Class FileBrowserSource
- java.lang.Object
-
- adams.core.logging.LoggingObject
-
- adams.core.logging.CustomLoggingLevelObject
-
- adams.gui.tools.spreadsheetprocessor.AbstractWidget
-
- adams.gui.tools.spreadsheetprocessor.sources.AbstractSource
-
- adams.gui.tools.spreadsheetprocessor.sources.FileBrowserSource
-
- All Implemented Interfaces:
LoggingLevelHandler
,LoggingSupporter
,SizeOfHandler
,Serializable
,Comparable<AbstractWidget>
public class FileBrowserSource extends AbstractSource
For browsing files and reading them.- Author:
- FracPete (fracpete at waikato dot ac dot nz)
- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description static String
KEY_DIRECTORY
static String
KEY_READER
protected BaseButton
m_ButtonLoad
the button for loading.protected SpreadSheet
m_Data
the data.protected boolean
m_IgnoreDirUpdates
whether to ignore dir updates.protected DirectoryChooserPanel
m_PanelDirectory
the directory to browse.protected FilePanel
m_PanelFiles
the list of files.protected GenericObjectEditorPanel
m_PanelReader
the reader to use.protected BasePanel
m_Widget
the widget.-
Fields inherited from class adams.gui.tools.spreadsheetprocessor.AbstractWidget
m_Owner
-
Fields inherited from class adams.core.logging.LoggingObject
m_Logger, m_LoggingIsEnabled, m_LoggingLevel
-
-
Constructor Summary
Constructors Constructor Description FileBrowserSource()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
assign(AbstractWidget other)
Retrieves the values from the other widget, if possible.void
deserialize(Object data, MessageCollection errors)
Deserializes the setup and maps it onto the widget.File
getCurrentDirectory()
Returns the current directory.File
getCurrentFile()
Returns the current file.SpreadSheetReader
getCurrentReader()
Returns the current reader.SpreadSheet
getData()
Returns the currently available dataString
getName()
Returns the name of the widget.Component
getWidget()
Returns the widget.boolean
hasData()
Checks whether data is available.protected void
load()
Loads the dataObject
serialize()
Serializes the setup from the widget.void
setCurrentDirectory(File value)
Sets the current directory.void
setCurrentReader(SpreadSheetReader reader)
Sets the current reader.void
update()
Updates the widget.-
Methods inherited from class adams.gui.tools.spreadsheetprocessor.AbstractWidget
compareTo, equals, getOwner, notifyOwner, setOwner, toString
-
Methods inherited from class adams.core.logging.CustomLoggingLevelObject
setLoggingLevel
-
Methods inherited from class adams.core.logging.LoggingObject
configureLogger, getLogger, getLoggingLevel, initializeLogging, isLoggingEnabled, sizeOf
-
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface adams.core.logging.LoggingLevelHandler
getLoggingLevel
-
-
-
-
Field Detail
-
KEY_DIRECTORY
public static final String KEY_DIRECTORY
- See Also:
- Constant Field Values
-
KEY_READER
public static final String KEY_READER
- See Also:
- Constant Field Values
-
m_Widget
protected BasePanel m_Widget
the widget.
-
m_PanelDirectory
protected DirectoryChooserPanel m_PanelDirectory
the directory to browse.
-
m_PanelFiles
protected FilePanel m_PanelFiles
the list of files.
-
m_PanelReader
protected GenericObjectEditorPanel m_PanelReader
the reader to use.
-
m_ButtonLoad
protected BaseButton m_ButtonLoad
the button for loading.
-
m_Data
protected SpreadSheet m_Data
the data.
-
m_IgnoreDirUpdates
protected boolean m_IgnoreDirUpdates
whether to ignore dir updates.
-
-
Method Detail
-
getName
public String getName()
Returns the name of the widget.- Specified by:
getName
in classAbstractWidget
- Returns:
- the name
-
getWidget
public Component getWidget()
Returns the widget.- Specified by:
getWidget
in classAbstractWidget
- Returns:
- the widget
-
load
protected void load()
Loads the data
-
hasData
public boolean hasData()
Checks whether data is available.- Specified by:
hasData
in classAbstractSource
- Returns:
- true if available
-
getData
public SpreadSheet getData()
Returns the currently available data- Specified by:
getData
in classAbstractSource
- Returns:
- the data, null if none available
-
setCurrentDirectory
public void setCurrentDirectory(File value)
Sets the current directory.- Parameters:
value
- the current directory
-
getCurrentDirectory
public File getCurrentDirectory()
Returns the current directory.- Returns:
- the current directory
-
getCurrentFile
public File getCurrentFile()
Returns the current file.- Returns:
- the current file
-
setCurrentReader
public void setCurrentReader(SpreadSheetReader reader)
Sets the current reader.- Parameters:
reader
- the current reader
-
getCurrentReader
public SpreadSheetReader getCurrentReader()
Returns the current reader.- Returns:
- the current reader
-
assign
public void assign(AbstractWidget other)
Retrieves the values from the other widget, if possible.- Specified by:
assign
in classAbstractWidget
- Parameters:
other
- the other widget to get the values from
-
serialize
public Object serialize()
Serializes the setup from the widget.- Specified by:
serialize
in classAbstractWidget
- Returns:
- the generated setup representation
-
deserialize
public void deserialize(Object data, MessageCollection errors)
Deserializes the setup and maps it onto the widget. /** Deserializes the setup and maps it onto the widget.- Specified by:
deserialize
in classAbstractWidget
- Parameters:
data
- the setup representation to useerrors
- for collecting errors
-
update
public void update()
Updates the widget.- Specified by:
update
in classAbstractWidget
-
-