bibliothek.gui.dock.common
Class CControl

java.lang.Object
  extended by bibliothek.gui.dock.common.CControl

public class CControl
extends Object

Manages the interaction between SingleCDockable, MultipleCDockable and CStations.
Clients should call read and write of the ApplicationResourceManager, accessible through getResources(), to store or load the configuration.
Clients which do no longer need a CControl can call destroy() to free resources.

Author:
Benjamin Sigg

Field Summary
static PropertyKey<CControl> CCONTROL
          A key for this CControl.
static String CONTENT_AREA_STATIONS_ID
          the unique id of the default-CContentArea created by this control
static String EXTERNALIZED_STATION_ID
          the unique id of the station that handles the externalized dockables
static PropertyKey<KeyStroke> KEY_CLOSE
          KeyStroke used to close a CDockable.
static PropertyKey<KeyStroke> KEY_GOTO_EXTERNALIZED
          KeyStroke used to change a CDockable into externalized-state.
static PropertyKey<KeyStroke> KEY_GOTO_MAXIMIZED
          KeyStroke used to change a CDockable into maximized-state.
static PropertyKey<KeyStroke> KEY_GOTO_MINIMIZED
          KeyStroke used to change a CDockable into minimized-state.
static PropertyKey<KeyStroke> KEY_GOTO_NORMALIZED
          KeyStroke used to change a CDockable into normalized-state.
static PropertyKey<KeyStroke> KEY_MAXIMIZE_CHANGE
          KeyStroke used to change a CDockable into maximized-state, or to go out of maximized-state when needed.
static PropertyKey<ConflictResolver<RequestDimension>> RESIZE_LOCK_CONFLICT_RESOLVER
          ConflictResolver used to determine what happens when there is a conflict between two resize requests on a SplitDockStation like CGridArea, CWorkingArea or CContentArea.
 
Constructor Summary
CControl()
          Creates a new control.
CControl(boolean restrictedEnvironment)
          Creates a new control
CControl(JFrame frame)
          Creates a new control
CControl(JFrame frame, boolean restrictedEnvironment)
          Creates a new control
CControl(JFrame frame, CControlFactory factory)
          Creates a new control
CControl(WindowProvider window)
          Creates a new control
CControl(WindowProvider window, boolean restrictedEnvironment)
          Creates a new control
CControl(WindowProvider window, CControlFactory factory)
          Creates a new control
 
Method Summary
 void add(CStation<?> station, boolean root)
          Adds an additional station to this control.
<M extends MultipleCDockable>
M
add(M dockable)
          Adds a dockable to this control.
<M extends MultipleCDockable>
M
add(M dockable, String uniqueId)
          Adds a dockable to this control.
<S extends SingleCDockable>
S
add(S dockable)
          Adds a dockable to this control.
 void add(String id, MultipleCDockableFactory<?,?> factory)
          Deprecated. use addMultipleDockableFactory(String, MultipleCDockableFactory)
 void addContentArea(CContentArea content)
          Deprecated. this method has not the same behavior as createContentArea(String), this method will either be removed in future releases or change its behavior
 void addControlListener(CControlListener listener)
          Adds a listener to this control.
 void addDestroyHook(DestroyHook hook)
          Adds a destroy-hook.
 void addDoubleClickListener(CDoubleClickListener listener)
          Adds a global mouse double click listener to this control.
 void addFocusListener(CFocusListener listener)
          Adds a new focus listener to this control.
 void addGlobalKeyListener(KeyListener listener)
          Adds a key listener to this control that will be informed about any KeyEvent that gets processed or analyzed by this control.
 void addKeyboardListener(CKeyboardListener listener)
          Adds a global keyboard listener to this control.
 void addMultipleDockableFactory(String id, MultipleCDockableFactory<?,?> factory)
          Adds a factory to this control.
 void addPropertyListener(CDockablePropertyListener listener)
          Adds a global property listener.
 void addResizeRequestListener(ResizeRequestListener listener)
          Adds a ResizeRequestListener to this CControl.
 void addSingleBackupFactory(String id, SingleCDockableBackupFactory backupFactory)
          Adds a backup factory to this control.
 void addStateListener(CDockableStateListener listener)
          Adds a global state listener.
 void addVetoClosingListener(CVetoClosingListener listener)
          Adds listener to this control, the listener will be informed whenever a set of CDockables is about to be closed.
 void addVetoFocusListener(CVetoFocusListener listener)
          Adds a new veto focus listener to this control.
 CContentArea createContentArea(String uniqueId)
          Creates and adds a new CContentArea.
 CGridArea createGridArea(String uniqueId)
          Creates a new area where normalized CDockables can be stored.
 CMinimizeArea createMinimizeArea(String uniqueId)
          Creates a new area where minimized CDockables can be stored.
 CWorkingArea createWorkingArea(String uniqueId)
          Creates and adds a new CWorkingArea to this control.
 void delete(String name)
          Deletes a layout that has been stored earlier.
 void destroy()
          Frees as much resources as possible.
 CDockable getCDockable(int index)
          Gets the index'th dockable that is registered in this control
 int getCDockableCount()
          Gets the number of CDockables that are registered in this CControl.
 CContentArea getContentArea()
          Gets the element that should be in the center of the mainframe.
 List<CContentArea> getContentAreas()
          Gets an unmodifiable list of all CContentAreas registered at this control
 CLocation getDefaultLocation()
          Gets the location where CDockables are opened when nothing else is specified.
 CControlFactory getFactory()
          Gets the factory which is mainly used to create new elements for this control.
 CLocationModeManager getLocationManager()
          Gets the manager that is responsible to handle all changes of the modes (maximized, normalized, ... ) of Dockables.
 CMaximizeBehavior getMaximizeBehavior()
          Gets the currently used maximize-behavior.
 MissingCDockableStrategy getMissingStrategy()
          Gets the strategy that tells what to do if layout information of a missing CDockable is found.
 MultipleCDockable getMultipleDockable(String id)
          Searches and returns the one MultipleCDockable which uses the unique identifier id.
 MultipleCDockableFactory<?,?> getMultipleDockableFactory(String id)
          Searches for the MultipleCDockableFactory with the identifier id.
 PreferenceModel getPreferenceModel()
          Gets the preference model which is used to translate between the preferences and this.
 PreferenceStorage getPreferences()
          Gets the storage container for PreferenceModels for this control.
<A> A
getProperty(PropertyKey<A> key)
          Gets the value of a property.
 CControlRegister getRegister()
          Gets the set of dockables, stations and other elemnts that are used by this control.
 ApplicationResourceManager getResources()
          Grants access to the manager that reads and stores configurations of the common-project.
 WindowProvider getRootWindow()
          Gets the root window of the application.
 SingleCDockableBackupFactory getSingleBackupFactory(String id)
          Searches for the SingleCDockableBackupFactory which was registered with the key id.
 SingleCDockable getSingleDockable(String id)
          Searches for the SingleCDockable which has the unique identifier id.
 CStation<?> getStation(DockStation intern)
          Searches the CStation whose internal representation is intern.
 CStation<?> getStation(String id)
          Searches the CStation with unique identifier id.
 List<CStation<?>> getStations()
          Gets an unmodifiable list of all stations that are currently registered at this control.
 ThemeMap getThemes()
          Gets the list of installed themes.
 void handleResizeRequests()
          Informs all ResizeRequestListeners, that the resize request of all CDockables should be processed.
 DockFrontend intern()
          Gets the representation of the layer beneath the common-layer.
 String[] layouts()
          Gets a list of all layouts that are currently known.
 void load(String name)
          Loads an earlier stored layout.
<A> void
putProperty(PropertyKey<A> key, A value)
          Changes the value of a property.
protected
<A> void
putProperty(PropertyKey<A> key, A value, Priority priority)
          Changes the value of a property.
 void read(DataInputStream in)
          Reads the current and other known layouts from in.
 void read(File file)
          Reads the current and other known layouts from file.
 void readXML(File file)
          Reads the current and other known layouts from file.
 void readXML(XElement element)
          Reads the current and other known layouts from element.
 void remove(CStation<?> station)
          Removes a CStation from this control.
 void remove(MultipleCDockable dockable)
          Removes a dockable from this control.
 boolean remove(SingleCDockable dockable)
          Removes dockable from this control.
 void removeContentArea(CContentArea content)
          Removes content from the list of known contentareas.
 void removeControlListener(CControlListener listener)
          Removes a listener from this control.
 void removeDestroyHook(DestroyHook hook)
          Removes a destroy-hook from this CControl.
 void removeDoubleClickListener(CDoubleClickListener listener)
          Removes a listener from this control.
 void removeFocusListener(CFocusListener listener)
          Removes a listener from this control.
 void removeGlobalKeyListener(KeyListener listener)
          Removes a global KeyListener from this control.
 void removeKeyboardListener(CKeyboardListener listener)
          Removes a listener from this control.
 void removeMultipleDockableFactory(String id)
          Removes the MultipleCDockableFactory with identifier id from this control.
 void removePropertyListener(CDockablePropertyListener listener)
          Removes a global listener from this control.
 void removeResizeRequestListener(ResizeRequestListener listener)
          Removes a ResizeRequestListener from this CControl.
 void removeSingleBackupFactory(String id)
          Removes a backup factory from this control.
 boolean removeSingleDockable(String id)
          Removes the SingleCDockable with the identifier id.
 void removeStateListener(CDockableStateListener listener)
          Removes a global state listener.
 void removeVetoClosingListener(CVetoClosingListener listener)
          Removes a listener from this control.
 void removeVetoFocusListener(CVetoFocusListener listener)
          Removes a listener from this control.
 void replace(MultipleCDockable oldDockable, MultipleCDockable newDockable)
          Replaces oldDockable with newDockable.
 void save(String name)
          Stores the current layout with the given name.
 void setDefaultLocation(CLocation defaultLocation)
          Sets the location where CDockables are opened when there is nothing else specified for these CDockables.
 void setMaximizeArea(String id)
          Makes sure that all CDockables are maximized onto the area which is registered under the given unique id.
 void setMaximizeBehavior(CMaximizeBehavior behavior)
          Sets the CMaximizeBehavior.
 void setMissingStrategy(MissingCDockableStrategy missingStrategy)
          Sets the strategy that tells what to do if layout information of a missing CDockable is found.
 void setPreferenceModel(PreferenceModel preferenceModel)
          Sets the PreferenceModel which will be used to translate between this and the preferences.
 void setRootWindow(WindowProvider window)
          Sets the root window of the application.
 void setTheme(DockTheme theme)
          Deprecated. replaced by setTheme(String). While this method still works, the theme will not get stored persistent and any module using the ThemeMap (getThemes()) will not be informed about the change.
 void setTheme(String theme)
          Sets the theme of the elements in the realm of this control.
 void write(DataOutputStream out)
          Writes the current and all known layouts into out.
 void write(File file)
          Writes the current and all known layouts into file.
 void writeXML(File file)
          Writes the current and all known layouts into file in xml format.
 void writeXML(XElement element)
          Writes the current and all known layouts into element.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

CCONTROL

public static final PropertyKey<CControl> CCONTROL
A key for this CControl. Will be set with the highest priority. To be used wherever a DockController but not a CControl is accessible.


KEY_MAXIMIZE_CHANGE

public static final PropertyKey<KeyStroke> KEY_MAXIMIZE_CHANGE
KeyStroke used to change a CDockable into maximized-state, or to go out of maximized-state when needed.


KEY_GOTO_MAXIMIZED

public static final PropertyKey<KeyStroke> KEY_GOTO_MAXIMIZED
KeyStroke used to change a CDockable into maximized-state.


KEY_GOTO_NORMALIZED

public static final PropertyKey<KeyStroke> KEY_GOTO_NORMALIZED
KeyStroke used to change a CDockable into normalized-state.


KEY_GOTO_MINIMIZED

public static final PropertyKey<KeyStroke> KEY_GOTO_MINIMIZED
KeyStroke used to change a CDockable into minimized-state.


KEY_GOTO_EXTERNALIZED

public static final PropertyKey<KeyStroke> KEY_GOTO_EXTERNALIZED
KeyStroke used to change a CDockable into externalized-state.


KEY_CLOSE

public static final PropertyKey<KeyStroke> KEY_CLOSE
KeyStroke used to close a CDockable.


RESIZE_LOCK_CONFLICT_RESOLVER

public static final PropertyKey<ConflictResolver<RequestDimension>> RESIZE_LOCK_CONFLICT_RESOLVER
ConflictResolver used to determine what happens when there is a conflict between two resize requests on a SplitDockStation like CGridArea, CWorkingArea or CContentArea.

See Also:
DefaultConflictResolver, FullLockConflictResolver

EXTERNALIZED_STATION_ID

public static final String EXTERNALIZED_STATION_ID
the unique id of the station that handles the externalized dockables

See Also:
Constant Field Values

CONTENT_AREA_STATIONS_ID

public static final String CONTENT_AREA_STATIONS_ID
the unique id of the default-CContentArea created by this control

See Also:
Constant Field Values
Constructor Detail

CControl

public CControl()
Creates a new control. Note that a control should know the main window of the application, thus CControl(WindowProvider) would be the better choice than this constructor.


CControl

public CControl(JFrame frame)
Creates a new control

Parameters:
frame - the main frame of the application, needed to create dialogs for externalized CDockables

CControl

public CControl(boolean restrictedEnvironment)
Creates a new control

Parameters:
restrictedEnvironment - whether this application runs in a restricted environment and is not allowed to listen for global events.

CControl

public CControl(WindowProvider window)
Creates a new control

Parameters:
window - a provider for the main window of this application. Needed to create dialogs for externalized CDockables. Must not be null, but its search method may return null

CControl

public CControl(JFrame frame,
                boolean restrictedEnvironment)
Creates a new control

Parameters:
frame - the main frame of the application, needed to create dialogs for externalized CDockables
restrictedEnvironment - whether this application runs in a restricted environment and is not allowed to listen for global events.

CControl

public CControl(WindowProvider window,
                boolean restrictedEnvironment)
Creates a new control

Parameters:
window - a provider for the main window of this application. Needed to create dialogs for externalized CDockables. Must not be null, but its search method may return null
restrictedEnvironment - whether this application runs in a restricted environment and is not allowed to listen for global events.

CControl

public CControl(JFrame frame,
                CControlFactory factory)
Creates a new control

Parameters:
frame - the main frame of the application, needed to create dialogs for externalized CDockables
factory - a factory which is used to create new elements for this control.

CControl

public CControl(WindowProvider window,
                CControlFactory factory)
Creates a new control

Parameters:
window - a provider for the main window of this application. Needed to create dialogs for externalized CDockables. Must not be null, but its search method may return null
factory - a factory which is used to create new elements for this control.
Method Detail

addControlListener

public void addControlListener(CControlListener listener)
Adds a listener to this control.

Parameters:
listener - the new listener

removeControlListener

public void removeControlListener(CControlListener listener)
Removes a listener from this control.

Parameters:
listener - the listener to remove

addFocusListener

public void addFocusListener(CFocusListener listener)
Adds a new focus listener to this control. The listener gets informed about changes in the focus.

Parameters:
listener - the new listener

removeFocusListener

public void removeFocusListener(CFocusListener listener)
Removes a listener from this control.

Parameters:
listener - the listener to remove

addVetoFocusListener

public void addVetoFocusListener(CVetoFocusListener listener)
Adds a new veto focus listener to this control. The listener gets informed about pending changes in the focus.

Parameters:
listener - the new listener

removeVetoFocusListener

public void removeVetoFocusListener(CVetoFocusListener listener)
Removes a listener from this control.

Parameters:
listener - the listener to remove

addStateListener

public void addStateListener(CDockableStateListener listener)
Adds a global state listener. This has the same effect as adding a state listener to each CDockable that is known to this control.

Parameters:
listener - the new listener

removeStateListener

public void removeStateListener(CDockableStateListener listener)
Removes a global state listener.

Parameters:
listener - the listener to remove

addPropertyListener

public void addPropertyListener(CDockablePropertyListener listener)
Adds a global property listener. This has the same effect as adding a property listener to each CDockable that is known to this control.

Parameters:
listener - the new listener

removePropertyListener

public void removePropertyListener(CDockablePropertyListener listener)
Removes a global listener from this control.

Parameters:
listener - the listener to remove

addKeyboardListener

public void addKeyboardListener(CKeyboardListener listener)
Adds a global keyboard listener to this control. The listener gets informed whenever a key is touched on a Component which is a child of a CDockable.
Note: listeners directly added to a CDockable will always be informed first.
Note: if a listener processes the event, then the other listeners will not be informed.

Parameters:
listener - the new listener

removeKeyboardListener

public void removeKeyboardListener(CKeyboardListener listener)
Removes a listener from this control.

Parameters:
listener - the listener to remove

addGlobalKeyListener

public void addGlobalKeyListener(KeyListener listener)
Adds a key listener to this control that will be informed about any KeyEvent that gets processed or analyzed by this control. Especially any event that gets forwarded to a CKeyboardListener gets also forwarded to listener.

Parameters:
listener - the new listener

removeGlobalKeyListener

public void removeGlobalKeyListener(KeyListener listener)
Removes a global KeyListener from this control.

Parameters:
listener - the listener to remove

addDoubleClickListener

public void addDoubleClickListener(CDoubleClickListener listener)
Adds a global mouse double click listener to this control. The listener gets informed whenever the mouse is clicked twice on a Component which is a child of a CDockable.
Note: listeners directly added to a CDockable will always be informed first.
Note: if a listener processes the event, then the other listeners will not be informed.

Parameters:
listener - the new listener

removeDoubleClickListener

public void removeDoubleClickListener(CDoubleClickListener listener)
Removes a listener from this control.

Parameters:
listener - the listener to remove

addVetoClosingListener

public void addVetoClosingListener(CVetoClosingListener listener)
Adds listener to this control, the listener will be informed whenever a set of CDockables is about to be closed.
CVetoClosingListeners added to the CControl are invoked before listeners that are added to a CDockable.

Parameters:
listener - the new listener, not null

removeVetoClosingListener

public void removeVetoClosingListener(CVetoClosingListener listener)
Removes a listener from this control.

Parameters:
listener - the listener to remove

destroy

public void destroy()
Frees as much resources as possible. This CControl will no longer work correctly after this method was called.


createWorkingArea

public CWorkingArea createWorkingArea(String uniqueId)
Creates and adds a new CWorkingArea to this control. The area is not made visible by this method.

Parameters:
uniqueId - the unique id of the area
Returns:
the new area

createMinimizeArea

public CMinimizeArea createMinimizeArea(String uniqueId)
Creates a new area where minimized CDockables can be stored. This method adds the new area directly as a root station to this control.

Parameters:
uniqueId - a unique identifier
Returns:
the new area

createGridArea

public CGridArea createGridArea(String uniqueId)
Creates a new area where normalized CDockables can be stored. This method adds the new area directly as a root station to this control

Parameters:
uniqueId - a unique identifier
Returns:
the new area

createContentArea

public CContentArea createContentArea(String uniqueId)
Creates and adds a new CContentArea.

Parameters:
uniqueId - the unique id of the new contentarea, the id must be unique in respect to all other contentareas which are registered at this control.
Returns:
the new contentarea
Throws:
IllegalArgumentException - if the id is not unique
NullPointerException - if the id is null

addContentArea

@Deprecated
@Todo(priority=MAJOR,
      compatibility=BREAK_MAJOR,
      target=VERSION_1_1_0,
      description="remove this method, replace by something better")
public void addContentArea(CContentArea content)
Deprecated. this method has not the same behavior as createContentArea(String), this method will either be removed in future releases or change its behavior

Adds a new CContentArea to this control.

Parameters:
content - the new area
Throws:
IllegalArgumentException - if the area is already in use or if the area was not created using this

removeContentArea

public void removeContentArea(CContentArea content)
Removes content from the list of known contentareas. This also removes the stations of content from this control. Elements aboard the stations are made invisible, but not removed from this control.

Parameters:
content - the contentarea to remove
Throws:
IllegalArgumentException - if the default-contentarea equals content

getRegister

public CControlRegister getRegister()
Gets the set of dockables, stations and other elemnts that are used by this control.

Returns:
the set of elements, never null

getContentAreas

public List<CContentArea> getContentAreas()
Gets an unmodifiable list of all CContentAreas registered at this control

Returns:
the list of content-areas

getFactory

public CControlFactory getFactory()
Gets the factory which is mainly used to create new elements for this control.

Returns:
the factory

getLocationManager

public CLocationModeManager getLocationManager()
Gets the manager that is responsible to handle all changes of the modes (maximized, normalized, ... ) of Dockables.
Note: clients should be careful when working with the location manager. Changing the properties of the location manager might introduce failures that are not visible directly.

Returns:
the manager

addDestroyHook

public void addDestroyHook(DestroyHook hook)
Adds a destroy-hook. The hook is called when this CControl is destroyed through destroy().

Parameters:
hook - the new hook

removeDestroyHook

public void removeDestroyHook(DestroyHook hook)
Removes a destroy-hook from this CControl.

Parameters:
hook - the hook to remove

getResources

public ApplicationResourceManager getResources()
Grants access to the manager that reads and stores configurations of the common-project.
Clients can add their own ApplicationResources to this manager, however clients are strongly discouraged from removing ApplicationResource which they did not add by themself.

Returns:
the persistent storage

putProperty

public <A> void putProperty(PropertyKey<A> key,
                            A value)
Changes the value of a property. Some properties are:

Type Parameters:
A - the type of the value
Parameters:
key - the name of the property
value - the new value, can be null

putProperty

protected <A> void putProperty(PropertyKey<A> key,
                               A value,
                               Priority priority)
Changes the value of a property.

Type Parameters:
A - the type of the value
Parameters:
key - the name of the property
priority - the priority of the new value
value - the new value, can be null
See Also:
putProperty(PropertyKey, Object)

getProperty

public <A> A getProperty(PropertyKey<A> key)
Gets the value of a property.

Type Parameters:
A - the type of the property
Parameters:
key - the name of the property
Returns:
the value or null

getContentArea

public CContentArea getContentArea()
Gets the element that should be in the center of the mainframe.

Returns:
the center of the mainframe of the application

add

public void add(CStation<?> station,
                boolean root)
Adds an additional station to this control. Most CStations should be root-stations, even if they are nested.

Parameters:
station - the new station
root - true if the station should become a root station. A root station often does not have a parent, the location of a CDockable is always relative to its youngest parent that is a root station.

remove

public void remove(CStation<?> station)
Removes a CStation from this control. It is unspecified what happens with the children on station

Parameters:
station - the station to remove

getStations

public List<CStation<?>> getStations()
Gets an unmodifiable list of all stations that are currently registered at this control.

Returns:
the list of stations

getStation

public CStation<?> getStation(DockStation intern)
Searches the CStation whose internal representation is intern.

Parameters:
intern - the internal representation
Returns:
the station or null

getStation

public CStation<?> getStation(String id)
Searches the CStation with unique identifier id.

Parameters:
id - the identifier
Returns:
the station or null

add

public <S extends SingleCDockable> S add(S dockable)
Adds a dockable to this control. The dockable can be made visible afterwards. This method will do nothing if dockable was already registered at this CControl.

Type Parameters:
S - the type of the new element
Parameters:
dockable - the new element to show
Returns:
dockable
Throws:
IllegalArgumentException - if dockable already is registered at another CControl or if the unique id of dockable already is used for another object

getSingleDockable

public SingleCDockable getSingleDockable(String id)
Searches for the SingleCDockable which has the unique identifier id.

Parameters:
id - the identifier to look out for
Returns:
the element with that identifier or null

removeSingleDockable

public boolean removeSingleDockable(String id)
Removes the SingleCDockable with the identifier id. This has the same effect as calling remove(SingleCDockable).

Parameters:
id - the id of the element to remove
Returns:
true if the element was removed, false otherwise

remove

public boolean remove(SingleCDockable dockable)
Removes dockable from this control. The location information for dockable remains stored if either there is a SingleCDockableBackupFactory registered or the MissingCDockableStrategy tells to store the values.

Parameters:
dockable - the element to remove
Returns:
true if the element was removed, false otherwise

addSingleBackupFactory

public void addSingleBackupFactory(String id,
                                   SingleCDockableBackupFactory backupFactory)
Adds a backup factory to this control. The backup factory will be used to create and add a SingleCDockable when one is requested that is not yet in the cache.
If there is already information for id available and id should be visible, then the factory will be used Instantaneously.

Parameters:
id - the id of the dockable that might be requested
backupFactory - the new factory

getSingleBackupFactory

public SingleCDockableBackupFactory getSingleBackupFactory(String id)
Searches for the SingleCDockableBackupFactory which was registered with the key id.

Parameters:
id - the identifier of some factory
Returns:
the factory or null

removeSingleBackupFactory

public void removeSingleBackupFactory(String id)
Removes a backup factory from this control. Location information for id will be deleted if neither a SingleCDockable is added nor the MissingCDockableStrategy tells to store the information.

Parameters:
id - the name of the factory
See Also:
addSingleBackupFactory(String, SingleCDockableBackupFactory)

add

public <M extends MultipleCDockable> M add(M dockable)
Adds a dockable to this control. The dockable can be made visible afterwards.

Type Parameters:
M - the type of the new element
Parameters:
dockable - the new element to show
Returns:
dockable

add

public <M extends MultipleCDockable> M add(M dockable,
                                           String uniqueId)
Adds a dockable to this control. The dockable can be made visible afterwards. This method will throw an exception when the unique identifier is already in use. Clients better use add(MultipleCDockable).

Type Parameters:
M - the type of the new element
Parameters:
dockable - the new element to show
uniqueId - id the unique id of the new element
Returns:
dockable
Throws:
IllegalArgumentException - if the unique identifier is already in use, if dockable is already used elsewhere, if there is no factory for dockable
NullPointerException - if any argument is null

replace

public void replace(MultipleCDockable oldDockable,
                    MultipleCDockable newDockable)
Replaces oldDockable with newDockable. The new dockable inherits settings and location of the old one.

Parameters:
oldDockable - the old dockable, not null
newDockable - the new dockable, not null

getMultipleDockable

public MultipleCDockable getMultipleDockable(String id)
Searches and returns the one MultipleCDockable which uses the unique identifier id.

Parameters:
id - the identifier to look out for
Returns:
the element using id or null if nothing was found

remove

public void remove(MultipleCDockable dockable)
Removes a dockable from this control. The dockable is made invisible.

Parameters:
dockable - the element to remove

getCDockableCount

public int getCDockableCount()
Gets the number of CDockables that are registered in this CControl.

Returns:
the number of dockables

getCDockable

public CDockable getCDockable(int index)
Gets the index'th dockable that is registered in this control

Parameters:
index - the index of the element
Returns:
the selected dockable

add

@Deprecated
public void add(String id,
                           MultipleCDockableFactory<?,?> factory)
Deprecated. use addMultipleDockableFactory(String, MultipleCDockableFactory)

Adds a factory to this control. The factory will create MultipleCDockables when a layout is loaded.

Parameters:
id - the unique id of the factory
factory - the new factory

addMultipleDockableFactory

public void addMultipleDockableFactory(String id,
                                       MultipleCDockableFactory<?,?> factory)
Adds a factory to this control. The factory will create MultipleCDockables when a layout is loaded.

Parameters:
id - the unique id of the factory
factory - the new factory

getMultipleDockableFactory

public MultipleCDockableFactory<?,?> getMultipleDockableFactory(String id)
Searches for the MultipleCDockableFactory with the identifier id.

Parameters:
id - the identifier to search for
Returns:
the factory or null

removeMultipleDockableFactory

public void removeMultipleDockableFactory(String id)
Removes the MultipleCDockableFactory with identifier id from this control. As a side effect all MultipleCDockables which use that factory are removed as well. Nothing happens if there is no factory registered with id.

Parameters:
id - the identifier of the factory to remove

setDefaultLocation

public void setDefaultLocation(CLocation defaultLocation)
Sets the location where CDockables are opened when there is nothing else specified for these CDockables.

Parameters:
defaultLocation - the location, can be null

getDefaultLocation

public CLocation getDefaultLocation()
Gets the location where CDockables are opened when nothing else is specified.

Returns:
the location, might be null
See Also:
setDefaultLocation(CLocation)

setMaximizeArea

public void setMaximizeArea(String id)
Makes sure that all CDockables are maximized onto the area which is registered under the given unique id.

Parameters:
id - the unique id of the area
See Also:
CGridArea.getUniqueId(), CContentArea.getCenterIdentifier()

setMaximizeBehavior

public void setMaximizeBehavior(CMaximizeBehavior behavior)
Sets the CMaximizeBehavior. The behavior decides what happens when the user want's to maximize or to un-maximize a CDockable.

Parameters:
behavior - the new behavior, not null

getMaximizeBehavior

public CMaximizeBehavior getMaximizeBehavior()
Gets the currently used maximize-behavior.

Returns:
the behavior, not null
See Also:
setMaximizeBehavior(CMaximizeBehavior)

setTheme

@Deprecated
public void setTheme(DockTheme theme)
Deprecated. replaced by setTheme(String). While this method still works, the theme will not get stored persistent and any module using the ThemeMap (getThemes()) will not be informed about the change.

Sets the theme of the elements in the realm of this control.

Parameters:
theme - the new theme

setTheme

public void setTheme(String theme)
Sets the theme of the elements in the realm of this control. The String theme is used as key for ThemeMap.select(String).

Parameters:
theme - the name of the theme, this might be one of ThemeMap.KEY_BASIC_THEME, ThemeMap.KEY_BUBBLE_THEME, ThemeMap.KEY_ECLIPSE_THEME, ThemeMap.KEY_FLAT_THEME or ThemeMap.KEY_SMOOTH_THEME. This can also be a any other string which was used for ThemeMap.put(String, ThemeFactory), ThemeMap.add(String, ThemeFactory) or ThemeMap.insert(int, String, ThemeFactory).

getThemes

public ThemeMap getThemes()
Gets the list of installed themes.

Returns:
the list of themes

setRootWindow

public void setRootWindow(WindowProvider window)
Sets the root window of the application. The root window is used as owner of any dialog that is created. Already existing dialogs will not change their owner.

Parameters:
window - the new owner, can be null

getRootWindow

public WindowProvider getRootWindow()
Gets the root window of the application. Note that this method might not return the same object as given to setRootWindow(WindowProvider), however the provide returned by this method will return the same window as specified by setRootWindow(WindowProvider).

Returns:
the provider, never null

getPreferences

public PreferenceStorage getPreferences()
Gets the storage container for PreferenceModels for this control. The contents of this container are stored in the resource manager.

Returns:
the storage for preferences
See Also:
getResources()

setPreferenceModel

public void setPreferenceModel(PreferenceModel preferenceModel)
Sets the PreferenceModel which will be used to translate between this and the preferences. This model can be set to null.
The default value of this property is null.

Parameters:
preferenceModel - the new model, it will used to translate the contents of getPreferences() immediately, can be null

getPreferenceModel

public PreferenceModel getPreferenceModel()
Gets the preference model which is used to translate between the preferences and this.

Returns:
the model, can be null
See Also:
setPreferenceModel(PreferenceModel)

setMissingStrategy

public void setMissingStrategy(MissingCDockableStrategy missingStrategy)
Sets the strategy that tells what to do if layout information of a missing CDockable is found.

Parameters:
missingStrategy - the strategy, null will set the default strategy

getMissingStrategy

public MissingCDockableStrategy getMissingStrategy()
Gets the strategy that tells what to do if layout information of a missing CDockable is found.

Returns:
the strategy, never null

addResizeRequestListener

public void addResizeRequestListener(ResizeRequestListener listener)
Adds a ResizeRequestListener to this CControl. The listener will be informed when the resize requests of a CDockable should be processed.

Parameters:
listener - the new listener, not null

removeResizeRequestListener

public void removeResizeRequestListener(ResizeRequestListener listener)
Removes a ResizeRequestListener from this CControl.

Parameters:
listener - the listener to remove

handleResizeRequests

public void handleResizeRequests()
Informs all ResizeRequestListeners, that the resize request of all CDockables should be processed. There are no guarantees that a resize requests can be granted or even gets processed.
All requests, independent from whether they were processed, will be deleted by this method.
Note that a request might conflict with a "resize lock" CDockable.isResizeLockedHorizontally() and CDockable.isResizeLockedVertically(). The behavior of that case is not specified, but clients can assume that the locked components introduce additional resize requests.


intern

public DockFrontend intern()
Gets the representation of the layer beneath the common-layer.

Returns:
the entry point to DockingFrames

write

public void write(File file)
           throws IOException
Writes the current and all known layouts into file.
This is the same as calling getResources().writeFile( file ).

Parameters:
file - the file to override
Throws:
IOException - if the file can't be written

write

public void write(DataOutputStream out)
           throws IOException
Writes the current and all known layouts into out.
This is the same as calling getResources().writeStream( out ).

Parameters:
out - the stream to write into
Throws:
IOException - if the stream is not writable

writeXML

public void writeXML(XElement element)
Writes the current and all known layouts into element.
This is the same as calling getResources().writeXML( element ).

Parameters:
element - the element to write into

writeXML

public void writeXML(File file)
              throws IOException
Writes the current and all known layouts into file in xml format.

Parameters:
file - the file to write into
Throws:
IOException - if the file is not writable

read

public void read(File file)
          throws IOException
Reads the current and other known layouts from file.
This is the same as calling getResources().readFile( file ).

Parameters:
file - the file to read from
Throws:
IOException - if the file can't be read

read

public void read(DataInputStream in)
          throws IOException
Reads the current and other known layouts from in.
This is the same as calling getResources().readStream( in ).

Parameters:
in - the stream to read from
Throws:
IOException - if the stream can't be read

readXML

public void readXML(XElement element)
Reads the current and other known layouts from element.
This is the same as calling getResources().readXML( element ).

Parameters:
element - the element to read
Throws:
XException - if the xml file has the wrong structure

readXML

public void readXML(File file)
             throws IOException
Reads the current and other known layouts from file.

Parameters:
file - the file to open and to read
Throws:
IOException - if the file cannot be read
XException - if the xml file has the wrong structure

save

public void save(String name)
Stores the current layout with the given name.

Parameters:
name - the name of the current layout.

load

public void load(String name)
Loads an earlier stored layout.

Parameters:
name - the name of the layout.

delete

public void delete(String name)
Deletes a layout that has been stored earlier.

Parameters:
name - the name of the layout to delete

layouts

public String[] layouts()
Gets a list of all layouts that are currently known.

Returns:
the list of layouts