You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@myfaces.apache.org by to...@apache.org on 2006/12/05 02:11:40 UTC
svn commit: r482436 - in /myfaces/tomahawk/trunk/sandbox:
core/src/main/java/org/apache/myfaces/custom/table/
core/src/main/resources-facesconfig/META-INF/ core/src/main/tld/
core/src/main/tld/entities/
examples/src/main/java/org/apache/myfaces/example...
Author: tomsp
Date: Mon Dec 4 17:11:38 2006
New Revision: 482436
URL: http://svn.apache.org/viewvc?view=rev&rev=482436
Log:
TOMAHAWK-815 new component FilterTable
Added:
myfaces/tomahawk/trunk/sandbox/core/src/main/java/org/apache/myfaces/custom/table/
myfaces/tomahawk/trunk/sandbox/core/src/main/java/org/apache/myfaces/custom/table/FilterTable.java
myfaces/tomahawk/trunk/sandbox/core/src/main/java/org/apache/myfaces/custom/table/FilterTableRenderer.java
myfaces/tomahawk/trunk/sandbox/core/src/main/java/org/apache/myfaces/custom/table/FilterTableTag.java
myfaces/tomahawk/trunk/sandbox/core/src/main/java/org/apache/myfaces/custom/table/SortableColumn.java
myfaces/tomahawk/trunk/sandbox/core/src/main/java/org/apache/myfaces/custom/table/SortableColumnTag.java
myfaces/tomahawk/trunk/sandbox/core/src/main/tld/entities/filter_table_attributes.xml
myfaces/tomahawk/trunk/sandbox/core/src/main/tld/entities/sortable_column_attributes.xml
myfaces/tomahawk/trunk/sandbox/examples/src/main/java/org/apache/myfaces/examples/data/
myfaces/tomahawk/trunk/sandbox/examples/src/main/java/org/apache/myfaces/examples/data/SortableTableBean.java
myfaces/tomahawk/trunk/sandbox/examples/src/main/webapp/filterTable.jsp
myfaces/tomahawk/trunk/sandbox/examples/src/main/webapp/images/ft-head.gif (with props)
myfaces/tomahawk/trunk/sandbox/examples/src/main/webapp/images/ft-headdown.gif (with props)
myfaces/tomahawk/trunk/sandbox/examples/src/main/webapp/images/ft-headup.gif (with props)
Modified:
myfaces/tomahawk/trunk/sandbox/core/src/main/resources-facesconfig/META-INF/faces-config.xml
myfaces/tomahawk/trunk/sandbox/core/src/main/tld/myfaces_sandbox.tld
myfaces/tomahawk/trunk/sandbox/examples/src/main/webapp/WEB-INF/examples-config.xml
Added: myfaces/tomahawk/trunk/sandbox/core/src/main/java/org/apache/myfaces/custom/table/FilterTable.java
URL: http://svn.apache.org/viewvc/myfaces/tomahawk/trunk/sandbox/core/src/main/java/org/apache/myfaces/custom/table/FilterTable.java?view=auto&rev=482436
==============================================================================
--- myfaces/tomahawk/trunk/sandbox/core/src/main/java/org/apache/myfaces/custom/table/FilterTable.java (added)
+++ myfaces/tomahawk/trunk/sandbox/core/src/main/java/org/apache/myfaces/custom/table/FilterTable.java Mon Dec 4 17:11:38 2006
@@ -0,0 +1,159 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.myfaces.custom.table;
+
+import javax.faces.component.UIData;
+import javax.faces.el.ValueBinding;
+import javax.faces.context.FacesContext;
+
+/**
+ * @author Thomas Spiegl
+ */
+public class FilterTable extends UIData {
+ public static final String COMPONENT_TYPE = "org.apache.myfaces.FilterTable";
+
+ private String _styleClass = null;
+ private String _headClass;
+ private String _tbodyClass;
+ private Boolean _multiple;
+ private Boolean _alternateRows;
+ private Integer _maxSortable;
+ private Integer _cellpadding;
+ private Integer _cellspacing;
+ private Integer _border;
+
+ public String getStyleClass() {
+ if (_styleClass != null) return _styleClass;
+ ValueBinding vb = getValueBinding("styleClass");
+ return vb != null ? (String)vb.getValue(getFacesContext()) : null;
+ }
+
+ public void setStyleClass(String styleClass) {
+ _styleClass = styleClass;
+ }
+
+ public String getHeadClass() {
+ if (_headClass != null) return _headClass;
+ ValueBinding vb = getValueBinding("headClass");
+ return vb != null ? (String)vb.getValue(getFacesContext()) : null;
+ }
+
+ public void setHeadClass(String headClass) {
+ _headClass = headClass;
+ }
+
+ public String getTbodyClass() {
+ if (_tbodyClass != null) return _tbodyClass;
+ ValueBinding vb = getValueBinding("tbodyClass");
+ return vb != null ? (String)vb.getValue(getFacesContext()) : null;
+ }
+
+ public void setTbodyClass(String tbodyClass) {
+ _tbodyClass = tbodyClass;
+ }
+
+ public Boolean getMultiple() {
+ if (_multiple != null) return _multiple;
+ ValueBinding vb = getValueBinding("enableMultipleSelect");
+ return vb != null ? (Boolean)vb.getValue(getFacesContext()) : null;
+ }
+
+ public void setMultiple(Boolean multiple) {
+ _multiple = multiple;
+ }
+
+ public Boolean getAlternateRows() {
+ if (_alternateRows != null) return _alternateRows;
+ ValueBinding vb = getValueBinding("enableAlternateRows");
+ return vb != null ? (Boolean)vb.getValue(getFacesContext()) : null;
+ }
+
+ public void setAlternateRows(Boolean alternateRows) {
+ _alternateRows = alternateRows;
+ }
+
+ public Integer getMaxSortable() {
+ if (_maxSortable != null) return _maxSortable;
+ ValueBinding vb = getValueBinding("maxSortable");
+ return vb != null ? (Integer)vb.getValue(getFacesContext()) : null;
+ }
+
+ public void setMaxSortable(Integer maxSortable) {
+ _maxSortable = maxSortable;
+ }
+
+ public Integer getCellpadding() {
+ if (_cellpadding != null) return _cellpadding;
+ ValueBinding vb = getValueBinding("cellpadding");
+ return vb != null ? (Integer)vb.getValue(getFacesContext()) : null;
+ }
+
+ public void setCellpadding(Integer cellpadding) {
+ _cellpadding = cellpadding;
+ }
+
+ public Integer getCellspacing() {
+ if (_cellspacing != null) return _cellspacing;
+ ValueBinding vb = getValueBinding("cellspacing");
+ return vb != null ? (Integer)vb.getValue(getFacesContext()) : null;
+ }
+
+ public void setCellspacing(Integer cellspacing) {
+ _cellspacing = cellspacing;
+ }
+
+ public Integer getBorder() {
+ if (_border != null) return _border;
+ ValueBinding vb = getValueBinding("border");
+ return vb != null ? (Integer)vb.getValue(getFacesContext()) : null;
+ }
+
+ public void setBorder(Integer border) {
+ _border = border;
+ }
+
+ public Object saveState(FacesContext context) {
+ Object[] obj = new Object[11];
+ obj[0] = super.saveState(context);
+ obj[2] = _styleClass;
+ obj[3] = _headClass;
+ obj[4] = _tbodyClass;
+ obj[5] = _multiple;
+ obj[6] = _alternateRows;
+ obj[7] = _maxSortable;
+ obj[8] = _cellpadding;
+ obj[9] = _cellspacing;
+ obj[10] = _border;
+ return obj;
+ }
+
+ public void restoreState(FacesContext context, Object state) {
+ Object[] obj = (Object[]) state;
+ super.restoreState(context, obj[0]);
+ _styleClass = (String) obj[2];
+ _headClass = (String) obj[3];
+ _tbodyClass = (String) obj[4];
+ _multiple = (Boolean) obj[5];
+ _alternateRows = (Boolean) obj[6];
+ _maxSortable = (Integer) obj[7];
+ _cellpadding = (Integer) obj[8];
+ _cellspacing = (Integer) obj[9];
+ _border = (Integer) obj[10];
+ }
+}
Added: myfaces/tomahawk/trunk/sandbox/core/src/main/java/org/apache/myfaces/custom/table/FilterTableRenderer.java
URL: http://svn.apache.org/viewvc/myfaces/tomahawk/trunk/sandbox/core/src/main/java/org/apache/myfaces/custom/table/FilterTableRenderer.java?view=auto&rev=482436
==============================================================================
--- myfaces/tomahawk/trunk/sandbox/core/src/main/java/org/apache/myfaces/custom/table/FilterTableRenderer.java (added)
+++ myfaces/tomahawk/trunk/sandbox/core/src/main/java/org/apache/myfaces/custom/table/FilterTableRenderer.java Mon Dec 4 17:11:38 2006
@@ -0,0 +1,203 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.myfaces.custom.table;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.apache.myfaces.custom.dojo.DojoUtils;
+import org.apache.myfaces.shared_tomahawk.renderkit.JSFAttr;
+import org.apache.myfaces.shared_tomahawk.renderkit.RendererUtils;
+import org.apache.myfaces.shared_tomahawk.renderkit.html.HTML;
+import org.apache.myfaces.shared_tomahawk.renderkit.html.HtmlRenderer;
+import org.apache.myfaces.shared_tomahawk.renderkit.html.HtmlRendererUtils;
+
+import javax.faces.component.UIColumn;
+import javax.faces.component.UIComponent;
+import javax.faces.component.UIData;
+import javax.faces.context.FacesContext;
+import javax.faces.context.ResponseWriter;
+import java.io.IOException;
+import java.util.List;
+import java.util.Iterator;
+
+/**
+ * @author Thomas Spiegl
+ */
+public class FilterTableRenderer extends HtmlRenderer {
+
+ public static final String RENDERER_TYPE = "org.apache.myfaces.FilterTable";
+
+ private Log log = LogFactory.getLog(FilterTableRenderer.class);
+
+ public boolean getRendersChildren() {
+ return true;
+ }
+
+ public void decode(FacesContext context, UIComponent component) {
+ super.decode(context, component);
+ }
+
+ public void encodeBegin(FacesContext context, UIComponent component) throws IOException {
+ RendererUtils.checkParamValidity(context, component, FilterTable.class);
+ ResponseWriter writer = context.getResponseWriter();
+
+ FilterTable table = (FilterTable) component;
+
+ String javascriptLocation = (String) component.getAttributes().get(JSFAttr.JAVASCRIPT_LOCATION);
+ DojoUtils.addMainInclude(context, component, javascriptLocation, DojoUtils.getDjConfigInstance(context));
+ DojoUtils.addRequire(context, component, "dojo.widget.FilteringTable");
+
+ writer.write("<table dojoType=\"filteringTable\" id=\"" + component.getClientId(context) + "\" ");
+ if (table.getHeadClass() != null) {
+ writer.write("headClass=\"" + table.getHeadClass() + "\" " );
+ } else {
+ writer.write("headClass=\"fixedHeader\" " );
+ }
+ if (table.getTbodyClass() != null) {
+ writer.write("tbodyClass=\"" + table.getTbodyClass() + "\" ");
+ } else {
+ writer.write("tbodyClass=\"scrollContent\" ");
+ }
+ if (table.getMultiple() != null) {
+ String value = table.getMultiple().booleanValue() ? "true" : "false";
+ writer.write("multiple=\"" + value + "\" ");
+ } else {
+ writer.write("multiple=\"true\" ");
+ }
+ if (table.getAlternateRows() != null) {
+ String value = table.getAlternateRows().booleanValue() ? "true" : "false";
+ writer.write("alternateRows=\""+ value + "\" ");
+ } else {
+ writer.write("alternateRows=\"true\" ");
+ }
+ if (table.getMaxSortable() != null) {
+ writer.write("maxSortable=\"" + table.getMaxSortable() + "\" ");
+ } else {
+ writer.write("maxSortable=\"1\" ");
+ }
+ if (table.getCellpadding() != null) {
+ writer.write("cellpadding=\"" + table.getCellpadding() + "\" ");
+ } else {
+ writer.write("cellpadding=\"0\" ");
+ }
+ if (table.getCellspacing() != null) {
+ writer.write("cellspacing=\"" + table.getCellspacing() + "\" ");
+ } else {
+ writer.write("cellspacing=\"0\" ");
+ }
+ if (table.getBorder() != null) {
+ writer.write("border=\"" + table.getBorder() + "\"");
+ } else {
+ writer.write("border=\"0\"");
+ }
+ writer.write(">");
+ encodeHeader(context, component);
+ }
+
+ public void encodeHeader(FacesContext context, UIComponent component) throws IOException {
+ ResponseWriter writer = context.getResponseWriter();
+ writer.startElement(HTML.THEAD_ELEM, component);
+ writer.startElement(HTML.TR_ELEM, component);
+ for (Iterator it = component.getChildren().iterator(); it.hasNext(); ) {
+ UIComponent child = (UIComponent) it.next();
+ if (child.isRendered() && child instanceof SortableColumn) {
+ SortableColumn col = (SortableColumn) child;
+ UIComponent header = col.getHeader();
+ if (header != null) {
+ writer.startElement(HTML.TH_ELEM, header);
+ if (col.getField() != null) {
+ writer.writeAttribute("field", col.getField(), null);
+ }
+ if (col.getDataType() != null) {
+ writer.writeAttribute("dataType", col.getDataType(), null);
+ } else {
+ writer.writeAttribute("dataType", "String", null);
+ }
+ RendererUtils.renderChild(context, header);
+ writer.endElement(HTML.TH_ELEM);
+ }
+ }
+ }
+ writer.endElement(HTML.TR_ELEM);
+ writer.endElement(HTML.THEAD_ELEM);
+ }
+
+ public void encodeChildren(FacesContext facesContext, UIComponent component) throws IOException
+ {
+ HtmlRendererUtils.writePrettyLineSeparator(facesContext);
+ ResponseWriter writer = facesContext.getResponseWriter();
+
+ writer.startElement(HTML.TBODY_ELEM, component);
+ encodeInnerHtml(facesContext, component);
+ writer.endElement(HTML.TBODY_ELEM);
+ }
+
+ protected void encodeInnerHtml(FacesContext facesContext, UIComponent component)throws IOException{
+ UIData uiData = (UIData) component;
+ ResponseWriter writer = facesContext.getResponseWriter();
+
+ int first = uiData.getFirst();
+ int rows = uiData.getRows();
+ int last;
+ if (rows <= 0) {
+ last = uiData.getRowCount();
+ }
+ else {
+ last = first + rows;
+ if (last > uiData.getRowCount()) {
+ last=uiData.getRowCount();
+ }
+ }
+ for(int idx = first; idx < last; idx++) {
+ // bail if any row does not exist
+ uiData.setRowIndex(idx);
+ if(!uiData.isRowAvailable()) {
+ log.error("Row is not available. Rowindex = " + idx);
+ break;
+ }
+
+ writer.startElement(HTML.TR_ELEM, component);
+ writer.writeAttribute("value", Integer.toString(idx + 1), null);
+ List children = getChildren(component);
+ for (int j = 0, size = getChildCount(component); j < size; j++) {
+ UIComponent child = (UIComponent) children.get(j);
+ if (child.isRendered()) {
+ boolean columnRendering = child instanceof UIColumn;
+ if (columnRendering)
+ encodeColumnChild(facesContext, writer, uiData, child);
+ }
+ }
+ writer.endElement(HTML.TR_ELEM);
+ }
+ }
+
+ protected void encodeColumnChild(FacesContext facesContext, ResponseWriter writer, UIData uiData,
+ UIComponent component) throws IOException {
+ writer.startElement(HTML.TD_ELEM, uiData);
+ RendererUtils.renderChild(facesContext, component);
+ writer.endElement(HTML.TD_ELEM);
+ }
+
+ public void encodeEnd(FacesContext context, UIComponent component) throws IOException {
+ RendererUtils.checkParamValidity(context, component, UIData.class);
+ ResponseWriter writer = context.getResponseWriter();
+ writer.endElement(HTML.TABLE_ELEM);
+ HtmlRendererUtils.writePrettyLineSeparator(context);
+ }
+}
Added: myfaces/tomahawk/trunk/sandbox/core/src/main/java/org/apache/myfaces/custom/table/FilterTableTag.java
URL: http://svn.apache.org/viewvc/myfaces/tomahawk/trunk/sandbox/core/src/main/java/org/apache/myfaces/custom/table/FilterTableTag.java?view=auto&rev=482436
==============================================================================
--- myfaces/tomahawk/trunk/sandbox/core/src/main/java/org/apache/myfaces/custom/table/FilterTableTag.java (added)
+++ myfaces/tomahawk/trunk/sandbox/core/src/main/java/org/apache/myfaces/custom/table/FilterTableTag.java Mon Dec 4 17:11:38 2006
@@ -0,0 +1,126 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.myfaces.custom.table;
+
+import org.apache.myfaces.shared_tomahawk.renderkit.JSFAttr;
+import org.apache.myfaces.shared_tomahawk.taglib.html.HtmlComponentTagBase;
+
+import javax.faces.component.UIComponent;
+
+/**
+ * @author Thomas Spiegl
+ */
+public class FilterTableTag extends HtmlComponentTagBase {
+
+ public static final String HEAD_CLASS_ATTR = "headClass";
+ public static final String TBODY_CLASS_ATTR = "tbodyClass";
+ public static final String MULTIPLE_SELECT_ATTR = "multiple";
+ public static final String ALETERNATE_ROWS_ATTR = "alternateRows";
+ public static final String MAX_SELECTABLE_ATTR = "maxSelectable";
+ public static final String CELLPADING_ATTR = "cellpadding";
+ public static final String CELLSPACING_ATTR = "cellspacing";
+ public static final String BORDER_ATTR = "border";
+
+ private String _var;
+ private String _styleClass;
+ private String _headClass;
+ private String _tbodyClass;
+ private String _mulitiple;
+ private String _alternateRows;
+ private String _maxSortable;
+ private String _cellpadding;
+ private String _cellspacing;
+ private String _border;
+
+ public String getComponentType() {
+ return FilterTable.COMPONENT_TYPE;
+ }
+
+ public String getRendererType() {
+ return FilterTableRenderer.RENDERER_TYPE;
+ }
+
+ protected void setProperties(UIComponent component) {
+ super.setProperties(component);
+ setStringProperty(component, JSFAttr.VAR_ATTR, _var);
+ setStringProperty(component, JSFAttr.STYLE_CLASS_ATTR, _styleClass);
+ setStringProperty(component, HEAD_CLASS_ATTR, _headClass);
+ setStringProperty(component, TBODY_CLASS_ATTR, _tbodyClass);
+ setBooleanProperty(component, MULTIPLE_SELECT_ATTR, _mulitiple);
+ setBooleanProperty(component, ALETERNATE_ROWS_ATTR, _alternateRows);
+ setIntegerProperty(component, MAX_SELECTABLE_ATTR, _maxSortable);
+ setIntegerProperty(component, CELLPADING_ATTR, _cellpadding);
+ setIntegerProperty(component, CELLSPACING_ATTR, _cellspacing);
+ setIntegerProperty(component, BORDER_ATTR, _border);
+ }
+
+ public void setVar(String var) {
+ _var = var;
+ }
+
+ public void setStyleClass(String styleClass) {
+ _styleClass = styleClass;
+ }
+
+ public void setHeadClass(String headClass) {
+ _headClass = headClass;
+ }
+
+ public void setTbodyClass(String tbodyClass) {
+ _tbodyClass = tbodyClass;
+ }
+
+ public void setMulitiple(String mulitiple) {
+ _mulitiple = mulitiple;
+ }
+
+ public void setAlternateRows(String alternateRows) {
+ _alternateRows = alternateRows;
+ }
+
+ public void setMaxSortable(String maxSortable) {
+ _maxSortable = maxSortable;
+ }
+
+ public void setCellpadding(String cellpadding) {
+ _cellpadding = cellpadding;
+ }
+
+ public void setCellspacing(String cellspacing) {
+ _cellspacing = cellspacing;
+ }
+
+ public void setBorder(String border) {
+ _border = border;
+ }
+
+ public void release() {
+ super.release();
+ _var = null;
+ _styleClass = null;
+ _headClass = null;
+ _tbodyClass = null;
+ _mulitiple = null;
+ _alternateRows = null;
+ _maxSortable = null;
+ _cellpadding = null;
+ _cellspacing = null;
+ _border = null;
+ }
+}
Added: myfaces/tomahawk/trunk/sandbox/core/src/main/java/org/apache/myfaces/custom/table/SortableColumn.java
URL: http://svn.apache.org/viewvc/myfaces/tomahawk/trunk/sandbox/core/src/main/java/org/apache/myfaces/custom/table/SortableColumn.java?view=auto&rev=482436
==============================================================================
--- myfaces/tomahawk/trunk/sandbox/core/src/main/java/org/apache/myfaces/custom/table/SortableColumn.java (added)
+++ myfaces/tomahawk/trunk/sandbox/core/src/main/java/org/apache/myfaces/custom/table/SortableColumn.java Mon Dec 4 17:11:38 2006
@@ -0,0 +1,102 @@
+package org.apache.myfaces.custom.table;
+
+import javax.faces.component.UIColumn;
+import javax.faces.el.ValueBinding;
+import javax.faces.context.FacesContext;
+
+/**
+ * @author Thomas Spiegl
+ */
+public class SortableColumn extends UIColumn {
+ public static final String COMPONENT_TYPE = "org.apache.myfaces.SortableColumn";
+
+ private String _field;
+ private String _dataType;
+ private String _sort;
+ private String _format;
+ private String _align;
+ private String _valign;
+
+ public String getField() {
+ if (_field != null) return _field;
+ ValueBinding vb = getValueBinding("field");
+ return vb != null ? (String)vb.getValue(getFacesContext()) : null;
+ }
+
+ public void setField(String field) {
+ _field = field;
+ }
+
+ public String getDataType() {
+ if (_dataType != null) return _dataType;
+ ValueBinding vb = getValueBinding("dataType");
+ return vb != null ? (String)vb.getValue(getFacesContext()) : null;
+ }
+
+ public void setDataType(String dataType) {
+ _dataType = dataType;
+ }
+
+ public String getSort() {
+ if (_sort != null) return _sort;
+ ValueBinding vb = getValueBinding("sort");
+ return vb != null ? (String)vb.getValue(getFacesContext()) : null;
+ }
+
+ public void setSort(String sort) {
+ _sort = sort;
+ }
+
+ public String getFormat() {
+ if (_format != null) return _format;
+ ValueBinding vb = getValueBinding("format");
+ return vb != null ? (String)vb.getValue(getFacesContext()) : null;
+ }
+
+ public void setFormat(String format) {
+ _format = format;
+ }
+
+ public String getAlign() {
+ if (_align != null) return _align;
+ ValueBinding vb = getValueBinding("align");
+ return vb != null ? (String)vb.getValue(getFacesContext()) : null;
+ }
+
+ public void setAlign(String align) {
+ _align = align;
+ }
+
+ public String getValign() {
+ if (_valign != null) return _valign;
+ ValueBinding vb = getValueBinding("valign");
+ return vb != null ? (String)vb.getValue(getFacesContext()) : null;
+ }
+
+ public void setValign(String valign) {
+ _valign = valign;
+ }
+
+ public Object saveState(FacesContext context) {
+ Object[] obj = new Object[7];
+ obj[0] = super.saveState(context);
+ obj[1] = _field;
+ obj[2] = _dataType;
+ obj[3] = _sort;
+ obj[4] = _format;
+ obj[5] = _align;
+ obj[6] = _valign;
+ return obj;
+ }
+
+ public void restoreState(FacesContext context, Object state) {
+ Object[] obj = (Object[]) state;
+ super.restoreState(context, obj[0]);
+ _field = (String) obj[1];
+ _dataType = (String) obj[2];
+ _sort = (String) obj[3];
+ _format = (String) obj[3];
+ _align = (String) obj[3];
+ _valign = (String) obj[3];
+ }
+}
Added: myfaces/tomahawk/trunk/sandbox/core/src/main/java/org/apache/myfaces/custom/table/SortableColumnTag.java
URL: http://svn.apache.org/viewvc/myfaces/tomahawk/trunk/sandbox/core/src/main/java/org/apache/myfaces/custom/table/SortableColumnTag.java?view=auto&rev=482436
==============================================================================
--- myfaces/tomahawk/trunk/sandbox/core/src/main/java/org/apache/myfaces/custom/table/SortableColumnTag.java (added)
+++ myfaces/tomahawk/trunk/sandbox/core/src/main/java/org/apache/myfaces/custom/table/SortableColumnTag.java Mon Dec 4 17:11:38 2006
@@ -0,0 +1,107 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.myfaces.custom.table;
+
+import org.apache.myfaces.shared_tomahawk.taglib.html.HtmlComponentBodyTagBase;
+
+import javax.faces.component.UIComponent;
+
+/**
+ * @author Thomas Spiegl
+ */
+public class SortableColumnTag extends HtmlComponentBodyTagBase {
+
+ private static final String FIELD_ATTR = "field";
+ private static final String DATA_TYPE_ATTR = "dataType";
+ private static final String SORT_ATTR = "sort";
+ private static final String FORMAT_ATTR = "format";
+ private static final String ALIGN_ATTR = "align";
+ private static final String VALIGN_ATTR = "valign";
+
+ private String _field;
+ private String _dataType;
+ private String _sort;
+ private String _format;
+ private String _align;
+ private String _valign;
+
+ public String getComponentType() {
+ return SortableColumn.COMPONENT_TYPE;
+ }
+
+ public String getRendererType() {
+ return null;
+ }
+
+ protected void setProperties(UIComponent component) {
+ super.setProperties(component);
+ setStringProperty(component, FIELD_ATTR, _field);
+ setStringProperty(component, DATA_TYPE_ATTR, _dataType);
+ setStringProperty(component, SORT_ATTR, _sort);
+ setStringProperty(component, FORMAT_ATTR, _format);
+ setStringProperty(component, ALIGN_ATTR, _align);
+ setStringProperty(component, VALIGN_ATTR, _valign);
+ }
+
+ public String getField() {
+ return _field;
+ }
+
+ public void setField(String field) {
+ _field = field;
+ }
+
+ public String getDataType() {
+ return _dataType;
+ }
+
+ public void setDataType(String dataType) {
+ _dataType = dataType;
+ }
+
+ public String getSort() {
+ return _sort;
+ }
+
+ public void setSort(String sort) {
+ _sort = sort;
+ }
+
+ public void setFormat(String format) {
+ _format = format;
+ }
+
+ public void setAlign(String align) {
+ _align = align;
+ }
+
+ public void setValign(String valign) {
+ _valign = valign;
+ }
+
+ public void release() {
+ super.release();
+ _field = null;
+ _dataType = null;
+ _sort = null;
+ _format = null;
+ _align = null;
+ _valign = null;
+ }
+}
Modified: myfaces/tomahawk/trunk/sandbox/core/src/main/resources-facesconfig/META-INF/faces-config.xml
URL: http://svn.apache.org/viewvc/myfaces/tomahawk/trunk/sandbox/core/src/main/resources-facesconfig/META-INF/faces-config.xml?view=diff&rev=482436&r1=482435&r2=482436
==============================================================================
--- myfaces/tomahawk/trunk/sandbox/core/src/main/resources-facesconfig/META-INF/faces-config.xml (original)
+++ myfaces/tomahawk/trunk/sandbox/core/src/main/resources-facesconfig/META-INF/faces-config.xml Mon Dec 4 17:11:38 2006
@@ -121,16 +121,16 @@
<component-type>org.apache.myfaces.OutputLinkDynamic</component-type>
<component-class>org.apache.myfaces.custom.outputlinkdynamic.OutputLinkDynamic</component-class>
</component>
-
- <component>
- <component-type>org.apache.myfaces.TogglePanel</component-type>
- <component-class>org.apache.myfaces.custom.toggle.TogglePanel</component-class>
- </component>
-
- <component>
- <component-type>org.apache.myfaces.ToggleGroup</component-type>
- <component-class>org.apache.myfaces.custom.toggle.ToggleGroup</component-class>
- </component>
+
+ <component>
+ <component-type>org.apache.myfaces.TogglePanel</component-type>
+ <component-class>org.apache.myfaces.custom.toggle.TogglePanel</component-class>
+ </component>
+
+ <component>
+ <component-type>org.apache.myfaces.ToggleGroup</component-type>
+ <component-class>org.apache.myfaces.custom.toggle.ToggleGroup</component-class>
+ </component>
<component>
<component-type>org.apache.myfaces.ToggleLink</component-type>
@@ -254,7 +254,15 @@
<component-class>org.apache.myfaces.custom.dojolayouts.FloatingPaneBase</component-class>
</component>
+ <component>
+ <component-type>org.apache.myfaces.FilterTable</component-type>
+ <component-class>org.apache.myfaces.custom.table.FilterTable</component-class>
+ </component>
+ <component>
+ <component-type>org.apache.myfaces.SortableColumn</component-type>
+ <component-class>org.apache.myfaces.custom.table.SortableColumn</component-class>
+ </component>
<!-- sandbox converters -->
@@ -401,18 +409,18 @@
<renderer-type>org.apache.myfaces.OutputLinkDynamicRenderer</renderer-type>
<renderer-class>org.apache.myfaces.custom.outputlinkdynamic.OutputLinkDynamicRenderer</renderer-class>
</renderer>
-
- <renderer>
- <component-family>javax.faces.Panel</component-family>
- <renderer-type>org.apache.myfaces.TogglePanel</renderer-type>
- <renderer-class>org.apache.myfaces.custom.toggle.TogglePanelRenderer</renderer-class>
- </renderer>
-
- <renderer>
- <component-family>javax.faces.Panel</component-family>
- <renderer-type>org.apache.myfaces.ToggleGroup</renderer-type>
- <renderer-class>org.apache.myfaces.custom.toggle.ToggleGroupRenderer</renderer-class>
- </renderer>
+
+ <renderer>
+ <component-family>javax.faces.Panel</component-family>
+ <renderer-type>org.apache.myfaces.TogglePanel</renderer-type>
+ <renderer-class>org.apache.myfaces.custom.toggle.TogglePanelRenderer</renderer-class>
+ </renderer>
+
+ <renderer>
+ <component-family>javax.faces.Panel</component-family>
+ <renderer-type>org.apache.myfaces.ToggleGroup</renderer-type>
+ <renderer-class>org.apache.myfaces.custom.toggle.ToggleGroupRenderer</renderer-class>
+ </renderer>
<renderer>
<component-family>javax.faces.Output</component-family>
@@ -526,7 +534,11 @@
<renderer-class>org.apache.myfaces.custom.dojolayouts.FloatingPaneBaseRenderer</renderer-class>
</renderer>
-
+ <renderer>
+ <component-family>javax.faces.Data</component-family>
+ <renderer-type>org.apache.myfaces.FilterTable</renderer-type>
+ <renderer-class>org.apache.myfaces.custom.table.FilterTableRenderer</renderer-class>
+ </renderer>
<!-- <renderer>
Added: myfaces/tomahawk/trunk/sandbox/core/src/main/tld/entities/filter_table_attributes.xml
URL: http://svn.apache.org/viewvc/myfaces/tomahawk/trunk/sandbox/core/src/main/tld/entities/filter_table_attributes.xml?view=auto&rev=482436
==============================================================================
--- myfaces/tomahawk/trunk/sandbox/core/src/main/tld/entities/filter_table_attributes.xml (added)
+++ myfaces/tomahawk/trunk/sandbox/core/src/main/tld/entities/filter_table_attributes.xml Mon Dec 4 17:11:38 2006
@@ -0,0 +1,82 @@
+<attribute>
+ <name>value</name>
+ <required>false</required>
+ <rtexprvalue>false</rtexprvalue>
+ <description>An EL expression that specifies the data model that backs this table. The value can be of any type.
+
+ A value of type DataModel is used directly. Array-like parameters of type java.util.List, array of Object,
+ java.sql.ResultSet, or javax.servlet.jsp.jstl.sql.Result are wrapped in a DataModel.
+
+ Other values are wrapped in a DataModel as a single row.</description>
+</attribute>
+
+<attribute>
+ <name>var</name>
+ <required>true</required>
+ <rtexprvalue>false</rtexprvalue>
+ <description>Defines the name of the request-scope variable that will hold the current row during iteration. This value must be a static value.</description>
+</attribute>
+
+<attribute>
+ <name>styleClass</name>
+ <required>false</required>
+ <rtexprvalue>false</rtexprvalue>
+ <description>CSS style class attribute</description>
+</attribute>
+
+<attribute>
+ <name>headClass</name>
+ <required>false</required>
+ <rtexprvalue>false</rtexprvalue>
+ <description>default=fixedHeader see http://dojotoolkit.org filterTable</description>
+</attribute>
+
+<attribute>
+ <name>tbodyClass</name>
+ <required>false</required>
+ <rtexprvalue>false</rtexprvalue>
+ <description>default=scrollContent see http://dojotoolkit.org filterTable</description>
+</attribute>
+
+<attribute>
+ <name>multiple</name>
+ <required>false</required>
+ <rtexprvalue>false</rtexprvalue>
+ <description>default=true see http://dojotoolkit.org filterTable</description>
+</attribute>
+
+<attribute>
+ <name>alternateRows</name>
+ <required>false</required>
+ <rtexprvalue>false</rtexprvalue>
+ <description>default=true see http://dojotoolkit.org filterTable</description>
+</attribute>
+
+<attribute>
+ <name>maxSortable</name>
+ <required>false</required>
+ <rtexprvalue>false</rtexprvalue>
+ <description>default=1 see http://dojotoolkit.org filterTable</description>
+</attribute>
+
+
+<attribute>
+ <name>cellpadding</name>
+ <required>false</required>
+ <rtexprvalue>false</rtexprvalue>
+ <description>default=0</description>
+</attribute>
+
+<attribute>
+ <name>cellspacing</name>
+ <required>false</required>
+ <rtexprvalue>false</rtexprvalue>
+ <description>default=0</description>
+</attribute>
+
+<attribute>
+ <name>border</name>
+ <required>false</required>
+ <rtexprvalue>false</rtexprvalue>
+ <description>default=0</description>
+</attribute>
Added: myfaces/tomahawk/trunk/sandbox/core/src/main/tld/entities/sortable_column_attributes.xml
URL: http://svn.apache.org/viewvc/myfaces/tomahawk/trunk/sandbox/core/src/main/tld/entities/sortable_column_attributes.xml?view=auto&rev=482436
==============================================================================
--- myfaces/tomahawk/trunk/sandbox/core/src/main/tld/entities/sortable_column_attributes.xml (added)
+++ myfaces/tomahawk/trunk/sandbox/core/src/main/tld/entities/sortable_column_attributes.xml Mon Dec 4 17:11:38 2006
@@ -0,0 +1,41 @@
+<attribute>
+ <name>field</name>
+ <required>false</required>
+ <rtexprvalue>false</rtexprvalue>
+ <description>see http://dojotoolkit.org org filterTable</description>
+</attribute>
+
+<attribute>
+ <name>dataType</name>
+ <required>false</required>
+ <rtexprvalue>false</rtexprvalue>
+ <description>default=String {Number,Date,html,String} see http://dojotoolkit.org org filterTable</description>
+</attribute>
+
+<attribute>
+ <name>sort</name>
+ <required>false</required>
+ <rtexprvalue>false</rtexprvalue>
+ <description>{asc, desc} see http://dojotoolkit.org org filterTable</description>
+</attribute>
+
+<attribute>
+ <name>format</name>
+ <required>false</required>
+ <rtexprvalue>false</rtexprvalue>
+ <description>{asc, desc} see http://dojotoolkit.org org filterTable</description>
+</attribute>
+
+<attribute>
+ <name>align</name>
+ <required>false</required>
+ <rtexprvalue>false</rtexprvalue>
+ <description>{asc, desc} see http://dojotoolkit.org org filterTable</description>
+</attribute>
+
+<attribute>
+ <name>valign</name>
+ <required>false</required>
+ <rtexprvalue>false</rtexprvalue>
+ <description>{asc, desc} see http://dojotoolkit.org org filterTable</description>
+</attribute>
Modified: myfaces/tomahawk/trunk/sandbox/core/src/main/tld/myfaces_sandbox.tld
URL: http://svn.apache.org/viewvc/myfaces/tomahawk/trunk/sandbox/core/src/main/tld/myfaces_sandbox.tld?view=diff&rev=482436&r1=482435&r2=482436
==============================================================================
--- myfaces/tomahawk/trunk/sandbox/core/src/main/tld/myfaces_sandbox.tld (original)
+++ myfaces/tomahawk/trunk/sandbox/core/src/main/tld/myfaces_sandbox.tld Mon Dec 4 17:11:38 2006
@@ -142,12 +142,11 @@
<!ENTITY submit_on_event_attributes SYSTEM "entities/submit_on_event_attributes.xml">
<!ENTITY excel_export_attributes SYSTEM "entities/excel_export_attributes.xml">
<!ENTITY dojowidget_attributes SYSTEM "entities/dojowidget_attributes.xml">
-
<!ENTITY floatingpane_base_attributes SYSTEM "entities/floatingpane_base_attributes.xml">
-
+<!ENTITY filter_table_attributes SYSTEM "entities/filter_table_attributes.xml">
+<!ENTITY sortable_column_attributes SYSTEM "entities/sortable_column_attributes.xml">
]>
-
<taglib>
<tlib-version>1.0.10</tlib-version>
@@ -1573,5 +1572,24 @@
&floatingpane_base_attributes;
</tag>
+ <!-- sortableTable -->
+ <tag>
+ <name>filterTable</name>
+ <tag-class>org.apache.myfaces.custom.table.FilterTableTag</tag-class>
+ <body-content>JSP</body-content>
+ <description>
+ </description>
+ &ui_component_attributes;
+ &filter_table_attributes;
+ </tag>
+ <tag>
+ <name>sortableColumn</name>
+ <tag-class>org.apache.myfaces.custom.table.SortableColumnTag</tag-class>
+ <body-content>JSP</body-content>
+ <description>
+ </description>
+ &ui_component_attributes;
+ &sortable_column_attributes;
+ </tag>
</taglib>
Added: myfaces/tomahawk/trunk/sandbox/examples/src/main/java/org/apache/myfaces/examples/data/SortableTableBean.java
URL: http://svn.apache.org/viewvc/myfaces/tomahawk/trunk/sandbox/examples/src/main/java/org/apache/myfaces/examples/data/SortableTableBean.java?view=auto&rev=482436
==============================================================================
--- myfaces/tomahawk/trunk/sandbox/examples/src/main/java/org/apache/myfaces/examples/data/SortableTableBean.java (added)
+++ myfaces/tomahawk/trunk/sandbox/examples/src/main/java/org/apache/myfaces/examples/data/SortableTableBean.java Mon Dec 4 17:11:38 2006
@@ -0,0 +1,105 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.myfaces.examples.data;
+
+import java.util.List;
+import java.util.ArrayList;
+
+/**
+ * @author Thomas Spiegl
+ */
+public class SortableTableBean {
+
+ public static class Car {
+ private Long _id;
+ private String _manufacturer;
+ private String _model;
+
+
+ public Car(Long id, String manufacturer, String model) {
+ _id = id;
+ _manufacturer = manufacturer;
+ _model = model;
+ }
+
+ public Long getId() {
+ return _id;
+ }
+
+ public void setId(Long id) {
+ _id = id;
+ }
+
+ public String getManufacturer() {
+ return _manufacturer;
+ }
+
+ public void setManufacturer(String manufacturer) {
+ _manufacturer = manufacturer;
+ }
+
+ public String getModel() {
+ return _model;
+ }
+
+ public void setModel(String model) {
+ _model = model;
+ }
+ }
+
+ public List getCars() {
+ List cars = new ArrayList();
+ long i = 1;
+ cars.add(new Car(i++, "Ford","Mondeo"));
+ cars.add(new Car(i++, "Skoda","Octavia"));
+ cars.add(new Car(i++, "Opel","Vectra"));
+ cars.add(new Car(i++, "Hyundai","Elantra"));
+ cars.add(new Car(i++, "Peugeot","406"));
+ cars.add(new Car(i++, "Peugeot","307"));
+ cars.add(new Car(i++, "Alfa","Romeo"));
+ cars.add(new Car(i++, "Honda","Stream"));
+ cars.add(new Car(i++, "Rover","25"));
+ cars.add(new Car(i++, "Renault","Laguna"));
+ cars.add(new Car(i++, "Mercedes","C-Klasse"));
+ cars.add(new Car(i++, "Audi","A4"));
+ cars.add(new Car(i++, "Rover","75"));
+ cars.add(new Car(i++, "VW","Passat"));
+ cars.add(new Car(i++, "Mitsubishi","Carisma"));
+ cars.add(new Car(i++, "Opel","Zafira"));
+ cars.add(new Car(i++, "Fiat","Multipla"));
+ cars.add(new Car(i++, "Honda","Civic"));
+ cars.add(new Car(i++, "Nissan","Tino"));
+ cars.add(new Car(i++, "Renault","Scenic"));
+ cars.add(new Car(i++, "Citroen","Picasso"));
+ cars.add(new Car(i++, "Mazda","Premacy"));
+ cars.add(new Car(i++, "Mitsubishi","SpaceStar"));
+ cars.add(new Car(i++, "Nissan","Almera"));
+ cars.add(new Car(i++, "Opel","Corsa"));
+ cars.add(new Car(i++, "Toyota","Yaris"));
+ cars.add(new Car(i++, "Renault","Clio"));
+ cars.add(new Car(i++, "Audi","A2"));
+ cars.add(new Car(i++, "Skoda","Fabia"));
+ cars.add(new Car(i++, "VW","Polo"));
+ cars.add(new Car(i++, "Peugeot","206"));
+ cars.add(new Car(i++, "Daihatsu","Sirion"));
+ cars.add(new Car(i++, "Daewoo","Matiz"));
+ cars.add(new Car(i++, "Ford","Fiesta"));
+ return cars;
+ }
+}
\ No newline at end of file
Modified: myfaces/tomahawk/trunk/sandbox/examples/src/main/webapp/WEB-INF/examples-config.xml
URL: http://svn.apache.org/viewvc/myfaces/tomahawk/trunk/sandbox/examples/src/main/webapp/WEB-INF/examples-config.xml?view=diff&rev=482436&r1=482435&r2=482436
==============================================================================
--- myfaces/tomahawk/trunk/sandbox/examples/src/main/webapp/WEB-INF/examples-config.xml (original)
+++ myfaces/tomahawk/trunk/sandbox/examples/src/main/webapp/WEB-INF/examples-config.xml Mon Dec 4 17:11:38 2006
@@ -5,7 +5,6 @@
"http://java.sun.com/dtd/web-facesconfig_1_1.dtd">
<!-- =========== FULL CONFIGURATION FILE ================================== -->
-
<faces-config>
<!-- logger/debugging phase listener -->
@@ -43,7 +42,7 @@
<managed-bean-scope>request</managed-bean-scope>
</managed-bean>
- <!-- managed bean for form-->
+ <!-- managed bean for form--> *
<managed-bean>
<managed-bean-name>formBean</managed-bean-name>
@@ -508,6 +507,12 @@
<managed-bean>
<managed-bean-name>validateForm</managed-bean-name>
<managed-bean-class>org.apache.myfaces.examples.validate.ValidateForm</managed-bean-class>
+ <managed-bean-scope>request</managed-bean-scope>
+ </managed-bean>
+
+ <managed-bean>
+ <managed-bean-name>sortableTableBean</managed-bean-name>
+ <managed-bean-class>org.apache.myfaces.examples.data.SortableTableBean</managed-bean-class>
<managed-bean-scope>request</managed-bean-scope>
</managed-bean>
Added: myfaces/tomahawk/trunk/sandbox/examples/src/main/webapp/filterTable.jsp
URL: http://svn.apache.org/viewvc/myfaces/tomahawk/trunk/sandbox/examples/src/main/webapp/filterTable.jsp?view=auto&rev=482436
==============================================================================
--- myfaces/tomahawk/trunk/sandbox/examples/src/main/webapp/filterTable.jsp (added)
+++ myfaces/tomahawk/trunk/sandbox/examples/src/main/webapp/filterTable.jsp Mon Dec 4 17:11:38 2006
@@ -0,0 +1,126 @@
+<%@ page session="false" contentType="text/html;charset=iso-8859-1"%>
+<%@ taglib uri="http://java.sun.com/jsf/html" prefix="h"%>
+<%@ taglib uri="http://java.sun.com/jsf/core" prefix="f"%>
+<%@ taglib uri="http://myfaces.apache.org/tomahawk" prefix="t"%>
+<%@ taglib uri="http://myfaces.apache.org/sandbox" prefix="s"%>
+<html>
+<head>
+<meta http-equiv="Content-Type"
+ content="text/html; charset=iso-8859-1" />
+<link type="text/css" rel="stylesheet" href="/css/basic.css" />
+<style type="text/css">
+ html>body tbody.scrollContent {
+ height: 262px;
+ overflow-x:hidden;
+ overflow-y: auto;
+ }
+
+ tbody.scrollContent td, tbody.scrollContent tr td {
+ background: #FFF;
+ padding: 2px;
+ }
+
+ tbody.scrollContent tr.alternateRow td {
+ background: #e3edfa;
+ padding: 2px;
+ }
+
+ tbody.scrollContent tr.selected td {
+ background: yellow;
+ padding: 2px;
+ }
+ tbody.scrollContent tr:hover td {
+ background: #a6c2e7;
+ padding: 2px;
+ }
+ tbody.scrollContent tr.selected:hover td {
+ background: #ff3;
+ padding: 2px;
+ }
+
+ table {
+ font-family:Lucida Grande, Verdana;
+ font-size:0.8em;
+ width:400px;
+ border:1px solid #ccc;
+ border-collapse:collapse;
+ cursor:default;
+ }
+ table td,
+ table th{
+ padding:2px;
+ font-weight:normal;
+ }
+ table thead td, table thead th {
+ background-image:url(images/ft-head.gif);
+ background-repeat:no-repeat;
+ background-position:top right;
+ }
+ table thead td.selectedUp, table thead th.selectedUp {
+ background-image:url(images/ft-headup.gif);
+ }
+ table thead td.selectedDown, table thead th.selectedDown {
+ background-image:url(images/ft-headdown.gif);
+ }
+
+ table tbody tr td{
+ border-bottom:1px solid #ddd;
+ }
+ table tbody tr.alt td{
+ background: #e3edfa;
+ }
+ table tbody tr.selected td{
+ background: yellow;
+ }
+ table tbody tr:hover td{
+ background: #a6c2e7;
+ }
+ table tbody tr.selected:hover td{
+ background:#ff9;
+ }
+</style>
+<script type="text/javascript">
+ function manufacturerFilter(name){
+ return (manufacturer.charAt(0) >= 'M' && manufacturer.charAt(0) <= 'Z');
+ }
+</script>
+</head>
+<body>
+<f:view>
+ <s:modalDialog dialogId="carDialog" dialogVar="carDialog"
+ dialogAttr="bgColor='white' bgOpacity='0.5' toggle='fade' toggleDuration='250'"
+ hiderIds="back" styleClass="dojoDialog">
+ <h:panelGrid columns="1">
+ <input type="button" id="back" value="Back"
+ onclick="dojo.widget.byId('carDialog').hide();" />
+ </h:panelGrid>
+ </s:modalDialog>
+ <input type="button" value="Show only manufacturers between M and Z" onclick="dojo.widget.byId('filterTbl').setFilter('manufacturer', manufacturerFilter);" />
+ <div class="tableContainer">
+ <s:filterTable id="filterTbl" var="car" value="#{sortableTableBean.cars}" >
+ <s:sortableColumn field="id" dataType="Number">
+ <f:facet name="header">
+ <h:outputText value="Id" />
+ </f:facet>
+ <h:outputText value="#{car.id}" />
+ </s:sortableColumn>
+ <s:sortableColumn field="manufacturer">
+ <f:facet name="header">
+ <h:outputText value="Manufacturer" />
+ </f:facet>
+ <h:outputText value="#{car.manufacturer}" />
+ </s:sortableColumn>
+ <s:sortableColumn field="model">
+ <f:facet name="header">
+ <h:outputText value="Model" />
+ </f:facet>
+ <h:outputText value="#{car.model}" />
+ </s:sortableColumn>
+ </s:filterTable>
+ </div>
+</f:view>
+
+<%@ include file="inc/page_footer.jsp" %>
+
+</body>
+</html>
Added: myfaces/tomahawk/trunk/sandbox/examples/src/main/webapp/images/ft-head.gif
URL: http://svn.apache.org/viewvc/myfaces/tomahawk/trunk/sandbox/examples/src/main/webapp/images/ft-head.gif?view=auto&rev=482436
==============================================================================
Binary file - no diff available.
Propchange: myfaces/tomahawk/trunk/sandbox/examples/src/main/webapp/images/ft-head.gif
------------------------------------------------------------------------------
svn:mime-type = application/octet-stream
Added: myfaces/tomahawk/trunk/sandbox/examples/src/main/webapp/images/ft-headdown.gif
URL: http://svn.apache.org/viewvc/myfaces/tomahawk/trunk/sandbox/examples/src/main/webapp/images/ft-headdown.gif?view=auto&rev=482436
==============================================================================
Binary file - no diff available.
Propchange: myfaces/tomahawk/trunk/sandbox/examples/src/main/webapp/images/ft-headdown.gif
------------------------------------------------------------------------------
svn:mime-type = application/octet-stream
Added: myfaces/tomahawk/trunk/sandbox/examples/src/main/webapp/images/ft-headup.gif
URL: http://svn.apache.org/viewvc/myfaces/tomahawk/trunk/sandbox/examples/src/main/webapp/images/ft-headup.gif?view=auto&rev=482436
==============================================================================
Binary file - no diff available.
Propchange: myfaces/tomahawk/trunk/sandbox/examples/src/main/webapp/images/ft-headup.gif
------------------------------------------------------------------------------
svn:mime-type = application/octet-stream