com.dynamide
Class Property

java.lang.Object
  extended by com.dynamide.DynamideObject
      extended by com.dynamide.Property
All Implemented Interfaces:
IGet

public class Property
extends DynamideObject

This class handles reading of XML properties that are embedded in XML files for Widget and Page (and, in theory, Session). The format for the properties element is

     <properties>
       <property name="myEventProperty" isEvent="true">
          <defaultValue></defaultValue>
          <type>com.dynamide.property.EventProperty</type>
       </property>
       <property name="myProperty">
          <defaultValue>Foo</defaultValue>
          <type>java.lang.String</type>
       </property>
     </properties>
  
The property element contains two attributes: name, and isEvent. Valid property child nodes are:
    name
    defaultValue
    value
    designer
    datatype
    helpTip
    category
    data
  
However, these are just stored in a StringList, so you can add them without changing the constructor. You would just need to modify constructor Property(Element) if one of the subpropbs had children.

There is one property that is not a simple String, and that is "enumeration", which can have "value" child nodes. The "value" nodes contain text nodes with the values that make up the enumeration. The enumeration is to support enumerated types, the datatype must be "com.dynamide.datatypes.EnumeratedDatatype". Here's an example:
     
       <property name="myProperty">
          <defaultValue>Foo</defaultValue>
          <type>java.lang.String</type>
          <datatype>enumeration</datatype>
          <enumeration>
              <value>left</value>
              <value>right</value>
              <value>top</value>
              <value>bottom</value>
          </enumeration>
       </property>
     </properties>
  
Property handles this subproperty specially in the Constructor.


Field Summary
static java.lang.String OPTIONAL
           
static java.lang.String RECOMMENDED
           
static java.lang.String REQUIRED
           
 
Fields inherited from class com.dynamide.DynamideObject
m_id
 
Constructor Summary
Property(DynamideObject owner)
           
Property(DynamideObject owner, Session session, org.jdom.Element propertyElement)
           
Property(DynamideObject owner, Session session, org.jdom.Element propertyElement, java.lang.String ownerID, java.lang.String location)
          Handles creating a Property from an xml Element.
Property(DynamideObject owner, java.lang.String name, java.lang.Object value)
           
 
Method Summary
 java.lang.Object clone()
           
static Property createFromXML(org.jdom.Element propertyElement)
           
static Property createFromXML(java.lang.String xmlFilename)
           
 java.lang.String dump()
          Subclasses can override this with something more descriptive, for logging and debugging.
 java.lang.String dumpHTML()
          Subclasses can override this with something more descriptive, for logging and debugging.
 java.lang.String dumpXML()
           
 void finalize()
           
 java.lang.Object get(java.lang.String what)
          Subclasses can override this.
 java.util.Collection getCollection()
           
 java.lang.String getCurrentStringValue()
           
 java.lang.Object getCurrentValue()
           
 Datatype getDatatype()
           
 java.lang.Object getDefaultValue()
           
 java.lang.String getDotName()
           
 java.lang.Object getEditor()
           
 EnumeratedDatatype getEnumeratedDatatype()
           
 java.util.Enumeration getEnumeration()
           
 int getEnumerationDefaultIndex()
           
 java.lang.String getName()
           
 Session getSession()
           
 java.lang.String getStringValue()
           
 java.lang.Object getValue()
          Returns the Object stored in "value", or, if that is null, reutrns the default value.
 java.lang.Object getValueObjectNoDefault()
           
 boolean hasEditor()
           
 boolean isEvent()
           
 boolean isValueTrue(java.lang.String subPropertyName)
           
 void overrideValuesFrom(Property newProperty)
           
 void set(java.lang.String key, java.lang.Object value)
           
 void setEditor(java.lang.Object new_value)
           
 void setIsEvent(boolean new_value)
           
 void setName(java.lang.String new_name)
           
 void setSession(Session new_value)
           
 void setValue(java.lang.Object value)
           
 org.jdom.Element toElement()
          Persist to Element to save any in-memory changes
 java.lang.String toString()
           
 
Methods inherited from class com.dynamide.DynamideObject
clearProfiler, dump, expand, findParentExpander, findParentPage, findParentSession, findTopParentPage, getCategoryID, getID, getNextGetter, getObjectID, getOwner, getProfiler, isDebugEnabled, isInfoEnabled, logDebug, logDebug, logDebug, logDebug, logError, logError, logError, logError, logInfo, logInfo, logInfo, logInfo, logWarn, logWarn, logWarn, logWarn, popLogContext, printf, printProfiler, profileEnter, profileLeave, pushLogContext, setDotName, setID, setNextGetter, setObjectID, setOwner, sprintf, useProfiler, walkParents
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

OPTIONAL

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

RECOMMENDED

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

REQUIRED

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

Property

public Property(DynamideObject owner)

Property

public Property(DynamideObject owner,
                java.lang.String name,
                java.lang.Object value)
         throws DatatypeException
Throws:
DatatypeException

Property

public Property(DynamideObject owner,
                Session session,
                org.jdom.Element propertyElement)
         throws DatatypeException
Throws:
DatatypeException

Property

public Property(DynamideObject owner,
                Session session,
                org.jdom.Element propertyElement,
                java.lang.String ownerID,
                java.lang.String location)
         throws DatatypeException
Handles creating a Property from an xml Element. All child nodes are taken as "subproperties", just simple String values, except for "enumeration" which can have "value" child nodes. Any single-node child of "property" that you add will automatically become a subproperty.

Throws:
DatatypeException
Method Detail

finalize

public void finalize()
              throws java.lang.Throwable
Overrides:
finalize in class DynamideObject
Throws:
java.lang.Throwable

createFromXML

public static Property createFromXML(org.jdom.Element propertyElement)
                              throws java.lang.Exception
Throws:
java.lang.Exception

createFromXML

public static Property createFromXML(java.lang.String xmlFilename)
                              throws java.lang.Exception
Throws:
java.lang.Exception

getSession

public Session getSession()

setSession

public void setSession(Session new_value)

getDotName

public java.lang.String getDotName()
Overrides:
getDotName in class DynamideObject

getName

public java.lang.String getName()

setName

public void setName(java.lang.String new_name)

clone

public java.lang.Object clone()
Overrides:
clone in class java.lang.Object

getDatatype

public Datatype getDatatype()

getValue

public java.lang.Object getValue()
Returns the Object stored in "value", or, if that is null, reutrns the default value. WebMacro requires this to be available if setValue() is available, since it thinks it is a bean; this method simply calls getValue(), you should call getStringValue() if you specifically need a String.


getValueObjectNoDefault

public java.lang.Object getValueObjectNoDefault()

getDefaultValue

public java.lang.Object getDefaultValue()

setValue

public void setValue(java.lang.Object value)

set

public void set(java.lang.String key,
                java.lang.Object value)

get

public java.lang.Object get(java.lang.String what)
Description copied from class: DynamideObject
Subclasses can override this.

Specified by:
get in interface IGet
Overrides:
get in class DynamideObject

isValueTrue

public boolean isValueTrue(java.lang.String subPropertyName)

getStringValue

public java.lang.String getStringValue()

getCurrentStringValue

public java.lang.String getCurrentStringValue()

getCurrentValue

public java.lang.Object getCurrentValue()

getEnumerationDefaultIndex

public int getEnumerationDefaultIndex()

getEnumeration

public java.util.Enumeration getEnumeration()
                                     throws java.lang.Exception
Throws:
java.lang.Exception

getCollection

public java.util.Collection getCollection()

getEnumeratedDatatype

public EnumeratedDatatype getEnumeratedDatatype()

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

dumpHTML

public java.lang.String dumpHTML()
Description copied from class: DynamideObject
Subclasses can override this with something more descriptive, for logging and debugging.

Overrides:
dumpHTML in class DynamideObject

dump

public java.lang.String dump()
Description copied from class: DynamideObject
Subclasses can override this with something more descriptive, for logging and debugging.

Overrides:
dump in class DynamideObject

dumpXML

public java.lang.String dumpXML()

toElement

public org.jdom.Element toElement()
Persist to Element to save any in-memory changes


overrideValuesFrom

public void overrideValuesFrom(Property newProperty)

isEvent

public boolean isEvent()

setIsEvent

public void setIsEvent(boolean new_value)

getEditor

public java.lang.Object getEditor()

setEditor

public void setEditor(java.lang.Object new_value)

hasEditor

public boolean hasEditor()


Copyright 2001-2013 DYNAMIDE.COM. All Rights Reserved.