Class CIDProp

All Implemented Interfaces:
EventListener, IGProp<Integer>, Cloneable

public final class CIDProp extends Int32Prop
Component ID property is used to assign a unique value known on both client and server. The Component ID is used for references such as LabelFor.
Author:
Christopher Mindus
  • Constructor Details

    • CIDProp

      public CIDProp()
      Default constructor.
    • CIDProp

      public CIDProp(Atom atom)
      Default constructor with name.
  • Method Details

    • onPropTreeInitialized

      public void onPropTreeInitialized()
      Called when the property has initialized from the Element when streamed from an XML file, has had all (if any) children elements and nodes added as properties and that the property has been added into it's parent.

      The PropertyContainer calls all its children with this method in order to inform the tree.

      The ExtendablePropertyContainer overrides this method to load all extended containers.

      This method

      Specified by:
      onPropTreeInitialized in interface IGProp<Integer>
      Overrides:
      onPropTreeInitialized in class GProp<Integer>
    • initializeProp

      protected void initializeProp(Element element)
      Called to initialize the property from an Element. The property should initialize itself from attributes and nodes with appropriate information.

      Subclasses should override this method if custom initialization is required.

      The default implementation gets the attribute "value" and calls the methods object=convertPropertyValue(string) followed by setPropertyValue(object).

      Overrides:
      initializeProp in class GProp<Integer>
      Parameters:
      element - The Element.
    • fromElementString

      public Object fromElementString(String string)
      Called from the initializeProperty(Element element) method once the element String is retrieved from the "value" attribute of the element. Override this method to provide the appropriate String to Object conversion.

      The default implementation returns the String passed as the parameter.

      Specified by:
      fromElementString in interface IGProp<Integer>
      Overrides:
      fromElementString in class Int32Prop
      Parameters:
      string - the String value of the object from the String value attribute.
      Returns:
      The Zero Integer value, always.
    • toNativeValue0

      protected Object toNativeValue0(Object value, int index)
      Tries conversion of possibly accepted properties values using the setPropertyValue method into the most preferred property value type. If the input value already is of the preferred type, the same object is returned.

      Subclasses overrides the method toNativeValue0 in order to provide the appropriate conversion.

      Overrides:
      toNativeValue0 in class Int32Prop
      Parameters:
      value - The input value to convert to native value.
      index - The index in the array returned by getValueClasses(), or -1 if not found.
      Returns:
      The Zero Integer value, always.
    • modifyPropValue

      protected int modifyPropValue(Object oldValue, Object newValue, PropMgr propMgr) throws PropException
      Called when setting a new value for this property. This method is normally not overridden by subclasses, but e.g. for properties containing arrays, this may be handled here, in order not modify the "oldValue" (such as an array, but rather to change it with the data from the "newValue").

      NOTE: if running with assertions, this method will throw an assert exception as the CIDProp value should never be changed programmatically.

      Overrides:
      modifyPropValue in class GProp<Integer>
      Parameters:
      oldValue - The old value.
      newValue - The new value.
      propMgr - The property manager for remote change, null for local.
      Returns:
      1 for value has changed, 0 for same value as current value, -1 for not processed. 2 can also be returned to indicate the current value has been modified with new contents. This is e.g. the case for the StringMapProp.
      Throws:
      PropException - when the new value doesn't validate correctly.
    • onEventSelf

      public void onEventSelf(GEvent event)
      Called when a property event is send to this property.

      A subclass can override this method to perform appropriate processing and is not required to call super.onEventSelf(e).

      Specified by:
      onEventSelf in interface IGProp<Integer>
      Overrides:
      onEventSelf in class GProp<Integer>
      Parameters:
      event - The property event.
    • getComponentID

      public int getComponentID()
      Gets the Component ID.
    • appendPropValue

      protected void appendPropValue(PropMgr propertyManager, SendTransaction trans, Object value)
      Appends the integer property value. If uninitialized, -1 is appended.
      Overrides:
      appendPropValue in class Int32Prop
      Parameters:
      propertyManager - the property manager instance.
      trans - transaction to append the properties to.
      value - the value to append to the transaction, a reference to the current property value.