ERXGroupingRepetition Class Reference

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

Inherited by ERXGroupingTable.

Collaboration diagram for ERXGroupingRepetition:

Collaboration graph
[legend]

List of all members.

Public Member Functions

 ERXGroupingRepetition (WOContext aContext)
void reset ()
Object sectionItem ()
String sectionKey ()
NSArray sections ()
void setSectionItem (Object section)

Static Public Attributes

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

Private Member Functions

Object keyForSection (Object section)
boolean splitArrays ()

Private Attributes

NSMutableDictionary _itemsPerSection = new NSMutableDictionary()
Object _sectionItem
String _sectionKey
NSMutableArray _sections
Boolean _splitArrays

Static Private Attributes

static final Object NULL = "N/A"


Detailed Description

Groups items into sections.For example: Employees belong to a department, you want to group on department. So the parent will need to consist of something like:

 [erxgroupingrepetition]
 [wostring value=currentDepartment.name] 
 [worepetition list=currentEmployees item=currentEmployee] 
    [wostring value=currentEmployees.firstName] 
 [/worepetition] 
 [/erxgroupingrepetition]

 
and then you'd set up the bindings of the grouping repetition like:

 list=allEmployees : list of employees to group
 item=currentEmployee : will be set so the next key can get evaluated
 sectionForItem=departmentForCurrentEmployee : a method in the parent that returns sth like currentEmployee.department()
 sectionKey="name" : assuming department has a name, but can be unbound; note that you can group on "city", too!
 subListSection=currentDepartment : instance variable in the parent that will get set to the current department
 subList=currentEmployees : instance variable in the parent that will get set to the employees of the current department
 sortKey=".name" : sorts the department list by name

 
If a user could belong to many departments, you could either set the splitArrays binding to true, in which case the sections would be all the departments and the user would be added in each section he belongs or you could leave it out. Then the sections will be each combination of departments a user belongs to. Please see the page BugsPerUser.wo from the BugTracker application to find another example on how to use it. list list of objects to group item current item, will get pushed to the parent, so that it can evaluate sectionForItem sectionForItem value pulled from the parent, after "item" gets pushed sectionKey key to group departments on (usually primaryKey or hashCode) subListSection will get set to the current section subList will get set to the grouped items for the section sortKey optional key for sorting the group list (sth like '.name') splitArrays optional boolean specifying if array keys are regarded as distinct keys ignoreNulls optional boolean specifying if nulls are ignored

Constructor & Destructor Documentation

ERXGroupingRepetition ( WOContext  aContext  ) 


Member Function Documentation

Object keyForSection ( Object  section  )  [private]

Parameters:
splitArrays 
section 
Returns:

void reset (  ) 

Reimplemented from ERXStatelessComponent.

Object sectionItem (  ) 

String sectionKey (  ) 

NSArray sections (  ) 

void setSectionItem ( Object  section  ) 

boolean splitArrays (  )  [private]


Member Data Documentation

Object _sectionItem [private]

String _sectionKey [private]

Boolean _splitArrays [private]

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

logging support

final Object NULL = "N/A" [static, private]


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

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