Project Wonder 2.0

er.directtoweb
Class ERD2WPage

java.lang.Object
  extended bycom.webobjects.appserver.WOElement
      extended bycom.webobjects.appserver.WOComponent
          extended bycom.webobjects.directtoweb.D2WComponent
              extended bycom.webobjects.directtoweb.D2WPage
                  extended byer.directtoweb.ERD2WPage
All Implemented Interfaces:
Cloneable, DTWGeneration, ERDBranchInterface, ERDUserInfoInterface, ERXComponentActionRedirector.Restorable, ERXExceptionHolder, NSKeyValueCoding, NSKeyValueCoding.ErrorHandling, NSKeyValueCodingAdditions, NSValidation, Serializable, WOActionResults
Direct Known Subclasses:
ERD2WEditSortedManyToManyPage, ERD2WInspectPage, ERD2WListPage, ERD2WMessagePage, ERD2WQueryEntitiesPage, ERD2WQueryPage

public abstract class ERD2WPage
extends D2WPage
implements ERXExceptionHolder, ERDUserInfoInterface, ERXComponentActionRedirector.Restorable, ERDBranchInterface

Common superclass for all ERD2W templates (except ERD2WEditRelationshipPage). Has tons of extra functionality:

  • Debugging support.
    Special handlers add extra info in the request-response loop
  • Workflow extensions.
    If your NextPageDelegate is a ERDBranchDelegate, then all of the code for actions can be handled in your delegate.
  • Display key extensions. We support tab and sectioned pages via the d2wContext array.
    In the case of a non-tab page, we expect d2wContext.sectionsContents to return one of the three following formats: (( section1, key1, key2, key4 ), ( section2, key76, key 5, ..) .. ) OR with the sections enclosed in "()" - this is most useful with the WebAssistant ( "(section1)", key1, key2, key3, "(section2)", key3, key4, key5... ) OR with normal displayPropertyKeys array in fact if sectionContents isn't found then it will look for displayPropertyKeys ( key1, key2, key3, ... ) In the case of a TAB page, we expect d2wContext.tabSectionsContents to return one of the two following formats: ( ( tab1, key1, key2, key4 ), ( tab2, key76, key 5, ..) .. ) OR with sections ( ( tab1, ( section1, key1, key2 ..), (section3, key4, key..) ), ... ) OR with the alternate syntax, which ist most useful with the WebAssistant ( "[tab1]", "(section1)", key1, key2, ... "[tab2]", "(section3)", key4, key..... )

    See Also:
    Serialized Form

    Nested Class Summary
    static interface ERD2WPage.Keys
              interface for all the keys used in this pages code
     
    Nested classes inherited from class com.webobjects.appserver.WOComponent
    WOComponent._EventLoggingEnabler, WOComponent.Event
     
    Nested classes inherited from class com.webobjects.foundation.NSKeyValueCoding
    NSKeyValueCoding._BooleanFieldBinding, NSKeyValueCoding._BooleanMethodBinding, NSKeyValueCoding._FieldBinding, NSKeyValueCoding._ForwardingBinding, NSKeyValueCoding._KeyBinding, NSKeyValueCoding._KeyBindingCreation, NSKeyValueCoding._MethodBinding, NSKeyValueCoding._NumberFieldBinding, NSKeyValueCoding._NumberMethodBinding, NSKeyValueCoding._ReflectionKeyBindingCreation, NSKeyValueCoding.DefaultImplementation, NSKeyValueCoding.ErrorHandling, NSKeyValueCoding.Null, NSKeyValueCoding.UnknownKeyException, NSKeyValueCoding.Utility, NSKeyValueCoding.ValueAccessor
     
    Nested classes inherited from class com.webobjects.foundation.NSKeyValueCodingAdditions
    NSKeyValueCodingAdditions.DefaultImplementation, NSKeyValueCodingAdditions.Utility
     
    Nested classes inherited from class com.webobjects.foundation.NSValidation
    NSValidation._MethodBinding, NSValidation._ValidationBinding, NSValidation.DefaultImplementation, NSValidation.Utility, NSValidation.ValidationException
     
    Field Summary
    protected static NSMutableSet _allConfigurations
               
    protected  NSDictionary _branch
              holds the chosen branch
    protected  EOEditingContext _context
              EOEditingContext for the current object
    protected  WOComponent _nextPage
               
    protected  NextPageDelegate _nextPageDelegate
               
    protected  NSMutableDictionary _userInfo
              Holds the user info.
    protected  NSMutableArray errorKeyOrder
               
    protected  String errorMessage
               
    protected  NSMutableDictionary errorMessages
               
    protected  NSMutableArray keyPathsWithValidationExceptions
               
    static ERXLogger log
              logging support
    static ERXLogger validationLog
               
     
    Fields inherited from class com.webobjects.directtoweb.D2WComponent
    _eo, _localContext, currentObjectKey
     
    Fields inherited from class com.webobjects.appserver.WOComponent
    _Extension, _IsEventLoggingEnabled, _keyAssociations
     
    Fields inherited from interface com.webobjects.foundation.NSKeyValueCoding
    _CLASS, NullValue
     
    Fields inherited from interface com.webobjects.foundation.NSKeyValueCoding.ErrorHandling
    _CLASS
     
    Fields inherited from interface com.webobjects.foundation.NSKeyValueCodingAdditions
    _CLASS, _KeyPathSeparatorChar, KeyPathSeparator
     
    Fields inherited from interface com.webobjects.foundation.NSValidation
    _CLASS
     
    Constructor Summary
    ERD2WPage(WOContext c)
              Default public constructor.
     
    Method Summary
    static NSSet allConfigurationNames()
               
     void appendToResponse(WOResponse r, WOContext c)
              Overridden from the parent for better logging.
     void awake()
              Overridden to lock the page's editingContext, if there is any present.
     NSDictionary branch()
              Cover method for getting the choosen branch.
     NSArray branchChoices()
              Calculates the branch choices for the current page.
     String branchName()
              Implementation of the ERDBranchDelegate.
     void clearValidationFailed()
              Clears all of the collected validation exceptions.
     ERD2WContainer currentSection()
              The current section of display keys.
     NSArray currentSectionKeys()
              The display keys for the current section.
     ERD2WContainer currentTab()
              Returns the ERD2WContainer defining the current tab.
     boolean d2wComponentNameDebuggingEnabled()
              Checks is component names should be shown.
     D2WContext d2wContext()
              D2WContext for this page.
     String d2wCurrentComponentName()
              Helper to return the actual current component name, even when wrapped in a custom component.
     String descriptionForResponse(WOResponse aResponse, WOContext aContext)
              This will allow d2w pages to be listed on a per configuration basis in stats collecting.
     EOEditingContext editingContext()
               
     String errorMessage()
               
     NSMutableDictionary errorMessages()
               
     boolean hasBranchChoices()
              Determines if this message page should display branch choices.
     boolean hasValidationExceptionForPropertyKey()
              Checks if there is a validation exception in the D2WContext for the current property key.
     WOActionResults invokeAction(WORequest r, WOContext c)
              Overridden from the parent for better logging.
     boolean isEmbedded()
               
     boolean isObjectDeleteable()
              Checks if the current object can be deleted.
     boolean isObjectEditable()
              Checks if the current object can be edited.
     boolean isObjectInspectable()
              Checks if the current object can be viewed.
     WOComponent nextPage()
               
     NextPageDelegate nextPageDelegate()
               
     NSTimestamp now()
               
     NSArray sectionsContents()
              The array of sections.
     NSArray sectionsForCurrentTab()
              Returns the sections on the current tab.
     WOComponent self()
              Can be used to get this instance into KVC
     void setBranch(NSDictionary branch)
              Sets the user choosen branch.
     void setCurrentSection(ERD2WContainer value)
              Sets the current section of display keys.
     void setCurrentTab(ERD2WContainer value)
              Sets the current tab.
     void setD2wContext(D2WContext newValue)
              Key-Value-Coding needs this method.
     void setDataSource(EODataSource eodatasource)
               
     void setEditingContext(EOEditingContext newEditingContext)
              Sets the page's editingContext, automatically locking/unlocking it.
     void setErrorMessage(String message)
               
     void setErrorMessages(NSMutableDictionary value)
               
     void setLocalContext(D2WContext newValue)
              Sets the d2wContext for this page
     void setNextPage(WOComponent wocomponent)
               
     void setNextPageDelegate(NextPageDelegate nextpagedelegate)
               
     void setObject(EOEnterpriseObject eo)
              Implementation of the InspectPageInterface
     boolean shouldCollectValidationExceptions()
              Should exceptions also be handled here or only handled by the parent.
     boolean shouldPropagateExceptions()
              Should exceptions be propagated through to the parent page.
     boolean shouldSetFailedValidationValue()
              Should incorrect values still be set into the EO.
     boolean showCancel()
               
     void sleep()
              Overridden to unlock the page's editingContext, if there is any present.
     NSArray tabSectionsContents()
              Returns the array of ERD2WContainer defining the tabs.
    protected static NSArray tabSectionsContentsFromRuleResult(NSArray tabSectionContentsFromRule)
              Helper method to calulate the tab key array
     void takeValuesFromRequest(WORequest r, WOContext c)
              Overridden from the parent for better logging.
     String urlForCurrentState()
              Implementation of the ERXComponentActionRedirector$Restorable interface.
     NSMutableDictionary userInfo()
              Implementation of the ERDUserInfoInterface
     void validationFailedWithException(Throwable e, Object value, String keyPath)
              Handles validation errors.
     
    Methods inherited from class com.webobjects.directtoweb.D2WPage
    alternateRowColor, dataSource, extraBindings, finalize, pageWrapperName, replacementAssociationForAssociation, setExtraBindings
     
    Methods inherited from class com.webobjects.directtoweb.D2WComponent
    allEntities, allowCollapsing, applicationPort, assistantPort, attribute, backgroundColorForHeaderRow, backgroundColorForPage, backgroundColorForTable, backgroundColorForTableDark, backgroundColorForTableLight, color, currentSettings, currentUrl, d2wContextVisibleEntityNamesCountPlus1, defaultRowspan, displayNameForKeyWhenRelationship, displayNameForProperty, displayPropertyKeys, dynamicPages, entity, entityName, formatter, generationReplacementFor, generationReplacementForCurrentObject, hasCustomKey, hasEntity, hasNoColor, homeClicked, homeHref, isEditing, isEntityReadOnly, isEntityReadOnly, isLiveAssistantEnabled, isNotBoldAsBoolean, isNotItalicAsBoolean, isPropertyAnAttribute, isWebAssistantActive, isWebAssistantConnected, isWebAssistantEnabled, keyForGenerationReplacementForVariableNamed, keyWhenRelationship, lastUrl, length, localContext, logout, object, objectPropertyValue, objectPropertyValueIsNonNull, pageTitle, property, propertyKey, propertyValueClassName, relationship, resourcePathURL, sessionID, setCurrentSettings, setDynamicPages, setEntities, setEntity, setEntityName, setPropertyKey, setResourcePathURL, setTask, setTasks, showBanner, showWebAssistant, submitActionName, target, task, tasks, visibleEntityNames
     
    Methods inherited from class com.webobjects.appserver.WOComponent
    _associationWithName, _awakeInContext, _childTemplate, _componentDefinition, _componentUnroll, _isPage, _setContext, _setIsPage, _setParent, _setSubcomponent, _sleepInContext, _subcomponentForElementWithID, _templateNameForClass, _unroll, application, baseURL, bindingKeys, canAccessFieldsDirectly, canGetValueForBinding, canSetValueForBinding, clone, context, debugString, ensureAwakeInContext, frameworkName, generateResponse, handleQueryWithUnboundKey, handleTakeValueForUnboundKey, hasBinding, hasSession, isCachingEnabled, isEventLoggingEnabled, isStateless, logString, name, pageWithName, parent, path, pathURL, performParentAction, pullValuesFromParent, pushValuesToParent, reset, session, set_componentUnroll, set_unroll, setCachingEnabled, setValueForBinding, synchronizesVariablesWithBindings, takeValueForKey, takeValueForKeyPath, template, templateWithHTMLString, templateWithName, toString, unableToSetNullForKey, validateTakeValueForKeyPath, validateValueForKey, valueForBinding, valueForKey, valueForKeyPath
     
    Methods inherited from class java.lang.Object
    equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
     

    Field Detail

    log

    public static final ERXLogger log
    logging support


    validationLog

    public static final ERXLogger validationLog

    _context

    protected EOEditingContext _context
    EOEditingContext for the current object


    errorMessages

    protected NSMutableDictionary errorMessages

    errorKeyOrder

    protected NSMutableArray errorKeyOrder

    keyPathsWithValidationExceptions

    protected NSMutableArray keyPathsWithValidationExceptions

    errorMessage

    protected String errorMessage

    _userInfo

    protected NSMutableDictionary _userInfo
    Holds the user info.


    _allConfigurations

    protected static NSMutableSet _allConfigurations

    _branch

    protected NSDictionary _branch
    holds the chosen branch


    _nextPage

    protected WOComponent _nextPage

    _nextPageDelegate

    protected NextPageDelegate _nextPageDelegate
    Constructor Detail

    ERD2WPage

    public ERD2WPage(WOContext c)
    Default public constructor.

    Parameters:
    c - current context.
    Method Detail

    awake

    public void awake()
    Overridden to lock the page's editingContext, if there is any present.


    sleep

    public void sleep()
    Overridden to unlock the page's editingContext, if there is any present.


    setEditingContext

    public void setEditingContext(EOEditingContext newEditingContext)
    Sets the page's editingContext, automatically locking/unlocking it.

    Parameters:
    newEditingContext - new EOEditingContext

    editingContext

    public EOEditingContext editingContext()

    urlForCurrentState

    public String urlForCurrentState()
    Implementation of the ERXComponentActionRedirector$Restorable interface. This implementation creates an URL with the name of the current pageConfiguration as a direct action, which assumes a ERD2WDirectAction as the default direct action. Subclasses need to implement more sensible behaviour.

    Specified by:
    urlForCurrentState in interface ERXComponentActionRedirector.Restorable
    Returns:
    url for the current page

    setObject

    public void setObject(EOEnterpriseObject eo)
    Implementation of the InspectPageInterface


    setDataSource

    public void setDataSource(EODataSource eodatasource)

    self

    public final WOComponent self()
    Can be used to get this instance into KVC


    d2wContext

    public D2WContext d2wContext()
    D2WContext for this page. Checks if there is a "d2wContext" binding, too.

    Returns:
    d2wContext

    setD2wContext

    public void setD2wContext(D2WContext newValue)
    Key-Value-Coding needs this method. It should not be called


    setLocalContext

    public void setLocalContext(D2WContext newValue)
    Sets the d2wContext for this page


    errorMessages

    public NSMutableDictionary errorMessages()

    setErrorMessages

    public void setErrorMessages(NSMutableDictionary value)

    errorMessage

    public String errorMessage()

    setErrorMessage

    public void setErrorMessage(String message)

    shouldPropagateExceptions

    public boolean shouldPropagateExceptions()
    Should exceptions be propagated through to the parent page. If false, the validation errors are not shown at all.


    shouldCollectValidationExceptions

    public boolean shouldCollectValidationExceptions()
    Should exceptions also be handled here or only handled by the parent.


    clearValidationFailed

    public void clearValidationFailed()
    Clears all of the collected validation exceptions. Implementation of the ERXExceptionHolder interface.

    Specified by:
    clearValidationFailed in interface ERXExceptionHolder

    shouldSetFailedValidationValue

    public boolean shouldSetFailedValidationValue()
    Should incorrect values still be set into the EO. If not set, then the user must re-enter them.


    validationFailedWithException

    public void validationFailedWithException(Throwable e,
                                              Object value,
                                              String keyPath)
    Handles validation errors.


    isObjectEditable

    public boolean isObjectEditable()
    Checks if the current object can be edited.


    isObjectDeleteable

    public boolean isObjectDeleteable()
    Checks if the current object can be deleted.


    isObjectInspectable

    public boolean isObjectInspectable()
    Checks if the current object can be viewed.


    hasValidationExceptionForPropertyKey

    public boolean hasValidationExceptionForPropertyKey()
    Checks if there is a validation exception in the D2WContext for the current property key.


    userInfo

    public NSMutableDictionary userInfo()
    Implementation of the ERDUserInfoInterface

    Specified by:
    userInfo in interface ERDUserInfoInterface

    d2wComponentNameDebuggingEnabled

    public boolean d2wComponentNameDebuggingEnabled()
    Checks is component names should be shown.


    d2wCurrentComponentName

    public String d2wCurrentComponentName()
    Helper to return the actual current component name, even when wrapped in a custom component.


    descriptionForResponse

    public String descriptionForResponse(WOResponse aResponse,
                                         WOContext aContext)
    This will allow d2w pages to be listed on a per configuration basis in stats collecting.


    takeValuesFromRequest

    public void takeValuesFromRequest(WORequest r,
                                      WOContext c)
    Overridden from the parent for better logging. Also clears validation errors


    invokeAction

    public WOActionResults invokeAction(WORequest r,
                                        WOContext c)
    Overridden from the parent for better logging.


    allConfigurationNames

    public static NSSet allConfigurationNames()

    appendToResponse

    public void appendToResponse(WOResponse r,
                                 WOContext c)
    Overridden from the parent for better logging. Reports exceptions in the console for easier debugging.


    branch

    public NSDictionary branch()
    Cover method for getting the choosen branch.

    Returns:
    user choosen branch.

    setBranch

    public void setBranch(NSDictionary branch)
    Sets the user choosen branch.

    Parameters:
    branch - choosen by user.

    branchName

    public String branchName()
    Implementation of the ERDBranchDelegate. Gets the user selected branch name.

    Specified by:
    branchName in interface ERDBranchInterface
    Returns:
    user selected branch name.

    branchChoices

    public NSArray branchChoices()
    Calculates the branch choices for the current page. This method is just a cover for calling the method branchChoicesForContext on the current ERDBranchDelegate.

    Returns:
    array of branch choices

    hasBranchChoices

    public boolean hasBranchChoices()
    Determines if this message page should display branch choices.

    Returns:
    if the current delegate supports branch choices.

    currentSection

    public ERD2WContainer currentSection()
    The current section of display keys.


    setCurrentSection

    public void setCurrentSection(ERD2WContainer value)
    Sets the current section of display keys.


    currentSectionKeys

    public NSArray currentSectionKeys()
    The display keys for the current section. You bind to this method.

    Returns:
    array of ERD2WContainer holding the keys for the current section

    sectionsContents

    public NSArray sectionsContents()
    The array of sections. You bind to this method.

    Returns:
    array of arrays of ERD2WContainer holding the keys.

    tabSectionsContents

    public NSArray tabSectionsContents()
    Returns the array of ERD2WContainer defining the tabs. A tab is a key and an array of sections


    sectionsForCurrentTab

    public NSArray sectionsForCurrentTab()
    Returns the sections on the current tab.


    currentTab

    public ERD2WContainer currentTab()
    Returns the ERD2WContainer defining the current tab.


    setCurrentTab

    public void setCurrentTab(ERD2WContainer value)
    Sets the current tab.


    tabSectionsContentsFromRuleResult

    protected static NSArray tabSectionsContentsFromRuleResult(NSArray tabSectionContentsFromRule)
    Helper method to calulate the tab key array


    isEmbedded

    public boolean isEmbedded()

    now

    public NSTimestamp now()

    nextPage

    public WOComponent nextPage()

    setNextPage

    public void setNextPage(WOComponent wocomponent)

    nextPageDelegate

    public NextPageDelegate nextPageDelegate()

    setNextPageDelegate

    public void setNextPageDelegate(NextPageDelegate nextpagedelegate)

    showCancel

    public boolean showCancel()

    Last updated: Do, Dez 9, 2004 • 12:46 PM CET

    Copyright © 2002 – 2004 Project Wonder.