1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17 package org.exoplatform.ecm.webui.form;
18
19 import java.util.HashMap;
20 import java.util.List;
21
22 import org.exoplatform.webui.application.WebuiRequestContext;
23 import org.exoplatform.webui.config.annotation.ComponentConfig;
24 import org.exoplatform.webui.form.UIForm;
25 import org.exoplatform.webui.form.UIFormInput;
26 import org.exoplatform.webui.form.UIFormInputSet;
27
28
29
30
31
32
33 @ComponentConfig(
34 template = "classpath:groovy/ecm/webui/form/UIFormInputSetWithAction.gtmpl"
35 )
36
37 public class UIFormInputSetWithAction extends UIFormInputSet implements UIFormInput {
38
39 private String[] actions_ ;
40 private String[] values_ ;
41 private boolean isView_ ;
42 private boolean isShowOnly_ = false ;
43 private boolean isDeleteOnly_ = false ;
44 private HashMap<String, String> infor_ = new HashMap<String, String>() ;
45 private HashMap<String, List<String>> listInfor_ = new HashMap<String, List<String>>() ;
46 private HashMap<String, String[]> actionInfo_ = new HashMap<String, String[]>() ;
47 private HashMap<String, String[]> fieldActions_ = new HashMap<String, String[]>() ;
48 private boolean isShowActionInfo_ = false ;
49 private HashMap<String, String> msgKey_ = new HashMap<String, String>();
50
51 public UIFormInputSetWithAction(String name) {
52 setId(name) ;
53 setComponentConfig(getClass(), null) ;
54 }
55 public boolean isShowActionInfo() {return isShowActionInfo_ ;}
56 public void showActionInfo(boolean isShow) {isShowActionInfo_ = isShow ;}
57 public void processRender(WebuiRequestContext context) throws Exception {
58 super.processRender(context) ;
59 }
60
61 public void setActions(String[] actionList, String[] values){
62 actions_ = actionList ;
63 values_ = values ;
64 }
65
66 public String[] getInputSetActions() { return actions_ ; }
67 public String[] getActionValues() { return values_ ; }
68
69 public String getFormName() {
70 UIForm uiForm = getAncestorOfType(UIForm.class);
71 return uiForm.getId() ;
72 }
73
74 public boolean isShowOnly() { return isShowOnly_ ; }
75 public void setIsShowOnly(boolean isShowOnly) { isShowOnly_ = isShowOnly ; }
76
77 public boolean isDeleteOnly() { return isDeleteOnly_ ; }
78 public void setIsDeleteOnly(boolean isDeleteOnly) { isDeleteOnly_ = isDeleteOnly ; }
79
80 public void setListInfoField(String fieldName, List<String> listInfor) {
81 listInfor_.put(fieldName, listInfor) ;
82 }
83
84 public List<String> getListInfoField(String fieldName) {
85 if(listInfor_.containsKey(fieldName)) return listInfor_.get(fieldName) ;
86 return null ;
87 }
88
89 public void setInfoField(String fieldName, String fieldInfo) {
90 infor_.put(fieldName, fieldInfo) ;
91 }
92
93 public String getInfoField(String fieldName) {
94 if(infor_.containsKey(fieldName)) return infor_.get(fieldName) ;
95 return null ;
96 }
97
98 public void setActionInfo(String fieldName, String[] actionNames) {
99 actionInfo_.put(fieldName, actionNames) ;
100 }
101 public String[] getActionInfo(String fieldName) {
102 if(actionInfo_.containsKey(fieldName)) return actionInfo_.get(fieldName) ;
103 return null ;
104 }
105 public void setFieldActions(String fieldName, String[] actionNames) {
106 fieldActions_.put(fieldName, actionNames) ;
107 }
108
109 public String[] getFieldActions(String fieldName) {
110 return fieldActions_.get(fieldName) ;
111 }
112
113 public void setIsView(boolean isView) { isView_ = isView; }
114 public boolean isView() { return isView_ ; }
115
116 public String getBindingField() { return null; }
117
118 public List getValidators() { return null; }
119
120 @SuppressWarnings("unused")
121 public UIFormInput addValidator(Class clazz, Object...params) throws Exception { return this; }
122
123 public Object getValue() throws Exception { return null; }
124
125 @SuppressWarnings("unused")
126 public UIFormInput setValue(Object value) throws Exception { return null; }
127
128 public Class getTypeValue() { return null ; }
129
130 public void setIntroduction(String fieldName, String msgKey) { msgKey_.put(fieldName, msgKey) ; }
131 public String getMsgKey(String fieldName) { return msgKey_.get(fieldName) ; }
132
133 public String getLabel() {
134 return getId();
135 }
136
137 @SuppressWarnings("unused")
138 public UIFormInput addValidator(Class arg0) throws Exception {
139 return null;
140 }
141 }