com.dynamide
Class Page

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.AbstractWidget
                      extended by com.dynamide.Widget
                          extended by com.dynamide.Page
All Implemented Interfaces:
IChangeListener, IPropertyProvider, IContext, IGet, org.xml.sax.EntityResolver

public class Page
extends Widget
implements IChangeListener

See how the WidgetType class is used for Page default properties, and look at the class javadoc for Widget. This class descends from AbstractWidget, as does com.dynamide.Widget. AbstractWidget abstracts the code for dealing with the WidgetType.


Nested Class Summary
 
Nested classes/interfaces inherited from class com.dynamide.Persistent
Persistent.Source
 
Field Summary
static boolean DEFAULT_WANT_WIDGET_SPAN
           
 
Fields inherited from class com.dynamide.AbstractWidget
debugFrom, m_type, m_widgetType
 
Fields inherited from class com.dynamide.Persistent
DEBUG_PAGE_SAVE, DEBUG_PROPS
 
Fields inherited from class com.dynamide.DynamideObject
m_id
 
Method Summary
 void addPageChangeListener(IPageChangeListener new_listener)
           
 void addWidget(Widget wd)
           
 java.lang.Object call(java.lang.String eventShortName)
           
 java.lang.Object call(java.lang.String eventShortName, java.lang.Object inputObject)
           
protected  boolean checkOnOutput(HandlerResult handlerResult)
           
 void cleanup()
           
 void clearErrors()
          calls Page.clearError() to clear the page error, and calls Field.clearError for all Widgets on this page.
 void clearFieldErrors()
           
 void commitInMemoryChangesToDOM()
          override of JDOMFile.commitInMemoryChangesToDOM().
 Widget createWidget(java.lang.String widgetType)
           
 Widget createWidget(java.lang.String widgetType, java.lang.String id, boolean callWidget_fire_OnLoad)
           
 Widget createWidgetFromElement(org.jdom.Element element, boolean generateID, boolean addWidget)
          Create a widget, and add to the widgets hashtable.
 Widget createWidgetSafe(java.lang.String widgetType)
           
 java.lang.String eventShortNameToFullName(java.lang.String eventShortName)
          There's also a version of this in Page, but not polymorphic.
 org.jdom.Element expandPageMacros(org.jdom.Element html, StringList variables, boolean hideEntities, java.lang.String logname)
           
 java.lang.String expandTemplate(java.lang.String text)
           
 java.lang.String expandTemplate(java.lang.String text, StringList variables)
           
 java.lang.String expandTemplate(java.lang.String text, StringList variables, java.lang.String dotname)
           
static java.lang.String finalExpansions(boolean unhideEntities, java.lang.String res)
           
 void finalize()
           
 java.lang.Object find(java.lang.String what)
          Search using "/" as the separator, by simply calling find(path, "/").
 java.util.Map findWidgetsInHTMLSource(java.lang.String browserStringID)
           
 ScriptEvent fire_afterOutput()
           
 ScriptEvent fire_beforeOutput()
          This event is fired just before expanding page and widget properties and returning the page to the browser.
 ScriptEvent fire_onAction(java.lang.String action)
           
 void fire_onImport()
           
 ScriptEvent fire_onLeave()
          This event is fired when a new page request has come in, and there was no action for this page, which can happen if you have a form with an action that also has hyperlinks or the user uses the 'back' button, skipping your form action.
 ScriptEvent fire_onLoad()
           
 ScriptEvent fire_onOutput()
           
protected  void fireAllWidgetsLoaded()
           
 ScriptEvent fireEvent(java.lang.Object inputObject, java.lang.String eventShortName)
           
 ScriptEvent fireEvent(java.lang.String eventShortName)
          this version is so that widget authors and bean authors can fire their own custom events. %% TODO: how to let them populate the Event object...
 ScriptEvent fireRegisteredAction(java.lang.String action)
           
 java.lang.Object get(java.lang.String what)
          Handles get("name") and get("field") specially, otherwise performs a lookup in the persisted and runtime properties, then from the WidgetType type definition as specified by the widget xml file.
 java.lang.String getEventPrefixName()
           
 ScriptEventSource getEventSource(java.lang.String eventName, boolean addSignature)
           
 HandlerResult getHandlerResult()
           
 java.lang.String getName()
           
 java.util.Enumeration getPageProperties()
           
 java.lang.String getPagePropertyEval(java.lang.String propertyName, java.lang.String propertyValue, javax.servlet.http.HttpServletRequest request)
           
 RegisteredActions getRegisteredActions()
           
 boolean getWantWidgetSpan()
           
 Widget getWidget(java.lang.String id)
           
 Widget getWidgetByID(java.lang.String id)
           
 java.lang.String getWidgetDiv(java.lang.String widgetID, javax.servlet.http.HttpServletRequest request)
           
 StringList getWidgetList()
          This one is by id, whereas getWidgetNamesList is by name
 StringList getWidgetNamesList()
           
 java.util.Enumeration getWidgets()
          for webmacro access.
 java.util.List getWidgetsByInterface(java.lang.String interfaceName)
           
 ScriptEvent handleAction(java.lang.String action)
           
 boolean hasFieldErrors()
           
 java.lang.String link(java.lang.String moreParams, java.lang.String linkText)
           
 java.lang.String listWidgets()
           
protected  void loadAllWidgets()
           
protected  void loadAllWidgets(boolean call_fireAllWidgetsLoaded)
           
protected  void notifyPageChangeListeners(java.lang.String fieldName, java.lang.Object oldValue, java.lang.Object newValue)
           
protected  void notifyPageNameChangeListeners(java.lang.Object oldValue, java.lang.Object newValue)
           
 java.lang.String outputContainer(StringList variables)
           
 HandlerResult outputPage()
          Outputs the page, but wrapped in a HandlerResult, which tells the caller the mime type, expiration time, redirect, and whether prettyPrint is appropriate.
 java.lang.String outputPage(boolean innerBodyOnly, boolean wantWidgetSpan)
           
 HandlerResult outputPage(HandlerResult handlerResult)
           
 java.lang.String outputPage(StringList variables)
          Output the page rendered with the widget tag.
 java.lang.String outputPage(StringList variables, boolean innerBodyOnly, boolean wantWidgetSpan)
           
 java.lang.String outputPageResult()
          Calls outputPage() and returns the HandlerResult.getResult(), pretty printed if the page determined that it could be pretty printed (errors and such are usually not pretty printed) so that the result of this method is a string representing the exact same page that the DynamideHandler would spit out for the DynamideServlet.
 java.lang.String outputWidget(java.lang.String widgetID)
          If the widget is already in the DOM, either because it was in the xml file when the form file was loaded, or because it was inserted there when the client-side designed page was saved, then this function is pertinent.
 java.lang.String outputWidget(java.lang.String widgetID, javax.servlet.http.HttpServletRequest request)
           
 void printSerializedWidget(org.jdom.Element element, java.io.Writer out, int indentLevel)
           
 void propertyChanged(ChangeEvent changeEvent)
           
 void registerAction(java.lang.String action, DynamideObject sender, java.lang.String eventName, java.lang.Object inputObject)
           
 void removePageChangeListener(IPageChangeListener listener)
           
 void removeUnusedWidgets()
           
 void removeWidgetsNotInList(java.util.Map widgetsInHtmlsrc)
           
 void renameWidget(Widget wd, java.lang.String oldName, java.lang.String newName)
           
 void setHandlerResult(HandlerResult new_value)
           
 void setName(java.lang.String new_value)
           
 void setWantWidgetSpan(boolean new_value)
          For most cases you could call this to eliminate the SPAN tag that surrounds all widget output; but for the IDE, this must be left using the default value; You can turn it to WantWidgetSpan == false if you will be rendering the page multiple times, for example if you are calling Page.outputPage() inside another page.
 java.lang.String toString()
           
 void unregisterAction(java.lang.String action)
           
 
Methods inherited from class com.dynamide.Widget
fireEvent, getDesignMode, getPage, initFromElement, printSerialized, printSerialized, render, render, setDesignMode, setID, setPage, toElement
 
Methods inherited from class com.dynamide.AbstractWidget
addChangeListener, changeProperty, changePropertyOLDDDDDDD, clearCachedDotName, clearError, clearErrorMessage, close, formatFullFieldName, formatFullFieldName, get, getDatasource, getDotName, getError, getErrorMessage, getErrorMessageHTML, getEventByOrdinal, getEventCount, getEventNameByOrdinal, getField, getField, getFieldID, getFieldID, getFieldStringValue, getObject, getPropertyByOrdinal, getPropertyCount, getPropertyDefault, getPropertyDefaultValue, getPropertyNameByOrdinal, getTableModel, getType, getValue, getWidgetType, logFromInfo, notifyChangeListeners, removeChangeListener, setError, setErrorMessage, setObject, setPropertiesFromURL, setProperty, setTableModel, setType, setValue, widgetTypeToScriptName
 
Methods inherited from class com.dynamide.Persistent
addProperties, addProperty, clonePropertiesTable, dumpHTML, dumpProperties, findEventElement, getEvents, getEventSignature, 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, setPropertyValue, setSession, sortPropertiesTable
 
Methods inherited from class com.dynamide.JDOMFile
addError, 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, firstContext, 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, 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, setNextGetter, setObjectID, setOwner, sprintf, useProfiler, walkParents
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

DEFAULT_WANT_WIDGET_SPAN

public static final boolean DEFAULT_WANT_WIDGET_SPAN
See Also:
Constant Field Values
Method Detail

finalize

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

cleanup

public void cleanup()
Overrides:
cleanup in class Widget

getWantWidgetSpan

public boolean getWantWidgetSpan()

setWantWidgetSpan

public void setWantWidgetSpan(boolean new_value)
For most cases you could call this to eliminate the SPAN tag that surrounds all widget output; but for the IDE, this must be left using the default value; You can turn it to WantWidgetSpan == false if you will be rendering the page multiple times, for example if you are calling Page.outputPage() inside another page. However, this is done automatically if you call Page.outputContainer() or Page.outputPage(false, true).


toString

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

getName

public java.lang.String getName()
Overrides:
getName in class Widget

setName

public void setName(java.lang.String new_value)
             throws DatatypeException
Overrides:
setName in class Widget
Throws:
DatatypeException

getHandlerResult

public HandlerResult getHandlerResult()

setHandlerResult

public void setHandlerResult(HandlerResult new_value)

getWidgets

public java.util.Enumeration getWidgets()
for webmacro access.


getWidgetsByInterface

public java.util.List getWidgetsByInterface(java.lang.String interfaceName)

listWidgets

public java.lang.String listWidgets()
                             throws java.lang.Exception
Throws:
java.lang.Exception

getPageProperties

public java.util.Enumeration getPageProperties()

get

public java.lang.Object get(java.lang.String what)
                     throws java.lang.Exception
Description copied from class: AbstractWidget

Handles get("name") and get("field") specially, otherwise performs a lookup in the persisted and runtime properties, then from the WidgetType type definition as specified by the widget xml file.

get("field") autocreates fields based on parent name and current object name when NOT in designMode. So, at runtime, if you didn't set field, it will be created for you so that widgets persist their values between screens even if you don't feel like adding a field to the fielddefs. This only happens at non designTime, so the autocreated fields do not get persisted to the pagefile or get seen in the property inspector. In the property inspector, you will just see "{autocreate}".

IMPORTANT: No checking is done to see if the field is missing. If you set the field to a value, then delete the field, the widet will not have a field.

Specified by:
get in interface IGet
Overrides:
get in class AbstractWidget
Throws:
java.lang.Exception

find

public java.lang.Object find(java.lang.String what)
Description copied from class: ContextNode
Search using "/" as the separator, by simply calling find(path, "/").

Specified by:
find in interface IContext
Overrides:
find in class ContextNode

commitInMemoryChangesToDOM

public void commitInMemoryChangesToDOM()
                                throws java.lang.Exception
override of JDOMFile.commitInMemoryChangesToDOM().

Overrides:
commitInMemoryChangesToDOM in class JDOMFile
Throws:
java.lang.Exception

outputContainer

public java.lang.String outputContainer(StringList variables)
                                 throws DynamideUncaughtException
Throws:
DynamideUncaughtException

outputPageResult

public java.lang.String outputPageResult()
                                  throws DynamideException
Calls outputPage() and returns the HandlerResult.getResult(), pretty printed if the page determined that it could be pretty printed (errors and such are usually not pretty printed) so that the result of this method is a string representing the exact same page that the DynamideHandler would spit out for the DynamideServlet. This makes this method the preferred call when doing batch processing or publishing. If you need the mime type, redirection, or the expires, etc., use outputPage().

Throws:
DynamideException

outputPage

public HandlerResult outputPage()
                         throws DynamideUncaughtException
Outputs the page, but wrapped in a HandlerResult, which tells the caller the mime type, expiration time, redirect, and whether prettyPrint is appropriate.

Throws:
DynamideUncaughtException
See Also:
outputPageResult()

outputPage

public HandlerResult outputPage(HandlerResult handlerResult)
                         throws DynamideUncaughtException
Throws:
DynamideUncaughtException

checkOnOutput

protected boolean checkOnOutput(HandlerResult handlerResult)
Returns:
true if event has created source to return with ScriptEvent.RA_RETURN_SOURCE

outputPage

public java.lang.String outputPage(StringList variables)
                            throws DynamideUncaughtException
Output the page rendered with the widget tag. All widget tags expand into full html widget text when called this way. (This is not the WidgetView factory -- that kind of rendering in the Swing GUI is totally different.)

Parameters:
variables - is a set of name-value pairs that will be put into the webmacro context.
Throws:
DynamideUncaughtException

outputPage

public java.lang.String outputPage(boolean innerBodyOnly,
                                   boolean wantWidgetSpan)
                            throws DynamideUncaughtException
Throws:
DynamideUncaughtException

outputPage

public java.lang.String outputPage(StringList variables,
                                   boolean innerBodyOnly,
                                   boolean wantWidgetSpan)
                            throws DynamideUncaughtException
Throws:
DynamideUncaughtException

finalExpansions

public static java.lang.String finalExpansions(boolean unhideEntities,
                                               java.lang.String res)

expandTemplate

public java.lang.String expandTemplate(java.lang.String text)
                                throws DynamideUncaughtException
Throws:
DynamideUncaughtException

expandTemplate

public java.lang.String expandTemplate(java.lang.String text,
                                       StringList variables)
                                throws DynamideUncaughtException
Throws:
DynamideUncaughtException

expandTemplate

public java.lang.String expandTemplate(java.lang.String text,
                                       StringList variables,
                                       java.lang.String dotname)
                                throws DynamideUncaughtException
Throws:
DynamideUncaughtException

expandPageMacros

public org.jdom.Element expandPageMacros(org.jdom.Element html,
                                         StringList variables,
                                         boolean hideEntities,
                                         java.lang.String logname)
                                  throws java.lang.Exception
Throws:
java.lang.Exception

outputWidget

public java.lang.String outputWidget(java.lang.String widgetID)
                              throws java.lang.Throwable
If the widget is already in the DOM, either because it was in the xml file when the form file was loaded, or because it was inserted there when the client-side designed page was saved, then this function is pertinent. Otherwise, Session.renderWidget should be called.

Throws:
java.lang.Throwable

outputWidget

public java.lang.String outputWidget(java.lang.String widgetID,
                                     javax.servlet.http.HttpServletRequest request)
                              throws java.lang.Throwable
Throws:
java.lang.Throwable

findWidgetsInHTMLSource

public java.util.Map findWidgetsInHTMLSource(java.lang.String browserStringID)

removeUnusedWidgets

public void removeUnusedWidgets()

removeWidgetsNotInList

public void removeWidgetsNotInList(java.util.Map widgetsInHtmlsrc)

propertyChanged

public void propertyChanged(ChangeEvent changeEvent)
Specified by:
propertyChanged in interface IChangeListener
Overrides:
propertyChanged in class AbstractWidget

getWidgetList

public StringList getWidgetList()
This one is by id, whereas getWidgetNamesList is by name


getWidgetNamesList

public StringList getWidgetNamesList()

loadAllWidgets

protected void loadAllWidgets()
                       throws DynamideUncaughtException
Throws:
DynamideUncaughtException

loadAllWidgets

protected void loadAllWidgets(boolean call_fireAllWidgetsLoaded)
                       throws DynamideUncaughtException
Throws:
DynamideUncaughtException

fireAllWidgetsLoaded

protected void fireAllWidgetsLoaded()

addWidget

public void addWidget(Widget wd)

renameWidget

public void renameWidget(Widget wd,
                         java.lang.String oldName,
                         java.lang.String newName)

createWidget

public Widget createWidget(java.lang.String widgetType)
                    throws java.lang.Exception
Throws:
java.lang.Exception

createWidget

public Widget createWidget(java.lang.String widgetType,
                           java.lang.String id,
                           boolean callWidget_fire_OnLoad)
                    throws java.lang.Exception
Throws:
java.lang.Exception

createWidgetSafe

public Widget createWidgetSafe(java.lang.String widgetType)
Returns:
null if error or not found.

createWidgetFromElement

public Widget createWidgetFromElement(org.jdom.Element element,
                                      boolean generateID,
                                      boolean addWidget)
Create a widget, and add to the widgets hashtable.


printSerializedWidget

public void printSerializedWidget(org.jdom.Element element,
                                  java.io.Writer out,
                                  int indentLevel)
                           throws java.lang.Exception
Throws:
java.lang.Exception

getWidget

public Widget getWidget(java.lang.String id)

getWidgetByID

public Widget getWidgetByID(java.lang.String id)

getWidgetDiv

public java.lang.String getWidgetDiv(java.lang.String widgetID,
                                     javax.servlet.http.HttpServletRequest request)
                              throws java.lang.Throwable
Throws:
java.lang.Throwable

getPagePropertyEval

public java.lang.String getPagePropertyEval(java.lang.String propertyName,
                                            java.lang.String propertyValue,
                                            javax.servlet.http.HttpServletRequest request)
                                     throws DynamideUncaughtException
Throws:
DynamideUncaughtException

link

public java.lang.String link(java.lang.String moreParams,
                             java.lang.String linkText)

addPageChangeListener

public void addPageChangeListener(IPageChangeListener new_listener)

removePageChangeListener

public void removePageChangeListener(IPageChangeListener listener)

notifyPageChangeListeners

protected void notifyPageChangeListeners(java.lang.String fieldName,
                                         java.lang.Object oldValue,
                                         java.lang.Object newValue)

notifyPageNameChangeListeners

protected void notifyPageNameChangeListeners(java.lang.Object oldValue,
                                             java.lang.Object newValue)

getRegisteredActions

public RegisteredActions getRegisteredActions()

fireRegisteredAction

public ScriptEvent fireRegisteredAction(java.lang.String action)

registerAction

public void registerAction(java.lang.String action,
                           DynamideObject sender,
                           java.lang.String eventName,
                           java.lang.Object inputObject)

unregisterAction

public void unregisterAction(java.lang.String action)

handleAction

public ScriptEvent handleAction(java.lang.String action)

getEventPrefixName

public java.lang.String getEventPrefixName()
Overrides:
getEventPrefixName in class Widget

eventShortNameToFullName

public java.lang.String eventShortNameToFullName(java.lang.String eventShortName)
Description copied from class: Widget
There's also a version of this in Page, but not polymorphic.

Overrides:
eventShortNameToFullName in class Widget

call

public java.lang.Object call(java.lang.String eventShortName)
Overrides:
call in class Widget

call

public java.lang.Object call(java.lang.String eventShortName,
                             java.lang.Object inputObject)
Overrides:
call in class Widget

getEventSource

public ScriptEventSource getEventSource(java.lang.String eventName,
                                        boolean addSignature)
Overrides:
getEventSource in class Persistent

fireEvent

public ScriptEvent fireEvent(java.lang.String eventShortName)
this version is so that widget authors and bean authors can fire their own custom events. %% TODO: how to let them populate the Event object...


fireEvent

public ScriptEvent fireEvent(java.lang.Object inputObject,
                             java.lang.String eventShortName)
Overrides:
fireEvent in class Widget

fire_onImport

public void fire_onImport()

fire_onAction

public ScriptEvent fire_onAction(java.lang.String action)

fire_onLoad

public ScriptEvent fire_onLoad()
Overrides:
fire_onLoad in class Widget

fire_beforeOutput

public ScriptEvent fire_beforeOutput()
This event is fired just before expanding page and widget properties and returning the page to the browser. Nothing is done with the return values from the event: it is strictly informational. However, you can set any errors, field values, etc.

Overrides:
fire_beforeOutput in class Widget

fire_onOutput

public ScriptEvent fire_onOutput()

fire_afterOutput

public ScriptEvent fire_afterOutput()

fire_onLeave

public ScriptEvent fire_onLeave()
This event is fired when a new page request has come in, and there was no action for this page, which can happen if you have a form with an action that also has hyperlinks or the user uses the 'back' button, skipping your form action. If this page is a dialog and must set some result when the user is done seeing the dialog, this is the place to trap that event if they did not click on the button that fires the expected action. Nothing is done with the return values from the event: it is strictly informational. However, you can set any errors, field values, etc. And you can perform necessary cleanup that would have been performed in onAction.


hasFieldErrors

public boolean hasFieldErrors()
Returns:
true if any errors.

clearErrors

public void clearErrors()
calls Page.clearError() to clear the page error, and calls Field.clearError for all Widgets on this page.

Overrides:
clearErrors in class JDOMFile

clearFieldErrors

public void clearFieldErrors()


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