public class ParentMap
extends java.lang.Object
implements java.io.Serializable
Modifier and Type | Class and Description |
---|---|
class |
ParentMap.Entry
Object that represents the relation between a child an a parent.
|
Modifier and Type | Field and Description |
---|---|
protected java.util.Set |
changedNodes
Set of changed changedNodes for the parent map.
|
protected java.util.Map |
childCount
Maps parents to integers with the future number of childs.
|
protected java.util.ArrayList |
entries
Contents of the parent map.
|
Constructor and Description |
---|
ParentMap()
Constructs a
ParentMap object. |
ParentMap(java.lang.Object[] children,
java.lang.Object parent)
Constructs a
ParentMap object. |
Modifier and Type | Method and Description |
---|---|
void |
addEntries(java.lang.Object[] children,
java.lang.Object parent)
Adds all child parent pairs using addEntry.
|
void |
addEntry(java.lang.Object child,
java.lang.Object parent)
Add a new entry for this child, parent pair to the parent map.
|
ParentMap |
clone(java.util.Map map)
Creates a new parent map based on this parent map, where the child and
parents are mapped using
map . |
static ParentMap |
create(GraphModel m,
java.lang.Object[] c,
boolean remove,
boolean onlyUsePassedInCells)
Returns a parent map that represents the insertion or removal of
cells in model based on remove . |
java.util.Iterator |
entries()
Returns an
Iterator for the entries in the map. |
java.util.Set |
getChangedNodes()
Returns a
Set for the nodes, childs and parents, in this
parent map. |
int |
size()
Returns the number of entries.
|
java.lang.String |
toString() |
protected java.util.ArrayList entries
protected java.util.Set changedNodes
protected java.util.Map childCount
public ParentMap()
ParentMap
object.public ParentMap(java.lang.Object[] children, java.lang.Object parent)
ParentMap
object.public static ParentMap create(GraphModel m, java.lang.Object[] c, boolean remove, boolean onlyUsePassedInCells)
cells
in model
based on remove
.
Unselected childs of selected nodes are moved to the first unselected
parent of that node.
Note: Consequently, cells "move up" one level when their parent is removed. Note: onlyUsePassedInCells can be used to indicate if only cells from the passed-in cell array are allowed parents. This is only used if remove is not true.
public void addEntry(java.lang.Object child, java.lang.Object parent)
public void addEntries(java.lang.Object[] children, java.lang.Object parent)
public int size()
public java.util.Iterator entries()
Iterator
for the entries in the map.public java.util.Set getChangedNodes()
Set
for the nodes, childs and parents, in this
parent map.public ParentMap clone(java.util.Map map)
map
. If one the cells is not in
map
, then the original cell is used instead.
public java.lang.String toString()
toString
in class java.lang.Object
Copyright (C) 2001-2009 JGraph Ltd. All rights reserved.