1 13 package com.tonbeller.wcf.ui; 14 15 import org.w3c.dom.Document ; 16 import org.w3c.dom.Element ; 17 18 import com.tonbeller.wcf.format.FormatException; 19 import com.tonbeller.wcf.utils.XoplonNS; 20 21 25 public class TextArea extends EditCtrl { 26 public static final String NODENAME = "textArea"; 27 28 public static boolean isTextArea(Element elem) { 29 return elem.getNodeName().equals(NODENAME); 30 } 31 32 33 public static Element createTextArea(Document doc, int iRows) throws FormatException { 34 Element retVal = createValueHolder(doc, NODENAME); 35 setRows(retVal, iRows); 36 return retVal; 37 } 38 39 40 public static Element addTextArea(Element parent, int iRows) throws FormatException { 41 Element textArea = createTextArea(parent.getOwnerDocument(), iRows); 42 parent.appendChild(textArea); 43 return textArea; 44 } 45 46 47 public static void setRows(Element element, int rows) throws FormatException { 48 XoplonNS.setAttribute(element, "rows", Integer.toString(rows)); 49 } 50 51 52 public static int getRows(Element element) throws FormatException { 53 return Integer.parseInt(XoplonNS.getAttribute(element, "rows")); 54 } 55 56 57 public static void setCols(Element element, int cols) throws FormatException { 58 XoplonNS.setAttribute(element, "cols", Integer.toString(cols)); 59 } 60 61 62 public static int getCols(Element element) throws FormatException { 63 return Integer.parseInt(XoplonNS.getAttribute(element, "cols")); 64 } 65 } 66 | Popular Tags |