AjaxGridNavBar Class Reference

Inherits com::webobjects::appserver::WOComponent.

Inherited by AjaxGridExampleNavBar.

Collaboration diagram for AjaxGridNavBar:

Collaboration graph
base refererrect $struct___string.html 33,20 97,44
[legend]

List of all members.

Public Member Functions

 AjaxGridNavBar (WOContext context)
abstract NSArray batchSizes ()
void batchSizeUpdated ()
NSMutableDictionary configurationData ()
String containerID ()
int currentBatchIndex ()
String currentBatchSize ()
WODisplayGroup displayGroup ()
String gridContainerID ()
boolean isStateless ()
void nextBatch ()
void previousBatch ()
void setCurrentBatchIndex (Number newValue)
String tableID ()
String updateBatchSizeName ()
String updateBatchSizeOnChange ()
String updateGridContainer ()

Static Public Attributes

static final String CONFIGURATION_DATA_BINDING = "configurationData"
static final String CONTAINER_ID_BINDING = "containerID"
static final String DISPLAY_GROUP_BINDING = "displayGroup"


Detailed Description

Abstract super class for a navigation bar that can be used with AjaxGrid. Use of this is not mandatory, it is provided as a convenience.

Example Usage

This class has a symbiotic relationship with AjaxGrid. When this nav bar changes the data (e.g. batch size, batch displayed) it updates the grid's container not its own container. It needs to have the grid tell it to update after the grid has refreshed. This allows the AjaxGrid to make any needed changes to the display group before the contents of the nav bar are updated.

  Grid: AjaxGrid {
      configurationData = configData;
      displayGroup = displayGroup;
      afterUpdate = "ajaxGridExampleNavBarUpdate();";
  }

  NavBar: AjaxGridExampleNavBar {
     containerID = "ajaxGridExampleNavBar";
     displayGroup = displayGroup;
     configurationData = configData;
  }
 

Example Sub-class

   <div class="ajaxGridNavBar">
    <webobject name="NavUpdater">
        <table><tr>
          <td style="text-align:left;"><webobject name="PrevBatch"><<</webobject>  
          Page <b><span id="currentBatch"><webobject name="CurrentBatchIndex"/></span></b> of <b><webobject name="BatchCount"/></b>  
          <webobject name="NextBatch">>></webobject>
        </td>
        <td style="text-align:center;">
           Number of lines per page: <webobject name="BatchSizes"/><webobject name="UpdateBatchSize"/>
        </td>
        <td style="text-align:right;">
          Displaying <b><webobject name="FirstIndex"/></b> to <b><webobject name="LastIndex"/></b> of <b><webobject name="TotalCount"/></b> entries.
        </td></tr></table>
        <webobject name="BatchSlider"/>
    </webobject name="NavUpdater">
  </div>
 

  NavUpdater: AjaxUpdateContainer {
     id = containerID;
  }

  BatchCount: WOString {
      value = displayGroup.batchCount;
  }

  BatchSlider: AjaxSlider {
     orientation = "horizontal";
     value = currentBatchIndex;
     minimum = 1;
     maximum = displayGroup.batchCount;
     onChangeServer = updateGridContainer;
     onSlide = "function(v) { $('currentBatch').innerHTML = Math.round(v) }";
     onChange = "function(v) { $('currentBatch').innerHTML = Math.round(v) }";
  }

  CurrentBatchIndex : WOString {
     value = displayGroup.currentBatchIndex;
  }

  PrevBatch : AjaxUpdateLink {
     action = previousBatch;
     updateContainerID = gridContainerID;
  }

  NextBatch : AjaxUpdateLink {
     action = nextBatch;
     updateContainerID = gridContainerID;
  }

  BatchSizes: WOPopUpButton {
     list      = batchSizes;
     item      = batchSize;
     selection = currentBatchSize;
     onChange  = updateBatchSizeOnChange;
  }

  FirstIndex: WOString {
    value = displayGroup.indexOfFirstDisplayedObject;
  }

  LastIndex: WOString {
     value = displayGroup.indexOfLastDisplayedObject;
  }

  TotalCount: WOString {
     value = displayGroup.allObjects.count;
  }

  UpdateBatchSize: AjaxUpdateLink {
    action = batchSizeUpdated;
    functionName = updateBatchSizeName;
    updateContainerID = gridContainerID;
 }
 

displayGroup the same WODisplayGroup passed to AjaxGrid configurationData the same NSMutableDictionary passed to AjaxGrid containerID unique ID for the AjaxUpdateContainer in this component.

Author:
Chuck Hill

Constructor & Destructor Documentation

AjaxGridNavBar ( WOContext  context  ) 


Member Function Documentation

abstract NSArray batchSizes (  )  [pure virtual]

Returns:
the list of batch sizes to show in the popup

Implemented in AjaxGridExampleNavBar.

void batchSizeUpdated (  ) 

Ajax action method for updates to batch size. Grabs batch size from request and updates configuration.

NSMutableDictionary configurationData (  ) 

Returns:
value bound to configurationData

String containerID (  ) 

Returns:
value bound to containerID

int currentBatchIndex (  ) 

Returns:
value for AjaxSlider

String currentBatchSize (  ) 

Returns:
displayGroup().numberOfObjectsPerBatch() as a String for the option input

WODisplayGroup displayGroup (  ) 

Returns:
value bound to displayGroup

String gridContainerID (  ) 

Returns:
UPDATE_CONTAINER_ID from configurationData(), the update container ID from the AjaxGrid

boolean isStateless (  ) 

Returns:
false, AjaxGridNavBar is stateless and manually synchronized

void nextBatch (  ) 

Ajax action method to select the next batch.

void previousBatch (  ) 

Ajax action method to select the previous batch.

void setCurrentBatchIndex ( Number  newValue  ) 

Intended to be bound to Ajax slider or selection of batch to display.

Parameters:
newValue new batch number from AjaxSlider

String tableID (  ) 

Returns:
TABLE_ID from configurationData(), the table ID from the AjaxGrid

String updateBatchSizeName (  ) 

Returns:
unique name for the AjaxUpdateContainer wrapping this AjaxGridNavBar

String updateBatchSizeOnChange (  ) 

Returns:
JavaScript for option control to pass selected batch size when changed

String updateGridContainer (  ) 

Returns JavaScript to update the AjaxUpdateContainer identified by gridContainerID(). This is intended for use as onChangeServer binding for a AjaxSlider.

Returns:
JavaScript calls to update the Ajax grid


Member Data Documentation

final String CONFIGURATION_DATA_BINDING = "configurationData" [static]

final String CONTAINER_ID_BINDING = "containerID" [static]

final String DISPLAY_GROUP_BINDING = "displayGroup" [static]


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

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