| 1 33 34 package com.icesoft.faces.component.ext; 35 36 import com.icesoft.faces.component.CSS_DEFAULT; 37 import com.icesoft.faces.component.ext.taglib.Util; 38 import com.icesoft.faces.context.effects.Effect; 39 import com.icesoft.faces.context.effects.JavascriptContext; 40 41 import javax.faces.context.FacesContext; 42 import javax.faces.el.ValueBinding; 43 44 45 51 public class HtmlPanelGrid extends javax.faces.component.html.HtmlPanelGrid { 52 public static final String COMPONENT_TYPE = 53 "com.icesoft.faces.HtmlPanelGrid"; 54 public static final String RENDERER_TYPE = "com.icesoft.faces.Grid"; 55 private static final boolean DEFAULT_VISIBLE = true; 56 private String renderedOnUserRole = null; 57 private Effect effect; 58 private Boolean visible = null; 59 60 public HtmlPanelGrid() { 61 super(); 62 setRendererType(RENDERER_TYPE); 63 } 64 65 public void setValueBinding(String s, ValueBinding vb) { 66 if (s != null && s.indexOf("effect") != -1) { 67 JavascriptContext.includeLib(JavascriptContext.ICE_EXTRAS, 69 getFacesContext()); 70 } 71 super.setValueBinding(s, vb); 72 } 73 74 77 public void setVisible(boolean visible) { 78 this.visible = Boolean.valueOf(visible); 79 } 80 81 84 public boolean getVisible() { 85 if (visible != null) { 86 return visible.booleanValue(); 87 } 88 ValueBinding vb = getValueBinding("visible"); 89 Boolean boolVal = 90 vb != null ? (Boolean ) vb.getValue(getFacesContext()) : null; 91 return boolVal != null ? boolVal.booleanValue() : DEFAULT_VISIBLE; 92 } 93 94 97 public void setEffect(Effect effect) { 98 this.effect = effect; 99 JavascriptContext 100 .includeLib(JavascriptContext.ICE_EXTRAS, getFacesContext()); 101 } 102 103 106 public Effect getEffect() { 107 if (effect != null) { 108 return effect; 109 } 110 ValueBinding vb = getValueBinding("effect"); 111 return vb != null ? (Effect) vb.getValue(getFacesContext()) : null; 112 } 113 114 117 public void setRenderedOnUserRole(String renderedOnUserRole) { 118 this.renderedOnUserRole = renderedOnUserRole; 119 } 120 121 124 public String getRenderedOnUserRole() { 125 if (renderedOnUserRole != null) { 126 return renderedOnUserRole; 127 } 128 ValueBinding vb = getValueBinding("renderedOnUserRole"); 129 return vb != null ? (String ) vb.getValue(getFacesContext()) : null; 130 } 131 132 135 public boolean isRendered() { 136 if (!Util.isRenderedOnUserRole(this)) { 137 return false; 138 } 139 return super.isRendered(); 140 } 141 142 146 public Object saveState(FacesContext context) { 147 Object values[] = new Object [5]; 148 values[0] = super.saveState(context); 149 values[1] = renderedOnUserRole; 150 values[2] = effect; 151 values[3] = visible; 152 return ((Object ) (values)); 153 } 154 155 159 public void restoreState(FacesContext context, Object state) { 160 Object values[] = (Object []) state; 161 super.restoreState(context, values[0]); 162 renderedOnUserRole = (String ) values[1]; 163 effect = (Effect) values[2]; 164 visible = (Boolean ) values[3]; 165 } 166 167 168 171 public String getStyleClass() { 172 return Util.getQualifiedStyleClass(this, 173 super.getStyleClass(), 174 CSS_DEFAULT.PANEL_GRID_DEFAULT_STYLE_CLASS, 175 "styleClass"); 176 177 } 178 179 182 public String getHeaderClass() { 183 return Util.getQualifiedStyleClass(this, 184 super.getHeaderClass(), 185 CSS_DEFAULT.HEADER, 186 "headerClass"); 187 } 188 189 192 public String getFooterClass() { 193 return Util.getQualifiedStyleClass(this, 194 super.getFooterClass(), 195 CSS_DEFAULT.FOOTER, 196 "footerClass"); 197 } 198 } 199 | Popular Tags |