Project Wonder 5.0.0.8787

er.extensions.components.javascript
Class ERXJSPopUpRelationPicker

java.lang.Object
  extended by com.webobjects.appserver.WOElement
      extended by com.webobjects.appserver.WOComponent
          extended by er.extensions.components.ERXComponent
              extended by er.extensions.components.ERXNonSynchronizingComponent
                  extended by er.extensions.components.ERXStatelessComponent
                      extended by er.extensions.components.javascript.ERXJSPopUpRelationPicker
All Implemented Interfaces:
WOActionResults, NSKeyValueCoding, NSKeyValueCoding.ErrorHandling, NSKeyValueCodingAdditions, NSValidation, Serializable, Cloneable

public class ERXJSPopUpRelationPicker
extends ERXStatelessComponent

Very, very cool js component. Implements master-detail with js in two popups, ie the first popup could be say states and depending on which state is picked the second popup might reflect all of the cities of that state.
This WOComponent displays two pop-up buttons. One pop-up displays a list of what can be thought of as parent entities. The second pop-up displays a list of what can be thought of as children entities. When a user selects an entity in the parent list, the child list is instantly modified to reflect the children entities available to the user through that parent. This is done through client-side Javascript. Also handles to-many selections both on the parent and the children.
For example:


parent1(child1,child2,child3)
parent2(child4,child5)
parent3(child2,child5)
When the user selects parent1, its appropriate children are displayed in the second popup. If the user selects child2 in the children pop-up this is the value that is returned to the user through the childrenSelection variable. This is either an NSArray if multiple is true or the single selected object. For the display of the parent popup, if we aren't passed in a parentSelection, then we default to parentPopUpStringForAll. If we aren't given that either, then we default to the first parent in the array. For the display of the child popup, if we aren't passed in a childrenSelection, then we default to childPopUpStringForAll. If we aren't given that either, then we default to the first child in the array.

See Also:
Serialized Form
Bindings
multiple boolean the defines if there can multiple parents and children selected.
           
parentEntitiesList array of the parent objects that appear in the first pop-up.
           
parentToChildrenRelationshipName name of the relationship from the parent to its possible children. This is used to fill the values that appear in the children popup.
           
parentSelection currently selected parent(s) in the parent pop-up. This can be null, but will return the user-selected parent.
           
childrenSelection returns the user-selected child(ren).
           
parentDisplayValueName keypath of the parent displayed in the parent pop-up
           
parentLabel value displayed in the table interface for the parent popup.
           
childLabel value displayed in the table interface for the child popup.
           
defaultChildKey keypath of the parent for the default child (eg, largest city)
           
childrenSortKey keypath to sort the children on
           
childDisplayValueName keypath of the child displayed in the child pop-up
           
parentPopUpStringForAll to display if no parent is chosen ("- all -")
           
childPopUpStringForAll to display if no child is chosen ("- all -")
           
size number of rows in select boxes
           
possibleChildren shows only these values for children
           

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
protected  String _childDisplayValueName
           
protected  String _childLabel
           
protected  String _childPopUpStringForAll
           
protected  NSArray _childrenSelection
           
protected  String _childrenSortKey
           
protected  String _defaultChildKey
           
protected  Boolean _multiple
           
protected  String _parentDisplayValueName
           
protected  NSArray _parentEntitiesList
           
protected  String _parentLabel
           
protected  String _parentPopUpStringForAll
           
protected  NSArray _parentSelection
           
protected  String _parentToChildrenRelationshipName
           
protected  NSArray _possibleChildren
           
protected  Integer _size
           
protected  String childSelectName
           
static Logger jsLog
           
static Logger log
          logging support
protected  String objectsArrayName
           
protected  String parentSelectName
           
protected  String pickerName
           
 
Fields inherited from class er.extensions.components.ERXComponent
_dynamicBindings
 
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
ERXJSPopUpRelationPicker(WOContext aContext)
           
 
Method Summary
 void awake()
           
 String childDisplayValueName()
           
protected  Object childFromID(Object parent, String id)
           
 String childLabel()
           
 String childPopUpString()
           
 String childPopUpStringForAll()
           
 NSArray childrenSelection()
           
 String childrenSortKey()
           
 String defaultChildKey()
           
 String formName()
           
 String hiddenFormElementStrings()
           
protected  Object idForChild(Object parent, Object child)
           
protected  Object idForParent(Object parent)
           
 String jsString()
           
 boolean multiple()
           
 String objectArrayCreationString()
           
protected  int offsetForChild(Object parent, Object child)
           
protected  int offsetForID(String id)
           
 String parentDisplayValueName()
           
 NSArray parentEntitiesList()
           
protected  Object parentFromID(String id)
           
 String parentLabel()
           
 String parentPopUpString()
           
 String parentPopUpStringForAll()
           
 NSArray parentSelection()
           
 String parentToChildrenRelationshipName()
           
protected  NSArray possibleChildren()
           
 void reset()
           
protected  StringBuffer selectHeader(String nm, String onChange)
           
 void setChildrenSelection(NSArray value)
           
 void setSelectedParents(NSArray value)
           
 int size()
           
protected  NSArray sortedChildren(Object parent)
           
 void takeValuesFromRequest(WORequest request, WOContext context)
          Calls _checkAccess prior to super.takeValuesFromRequest.
protected  NSArray unsortedChildren(Object parent)
           
protected  void updateVarNames()
           
 
Methods inherited from class er.extensions.components.ERXStatelessComponent
isStateless, valueForBooleanBinding, valueForBooleanBinding, valueForBooleanBinding, valueForIntBinding, valueForObjectBinding, valueForObjectBinding
 
Methods inherited from class er.extensions.components.ERXNonSynchronizingComponent
synchronizesVariablesWithBindings
 
Methods inherited from class er.extensions.components.ERXComponent
_awakeInContext, _checkAccess, _frameworkName, _includeCSSResources, _includeJavascriptResources, additionalCSSFiles, additionalJavascriptFiles, appendToResponse, booleanValueForBinding, booleanValueForBinding, booleanValueForBinding, checkAccess, clickToOpenEnabled, componentName, defaultCSSPath, defaultJavascriptPath, dynamicBindings, floatValueForBinding, intValueForBinding, invokeAction, isPageAccessAllowed, localizer, objectValueForBinding, objectValueForBinding, pageWithName, postAppendToResponse, preAppendToResponse, primaryCSSFile, primaryJavascriptFile, stringValueForBinding, stringValueForBinding, useDefaultComponentCSS, useDefaultComponentJavascript
 
Methods inherited from class com.webobjects.appserver.WOComponent
__valueForBinding, _associationWithName, _childTemplate, _cleanUpStatelessComponent, _componentDefinition, _componentUnroll, _isPage, _setContext, _setIsPage, _setParent, _setSubcomponent, _sleepInContext, _subcomponentForElementWithID, _templateNameForClass, _unroll, application, baseURL, bindingKeys, canAccessFieldsDirectly, canGetValueForBinding, canSetValueForBinding, clone, context, debugString, descriptionForResponse, ensureAwakeInContext, frameworkName, generateResponse, handleQueryWithUnboundKey, handleTakeValueForUnboundKey, hasBinding, hasSession, isCachingEnabled, isEventLoggingEnabled, logString, name, pageWithName, parent, path, pathURL, performParentAction, pullValuesFromParent, pushValuesToParent, session, set_componentUnroll, set_unroll, setCachingEnabled, setValueForBinding, sleep, takeValueForKey, takeValueForKeyPath, template, templateWithHTMLString, templateWithHTMLString, templateWithName, toString, unableToSetNullForKey, validateTakeValueForKeyPath, validateValueForKey, validationFailedWithException, valueForBinding, 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

log

public static final Logger log
logging support


jsLog

public static final Logger jsLog

_size

protected Integer _size

_childDisplayValueName

protected String _childDisplayValueName

_parentDisplayValueName

protected String _parentDisplayValueName

_parentEntitiesList

protected NSArray _parentEntitiesList

_parentToChildrenRelationshipName

protected String _parentToChildrenRelationshipName

_parentSelection

protected NSArray _parentSelection

_childrenSelection

protected NSArray _childrenSelection

_parentPopUpStringForAll

protected String _parentPopUpStringForAll

_childPopUpStringForAll

protected String _childPopUpStringForAll

_parentLabel

protected String _parentLabel

_childLabel

protected String _childLabel

_childrenSortKey

protected String _childrenSortKey

_defaultChildKey

protected String _defaultChildKey

_multiple

protected Boolean _multiple

_possibleChildren

protected NSArray _possibleChildren

parentSelectName

protected String parentSelectName

childSelectName

protected String childSelectName

pickerName

protected String pickerName

objectsArrayName

protected String objectsArrayName
Constructor Detail

ERXJSPopUpRelationPicker

public ERXJSPopUpRelationPicker(WOContext aContext)
Method Detail

awake

public void awake()
Overrides:
awake in class WOComponent

updateVarNames

protected void updateVarNames()

offsetForID

protected int offsetForID(String id)

parentFromID

protected Object parentFromID(String id)

idForParent

protected Object idForParent(Object parent)

childFromID

protected Object childFromID(Object parent,
                             String id)

offsetForChild

protected int offsetForChild(Object parent,
                             Object child)

idForChild

protected Object idForChild(Object parent,
                            Object child)

takeValuesFromRequest

public void takeValuesFromRequest(WORequest request,
                                  WOContext context)
Description copied from class: ERXComponent
Calls _checkAccess prior to super.takeValuesFromRequest.

Overrides:
takeValuesFromRequest in class ERXComponent

possibleChildren

protected NSArray possibleChildren()

unsortedChildren

protected NSArray unsortedChildren(Object parent)

sortedChildren

protected NSArray sortedChildren(Object parent)

jsString

public String jsString()

hiddenFormElementStrings

public String hiddenFormElementStrings()

parentPopUpString

public String parentPopUpString()

formName

public String formName()

childPopUpString

public String childPopUpString()
Returns:
the string to create the pop-up with the initial child values something like:
<select name="children_select">
     <option value=4>poodle
     <option selected value=5>puli
     <option value=6>greyhound
     </select>

selectHeader

protected StringBuffer selectHeader(String nm,
                                    String onChange)

objectArrayCreationString

public String objectArrayCreationString()

parentEntitiesList

public NSArray parentEntitiesList()

parentSelection

public NSArray parentSelection()

setSelectedParents

public void setSelectedParents(NSArray value)

childrenSelection

public NSArray childrenSelection()

setChildrenSelection

public void setChildrenSelection(NSArray value)

defaultChildKey

public String defaultChildKey()

childrenSortKey

public String childrenSortKey()

childLabel

public String childLabel()

parentLabel

public String parentLabel()

childDisplayValueName

public String childDisplayValueName()

parentDisplayValueName

public String parentDisplayValueName()

parentToChildrenRelationshipName

public String parentToChildrenRelationshipName()

parentPopUpStringForAll

public String parentPopUpStringForAll()

childPopUpStringForAll

public String childPopUpStringForAll()

size

public int size()

multiple

public boolean multiple()

reset

public void reset()
Overrides:
reset in class ERXStatelessComponent

Last updated: Wed, Jan 7, 2009 • 04:35 AM EST

Copyright © 2002 – 2007 Project Wonder.