ERD2WPage Class Reference

Inherits com::webobjects::directtoweb::D2WPage, er::extensions::validation::ERXExceptionHolder, er::directtoweb::interfaces::ERDUserInfoInterface, er::extensions::appserver::ERXComponentActionRedirector::Restorable, and er::directtoweb::delegates::ERDBranchInterface.

Inherited by ReportPage, ERD2WEditSortedManyToManyPage, ERD2WGraphVizPage, ERD2WInspectPage, ERD2WListPage, ERD2WMessagePage, ERD2WPickTypePage, ERD2WQueryEntitiesPage, ERD2WQueryPage, and ERMODEditRelationshipPage.

Collaboration diagram for ERD2WPage:

Collaboration graph
[legend]

List of all members.

Classes

interface  Keys

Public Member Functions

long aggregateEventDurationForCurrentPropertyKey ()
void appendToResponse (WOResponse response, WOContext context)
void awake ()
NSDictionary branch ()
NSArray branchChoices ()
String branchName ()
void clearValidationFailed ()
boolean clickToOpenEnabled (WOResponse response, WOContext context)
String cssClassForPageContainerElement ()
String cssClassForPropertyKey ()
String cssClassForPropertyName ()
ERD2WContainer currentSection ()
NSArray currentSectionKeys ()
ERD2WContainer currentTab ()
boolean d2wComponentNameDebuggingEnabled ()
D2WContext d2wContext ()
String d2wCurrentComponentName ()
boolean d2wDebuggingEnabled ()
String descriptionForResponse (WOResponse aResponse, WOContext aContext)
String displayVariant ()
EOEditingContext editingContext ()
 ERD2WPage (WOContext c)
NSArray< StringerrorKeyOrder ()
String errorMessage ()
NSMutableDictionary< String,
String
errorMessages ()
boolean hasActualChanges ()
boolean hasBranchChoices ()
boolean hasErrors ()
boolean hasValidationExceptionForPropertyKey ()
String inlineStyleDeclarationForPropertyKey ()
String inlineStyleDeclarationForPropertyName ()
WOActionResults invokeAction (WORequest r, WOContext c)
boolean isEmbedded ()
boolean isEntityEditable ()
boolean isEntityReadOnly ()
boolean isKeyOmitted ()
boolean isObjectDeleteable ()
boolean isObjectEditable ()
boolean isObjectInspectable ()
boolean isTopLevelPage ()
ERXStats.LogEntry latestEntryForCurrentPropertyKey ()
WOComponent nextPage ()
NextPageDelegate nextPageDelegate ()
NSTimestamp now ()
EOEnterpriseObject object ()
ERDBranchDelegateInterface pageController ()
String pageWrapperName ()
NSArray sectionsContents ()
NSArray sectionsForCurrentTab ()
final WOComponent self ()
void setBranch (NSDictionary branch)
void setCurrentSection (ERD2WContainer value)
void setCurrentTab (ERD2WContainer value)
void setD2wContext (D2WContext newValue)
void setDataSource (EODataSource eodatasource)
void setEditingContext (EOEditingContext newEditingContext)
void setErrorMessage (String message)
void setErrorMessages (NSMutableDictionary< String, String > value)
void setLocalContext (D2WContext newValue)
void setNextPage (WOComponent wocomponent)
void setNextPageDelegate (NextPageDelegate nextpagedelegate)
void setObject (EOEnterpriseObject eo)
void setPageController (ERDBranchDelegateInterface aPageController)
NSDictionary settings ()
boolean shouldCollectValidationExceptions ()
boolean shouldDisplayDetailedPageMetrics ()
boolean shouldDisplayPageMetricsSummary ()
boolean shouldPropagateExceptions ()
boolean shouldSetFailedValidationValue ()
boolean showCancel ()
void sleep ()
NSDictionary statsForPage ()
String statsKeyForCurrentPropertyKey ()
String statsKeyPrefix ()
NSArray< ERD2WContainertabSectionsContents ()
void takeValuesFromRequest (WORequest r, WOContext c)
String urlForCurrentState ()
NSMutableDictionary userInfo ()
void validationFailedWithException (Throwable e, Object value, String keyPath)

Static Public Member Functions

static NSArray< StringallConfigurationNames ()

Static Public Attributes

static final Logger log = Logger.getLogger(ERD2WPage.class)
static final Logger validationLog = Logger.getLogger("er.directtoweb.validation.ERD2WPage")

Protected Member Functions

void clearTabSectionsContents ()
String makeStatsKey (String key)
WOComponent nextPageFromDelegate ()
Object userPreferencesValueForKey (String key)
Object userPreferencesValueForPageConfigurationKey (String key)

Static Protected Member Functions

static NSArray tabSectionsContentsFromRuleResult (NSArray tabSectionContentsFromRule)

Protected Attributes

NSDictionary _branch
EOEditingContext _context
WOComponent _nextPage
NextPageDelegate _nextPageDelegate
ERDBranchDelegateInterface _pageController
NSMutableDictionary _userInfo = new NSMutableDictionary()
NSMutableArray< StringerrorKeyOrder = new NSMutableArray<String>()
String errorMessage = ""
NSMutableDictionary< String,
String
errorMessages = new NSMutableDictionary<String,String>()
NSMutableArray< StringkeyPathsWithValidationExceptions = new NSMutableArray<String>()

Static Protected Attributes

static final NSMutableSet< String_allConfigurations = new NSMutableSet<String>()

Package Functions

public< T extends WOComponent > T pageWithName (Class< T > componentClass)

Private Member Functions

String _cssClassForTemplateForCurrentPropertyKey (String cssKey)
ERD2WPage topLevelPage ()

Private Attributes

ERD2WContainer _currentSection
ERD2WContainer _currentTab
NSMutableArray _sectionsContents
String _statsKeyPrefix
NSArray _tabSectionsContents
NSMutableDictionary< String,
String
_temp = new NSMutableDictionary<String,String>()

Static Private Attributes

static final NSArray _NO_SECTIONS = new NSArray("")


Detailed Description

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..... ) object localContext keyPathsWithValidationExceptions shouldPropagateExceptions shouldCollectionValidationExceptions shouldSetFailedValidationValue errorMessages componentName customComponentName propertyKey sectionKey sectionContents tabKey displayNameForTabKey isEntityEditable pageConfiguration displayPropertyKeys tabSectionsContents displayVariant displayNameForEntity nextPageDelegate pageController pageWrapperName inlineStyle


Constructor & Destructor Documentation

ERD2WPage ( WOContext  c  ) 

Default public constructor.

Parameters:
c current context.


Member Function Documentation

String _cssClassForTemplateForCurrentPropertyKey ( String  cssKey  )  [private]

Gets the CSS class(es) that should be applied to the current container element.

Parameters:
cssKey from the d2wContext that defines the CSS for this element
Returns:
the css classes

long aggregateEventDurationForCurrentPropertyKey (  ) 

Gets the aggregate duration of events sharing the current property key.

Returns:
the duration

static NSArray<String> allConfigurationNames (  )  [static]

Collects the names of all page configurations as you walk through your application.

void appendToResponse ( WOResponse  response,
WOContext  context 
)

void awake (  ) 

Overridden to lock the page's editingContext, if there is any present.

Reimplemented in ERD2WQueryPage, ERD2WTabInspectPage, ERMODEditRelationshipPage, ERMODInspectPage, and ERMODWizardCreationPage.

NSDictionary branch (  ) 

Cover method for getting the choosen branch.

Returns:
user choosen branch.

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

String branchName (  ) 

Implementation of the ERDBranchDelegate. Gets the user selected branch name.

Returns:
user selected branch name.

Implements ERDBranchInterface.

void clearTabSectionsContents (  )  [protected]

If you switch the context out from under a wizard page it will hold onto the keys in the tab sections and blow up the next time you use it if the entity has changed. This allows you to clear the array so it rebuilds.

void clearValidationFailed (  ) 

Clears all of the collected validation exceptions. Implementation of the ERXExceptionHolder interface.

Implements ERXExceptionHolder.

Reimplemented in ERD2WEditableListPage.

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

String cssClassForPageContainerElement (  ) 

Gets the CSS class(es) for the container element, based on the current entity and task.

Returns:
the css classes

String cssClassForPropertyKey (  ) 

Gets the CSS class(es) that should be applied to the current property key container element.

Returns:
the css classes

String cssClassForPropertyName (  ) 

Gets the CSS class(es) that should be applied to the current property name container element.

Returns:
the css classes

ERD2WContainer currentSection (  ) 

The current section of display keys.

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

ERD2WContainer currentTab (  ) 

Returns the ERD2WContainer defining the current tab.

boolean d2wComponentNameDebuggingEnabled (  ) 

Checks is component names should be shown.

D2WContext d2wContext (  ) 

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

Returns:
d2wContext

Reimplemented in ERMODWizardCreationPage.

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.

Reimplemented in ERD2WListPage.

String displayVariant (  ) 

Gets the displayVariant for the current property key. The intention is that the display variant allows variation in the display method of property keys without needing different, slightly varying, displayPropertyKeys or tabSectionsContents rules. Template support has been added for the omit and blank variants. One could imagine others, such as collapsed, ajax, etc.

Returns:
the display variant, if specified

EOEditingContext editingContext (  ) 

NSArray<String> errorKeyOrder (  ) 

boolean hasActualChanges (  ) 

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

boolean hasBranchChoices (  ) 

Determines if this message page should display branch choices.

Returns:
if the current delegate supports branch choices.

boolean hasErrors (  ) 

boolean hasValidationExceptionForPropertyKey (  ) 

Checks if there is a validation exception in the D2WContext for the current property key.

String inlineStyleDeclarationForPropertyKey (  ) 

Gets any inline style declarations for the current property key container element.

Returns:
the inline style declarations

String inlineStyleDeclarationForPropertyName (  ) 

Gets any inline style declarations for the current property name container element.

Returns:
the inline style declarations

WOActionResults invokeAction ( WORequest  r,
WOContext  c 
)

Overridden from the parent for better logging.

Reimplemented in ERD2WListPage.

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.

Reimplemented in ERD2WListPage.

boolean isEntityReadOnly (  ) 

True if the entity is read only. Returns !(isEntityEditable())

Reimplemented in ERD2WListPage.

boolean isKeyOmitted (  ) 

Determines if display of the current property key should be omitted.

Returns:
true if key should be omitted

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.

boolean isTopLevelPage (  ) 

ERXStats.LogEntry latestEntryForCurrentPropertyKey (  ) 

Gets the latest metrics event for the current property key.

Returns:
the event

String makeStatsKey ( String  key  )  [protected]

Makes the stats key, prepending a prefix to identify the stats to the originating page.

Parameters:
key to format
Returns:
the formatted key

WOComponent nextPage (  ) 

NextPageDelegate nextPageDelegate (  ) 

Returns the page's NextPageDelegate, if any, checking for a "nextPageDelegate" binding if no delegate has been explicitly set.

Returns:
The page's next page delegate.

WOComponent nextPageFromDelegate (  )  [protected]

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. If there is none given yet, tries to create one by querying the key "pageController" from the d2wContext. The most conventient way to set and use a pageController is via the rule system:

  100: (entity.name='WebSite') and (task = 'list') => pageController = "ListWebSiteController" [er.directtoweb.ERDDelayedObjectCreationAssignment]
  100: (entity.name='WebSite') => actions = {left = (editAction, controllerAction);}
  100: (propertyKey = 'controllerAction') => componentName = "ERDControllerButton"
 
Then ListWebSiteController would be:
 public class ListWebSiteController extends ERDBranchDelegate {

     private WOComponent _sender;

     private WOComponent sender() {
         return _sender;
     }

     private void setSender(WOComponent aSender) {
         _sender = aSender;
     }

     private D2WContext d2wContext() {
         return (D2WContext) sender().valueForKey("d2wContext");
     }

     private EOEnterpriseObject object() {
         return (EOEnterpriseObject) d2wContext().valueForKey("object");
     }

     // first action, show up as "Copy Web Site"
     public WOComponent copyWebSite(WOComponent sender) {
        setSender(sender);
        WOComponent result = ....
        return result;
     }

     // second action, show up as "Delete Web Site"
     public WOComponent deleteWebSite(WOComponent sender) {
        setSender(sender);
        WOComponent result = ....
        return result;
     }
 }
 
The nice thing about this is that this allows you to keep your logic confined to just a handful of classes, without the need to constantly create new components that just handle one action.

public<T extends WOComponent> T pageWithName ( Class< T >  componentClass  )  [package]

This variant of pageWithName provides a Java5 genericized version of the original pageWithName. You would call it with:

MyNextPage nextPage = pageWithName(MyNextPage.class);

Parameters:
<T> the type of component to create
componentClass the Class of the component to load
Returns:
an instance of the requested component class

String pageWrapperName (  ) 

Gets the name of the page wrapper component. Overrides the superclass' implementation which caches the name too aggressively. This method allows you to drive the page wrapper component via the rules. Defaults to PageWrapper if a value is not found from the D2W rules.

Returns:
the name of the page wrapper

NSArray sectionsContents (  ) 

The array of sections. You bind to this method.

Returns:
array of arrays of ERD2WContainer holding the keys.

NSArray sectionsForCurrentTab (  ) 

Returns the sections on the current tab.

final WOComponent self (  ) 

Can be used to get this instance into KVC

void setBranch ( NSDictionary  branch  ) 

Sets the user chosen branch.

Parameters:
branch chosen by user.

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. It should not be called

void setDataSource ( EODataSource  eodatasource  ) 

Reimplemented in ERD2WListPage, and ERMODEditRelationshipPage.

void setEditingContext ( EOEditingContext  newEditingContext  ) 

Sets the page's editingContext, automatically locking/unlocking it.

Parameters:
newEditingContext new EOEditingContext

void setErrorMessage ( String  message  ) 

void setErrorMessages ( NSMutableDictionary< String, String value  ) 

void setLocalContext ( D2WContext  newValue  ) 

Sets the d2wContext for this page

void setNextPage ( WOComponent  wocomponent  ) 

void setNextPageDelegate ( NextPageDelegate  nextpagedelegate  ) 

void setObject ( EOEnterpriseObject  eo  ) 

void setPageController ( ERDBranchDelegateInterface  aPageController  ) 

NSDictionary settings (  ) 

Reimplemented in ERDIVListPage.

boolean shouldCollectValidationExceptions (  ) 

Should exceptions also be handled here or only handled by the parent.

Reimplemented in ERD2WInspectPage.

boolean shouldDisplayDetailedPageMetrics (  ) 

Determines whether the component should display the detailed "inline" page metrics.

Returns:
true if should show the detailed metrics

boolean shouldDisplayPageMetricsSummary (  ) 

Determines whether the component should display the page metrics summary. On display the summary for the top-level page by default, and for all pages when showing detailed metrics.

Returns:
true if should show metrics summary

boolean shouldPropagateExceptions (  ) 

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

boolean shouldSetFailedValidationValue (  ) 

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

boolean showCancel (  ) 

void sleep (  ) 

Overridden to unlock the page's editingContext, if there is any present.

Reimplemented in ERMODEditRelationshipPage.

NSDictionary statsForPage (  ) 

Gets the stats for the current page.

Returns:
the stats

String statsKeyForCurrentPropertyKey (  ) 

Creates a stats key to identify stats to the current property key.

Returns:
the stats key

String statsKeyPrefix (  ) 

A stats key prefix that guarantees the stats will be identifiable to this instance.

Returns:
the key prefix

NSArray<ERD2WContainer> tabSectionsContents (  ) 

Returns the array of ERD2WContainer defining the tabs. A tab is a key and an array of sections

static NSArray tabSectionsContentsFromRuleResult ( NSArray  tabSectionContentsFromRule  )  [static, protected]

Helper method to calulate the tab key array

void takeValuesFromRequest ( WORequest  r,
WOContext  c 
)

Overridden from the parent for better logging. Also clears validation errors

Reimplemented in ERD2WEditableListPage, ERD2WInspectPage, ERD2WListPage, and ERD2WQueryPage.

ERD2WPage topLevelPage (  )  [private]

Gets the top level D2WPage.

Returns:
the page

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.

Returns:
url for the current page

Implements ERXComponentActionRedirector.Restorable.

Reimplemented in ERD2WInspectPage, ERD2WListPage, and ERD2WTabInspectPage.

NSMutableDictionary userInfo (  ) 

Implementation of the ERDUserInfoInterface

Implements ERDUserInfoInterface.

Object userPreferencesValueForKey ( String  key  )  [protected]

Utility method to get a value from the user prefs.

Parameters:
key 

Object userPreferencesValueForPageConfigurationKey ( String  key  )  [protected]

Utility method to get a value for the current page configuration from the user prefs.

Parameters:
key 

void validationFailedWithException ( Throwable  e,
Object  value,
String  keyPath 
)

Handles validation errors.

Reimplemented in ERD2WEditableListPage.


Member Data Documentation

final NSMutableSet<String> _allConfigurations = new NSMutableSet<String>() [static, protected]

NSDictionary _branch [protected]

holds the chosen branch

EOEditingContext _context [protected]

EOEditingContext for the current object

Holds the current section of display keys.

Holds the current tab.

WOComponent _nextPage [protected]

NextPageDelegate _nextPageDelegate [protected]

final NSArray _NO_SECTIONS = new NSArray("") [static, private]

Dummy denoting to sections.

Holds the page controller for this page.

Holds the section info

NSArray _tabSectionsContents [private]

Holds the array of ERD2WContainer defining the tabs.

Used to hold a cleaned-up validation key and message.

Holds the user info.

String errorMessage = "" [protected]

final Logger log = Logger.getLogger(ERD2WPage.class) [static]

final Logger validationLog = Logger.getLogger("er.directtoweb.validation.ERD2WPage") [static]

Reimplemented in ERD2WTabInspectPage.


The documentation for this class was generated from the following file:

Generated on Sat May 26 06:42:56 2012 for Project Wonder by  doxygen 1.5.8