Project Wonder 5.0

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:
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 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
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
protected  java.lang.String _childDisplayValueName
           
protected  java.lang.String _childLabel
           
protected  java.lang.String _childPopUpStringForAll
           
protected  com.webobjects.foundation.NSArray _childrenSelection
           
protected  java.lang.String _childrenSortKey
           
protected  java.lang.String _defaultChildKey
           
protected  java.lang.Boolean _multiple
           
protected  java.lang.String _parentDisplayValueName
           
protected  com.webobjects.foundation.NSArray _parentEntitiesList
           
protected  java.lang.String _parentLabel
           
protected  java.lang.String _parentPopUpStringForAll
           
protected  com.webobjects.foundation.NSArray _parentSelection
           
protected  java.lang.String _parentToChildrenRelationshipName
           
protected  com.webobjects.foundation.NSArray _possibleChildren
           
protected  java.lang.Integer _size
           
protected  java.lang.String childSelectName
           
static org.apache.log4j.Logger jsLog
           
static org.apache.log4j.Logger log
          logging support
protected  java.lang.String objectsArrayName
           
protected  java.lang.String parentSelectName
           
protected  java.lang.String pickerName
           
 
Fields inherited from class er.extensions.components.ERXComponent
_dynamicBindings
 
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
ERXJSPopUpRelationPicker(com.webobjects.appserver.WOContext aContext)
           
 
Method Summary
 void awake()
           
 java.lang.String childDisplayValueName()
           
protected  java.lang.Object childFromID(java.lang.Object parent, java.lang.String id)
           
 java.lang.String childLabel()
           
 java.lang.String childPopUpString()
           
 java.lang.String childPopUpStringForAll()
           
 com.webobjects.foundation.NSArray childrenSelection()
           
 java.lang.String childrenSortKey()
           
 java.lang.String defaultChildKey()
           
 java.lang.String formName()
           
 java.lang.String hiddenFormElementStrings()
           
protected  java.lang.Object idForChild(java.lang.Object parent, java.lang.Object child)
           
protected  java.lang.Object idForParent(java.lang.Object parent)
           
 java.lang.String jsString()
           
 boolean multiple()
           
 java.lang.String objectArrayCreationString()
           
protected  int offsetForChild(java.lang.Object parent, java.lang.Object child)
           
protected  int offsetForID(java.lang.String id)
           
 java.lang.String parentDisplayValueName()
           
 com.webobjects.foundation.NSArray parentEntitiesList()
           
protected  java.lang.Object parentFromID(java.lang.String id)
           
 java.lang.String parentLabel()
           
 java.lang.String parentPopUpString()
           
 java.lang.String parentPopUpStringForAll()
           
 com.webobjects.foundation.NSArray parentSelection()
           
 java.lang.String parentToChildrenRelationshipName()
           
protected  com.webobjects.foundation.NSArray possibleChildren()
           
 void reset()
           
protected  java.lang.StringBuffer selectHeader(java.lang.String nm, java.lang.String onChange)
           
 void setChildrenSelection(com.webobjects.foundation.NSArray value)
           
 void setSelectedParents(com.webobjects.foundation.NSArray value)
           
 int size()
           
protected  com.webobjects.foundation.NSArray sortedChildren(java.lang.Object parent)
           
 void takeValuesFromRequest(com.webobjects.appserver.WORequest request, com.webobjects.appserver.WOContext context)
          Calls ERXNonSynchronizingComponent.resetCachedBindingsInStatefulComponent() prior to super.takeValuesFromRequest.
protected  com.webobjects.foundation.NSArray unsortedChildren(java.lang.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
appendToResponse, invokeAction, resetCachedBindingsInStatefulComponent, synchronizesVariablesWithBindings
 
Methods inherited from class er.extensions.components.ERXComponent
_awakeInContext, _checkAccess, _frameworkName, _includeCSSResources, _includeJavascriptResources, additionalCSSFiles, additionalJavascriptFiles, booleanValueForBinding, booleanValueForBinding, booleanValueForBinding, checkAccess, clickToOpenEnabled, componentName, defaultCSSPath, defaultJavascriptPath, dynamicBindings, floatValueForBinding, intValueForBinding, isPageAccessAllowed, localizer, objectValueForBinding, objectValueForBinding, pageWithName, postAppendToResponse, preAppendToResponse, primaryCSSFile, primaryJavascriptFile, stringValueForBinding, stringValueForBinding, useDefaultComponentCSS, useDefaultComponentJavascript
 
Methods inherited from class com.webobjects.appserver.WOComponent
_associationWithName, _childTemplate, _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, 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

log

public static final org.apache.log4j.Logger log
logging support


jsLog

public static final org.apache.log4j.Logger jsLog

_size

protected java.lang.Integer _size

_childDisplayValueName

protected java.lang.String _childDisplayValueName

_parentDisplayValueName

protected java.lang.String _parentDisplayValueName

_parentEntitiesList

protected com.webobjects.foundation.NSArray _parentEntitiesList

_parentToChildrenRelationshipName

protected java.lang.String _parentToChildrenRelationshipName

_parentSelection

protected com.webobjects.foundation.NSArray _parentSelection

_childrenSelection

protected com.webobjects.foundation.NSArray _childrenSelection

_parentPopUpStringForAll

protected java.lang.String _parentPopUpStringForAll

_childPopUpStringForAll

protected java.lang.String _childPopUpStringForAll

_parentLabel

protected java.lang.String _parentLabel

_childLabel

protected java.lang.String _childLabel

_childrenSortKey

protected java.lang.String _childrenSortKey

_defaultChildKey

protected java.lang.String _defaultChildKey

_multiple

protected java.lang.Boolean _multiple

_possibleChildren

protected com.webobjects.foundation.NSArray _possibleChildren

parentSelectName

protected java.lang.String parentSelectName

childSelectName

protected java.lang.String childSelectName

pickerName

protected java.lang.String pickerName

objectsArrayName

protected java.lang.String objectsArrayName
Constructor Detail

ERXJSPopUpRelationPicker

public ERXJSPopUpRelationPicker(com.webobjects.appserver.WOContext aContext)
Method Detail

awake

public void awake()
Overrides:
awake in class com.webobjects.appserver.WOComponent

updateVarNames

protected void updateVarNames()

offsetForID

protected int offsetForID(java.lang.String id)

parentFromID

protected java.lang.Object parentFromID(java.lang.String id)

idForParent

protected java.lang.Object idForParent(java.lang.Object parent)

childFromID

protected java.lang.Object childFromID(java.lang.Object parent,
                                       java.lang.String id)

offsetForChild

protected int offsetForChild(java.lang.Object parent,
                             java.lang.Object child)

idForChild

protected java.lang.Object idForChild(java.lang.Object parent,
                                      java.lang.Object child)

takeValuesFromRequest

public void takeValuesFromRequest(com.webobjects.appserver.WORequest request,
                                  com.webobjects.appserver.WOContext context)
Description copied from class: ERXNonSynchronizingComponent
Calls ERXNonSynchronizingComponent.resetCachedBindingsInStatefulComponent() prior to super.takeValuesFromRequest.

Overrides:
takeValuesFromRequest in class ERXNonSynchronizingComponent
Parameters:
request - from which the values will be taken
context - of the request

possibleChildren

protected com.webobjects.foundation.NSArray possibleChildren()

unsortedChildren

protected com.webobjects.foundation.NSArray unsortedChildren(java.lang.Object parent)

sortedChildren

protected com.webobjects.foundation.NSArray sortedChildren(java.lang.Object parent)

jsString

public java.lang.String jsString()

hiddenFormElementStrings

public java.lang.String hiddenFormElementStrings()

parentPopUpString

public java.lang.String parentPopUpString()

formName

public java.lang.String formName()

childPopUpString

public java.lang.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 java.lang.StringBuffer selectHeader(java.lang.String nm,
                                              java.lang.String onChange)

objectArrayCreationString

public java.lang.String objectArrayCreationString()

parentEntitiesList

public com.webobjects.foundation.NSArray parentEntitiesList()

parentSelection

public com.webobjects.foundation.NSArray parentSelection()

setSelectedParents

public void setSelectedParents(com.webobjects.foundation.NSArray value)

childrenSelection

public com.webobjects.foundation.NSArray childrenSelection()

setChildrenSelection

public void setChildrenSelection(com.webobjects.foundation.NSArray value)

defaultChildKey

public java.lang.String defaultChildKey()

childrenSortKey

public java.lang.String childrenSortKey()

childLabel

public java.lang.String childLabel()

parentLabel

public java.lang.String parentLabel()

childDisplayValueName

public java.lang.String childDisplayValueName()

parentDisplayValueName

public java.lang.String parentDisplayValueName()

parentToChildrenRelationshipName

public java.lang.String parentToChildrenRelationshipName()

parentPopUpStringForAll

public java.lang.String parentPopUpStringForAll()

childPopUpStringForAll

public java.lang.String childPopUpStringForAll()

size

public int size()

multiple

public boolean multiple()

reset

public void reset()
Overrides:
reset in class ERXStatelessComponent

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

Copyright © 2002 – 2007 Project Wonder.