de.fhg.igd.earth.model.graph
Class HistoryGroup

java.lang.Object
  extended byde.fhg.igd.earth.model.graph.ProjectorObject
      extended byde.fhg.igd.earth.model.graph.ModelGraphObject
          extended byde.fhg.igd.earth.model.graph.Node
              extended byde.fhg.igd.earth.model.graph.Group
                  extended byde.fhg.igd.earth.model.graph.SwitchGroup
                      extended byde.fhg.igd.earth.model.graph.HistoryGroup
All Implemented Interfaces:
Cloneable, Serializable

public class HistoryGroup
extends SwitchGroup
implements Serializable, Cloneable

A HistoryGroup represents a group which can store mutable nodes and all their changes. Mutable nodes can be traced by an observer. After you have changed the FIRST child of this group you can let it clone automaticly by calling createNewChild(). The first child is the youngest, and the last one is the oldest. You can set a maximum capacity, the current capacity and the view depth. Also you can call the createNewConnector() methode witch creates a default connector (flat an spherical) between the first and the second child. Title : Earth Copyright : Copyright (c) 2001 Organisation : IGD FhG

Version:
: 1.0
Author:
: Werner Beutel
See Also:
Serialized Form

Field Summary
private  int capacity_
          current capacity = maximum of children
protected  String datapath_
          Datapath for Icons
private  int hops_
          number of hops since creation
static String ICON_ACTIVE
          active agent icon
static String ICON_HISTORY
          inactive agent icon
private  int maxCapacity_
          maximum capacity sets the highest capacity value
private  int viewDepth_
          defines how much children will be visible.
 
Fields inherited from class de.fhg.igd.earth.model.graph.SwitchGroup
CHILD_ALL, CHILD_MASK, CHILD_NONE
 
Fields inherited from class de.fhg.igd.earth.model.graph.Group
maxNumChildren_
 
Fields inherited from class de.fhg.igd.earth.model.graph.Node
boundless_, collidable_, icon_, parent_, pickable_
 
Fields inherited from class de.fhg.igd.earth.model.graph.ModelGraphObject
CHANGE_AddChild, CHANGE_Anything, CHANGE_Appearance, CHANGE_Color, CHANGE_Create, CHANGE_Delete, CHANGE_Focus, CHANGE_HistoryGroup, CHANGE_InfoTable, CHANGE_Object, CHANGE_RemoveChild, CHANGE_Shape, CHANGE_Trace, CHANGE_Update, CHANGE_Visibility, changes_, infoTable_, mutable_, name_, subChanges_, SUBTYPE_BackGround, SUBTYPE_Box, SUBTYPE_BranchGroup, SUBTYPE_Cone, SUBTYPE_Cylinder, SUBTYPE_DetailGroup, SUBTYPE_DistanceDetailGroup, SUBTYPE_Group, SUBTYPE_HistoryGroup, SUBTYPE_LatchGroup, SUBTYPE_ModelGraph, SUBTYPE_Polygon, SUBTYPE_Primitive, SUBTYPE_Sphere, SUBTYPE_Text, SUBTYPE_TransformGroup, SUBTYPE_WireBoxGroup, timeStamp_, trace_, traceable_, TYPE_Group, TYPE_Leaf
 
Fields inherited from class de.fhg.igd.earth.model.graph.ProjectorObject
projectorObject_
 
Constructor Summary
HistoryGroup(int capacity, int maxCapacity, int viewDepth)
          Constructs and initializes a HistoryGroup.
 
Method Summary
protected  boolean allowChildAddEvent(Node n)
          Overwrites the group class method.
 void calcBoundingBox(cBoundingBox boundingBox)
          Overwrites the Group method.
private  void calcConnectorColor()
          Calculates and updates the connector color for all children.
private  void checkViewDepth()
          Checks the view depth and calculates the childMask
protected  void childAddedEvent(int index)
          This method is called AFTER a new child was added to this group.
 Object clone()
          Clones this HistoryGroup
 Node createNewChild()
          Clones the first child and includes the clone AFTER the first child.
 void createNewConnector()
          Creates a new connector.
 int getCapacity()
          Returns the capacity.
 int getHops()
          Returns the number of hops
 int getMaxCapacity()
          Returns the maximum capacity.
 int getSubType()
          Returns SUBTYPE_HistoryGroup.
 int getType()
          Returns TYPE_Group.
 int getViewDepth()
          Returns the view depth.
 boolean setCapacity(int cap)
          Sets the current capacity (blocked by mutable and limited by maxCapacity)
 void setDatapath(String datapath)
          Sets the "Datapath" for icons
 boolean setInfoTable(Hashtable infoTable)
          Overwrites the current infoTable with a new one (blocked by mutable).
 boolean setViewDepth(int vd)
          Sets the view depth (blocked by mutable and limited by capacity) Released changes: CHANGE_UPDATE, CHANGE_HISTORYGROUP
 
Methods inherited from class de.fhg.igd.earth.model.graph.SwitchGroup
childRemovedEvent, getChildMask, getWitchChild, setChildMask, setWitchChild
 
Methods inherited from class de.fhg.igd.earth.model.graph.Group
addChild, createLeafList, createSubGroupList, createSubNodeList, detach, detachedEvent, getAllChildren, getChild, getErasedChildren, numChildren, removeAllChildren, removeChild, removeChild, resetChanges, searchDown, searchDown, searchDown, searchDown, searchDownInserter, searchDownInserter, setChildAt, setColor, setHighLight, setMutable, setVisible
 
Methods inherited from class de.fhg.igd.earth.model.graph.Node
broadcastCreation, broadcastResetChanges, createParentGroupList, delete, delete, getBoundingBox, getBoundless, getBranchGroup, getCollidable, getGroup, getIcon, getLeafList, getModelGraph, getParent, getParentGroupList, getPickable, getSubGroupList, getSubNodeList, isFocused, move, move, moveTo, publishChanges, resetProjectorObject, searchUp, searchUp, searchUp, searchUp, setBoundless, setCollidable, setIcon, setParent, setPickable
 
Methods inherited from class de.fhg.igd.earth.model.graph.ModelGraphObject
anyChanges, anySubChanges, getChanges, getChanges, getInfoTable, getInfoTableElements, getInfoTableKeys, getInfoTableSize, getInfoTableValues, getMutable, getName, getSubChanges, getSubChanges, getSubTypeName, getTimeStamp, getTrace, getTraceable, putInfo, setChanges, setName, setSubChanges, setTrace, VectorClone
 
Methods inherited from class de.fhg.igd.earth.model.graph.ProjectorObject
getProjectorObject, setProjectorObject
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

datapath_

protected String datapath_
Datapath for Icons


ICON_ACTIVE

public static final String ICON_ACTIVE
active agent icon

See Also:
Constant Field Values

ICON_HISTORY

public static final String ICON_HISTORY
inactive agent icon

See Also:
Constant Field Values

hops_

private int hops_
number of hops since creation


capacity_

private int capacity_
current capacity = maximum of children


maxCapacity_

private int maxCapacity_
maximum capacity sets the highest capacity value


viewDepth_

private int viewDepth_
defines how much children will be visible.

Constructor Detail

HistoryGroup

public HistoryGroup(int capacity,
                    int maxCapacity,
                    int viewDepth)
Constructs and initializes a HistoryGroup. Traceable is set to TRUE. maxNumChildren is set to 1 ! YOU can only add one child. All others are clones.

Parameters:
capacity - Current capacity
maxCapacity - Highest capacity value
Method Detail

getType

public int getType()
Returns TYPE_Group. Defined in ModelGraphObject

Overrides:
getType in class Group
Returns:
type (always TYPE_Group)

getSubType

public int getSubType()
Returns SUBTYPE_HistoryGroup. Defined in ModelGraphObject

Overrides:
getSubType in class Group
Returns:
subType (always SUBTYPE_HistoryGroup)

setCapacity

public boolean setCapacity(int cap)
Sets the current capacity (blocked by mutable and limited by maxCapacity)

Parameters:
cap - Capacity
Returns:
true on success

getCapacity

public int getCapacity()
Returns the capacity.

Returns:
Capacity

getMaxCapacity

public int getMaxCapacity()
Returns the maximum capacity.

Returns:
Maximum capacity

getViewDepth

public int getViewDepth()
Returns the view depth.

Returns:
view depth

setViewDepth

public boolean setViewDepth(int vd)
Sets the view depth (blocked by mutable and limited by capacity) Released changes: CHANGE_UPDATE, CHANGE_HISTORYGROUP

Parameters:
vd - View depth
Returns:
true on success

checkViewDepth

private void checkViewDepth()
Checks the view depth and calculates the childMask


getHops

public int getHops()
Returns the number of hops

Returns:
hops

childAddedEvent

protected void childAddedEvent(int index)
This method is called AFTER a new child was added to this group. It will be called by the addChild() method. A new name will be created. Name=Hop[x]: timestamp. The icons will be updated, the capacity will be checked...

Overrides:
childAddedEvent in class SwitchGroup
Parameters:
index - Index of the new node

createNewChild

public Node createNewChild()
Clones the first child and includes the clone AFTER the first child. The child wont be cloned completely ! The sub group named "Head" will be deleted after cloning. So only the Body will be existent in the second child and only the first one has got a head and a body.

Returns:
The first node (youngest child)

createNewConnector

public void createNewConnector()
Creates a new connector. A connector is a line from the first child to the second (flat and spherical).


setInfoTable

public boolean setInfoTable(Hashtable infoTable)
Overwrites the current infoTable with a new one (blocked by mutable). Released changes: CHANGE_UPDATE, CHANGE_INFOTABLE

Overrides:
setInfoTable in class ModelGraphObject
Parameters:
infoTable - The new infoTable of this object.
Returns:
true on success

calcConnectorColor

private void calcConnectorColor()
Calculates and updates the connector color for all children. As younger a child as brighter the connector is.


allowChildAddEvent

protected boolean allowChildAddEvent(Node n)
Overwrites the group class method. Only Groups and TransformGroups are permitted as children.

Overrides:
allowChildAddEvent in class Group
Parameters:
n - Node
Returns:
true if child is allowed to be added

calcBoundingBox

public void calcBoundingBox(cBoundingBox boundingBox)
Overwrites the Group method. Only the bounding box of the youngest child needs to be combined.

Overrides:
calcBoundingBox in class Group
Parameters:
boundingBox - which will be combined with

setDatapath

public void setDatapath(String datapath)
Sets the "Datapath" for icons


clone

public Object clone()
Clones this HistoryGroup

Overrides:
clone in class SwitchGroup


Copyright © Fraunhofer Gesellschaft. All Rights Reserved.