View Javadoc
1   /*
2    * Copyright (C) 2003-2008 eXo Platform SAS.
3    *
4    * This program is free software; you can redistribute it and/or
5    * modify it under the terms of the GNU Affero General Public License
6    * as published by the Free Software Foundation; either version 3
7    * of the License, or (at your option) any later version.
8    *
9    * This program is distributed in the hope that it will be useful,
10   * but WITHOUT ANY WARRANTY; without even the implied warranty of
11   * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12   * GNU General Public License for more details.
13   *
14   * You should have received a copy of the GNU General Public License
15   * along with this program; if not, see<http://www.gnu.org/licenses/>.
16   */
17  package org.exoplatform.ecm.webui.form.field;
18  
19  import java.util.HashMap;
20  import java.util.Map;
21  
22  import org.exoplatform.ecm.webui.form.DialogFormField;
23  import org.exoplatform.ecm.webui.utils.DialogFormUtil;
24  import org.exoplatform.webui.form.UIFormInputBase;
25  import org.exoplatform.webui.form.UIFormTextAreaInput;
26  
27  /**
28   * Created by The eXo Platform SAS
29   * @author : Hoa.Pham
30   *          hoa.pham@exoplatform.com
31   * Jun 23, 2008
32   */
33  public class UIFormTextAreaField extends DialogFormField {
34  
35    public final static int DEFAULT_ROW = 10;
36    public final static int DEFAULT_COL = 30;
37  
38    public UIFormTextAreaField(String name, String label, String[] arguments) {
39      super(name, label, arguments);
40    }
41  
42    @SuppressWarnings("unchecked")
43    public <T extends UIFormInputBase> T createUIFormInput() throws Exception {
44      UIFormTextAreaInput uiTextArea = new UIFormTextAreaInput(name, name, defaultValue) ;
45      if(validateType != null) {
46        DialogFormUtil.addValidators(uiTextArea, validateType);
47      }
48      if(label != null) uiTextArea.setLabel(label) ;
49      return (T)uiTextArea;
50    }
51  
52    public Map<String, String> getSelectorInfo() {
53      Map<String, String> map = new HashMap<String, String>() ;
54      map.put("selectorClass", selectorClass) ;
55      map.put("returnField", name) ;
56      map.put("selectorIcon", selectorIcon) ;
57      map.put("workspaceField", workspaceField) ;
58      if(selectorParams != null) map.put("selectorParams", selectorParams) ;
59      return map;
60    }
61  
62    public boolean useSelector() { return selectorClass != null; }
63  }