1
2
3
4 package org.rcfaces.core.item;
5
6 import javax.faces.model.SelectItem;
7
8 import org.rcfaces.core.component.capability.IInputTypeCapability;
9
10
11
12
13
14 public class SeparatorSelectItem extends SelectItem implements ISeparatorItem {
15 private static final String REVISION = "$Revision: 1.1 $";
16
17 private static final long serialVersionUID = -5825985202702986997L;
18
19 private static final String SEPARATOR_KEY = "$-camelia#separator-$";
20
21 public static final SelectItem SEPARATOR = new SeparatorSelectItem() {
22 private static final String REVISION = "$Revision: 1.1 $";
23
24 private static final long serialVersionUID = 3542510884321447395L;
25
26 public Object getValue() {
27 return SEPARATOR_KEY;
28 }
29
30 public void setValue(Object value) {
31 throw new IllegalStateException(
32 "Can not change value of Separator item !");
33 }
34 };
35
36 public static final boolean isSeparator(SelectItem selectItem) {
37 if (selectItem == SEPARATOR) {
38 return true;
39 }
40 if (selectItem instanceof ISeparatorItem) {
41 if (((ISeparatorItem) selectItem).isSeparator()) {
42 return true;
43 }
44 }
45 if (selectItem instanceof IInputTypeItem) {
46 if (((IInputTypeItem) selectItem).getInputType() == IInputTypeCapability.AS_SEPARATOR) {
47 return true;
48 }
49 }
50
51 if (SEPARATOR_KEY.equals(selectItem.getValue())) {
52 return true;
53 }
54
55 return false;
56 }
57
58 public boolean isSeparator() {
59 return true;
60 }
61
62 }