Class JAlbumUtilities


  • public class JAlbumUtilities
    extends java.lang.Object
    Miscellaneous JAlbum related utility methods that doesn't fit elsewhere
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static CategoryCounters countCategories​(java.util.List<AlbumObject> objects, CategoryCounters counters, boolean recursive)
      For jAlbum use only
      static CategoryCounters countCategories​(AlbumObject folder)
      Return an object holding the number of objects per category under this folder.
      Usage examples:
      JAlbumUtilities.countCategories(currentFolder).getCount(Category.image); // Get number of images in current folder
      JAlbumUtilities.countCategories(currentFolder).getCount(Category.webPage); // Get number of web pages in current folder
      JAlbumUtilities.countCategories(currentFolder).getTotalCount()); // Get total number of objects in current folder
      JAlbumUtilities.countCategories(currentFolder).getFileCount()); // Get total number of files (not folders) in current folder
      JAlbumUtilities.countCategories(rootFolder, true); // Get total number of objects per category in album
      static CategoryCounters countCategories​(AlbumObject folder, boolean recursive)  
      static CategoryCounters countCategories​(AlbumObject folder, CategoryCounters counters, boolean recursive)
      Return an object holding the number of objects per category under this folder
      static int countComponentTree​(javax.swing.JComponent root)
      Internal tests.
      static long deepLastModified​(AlbumObject folder)  
      static void fillCombo​(javax.swing.JComboBox combo, java.io.File dir, java.io.FileFilter filter)  
      static void fillCombo​(javax.swing.JComboBox combo, ChainedDirectory dir, java.io.FileFilter filter)  
      static DateRange getCameraDates​(AlbumObject folder)
      Get the first and last camera date of the included objects of given folder.
      static DateRange getDeepCameraDates​(AlbumObject folder)
      Get the first and last camera date of the included objects of given folder and its sub folders.
      static long getDeepLastAdded​(AlbumObject folder)
      For folders, returns the newest added date (getWhenAdded) of objects within the folder and its sub folders that are included, not hidden and not folders
      static long getLastAdded​(AlbumObject folder)
      For folders, returns the newest added date (getWhenAdded) of objects within the folder that are included, not hidden and not folders
      static java.util.Map getOrdinaryVariables​(java.util.Properties props)  
      static java.util.Map getSkinVariables​(java.util.Properties props)  
      static AlbumObject getThemeObject​(AlbumObject folder)
      Get the theme image object for the specified folder.
      static java.util.Map getUserVariables​(java.util.Properties props)  
      static boolean hasWebPages​(AlbumObject folder)
      Test if the passed folder contains any web template pages Skins can use this test to determine if to include top-level navigation links for instance
      static java.util.Properties importProject​(java.io.File projectFile)  
      static boolean isDirty​(java.io.File dest, java.io.File source)
      Return true if either dest does not exist or is older than source
      static boolean isDirty​(java.io.File dest, AlbumObject source)
      Return true if either dest does not exist or is older than source New since v13.3: Also considers videos with updated representing images dirty
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Method Detail

      • importProject

        public static java.util.Properties importProject​(java.io.File projectFile)
                                                  throws java.io.IOException
        Throws:
        java.io.IOException
      • countComponentTree

        public static int countComponentTree​(javax.swing.JComponent root)
        Internal tests. Don't use
        Parameters:
        root -
        Returns:
      • fillCombo

        public static void fillCombo​(javax.swing.JComboBox combo,
                                     java.io.File dir,
                                     java.io.FileFilter filter)
      • fillCombo

        public static void fillCombo​(javax.swing.JComboBox combo,
                                     ChainedDirectory dir,
                                     java.io.FileFilter filter)
      • getUserVariables

        public static java.util.Map getUserVariables​(java.util.Properties props)
      • getSkinVariables

        public static java.util.Map getSkinVariables​(java.util.Properties props)
      • getOrdinaryVariables

        public static java.util.Map getOrdinaryVariables​(java.util.Properties props)
      • hasWebPages

        public static boolean hasWebPages​(AlbumObject folder)
        Test if the passed folder contains any web template pages Skins can use this test to determine if to include top-level navigation links for instance
        Since:
        10.4
      • countCategories

        public static CategoryCounters countCategories​(AlbumObject folder)
                                                throws CircularFolderReferenceException
        Return an object holding the number of objects per category under this folder.
        Usage examples:
        JAlbumUtilities.countCategories(currentFolder).getCount(Category.image); // Get number of images in current folder
        JAlbumUtilities.countCategories(currentFolder).getCount(Category.webPage); // Get number of web pages in current folder
        JAlbumUtilities.countCategories(currentFolder).getTotalCount()); // Get total number of objects in current folder
        JAlbumUtilities.countCategories(currentFolder).getFileCount()); // Get total number of files (not folders) in current folder
        JAlbumUtilities.countCategories(rootFolder, true); // Get total number of objects per category in album
        Parameters:
        folder -
        Returns:
        Throws:
        CircularFolderReferenceException
        See Also:
        CategoryCounters
      • countCategories

        public static CategoryCounters countCategories​(AlbumObject folder,
                                                       CategoryCounters counters,
                                                       boolean recursive)
        Return an object holding the number of objects per category under this folder
        Parameters:
        folder -
        Returns:
      • getThemeObject

        public static AlbumObject getThemeObject​(AlbumObject folder)
        Get the theme image object for the specified folder. Will fall back to delivering the representing object if an explicit theme image hasn't been set and the folder hasn't had its theme image explicitly removed.
        Parameters:
        folder - Theme object for folder or null if no theme image designated
        Returns:
        Since:
        15
      • deepLastModified

        public static long deepLastModified​(AlbumObject folder)
                                     throws java.io.IOException
        Throws:
        java.io.IOException
      • getDeepCameraDates

        public static DateRange getDeepCameraDates​(AlbumObject folder)
        Get the first and last camera date of the included objects of given folder and its sub folders. Relies on disk based cacheing for speed
        Parameters:
        folder -
        Returns:
        DateRange object specifying the first and last camera dates
        Since:
        14.1
      • getCameraDates

        public static DateRange getCameraDates​(AlbumObject folder)
        Get the first and last camera date of the included objects of given folder. Relies on disk based cacheing for speed
        Parameters:
        folder -
        Returns:
        DateRange object specifying the first and last camera dates
        Since:
        14.1
      • getLastAdded

        public static long getLastAdded​(AlbumObject folder)
        For folders, returns the newest added date (getWhenAdded) of objects within the folder that are included, not hidden and not folders
        Returns:
        last added date formatted as the number of milliseconds since epoch or zero if no objects added at all
        Since:
        11.6
      • getDeepLastAdded

        public static long getDeepLastAdded​(AlbumObject folder)
        For folders, returns the newest added date (getWhenAdded) of objects within the folder and its sub folders that are included, not hidden and not folders
        Returns:
        last added date formatted as the number of milliseconds since epoch or zero if no objects added at all
        Since:
        11.6
      • isDirty

        public static boolean isDirty​(java.io.File dest,
                                      AlbumObject source)
        Return true if either dest does not exist or is older than source New since v13.3: Also considers videos with updated representing images dirty
        Since:
        v11
      • isDirty

        public static boolean isDirty​(java.io.File dest,
                                      java.io.File source)
        Return true if either dest does not exist or is older than source
        Since:
        v11