com.dynamide
Class WidgetType

java.lang.Object
  extended by com.dynamide.DynamideObject
      extended by com.dynamide.resource.ContextNode
          extended by com.dynamide.JDOMFile
              extended by com.dynamide.Persistent
                  extended by com.dynamide.WidgetType
All Implemented Interfaces:
IPropertyProvider, IContext, IGet, org.xml.sax.EntityResolver

public class WidgetType
extends Persistent

Each widget type, represented by the WidgetType class, corresponds to an xml file, called something like com.dynamide.button (which may be physically stored as com.dynamide.button.xml), which defines the type. A page can have *instances* of Widgets, which use the class Widget. The legal properties of Widgets are found only in the WidgetType's xml file. The values in the WidgetType's xml file are the default values. All properties found in the Page's persistence override these defaults. There are no run-time-only properties -- all properties found are available at design-time. If a property is present, it will be shown in the PropertyPage. (NOTE: This may be changed in a future build to allow a property to have a subproperty of "hidden", in which case it will be hidden from the property editor.)

The widget's type is determined by its "type" property. This property is mutable in a widget instance, but has a subproperty of "readOnly", so that it can't be changed in the IDE. This solves lots of issues. To change the Widget's type, you must drop a new Widget on the Page. Right now the rule is that the filename is the type, and all widgets are stored in one of the template directories. The storage may change, but the "type" property will stay the same. For this reason, the "type" property doesn't include ".xml". For example, the "type" is "com.dynamide.button", NOT "com.dynamide.button.xml".

This class is also used for Page default properties. The only Widget-specific methods are: generateEmptyWidgetFor(String type, String id);


Nested Class Summary
 
Nested classes/interfaces inherited from class com.dynamide.Persistent
Persistent.Source
 
Field Summary
 
Fields inherited from class com.dynamide.Persistent
DEBUG_PAGE_SAVE, DEBUG_PROPS
 
Fields inherited from class com.dynamide.DynamideObject
m_id
 
Constructor Summary
WidgetType(DynamideObject owner, java.lang.String filename, Session session)
           
 
Method Summary
 java.lang.String findPropertyDefaultValue(java.lang.String name)
           
 ScriptEvent fire_onImport()
           
 ScriptEvent fire_onLoad(Widget widget)
          Fires an event named for the Widget type, but fires it once per loading of widget instance on a Page, so it is a Widget-author plugable event.
 ScriptEvent fire_onPropertyChanged(AbstractWidget widget, ChangeEvent changeEvent)
           
static org.jdom.Element generateEmptyWidgetFor(java.lang.String type, java.lang.String id)
          Produces something like this: <widget id='"+id+"' > <properties> <property name='type'>"+type+"</property> </properties> </widget>
 java.lang.String getDotName()
           
 Property getPropertyDefault(java.lang.String name)
           
 java.lang.String getPropertyDefaultValue(java.lang.String name)
           
 java.lang.String getType()
           
 void initializeForSession(Session session)
           
 
Methods inherited from class com.dynamide.Persistent
addProperties, addProperty, clonePropertiesTable, dumpHTML, dumpProperties, findEventElement, getEvents, getEventSignature, getEventSource, getEventSource, getEventSourceBody, getHtmlsrcElement, getHtmlsrcElement, getNamedObject, getProperties, getPropertiesElement, getPropertiesTable, getProperty, getPropertyNames, getPropertyStringValue, getPropertyValue, getRawHTMLSource, getRawHTMLSource, getSession, getSourceElement, getSourceElement, hasProperty, isPropertyTrue, isValueTrue, listEvents, listEventsHTML, listProperties, mergeProperties, mergeProperty, removeProperty, removeWidgetContents, removeWidgetContents, resetPropertiesTable, setEventSource, setHTMLSource, setHTMLSourceIE, setNamedObject, setProperty, setProperty, setProperty, setPropertyValue, setSession, sortPropertiesTable, toString
 
Methods inherited from class com.dynamide.JDOMFile
addError, clearErrors, commitInMemoryChangesToDOM, createJDomXMLOutputter, findFirstElement, findFirstElement, findFirstElementWithAttribute, getAttributeValue, getDocument, getErrors, getFilename, getFullXMLSource, getRootElement, hideEntities, isValidXHTML, isValidXHTMLFragment, listNamedElement, main, output, output, output, output, output, prepare, prettyPrintHTML, prettyPrintHTML, prettyPrintHTMLSafe, read, readFromString, reload, resolveEntity, safeGetElementChildText, saveToFile, saveToFile, select, select, select, selectFirst, selectFirst, setFilename, testPrettyPrint, unHideEntities, valueOf, valueOf
 
Methods inherited from class com.dynamide.resource.ContextNode
bind, bind, bindAll, bindAllAttributes, bindAttribute, dump, dumpAttributes, dumpContext, find, find, find, firstContext, get, getAttribute, getAttributeCount, getAttributes, getContext, getContextCount, getContexts, getKey, getPermission, hasAttribute, hasContext, listAttributeNames, listAttributeNames, listContextNames, listContextNames, lockPermissions, rebind, rebind, rebindAttribute, remove, removeAttribute, removeFirstContext, setKey, unlockPermissions, update, writeCache
 
Methods inherited from class com.dynamide.DynamideObject
clearProfiler, dump, expand, finalize, 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
clone, equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

WidgetType

public WidgetType(DynamideObject owner,
                  java.lang.String filename,
                  Session session)
           throws org.jdom.JDOMException,
                  java.io.IOException,
                  DatatypeException
Throws:
org.jdom.JDOMException
java.io.IOException
DatatypeException
Method Detail

initializeForSession

public void initializeForSession(Session session)

getType

public java.lang.String getType()

getDotName

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

getPropertyDefault

public Property getPropertyDefault(java.lang.String name)

getPropertyDefaultValue

public java.lang.String getPropertyDefaultValue(java.lang.String name)

findPropertyDefaultValue

public java.lang.String findPropertyDefaultValue(java.lang.String name)

fire_onLoad

public ScriptEvent fire_onLoad(Widget widget)
Fires an event named for the Widget type, but fires it once per loading of widget instance on a Page, so it is a Widget-author plugable event. It is called from the code that also fires [widgetID]_onLoad which is an application-programmer pluggable event.


fire_onImport

public ScriptEvent fire_onImport()

fire_onPropertyChanged

public ScriptEvent fire_onPropertyChanged(AbstractWidget widget,
                                          ChangeEvent changeEvent)

generateEmptyWidgetFor

public static org.jdom.Element generateEmptyWidgetFor(java.lang.String type,
                                                      java.lang.String id)
Produces something like this: <widget id='"+id+"' > <properties> <property name='type'>"+type+"</property> </properties> </widget>



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