ERXJSPopUpRelationPicker Class Reference

Inherits er::extensions::components::ERXStatelessComponent.

Collaboration diagram for ERXJSPopUpRelationPicker:

Collaboration graph
[legend]

List of all members.

Public Member Functions

void awake ()
String childDisplayValueName ()
String childLabel ()
String childPopUpString ()
String childPopUpStringForAll ()
NSArray childrenSelection ()
String childrenSortKey ()
String defaultChildKey ()
 ERXJSPopUpRelationPicker (WOContext aContext)
String formName ()
String hiddenFormElementStrings ()
String jsString ()
boolean multiple ()
String objectArrayCreationString ()
String parentDisplayValueName ()
NSArray parentEntitiesList ()
String parentLabel ()
String parentPopUpString ()
String parentPopUpStringForAll ()
NSArray parentSelection ()
String parentToChildrenRelationshipName ()
void reset ()
void setChildrenSelection (NSArray value)
void setSelectedParents (NSArray value)
int size ()
void takeValuesFromRequest (WORequest request, WOContext context)

Static Public Attributes

static final Logger jsLog = Logger.getLogger("er.extensions.ERXJSPopUpRelationPicker.script")
static final Logger log = Logger.getLogger(ERXJSPopUpRelationPicker.class)

Protected Member Functions

Object childFromID (Object parent, String id)
Object idForChild (Object parent, Object child)
Object idForParent (Object parent)
int offsetForChild (Object parent, Object child)
int offsetForID (String id)
Object parentFromID (String id)
NSArray possibleChildren ()
StringBuffer selectHeader (String nm, String onChange)
NSArray sortedChildren (Object parent)
NSArray unsortedChildren (Object parent)
void updateVarNames ()

Protected Attributes

String _childDisplayValueName
String _childLabel
String _childPopUpStringForAll
NSArray _childrenSelection
String _childrenSortKey
String _defaultChildKey
Boolean _multiple
String _parentDisplayValueName
NSArray _parentEntitiesList
String _parentLabel
String _parentPopUpStringForAll
NSArray _parentSelection
String _parentToChildrenRelationshipName
NSArray _possibleChildren
Integer _size
String childSelectName
String objectsArrayName
String parentSelectName
String pickerName

Private Member Functions

void appendChildPopupStringWithParent (StringBuffer returnString, NSArray aParents)
boolean isSelectedChild (Object aChild)
boolean isSelectedParent (Object aParent)

Static Private Attributes

static final int NOT_FOUND = -1
static final NSArray UNSET = new NSArray()


Detailed Description

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.

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


Constructor & Destructor Documentation

ERXJSPopUpRelationPicker ( WOContext  aContext  ) 


Member Function Documentation

void appendChildPopupStringWithParent ( StringBuffer  returnString,
NSArray  aParents 
) [private]

void awake (  ) 

String childDisplayValueName (  ) 

Object childFromID ( Object  parent,
String  id 
) [protected]

String childLabel (  ) 

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>

String childPopUpStringForAll (  ) 

NSArray childrenSelection (  ) 

String childrenSortKey (  ) 

String defaultChildKey (  ) 

String formName (  ) 

String hiddenFormElementStrings (  ) 

Object idForChild ( Object  parent,
Object  child 
) [protected]

Object idForParent ( Object  parent  )  [protected]

boolean isSelectedChild ( Object  aChild  )  [private]

Parameters:
aChild 
Returns:

boolean isSelectedParent ( Object  aParent  )  [private]

Parameters:
aParent 
Returns:

String jsString (  ) 

boolean multiple (  ) 

String objectArrayCreationString (  ) 

int offsetForChild ( Object  parent,
Object  child 
) [protected]

int offsetForID ( String  id  )  [protected]

String parentDisplayValueName (  ) 

NSArray parentEntitiesList (  ) 

Object parentFromID ( String  id  )  [protected]

String parentLabel (  ) 

String parentPopUpString (  ) 

String parentPopUpStringForAll (  ) 

NSArray parentSelection (  ) 

String parentToChildrenRelationshipName (  ) 

NSArray possibleChildren (  )  [protected]

void reset (  ) 

Reimplemented from ERXStatelessComponent.

StringBuffer selectHeader ( String  nm,
String  onChange 
) [protected]

void setChildrenSelection ( NSArray  value  ) 

void setSelectedParents ( NSArray  value  ) 

int size (  ) 

NSArray sortedChildren ( Object  parent  )  [protected]

void takeValuesFromRequest ( WORequest  request,
WOContext  context 
)

Calls resetCachedBindingsInStatefulComponent prior to super.takeValuesFromRequest.

Parameters:
request from which the values will be taken
context of the request

Reimplemented from ERXNonSynchronizingComponent.

NSArray unsortedChildren ( Object  parent  )  [protected]

void updateVarNames (  )  [protected]


Member Data Documentation

String _childLabel [protected]

NSArray _childrenSelection [protected]

String _childrenSortKey [protected]

String _defaultChildKey [protected]

Boolean _multiple [protected]

NSArray _parentEntitiesList [protected]

String _parentLabel [protected]

NSArray _parentSelection [protected]

NSArray _possibleChildren [protected]

Integer _size [protected]

String childSelectName [protected]

final Logger jsLog = Logger.getLogger("er.extensions.ERXJSPopUpRelationPicker.script") [static]

final Logger log = Logger.getLogger(ERXJSPopUpRelationPicker.class) [static]

logging support

final int NOT_FOUND = -1 [static, private]

String objectsArrayName [protected]

String parentSelectName [protected]

String pickerName [protected]

final NSArray UNSET = new NSArray() [static, private]


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

Generated on Sat May 26 06:43:07 2012 for Project Wonder by  doxygen 1.5.8