1 /* 2 * Licensed to the Apache Software Foundation (ASF) under one 3 * or more contributor license agreements. See the NOTICE file 4 * distributed with this work for additional information 5 * regarding copyright ownership. The ASF licenses this file 6 * to you under the Apache License, Version 2.0 (the 7 * "License"); you may not use this file except in compliance 8 * with the License. You may obtain a copy of the License at 9 * 10 * http://www.apache.org/licenses/LICENSE-2.0 11 * 12 * Unless required by applicable law or agreed to in writing, 13 * software distributed under the License is distributed on an 14 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 * KIND, either express or implied. See the License for the 16 * specific language governing permissions and limitations 17 * under the License. 18 */ 19 package org.apache.myfaces.custom.newspaper; 20 21 import javax.faces.component.UIComponent; 22 import javax.faces.component.html.HtmlDataTable; 23 24 import org.apache.myfaces.component.AlignProperty; 25 import org.apache.myfaces.component.DataProperties; 26 27 /** 28 * Model for a table in multiple balanced columns. 29 * 30 * The newspaperTable tag allows a long, narrow table to be wrapped 31 * so that it becomes a short, wide table. This allows more information 32 * to be shown on a single screen. This is commonly used to present 33 * checkboxes for a long list of items. 34 * 35 * A data table for rendering long skinny tables as short wide 36 * table by wrapping the table over a specified number of columns. 37 * 38 * Unless otherwise specified, all attributes accept static values or EL expressions. 39 * 40 * @JSFComponent 41 * name = "t:newspaperTable" 42 * class = "org.apache.myfaces.custom.newspaper.HtmlNewspaperTable" 43 * tagClass = "org.apache.myfaces.custom.newspaper.HtmlNewspaperTableTag" 44 * @since 1.1.7 45 * @author <a href="mailto:jesse@odel.on.ca">Jesse Wilson</a> 46 */ 47 public abstract class AbstractHtmlNewspaperTable 48 extends HtmlDataTable implements AlignProperty, DataProperties 49 { 50 /** the component's renderers and type */ 51 public static final String DEFAULT_RENDERER_TYPE = "org.apache.myfaces.HtmlNewspaperTable"; 52 public static final String COMPONENT_TYPE = "org.apache.myfaces.HtmlNewspaperTable"; 53 54 /** the property names */ 55 public static final String NEWSPAPER_COLUMNS_PROPERTY = "newspaperColumns"; 56 public static final String SPACER_FACET_NAME = "spacer"; 57 58 private static final Integer DEFAULT_NEWSPAPER_COLUMNS = new Integer(1); 59 60 /** 61 * Set the number of columns the table will be divided over. 62 * In other words, the number of columns to wrap the table over. Default: 1 63 * 64 * @JSFProperty 65 * defaultValue = "1" 66 */ 67 public abstract int getNewspaperColumns(); 68 69 /** 70 * The orientation of the newspaper columns in the newspaper 71 * table - "horizontal" or "vertical". Default: vertical 72 * 73 * @JSFProperty 74 */ 75 public abstract String getNewspaperOrientation(); 76 77 /** 78 * Gets the spacer facet, between each pair of newspaper columns. 79 */ 80 public UIComponent getSpacer() { 81 return (UIComponent)getFacets().get(SPACER_FACET_NAME); 82 } 83 public void setSpacer(UIComponent spacer) { 84 getFacets().put(SPACER_FACET_NAME, spacer); 85 } 86 87 }