Package adams.gui.tools.previewbrowser
Class PropertiesManager
- java.lang.Object
-
- adams.gui.tools.previewbrowser.PropertiesManager
-
public class PropertiesManager extends Object
Manages the properties.- Author:
- FracPete (fracpete at waikato dot ac dot nz)
-
-
Field Summary
Fields Modifier and Type Field Description static StringFILENAMEthe name of the props file.protected static Set<String>m_Blacklistedthe blacklisted handlers.protected static Propertiesm_Propertiesthe properties.static StringPREFIX_CUSTOM_CONTENT_HANDLERthe prefix for the custom content handler keys in the props file.static StringPREFIX_PREFERRED_ARCHIVE_HANDLERthe prefix for the preferred archive handler keys in the props file.static StringPREFIX_PREFERRED_CONTENT_HANDLERthe prefix for the preferred content handler keys in the props file.
-
Constructor Summary
Constructors Constructor Description PropertiesManager()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static ContentHandlergetCustomContentHandler(ContentHandler handler)Returns any custom content handler for the class.static ContentHandlergetCustomContentHandler(Class cls)Returns any custom content handler for the class.static ArchiveHandlergetPreferredArchiveHandler(File file)Returns the preferred archive handler.static ContentHandlergetPreferredContentHandler(File file)Returns the preferred content handler.static PropertiesgetProperties()Returns the properties that define the editor.protected static booleansave(String action)Saves the properties.static booleansetCustomContentHandler(ContentHandler handler)Stores the custom setup of the handler.static booleanupdatePreferredArchiveHandler(String[] ext, String handler)Updates the preferred archive handler.static booleanupdatePreferredContentHandler(String[] ext, ContentHandler handler)Updates the preferred content handler.
-
-
-
Field Detail
-
FILENAME
public static final String FILENAME
the name of the props file.- See Also:
- Constant Field Values
-
PREFIX_PREFERRED_ARCHIVE_HANDLER
public static final String PREFIX_PREFERRED_ARCHIVE_HANDLER
the prefix for the preferred archive handler keys in the props file.- See Also:
- Constant Field Values
-
PREFIX_PREFERRED_CONTENT_HANDLER
public static final String PREFIX_PREFERRED_CONTENT_HANDLER
the prefix for the preferred content handler keys in the props file.- See Also:
- Constant Field Values
-
PREFIX_CUSTOM_CONTENT_HANDLER
public static final String PREFIX_CUSTOM_CONTENT_HANDLER
the prefix for the custom content handler keys in the props file.- See Also:
- Constant Field Values
-
m_Properties
protected static Properties m_Properties
the properties.
-
-
Method Detail
-
getPreferredContentHandler
public static ContentHandler getPreferredContentHandler(File file)
Returns the preferred content handler.- Parameters:
file- the file to get the preferred handler for- Returns:
- the preferred handler
-
updatePreferredContentHandler
public static boolean updatePreferredContentHandler(String[] ext, ContentHandler handler)
Updates the preferred content handler.- Parameters:
ext- the extension to updatehandler- the preferred handler- Returns:
- true if successfully updated
-
getPreferredArchiveHandler
public static ArchiveHandler getPreferredArchiveHandler(File file)
Returns the preferred archive handler.- Parameters:
file- the file to get the preferred handler for- Returns:
- the preferred handler
-
updatePreferredArchiveHandler
public static boolean updatePreferredArchiveHandler(String[] ext, String handler)
Updates the preferred archive handler.- Parameters:
ext- the extension to updatehandler- the preferred handler- Returns:
- true if successfully updated
-
getCustomContentHandler
public static ContentHandler getCustomContentHandler(Class cls)
Returns any custom content handler for the class. If not available, then just an instance of the class.- Parameters:
cls- the handler class to get the custom setup for- Returns:
- the custom setup (or just an instance of the class), null if failed to instantiate
-
getCustomContentHandler
public static ContentHandler getCustomContentHandler(ContentHandler handler)
Returns any custom content handler for the class. If not available, then just the provided instance.- Parameters:
handler- the handler to get the custom setup for- Returns:
- the custom setup (or just the input)
-
setCustomContentHandler
public static boolean setCustomContentHandler(ContentHandler handler)
Stores the custom setup of the handler. If just default options, then it gets ignored.- Parameters:
handler- the custom handler to update in props file- Returns:
- true if updated
-
save
protected static boolean save(String action)
Saves the properties.- Parameters:
action- what triggered the save action- Returns:
- true if successful
-
getProperties
public static Properties getProperties()
Returns the properties that define the editor.- Returns:
- the properties
-
-