1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34 package info.magnolia.ui.form.field.definition;
35
36 import info.magnolia.annotation.deprecation.MgnlDeprecated;
37
38 import info.magnolia.repository.RepositoryConstants;
39
40 import java.util.ArrayList;
41 import java.util.Comparator;
42 import java.util.List;
43
44 import com.vaadin.v7.shared.ui.combobox.FilteringMode;
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60 @Deprecated
61 @MgnlDeprecated(since = "6.2", description = "Use new framework and info.magnolia.ui.field.AbstractSelectFieldDefinition instead.")
62 public class SelectFieldDefinition extends ConfiguredFieldDefinition {
63
64 public static final String OPTION_VALUE_PROPERTY_NAME = "value";
65 public static final String OPTION_NAME_PROPERTY_NAME = "name";
66 public static final String OPTION_SELECTED_PROPERTY_NAME = "selected";
67 public static final String OPTION_ICONSRC_PROPERTY_NAME = "iconSrc";
68 public static final String OPTION_LABEL_PROPERTY_NAME = "label";
69
70 public static final String DEFAULT_REPOSITORY_NAME = RepositoryConstants.CONFIG;
71
72 private String path;
73
74 private String repository = DEFAULT_REPOSITORY_NAME;
75
76 private String valueProperty = OPTION_VALUE_PROPERTY_NAME;
77
78 private String labelProperty = OPTION_LABEL_PROPERTY_NAME;
79
80 private FilteringMode filteringMode = FilteringMode.OFF;
81
82 private boolean sortOptions = true;
83
84 private Class<? extends Comparator<SelectFieldOptionDefinition>> comparatorClass;
85
86 private List<SelectFieldOptionDefinition> options = new ArrayList<SelectFieldOptionDefinition>();
87
88 private boolean textInputAllowed = false;
89
90 private int pageLength = 0;
91
92 public List<SelectFieldOptionDefinition> getOptions() {
93 return options;
94 }
95
96 public void setOptions(List<SelectFieldOptionDefinition> options) {
97 this.options = options;
98 }
99
100 public void addOption(SelectFieldOptionDefinition option) {
101 options.add(option);
102 }
103
104 public String getPath() {
105 return path;
106 }
107
108 public void setPath(String path) {
109 this.path = path;
110 }
111
112 public String getRepository() {
113 return repository;
114 }
115
116 public void setRepository(String repository) {
117 this.repository = repository;
118 }
119
120 public String getValueProperty() {
121 return valueProperty;
122 }
123
124 public void setValueProperty(String valueProperty) {
125 this.valueProperty = valueProperty;
126 }
127
128 public String getLabelProperty() {
129 return labelProperty;
130 }
131
132 public void setLabelProperty(String labelProperty) {
133 this.labelProperty = labelProperty;
134 }
135
136
137
138
139
140
141
142
143 public FilteringMode getFilteringMode() {
144 return filteringMode;
145 }
146
147 public void setFilteringMode(FilteringMode filteringMode) {
148 this.filteringMode = filteringMode;
149 }
150
151
152
153
154 @Deprecated
155 public void setFilteringMode(int filteringMode) {
156 switch (filteringMode) {
157 case 1:
158 this.filteringMode = FilteringMode.CONTAINS;
159 case 2:
160 this.filteringMode = FilteringMode.STARTSWITH;
161 default:
162 this.filteringMode = FilteringMode.OFF;
163 }
164 }
165
166
167
168
169 public void setSortOptions(boolean sortOptions) {
170 this.sortOptions = sortOptions;
171 }
172
173 public boolean isSortOptions() {
174 return sortOptions;
175 }
176
177 public Class<? extends Comparator<SelectFieldOptionDefinition>> getComparatorClass() {
178 return comparatorClass;
179 }
180
181 public void setComparatorClass(Class<? extends Comparator<SelectFieldOptionDefinition>> comparatorClass) {
182 this.comparatorClass = comparatorClass;
183 }
184
185 public boolean isTextInputAllowed() {
186 return textInputAllowed;
187 }
188
189 public void setTextInputAllowed(boolean textInputAllowed) {
190 this.textInputAllowed = textInputAllowed;
191 }
192
193 public int getPageLength() {
194 return pageLength;
195 }
196
197 public void setPageLength(int pageLength) {
198 this.pageLength = pageLength;
199 }
200 }