org.grinvin.workspace

Interface Wrapper<C>

Known Implementing Classes:
ConjecturingWindowWrapper, DefaultWindowWrapper<W,extends,Window>, EditorWindowWrapper, GraphBrowserWindowWrapper, GrinvinWindowWrapper, LoggingWindowWrapper

public interface Wrapper<C>

An object of this type manages the life cycle of one or more subcomponents of the GrInVin system, of type . Wrappers are typically stateless objects one instance of which can be reused to manage different component objects of the same type .

Method Summary

C
create()
Create the subcomponent(s) managed by this wrapper.
void
dispose(C component)
Dispose of the given subcomponent.
String
getElementName()
Return the XML-element name by which this type of wrapper is identified within its parent.
int
getMajorVersion()
Return the major version of the format used by this wrapper.
int
getMinorVersion()
Return the minor version of the format used by this wrapper.
C
load(Element element, File directory)
Load the subcomponent(s) managed by this wrapper from a persistent work space.
void
save(C component, Element parent, File directory)
Save the given subcomponent.

Method Details

create

public C create()
Create the subcomponent(s) managed by this wrapper. This is typically called when the system is started with no persisted workspace available.
Returns:
the newly created subcomponent

dispose

public void dispose(C component)
Dispose of the given subcomponent. Typically disposes windows, clears caches, etc.

getElementName

public String getElementName()
Return the XML-element name by which this type of wrapper is identified within its parent.

getMajorVersion

public int getMajorVersion()
Return the major version of the format used by this wrapper. If non-zero a version string will be stored with the XML-element.

getMinorVersion

public int getMinorVersion()
Return the minor version of the format used by this wrapper.

load

public C load(Element element,
              File directory)
            throws IOException
Parameters:
element - JDOM element which stores extra information about this wrapper.
directory - Workspace directory
Returns:
the object which was loaded

save

public void save(C component,
                 Element parent,
                 File directory)
            throws IOException
Save the given subcomponent.
Parameters:
component - Subcomponent to be saved
parent - parent JDOM element into which the JDOM element(s) for this wrapper must be stored.
directory - Workspace directory