org.grinvin.workspace

Class DefaultWindowWrapper<W,extends,Window>

Implemented Interfaces:
Wrapper<C>
Known Direct Subclasses:
ConjecturingWindowWrapper, EditorWindowWrapper, GraphBrowserWindowWrapper, GrinvinWindowWrapper, LoggingWindowWrapper

public abstract class DefaultWindowWrapper<W,extends,Window>
extends java.lang.Object
implements Wrapper<C>

Common super class of all wrappers that manage a single window of type W.

Method Summary

protected Element
baseElement()
Create a JDOM-element that contains the version information.
abstract W
create()
Create the subcomponent(s) managed by this wrapper.
void
dispose(W window)
This implementation disposes of the associated window.
int
getMajorVersion()
This format has version 1.0
int
getMinorVersion()
This format has version 1.0
W
load(Element element, File directory)
This implementation creates the window using create() and sets window bounds and visibility from the information in the workspace XML-file.
protected static void
loadWindowProperties(Element element, Window window)
General purpose routine which can be used to set bounds and visbility of any window.
void
save(W window, Element parent, File directory)
This implementation saves the information obtained from the method baseElement() and saveWindowProperties(Element,Window) into parent and leaves the directory alone.
protected static void
saveWindowProperties(Element element, Window window)
General purpose routine which can be used to save the bounds and visibility of any window.

Method Details

baseElement

protected final Element baseElement()
Create a JDOM-element that contains the version information. Further attributes and contents should be added later.

create

public abstract W create()
Create the subcomponent(s) managed by this wrapper. This is typically called when the system is started with no persisted workspace available.
Specified by:
create in interface Wrapper<C>
Returns:
the newly created subcomponent

dispose

public void dispose(W window)
This implementation disposes of the associated window.

getMajorVersion

public int getMajorVersion()
This format has version 1.0
Specified by:
getMajorVersion in interface Wrapper<C>

getMinorVersion

public int getMinorVersion()
This format has version 1.0
Specified by:
getMinorVersion in interface Wrapper<C>

load

public W load(Element element,
              File directory)
            throws IOException
This implementation creates the window using create() and sets window bounds and visibility from the information in the workspace XML-file.
Specified by:
load in interface Wrapper<C>

loadWindowProperties

protected static void loadWindowProperties(Element element,
                                           Window window)
            throws IOFormatException
General purpose routine which can be used to set bounds and visbility of any window.

save

public void save(W window,
                 Element parent,
                 File directory)
            throws IOException

saveWindowProperties

protected static void saveWindowProperties(Element element,
                                           Window window)
General purpose routine which can be used to save the bounds and visibility of any window.