WebObjects 5.3

com.webobjects.directtoweb
Class D2WListPage

java.lang.Object
  extended bycom.webobjects.appserver.WOElement
      extended bycom.webobjects.appserver.WOComponent
          extended bycom.webobjects.directtoweb.D2WComponent
              extended bycom.webobjects.directtoweb.D2WPage
                  extended bycom.webobjects.directtoweb.D2WListPage
All Implemented Interfaces:
Cloneable, com.webobjects.directtoweb.generation.DTWGeneration, ListPageInterface, NSKeyValueCoding, NSKeyValueCoding.ErrorHandling, NSKeyValueCodingAdditions, NSValidation, SelectPageInterface, Serializable, WOActionResults
Direct Known Subclasses:
BASListPage, D2WPlainListPage, NEUListPage, WOLListPage

public class D2WListPage
extends D2WPage
implements com.webobjects.directtoweb.generation.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 inherited from class com.webobjects.appserver.WOComponent
WOComponent.Event
 
Nested classes inherited from class com.webobjects.foundation.NSKeyValueCoding
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.DefaultImplementation, NSValidation.Utility, NSValidation.ValidationException
 
Field Summary
 
Fields inherited from class com.webobjects.directtoweb.D2WComponent
currentObjectKey
 
Fields inherited from interface com.webobjects.foundation.NSKeyValueCoding
NullValue
 
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, com.webobjects.directtoweb.generation.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, sleep, synchronizesVariablesWithBindings, takeValueForKey, takeValueForKeyPath, takeValuesFromRequest, template, templateWithHTMLString, templateWithName, toString, unableToSetNullForKey, validateTakeValueForKeyPath, validateValueForKey, validationFailedWithException, valueForBinding, valueForKey, valueForKeyPath
 
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:
editingContextDidSaveChanges(NSNotification), D2WPage.D2WPage(WOContext), NSNotificationCenter
Method Detail

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

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:
editingContextDidSaveChanges(com.webobjects.foundation.NSNotification), WOComponent.WOComponent(WOContext)

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

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:
displayGroup(), alternatingColorForRow(), D2WComponent.task(), D2WComponent.object()

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:
backgroundColorForRow(), replacementAssociationForAssociation(WOAssociation, String, DTWTemplate, WOContext)

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

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

displayGroup

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

Returns:
instance of WODisplayGroup

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

editingContextDidSaveChanges

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

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

finalize

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

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

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

isListEmpty

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

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

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

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

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:
displayGroup(), D2WComponent.d2wContext()

replacementAssociationForAssociation

public WOAssociation replacementAssociationForAssociation(WOAssociation oldAssociation,
                                                          String oldBinding,
                                                          com.webobjects.directtoweb.generation.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 com.webobjects.directtoweb.generation.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:
isListEmpty(), setDataSource(EODataSource), selectObjectAction(), D2WPage.showCancel(), D2WPage.replacementAssociationForAssociation(WOAssociation, String, DTWTemplate, WOContext), D2WComponent.object(), D2WContext.propertyKey(), D2WContext.displayNameForProperty()

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

selectedObject

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

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

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

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
Overrides:
setDataSource in class D2WPage
Parameters:
dataSource - instance of EODataSource
See Also:
D2WPage.setDataSource(com.webobjects.eocontrol.EODataSource), displayGroup()

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:
displayGroup(), numberOfObjectsPerBatch(), defaultSortKey()

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

Last updated Thu May 26 13:46:12 PDT 2005.

Copyright © 2005 Apple Computer, Inc.