ERXJSToManyRelationshipEditor Class Reference

Inherits er::extensions::components::ERXNonSynchronizingComponent.

Collaboration diagram for ERXJSToManyRelationshipEditor:

Collaboration graph
[legend]

List of all members.

Classes

interface  Keys

Public Member Functions

String addItemScript ()
void appendToResponse (WOResponse aResponse, WOContext aContext)
String availableValuesPopupMenu ()
Object currentItem ()
String displayString ()
String editorContextID ()
String editorName ()
 ERXJSToManyRelationshipEditor (WOContext context)
String hiddenFieldName ()
void invalidateCaches ()
boolean isListEmpty ()
boolean isStateless ()
int itemIndex ()
String javascriptForThisEditorInstance ()
NSArray list ()
NSArray maybeSortedList ()
String removeItemScript ()
void reset ()
String selectedValuesTableName ()
NSArray selections ()
String selectionsString ()
void setCurrentItem (Object anItem)
void setSelectionsString (String value)
void sleep ()

Static Public Attributes

static final Logger log = Logger.getLogger(ERXJSToManyRelationshipEditor.class)

Protected Attributes

NSArray _list
NSArray _selections
Object currentItem

Private Member Functions

NSDictionary cachedPossibleValues ()
int indexOfObjectInArrayUsingERXEOControlUtilitiesEOEquals (Object anObject, NSArray anArray)
NSArray listFromBindings ()
String possibleValuesHashForScript ()
void pushSelectionsBinding (NSArray selections)
String selectedValuesArrayForScript ()
NSArray selectionsFromBindings ()

Private Attributes

NSDictionary _cachedPossibleValuesDict
String _editorContextID
String _selectionsString


Detailed Description

A fancy to-many relationship editor component.
Author:
Travis Cripps
displayString for the items in the menu, this should be a keyPath that will be resolved from each item to produce the display string for the item. item to use as an iteration variable list of items to display; equivalent to the possible values from which a user might choose selections items from the list that are selected. The resulting selections will be pushed back into the parent component's variable that is bound to the selections binding. sortKey (optional) to use in order to produce a sorted menu

Constructor & Destructor Documentation

ERXJSToManyRelationshipEditor ( WOContext  context  ) 


Member Function Documentation

String addItemScript (  ) 

Builds the JavaScript used to add the selected item from the selections popup to the selected items.

Returns:
the script

void appendToResponse ( WOResponse  response,
WOContext  context 
)

Calls resetCachedBindingsInStatefulComponent prior to super.appendToResponse.

Parameters:
response to which we are appending
context context of the response

Reimplemented from ERXNonSynchronizingComponent.

String availableValuesPopupMenu (  ) 

Builds the select menu for adding available items to the selected items.

Returns:
the string for the select menu

NSDictionary cachedPossibleValues (  )  [private]

Builds a cached dictionary of the list item offsets and their display strings.

Returns:
the dictionary

Object currentItem (  ) 

Gets the item currently being displayed.

Returns:
the item

String displayString (  ) 

Gets the display string for the current item.

Returns:
the display string

String editorContextID (  ) 

Gets the context ID of the editor (this component), escaped for use in JavaScript.

Returns:
the context ID

String editorName (  ) 

Formats the name of this editor instance.

Returns:
the editor name

String hiddenFieldName (  ) 

Formats the name of the hidden field for this editor instance.

Returns:
the hidden field's name

int indexOfObjectInArrayUsingERXEOControlUtilitiesEOEquals ( Object  anObject,
NSArray  anArray 
) [private]

void invalidateCaches (  ) 

Resets the state variables.

boolean isListEmpty (  ) 

Determines if the list is empty

Returns:
true if the list is empty

boolean isStateless (  ) 

component is not stateless

Reimplemented from ERXNonSynchronizingComponent.

int itemIndex (  ) 

Gets the index of the current item in the overall list.

Returns:
the index of the current item

String javascriptForThisEditorInstance (  ) 

Formats the JavaScript used to initialize this instance of the editor.

Returns:
the script for this editor

NSArray list (  ) 

Gets the list of items to display.

Returns:
the list of items

NSArray listFromBindings (  )  [private]

Pulls the list from the list binding.

Returns:
the list, or an empty array if null

NSArray maybeSortedList (  ) 

Gets the list of items and sorts it by the sort key if a sort key is available.

Returns:
the maybe sorted list

String possibleValuesHashForScript (  )  [private]

Creates a JSON/JavaScript-formatted hash of the list item offsets and their display strings.

Returns:
the hash representation

void pushSelectionsBinding ( NSArray  selections  )  [private]

Pushes the selections up to the parent component.

Parameters:
selections array

String removeItemScript (  ) 

Builds the JavaScript used to remove the item from the selections.

Returns:
the script

void reset (  ) 

Reimplemented from ERXComponent.

String selectedValuesArrayForScript (  )  [private]

Creates a JSON/JavaScript-formatted array of the selected list items' offsets.

Returns:
the array representation

String selectedValuesTableName (  ) 

Formats the name of the selected values table for this editor instance.

Returns:
the table's name

NSArray selections (  ) 

Gets the selections.

Returns:
the selections

NSArray selectionsFromBindings (  )  [private]

Pulls the selections from the selections binding.

Returns:
the selections, or an empty array if null

String selectionsString (  ) 

Formats the selection string for the hidden field from the indexes of the items in the selection subset of the list.

Returns:
the selection string

void setCurrentItem ( Object  anItem  ) 

Sets the item being displayed.

Parameters:
anItem to display

void setSelectionsString ( String  value  ) 

Sets the selection string from the input. Parses the input string to isolate the indexes of the selected items and looks them up in the array. Then pushes the selections up to the parent binding.

Parameters:
value of the selections string

void sleep (  ) 


Member Data Documentation

NSDictionary _cachedPossibleValuesDict [private]

NSArray _list [protected]

NSArray _selections [protected]

Object currentItem [protected]

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


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