com.dynamide
Class Persistent

java.lang.Object
  extended by com.dynamide.DynamideObject
      extended by com.dynamide.resource.ContextNode
          extended by com.dynamide.JDOMFile
              extended by com.dynamide.Persistent
All Implemented Interfaces:
IPropertyProvider, IContext, IGet, org.xml.sax.EntityResolver
Direct Known Subclasses:
AbstractWidget, Account, Application, Field, Session, WidgetType

public class Persistent
extends JDOMFile
implements IPropertyProvider


Nested Class Summary
 class Persistent.Source
           
 
Field Summary
protected static boolean DEBUG_PAGE_SAVE
           
protected static boolean DEBUG_PROPS
           
 
Fields inherited from class com.dynamide.DynamideObject
m_id
 
Constructor Summary
Persistent(DynamideObject owner, Session session)
           
Persistent(DynamideObject owner, java.lang.String filename, Session session)
           
 
Method Summary
static void addProperties(Persistent persistent, org.jdom.Element propertyContainerElement, java.lang.String ownerID)
          Static method can be recycled by any subclass.
 void addProperty(java.lang.String name, Property value)
           
 StringList clonePropertiesTable()
           
 java.lang.String dumpHTML()
          Subclasses can override this with something more descriptive, for logging and debugging.
 java.lang.String dumpProperties()
          Except that no-one uses it now...
 org.jdom.Element findEventElement(java.lang.String findName)
           
 java.util.Set getEvents()
           
 java.lang.String getEventSignature(java.lang.String findName)
           
 ScriptEventSource getEventSource(java.lang.String findName)
           
 ScriptEventSource getEventSource(java.lang.String findName, boolean addSignature)
           
 ScriptEventSource getEventSourceBody(java.lang.String findName)
           
 org.jdom.Element getHtmlsrcElement()
           
 org.jdom.Element getHtmlsrcElement(java.lang.String browserID)
           
 java.lang.Object getNamedObject(java.lang.String name)
          A place to store objects in memory that won't be persisted.
 java.util.Enumeration getProperties()
           
 org.jdom.Element getPropertiesElement()
           
 StringList getPropertiesTable()
           
 Property getProperty(java.lang.String propertyName)
          %% this is funky, since right now all are stored as String name and value. isEvent is just lost, for example.
 java.util.Enumeration getPropertyNames()
           
 java.lang.String getPropertyStringValue(java.lang.String name)
           
 java.lang.Object getPropertyValue(java.lang.String name)
           
 java.lang.String getRawHTMLSource()
           
 java.lang.String getRawHTMLSource(java.lang.String browserID)
          Return just the un-rendered xhtml source, un-processed by Webmacro.
 Session getSession()
           
 Persistent.Source getSourceElement()
           
 Persistent.Source getSourceElement(java.lang.String browserID)
          get whatever the first element inside the CDATA inside the htmlsrc element is.
 boolean hasProperty(java.lang.String propertyName)
           
 boolean isPropertyTrue(java.lang.String propertyName)
          Same as isValueTrue
 boolean isValueTrue(java.lang.String propertyName)
          Same as isPropertyTrue
 java.lang.String listEvents()
           
 java.lang.String listEventsHTML()
           
 java.lang.String listProperties()
           
static void mergeProperties(Persistent persistent, org.jdom.Element propertyContainerElement, java.lang.String ownerID)
           
protected  void mergeProperty(java.lang.String name, Property newProperty)
           
 void removeProperty(java.lang.String name)
           
 void removeWidgetContents(org.jdom.Element root)
           
 void removeWidgetContents(java.util.List list)
           
protected  void resetPropertiesTable(StringList newTable, java.lang.String reason, DynamideObject newOwner)
          Subclasses can get the props from somewhere and install them here.
 void setEventSource(java.lang.String eventName, java.lang.String source)
           
 java.lang.String setHTMLSource(java.lang.String xhtmlSource)
           
 java.lang.String setHTMLSourceIE(java.lang.String nonXhtmlSource)
          Use this to set the source using IE's invalid innerHTML and outterHTML.
 void setNamedObject(java.lang.String name, java.lang.Object value)
          A place to store objects in memory that won't be persisted.
 void setProperty(Property property)
           
 void setProperty(java.lang.String name, Property value)
           
 void setProperty(java.lang.String name, java.lang.String value)
           
 void setPropertyValue(java.lang.String name, java.lang.Object value)
           
 void setSession(Session new_value)
           
protected  void sortPropertiesTable()
           
 java.lang.String 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, 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
clone, equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

DEBUG_PROPS

protected static final boolean DEBUG_PROPS
See Also:
Constant Field Values

DEBUG_PAGE_SAVE

protected static final boolean DEBUG_PAGE_SAVE
See Also:
Constant Field Values
Constructor Detail

Persistent

public Persistent(DynamideObject owner,
                  Session session)

Persistent

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

getSession

public Session getSession()

setSession

public void setSession(Session new_value)

getPropertiesTable

public StringList getPropertiesTable()

resetPropertiesTable

protected void resetPropertiesTable(StringList newTable,
                                    java.lang.String reason,
                                    DynamideObject newOwner)
Subclasses can get the props from somewhere and install them here. Widget does this since the defaults come first from WidgetType.


sortPropertiesTable

protected void sortPropertiesTable()

isValueTrue

public boolean isValueTrue(java.lang.String propertyName)
                    throws java.lang.Exception
Same as isPropertyTrue

Throws:
java.lang.Exception

isPropertyTrue

public boolean isPropertyTrue(java.lang.String propertyName)
                       throws java.lang.Exception
Same as isValueTrue

Throws:
java.lang.Exception

hasProperty

public boolean hasProperty(java.lang.String propertyName)
Specified by:
hasProperty in interface IPropertyProvider

getProperties

public java.util.Enumeration getProperties()
Specified by:
getProperties in interface IPropertyProvider

getPropertyNames

public java.util.Enumeration getPropertyNames()
Specified by:
getPropertyNames in interface IPropertyProvider

getPropertiesElement

public org.jdom.Element getPropertiesElement()

getPropertyStringValue

public java.lang.String getPropertyStringValue(java.lang.String name)
Specified by:
getPropertyStringValue in interface IPropertyProvider

getPropertyValue

public java.lang.Object getPropertyValue(java.lang.String name)
Specified by:
getPropertyValue in interface IPropertyProvider

setPropertyValue

public void setPropertyValue(java.lang.String name,
                             java.lang.Object value)
                      throws DatatypeException
Throws:
DatatypeException

setProperty

public void setProperty(Property property)

setProperty

public void setProperty(java.lang.String name,
                        java.lang.String value)
                 throws DatatypeException
Specified by:
setProperty in interface IPropertyProvider
Throws:
DatatypeException

setProperty

public void setProperty(java.lang.String name,
                        Property value)
Specified by:
setProperty in interface IPropertyProvider

removeProperty

public void removeProperty(java.lang.String name)
Specified by:
removeProperty in interface IPropertyProvider

getProperty

public Property getProperty(java.lang.String propertyName)
%% this is funky, since right now all are stored as String name and value. isEvent is just lost, for example.

Specified by:
getProperty in interface IPropertyProvider

addProperty

public void addProperty(java.lang.String name,
                        Property value)
Specified by:
addProperty in interface IPropertyProvider

addProperties

public static void addProperties(Persistent persistent,
                                 org.jdom.Element propertyContainerElement,
                                 java.lang.String ownerID)
                          throws DatatypeException
Static method can be recycled by any subclass. Override addProperty for more control.

Throws:
DatatypeException

mergeProperty

protected void mergeProperty(java.lang.String name,
                             Property newProperty)

mergeProperties

public static void mergeProperties(Persistent persistent,
                                   org.jdom.Element propertyContainerElement,
                                   java.lang.String ownerID)
                            throws DatatypeException
Throws:
DatatypeException

dumpProperties

public java.lang.String dumpProperties()
Except that no-one uses it now... public static String findProperty(Element element, String propertyName){ List properties = element.getChildren("property"); Iterator i = properties.iterator(); while (i.hasNext()) { Element propertyElement = (Element) i.next(); if ( propertyElement.getAttributeValue("name").equals(propertyName) ) { Element valueElement = propertyElement.getChild("value"); if ( valueElement != null ) { return valueElement.getTextTrim(); } valueElement = propertyElement.getChild("defaultValue"); if ( valueElement != null ) { return valueElement.getTextTrim(); } } } return ""; }


listProperties

public java.lang.String listProperties()

clonePropertiesTable

public StringList clonePropertiesTable()

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

toString

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

getNamedObject

public java.lang.Object getNamedObject(java.lang.String name)
A place to store objects in memory that won't be persisted. See setNamedObject.


setNamedObject

public void setNamedObject(java.lang.String name,
                           java.lang.Object value)
A place to store objects in memory that won't be persisted. Useful when building applications since you don't have to create a Field just to hold an object like a list between a ServerSide event and the Widget rendering code, for example.


getEventSourceBody

public ScriptEventSource getEventSourceBody(java.lang.String findName)

getEventSignature

public java.lang.String getEventSignature(java.lang.String findName)

getEventSource

public ScriptEventSource getEventSource(java.lang.String findName)

getEventSource

public ScriptEventSource getEventSource(java.lang.String findName,
                                        boolean addSignature)

findEventElement

public org.jdom.Element findEventElement(java.lang.String findName)

listEvents

public java.lang.String listEvents()

listEventsHTML

public java.lang.String listEventsHTML()

getEvents

public java.util.Set getEvents()

setEventSource

public void setEventSource(java.lang.String eventName,
                           java.lang.String source)

getSourceElement

public Persistent.Source getSourceElement()
                                   throws XMLFormatException
Throws:
XMLFormatException

getSourceElement

public Persistent.Source getSourceElement(java.lang.String browserID)
                                   throws XMLFormatException
get whatever the first element inside the CDATA inside the htmlsrc element is. For containers, this may be HTML, or it may be SPAN or DIV or something else for Widgets.

Throws:
XMLFormatException

getHtmlsrcElement

public org.jdom.Element getHtmlsrcElement()
To do:
make it use the request browser ID. %%

getHtmlsrcElement

public org.jdom.Element getHtmlsrcElement(java.lang.String browserID)

getRawHTMLSource

public java.lang.String getRawHTMLSource()

getRawHTMLSource

public java.lang.String getRawHTMLSource(java.lang.String browserID)
Return just the un-rendered xhtml source, un-processed by Webmacro. This is used by the IDE. Doesn't work for Widget since Widget isn't file based, so getRootElement fails. WidgetType, Widget call this method rather than getHTMLSource, since there is no HTML element in a widget type source.


setHTMLSourceIE

public java.lang.String setHTMLSourceIE(java.lang.String nonXhtmlSource)
                                 throws XMLFormatException
Use this to set the source using IE's invalid innerHTML and outterHTML. This calls com.dynamide.util.IETidy to tidy the source and turn it into XHTML, and then calls the normal setHTMLSource(String).

Throws:
XMLFormatException
See Also:
setHTMLSource(java.lang.String)

setHTMLSource

public java.lang.String setHTMLSource(java.lang.String xhtmlSource)
                               throws XMLFormatException
Throws:
XMLFormatException

removeWidgetContents

public void removeWidgetContents(org.jdom.Element root)

removeWidgetContents

public void removeWidgetContents(java.util.List list)


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