Project Wonder 5.0.0.8658

er.ajax
Class AjaxGrid

java.lang.Object
  extended by com.webobjects.appserver.WOElement
      extended by com.webobjects.appserver.WOComponent
          extended by er.ajax.AjaxGrid
All Implemented Interfaces:
WOActionResults, NSKeyValueCoding, NSKeyValueCoding.ErrorHandling, NSKeyValueCodingAdditions, NSValidation, Serializable, Cloneable

public class AjaxGrid
extends WOComponent

Ajax powered grid based on HTML Table that provides drag and drop column re-ordering, complex sorting, and the ability to embed components in cells. Class names and spans are used extensively to allow the display to be heavily customized with CSS.

The data is taken from a WODisplayGroup. Use er.extensions.ERXBatchingDisplayGroup to provide high performance access to large data sets.

Navigation between batches is not implemented as implementing in it another component bound to the display group will allow for a more flexible UI.

Configuration

Configuration is provided by an NSMutableDictionary and NSMutableArray data structure. This reduces the number of bindings, eases keeping related lists of information in synch, and provides an easy path for serializing a user's customizations to configuration for persistent storage. Described as a plist, the format of the configuration information is:
   {
        tableID = "exampleAjaxGrid";                // Goes on main table tag
        updateContainerID = "ajaxGridContainer";    // Goes on div wrapping table, used with AjaxUpdate* components
        updateFrequency = 60;                                 // Optional frequency of automatic updates of the grid contents
                                                              // This function uses the Ajax.PeriodicalUpdater which does an
                                                              // update when it is first created, rather than waiting for the 
                                                              // frequency time before making the first request
        cssClass = "ajaxGrid";                      // CSS class attribute on main table tag, optional
        cssStyle = "border: thin solid #000000;";   // CSS style attribute on main table tag, optional
        evenRowCSSClass = "yellowBackground";       // CSS class attribute on even rows, optional
        oddRowCSSClass = "greyBackground";          // CSS class attribute on odd rows, optional
        evenRowCSSStyle = "background:lightyellow;" // CSS style attribute on even rows, optional
        oddRowCSSStyle = "background:lightgrey;";   // CSS style attribute on odd rows, optional
        selectedRowCSSClass = "yellowBackground";   // Secondary CSS class attribute on selected rows, optional
        unselectedRowCSSClass = "greyBackground";   // Secondary CSS class attribute on unselected rows, optional
        selectedRowCSSStyle = "background:lightyellow;"; // Secondary CSS style attribute on selected rows, optional
        unselectedRowCSSStyle = "background:lightgrey;";// Secondary CSS style attribute on unselected rows, optional
        canReorder = true;                                    // Enables (or disables) drag and drop reordering of columns
        dragHeaderOnly = true;                                // Optional, defaults to false, true if only the title/header cells can
                                                              // be dragged to re-order columns
        batchSize = 10;                                       // Controls size of batch in display group, use zero for no batching
        rowIdentifier = adKey;                                // Optional, key path into row returning a unique identifier for the row 
                                                              // rowIdentifier is used to build HTML ID attributes, so a String or Number works best
        
  
        columns = (                                           // List of columns to display, controls the initial display order
            {
                title = "Name";                     // Title for this column in the table header row
                keyPath = "fullName";               // Key path into row returning the data to display in this colunmn
            },                                                // keyPath is optional if component is specified
            {
                title = "Department";
                keyPath = "department.name";
                sortPath = "department.code";       // sortPath is an optional path to sort this column on, defaults to keyPath
                                                              // This is useful if keyPath points to something that can't be sorted or a
                                                              // different sort order is need, e.g. here by Department Code rather than name.
                                                              // It can also be used when component is used to provide a sorting for the column
            },
            {
                title = "Hire Date";
                keyPath = "hireDate";
                formatterClass = "com.webobjects.foundation.NSTimestampFormatter"; // Class of formatter to apply to values in this column
                formatPattern = "%m/%d/%y";         // Optional pattern if needed by formatter
            },
            {
                title = "Salary";
                keyPath = "salary";
                formatterClass = "com.webobjects.foundation.NSNumberFormatter";
                formatPattern = "$###,##0.00";
                cssClass = "alignRight";            // CSS class attribute td tag in this column, optional
            },
            {
                title = "Vacation Days";
                keyPath = "daysVacation";
                formatterClass = "com.webobjects.foundation.NSNumberFormatter";
                cssStyle = "text-align: right;";    // CSS style attribute td tag in this column, useful for text-align and width, optional
            },
            {
                title =  "Actions";
                keyPath = "";                       // Missing or empty keypath results in the current object itself being passed to component
                component = "EmployeeActions";      // Name of WOComponent to be displayed in this column.  Gets passed two bindings: value (Object), 
                                                              // and grid (AjaxGrid) so that any other needed data can be accessed
                cssClass = "alignCenter";
            }
        );
        sortOrder = (
            {
                keyPath = "department.code";        // If the related column definition uses sortPath, this keyPath should match it
                                                              // This was left as keyPath (rather than sortPath) for backwards compatibility
                direction = "ascending";
            },
            {
                keyPath = "salary";
                direction = "descending";
            },
            {
                keyPath = "daysVacation";
                direction = "ascending";
            }
      );
  
  }
 

Initializing Configuration From a File

You can get the configuration information from a plist file with code like this:
 public NSMutableDictionary configData() {
        if (configData == null) {
                // Get data from user preferences here if available, otherwise load the defaults
                configData = mySession().user().preferencesFor("AjaxGridExample");
                if (configData == null) {
                        NSData data = new NSData(application().resourceManager().bytesForResourceNamed("AjaxGridExampleConfiguration.plist", null, NSArray.EmptyArray));
                        configData = new NSMutableDictionary((NSDictionary) NSPropertyListSerialization.propertyListFromData(data, "UTF-8"));
                }
        }
 
        return configData;
 }
 

Updating the Grid From a Different Component

When the grid contents are updated the AjaxUpdateContainer needs to be updated. The grid configuration updateContainerID gives the ID for this. This can be used as the updateContainerID in a AjaxUpdateLink or <updateContainerID>Update() can be called directly. This results in a call to ajaxGrid_init('<tableID>'); to be re-enable drag and drop on the table.

Here is an example. In this example, updateContainerID is used to update the grid, and then the NavBar container is updated manually from onComplete. The reason for this is that the grid needs to update first so that the correct values are available for updating the NavBar.

Relevant Configuration:

   {
      tableID = "exampleAjaxGrid";
      updateContainerID = "ajaxGridContainer";
      . . .
 
WOD Bindings:
   NavUpdater: AjaxUpdateContainer {
       id = "NavBar";
   }
   
   NextBatch : AjaxUpdateLink {
       action = nextBatch;
       updateContainerID = "ajaxGridContainer";
       onComplete = "function(request) { NavBarUpdate(); }";
   }
 

CSS Classes Used by AjaxGrid

In addition to the classes defined in the grid configuration, AjaxGrid uses some set class names:
Class Name Used For
ajaxGridRemoveSorting The th of cell containing link to remove all sorting
ajaxGridColumnTitle The th of cells containing column titles
ajaxGridSortAscending The span that wraps index and direction indicator of columns sorted in ascending order
ajaxGridSortDescending The span that wraps index and direction indicator of columns sorted in descending order
ajaxGridSelectRow The td of cells containing the row selection link
Advanced Styling of the Grid The grid contains several places were there are nested anonymous span tags wrapping default text content. These are there so that the span wrapping the default content can be set to display: none and the content of the outer div given in CSS. For this HTML:
   <th class="ajaxGridRemoveSorting"><span>X</span><em>&nbsp;</em></th>
 
The default X can replaced with an image with this CSS:
   th.ajaxGridRemoveSorting a span {display: none;}
   th.ajaxGridRemoveSorting a  em {     
      background-image: url(http://vancouver.global-village.net/WebObjects/Frameworks/JavaDirectToWeb.framework/WebServerResources/trashcan-btn.gif);
      background-repeat:no-repeat;
      padding-right: 12px;
      padding-bottom: 5px;
   }
 
You can also use content to replace the span content with text if your browser (not IE) supports it.

Updating the Configuration

If you update the configuration after the grid has been displayed, some items will not update as the information is cached. Add a value under the key AjaxGrid.CONFIGURATION_UPDATED to notify the grid to discard the cached information. The grid will remove the value under this key after it has cleared the cache.

To Do

Author:
chill
See Also:
Serialized Form
Bindings
displayGroup required, WODisplayGroup acting as source and batching engine for the data to be displayed
           
configurationData required, NSMutableDictionary used to configure grid, see documentation for details
           
selectedObjects optional, NSMutableArray list of rows that the user has selected from the grid
           
willUpdate optional, Ajax action method called when the AjaxUpdateContainer is being updated, but before it renders its content
           
afterUpdate optional, JavaScript to execute client-side after the grid has updated
           

Nested Class Summary
 
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
static String AFTER_UPDATE_BINDING
           
static String BATCH_SIZE
           
static String CAN_REORDER
           
static String COLUMNS
           
static String COMPONENT_NAME
           
static String CONFIGURATION_DATA_BINDING
           
static String CONFIGURATION_UPDATED
           
static String DESTINATION_COLUMN_FORM_VALUE
           
static String DISPLAY_GROUP_BINDING
           
static String DRAG_HEADER_ONLY
           
static String EVEN_ROW_CSS_CLASS
           
static String EVEN_ROW_CSS_STYLE
           
static String FORMAT_PATTERN
           
static String FORMATTER_CLASS
           
static String KEY_PATH
           
static String ODD_ROW_CSS_CLASS
           
static String ODD_ROW_CSS_STYLE
           
static String ROW_IDENTIFIER
           
static String SELECTED_OBJECTS_BINDING
           
static String SELECTED_ROW_CSS_CLASS
           
static String SELECTED_ROW_CSS_STYLE
           
static String SORT_ASCENDING
           
static String SORT_DESCENDING
           
static String SORT_DIRECTION
           
static String SORT_ORDER
           
static String SORT_PATH
           
static String SOURCE_COLUMN_FORM_VALUE
           
static String TABLE_ID
           
static String TITLE
           
static String UNSELECTED_ROW_CSS_CLASS
           
static String UNSELECTED_ROW_CSS_STYLE
           
static String UPDATE_CONTAINER_ID
           
static String UPDATE_FREQUENCY
           
static String WILL_UPDATE_BINDING
           
 
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
AjaxGrid(WOContext context)
           
 
Method Summary
 String afterUpdate()
          Binding value for onRefreshComplete function of AjaxUpdate container.
 void appendToResponse(WOResponse response, WOContext context)
          Adds movecolumns.js to the header.
protected  int batchSize()
          Returns BATCH_SIZE value from configurationData()
 boolean canReorder()
          Returns CAN_REORDER value from configurationData()
protected  void clearCachedConfiguration()
          Clears local cache of configuration data so that fresh data will be cached.
 String columnComponentName()
           
 Format columnFormatter()
           
 void columnOrderUpdated()
          Ajax action method for when columns are dragged and dropped.
protected  NSMutableArray columns()
          Returns COLUMNS value from configurationData()
 NSMutableDictionary columnsByKeypath()
           
 Object columnValue()
           
 NSMutableDictionary configurationData()
           
 void containerUpdated()
          This method is called when the AjaxUpdateContainer is about to update.
 NSDictionary currentColumn()
          Cover method for item binding of a WORepetition.
 String currentColumnID()
           
 int currentColumnSortIndex()
           
 NSMutableDictionary currentColumnSortOrder()
           
 String currentKeyPath()
           
 String currentSortPath()
           
 WODisplayGroup displayGroup()
           
 String dragHeaderOnly()
           
 String enableDragAndDrop()
          Returns Javacript to (re)initialize drag and drop on the grid.
 NSMutableDictionary formattersByKeypath()
           
 String initScript()
          Script that goes on this page to initialize drag and drop on the grid when the page loads / re-loads
 boolean isCurrentColumnSorted()
           
 boolean isCurrentColumnSortedAscending()
           
 boolean isRowSelected()
           
 void removeSorting()
          Ajax action method for when control clicked to remove all sorting.
 String removeSortingID()
           
 NSKeyValueCodingAdditions row()
          Cover method for item binding of a WORepetition.
 String rowClass()
          Returns EVEN_ROW_CSS_CLASS or ODD_ROW_CSS_CLASS, depending on rowIndex(), value from configurationData() followed by SELECTED_ROW_CSS_CLASS or UNSELECTED_ROW_CSS_CLASS, depending on isRowSelected(), value from configurationData()
 String rowID()
          Returns a value suitable for use as part of an HTML ID attribute that uniquely identifies this row.
 String rowIdentifier()
          Returns an optional key path into row that will return a value that uniquely identifies this row.
 int rowIndex()
          Cover method for index binding of a WORepetition.
 String rowStyle()
          Returns EVEN_ROW_CSS_STYLE or ODD_ROW_CSS_STYLE, depending on rowIndex(), value from configurationData() folowed by SELECTED_ROW_CSS_STYLE or UNSELECTED_ROW_CSS_STYLE, depending on isRowSelected(), value from configurationData()
 NSMutableArray selectedObjects()
          This list is implemented by AjaxGrid and is not based on the display group's selected objects.
 void setColumnValue(Object value)
          Method used with automatic synchronizing custom components.
 void setCurrentColumn(NSDictionary newColumn)
          Cover method for item binding of a WORepetition.
 void setRow(NSKeyValueCodingAdditions newRow)
          Cover method for item binding of a WORepetition.
 void setRowIndex(int index)
          Cover method for index binding of a WORepetition.
protected  NSMutableArray sortOrders()
          Returns SORT_ORDER value from configurationData()
 NSMutableDictionary sortOrdersByKeypath()
           
 void sortOrderUpdated()
          Ajax action method for when column titles are clicked to change sorting.
 boolean synchronizesVariablesWithBindings()
           
 String tableID()
          Returns TABLE_ID value from configurationData()
 AjaxGrid thisComponent()
           
 void toggleRowSelection()
          Toggles inclusion of row into selectedObjects() (i.e.
 String toggleRowSelectionID()
           
protected  void updateDisplayGroupSort()
          Updates sort orders on the display group
 
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, awake, baseURL, bindingKeys, canAccessFieldsDirectly, canGetValueForBinding, canSetValueForBinding, clone, context, debugString, descriptionForResponse, 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, takeValueForKey, takeValueForKeyPath, takeValuesFromRequest, template, templateWithHTMLString, templateWithHTMLString, templateWithName, toString, unableToSetNullForKey, validateTakeValueForKeyPath, validateValueForKey, validationFailedWithException, valueForBinding, valueForBooleanBinding, valueForIntegerBinding, valueForKey, valueForKeyPath, valueForNSArrayBindings, valueForNSDictionaryBindings, valueForNumberBinding, valueForStringBinding
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

TITLE

public static final String TITLE
See Also:
Constant Field Values

KEY_PATH

public static final String KEY_PATH
See Also:
Constant Field Values

SORT_PATH

public static final String SORT_PATH
See Also:
Constant Field Values

SORT_DIRECTION

public static final String SORT_DIRECTION
See Also:
Constant Field Values

SORT_ASCENDING

public static final String SORT_ASCENDING
See Also:
Constant Field Values

SORT_DESCENDING

public static final String SORT_DESCENDING
See Also:
Constant Field Values

SORT_ORDER

public static final String SORT_ORDER
See Also:
Constant Field Values

COLUMNS

public static final String COLUMNS
See Also:
Constant Field Values

BATCH_SIZE

public static final String BATCH_SIZE
See Also:
Constant Field Values

UPDATE_CONTAINER_ID

public static final String UPDATE_CONTAINER_ID
See Also:
Constant Field Values

TABLE_ID

public static final String TABLE_ID
See Also:
Constant Field Values

ROW_IDENTIFIER

public static final String ROW_IDENTIFIER
See Also:
Constant Field Values

CAN_REORDER

public static final String CAN_REORDER
See Also:
Constant Field Values

DRAG_HEADER_ONLY

public static final String DRAG_HEADER_ONLY
See Also:
Constant Field Values

SOURCE_COLUMN_FORM_VALUE

public static final String SOURCE_COLUMN_FORM_VALUE
See Also:
Constant Field Values

DESTINATION_COLUMN_FORM_VALUE

public static final String DESTINATION_COLUMN_FORM_VALUE
See Also:
Constant Field Values

FORMATTER_CLASS

public static final String FORMATTER_CLASS
See Also:
Constant Field Values

FORMAT_PATTERN

public static final String FORMAT_PATTERN
See Also:
Constant Field Values

EVEN_ROW_CSS_CLASS

public static final String EVEN_ROW_CSS_CLASS
See Also:
Constant Field Values

ODD_ROW_CSS_CLASS

public static final String ODD_ROW_CSS_CLASS
See Also:
Constant Field Values

EVEN_ROW_CSS_STYLE

public static final String EVEN_ROW_CSS_STYLE
See Also:
Constant Field Values

ODD_ROW_CSS_STYLE

public static final String ODD_ROW_CSS_STYLE
See Also:
Constant Field Values

SELECTED_ROW_CSS_CLASS

public static final String SELECTED_ROW_CSS_CLASS
See Also:
Constant Field Values

UNSELECTED_ROW_CSS_CLASS

public static final String UNSELECTED_ROW_CSS_CLASS
See Also:
Constant Field Values

SELECTED_ROW_CSS_STYLE

public static final String SELECTED_ROW_CSS_STYLE
See Also:
Constant Field Values

UNSELECTED_ROW_CSS_STYLE

public static final String UNSELECTED_ROW_CSS_STYLE
See Also:
Constant Field Values

CONFIGURATION_UPDATED

public static final String CONFIGURATION_UPDATED
See Also:
Constant Field Values

COMPONENT_NAME

public static final String COMPONENT_NAME
See Also:
Constant Field Values

UPDATE_FREQUENCY

public static final String UPDATE_FREQUENCY
See Also:
Constant Field Values

DISPLAY_GROUP_BINDING

public static final String DISPLAY_GROUP_BINDING
See Also:
Constant Field Values

CONFIGURATION_DATA_BINDING

public static final String CONFIGURATION_DATA_BINDING
See Also:
Constant Field Values

SELECTED_OBJECTS_BINDING

public static final String SELECTED_OBJECTS_BINDING
See Also:
Constant Field Values

WILL_UPDATE_BINDING

public static final String WILL_UPDATE_BINDING
See Also:
Constant Field Values

AFTER_UPDATE_BINDING

public static final String AFTER_UPDATE_BINDING
See Also:
Constant Field Values
Constructor Detail

AjaxGrid

public AjaxGrid(WOContext context)
Method Detail

synchronizesVariablesWithBindings

public boolean synchronizesVariablesWithBindings()
Overrides:
synchronizesVariablesWithBindings in class WOComponent
Returns:
false, AjaxGrid is manually synchronized

appendToResponse

public void appendToResponse(WOResponse response,
                             WOContext context)
Adds movecolumns.js to the header.

Overrides:
appendToResponse in class WOComponent

columnOrderUpdated

public void columnOrderUpdated()
Ajax action method for when columns are dragged and dropped. Updates configurationData().


sortOrderUpdated

public void sortOrderUpdated()
Ajax action method for when column titles are clicked to change sorting. Updates configurationData() and displayGroup().


removeSorting

public void removeSorting()
Ajax action method for when control clicked to remove all sorting. Updates configurationData() and displayGroup().


removeSortingID

public String removeSortingID()
Returns:
ID to be used on AjaxUpdateLink bound to removeSorting()

containerUpdated

public void containerUpdated()
This method is called when the AjaxUpdateContainer is about to update. It invokes the willUpdate action binding, if set, and discards the result.


initScript

public String initScript()
Script that goes on this page to initialize drag and drop on the grid when the page loads / re-loads

Returns:
JavaScript to initialize drag and drop on the grid

dragHeaderOnly

public String dragHeaderOnly()
Returns:
the value for the DRAG_HEADER_ONLY configuration item with a default of false

afterUpdate

public String afterUpdate()
Binding value for onRefreshComplete function of AjaxUpdate container. Returns the value from the AFTER_UPDATE_BINDING followed by enableDragAndDrop().

Returns:
value for AFTER_UPDATE_BINDING concatenated with enableDragAndDrop()

enableDragAndDrop

public String enableDragAndDrop()
Returns Javacript to (re)initialize drag and drop on the grid.

Returns:
ajaxGrid_init(TABLE);

configurationData

public NSMutableDictionary configurationData()
Returns:
the configurationData

clearCachedConfiguration

protected void clearCachedConfiguration()
Clears local cache of configuration data so that fresh data will be cached.


canReorder

public boolean canReorder()
Returns CAN_REORDER value from configurationData()

Returns:
true if column re-ordering is enabled

tableID

public String tableID()
Returns TABLE_ID value from configurationData()

Returns:
HTML ID for implementing the grid

rowIdentifier

public String rowIdentifier()
Returns an optional key path into row that will return a value that uniquely identifies this row. This should be suitable for use as part of an HTML ID attribute.

Returns:
an optional key path into row that will return a value that uniquely identifies this row

columns

protected NSMutableArray columns()
Returns COLUMNS value from configurationData()

Returns:
list of configuration for the columns to display in the grid

sortOrders

protected NSMutableArray sortOrders()
Returns SORT_ORDER value from configurationData()

Returns:
list of sort orders controlling display of data in the grid

batchSize

protected int batchSize()
Returns BATCH_SIZE value from configurationData()

Returns:
batch size for the display grid

rowClass

public String rowClass()
Returns EVEN_ROW_CSS_CLASS or ODD_ROW_CSS_CLASS, depending on rowIndex(), value from configurationData() followed by SELECTED_ROW_CSS_CLASS or UNSELECTED_ROW_CSS_CLASS, depending on isRowSelected(), value from configurationData()

Returns:
CSS class for this row

rowStyle

public String rowStyle()
Returns EVEN_ROW_CSS_STYLE or ODD_ROW_CSS_STYLE, depending on rowIndex(), value from configurationData() folowed by SELECTED_ROW_CSS_STYLE or UNSELECTED_ROW_CSS_STYLE, depending on isRowSelected(), value from configurationData()

Returns:
CSS class for this row

rowID

public String rowID()
Returns a value suitable for use as part of an HTML ID attribute that uniquely identifies this row. If rowIdentifier() is set, used row().valueForKeyPath(rowIdentifier()), otherwise uses "row_" and the index of the row in the list of objects.

Returns:
a value suitable for use as part of an HTML ID attribute that uniquely identifies this row

columnsByKeypath

public NSMutableDictionary columnsByKeypath()
Returns:
dictionary of columns() keyed on KEY_PATH of column

sortOrdersByKeypath

public NSMutableDictionary sortOrdersByKeypath()
Returns:
dictionary of sortOrders() keyed on KEY_PATH of column

formattersByKeypath

public NSMutableDictionary formattersByKeypath()
Returns:
dictionary of formatters for columns() keyed on KEY_PATH of column

updateDisplayGroupSort

protected void updateDisplayGroupSort()
Updates sort orders on the display group


displayGroup

public WODisplayGroup displayGroup()
Returns:
the displayGroup

currentColumnID

public String currentColumnID()
Returns:
ID to be used on AjaxUpdateLink bound to sortOrderUpdated() for currentColumn()

isCurrentColumnSorted

public boolean isCurrentColumnSorted()
Returns:
true if currentColumn() is part of the sort ordering

currentColumnSortOrder

public NSMutableDictionary currentColumnSortOrder()
Returns:
the sort order dictionary for currentColumn() or null if ! isCurrentColumnSorted()

isCurrentColumnSortedAscending

public boolean isCurrentColumnSortedAscending()
Returns:
true if currentColumn() is part of the sort ordering and is being sorted in ascending order

currentColumnSortIndex

public int currentColumnSortIndex()
Returns:
the index (1 based) of this columns precedence in sorting or -1 if it is not part of the sort order

columnValue

public Object columnValue()
Returns:
the value from row() corresponding to currentColumn(), formatted as configured

setColumnValue

public void setColumnValue(Object value)
Method used with automatic synchronizing custom components.

Parameters:
value - new value for row() in this column

columnFormatter

public Format columnFormatter()
Returns:
the value from row() corresponding to currentColumn()

currentKeyPath

public String currentKeyPath()
Returns:
the keyPath value from currentColumn()

currentSortPath

public String currentSortPath()
Returns:
the sortPath value from currentColumn() or currentKeyPath() if not found

columnComponentName

public String columnComponentName()
Returns:
the name of the WOComponent to use to display the value from currentColumn()

selectedObjects

public NSMutableArray selectedObjects()
This list is implemented by AjaxGrid and is not based on the display group's selected objects. The list of selected objects is maintained across all batches.

Returns:
list of user selected objects

toggleRowSelection

public void toggleRowSelection()
Toggles inclusion of row into selectedObjects() (i.e. selects and de-selects it).


toggleRowSelectionID

public String toggleRowSelectionID()
Returns:
ID to be used on AjaxUpdateLink bound to toggleRowSelection()

isRowSelected

public boolean isRowSelected()
Returns:
true if row() is in selectedObjects()

currentColumn

public NSDictionary currentColumn()
Cover method for item binding of a WORepetition.

Returns:
the current column being rendered

setCurrentColumn

public void setCurrentColumn(NSDictionary newColumn)
Cover method for item binding of a WORepetition.

Parameters:
newColumn - current column being rendered

row

public NSKeyValueCodingAdditions row()
Cover method for item binding of a WORepetition.

Returns:
the current row being rendered

setRow

public void setRow(NSKeyValueCodingAdditions newRow)
Cover method for item binding of a WORepetition.

Parameters:
newRow - current row being rendered

rowIndex

public int rowIndex()
Cover method for index binding of a WORepetition.

Returns:
index of the current row being rendered

setRowIndex

public void setRowIndex(int index)
Cover method for index binding of a WORepetition.

Parameters:
index - inded of current row being rendered

thisComponent

public AjaxGrid thisComponent()
Returns:
this component so that it can be used in bindings

Last updated: Fri, Nov 21, 2008 • 04:36 AM EST

Copyright © 2002 – 2007 Project Wonder.