Rational Developer for Power Systems Software
V7.6

com.ibm.etools.iseries.edit.language.model
Class LanguageModelElement

java.lang.Object
  extended by com.ibm.etools.iseries.edit.language.model.LanguageModelElement
Direct Known Subclasses:
LanguageModel

public class LanguageModelElement
extends Object

This element is used to represent a node in a tree of elements. This element knows about its children, and its parent. A programmer may associate any object with this element by using the setData and getData methods. Elements are presented in the Outline view. The element may have attributes that are shown in the Properties view.


Field Summary
protected  LanguageModelElement _elementParent
           
protected  int _iLineNumberFirst
           
protected  int _iLineNumberLast
           
protected  LanguageModel _model
           
protected  String _name
           
protected  Object _objData
           
protected  String _strImage
           
protected  String _strName
           
protected  Vector _vectorAttributes
           
protected  Vector _vectorChildElements
           
static String Copyright
           
 
Constructor Summary
LanguageModelElement(LanguageModel model, LanguageModelElement elementParent, String strName, String strImage, int iLineNumberFirst, int iLineNumberLast)
          Constructor.
LanguageModelElement(String name, LanguageModel model, LanguageModelElement elementParent, String strName, String strImage, int iLineNumberFirst, int iLineNumberLast)
          Constructor.
LanguageModelElement(String name, LanguageModel model, LanguageModelElement elementParent, String strName, String strImage, int iLineNumberFirst, int iLineNumberLast, int iIndex)
          Constructor.
 
Method Summary
 void addAttribute(LanguageModelAttribute attribute)
          Adds an attribute to this element.
protected  void addChildElement(LanguageModelElement element)
          Adds a child element to the end of the element list.
protected  void addChildElement(LanguageModelElement element, int iIndex)
          Adds a child element to the specified location in the zero based list.
 LanguageModelElement findElementFromHashValue(int iHashValue)
          Searches the element tree for an element with the hash value.
 Object getAdapter(Class adapter)
          Returns an object which is an instance of the given class associated with this object.
 LanguageModelAttribute getAttribute(String strAttributeName)
          Returns the attribute given the attribute name.
 String getAttributeValue(String strAttributeName)
          Returns the value of an attribute given the attribute's name.
 LanguageModelElement getChildElement(String strElementName)
          Returns the first child element with the given name.
 LanguageModelElement getChildElementAt(int iIndex)
          Returns the element at the given position in the list.
 int getChildElementIndex(LanguageModelElement elementChild)
          Returns the position of the given child element in the list of child elements.
 Iterator getChildren()
          Returns the children in the form of an iterator.
 void getData(Object objData)
          Obtains the associated user data of this element.
 Object getEditableValue()
          Returns a value for this object that can be edited in a property sheet.
 LanguageModelElement getElementFromLineNumber(int iLineNumber)
          Returns the farthest element branch in the tree that is at this line number.
 String getImageName()
          Returns the name of the image file.
 int getLineRangeExtent()
          Returns the number of lines that this element covers.
 int getLineRangeOrigin()
          Returns the first line number that this element covers.
 LanguageModel getModel()
          Returns the model that contains this element.
 String getName()
           
 int getNumberOfAttributes()
          Returns the number of attributes that this element contains.
 int getNumberOfChildElements()
          Returns the number of child elements that this element contains.
 LanguageModelElement getParent()
          Returns the parent element of this element.
 IPropertyDescriptor[] getPropertyDescriptors()
          Returns an array of property descriptors, ne for each attribute.
 Object getPropertyValue(Object objName)
          Returns the current value for the named property.
 boolean hasChildren()
          Returns whether this element contains child elements.
 boolean hasDescendent(LanguageModelElement element)
          Determines whether the given element is a descendent of this one.
 boolean isPropertySet(Object property)
          Returns whether the property value has changed from the default.
 void printElementTree()
          Debug function that prints the entire element tree, and each element's attributes starting at this element.
 void printElementTree(int iIndentation)
          Debug function that prints the entire element tree, and each element's attributes starting at this element.
 void removeAllChildElements()
          Removes all child elements of this element.
 void removeChildElement(LanguageModelElement elementChild)
          Removes the given child element from this element.
 void resetPropertyValue(Object id)
          Resets the property with the given id to its default value if possible.
 void setData(Object objData)
          Associates user data with this element.
 void setPropertyValue(Object objName, Object objValue)
          Sets the named property (attribute) to the given value (string).
 String toString()
          Returns the name of the element.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

Copyright

public static final String Copyright
See Also:
Constant Field Values

_model

protected LanguageModel _model

_elementParent

protected LanguageModelElement _elementParent

_objData

protected Object _objData

_strImage

protected String _strImage

_strName

protected String _strName

_name

protected String _name

_vectorChildElements

protected Vector _vectorChildElements

_vectorAttributes

protected Vector _vectorAttributes

_iLineNumberFirst

protected int _iLineNumberFirst

_iLineNumberLast

protected int _iLineNumberLast
Constructor Detail

LanguageModelElement

public LanguageModelElement(LanguageModel model,
                            LanguageModelElement elementParent,
                            String strName,
                            String strImage,
                            int iLineNumberFirst,
                            int iLineNumberLast)
Constructor. Line numbers set to -1 are ignored. A programmer may associate any object with this element by using the setData and getData methods.


LanguageModelElement

public LanguageModelElement(String name,
                            LanguageModel model,
                            LanguageModelElement elementParent,
                            String strName,
                            String strImage,
                            int iLineNumberFirst,
                            int iLineNumberLast)
Constructor. Line numbers set to -1 are ignored. A programmer may associate any object with this element by using the setData and getData methods.


LanguageModelElement

public LanguageModelElement(String name,
                            LanguageModel model,
                            LanguageModelElement elementParent,
                            String strName,
                            String strImage,
                            int iLineNumberFirst,
                            int iLineNumberLast,
                            int iIndex)
Constructor. Line numbers set to -1 are ignored. A programmer may associate any object with this element by using the setData and getData methods.

Method Detail

getName

public String getName()

addAttribute

public void addAttribute(LanguageModelAttribute attribute)
Adds an attribute to this element.


addChildElement

protected void addChildElement(LanguageModelElement element)
Adds a child element to the end of the element list.


addChildElement

protected void addChildElement(LanguageModelElement element,
                               int iIndex)
Adds a child element to the specified location in the zero based list.


findElementFromHashValue

public LanguageModelElement findElementFromHashValue(int iHashValue)
Searches the element tree for an element with the hash value. This is used during drag/drop.


getAdapter

public Object getAdapter(Class adapter)
Returns an object which is an instance of the given class associated with this object. Returns null if no such object can be found. This class is an IPropertySource.


getAttribute

public LanguageModelAttribute getAttribute(String strAttributeName)
Returns the attribute given the attribute name. The name is case sensitive. A null is returned if the attribute is not found.


getAttributeValue

public String getAttributeValue(String strAttributeName)
Returns the value of an attribute given the attribute's name. Returns null if the attribute is not found.


getChildElement

public LanguageModelElement getChildElement(String strElementName)
Returns the first child element with the given name. Returns null if the element is not found.


getChildElementAt

public LanguageModelElement getChildElementAt(int iIndex)
Returns the element at the given position in the list. Returns null if the position is out of bounds.


getChildElementIndex

public int getChildElementIndex(LanguageModelElement elementChild)
Returns the position of the given child element in the list of child elements. Returns -1 if the element is not found.


getChildren

public Iterator getChildren()
Returns the children in the form of an iterator. Returns null if there are no children.


getData

public void getData(Object objData)
Obtains the associated user data of this element. This is used for storing and retrieving any object type with this element. The object is not used by this class.


getEditableValue

public Object getEditableValue()
Returns a value for this object that can be edited in a property sheet.


getElementFromLineNumber

public LanguageModelElement getElementFromLineNumber(int iLineNumber)
Returns the farthest element branch in the tree that is at this line number.


getModel

public LanguageModel getModel()
Returns the model that contains this element.


getImageName

public String getImageName()
Returns the name of the image file.


getLineRangeExtent

public int getLineRangeExtent()
Returns the number of lines that this element covers.


getLineRangeOrigin

public int getLineRangeOrigin()
Returns the first line number that this element covers.


getNumberOfAttributes

public int getNumberOfAttributes()
Returns the number of attributes that this element contains.


getNumberOfChildElements

public int getNumberOfChildElements()
Returns the number of child elements that this element contains.


getParent

public LanguageModelElement getParent()
Returns the parent element of this element.


getPropertyDescriptors

public IPropertyDescriptor[] getPropertyDescriptors()
Returns an array of property descriptors, ne for each attribute. If the attribute is editable, then a TextPropertyDescriptor is returned. Otherwise, a PropertyDescriptor is returned.


getPropertyValue

public Object getPropertyValue(Object objName)
Returns the current value for the named property.


hasChildren

public boolean hasChildren()
Returns whether this element contains child elements.


hasDescendent

public boolean hasDescendent(LanguageModelElement element)
Determines whether the given element is a descendent of this one.


isPropertySet

public boolean isPropertySet(Object property)
Returns whether the property value has changed from the default. This version always returns false.


printElementTree

public void printElementTree()
Debug function that prints the entire element tree, and each element's attributes starting at this element.


printElementTree

public void printElementTree(int iIndentation)
Debug function that prints the entire element tree, and each element's attributes starting at this element.


removeAllChildElements

public void removeAllChildElements()
Removes all child elements of this element.


removeChildElement

public void removeChildElement(LanguageModelElement elementChild)
Removes the given child element from this element.


resetPropertyValue

public void resetPropertyValue(Object id)
Resets the property with the given id to its default value if possible. Does nothing if the notion of default value is not meaningful for the specified property, or if the property's value cannot be changed, or if this source does not have the specified property. This version does nothing.


setPropertyValue

public void setPropertyValue(Object objName,
                             Object objValue)
Sets the named property (attribute) to the given value (string). The model is notified of the change.


setData

public void setData(Object objData)
Associates user data with this element. This is used for storing and retrieving any object type with this element. The object is not used by this class.


toString

public String toString()
Returns the name of the element. This is used as the label in the outline view.

Overrides:
toString in class Object

Rational Developer for Power Systems Software
V7.6

Copyright © 2011 IBM Corp. All Rights Reserved.

Note: This documentation is for part of an interim API that is still under development and expected to change significantly before reaching stability. It is being made available at this early stage to solicit feedback from pioneering adopters on the understanding that any code that uses this API will almost certainly be broken (repeatedly) as the API evolves.