Class SimpleValueHandle

  • Direct Known Subclasses:
    MemberHandle, PropertyHandleImpl

    public abstract class SimpleValueHandle
    extends ValueHandle
    Abstract base class that represents a handle for the value to either a property or a structure member.
    • Method Summary

      All Methods Instance Methods Abstract Methods Concrete Methods 
      Modifier and Type Method Description
      abstract void addItem​(java.lang.Object item)
      Adds an item to the end of a list property.
      StructureHandle addItem​(IStructure item)
      Adds an item to the end of a list property or member.
      void clearValue()
      Clears the value of the property or member.
      java.lang.Object get​(int n)
      Returns the the nth entry in a list property or member.
      StructureHandle getAt​(int n)
      Returns the the nth entry in a list property or member.
      IChoice[] getChoices()
      Returns the array of choices that are defined for this property or member.
      java.lang.String getDefaultUnit()
      Gets the default unit of the property.
      abstract IPropertyDefn getDefn()
      Gets the generic property definition.
      java.lang.String getDisplayValue()
      gets the localized value of the property.
      double getFloatValue()
      Gets the value as a double.
      int getIntValue()
      Gets the value as an integer.
      java.util.List getItems()
      Gets the items of the list property.
      java.util.ArrayList getListValue()
      Gets the value as a list.
      java.math.BigDecimal getNumberValue()
      Gets the value as a number (BigDecimal).
      protected abstract java.lang.Object getRawValue()
      Gets the value stored in the memory directly.
      java.lang.String getStringValue()
      Gets the value as a string.
      int getTypeCode()
      Returns the numeric code for the type of this property or member.
      java.lang.Object getValue()
      Gets the value of the property as a generic object.
      int indexOf​(java.lang.Object o)
      Returns the index in this list of the first occurrence of the specified element, or -1 if this list does not contain this element.
      StructureHandle insertItem​(IStructure item, int posn)
      Inserts a new item into a list property or member at the given position.
      protected boolean isList()
      Indicate if this handle is working on a list property.
      abstract boolean isReadOnly()
      Checks whether a value is read-only in the property sheet.
      abstract boolean isVisible()
      Checks whether a value is visible in the property sheet.
      java.util.Iterator iterator()
      Returns an iterator over the values in a list property, or null if the property is not a list property.
      void moveItem​(int from, int to)
      Moves an item within a list property or member.
      abstract void removeItem​(int posn)
      Removes an item from a list property or member.
      void removeItem​(java.lang.Object item)
      Removes an item from a list property or member.
      void removeItems​(java.util.List items)
      Removes all the items in the list from a list property or member.
      void replaceItem​(IStructure oldItem, IStructure newItem)
      Replaces an old structure with a new one for the this property or member.
      void setFloatValue​(double value)
      Sets the value of the property or member to the given double.
      void setIntValue​(int value)
      Sets the value of the property or member to the given integer.
      void setNumberValue​(java.math.BigDecimal value)
      Sets the value of the property or member to the given number.
      void setStringValue​(java.lang.String value)
      Sets the value of the property or member to the given integer.
      abstract void setValue​(java.lang.Object value)
      Sets the value of a property or member to the object given.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • SimpleValueHandle

        public SimpleValueHandle​(DesignElementHandle element)
        Constructs a handle with the given handle to an design element.
        Parameters:
        element - a handle to a report element
    • Method Detail

      • getDefn

        public abstract IPropertyDefn getDefn()
        Gets the generic property definition. Its a property definition for an element or a member definition for a structure.
        Returns:
        the value definition.
      • getRawValue

        protected abstract java.lang.Object getRawValue()
        Gets the value stored in the memory directly. The returned value won't be done any conversion.
        Returns:
        the value stored in the memory
      • getValue

        public final java.lang.Object getValue()
        Gets the value of the property as a generic object. Use the specialized methods to get the value as a particular type.
        Returns:
        The value of the property as a generic object.
        See Also:
        getStringValue(), getIntValue(), getFloatValue(), getNumberValue()
      • getIntValue

        public int getIntValue()
        Gets the value as an integer.
        Returns:
        The value as an integer. Returns 0 if the value cannot be converted to an integer.
      • getStringValue

        public java.lang.String getStringValue()
        Gets the value as a string.
        Returns:
        The value as a string.
      • getFloatValue

        public double getFloatValue()
        Gets the value as a double.
        Returns:
        The value as a double. Returns 0 if the value cannot be converted to a double.
      • getNumberValue

        public java.math.BigDecimal getNumberValue()
        Gets the value as a number (BigDecimal).
        Returns:
        The value as a number. Returns null if the value cannot be converted to a number.
      • getListValue

        public java.util.ArrayList getListValue()
        Gets the value as a list.
        Returns:
        The value as a list. Returns null if the value cannot be converted to a list.
      • getDisplayValue

        public java.lang.String getDisplayValue()
        gets the localized value of the property.
        Returns:
        the localized value
      • getAt

        public StructureHandle getAt​(int n)
        Returns the the nth entry in a list property or member. Use this method for properties that contain a list of structures. The index must be valid for the list.
        Parameters:
        n - The list index.
        Returns:
        A handle to the structure at the given index.
      • get

        public java.lang.Object get​(int n)
        Returns the the nth entry in a list property or member. Use this method for properties that contain a list of items. The index must be valid for the list. In the following cases, this method will return a meaningful value:

      • If this property or member is a structure list type, then return StructureHandle.
      • If this property or member is a list of element reference, return DesignElementHandle if resolved, otherwise return the qualified name of the referred element.
      • If this property or member is a list of simeple value(int, float, decimal, date-time, string), then return the atomice Java Object(Integer, Float, Double, BigDecimal, Date, String).
      • If this property or member is not a list value or the index is out of range, then return null.
Parameters:
n - The list index.
Returns:
A handle to the structure, a handle to the referred element, or some simple value(int, float, decimal, data-time, string) at the given index.
Parameters:
item - the item to remove
Throws:
PropertyValueException - If the property is not a list property, or if the given item is not contained in the list.