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.renderer;
042:
043: import com.sun.rave.web.ui.component.PageSeparator;
044: import com.sun.rave.web.ui.theme.Theme;
045: import com.sun.rave.web.ui.theme.ThemeStyles;
046: import com.sun.rave.web.ui.util.RenderingUtilities;
047: import com.sun.rave.web.ui.util.ThemeUtilities;
048:
049: import java.io.IOException;
050: import javax.faces.component.UIComponent;
051: import javax.faces.context.FacesContext;
052: import javax.faces.context.ResponseWriter;
053:
054: /**
055: * <p>Renderer for a {@link PageSeparator} component.</p>
056: */
057:
058: public class PageSeparatorRenderer extends AbstractRenderer {
059:
060: // ======================================================== Static Variables
061:
062: /**
063: * <p>The set of String pass-through attributes to be rendered.</p>
064: */
065: private static final String stringAttributes[] = { "onClick",
066: "onDblClick", "onMouseUp", //NOI18N
067: "onMouseDown", "onMouseMove", "onMouseOut", "onMouseOver" }; //NOI18N
068:
069: // -------------------------------------------------------- Renderer Methods
070:
071: /**
072: * <p>Render the appropriate element start, depending on whether the
073: * <code>for</code> property is set or not.</p>
074: *
075: * @param context <code>FacesContext</code> for the current request
076: * @param component StaticText component
077: * @param writer <code>ResponseWriter</code> to which the element
078: * start should be rendered
079: *
080: * @exception IOException if an input/output error occurs
081: */
082: protected void renderStart(FacesContext context,
083: UIComponent component, ResponseWriter writer)
084: throws IOException {
085:
086: }
087:
088: /**
089: * <p>Render the appropriate element attributes, followed by the
090: * label content, depending on whether the <code>for</code> property
091: * is set or not.</p>
092: *
093: * @param context <code>FacesContext</code> for the current request
094: * @param component StaticText component
095: * @param writer <code>ResponseWriter</code> to which the element
096: * start should be rendered
097: *
098: * @exception IOException if an input/output error occurs
099: */
100: protected void renderAttributes(FacesContext context,
101: UIComponent component, ResponseWriter writer)
102: throws IOException {
103:
104: }
105:
106: /**
107: * <p>Render the appropriate element end, depending on whether the
108: * <code>for</code> property is set or not.</p>
109: *
110: * @param context <code>FacesContext</code> for the current request
111: * @param component <code>EditableValueHolder</code> component whose
112: * submitted value is to be stored
113: * @param writer <code>ResponseWriter</code> to which the element
114: * start should be rendered
115: *
116: * @exception IOException if an input/output error occurs
117: */
118: protected void renderEnd(FacesContext context,
119: UIComponent component, ResponseWriter writer)
120: throws IOException {
121: PageSeparator pageSep = (PageSeparator) component;
122:
123: writer.startElement("table", component);
124: String style = pageSep.getStyle();
125: if (style != null) {
126: writer.writeAttribute("style", style, null); // NOI18N
127: }
128: RenderingUtilities.renderStyleClass(context, writer, component,
129: null);
130: writer.writeAttribute("border", "0", null); // NOI18N
131: writer.writeAttribute("width", "100%", null); // NOI18N
132: writer.writeAttribute("cellpadding", "0", null); // NOI18N
133: writer.writeAttribute("cellspacing", "0", null); // NOI18N
134: writer.startElement("tr", component);
135: writer.startElement("td", component);
136: writer.writeAttribute("colspan", "3", null); // NOI18N
137:
138: RenderingUtilities.renderSpacer(context, writer, component, 30,
139: 1);
140: writer.endElement("td");
141: writer.endElement("tr");
142: writer.startElement("tr", component);
143: writer.startElement("td", component);
144: RenderingUtilities.renderSpacer(context, writer, component, 1,
145: 10);
146: writer.endElement("td");
147: writer.startElement("td", component);
148: Theme theme = ThemeUtilities.getTheme(context);
149:
150: writer.writeAttribute("class", theme
151: .getStyleClass(ThemeStyles.TITLE_LINE), null); // NOI18N
152: writer.writeAttribute("width", "100%", null); // NOI18N
153: RenderingUtilities.renderSpacer(context, writer, component, 1,
154: 1);
155: writer.endElement("td");
156: writer.startElement("td", component);
157: RenderingUtilities.renderSpacer(context, writer, component, 1,
158: 10);
159: writer.endElement("td");
160: writer.endElement("tr");
161: writer.endElement("table");
162: }
163:
164: // --------------------------------------------------------- Private Methods
165:
166: }
|