public class DataSetManager extends Object
Constructor and Description |
---|
DataSetManager()
Default constructor initializing required fields.
|
Modifier and Type | Method and Description |
---|---|
void |
addDataSet(DataSet newDataSet)
Add a Dataset to this Manager.
|
void |
addDataSetAboutToBeChangedListener(DataSetAboutToBeChangedListener listener)
Add a Listener that needs to be informed, if a dataset state is about to be changed, before the change actually happened
|
void |
addDataSetChangeListener(DataSetChangeListener listener)
Add a Listener that needs to be informed, if a dataset state was changed
|
void |
clearDataSets()
Clear all Datasets, and inform any listeners that the sets are being removed.
|
DataSet |
createDataSet(boolean TwoCols,
String DataSetTypeName,
String SetDescription,
IDAREWorkbook dsWorkBook)
Create a Dataset based on properties and a DataSetFile.
|
void |
deregisterDataSetReader(IDAREDatasetReader reader)
DeRegister a
IDAREDatasetReader . |
void |
deRegisterDataSetType(String TypeName,
Class<? extends DataSet> dataSetClass)
Remove a class from the available Datasetclasses.
|
void |
deregisterPropertiesForDataSet(Class<? extends DataSet> classType,
DataSetLayoutProperties properties)
Deregister Properties for a DataSet
|
Collection<String> |
getAvailableDataSetTypes()
Get the Types of Datasets available to this Manager.
|
Vector<IDAREDatasetReader> |
getAvailableReaders()
Get all
IDAREDatasetReader s currently registered with IDARE. |
DataSet |
getDataSetForID(Integer id)
Get the dataset with the specified ID from this manager.
|
Collection<DataSet> |
getDataSets() |
void |
handleEvent(org.cytoscape.session.events.SessionAboutToBeSavedEvent arg0)
Handle A
SessionAboutToBeSavedEvent , ad add data of the DataManger to this Event. |
void |
handleEvent(org.cytoscape.session.events.SessionLoadedEvent arg0)
Handle A SessionLoadedevent, since order is relevant this object is not directly a listener but gets the command from a listener.
|
void |
registerDataSetReader(IDAREDatasetReader reader)
Register a
IDAREDatasetReader to be available for file reading. |
void |
registerDataSetType(String TypeName,
Class<? extends DataSet> dataSetClass)
Register a DataSetType that can be accessed by the TypeName.
|
Collection<DataSetLayoutProperties> |
registerPropertiesForDataSet(Class<? extends DataSet> classType,
Collection<DataSetLayoutProperties> properties)
Register a set of properties for a datasetclass.
|
boolean |
registerPropertiesForDataSet(Class<? extends DataSet> classType,
DataSetLayoutProperties properties)
Add DataSetProperties for a specific dataset
|
void |
removeDataSet(DataSet setToRemove)
Remove a
DataSet from this Manager |
void |
removeDataSetAboutToBeChangedListener(DataSetAboutToBeChangedListener listener)
Remove a
DataSetAboutToBeChangedListener listening to changes in DataSet s |
void |
removeDataSetChangeListener(DataSetChangeListener listener)
Remove a Listener that needs to be informed, if a dataset state was changed
|
void |
reset()
Reset this DataSetManager clearing all datastructures.
|
public DataSetManager()
public void clearDataSets()
public Collection<String> getAvailableDataSetTypes()
Collection
of String
s of available DataSet
typespublic void registerDataSetType(String TypeName, Class<? extends DataSet> dataSetClass) throws DuplicateIDException
TypeName
- the TypeName (string description) of the registered DataSetTypedataSetClass
- The Class of the DataSetDuplicateIDException
- IF an ID for a type of dataset is already presentpublic void deRegisterDataSetType(String TypeName, Class<? extends DataSet> dataSetClass)
TypeName
- the TypeName (string description) of the deregistered DataSetTypedataSetClass
- The Class of the DataSetpublic boolean registerPropertiesForDataSet(Class<? extends DataSet> classType, DataSetLayoutProperties properties)
classType
- The class to register the properties forproperties
- The properties to make available for the given classpublic Collection<DataSetLayoutProperties> registerPropertiesForDataSet(Class<? extends DataSet> classType, Collection<DataSetLayoutProperties> properties)
classType
- the class of the dataset which to register the properties for.properties
- the property options for the dataset that should eb registered.public void deregisterPropertiesForDataSet(Class<? extends DataSet> classType, DataSetLayoutProperties properties)
classType
- the class of the dataset to deregister items for.properties
- the properties to deregister.public void addDataSetAboutToBeChangedListener(DataSetAboutToBeChangedListener listener)
listener
- the DataSetAboutToBeChangedListener
that listenspublic void removeDataSetAboutToBeChangedListener(DataSetAboutToBeChangedListener listener)
DataSetAboutToBeChangedListener
listening to changes in DataSet
slistener
- the DataSetAboutToBeChangedListener
that listenspublic void addDataSetChangeListener(DataSetChangeListener listener)
listener
- the DataSetChangeListener
that listenspublic void removeDataSetChangeListener(DataSetChangeListener listener)
listener
- the DataSetChangeListener
that listenspublic Collection<DataSet> getDataSets()
public void addDataSet(DataSet newDataSet)
newDataSet
- The Dataset to addpublic void removeDataSet(DataSet setToRemove)
DataSet
from this ManagersetToRemove
- the Dataset to removepublic DataSet getDataSetForID(Integer id)
id
- the requested IDDataSet
or null
if no set has this id.public void reset()
public void handleEvent(org.cytoscape.session.events.SessionLoadedEvent arg0)
arg0
- the SessionLoadedEvent
to obtain data frompublic Vector<IDAREDatasetReader> getAvailableReaders()
IDAREDatasetReader
s currently registered with IDARE.Vector
of DataSetReaders in the reverse order of their addition to IDARE.public DataSet createDataSet(boolean TwoCols, String DataSetTypeName, String SetDescription, IDAREWorkbook dsWorkBook) throws ExecutionException, WrongFormat, org.apache.poi.openxml4j.exceptions.InvalidFormatException, DuplicateIDException, IOException, ClassNotFoundException, InstantiationException, IllegalAccessException
TwoCols
- indicator whether to use twoColumn ID IndicatorsDataSetTypeName
- Class name of the datasetSetDescription
- Description of the DatasetdsWorkBook
- The IDAREWorkbook
to use for this DataSet
WrongFormat
- Depending on the Dataset specific properties have to be matched by the fileorg.apache.poi.openxml4j.exceptions.InvalidFormatException
- Depending on the Dataset specific properties have to be matched by the fileDuplicateIDException
- Depending on the Dataset specific properties have to be matched by the fileIOException
- if IO on the workbook failedExecutionException
- if something during the processing went wrongClassNotFoundException
- if the class for the Dataset is not foundIllegalAccessException
- if something wents off with accessInstantiationException
- if the Dataset cannot be instantiatedpublic void handleEvent(org.cytoscape.session.events.SessionAboutToBeSavedEvent arg0)
SessionAboutToBeSavedEvent
, ad add data of the DataManger to this Event.
Since order is necessary this class does not itself implement the SessionLoaded/Saved mechanism but relies on a managing class to keep the order of actions.arg0
- a SessionAboutToBeSavedEvent
public void registerDataSetReader(IDAREDatasetReader reader)
IDAREDatasetReader
to be available for file reading.
Readers are used in their reverse order of registration. i.e. the later a reader was registered, the higher its precedence of usage.
Multiple readers for the same file extensions can be available, and thus the latest registered reader will be tried first.reader
- the reader to addpublic void deregisterDataSetReader(IDAREDatasetReader reader)
IDAREDatasetReader
. It will no longer be available for Datsetreading.reader
- the reader to deregisterCopyright © 2018. All rights reserved.