com.ontotext.gate.vr
Class ClassNode

java.lang.Object
  extended by com.ontotext.gate.vr.ClassNode
All Implemented Interfaces:
IFolder, Transferable, Serializable, Cloneable

public class ClassNode
extends Object
implements IFolder, Transferable, Cloneable, Serializable

Represents a single class node from the visualized ontology

See Also:
Serialized Form

Field Summary
static DataFlavor CLASS_NODE_FLAVOR
          flavor used for drag and drop
 
Constructor Summary
ClassNode(MappingNode mapNode)
          Constructs a class node given a mapping node
ClassNode(OClass clas)
          Constructs a class node given an ontology class
ClassNode(OInstance instance)
          Constructs a class node given an ontology instance
ClassNode(Ontology o)
          Constructs a root class node from an ontology
 
Method Summary
 void addSubNode(ClassNode sub)
          Adds a sub node
 Vector<ClassNode> children()
           
static ClassNode createRootNode(Ontology o)
          create a structure representing the class hierarchy of an ontology
static ClassNode createRootNode(Ontology o, boolean includeInstances, boolean includeAnonymousClasses)
           
static ClassNode createRootNode(Ontology o, MappingDefinition mapping, Map<String,ClassNode> nameVsNode)
          Creates a structure representing the class hierarchy of an ontology and the gazetteerLists mapped to it.
 boolean equals(Object obj)
           
 IFolder getChild(int index)
           
 int getChildCount()
           
 Iterator<ClassNode> getChildren()
           
 int getIndexOfChild(Object child)
           
 Object getSource()
          Gets the Source object
 Object getTransferData(DataFlavor df)
           
 DataFlavor[] getTransferDataFlavors()
           
 int hashCode()
           
 boolean isDataFlavorSupported(DataFlavor df)
           
 void removeSubNode(ClassNode sub)
          Removes a sub class
 void rename(String newName)
          Renames this class node
 void setChildren(Vector<ClassNode> chldrn)
           
 void setSource(Object o)
          Sets the source object
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

CLASS_NODE_FLAVOR

public static final DataFlavor CLASS_NODE_FLAVOR
flavor used for drag and drop

Constructor Detail

ClassNode

public ClassNode(Ontology o)
Constructs a root class node from an ontology

Parameters:
o - the ontology

ClassNode

public ClassNode(OClass clas)
Constructs a class node given an ontology class

Parameters:
clas - ontology class

ClassNode

public ClassNode(OInstance instance)
Constructs a class node given an ontology instance

Parameters:
instance - ontology instance

ClassNode

public ClassNode(MappingNode mapNode)
Constructs a class node given a mapping node

Parameters:
mapNode - mapping node
Method Detail

createRootNode

public static ClassNode createRootNode(Ontology o)
create a structure representing the class hierarchy of an ontology

Returns:
the root node of the structure

createRootNode

public static ClassNode createRootNode(Ontology o,
                                       boolean includeInstances,
                                       boolean includeAnonymousClasses)

createRootNode

public static ClassNode createRootNode(Ontology o,
                                       MappingDefinition mapping,
                                       Map<String,ClassNode> nameVsNode)
Creates a structure representing the class hierarchy of an ontology and the gazetteerLists mapped to it.

Parameters:
o - an ontology
mapping - mapping definition
nameVsNode - : this is actually a return value: should be initialized before passing to this method and afterwards one can find a mapping of class names vs class nodes there.
Returns:
the root node of the structure

getIndexOfChild

public int getIndexOfChild(Object child)
Specified by:
getIndexOfChild in interface IFolder

getChildren

public Iterator<ClassNode> getChildren()
Specified by:
getChildren in interface IFolder

setChildren

public void setChildren(Vector<ClassNode> chldrn)

children

public Vector<ClassNode> children()
Specified by:
children in interface IFolder

toString

public String toString()
Specified by:
toString in interface IFolder
Overrides:
toString in class Object

getChildCount

public int getChildCount()
Specified by:
getChildCount in interface IFolder

getChild

public IFolder getChild(int index)
Specified by:
getChild in interface IFolder

hashCode

public int hashCode()
Overrides:
hashCode in class Object

equals

public boolean equals(Object obj)
Overrides:
equals in class Object

getSource

public Object getSource()
Gets the Source object

Returns:
the source object e.g. an gate.creole.TClass or a gate.creole.Ontology

setSource

public void setSource(Object o)
Sets the source object

Parameters:
o - the source object to be set

rename

public void rename(String newName)
Renames this class node

Parameters:
newName - the new name of the node

removeSubNode

public void removeSubNode(ClassNode sub)
Removes a sub class

Parameters:
sub - the sub class to be removed

addSubNode

public void addSubNode(ClassNode sub)
Adds a sub node

Parameters:
sub - the sub node to be added

isDataFlavorSupported

public boolean isDataFlavorSupported(DataFlavor df)
Specified by:
isDataFlavorSupported in interface Transferable

getTransferData

public Object getTransferData(DataFlavor df)
                       throws UnsupportedFlavorException,
                              IOException
Specified by:
getTransferData in interface Transferable
Throws:
UnsupportedFlavorException
IOException

getTransferDataFlavors

public DataFlavor[] getTransferDataFlavors()
Specified by:
getTransferDataFlavors in interface Transferable