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.utils.XoplonNS; 19 20 25 public abstract class XoplonCtrl { 26 27 protected static Element createCtrl(Document factory, String type) { 28 Element elem = XoplonNS.createElement(factory, type); 29 return elem; 30 } 31 32 33 public static String getId(Element element) { 34 return XoplonNS.getAttribute(element, "id"); 35 } 36 37 38 public static void setId(Element elem, String id) { 39 XoplonNS.setAttribute(elem, "id", id); 40 } 41 42 43 public static void setLabel(Element elem, String label) { 44 if (label == null) 45 XoplonNS.removeAttribute(elem, "label"); 46 else 47 XoplonNS.setAttribute(elem, "label", label); 48 } 49 50 51 public static String getLabel(Element elem) { 52 return XoplonNS.getAttribute(elem, "label"); 53 } 54 55 56 public static void setDisabled(Element elem, boolean disabled) { 57 XoplonNS.setAttribute(elem, "disabled", disabled ? "true" : "false"); 58 } 59 60 61 public static boolean isDisabled(Element elem) { 62 return "true".equals(XoplonNS.getAttribute(elem, "disabled")); 63 } 64 65 66 public static void setHidden(Element elem, boolean disabled) { 67 XoplonNS.setAttribute(elem, "hidden", disabled ? "true" : "false"); 68 } 69 70 71 public static boolean isHidden(Element elem) { 72 return "true".equals(XoplonNS.getAttribute(elem, "hidden")); 73 } 74 75 80 public static void setModelReference(Element elem, String label) { 81 XoplonNS.setAttribute(elem, "modelReference", label); 82 } 83 84 85 public static String getModelReference(Element elem) { 86 return XoplonNS.getAttribute(elem, "modelReference"); 87 } 88 89 } 90 | Popular Tags |