JBoss Rich Faces SVN: r1225 - in trunk/sandbox/scrollable-grid/src/main: java/org/richfaces/renderkit/html and 3 other directories.
by richfaces-svn-commits@lists.jboss.org
Author: konstantin.mishin
Date: 2007-06-19 13:09:16 -0400 (Tue, 19 Jun 2007)
New Revision: 1225
Modified:
trunk/sandbox/scrollable-grid/src/main/config/component/scrollable-grid.xml
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
trunk/sandbox/scrollable-grid/src/main/javascript/ClientUI/controls/grid/Selection.js
trunk/sandbox/scrollable-grid/src/main/resources/org/richfaces/renderkit/html/css/grid.xcss
trunk/sandbox/scrollable-grid/src/main/templates/org/richfaces/scrollable-grid-cell.jspx
Log:
add attribut columnClasses
Modified: trunk/sandbox/scrollable-grid/src/main/config/component/scrollable-grid.xml
===================================================================
--- trunk/sandbox/scrollable-grid/src/main/config/component/scrollable-grid.xml 2007-06-19 15:40:40 UTC (rev 1224)
+++ trunk/sandbox/scrollable-grid/src/main/config/component/scrollable-grid.xml 2007-06-19 17:09:16 UTC (rev 1225)
@@ -49,7 +49,46 @@
<defaultvalue>40</defaultvalue>
</property>
+ <property>
+ <name>selectedClass</name>
+ <classname>java.lang.String</classname>
+ </property>
+
+ <property>
+ <name>activeClass</name>
+ <classname>java.lang.String</classname>
+ </property>
+ <property>
+ <name>columnClasses</name>
+ <classname>java.lang.String</classname>
+ </property>
+
+ <property>
+ <name>rowClasses</name>
+ <classname>java.lang.String</classname>
+ </property>
+
+ <property>
+ <name>footerClass</name>
+ <classname>java.lang.String</classname>
+ </property>
+
+ <property>
+ <name>captionClass</name>
+ <classname>java.lang.String</classname>
+ </property>
+
+ <property>
+ <name>headerClass</name>
+ <classname>java.lang.String</classname>
+ </property>
+
+ <property>
+ <name>styleClass</name>
+ <classname>java.lang.String</classname>
+ </property>
+
<property attachedstate="true" hidden="true">
<name>sortOrder</name>
<classname>org.richfaces.model.SortOrder</classname>
@@ -93,13 +132,18 @@
</property>
<property>
- <name>selectedClass</name>
+ <name>footerClass</name>
<classname>java.lang.String</classname>
</property>
<property>
- <name>activeClass</name>
+ <name>headerClass</name>
<classname>java.lang.String</classname>
+ </property>
+
+ <property>
+ <name>styleClass</name>
+ <classname>java.lang.String</classname>
</property>
&ui_component_attributes;
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-19 15:40:40 UTC (rev 1224)
+++ trunk/sandbox/scrollable-grid/src/main/java/org/richfaces/renderkit/html/GridRendererState.java 2007-06-19 17:09:16 UTC (rev 1225)
@@ -6,6 +6,7 @@
import java.io.Serializable;
import java.util.Collection;
import java.util.Map;
+import java.util.Set;
import javax.faces.FacesException;
import javax.faces.component.NamingContainer;
@@ -31,6 +32,10 @@
private boolean fake;
+ private Object columnClasses[];
+
+ private int columnClasseSize;
+
private int _rowIndex = 0;
private int _cellIndex = 0;
@@ -100,6 +105,7 @@
}
GridRendererState oldState = getRendererState(context);
GridRendererState state = new GridRendererState(context,oldState,grid);
+ state.setColumnClasses(AjaxRendererUtils.asSet(grid.getAttributes().get("columnClasses")));
context.getExternalContext().getRequestMap().put(DATA_GRID_RENDERER_STATE,state);
return state;
}
@@ -376,5 +382,14 @@
public void setFake(boolean fake) {
this.fake = fake;
+ }
+
+ public String getColumnClass(int index) {
+ return (String)columnClasses[index % columnClasseSize];
+ }
+
+ public void setColumnClasses(Set columnClasses) {
+ this.columnClasses = columnClasses.toArray();
+ columnClasseSize = this.columnClasses.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-19 15:40:40 UTC (rev 1224)
+++ trunk/sandbox/scrollable-grid/src/main/java/org/richfaces/renderkit/html/ScrollableGridBaseRenderer.java 2007-06-19 17:09:16 UTC (rev 1225)
@@ -168,6 +168,7 @@
variables.setVariable("cell_id",cell_id);
variables.setVariable("client_id", client_id);
variables.setVariable("cell_index", new Integer(cell_index));
+ variables.setVariable("columnClass", state.getColumnClass(cell_index));
cellTemplate.encodeBegin(context, column);
if(!state.isFake()) {
@@ -215,7 +216,7 @@
ColumnWalker.iterateOverColumns(context, grid, cellRenderer, writer, state);
if(!state.isFrozenPart()){
writer.startElement("td", grid);
- getUtils().writeAttribute(writer, "class","ClientUI_Grid_BR");
+ getUtils().writeAttribute(writer, "class","ClientUI_Grid_BC " + state.getColumnClass(state.getCellIndex()));
writer.endElement("td");
}
writer.endElement(HTML.TR_ELEMENT);
Modified: trunk/sandbox/scrollable-grid/src/main/javascript/ClientUI/controls/grid/Selection.js
===================================================================
--- trunk/sandbox/scrollable-grid/src/main/javascript/ClientUI/controls/grid/Selection.js 2007-06-19 15:40:40 UTC (rev 1224)
+++ trunk/sandbox/scrollable-grid/src/main/javascript/ClientUI/controls/grid/Selection.js 2007-06-19 17:09:16 UTC (rev 1225)
@@ -235,10 +235,10 @@
while(j <= this.selection.ranges[i].indexes[1]) {
var fElement = $(this.prefix + ":f:" + j);
var nElement = $(this.prefix + ":n:" + j);
- Element.addClassName(fElement, "idg_row_selected_h");
- Element.addClassName(nElement, "idg_row_selected_h");
- Element.addClassName(fElement, "idg_row_selected");
- Element.addClassName(nElement, "idg_row_selected");
+ Element.addClassName(fElement, "idg-row-selected-h");
+ Element.addClassName(nElement, "idg-row-selected-h");
+ Element.addClassName(fElement, "idg-row-selected");
+ Element.addClassName(nElement, "idg-row-selected");
Element.addClassName(fElement, this.selectedClass);
Element.addClassName(nElement, this.selectedClass);
j++;
@@ -434,10 +434,10 @@
this.selection.addId(rowIndex);
var fElement = $(this.prefix + ":f:" + rowIndex);
var nElement = $(this.prefix + ":n:" + rowIndex);
- Element.addClassName(fElement, "idg_row_selected_h");
- Element.addClassName(nElement, "idg_row_selected_h");
- Element.addClassName(fElement, "idg_row_selected");
- Element.addClassName(nElement, "idg_row_selected");
+ Element.addClassName(fElement, "idg-row-selected-h");
+ Element.addClassName(nElement, "idg-row-selected-h");
+ Element.addClassName(fElement, "idg-row-selected");
+ Element.addClassName(nElement, "idg-row-selected");
Element.addClassName(fElement, this.selectedClass);
Element.addClassName(nElement, this.selectedClass);
},
@@ -446,10 +446,10 @@
this.selection.removeId(rowIndex);
var fElement = $(this.prefix + ":f:" + rowIndex);
var nElement = $(this.prefix + ":n:" + rowIndex);
- Element.removeClassName(fElement, "idg_row_selected_h");
- Element.removeClassName(nElement, "idg_row_selected_h");
- Element.removeClassName(fElement, "idg_row_selected");
- Element.removeClassName(nElement, "idg_row_selected");
+ Element.removeClassName(fElement, "idg-row-selected-h");
+ Element.removeClassName(nElement, "idg-row-selected-h");
+ Element.removeClassName(fElement, "idg-row-selected");
+ Element.removeClassName(nElement, "idg-row-selected");
Element.removeClassName(fElement, this.selectedClass);
Element.removeClassName(nElement, this.selectedClass);
},
@@ -459,19 +459,19 @@
if(this.activeRow != null) {
fElement = $(this.prefix + ":f:" + this.activeRow);
nElement = $(this.prefix + ":n:" + this.activeRow);
- Element.removeClassName(fElement, "idg_row_active_h");
- Element.removeClassName(nElement, "idg_row_active_h");
- Element.removeClassName(fElement, "idg_row_active");
- Element.removeClassName(nElement, "idg_row_active");
+ Element.removeClassName(fElement, "idg-row-active-h");
+ Element.removeClassName(nElement, "idg-row-active-h");
+ Element.removeClassName(fElement, "idg-row-active");
+ Element.removeClassName(nElement, "idg-row-active");
Element.removeClassName(fElement, this.activeClass);
Element.removeClassName(nElement, this.activeClass);
}
fElement = $(this.prefix + ":f:" + rowIndex);
nElement = $(this.prefix + ":n:" + rowIndex);
- Element.addClassName(fElement, "idg_row_active_h");
- Element.addClassName(nElement, "idg_row_active_h");
- Element.addClassName(fElement, "idg_row_active");
- Element.addClassName(nElement, "idg_row_active");
+ Element.addClassName(fElement, "idg-row-active-h");
+ Element.addClassName(nElement, "idg-row-active-h");
+ Element.addClassName(fElement, "idg-row-active");
+ Element.addClassName(nElement, "idg-row-active");
Element.addClassName(fElement, this.activeClass);
Element.addClassName(nElement, this.activeClass);
this.activeRow = rowIndex;
Modified: trunk/sandbox/scrollable-grid/src/main/resources/org/richfaces/renderkit/html/css/grid.xcss
===================================================================
--- trunk/sandbox/scrollable-grid/src/main/resources/org/richfaces/renderkit/html/css/grid.xcss 2007-06-19 15:40:40 UTC (rev 1224)
+++ trunk/sandbox/scrollable-grid/src/main/resources/org/richfaces/renderkit/html/css/grid.xcss 2007-06-19 17:09:16 UTC (rev 1225)
@@ -287,11 +287,11 @@
-moz-box-sizing: border-box;
}
-.idg_row_selected_h {
+.idg-row-selected-h {
background-color: #DDDDFF;
}
-.idg_row_active_h {
+.idg-row-active-h {
color : #0000AA;
}
Modified: trunk/sandbox/scrollable-grid/src/main/templates/org/richfaces/scrollable-grid-cell.jspx
===================================================================
--- trunk/sandbox/scrollable-grid/src/main/templates/org/richfaces/scrollable-grid-cell.jspx 2007-06-19 15:40:40 UTC (rev 1224)
+++ trunk/sandbox/scrollable-grid/src/main/templates/org/richfaces/scrollable-grid-cell.jspx 2007-06-19 17:09:16 UTC (rev 1225)
@@ -13,10 +13,10 @@
<td class="ClientUI_Grid_BC" id="#{client_id}:c_#{cell_id}">
<span id="#{client_id}:bc_#{cell_index}" class="ClientUI_Grid_BCBody1">
- <span class="ClientUI_Grid_FCBody" id="#{client_id}:bc_#{cell_id}">
+ <span class="ClientUI_Grid_FCBody #{columnClass}" id="#{client_id}:bc_#{cell_id}">
<vcp:body/>
</span>
</span>
</td>
-</f:root>
\ No newline at end of file
+</f:root>
\ No newline at end of file