pl.edu.agh.cast.schema.model.visual
Class VisualSchemaNode

java.lang.Object
  extended by pl.edu.agh.cast.data.model.property.PropertyContainer
      extended by pl.edu.agh.cast.data.model.AbstractElement
          extended by pl.edu.agh.cast.data.model.visual.VisualElement<ISchemaNode>
              extended by pl.edu.agh.cast.schema.model.visual.VisualSchemaNode
All Implemented Interfaces:
Serializable, Observer, IDisposable, IReplicable, IValidatable, Identifiable, IElement, IPropertyChangeProvider, IPropertyContainer, IVisualElement<ISchemaNode>, IVisualSchemaElement<ISchemaNode>, IVisualSchemaNode

public class VisualSchemaNode
extends VisualElement<ISchemaNode>
implements IVisualSchemaNode

The default implementation of IVisualSchemaNode.

Author:
AGH CAST Team
See Also:
Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from interface pl.edu.agh.cast.data.model.visual.IVisualElement
IVisualElement.Properties
 
Field Summary
 
Fields inherited from class pl.edu.agh.cast.data.model.visual.VisualElement
presentationElement
 
Fields inherited from interface pl.edu.agh.cast.schema.model.visual.IVisualSchemaNode
CONNECTION_EVENT, DIMENSION_EVENT, LOCATION_EVENT, RESOURCE_EVENT, TYPE
 
Fields inherited from interface pl.edu.agh.cast.data.model.visual.IVisualElement
DEFAULT_VISUAL_LABEL_ID
 
Constructor Summary
  VisualSchemaNode()
          Default constructor.
  VisualSchemaNode(IVisualSchemaDataSet dataSet, ISchemaNode node)
          Constructor for creating new visual node associated to given node.
  VisualSchemaNode(IVisualSchemaDataSet dataSet, String label)
          Constructor for creating new visual node associated to new schema node with given label.
protected VisualSchemaNode(IVisualSchemaDataSet dataSet, Type type, ISchemaNode elementReference)
          The constructor for subclasses which wraps the schema node.
protected VisualSchemaNode(Type type)
           
 
Method Summary
 String acquireResourceId(String defaultResourceId)
          The resource id of the node.
 org.eclipse.draw2d.geometry.Dimension getDimension()
          Returns the copy of the dimension of the node.
 Integer getHeight()
          The height of the node.
 org.eclipse.draw2d.geometry.Point getLocation()
          Returns the copy of the location of the node.
 String getResourceId()
          The resource id of the node.
 Integer getWidth()
          The width of the node.
 Integer getXCoordinate()
          The x coordinate of the node.
 Integer getYCoordinate()
          The y coordinate of the node.
 VisualSchemaNode replicate()
          Returns a replicated instance of this instance.
 VisualSchemaNode replicateTo(Object replica)
          Replicates this instance state to given replica object.
 void setHeight(Integer height)
          Sets the height of the node.
 void setResourceId(String id)
          Sets the resource id of the node.
 void setWidth(Integer width)
          Sets the width of the node.
 void setXCoordinate(Integer x)
          Sets the x coordinate of the node.
 void setYCoordinate(Integer y)
          Sets the y coordinate of the node.
 
Methods inherited from class pl.edu.agh.cast.data.model.visual.VisualElement
addPropertyChangeListener, checkIfValid, checkIfValidVisualElement, firePropertyChange, getPresentationElement, getPropertiesMarkedAsLabel, getVisualLabel, markPropertyAsLabel, removePropertyChangeListener, setPresentationElement
 
Methods inherited from class pl.edu.agh.cast.data.model.AbstractElement
afterSetMetaPropertyManager, canReplicateTo, equals, getDataSet, getDescString, getId, getType, hashCode, isValid, setDataSet, setId, setType, toString
 
Methods inherited from class pl.edu.agh.cast.data.model.property.PropertyContainer
addProperty, createProperty, dispose, getCustomProperties, getMetaPropertyManager, getPermanentProperties, getProperties, getProperty, getTransientProperties, initializeProperties, matches, removeProperty, setMetaPropertyManager, setProperty, update
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface pl.edu.agh.cast.data.model.visual.IVisualElement
getPresentationElement, getPropertiesMarkedAsLabel, getVisualLabel, markPropertyAsLabel, setPresentationElement
 
Methods inherited from interface pl.edu.agh.cast.data.model.IElement
getDataSet
 
Methods inherited from interface pl.edu.agh.cast.data.model.Identifiable
getId, getType
 
Methods inherited from interface pl.edu.agh.cast.data.model.property.IPropertyContainer
addProperty, getCustomProperties, getMetaPropertyManager, getPermanentProperties, getProperties, getProperty, getTransientProperties, matches, removeProperty, setProperty
 
Methods inherited from interface java.util.Observer
update
 
Methods inherited from interface pl.edu.agh.cast.common.IValidatable
isValid
 
Methods inherited from interface pl.edu.agh.cast.common.IDisposable
dispose
 
Methods inherited from interface pl.edu.agh.cast.data.model.property.IPropertyChangeProvider
addPropertyChangeListener, removePropertyChangeListener
 

Constructor Detail

VisualSchemaNode

public VisualSchemaNode()
Default constructor.


VisualSchemaNode

protected VisualSchemaNode(Type type)

VisualSchemaNode

protected VisualSchemaNode(IVisualSchemaDataSet dataSet,
                           Type type,
                           ISchemaNode elementReference)
The constructor for subclasses which wraps the schema node.

Parameters:
dataSet - The data set of this node.
type - The type of this node.
elementReference - The referenced element of presentation model.

VisualSchemaNode

public VisualSchemaNode(IVisualSchemaDataSet dataSet,
                        ISchemaNode node)
Constructor for creating new visual node associated to given node.

Parameters:
dataSet - data set which visual node belongs to
node - model node which is visualized by this object

VisualSchemaNode

public VisualSchemaNode(IVisualSchemaDataSet dataSet,
                        String label)
Constructor for creating new visual node associated to new schema node with given label.

Parameters:
dataSet - data set which visual node belongs to
label - label of node which is visualized by this object
Method Detail

getXCoordinate

public Integer getXCoordinate()
The x coordinate of the node.

Specified by:
getXCoordinate in interface IVisualSchemaNode
Returns:
The x coordinate.
See Also:
IVisualSchemaNode.getXCoordinate()

setXCoordinate

public void setXCoordinate(Integer x)
Sets the x coordinate of the node.

Specified by:
setXCoordinate in interface IVisualSchemaNode
Parameters:
x - The coordinate to set.
See Also:
pl.edu.agh.cast.schema.model.visual.IVisualSchemaNode#setXCoordinate(int)

getLocation

public org.eclipse.draw2d.geometry.Point getLocation()
Returns the copy of the location of the node.

Specified by:
getLocation in interface IVisualSchemaNode
Returns:
The location.

getYCoordinate

public Integer getYCoordinate()
The y coordinate of the node.

Specified by:
getYCoordinate in interface IVisualSchemaNode
Returns:
The y coordinate.
See Also:
IVisualSchemaNode.getYCoordinate()

setYCoordinate

public void setYCoordinate(Integer y)
Sets the y coordinate of the node.

Specified by:
setYCoordinate in interface IVisualSchemaNode
Parameters:
y - The coordinate to set.
See Also:
pl.edu.agh.cast.schema.model.visual.IVisualSchemaNode#setYCoordinate(int)

getWidth

public Integer getWidth()
The width of the node.

Specified by:
getWidth in interface IVisualSchemaNode
Returns:
The width.
See Also:
IVisualSchemaNode.getWidth()

setWidth

public void setWidth(Integer width)
Sets the width of the node.

Specified by:
setWidth in interface IVisualSchemaNode
Parameters:
width - The width to set.
See Also:
pl.edu.agh.cast.schema.model.visual.IVisualSchemaNode#setWidth(int)

getHeight

public Integer getHeight()
The height of the node.

Specified by:
getHeight in interface IVisualSchemaNode
Returns:
The height.
See Also:
IVisualSchemaNode.getHeight()

setHeight

public void setHeight(Integer height)
Sets the height of the node.

Specified by:
setHeight in interface IVisualSchemaNode
Parameters:
height - The height to set.
See Also:
pl.edu.agh.cast.schema.model.visual.IVisualSchemaNode#setHeight(int)

getDimension

public org.eclipse.draw2d.geometry.Dimension getDimension()
Returns the copy of the dimension of the node.

Returns:
The dimension.

getResourceId

public String getResourceId()
The resource id of the node.

Specified by:
getResourceId in interface IVisualSchemaNode
Returns:
The image id.
See Also:
IVisualSchemaNode.getResourceId()

setResourceId

public void setResourceId(String id)
Sets the resource id of the node.

Specified by:
setResourceId in interface IVisualSchemaNode
Parameters:
id - The id to set.
See Also:
IVisualSchemaNode.setResourceId(java.lang.String)

acquireResourceId

public String acquireResourceId(String defaultResourceId)
The resource id of the node. If none is specified then a one based on the derived type is returned. If derived type is not specified then the given default is returned.

Specified by:
acquireResourceId in interface IVisualSchemaNode
Parameters:
defaultResourceId - the id of the default resource
Returns:
the resource id.
See Also:
IVisualSchemaNode.acquireResourceId(java.lang.String)

replicateTo

public VisualSchemaNode replicateTo(Object replica)
                             throws IllegalArgumentException,
                                    ReplicationException
Replicates this instance state to given replica object. The replica should be an instance of replicated instance's class (same class or subclass).

Replicates element type and ID.

Replicates the direction flag, source and target nodes are null empty.

Specified by:
replicateTo in interface IReplicable
Overrides:
replicateTo in class VisualElement<ISchemaNode>
Parameters:
replica - the object to replicate to
Returns:
the replica object (the same instance as given)
Throws:
IllegalArgumentException - if given object is null or of invalid type
ReplicationException - if replication fails
See Also:
VisualElement.replicateTo(java.lang.Object)

replicate

public VisualSchemaNode replicate()
                           throws ReplicationException
Returns a replicated instance of this instance.

Specified by:
replicate in interface IReplicable
Overrides:
replicate in class AbstractElement
Returns:
replicated instance
Throws:
ReplicationException - if replication fails
See Also:
IReplicable.replicate()


Copyright © 2007-2009 IISG AGH-UST Krakow, Poland. All Rights Reserved.