WebObjects 5.4.2

com.webobjects.directtoweb
Class D2WListPage

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 com.webobjects.directtoweb.D2WListPage
All Implemented Interfaces:
WOActionResults, DTWGeneration, ListPageInterface, SelectPageInterface, NSKeyValueCoding, NSKeyValueCoding.ErrorHandling, NSKeyValueCodingAdditions, NSValidation, Serializable, Cloneable
Direct Known Subclasses:
BASListPage, D2WPlainListPage, NEUListPage, WOLListPage

public class D2WListPage
extends D2WPage
implements DTWGeneration, ListPageInterface, SelectPageInterface

The D2WListPage class provides the behavior for the list page and select page Direct to Web templates, specifically BASListPage, NEUListPage, and WOLListPage. The classes for these components inherit directly from D2WListPage and define no additional methods or variables.

D2WPlainListPage also inherits from this class.

Most of the methods in this class are accessed, via the EOKeyValueCoding interface defined in the EOControl framework, from the bindings (.wod) file of the Direct to Web template. If you create a Direct to Web template from a list page or select page, you can invoke the methods in this class in the same way.

See Also:
Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from class com.webobjects.appserver.WOComponent
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.DefaultImplementation, NSValidation.Utility, NSValidation.ValidationException
 
Field Summary
 
Fields inherited from class com.webobjects.directtoweb.D2WComponent
currentObjectKey
 
Fields inherited from interface com.webobjects.foundation.NSKeyValueCodingAdditions
KeyPathSeparator
 
Constructor Summary
D2WListPage(WOContext aContext)
          Creates an instance of D2WListPage with the specified context.
 
Method Summary
 String alternatingColorForRow()
          Gets the alternating row background color.
 void appendToResponse(WOResponse r, WOContext c)
          Fetches on the display group if the editing context did save changes recently.
 WOComponent backAction()
          Is invoked when the user clicks 'Return' in the list page.
 String backgroundColorForRow()
          Gets the row background color.
 String backgroundColorForRowMethod()
          Contributes to the template method that corresponds to the method backgroundColorForRow.
 String defaultSortKey()
          Gets the default sort key.
 WOComponent deleteObjectAction()
          Is invoked when the user clicks the delete button next to an object on the list page.
 WODisplayGroup displayGroup()
          Gets the display group that contains the objects listed on the page.
 void editingContextDidSaveChanges(NSNotification notif)
          Handles notifications when the editing context did save changes.
 WOComponent editObjectAction()
          Is invoked when the user clicks the edit button next to an object on the list page.
 void finalize()
           
 WOComponent inspectObjectAction()
          Is invoked when the user clicks the inspect button next to an object on the list page.
 boolean isEntityReadOnly()
          Indicates whether the entity displayed on this page can be modified.
 boolean isListEmpty()
          Indicates whether the list displayed contains no objects.
 boolean isSelecting()
          Indicates whether the page is a select page.
 int listSize()
          Gets the total number of objects in the display group.
 int numberOfObjectsPerBatch()
          Gets the batch size of the display group.
 WOAssociation replacementAssociationForAssociation(WOAssociation oldAssociation, String oldBinding, DTWTemplate aTemplate, WOContext aContext)
          Replaces the following bindings: isListEmpty, d2wContext.propertyKey, d2wContext.justification, d2wContext.displayNameForProperty, object, displayedObjects.
 EOEnterpriseObject selectedObject()
          Gets the selected object of the display group.
 WOComponent selectObjectAction()
          Is invoked when the user clicks 'Select' next to one of the objects on the select page.
 void setBackgroundColorForRow(String newValue)
          Sets the row background color to the specified value.
 void setDataSource(EODataSource dataSource)
          Sets the data source to the specified data source.
 void setLocalContext(D2WContext newValue)
          Sets the local context to the specified D2WContext.
 void setSelectedObject(EOEnterpriseObject selectedObject)
          Selects the object in the display group if the specified object is not null; clears the selection of the display group otherwise.
 
Methods inherited from class com.webobjects.directtoweb.D2WPage
alternateRowColor, dataSource, descriptionForResponse, extraBindings, nextPage, nextPageDelegate, pageWrapperName, setExtraBindings, setNextPage, setNextPageDelegate, showCancel
 
Methods inherited from class com.webobjects.directtoweb.D2WComponent
allEntities, allowCollapsing, applicationPort, assistantPort, attribute, backgroundColorForHeaderRow, backgroundColorForPage, backgroundColorForTable, backgroundColorForTableDark, backgroundColorForTableLight, color, currentSettings, currentUrl, d2wContext, 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, object, objectPropertyValue, objectPropertyValueIsNonNull, pageTitle, property, propertyKey, propertyValueClassName, relationship, resourcePathURL, sessionID, setCurrentSettings, setDynamicPages, setEntities, setEntity, setEntityName, setObject, setPropertyKey, setResourcePathURL, setTask, setTasks, showBanner, showWebAssistant, submitActionName, target, task, tasks, visibleEntityNames
 
Methods inherited from class com.webobjects.appserver.WOComponent
application, awake, baseURL, bindingKeys, canAccessFieldsDirectly, canGetValueForBinding, canSetValueForBinding, clone, context, debugString, ensureAwakeInContext, frameworkName, generateResponse, handleQueryWithUnboundKey, handleTakeValueForUnboundKey, hasBinding, hasSession, invokeAction, isCachingEnabled, isEventLoggingEnabled, isStateless, logString, name, pageWithName, parent, path, pathURL, performParentAction, pullValuesFromParent, pushValuesToParent, reset, session, set_componentUnroll, set_unroll, setCachingEnabled, setValueForBinding, setVariableValueForName, sleep, synchronizesVariablesWithBindings, takeValueForKey, takeValueForKeyPath, takeValuesFromRequest, template, templateWithHTMLString, templateWithHTMLString, templateWithHTMLString, templateWithName, toString, unableToSetNullForKey, validateTakeValueForKeyPath, validateValueForKey, validationFailedWithException, valueForBinding, valueForBooleanBinding, valueForIntegerBinding, valueForKey, valueForKeyPath, valueForNSArrayBindings, valueForNSDictionaryBindings, valueForNumberBinding, valueForStringBinding, variableValueForName, variableWithName
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface com.webobjects.directtoweb.ListPageInterface
setNextPage, setNextPageDelegate
 
Methods inherited from interface com.webobjects.directtoweb.SelectPageInterface
nextPageDelegate, setNextPageDelegate
 

Constructor Detail

D2WListPage

public D2WListPage(WOContext aContext)
Creates an instance of D2WListPage with the specified context. Registers for "editingContextDidSaveChanges" notifications.

Parameters:
aContext - instance of WOContext
See Also:
D2WListPage.editingContextDidSaveChanges(NSNotification), D2WPage.D2WPage(WOContext), NSNotificationCenter
Method Detail

displayGroup

public WODisplayGroup displayGroup()
Gets the display group that contains the objects listed on the page.

Returns:
instance of WODisplayGroup

numberOfObjectsPerBatch

public int numberOfObjectsPerBatch()
Gets the batch size of the display group.

The current implementation parses the value for the key "batchSize" in the D2WContext and returns the int if parsing succeeds; 10 otherwise.

The implementation is subject to change in future releases.

Returns:
the batch size of the display group
See Also:
D2WListPage.displayGroup(), D2WComponent.d2wContext()

isEntityReadOnly

public boolean isEntityReadOnly()
Indicates whether the entity displayed on this page can be modified.

The current implementation returns true if the value for the key "readOnly" in the D2WContext is D2WModel.One; false otherwise.

The implementation is subject to change in future releases.

Overrides:
isEntityReadOnly in class D2WComponent
Returns:
true if displayed entity can be modified; false otherwise
See Also:
D2WComponent.d2wContext(), D2WModel.One

setLocalContext

public void setLocalContext(D2WContext newValue)
Sets the local context to the specified D2WContext.

The current implementation also supports sorting the first column of the List Page and affects the display of sort icons.

The implementation is subject to change in future releases.

Overrides:
setLocalContext in class D2WComponent
Parameters:
newValue - instance of D2WContext
See Also:
D2WListPage.displayGroup(), D2WListPage.numberOfObjectsPerBatch(), D2WListPage.defaultSortKey()

defaultSortKey

public String defaultSortKey()
Gets the default sort key.

The current implementation takes the first attribute in the display property keys.

The implementation is subject to change in future releases.

Returns:
instance of String
See Also:
D2WComponent.displayPropertyKeys()

setDataSource

public void setDataSource(EODataSource dataSource)
Sets the data source to the specified data source. Also sets the data source of the display group and fetches.

Specified by:
setDataSource in interface ListPageInterface
Specified by:
setDataSource in interface SelectPageInterface
Overrides:
setDataSource in class D2WPage
Parameters:
dataSource - instance of EODataSource
See Also:
D2WPage.setDataSource(com.webobjects.eocontrol.EODataSource), D2WListPage.displayGroup()

isSelecting

public boolean isSelecting()
Indicates whether the page is a select page.

The current implementation returns true if the task in the D2WContext equals "select"; false otherwise.

The implementation is subject to change in future releases.

Returns:
true if the page is a select page; false otherwise

isListEmpty

public boolean isListEmpty()
Indicates whether the list displayed contains no objects.

Returns:
true if the list is empty; false otherwise
See Also:
D2WListPage.listSize()

listSize

public int listSize()
Gets the total number of objects in the display group. This is not the number of objects shown on the page, which depends on the batch size of the display group.

Returns:
the number of objects in the display group

alternatingColorForRow

public String alternatingColorForRow()
Gets the alternating row background color. Is provided as a convenience for subclasses.

The current implementation returns "#FFFF00" if the task is "select" and the object is selected in the display group; the value of the method alternatingColorForRow otherwise.

The implementation is subject to change in future releases.

See Also:
D2WPage.alternateRowColor(), D2WComponent.backgroundColorForTable(), D2WComponent.backgroundColorForTableDark()

backgroundColorForRow

public String backgroundColorForRow()
Gets the row background color. Is provided as a convenience for subclasses.

The current implementation return "#FFFF00" if the task is "select" and the object is selected in the display group; the value of the method alternatingColorForRow otherwise.

The implementation is subject to change in future releases.

Returns:
String representing the hex code for the background color
See Also:
D2WListPage.displayGroup(), D2WListPage.alternatingColorForRow(), D2WComponent.task(), D2WComponent.object()

setBackgroundColorForRow

public void setBackgroundColorForRow(String newValue)
Sets the row background color to the specified value.

The current implementation does nothing.

The implementation is subject to change in future releases.

Parameters:
newValue - instance of String - ignored
See Also:
D2WListPage.backgroundColorForRow()

selectedObject

public EOEnterpriseObject selectedObject()
Gets the selected object of the display group.

Specified by:
selectedObject in interface SelectPageInterface
Returns:
instance of EOEnterpriseObject
See Also:
D2WListPage.displayGroup(), D2WListPage.setSelectedObject(EOEnterpriseObject)

setSelectedObject

public void setSelectedObject(EOEnterpriseObject selectedObject)
Selects the object in the display group if the specified object is not null; clears the selection of the display group otherwise.

Specified by:
setSelectedObject in interface SelectPageInterface
Parameters:
selectedObject - instance of EOEnterpriseObject
See Also:
D2WListPage.selectedObject()

selectObjectAction

public WOComponent selectObjectAction()
Is invoked when the user clicks 'Select' next to one of the objects on the select page. You can specify custom behavior for this action by overriding the method nextPageDelegate.

Returns:
the list page
See Also:
D2WPage.nextPageDelegate()

inspectObjectAction

public WOComponent inspectObjectAction()
Is invoked when the user clicks the inspect button next to an object on the list page. Creates and returns an inspect page for the object.

Returns:
an inspect page for the object chosen from the list page

editObjectAction

public WOComponent editObjectAction()
Is invoked when the user clicks the edit button next to an object on the list page. Creates and returns an inspect page for the object.

Returns:
an inspect page for the object chosen from the list page

deleteObjectAction

public WOComponent deleteObjectAction()
Is invoked when the user clicks the delete button next to an object on the list page. Creates and returns an inspect page for the object.

Returns:
a confirm page for the object chosen from the list page

backAction

public WOComponent backAction()
Is invoked when the user clicks 'Return' in the list page. You can specify custom behavior for this action by overriding the method nextPage. You can also specify custom behavior for this action by overriding the method nextPageDelegate; in this case, the method nextPage is ignored.

Returns:
the next page
See Also:
D2WPage.nextPage(), D2WPage.nextPageDelegate()

backgroundColorForRowMethod

public String backgroundColorForRowMethod()
Contributes to the template method that corresponds to the method backgroundColorForRow.

The implementation is subject to change in future releases.

Returns:
part of the definition of backgroundColorForRow
See Also:
D2WListPage.backgroundColorForRow(), D2WListPage.replacementAssociationForAssociation(WOAssociation, String, DTWTemplate, WOContext)

editingContextDidSaveChanges

public void editingContextDidSaveChanges(NSNotification notif)
Handles notifications when the editing context did save changes.

Parameters:
notif - instance of NSNotification
See Also:
D2WListPage.D2WListPage(WOContext), D2WListPage.appendToResponse(WOResponse, WOContext)

finalize

public void finalize()
              throws Throwable
Overrides:
finalize in class D2WPage
Throws:
Throwable

appendToResponse

public void appendToResponse(WOResponse r,
                             WOContext c)
Fetches on the display group if the editing context did save changes recently.

Overrides:
appendToResponse in class WOComponent
Parameters:
r - instance of WOResponse
c - instance of WOContext
See Also:
D2WListPage.editingContextDidSaveChanges(com.webobjects.foundation.NSNotification), WOComponent.WOComponent(WOContext)

replacementAssociationForAssociation

public WOAssociation replacementAssociationForAssociation(WOAssociation oldAssociation,
                                                          String oldBinding,
                                                          DTWTemplate aTemplate,
                                                          WOContext aContext)
Replaces the following bindings: isListEmpty, d2wContext.propertyKey, d2wContext.justification, d2wContext.displayNameForProperty, object, displayedObjects.

May also replace the bindings showCancel and selectObjectAction.

The implementation is subject to change in future releases.

Specified by:
replacementAssociationForAssociation in interface DTWGeneration
Overrides:
replacementAssociationForAssociation in class D2WPage
Parameters:
oldAssociation - instance of WOAssociation
oldBinding - instance of String
aTemplate - instance of DTWTemplate
aContext - instance of WOContext
Returns:
instance of WOAssociation
See Also:
D2WListPage.isListEmpty(), D2WListPage.setDataSource(EODataSource), D2WListPage.selectObjectAction(), D2WPage.showCancel(), D2WPage.replacementAssociationForAssociation(WOAssociation, String, DTWTemplate, WOContext), D2WComponent.object(), D2WContext.propertyKey(), D2WContext.displayNameForProperty()

Last updated June 2008

Copyright © 2000-2008 Apple Inc.