ilog.views.maps.datasource
Class IlvMapDataSourceModel

java.lang.Object
  extended by javax.swing.tree.DefaultTreeModel
      extended by ilog.views.maps.datasource.IlvMapDataSourceModel
All Implemented Interfaces:
IlvPersistentObject, Serializable, TreeModel

public class IlvMapDataSourceModel
extends DefaultTreeModel
implements IlvPersistentObject

The IlvMapDataSourceModel is a tree model used to display data sources in a tree. A data source model can be attached to a IlvManager through a IlvMapDataSourceProperty in order to be saved in an .ivl file. The following code retrieves the data source model from an IlvManager and inserts a data source.

  IlvMapDataSourceModel model = 
    IlvMapDataSourceProperty.GetMapDataSourceModel(manager);
 IlvMapDataSource reader = new IlvShapeDataSource("shapeFile.shp", true);
 model.insert(reader);
 

Since:
JViews 7.5
See Also:
Serialized Form

Field Summary
 
Fields inherited from class javax.swing.tree.DefaultTreeModel
asksAllowsChildren, listenerList, root
 
Constructor Summary
IlvMapDataSourceModel()
          Constructs an empty IlvMapDataSourceModel.
IlvMapDataSourceModel(IlvInputStream stream)
          Reads the model from an IlvInputStream.
IlvMapDataSourceModel(TreeNode root)
          Constructs an IlvMapDataSourceModel with a root.
 
Method Summary
 void clear()
          Clears the nodes of this model.
 IlvMapDataSource getDataSource(String name)
          Finds a data source by its name.
 IlvMapDataSource[] getDataSources()
          Returns all the data sources known by this IlvMapDataSourceModel.
 Enumeration getEnumeration()
          Returns an enumeration of the nodes of this model.
 IlvManager getManager()
          Retrieves the manager.
 void insert(IlvMapDataSource source)
          Inserts a data source in this model.
 void remove(IlvMapDataSource source)
          Removes a datasource from its parent.
 void setManager(IlvManager manager)
          Sets the manager.
 void start()
          Starts all the data sources present in this model.
 void write(IlvOutputStream stream)
          Writes this model into an IlvOutputStream.
 
Methods inherited from class javax.swing.tree.DefaultTreeModel
addTreeModelListener, asksAllowsChildren, fireTreeNodesChanged, fireTreeNodesInserted, fireTreeNodesRemoved, fireTreeStructureChanged, getChild, getChildCount, getIndexOfChild, getListeners, getPathToRoot, getPathToRoot, getRoot, getTreeModelListeners, insertNodeInto, isLeaf, nodeChanged, nodesChanged, nodeStructureChanged, nodesWereInserted, nodesWereRemoved, reload, reload, removeNodeFromParent, removeTreeModelListener, setAsksAllowsChildren, setRoot, valueForPathChanged
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

IlvMapDataSourceModel

public IlvMapDataSourceModel(IlvInputStream stream)
                      throws IlvReadFileException
Reads the model from an IlvInputStream.

Parameters:
stream - The stream to read from.
Throws:
IlvReadFileException

IlvMapDataSourceModel

public IlvMapDataSourceModel()
Constructs an empty IlvMapDataSourceModel.


IlvMapDataSourceModel

public IlvMapDataSourceModel(TreeNode root)
Constructs an IlvMapDataSourceModel with a root.

Parameters:
root - The root.
Method Detail

write

public void write(IlvOutputStream stream)
           throws IOException
Writes this model into an IlvOutputStream.

Specified by:
write in interface IlvPersistentObject
Parameters:
stream - The stream to write to.
Throws:
IOException

setManager

public void setManager(IlvManager manager)
Sets the manager.

Parameters:
manager - The manager.

getManager

public IlvManager getManager()
Retrieves the manager.

Returns:
The manager.

getEnumeration

public Enumeration getEnumeration()
Returns an enumeration of the nodes of this model. It calls getRoot().preorderEnumeration();

Returns:
An enumeration of the nodes of this model.

clear

public void clear()
Clears the nodes of this model.


start

public void start()
Starts all the data sources present in this model.


insert

public void insert(IlvMapDataSource source)
Inserts a data source in this model. The corresponding node is inserted at the end of the model.

Parameters:
source - The data source to insert.

remove

public void remove(IlvMapDataSource source)
Removes a datasource from its parent.

Parameters:
source - The data source to remove.

getDataSource

public IlvMapDataSource getDataSource(String name)
Finds a data source by its name.

Parameters:
name - Name of the data source to find.
Returns:
The first data source found or null.

getDataSources

public IlvMapDataSource[] getDataSources()
Returns all the data sources known by this IlvMapDataSourceModel.

Returns:
Returns all the data sources known.
Since:
JViews 8.0


Copyright © 1996-2007 ILOG S.A. All rights reserved.   Documentation homepage.