Stripes

Filtering for options-enumeration/options-collection

Details

  • Type: New Feature New Feature
  • Status: Closed Closed
  • Priority: Major Major
  • Resolution: Won't Fix
  • Affects Version/s: Release 1.4.1
  • Fix Version/s: None
  • Component/s: Tag Library
  • Labels:
    None

Description

Currently the options-enumeration and options-collection tags render all values in the enum or collection.

They will be more useful if filtering criteria can be specified when not all values should be rendered.

package xxx.enums;
public enum MyNumber { ONE, TWO, THREE, FOUR, FIVE, SIX, SEVEN;
public boolean getIsPrime() { return this==TWO || this==THREE || this==FIVE || this==SEVEN; }
public boolean getIsEven() { return (ordinal() % 2) == 1; }
}

<stripes:options-enumeration enum="xxx.enums.MyNumber"/>
(renders all seven options)

<stripes:options-enumeration enum="xxx.enums.MyNumber" where="isPrime"/>
(renders only TWO, THREE, FIVE, SEVEN)

<stripes:options-enumeration enum="xxx.enums.MyNumber" where="isEven"/>
(renders only TWO, FOUR, SIX)

If the proposed where= attribute supports some kind of expression language (EL?), it will be much more flexible:

<stripes:options-enumeration enum="xxx.enums.MyNumber" where="isPrime && !isEven"/>
(renders only THREE, FIVE, SEVEN)

For symmetry, the options-collection tag should likewise take a where= attribute.

A typical use would be, where="theCurrentUserCanSeeThisOption"

Activity

Hide
Kai Grabfelder added a comment - 03/Nov/06 3:32 AM

should this functionality really be added on the VIEW level? I think this addes quite much complexity to stripes / to the implementation of stripes.

In my opition from an MVC point of view, filtering information in the view is not really the correct approach.

Show
Kai Grabfelder added a comment - 03/Nov/06 3:32 AM should this functionality really be added on the VIEW level? I think this addes quite much complexity to stripes / to the implementation of stripes. In my opition from an MVC point of view, filtering information in the view is not really the correct approach.
Hide
Frederic Daoud added a comment - 04/Oct/08 9:49 PM

Agree with Kai - this would add too much complexity to the tag.
Anyone else care to comment on this issue so that we can decide whether to A) look into implementing this feature, or B) close the issue as won't implement?

Show
Frederic Daoud added a comment - 04/Oct/08 9:49 PM Agree with Kai - this would add too much complexity to the tag. Anyone else care to comment on this issue so that we can decide whether to A) look into implementing this feature, or B) close the issue as won't implement?
Hide
Tim Fennell added a comment - 06/Oct/08 9:39 AM

Agreed. I think this is too much for one tag. Really the ActionBean should just present the reduced collection to the page I think.

Show
Tim Fennell added a comment - 06/Oct/08 9:39 AM Agreed. I think this is too much for one tag. Really the ActionBean should just present the reduced collection to the page I think.
Hide
Frederic Daoud added a comment - 10/Oct/08 10:38 AM

This functionality does not belong in the tag.

Show
Frederic Daoud added a comment - 10/Oct/08 10:38 AM This functionality does not belong in the tag.

People

  • Assignee:
    Unassigned
    Reporter:
    Andy
Vote (1)
Watch (0)

Dates

  • Created:
    02/Nov/06 10:35 AM
    Updated:
    10/Oct/08 10:38 AM
    Resolved:
    10/Oct/08 10:38 AM