Project Wonder 5.0.0.8787

er.extensions.components
Class ERXArrayChooser

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.ERXArrayChooser
All Implemented Interfaces:
WOActionResults, NSKeyValueCoding, NSKeyValueCoding.ErrorHandling, NSKeyValueCodingAdditions, NSValidation, Serializable, Cloneable
Direct Known Subclasses:
WOToManyRelationship, WOToOneRelationship

public abstract class ERXArrayChooser
extends ERXStatelessComponent

This is an effort to consolidate the WOToOneRelationship, WOToManyRelationship and descendant components.
As most of the code between the two is shared anyway, it makes sense to provide a base class and only handle the differences in the descendants. One core difference if that this component can handle POJOs both as the source and the destination objects. You can't instantiate one of these yourself.
This class can handle to-one, to-many and simple attribute selections. You can can set the list via possibleChoices, dataSource, destinationEntityName or via sourceEntityName and relationshipKey.
The main difference between this component and the former WOToOne/WOToMany is that it is non-synchronizing. So if you have custom subclasses of WOToOne/WOToMany you need to take this into account. Also adds the values that are not included in the restricted-choice list. These items are marked by [name of item]. This should ensure they end up at the bottom of the list. You can also specify the editingContext the component uses to fetch the related objects into. NOTE: currently "includeUnmatchedValues" is set to false

Author:
ak (but most stuff is pulled over from the pre-existing WOToOne/WOToMany)
See Also:
Serialized Form

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  EODataSource _dataSource
           
protected  String _destinationDisplayKey
           
protected  String _destinationEntityName
           
protected  String _destinationSortKey
           
protected  Boolean _includeUnmatchedValues
           
protected  Boolean _isMandatory
           
protected  NSArray _list
           
protected  Boolean _localizeDisplayKeys
           
protected  String _noneString
           
protected  String _relationshipKey
           
protected  Boolean _sortCaseInsensitive
           
protected  String _sourceEntityName
           
protected  Object _sourceObject
           
protected  String _uiStyle
           
protected  NSArray _unmatchedValues
           
static boolean includeUnmatchedValuesDefault
           
static boolean localizeDisplayKeysDefault
           
static Logger log
          logging support
protected static String NO_SELECTION_STRING
           
protected static String NO_SORT_STRING
           
static boolean sortCaseInsensitiveDefault
           
protected  Object theCurrentItem
           
 
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
ERXArrayChooser(WOContext aContext)
           
 
Method Summary
 String _destinationEntityName(boolean throwExceptionIfMissing)
           
abstract  NSArray currentValues()
           
 EODataSource dataSource()
           
 String destinationDisplayKey()
           
protected  EOEntity destinationEntity()
           
 String destinationEntityName()
           
 String destinationSortKey()
           
protected  NSArray destinationSortKeys()
           
protected  EOEditingContext editingContext()
           
 boolean includeUnmatchedValues()
           
 boolean isBrowser()
           
 boolean isCheckBox()
           
 boolean isMandatory()
           
 boolean isPopup()
           
 boolean isRadio()
           
protected abstract  boolean isSingleSelection()
           
protected  void loadBindingsFromSelection()
           I'm lazy.
 boolean localizeDisplayKeys()
           
 String noneString()
           
 EOQualifier qualifier()
           
protected  String realRelationshipKey()
           
protected  Object realSourceObject()
           
 String relationshipKey()
           
 void reset()
           
 void setTheCurrentItem(Object aValue)
           
 boolean sortCaseInsensitive()
           
 String sourceEntityName()
           
 Object sourceObject()
           
 void takeValuesFromRequest(WORequest r, WOContext c)
          Calls _checkAccess prior to super.takeValuesFromRequest.
 Object theCurrentItem()
           
 Object theCurrentValue()
           
 NSArray theList()
           
 String uiStyle()
           
 NSArray unmatchedValues()
           
 
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, awake, 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


localizeDisplayKeysDefault

public static boolean localizeDisplayKeysDefault

includeUnmatchedValuesDefault

public static boolean includeUnmatchedValuesDefault

sortCaseInsensitiveDefault

public static boolean sortCaseInsensitiveDefault

NO_SELECTION_STRING

protected static final String NO_SELECTION_STRING
See Also:
Constant Field Values

NO_SORT_STRING

protected static final String NO_SORT_STRING
See Also:
Constant Field Values

_localizeDisplayKeys

protected Boolean _localizeDisplayKeys

_includeUnmatchedValues

protected Boolean _includeUnmatchedValues

_sortCaseInsensitive

protected Boolean _sortCaseInsensitive

_sourceEntityName

protected String _sourceEntityName

_destinationEntityName

protected String _destinationEntityName

_relationshipKey

protected String _relationshipKey

_sourceObject

protected Object _sourceObject

_destinationDisplayKey

protected String _destinationDisplayKey

_dataSource

protected EODataSource _dataSource

_uiStyle

protected String _uiStyle

_isMandatory

protected Boolean _isMandatory

_list

protected NSArray _list

_unmatchedValues

protected NSArray _unmatchedValues

_destinationSortKey

protected String _destinationSortKey

_noneString

protected String _noneString

theCurrentItem

protected Object theCurrentItem
Constructor Detail

ERXArrayChooser

public ERXArrayChooser(WOContext aContext)
Method Detail

isSingleSelection

protected abstract boolean isSingleSelection()

reset

public void reset()
Overrides:
reset in class ERXStatelessComponent

noneString

public String noneString()

sortCaseInsensitive

public boolean sortCaseInsensitive()

localizeDisplayKeys

public boolean localizeDisplayKeys()

includeUnmatchedValues

public boolean includeUnmatchedValues()

sourceEntityName

public String sourceEntityName()

destinationSortKey

public String destinationSortKey()

unmatchedValues

public NSArray unmatchedValues()

destinationSortKeys

protected NSArray destinationSortKeys()

editingContext

protected EOEditingContext editingContext()

loadBindingsFromSelection

protected void loadBindingsFromSelection()

I'm lazy. I don't want to bind sourceObject, sourceEntityName, and relationshipKey. Work it out, Wonder, that's what I say. So if you bind, for instance:

selection = person.company;

... it will figure out that the sourceObject is "person", the relationshipKey is "company" and the sourceEntityName is "Person".


destinationEntity

protected EOEntity destinationEntity()

destinationEntityName

public String destinationEntityName()

_destinationEntityName

public String _destinationEntityName(boolean throwExceptionIfMissing)

relationshipKey

public String relationshipKey()

sourceObject

public Object sourceObject()

destinationDisplayKey

public String destinationDisplayKey()

qualifier

public EOQualifier qualifier()

dataSource

public EODataSource dataSource()

uiStyle

public String uiStyle()

isMandatory

public boolean isMandatory()

isCheckBox

public boolean isCheckBox()

isRadio

public boolean isRadio()

isPopup

public boolean isPopup()

isBrowser

public boolean isBrowser()

theCurrentItem

public Object theCurrentItem()

setTheCurrentItem

public void setTheCurrentItem(Object aValue)

currentValues

public abstract NSArray currentValues()

theList

public NSArray theList()

theCurrentValue

public Object theCurrentValue()

takeValuesFromRequest

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

Overrides:
takeValuesFromRequest in class ERXComponent

realSourceObject

protected Object realSourceObject()

realRelationshipKey

protected String realRelationshipKey()

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

Copyright © 2002 – 2007 Project Wonder.