com.pnp.xfeature.models
Class FeatureNodeModel

java.lang.Object
  extended by com.pnp.xfeature.models.AbstractComponentModel
      extended by com.pnp.xfeature.models.FeatureNodeModel

public class FeatureNodeModel
extends AbstractComponentModel

Class representing a feature node. It contains method that manipulates the feature node and provides information about it.

Author:
Kamil Ekstein, created on 21.9.2004, totally redesigned in 2005 by Ondrej Rohlik

Field Summary
static RGB FEA_DEFAULTCOLOUR
          Feature attribute constants
static java.lang.String PROPERTY_CONNECTION_ADDED
          event identifier
static java.lang.String PROPERTY_CONNECTION_PARENT_EXPANDED_COLLAPSED
          event identifier
static java.lang.String PROPERTY_CONNECTION_REMOVED
          event identifier
static java.lang.String PROPERTY_CONSTRAINT
          event identifier
static java.lang.String PROPERTY_EXPANDED
          event identifier
static java.lang.String PROPERTY_NAME
          event identifier
static java.lang.String PROPERTY_TOOLTIPTEXT
          event identifier
 
Constructor Summary
FeatureNodeModel(org.w3c.dom.Node node, org.w3c.dom.Document displayModel, org.w3c.dom.Document metaModel, FeatureDiagramModel diagram)
          Creates new instance of FeatureNodeModel reading data from W3C DOM Node object.
 
Method Summary
 void addAttachedNode(FeatureNodeModel nodeModel)
          attaches a new attached node to this node
 void addChild(FeatureNodeModel feature)
          adds a child node to the list of children
 void addSourceConnection(FeatureConnectionModel connection)
          adds a new connection to the list of source connections
 void addTargetConnection(FeatureConnectionModel connection)
          adds a new connection to the list of target connections
 void alignToParent()
          aligns an attached node to its parent, it assumes that the attached node is below its parent
 void fire()
          fires property change event when node position or size is changed Fixme: This is just to fire the event that fixes the connection O.R.
 java.lang.String getAttachedToParentPosition()
          getter method
 java.lang.String getCardinality()
          Returns the feature node cardnality.
 java.lang.String getCardinalityFont()
          getter method
 int getCardinalityFontSize()
          getter method
 int getCardinalityFontStyle()
          getter method
 RGB getCardinalityTextColor()
          getter method
 java.lang.String getCardinalityTextPosition()
          getter method
 Rectangle getConstraint()
          getter method
 RGB getFillColor()
          getter method
 java.lang.String getFont()
          getter method
 int getFontSize()
          getter method
 int getFontStyle()
          getter method
 java.util.Map getGlobalConstraintParents()
          This is a setter method.
 java.util.List getGlobalConstraints()
          This is a setter method.
 java.util.List getChildren()
          returns list of all child nodes
 Image getIcon()
          returns a pictogram (small icon) describing this model element.
 java.lang.String getIconPath()
          queries the display model for the path to the icon
 Image getImage(java.lang.String string)
          creates new Eclipse image, called from getIcon and FeatureNodeFigure construcotor
 ILabelProvider getLabelProvider()
          returns dummy label provider; used to dsplay icons of feature nodes
 RGB getLineColor()
          getter method
 int getLineStyle()
          getter method
 int getLineWidth()
          getter method
 org.w3c.dom.Document getMetamodel()
          getter method
 java.lang.String getName()
          getter method
 Dimension getNameTextExtent()
          returns size of the node name as it is displayed with current font name, font size, and font style
 org.w3c.dom.Node getNode()
          returns the node as a W3C DOM Node object, the returned node is the node as it is written in the *.xfm file
 int getNodeLastPosition()
          getter method
 int getNodeWidth()
          returns number of pixels necessary to fit the node to the screen
 int getNumberOfAlreadyArrangedNodesOfThisType(java.lang.String posCode)
          returns number of nodes of given type for which the postion has been already computed
 int getNumberOfAlreadyAttachedNodes()
          returns the number of actually attached nodes.
 FeatureNodeModel getParent()
          getter method
 RGB getParentConnectorColor()
          getter method
 int getParentConnectorStyle()
          getter method
 int getParentConnectorWidth()
          getter method
 IPropertyDescriptor[] getPropertyDescriptors()
          creates an array of property descriptors to appear in the property view of Eclipse perspective according to the sub-nodes of this node
 java.lang.Object getPropertyValue(java.lang.Object id)
          returns value of the property from the property view
 long getRefreshSubtreeTimeStamp()
          getter method
 java.lang.String getShape()
          getter method
 int getSize()
          getter method
 java.util.List getSourceConnections()
          getter method
 int getSubtreeOffset()
          getter method
 long getSubtreeOffsetTimeStamp()
          getter method
 int getSubtreeWidth()
          getter method
 long getSubtreeWidthTimeStamp()
          getter method
 java.util.List getTargetConnections()
          getter method
 RGB getTextColor()
          getter method
 java.lang.String getToolTipText()
          returns the tooltip or the node
 int getTotalNumberOfAttachedNodes()
          returns the number of all nodes attached to this node, used to automaticaly position them along the bottome side of the parent node
 int getTotalNumberOfAttachedNodesOfThisType(java.lang.String posCode)
          returns number of child nodes of given type
 long getUniqueId()
          getter method
 boolean hasCardinalityText()
          getter method
 boolean hasCollapsedAncestor()
          returns true if there is an ancestor that is colappsed
 boolean hasChildNodes()
          returns true if there is at least one child node
 boolean hasNameText()
          getter method
 boolean hasParentConnector()
          getter method
 boolean hasPropertySet(java.lang.String name)
          Checks whether the node has a property set(s) or not
 boolean isAttachedToParent()
          getter method
 boolean isExpanded()
          setter method
 boolean isIconAttached()
          ToDo: query the display model whether an icon is attached to this node
 boolean isPropertySet(java.lang.Object id)
          returns true (a property is always set if it exist)
 void removeAttachedNode(FeatureNodeModel nodeModel)
          dettaches an attached node from this node
 void removeConnectionToParent()
          removes the connection from tha parent node to this node
 void removeChild(FeatureNodeModel feature)
          removes a node to the list of children
 void removeSourceConnection(FeatureConnectionModel connection)
          removes existing connection from the list of source connections
 void removeTargetConnection(FeatureConnectionModel connection)
          removes existing connection from the list of target connections
 void setConstraintInit(Rectangle rect)
          sets the initial position of a node
 void setConstraintOffset(Rectangle rect)
          modifies the position of the node and its children that are attached to it
 void setExpanded(boolean expanded)
          setter method, fires property change event to inform the editpart that feature model has to be repainted
 void setName(java.lang.String name)
          setter method
 void setNodeLastPosition(int nodeLastPosition)
          setter method
 void setParent(FeatureNodeModel parent)
          setter method
 void setPropertyValue(java.lang.Object id, java.lang.Object value)
          writes the new property value to the model and updates the graphical view via call of firePropertyChange()
 void setRefreshSubtreeTimeStamp(long refreshSubtreeTimeStamp)
          setter method
 void setSubtreeOffset(int subtreeOffset, long timeStamp)
          setter method
 void setSubtreeOffsetTimeStamp(long subtreeOffsetTimeStamp)
          setter method
 void setSubtreeWidth(int subtreeWidth, long timeStamp)
          setter method
 void setSubtreeWidthTimeStamp(long subtreeWidthTimeStamp)
          setter method
 void setTreeLevel(int level)
          setter method
 void setUniqueId(long uniqueId)
          setter method
 java.lang.String toString()
          retuen name othe feature
 boolean validIntString(java.lang.String intStr)
          Checks whether the passed string intStr can be converted to an integer
 
Methods inherited from class com.pnp.xfeature.models.AbstractComponentModel
addPropertyChangeListener, firePropertyChange, getEditableValue, removePropertyChangeListener, resetPropertyValue
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

FEA_DEFAULTCOLOUR

public static final RGB FEA_DEFAULTCOLOUR
Feature attribute constants


PROPERTY_CONSTRAINT

public static final java.lang.String PROPERTY_CONSTRAINT
event identifier

See Also:
Constant Field Values

PROPERTY_NAME

public static final java.lang.String PROPERTY_NAME
event identifier

See Also:
Constant Field Values

PROPERTY_TOOLTIPTEXT

public static final java.lang.String PROPERTY_TOOLTIPTEXT
event identifier

See Also:
Constant Field Values

PROPERTY_EXPANDED

public static final java.lang.String PROPERTY_EXPANDED
event identifier

See Also:
Constant Field Values

PROPERTY_CONNECTION_ADDED

public static final java.lang.String PROPERTY_CONNECTION_ADDED
event identifier

See Also:
Constant Field Values

PROPERTY_CONNECTION_REMOVED

public static final java.lang.String PROPERTY_CONNECTION_REMOVED
event identifier

See Also:
Constant Field Values

PROPERTY_CONNECTION_PARENT_EXPANDED_COLLAPSED

public static final java.lang.String PROPERTY_CONNECTION_PARENT_EXPANDED_COLLAPSED
event identifier

See Also:
Constant Field Values
Constructor Detail

FeatureNodeModel

public FeatureNodeModel(org.w3c.dom.Node node,
                        org.w3c.dom.Document displayModel,
                        org.w3c.dom.Document metaModel,
                        FeatureDiagramModel diagram)
Creates new instance of FeatureNodeModel reading data from W3C DOM Node object. Sets the display model and meta-model.

Parameters:
node -
displayModel -
metaModel -
Method Detail

getCardinality

public java.lang.String getCardinality()
Returns the feature node cardnality. The returned string has a form of two number delimeted by two dots. E.g. "0..5", "1..1", and "3..*".


hasPropertySet

public boolean hasPropertySet(java.lang.String name)
Checks whether the node has a property set(s) or not


getToolTipText

public java.lang.String getToolTipText()
returns the tooltip or the node


getUniqueId

public long getUniqueId()
getter method


getMetamodel

public org.w3c.dom.Document getMetamodel()
getter method


getName

public java.lang.String getName()
getter method


setName

public void setName(java.lang.String name)
setter method


getFillColor

public RGB getFillColor()
getter method


getTextColor

public RGB getTextColor()
getter method


getCardinalityTextColor

public RGB getCardinalityTextColor()
getter method


getLineColor

public RGB getLineColor()
getter method


getParentConnectorColor

public RGB getParentConnectorColor()
getter method


getShape

public java.lang.String getShape()
getter method


getSize

public int getSize()
getter method


getLineStyle

public int getLineStyle()
getter method


getLineWidth

public int getLineWidth()
getter method


getParentConnectorWidth

public int getParentConnectorWidth()
getter method


getParentConnectorStyle

public int getParentConnectorStyle()
getter method


getCardinalityTextPosition

public java.lang.String getCardinalityTextPosition()
getter method


getAttachedToParentPosition

public java.lang.String getAttachedToParentPosition()
getter method


isAttachedToParent

public boolean isAttachedToParent()
getter method


hasParentConnector

public boolean hasParentConnector()
getter method


getFont

public java.lang.String getFont()
getter method


getCardinalityFont

public java.lang.String getCardinalityFont()
getter method


getFontSize

public int getFontSize()
getter method


getCardinalityFontSize

public int getCardinalityFontSize()
getter method


getFontStyle

public int getFontStyle()
getter method


getCardinalityFontStyle

public int getCardinalityFontStyle()
getter method


hasNameText

public boolean hasNameText()
getter method


hasCardinalityText

public boolean hasCardinalityText()
getter method


setTreeLevel

public void setTreeLevel(int level)
setter method


getConstraint

public Rectangle getConstraint()
getter method


setConstraintOffset

public void setConstraintOffset(Rectangle rect)
modifies the position of the node and its children that are attached to it


setConstraintInit

public void setConstraintInit(Rectangle rect)
sets the initial position of a node


alignToParent

public void alignToParent()
aligns an attached node to its parent, it assumes that the attached node is below its parent


getLabelProvider

public ILabelProvider getLabelProvider()
returns dummy label provider; used to dsplay icons of feature nodes


getPropertyDescriptors

public IPropertyDescriptor[] getPropertyDescriptors()
creates an array of property descriptors to appear in the property view of Eclipse perspective according to the sub-nodes of this node

Overrides:
getPropertyDescriptors in class AbstractComponentModel
See Also:
org.eclipse.ui.views.properties.IPropertySource#getPropertyDescriptors()

getPropertyValue

public java.lang.Object getPropertyValue(java.lang.Object id)
returns value of the property from the property view

Overrides:
getPropertyValue in class AbstractComponentModel
See Also:
org.eclipse.ui.views.properties.IPropertySource#getPropertyValue(java.lang.Object)

isPropertySet

public boolean isPropertySet(java.lang.Object id)
returns true (a property is always set if it exist)

Overrides:
isPropertySet in class AbstractComponentModel
See Also:
org.eclipse.ui.views.properties.IPropertySource#isPropertySet(java.lang.Object)

setPropertyValue

public void setPropertyValue(java.lang.Object id,
                             java.lang.Object value)
writes the new property value to the model and updates the graphical view via call of firePropertyChange()

Overrides:
setPropertyValue in class AbstractComponentModel
See Also:
org.eclipse.ui.views.properties.IPropertySource#setPropertyValue(java.lang.Object, java.lang.Object)

validIntString

public boolean validIntString(java.lang.String intStr)
Checks whether the passed string intStr can be converted to an integer


getSourceConnections

public java.util.List getSourceConnections()
getter method


getTargetConnections

public java.util.List getTargetConnections()
getter method


addSourceConnection

public void addSourceConnection(FeatureConnectionModel connection)
adds a new connection to the list of source connections


addTargetConnection

public void addTargetConnection(FeatureConnectionModel connection)
adds a new connection to the list of target connections


removeSourceConnection

public void removeSourceConnection(FeatureConnectionModel connection)
removes existing connection from the list of source connections


removeTargetConnection

public void removeTargetConnection(FeatureConnectionModel connection)
removes existing connection from the list of target connections


removeConnectionToParent

public void removeConnectionToParent()
removes the connection from tha parent node to this node


getNode

public org.w3c.dom.Node getNode()
returns the node as a W3C DOM Node object, the returned node is the node as it is written in the *.xfm file


getTotalNumberOfAttachedNodes

public int getTotalNumberOfAttachedNodes()
returns the number of all nodes attached to this node, used to automaticaly position them along the bottome side of the parent node


getNumberOfAlreadyAttachedNodes

public int getNumberOfAlreadyAttachedNodes()
returns the number of actually attached nodes. Used to position them


addAttachedNode

public void addAttachedNode(FeatureNodeModel nodeModel)
attaches a new attached node to this node


removeAttachedNode

public void removeAttachedNode(FeatureNodeModel nodeModel)
dettaches an attached node from this node


setUniqueId

public void setUniqueId(long uniqueId)
setter method


getIcon

public Image getIcon()
returns a pictogram (small icon) describing this model element.

Returns:
a 16x16 Image or null

toString

public java.lang.String toString()
retuen name othe feature

Overrides:
toString in class java.lang.Object

getChildren

public java.util.List getChildren()
returns list of all child nodes

Returns:
list of all child nodes (instances of FeatureNodeModel)

setParent

public void setParent(FeatureNodeModel parent)
setter method


addChild

public void addChild(FeatureNodeModel feature)
adds a child node to the list of children


removeChild

public void removeChild(FeatureNodeModel feature)
removes a node to the list of children


getParent

public FeatureNodeModel getParent()
getter method


getNodeLastPosition

public int getNodeLastPosition()
getter method


setNodeLastPosition

public void setNodeLastPosition(int nodeLastPosition)
setter method


fire

public void fire()
fires property change event when node position or size is changed Fixme: This is just to fire the event that fixes the connection O.R.


isExpanded

public boolean isExpanded()
setter method


setExpanded

public void setExpanded(boolean expanded)
setter method, fires property change event to inform the editpart that feature model has to be repainted


hasCollapsedAncestor

public boolean hasCollapsedAncestor()
returns true if there is an ancestor that is colappsed


hasChildNodes

public boolean hasChildNodes()
returns true if there is at least one child node


getNameTextExtent

public Dimension getNameTextExtent()
returns size of the node name as it is displayed with current font name, font size, and font style


getNodeWidth

public int getNodeWidth()
returns number of pixels necessary to fit the node to the screen


isIconAttached

public boolean isIconAttached()
ToDo: query the display model whether an icon is attached to this node

Returns:
always true

getTotalNumberOfAttachedNodesOfThisType

public int getTotalNumberOfAttachedNodesOfThisType(java.lang.String posCode)
returns number of child nodes of given type


getNumberOfAlreadyArrangedNodesOfThisType

public int getNumberOfAlreadyArrangedNodesOfThisType(java.lang.String posCode)
returns number of nodes of given type for which the postion has been already computed


getSubtreeWidth

public int getSubtreeWidth()
getter method


setSubtreeWidth

public void setSubtreeWidth(int subtreeWidth,
                            long timeStamp)
setter method


getSubtreeOffset

public int getSubtreeOffset()
getter method


setSubtreeOffset

public void setSubtreeOffset(int subtreeOffset,
                             long timeStamp)
setter method


getRefreshSubtreeTimeStamp

public long getRefreshSubtreeTimeStamp()
getter method


setRefreshSubtreeTimeStamp

public void setRefreshSubtreeTimeStamp(long refreshSubtreeTimeStamp)
setter method


getSubtreeOffsetTimeStamp

public long getSubtreeOffsetTimeStamp()
getter method


setSubtreeOffsetTimeStamp

public void setSubtreeOffsetTimeStamp(long subtreeOffsetTimeStamp)
setter method


getSubtreeWidthTimeStamp

public long getSubtreeWidthTimeStamp()
getter method


setSubtreeWidthTimeStamp

public void setSubtreeWidthTimeStamp(long subtreeWidthTimeStamp)
setter method


getIconPath

public java.lang.String getIconPath()
queries the display model for the path to the icon

Returns:

getImage

public Image getImage(java.lang.String string)
creates new Eclipse image, called from getIcon and FeatureNodeFigure construcotor

Parameters:
string -
Returns:

getGlobalConstraints

public java.util.List getGlobalConstraints()
This is a setter method.

Returns:
list of global constraint in which the node is used

getGlobalConstraintParents

public java.util.Map getGlobalConstraintParents()
This is a setter method.

Returns:
map that maps global constraint to its parent


Copyright © 2004 - 2008 ETH Zurich and P&P Software GmbH, All Rights Reserved.