fr.inria.insitu.glite.nodes
Class LiteGroup

java.lang.Object
  extended by fr.inria.insitu.glite.Lite
      extended by fr.inria.insitu.glite.nodes.LiteGroup

public class LiteGroup
extends Lite

A Lite managing several Lite objects.

Version:
$Revision: 1.4 $
Author:
Jean-Daniel Fekete

Constructor Summary
LiteGroup()
          Create an empty LiteGroup.
 
Method Summary
 void addChild(int index, Lite l)
          Adds a Lite to this group at the specified index.
 void addChild(Lite l)
          Adds a Lite to the end of this group.
 void clear()
          Removes all the Lite objects from this LiteGroup.
 void descendantModified()
          Notifies this node that one of its descendant has been modified.
 LiteBounds getBounds()
          Returns the bounds of this lite.
 Lite getChild(int i)
          Returns the Lite contained at the specified index in that Lite or null.
 int getChildrenCount()
          Returns the number of children contained in the Lite.
 Point2D getPosition()
          Returns a reference position for this Lite.
 void moveToTop(Lite l)
          Moves the specified Lite to the end of this LiteGroup.
 void paint(LitePaintContext ctx)
          Abstract method to called when the Lite should be painted.
 Lite pick(LiteBounds box)
          Abstract method used to find the top Lite object under a specified bounding box.
 ArrayList<Lite> pickAll(LiteBounds box, ArrayList<Lite> pickStack)
          Abstract method to pick all the Lite objects under a specified bounding box.
 void removeChild(int index)
          Removes the Lite at the specfied index from this LiteGroup.
 void removeChild(Lite l)
          Removes the specified Lite from this LiteGroup.
 void setPosition(double x, double y)
          Change the reference position for this Lite.
 
Methods inherited from class fr.inria.insitu.glite.Lite
getComponent, getHeight, getParent, getWidth, getX, getY, indexOf, modified, moveBy, pick, setParent, setPosition
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

LiteGroup

public LiteGroup()
Create an empty LiteGroup.

Method Detail

descendantModified

public void descendantModified()
Notifies this node that one of its descendant has been modified.

Overrides:
descendantModified in class Lite

getBounds

public LiteBounds getBounds()
Returns the bounds of this lite. Depending on the class, the returned object can be used by the Lite object or new. In general, don't change it and make a copy if you want to hold it. It can also be recomputed each time it is called so this method can be expensive.

Specified by:
getBounds in class Lite
Returns:
the bounds of this lite.

getChild

public Lite getChild(int i)
Returns the Lite contained at the specified index in that Lite or null.

Overrides:
getChild in class Lite
Parameters:
i - the index
Returns:
the Lite contained at the specified index in that Lite or null.

getChildrenCount

public int getChildrenCount()
Returns the number of children contained in the Lite.

Overrides:
getChildrenCount in class Lite
Returns:
the number of children contained in the Lite

addChild

public void addChild(int index,
                     Lite l)
Adds a Lite to this group at the specified index.

Parameters:
index - the index
l - the Lite to add

addChild

public void addChild(Lite l)
Adds a Lite to the end of this group.

Parameters:
l - the Lite to add

removeChild

public void removeChild(Lite l)
Removes the specified Lite from this LiteGroup.

Parameters:
l - the lite to remove

removeChild

public void removeChild(int index)
Removes the Lite at the specfied index from this LiteGroup.

Parameters:
index - the index of the Lite to remove

moveToTop

public void moveToTop(Lite l)
Moves the specified Lite to the end of this LiteGroup.

Parameters:
l - the lite

clear

public void clear()
Removes all the Lite objects from this LiteGroup.


paint

public void paint(LitePaintContext ctx)
Abstract method to called when the Lite should be painted.

Specified by:
paint in class Lite
Parameters:
ctx - the LitePaintContext

pick

public Lite pick(LiteBounds box)
Abstract method used to find the top Lite object under a specified bounding box.

Specified by:
pick in class Lite
Parameters:
box - the box
Returns:
the top Lite under the box or null.

pickAll

public ArrayList<Lite> pickAll(LiteBounds box,
                               ArrayList<Lite> pickStack)
Abstract method to pick all the Lite objects under a specified bounding box. The topmost object is added first, then all the other objects are added.

Specified by:
pickAll in class Lite
Parameters:
box - the bounding box
pickStack - an ArrayList that will hold the Lite objects or null if you want the Lite to allocate it by itself.
Returns:
a list of all the picked Lite objects.

getPosition

public Point2D getPosition()
Returns a reference position for this Lite.

Specified by:
getPosition in class Lite
Returns:
a reference position for this Lite.

setPosition

public void setPosition(double x,
                        double y)
Change the reference position for this Lite.

Specified by:
setPosition in class Lite
Parameters:
x - the new x coordinate
y - the new y coordinate


Copyright © 2006 by Jean-Daniel Fekete and INRIA, France All rights reserved.