Project Wonder 5.0

er.ajax
Class AjaxGridNavBar

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

public abstract class AjaxGridNavBar
extends com.webobjects.appserver.WOComponent

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;
 }
 

See Also:
Serialized Form
Author:
Chuck Hill
Bindings
displayGroup the same WODisplayGroup passed to AjaxGrid
           
configurationData the same NSMutableDictionary passed to AjaxGrid
           
containerID unique ID for the AjaxUpdateContainer in this component.
           

Nested Class Summary
 
Nested classes/interfaces inherited from class com.webobjects.appserver.WOComponent
com.webobjects.appserver.WOComponent._EventLoggingEnabler, com.webobjects.appserver.WOComponent.Event
 
Nested classes/interfaces inherited from interface com.webobjects.foundation.NSKeyValueCodingAdditions
com.webobjects.foundation.NSKeyValueCodingAdditions.DefaultImplementation, com.webobjects.foundation.NSKeyValueCodingAdditions.Utility
 
Nested classes/interfaces inherited from interface com.webobjects.foundation.NSKeyValueCoding
com.webobjects.foundation.NSKeyValueCoding._BooleanFieldBinding, com.webobjects.foundation.NSKeyValueCoding._BooleanMethodBinding, com.webobjects.foundation.NSKeyValueCoding._FieldBinding, com.webobjects.foundation.NSKeyValueCoding._ForwardingBinding, com.webobjects.foundation.NSKeyValueCoding._KeyBinding, com.webobjects.foundation.NSKeyValueCoding._KeyBindingCreation, com.webobjects.foundation.NSKeyValueCoding._MethodBinding, com.webobjects.foundation.NSKeyValueCoding._NumberFieldBinding, com.webobjects.foundation.NSKeyValueCoding._NumberMethodBinding, com.webobjects.foundation.NSKeyValueCoding._ReflectionKeyBindingCreation, com.webobjects.foundation.NSKeyValueCoding.ErrorHandling, com.webobjects.foundation.NSKeyValueCoding.Null, com.webobjects.foundation.NSKeyValueCoding.UnknownKeyException, com.webobjects.foundation.NSKeyValueCoding.ValueAccessor
 
Nested classes/interfaces inherited from interface com.webobjects.foundation.NSValidation
com.webobjects.foundation.NSValidation._MethodBinding, com.webobjects.foundation.NSValidation._ValidationBinding, com.webobjects.foundation.NSValidation.DefaultImplementation, com.webobjects.foundation.NSValidation.Utility, com.webobjects.foundation.NSValidation.ValidationException
 
Field Summary
static java.lang.String CONFIGURATION_DATA_BINDING
           
static java.lang.String CONTAINER_ID_BINDING
           
static java.lang.String DISPLAY_GROUP_BINDING
           
 
Fields inherited from class com.webobjects.appserver.WOComponent
_Extension, _IsEventLoggingEnabled, _keyAssociations
 
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.NSKeyValueCoding
NullValue
 
Fields inherited from interface com.webobjects.foundation.NSValidation
_CLASS
 
Constructor Summary
AjaxGridNavBar(com.webobjects.appserver.WOContext context)
           
 
Method Summary
abstract  com.webobjects.foundation.NSArray batchSizes()
           
 void batchSizeUpdated()
          Ajax action method for updates to batch size.
 com.webobjects.foundation.NSMutableDictionary configurationData()
           
 java.lang.String containerID()
           
 int currentBatchIndex()
           
 java.lang.String currentBatchSize()
           
 com.webobjects.appserver.WODisplayGroup displayGroup()
           
 java.lang.String gridContainerID()
           
 boolean isStateless()
           
 void nextBatch()
          Ajax action method to select the next batch.
 void previousBatch()
          Ajax action method to select the previous batch.
 void setCurrentBatchIndex(java.lang.Number newValue)
          Intended to be bound to Ajax slider or selection of batch to display.
 java.lang.String tableID()
           
 java.lang.String updateBatchSizeName()
           
 java.lang.String updateBatchSizeOnChange()
           
 java.lang.String updateGridContainer()
          Returns JavaScript to update the AjaxUpdateContainer identified by gridContainerID().
 
Methods inherited from class com.webobjects.appserver.WOComponent
_associationWithName, _awakeInContext, _childTemplate, _componentDefinition, _componentUnroll, _isPage, _setContext, _setIsPage, _setParent, _setSubcomponent, _sleepInContext, _subcomponentForElementWithID, _templateNameForClass, _unroll, appendToResponse, application, awake, baseURL, bindingKeys, canAccessFieldsDirectly, canGetValueForBinding, canSetValueForBinding, clone, context, debugString, descriptionForResponse, ensureAwakeInContext, frameworkName, generateResponse, handleQueryWithUnboundKey, handleTakeValueForUnboundKey, hasBinding, hasSession, invokeAction, isCachingEnabled, isEventLoggingEnabled, 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, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

CONTAINER_ID_BINDING

public static final java.lang.String CONTAINER_ID_BINDING
See Also:
Constant Field Values

DISPLAY_GROUP_BINDING

public static final java.lang.String DISPLAY_GROUP_BINDING
See Also:
Constant Field Values

CONFIGURATION_DATA_BINDING

public static final java.lang.String CONFIGURATION_DATA_BINDING
See Also:
Constant Field Values
Constructor Detail

AjaxGridNavBar

public AjaxGridNavBar(com.webobjects.appserver.WOContext context)
Method Detail

isStateless

public boolean isStateless()
Overrides:
isStateless in class com.webobjects.appserver.WOComponent
Returns:
false, AjaxGridNavBar is stateless and manually synchronized

nextBatch

public void nextBatch()
Ajax action method to select the next batch.


previousBatch

public void previousBatch()
Ajax action method to select the previous batch.


setCurrentBatchIndex

public void setCurrentBatchIndex(java.lang.Number newValue)
Intended to be bound to Ajax slider or selection of batch to display.

Parameters:
newValue - new batch number from AjaxSlider

currentBatchIndex

public int currentBatchIndex()
Returns:
value for AjaxSlider

updateGridContainer

public java.lang.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

updateBatchSizeOnChange

public java.lang.String updateBatchSizeOnChange()
Returns:
JavaScript for option control to pass selected batch size when changed

updateBatchSizeName

public java.lang.String updateBatchSizeName()
Returns:
unique name for the AjaxUpdateContainer wrapping this AjaxGridNavBar

batchSizeUpdated

public void batchSizeUpdated()
Ajax action method for updates to batch size. Grabs batch size from request and updates configuration.


batchSizes

public abstract com.webobjects.foundation.NSArray batchSizes()
Returns:
the list of batch sizes to show in the popup

currentBatchSize

public java.lang.String currentBatchSize()
Returns:
displayGroup().numberOfObjectsPerBatch() as a String for the option input

gridContainerID

public java.lang.String gridContainerID()
Returns:
UPDATE_CONTAINER_ID from configurationData(), the update container ID from the AjaxGrid

tableID

public java.lang.String tableID()
Returns:
TABLE_ID from configurationData(), the table ID from the AjaxGrid

displayGroup

public com.webobjects.appserver.WODisplayGroup displayGroup()
Returns:
value bound to displayGroup

configurationData

public com.webobjects.foundation.NSMutableDictionary configurationData()
Returns:
value bound to configurationData

containerID

public java.lang.String containerID()
Returns:
value bound to containerID

Last updated: Tue, Feb 21, 2017 • 05:45 PM CET

Copyright © 2002 – 2007 Project Wonder.