com.dynamide.datatypes
Class EnumeratedDatatype

java.lang.Object
  extended by com.dynamide.DynamideObject
      extended by com.dynamide.datatypes.Datatype
          extended by com.dynamide.datatypes.EnumeratedDatatype
All Implemented Interfaces:
IGet
Direct Known Subclasses:
LiveEnumeratedDatatype

public class EnumeratedDatatype
extends Datatype


Field Summary
 
Fields inherited from class com.dynamide.DynamideObject
m_id
 
Constructor Summary
EnumeratedDatatype()
           
EnumeratedDatatype(DynamideObject owner, Session session)
           
 
Method Summary
 void add(java.util.Collection datatypeCollection)
           
 int add(Datatype dt)
          Example of how to call this in a beanshell ServerSideEvent: items = event.currentPage.get("com_dynamide_select1").getProperty("items"); // getValueObject will return EnumerateDatatype instance, of this class.
 int add(int index, Datatype dt)
           
 void addStrings(java.util.Collection newStrings)
          Example of how to call this in a beanshell ServerSideEvent: items = event.currentPage.get("com_dynamide_select1").getProperty("items"); // getValueObject will return EnumerateDatatype instance, of this class.
 void addXMLContentTo(org.jdom.Element container)
           
 void clear()
           
 Datatype createClone()
          subclasses can override and replace
 java.lang.String dump()
          Subclasses can override this with something more descriptive, for logging and debugging.
 java.lang.String dump(boolean linebreaks)
          Add linebreaks for viewing in a console; 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.Object get(java.lang.String what)
          override to handle setting single string values, by just setting a single item with that value
 java.util.Collection getCollection()
           
 int getDefaultIndex()
           
 java.lang.Object getDefaultValue()
           
 java.util.Enumeration getEnumeration()
           
 boolean getFinal()
           
 java.lang.String getItemDatatype()
           
 boolean getOverride()
           
 java.lang.Object getValue(int index)
           
 int indexOf(java.lang.Object o)
           
 void init(org.jdom.Element element, java.lang.String ownerID)
          Deals with XML structures like this: <property name="links"> <datatype>com.dynamide.datatypes.Enumeration</datatype> <value> <enumeration override="true" final="false" itemDatatype="com.dynamide.datatypes.StringDatatype" > <item datatype="com.dynamide.datatypes.Link"> <href>${SESSIONARG}&${PAGEARG}&action=com.dynamide.linkstrip&dmLinkstripItem=Contact%20Us</href> <text>Contact Us</text> </item> ...
 void remove(int index)
           
 void remove(java.lang.String key)
           
 void set(java.lang.String what, java.lang.String value)
          override to handle setting single string values, by just setting a single item with that value
 void setDefaultIndex(int new_value)
           
 void setFinal(boolean new_value)
           
 void setItemDatatype(java.lang.String new_value)
           
 void setOverride(boolean new_value)
           
 int size()
           
 java.lang.String toHTML()
           
 java.lang.String toString()
           
 ValidationResult validate()
           
 
Methods inherited from class com.dynamide.datatypes.Datatype
clone, finalize, getAsStored, getDatatypeClassName, getDatatypeClassName, getDatatypeClassName, getDatatypeInstance, getProperty, getSession, insertItemDatatype, setProperty, setSession
 
Methods inherited from class com.dynamide.DynamideObject
clearProfiler, expand, findParentExpander, findParentPage, findParentSession, findTopParentPage, getCategoryID, getDotName, 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
 

Constructor Detail

EnumeratedDatatype

public EnumeratedDatatype()

EnumeratedDatatype

public EnumeratedDatatype(DynamideObject owner,
                          Session session)
Method Detail

getDefaultIndex

public int getDefaultIndex()

setDefaultIndex

public void setDefaultIndex(int new_value)

getOverride

public boolean getOverride()

setOverride

public void setOverride(boolean new_value)

getFinal

public boolean getFinal()

setFinal

public void setFinal(boolean new_value)

getItemDatatype

public java.lang.String getItemDatatype()

setItemDatatype

public void setItemDatatype(java.lang.String new_value)

getEnumeration

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

init

public void init(org.jdom.Element element,
                 java.lang.String ownerID)
          throws DatatypeException
Deals with XML structures like this:
     <property name="links">
       <datatype>com.dynamide.datatypes.Enumeration</datatype>
       <value>
           <enumeration override="true"  final="false" itemDatatype="com.dynamide.datatypes.StringDatatype" >
               <item datatype="com.dynamide.datatypes.Link">
                   <href>${SESSIONARG}&${PAGEARG}&action=com.dynamide.linkstrip&dmLinkstripItem=Contact%20Us</href>
                   <text>Contact Us</text>
               </item>
         ...
 

Overrides:
init in class Datatype
Throws:
DatatypeException

add

public int add(Datatype dt)
Example of how to call this in a beanshell ServerSideEvent:

   items = event.currentPage.get("com_dynamide_select1").getProperty("items");
   //   getValueObject will return EnumerateDatatype instance, of this class.
   enumObj = items.getValue();

   event.println("enumObj.dumpHTML(): "+enumObj.dumpHTML());

   Datatype dtc = Datatype.getDatatypeInstance(null, "com.dynamide.datatypes.Caption", session);
   dtc.set("key", "greeting");
   dtc.set("text", "Hello, world!");
   enumObj.add(dtc);

   event.println("enumObj.dumpHTML(): "+enumObj.dumpHTML());

 

Returns:
the index of the item added.

add

public int add(int index,
               Datatype dt)

add

public void add(java.util.Collection datatypeCollection)

addStrings

public void addStrings(java.util.Collection newStrings)
Example of how to call this in a beanshell ServerSideEvent:

   items = event.currentPage.get("com_dynamide_select1").getProperty("items");
   //   getValueObject will return EnumerateDatatype instance, of this class.
   enumObj = items.getValue();

   event.print("enumObj.dumpHTML(): "+enumObj.dumpHTML());

   Vector v = new Vector();
   v.addElement("aaa");
   v.addElement("bbb");
   v.addElement("ccc");

   enumObj.clear();
   enumObj.addStrings(v);

   event.println("enumObj.dumpHTML(): "+enumObj.dumpHTML());

 


addXMLContentTo

public void addXMLContentTo(org.jdom.Element container)
Specified by:
addXMLContentTo in class Datatype

clear

public void clear()

size

public int size()

createClone

public Datatype createClone()
Description copied from class: Datatype
subclasses can override and replace

Overrides:
createClone in class Datatype

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 Datatype

get

public java.lang.Object get(java.lang.String what)
override to handle setting single string values, by just setting a single item with that value

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

getCollection

public java.util.Collection getCollection()

getValue

public java.lang.Object getValue(int index)

getDefaultValue

public java.lang.Object getDefaultValue()

indexOf

public int indexOf(java.lang.Object o)

remove

public void remove(int index)

remove

public void remove(java.lang.String key)

set

public void set(java.lang.String what,
                java.lang.String value)
override to handle setting single string values, by just setting a single item with that value

Overrides:
set in class Datatype

toHTML

public java.lang.String toHTML()

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 Datatype

dump

public java.lang.String dump(boolean linebreaks)
Description copied from class: DynamideObject
Add linebreaks for viewing in a console; subclasses can override this with something more descriptive, for logging and debugging.

Overrides:
dump in class DynamideObject

toString

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

validate

public ValidationResult validate()
Overrides:
validate in class Datatype


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