|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--edu.umd.cs.jazz.util.ZSceneGraphEditor
ZSceneGraphEditor provides a convenience mechanism used to locate and create instances of the following types of group nodes:
For example, you can use a graph editor to obtain a ZTransformGroup for a leaf node. The first time you do this, a new ZTransformGroup is inserted above the leaf. Subsequently, that ZTransformGroup is reused. e.g.
ZTransformGroup t = node.editor().getTransformGroup(); t.translate(1, 0);will translate node by 1, 0. Repeatedly executing this code will cause the node to move horizontally across the screen.
If multiple group types are created for a given node in the scene graph, they are ordered as shown in the list above - so custom groups will be inserted at the top (closest to the root), whereas spatialIndex groups will be inserted at the bottom (closest to the node being edited.)
Group nodes inserted into the scene graph by ZSceneGraphEditor have their hasOneChild flag set to true - such group nodes are referred to as "edit groups", and can only act on the single node immediately beneath them in the scene graph. This guarantees that translations or scalings applied to a ZTransformGroup node created by ZSceneGraphEditor effect only the node being edited. ZSceneGraphEditor uses the hasOneChild flag to identify edit groups that it has created in the scene graph, to avoid creating the same group nodes twice.
Customization: You can also use the scene graph editor to manage your own custom edit groups. This is done with the following methods;
getEditGroup(ZMyCustomGroup.class); hasEditGroup(ZMyCustomGroup.class); removeEditGroup(ZMyCustomGroup.class);If ZMyCustomGroup.class is a class that the scene graph editor does not have ordering information for then the edit group will be inserted at the top of the edit groups.
If you need to have your edit group inserted somewhere else (for example below the ZTransformGroup editor) then you need to give the ZSceneGraphEditor ordering information for this that type. This is done by calling
ZSceneGraphEditor.setEditorOrder(ZMyCustomGroup.class, ZSceneGraphEditor.TRANSFORM_GROUP_ORDER - 1);
Warning: Serialized and ZSerialized objects of this class will not be compatible with future Jazz releases. The current serialization support is appropriate for short term storage or RMI between applications running the same version of Jazz. A future release of Jazz will provide support for long term persistence.
ZNode.editor()
, Serialized FormInner Class Summary | |
protected class |
ZSceneGraphEditor.ZEditGroupIterator
|
Field Summary | |
static int |
ANCHOR_GROUP_ORDER
|
static int |
CLIP_GROUP_ORDER
|
protected ZNode |
editNode
The edit node. |
static int |
FADE_GROUP_ORDER
|
static int |
INVISIBLE_GROUP_ORDER
|
static int |
LAYOUT_GROUP_ORDER
|
static int |
NAME_GROUP_ORDER
Defines the ordering of the edit goups above the edit node. |
static int |
SELECTION_GROUP_ORDER
|
static int |
SPATIAL_INDEX_GROUP_ORDER
|
static int |
STICKY_GROUP_ORDER
|
static int |
TRANSFORM_GROUP_ORDER
|
Constructor Summary | |
ZSceneGraphEditor(ZNode aNode)
Create a new editor for aNode. |
Method Summary | |
java.util.Iterator |
editorIterator()
Returns an iterator over the list of "edit" groups above the node - groups above the node whose hasOneChild flag is set to true. |
ZAnchorGroup |
getAnchorGroup()
Returns a ZAnchorGroup to use for a node, inserting one above the edited node if none exists. |
ZClipGroup |
getClipGroup()
Returns a ZClipGroup to use for a node, inserting one above the edited node if none exists. |
ZGroup |
getEditGroup(java.lang.Class aType)
Checks to see if an editor of this type already exists, if so it returns that editor if not it creates a new editor, inserts that editor above the edit node, and then returns that new editor. |
ZFadeGroup |
getFadeGroup()
Returns a ZFadeGroup to use for a node, inserting one above the edited node if none exists. |
java.util.ArrayList |
getGroups()
Deprecated. as of Jazz 1.1 editorIterator() instead. |
ZInvisibleGroup |
getInvisibleGroup()
Returns a ZInvisibleGroup to use for a node, inserting one above the edited node if none exists. |
ZLayoutGroup |
getLayoutGroup()
Returns a ZLayoutGroup to use for a node, inserting one above the edited node if none exists. |
ZNameGroup |
getNameGroup()
Returns a ZNameGroup to use for a node, inserting one above the edited node if none exists. |
ZNode |
getNode()
Returns the node being edited. |
protected int |
getOrderFor(java.lang.Class aType)
Returns the order where aType of editor group should be inserted above the edit node. |
ZSelectionGroup |
getSelectionGroup()
Returns a ZSelectionGroup to use for a node, inserting one above the edited node if none exists. |
ZSpatialIndexGroup |
getSpatialIndexGroup()
Returns a ZSpatialIndexGroup to use for a node, inserting one above the edited node if none exists. |
ZStickyGroup |
getStickyGroup()
Returns a ZStickyGroup to use for a node, inserting one above the edited node if none exists. |
ZNode |
getTop()
If ZSceneGraphEditor has inserted groups above a node, this returns the topmost of those groups (the group nearest the root of the scene graph). |
ZTransformGroup |
getTransformGroup()
Returns a ZTransformGroup to use for a node, inserting one above the edited node if none exists. |
boolean |
hasAnchorGroup()
Returns true if this node has a ZAnchorGroup above it as an edit group, false otherwise. |
boolean |
hasClipGroup()
Returns true if this node has a ZClipGroup above it as an edit group, false otherwise. |
boolean |
hasEditGroup(java.lang.Class aType)
Searches to see if the edit node has an edit group of a matching type. |
boolean |
hasFadeGroup()
Returns true if this node has a ZFadeGroup above it as an edit group, false otherwise. |
boolean |
hasInvisibleGroup()
Returns true if this node has a ZInvisibleGroup above it as an edit group, false otherwise. |
boolean |
hasLayoutGroup()
Returns true if this node has a ZLayoutGroup above it as an edit group, false otherwise. |
boolean |
hasNameGroup()
Returns true if this node has a ZNameGroup above it as an edit group, false otherwise. |
boolean |
hasSelectionGroup()
Returns true if this node has a ZSelectionGroup above it as an edit group, false otherwise. |
boolean |
hasSpatialIndexGroup()
Returns true if this node has a ZSpatialIndexGroup above it as an edit group, false otherwise. |
boolean |
hasStickyGroup()
Returns true if this node has a ZStickyGroup above it as an edit group, false otherwise. |
boolean |
hasTransformGroup()
Returns true if this node has a ZTransformGroup above it as an edit group, false otherwise. |
protected void |
insertEditGroup(ZGroup aGroup)
Insert aGroup above the edit node. |
protected boolean |
isEditGroup(ZNode aNode)
Returns true if aNode is an edit group; |
boolean |
removeAnchorGroup()
Removes a ZAnchorGroup edit group from above a node. |
boolean |
removeClipGroup()
Removes a ZClipGroup edit group from above a node. |
boolean |
removeEditGroup(java.lang.Class aType)
Looks for an edit group of matching type, and if found removes that edit group. |
boolean |
removeFadeGroup()
Removes a ZFadeGroup edit group from above a node. |
boolean |
removeInvisibleGroup()
Removes a ZInvisibleGroup edit group from above a node. |
boolean |
removeLayoutGroup()
Removes a ZLayoutGroup edit group from above a node. |
boolean |
removeNameGroup()
Removes a ZNameGroup edit group from above a node. |
boolean |
removeSelectionGroup()
Removes a ZSelectionGroup edit group from above a node. |
boolean |
removeSpatialIndexGroup()
Removes a ZSpatialIndexGroup edit group from above a node. |
boolean |
removeStickyGroup()
Removes a ZStickyGroup edit group from above a node. |
boolean |
removeTransformGroup()
Removes a TransformGroup edit group from above a node. |
static void |
setEditorOrder(java.lang.Class aType,
int aOrder)
Set the ordering information for aType of edit group. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
public static final int NAME_GROUP_ORDER
public static final int INVISIBLE_GROUP_ORDER
public static final int LAYOUT_GROUP_ORDER
public static final int ANCHOR_GROUP_ORDER
public static final int TRANSFORM_GROUP_ORDER
public static final int STICKY_GROUP_ORDER
public static final int SELECTION_GROUP_ORDER
public static final int CLIP_GROUP_ORDER
public static final int FADE_GROUP_ORDER
public static final int SPATIAL_INDEX_GROUP_ORDER
protected ZNode editNode
Constructor Detail |
public ZSceneGraphEditor(ZNode aNode)
Method Detail |
public static void setEditorOrder(java.lang.Class aType, int aOrder)
public ZNode getTop()
public ZNode getNode()
public java.util.ArrayList getGroups()
public java.util.Iterator editorIterator()
public ZGroup getEditGroup(java.lang.Class aType)
type
- The type of edit group to returnpublic ZTransformGroup getTransformGroup()
public ZFadeGroup getFadeGroup()
public ZStickyGroup getStickyGroup()
public ZSelectionGroup getSelectionGroup()
public ZAnchorGroup getAnchorGroup()
public ZLayoutGroup getLayoutGroup()
public ZNameGroup getNameGroup()
public ZInvisibleGroup getInvisibleGroup()
public ZSpatialIndexGroup getSpatialIndexGroup()
public ZClipGroup getClipGroup()
public boolean hasEditGroup(java.lang.Class aType)
type
- The type of edit group to search for.public boolean hasTransformGroup()
public boolean hasFadeGroup()
public boolean hasStickyGroup()
public boolean hasSelectionGroup()
public boolean hasAnchorGroup()
public boolean hasLayoutGroup()
public boolean hasNameGroup()
public boolean hasInvisibleGroup()
public boolean hasSpatialIndexGroup()
public boolean hasClipGroup()
public boolean removeEditGroup(java.lang.Class aType)
type
- The type of edit group to removepublic boolean removeTransformGroup()
public boolean removeFadeGroup()
public boolean removeStickyGroup()
public boolean removeSelectionGroup()
public boolean removeAnchorGroup()
public boolean removeLayoutGroup()
public boolean removeNameGroup()
public boolean removeInvisibleGroup()
public boolean removeClipGroup()
public boolean removeSpatialIndexGroup()
protected boolean isEditGroup(ZNode aNode)
protected void insertEditGroup(ZGroup aGroup)
protected int getOrderFor(java.lang.Class aType)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |