Details
-
Type:
New Feature
-
Status:
Closed
-
Priority:
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" ![]()
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.