edu.usc.cse.desi.model.view
Class AbstractNodeViewModel

java.lang.Object
  extended byedu.usc.cse.desi.model.AbstractDESIModel
      extended byedu.usc.cse.desi.model.view.AbstractViewModel
          extended byedu.usc.cse.desi.model.view.AbstractNodeViewModel
All Implemented Interfaces:
java.util.EventListener, org.eclipse.ui.views.properties.IPropertySource, java.beans.PropertyChangeListener, java.io.Serializable
Direct Known Subclasses:
ComponentViewModel, HostViewModel

public abstract class AbstractNodeViewModel
extends AbstractViewModel
implements org.eclipse.ui.views.properties.IPropertySource

The super class that all node view models inherrit from.

Author:
Nels Started Mar 3, 2004
See Also:
Serialized Form

Field Summary
static java.lang.String C_DISPLAY_IMAGEDATA
           
static java.lang.String C_DISPLAY_MODELDATA
           
protected  org.eclipse.swt.graphics.Color myBGColor
           
protected  int myBorderWidth
           
protected  java.util.List myChildren
           
private  java.util.HashMap myConnectedNodes
           
protected  java.util.List myConnections
           
protected  int myFigPosX
           
protected  int myFigPosY
           
protected  int myFigSizeH
           
protected  int myFigSizeW
           
static java.lang.String P_DISPLAY_FIGLOCATION_X
           
static java.lang.String P_DISPLAY_FIGLOCATION_Y
           
static java.lang.String P_DISPLAY_FIGSIZE_H
           
static java.lang.String P_DISPLAY_FIGSIZE_W
           
static java.lang.String P_DISPLAY_NUMCHILDREN
           
static java.lang.String P_DISPLAY_NUMCONNECTIONS
           
static java.lang.String P_ID_FIGLOCATION_X
           
static java.lang.String P_ID_FIGLOCATION_Y
           
static java.lang.String P_ID_FIGSIZE_H
           
static java.lang.String P_ID_FIGSIZE_W
           
static java.lang.String P_ID_NUMCHILDREN
           
static java.lang.String P_ID_NUMCONNECTIONS
           
 
Fields inherited from class edu.usc.cse.desi.model.view.AbstractViewModel
myDataModel
 
Fields inherited from class edu.usc.cse.desi.model.AbstractDESIModel
listeners
 
Constructor Summary
AbstractNodeViewModel()
           
 
Method Summary
 void addConnectedNode(AbstractNodeViewModel arg0, AbstractConnectionViewModel arg1)
           
private  org.eclipse.ui.views.properties.IPropertyDescriptor[] buildPropertyDescriptor()
          Build the array of property descriptors from this object's PropertyHolder.
 java.util.List getChildren()
           
 AbstractConnectionViewModel getConnectedLink(AbstractNodeViewModel arg0)
          Returns the link that connects this node and the given node.
 java.util.Iterator getConnectedNodes()
           
 java.util.List getConnections()
           
 java.lang.Object getEditableValue()
           
 org.eclipse.swt.graphics.Color getMyBGColor()
          Return the background color of this Node.
 int getMyBorderWidth()
           
 int getMyFigPosX()
           
 int getMyFigPosY()
           
 int getMyFigSizeH()
           
 int getMyFigSizeW()
           
 PropertyInitializer getMyPropetyInitializer()
          I overrode this method:
 java.util.Collection getProperties()
          I overrode this method:
 org.eclipse.ui.views.properties.IPropertyDescriptor[] getPropertyDescriptors()
          Returns the texts descriptions of the properties that will appear in the property sheet.
 java.lang.String getPropertyDisplayName(java.lang.String prop_name)
          I overrode this method:
 java.lang.Object getPropertyValue(java.lang.Object obj)
          Return the value associated with the given property.
 java.lang.Object getPropertyValue(java.lang.String prop_name)
          I overrode this method:
 boolean hasProperty(java.lang.String prop_name)
          I overrode this method:
 boolean isConnectedToNode(AbstractNodeViewModel arg0)
           
 boolean isPropertySet(java.lang.Object id)
          At this point I am not sure what this method does but it is necessary for the IPropertySource interface and in the Eclipse book they return false.
 int numOfConnectedNodes()
           
 void reinitialize()
          I overrode this method:
 void removeConnectedNode(AbstractNodeViewModel arg0)
           
 void resetPropertyValue(java.lang.Object id)
          Same is true for this function as is isPropertySet() except that in the Eclipse book, they didn't mention this method AT ALL.
 void setMyBGColor(org.eclipse.swt.graphics.Color color)
          Set the foreground color of this Node.
 void setMyBorderWidth(int i)
           
protected  void setMyDataModel(AbstractNodeDataModel model)
           
 void setMyFigPosX(int i)
           
 void setMyFigPosY(int i)
           
 void setMyFigSizeH(int i)
           
 void setMyFigSizeW(int i)
           
 void setPropertyValue(java.lang.Object obj, java.lang.Object value)
          Sets the values that are entered into a property sheet into the data model.
 void setPropertyValue(java.lang.String prop_name, java.lang.Object value)
          I overrode this method:
 
Methods inherited from class edu.usc.cse.desi.model.view.AbstractViewModel
getMyDataModel
 
Methods inherited from class edu.usc.cse.desi.model.AbstractDESIModel
addPropertyChangeListener, firePropertyChange, propertyChange, removePropertyChangeListener
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

myChildren

protected java.util.List myChildren

myConnections

protected java.util.List myConnections

myFigPosX

protected int myFigPosX

myFigPosY

protected int myFigPosY

myFigSizeW

protected int myFigSizeW

myFigSizeH

protected int myFigSizeH

myBorderWidth

protected int myBorderWidth

myBGColor

protected transient org.eclipse.swt.graphics.Color myBGColor

myConnectedNodes

private transient java.util.HashMap myConnectedNodes

P_ID_FIGSIZE_W

public static final java.lang.String P_ID_FIGSIZE_W
See Also:
Constant Field Values

P_DISPLAY_FIGSIZE_W

public static final java.lang.String P_DISPLAY_FIGSIZE_W
See Also:
Constant Field Values

P_ID_FIGSIZE_H

public static final java.lang.String P_ID_FIGSIZE_H
See Also:
Constant Field Values

P_DISPLAY_FIGSIZE_H

public static final java.lang.String P_DISPLAY_FIGSIZE_H
See Also:
Constant Field Values

P_ID_FIGLOCATION_X

public static final java.lang.String P_ID_FIGLOCATION_X
See Also:
Constant Field Values

P_DISPLAY_FIGLOCATION_X

public static final java.lang.String P_DISPLAY_FIGLOCATION_X
See Also:
Constant Field Values

P_ID_FIGLOCATION_Y

public static final java.lang.String P_ID_FIGLOCATION_Y
See Also:
Constant Field Values

P_DISPLAY_FIGLOCATION_Y

public static final java.lang.String P_DISPLAY_FIGLOCATION_Y
See Also:
Constant Field Values

P_ID_NUMCONNECTIONS

public static final java.lang.String P_ID_NUMCONNECTIONS
See Also:
Constant Field Values

P_DISPLAY_NUMCONNECTIONS

public static final java.lang.String P_DISPLAY_NUMCONNECTIONS
See Also:
Constant Field Values

P_ID_NUMCHILDREN

public static final java.lang.String P_ID_NUMCHILDREN
See Also:
Constant Field Values

P_DISPLAY_NUMCHILDREN

public static final java.lang.String P_DISPLAY_NUMCHILDREN
See Also:
Constant Field Values

C_DISPLAY_MODELDATA

public static final java.lang.String C_DISPLAY_MODELDATA
See Also:
Constant Field Values

C_DISPLAY_IMAGEDATA

public static final java.lang.String C_DISPLAY_IMAGEDATA
See Also:
Constant Field Values
Constructor Detail

AbstractNodeViewModel

public AbstractNodeViewModel()
Method Detail

reinitialize

public void reinitialize()
I overrode this method:

Overrides:
reinitialize in class AbstractViewModel
See Also:
AbstractDESIModel.reinitialize()

getMyBorderWidth

public int getMyBorderWidth()
Returns:
int

getMyFigPosX

public int getMyFigPosX()
Returns:
int

getMyFigPosY

public int getMyFigPosY()
Returns:
int

getMyFigSizeH

public int getMyFigSizeH()
Returns:
int

getMyFigSizeW

public int getMyFigSizeW()
Returns:
int

setMyBorderWidth

public void setMyBorderWidth(int i)
Parameters:
i - int

setMyFigPosX

public void setMyFigPosX(int i)
Parameters:
i - int

setMyFigPosY

public void setMyFigPosY(int i)
Parameters:
i - int

setMyFigSizeH

public void setMyFigSizeH(int i)
Parameters:
i - int

setMyFigSizeW

public void setMyFigSizeW(int i)
Parameters:
i - int

getMyBGColor

public org.eclipse.swt.graphics.Color getMyBGColor()
Return the background color of this Node.

Returns:

setMyBGColor

public void setMyBGColor(org.eclipse.swt.graphics.Color color)
Set the foreground color of this Node. *NOTE* It is best to set this color to on of the ColorConstants. Otherwise you need to call Color.dispose() when you are finished with a Color.

Parameters:
color - new BG color.

setMyDataModel

protected void setMyDataModel(AbstractNodeDataModel model)
Parameters:
model -

getChildren

public java.util.List getChildren()
Returns:
Returns the myChildren.

getConnections

public java.util.List getConnections()
Returns:
Returns the myConnections.

getEditableValue

public java.lang.Object getEditableValue()
Specified by:
getEditableValue in interface org.eclipse.ui.views.properties.IPropertySource

buildPropertyDescriptor

private org.eclipse.ui.views.properties.IPropertyDescriptor[] buildPropertyDescriptor()
Build the array of property descriptors from this object's PropertyHolder.

Returns:
IPropertyDescriptor[] - The array of propertyDescriptors.

getPropertyDescriptors

public org.eclipse.ui.views.properties.IPropertyDescriptor[] getPropertyDescriptors()
Returns the texts descriptions of the properties that will appear in the property sheet.

Specified by:
getPropertyDescriptors in interface org.eclipse.ui.views.properties.IPropertySource
Returns:

getPropertyValue

public java.lang.Object getPropertyValue(java.lang.Object obj)
Return the value associated with the given property. Remember, this could be anything from size to amount of memory or name.

Specified by:
getPropertyValue in interface org.eclipse.ui.views.properties.IPropertySource
Parameters:
obj -
Returns:

setPropertyValue

public void setPropertyValue(java.lang.Object obj,
                             java.lang.Object value)
Sets the values that are entered into a property sheet into the data model.

Specified by:
setPropertyValue in interface org.eclipse.ui.views.properties.IPropertySource
Parameters:
obj - The id of the property.
value - The new value of the property.

isPropertySet

public boolean isPropertySet(java.lang.Object id)
At this point I am not sure what this method does but it is necessary for the IPropertySource interface and in the Eclipse book they return false.

Specified by:
isPropertySet in interface org.eclipse.ui.views.properties.IPropertySource
Parameters:
id -
Returns:

resetPropertyValue

public void resetPropertyValue(java.lang.Object id)
Same is true for this function as is isPropertySet() except that in the Eclipse book, they didn't mention this method AT ALL.

Specified by:
resetPropertyValue in interface org.eclipse.ui.views.properties.IPropertySource
Parameters:
id -

addConnectedNode

public void addConnectedNode(AbstractNodeViewModel arg0,
                             AbstractConnectionViewModel arg1)
Parameters:
arg0 -
Returns:

isConnectedToNode

public boolean isConnectedToNode(AbstractNodeViewModel arg0)
Parameters:
arg0 -
Returns:

removeConnectedNode

public void removeConnectedNode(AbstractNodeViewModel arg0)
Parameters:
arg0 -
Returns:

numOfConnectedNodes

public int numOfConnectedNodes()
Returns:

getConnectedLink

public AbstractConnectionViewModel getConnectedLink(AbstractNodeViewModel arg0)
Returns the link that connects this node and the given node. Returns null if there is no connection. You should check isConnectedToNode() first to see if links are connected.

Parameters:
arg0 - AbstractNodeViewModel - The other node.
Returns:
AbstractConnectionViewModel - The link connecting the two nodes.

getConnectedNodes

public java.util.Iterator getConnectedNodes()
Returns:
Iterator - An iter full of AbstractNodeViewModels.

getMyPropetyInitializer

public PropertyInitializer getMyPropetyInitializer()
I overrode this method:

Overrides:
getMyPropetyInitializer in class AbstractViewModel
Returns:
See Also:
edu.usc.cse.desi.model.AbstractNodeDataModel#getMyPropetyInitializer()

getProperties

public java.util.Collection getProperties()
I overrode this method:

Overrides:
getProperties in class AbstractViewModel
Returns:
See Also:
AbstractDataModel.getProperties()

getPropertyDisplayName

public java.lang.String getPropertyDisplayName(java.lang.String prop_name)
                                        throws PropertyNotFoundException
I overrode this method:

Overrides:
getPropertyDisplayName in class AbstractViewModel
Parameters:
prop_name -
Returns:
Throws:
PropertyNotFoundException
See Also:
AbstractDataModel.getPropertyDisplayName(java.lang.String)

getPropertyValue

public java.lang.Object getPropertyValue(java.lang.String prop_name)
                                  throws PropertyNotFoundException
I overrode this method:

Overrides:
getPropertyValue in class AbstractViewModel
Parameters:
prop_name -
Returns:
Throws:
PropertyNotFoundException
See Also:
AbstractDataModel.getPropertyValue(java.lang.String)

hasProperty

public boolean hasProperty(java.lang.String prop_name)
I overrode this method:

Overrides:
hasProperty in class AbstractViewModel
Parameters:
prop_name -
Returns:
See Also:
AbstractDataModel.hasProperty(java.lang.String)

setPropertyValue

public void setPropertyValue(java.lang.String prop_name,
                             java.lang.Object value)
                      throws PropertyNotFoundException,
                             java.lang.ClassCastException
I overrode this method:

Overrides:
setPropertyValue in class AbstractViewModel
Parameters:
prop_name -
value -
Throws:
java.lang.ClassCastException
PropertyNotFoundException
See Also:
AbstractDataModel.setPropertyValue(java.lang.String, java.lang.Object)