Class CControlPerspective
java.lang.Object
bibliothek.gui.dock.common.perspective.CControlPerspective
- Author:
- Benjamin Sigg
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionconversion(CPerspective perspective, boolean includeWorkingAreas) Creates a newDockFrontendPerspectivewhich uses the settings fromperspectiveto read and write layouts.Creates a newCPerspectivethat is set up with all the stations of theCControl.Gets theCControlin whose realm thisCControlPerspectiveoperates.String[]getNames()Gets the names of all the perspectives that are available.getPerspective(boolean includeWorkingAreas) Gets a perspective that matches the current layout of the application.getPerspective(String name) Gets the perspective which represents a layout that was stored usingCControl.save(String).getPerspective(String name, boolean includeWorkingAreas) Gets the perspective which represents a layout that was stored usingCControl.save(String).Creates a newCPerspectiveand fills it using the information fromsetting.read(DataInputStream in) Creates a newCPerspectiveusing the information stored inin.read(DataInputStream in, boolean includeWorkingAreas) Creates a newCPerspectiveusing the information stored inin.Emulates a call toCControl.read(DataInputStream)and returns all the layouts that are stored in the streamin.readAllXML(XElement root) Emulates a call toCControl.readXML(XElement)and returns all the layouts that are stored withinroot.Creates a newCPerspectiveusing the information stored inroot.Creates a newCPerspectiveusing the information stored inroot.voidremovePerspective(String name) Deletes the perspective with namename.voidrenamePerspective(String source, String destination) Renames the perspectivesourcetodestination.voidsetPerspective(CPerspective perspective, boolean includeWorkingAreas) Changes the layout of the associatedCControlsuch that it matchesperspective.voidsetPerspective(String name, CPerspective perspective) Storesperspectiveas a layout that can be selected by the user by callingCControl.load(String).
The contents of working areas are ignored by this method.voidsetPerspective(String name, CPerspective perspective, boolean includeWorkingAreas) Storesperspectiveas a layout that can be selected by the user by callingCControl.load(String).write(CPerspective perspective, boolean includeWorkingAreas) Convertsperspectiveinto aCSetting.voidwrite(DataOutputStream out, CPerspective perspective) Writes the contents ofperspectiveintooutusing the factories provided by thisCControlPerspective.voidwrite(DataOutputStream out, CPerspective perspective, boolean includeWorkingAreas) Writes the contents ofperspectiveintooutusing the factories provided by thisCControlPerspective.voidwriteXML(XElement root, CPerspective perspective) Writes the contents ofperspectiveintorootusing the factories provided by thisCControlPerspective.voidwriteXML(XElement root, CPerspective perspective, boolean includeWorkingAreas) Writes the contents ofperspectiveintorootusing the factories provided by thisCControlPerspective.
-
Constructor Details
-
CControlPerspective
Creates a new wrapper- Parameters:
control- the control whose perspectives are modified
-
-
Method Details
-
getControl
Gets theCControlin whose realm thisCControlPerspectiveoperates.- Returns:
- the owner of this perspective
-
createEmptyPerspective
Creates a newCPerspectivethat is set up with all the stations of theCControl. There are noDockables stored in the new perspective.- Returns:
- the new perspective
-
getPerspective
Gets a perspective that matches the current layout of the application.- Parameters:
includeWorkingAreas- whetherDockables that are managed by a working-area should be included in the layout or not- Returns:
- the current perspective
-
getNames
Gets the names of all the perspectives that are available.- Returns:
- all the names
-
getPerspective
Gets the perspective which represents a layout that was stored usingCControl.save(String).- Parameters:
name- the name of the stored layout- Returns:
- the perspective or
nullifnamewas not found
-
getPerspective
Gets the perspective which represents a layout that was stored usingCControl.save(String).- Parameters:
name- the name of the stored layoutincludeWorkingAreas- whether the content of working areas should be included (requires that the layout was saved in the first place)- Returns:
- the perspective or
nullifnamewas not found
-
setPerspective
Changes the layout of the associatedCControlsuch that it matchesperspective.- Parameters:
perspective- the perspective to apply, notnullincludeWorkingAreas- whetherDockables that are managed by a working-area should be included in the layout or not
-
setPerspective
Storesperspectiveas a layout that can be selected by the user by callingCControl.load(String).
The contents of working areas are ignored by this method.- Parameters:
name- the name of the layoutperspective- the new layout, notnull
-
setPerspective
Storesperspectiveas a layout that can be selected by the user by callingCControl.load(String).- Parameters:
name- the name of the layoutperspective- the new layout, notnullincludeWorkingAreas- whether the contents of working areas should be stored as well
-
removePerspective
Deletes the perspective with namename.- Parameters:
name- the name of the perspective
-
renamePerspective
Renames the perspectivesourcetodestination. If there is already a layout with namedestinationit will be overridden. This operation works directly on theCControl, already existingCPerspectives will not be affected by invoking this method.- Parameters:
source- the name of the sourcedestination- the name of the destination- Throws:
IllegalArgumentException- ifsourcedoes not point to an existing layoutIllegalArgumentException- if eithersourceordestinationarenull
-
writeXML
Writes the contents ofperspectiveintorootusing the factories provided by thisCControlPerspective.- Parameters:
root- the element to write into, notnullperspective- the perspective to write, notnull
-
writeXML
Writes the contents ofperspectiveintorootusing the factories provided by thisCControlPerspective.- Parameters:
root- the element to write into, notnullperspective- the perspective to write, notnullincludeWorkingAreas- whether the output contains information about children ofworking areas(includeWorkingAreas = true) or not (includeWorkingAreas = false)
-
write
Writes the contents ofperspectiveintooutusing the factories provided by thisCControlPerspective.- Parameters:
out- the stream to write into, notnullperspective- the perspective to write, notnull- Throws:
IOException- ifoutis not writeable
-
write
public void write(DataOutputStream out, CPerspective perspective, boolean includeWorkingAreas) throws IOException Writes the contents ofperspectiveintooutusing the factories provided by thisCControlPerspective.- Parameters:
out- the stream to write into, notnullperspective- the perspective to write, notnullincludeWorkingAreas- whether the output contains information about children ofworking areas(includeWorkingAreas = true) or not (includeWorkingAreas = false)- Throws:
IOException- ifoutis not writeable
-
write
Convertsperspectiveinto aCSetting.- Parameters:
perspective- the perspective to convertincludeWorkingAreas- whether the children ofCWorkingAreas should be stored as well- Returns:
- the converted perspective
-
readAllXML
Emulates a call toCControl.readXML(XElement)and returns all the layouts that are stored withinroot.- Parameters:
root- the root xml element of a file- Returns:
- all the layouts and settings stored in
root - Throws:
XException- ifrootis not well formed
-
readXML
Creates a newCPerspectiveusing the information stored inroot. While this method uses the factories provided by thisCControlPerspective, the newCPerspectiveis not registered anywhere. It is the clients responsibility to callsetPerspective(String, CPerspective)orsetPerspective(CPerspective, boolean)to actually use the result of this method.- Parameters:
root- the element which contains information about a perspective- Returns:
- the new perspective
- Throws:
XException- if the structure ofrootis not as expected
-
readXML
Creates a newCPerspectiveusing the information stored inroot. While this method uses the factories provided by thisCControlPerspective, the newCPerspectiveis not registered anywhere. It is the clients responsibility to callsetPerspective(String, CPerspective)orsetPerspective(CPerspective, boolean)to actually use the result of this method.- Parameters:
root- the element which contains information about a perspectiveincludeWorkingAreas- whether the perspective contains information about children ofworking areas(includeWorkingAreas = true) or not (includeWorkingAreas = false). This parameter should have the same value as was used when callingwrite(DataOutputStream, CPerspective, boolean).- Returns:
- the new perspective
- Throws:
XException- if the structure ofrootis not as expected
-
readAll
Emulates a call toCControl.read(DataInputStream)and returns all the layouts that are stored in the streamin.- Parameters:
in- the bytes of some layout file- Returns:
- all the layouts and settings that can be read from
in - Throws:
IOException- if there is a problem readinginor ifinis not well formed
-
read
Creates a newCPerspectiveusing the information stored inin. While this method uses the factories provided by thisCControlPerspective, the newCPerspectiveis not registered anywhere. It is the clients responsibility to callsetPerspective(String, CPerspective)orsetPerspective(CPerspective, boolean)to actually use the result of this method.- Parameters:
in- the stream to read data from- Returns:
- the new perspective
- Throws:
IOException- ifinis not readable or in the wrong format
-
read
Creates a newCPerspectiveusing the information stored inin. While this method uses the factories provided by thisCControlPerspective, the newCPerspectiveis not registered anywhere. It is the clients responsibility to callsetPerspective(String, CPerspective)orsetPerspective(CPerspective, boolean)to actually use the result of this method.- Parameters:
in- the stream to read data fromincludeWorkingAreas- whether the perspective contains information about children ofworking areas(includeWorkingAreas = true) or not (includeWorkingAreas = false). This parameter should have the same value as was used when callingwrite(DataOutputStream, CPerspective, boolean).- Returns:
- the new perspective
- Throws:
IOException- ifinis not readable or in the wrong format
-
read
Creates a newCPerspectiveand fills it using the information fromsetting.- Parameters:
setting- the layout to convertincludeWorkingAreas- whether the layout contains information about children ofCWorkingAreas- Returns:
- the layout of
setting
-
conversion
@FrameworkOnly public DockFrontendPerspective conversion(CPerspective perspective, boolean includeWorkingAreas) Creates a newDockFrontendPerspectivewhich uses the settings fromperspectiveto read and write layouts. This method addsCommonSingleDockableFactory,CommonMultipleDockableFactoryandCommonDockStationFactoryto the perspective.
Clients usually have no need to call this method.- Parameters:
perspective- the perspective whose settings should be used for reading or writing a layoutincludeWorkingAreas- whether the contents ofworking areasshould be included in the layout or not- Returns:
- the new builder
-