|
||||||||||
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. |
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 | ||
---|---|---|
|
add(F dockable)
Adds a dockable to this control. |
|
|
add(F dockable)
Adds a dockable to this control. |
|
void |
add(String id,
MultipleCDockableFactory<?,?> factory)
Adds a factory to this control. |
|
void |
addDestroyHook(DestroyHook hook)
Adds a destroy-hook. |
|
CContentArea |
createContentArea(String uniqueId)
Creates and adds a new CContentArea . |
|
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. |
|
DockFrontend |
intern()
Gets the representation of the layer beneath the facile-layer. |
|
String[] |
layouts()
Gets a list of all layouts that are currently known. |
|
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(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 |
removeDestroyHook(DestroyHook hook)
Removes a destroy-hook from this CControl . |
|
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 |
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 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 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 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 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 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 <F extends SingleCDockable> F add(F dockable)
F
- the type of the new elementdockable
- the new element to show
dockable
public <F extends MultipleCDockable> F add(F dockable)
F
- the type of the new elementdockable
- the new element to show
dockable
public void remove(SingleCDockable dockable)
dockable
- the element to removepublic 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 CMaximizeBehavior getMaximizeBehavior()
null
setMaximizeBehavior(CMaximizeBehavior)
public void setTheme(DockTheme theme)
theme
- the new themepublic 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()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |