01: package org.romaframework.module.designer.domain.wrapper;
02:
03: import java.util.Set;
04: import org.romaframework.core.domain.wrapper.SelectWrapper;
05: import org.romaframework.core.flow.ObjectContext;
06:
07: public class LayoutSelectWrapper<T> extends SelectWrapper<T> {
08: private String formArea;
09:
10: public LayoutSelectWrapper(Set<T> selectValues) {
11: super (selectValues);
12: }
13:
14: public LayoutSelectWrapper(Set<T> selectValues, T iInitialValue) {
15: super (selectValues, iInitialValue);
16: if (iInitialValue != null
17: && iInitialValue.toString().startsWith("form:")) {
18: formArea = iInitialValue.toString().substring(5);
19: selected = (T) "form";
20: } else if (iInitialValue != null
21: && iInitialValue.toString().startsWith("screen:")) {
22: formArea = iInitialValue.toString().substring(7);
23: selected = (T) "screen";
24: }
25: }
26:
27: public String getFormArea() {
28: return formArea;
29: }
30:
31: public void onFormArea() {
32: if (formArea != null && !formArea.equals("")) {
33: selected = null;
34: ObjectContext.getInstance().refresh(this , "values");
35: }
36: }
37:
38: public void setFormArea(String formArea) {
39: this .formArea = formArea;
40: }
41:
42: @Override
43: public Object getFinalValue() {
44: if (selected != null && selected.toString().equals("form")) {
45: return "form:" + formArea;
46: } else if (selected != null
47: && selected.toString().equals("screen")) {
48: return "screen:" + formArea;
49: } else {
50: return selected;
51: }
52: }
53: }
|