Author: konstantin.mishin
Date: 2007-06-20 05:21:32 -0400 (Wed, 20 Jun 2007)
New Revision: 1232
Modified:
trunk/sandbox/scrollable-grid/src/main/java/org/richfaces/renderkit/html/GridRendererState.java
trunk/sandbox/scrollable-grid/src/main/java/org/richfaces/renderkit/html/ScrollableGridBaseRenderer.java
Log:
add attribut rowClasses
Modified:
trunk/sandbox/scrollable-grid/src/main/java/org/richfaces/renderkit/html/GridRendererState.java
===================================================================
---
trunk/sandbox/scrollable-grid/src/main/java/org/richfaces/renderkit/html/GridRendererState.java 2007-06-20
00:11:06 UTC (rev 1231)
+++
trunk/sandbox/scrollable-grid/src/main/java/org/richfaces/renderkit/html/GridRendererState.java 2007-06-20
09:21:32 UTC (rev 1232)
@@ -32,9 +32,13 @@
private boolean fake;
+ private Object rowClasses[];
+
+ private int rowClassesSize;
+
private Object columnClasses[];
- private int columnClasseSize;
+ private int columnClassesSize;
private int _rowIndex = 0;
@@ -106,6 +110,7 @@
GridRendererState oldState = getRendererState(context);
GridRendererState state = new GridRendererState(context,oldState,grid);
state.setColumnClasses(AjaxRendererUtils.asSet(grid.getAttributes().get("columnClasses")));
+ state.setRowClasses(AjaxRendererUtils.asSet(grid.getAttributes().get("rowClasses")));
context.getExternalContext().getRequestMap().put(DATA_GRID_RENDERER_STATE,state);
return state;
}
@@ -385,11 +390,32 @@
}
public String getColumnClass(int index) {
- return (String)columnClasses[index % columnClasseSize];
+ if(columnClasses != null) {
+ return (String)columnClasses[index % columnClassesSize];
+ } else {
+ return "";
+ }
}
public void setColumnClasses(Set columnClasses) {
- this.columnClasses = columnClasses.toArray();
- columnClasseSize = this.columnClasses.length;
+ if(columnClasses != null) {
+ this.columnClasses = columnClasses.toArray();
+ columnClassesSize = this.columnClasses.length;
+ }
}
+
+ public String getRowClass(int index) {
+ if(rowClasses != null) {
+ return (String)rowClasses[index % rowClassesSize];
+ } else {
+ return "";
+ }
+ }
+
+ public void setRowClasses(Set rowClasses) {
+ if(rowClasses != null) {
+ this.rowClasses = rowClasses.toArray();
+ rowClassesSize = this.rowClasses.length;
+ }
+ }
}
Modified:
trunk/sandbox/scrollable-grid/src/main/java/org/richfaces/renderkit/html/ScrollableGridBaseRenderer.java
===================================================================
---
trunk/sandbox/scrollable-grid/src/main/java/org/richfaces/renderkit/html/ScrollableGridBaseRenderer.java 2007-06-20
00:11:06 UTC (rev 1231)
+++
trunk/sandbox/scrollable-grid/src/main/java/org/richfaces/renderkit/html/ScrollableGridBaseRenderer.java 2007-06-20
09:21:32 UTC (rev 1232)
@@ -207,7 +207,7 @@
writer.startElement(HTML.TR_ELEMENT, grid);
state.setFrozenColumnCount(GridUtils.getFrozenColumnsCount(grid));
getUtils().writeAttribute(writer, "id",row_id);
- getUtils().writeAttribute(writer, "class","ClientUI_Grid_BR");
+ getUtils().writeAttribute(writer, "class","ClientUI_Grid_BR " +
state.getRowClass(index));
if (log.isDebugEnabled()) {
log.debug("rowIndex : " + index);
Show replies by date