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.DropDown;
044: import com.sun.rave.web.ui.component.Label;
045: import com.sun.rave.web.ui.component.Table;
046: import com.sun.rave.web.ui.component.TablePanels;
047: import com.sun.rave.web.ui.model.Option;
048: import com.sun.rave.web.ui.theme.Theme;
049: import com.sun.rave.web.ui.theme.ThemeStyles;
050: import com.sun.rave.web.ui.util.LogUtil;
051: import com.sun.rave.web.ui.util.RenderingUtilities;
052: import com.sun.rave.web.ui.util.ThemeUtilities;
053:
054: import java.io.IOException;
055:
056: import javax.faces.component.UIComponent;
057: import javax.faces.component.NamingContainer;
058: import javax.faces.context.FacesContext;
059: import javax.faces.context.ResponseWriter;
060: import javax.faces.render.Renderer;
061:
062: /**
063: * This class renders TablePanels components.
064: * <p>
065: * Note: To see the messages logged by this class, set the following global
066: * defaults in your JDK's "jre/lib/logging.properties" file.
067: * </p><p><pre>
068: * java.util.logging.ConsoleHandler.level = FINE
069: * com.sun.rave.web.ui.renderer.TablePanelsRenderer.level = FINE
070: * </pre></p>
071: */
072: public class TablePanelsRenderer extends Renderer {
073: /**
074: * The set of String pass-through attributes to be rendered.
075: * <p>
076: * Note: The WIDTH, HEIGHT, and BGCOLOR attributes are all deprecated (in
077: * the HTML 4.0 spec) in favor of style sheets. In addition, the DIR and
078: * LANG attributes are not cuurently supported.
079: * </p>
080: */
081: private static final String stringAttributes[] = { "abbr", //NOI18N
082: "align", //NOI18N
083: "axis", //NOI18N
084: "bgColor", //NOI18N
085: "char", //NOI18N
086: "charOff", //NOI18N
087: "dir", //NOI18N
088: "headers", //NOI18N
089: "height", //NOI18N
090: "lang", //NOI18N
091: "onClick", //NOI18N
092: "onDblClick", //NOI18N
093: "onKeyDown", //NOI18N
094: "onKeyPress", //NOI18N
095: "onKeyUp", //NOI18N
096: "onMouseDown", //NOI18N
097: "onMouseUp", //NOI18N
098: "onMouseMove", //NOI18N
099: "onMouseOut", //NOI18N
100: "onMouseOver", //NOI18N
101: "style", //NOI18N
102: "valign", //NOI18N
103: "width" }; //NOI18N
104:
105: // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
106: // Renderer methods
107: // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
108:
109: /**
110: * Render the beginning of the specified UIComponent to the output stream or
111: * writer associated with the response we are creating.
112: *
113: * @param context FacesContext for the current request.
114: * @param component UIComponent to be rendered.
115: *
116: * @exception IOException if an input/output error occurs.
117: * @exception NullPointerException if context or component is null.
118: */
119: public void encodeBegin(FacesContext context, UIComponent component)
120: throws IOException {
121: if (context == null || component == null) {
122: log("encodeBegin", //NOI18N
123: "Cannot render, FacesContext or UIComponent is null"); //NOI18N
124: throw new NullPointerException();
125: }
126: if (!component.isRendered()) {
127: log("encodeBegin",
128: "Component not rendered, nothing to display"); //NOI18N
129: return;
130: }
131:
132: TablePanels panel = (TablePanels) component;
133: ResponseWriter writer = context.getResponseWriter();
134: renderEnclosingTagStart(context, panel, writer);
135: }
136:
137: /**
138: * Render the children of the specified UIComponent to the output stream or
139: * writer associated with the response we are creating.
140: *
141: * @param context FacesContext for the current request.
142: * @param component UIComponent to be decoded.
143: *
144: * @exception IOException if an input/output error occurs.
145: * @exception NullPointerException if context or component is null.
146: */
147: public void encodeChildren(FacesContext context,
148: UIComponent component) throws IOException {
149: if (context == null || component == null) {
150: log("encodeChildren", //NOI18N
151: "Cannot render, FacesContext or UIComponent is null"); //NOI18N
152: throw new NullPointerException();
153: }
154: if (!component.isRendered()) {
155: log("encodeChildren",
156: "Component not rendered, nothing to display"); //NOI18N
157: return;
158: }
159:
160: TablePanels panel = (TablePanels) component;
161: ResponseWriter writer = context.getResponseWriter();
162:
163: // Render panels.
164: if (panel.isFilterPanel()) {
165: renderFilterPanel(context, panel, writer);
166: }
167: if (panel.isPreferencesPanel()) {
168: renderPreferencesPanel(context, panel, writer);
169: }
170: renderSortPanel(context, panel, writer);
171: }
172:
173: /**
174: * Render the ending of the specified UIComponent to the output stream or
175: * writer associated with the response we are creating.
176: *
177: * @param context FacesContext for the current request.
178: * @param component UIComponent to be rendered.
179: *
180: * @exception IOException if an input/output error occurs.
181: * @exception NullPointerException if context or component is null.
182: */
183: public void encodeEnd(FacesContext context, UIComponent component)
184: throws IOException {
185: if (context == null || component == null) {
186: log("encodeEnd", //NOI18N
187: "Cannot render, FacesContext or UIComponent is null"); //NOI18N
188: throw new NullPointerException();
189: }
190: if (!component.isRendered()) {
191: log("encodeEnd",
192: "Component not rendered, nothing to display"); //NOI18N
193: return;
194: }
195:
196: TablePanels panel = (TablePanels) component;
197: ResponseWriter writer = context.getResponseWriter();
198: renderEnclosingTagEnd(context, panel, writer);
199: }
200:
201: /**
202: * Return a flag indicating whether this Renderer is responsible
203: * for rendering the children the component it is asked to render.
204: * The default implementation returns false.
205: */
206: public boolean getRendersChildren() {
207: return true;
208: }
209:
210: // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
211: // Panel methods
212: // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
213:
214: /**
215: * Render filter panel for TablePanels components.
216: *
217: * @param context FacesContext for the current request.
218: * @param component TablePanels to be rendered.
219: * @param writer ResponseWriter to which the component should be rendered.
220: *
221: * @exception IOException if an input/output error occurs.
222: */
223: protected void renderFilterPanel(FacesContext context,
224: TablePanels component, ResponseWriter writer)
225: throws IOException {
226: if (component == null) {
227: log("renderFilterPanel", //NOI18N
228: "Cannot render filter panel, TablePanels is null"); //NOI18N
229: return;
230: }
231:
232: // Get facet.
233: Table table = component.getTableAncestor();
234: UIComponent facet = (table != null) ? table
235: .getFacet(Table.FILTER_PANEL_FACET) : null;
236: if (!(facet != null && facet.isRendered())) {
237: log("renderFilterPanel", //NOI18N
238: "Filter panel not rendered, nothing to display"); //NOI18N
239: return;
240: }
241:
242: // Render filter panel.
243: renderPanelStart(context, component, writer,
244: TablePanels.FILTER_PANEL_ID, getTheme().getMessage(
245: "table.panel.filterTitle")); //NOI18N
246: RenderingUtilities.renderComponent(facet, context);
247: renderPanelEnd(writer);
248: }
249:
250: /**
251: * Render preferences panel for TablePanels components.
252: *
253: * @param context FacesContext for the current request.
254: * @param component TablePanels to be rendered.
255: * @param writer ResponseWriter to which the component should be rendered.
256: *
257: * @exception IOException if an input/output error occurs.
258: */
259: protected void renderPreferencesPanel(FacesContext context,
260: TablePanels component, ResponseWriter writer)
261: throws IOException {
262: if (component == null) {
263: log("renderPreferencesPanel", //NOI18N
264: "Cannot render preferences panel, TablePanels is null"); //NOI18N
265: return;
266: }
267:
268: // Get facet.
269: Table table = component.getTableAncestor();
270: UIComponent facet = (table != null) ? table
271: .getFacet(Table.PREFERENCES_PANEL_FACET) : null;
272: if (!(facet != null && facet.isRendered())) {
273: log("renderPreferencesPanel", //NOI18N
274: "Preferences panel not rendered, nothing to display"); //NOI18N
275: return;
276: }
277:
278: // Render filter panel.
279: renderPanelStart(context, component, writer,
280: TablePanels.PREFERENCES_PANEL_ID, getTheme()
281: .getMessage("table.panel.preferencesTitle")); //NOI18N
282: RenderingUtilities.renderComponent(facet, context);
283: renderPanelEnd(writer);
284: }
285:
286: /**
287: * Render sort panel for TablePanels components.
288: *
289: * @param context FacesContext for the current request.
290: * @param component TablePanels to be rendered.
291: * @param writer ResponseWriter to which the component should be rendered.
292: *
293: * @exception IOException if an input/output error occurs.
294: */
295: protected void renderSortPanel(FacesContext context,
296: TablePanels component, ResponseWriter writer)
297: throws IOException {
298: if (component == null) {
299: log("renderSortPanel", //NOI18N
300: "Cannot render sort panel, TablePanels is null"); //NOI18N
301: return;
302: }
303:
304: // Render filter panel.
305: renderPanelStart(context, component, writer,
306: TablePanels.SORT_PANEL_ID, getTheme().getMessage(
307: "table.panel.sortTitle")); //NOI18N
308:
309: // Get facet.
310: Table table = component.getTableAncestor();
311: UIComponent facet = (table != null) ? table
312: .getFacet(Table.SORT_PANEL_FACET) : null;
313: if (facet != null && facet.isRendered()) {
314: RenderingUtilities.renderComponent(facet, context);
315: } else {
316: renderSortPanelLayout(context, component, writer);
317: }
318: renderPanelEnd(writer);
319: }
320:
321: // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
322: // Enclosing tag methods
323: // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
324:
325: /**
326: * Render enclosing tag for TablePanels components.
327: *
328: * @param context FacesContext for the current request.
329: * @param component TablePanels to be rendered.
330: * @param writer ResponseWriter to which the component should be rendered.
331: *
332: * @exception IOException if an input/output error occurs.
333: */
334: protected void renderEnclosingTagStart(FacesContext context,
335: TablePanels component, ResponseWriter writer)
336: throws IOException {
337: if (component == null) {
338: log("renderEnclosingTagStart", //NOI18N
339: "Cannot render enclosing tag, TablePanels is null"); //NOI18N
340: return;
341: }
342:
343: writer.writeText("\n", null); //NOI18N
344: writer.startElement("td", component); //NOI18N
345: writer.writeAttribute("id", component.getClientId(context),
346: null); //NOI18N
347:
348: // Render style class.
349: String extraHtml = RenderingUtilities.renderStyleClass(context,
350: writer, component, ThemeStyles.TABLE_PANEL_TD,
351: component.getExtraHtml());
352:
353: // Render colspan.
354: if (component.getColSpan() > -1
355: && (extraHtml == null || extraHtml.indexOf("colspan=") == -1)) { //NOI18N
356: writer.writeAttribute("colspan", //NOI18N
357: Integer.toString(component.getColSpan()), null); //NOI18N
358: }
359:
360: // Render rowspan.
361: if (component.getRowSpan() > -1
362: && (extraHtml == null || extraHtml.indexOf("rowspan=") == -1)) { //NOI18N
363: writer.writeAttribute("rowspan", //NOI18N
364: Integer.toString(component.getRowSpan()), null); //NOI18N
365: }
366:
367: // Render nowrap.
368: if (component.isNoWrap()
369: && (extraHtml == null || extraHtml.indexOf("nowrap=") == -1)) { //NOI18N
370: writer.writeAttribute("nowrap", "nowrap", null); //NOI18N
371: }
372:
373: // Render tooltip.
374: if (component.getToolTip() != null
375: && (extraHtml == null || extraHtml.indexOf("title=") == -1)) { //NOI18N
376: writer.writeAttribute("title", component.getToolTip(),
377: "toolTip"); //NOI18N
378: }
379:
380: // Render pass through attributes.
381: RenderingUtilities.writeStringAttributes(component, writer,
382: stringAttributes, extraHtml);
383: }
384:
385: /**
386: * Render enclosing tag for TablePanels components.
387: *
388: * @param context FacesContext for the current request.
389: * @param component TablePanels to be rendered.
390: * @param writer ResponseWriter to which the component should be rendered.
391: *
392: * @exception IOException if an input/output error occurs.
393: */
394: protected void renderEnclosingTagEnd(FacesContext context,
395: TablePanels component, ResponseWriter writer)
396: throws IOException {
397: if (component == null) {
398: log("renderEnclosingTagEnd", //NOI18N
399: "Cannot render enclosing tag, TablePanels is null"); //NOI18N
400: return;
401: }
402: writer.endElement("td"); //NOI18N
403: }
404:
405: // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
406: // Private methods
407: // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
408:
409: /**
410: * Get component id.
411: *
412: * @param component The parent UIComponent component.
413: * @param id The id of the the component to be rendered.
414: */
415: private String getId(UIComponent component, String id) {
416: String clientId = component.getClientId(FacesContext
417: .getCurrentInstance());
418: return clientId + NamingContainer.SEPARATOR_CHAR + id;
419: }
420:
421: /** Helper method to get Theme objects. */
422: private Theme getTheme() {
423: return ThemeUtilities.getTheme(FacesContext
424: .getCurrentInstance());
425: }
426:
427: /**
428: * Log fine messages.
429: */
430: private void log(String method, String message) {
431: // Get class.
432: Class clazz = this .getClass();
433: if (LogUtil.fineEnabled(clazz)) {
434: // Log method name and message.
435: LogUtil.fine(clazz, clazz.getName() + "." + method + ": "
436: + message); //NOI18N
437: }
438: }
439:
440: /**
441: * Helper method to render embedded panel for TablePanels components.
442: *
443: * @param context FacesContext for the current request.
444: * @param component TablePanels to be rendered.
445: * @param writer ResponseWriter to which the component should be rendered.
446: * @param id The identifier for the component.
447: * @param title The title for the panel.
448: *
449: * @exception IOException if an input/output error occurs.
450: */
451: private void renderPanelStart(FacesContext context,
452: TablePanels component, ResponseWriter writer, String id,
453: String title) throws IOException {
454: if (component == null) {
455: log("renderPanelStart",
456: "Cannot render panel, TablePanels is null"); //NOI18N
457: return;
458: }
459:
460: Theme theme = getTheme();
461: writer.writeText("\n", null); //NOI18N
462: writer.startElement("div", component); //NOI18N
463:
464: // Render client id.
465: writer.writeAttribute("id", getId(component, id), null); //NOI18N
466:
467: // Render style (i.e., div is initially hidden).
468: writer.writeAttribute("class", theme
469: .getStyleClass(ThemeStyles.HIDDEN), //NOI18N
470: null);
471:
472: // Render div used to create drop shadow effect.
473: writer.writeText("\n", null); //NOI18N
474: writer.startElement("div", component); //NOI18N
475:
476: // Render style class.
477: writer.writeAttribute("class", theme.getStyleClass( //NOI18N
478: ThemeStyles.TABLE_PANEL_SHADOW3_DIV), null);
479:
480: // Render div used to create drop shadow effect.
481: writer.writeText("\n", null); //NOI18N
482: writer.startElement("div", component); //NOI18N
483:
484: // Render style class.
485: writer.writeAttribute("class", theme.getStyleClass( //NOI18N
486: ThemeStyles.TABLE_PANEL_SHADOW2_DIV), null);
487:
488: // Render div used to create drop shadow effect.
489: writer.writeText("\n", null); //NOI18N
490: writer.startElement("div", component); //NOI18N
491:
492: // Render style class.
493: writer.writeAttribute("class", theme.getStyleClass( //NOI18N
494: ThemeStyles.TABLE_PANEL_SHADOW1_DIV), null);
495:
496: // Render div used to create the yellow box itself.
497: writer.writeText("\n", null); //NOI18N
498: writer.startElement("div", component); //NOI18N
499:
500: // Render style class.
501: writer.writeAttribute("class", theme.getStyleClass( //NOI18N
502: ThemeStyles.TABLE_PANEL_DIV), null);
503:
504: // Render div used to format the title in the box.
505: writer.writeText("\n", null); //NOI18N
506: writer.startElement("div", component); //NOI18N
507:
508: // Render style class.
509: writer.writeAttribute("class", theme.getStyleClass( //NOI18N
510: ThemeStyles.TABLE_PANEL_TITLE), null);
511:
512: // Render title.
513: writer.writeText(title, null);
514: writer.endElement("div"); //NOI18N
515:
516: // Render div for whatever content goes in the box.
517: writer.writeText("\n", null); //NOI18N
518: writer.startElement("div", component); //NOI18N
519:
520: // Render style class.
521: writer.writeAttribute("class", theme.getStyleClass( //NOI18N
522: ThemeStyles.TABLE_PANEL_CONTENT), null);
523: }
524:
525: /**
526: * Helper method to render embedded panel for Table components.
527: *
528: * @param writer ResponseWriter to which the component should be rendered.
529: *
530: * @exception IOException if an input/output error occurs.
531: */
532: private void renderPanelEnd(ResponseWriter writer)
533: throws IOException {
534: writer.endElement("div"); //NOI18N
535: writer.endElement("div"); //NOI18N
536: writer.endElement("div"); //NOI18N
537: writer.endElement("div"); //NOI18N
538: writer.endElement("div"); //NOI18N
539: writer.endElement("div"); //NOI18N
540: }
541:
542: /**
543: * Helper method to render sort panel layout for Table components.
544: *
545: * @param context FacesContext for the current request.
546: * @param component TablePanels to be rendered.
547: * @param writer ResponseWriter to which the component should be rendered.
548: *
549: * @exception IOException if an input/output error occurs.
550: */
551: private void renderSortPanelLayout(FacesContext context,
552: TablePanels component, ResponseWriter writer)
553: throws IOException {
554: if (component == null) {
555: log("renderSortPanelLayout", //NOI18N
556: "Cannot render sort panel layout, TablePanels is null"); //NOI18N
557: return;
558: }
559:
560: Theme theme = getTheme();
561: writer.writeText("\n", null); //NOI18N
562: writer.startElement("table", component); //NOI18N
563: writer.writeAttribute(
564: "class", //NOI18N
565: theme.getStyleClass(ThemeStyles.TABLE_PANEL_TABLE),
566: null);
567: writer.writeAttribute("border", "0", null); //NOI18N
568: writer.writeAttribute("cellpadding", "0", null); //NOI18N
569: writer.writeAttribute("cellspacing", "0", null); //NOI18N
570:
571: // Render primary sort column menu.
572: renderSortPanelRow(context, component, writer, component
573: .getPrimarySortColumnMenuLabel(), component
574: .getPrimarySortColumnMenu(), component
575: .getPrimarySortOrderMenu());
576:
577: // Render secondary sort column menu if there are more than 2 choices,
578: // including the none selected option.
579: UIComponent menu = component.getSecondarySortColumnMenu();
580: Option[] options = (menu instanceof DropDown) ? (Option[]) ((DropDown) menu)
581: .getItems()
582: : null;
583: if (options != null && options.length > 2) {
584: renderSortPanelRow(context, component, writer, component
585: .getSecondarySortColumnMenuLabel(), menu, component
586: .getSecondarySortOrderMenu());
587: } else {
588: log("renderSortPanelLayout", //NOI18N
589: "Secondary sort column menu not rendered"); //NOI18N
590: }
591:
592: // Render tertiary sort column menu if there are more than 3 choices,
593: // including the none selected option.
594: menu = component.getTertiarySortColumnMenu();
595: options = (menu instanceof DropDown) ? (Option[]) ((DropDown) menu)
596: .getItems()
597: : null;
598: if (options != null && options.length > 3) {
599: renderSortPanelRow(context, component, writer, component
600: .getTertiarySortColumnMenuLabel(), menu, component
601: .getTertiarySortOrderMenu());
602: } else {
603: log("renderSortPanelLayout", //NOI18N
604: "Tertiary sort column menu not rendered"); //NOI18N
605: }
606:
607: writer.endElement("table"); //NOI18N
608: writer.writeText("\n", null); //NOI18N
609: writer.startElement("div", component); //NOI18N
610: writer.writeAttribute("class", theme.getStyleClass( //NOI18N
611: ThemeStyles.TABLE_PANEL_BUTTON_DIV), null);
612:
613: // Render ok and cancel buttons.
614: RenderingUtilities.renderComponent(component
615: .getSortPanelSubmitButton(), context);
616: RenderingUtilities.renderComponent(component
617: .getSortPanelCancelButton(), context);
618:
619: writer.endElement("div"); //NOI18N
620:
621: // Render help tip.
622: writer.writeText("\n", null); //NOI18N
623: writer.startElement("br", component); //NOI18N
624: writer.endElement("br"); //NOI18N
625: writer.startElement("br", component); //NOI18N
626: writer.endElement("br"); //NOI18N
627: writer.writeText("\n", null); //NOI18N
628: writer.startElement("div", component); //NOI18N
629: writer.writeAttribute("class", theme.getStyleClass( //NOI18N
630: ThemeStyles.TABLE_PANEL_HELP_TEXT), null);
631: writer.writeText(theme.getMessage("table.panel.help"), null); //NOI18N
632: writer.endElement("div"); //NOI18N
633: }
634:
635: /**
636: * Helper method to render sort panel row for Table components.
637: *
638: * @param context FacesContext for the current request.
639: * @param component TablePanels to be rendered.
640: * @param writer ResponseWriter to which the component should be rendered.
641: * @param label The sort label.
642: * @param columnMenu The sort column menu.
643: * @param orderMenu The sort order menu.
644: *
645: * @exception IOException if an input/output error occurs.
646: */
647: private void renderSortPanelRow(FacesContext context,
648: TablePanels component, ResponseWriter writer,
649: UIComponent label, UIComponent columnMenu,
650: UIComponent orderMenu) throws IOException {
651: if (component == null) {
652: log("renderSortPanelRow", //NOI18N
653: "Cannot render sort panel row, TablePanels is null"); //NOI18N
654: return;
655: }
656:
657: writer.writeText("\n", null); //NOI18N
658: writer.startElement("tr", component); //NOI18N
659: writer.writeText("\n", null); //NOI18N
660: writer.startElement("td", component); //NOI18N
661:
662: // Render primary sort column menu label.
663: if (label instanceof Label) {
664: ((Label) label).setLabeledComponent(columnMenu);
665: RenderingUtilities.renderComponent(label, context);
666: } else {
667: log("renderSortPanelRow", //NOI18N
668: "Cannot render label, not Label instance"); //NOI18N
669: }
670:
671: writer.endElement("td"); //NOI18N
672: writer.writeText("\n", null); //NOI18N
673: writer.startElement("td", component); //NOI18N
674:
675: // Render primary sort column menu.
676: RenderingUtilities.renderComponent(columnMenu, context);
677:
678: writer.endElement("td"); //NOI18N
679: writer.writeText("\n", null); //NOI18N
680: writer.startElement("td", component); //NOI18N
681:
682: // Render primary sort order menu.
683: RenderingUtilities.renderComponent(orderMenu, context);
684:
685: writer.endElement("td"); //NOI18N
686: writer.endElement("tr"); //NOI18N
687: }
688: }
|