Package adams.gui.tools.previewbrowser
Class AbstractObjectContentHandler
- java.lang.Object
-
- adams.core.logging.LoggingObject
-
- adams.core.logging.CustomLoggingLevelObject
-
- adams.core.option.AbstractOptionHandler
-
- adams.gui.tools.previewbrowser.AbstractContentHandler
-
- adams.gui.tools.previewbrowser.AbstractObjectContentHandler
-
- All Implemented Interfaces:
Destroyable
,GlobalInfoSupporter
,LoggingLevelHandler
,LoggingSupporter
,OptionHandler
,SizeOfHandler
,ContentHandler
,ObjectContentHandler
,Serializable
- Direct Known Subclasses:
ObjectAnnotationsReportHandler
,PlainTextHandler
,ReportHandler
public abstract class AbstractObjectContentHandler extends AbstractContentHandler implements ObjectContentHandler
Ancestor for content handlers that handle files and objects.- Author:
- fracpete (fracpete at waikato dot ac dot nz)
- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description protected static Map<Class,List<Class<? extends ObjectContentHandler>>>
m_ObjectHandlerMapping
the cache for managed classes.-
Fields inherited from class adams.gui.tools.previewbrowser.AbstractContentHandler
m_Relation
-
Fields inherited from class adams.core.option.AbstractOptionHandler
m_OptionManager
-
Fields inherited from class adams.core.logging.LoggingObject
m_Logger, m_LoggingIsEnabled, m_LoggingLevel
-
Fields inherited from interface adams.gui.tools.previewbrowser.ContentHandler
MATCH_ALL
-
-
Constructor Summary
Constructors Constructor Description AbstractObjectContentHandler()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
canHandle(Object obj)
Checks whether the object is handled by this content handler.protected String
checkObject(Object obj)
Hook method for checks before generating the preview.static String[]
getObjectHandlers()
Returns a list with classnames of handlers.static List<Class<? extends ObjectContentHandler>>
getObjectHandlersFor(Class cls)
Returns the handlers registered for the class.static List<Class<? extends ObjectContentHandler>>
getObjectHandlersFor(Object obj)
Returns the handlers registered for the object.PreviewPanel
getPreview(Object obj)
Returns the preview for the specified object.static boolean
hasObjectHandler(Class cls)
Checks whether the specified class can be managed.static boolean
hasObjectHandler(Object obj)
Checks whether the specified object can be managed.PreviewPanel
reusePreview(Object obj, PreviewPanel lastPreview)
Reuses the last preview, if possible.-
Methods inherited from class adams.gui.tools.previewbrowser.AbstractContentHandler
checkFile, createPreview, getHandlers, getHandlersForFile, getHandlersForFile, getPreview, getRelation, hasHandler, hasHandler, reusePreview
-
Methods inherited from class adams.core.option.AbstractOptionHandler
cleanUpOptions, defineOptions, destroy, finishInit, getDefaultLoggingLevel, getOptionManager, globalInfo, initialize, loggingLevelTipText, newOptionManager, reset, setLoggingLevel, toCommandLine, toString
-
Methods inherited from class adams.core.logging.LoggingObject
configureLogger, getLogger, getLoggingLevel, initializeLogging, isLoggingEnabled, sizeOf
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface adams.gui.tools.previewbrowser.ContentHandler
createPreview, getExtensions, getPreview, reusePreview
-
Methods inherited from interface adams.core.Destroyable
destroy
-
Methods inherited from interface adams.core.logging.LoggingLevelHandler
getLoggingLevel
-
Methods inherited from interface adams.gui.tools.previewbrowser.ObjectContentHandler
canHandle, createPreview
-
Methods inherited from interface adams.core.option.OptionHandler
cleanUpOptions, defineOptions, getOptionManager, toCommandLine
-
-
-
-
Field Detail
-
m_ObjectHandlerMapping
protected static Map<Class,List<Class<? extends ObjectContentHandler>>> m_ObjectHandlerMapping
the cache for managed classes.
-
-
Method Detail
-
reusePreview
public PreviewPanel reusePreview(Object obj, PreviewPanel lastPreview)
Reuses the last preview, if possible.
Default implementation just creates a new preview.- Specified by:
reusePreview
in interfaceObjectContentHandler
- Parameters:
obj
- the object to create the view for- Returns:
- the preview
-
canHandle
public boolean canHandle(Object obj)
Checks whether the object is handled by this content handler.- Specified by:
canHandle
in interfaceObjectContentHandler
- Parameters:
obj
- the object to check- Returns:
- true if handled
-
checkObject
protected String checkObject(Object obj)
Hook method for checks before generating the preview.- Parameters:
obj
- the object to check- Returns:
- null if checks passed, otherwise error message
-
getPreview
public PreviewPanel getPreview(Object obj)
Returns the preview for the specified object.- Specified by:
getPreview
in interfaceObjectContentHandler
- Parameters:
obj
- the object to create the view for- Returns:
- the preview, NoPreviewAvailablePanel in case of an error
- See Also:
NoPreviewAvailablePanel
-
getObjectHandlers
public static String[] getObjectHandlers()
Returns a list with classnames of handlers.- Returns:
- the handler classnames
-
hasObjectHandler
public static boolean hasObjectHandler(Object obj)
Checks whether the specified object can be managed.- Parameters:
obj
- the object to check- Returns:
- true if the object represents a managed object
-
hasObjectHandler
public static boolean hasObjectHandler(Class cls)
Checks whether the specified class can be managed.- Parameters:
cls
- the object to check- Returns:
- true if the object represents a managed object
-
getObjectHandlersFor
public static List<Class<? extends ObjectContentHandler>> getObjectHandlersFor(Object obj)
Returns the handlers registered for the object.- Parameters:
obj
- the object to get the handlers for- Returns:
- the handlers, null if none available
-
getObjectHandlersFor
public static List<Class<? extends ObjectContentHandler>> getObjectHandlersFor(Class cls)
Returns the handlers registered for the class.- Parameters:
cls
- the class to get the handlers for- Returns:
- the handlers, null if none available
-
-