public class IlvMapLayerTreeModel extends DefaultTreeModel implements IlvPersistentObject
IlvMapLayerTreeModel is a TreeModel that has been
specialized to handle IlvMapLayerTreeNode objects. A data source
model can be attached to an IlvManager instance through an
IlvMapLayerTreeProperty object in order to be saved in an
.ivl file. The following code example shows how to retrieve the
data source model from an IlvManager object and inserts a data
source.
IlvMapLayerTreeModel model = IlvMapLayerTreeProperty.GetMapLayerTreeModel(manager); IlvMapLayer layer = new IlvMapLayer(); IlvMapLayerTreeNode node = new IlvMapLayerTreeNode(layer); model.insertNodeInto(node, pnode, pnode.getChildCount());
asksAllowsChildren, listenerList, root| Constructor and Description |
|---|
IlvMapLayerTreeModel()
Constructs an empty
IlvMapLayerTreeModel instance. |
IlvMapLayerTreeModel(IlvInputStream stream)
Reads an
IlvMapLayerTreeModel object from an
IlvInputStream. |
| Modifier and Type | Method and Description |
|---|---|
void |
activateListener(boolean activate)
Activate or deactivates the
TreeModelListener. |
void |
addChild(IlvMapLayer parent,
IlvMapLayer layer)
Adds
layer as the last child of parent. |
void |
addChild(IlvMapLayer parent,
IlvMapLayer layer,
int idx)
Adds a child layer to a parent layer.
|
void |
arrangeLayers()
Arranges the
IlvManagerLayer objects in this model so that
they match the order returned by calling getEnumeration. |
void |
clear()
Clears this model from the root.
|
void |
clearAllObjects()
Removes all
IlvGraphic objects from this model. |
IlvMapLayer |
findChildLayer(IlvMapLayer parent,
String name)
Returns the child object with a specific name from an
IlvMapLayer instance. |
protected void |
fireTreeNodesChanged(Object source,
Object[] path,
int[] childIndices,
Object[] children) |
protected void |
fireTreeNodesInserted(Object source,
Object[] path,
int[] childIndices,
Object[] children) |
protected void |
fireTreeNodesRemoved(Object source,
Object[] path,
int[] childIndices,
Object[] children) |
protected void |
fireTreeStructureChanged(Object source,
Object[] path,
int[] childIndices,
Object[] children) |
Enumeration<IlvMapLayerTreeNode> |
getCheckedNodes()
Retrieves an enumeration of all the checked nodes contained in this model.
|
Object |
getChild(Object parent,
int index)
The child object at a specific index in the parent object.
|
int |
getChildCount(Object parent)
Returns the number of child objects for
parent. |
IlvMapLayer[] |
getChildren(IlvMapLayer layer)
Returns the array of the children of the specified
IlvMapLayer
instance. |
Enumeration<?> |
getEnumeration()
Retrieves an enumeration of all the nodes contained in this model.
|
IlvManager |
getManager()
Returns the
IlvManager object attached to this model. |
IlvMapLayer |
getMapLayer(Object o)
Returns the
IlvMapLayer object from the specified
IlvMapLayerTreeNode instance. |
IlvMapLayer |
getParent(IlvMapLayer layer)
Returns the parent object of the specified layer.
|
IlvMapLayerTreeNode |
getTreeNode(IlvMapLayer layer)
Returns the
IlvMapLayerTreeNode object attached to the
specified IlvMapLayer instance. |
boolean |
isAutoRearrange()
Returns
true if rearrange layers is allowed to change the
manager layer order. |
void |
nodeChanged(IlvMapLayer layer)
Calls the
nodeChanged method of the
IlvMapLayerTreeNode object attached to the specified
IlvMapLayer instance. |
void |
nodeStructureChanged(IlvMapLayer layer)
Calls the
nodeStructureChanged method of the
IlvMapLayerTreeNode instance attached to the specified
IlvMapLayer object. |
void |
orderLayer(IlvMapLayer l1,
IlvMapLayer l2,
boolean after)
Orders the specified
IlvMapLayer objects. |
void |
reload(IlvMapLayer layer)
Calls the
reload method of the
IlvMapLayerTreeNode object attached to the specified
IlvMapLayer instance. |
boolean |
removeChild(IlvMapLayer layer)
Removes the specified child object from its parent.
|
void |
setAutoRearrange(boolean autoRearrange)
Indicates if rearrange layers is allowed to change the manager layer order.
|
void |
setManager(IlvManager manager)
Sets the
IlvManager object for this model. |
void |
write(IlvOutputStream stream)
Write this model to an
IlvOutputStream. |
addTreeModelListener, asksAllowsChildren, getIndexOfChild, getListeners, getPathToRoot, getPathToRoot, getRoot, getTreeModelListeners, insertNodeInto, isLeaf, nodeChanged, nodesChanged, nodeStructureChanged, nodesWereInserted, nodesWereRemoved, reload, reload, removeNodeFromParent, removeTreeModelListener, setAsksAllowsChildren, setRoot, valueForPathChangedpublic IlvMapLayerTreeModel(IlvInputStream stream) throws IlvReadFileException
IlvMapLayerTreeModel object from an
IlvInputStream.stream - The stream to read from.IlvReadFileException - if there is a problem reading from stream.public IlvMapLayerTreeModel()
IlvMapLayerTreeModel instance.protected void fireTreeNodesInserted(Object source, Object[] path, int[] childIndices, Object[] children)
fireTreeNodesInserted in class DefaultTreeModelprotected void fireTreeNodesChanged(Object source, Object[] path, int[] childIndices, Object[] children)
fireTreeNodesChanged in class DefaultTreeModelprotected void fireTreeNodesRemoved(Object source, Object[] path, int[] childIndices, Object[] children)
fireTreeNodesRemoved in class DefaultTreeModelprotected void fireTreeStructureChanged(Object source, Object[] path, int[] childIndices, Object[] children)
fireTreeStructureChanged in class DefaultTreeModelpublic void setManager(IlvManager manager)
IlvManager object for this model.manager - The manager.public IlvManager getManager()
IlvManager object attached to this model.IlvManager object attached to this model.public Enumeration<?> getEnumeration()
Enumeration object from the root.public Enumeration<IlvMapLayerTreeNode> getCheckedNodes()
Enumeration object from the root
containing all the checked nodes.public void nodeChanged(IlvMapLayer layer)
nodeChanged method of the
IlvMapLayerTreeNode object attached to the specified
IlvMapLayer instance.layer - The specified IlvMapLayer instance.public void reload(IlvMapLayer layer)
reload method of the
IlvMapLayerTreeNode object attached to the specified
IlvMapLayer instance.layer - The specified IlvMapLayer instance.public void nodeStructureChanged(IlvMapLayer layer)
nodeStructureChanged method of the
IlvMapLayerTreeNode instance attached to the specified
IlvMapLayer object.layer - The specified IlvMapLayer object.public void addChild(IlvMapLayer parent, IlvMapLayer layer)
layer as the last child of parent. If
parent is null, the child is added to the root.parent - The parent to add a child to.layer - The child to add.public void addChild(IlvMapLayer parent, IlvMapLayer layer, int idx)
layer as the
idxth child of parent. If parent is
null, the child is added to the root.parent - The parent to add a child to.layer - The child to add.idx - The index where the layer should be inserted. Set to
-1 to insert layer at the end.public boolean removeChild(IlvMapLayer layer)
layer - The IlvMapLayer object to detach from its parent.true is returned.public IlvMapLayer getMapLayer(Object o)
IlvMapLayer object from the specified
IlvMapLayerTreeNode instance. If o is not an
IlvMapLayerTreeNode instance, or if the user object of the
IlvMapLayerTreeNode instance is not an
IlvMapLayer object, null is returned.o - The IlvMapLayerTreeNode instance from which to
retrieve the layer.IlvMapLayer object or null.public IlvMapLayer[] getChildren(IlvMapLayer layer)
IlvMapLayer
instance.layer - The layer from which to retrieve the children.layer.public IlvMapLayer getParent(IlvMapLayer layer)
layer - The layer from which to retrieve the parent object.public void activateListener(boolean activate)
TreeModelListener.activate - Set to true to activate the listener.public void orderLayer(IlvMapLayer l1, IlvMapLayer l2, boolean after)
IlvMapLayer objects.l1 - The first IlvMapLayer object.l2 - The second IlvMapLayer object.after - Specifies if l1 should be placed before or after
l2.IllegalArgumentException - if l1 and l2 do not have the same
parent object.public void clear()
public void clearAllObjects()
IlvGraphic objects from this model.public void arrangeLayers()
IlvManagerLayer objects in this model so that
they match the order returned by calling getEnumeration.public void write(IlvOutputStream stream) throws IOException
IlvOutputStream.write in interface IlvPersistentObjectstream - The stream to write to.IOException - if there is a problem writing to stream.public IlvMapLayerTreeNode getTreeNode(IlvMapLayer layer)
IlvMapLayerTreeNode object attached to the
specified IlvMapLayer instance.layer - The specified IlvMapLayer instance.IlvMapLayerTreeNode object.public IlvMapLayer findChildLayer(IlvMapLayer parent, String name)
IlvMapLayer instance.parent - The parent IlvMapLayer object.name - The name of the layer to find.IlvMapLayer instance, child of
parent, whose name is name.public Object getChild(Object parent, int index)
getChild in interface TreeModelgetChild in class DefaultTreeModelparent at index in the
parent objects child array.DefaultTreeModel.getChild(java.lang.Object, int)public int getChildCount(Object parent)
parent.getChildCount in interface TreeModelgetChildCount in class DefaultTreeModelparent.DefaultTreeModel.getChildCount(java.lang.Object)public boolean isAutoRearrange()
true if rearrange layers is allowed to change the
manager layer order.true is returned.public void setAutoRearrange(boolean autoRearrange)
true.
Note: this property is not persistent.
autoRearrange - Set to false to prevent rearranging of the manager
layer order.© Copyright Rogue Wave Software, Inc. 1997, 2017. All Rights Reserved.