gishur.gui2
Class LayerManager

java.lang.Object
  |
  +--gishur.gui2.DrawAtom
        |
        +--gishur.gui2.DrawManager
              |
              +--gishur.gui2.LayerManager

public class LayerManager
extends DrawManager

A LayerManager is a DrawManager that manages a list of Layers, one BackgroundLayer and one InputLayer. A LayerManager accepts (and consumes) the following messages:
Accepted Messages
Message ID Argument Type Meaning
gain_focus gishur.gui2.DisplayObject Gains the focus for the given DisplayObject.
lose_focus gishur.gui2.DisplayObject Loses the focus of the actual focused Object.

Version:
1.0
Author:
Thomas Wolf
See Also:
BackgroundLayer, InputLayer

Fields inherited from class gishur.gui2.DrawAtom
BLOCK_REPAINT, MARK_RECALC, MARK_REPAINT, MARK_SIZE, REPAINT, UNBLOCK_REPAINT, USER_STATES_FIRST, USER_STATES_MASK
 
Constructor Summary
LayerManager()
          Default constructor.
 
Method Summary
 void add(Layer layer)
          Adds the Layer layer at the end of the layer list.
 BackgroundLayer background()
          Returns the background layer of this LayerManager.
 Layer first()
          Returns the first stored Layer in the LayerManager.
 InputLayer input()
          Returns the input layer of this LayerManager.
 void insert(Layer l, Layer layer)
          Inserts the Layer layer in the layer list before l.
 Layer last()
          Returns the last stored Layer in the LayerManager.
 Layer layer(int i)
          Returns the layer with the given index.
 int layerCount()
          Returns the number of the stored layers.
 void remove(Layer layer)
          Removes the given Layer from this layer list.
 void setBackground(BackgroundLayer back)
          Set the background to the given background layer.
 void setInputLayer(InputLayer input)
          Set the input layer.
 void setScreenTransformation(ScreenTransformation transform)
          Sets the screen transformation for this Layer.
 
Methods inherited from class gishur.gui2.DrawManager
dispatchEvent, displayManager, draw, drawComponent, processMessage, recalculate
 
Methods inherited from class gishur.gui2.DrawAtom
addProperties, collectHits, getBounds, getLocalProperty, getProperty, getProperty, getRequiredProperty, locate, prepeareRenderContext, preprocessEvent, properties, removeProperty, sendEvent, sendMessage, setBounds, setPropertiesTo, setProperty, setProperty, setProperty, setProperty, toString, toString, toStringDetail, toTreeString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

LayerManager

public LayerManager()
Default constructor.
Method Detail

background

public BackgroundLayer background()
Returns the background layer of this LayerManager.
Returns:
the background layer.

input

public InputLayer input()
Returns the input layer of this LayerManager.
Returns:
the input layer

setBackground

public void setBackground(BackgroundLayer back)
Set the background to the given background layer.
Parameters:
back - the new BackgroundLayer

setInputLayer

public void setInputLayer(InputLayer input)
Set the input layer.
Parameters:
input - new input layer

setScreenTransformation

public final void setScreenTransformation(ScreenTransformation transform)
Sets the screen transformation for this Layer. The transformation will be stored under the key "screen_transformation" in this layers properties list. To initialize the ScreenTransformation correctly, use this method instead of DrawAtom.setProperty(java.lang.String, java.lang.Object).
Parameters:
transform - the new ScreenTransformation

first

public Layer first()
Returns the first stored Layer in the LayerManager.
Returns:
first Layer

last

public Layer last()
Returns the last stored Layer in the LayerManager.
Returns:
last Layer

layer

public Layer layer(int i)
Returns the layer with the given index.
Parameters:
index - of the layer (0 for the first)
Returns:
the layer with index i

layerCount

public int layerCount()
Returns the number of the stored layers.
Returns:
number of the stored layers

add

public void add(Layer layer)
Adds the Layer layer at the end of the layer list.
Parameters:
layer - Layer to add

insert

public void insert(Layer l,
                   Layer layer)
Inserts the Layer layer in the layer list before l.
Parameters:
l - Layer to insert before or null to add at the end of the layer list
layer - Layer to insert

remove

public void remove(Layer layer)
Removes the given Layer from this layer list. All members of the layer are removed.
Parameters:
layer - Layer to remove