|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectbibliothek.gui.dock.common.CControl
public class CControl
Manages the interaction between SingleCDockable
, MultipleCDockable
and the CContentArea
.
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.
Field Summary | |
---|---|
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(JFrame frame)
Creates a new control |
|
CControl(JFrame frame,
boolean restrictedEnvironment)
Creates a new control |
|
CControl(JFrame frame,
CControlFactory factory)
Creates a new control |
Method Summary | ||
---|---|---|
void |
add(CStation station,
boolean root)
Adds an additional station to this control. |
|
|
add(F dockable)
Adds a dockable to this control. |
|
|
add(M dockable,
String uniqueId)
Adds a dockable to this control. |
|
|
add(S dockable)
Adds a dockable to this control. |
|
void |
add(String id,
MultipleCDockableFactory<?,?> factory)
Adds a factory to this control. |
|
void |
addContentArea(CContentArea content)
Adds a new CContentArea to this control. |
|
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 |
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. |
|
CContentArea |
createContentArea(String uniqueId)
Creates and adds a new CContentArea . |
|
CGridArea |
createGridArea(String uniqueId)
Creates a new area where normalized CDockable s can be stored. |
|
CMinimizeArea |
createMinimizeArea(String uniqueId)
Creates a new area where minimized CDockable s 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 CDockable s 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 CContentArea s registered at
this control |
|
CLocation |
getDefaultLocation()
Gets the location where CDockable s are opened when nothing else
is specified. |
|
CControlFactory |
getFactory()
Gets the factory which is mainly used to create new elements for this control. |
|
CMaximizeBehavior |
getMaximizeBehavior()
Gets the currently used maximize-behavior. |
|
|
getProperty(PropertyKey<A> key)
Gets the value of a property. |
|
ApplicationResourceManager |
getResources()
Grants access to the manager that reads and stores configurations of the common-project. Clients can add their own ApplicationResource s to this manager,
however clients are strongly discouraged from removing ApplicationResource
which they did not add by themself. |
|
CStateManager |
getStateManager()
Gets the manager that is responsible to handle all changes of the modes (maximized, normalized, ... |
|
CStation |
getStation(DockStation intern)
Searches the CStation whose internal representation
is intern . |
|
List<CStation> |
getStations()
Gets an unmodifiable list of all stations that are currently registered at this control. |
|
void |
handleResizeRequests()
Informs all ResizeRequestListener s, that the
resize request of all
CDockable s 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. |
|
CDockable[] |
listDockables()
Gets a list of all CDockable s that are known to this control. |
|
CDockable[] |
listDockablesInMode(CDockable.ExtendedMode mode)
Gets a list of all visible CDockable s in the given mode. |
|
void |
load(String name)
Loads an earlier stored layout. |
|
|
putProperty(PropertyKey<A> key,
A value)
Changes the value of a property. |
|
void |
read(DataInputStream in)
Reads the current and other known layouts from in .This is the same as calling getResources().readStream( out ) . |
|
void |
read(File file)
Reads the current and other known layouts from file .This is the same as calling getResources().readFile( file ) . |
|
void |
remove(CStation station)
Removes a CStation from this control. |
|
void |
remove(MultipleCDockable dockable)
Removes a dockable from this control. |
|
void |
remove(SingleCDockable dockable)
Removes a 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 |
removeKeybaordListener(CKeyboardListener listener)
Removes a listener 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. |
|
void |
removeStateListener(CDockableStateListener listener)
Removes a global state listener. |
|
void |
save(String name)
Stores the current layout with the given name. |
|
void |
setDefaultLocation(CLocation defaultLocation)
Sets the location where CDockable s are opened when there is
nothing else specified for these CDockable s. |
|
void |
setMaximizeArea(String id)
Makes sure that all CDockable s are maximized onto the area
which is registered under the given unique id. |
|
void |
setMaximizeBehavior(CMaximizeBehavior behavior)
Sets the CMaximizeBehavior . |
|
void |
setTheme(DockTheme 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 .This is the same as calling getResources().writeStream( out ) . |
|
void |
write(File file)
Writes the current and all known layouts into file .This is the same as calling getResources().writeFile( file ) . |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
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.
public static final PropertyKey<KeyStroke> KEY_GOTO_MAXIMIZED
KeyStroke
used to change a CDockable
into
maximized-state.
public static final PropertyKey<KeyStroke> KEY_GOTO_NORMALIZED
KeyStroke
used to change a CDockable
into
normalized-state.
public static final PropertyKey<KeyStroke> KEY_GOTO_MINIMIZED
KeyStroke
used to change a CDockable
into
minimized-state.
public static final PropertyKey<KeyStroke> KEY_GOTO_EXTERNALIZED
KeyStroke
used to change a CDockable
into
externalized-state.
public static final PropertyKey<KeyStroke> KEY_CLOSE
KeyStroke
used to close a CDockable
.
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
.
DefaultConflictResolver
,
FullLockConflictResolver
public static final String EXTERNALIZED_STATION_ID
public static final String CONTENT_AREA_STATIONS_ID
CContentArea
created by this control
Constructor Detail |
---|
public CControl(JFrame frame)
frame
- the main frame of the application, needed to create
dialogs for externalized CDockable
spublic CControl(JFrame frame, boolean restrictedEnvironment)
frame
- the main frame of the application, needed to create
dialogs for externalized CDockable
srestrictedEnvironment
- whether this application runs in a
restricted environment and is not allowed to listen for global events.public CControl(JFrame frame, CControlFactory factory)
frame
- the main frame of the application, needed to create
dialogs for externalized CDockable
sfactory
- a factory which is used to create new elements for this
control.Method Detail |
---|
public void addControlListener(CControlListener listener)
listener
- the new listenerpublic void removeControlListener(CControlListener listener)
listener
- the listener to removepublic void addFocusListener(CFocusListener listener)
listener
- the new listenerpublic void removeFocusListener(CFocusListener listener)
listener
- the listener to removepublic void addStateListener(CDockableStateListener listener)
CDockable
that is known to this
control.
listener
- the new listenerpublic void removeStateListener(CDockableStateListener listener)
listener
- the listener to removepublic void addPropertyListener(CDockablePropertyListener listener)
CDockable
that is known to this
control.
listener
- the new listenerpublic void removePropertyListener(CDockablePropertyListener listener)
listener
- the listener to removepublic void addKeyboardListener(CKeyboardListener listener)
Component
which is a child
of a CDockable
.CDockable
will always
be informed first.
listener
- the new listenerpublic void removeKeybaordListener(CKeyboardListener listener)
listener
- the listener to removepublic void addGlobalKeyListener(KeyListener listener)
KeyEvent
that gets processed or analyzed by this control. Especially
any event that gets forwarded to a CKeyboardListener
gets also
forwarded to listener
.
listener
- the new listenerpublic void removeGlobalKeyListener(KeyListener listener)
KeyListener
from this control.
listener
- the listener to removepublic void addDoubleClickListener(CDoubleClickListener listener)
Component
which
is a child of a CDockable
.CDockable
will always
be informed first.
listener
- the new listenerpublic void removeDoubleClickListener(CDoubleClickListener listener)
listener
- the listener to removepublic void destroy()
CControl
will no longer
work correctly after this method was called.
public CWorkingArea createWorkingArea(String uniqueId)
CWorkingArea
to this control. The area
is not made visible by this method.
uniqueId
- the unique id of the area
public CMinimizeArea createMinimizeArea(String uniqueId)
CDockable
s can be stored. This
method adds the new area directly as a root station to this control.
uniqueId
- a unique identifier
public CGridArea createGridArea(String uniqueId)
CDockable
s can be stored.
This method adds the new area directly as a root station to this control
uniqueId
- a unique identifier
public CContentArea createContentArea(String uniqueId)
CContentArea
.
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.
IllegalArgumentException
- if the id is not unique
NullPointerException
- if the id is null
public void addContentArea(CContentArea content)
CContentArea
to this control.
content
- the new area
IllegalArgumentException
- if the area is already in use or if
the area was not created using this
public void removeContentArea(CContentArea content)
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.
content
- the contentarea to remove
IllegalArgumentException
- if the default-contentarea equals content
public List<CContentArea> getContentAreas()
CContentArea
s registered at
this control
public CControlFactory getFactory()
public CStateManager getStateManager()
Dockable
s.
public void addDestroyHook(DestroyHook hook)
CControl
is
destroyed through destroy()
.
hook
- the new hookpublic void removeDestroyHook(DestroyHook hook)
CControl
.
hook
- the hook to removepublic ApplicationResourceManager getResources()
ApplicationResource
s to this manager,
however clients are strongly discouraged from removing ApplicationResource
which they did not add by themself.
public <A> void putProperty(PropertyKey<A> key, A value)
KEY_MAXIMIZE_CHANGE
KEY_GOTO_EXTERNALIZED
KEY_GOTO_MAXIMIZED
KEY_GOTO_MINIMIZED
KEY_GOTO_NORMALIZED
KEY_CLOSE
A
- the type of the valuekey
- the name of the propertyvalue
- the new value, can be null
public <A> A getProperty(PropertyKey<A> key)
A
- the type of the propertykey
- the name of the property
null
public CContentArea getContentArea()
public void add(CStation station, boolean root)
station
- the new stationroot
- true
if the station should become a root station,
which means that the station will not have any parent. false
if the station will have another parent, that is often the case if the
station is a CDockable
as well.public void remove(CStation station)
CStation
from this control. It is unspecified what
happens with the children on station
station
- the statio to removepublic List<CStation> getStations()
public CStation getStation(DockStation intern)
CStation
whose internal representation
is intern
.
intern
- the internal representation
null
public <S extends SingleCDockable> S add(S dockable)
S
- the type of the new elementdockable
- the new element to show
dockable
public void remove(SingleCDockable dockable)
dockable
- the element to removepublic void addSingleBackupFactory(String id, SingleCDockableBackupFactory backupFactory)
SingleCDockable
when one is requested that
is not yet in the cache.
id
- the id of the dockable that might be requestedbackupFactory
- the new factorypublic void removeSingleBackupFactory(String id)
id
- the name of the factoryaddSingleBackupFactory(String, SingleCDockableBackupFactory)
public <F extends MultipleCDockable> F add(F dockable)
F
- the type of the new elementdockable
- the new element to show
dockable
public <M extends MultipleCDockable> M add(M dockable, String uniqueId)
add(MultipleCDockable)
.
M
- the type of the new elementdockable
- the new element to showuniqueId
- id the unique id of the new element
dockable
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
public void remove(MultipleCDockable dockable)
dockable
- the element to removepublic int getCDockableCount()
CDockable
s that are registered in this
CControl
.
public CDockable getCDockable(int index)
index
- the index of the element
public void add(String id, MultipleCDockableFactory<?,?> factory)
MultipleCDockable
s
when a layout is loaded.
id
- the unique id of the factoryfactory
- the new factorypublic void setDefaultLocation(CLocation defaultLocation)
CDockable
s are opened when there is
nothing else specified for these CDockable
s.
defaultLocation
- the location, can be null
public CLocation getDefaultLocation()
CDockable
s are opened when nothing else
is specified.
null
setDefaultLocation(CLocation)
public void setMaximizeBehavior(CMaximizeBehavior behavior)
CMaximizeBehavior
. The behavior decides what happens
when the user want's to maximize or to un-maximize a CDockable
.
behavior
- the new behavior, not null
public void setMaximizeArea(String id)
CDockable
s are maximized onto the area
which is registered under the given unique id.
id
- the unique id of the areaCGridArea.getUniqueId()
,
CContentArea.getCenterIdentifier()
public CMaximizeBehavior getMaximizeBehavior()
null
setMaximizeBehavior(CMaximizeBehavior)
public void setTheme(DockTheme theme)
theme
- the new themepublic void addResizeRequestListener(ResizeRequestListener listener)
ResizeRequestListener
to this CControl
. The listener
will be informed when the resize requests of a CDockable
should
be processed.
listener
- the new listener, not null
public void removeResizeRequestListener(ResizeRequestListener listener)
ResizeRequestListener
from this CControl
.
listener
- the listener to removepublic void handleResizeRequests()
ResizeRequestListener
s, that the
resize request
of all
CDockable
s should be processed. There are no
guarantees that a resize requests can be granted or even gets processed.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.
public DockFrontend intern()
public void write(File file) throws IOException
file
.getResources().writeFile( file )
.
file
- the file to override
IOException
- if the file can't be writtenpublic void write(DataOutputStream out) throws IOException
out
.getResources().writeStream( out )
.
out
- the stream to write into
IOException
- if the stream is not writablepublic void read(File file) throws IOException
file
.getResources().readFile( file )
.
file
- the file to read from
IOException
- if the file can't be readpublic void read(DataInputStream in) throws IOException
in
.getResources().readStream( out )
.
in
- the stream to read from
IOException
- if the stream can't be readpublic void save(String name)
name
- the name of the current layout.public void load(String name)
name
- the name of the layout.public void delete(String name)
name
- the name of the layout to deletepublic String[] layouts()
public CDockable[] listDockables()
CDockable
s that are known to this control. This includes
invisible dockables.
public CDockable[] listDockablesInMode(CDockable.ExtendedMode mode)
CDockable
s in the given mode.
mode
- the mode which each CDockable
must have
CDockable
s
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |