Package se.datadosen.jalbum
Class JAlbumUtilities
java.lang.Object
se.datadosen.jalbum.JAlbumUtilities
Miscellaneous JAlbum related utility methods that doesn't fit elsewhere
-
Method Summary
Modifier and TypeMethodDescriptionstatic CategoryCounters
countCategories
(List<AlbumObject> objects, CategoryCounters counters, boolean recursive) For jAlbum use onlystatic 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 albumstatic 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 folderstatic int
countComponentTree
(JComponent root) Internal tests.static long
deepLastModified
(AlbumObject folder) static long
deepLastModified
(AlbumObject folder, ForkJoinPool pool) Variant of deepLastModified accepting a ForkJoinPool to control parallelism, isolation and abortion of long running calculation.static void
fillCombo
(JComboBox combo, File dir, FileFilter filter) static void
fillCombo
(JComboBox combo, ChainedDirectory dir, 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 foldersstatic long
getLastAdded
(AlbumObject folder) For folders, returns the newest added date (getWhenAdded) of objects within the folder that are included, not hidden and not foldersstatic Map
getOrdinaryVariables
(Properties props) static Map
getSkinVariables
(Properties props) static AlbumObject
getThemeObject
(AlbumObject folder) Get the theme image object for the specified folder.static Map
getUserVariables
(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 instancestatic Properties
importProject
(File projectFile) static boolean
Return true if either dest does not exist or is older than sourcestatic boolean
isDirty
(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 dirtystatic void
Ensure that passed code runs on the AWT thread If caller is on the AWT thread already, simply execute the code, otherwise put it onto the event queue for later dispatchingstatic ScheduledFuture<?>
Submits a one-shot task that becomes enabled after the given delay.static <V> ScheduledFuture<V>
Submits a value-returning one-shot task that becomes enabled after the given delay.
-
Method Details
-
importProject
- Throws:
IOException
-
countComponentTree
Internal tests. Don't use- Parameters:
root
-- Returns:
-
fillCombo
-
fillCombo
-
getUserVariables
-
getSkinVariables
-
getOrdinaryVariables
-
hasWebPages
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:
-
countCategories
-
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
-counters
-recursive
-- Returns:
-
countCategories
public static CategoryCounters countCategories(List<AlbumObject> objects, CategoryCounters counters, boolean recursive) For jAlbum use only- Since:
- 13
-
getThemeObject
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
- Throws:
IOException
-
deepLastModified
public static long deepLastModified(AlbumObject folder, ForkJoinPool pool) throws IOException, OperationAbortedException Variant of deepLastModified accepting a ForkJoinPool to control parallelism, isolation and abortion of long running calculation. Abort ongoing calculation by calling pool.shutdownNow();- Parameters:
folder
-pool
- create preferably with new ForkJoinPool(4)- Returns:
- Throws:
IOException
OperationAbortedException
- if aborted with pool.shutdownNow();- Since:
- 25.1
-
getDeepCameraDates
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
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
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
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
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
Return true if either dest does not exist or is older than source- Since:
- v11
-
runOnAWT
Ensure that passed code runs on the AWT thread If caller is on the AWT thread already, simply execute the code, otherwise put it onto the event queue for later dispatching- Parameters:
r
-- Since:
- 20
-
schedule
Submits a one-shot task that becomes enabled after the given delay.- Parameters:
command
- the task to executedelay
- the time from now to delay executionunit
- the time unit of the delay parameter- Returns:
- a ScheduledFuture representing pending completion of the task and
whose
get()
method will returnnull
upon completion - Throws:
NullPointerException
- if command or unit is null
-
schedule
Submits a value-returning one-shot task that becomes enabled after the given delay.- Type Parameters:
V
- the type of the callable's result- Parameters:
callable
- the function to executedelay
- the time from now to delay executionunit
- the time unit of the delay parameter- Returns:
- a ScheduledFuture that can be used to extract result or cancel
- Throws:
NullPointerException
- if callable or unit is null
-