1 28 29 package com.caucho.widget; 30 31 abstract public class XulWidget 32 extends AbstractWidgetContainer 33 { 34 private StringProperty _cssClassProperty = new StringProperty(this, "cssClass", false, getTypeName()); 35 private TransientProperty _transientProperty = new TransientProperty(this); 36 37 41 protected boolean isImmutable() 42 { 43 return getId() == null; 44 } 45 46 public void setCssClass(String cssClass) 47 { 48 _cssClassProperty.setValue(cssClass); 49 } 50 51 public String getCssClass() 52 { 53 return _cssClassProperty.getValue(); 54 } 55 56 protected boolean isContainer() 57 { 58 return false; 59 } 60 61 public void setTransient(boolean isTransient) 62 { 63 _transientProperty.setValue(isTransient); 64 } 65 66 public boolean isTransient() 67 { 68 return _transientProperty.getValue(); 69 } 70 71 public void add(Widget child) 72 { 73 if (!isContainer()) 74 throw new UnsupportedOperationException(); 75 76 super.add(child); 77 } 78 79 public void init(WidgetInit init) 80 throws WidgetException 81 { 82 super.init(init); 83 84 _transientProperty.init(init); 85 _cssClassProperty.init(init); 86 } 87 88 public void setCssClass(VarContext context, String cssClass) 89 { 90 _cssClassProperty.setValue(context, cssClass); 91 } 92 93 public String getCssClass(VarContext context) 94 { 95 return _cssClassProperty.getValue(context); 96 } 97 98 public void setTransient(VarContext context, boolean isTransient) 99 { 100 _transientProperty.setValue(context, isTransient); 101 } 102 103 public boolean isTransient(VarContext context) 104 { 105 return _transientProperty.getValue(context); 106 } 107 } 108 | Popular Tags |