Project Wonder 5.0.0.8794

er.directtoweb.pages
Class ERD2WPage

java.lang.Object
  extended by com.webobjects.appserver.WOElement
      extended by com.webobjects.appserver.WOComponent
          extended by com.webobjects.directtoweb.D2WComponent
              extended by com.webobjects.directtoweb.D2WPage
                  extended by er.directtoweb.pages.ERD2WPage
All Implemented Interfaces:
WOActionResults, com.webobjects.directtoweb.generation.DTWGeneration, NSKeyValueCoding, NSKeyValueCoding.ErrorHandling, NSKeyValueCodingAdditions, NSValidation, ERDBranchInterface, ERDUserInfoInterface, ERXComponentActionRedirector.Restorable, ERXExceptionHolder, Serializable, Cloneable
Direct Known Subclasses:
ERD2WEditSortedManyToManyPage, ERD2WInspectPage, ERD2WListPage, ERD2WMessagePage, ERD2WPickTypePage, 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/interfaces inherited from class com.webobjects.appserver.WOComponent
    WOComponent._EventLoggingEnabler, WOComponent.Event
     
    Nested classes/interfaces inherited from interface com.webobjects.foundation.NSKeyValueCodingAdditions
    NSKeyValueCodingAdditions.DefaultImplementation, NSKeyValueCodingAdditions.Utility
     
    Nested classes/interfaces inherited from interface 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  ERDBranchDelegateInterface _pageController
              Holds the page controller for this page.
    protected  NSMutableDictionary _userInfo
              Holds the user info.
    protected  NSMutableArray errorKeyOrder
               
    protected  String errorMessage
               
    protected  NSMutableDictionary errorMessages
               
    protected  NSMutableArray keyPathsWithValidationExceptions
               
    static Logger log
              logging support
    static Logger validationLog
               
     
    Fields inherited from class com.webobjects.directtoweb.D2WComponent
    _eo, _localContext, currentObjectKey
     
    Fields inherited from class com.webobjects.appserver.WOComponent
    _Extension, _IsEventLoggingEnabled, _keyAssociations, MINUSONE
     
    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 NSArray allConfigurationNames()
              Collects the names of all page configurations as you walk through your application.
     void appendToResponse(WOResponse response, WOContext context)
              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.
     boolean clickToOpenEnabled(WOResponse response, WOContext context)
              Returns whether or not click-to-open should be enabled for this component.
     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.
     boolean d2wDebuggingEnabled()
              Checks if basic debugging is on
     String descriptionForResponse(WOResponse aResponse, WOContext aContext)
              This will allow d2w pages to be listed on a per configuration basis in stats collecting.
     EOEditingContext editingContext()
               
     NSArray errorKeyOrder()
               
     String errorMessage()
               
     NSMutableDictionary errorMessages()
               
     boolean hasActualChanges()
              Returns true if the EC has "real" changes (processRecentChanges was called)
     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 isEntityEditable()
              If the key isEntityEditable is set, then this value is used, otherwise the value from the super implementation, which checks if the entity is not in the list of readOnlyEntityNames.
     boolean isEntityReadOnly()
              True if the entity is read only.
     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()
              Returns the page's NextPageDelegate, if any, checking for a "nextPageDelegate" binding if no delegate has been explicitly set.
    protected  WOComponent nextPageFromDelegate()
              Checks if the delegate is present and can be invoked, then returns the page from it.
     NSTimestamp now()
               
     EOEnterpriseObject object()
              Return the object from the d2wContext.
     ERDBranchDelegateInterface pageController()
              Returns the pageController for this page.
    <T extends WOComponent>
    T
    pageWithName(Class<T> componentClass)
              This variant of pageWithName provides a Java5 genericized version of the original pageWithName.
     String pageWrapperName()
              Gets the name of the page wrapper component.
     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
     void setPageController(ERDBranchDelegateInterface aPageController)
               
     NSDictionary settings()
               
     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
    protected  Object userPreferencesValueForKey(String key)
              Utility method to get a value from the user prefs.
    protected  Object userPreferencesValueForPageConfigurationKey(String key)
              Utility method to get a value for the current page configuration from the user prefs.
     void validationFailedWithException(Throwable e, Object value, String keyPath)
              Handles validation errors.
     
    Methods inherited from class com.webobjects.directtoweb.D2WPage
    alternateRowColor, dataSource, extraBindings, finalize, 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, isLiveAssistantEnabled, isNotBoldAsBoolean, isNotItalicAsBoolean, isPropertyAnAttribute, isWebAssistantActive, isWebAssistantConnected, isWebAssistantEnabled, keyForGenerationReplacementForVariableNamed, keyWhenRelationship, lastUrl, length, localContext, logout, 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
    __valueForBinding, _associationWithName, _awakeInContext, _childTemplate, _cleanUpStatelessComponent, _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, templateWithHTMLString, templateWithName, toString, unableToSetNullForKey, validateTakeValueForKeyPath, validateValueForKey, valueForBinding, valueForBooleanBinding, valueForIntegerBinding, valueForKey, valueForKeyPath, valueForNSArrayBindings, valueForNSDictionaryBindings, valueForNumberBinding, valueForStringBinding
     
    Methods inherited from class java.lang.Object
    equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
     

    Field Detail

    log

    public static final Logger log
    logging support


    validationLog

    public static final Logger 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

    _pageController

    protected ERDBranchDelegateInterface _pageController
    Holds the page controller for this page.

    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.

    Overrides:
    awake in class WOComponent

    clickToOpenEnabled

    public boolean clickToOpenEnabled(WOResponse response,
                                      WOContext context)
    Returns whether or not click-to-open should be enabled for this component. By default this returns ERXClickToOpenSupport.isEnabled().

    Parameters:
    response - the response
    context - the context
    Returns:
    whether or not click-to-open is enabled for this component

    userPreferencesValueForKey

    protected Object userPreferencesValueForKey(String key)
    Utility method to get a value from the user prefs.

    Parameters:
    key -

    userPreferencesValueForPageConfigurationKey

    protected Object userPreferencesValueForPageConfigurationKey(String key)
    Utility method to get a value for the current page configuration from the user prefs.

    Parameters:
    key -

    sleep

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

    Overrides:
    sleep in class WOComponent

    setEditingContext

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

    Parameters:
    newEditingContext - new EOEditingContext

    editingContext

    public EOEditingContext editingContext()

    hasActualChanges

    public boolean hasActualChanges()
    Returns true if the EC has "real" changes (processRecentChanges was called)


    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

    Overrides:
    setObject in class D2WComponent

    object

    public EOEnterpriseObject object()
    Return the object from the d2wContext.

    Overrides:
    object in class D2WComponent

    setDataSource

    public void setDataSource(EODataSource eodatasource)
    Overrides:
    setDataSource in class D2WPage

    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.

    Overrides:
    d2wContext in class D2WComponent
    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

    Overrides:
    setLocalContext in class D2WComponent

    errorMessages

    public NSMutableDictionary errorMessages()

    setErrorMessages

    public void setErrorMessages(NSMutableDictionary value)

    errorMessage

    public String errorMessage()

    setErrorMessage

    public void setErrorMessage(String message)

    errorKeyOrder

    public NSArray errorKeyOrder()

    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.

    Overrides:
    validationFailedWithException in class WOComponent

    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()