001: /*
002: * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
003: *
004: * Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
005: *
006: * The contents of this file are subject to the terms of either the GNU
007: * General Public License Version 2 only ("GPL") or the Common
008: * Development and Distribution License("CDDL") (collectively, the
009: * "License"). You may not use this file except in compliance with the
010: * License. You can obtain a copy of the License at
011: * http://www.netbeans.org/cddl-gplv2.html
012: * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
013: * specific language governing permissions and limitations under the
014: * License. When distributing the software, include this License Header
015: * Notice in each file and include the License file at
016: * nbbuild/licenses/CDDL-GPL-2-CP. Sun designates this
017: * particular file as subject to the "Classpath" exception as provided
018: * by Sun in the GPL Version 2 section of the License file that
019: * accompanied this code. If applicable, add the following below the
020: * License Header, with the fields enclosed by brackets [] replaced by
021: * your own identifying information:
022: * "Portions Copyrighted [year] [name of copyright owner]"
023: *
024: * Contributor(s):
025: *
026: * The Original Software is NetBeans. The Initial Developer of the Original
027: * Software is Sun Microsystems, Inc. Portions Copyright 1997-2007 Sun
028: * Microsystems, Inc. All Rights Reserved.
029: *
030: * If you wish your version of this file to be governed by only the CDDL
031: * or only the GPL Version 2, indicate your decision by adding
032: * "[Contributor] elects to include this software in this distribution
033: * under the [CDDL or GPL Version 2] license." If you do not indicate a
034: * single choice of license, a recipient has the option to distribute
035: * your version of this file under either the CDDL, the GPL Version 2 or
036: * to extend the choice of license to its licensees as provided above.
037: * However, if you add GPL Version 2 code and therefore, elected the GPL
038: * Version 2 license, then the option applies only if the new code is
039: * made subject to such option by the copyright holder.
040: */
041: package com.sun.rave.web.ui.component;
042:
043: import java.io.IOException;
044: import javax.faces.component.UIComponent;
045: import javax.faces.context.FacesContext;
046: import javax.faces.el.MethodBinding;
047: import javax.faces.el.ValueBinding;
048:
049: /**
050: * <p> Use the <code>ui:panelLayout</code> tag to display a group of components
051: * that are related, in either flow layout, or using absolute positioning.
052: * This tag is often useful for
053: * providing a consistently formatted layout of a group of components.</p>
054: * <p>Auto-generated component class.
055: * Do <strong>NOT</strong> modify; all changes
056: * <strong>will</strong> be lost!</p>
057: */
058:
059: public abstract class PanelLayoutBase extends
060: javax.faces.component.UIComponentBase {
061:
062: /**
063: * <p>Construct a new <code>PanelLayoutBase</code>.</p>
064: */
065: public PanelLayoutBase() {
066: super ();
067: setRendererType("com.sun.rave.web.ui.PanelLayout");
068: }
069:
070: /**
071: * <p>Return the identifier of the component family to which this
072: * component belongs. This identifier, in conjunction with the value
073: * of the <code>rendererType</code> property, may be used to select
074: * the appropriate {@link Renderer} for this component instance.</p>
075: */
076: public String getFamily() {
077: return "com.sun.rave.web.ui.PanelLayout";
078: }
079:
080: // panelLayout
081: private String panelLayout = null;
082:
083: /**
084: * <p>Use absolute grid positioning, or flow layout</p>
085: */
086: public String getPanelLayout() {
087: return this .panelLayout;
088: }
089:
090: /**
091: * <p>Use absolute grid positioning, or flow layout</p>
092: * @see #getPanelLayout()
093: */
094: public void setPanelLayout(String panelLayout) {
095: this .panelLayout = panelLayout;
096: }
097:
098: // style
099: private String style = null;
100:
101: /**
102: * <p>CSS style(s) to be applied when this component is rendered.</p>
103: */
104: public String getStyle() {
105: if (this .style != null) {
106: return this .style;
107: }
108: ValueBinding _vb = getValueBinding("style");
109: if (_vb != null) {
110: return (String) _vb.getValue(getFacesContext());
111: }
112: return null;
113: }
114:
115: /**
116: * <p>CSS style(s) to be applied when this component is rendered.</p>
117: * @see #getStyle()
118: */
119: public void setStyle(String style) {
120: this .style = style;
121: }
122:
123: // styleClass
124: private String styleClass = null;
125:
126: /**
127: * <p>CSS style class(es) to be applied when this component is rendered.</p>
128: */
129: public String getStyleClass() {
130: if (this .styleClass != null) {
131: return this .styleClass;
132: }
133: ValueBinding _vb = getValueBinding("styleClass");
134: if (_vb != null) {
135: return (String) _vb.getValue(getFacesContext());
136: }
137: return null;
138: }
139:
140: /**
141: * <p>CSS style class(es) to be applied when this component is rendered.</p>
142: * @see #getStyleClass()
143: */
144: public void setStyleClass(String styleClass) {
145: this .styleClass = styleClass;
146: }
147:
148: // visible
149: private boolean visible = false;
150: private boolean visible_set = false;
151:
152: /**
153: * <p>Use the visible attribute to indicate whether the component should be
154: * viewable by the user in the rendered HTML page. If set to false, the
155: * HTML code for the component is present in the page, but the component
156: * is hidden with style attributes. By default, visible is set to true, so
157: * HTML for the component HTML is included and visible to the user. If the
158: * component is not visible, it can still be processed on subsequent form
159: * submissions because the HTML is present.</p>
160: */
161: public boolean isVisible() {
162: if (this .visible_set) {
163: return this .visible;
164: }
165: ValueBinding _vb = getValueBinding("visible");
166: if (_vb != null) {
167: Object _result = _vb.getValue(getFacesContext());
168: if (_result == null) {
169: return false;
170: } else {
171: return ((Boolean) _result).booleanValue();
172: }
173: }
174: return true;
175: }
176:
177: /**
178: * <p>Use the visible attribute to indicate whether the component should be
179: * viewable by the user in the rendered HTML page. If set to false, the
180: * HTML code for the component is present in the page, but the component
181: * is hidden with style attributes. By default, visible is set to true, so
182: * HTML for the component HTML is included and visible to the user. If the
183: * component is not visible, it can still be processed on subsequent form
184: * submissions because the HTML is present.</p>
185: * @see #isVisible()
186: */
187: public void setVisible(boolean visible) {
188: this .visible = visible;
189: this .visible_set = true;
190: }
191:
192: /**
193: * <p>Restore the state of this component.</p>
194: */
195: public void restoreState(FacesContext _context, Object _state) {
196: Object _values[] = (Object[]) _state;
197: super .restoreState(_context, _values[0]);
198: this .panelLayout = (String) _values[1];
199: this .style = (String) _values[2];
200: this .styleClass = (String) _values[3];
201: this .visible = ((Boolean) _values[4]).booleanValue();
202: this .visible_set = ((Boolean) _values[5]).booleanValue();
203: }
204:
205: /**
206: * <p>Save the state of this component.</p>
207: */
208: public Object saveState(FacesContext _context) {
209: Object _values[] = new Object[6];
210: _values[0] = super .saveState(_context);
211: _values[1] = this .panelLayout;
212: _values[2] = this .style;
213: _values[3] = this .styleClass;
214: _values[4] = this .visible ? Boolean.TRUE : Boolean.FALSE;
215: _values[5] = this.visible_set ? Boolean.TRUE : Boolean.FALSE;
216: return _values;
217: }
218:
219: }
|