Author: sergeyhalipov
Date: 2008-02-25 14:31:49 -0500 (Mon, 25 Feb 2008)
New Revision: 6337
Modified:
trunk/ui/dataTable/src/main/java/org/richfaces/component/UIDataTable.java
trunk/ui/dataTable/src/main/java/org/richfaces/renderkit/AbstractTableRenderer.java
trunk/ui/dataTable/src/main/resources/org/richfaces/renderkit/html/css/table.xcss
Log:
Inplace inputs in headers with filter. HTML mark-up changed.
Modified: trunk/ui/dataTable/src/main/java/org/richfaces/component/UIDataTable.java
===================================================================
--- trunk/ui/dataTable/src/main/java/org/richfaces/component/UIDataTable.java 2008-02-25
19:12:49 UTC (rev 6336)
+++ trunk/ui/dataTable/src/main/java/org/richfaces/component/UIDataTable.java 2008-02-25
19:31:49 UTC (rev 6337)
@@ -56,8 +56,6 @@
Collection<Object> sortPriority = new ArrayList<Object>();
- private boolean hasFilterColumns = false;
-
/**
* @author shura
*
@@ -256,12 +254,4 @@
super.restoreState(context, states[0]);
sortPriority = (Collection)states[1];
}
-
- public boolean hasFilterColumns() {
- return hasFilterColumns;
- }
-
- public void setHasFilterColumns(boolean hasFilterColumns) {
- this.hasFilterColumns = hasFilterColumns;
- }
}
\ No newline at end of file
Modified:
trunk/ui/dataTable/src/main/java/org/richfaces/renderkit/AbstractTableRenderer.java
===================================================================
---
trunk/ui/dataTable/src/main/java/org/richfaces/renderkit/AbstractTableRenderer.java 2008-02-25
19:12:49 UTC (rev 6336)
+++
trunk/ui/dataTable/src/main/java/org/richfaces/renderkit/AbstractTableRenderer.java 2008-02-25
19:31:49 UTC (rev 6337)
@@ -112,7 +112,6 @@
}
if (headers.hasNext()&&findFacet(table,"header")) {
- table.setHasFilterColumns(false);
writer.startElement("tr", table);
encodeStyleClass(writer, null,
"dr-table-subheader rich-table-subheader", null,
@@ -122,17 +121,6 @@
headerClass, "header", "th", colCount);
writer.endElement("tr");
-
- if (table.hasFilterColumns()) {
- colums = table.columns();
- writer.startElement("tr", table);
- encodeStyleClass(writer, null,
- "dr-table-subheader rich-table-subheader", null,
- headerClass);
- encodeFilterInputs(context, writer, colums, "dr-table-subheadercell
rich-table-subheadercell",
- "th", headerClass, colCount);
- writer.endElement("tr");
- }
}
writer.endElement("thead");
}
@@ -185,6 +173,9 @@
(org.richfaces.component.UIColumn) column;
String clientId = col.getClientId(context) + facetName;
writer.writeAttribute("id", clientId, null);
+
+ writer.startElement(HTML.DIV_ELEM, column);
+
if (column.getValueExpression("comparator") != null
|| column.getValueExpression("sortBy") != null) {
StringBuffer buffer;
@@ -204,6 +195,7 @@
ajaxFunction.appendScript(buffer);
writer.writeAttribute(HTML.onclick_ATTRIBUTE, buffer
.toString(), null);
+ writer.writeAttribute(HTML.class_ATTRIBUTE, "dr-table-cursor-pointer",
null);
}
writer.startElement(HTML.SPAN_ELEM, column);
String spanClass = "";
@@ -234,6 +226,9 @@
}
writer.endElement(HTML.SPAN_ELEM);
}
+
+ writer.endElement(HTML.DIV_ELEM);
+
if (((org.richfaces.component.UIColumn)column).getFilterMethod() == null
&& column.getValueExpression("filterExpression") == null
&& column.getValueExpression("filterBy") != null) {
@@ -247,8 +242,9 @@
StringBuffer buffer = new StringBuffer();
ajaxFunction.appendScript(buffer);
- ((UIDataTable)table).setHasFilterColumns(true);
+ writer.startElement(HTML.DIV_ELEM, column);
addInplaceInput(context, column, buffer);
+ writer.endElement(HTML.DIV_ELEM);
}
}
writer.endElement(element);
@@ -567,41 +563,13 @@
}
filterValueInput.setId(column.getId() + SORT_FILTER_PARAMETER);
filterValueInput.setImmediate(true);
- filterValueInput.getAttributes().put("onclick",
"Event.stop(event);");
column.getFacets().put(FILTER_INPUT_FACET_NAME, filterValueInput);
}
filterValueInput.getAttributes().put(event, buffer.toString());
filterValueInput.setValue(column.getAttributes().get("filterValue"));
+
+ getUtils().encodeBeginFormIfNessesary(context, column);
+ renderChild(context, filterValueInput);
+ getUtils().encodeEndFormIfNessesary(context, column);
}
-
- protected void encodeFilterInputs(FacesContext context,
- ResponseWriter writer, Iterator<UIComponent> columns, String cellClass,
- String element, String headerClass, int colCount) throws IOException {
- int t_colCount = 0;
- while (columns.hasNext()) {
- UIComponent column = (UIComponent) columns.next();
- if ((Integer)column.getAttributes().get("colspan") != null ) {
- t_colCount = t_colCount +
((Integer)column.getAttributes().get("colspan")).intValue();
- } else {
- t_colCount++;
- }
- if( t_colCount > colCount) {
- break;
- }
-
- String columnHeaderClass = (String)
column.getAttributes().get("headerClass");
- writer.startElement(element, column);
- encodeStyleClass(writer, null, cellClass, headerClass,
- columnHeaderClass);
- writer.writeAttribute("scope", "col", null);
- getUtils().encodeAttribute(context, column, "colspan");
-
- UIInput filterValueInput = (UIInput) column.getFacet(FILTER_INPUT_FACET_NAME);
- if (null != filterValueInput) {
- getUtils().encodeBeginFormIfNessesary(context, column);
- renderChild(context, filterValueInput);
- getUtils().encodeEndFormIfNessesary(context, column);
- }
- }
- }
}
\ No newline at end of file
Modified:
trunk/ui/dataTable/src/main/resources/org/richfaces/renderkit/html/css/table.xcss
===================================================================
---
trunk/ui/dataTable/src/main/resources/org/richfaces/renderkit/html/css/table.xcss 2008-02-25
19:12:49 UTC (rev 6336)
+++
trunk/ui/dataTable/src/main/resources/org/richfaces/renderkit/html/css/table.xcss 2008-02-25
19:31:49 UTC (rev 6337)
@@ -105,9 +105,12 @@
.dr-table-sortable-header {
background-position: right;
background-repeat: no-repeat;
- cursor : pointer;
white-space : nowrap;
}
+
+ .dr-table-cursor-pointer {
+ cursor: pointer;
+ }
</f:verbatim>
<u:selector name=".dr-table-header-sort-down" >