JBoss Rich Faces SVN: r817 - trunk/sandbox-samples/scrollable-grid-demo/src/main/webapp/pages.
by richfaces-svn-commits@lists.jboss.org
Author: abelevich
Date: 2007-05-21 07:21:27 -0400 (Mon, 21 May 2007)
New Revision: 817
Modified:
trunk/sandbox-samples/scrollable-grid-demo/src/main/webapp/pages/scrollable-grid.xhtml
Log:
Modified: trunk/sandbox-samples/scrollable-grid-demo/src/main/webapp/pages/scrollable-grid.xhtml
===================================================================
--- trunk/sandbox-samples/scrollable-grid-demo/src/main/webapp/pages/scrollable-grid.xhtml 2007-05-21 11:20:29 UTC (rev 816)
+++ trunk/sandbox-samples/scrollable-grid-demo/src/main/webapp/pages/scrollable-grid.xhtml 2007-05-21 11:21:27 UTC (rev 817)
@@ -36,9 +36,10 @@
<f:view>
<h:form>
- <sg:scrollable-grid value="#{selectionBean.dataModel}"
+ <sg:scrollable-grid id="grid"
+ value="#{selectionBean.dataModel}"
var="issues"
- frozenColCount="2"
+ frozenColCount="3"
first="0"
rows="40"
width="800px"
@@ -46,6 +47,15 @@
<sg:column width="200px">
<f:facet name="header">
+ <h:outputText value="Index"></h:outputText>
+ </f:facet>
+ <h:outputText value="#{issues.index}"></h:outputText>
+ <f:facet name="footer">
+ <h:outputText value="footer0"></h:outputText>
+ </f:facet>
+ </sg:column>
+ <sg:column width="200px">
+ <f:facet name="header">
<h:outputText value="Key"></h:outputText>
</f:facet>
<h:outputText value="#{issues.key.value}"></h:outputText>
@@ -53,6 +63,8 @@
<h:outputText value="footer1"></h:outputText>
</f:facet>
</sg:column>
+
+
<sg:column width="200px">
<f:facet name="header">
<h:outputText value="Summary"></h:outputText>
@@ -117,7 +129,7 @@
</f:facet>
</sg:column>
</sg:scrollable-grid>
-
+
</h:form>
</f:view>
</body>
17 years, 7 months
JBoss Rich Faces SVN: r816 - trunk/sandbox/scrollable-grid/src/main/javascript/ClientUI/controls/grid.
by richfaces-svn-commits@lists.jboss.org
Author: abelevich
Date: 2007-05-21 07:20:29 -0400 (Mon, 21 May 2007)
New Revision: 816
Modified:
trunk/sandbox/scrollable-grid/src/main/javascript/ClientUI/controls/grid/GridBody2.js
Log:
Modified: trunk/sandbox/scrollable-grid/src/main/javascript/ClientUI/controls/grid/GridBody2.js
===================================================================
--- trunk/sandbox/scrollable-grid/src/main/javascript/ClientUI/controls/grid/GridBody2.js 2007-05-21 11:20:20 UTC (rev 815)
+++ trunk/sandbox/scrollable-grid/src/main/javascript/ClientUI/controls/grid/GridBody2.js 2007-05-21 11:20:29 UTC (rev 816)
@@ -388,7 +388,7 @@
this.countToLoad = range.start - this.currRange.start;
this.startRow = frozenTbl.rows[0].index;
- this.startIndex = range.start + this.countToLoad;
+ this.startIndex = range.start + (this.rowsCount - this.countToLoad);
// store visible row pos to restore after rows reerrange
var visibleRowPos = this.templFrozen.getY() + this.countToLoad * this.defaultRowHeight;
17 years, 7 months
JBoss Rich Faces SVN: r815 - trunk/sandbox/scrollable-grid/src/main/java/org/richfaces/renderkit/html.
by richfaces-svn-commits@lists.jboss.org
Author: abelevich
Date: 2007-05-21 07:20:20 -0400 (Mon, 21 May 2007)
New Revision: 815
Removed:
trunk/sandbox/scrollable-grid/src/main/java/org/richfaces/renderkit/html/ScrollableGridBaseRenderer2.java
Modified:
trunk/sandbox/scrollable-grid/src/main/java/org/richfaces/renderkit/html/GridRendererState.java
Log:
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-05-21 11:20:10 UTC (rev 814)
+++ trunk/sandbox/scrollable-grid/src/main/java/org/richfaces/renderkit/html/GridRendererState.java 2007-05-21 11:20:20 UTC (rev 815)
@@ -34,6 +34,10 @@
private int _columns = 0;
+ private Integer sepOffset;
+
+ private int _loadedRowsCount;
+
private String _cell_id_prefix;
private int sumWidth = 0;
@@ -222,10 +226,13 @@
* @return new row number.
*/
public int nextRow(){
- if(_rowIndex > _grid.getRows())
+ if(_rowIndex > _loadedRowsCount)
_rowIndex = 0;
+ else{
+ _rowIndex ++;
+ }
- return ++_rowIndex;
+ return _rowIndex;
}
/**
@@ -351,4 +358,20 @@
public void setSumWidth(int sumWidth) {
this.sumWidth = sumWidth;
}
+
+ public int get_loadedRowsCount() {
+ return _loadedRowsCount;
+ }
+
+ public void set_loadedRowsCount(int rowsCount) {
+ _loadedRowsCount = rowsCount;
+ }
+
+ public Integer getSepOffset() {
+ return sepOffset;
+ }
+
+ public void setSepOffset(Integer sepOffset) {
+ this.sepOffset = sepOffset;
+ }
}
Deleted: trunk/sandbox/scrollable-grid/src/main/java/org/richfaces/renderkit/html/ScrollableGridBaseRenderer2.java
===================================================================
--- trunk/sandbox/scrollable-grid/src/main/java/org/richfaces/renderkit/html/ScrollableGridBaseRenderer2.java 2007-05-21 11:20:10 UTC (rev 814)
+++ trunk/sandbox/scrollable-grid/src/main/java/org/richfaces/renderkit/html/ScrollableGridBaseRenderer2.java 2007-05-21 11:20:20 UTC (rev 815)
@@ -1,418 +0,0 @@
-package org.richfaces.renderkit.html;
-
-import java.io.IOException;
-import java.util.Map;
-
-import javax.faces.component.UIComponent;
-import javax.faces.context.ExternalContext;
-import javax.faces.context.FacesContext;
-import javax.faces.context.ResponseWriter;
-
-import org.ajax4jsf.ajax.repeat.DataVisitor;
-import org.ajax4jsf.framework.ajax.AjaxContext;
-import org.ajax4jsf.framework.ajax.AjaxEvent;
-import org.ajax4jsf.framework.renderer.AjaxRendererUtils;
-import org.ajax4jsf.framework.renderer.ComponentVariables;
-import org.ajax4jsf.framework.renderer.ComponentsVariableResolver;
-import org.ajax4jsf.framework.renderer.RendererBase;
-import org.ajax4jsf.framework.renderer.RendererUtils.HTML;
-import org.ajax4jsf.framework.util.javascript.JSFunction;
-import org.richfaces.component.UIScrollableGrid;
-import org.richfaces.component.UIScrollableGridColumn;
-import org.richfaces.renderkit.CompositeRenderer;
-import org.richfaces.utils.TemplateLoader;
-
-import com.sun.org.apache.bcel.internal.generic.NEW;
-
-
-
-/**
- * @author Anton Belevich
- *
- */
-
-public abstract class ScrollableGridBaseRenderer2 extends CompositeRenderer {
-
- private final String FOOTER_PART = "footer";
-
- private final String HEADER_PART = "header";
-
- private final String CELL_ID_PREFFIX ="bcc_";
-
- private final String COLUMN_FROZEN_TYPE = "frozen";
-
- private final String COLUMN_NORMAL_TYPE = "normal";
-
- private RendererBase cellTemplate = null;
-
- private RendererBase headerCellTemplate = null;
-
- private RendererBase footerCellTemplate = null;
-
- private final ColumnVisitor columnsWidthCounter = new ColumnVisitor(){
-
- public int visit(FacesContext context, UIScrollableGridColumn column, ResponseWriter writer, GridRendererState state) throws IOException {
-
- int prevWidth = 0;
- int width = 0;
-
-
- String widthPx = (String)column.getAttributes().get("width");
- prevWidth = state.getSumWidth();
-
- if(widthPx.endsWith("px")){
- width = prevWidth + Integer.parseInt(widthPx.substring(0, widthPx.indexOf("px")));
- }
-
- state.setSumWidth(width);
- return 1;
- }
- };
-
- private final ColumnVisitor headerCellRenderer = new ExtendedColumnVisitor(){
-
- public void renderContent(FacesContext context, UIScrollableGridColumn column, ResponseWriter writer, GridRendererState state) throws IOException {
-
-
- int cell_index = state.getCellIndex();
- String client_id = state.getClientId();
- String cell_id = state.getColumnType()+ ":" + state.getRowIndex()+ ":" + cell_index;
- headerCellTemplate = getHeaderCellTemplate();
- ComponentVariables variables = ComponentsVariableResolver.getVariables(headerCellTemplate, column);
- variables.setVariable("cell_id",cell_id);
- variables.setVariable("client_id", client_id);
- variables.setVariable("cell_index", new Integer(cell_index));
-
- headerCellTemplate.encodeBegin(context, column);
- UIComponent component = column.getFacet(HEADER_PART);
- if(component != null){
- renderChild(context, component);
- }
- headerCellTemplate.encodeEnd(context, column);
-
- }
- };
-
- private final ColumnVisitor footerCellRenderer = new ExtendedColumnVisitor(){
-
- public void renderContent(FacesContext context, UIScrollableGridColumn column, ResponseWriter writer, GridRendererState state) throws IOException {
-
- int cell_index = state.getCellIndex();
- String cell_id = state.getColumnType()+ ":" + state.getRowIndex()+ ":" + cell_index;
- String client_id = state.getClientId();
- footerCellTemplate = getFooterCellTemplate();
- ComponentVariables variables = ComponentsVariableResolver.getVariables(footerCellTemplate, column);
- variables.setVariable("cell_id",cell_id);
- variables.setVariable("client_id", client_id);
- variables.setVariable("cell_index", new Integer(cell_index));
- footerCellTemplate.encodeBegin(context, column);
- UIComponent component = column.getFacet(FOOTER_PART);
- if(component != null){
- renderChild(context, component);
- }
- footerCellTemplate.encodeEnd(context, column);
-
- }
- };
-
- private final ColumnVisitor cellRenderer = new ExtendedColumnVisitor(){
-
- public void renderContent(FacesContext context, UIScrollableGridColumn column, ResponseWriter writer, GridRendererState state) throws IOException {
-
- int cell_index = state.getCellIndex();
- String cell_id = state.getRowIndex()+ "_" + state.getCellIndex();
- String column_type = state.getColumnType();
- int row_index = state.getRowIndex();
- String client_id = state.getClientId();
-
- cellTemplate = getCellTemplate();
- ComponentVariables variables = ComponentsVariableResolver.getVariables(cellTemplate, column);
- variables.setVariable("cell_id",cell_id);
- variables.setVariable("row_index",new Integer(row_index));
- variables.setVariable("column_type", column_type);
- variables.setVariable("client_id", client_id);
- variables.setVariable("cell_index",new Integer(cell_index));
- cellTemplate.encodeBegin(context, column);
- renderChildren(context, column);
- cellTemplate.encodeEnd(context, column);
- }
-
- };
-
- private final DataVisitor rowsRenderer = new DataVisitor(){
-
- public void process(FacesContext context, Object rowIndex, Object argument) throws IOException {
-
- GridRendererState state = (GridRendererState)argument;
- UIScrollableGrid grid = state.getGrid();
-
- grid.setRowKey(rowIndex);
-
- if(grid.isRowAvailable()){
-
- int index = ((Integer)rowIndex).intValue();
- state.setRowIndex(index);
- String row_id = "row_" + index;
- ResponseWriter writer = context.getResponseWriter();
- writer.startElement(HTML.TR_ELEMENT, grid);
- state.setFrozenColumnCount(((Integer)grid.getAttributes().get("frozenColCount")).intValue());
- getUtils().writeAttribute(writer, "id",row_id);
- getUtils().writeAttribute(writer, "class","ClientUI_Grid_BR");
- ColumnWalker.iterateOverColumns(context, grid, cellRenderer, writer, state);
- writer.endElement(HTML.TR_ELEMENT);
-
- }
- }
- };
-
- private final ColumnVisitor ajaxCellRenderer = new ExtendedColumnVisitor(){
-
- public int visit(FacesContext context, UIScrollableGridColumn column, ResponseWriter writer, GridRendererState state) throws IOException {
-
- if(state.isFrozenColumn()){
- int i = state.getFrozenColumnCount();
- state.setFrozenColumnCount(i-1);
- state.setCellIdPrefix(COLUMN_FROZEN_TYPE +":"+ CELL_ID_PREFFIX);
- renderContent(context, column, writer,state);
- }else{
- state.setCellIdPrefix(COLUMN_NORMAL_TYPE + ":" + CELL_ID_PREFFIX);
- renderContent(context, column, writer,state);
- }
- return 1;
- }
-
- public void renderContent(FacesContext context, UIScrollableGridColumn column, ResponseWriter writer, GridRendererState state) throws IOException {
- writer.startElement(HTML.SPAN_ELEM, column);
- String columnWidth = (String)column.getAttributes().get("width");
-
- String cell_id = state.getClientId() + ":" + state.getCellIdPrefix() + state.getRowIndex()+ "_" + state.getCellIndex();
- getUtils().writeAttribute(writer, "id",cell_id);
- getUtils().writeAttribute(writer, "class", "ClientUI_Grid_BCBody");
- getUtils().writeAttribute(writer, "style", "width:" + columnWidth);
- renderChildren(context, column);
- writer.endElement(HTML.SPAN_ELEM);
- AjaxContext ajaxContext = state.getAjaxContext();
- ajaxContext.addRenderedArea(cell_id);
- }
-
- };
-
- private final DataVisitor ajaxRowsRenderer = new DataVisitor(){
-
- public void process(FacesContext context, Object rowKey, Object argument) throws IOException {
-
- GridRendererState state = (GridRendererState)argument;
- UIScrollableGrid grid = state.getGrid();
- grid.setRowKey(rowKey);
- ResponseWriter writer = context.getResponseWriter();
- state.setFrozenColumnCount(((Integer)grid.getAttributes().get("frozenColCount")).intValue());
- ColumnWalker.iterateOverColumns(context, grid, ajaxCellRenderer, writer, state);
- state.nextRow();
- }
- };
-
- protected String getJavaScriptVarName(FacesContext context, UIScrollableGrid grid) {
- String id = grid.getBaseClientId(context);
- return "Richfaces_ScrollableGrid_" + id.replaceAll("[^A-Za-z0-9_]", "_");
- }
-
- protected String getScriptContributions(FacesContext context, UIScrollableGrid grid) {
- return super.getScriptContributions(getJavaScriptVarName(context, grid), context, grid);
- }
-
- public boolean getRendersChildren() {
- return true;
- }
-
- public void renderGridBody(FacesContext context, UIScrollableGrid grid, boolean isFrozen) throws IOException{
-
- final GridRendererState state = GridRendererState.getRendererState(context);
-
- if(isFrozen){
- state.setColumType(COLUMN_FROZEN_TYPE);
- }else{
- state.setColumType(COLUMN_NORMAL_TYPE);
- }
-
- state.setFrozenColumnCount(((Integer)grid.getAttributes().get("frozenColCount")).intValue());
- state.setFrozenPart(isFrozen);
- state.setClientId(grid.getClientId(context));
- grid.walk(context, rowsRenderer, state);
- grid.setRowKey(null);
- }
-
- public void renderHeaders(FacesContext context, UIScrollableGrid grid, boolean isFrozen)throws IOException{
-
- ResponseWriter writer = context.getResponseWriter();
- final GridRendererState state = GridRendererState.getRendererState(context);
-
- if(isFrozen){
- state.setColumType(COLUMN_FROZEN_TYPE);
- }else{
- state.setColumType(COLUMN_NORMAL_TYPE);
- }
-
- state.setClientId(grid.getClientId(context));
- state.setPart(HEADER_PART);
- state.setFrozenColumnCount(((Integer)grid.getAttributes().get("frozenColCount")).intValue());
- state.setFrozenPart(isFrozen);
- state.setClientId(grid.getClientId(context));
- ColumnWalker.iterateOverColumns(context, grid, headerCellRenderer, writer, state);
- }
-
- public void renderFooters(FacesContext context, UIScrollableGrid grid, boolean isFrozen) throws IOException{
-
- ResponseWriter writer = context.getResponseWriter();
- final GridRendererState state = GridRendererState.getRendererState(context);
-
- if(isFrozen){
- state.setColumType(COLUMN_FROZEN_TYPE);
- }else{
- state.setColumType(COLUMN_NORMAL_TYPE);
- }
-
- state.setClientId(grid.getClientId(context));
- state.setFrozenColumnCount(((Integer)grid.getAttributes().get("frozenColCount")).intValue());
- state.setFrozenPart(isFrozen);
- int colsCount = ColumnWalker.iterateOverColumns(context, grid, footerCellRenderer, writer, state);
- int rowsCount = grid.getRowCount();
-
- ComponentVariables variables = ComponentsVariableResolver.getVariables(this, grid);
- variables.setVariable("rows_count", new Integer(rowsCount));
- variables.setVariable("columns_count", new Integer(colsCount));
-
- }
-
- public void setUpState(FacesContext context, UIScrollableGrid grid) {
- GridRendererState.createState(context, grid);
- }
-
- public void tearDownState(FacesContext context){
- GridRendererState.restoreState(context);
- }
-
- public String getRowsAjaxUpdate(FacesContext context, UIScrollableGrid grid){
-
- JSFunction function = AjaxRendererUtils.buildAjaxFunction(grid, context);
- Map options = AjaxRendererUtils.buildEventOptions(context, grid);
-
- function.addParameter(options);
- String completeFunction = function.toScript()+"; return false;";
- return completeFunction;
-
- }
-
- protected void doDecode(FacesContext context, UIComponent component) {
-
- super.doDecode(context, component);
-
- if(component instanceof UIScrollableGrid){
-
- UIScrollableGrid grid = (UIScrollableGrid)component;
- ExternalContext externalContext = context.getExternalContext();
- String clientId = grid.getClientId(context) + "_state_input";
-
- Map parameters = externalContext.getRequestParameterMap();
- if(parameters.containsKey(clientId)){
-
- String submitedState = (String)parameters.get(clientId);
- String [] values = submitedState.split(",");
- grid.setRow_count(new Integer(Integer.parseInt(values[0])));
- grid.setDataIndex(new Integer(Integer.parseInt(values[1])));
- grid.setStartRow(new Integer(Integer.parseInt(values[2])));
- grid.queueEvent(new AjaxEvent(grid));
-
- }
-
- }
-
- }
-
- public void renderAjaxChildren(FacesContext context, UIComponent component)throws IOException{
-
- UIScrollableGrid grid = (UIScrollableGrid)component;
-
- GridRendererState state = GridRendererState.createState(context, grid);
- grid.setFirst(grid.getDataIndex().intValue());
- grid.setRows(grid.getRow_count().intValue());
- int start_row = grid.getStartRow().intValue();
-
- AjaxContext ajaxContext = AjaxContext.getCurrentInstance(context);
- String client_id = grid.getClientId(context);
- state.setClientId(client_id);
- state.setAjaxContext(ajaxContext);
- state.setRowIndex(start_row);
-
- grid.walk(context, ajaxRowsRenderer, state);
-
- }
-
- public void encodeChildren(FacesContext context, UIComponent component
- ) throws IOException {
-
- AjaxContext ajaxContext = AjaxContext.getCurrentInstance();
- if(ajaxContext.isAjaxRequest()){
- renderAjaxChildren(context, component);
- }else{
- super.encodeChildren(context, component);
- }
-
- }
-
- public void encodeBegin(FacesContext context, UIComponent component) throws IOException {
-
- if(component instanceof UIScrollableGrid){
- UIScrollableGrid grid = (UIScrollableGrid)component;
- setUpState(context, grid);
- }
-
- AjaxContext ajaxContext = AjaxContext.getCurrentInstance();
- if(ajaxContext.isAjaxRequest()){
- }else{
- super.encodeBegin(context, component);
- }
-
- }
-
- public void encodeEnd(FacesContext context, UIComponent component) throws IOException {
-
- AjaxContext ajaxContext = AjaxContext.getCurrentInstance();
- if(ajaxContext.isAjaxRequest()){
- }else{
- super.encodeEnd(context, component);
- }
-
- }
-
- public void setUpColumnsWidth(FacesContext context, UIScrollableGrid grid) throws IOException{
- GridRendererState state = GridRendererState.getRendererState(context);
- state.setFrozenColumnCount(((Integer)grid.getAttributes().get("frozenColCount")).intValue());
- ColumnWalker.iterateOverColumns(context, grid, columnsWidthCounter, null, state);
- ComponentVariables variables = ComponentsVariableResolver.getVariables(this, grid);
- int sumWidth = state.getSumWidth() + 20;
- variables.setVariable("sumWidth", new Integer(sumWidth));
- }
-
- private RendererBase getCellTemplate() {
- if (cellTemplate == null) {
- cellTemplate = TemplateLoader.loadTemplate("org.richfaces.renderkit.html.ScrollableGridCellRenderer");
- }
- return cellTemplate;
- }
-
- private RendererBase getHeaderCellTemplate() {
-
- if (headerCellTemplate == null) {
- headerCellTemplate = TemplateLoader.loadTemplate("org.richfaces.renderkit.html.ScrollableGridHeaderCellRenderer");
- }
- return headerCellTemplate;
- }
-
- private RendererBase getFooterCellTemplate() {
-
- if (footerCellTemplate == null) {
- footerCellTemplate = TemplateLoader.loadTemplate("org.richfaces.renderkit.html.ScrollableGridFooterCellRenderer");
- }
- return footerCellTemplate;
- }
-}
17 years, 7 months
JBoss Rich Faces SVN: r814 - trunk/sandbox/scrollable-grid/src/main/config/component.
by richfaces-svn-commits@lists.jboss.org
Author: abelevich
Date: 2007-05-21 07:20:10 -0400 (Mon, 21 May 2007)
New Revision: 814
Modified:
trunk/sandbox/scrollable-grid/src/main/config/component/scrollable-grid.xml
Log:
Modified: trunk/sandbox/scrollable-grid/src/main/config/component/scrollable-grid.xml
===================================================================
--- trunk/sandbox/scrollable-grid/src/main/config/component/scrollable-grid.xml 2007-05-21 11:19:07 UTC (rev 813)
+++ trunk/sandbox/scrollable-grid/src/main/config/component/scrollable-grid.xml 2007-05-21 11:20:10 UTC (rev 814)
@@ -14,7 +14,7 @@
<renderer generate="true" override="true">
<name>org.richfaces.renderkit.html.ScrollableGridRenderer</name>
- <template>org/richfaces/scrollable-grid2.jspx</template>
+ <template>org/richfaces/scrollable-grid.jspx</template>
</renderer>
<tag>
<name>scrollable-grid</name>
17 years, 7 months
JBoss Rich Faces SVN: r813 - trunk/sandbox/scrollable-grid/src/main/java/org/richfaces/renderkit/html.
by richfaces-svn-commits@lists.jboss.org
Author: abelevich
Date: 2007-05-21 07:19:07 -0400 (Mon, 21 May 2007)
New Revision: 813
Added:
trunk/sandbox/scrollable-grid/src/main/java/org/richfaces/renderkit/html/ScrollableGridBaseRenderer.java
Removed:
trunk/sandbox/scrollable-grid/src/main/java/org/richfaces/renderkit/html/ScrollableGridBaseRenderer.java
Log:
Deleted: 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-05-21 11:18:50 UTC (rev 812)
+++ trunk/sandbox/scrollable-grid/src/main/java/org/richfaces/renderkit/html/ScrollableGridBaseRenderer.java 2007-05-21 11:19:07 UTC (rev 813)
@@ -1,435 +0,0 @@
-package org.richfaces.renderkit.html;
-
-import java.io.IOException;
-import java.util.Map;
-
-import javax.faces.component.UIComponent;
-import javax.faces.context.ExternalContext;
-import javax.faces.context.FacesContext;
-import javax.faces.context.ResponseWriter;
-import javax.faces.model.DataModel;
-
-import org.ajax4jsf.ajax.repeat.DataVisitor;
-import org.ajax4jsf.framework.ajax.AjaxContext;
-import org.ajax4jsf.framework.ajax.AjaxEvent;
-import org.ajax4jsf.framework.renderer.AjaxRendererUtils;
-import org.ajax4jsf.framework.renderer.ComponentVariables;
-import org.ajax4jsf.framework.renderer.ComponentsVariableResolver;
-import org.ajax4jsf.framework.renderer.RendererBase;
-import org.ajax4jsf.framework.renderer.RendererUtils.HTML;
-import org.ajax4jsf.framework.util.javascript.JSFunction;
-import org.richfaces.component.UIScrollableGrid;
-import org.richfaces.component.UIScrollableGridColumn;
-import org.richfaces.renderkit.CompositeRenderer;
-import org.richfaces.utils.TemplateLoader;
-
-
-
-/**
- * @author Anton Belevich
- *
- */
-
-public abstract class ScrollableGridBaseRenderer extends CompositeRenderer {
-
- private final String FOOTER_PART = "footer";
-
- private final String HEADER_PART = "header";
-
- private final String CELL_ID_PREFFIX ="bc_";
-
- private final String COLUMN_FROZEN_TYPE = "frozen";
-
- private final String COLUMN_NORMAL_TYPE = "normal";
-
- private RendererBase cellTemplate = null;
-
-
-
- private final ColumnVisitor headerFooterRenderer = new ExtendedColumnVisitor(){
-
-
- public int visit(FacesContext context, UIScrollableGridColumn column,
- ResponseWriter writer, GridRendererState state) throws IOException {
-
- renderContent(context, column, writer, state);
-
- if(state.isFrozenColumn()){
- int i = state.getFrozenColumnCount();
- state.setFrozenColumnCount(i-1);
- }
-
- return 1;
- }
-
- public void renderContent(FacesContext context, UIScrollableGridColumn column, ResponseWriter writer, GridRendererState state) throws IOException {
-
- writer.startElement(HTML.td_ELEM, column);
- String frozen = Boolean.toString(state.isFrozenColumn());
- getUtils().writeAttribute(writer, "frozen",frozen );
- getUtils().writeAttribute(writer, "width",column.getAttributes().get("width"));
- writer.writeText("\n", null);
-
- if(state.isHeader() && (column.getFacet(HEADER_PART) != null)){
-
- UIComponent component = column.getFacet(HEADER_PART);
- renderChild(context, component);
-
- }else if(!state.isHeader()&& (column.getFacet(FOOTER_PART) != null)){
-
- UIComponent component = column.getFacet(FOOTER_PART);
- renderChild(context, component);
-
- }
-
- writer.endElement(HTML.td_ELEM);
- writer.writeText("\n", null);
- }
- };
-
- private final ColumnVisitor cellRenderer = new ExtendedColumnVisitor(){
-
- public int visit(FacesContext context, UIScrollableGridColumn column,
- ResponseWriter writer, GridRendererState state) throws IOException {
-
-
- if(state.isFrozenColumn()){
- int i = state.getFrozenColumnCount();
- state.setFrozenColumnCount(i-1);
- if(state.isFrozenPart()){
- renderContent(context, column, writer,state);
- }
- }else if(!state.isFrozenColumn()&& !state.isFrozenPart()){
- renderContent(context, column, writer,state);
- }
-
- return 0;
- }
-
- public void renderContent(FacesContext context, UIScrollableGridColumn column, ResponseWriter writer, GridRendererState state) throws IOException {
-
- String cell_id = state.getColumnType()+ ":" + state.getRowIndex()+ ":" + state.getCellIndex();
- String client_id = state.getClientId();
-
- cellTemplate = getCellTemplate();
- ComponentVariables variables = ComponentsVariableResolver.getVariables(cellTemplate, column);
- variables.setVariable("cell_id",cell_id);
- variables.setVariable("client_id", client_id);
- cellTemplate.encodeBegin(context, column);
- renderChildren(context, column);
- cellTemplate.encodeEnd(context, column);
- }
-
- };
-
- private final DataVisitor rowsRenderer = new DataVisitor(){
-
- public void process(FacesContext context, Object rowIndex, Object argument) throws IOException {
-
- GridRendererState state = (GridRendererState)argument;
- UIScrollableGrid grid = state.getGrid();
-
- grid.setRowKey(rowIndex);
-
- if(grid.isRowAvailable()){
-
- int index = ((Integer)rowIndex).intValue();
- state.setRowIndex(index);
- String row_id = state.getClientId() + ":" + "row_" + state.getColumnType() + ":" + index;
- ResponseWriter writer = context.getResponseWriter();
- writer.startElement(HTML.TR_ELEMENT, grid);
- state.setFrozenColumnCount(((Integer)grid.getAttributes().get("frozenColCount")).intValue());
- getUtils().writeAttribute(writer, "id",row_id);
- getUtils().writeAttribute(writer, "class","ClientUI_Grid_BR");
- ColumnWalker.iterateOverColumns(context, grid, cellRenderer, writer, state);
- writer.endElement(HTML.TR_ELEMENT);
-
- }
- }
- };
-
- private final ColumnVisitor ajaxCellRenderer = new ColumnVisitor(){
-
- public int visit(FacesContext context, UIScrollableGridColumn column, ResponseWriter writer, GridRendererState state) throws IOException {
-
- writer.startElement(HTML.SPAN_ELEM, column);
- String columnWidth = (String)column.getAttributes().get("width");
- String cell_id = state.getClientId() + ":" + state.getCellIdPrefix() + ":" + state.getRowIndex()+":" + state.getCellIndex();
- getUtils().writeAttribute(writer, "id",cell_id);
- getUtils().writeAttribute(writer, "class", "ClientUI_Grid_BCBody");
- getUtils().writeAttribute(writer, "style", "width:" + columnWidth);
- renderChildren(context, column);
- writer.endElement(HTML.SPAN_ELEM);
- AjaxContext ajaxContext = state.getAjaxContext();
- ajaxContext.addRenderedArea(cell_id);
-
- return 0;
- }
-
- };
-
- private final DataVisitor ajaxRowsRenderer = new DataVisitor(){
-
- public void process(FacesContext context, Object rowKey, Object argument) throws IOException {
-
- GridRendererState state = (GridRendererState)argument;
- UIScrollableGrid grid = state.getGrid();
- grid.setRowKey(rowKey);
- ResponseWriter writer = context.getResponseWriter();
- state.setFrozenColumnCount(((Integer)grid.getAttributes().get("frozenColCount")).intValue());
- ColumnWalker.iterateOverColumns(context, grid, ajaxCellRenderer, writer, state);
- state.nextRow();
- }
- };
-
- protected String getJavaScriptVarName(FacesContext context, UIScrollableGrid grid) {
- String id = grid.getBaseClientId(context);
-// setUpScriptModel(context, grid);
- return "Richfaces_ScrollableGrid_" + id.replaceAll("[^A-Za-z0-9_]", "_");
- }
-
- protected String getScriptContributions(FacesContext context, UIScrollableGrid grid) {
- return super.getScriptContributions(getJavaScriptVarName(context, grid), context, grid);
- }
-
- public boolean getRendersChildren() {
- return true;
- }
-
- protected void doEncodeChildren(ResponseWriter writer, FacesContext context,
- UIComponent component) throws IOException {
- if(component instanceof UIScrollableGrid){
- renderGridBody(context, (UIScrollableGrid)component, writer);
- }
- }
-
- public void renderGridBody(FacesContext context, UIScrollableGrid component,ResponseWriter writer) throws IOException{
-
- final UIScrollableGrid grid = component;
-
- final GridRendererState state = GridRendererState.getRendererState(context);
-
-
- writer.startElement(HTML.DIV_ELEM, grid);
- getUtils().writeAttribute(writer, "class","GridDataColumns");
- getUtils().writeAttribute(writer, "id","FrozenBox");
- getUtils().writeAttribute(writer, "style","position: absolute; left: 0px; top: 0px; display: block; width: 100px");
- writer.writeText("\n", null);
- writer.startElement("table", grid);
- getUtils().writeAttribute(writer, "id","GridDataFrozen");
- getUtils().writeAttribute(writer, "cellpadding","0");
- getUtils().writeAttribute(writer, "cellspacing","0");
- getUtils().writeAttribute(writer, "style","position: absolute; left: 0px; top: 0px; display: block; width: 100%");
- writer.writeText("\n", null);
- writer.startElement("tbody", grid);
- state.setGrid(grid);
- state.setClientId(grid.getClientId(context));
-
- state.setFrozenPart(true);
- state.setColumType(COLUMN_FROZEN_TYPE);
-
- grid.walk(context, rowsRenderer, state);
-
- writer.endElement("tbody");
- writer.endElement("table");
- writer.endElement(HTML.DIV_ELEM);
-
- writer.startElement(HTML.DIV_ELEM, grid);
- getUtils().writeAttribute(writer, "class","GridDataColumns");
- getUtils().writeAttribute(writer, "id","NormalBox");
- getUtils().writeAttribute(writer, "style","position: absolute; left: 300px; top: 0px; display: block; width: 700px");
- writer.writeText("\n", null);
- writer.startElement("table", grid);
- getUtils().writeAttribute(writer, "id","GridDataNormal");
- getUtils().writeAttribute(writer, "cellpadding","0");
- getUtils().writeAttribute(writer, "cellspacing","0");
- getUtils().writeAttribute(writer, "style","position: absolute; left: 0px; top: 0px; display: block; width: 100%");
- writer.writeText("\n", null);
-
- state.setColumType(COLUMN_NORMAL_TYPE);
- state.setFrozenPart(false);
-
- grid.walk(context, rowsRenderer, state);
-
- writer.endElement("tbody");
- writer.endElement("table");
- writer.endElement(HTML.DIV_ELEM);
- grid.setRowKey(null);
-
- }
-
- public void renderHeaders(FacesContext context, UIScrollableGrid component
- )throws IOException{
-
- ResponseWriter writer = context.getResponseWriter();
- final GridRendererState state = GridRendererState.getRendererState(context);
- state.setFrozenColumnCount(((Integer)component.getAttributes().get("frozenColCount")).intValue());
-
- writer.startElement(HTML.TR_ELEMENT, component);
- writer.writeText("\n", null);
- state.setHeader(true);
- ColumnWalker.iterateOverColumns(context, component, headerFooterRenderer, writer, state);
-
- writer.endElement(HTML.TR_ELEMENT);
- writer.writeText("\n", null);
-
- }
-
- public void renderFooters(FacesContext context, UIScrollableGrid component
- ) throws IOException{
-
- ResponseWriter writer = context.getResponseWriter();
- final GridRendererState state = GridRendererState.getRendererState(context);
- state.setFrozenColumnCount(((Integer)component.getAttributes().get("frozenColCount")).intValue());
-
- writer.startElement(HTML.TR_ELEMENT, component);
- writer.writeText("\n", null);
-
- state.setHeader(false);
-
- int colsCount = ColumnWalker.iterateOverColumns(context, component, headerFooterRenderer, writer, state);
- int rowsCount = component.getRowCount();
-
- ComponentVariables variables = ComponentsVariableResolver.getVariables(this, component);
- variables.setVariable("rows_count", new Integer(rowsCount));
- variables.setVariable("columns_count", new Integer(colsCount));
-
- writer.endElement(HTML.TR_ELEMENT);
- writer.writeText("\n", null);
-
- }
-
- public void setUpState(FacesContext context, UIScrollableGrid grid) {
- GridRendererState.createState(context, grid);
- }
-
- public void tearDownState(FacesContext context){
- GridRendererState.restoreState(context);
- }
-
- public String getRowsAjaxUpdate(FacesContext context, UIScrollableGrid grid){
- JSFunction function = AjaxRendererUtils.buildAjaxFunction(grid, context);
- Map options = AjaxRendererUtils.buildEventOptions(context, grid);
-
- function.addParameter(options);
- String completeFunction = function.toScript()+"; return false;";
- return completeFunction;
- }
-
- protected void doDecode(FacesContext context, UIComponent component) {
-
- super.doDecode(context, component);
-
- if(component instanceof UIScrollableGrid){
-
- UIScrollableGrid grid = (UIScrollableGrid)component;
- ExternalContext externalContext = context.getExternalContext();
- String clientId = grid.getClientId(context) + "_state_input";
-
- Map parameters = externalContext.getRequestParameterMap();
- if(parameters.containsKey(clientId)){
- String submitedState = (String)parameters.get(clientId);
- String [] values = submitedState.split(",");
-
- grid.setRow_count(new Integer(Integer.parseInt(values[0])));
- grid.setDataIndex(new Integer(Integer.parseInt(values[1])));
- grid.setStartRow(new Integer(Integer.parseInt(values[2])));
- grid.queueEvent(new AjaxEvent(grid));
- }
-
- }
- }
-
-
- public void renderAjaxChildren(FacesContext context, UIComponent component)throws IOException{
-
- UIScrollableGrid grid = (UIScrollableGrid)component;
- grid.setFirst(grid.getDataIndex().intValue());
- grid.setRows(grid.getRow_count().intValue());
- int start_row = grid.getStartRow().intValue();
-
- //remode scripts
- AjaxContext ajaxContext = AjaxContext.getCurrentInstance(context);
- String client_id = grid.getClientId(context);
- String script_id = client_id + "_model_create_scripts";
- ajaxContext.removeRenderedArea(client_id);
- ajaxContext.removeRenderedArea(script_id);
- script_id = client_id + "_model_create_scripts";
- ajaxContext.removeRenderedArea(script_id);
-
- GridRendererState state = GridRendererState.createState(context, grid);
- state.setClientId(client_id);
- state.setAjaxContext(ajaxContext);
- state.setRowIndex(start_row);
- state.setFrozenPart(true);
- state.setCellIdPrefix(CELL_ID_PREFFIX + COLUMN_FROZEN_TYPE);
-
- grid.walk(context, ajaxRowsRenderer, state);
-
- state.setRowIndex(start_row);
- grid.setFirst(grid.getDataIndex().intValue());
- grid.setRows(grid.getRow_count().intValue());
- state.setFrozenPart(false);
- state.setCellIdPrefix(CELL_ID_PREFFIX + COLUMN_NORMAL_TYPE);
- grid.walk(context, ajaxRowsRenderer, state);
- }
-
- public void encodeChildren(FacesContext context, UIComponent component
- ) throws IOException {
- AjaxContext ajaxContext = AjaxContext.getCurrentInstance();
- if(ajaxContext.isAjaxRequest()){
- renderAjaxChildren(context, component);
- }else{
- super.encodeChildren(context, component);
- }
- }
-
-
- public void encodeBegin(FacesContext context, UIComponent component) throws IOException {
-
- if(component instanceof UIScrollableGrid){
- UIScrollableGrid grid = (UIScrollableGrid)component;
- setUpState(context, grid);
- }
-
- AjaxContext ajaxContext = AjaxContext.getCurrentInstance();
- if(ajaxContext.isAjaxRequest()){
- }else{
- super.encodeBegin(context, component);
- }
- }
-
- public void encodeEnd(FacesContext context, UIComponent component) throws IOException {
-
- AjaxContext ajaxContext = AjaxContext.getCurrentInstance();
- if(ajaxContext.isAjaxRequest()){
- }else{
- super.encodeEnd(context, component);
- }
- }
-
- public void setUpScriptModel(FacesContext context, UIScrollableGrid grid) throws IOException{
-
- DataModel dataModel = grid.getStoredDataModel();
- Integer rows_count = new Integer(dataModel.getRowCount());
-
- ColumnVisitor visitor = new ColumnVisitor(){
- public int visit(FacesContext context, UIScrollableGridColumn column, ResponseWriter writer, GridRendererState state) throws IOException {
- return 1;
- }
- };
-
- Integer columns_count = new Integer(ColumnWalker.iterateOverColumns(context, grid, visitor, null, null));
- ComponentVariables variables = ComponentsVariableResolver.getVariables(this, grid);
- variables.setVariable("rows_count", rows_count);
- variables.setVariable("column_count", columns_count);
- }
-
- private RendererBase getCellTemplate() {
- if (cellTemplate == null) {
- cellTemplate = TemplateLoader.loadTemplate("org.richfaces.renderkit.html.ScrollableGridCellRenderer");
- }
-
- return cellTemplate;
- }
-}
Added: 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 (rev 0)
+++ trunk/sandbox/scrollable-grid/src/main/java/org/richfaces/renderkit/html/ScrollableGridBaseRenderer.java 2007-05-21 11:19:07 UTC (rev 813)
@@ -0,0 +1,426 @@
+package org.richfaces.renderkit.html;
+
+import java.io.IOException;
+import java.util.Map;
+
+import javax.faces.component.UIComponent;
+import javax.faces.context.ExternalContext;
+import javax.faces.context.FacesContext;
+import javax.faces.context.ResponseWriter;
+
+import org.ajax4jsf.ajax.repeat.DataVisitor;
+import org.ajax4jsf.framework.ajax.AjaxContext;
+import org.ajax4jsf.framework.ajax.AjaxEvent;
+import org.ajax4jsf.framework.renderer.AjaxRendererUtils;
+import org.ajax4jsf.framework.renderer.ComponentVariables;
+import org.ajax4jsf.framework.renderer.ComponentsVariableResolver;
+import org.ajax4jsf.framework.renderer.RendererBase;
+import org.ajax4jsf.framework.renderer.RendererUtils.HTML;
+import org.ajax4jsf.framework.util.javascript.JSFunction;
+import org.richfaces.component.UIScrollableGrid;
+import org.richfaces.component.UIScrollableGridColumn;
+import org.richfaces.renderkit.CompositeRenderer;
+import org.richfaces.utils.TemplateLoader;
+
+
+
+/**
+ * @author Anton Belevich
+ *
+ */
+
+public abstract class ScrollableGridBaseRenderer extends CompositeRenderer {
+
+ private final String FOOTER_PART = "footer";
+
+ private final String HEADER_PART = "header";
+
+ private final String CELL_ID_PREFFIX ="bc_";
+
+ private final String COLUMN_FROZEN_TYPE = "frozen";
+
+ private final String COLUMN_NORMAL_TYPE = "normal";
+
+ private RendererBase cellTemplate = null;
+
+ private RendererBase headerCellTemplate = null;
+
+ private RendererBase footerCellTemplate = null;
+
+ private final ColumnVisitor columnsWidthCounter = new ColumnVisitor(){
+
+ public int visit(FacesContext context, UIScrollableGridColumn column, ResponseWriter writer, GridRendererState state) throws IOException {
+
+ int prevWidth = 0;
+ int width = 0;
+
+
+ String widthPx = (String)column.getAttributes().get("width");
+ prevWidth = state.getSumWidth();
+
+ if(widthPx.endsWith("px")){
+ width = prevWidth + Integer.parseInt(widthPx.substring(0, widthPx.indexOf("px")));
+ }
+
+ state.setSumWidth(width);
+ return 1;
+ }
+ };
+
+ private final ColumnVisitor headerCellRenderer = new ExtendedColumnVisitor(){
+
+ public void renderContent(FacesContext context, UIScrollableGridColumn column, ResponseWriter writer, GridRendererState state) throws IOException {
+
+
+ int cell_index = state.getCellIndex();
+ String client_id = state.getClientId();
+
+ headerCellTemplate = getHeaderCellTemplate();
+
+ ComponentVariables variables = ComponentsVariableResolver.getVariables(headerCellTemplate, column);
+ String widthPx = (String)column.getAttributes().get("width");
+ int width = Integer.parseInt(widthPx.substring(0, widthPx.indexOf("px")));
+
+
+ int sepOffset = 0;
+
+ if(state.isFrozenColumn()){
+ sepOffset = state.getSepOffset().intValue() + width;
+ }else{
+ sepOffset = state.getSepOffset().intValue() + width + 1;
+ state.setSepOffset(new Integer(sepOffset));
+ }
+
+ variables.setVariable("client_id", client_id);
+ variables.setVariable("cell_index", new Integer(cell_index));
+ variables.setVariable("sepOffset", new Integer(sepOffset));
+
+ headerCellTemplate.encodeBegin(context, column);
+ UIComponent component = column.getFacet(HEADER_PART);
+ if(component != null){
+ renderChild(context, component);
+ }
+ headerCellTemplate.encodeEnd(context, column);
+
+
+ }
+ };
+
+ private final ColumnVisitor footerCellRenderer = new ExtendedColumnVisitor(){
+
+ public void renderContent(FacesContext context, UIScrollableGridColumn column, ResponseWriter writer, GridRendererState state) throws IOException {
+
+ int cell_index = state.getCellIndex();
+ String client_id = state.getClientId();
+
+ footerCellTemplate = getFooterCellTemplate();
+
+ ComponentVariables variables = ComponentsVariableResolver.getVariables(footerCellTemplate, column);
+ variables.setVariable("client_id", client_id);
+ variables.setVariable("cell_index", new Integer(cell_index));
+
+ footerCellTemplate.encodeBegin(context, column);
+ UIComponent component = column.getFacet(FOOTER_PART);
+ if(component != null){
+ renderChild(context, component);
+ }
+ footerCellTemplate.encodeEnd(context, column);
+
+ }
+ };
+
+ private final ColumnVisitor cellRenderer = new ExtendedColumnVisitor(){
+
+ public void renderContent(FacesContext context, UIScrollableGridColumn column, ResponseWriter writer, GridRendererState state) throws IOException {
+
+ String cell_id = state.getRowIndex()+ "_" + state.getCellIndex();
+ String client_id = state.getClientId();
+ int cell_index = state.getCellIndex();
+ cellTemplate = getCellTemplate();
+
+ ComponentVariables variables = ComponentsVariableResolver.getVariables(cellTemplate, column);
+ variables.setVariable("cell_id",cell_id);
+ variables.setVariable("client_id", client_id);
+ variables.setVariable("cell_index", new Integer(cell_index));
+
+ cellTemplate.encodeBegin(context, column);
+ renderChildren(context, column);
+ cellTemplate.encodeEnd(context, column);
+ }
+
+ };
+
+ private final DataVisitor rowsRenderer = new DataVisitor(){
+
+ public void process(FacesContext context, Object rowIndex, Object argument) throws IOException {
+
+ GridRendererState state = (GridRendererState)argument;
+ UIScrollableGrid grid = state.getGrid();
+
+ grid.setRowKey(rowIndex);
+
+ if(grid.isRowAvailable()){
+
+ int index = ((Integer)rowIndex).intValue();
+ state.setRowIndex(index);
+ String row_id = "row_" + index;
+ ResponseWriter writer = context.getResponseWriter();
+ writer.startElement(HTML.TR_ELEMENT, grid);
+ state.setFrozenColumnCount(((Integer)grid.getAttributes().get("frozenColCount")).intValue());
+ getUtils().writeAttribute(writer, "id",row_id);
+ getUtils().writeAttribute(writer, "class","ClientUI_Grid_BR");
+ ColumnWalker.iterateOverColumns(context, grid, cellRenderer, writer, state);
+ writer.endElement(HTML.TR_ELEMENT);
+
+ }
+ }
+ };
+
+ private final ColumnVisitor ajaxCellRenderer = new ExtendedColumnVisitor(){
+
+ public int visit(FacesContext context, UIScrollableGridColumn column, ResponseWriter writer, GridRendererState state) throws IOException {
+ int i = state.getFrozenColumnCount();
+ state.setFrozenColumnCount(i-1);
+ renderContent(context, column, writer,state);
+
+ return 1;
+ }
+
+ public void renderContent(FacesContext context, UIScrollableGridColumn column, ResponseWriter writer, GridRendererState state) throws IOException {
+ writer.startElement(HTML.SPAN_ELEM, column);
+ String columnWidth = (String)column.getAttributes().get("width");
+
+ String cell_id = state.getClientId() + ":" + CELL_ID_PREFFIX+ state.getRowIndex()+ "_" + state.getCellIndex();
+ getUtils().writeAttribute(writer, "id",cell_id);
+ getUtils().writeAttribute(writer, "class", "ClientUI_Grid_BCBody");
+ getUtils().writeAttribute(writer, "style", "width:" + columnWidth);
+ renderChildren(context, column);
+ writer.endElement(HTML.SPAN_ELEM);
+ AjaxContext ajaxContext = state.getAjaxContext();
+ ajaxContext.addRenderedArea(cell_id);
+ }
+
+ };
+
+ private final DataVisitor ajaxRowsRenderer = new DataVisitor(){
+
+ public void process(FacesContext context, Object rowKey, Object argument) throws IOException {
+
+ GridRendererState state = (GridRendererState)argument;
+ UIScrollableGrid grid = state.getGrid();
+ grid.setRowKey(rowKey);
+ ResponseWriter writer = context.getResponseWriter();
+ state.setFrozenColumnCount(((Integer)grid.getAttributes().get("frozenColCount")).intValue());
+ ColumnWalker.iterateOverColumns(context, grid, ajaxCellRenderer, writer, state);
+ state.nextRow();
+ }
+ };
+
+ protected String getJavaScriptVarName(FacesContext context, UIScrollableGrid grid) {
+ String id = grid.getBaseClientId(context);
+ return "Richfaces_ScrollableGrid_" + id.replaceAll("[^A-Za-z0-9_]", "_");
+ }
+
+ protected String getScriptContributions(FacesContext context, UIScrollableGrid grid) {
+ return super.getScriptContributions(getJavaScriptVarName(context, grid), context, grid);
+ }
+
+ public boolean getRendersChildren() {
+ return true;
+ }
+
+ public void renderGridBody(FacesContext context, UIScrollableGrid grid, boolean isFrozen) throws IOException{
+
+ final GridRendererState state = GridRendererState.getRendererState(context);
+
+ if(isFrozen){
+ state.setColumType(COLUMN_FROZEN_TYPE);
+ }else{
+ state.setColumType(COLUMN_NORMAL_TYPE);
+ }
+
+ state.setFrozenColumnCount(((Integer)grid.getAttributes().get("frozenColCount")).intValue());
+ state.setFrozenPart(isFrozen);
+ state.setClientId(grid.getClientId(context));
+ grid.walk(context, rowsRenderer, state);
+ grid.setRowKey(null);
+ }
+
+ public void renderHeaders(FacesContext context, UIScrollableGrid grid, boolean isFrozen)throws IOException{
+
+ ResponseWriter writer = context.getResponseWriter();
+ final GridRendererState state = GridRendererState.getRendererState(context);
+
+ if(isFrozen){
+ state.setColumType(COLUMN_FROZEN_TYPE);
+ }else{
+ state.setColumType(COLUMN_NORMAL_TYPE);
+ }
+
+ state.setClientId(grid.getClientId(context));
+ state.setPart(HEADER_PART);
+ state.setFrozenColumnCount(((Integer)grid.getAttributes().get("frozenColCount")).intValue());
+ state.setFrozenPart(isFrozen);
+ state.setClientId(grid.getClientId(context));
+ state.setSepOffset(new Integer(0));
+ ColumnWalker.iterateOverColumns(context, grid, headerCellRenderer, writer, state);
+ }
+
+ public void renderFooters(FacesContext context, UIScrollableGrid grid, boolean isFrozen) throws IOException{
+
+ ResponseWriter writer = context.getResponseWriter();
+ final GridRendererState state = GridRendererState.getRendererState(context);
+
+ if(isFrozen){
+ state.setColumType(COLUMN_FROZEN_TYPE);
+ }else{
+ state.setColumType(COLUMN_NORMAL_TYPE);
+ }
+
+ state.setClientId(grid.getClientId(context));
+ state.setFrozenColumnCount(((Integer)grid.getAttributes().get("frozenColCount")).intValue());
+ state.setFrozenPart(isFrozen);
+ int colsCount = ColumnWalker.iterateOverColumns(context, grid, footerCellRenderer, writer, state);
+ int rowsCount = grid.getRowCount();
+
+ ComponentVariables variables = ComponentsVariableResolver.getVariables(this, grid);
+ variables.setVariable("rows_count", new Integer(rowsCount));
+ variables.setVariable("columns_count", new Integer(colsCount));
+
+ }
+
+ public void setUpState(FacesContext context, UIScrollableGrid grid) {
+ GridRendererState.createState(context, grid);
+ }
+
+ public void tearDownState(FacesContext context){
+ GridRendererState.restoreState(context);
+ }
+
+ public String getRowsAjaxUpdate(FacesContext context, UIScrollableGrid grid){
+
+ JSFunction function = AjaxRendererUtils.buildAjaxFunction(grid, context);
+ Map options = AjaxRendererUtils.buildEventOptions(context, grid);
+
+ function.addParameter(options);
+ String completeFunction = function.toScript()+"; return false;";
+ return completeFunction;
+
+ }
+
+ protected void doDecode(FacesContext context, UIComponent component) {
+
+ super.doDecode(context, component);
+
+ if(component instanceof UIScrollableGrid){
+
+ UIScrollableGrid grid = (UIScrollableGrid)component;
+ ExternalContext externalContext = context.getExternalContext();
+ String clientId = grid.getClientId(context) + "_state_input";
+
+ Map parameters = externalContext.getRequestParameterMap();
+ if(parameters.containsKey(clientId)){
+
+ String submitedState = (String)parameters.get(clientId);
+ String [] values = submitedState.split(",");
+ grid.setRow_count(new Integer(Integer.parseInt(values[0])));
+ grid.setDataIndex(new Integer(Integer.parseInt(values[1])));
+ grid.setStartRow(new Integer(Integer.parseInt(values[2])));
+ grid.queueEvent(new AjaxEvent(grid));
+
+ }
+
+ }
+
+ }
+
+ public void renderAjaxChildren(FacesContext context, UIComponent component)throws IOException{
+
+ UIScrollableGrid grid = (UIScrollableGrid)component;
+
+ GridRendererState state = GridRendererState.createState(context, grid);
+ grid.setFirst(grid.getDataIndex().intValue());
+ int old = grid.getRows();
+ state.set_loadedRowsCount(old);
+
+ grid.setRows(grid.getRow_count().intValue());
+ int start_row = grid.getStartRow().intValue();
+
+ AjaxContext ajaxContext = AjaxContext.getCurrentInstance(context);
+ String client_id = grid.getClientId(context);
+ state.setClientId(client_id);
+ state.setAjaxContext(ajaxContext);
+ state.setRowIndex(start_row);
+ grid.walk(context, ajaxRowsRenderer, state);
+ grid.setRows(old);
+ }
+
+ public void encodeChildren(FacesContext context, UIComponent component
+ ) throws IOException {
+
+ AjaxContext ajaxContext = AjaxContext.getCurrentInstance();
+ if(ajaxContext.isAjaxRequest()){
+ renderAjaxChildren(context, component);
+ }else{
+ super.encodeChildren(context, component);
+ }
+
+ }
+
+ public void encodeBegin(FacesContext context, UIComponent component) throws IOException {
+
+ if(component instanceof UIScrollableGrid){
+ UIScrollableGrid grid = (UIScrollableGrid)component;
+ setUpState(context, grid);
+ }
+
+ AjaxContext ajaxContext = AjaxContext.getCurrentInstance();
+ if(ajaxContext.isAjaxRequest()){
+ }else{
+ super.encodeBegin(context, component);
+ }
+
+ }
+
+ public void encodeEnd(FacesContext context, UIComponent component) throws IOException {
+
+ AjaxContext ajaxContext = AjaxContext.getCurrentInstance();
+ if(ajaxContext.isAjaxRequest()){
+ }else{
+ super.encodeEnd(context, component);
+ }
+
+ }
+
+ public void setUpColumnsWidth(FacesContext context, UIScrollableGrid grid) throws IOException{
+ GridRendererState state = GridRendererState.getRendererState(context);
+ state.setFrozenColumnCount(((Integer)grid.getAttributes().get("frozenColCount")).intValue());
+ ColumnWalker.iterateOverColumns(context, grid, columnsWidthCounter, null, state);
+ ComponentVariables variables = ComponentsVariableResolver.getVariables(this, grid);
+ int sumWidth = state.getSumWidth() + 20;
+ variables.setVariable("sumWidth", new Integer(sumWidth));
+ }
+
+ private RendererBase getCellTemplate() {
+ if (cellTemplate == null) {
+ cellTemplate = TemplateLoader.loadTemplate("org.richfaces.renderkit.html.ScrollableGridCellRenderer");
+ }
+ return cellTemplate;
+ }
+
+ private RendererBase getHeaderCellTemplate() {
+
+ if (headerCellTemplate == null) {
+ headerCellTemplate = TemplateLoader.loadTemplate("org.richfaces.renderkit.html.ScrollableGridHeaderCellRenderer");
+ }
+ return headerCellTemplate;
+ }
+
+ private RendererBase getFooterCellTemplate() {
+
+ if (footerCellTemplate == null) {
+ footerCellTemplate = TemplateLoader.loadTemplate("org.richfaces.renderkit.html.ScrollableGridFooterCellRenderer");
+ }
+ return footerCellTemplate;
+ }
+}
17 years, 7 months
JBoss Rich Faces SVN: r812 - trunk/sandbox/scrollable-grid/src/main/templates/org/richfaces.
by richfaces-svn-commits@lists.jboss.org
Author: abelevich
Date: 2007-05-21 07:18:50 -0400 (Mon, 21 May 2007)
New Revision: 812
Added:
trunk/sandbox/scrollable-grid/src/main/templates/org/richfaces/scrollable-grid.jspx
Removed:
trunk/sandbox/scrollable-grid/src/main/templates/org/richfaces/scrollable-grid-cells2.jspx
trunk/sandbox/scrollable-grid/src/main/templates/org/richfaces/scrollable-grid.jspx
trunk/sandbox/scrollable-grid/src/main/templates/org/richfaces/scrollable-grid2.jspx
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-footer-cell.jspx
trunk/sandbox/scrollable-grid/src/main/templates/org/richfaces/scrollable-grid-header-cell.jspx
Log:
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-05-21 10:36:48 UTC (rev 811)
+++ trunk/sandbox/scrollable-grid/src/main/templates/org/richfaces/scrollable-grid-cell.jspx 2007-05-21 11:18:50 UTC (rev 812)
@@ -12,8 +12,8 @@
>
<td class="ClientUI_Grid_BC" id="#{client_id}:c_#{cell_id}">
- <span style="width: #{component.attributes['width']}" id="#{client_id}:#{column_type}:bc_#{cell_index}_#{row_index}" class="ClientUI_Grid_BCBody1">
- <span class="ClientUI_Grid_FCBody" id="#{client_id}:#{column_type}:bcc_#{cell_id}">
+ <span style="width: #{component.attributes['width']}" id="#{client_id}:bc_#{cell_index}" class="ClientUI_Grid_BCBody1">
+ <span class="ClientUI_Grid_FCBody" id="#{client_id}:bc_#{cell_id}">
<vcp:body/>
</span>
</span>
Deleted: trunk/sandbox/scrollable-grid/src/main/templates/org/richfaces/scrollable-grid-cells2.jspx
===================================================================
--- trunk/sandbox/scrollable-grid/src/main/templates/org/richfaces/scrollable-grid-cells2.jspx 2007-05-21 10:36:48 UTC (rev 811)
+++ trunk/sandbox/scrollable-grid/src/main/templates/org/richfaces/scrollable-grid-cells2.jspx 2007-05-21 11:18:50 UTC (rev 812)
@@ -1,21 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<f:root
- xmlns:f="http://ajax4jsf.org/cdk/template"
- xmlns:c=" http://java.sun.com/jsf/core"
- xmlns:ui=" http://ajax4jsf.org/cdk/ui"
- xmlns:u=" http://ajax4jsf.org/cdk/u"
- xmlns:x=" http://ajax4jsf.org/cdk/x"
- xmlns:h=" http://ajax4jsf.org/cdk/headers"
- xmlns:vcp="http://ajax4jsf.org/cdk/vcp"
- class="org.richfaces.renderkit.html.ScrollableGridCellRenderer"
- component="javax.faces.component.UIComponent"
- >
- <f:clientId var="clientId" />
-
- <td id="#{client_id}:c_#{cell_id}" class="ClientUI_Grid_BC">
- <span id="#{client_id}:bc_#{cell_id}" style="width: #{component.attributes['width']}" class="ClientUI_Grid_BCBody">
- <vcp:body/>
- </span>
- </td>
-
-</f:root>
\ No newline at end of file
Modified: trunk/sandbox/scrollable-grid/src/main/templates/org/richfaces/scrollable-grid-footer-cell.jspx
===================================================================
--- trunk/sandbox/scrollable-grid/src/main/templates/org/richfaces/scrollable-grid-footer-cell.jspx 2007-05-21 10:36:48 UTC (rev 811)
+++ trunk/sandbox/scrollable-grid/src/main/templates/org/richfaces/scrollable-grid-footer-cell.jspx 2007-05-21 11:18:50 UTC (rev 812)
@@ -12,7 +12,7 @@
>
<td class="ClientUI_Grid_FC">
- <span style="width: #{component.attributes['width']}" id="#{client_id}:fc_#{cell_id}" class="ClientUI_Grid_FCBody1">
+ <span style="width: #{component.attributes['width']}" id="#{client_id}:fc_#{cell_index}" class="ClientUI_Grid_FCBody1">
<span class="ClientUI_Grid_FCBody">
<vcp:body/>
</span>
Modified: trunk/sandbox/scrollable-grid/src/main/templates/org/richfaces/scrollable-grid-header-cell.jspx
===================================================================
--- trunk/sandbox/scrollable-grid/src/main/templates/org/richfaces/scrollable-grid-header-cell.jspx 2007-05-21 10:36:48 UTC (rev 811)
+++ trunk/sandbox/scrollable-grid/src/main/templates/org/richfaces/scrollable-grid-header-cell.jspx 2007-05-21 11:18:50 UTC (rev 812)
@@ -11,8 +11,8 @@
component="javax.faces.component.UIComponent"
>
- <td class="ClientUI_Grid_HC" id="#{client_id}hc_#{cell_id}">
- <span style="width: #{component.attributes['width']}" id="#{client_id}:hcc_#{cell_id}" class="ClientUI_Grid_HCBody1">
+ <td class="ClientUI_Grid_HC" id="#{client_id}:hc_#{cell_index}">
+ <span style="width: #{component.attributes['width']}" id="#{client_id}:hcc_#{cell_index}" class="ClientUI_Grid_HCBody1">
<span id="#{clientId}:hcb_#{cell_index}" class="ClientUI_Grid_HCBody">
<table width="100%" cellspacing="0" cellpadding="0" border="0" align="center">
<tbody>
@@ -33,7 +33,12 @@
</table>
</span>
</span>
- <span column="#{cell_index}" id="#{client_id}:hsep_#{cell_index}" style="left: ${sepOffset - 3}px;" class="ClientUI_Grid_HSep" />
+ <jsp:scriptlet>
+
+ int offset = ((Integer)variables.getVariable("sepOffset")).intValue() - 3;
+
+ </jsp:scriptlet>
+ <span column="#{cell_index}" id="#{client_id}:hsep_#{cell_index}" style="left: #{offset}px;" class="ClientUI_Grid_HSep" />
</td>
</f:root>
\ No newline at end of file
Deleted: trunk/sandbox/scrollable-grid/src/main/templates/org/richfaces/scrollable-grid.jspx
===================================================================
--- trunk/sandbox/scrollable-grid/src/main/templates/org/richfaces/scrollable-grid.jspx 2007-05-21 10:36:48 UTC (rev 811)
+++ trunk/sandbox/scrollable-grid/src/main/templates/org/richfaces/scrollable-grid.jspx 2007-05-21 11:18:50 UTC (rev 812)
@@ -1,158 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<f:root
- xmlns:f="http://ajax4jsf.org/cdk/template"
- xmlns:c=" http://java.sun.com/jsf/core"
- xmlns:ui=" http://ajax4jsf.org/cdk/ui"
- xmlns:u=" http://ajax4jsf.org/cdk/u"
- xmlns:x=" http://ajax4jsf.org/cdk/x"
- xmlns:h=" http://ajax4jsf.org/cdk/headers"
- xmlns:vcp="http://ajax4jsf.org/cdk/vcp"
- class="org.richfaces.renderkit.html.ScrollableGridRenderer"
- baseclass="org.richfaces.renderkit.html.ScrollableGridBaseRenderer"
- component="org.richfaces.component.UIScrollableGrid"
- >
-
- <h:styles>
- /org/richfaces/renderkit/html/css/grid.xcss
- </h:styles>
-
- <h:scripts>
- new org.ajax4jsf.framework.resource.PrototypeScript(),
- new org.ajax4jsf.framework.ajax.AjaxScript(),
- /org/richfaces/renderkit/html/scripts/scrollable-grid.js
- </h:scripts>
-
- <f:clientId var="clientId" />
-
-
- <div id="#{clientId}_GridContainer" style="width: 90%; height:500px;" class="ClientUI_Grid">
- <div id="#{clientId}_GridHeaderTemplate">
- <table class="TestGridHeader" cellpadding="0" cellspacing="0" border="1">
- <tbody>
- <f:call name="renderHeaders"/>
- </tbody>
- </table>
- </div>
- <div id="#{clientId}_GridBodyTemplate">
- <vcp:body/>
- </div>
- <f:clientId var="clientId" />
- <div id="#{clientId}_GridFooterTemplate">
- <table cellpadding="0" cellspacing="0">
- <tbody>
- <f:call name="renderFooters"/>
- </tbody>
- </table>
- </div>
-
- <input type="hidden" name="#{clientId}_state_input" id="#{clientId}_state_input"/>
- <input type="hidden" name="#{clienId}_rows_input" id="#{clientId}_rows_input" value="#{rows_count}"/>
- <input type="button" name="#{clientId}_submit_input" id="#{clientId}_submit_input" onclick="#{this:getRowsAjaxUpdate(context,component)}" style="display:none"/>
-
- </div>
-
- <f:call name="tearDownState"/>
-
-
- <script id="#{clientId}_model_create_scripts" type="text/javascript">
- //<![CDATA[
- ClientUI.controls.grid.FakeArrayDataModel = Class.create({
- CLASSDEF: {
- name: 'ClientUI.controls.grid.FakeArrayDataModel',
- parent: ClientUI.controls.grid.DataModel
- }
- });
-
- Object.extend(ClientUI.controls.grid.FakeArrayDataModel.prototype, {
- initialize: function(rows_count, columns_count, grid_id) {
- ClientUI.controls.grid.FakeArrayDataModel.parentClass.constructor().call(this);
- this.data = [];
- this.count = rows_count;
- this.columns = columns_count;
- this.gridId = grid_id;
- },
- getRow: function(index) {
- if(!this.data[index]) {
- this.data[index] = [];
- for (var index2 = 0; index2 < 7; index2++) {
- this.data[index][index2] = index2 + " : " + index;
- }
- this.data[index][6] = index%2 ? "value 1" : "value 2";
- }
-
- return this.data[index];
- },
- getCount: function() {
- return this.count;
- },
- getRequestDelay: function() {
- return 50;
- },
-
- loadRows: function(options) {
- var state_options = options;
- var state_input = $(this.gridId + "_state_input");
- var submit_input = $(this.gridId + "_submit_input");
- var submit_values = state_options.count + "," + state_options.index + "," + state_options.startRow;
- state_input.value = submit_values;
- submit_input.click();
- }
- });
- // ]]>
- </script>
-
- <script id="#{clientId}_grid_create_scripts" type="text/javascript">
- //<![CDATA[
-
-
- var #{this:getJavaScriptVarName(context, component)} = function() {
- return {
- init : function() {
- var currTime = (new Date()).getTime();
- // ClientUILib.log(ClientUILogger.WARNING, "Document loaded over " + (currTime - ClientUILib.startTime) + " miliseconds.");
- var clientId = '#{clientId}';
- var rows_count = $(clientId + "_rows_input").value;
- var columns_count = '#{columns_count}';
-
- dataModel = new ClientUI.controls.grid.FakeArrayDataModel(rows_count, columns_count, clientId);
-
- var templates = [
- {pane: GridLayout_Enum.HEADER, ref: clientId +"_" + "GridHeaderTemplate"},
- {pane: GridLayout_Enum.BODY, ref: clientId +"_" + "GridBodyTemplate"},
- {pane: GridLayout_Enum.FOOTER, ref: clientId +"_" + "GridFooterTemplate"}
- ];
-
- // ClientUILib.log(ClientUILogger.WARNING, "DataModel created over " + ((new Date()).getTime() - currTime) + " miliseconds.");
- // currTime = (new Date()).getTime();
-
- // create the Grid
- grid = new ClientUI.controls.grid.Grid2(clientId +"_" + 'GridContainer', dataModel, templates,
- {
- showIndexColumn: false,
- indexColumnWidth: 40
- }
- );
- // ClientUILib.log(ClientUILogger.WARNING, "Grid control created over " + ((new Date()).getTime() - currTime) + " miliseconds.");
-
- grid.updateLayout();
-
- setTimeout(function() {
- currTime = (new Date()).getTime();
- //grid.loadData();
- }.bind(this), 100);
-
- // ClientUILib.log(ClientUILogger.WARNING, "Done.");
- }
-
- }
- }();
-
- #{this:getScriptContributions(context, component)};
- Event.observe(window, 'load', #{this:getJavaScriptVarName(context, component)}.init);
-
-// ]]>
- </script>
-</f:root>
-
-
-
\ No newline at end of file
Added: trunk/sandbox/scrollable-grid/src/main/templates/org/richfaces/scrollable-grid.jspx
===================================================================
--- trunk/sandbox/scrollable-grid/src/main/templates/org/richfaces/scrollable-grid.jspx (rev 0)
+++ trunk/sandbox/scrollable-grid/src/main/templates/org/richfaces/scrollable-grid.jspx 2007-05-21 11:18:50 UTC (rev 812)
@@ -0,0 +1,235 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<f:root
+ xmlns:f="http://ajax4jsf.org/cdk/template"
+ xmlns:c=" http://java.sun.com/jsf/core"
+ xmlns:ui=" http://ajax4jsf.org/cdk/ui"
+ xmlns:u=" http://ajax4jsf.org/cdk/u"
+ xmlns:x=" http://ajax4jsf.org/cdk/x"
+ xmlns:h=" http://ajax4jsf.org/cdk/headers"
+ xmlns:vcp="http://ajax4jsf.org/cdk/vcp"
+ class="org.richfaces.renderkit.html.ScrollableGridRenderer"
+ baseclass="org.richfaces.renderkit.html.ScrollableGridBaseRenderer"
+ component="org.richfaces.component.UIScrollableGrid"
+ >
+
+ <h:styles>
+ /org/richfaces/renderkit/html/css/grid.xcss
+ </h:styles>
+
+ <h:scripts>
+ new org.ajax4jsf.framework.resource.PrototypeScript(),
+ new org.ajax4jsf.framework.ajax.AjaxScript(),
+ /org/richfaces/renderkit/html/scripts/scrollable-grid.js
+ </h:scripts>
+
+ <f:clientId var="clientId" />
+
+ <f:call name="setUpColumnsWidth"/>
+
+ <div id="#{clientId}_GridContainer" style="width: #{component.attributes['width']};height: #{component.attributes['height']};" class="ClientUI_Grid">
+
+ <div id="#{clientId}_GridHeaderTemplate" class="ClientUI_InlineBox" style="width: #{component.attributes['width']};">
+ <div style="display: block; left: 0px; top: 0px; width: #{sumWidth}px;">
+ <span class="ClientUI_TmplBox" id="FrozenBox">
+ <table cellpadding="0" cellspacing="0">
+ <tbody>
+ <tr class="ClientUI_Grid_HR">
+ <jsp:scriptlet>
+ <![CDATA[
+ renderHeaders(context, component, true);
+ ]]>
+ </jsp:scriptlet>
+ </tr>
+ </tbody>
+ </table>
+ </span>
+
+ <span class="ClientUI_TmplBox" id="NormalBox">
+ <table cellpadding="0" cellspacing="0">
+ <tbody>
+ <tr class="ClientUI_Grid_HR">
+ <jsp:scriptlet>
+ <![CDATA[
+ renderHeaders(context, component, false);
+ ]]>
+ </jsp:scriptlet>
+ </tr>
+ </tbody>
+ </table>
+ </span>
+ </div>
+ </div>
+
+ <div id="#{clientId}_GridBodyTemplate" class="ClientUI_InlineBox" style="overflow: auto; width: #{component.attributes['width']}; height: #{component.attributes['height']};">
+ <div style="display: block; width: #{sumWidth}px;">
+ <span class="ClientUI_TmplBox" id="FrozenBox">
+ <table cellpadding="0" cellspacing="0">
+ <tbody>
+ <jsp:scriptlet>
+ <![CDATA[
+ renderGridBody(context, component, true);
+ ]]>
+ </jsp:scriptlet>
+ </tbody>
+ </table>
+ </span>
+ <span class="ClientUI_TmplBox" id="NormalBox">
+ <table cellpadding="0" cellspacing="0">
+ <tbody>
+ <jsp:scriptlet>
+ <![CDATA[
+ renderGridBody(context, component, false);
+ ]]>
+ </jsp:scriptlet>
+ </tbody>
+ </table>
+ </span>
+ </div>
+ </div>
+
+ <div id="#{clientId}_GridFooterTemplate" class="ClientUI_InlineBox" style="width: #{component.attributes['width']};">
+ <div style="display: block; width: width: #{sumWidth}px;">
+ <span class="ClientUI_TmplBox" id="FrozenBox">
+ <table cellpadding="0" cellspacing="0">
+ <tbody>
+ <tr class="ClientUI_Grid_FR">
+ <jsp:scriptlet>
+ <![CDATA[
+ renderFooters(context, component,true);
+ ]]>
+ </jsp:scriptlet>
+ </tr>
+ </tbody>
+ </table>
+ </span>
+
+ <span class="ClientUI_TmplBox" id="NormalBox">
+ <table cellpadding="0" cellspacing="0">
+ <tbody>
+ <tr class="ClientUI_Grid_FR">
+ <jsp:scriptlet>
+ <![CDATA[
+ renderFooters(context, component,false);
+ ]]>
+ </jsp:scriptlet>
+ </tr>
+ </tbody>
+ </table>
+ </span>
+ </div>
+ </div>
+
+ <input type="hidden" name="#{clientId}_state_input" id="#{clientId}_state_input"/>
+ <input type="hidden" name="#{clienId}_rows_input" id="#{clientId}_rows_input" value="#{rows_count}"/>
+ <input type="button" name="#{clientId}_submit_input" id="#{clientId}_submit_input" onclick="#{this:getRowsAjaxUpdate(context,component)}" style="display:none"/>
+
+ </div>
+
+ <f:call name="tearDownState"/>
+
+ <script id="#{clientId}_model_create_scripts" type="text/javascript">
+ //<![CDATA[
+ ClientUI.controls.grid.FakeArrayDataModel = Class.create({
+ CLASSDEF: {
+ name: 'ClientUI.controls.grid.FakeArrayDataModel',
+ parent: ClientUI.controls.grid.DataModel
+ }
+ });
+
+ Object.extend(ClientUI.controls.grid.FakeArrayDataModel.prototype, {
+ initialize: function(rows_count, columns_count, grid_id) {
+ ClientUI.controls.grid.FakeArrayDataModel.parentClass.constructor().call(this);
+ this.data = [];
+ this.count = rows_count;
+ this.columns = columns_count;
+ this.gridId = grid_id;
+ },
+ getRow: function(index) {
+ if(!this.data[index]) {
+ this.data[index] = [];
+ for (var index2 = 0; index2 < 7; index2++) {
+ this.data[index][index2] = index2 + " : " + index;
+ }
+ this.data[index][6] = index%2 ? "value 1" : "value 2";
+ }
+
+ return this.data[index];
+ },
+ getCount: function() {
+ return this.count;
+ },
+ getRequestDelay: function() {
+ return 50;
+ },
+
+ loadRows: function(options) {
+ var state_options = options;
+ var state_input = $(this.gridId + "_state_input");
+ var submit_input = $(this.gridId + "_submit_input");
+ var submit_values = state_options.count + "," + state_options.index + "," + state_options.startRow;
+ state_input.value = submit_values;
+ submit_input.click();
+ }
+ });
+ // ]]>
+ </script>
+
+ <script id="#{clientId}_grid_create_scripts" type="text/javascript">
+ //<![CDATA[
+
+
+ var #{this:getJavaScriptVarName(context, component)} = function() {
+ return {
+ init : function() {
+ var currTime = (new Date()).getTime();
+ // ClientUILib.log(ClientUILogger.WARNING, "Document loaded over " + (currTime - ClientUILib.startTime) + " miliseconds.");
+ var clientId = '#{clientId}';
+ var rows_count = $(clientId + "_rows_input").value;
+ var columns_count = '#{columns_count}';
+
+ dataModel = new ClientUI.controls.grid.FakeArrayDataModel(rows_count, columns_count, clientId);
+
+ var templates = [
+ {pane: GridLayout_Enum.HEADER, ref: clientId +"_" + "GridHeaderTemplate"},
+ {pane: GridLayout_Enum.BODY, ref: clientId +"_" + "GridBodyTemplate"},
+ {pane: GridLayout_Enum.FOOTER, ref: clientId +"_" + "GridFooterTemplate"}
+ ];
+
+ // ClientUILib.log(ClientUILogger.WARNING, "DataModel created over " + ((new Date()).getTime() - currTime) + " miliseconds.");
+ // currTime = (new Date()).getTime();
+
+ // create the Grid
+ grid = new ClientUI.controls.grid.Grid(clientId +"_" + 'GridContainer', dataModel, templates,
+ {
+ showIndexColumn: false,
+ indexColumnWidth: 40
+ }
+ );
+
+ // function onColumnResize(column, width) {call to ajax4jsf}
+ //Event.observe(grid.eventOnResizeColumn, "", onColumnResize);
+
+ // ClientUILib.log(ClientUILogger.WARNING, "Grid control created over " + ((new Date()).getTime() - currTime) + " miliseconds.");
+
+ grid.updateLayout();
+
+ setTimeout(function() {
+ currTime = (new Date()).getTime();
+ //grid.loadData();
+ }.bind(this), 100);
+
+ // ClientUILib.log(ClientUILogger.WARNING, "Done.");
+ }
+
+ }
+ }();
+
+ #{this:getScriptContributions(context, component)};
+ Event.observe(window, 'load', #{this:getJavaScriptVarName(context, component)}.init);
+
+// ]]>
+ </script>
+</f:root>
+
+
+
\ No newline at end of file
Deleted: trunk/sandbox/scrollable-grid/src/main/templates/org/richfaces/scrollable-grid2.jspx
===================================================================
--- trunk/sandbox/scrollable-grid/src/main/templates/org/richfaces/scrollable-grid2.jspx 2007-05-21 10:36:48 UTC (rev 811)
+++ trunk/sandbox/scrollable-grid/src/main/templates/org/richfaces/scrollable-grid2.jspx 2007-05-21 11:18:50 UTC (rev 812)
@@ -1,231 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<f:root
- xmlns:f="http://ajax4jsf.org/cdk/template"
- xmlns:c=" http://java.sun.com/jsf/core"
- xmlns:ui=" http://ajax4jsf.org/cdk/ui"
- xmlns:u=" http://ajax4jsf.org/cdk/u"
- xmlns:x=" http://ajax4jsf.org/cdk/x"
- xmlns:h=" http://ajax4jsf.org/cdk/headers"
- xmlns:vcp="http://ajax4jsf.org/cdk/vcp"
- class="org.richfaces.renderkit.html.ScrollableGridRenderer"
- baseclass="org.richfaces.renderkit.html.ScrollableGridBaseRenderer2"
- component="org.richfaces.component.UIScrollableGrid"
- >
-
- <h:styles>
- /org/richfaces/renderkit/html/css/grid.xcss
- </h:styles>
-
- <h:scripts>
- new org.ajax4jsf.framework.resource.PrototypeScript(),
- new org.ajax4jsf.framework.ajax.AjaxScript(),
- /org/richfaces/renderkit/html/scripts/scrollable-grid.js
- </h:scripts>
-
- <f:clientId var="clientId" />
-
- <f:call name="setUpColumnsWidth"/>
-
- <div id="#{clientId}_GridContainer" style="width: #{component.attributes['width']};height: #{component.attributes['height']};" class="ClientUI_Grid">
-
- <div id="#{clientId}_GridHeaderTemplate" class="ClientUI_InlineBox" style="width: #{component.attributes['width']};">
- <div style="display: block; left: 0px; top: 0px; width: #{sumWidth}px;">
- <span class="ClientUI_TmplBox" id="FrozenBox">
- <table cellpadding="0" cellspacing="0">
- <tbody>
- <tr class="ClientUI_Grid_HR">
- <jsp:scriptlet>
- <![CDATA[
- renderHeaders(context, component, true);
- ]]>
- </jsp:scriptlet>
- </tr>
- </tbody>
- </table>
- </span>
-
- <span class="ClientUI_TmplBox" id="NormalBox">
- <table cellpadding="0" cellspacing="0">
- <tbody>
- <tr class="ClientUI_Grid_HR">
- <jsp:scriptlet>
- <![CDATA[
- renderHeaders(context, component, false);
- ]]>
- </jsp:scriptlet>
- </tr>
- </tbody>
- </table>
- </span>
- </div>
- </div>
-
- <div id="#{clientId}_GridBodyTemplate" class="ClientUI_InlineBox" style="overflow: auto; width: #{component.attributes['width']}; height: #{component.attributes['height']};">
- <div style="display: block; width: #{sumWidth}px;">
- <span class="ClientUI_TmplBox" id="FrozenBox">
- <table cellpadding="0" cellspacing="0">
- <tbody>
- <jsp:scriptlet>
- <![CDATA[
- renderGridBody(context, component, true);
- ]]>
- </jsp:scriptlet>
- </tbody>
- </table>
- </span>
- <span class="ClientUI_TmplBox" id="NormalBox">
- <table cellpadding="0" cellspacing="0">
- <tbody>
- <jsp:scriptlet>
- <![CDATA[
- renderGridBody(context, component, false);
- ]]>
- </jsp:scriptlet>
- </tbody>
- </table>
- </span>
- </div>
- </div>
-
- <div id="#{clientId}_GridFooterTemplate" class="ClientUI_InlineBox" style="width: #{component.attributes['width']};">
- <div style="display: block; width: width: #{sumWidth}px;">
- <span class="ClientUI_TmplBox" id="FrozenBox">
- <table cellpadding="0" cellspacing="0">
- <tbody>
- <tr class="ClientUI_Grid_FR">
- <jsp:scriptlet>
- <![CDATA[
- renderFooters(context, component,true);
- ]]>
- </jsp:scriptlet>
- </tr>
- </tbody>
- </table>
- </span>
-
- <span class="ClientUI_TmplBox" id="NormalBox">
- <table cellpadding="0" cellspacing="0">
- <tbody>
- <tr class="ClientUI_Grid_FR">
- <jsp:scriptlet>
- <![CDATA[
- renderFooters(context, component,false);
- ]]>
- </jsp:scriptlet>
- </tr>
- </tbody>
- </table>
- </span>
- </div>
- </div>
-
- <input type="hidden" name="#{clientId}_state_input" id="#{clientId}_state_input"/>
- <input type="hidden" name="#{clienId}_rows_input" id="#{clientId}_rows_input" value="#{rows_count}"/>
- <input type="button" name="#{clientId}_submit_input" id="#{clientId}_submit_input" onclick="#{this:getRowsAjaxUpdate(context,component)}" style="display:none"/>
-
- </div>
-
- <f:call name="tearDownState"/>
-
- <script id="#{clientId}_model_create_scripts" type="text/javascript">
- //<![CDATA[
- ClientUI.controls.grid.FakeArrayDataModel = Class.create({
- CLASSDEF: {
- name: 'ClientUI.controls.grid.FakeArrayDataModel',
- parent: ClientUI.controls.grid.DataModel
- }
- });
-
- Object.extend(ClientUI.controls.grid.FakeArrayDataModel.prototype, {
- initialize: function(rows_count, columns_count, grid_id) {
- ClientUI.controls.grid.FakeArrayDataModel.parentClass.constructor().call(this);
- this.data = [];
- this.count = rows_count;
- this.columns = columns_count;
- this.gridId = grid_id;
- },
- getRow: function(index) {
- if(!this.data[index]) {
- this.data[index] = [];
- for (var index2 = 0; index2 < 7; index2++) {
- this.data[index][index2] = index2 + " : " + index;
- }
- this.data[index][6] = index%2 ? "value 1" : "value 2";
- }
-
- return this.data[index];
- },
- getCount: function() {
- return this.count;
- },
- getRequestDelay: function() {
- return 50;
- },
-
- loadRows: function(options) {
- var state_options = options;
- var state_input = $(this.gridId + "_state_input");
- var submit_input = $(this.gridId + "_submit_input");
- var submit_values = state_options.count + "," + state_options.index + "," + state_options.startRow;
- state_input.value = submit_values;
- submit_input.click();
- }
- });
- // ]]>
- </script>
-
- <script id="#{clientId}_grid_create_scripts" type="text/javascript">
- //<![CDATA[
-
-
- var #{this:getJavaScriptVarName(context, component)} = function() {
- return {
- init : function() {
- var currTime = (new Date()).getTime();
- // ClientUILib.log(ClientUILogger.WARNING, "Document loaded over " + (currTime - ClientUILib.startTime) + " miliseconds.");
- var clientId = '#{clientId}';
- var rows_count = $(clientId + "_rows_input").value;
- var columns_count = '#{columns_count}';
-
- dataModel = new ClientUI.controls.grid.FakeArrayDataModel(rows_count, columns_count, clientId);
-
- var templates = [
- {pane: GridLayout_Enum.HEADER, ref: clientId +"_" + "GridHeaderTemplate"},
- {pane: GridLayout_Enum.BODY, ref: clientId +"_" + "GridBodyTemplate"},
- {pane: GridLayout_Enum.FOOTER, ref: clientId +"_" + "GridFooterTemplate"}
- ];
-
- // ClientUILib.log(ClientUILogger.WARNING, "DataModel created over " + ((new Date()).getTime() - currTime) + " miliseconds.");
- // currTime = (new Date()).getTime();
-
- // create the Grid
- grid = new ClientUI.controls.grid.Grid(clientId +"_" + 'GridContainer', dataModel, templates,
- {
- showIndexColumn: false,
- indexColumnWidth: 40
- }
- );
- // ClientUILib.log(ClientUILogger.WARNING, "Grid control created over " + ((new Date()).getTime() - currTime) + " miliseconds.");
-
- grid.updateLayout();
-
- setTimeout(function() {
- currTime = (new Date()).getTime();
- //grid.loadData();
- }.bind(this), 100);
-
- // ClientUILib.log(ClientUILogger.WARNING, "Done.");
- }
-
- }
- }();
-
- #{this:getScriptContributions(context, component)};
- Event.observe(window, 'load', #{this:getJavaScriptVarName(context, component)}.init);
-
-// ]]>
- </script>
-</f:root>
-
-
-
\ No newline at end of file
17 years, 7 months
JBoss Rich Faces SVN: r811 - trunk/richfaces/datascroller/src/main/config/component.
by richfaces-svn-commits@lists.jboss.org
Author: A.Skokov
Date: 2007-05-21 06:36:48 -0400 (Mon, 21 May 2007)
New Revision: 811
Modified:
trunk/richfaces/datascroller/src/main/config/component/datascroller.xml
Log:
http://jira.jboss.com/jira/browse/RF-151
Modified: trunk/richfaces/datascroller/src/main/config/component/datascroller.xml
===================================================================
--- trunk/richfaces/datascroller/src/main/config/component/datascroller.xml 2007-05-21 09:01:09 UTC (rev 810)
+++ trunk/richfaces/datascroller/src/main/config/component/datascroller.xml 2007-05-21 10:36:48 UTC (rev 811)
@@ -259,6 +259,11 @@
<name>firstRow</name>
<classname>java.lang.String</classname>
</property>
+
+ <property hidden="true">
+ <name>page</name>
+ <classname>java.lang.String</classname>
+ </property>
</component>
&listeners;
17 years, 7 months
JBoss Rich Faces SVN: r810 - trunk/richfaces/simpleTogglePanel/src/main/java/org/richfaces/renderkit/html.
by richfaces-svn-commits@lists.jboss.org
Author: a.izobov
Date: 2007-05-21 05:01:09 -0400 (Mon, 21 May 2007)
New Revision: 810
Modified:
trunk/richfaces/simpleTogglePanel/src/main/java/org/richfaces/renderkit/html/SimpleTogglePanelRenderer.java
Log:
RF-212 fixed
Modified: trunk/richfaces/simpleTogglePanel/src/main/java/org/richfaces/renderkit/html/SimpleTogglePanelRenderer.java
===================================================================
--- trunk/richfaces/simpleTogglePanel/src/main/java/org/richfaces/renderkit/html/SimpleTogglePanelRenderer.java 2007-05-18 17:07:11 UTC (rev 809)
+++ trunk/richfaces/simpleTogglePanel/src/main/java/org/richfaces/renderkit/html/SimpleTogglePanelRenderer.java 2007-05-21 09:01:09 UTC (rev 810)
@@ -102,16 +102,15 @@
panel.setOpened(new Boolean((String) clnId).booleanValue());
}
+ if (AjaxRendererUtils.isAjaxRequest(context) && panel.getSwitchType().equals(UISimpleTogglePanel.AJAX_SWITCH_TYPE)) {
+ AjaxRendererUtils.addRegionByName(context,
+ panel,
+ panel.getId());
+ }
-
}
- if (AjaxRendererUtils.isAjaxRequest(context) && panel.getSwitchType().equals(UISimpleTogglePanel.AJAX_SWITCH_TYPE)) {
- AjaxRendererUtils.addRegionByName(context,
- panel,
- panel.getId());
- }
}
17 years, 7 months
JBoss Rich Faces SVN: r809 - in trunk/richfaces/panelmenu/src/main: java/org/richfaces/renderkit/gradientImages and 1 other directories.
by richfaces-svn-commits@lists.jboss.org
Author: sergeyhalipov
Date: 2007-05-18 13:07:11 -0400 (Fri, 18 May 2007)
New Revision: 809
Added:
trunk/richfaces/panelmenu/src/main/java/org/richfaces/renderkit/gradientImages/
trunk/richfaces/panelmenu/src/main/java/org/richfaces/renderkit/gradientImages/PanelMenuGroupGradient.java
trunk/richfaces/panelmenu/src/main/java/org/richfaces/renderkit/gradientImages/PanelMenuItemGradient.java
Modified:
trunk/richfaces/panelmenu/src/main/java/org/richfaces/renderkit/PanelMenuGroupRenderer.java
trunk/richfaces/panelmenu/src/main/resources/org/richfaces/renderkit/html/css/panelMenu.xcss
Log:
Panel menu: gradient backgrounds added.
Modified: trunk/richfaces/panelmenu/src/main/java/org/richfaces/renderkit/PanelMenuGroupRenderer.java
===================================================================
--- trunk/richfaces/panelmenu/src/main/java/org/richfaces/renderkit/PanelMenuGroupRenderer.java 2007-05-18 15:00:20 UTC (rev 808)
+++ trunk/richfaces/panelmenu/src/main/java/org/richfaces/renderkit/PanelMenuGroupRenderer.java 2007-05-18 17:07:11 UTC (rev 809)
@@ -46,9 +46,9 @@
Object property = requestMap.get("panelMenuState"+clientId);
if (property.equals("opened")) {
- component.getAttributes().put("expanded", "true");
+ ((UIPanelMenuGroup)component).setExpanded(true);
} else if (property.equals("closed")) {
- component.getAttributes().put("expanded", "false");
+ ((UIPanelMenuGroup)component).setExpanded(false);
}
}
Added: trunk/richfaces/panelmenu/src/main/java/org/richfaces/renderkit/gradientImages/PanelMenuGroupGradient.java
===================================================================
--- trunk/richfaces/panelmenu/src/main/java/org/richfaces/renderkit/gradientImages/PanelMenuGroupGradient.java (rev 0)
+++ trunk/richfaces/panelmenu/src/main/java/org/richfaces/renderkit/gradientImages/PanelMenuGroupGradient.java 2007-05-18 17:07:11 UTC (rev 809)
@@ -0,0 +1,32 @@
+/**
+ * License Agreement.
+ *
+ * JBoss RichFaces 3.0 - Ajax4jsf Component Library
+ *
+ * Copyright (C) 2007 Exadel, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1 as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+package org.richfaces.renderkit.gradientImages;
+
+import org.ajax4jsf.framework.skin.Skin;
+import org.richfaces.renderkit.html.BaseGradient;
+
+public class PanelMenuGroupGradient extends BaseGradient {
+ public PanelMenuGroupGradient() {
+ super(10, 40, 14, "headerGradientColor", Skin.headerBackgroundColor);
+ }
+
+}
Added: trunk/richfaces/panelmenu/src/main/java/org/richfaces/renderkit/gradientImages/PanelMenuItemGradient.java
===================================================================
--- trunk/richfaces/panelmenu/src/main/java/org/richfaces/renderkit/gradientImages/PanelMenuItemGradient.java (rev 0)
+++ trunk/richfaces/panelmenu/src/main/java/org/richfaces/renderkit/gradientImages/PanelMenuItemGradient.java 2007-05-18 17:07:11 UTC (rev 809)
@@ -0,0 +1,31 @@
+/**
+ * License Agreement.
+ *
+ * JBoss RichFaces 3.0 - Ajax4jsf Component Library
+ *
+ * Copyright (C) 2007 Exadel, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1 as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+package org.richfaces.renderkit.gradientImages;
+
+import org.ajax4jsf.framework.skin.Skin;
+import org.richfaces.renderkit.html.BaseGradient;
+
+public class PanelMenuItemGradient extends BaseGradient {
+ public PanelMenuItemGradient() {
+ super(10, 40, 14, "controlBackgroundColor", Skin.generalBackgroundColor);
+ }
+}
Modified: trunk/richfaces/panelmenu/src/main/resources/org/richfaces/renderkit/html/css/panelMenu.xcss
===================================================================
--- trunk/richfaces/panelmenu/src/main/resources/org/richfaces/renderkit/html/css/panelMenu.xcss 2007-05-18 15:00:20 UTC (rev 808)
+++ trunk/richfaces/panelmenu/src/main/resources/org/richfaces/renderkit/html/css/panelMenu.xcss 2007-05-18 17:07:11 UTC (rev 809)
@@ -7,11 +7,16 @@
<f:verbatim>
.dr-pmenu-group {
height: 20px;
+ background-repeat: repeat-x;
+ background-position: left top;
}
.dr-pmenu-item {
height: 20px;
+ background-repeat: repeat-x;
+ background-position: left top;
}
+
</f:verbatim>
<u:selector name=".dr-pmenu-group">
@@ -28,6 +33,9 @@
<u:style name="border-top-style" value="solid"/>
<u:style name="border-color" skin="panelBorderColor"/>
<u:style name="background-color" skin="headerBackgroundColor"/>
+ <u:style name="background-image" >
+ <f:resource f:key="org.richfaces.renderkit.gradientImages.PanelMenuGroupGradient" />
+ </u:style>
</u:selector>
<u:selector name=".dr-pmenu-item">
@@ -43,5 +51,20 @@
<u:style name="border-style" value="none"/>
<u:style name="border-top-style" value="solid"/>
<u:style name="border-color" skin="subBorderColor"/>
+ <u:style name="background-image" >
+ <f:resource f:key="org.richfaces.renderkit.gradientImages.PanelMenuItemGradient" />
+ </u:style>
</u:selector>
+
+ <u:selector name=".dr-pmenu-group-tr">
+ <u:style name="background-image" >
+ <f:resource f:key="org.richfaces.renderkit.gradientImages.PanelMenuGroupGradient" />
+ </u:style>
+ </u:selector>
+
+ <u:selector name=".dr-pmenu-item-tr">
+ <u:style name="background-image" >
+ <f:resource f:key="org.richfaces.renderkit.gradientImages.PanelMenuItemGradient" />
+ </u:style>
+ </u:selector>
</f:template>
\ No newline at end of file
17 years, 8 months
JBoss Rich Faces SVN: r808 - trunk/richfaces/panelmenu/src/main/java/org/richfaces/renderkit.
by richfaces-svn-commits@lists.jboss.org
Author: dbiatenia
Date: 2007-05-18 11:00:20 -0400 (Fri, 18 May 2007)
New Revision: 808
Modified:
trunk/richfaces/panelmenu/src/main/java/org/richfaces/renderkit/PanelMenuItemRenderer.java
trunk/richfaces/panelmenu/src/main/java/org/richfaces/renderkit/PanelMenuRendererBase.java
Log:
Modified: trunk/richfaces/panelmenu/src/main/java/org/richfaces/renderkit/PanelMenuItemRenderer.java
===================================================================
--- trunk/richfaces/panelmenu/src/main/java/org/richfaces/renderkit/PanelMenuItemRenderer.java 2007-05-18 14:58:11 UTC (rev 807)
+++ trunk/richfaces/panelmenu/src/main/java/org/richfaces/renderkit/PanelMenuItemRenderer.java 2007-05-18 15:00:20 UTC (rev 808)
@@ -157,7 +157,7 @@
return styleBuffer.toString();
}
- @Override
+
public String getHideStyle(FacesContext context, UIComponent component) {
// TODO Auto-generated method stub
if (!(component.getParent() instanceof UIPanelMenu)) {
Modified: trunk/richfaces/panelmenu/src/main/java/org/richfaces/renderkit/PanelMenuRendererBase.java
===================================================================
--- trunk/richfaces/panelmenu/src/main/java/org/richfaces/renderkit/PanelMenuRendererBase.java 2007-05-18 14:58:11 UTC (rev 807)
+++ trunk/richfaces/panelmenu/src/main/java/org/richfaces/renderkit/PanelMenuRendererBase.java 2007-05-18 15:00:20 UTC (rev 808)
@@ -22,6 +22,7 @@
package org.richfaces.renderkit;
import java.io.IOException;
+import java.util.Iterator;
import java.util.Map;
import javax.faces.component.UICommand;
@@ -176,12 +177,14 @@
public boolean isChildrenExpanded(UIComponent component){
if (component.getChildren() != null){
- for(Object child : component.getChildren()){
+ Iterator itr = component.getChildren().iterator();
+ while(itr.hasNext()){
+ UIComponent child = (UIComponent)itr.next();
if(child instanceof UIPanelMenuGroup){
if( ((UIPanelMenuGroup)child).isExpanded() ){
return true;
} else {
- return isChildrenExpanded((UIComponent)child);
+ return isChildrenExpanded(child);
}
}
}
17 years, 8 months