Author: abelevich
Date: 2007-06-13 13:11:12 -0400 (Wed, 13 Jun 2007)
New Revision: 1168
Modified:
trunk/sandbox-samples/scrollable-grid-demo/src/main/java/org/richfaces/demo/converters/PriorityConverter.java
trunk/sandbox-samples/scrollable-grid-demo/src/main/java/org/richfaces/demo/converters/StatusConverter.java
Log:
new Converters
Modified:
trunk/sandbox-samples/scrollable-grid-demo/src/main/java/org/richfaces/demo/converters/PriorityConverter.java
===================================================================
---
trunk/sandbox-samples/scrollable-grid-demo/src/main/java/org/richfaces/demo/converters/PriorityConverter.java 2007-06-13
16:53:21 UTC (rev 1167)
+++
trunk/sandbox-samples/scrollable-grid-demo/src/main/java/org/richfaces/demo/converters/PriorityConverter.java 2007-06-13
17:11:12 UTC (rev 1168)
@@ -17,7 +17,18 @@
*
*/
public class PriorityConverter implements Converter{
-
+
+ private final static int PRIORITY_BLOCKER = 1;
+
+ private final static int PRIORITY_CRITICAL = 2;
+
+ private final static int PRIORITY_MAJOR = 3;
+
+ private final static int PRIORITY_MINOR = 4;
+
+ private final static int PRIORITY_COSMETIC = 5;
+
+
public PriorityConverter() {
}
@@ -35,8 +46,27 @@
public Object getAsObject(FacesContext context, UIComponent component,
String value) throws ConverterException{
- int id = Integer.parseInt(value);
+ int pr_id = Integer.parseInt(value);
+ int id = -1;
+ switch (pr_id) {
+ case PRIORITY_BLOCKER:
+ id = 0;
+ break;
+ case PRIORITY_CRITICAL:
+ id = 1;
+ break;
+ case PRIORITY_MAJOR:
+ id = 2;
+ break;
+ case PRIORITY_MINOR:
+ id = 3;
+ break;
+ case PRIORITY_COSMETIC:
+ id = 4;
+ break;
+ }
+
Priority convertedValue = null;
try {
Modified:
trunk/sandbox-samples/scrollable-grid-demo/src/main/java/org/richfaces/demo/converters/StatusConverter.java
===================================================================
---
trunk/sandbox-samples/scrollable-grid-demo/src/main/java/org/richfaces/demo/converters/StatusConverter.java 2007-06-13
16:53:21 UTC (rev 1167)
+++
trunk/sandbox-samples/scrollable-grid-demo/src/main/java/org/richfaces/demo/converters/StatusConverter.java 2007-06-13
17:11:12 UTC (rev 1168)
@@ -18,6 +18,16 @@
*/
public class StatusConverter implements Converter{
+ private final static int STATUS_OPEN = 1;
+
+ private final static int STATUS_INPROGRESS = 3;
+
+ private final static int STATUS_RESOLVED = 5;
+
+ private final static int STATUS_REOPENED = 4;
+
+ private final static int STATUS_CLOSED = 6;
+
private List statusList = new ArrayList<Status>();
@@ -33,9 +43,28 @@
String value) throws ConverterException{
Status convertedValue = null;
- int id = Integer.parseInt(value);
+ int st_id = Integer.parseInt(value);
+ int id = -1;
+ switch (st_id) {
+ case STATUS_OPEN:
+ id = 0;
+ break;
+ case STATUS_INPROGRESS:
+ id = 1;
+ break;
+ case STATUS_RESOLVED:
+ id = 2;
+ break;
+ case STATUS_REOPENED:
+ id = 3;
+ break;
+ case STATUS_CLOSED:
+ id = 4;
+ break;
+ }
+
try {
convertedValue = (Status)statusList.get(id);
} catch (IndexOutOfBoundsException e) {
Show replies by date