org.globus.cog.gui.grapheditor
Class AbstractGraphComponent

java.lang.Object
  extended by org.globus.cog.gui.grapheditor.AbstractGraphComponent
All Implemented Interfaces:
Cloneable, GraphComponent, PropertyHolder
Direct Known Subclasses:
AbstractEdgeComponent, AbstractNodeComponent

public abstract class AbstractGraphComponent
extends Object
implements GraphComponent, PropertyHolder

Implements the basic functionality for a graph component


Constructor Summary
AbstractGraphComponent()
           
 
Method Summary
protected static void addClassProperty(ClassProperty prop)
           
 void addProperty(Property property)
           
 void addPropertyChangeListener(PropertyChangeListener l)
           
 Object clone()
           
 void firePropertyChange(PropertyChangeEvent e)
           
 void firePropertyChange(String property)
           
 void firePropertyChange(String property, Object oldValue, Object newValue)
           
 String get_ID()
          Returns the id of this component
 Collection getClassProperties(GraphComponent owner)
           
protected static ClassProperty getClassProperty(Class cls, String name)
           
protected static ClassProperty getClassProperty2(Class cls, String name)
           
 String getComponentType()
          Gets the type of this component.
 NodeComponent getParent()
           
 Collection getProperties()
           
 Property getProperty(String name)
           
protected  Property getProperty2(String name)
           
 Object getPropertyValue(String name)
           
 NodeComponent getRootNode()
           
protected static boolean hasClassProperty(Class cls, String name)
           
static boolean hasClassProperty(HashMap classes, Class cls, String name)
           
 boolean hasProperty(String name)
           
 GraphComponent newInstance()
          Creates a new component using the current one as prototype.
 ComponentRenderer newRenderer()
          Creates a renderer for this component using the current target.
 ComponentRenderer newRenderer(String target)
          Creates a renderer for this components using the specified target.
 void removeProperty(Property property)
           
 void removeProperty(String name)
           
 void removePropertyChangeListener(PropertyChangeListener l)
           
 void set_ID(String _id)
          Sets the id of this component.
protected  void setClassRendererClass(Class cls)
           
protected static void setClassRendererClass(Class componentClass, Class cls)
           
protected static void setClassRendererClass(Class componentClass, Class cls, String target)
           
protected  void setClassRendererClass(Class cls, String target)
           
 void setComponentType(String name)
          Sets the type of this component
 void setInstanceRendererClass(Class cls)
           
 void setInstanceRendererClass(Class cls, String target)
           
 void setParent(NodeComponent parent)
          Sets the parent node in the hierarchical graph
 void setPropertyValue(String name, Object value)
           
 boolean supportsType(String type)
          This method is used to allow the existence of generic objects which can render a range of types.
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AbstractGraphComponent

public AbstractGraphComponent()
Method Detail

supportsType

public boolean supportsType(String type)
Description copied from interface: GraphComponent
This method is used to allow the existence of generic objects which can render a range of types.

Specified by:
supportsType in interface GraphComponent
Parameters:
type - The type to be checked
Returns:
true if this component can render the specified type

getComponentType

public String getComponentType()
Description copied from interface: GraphComponent
Gets the type of this component. The type can be used to differentiate components from each other.

Specified by:
getComponentType in interface GraphComponent
Returns:
A string representing the type

setComponentType

public void setComponentType(String name)
Description copied from interface: GraphComponent
Sets the type of this component

Specified by:
setComponentType in interface GraphComponent

setInstanceRendererClass

public void setInstanceRendererClass(Class cls,
                                     String target)

setInstanceRendererClass

public void setInstanceRendererClass(Class cls)

setClassRendererClass

protected void setClassRendererClass(Class cls)

setClassRendererClass

protected static void setClassRendererClass(Class componentClass,
                                            Class cls)

setClassRendererClass

protected void setClassRendererClass(Class cls,
                                     String target)

setClassRendererClass

protected static void setClassRendererClass(Class componentClass,
                                            Class cls,
                                            String target)

newRenderer

public ComponentRenderer newRenderer()
Description copied from interface: GraphComponent
Creates a renderer for this component using the current target.

Specified by:
newRenderer in interface GraphComponent

newRenderer

public ComponentRenderer newRenderer(String target)
Description copied from interface: GraphComponent
Creates a renderer for this components using the specified target.

Specified by:
newRenderer in interface GraphComponent

newInstance

public GraphComponent newInstance()
Description copied from interface: GraphComponent
Creates a new component using the current one as prototype.

Specified by:
newInstance in interface GraphComponent

getParent

public NodeComponent getParent()
Specified by:
getParent in interface GraphComponent
Returns:
The parent node in the hierarchical graph

setParent

public void setParent(NodeComponent parent)
Description copied from interface: GraphComponent
Sets the parent node in the hierarchical graph

Specified by:
setParent in interface GraphComponent

firePropertyChange

public void firePropertyChange(String property,
                               Object oldValue,
                               Object newValue)
Specified by:
firePropertyChange in interface PropertyHolder

firePropertyChange

public void firePropertyChange(String property)
Specified by:
firePropertyChange in interface PropertyHolder

addProperty

public void addProperty(Property property)
Specified by:
addProperty in interface PropertyHolder

addClassProperty

protected static void addClassProperty(ClassProperty prop)

getClassProperty2

protected static ClassProperty getClassProperty2(Class cls,
                                                 String name)

getClassProperty

protected static ClassProperty getClassProperty(Class cls,
                                                String name)

hasClassProperty

protected static boolean hasClassProperty(Class cls,
                                          String name)

hasClassProperty

public static boolean hasClassProperty(HashMap classes,
                                       Class cls,
                                       String name)

removeProperty

public void removeProperty(Property property)
Specified by:
removeProperty in interface PropertyHolder

removeProperty

public void removeProperty(String name)

getProperty

public Property getProperty(String name)
Specified by:
getProperty in interface PropertyHolder

getProperty2

protected Property getProperty2(String name)

hasProperty

public boolean hasProperty(String name)
Specified by:
hasProperty in interface PropertyHolder

getPropertyValue

public Object getPropertyValue(String name)
Specified by:
getPropertyValue in interface PropertyHolder

setPropertyValue

public void setPropertyValue(String name,
                             Object value)
Specified by:
setPropertyValue in interface PropertyHolder

getProperties

public Collection getProperties()
Specified by:
getProperties in interface PropertyHolder

getClassProperties

public Collection getClassProperties(GraphComponent owner)

addPropertyChangeListener

public void addPropertyChangeListener(PropertyChangeListener l)
Specified by:
addPropertyChangeListener in interface PropertyHolder

removePropertyChangeListener

public void removePropertyChangeListener(PropertyChangeListener l)
Specified by:
removePropertyChangeListener in interface PropertyHolder

firePropertyChange

public void firePropertyChange(PropertyChangeEvent e)
Specified by:
firePropertyChange in interface PropertyHolder

get_ID

public String get_ID()
Description copied from interface: GraphComponent
Returns the id of this component

Specified by:
get_ID in interface GraphComponent

set_ID

public void set_ID(String _id)
Description copied from interface: GraphComponent
Sets the id of this component. An id can be used to uniquely reference a component.

Specified by:
set_ID in interface GraphComponent

getRootNode

public NodeComponent getRootNode()
Specified by:
getRootNode in interface GraphComponent

clone

public Object clone()
Specified by:
clone in interface GraphComponent
Overrides:
clone in class Object