![]() |
|
| . | |
7. Value Holders7.1 Heirarchy7.2 ValueHolders7.3 Binding Components to ValueHolders7.4 ObjectValueHolder7.5 VariantValueHolder7.6 VOValueHolder7.7 ObjectCollectionValueHolder7.8 ObjectListValueHolder7.9 VOCollectionValueHolder7.10 VOListValueHolder7.11 VOComparatorsVOComparator is a Comparator for sorting value objects in a VOListValueHolder. This can sort by one or more properties of the value object. Ascending or descending can be specified for each property (default is ascending). To sort by a single property, use the setPropertyName method. To sort by more than one property use the setPropertyNames method and pass it a String[] array of property names. To change the order for a single property, use the setAscendingOrder method (true=Ascending false=descending). To change the order for multiple properties, use the setAscendingOrders method and pass it a boolean[] array. The order of the ascending order indicators should match the array of property names. This VOComparator is then attached to the VOListValueHolder using the setComparator method. IMPORTANT: This VOComparator can only be used with one VOListValueHolder at a time - it cannot be shared. Example - sort ascending by a lastName
VOListValueHolder holder = new VOListValueHolder();
VOComparator comparator = new VOComparator();
...
comparator.setPropertyName("lastName");
holder.setComparator(comparator);
Example - sort ascending by a salary(descending), yearsWorked(ascending)
VOListValueHolder holder = new VOListValueHolder();
VOComparator comparator = new VOComparator();
...
comparator.setPropertyNames(new String[] {"salary", "yearsWorked"});
comparator.setAscendingOrders(new boolean[] {false, true});
holder.setComparator(comparator);
|
|
| . | |