001: /*
002: * Version: MPL 1.1/GPL 2.0/LGPL 2.1
003: *
004: * "The contents of this file are subject to the Mozilla Public License
005: * Version 1.1 (the "License"); you may not use this file except in
006: * compliance with the License. You may obtain a copy of the License at
007: * http://www.mozilla.org/MPL/
008: *
009: * Software distributed under the License is distributed on an "AS IS"
010: * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the
011: * License for the specific language governing rights and limitations under
012: * the License.
013: *
014: * The Original Code is ICEfaces 1.5 open source software code, released
015: * November 5, 2006. The Initial Developer of the Original Code is ICEsoft
016: * Technologies Canada, Corp. Portions created by ICEsoft are Copyright (C)
017: * 2004-2006 ICEsoft Technologies Canada, Corp. All Rights Reserved.
018: *
019: * Contributor(s): _____________________.
020: *
021: * Alternatively, the contents of this file may be used under the terms of
022: * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"
023: * License), in which case the provisions of the LGPL License are
024: * applicable instead of those above. If you wish to allow use of your
025: * version of this file only under the terms of the LGPL License and not to
026: * allow others to use your version of this file under the MPL, indicate
027: * your decision by deleting the provisions above and replace them with
028: * the notice and other provisions required by the LGPL License. If you do
029: * not delete the provisions above, a recipient may use your version of
030: * this file under either the MPL or the LGPL License."
031: *
032: */
033:
034: package com.icesoft.faces.component.panelseries;
035:
036: import com.icesoft.faces.component.CSS_DEFAULT;
037: import com.icesoft.faces.component.ext.taglib.Util;
038:
039: import javax.faces.component.UIComponent;
040: import javax.faces.component.UIData;
041: import javax.faces.context.FacesContext;
042: import javax.faces.el.ValueBinding;
043:
044: /**
045: * PanelSeries is a JSF component class representing an ICEfaces panelSeries.
046: * <p>The panelSeries component provides a mechanism for dynamically generating
047: * a series of repeating child-components within a panel. This component renders
048: * its child components in an iterative fashion similar to way the dataTable
049: * component renders data rows. However, the panelSeries component is more
050: * flexibile in that it can render a series of arbitrarily complex child
051: * components. The dataset can be defined and used by implementing the value and
052: * var attributes respectively.
053: * <p/>
054: * By default this component is rendered by the "com.icesoft.faces.PanelSeriesRenderer"
055: * renderer type.
056: *
057: * @version beta 1.0
058: */
059: public class PanelSeries extends UISeries {
060: public static final String COMPONENT_TYPE = "com.icesoft.faces.PanelSeries";
061: public static final String RENDERER_TYPE = "com.icesoft.faces.PanelSeriesRenderer";
062: public static final String COMPONENT_FAMILY = "javax.faces.Panel";
063: private String style = null;
064: private String styleClass = null;
065:
066: public PanelSeries() {
067: super ();
068: setRendererType(RENDERER_TYPE);
069: }
070:
071: /*
072: * (non-Javadoc)
073: * @see javax.faces.component.UIComponent#getFamily()
074: */
075: public String getFamily() {
076: return (COMPONENT_FAMILY);
077: }
078:
079: /*
080: * (non-Javadoc)
081: * @see javax.faces.component.UIComponent#isRendered()
082: */
083: public boolean isRendered() {
084: if (!Util.isRenderedOnUserRole(this )) {
085: return false;
086: }
087: return super .isRendered();
088: }
089:
090: /**
091: * <p>Set the value of the <code>styleClass</code> property.</p>
092: *
093: * @return style class property value.
094: */
095: public String getStyleClass() {
096: return Util.getQualifiedStyleClass(this , styleClass,
097: CSS_DEFAULT.PANEL_SERIES_DEFAULT_CLASS, "styleClass");
098: }
099:
100: /**
101: * <p>Set the value of the <code>styleClass</code> property.</p>
102: */
103: public void setStyleClass(String styleClass) {
104: this .styleClass = styleClass;
105: }
106:
107: /**
108: * <p>Set the value of the <code>style</code> property.</p>
109: *
110: * @return style property value.
111: */
112: public String getStyle() {
113: if (style != null) {
114: return style;
115: }
116: ValueBinding vb = getValueBinding("style");
117: return vb != null ? (String) vb.getValue(getFacesContext())
118: : null;
119: }
120:
121: /**
122: * <p>Set the value of the <code>style</code> property.</p>
123: */
124: public void setStyle(String style) {
125: this .style = style;
126: }
127:
128: /*
129: * (non-Javadoc)
130: * @see com.icesoft.faces.component.panelseries.UISeries#restoreChild(javax.faces.context.FacesContext, javax.faces.component.UIComponent)
131: */
132: protected void restoreChild(FacesContext facesContext,
133: UIComponent uiComponent) {
134: super .restoreChild(facesContext, uiComponent);
135: if (uiComponent instanceof UIData) {
136: String clientId = uiComponent.getClientId(facesContext);
137: Object value = savedChildren.get(clientId);
138: ((UIData) uiComponent).setValue(value);
139: }
140: }
141:
142: /*
143: * (non-Javadoc)
144: * @see com.icesoft.faces.component.panelseries.UISeries#saveChild(javax.faces.context.FacesContext, javax.faces.component.UIComponent)
145: */
146: protected void saveChild(FacesContext facesContext,
147: UIComponent uiComponent) {
148: super .saveChild(facesContext, uiComponent);
149: if (uiComponent instanceof UIData) {
150: String clientId = uiComponent.getClientId(facesContext);
151: savedChildren.put(clientId, ((UIData) uiComponent)
152: .getValue());
153: }
154: }
155: }
|