bibliothek.gui.dock.station.screen
Class ScreenDockPerspective

java.lang.Object
  extended by bibliothek.gui.dock.station.screen.ScreenDockPerspective
All Implemented Interfaces:
PerspectiveElement, PerspectiveStation
Direct Known Subclasses:
CExternalizePerspective.CommonScreenDockPerspective

public class ScreenDockPerspective
extends Object
implements PerspectiveStation

A representation of a ScreenDockStation in a Perspective.

Author:
Benjamin Sigg

Nested Class Summary
static class ScreenDockPerspective.ScreenPerspectiveWindow
          Represents a child of a ScreenDockPerspective.
 
Constructor Summary
ScreenDockPerspective()
           
 
Method Summary
 void add(PerspectiveDockable dockable, int x, int y, int width, int height)
          Adds dockable at location x/y with size width/height to this perspective.
 void add(PerspectiveDockable dockable, int x, int y, int width, int height, boolean fullscreen)
          Adds dockable at location x/y with size width/height to this perspective.
 void add(PerspectiveDockable dockable, Rectangle bounds)
          Adds dockable with boundaries bounds to this perspective.
 void add(PerspectiveDockable dockable, Rectangle bounds, boolean fullscreen)
          Adds dockable width boundaries bounds to this perspective
 void addPlaceholder(Path placeholder, int x, int y, int width, int height)
          Adds placeholder to this station.
 void addPlaceholder(Path placeholder, Rectangle bounds)
          Adds placeholder to this station.
 void addPlaceholder(PerspectiveDockable dockable, int x, int y, int width, int height)
          Adds a placeholder for dockable and all its children to this station.
 void addPlaceholder(PerspectiveDockable dockable, Rectangle bounds)
          Adds a placeholder for dockable and all its children to this station.
 PerspectiveDockable asDockable()
          Returns the representation of this as PerspectiveDockable.
 PerspectiveStation asStation()
          Returns the representation of this as PerspectiveStation
 PerspectiveDockable getDockable(int index)
          Gets the index'th child of this station.
 int getDockableCount()
          Gets the number of children this station has.
 DockableProperty getDockableProperty(PerspectiveDockable child, PerspectiveDockable target)
          Gets precise information about the location of a child of this station.
 String getFactoryID()
          Gets the identifier of the DockFactory that will be able to understand the layout information this element generates.
 PlaceholderMap getPlaceholders()
          Converts the contents of this station into a map of placeholders.
 ScreenDockPerspective.ScreenPerspectiveWindow getWindow(PerspectiveDockable dockable)
          Gets access to the window that shows dockable
 int indexOf(PerspectiveDockable dockable)
          Gets the index of dockable.
 void read(PlaceholderMap map, Map<Integer,PerspectiveDockable> children)
          Reads the contents of map and replaces any content of this perspective.
 PerspectiveDockable remove(int index)
          Removes the index'th element of this station.
 boolean remove(PerspectiveDockable dockable)
          Removes the child dockable from this station.
 void replace(PerspectiveDockable oldDockable, PerspectiveDockable newDockable)
          Replaces oldDockable by newDockable.
 void setPlaceholders(PlaceholderMap placeholders)
          Informs this station of the content that it should show
 PlaceholderMap toMap(Map<PerspectiveDockable,Integer> children)
          Converts the content of this perspective to a PlaceholderMap that can be stored persistently.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ScreenDockPerspective

public ScreenDockPerspective()
Method Detail

read

public void read(PlaceholderMap map,
                 Map<Integer,PerspectiveDockable> children)
Reads the contents of map and replaces any content of this perspective.

Parameters:
map - the layout
children - the children of this station

getDockable

public PerspectiveDockable getDockable(int index)
Description copied from interface: PerspectiveStation
Gets the index'th child of this station.

Specified by:
getDockable in interface PerspectiveStation
Parameters:
index - the index of a child
Returns:
the child, not null

getDockableCount

public int getDockableCount()
Description copied from interface: PerspectiveStation
Gets the number of children this station has.

Specified by:
getDockableCount in interface PerspectiveStation
Returns:
the number of children

asDockable

public PerspectiveDockable asDockable()
Description copied from interface: PerspectiveElement
Returns the representation of this as PerspectiveDockable.

Specified by:
asDockable in interface PerspectiveElement
Returns:
either this, a representation of this or null

asStation

public PerspectiveStation asStation()
Description copied from interface: PerspectiveElement
Returns the representation of this as PerspectiveStation

Specified by:
asStation in interface PerspectiveElement
Returns:
either this, a representation of this or null

getFactoryID

public String getFactoryID()
Description copied from interface: PerspectiveElement
Gets the identifier of the DockFactory that will be able to understand the layout information this element generates.

Specified by:
getFactoryID in interface PerspectiveElement
Returns:
the factories identifier

setPlaceholders

public void setPlaceholders(PlaceholderMap placeholders)
Description copied from interface: PerspectiveStation
Informs this station of the content that it should show

Specified by:
setPlaceholders in interface PerspectiveStation
Parameters:
placeholders - a map that was earlier created by PerspectiveStation.getPlaceholders()

getPlaceholders

public PlaceholderMap getPlaceholders()
Description copied from interface: PerspectiveStation
Converts the contents of this station into a map of placeholders.

Specified by:
getPlaceholders in interface PerspectiveStation
Returns:
a map of placeholders describing the contents of this station

toMap

public PlaceholderMap toMap(Map<PerspectiveDockable,Integer> children)
Converts the content of this perspective to a PlaceholderMap that can be stored persistently.

Parameters:
children - unique identifiers for the children of this perspective
Returns:
the map, not null

add

public void add(PerspectiveDockable dockable,
                Rectangle bounds)
Adds dockable with boundaries bounds to this perspective.

Parameters:
dockable - the element to add
bounds - the boundaries of dockable

add

public void add(PerspectiveDockable dockable,
                Rectangle bounds,
                boolean fullscreen)
Adds dockable width boundaries bounds to this perspective

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(PerspectiveDockable dockable,
                int x,
                int y,
                int width,
                int height)
Adds dockable at location x/y with size width/height to this perspective.

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(PerspectiveDockable dockable,
                int x,
                int y,
                int width,
                int height,
                boolean fullscreen)
Adds dockable at location x/y with size width/height to this perspective.

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(PerspectiveDockable dockable,
                           Rectangle bounds)
Adds a placeholder for dockable and all its children to this station.

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

addPlaceholder

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

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 station.

Parameters:
placeholder - the placeholder to add
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 station.

Parameters:
placeholder - the placeholder to add
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

indexOf

public int indexOf(PerspectiveDockable dockable)
Gets the index of dockable.

Parameters:
dockable - some child of this station
Returns:
the index or -1 if dockable was not found

remove

public boolean remove(PerspectiveDockable dockable)
Removes the child dockable from this station.

Specified by:
remove in interface PerspectiveStation
Parameters:
dockable - the element to remove
Returns:
true if dockable was removed, false otherwise

remove

public PerspectiveDockable remove(int index)
Removes the index'th element of this station.

Parameters:
index - the index of the element to remove
Returns:
the removed element

replace

public void replace(PerspectiveDockable oldDockable,
                    PerspectiveDockable newDockable)
Description copied from interface: PerspectiveStation
Replaces oldDockable by newDockable. This method should behave the same way is if oldDockable was removed and newDockable added at the same location.

Specified by:
replace in interface PerspectiveStation
Parameters:
oldDockable - some child of this station
newDockable - the replacement for oldDockable

getWindow

public ScreenDockPerspective.ScreenPerspectiveWindow getWindow(PerspectiveDockable dockable)
Gets access to the window that shows dockable

Parameters:
dockable - the element whose window is requested
Returns:
the window or null if dockable was not found

getDockableProperty

public DockableProperty getDockableProperty(PerspectiveDockable child,
                                            PerspectiveDockable target)
Description copied from interface: PerspectiveStation
Gets precise information about the location of a child of this station.

Specified by:
getDockableProperty in interface PerspectiveStation
Parameters:
child - a child of this station, this childs location is asked
target - an optional hint telling for which dockable the location information will be used, can be null. This hint can be used to find a placeholder that should be part of the result.
Returns:
the location