bibliothek.gui.dock.common.perspective
Class CExternalizePerspective

java.lang.Object
  extended by bibliothek.gui.dock.common.perspective.CExternalizePerspective
All Implemented Interfaces:
CElementPerspective, CStationPerspective

public class CExternalizePerspective
extends Object
implements CStationPerspective

A representation of a CExternalizeArea.

Author:
Benjamin Sigg

Nested Class Summary
 class CExternalizePerspective.CommonScreenDockPerspective
          This type of object is used by the CExternalizePerspective as intern representation.
 
Constructor Summary
CExternalizePerspective(String id, Path typeId)
          Creates a new, empty perspective.
 
Method Summary
 void add(CDockablePerspective dockable, int x, int y, int width, int height)
          Adds dockable at location x/y with size width/height to this area.
 void add(CDockablePerspective dockable, int x, int y, int width, int height, boolean fullscreen)
          Adds dockable at location x/y with size width/height to this area.
 void add(CDockablePerspective dockable, Rectangle bounds)
          Adds dockable width boundaries bounds to this area.
 void add(CDockablePerspective dockable, Rectangle bounds, boolean fullscreen)
          Adds dockable width boundaries bounds to this area.
 void addPlaceholder(CDockablePerspective dockable, int x, int y, int width, int height)
          Adds a placeholder for dockable and all its children to this area.
 void addPlaceholder(CDockablePerspective dockable, Rectangle bounds)
          Adds a placeholder for dockable and all its children to this area.
 void addPlaceholder(Path placeholder, int x, int y, int width, int height)
          Adds placeholder to this area.
 void addPlaceholder(Path placeholder, Rectangle bounds)
          Adds placeholder to this area.
 CDockablePerspective asDockable()
          Gets this as dockable, if this is a dockable.
 CStationPerspective asStation()
          Gets this as station, if this is a station.
 String getFactoryID()
           
 CPerspective getPerspective()
          Gets the perspective which presents this station.
 PlaceholderMap getPlaceholders()
           
 Path getTypeId()
          Gets the unique id denoting the type of this CStation, this should be the exact same result as CStation.getTypeId() will return.
 String getUniqueId()
          Gets the unique identifier of this station.
 ScreenDockPerspective.ScreenPerspectiveWindow getWindow(CDockablePerspective dockable)
          Gets an object that stores all the properties that are associated with dockable.
 int indexOf(CDockablePerspective dockable)
          Gets the location of dockable.
 CExternalizePerspective.CommonScreenDockPerspective intern()
          Gets the internal representation for this element.
If CElementPerspective.asDockable() returns a non-null value, then intern().asDockable() must not return null either.
If CElementPerspective.asStation() returns a non-null value, then intern().asStation() must not return null either.
 boolean isRoot()
          Tells whether this is a root station or not.
 boolean isWorkingArea()
          Tells whether this station will act as a working area.
 boolean remove(CDockablePerspective dockable)
          Removes dockable from this area.
 CDockablePerspective remove(int index)
          Removes the index'th dockable of this area.
 void setPerspective(CPerspective perspective)
          Informs this station by which perspective it is used.
 void setPlaceholders(PlaceholderMap placeholders)
           
 void setRoot(boolean root)
          Sets the root station flag.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CExternalizePerspective

public CExternalizePerspective(String id,
                               Path typeId)
Creates a new, empty perspective.

Parameters:
id - the unique identifier of this perspective
typeId - the type of this station, can be null
Method Detail

getUniqueId

public String getUniqueId()
Description copied from interface: CStationPerspective
Gets the unique identifier of this station.

Specified by:
getUniqueId in interface CStationPerspective
Returns:
the unique identifier

getTypeId

public Path getTypeId()
Description copied from interface: CStationPerspective
Gets the unique id denoting the type of this CStation, this should be the exact same result as CStation.getTypeId() will return.

Specified by:
getTypeId in interface CStationPerspective
Returns:
the type id, can be null

isRoot

public boolean isRoot()
Description copied from interface: CStationPerspective
Tells whether this is a root station or not.

Specified by:
isRoot in interface CStationPerspective
Returns:
the root flag
See Also:
CStationPerspective.setRoot(boolean)

setRoot

public void setRoot(boolean root)
Description copied from interface: CStationPerspective
Sets the root station flag. Setting flag is equivalent of setting the root parameter when calling CControl.addStation(bibliothek.gui.dock.common.CStation, boolean). The location of a Dockable is always relative to its nearest root-station parent.
Please note that the root-flag set by calling CControl.addStation(bibliothek.gui.dock.common.CStation, boolean) will never be overriden by the flag set in the perspective.

Specified by:
setRoot in interface CStationPerspective

setPerspective

public void setPerspective(CPerspective perspective)
Description copied from interface: CStationPerspective
Informs this station by which perspective it is used.

Specified by:
setPerspective in interface CStationPerspective
Parameters:
perspective - the perspective that uses this station or null

getPerspective

public CPerspective getPerspective()
Description copied from interface: CStationPerspective
Gets the perspective which presents this station.

Specified by:
getPerspective in interface CStationPerspective
Returns:
the owner of this station, can be null

add

public void add(CDockablePerspective dockable,
                Rectangle bounds)
Adds dockable width boundaries bounds to this area.

Parameters:
dockable - the element to add, not null
bounds - the boundaries of dockable

add

public void add(CDockablePerspective dockable,
                int x,
                int y,
                int width,
                int height)
Adds dockable at location x/y with size width/height to this area.

Parameters:
dockable - the element to add, not null
x - the x-coordinate on the screen
y - the y-coordinate on the screen
width - the width of the window
height - the height of the window

add

public void add(CDockablePerspective dockable,
                Rectangle bounds,
                boolean fullscreen)
Adds dockable width boundaries bounds to this area.

Parameters:
dockable - the element to add, not null
bounds - the boundaries of dockable
fullscreen - whether dockable should be extended to fullscreen mode

add

public void add(CDockablePerspective dockable,
                int x,
                int y,
                int width,
                int height,
                boolean fullscreen)
Adds dockable at location x/y with size width/height to this area.

Parameters:
dockable - the element to add, not null
x - the x-coordinate on the screen
y - the y-coordinate on the screen
width - the width of the window
height - the height of the window
fullscreen - whether dockable should be extended to fullscreen mode

addPlaceholder

public void addPlaceholder(CDockablePerspective dockable,
                           Rectangle bounds)
Adds a placeholder for dockable and all its children to this area.

Parameters:
dockable - the element whose placeholder should be inserted
bounds - the location and size of dockable

addPlaceholder

public void addPlaceholder(CDockablePerspective dockable,
                           int x,
                           int y,
                           int width,
                           int height)
Adds a placeholder for dockable and all its children to this area.

Parameters:
dockable - the element whose placeholder should be inserted
x - the x-coordinate on the screen
y - the y-coordinate on the screen
width - the width of the window
height - the height of the window

addPlaceholder

public void addPlaceholder(Path placeholder,
                           Rectangle bounds)
Adds placeholder to this area.

Parameters:
placeholder - the placeholder to add, not null
bounds - the location and size of placeholder

addPlaceholder

public void addPlaceholder(Path placeholder,
                           int x,
                           int y,
                           int width,
                           int height)
Adds placeholder to this area.

Parameters:
placeholder - the placeholder to add, not null
x - the x-coordinate on the screen
y - the y-coordinate on the screen
width - the width of the window
height - the height of the window

getWindow

public ScreenDockPerspective.ScreenPerspectiveWindow getWindow(CDockablePerspective dockable)
Gets an object that stores all the properties that are associated with dockable.

Parameters:
dockable - the element whose window is searched
Returns:
the window, null if dockable is not known to this area

remove

public boolean remove(CDockablePerspective dockable)
Removes dockable from this area.

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

remove

public CDockablePerspective remove(int index)
Removes the index'th dockable of this area.

Parameters:
index - the index of a child of this area
Returns:
the element that was removed, null if the element is not a CDockablePerspective

indexOf

public int indexOf(CDockablePerspective dockable)
Gets the location of dockable.

Parameters:
dockable - some child of this area
Returns:
the location or -1 if not found

intern

public CExternalizePerspective.CommonScreenDockPerspective intern()
Description copied from interface: CElementPerspective
Gets the internal representation for this element.
If CElementPerspective.asDockable() returns a non-null value, then intern().asDockable() must not return null either.
If CElementPerspective.asStation() returns a non-null value, then intern().asStation() must not return null either.

Specified by:
intern in interface CElementPerspective
Returns:
the internal representation

asDockable

public CDockablePerspective asDockable()
Description copied from interface: CElementPerspective
Gets this as dockable, if this is a dockable.

Specified by:
asDockable in interface CElementPerspective
Returns:
this or null

asStation

public CStationPerspective asStation()
Description copied from interface: CElementPerspective
Gets this as station, if this is a station.

Specified by:
asStation in interface CElementPerspective
Returns:
this or null

getFactoryID

public String getFactoryID()

getPlaceholders

public PlaceholderMap getPlaceholders()

setPlaceholders

public void setPlaceholders(PlaceholderMap placeholders)

isWorkingArea

public boolean isWorkingArea()
Description copied from interface: CStationPerspective
Tells whether this station will act as a working area.

Specified by:
isWorkingArea in interface CStationPerspective
Returns:
whether this station acts as working area