Author: konstantin.mishin
Date: 2008-01-16 10:35:03 -0500 (Wed, 16 Jan 2008)
New Revision: 5428
Added:
branches/3.1.x/ui/scrollableDataTable/src/main/javascript/ClientUI/common/box/SplashBox.js
Removed:
branches/3.1.x/ui/scrollableDataTable/src/main/java/org/richfaces/event/sort/AbstractSortListener.java
Modified:
branches/3.1.x/ui/scrollableDataTable/generatescript.xml
branches/3.1.x/ui/scrollableDataTable/pom.xml
branches/3.1.x/ui/scrollableDataTable/src/main/config/component/scrollable-data-table.xml
branches/3.1.x/ui/scrollableDataTable/src/main/java/org/richfaces/component/UIScrollableDataTable.java
branches/3.1.x/ui/scrollableDataTable/src/main/java/org/richfaces/convert/selection/ClientSelectionConverter.java
branches/3.1.x/ui/scrollableDataTable/src/main/java/org/richfaces/event/sort/MultiColumnSortListener.java
branches/3.1.x/ui/scrollableDataTable/src/main/java/org/richfaces/event/sort/SingleColumnSortListener.java
branches/3.1.x/ui/scrollableDataTable/src/main/java/org/richfaces/model/internal/ComponentSortableDataModel.java
branches/3.1.x/ui/scrollableDataTable/src/main/java/org/richfaces/model/selection/ClientSelection.java
branches/3.1.x/ui/scrollableDataTable/src/main/java/org/richfaces/renderkit/html/ScrollableDataTableBaseRenderer.java
branches/3.1.x/ui/scrollableDataTable/src/main/java/org/richfaces/renderkit/html/ScrollableDataTableRendererState.java
branches/3.1.x/ui/scrollableDataTable/src/main/java/org/richfaces/renderkit/html/SelectionRendererContributor.java
branches/3.1.x/ui/scrollableDataTable/src/main/javascript/ClientUI/common/box/Box.js
branches/3.1.x/ui/scrollableDataTable/src/main/javascript/ClientUI/common/box/ScrollableBox.js
branches/3.1.x/ui/scrollableDataTable/src/main/javascript/ClientUI/common/box/Substrate.js
branches/3.1.x/ui/scrollableDataTable/src/main/javascript/ClientUI/common/utils/Utils.js
branches/3.1.x/ui/scrollableDataTable/src/main/javascript/ClientUI/controls/grid/DataModel.js
branches/3.1.x/ui/scrollableDataTable/src/main/javascript/ClientUI/controls/grid/Grid.js
branches/3.1.x/ui/scrollableDataTable/src/main/javascript/ClientUI/controls/grid/GridBody.js
branches/3.1.x/ui/scrollableDataTable/src/main/javascript/ClientUI/controls/grid/GridFooter.js
branches/3.1.x/ui/scrollableDataTable/src/main/javascript/ClientUI/controls/grid/GridHeader.js
branches/3.1.x/ui/scrollableDataTable/src/main/javascript/ClientUI/controls/grid/ScrollableGrid.js
branches/3.1.x/ui/scrollableDataTable/src/main/javascript/ClientUI/controls/grid/Selection.js
branches/3.1.x/ui/scrollableDataTable/src/main/javascript/ClientUI/layouts/GridLayoutManager.js
branches/3.1.x/ui/scrollableDataTable/src/main/javascript/ClientUI/layouts/LayoutManager.js
branches/3.1.x/ui/scrollableDataTable/src/main/javascript/ClientUI/layouts/VLayoutManager.js
branches/3.1.x/ui/scrollableDataTable/src/main/resources/org/richfaces/renderkit/html/css/scrollable-data-table.xcss
branches/3.1.x/ui/scrollableDataTable/src/main/templates/org/richfaces/scrollable-data-table-footer-cell.jspx
branches/3.1.x/ui/scrollableDataTable/src/main/templates/org/richfaces/scrollable-data-table.jspx
branches/3.1.x/ui/scrollableDataTable/src/test/java/org/richfaces/renderkit/html/ScrollableDataTableRendererStateTest.java
branches/3.1.x/ui/scrollableDataTable/src/test/java/org/richfaces/renderkit/html/ScrollableDataTableRendererTest.java
Log:
RF-1921
Modified: branches/3.1.x/ui/scrollableDataTable/generatescript.xml
===================================================================
--- branches/3.1.x/ui/scrollableDataTable/generatescript.xml 2008-01-16 15:23:05 UTC (rev
5427)
+++ branches/3.1.x/ui/scrollableDataTable/generatescript.xml 2008-01-16 15:35:03 UTC (rev
5428)
@@ -27,6 +27,7 @@
<file
name="${resources-dir}/ClientUI/common/utils/Validators.js"/>
<file name="${resources-dir}/ClientUI/common/box/Box.js"/>
<file name="${resources-dir}/ClientUI/common/box/InlineBox.js"/>
+ <file
name="${resources-dir}/ClientUI/common/utils/CustomEvent.js"/>
<file
name="${resources-dir}/ClientUI/common/box/ScrollableBox.js"/>
<file
name="${resources-dir}/ClientUI/controls/grid/DataModel.js"/>
<file
name="${resources-dir}/ClientUI/controls/grid/ArrayDataModel.js"/>
@@ -36,6 +37,7 @@
<file name="${resources-dir}/ClientUI/layouts/VLayoutManager.js"/>
<file
name="${resources-dir}/ClientUI/layouts/GridLayoutManager.js"/>
<file
name="${resources-dir}/ClientUI/controls/grid/GridHeader.js"/>
+ <file name="${resources-dir}/ClientUI/common/box/SplashBox.js"/>
<file name="${resources-dir}/ClientUI/controls/grid/DataCash.js"/>
<file name="${resources-dir}/ClientUI/controls/grid/GridBody.js"/>
<file
name="${resources-dir}/ClientUI/controls/grid/GridFooter.js"/>
@@ -59,6 +61,7 @@
<file name="/ClientUI/common/utils/Validators.js"/>
<file name="/ClientUI/common/box/Box.js"/>
<file name="/ClientUI/common/box/InlineBox.js"/>
+ <file name="/ClientUI/common/utils/CustomEvent.js"/>
<file name="/ClientUI/common/box/ScrollableBox.js"/>
<file name="/ClientUI/controls/grid/DataModel.js"/>
<file name="/ClientUI/controls/grid/ArrayDataModel.js"/>
@@ -68,6 +71,7 @@
<file name="/ClientUI/layouts/VLayoutManager.js"/>
<file name="/ClientUI/layouts/GridLayoutManager.js"/>
<file name="/ClientUI/controls/grid/GridHeader.js"/>
+ <file name="/ClientUI/common/box/SplashBox.js"/>
<file name="/ClientUI/controls/grid/DataCash.js"/>
<file name="/ClientUI/controls/grid/GridBody.js"/>
<file name="/ClientUI/controls/grid/GridFooter.js"/>
Modified: branches/3.1.x/ui/scrollableDataTable/pom.xml
===================================================================
--- branches/3.1.x/ui/scrollableDataTable/pom.xml 2008-01-16 15:23:05 UTC (rev 5427)
+++ branches/3.1.x/ui/scrollableDataTable/pom.xml 2008-01-16 15:35:03 UTC (rev 5428)
@@ -2,19 +2,19 @@
<parent>
<artifactId>ui</artifactId>
<groupId>org.richfaces</groupId>
- <version>3.1.4-SNAPSHOT</version>
+ <version>3.1.3-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<groupId>org.richfaces.ui</groupId>
<artifactId>scrollableDataTable</artifactId>
- <version>3.1.4-SNAPSHOT</version>
+ <version>3.1.3-SNAPSHOT</version>
<name>Scrollable Data Table</name>
<build>
<plugins>
<plugin>
<groupId>org.richfaces.cdk</groupId>
<artifactId>maven-cdk-plugin</artifactId>
- <version>3.1.4-SNAPSHOT</version>
+ <version>3.1.3-SNAPSHOT</version>
<executions>
<execution>
<phase>generate-sources</phase>
@@ -71,12 +71,12 @@
<dependency>
<groupId>org.richfaces.framework</groupId>
<artifactId>richfaces-impl</artifactId>
- <version>3.1.4-SNAPSHOT</version>
+ <version>3.1.3-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>org.richfaces.ui</groupId>
<artifactId>dataTable</artifactId>
- <version>3.1.4-SNAPSHOT</version>
+ <version>3.1.3-SNAPSHOT</version>
<scope>test</scope>
</dependency>
</dependencies>
Modified:
branches/3.1.x/ui/scrollableDataTable/src/main/config/component/scrollable-data-table.xml
===================================================================
---
branches/3.1.x/ui/scrollableDataTable/src/main/config/component/scrollable-data-table.xml 2008-01-16
15:23:05 UTC (rev 5427)
+++
branches/3.1.x/ui/scrollableDataTable/src/main/config/component/scrollable-data-table.xml 2008-01-16
15:35:03 UTC (rev 5428)
@@ -60,7 +60,7 @@
<property>
<name>componentState</name>
- <classname>org.ajax4jsf.model.DataComponentState</classname>
+ <classname>java.lang.String</classname>
<description>It defines EL-binding for a component state for saving or
redefinition</description>
</property>
@@ -185,7 +185,7 @@
<property>
<name>rowKey</name>
- <classname>java.lang.Object</classname>
+ <classname>java.lang.String</classname>
<description>The attribute is a representation of an identifier for a specific
data row</description>
</property>
@@ -234,7 +234,7 @@
<property>
<name>ajaxKeys</name>
- <classname>java.util.Set</classname>
+ <classname>java.lang.String</classname>
<description>This attribute defines rows that are updated after an AJAX
request</description>
</property>
Modified:
branches/3.1.x/ui/scrollableDataTable/src/main/java/org/richfaces/component/UIScrollableDataTable.java
===================================================================
---
branches/3.1.x/ui/scrollableDataTable/src/main/java/org/richfaces/component/UIScrollableDataTable.java 2008-01-16
15:23:05 UTC (rev 5427)
+++
branches/3.1.x/ui/scrollableDataTable/src/main/java/org/richfaces/component/UIScrollableDataTable.java 2008-01-16
15:35:03 UTC (rev 5428)
@@ -93,13 +93,12 @@
int curentRow = getFirst();
- int rows;
if(reqRowsCount == -1 ){
- rows = getRows();
- } else {
- rows = reqRowsCount;
+ reqRowsCount = getRows();
}
-
+
+ int rows = reqRowsCount;
+
int rowsCount = getExtendedDataModel().getRowCount();
if(rows > 0){
@@ -130,7 +129,6 @@
if (log.isTraceEnabled()) {
log.trace("UIScrollableDataTable.processDecodes(faces)");
}
- checkRange();
super.processDecodes(faces);
}
@@ -160,7 +158,6 @@
}
useSavedRanges = false;
- checkRange();
super.encodeBegin(context);
}
@@ -373,8 +370,6 @@
public abstract String getSortMode();
public abstract void setSortMode(String mode);
- public abstract Object getActiveRowKey();
- public abstract void setActiveRowKey(Object activeRowKey);
/* (non-Javadoc)
* @see org.ajax4jsf.component.UIDataAdaptor#setRowIndex(int)
@@ -385,16 +380,4 @@
}
//super.setRowIndex(index);
}
-
- public void resetReqRowsCount() {
- this.reqRowsCount = -1;
- }
-
- private void checkRange() {
- int rows = getRows();
- if (getRowCount() < getFirst() + rows) {
- setFirst(0);
- setScrollPos("0,0," + rows);
- }
- }
}
Modified:
branches/3.1.x/ui/scrollableDataTable/src/main/java/org/richfaces/convert/selection/ClientSelectionConverter.java
===================================================================
---
branches/3.1.x/ui/scrollableDataTable/src/main/java/org/richfaces/convert/selection/ClientSelectionConverter.java 2008-01-16
15:23:05 UTC (rev 5427)
+++
branches/3.1.x/ui/scrollableDataTable/src/main/java/org/richfaces/convert/selection/ClientSelectionConverter.java 2008-01-16
15:35:03 UTC (rev 5428)
@@ -62,18 +62,13 @@
}
final ClientSelection clientSelection = new ClientSelection();
- if(stringSelection == null || stringSelection.length() == 0) {
- return clientSelection;
- }
String [] selections = stringSelection.split(";");
int length = selections.length;
- if (selections[length-1].charAt(0) > '9') {
+ if (selections[length-1].length() == 1) {
clientSelection.setSelectionFlag(selections[length-1]);
length--;
}
- clientSelection.setActiveRowIndex(Integer.parseInt(selections[length-1]));
- length--;
for (int i = 0; i < length; i++) {
String range = selections[i];
Deleted:
branches/3.1.x/ui/scrollableDataTable/src/main/java/org/richfaces/event/sort/AbstractSortListener.java
===================================================================
---
branches/3.1.x/ui/scrollableDataTable/src/main/java/org/richfaces/event/sort/AbstractSortListener.java 2008-01-16
15:23:05 UTC (rev 5427)
+++
branches/3.1.x/ui/scrollableDataTable/src/main/java/org/richfaces/event/sort/AbstractSortListener.java 2008-01-16
15:35:03 UTC (rev 5428)
@@ -1,46 +0,0 @@
-/**
- * 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.event.sort;
-
-/**
- * @author Maksim Kaszynski
- *
- */
-public abstract class AbstractSortListener implements SortListener {
-
- /**
- * Encapsulate sorting toggle here
- * @param current
- * @param suggested
- * @return
- */
- protected Boolean nextSortOrder(Boolean current, Boolean suggested) {
-
- if (suggested != null) {
- return suggested;
- } else {
- return (current == null) ? Boolean.TRUE : (current.booleanValue() ? Boolean.FALSE :
Boolean.TRUE);
- }
-
- }
-
-}
Modified:
branches/3.1.x/ui/scrollableDataTable/src/main/java/org/richfaces/event/sort/MultiColumnSortListener.java
===================================================================
---
branches/3.1.x/ui/scrollableDataTable/src/main/java/org/richfaces/event/sort/MultiColumnSortListener.java 2008-01-16
15:23:05 UTC (rev 5427)
+++
branches/3.1.x/ui/scrollableDataTable/src/main/java/org/richfaces/event/sort/MultiColumnSortListener.java 2008-01-16
15:35:03 UTC (rev 5428)
@@ -21,7 +21,7 @@
* @author Maksim Kaszynski
*
*/
-public class MultiColumnSortListener extends AbstractSortListener {
+public class MultiColumnSortListener implements SortListener {
public static final MultiColumnSortListener INSTANCE = new MultiColumnSortListener();
@@ -51,13 +51,11 @@
}
- Boolean suggested = e.getSuggestedOrder();
-
SortField[] fields = sortOrder.getFields();
if (fields == null) {
//If no sorting was applied at all, set sorting to current
- fields = new SortField[] {new SortField(name, columnIndex, nextSortOrder(null,
suggested))};
+ fields = new SortField[] {new SortField(name, columnIndex, Boolean.TRUE)};
} else {
List newFields = new LinkedList(Arrays.asList(fields));
@@ -71,16 +69,16 @@
name.equals(sortField.getName()))) {
Boolean asc = sortField.getAscending();
+ asc = Boolean.TRUE.equals(asc) ? Boolean.FALSE : Boolean.TRUE;
- newField = new SortField(name, columnIndex, nextSortOrder(asc, suggested));
+ newField = new SortField(name, columnIndex, asc);
iterator.remove();
}
}
if (newField == null) {
-
- newField = new SortField(name, columnIndex, nextSortOrder(null, suggested));
+ newField = new SortField(name, columnIndex, Boolean.TRUE);
}
newFields.add(newField);
Modified:
branches/3.1.x/ui/scrollableDataTable/src/main/java/org/richfaces/event/sort/SingleColumnSortListener.java
===================================================================
---
branches/3.1.x/ui/scrollableDataTable/src/main/java/org/richfaces/event/sort/SingleColumnSortListener.java 2008-01-16
15:23:05 UTC (rev 5427)
+++
branches/3.1.x/ui/scrollableDataTable/src/main/java/org/richfaces/event/sort/SingleColumnSortListener.java 2008-01-16
15:35:03 UTC (rev 5428)
@@ -15,7 +15,7 @@
* @author Maksim Kaszynski
*
*/
-public class SingleColumnSortListener extends AbstractSortListener {
+public class SingleColumnSortListener implements SortListener {
public static final SingleColumnSortListener INSTANCE = new SingleColumnSortListener();
@@ -46,7 +46,7 @@
SortField[] fields = sortOrder.getFields();
- SortField newField = new SortField(name, columnIndex, nextSortOrder(null,
e.getSuggestedOrder()));
+ SortField newField = new SortField(name, columnIndex, Boolean.TRUE);
if (fields != null) {
for (int i = 0; i < fields.length; i++) {
@@ -56,7 +56,8 @@
name != null &&
name.equals(sortField.getName()))) {
- Boolean asc = nextSortOrder(sortField.getAscending(), e.getSuggestedOrder()) ;
+ Boolean asc = sortField.getAscending();
+ asc = Boolean.TRUE.equals(asc) ? Boolean.FALSE : Boolean.TRUE;
newField = new SortField(name, columnIndex, asc);
break;
Modified:
branches/3.1.x/ui/scrollableDataTable/src/main/java/org/richfaces/model/internal/ComponentSortableDataModel.java
===================================================================
---
branches/3.1.x/ui/scrollableDataTable/src/main/java/org/richfaces/model/internal/ComponentSortableDataModel.java 2008-01-16
15:23:05 UTC (rev 5427)
+++
branches/3.1.x/ui/scrollableDataTable/src/main/java/org/richfaces/model/internal/ComponentSortableDataModel.java 2008-01-16
15:35:03 UTC (rev 5428)
@@ -27,7 +27,6 @@
import java.util.List;
import javax.faces.context.FacesContext;
-import javax.faces.model.DataModel;
import org.richfaces.model.ScrollableTableDataModel;
import org.richfaces.model.SortField;
@@ -66,7 +65,6 @@
private List wrappedList;
- DataModel model;
private String var;
public ComponentSortableDataModel(String var, Object value) {
@@ -78,7 +76,12 @@
* @see org.richfaces.model.ScrollableTableDataModel#loadData(int, int,
org.richfaces.model.SortOrder)
*/
public List loadData(int startRow, int endRow, SortOrder sortOrder) {
- List list = null;
+
+
+ List sortedCollection = sortOrder != null ?
+ prepareCollection(FacesContext.getCurrentInstance(), new ArrayList(wrappedList),
sortOrder) : wrappedList;
+
+
int rc = getRowCount();
if (startRow < 0) {
startRow = 0;
@@ -87,51 +90,24 @@
if (endRow > rc) {
endRow = rc;
}
- if (sortOrder == null) {
- if(model != null) {
- list = new ArrayList(rc);
- for (int i = startRow; i < endRow; i++) {
- model.setRowIndex(i);
- list.add(model.getRowData());
- }
- } else {
- list = wrappedList.subList(startRow, endRow);
- }
- } else {
- if(model != null) {
- list = new ArrayList(rc);
- for (int i = 0; i < rc; i++) {
- model.setRowIndex(i);
- list.add(model.getRowData());
- }
- } else {
- list = new ArrayList(wrappedList);
- }
- list = prepareCollection(FacesContext.getCurrentInstance(), list,
sortOrder).subList(startRow, endRow);
- }
- return list;
+
+ return sortedCollection.subList(startRow, endRow);
}
/* (non-Javadoc)
* @see javax.faces.model.DataModel#getRowCount()
*/
public int getRowCount() {
- if (model != null) {
- return model.getRowCount();
- } else {
- return wrappedList.size();
- }
+ // TODO Auto-generated method stub
+ return wrappedList.size();
}
/* (non-Javadoc)
* @see javax.faces.model.DataModel#getWrappedData()
*/
public Object getWrappedData() {
- if (model != null) {
- return model;
- } else {
- return wrappedList;
- }
+ // TODO Auto-generated method stub
+ return wrappedList;
}
/* (non-Javadoc)
@@ -156,8 +132,6 @@
wrappedList = new ArrayList((Collection) value);
- } else if (value instanceof DataModel) {
- model = (DataModel)value;
} else {
wrappedList = new ArrayList(1);
wrappedList.add(value);
Modified:
branches/3.1.x/ui/scrollableDataTable/src/main/java/org/richfaces/model/selection/ClientSelection.java
===================================================================
---
branches/3.1.x/ui/scrollableDataTable/src/main/java/org/richfaces/model/selection/ClientSelection.java 2008-01-16
15:23:05 UTC (rev 5427)
+++
branches/3.1.x/ui/scrollableDataTable/src/main/java/org/richfaces/model/selection/ClientSelection.java 2008-01-16
15:35:03 UTC (rev 5428)
@@ -24,8 +24,6 @@
private String selectionFlag;
- private int activeRowIndex = -1;
-
private List ranges = new ArrayList();
public ClientSelection() {
@@ -59,8 +57,8 @@
int s = ranges.size();
int insertPosition = 0;
- int i;
- for(i = 0; i < s && insertPosition >= 0 ; i++) {
+
+ for(int i = 0; i < s && insertPosition >= 0 ; i++) {
firstRange = (SelectionRange) ranges.get(i);
@@ -88,8 +86,6 @@
} else if (firstRange.getStartIndex() > j) {
insertPosition = i;
- } else if (insertPosition == 0 && i == s - 1) {
- insertPosition = s;
}
}
@@ -132,14 +128,4 @@
reset = true;
}
}
-
-
- public int getActiveRowIndex() {
- return activeRowIndex;
- }
-
-
- public void setActiveRowIndex(int activeRowIndex) {
- this.activeRowIndex = activeRowIndex;
- }
}
Modified:
branches/3.1.x/ui/scrollableDataTable/src/main/java/org/richfaces/renderkit/html/ScrollableDataTableBaseRenderer.java
===================================================================
---
branches/3.1.x/ui/scrollableDataTable/src/main/java/org/richfaces/renderkit/html/ScrollableDataTableBaseRenderer.java 2008-01-16
15:23:05 UTC (rev 5427)
+++
branches/3.1.x/ui/scrollableDataTable/src/main/java/org/richfaces/renderkit/html/ScrollableDataTableBaseRenderer.java 2008-01-16
15:35:03 UTC (rev 5428)
@@ -41,18 +41,18 @@
public abstract class ScrollableDataTableBaseRenderer extends CompositeRenderer {
- public static final String PARTIAL_UPDATE = "partialUpdate";
- public static final String UPDATE_HEADER = "updateHeader";
+ public final String PARTIAL_UPDATE= "partialUpdate";
+ public final String UPDATE_HEADER = "updateHeader";
- public static final String FOOTER_PART = "footer";
+ public final String FOOTER_PART = "footer";
- public static final String HEADER_PART = "header";
+ public final String HEADER_PART = "header";
- private static final String COLUMN_FROZEN_TYPE = "frozen";
+ private final String COLUMN_FROZEN_TYPE = "frozen";
- private static final String COLUMN_NORMAL_TYPE = "normal";
+ private final String COLUMN_NORMAL_TYPE = "normal";
- private static final String PERSENTAGE_SUPPORT_ERROR_MSG = "columnsWidth property:
Percentage values are not supported";
+ private final String PERSENTAGE_SUPPORT_ERROR_MSG = "columnsWidth property:
Percentage values are not supported";
private RendererBase cellTemplate = null;
@@ -72,7 +72,7 @@
int width = 0;
- String widthPx = getColumnWidth(column);
+ String widthPx = (String)column.getAttributes().get("width");
widthPx = getFormattedWidth(widthPx);
prevWidth = state.getSumWidth();
width = prevWidth + Integer.parseInt(widthPx);
@@ -86,7 +86,7 @@
public void renderContent(FacesContext context, UIComponent column, ResponseWriter
writer, ScrollableDataTableRendererState state) throws IOException {
writer.startElement("col", column);
- getUtils().writeAttribute(writer, "width", getColumnWidth(column));
+ getUtils().writeAttribute(writer, "width",
column.getAttributes().get("width"));
getUtils().writeAttribute(writer, "style",
column.getAttributes().get("style"));
//int cell_index = state.getCellIndex();
//Object columnClass = state.getColumnClass(cell_index);
@@ -108,7 +108,7 @@
ComponentVariables variables =
ComponentsVariableResolver.getVariables(headerCellTemplate, column);
- String widthPx = getColumnWidth(column);
+ String widthPx = (String)column.getAttributes().get("width");
widthPx = getFormattedWidth(widthPx);
int width = Integer.parseInt(widthPx);
@@ -280,7 +280,7 @@
writer.startElement(HTML.TR_ELEMENT, grid);
state.setFrozenColumnCount(ScrollableDataTableUtils.getFrozenColumnsCount(grid));
getUtils().writeAttribute(writer, "id",row_id);
- getUtils().writeAttribute(writer, "class","dr-sdt-rb rich-sdt-row
" + state.getRowClass());
+ getUtils().writeAttribute(writer, "class","dr-sdt-rb rich-sdt-row
" + state.getRowClass(index));
addRowJavascriptEvents(writer, grid);
if (log.isDebugEnabled()) {
log.debug("rowIndex : " + index);
@@ -289,10 +289,7 @@
ColumnWalker.iterateOverColumns(context, grid, cellRenderer, writer, state);
if(!state.isFrozenPart()){
writer.startElement("td", grid);
- getUtils().writeAttribute(writer, "class","dr-sdt-bc
rich-sdt-column-cell " + state.getColumnClass(state.getCellIndex()));
- writer.startElement(HTML.DIV_ELEM, grid);
- getUtils().writeAttribute(writer, "class","dr-sdt-bcbody");
- writer.endElement(HTML.DIV_ELEM);
+ getUtils().writeAttribute(writer, "class","dr-sdt-bc rich-sdt-row
" + state.getColumnClass(state.getCellIndex()));
writer.endElement("td");
}
writer.endElement(HTML.TR_ELEMENT);
@@ -327,31 +324,42 @@
String row_id = null;
- String baseClientId = grid.getBaseClientId(context);
for (Iterator iter = grid.getChildren().iterator(); iter.hasNext(); ) {
UIComponent kid = (UIComponent) iter.next();
if (kid.isRendered()) {
- if (kid instanceof Column){
- if(state.isFrozenColumn() && !frozenTRRendered &&
state.getFrozenColumnCount() > 0){
+ if (kid instanceof Column){
+ String baseClientId = grid.getBaseClientId(context);
+
+ if(state.isFrozenColumn() && !frozenTRRendered){
state.setFrozenPart(true);
frozenTRRendered = true;
row_id = baseClientId + ":f:" + state.getRowIndex();
writer.startElement("tr", grid);
- getUtils().writeAttribute(writer, "class","dr-sdt-rb
rich-sdt-row" + state.getRowClass());
+ getUtils().writeAttribute(writer, "class","dr-sdt-rb
rich-sdt-row" + state.getRowClass(state.getRowIndex()));
getUtils().writeAttribute(writer,"id",row_id);
addRowJavascriptEvents(writer, grid);
collection.add(row_id);
}else if(!state.isFrozenColumn() && !normalTRRendered){
- writeNormalTr(frozenTRRendered, state, grid, collection,
- writer, baseClientId);
+ if(frozenTRRendered){
+ writer.endElement("tr");
+ }
+
+ state.setFrozenPart(false);
+ row_id = baseClientId + ":n:" + state.getRowIndex();
+
+ writer.startElement("tr", grid);
+ getUtils().writeAttribute(writer,"id",row_id);
+ getUtils().writeAttribute(writer, "class","dr-sdt-rb
rich-sdt-row" + state.getRowClass(state.getRowIndex()));
+ addRowJavascriptEvents(writer, grid);
normalTRRendered = true;
+ collection.add(row_id);
}
@@ -368,39 +376,17 @@
}
}
- if(!normalTRRendered){
- writeNormalTr(frozenTRRendered, state, grid, collection,
- writer, baseClientId);
- }
- writer.startElement("td", grid);
- getUtils().writeAttribute(writer, "class","dr-sdt-bc
rich-sdt-column-cell " + state.getColumnClass(state.getCellIndex()));
- writer.startElement(HTML.DIV_ELEM, grid);
- getUtils().writeAttribute(writer, "class","dr-sdt-bcbody");
- writer.endElement(HTML.DIV_ELEM);
- writer.endElement("td");
+
+// if(!state.isFrozenPart()){
+// writer.startElement("td", grid);
+// getUtils().writeAttribute(writer, "class","dr-sdt-bc " +
state.getColumnClass(state.getCellIndex()));
+// writer.endElement("td");
+// }
+
writer.endElement("tr");
state.setCellIndex(0);
state.nextRow();
}
-
- private void writeNormalTr(boolean frozenTRRendered,
- ScrollableDataTableRendererState state,
- UIScrollableDataTable grid, Collection collection,
- ResponseWriter writer, String baseClientId) throws IOException {
- String row_id;
- if(frozenTRRendered){
- writer.endElement("tr");
- }
-
- state.setFrozenPart(false);
- row_id = baseClientId + ":n:" + state.getRowIndex();
-
- writer.startElement("tr", grid);
- getUtils().writeAttribute(writer,"id",row_id);
- getUtils().writeAttribute(writer, "class","dr-sdt-rb rich-sdt-row"
+ state.getRowClass());
- addRowJavascriptEvents(writer, grid);
- collection.add(row_id);
- }
};
// temporary solution RF-957
@@ -470,15 +456,15 @@
state.setFrozenPart(isFrozen);
state.setClientId(grid.getClientId(context));
- if (!isFrozen || state.getFrozenColumnCount() > 0) {
- grid.walk(context, rowsRenderer, state);
- int fakeRowsCount = grid.getRows() - grid.getRowCount();
- state.setFake(true);
- for (int i = 0; i < fakeRowsCount; i++) {
- rowsRenderer.process(context, null, state);
- }
- state.setFake(false);
+ grid.walk(context, rowsRenderer, state);
+
+ int fakeRowsCount = grid.getRows() - grid.getRowCount();
+ state.setFake(true);
+ for (int i = 0; i < fakeRowsCount; i++) {
+ rowsRenderer.process(context, null, state);
}
+
+ state.setFake(false);
state.setRowIndex(0);
grid.setRowKey(null);
}
@@ -500,26 +486,8 @@
state.setFrozenPart(isFrozen);
state.setClientId(grid.getClientId(context));
state.setSepOffset(new Integer(0));
- if (!isFrozen || state.getFrozenColumnCount() > 0) {
- writer.startElement(HTML.TR_ELEMENT, grid);
- getUtils().writeAttribute(
- writer,
- "class",
- "dr-sdt-hr rich-std-header-row"
- + grid.getAttributes().get("headerClass"));
- ColumnWalker.iterateOverColumns(context, grid, headerCellRenderer,
- writer, state);
- if (!isFrozen) {
- writer.startElement(HTML.th_ELEM, grid);
- getUtils().writeAttribute(writer, "class",
- "dr-sdt-hc rich-sdt-header-cell");
- writer.startElement(HTML.DIV_ELEM, grid);
- getUtils().writeAttribute(writer, "class", "dr-sdt-hcbody");
- writer.endElement(HTML.DIV_ELEM);
- writer.endElement(HTML.th_ELEM);
- }
- writer.endElement(HTML.TR_ELEMENT);
- }
+
+ ColumnWalker.iterateOverColumns(context, grid, headerCellRenderer, writer, state);
}
public void renderCols(FacesContext context, UIScrollableDataTable grid, boolean
isFrozen) throws IOException{
@@ -606,40 +574,21 @@
Map parameters = externalContext.getRequestParameterMap();
String s_id = clientId + ":si";
- grid.resetReqRowsCount();
if(parameters.containsKey(s_id)){
String options = (String)parameters.get(s_id);
grid.setScrollPos(options);
- if(options.length() > 0){
- grid.setFirst(Integer.parseInt(options.split(",")[1]));
- }
}
if(parameters.containsKey(clientId + ":sortColumn") &&
parameters.containsKey(clientId + ":sortStartRow") &&
- parameters.containsKey(clientId + ":sortIndex")){
+ parameters.containsKey(clientId + ":sortIndex") &&
+ parameters.containsKey(clientId + ":sortOrder")){
int sortColumn = Integer.parseInt((String)parameters.get(clientId +
":sortColumn"));
int sortDataIndex = Integer.parseInt((String)parameters.get(clientId +
":sortIndex"));
Integer sortStartRow = Integer.valueOf((String)parameters.get(clientId +
":sortStartRow"));
- String sortOrderString =
- (String) parameters.get(clientId + ":sortOrder");
-
- Boolean so = null;
-
- if (sortOrderString != null && sortOrderString.length() > 0 ) {
- sortOrderString = sortOrderString.toLowerCase();
-
- if (sortOrderString.startsWith("a")) {
- so = Boolean.TRUE;
- } else if (sortOrderString.startsWith("d")){
- so = Boolean.FALSE;
- }
- }
-
-
Column column = (Column)grid.getChildren().get(sortColumn);
if(column.isSortable()){
@@ -647,8 +596,6 @@
sorted = true;
SortEvent sortEvent = new SortEvent(grid,sortColumn, grid.getRows(),
sortDataIndex);
- sortEvent.setProposedOrder(so);
-
sortEvent.setAttribute(ScrollableDataTableUtils.CLIENT_ROW_KEY,sortStartRow);
if (ajaxContext.isAjaxRequest()) {
@@ -724,30 +671,12 @@
writer.startElement("tbody", grid);
grid.walk(context, ajaxRowsRenderer, state);
- int fakeRowsCount = grid.getRows() - grid.getRowCount();
- ScrollableDataTableRendererState.restoreState(context);
- grid.setRowKey(null);
- state.setFake(true);
- for (int i = 0; i < fakeRowsCount; i++) {
- ajaxRowsRenderer.process(context, null, state);
- }
- state.setFake(false);
-
writer.endElement("tbody");
writer.endElement("table");
- String id = client_id+"_rows_input";
- writer.startElement(HTML.INPUT_ELEM, grid);
- writer.writeAttribute(HTML.TYPE_ATTR, "hidden", null);
- writer.writeAttribute(HTML.id_ATTRIBUTE, id, null);
- writer.writeAttribute(HTML.NAME_ATTRIBUTE, id, null);
- writer.writeAttribute(HTML.value_ATTRIBUTE, new Integer(grid.getRowCount()), null);
- writer.endElement(HTML.INPUT_ELEM);
- ajaxContext.addRenderedArea(id);
-
- renderHiddenScrollInput(context, grid);
- ajaxContext.addRenderedArea(client_id+":si");
+ ScrollableDataTableRendererState.restoreState(context);
+ grid.setRowKey(null);
ajaxContext.setResponseData(grid.getResponseData());
@@ -956,11 +885,4 @@
return sorting;
}
- private String getColumnWidth(UIComponent column) {
- String width = (String) column.getAttributes().get("width");
- if (width == null) {
- width = "100px";
- }
- return width;
- }
}
Modified:
branches/3.1.x/ui/scrollableDataTable/src/main/java/org/richfaces/renderkit/html/ScrollableDataTableRendererState.java
===================================================================
---
branches/3.1.x/ui/scrollableDataTable/src/main/java/org/richfaces/renderkit/html/ScrollableDataTableRendererState.java 2008-01-16
15:23:05 UTC (rev 5427)
+++
branches/3.1.x/ui/scrollableDataTable/src/main/java/org/richfaces/renderkit/html/ScrollableDataTableRendererState.java 2008-01-16
15:35:03 UTC (rev 5428)
@@ -3,6 +3,7 @@
*/
package org.richfaces.renderkit.html;
+import java.io.Serializable;
import java.util.Collection;
import java.util.HashSet;
@@ -11,12 +12,11 @@
import javax.faces.context.FacesContext;
import javax.faces.context.ResponseWriter;
-import org.ajax4jsf.component.UIDataAdaptor;
import org.ajax4jsf.context.AjaxContext;
import org.richfaces.component.UIScrollableDataTable;
/**
- * bean to store current {@link UIDataAdaptor } information
+ * bean to store current {@link com.exadel.vcp.components.datagrid.UIDataGrid }
information
* in request map. For nested grids, it support push/pop state saving.
* In {@link javax.faces.render.Renderer#encodeBegin(javax.faces.context.FacesContext,
javax.faces.component.UIComponent)} method
* must be created instance of this bean , or, if it already exist in request map - push
information.
@@ -24,7 +24,7 @@
* @author shura
*
*/
-public class ScrollableDataTableRendererState{
+public class ScrollableDataTableRendererState implements Serializable {
public static final String DATA_GRID_RENDERER_STATE =
ScrollableDataTableRendererState.class.getName();
@@ -78,8 +78,6 @@
private Object rowKey;
- private int rows;
-
private static final long serialVersionUID = 2129605586975025578L;
@@ -148,7 +146,6 @@
_cachedClientId = grid.getClientId(context);
clientId = _cachedClientId;
_previousState = previsiosState;
- rows = grid.getRows();
}
public String getCurrentCellId(FacesContext context){
@@ -226,7 +223,7 @@
* @return Returns the rowIndex.
*/
public int getRowIndex() {
- if(rows != 0 && _rowIndex >= rows){
+ if(_grid.getRows() != 0 && _rowIndex >= _grid.getRows()){
_rowIndex = 0;
}
return _rowIndex;
@@ -413,11 +410,7 @@
}
}
- public String getRowClass() {
- return getRowClass(getRowIndex()) + (isFake() ? " dr-sdt-fake-r rich-sdt-fake-r
" : "");
- }
-
- private String getRowClass(int index) {
+ public String getRowClass(int index) {
if(rowClasses != null) {
return rowClasses[index % rowClassesSize];
} else {
Modified:
branches/3.1.x/ui/scrollableDataTable/src/main/java/org/richfaces/renderkit/html/SelectionRendererContributor.java
===================================================================
---
branches/3.1.x/ui/scrollableDataTable/src/main/java/org/richfaces/renderkit/html/SelectionRendererContributor.java 2008-01-16
15:23:05 UTC (rev 5427)
+++
branches/3.1.x/ui/scrollableDataTable/src/main/java/org/richfaces/renderkit/html/SelectionRendererContributor.java 2008-01-16
15:35:03 UTC (rev 5428)
@@ -45,7 +45,7 @@
public void decode(FacesContext context, UIComponent component,
CompositeRenderer compositeRenderer) {
- final UIScrollableDataTable grid = (UIScrollableDataTable) component;
+ UIScrollableDataTable grid = (UIScrollableDataTable) component;
ExternalContext externalContext = context.getExternalContext();
Map requestParamMap = externalContext.getRequestParameterMap();
@@ -103,9 +103,6 @@
}
- if(i == clientSelection.getActiveRowIndex()) {
- grid.setActiveRowKey(rowKey);
- }
state.nextRow();
}
@@ -168,16 +165,8 @@
ScriptOptions scriptOptions = new ScriptOptions(component);
scriptOptions.addOption("selectionInput", getSelectionInputName(
context, (UIScrollableDataTable) component));
- Map attributes = component.getAttributes();
- Object attribut = attributes.get("selectedClass");
- if (attribut == null) {
- attribut = "";
- }
- scriptOptions.addOption("selectedClass", attribut);
- attribut = attributes.get("activeClass");
- if (attribut == null) {
- attribut = "";
- }scriptOptions.addOption("activeClass", attribut);
+ scriptOptions.addOption("selectedClass");
+ scriptOptions.addOption("activeClass");
return scriptOptions;
}
@@ -205,7 +194,7 @@
}
- private void encodeSelection(FacesContext context, final UIScrollableDataTable grid)
throws IOException {
+ private void encodeSelection(FacesContext context, UIScrollableDataTable grid) throws
IOException {
final ScrollableDataTableRendererState state =
ScrollableDataTableRendererState.createState(context, grid);
state.setRowIndex(ScrollableDataTableUtils.getClientRowIndex(grid));
@@ -228,9 +217,6 @@
clientSelection.addIndex(i);
}
- if (rowKey.equals(grid.getActiveRowKey())) {
- clientSelection.setActiveRowIndex(state.getRowIndex());
- }
state.nextRow();
@@ -259,16 +245,13 @@
Converter converter =
application.createConverter(ClientSelection.class);
- ClientSelection selection =
(ClientSelection)grid.getAttributes().get(CLIENT_SELECTION);
String string =
- converter.getAsString(context, grid, selection);
+ converter.getAsString(context, grid, grid.getAttributes().get(CLIENT_SELECTION));
if (string == null) {
string = "";
}
- string += selection.getActiveRowIndex();
-
String id = getSelectionInputName(context, grid);
Modified:
branches/3.1.x/ui/scrollableDataTable/src/main/javascript/ClientUI/common/box/Box.js
===================================================================
---
branches/3.1.x/ui/scrollableDataTable/src/main/javascript/ClientUI/common/box/Box.js 2008-01-16
15:23:05 UTC (rev 5427)
+++
branches/3.1.x/ui/scrollableDataTable/src/main/javascript/ClientUI/common/box/Box.js 2008-01-16
15:35:03 UTC (rev 5428)
@@ -50,6 +50,12 @@
if(!dontUpdateStyles) {
this.element.setStyle({overflow: 'hidden'});
this.element.setStyle({whiteSpace: 'nowrap'});
+
+ // if the element isn't positioned, make it relative
+ var position = this.element.getStyle('position');
+ if(position != 'absolute' && position != 'fixed'){
+ this.element.setStyle({position: 'relative'});
+ }
}
},
@@ -69,9 +75,8 @@
return this.element;
},
getHeight: function() {
- var el = this.getElement();
- if(el.tagName.toLowerCase() != "body") {
- var h = el.offsetHeight;
+ if(this.getElement().tagName.toLowerCase() != "body") {
+ var h = Element.getHeight(this.element);
return h>0 ? h : (this.element.boxHeight ? parseInt(this.element.boxHeight) : 0);
}
@@ -98,9 +103,8 @@
return this;
},
getWidth: function() {
- var el = this.getElement();
- if(el.tagName.toLowerCase() != "body") {
- var w = el.offsetWidth;
+ if(this.getElement().tagName.toLowerCase() != "body") {
+ var w = Element.getWidth(this.element);
return w>0 ? w : (this.element.boxWidth ? parseInt(this.element.boxWidth) : 0);
}
Modified:
branches/3.1.x/ui/scrollableDataTable/src/main/javascript/ClientUI/common/box/ScrollableBox.js
===================================================================
---
branches/3.1.x/ui/scrollableDataTable/src/main/javascript/ClientUI/common/box/ScrollableBox.js 2008-01-16
15:23:05 UTC (rev 5427)
+++
branches/3.1.x/ui/scrollableDataTable/src/main/javascript/ClientUI/common/box/ScrollableBox.js 2008-01-16
15:35:03 UTC (rev 5428)
@@ -6,6 +6,7 @@
ClientUILib.declarePackage("ClientUI.common.box.ScrollableBox");
ClientUILib.requireClass("ClientUI.common.box.Box");
+ClientUILib.requireClass("ClientUI.common.utils.CustomEvent");
/**
* This class target to manage scrollable box object.
@@ -17,6 +18,10 @@
$super(element, parentElement);
this.element.setStyle({overflow: 'auto'});
+ // Create custom event producers
+ this.eventHScroll = new ClientUI.common.utils.CustomEvent('OnHScroll');
+ this.eventVScroll = new ClientUI.common.utils.CustomEvent('OnVScroll');
+
this.eventOnScroll = this.scrollContent.bindAsEventListener(this);
Event.observe(this.element, 'scroll', this.eventOnScroll);
},
@@ -29,13 +34,13 @@
// process horizontal scrolling
if(this.scrollLeft!==this.getViewportScrollX()) {
this.scrollLeft = this.getViewportScrollX();
- this.element.fire("grid:onhcroll", {pos:this.getViewportScrollX()});
+ this.eventHScroll.fire(this.getViewportScrollX());
}
// process vertical scrolling
if(this.scrollTop!==this.getViewportScrollY()) {
this.scrollTop = this.getViewportScrollY();
- this.element.fire("grid:onvcroll", {pos:this.getViewportScrollY()});
+ this.eventVScroll.fire(this.getViewportScrollY());
}
},
updateLayout: function($super) {
@@ -112,4 +117,16 @@
this.scrollerWidth = (wNoScroll - wScroll);
return this.scrollerWidth || 0;
}
+});
+
+Object.extend(ClientUI.common.box.ScrollableBox.prototype, {
+ // Custom events
+ /**
+ * Occured when content scrolled in horizontal
+ */
+ eventHScroll: {},
+ /**
+ * Occured when content scrolled in vertical
+ */
+ eventVScroll: {}
});
\ No newline at end of file
Copied:
branches/3.1.x/ui/scrollableDataTable/src/main/javascript/ClientUI/common/box/SplashBox.js
(from rev 4879,
branches/3.1.x/ui/scrollableDataTable/src/main/javascript/ClientUI/common/box/SplashBox.js)
===================================================================
---
branches/3.1.x/ui/scrollableDataTable/src/main/javascript/ClientUI/common/box/SplashBox.js
(rev 0)
+++
branches/3.1.x/ui/scrollableDataTable/src/main/javascript/ClientUI/common/box/SplashBox.js 2008-01-16
15:35:03 UTC (rev 5428)
@@ -0,0 +1,95 @@
+/**
+ * InlineBox.js Date created: 6.04.2007
+ * Copyright (c) 2007 Exadel Inc.
+ * @author Denis Morozov <dmorozov(a)exadel.com>
+ */
+ClientUILib.declarePackage("ClientUI.common.box.SplashBox");
+
+ClientUILib.requireClass("ClientUI.common.box.Box");
+ClientUILib.requireClass("ClientUI.common.box.Substrate");
+
+/**
+ * Base class that wrap work with inline blocks like span
+ */
+ClientUI.common.box.SplashBox = Class.create(ClientUI.common.box.Box, {
+
+ initialize: function($super, text, parentElement, zIndex, supressSplash) {
+ $super(null, parentElement);
+ this.moveTo(-1000, -1000);
+ this.zIndex = zIndex || 500;
+ this.supressSplash = supressSplash || false;
+ this.createControl(text);
+ this.hide();
+ },
+ createControl: function(text) {
+ this.element.setStyle({zIndex: this.zIndex});
+ this.makeAbsolute();
+
+ this.frame = new ClientUI.common.box.Substrate(null, this.getElement());
+ this.frame.getElement().setStyle({zIndex: this.zIndex + 1});
+ this.frame.getElement().setStyle({backgroundColor: "#FFFFFF"});
+ this.frame.getElement().setStyle({border: "medium none"});
+ this.frame.getElement().setStyle({opacity: "0"});
+ this.frame.moveTo(0, 0);
+ this.frame.setWidth(this.getWidth());
+ this.frame.setHeight(this.getHeight());
+
+ if(!this.supressSplash) {
+ this.div = new ClientUI.common.box.Box(null, this.getElement());
+ this.div.getElement().setStyle({zIndex: this.zIndex + 2});
+ this.div.getElement().setStyle({backgroundColor: "#000000"});
+ this.div.getElement().setStyle({opacity: "0.6"});
+ this.div.makeAbsolute();
+ this.div.moveTo(0, 0);
+ this.div.setWidth(this.getWidth());
+ this.div.setHeight(this.getHeight());
+ this.div.show();
+ }
+
+ this.text = new ClientUI.common.box.Box(text, this.getElement());
+ this.text.setParent(this.getElement());
+ this.text.getElement().setStyle({zIndex: this.zIndex + 100});
+ if(!text)
+ this.text.getElement().innerHTML = "<font size='4'
color='white'>Loading...</font>";
+ this.text.makeAbsolute();
+ this.text.show();
+
+ },
+ setSize: function(width, height) {
+ this.setWidth(width);
+ this.setHeight(height);
+ this.containerWidth = width;
+ this.containerHeight = height;
+ },
+ setImage: function(image) {
+ if(!this.img) {
+ this.img = new ClientUI.common.box.Box($(document.createElement("img")),
this.div.getElement());
+ this.img.makeAbsolute();
+ }
+ this.img.getElement().src = image;
+ this.text.hide();
+ },
+ updateLayout: function() {
+ var width = this.containerWidth||this.getWidth();
+ var height = this.containerHeight||this.getHeight();
+
+ this.frame.setWidth(width);
+ this.frame.setHeight(height);
+
+ if(!this.supressSplash) {
+ this.div.setWidth(width);
+ this.div.setHeight(height);
+ }
+
+ if(this.img) {
+ var x = width/2 - this.img.getWidth()/2;
+ var y = height/2 - this.img.getHeight()/2;
+ this.img.moveTo(x, y);
+ }
+ else {
+ var x = width/2 - this.text.getWidth()/2;
+ var y = height/2 - this.text.getHeight()/2;
+ this.text.moveTo(x, y);
+ }
+ }
+});
Modified:
branches/3.1.x/ui/scrollableDataTable/src/main/javascript/ClientUI/common/box/Substrate.js
===================================================================
---
branches/3.1.x/ui/scrollableDataTable/src/main/javascript/ClientUI/common/box/Substrate.js 2008-01-16
15:23:05 UTC (rev 5427)
+++
branches/3.1.x/ui/scrollableDataTable/src/main/javascript/ClientUI/common/box/Substrate.js 2008-01-16
15:35:03 UTC (rev 5428)
@@ -15,7 +15,7 @@
initialize: function($super, element, parentElement, dontUpdateStyles) {
if(!element) {
var fakeElement = $(document.createElement("div"));
- fakeElement.innerHTML = '<iframe id="'+'ClientUI_Substrate' +
(ClientUI_common_box_Substrate_idGenerator++) +'"
src="javascript:\'\'" scrolling="no" frameborder="0"
style="filter:Alpha(opacity=0);position:absolute;top:0px;left:0px;display:block"></iframe>';
+ fakeElement.innerHTML = '<iframe id="'+'ClientUI_Substrate' +
(ClientUI_common_box_Substrate_idGenerator++) +'" src=""
scrolling="no" frameborder="0"
style="filter:Alpha(opacity=0);position:absolute;top:0px;left:0px;display:block"></iframe>';
element = $(fakeElement.getElementsByTagName("iframe")[0]);
fakeElement.removeChild(element);
}
Modified:
branches/3.1.x/ui/scrollableDataTable/src/main/javascript/ClientUI/common/utils/Utils.js
===================================================================
---
branches/3.1.x/ui/scrollableDataTable/src/main/javascript/ClientUI/common/utils/Utils.js 2008-01-16
15:23:05 UTC (rev 5427)
+++
branches/3.1.x/ui/scrollableDataTable/src/main/javascript/ClientUI/common/utils/Utils.js 2008-01-16
15:35:03 UTC (rev 5428)
@@ -60,15 +60,15 @@
target.parentNode.replaceChild(imported, target);;
return imported;
-// } else if (ClientUILib.isGecko){
-// //Mozill family
-// var theDoc = document;
-//
-// Utils.DOM._clearAttributes(target);
-// Utils.DOM.copyAttributes(target, src);
-//
-// target.innerHTML = src.innerHTML;//nnerHTML.join("");
-// return target;
+ } else if (ClientUILib.isGecko){
+ //Mozill family
+ var theDoc = document;
+
+ Utils.DOM._clearAttributes(target);
+ Utils.DOM.copyAttributes(target, src);
+
+ target.innerHTML = src.innerHTML;//nnerHTML.join("");
+ return target;
} else {
//Fall back to DOM, and cross the fingers
src = document.importNode(src, true);
@@ -255,7 +255,7 @@
}, 100);
}
- grid.getBody()._onDataReady(localOptions);
+ dataModel.eventDataReady.fire(localOptions);
}
}
};
@@ -299,12 +299,6 @@
}
};
-Utils.trace = function(s) {
- LOG.info(s + ": " + (new Date().getTime()- this._d) + " ");
- //window.status = s + ": " + (new Date().getTime()- this._d) + "
" + window.status;
- this._d = new Date().getTime();
-};
-
Array.prototype.unbreakableEach = function(f) {
for (var i = 0; i < this.length; i++) {
f(this[i], i);
Modified:
branches/3.1.x/ui/scrollableDataTable/src/main/javascript/ClientUI/controls/grid/DataModel.js
===================================================================
---
branches/3.1.x/ui/scrollableDataTable/src/main/javascript/ClientUI/controls/grid/DataModel.js 2008-01-16
15:23:05 UTC (rev 5427)
+++
branches/3.1.x/ui/scrollableDataTable/src/main/javascript/ClientUI/controls/grid/DataModel.js 2008-01-16
15:35:03 UTC (rev 5428)
@@ -5,6 +5,8 @@
*/
ClientUILib.declarePackage("ClientUI.controls.grid.DataModel");
+ClientUILib.requireClass("ClientUI.common.utils.CustomEvent");
+
/*
* DataModel.js - Base datamodel class for grid control
* by Denis Morozov <dmorozov(a)exadel.com> distributed under the BSD license.
@@ -14,6 +16,7 @@
initialize: function() {
// constructor
+ this.eventDataReady = new
ClientUI.common.utils.CustomEvent('DataModel::OnDataReady');
},
// interface method
@@ -35,4 +38,9 @@
getRequestDelay: function() {
return 1000;
}
-});
+});
+
+Object.extend(ClientUI.controls.grid.DataModel.prototype, {
+ eventDataReady: {}
+});
+
Modified:
branches/3.1.x/ui/scrollableDataTable/src/main/javascript/ClientUI/controls/grid/Grid.js
===================================================================
---
branches/3.1.x/ui/scrollableDataTable/src/main/javascript/ClientUI/controls/grid/Grid.js 2008-01-16
15:23:05 UTC (rev 5427)
+++
branches/3.1.x/ui/scrollableDataTable/src/main/javascript/ClientUI/controls/grid/Grid.js 2008-01-16
15:35:03 UTC (rev 5428)
@@ -33,16 +33,21 @@
initialize: function($super, element, dataModel, templates) {
$super(element);
+ if(!this.element || !this.element.id)
+ this.element.id = "ClientUI_Grid" +
ClientUI_controls_grid_Grid_idGenerator++;
this.dataModel = dataModel;
this.templates = $A(templates);
-
+
+ this.eventOnSort = new ClientUI.common.utils.CustomEvent('OnSort');
+ this.eventOnResizeColumn = new
ClientUI.common.utils.CustomEvent('OnResizeColumn');
+
this.createControl();
},
createControl: function() {
var grid = this;
- this.layout = new ClientUI.layouts.GridLayoutManager(this.getElement().id +
":c", null);
+ this.layout = new ClientUI.layouts.GridLayoutManager(this.getElement(), null);
var pagePart, item;
for(var i=0; i<this.templates.length; i++) {
@@ -68,22 +73,33 @@
this.currentScrollPos = 0;
this.controlCreated = true;
- var grid = this;
- Utils.execOnLoad(
- function(){
- grid.getHeader().updateSize();
- grid.getBody().updateSize();
- if(grid.getFooter()) {grid.getFooter().updateSize();}
- grid.updateLayout();
- },
- Utils.Condition.ElementPresent(grid.client_id), 100);
+ this.updateLayout();
+
+ if (ClientUILib.isIE && !ClientUILib.isIE7) {
+ var grid = this;
+ setTimeout(function() {grid.updateLayout()}, 50);
+ }
},
-
updateLayout: function($super) {
+ if(!this.controlCreated || this.getHeight()==0) {
+ return;
+ }
$super();
+
+ var header = this.getHeader();
+ if(header.getHeight() == 0) {
+ header.updateSize();
+ this.getBody().updateSize();
+ if(this.getFooter()) {this.getFooter().updateSize();}
+ }
+
if(this.layout) {
this.layout.updateLayout();
}
+ header.updateLayout();
+ header.setFakeColumnWidth();
+ this.getBody().setFakeColumnWidth();
+ if(this.getFooter()) {this.getFooter().setFakeColumnWidth();}
},
getHeader: function() {
return this.layout.getPane(GridLayout_Enum.HEADER);
@@ -100,7 +116,7 @@
if(this.getFooter()) this.getFooter().adjustColumnWidth(index, width);
this.updateLayout();
this.getHeader().agjustSeparators();
- this.element.fire("grid:onresizecolumn",{index:index, width:width});
+ this.eventOnResizeColumn.fire(index, width);
},
adjustScrollPosition: function(pos) {
if(pos<0) {pos = 0;}
@@ -146,14 +162,15 @@
},
quickFind: function(column, text, startRow) {
var start = startRow || 0;
- var searchText = ".*" + text + ".*";
+ var searchText = "*" + text + "*";
+ searchText = searchText.replace(/\*/g, ".*");
var searchReg = new RegExp(searchText, 'i');
var rowIndex = -1;
var body = this.getBody();
var rowsCount = body.rowsCount;
for (var i = start; i < rowsCount; i++) {
var currentTextInGrid = body.getCellText(i, column);
- currentTextInGrid =
currentTextInGrid.replace(/(<[^<]*>)/g,'');
+ currentTextInGrid = currentTextInGrid.replace(/,/g,'');
if (currentTextInGrid.search(searchReg) != -1) {
rowIndex = i;
break;
@@ -187,4 +204,21 @@
this.updateLayout();
}
}
-});
+});
+
+Object.extend(ClientUI.controls.grid.Grid.prototype, {
+ // Custom events
+ /**
+ * Occured when content header clicked
+ */
+ eventOnSort: {},
+ /**
+ * Occured when column width adjusted
+ */
+ eventOnResizeColumn: {}
+});
+
+if(!ClientUI_controls_grid_Grid_idGenerator) {
+var ClientUI_controls_grid_Grid_idGenerator = 0;
+};
+
Modified:
branches/3.1.x/ui/scrollableDataTable/src/main/javascript/ClientUI/controls/grid/GridBody.js
===================================================================
---
branches/3.1.x/ui/scrollableDataTable/src/main/javascript/ClientUI/controls/grid/GridBody.js 2008-01-16
15:23:05 UTC (rev 5427)
+++
branches/3.1.x/ui/scrollableDataTable/src/main/javascript/ClientUI/controls/grid/GridBody.js 2008-01-16
15:35:03 UTC (rev 5428)
@@ -24,23 +24,26 @@
$super(template);
// declare event listeners
- this._eventOnHScroll = this._onContentHScroll.bindAsEventListener(this);
- this._eventOnVScroll = this._onContentVScroll.bindAsEventListener(this);
+ this._eventOnHScroll = this._onContentHScroll.bind(this);
+ this._eventOnVScroll = this._onContentVScroll.bind(this);
+ this._eventOnDataReady = this._onDataReady.bind(this);
this.createControl(template);
this.registerEvents();
},
registerEvents: function() {
- Event.observe(this.scrollBox.element, "grid:onhcroll",
this._eventOnHScroll);
- Event.observe(this.scrollBox.element, "grid:onvcroll",
this._eventOnVScroll);
+ Event.observe(this.scrollBox.eventHScroll, "grid body hscroll",
this._eventOnHScroll);
+ Event.observe(this.scrollBox.eventVScroll, "grid body vscroll",
this._eventOnVScroll);
+ Event.observe(this.grid.dataModel.eventDataReady, "grid data is loaded",
this._eventOnDataReady);
},
destroy: function() {
- Event.stopObserving(this.scrollBox.element, "grid:onhcroll",
this._eventOnHScroll);
- Event.stopObserving(this.scrollBox.element, "grid:onvcroll",
this._eventOnVScroll);
+ Event.stopObserving(this.scrollBox.eventHScroll, "grid body hscroll",
this._eventOnHScroll);
+ Event.stopObserving(this.scrollBox.eventVScroll, "grid body vscroll",
this._eventOnVScroll);
+ Event.stopObserving(this.grid.dataModel.eventDataReady, "grid data is
loaded", this._eventOnDataReady);
},
// event listeners
- _onContentHScroll: function(event) {
- this.grid.adjustScrollPosition(event.memo.pos);
+ _onContentHScroll: function(xpos) {
+ this.grid.adjustScrollPosition(xpos);
},
_onDataReady: function(options) {
// load rows data
@@ -50,14 +53,14 @@
window.loadingInvalidateTime = (new Date()).getTime();
},
- _onContentVScroll: function(event) {
- this.helpObject1.moveToY(this.sizeBox.element.offsetHeight+ this.defaultRowHeight +
5);
- this.helpObject2.moveToY(this.sizeBox.element.offsetHeight+ this.defaultRowHeight +
5);
- this.setScrollPos(event.memo.pos);
- this.adjustDataPosition(event.memo.pos);
+ _onContentVScroll: function(ypos) {
+ this.helpObject1.moveToY(this.sizeBox.getHeight()+ this.defaultRowHeight + 5);
+ this.helpObject2.moveToY(this.sizeBox.getHeight()+ this.defaultRowHeight + 5);
+ this.setScrollPos(ypos);
+ this.adjustDataPosition(ypos);
},
createControl: function(template) {
- this.scrollInput = $(this.gridId + ":si");
+
var childs = template.childNodes;
for(var i=0; i<childs.length; i++) {
if(childs[i].id == this.gridId + ":bc") {
@@ -68,10 +71,11 @@
break;
}
}
- Event.observe(this.container.getElement(), 'keypress',
this.synchronizeScroll.bindAsEventListener(this));
// create scroll box
this.scrollBox = new ClientUI.common.box.ScrollableBox(this.gridId + ":scb",
this.getElement());
+ this.scrollBox.setWidth(this.getWidth());
+ this.scrollBox.setHeight(this.getHeight());
this.sizeBox = new ClientUI.common.box.Box(this.gridId + ":sb",
this.scrollBox.getElement());
var normal = null, frozen = null;
@@ -92,8 +96,9 @@
}
this.contentBox = new ClientUI.common.box.Box(normal);
- Event.observe(this.contentBox.getElement(), 'keypress',
this.synchronizeScroll.bindAsEventListener(this));
+ this.contentBox.makeAbsolute();
this.frozenContentBox = new ClientUI.common.box.Box(frozen);
+ this.frozenContentBox.makeAbsolute();
this.helpObject1 = new ClientUI.common.box.Box(this.gridId + ":nho",
this.contentBox.getElement());
this.helpObject2 = new ClientUI.common.box.Box(this.gridId + ":fho",
this.frozenContentBox.getElement());
@@ -135,34 +140,35 @@
this.sizeBox.setHeight(this.templNormal.getElement().offsetHeight);
},
parseTemplate: function(templFrozen, templNormal) {
- var result = false;
- if(templNormal && templNormal.rows && templNormal.rows.length != 0) {
- var columns = this.grid.getHeader().getColumns();
- var i=0, j=0;
- var cols = this.templFrozen.getElement().getElementsByTagName("col");
- for(i=0; i<cols.length; i++) {
- columns[j].bodyCol = $(cols[i]);
- j++;
- }
- cols = this.templNormal.getElement().getElementsByTagName("col");
- for(i=0; i<cols.length; i++) {
- columns[j].bodyCol = $(cols[i]);
- j++;
- }
-
- this.rowsCount = Math.min(templNormal.rows.length, this.grid.dataModel.getCount());
-
- //if(ClientUILib.isGecko) {
- // this.defaultRowHeight -= this.getBorderWidth("tb") +
this.getPadding("tb");
- //}
- this.helpObj = new ClientUI.common.box.Box(templFrozen, null, true);
- this.countToLoad = 0;
- this.startRow = 0;
- this.startIndex = 0;
- result = true;
+ if(!templNormal || !templNormal.rows || templNormal.rows.length===0) {
+ return false;
}
+
+ var columns = this.grid.getHeader().getColumns();
+ var i=0, j=0;
+ var cols = this.templFrozen.getElement().getElementsByTagName("col");
+ for(i=0; i<cols.length; i++) {
+ columns[j].bodyCol = $(cols[i]);
+ j++;
+ }
+ cols = this.templNormal.getElement().getElementsByTagName("col");
+ for(i=0; i<cols.length; i++) {
+ columns[j].bodyCol = $(cols[i]);
+ j++;
+ }
+
+ this.rowsCount = Math.min(templNormal.rows.length, this.grid.dataModel.getCount());
+
+ //if(ClientUILib.isGecko) {
+ // this.defaultRowHeight -= this.getBorderWidth("tb") +
this.getPadding("tb");
+ //}
+ this.helpObj = new ClientUI.common.box.Box(templFrozen, null, true);
+ this.countToLoad = 0;
+ this.startRow = 0;
+ this.startIndex = 0;
this.currRange = $R(0, this.rowsCount);
- return result;
+
+ return true;
},
setScrollPos: function(pos) {
this.contentBox.getElement().scrollTop = pos;
@@ -174,14 +180,15 @@
},
updateSize: function() {
+ var defHeight = this._calcDefaultRowHeight();
+
+ if (isFinite(defHeight)) {
+ this.defaultRowHeight = defHeight;
+ }
+
var row = this.templNormal.getElement().rows[0];
if(row) {
- this.defaultRowHeight = row.cells[0].offsetHeight;
- } else {
- var defHeight = this._calcDefaultRowHeight();
- if (isFinite(defHeight)) {
- this.defaultRowHeight = defHeight;
- }
+ this.defaultRowHeight = Element.getHeight(row.cells[0]);
}
//if(ClientUILib.isGecko) {
// this.defaultRowHeight -= this.getBorderWidth("tb") +
this.getPadding("tb");
@@ -198,14 +205,12 @@
var totalWidth = this.grid.getColumnsTotalWidth();
this.scrollBox.moveTo(0, 0);
- var height = this.element.offsetHeight;
- var width = this.element.offsetWidth;
+ this.scrollBox.setWidth(this.getWidth());
+ this.scrollBox.setHeight(this.getHeight());
- this.scrollBox.setWidth(width);
- this.scrollBox.setHeight(height);
-
var scrollLeft = this.grid.getScrollOffset();
- var fixH = this.grid.getFooter() ? this.grid.getFooter().element.offsetHeight : 0;
+ var height = this.scrollBox.getHeight();
+ var fixH = this.grid.getFooter() ? this.grid.getFooter().getHeight() : 0;
if(fixH > height) fixH = 0;
var frozenContentWidth = this.grid.getColumnsFrozenWidth();
@@ -215,8 +220,19 @@
this.sizeBox.moveTo(0, 0);
this.sizeBox.setWidth(totalWidth);
- this.scrollBox.setWidth(width);
- this.scrollBox.setHeight(height);
+ this.scrollBox.setWidth(this.getWidth()+1);
+ this.scrollBox.setHeight(this.getHeight()+1);
+ this.scrollBox.setWidth(this.getWidth());
+ this.scrollBox.setHeight(this.getHeight());
+ var viewWidth = this.scrollBox.getViewportWidth();
+ this.container.setWidth(viewWidth);
+
+ if(ClientUILib.isIE) {
+ this.contentBox.setWidth(viewWidth - frozenContentWidth);
+ }
+ else {
+ this.contentBox.setWidth(Math.max(this.getWidth(), totalWidth));
+ }
height = this.scrollBox.getElement().clientHeight;
@@ -226,29 +242,18 @@
this.container.setHeight(height - fixH);
this.defaultRowHeight = this._calcDefaultRowHeight();
- this.scrollBox.hide();
this.sizeBox.setHeight(this.defaultRowHeight * this.grid.dataModel.getCount() + fixH);
- this.helpObject1.moveToY(this.sizeBox.element.offsetHeight+ this.defaultRowHeight +
5);
- this.helpObject2.moveToY(this.sizeBox.element.offsetHeight+ this.defaultRowHeight +
5);
+ this.helpObject1.moveToY(this.sizeBox.getHeight()+ this.defaultRowHeight + 5);
+ this.helpObject2.moveToY(this.sizeBox.getHeight()+ this.defaultRowHeight + 5);
+
+ var scrollPos = Math.min(totalWidth - viewWidth, scrollLeft);
+ this.grid.adjustScrollPosition(scrollPos);
- this.dataVisible = parseInt(this.contentBox.element.offsetHeight /
this.defaultRowHeight, 10) + 1;
+ this.dataVisible = parseInt(this.contentBox.getHeight() / this.defaultRowHeight, 10) +
1;
this.dataVisible = Math.min(this.dataVisible, this.rowsCount);
if(height > 0) {
this.adjustDataPosition(this.currentPos);
}
- this.scrollBox.show();
- var viewWidth = this.scrollBox.getViewportWidth();
- this.container.setWidth(viewWidth);
-
- if(ClientUILib.isIE) {
- this.contentBox.setWidth(viewWidth - frozenContentWidth);
- }
- else {
- this.contentBox.setWidth(Math.max(this.getWidth(), totalWidth));
- }
- var scrollPos = Math.min(totalWidth - viewWidth, scrollLeft);
- this.grid.adjustScrollPosition(scrollPos);
- this.setFakeColumnWidth();
},
adjustScrollPosition: function(pos) {
this.templNormal.moveToX(-pos);
@@ -278,9 +283,6 @@
}
else if(to == this.grid.dataModel.getCount()) {
from = to - this.rowsCount;
- if (from < 0) {
- from = 0;
- }
}
var range = $R(from, to);
@@ -329,17 +331,15 @@
}.bind(this), this.grid.dataModel.getRequestDelay());
},
adjustColumnWidth: function(column, width) {
- var bodyCol = this.grid.getHeader().getColumns()[column].bodyCol;
- if (bodyCol) {
- bodyCol.width = width>0 ? width : 1;
- }
+ var columns = this.grid.getHeader().getColumns();
+ columns[column].bodyCol.width = width>0 ? width : 1;
},
setFakeColumnWidth: function() {
var columns = this.grid.getHeader().getColumns();
var bodyCell = columns.last().bodyCol;
if(bodyCell) bodyCell.width = 1;
- var width = this.container.getElement().offsetWidth - this.fTable.offsetWidth -
this.nTable.offsetWidth;
+ var width = this.grid.getElement().offsetWidth - this.fTable.offsetWidth -
this.nTable.offsetWidth;
if (width < 1) {
width = 1;
}
@@ -360,8 +360,6 @@
var startRowIndx = 0;
var countToLoad = 0;
- this.scrollInput.value = task.pos + "," + range.start + "," +
range.end;
-
// if we have intersepted ranges than rearrange rows
// in other case just move rows table to first position
if(this.currRange.end < range.start
@@ -370,20 +368,21 @@
}
if(switchType === 0) {
- startRowIndx = this._getRowIndex(this.templNormal.getElement().rows[0].id);
+ startRowIndx = this._getRowIndex(this.templFrozen.getElement().rows[0].id);
startIndex = range.start;
countToLoad = range.end - range.start;
}
else {
var i, row, rownew, cloned;
countToLoad = 0;
+ var frozenTbl = this.templFrozen.getElement();
var normalTbl = this.templNormal.getElement();
if(range.start > this.currRange.start
&& range.start < this.currRange.end) {
switchType = 1;
countToLoad = range.start - this.currRange.start;
if(countToLoad > 0) {
- startRowIndx = this._getRowIndex(normalTbl.rows[0].id);
+ startRowIndx = this._getRowIndex(frozenTbl.rows[0].id);
startIndex = this.currRange.end;
}
}
@@ -393,7 +392,7 @@
if(countToLoad > 0) {
startIndex = this.currRange.end;
var restCount = this.rowsCount - countToLoad;
- startRowIndx = this._getRowIndex(normalTbl.rows[restCount].id);
+ startRowIndx = this._getRowIndex(frozenTbl.rows[restCount].id);
}
}
else {
@@ -402,7 +401,7 @@
if(countToLoad > 0) {
startIndex = range.start;
var restCount = this.rowsCount - countToLoad;
- startRowIndx = this._getRowIndex(normalTbl.rows[restCount].id);
+ startRowIndx = this._getRowIndex(frozenTbl.rows[restCount].id);
}
}
}
@@ -708,12 +707,12 @@
ensureVisible: function (index) {
if(index>=0 && index<this.grid.dataModel.getCount()) {
- var visibleRows = parseInt(this.contentBox.element.offsetHeight /
this.defaultRowHeight, 10) + 1;
+ var visibleRows = parseInt(this.contentBox.getHeight() / this.defaultRowHeight, 10) +
1;
if(this.grid.dataModel.getCount() > visibleRows) {
var y = index*this.defaultRowHeight;
this.scrollBox.getElement().scrollTop = y;
this.currentPos = 0;
- this._onContentVScroll({memo:{pos:y}});
+ this._onContentVScroll(this.scrollBox.getElement().scrollTop);
}
}
},
@@ -722,7 +721,7 @@
this.scrollBox.getElement().scrollTop = 0;
this.currRange.start = -this.rowsCount;
this.currRange.end = -1;
- this._onContentVScroll({memo:{pos:0}});
+ this._onContentVScroll(0);
},
_getRowIndex: function(rowId) {
return Number(rowId.split(this.grid.getElement().id)[1].split(":")[2]);
@@ -769,27 +768,6 @@
} else {
return 16;
}
- },
-
- restoreScrollState: function() {
- this.scrollInput = $(this.gridId + ":si");
- var value = this.scrollInput.value
- if(value !=''){
- var values = value.split(',');
- this.currentPos = values[0];
- this.scrollBox.getElement().scrollTop = values[0];
- this.currRange.start = values[1];
- this.currRange.end = values[2];
- var visibleRowPos = this.currRange.start * this.defaultRowHeight;
- this.templFrozen.moveToY(visibleRowPos);
- this.templNormal.moveToY(visibleRowPos);
- }
- },
-
- synchronizeScroll: function(event) {
- if(Event.KEY_TAB == event.keyCode || Event.KEY_TAB == event.charCode) {
- Event.stop(event);
- }
}
});
Modified:
branches/3.1.x/ui/scrollableDataTable/src/main/javascript/ClientUI/controls/grid/GridFooter.js
===================================================================
---
branches/3.1.x/ui/scrollableDataTable/src/main/javascript/ClientUI/controls/grid/GridFooter.js 2008-01-16
15:23:05 UTC (rev 5427)
+++
branches/3.1.x/ui/scrollableDataTable/src/main/javascript/ClientUI/controls/grid/GridFooter.js 2008-01-16
15:35:03 UTC (rev 5428)
@@ -67,8 +67,10 @@
throw(errMsg);
}
this.contentBox = new ClientUI.common.box.Box(normal);
+ this.contentBox.makeAbsolute();
this.frozenContentBox = new ClientUI.common.box.Box(frozen);
-
+ this.frozenContentBox.makeAbsolute();
+
// create row template
var ch = this.contentBox.getElement().firstChild;
while(ch) {
@@ -102,11 +104,11 @@
this.helpObj = new ClientUI.common.box.Box(this.frozenContentBox.getElement(), null,
true);
this.defaultWidth = this.grid.getHeader().defaultWidth;
- this.defaultHeight = this.headerRow.getElement().rows[0].cells[0].offsetHeight;
+ this.defaultHeight = Element.getHeight(this.headerRow.getElement().rows[0].cells[0]);
if(ClientUILib.isGecko) {
this.defaultHeight -= this.getBorderWidth("tb") +
this.getPadding("tb");
//this.defaultWidth -= this.getBorderWidth("lr") +
this.getPadding("lr");
- }
+ }
this.frozenSubstrate = new ClientUI.common.box.Box(this.grid.getElement().id +
":fs", this.getElement());
this.frozenSubstrate.getElement().name = this.getElement().id + "FRFrm";
@@ -115,7 +117,7 @@
},
updateSize: function() {
this.defaultWidth = this.grid.getHeader().defaultWidth;
- this.defaultHeight = this.headerRow.getElement().rows[0].cells[0].offsetHeight;
+ this.defaultHeight = Element.getHeight(this.headerRow.getElement().rows[0].cells[0]);
if(ClientUILib.isGecko) {
this.defaultHeight -= this.getBorderWidth("tb") +
this.getPadding("tb");
//this.defaultWidth -= this.getBorderWidth("lr") +
this.getPadding("lr");
@@ -129,7 +131,7 @@
}
$super();
- var height = this.element.offsetHeight;
+ var height = this.getHeight();
var totalWidth = this.grid.getColumnsTotalWidth();
var frozenContentWidth = this.grid.getColumnsFrozenWidth();
@@ -145,7 +147,6 @@
this.container.setWidth(viewWidth);
this.setWidth(viewWidth);
this.frozenSubstrate.setWidth(frozenContentWidth);
- this.setFakeColumnWidth();
},
adjustScrollPosition: function(pos) {
this.contentBox.moveToX(this.grid.getColumnsFrozenWidth()-pos);
Modified:
branches/3.1.x/ui/scrollableDataTable/src/main/javascript/ClientUI/controls/grid/GridHeader.js
===================================================================
---
branches/3.1.x/ui/scrollableDataTable/src/main/javascript/ClientUI/controls/grid/GridHeader.js 2008-01-16
15:23:05 UTC (rev 5427)
+++
branches/3.1.x/ui/scrollableDataTable/src/main/javascript/ClientUI/controls/grid/GridHeader.js 2008-01-16
15:35:03 UTC (rev 5428)
@@ -20,7 +20,7 @@
$super(template);
// register event handlers
- this.eventSepClick = this.OnSepClick.bindAsEventListener(this);
+ this.eventSepDblClick = this.OnSepDblClick.bindAsEventListener(this);
this.eventSepMouseDown = this.OnSepMouseDown.bindAsEventListener(this);
this.eventSepMouseUp = this.OnSepMouseUp.bindAsEventListener(this);
this.eventSepMouseMove = this.OnSepMouseMove.bindAsEventListener(this);
@@ -56,6 +56,7 @@
if(!template) {
return false;
}
+
var childs = template.childNodes;
for(var i=0; i<childs.length; i++) {
if(childs[i].tagName && childs[i].tagName.toLowerCase() == "div") {
@@ -82,8 +83,10 @@
throw(errMsg);
}
this.contentBox = new ClientUI.common.box.Box(normal);
+ this.contentBox.makeAbsolute();
this.frozenContentBox = new ClientUI.common.box.Box(frozen);
-
+ this.frozenContentBox.makeAbsolute();
+
// create row template
var ch = this.contentBox.getElement().firstChild;
while(ch) {
@@ -104,8 +107,7 @@
this.helpObj = new ClientUI.common.box.Box(this.frozenContentBox.getElement(), null,
true);
- var rows = this.headerFrozenRow.getElement().rows
- var fcount = rows.length?rows[0].cells.length:0;
+ var fcount = this.headerFrozenRow.getElement().rows[0].cells.length;
var ncount = this.headerRow.getElement().rows[0].cells.length;
var columns = new Array(fcount + ncount);
var defaultWidth = 0;
@@ -116,12 +118,11 @@
// Get columns information
var i = 0, h, j=0, cell;
var cols = this.headerFrozenRow.getElement().getElementsByTagName("col");
- this.frozenCells = fcount?this.headerFrozenRow.getElement().rows[0].cells:[];
+ var cells = this.headerFrozenRow.getElement().rows[0].cells;
var ids = this.grid.options.ids;
- var count = this.frozenCells.length;
+ var count = cells.length;
for(i=0; i<count; i++) {
- Utils.trace(i);
- cell = this.frozenCells[i];
+ cell = cells[i];
columns[j] = {
columnId: ids[i],
col: cols[i],
@@ -137,24 +138,20 @@
sortable: Validators.getBoolean(cell.getAttribute("sortable"), false),
sorted: Validators.getBoolean(cell.getAttribute("sorted"),
"desc")
};
- Utils.trace(i+"a");
if(columns[j].sortable)
Event.observe(cell, 'click', eventCellMouseDown);
- Utils.trace(i+"a1");
- h = cell.offsetHeight;
- Utils.trace(i+"a2");
+ h = Element.getHeight(cell);
if(h > defaultHeight) defaultHeight = h;
defaultWidth += columns[j].width;
columns[j].object = new ClientUI.common.box.InlineBox(cell, null, true);
- Utils.trace(i+"b");
var details = this._getCellElements(j);
// separator
columns[j].sep = new ClientUI.common.box.InlineBox(details[0], null, true);
columns[j].sep.getElement().columnIndex = j;
if(!columns[j].fixedWidth) {
- Event.observe(columns[j].sep.getElement(), 'click', this.eventSepClick);
+ Event.observe(columns[j].sep.getElement(), 'dblclick',
this.eventSepDblClick);
Event.observe(columns[j].sep.getElement(), 'mousedown',
this.eventSepMouseDown);
}
else {
@@ -165,14 +162,13 @@
//columns[j].sortDesc = new ClientUI.common.box.Box(details[1], null, true);
//columns[j].sortAsc = new ClientUI.common.box.Box(details[2], null, true);
j++;
- Utils.trace(i+"c");
}
cols = this.headerRow.getElement().getElementsByTagName("col");
- this.cells = this.headerRow.getElement().rows[0].cells;
- count = this.cells.length;
+ cells = this.headerRow.getElement().rows[0].cells;
+ count = cells.length;
for(i=0; i<count; i++) {
- cell = this.cells[i];
+ cell = cells[i];
columns[j] = {
columnId: ids[i],
@@ -187,12 +183,12 @@
frozen: false,
fixedWidth: Validators.getBoolean(cell.getAttribute("fixedWidth"), false),
sortable: Validators.getBoolean(cell.getAttribute("sortable"), false),
- sorted: null
+ sorted: Validators.getBoolean(cell.getAttribute("sorted"),
"desc")
};
if(columns[j].sortable)
Event.observe(cell, 'click', eventCellMouseDown);
- h = cell.offsetHeight;
+ h = Element.getHeight(cell);
if(h > defaultHeight) defaultHeight = h;
defaultWidth += columns[j].width;
columns[j].object = new ClientUI.common.box.InlineBox(cell, null, true);
@@ -203,7 +199,7 @@
columns[j].sep = new ClientUI.common.box.InlineBox(details[0], null, true);
columns[j].sep.getElement().columnIndex = j;
if(!columns[j].fixedWidth) {
- Event.observe(columns[j].sep.getElement(), 'click', this.eventSepClick);
+ Event.observe(columns[j].sep.getElement(), 'dblclick',
this.eventSepDblClick);
Event.observe(columns[j].sep.getElement(), 'mousedown',
this.eventSepMouseDown);
}
else {
@@ -227,8 +223,8 @@
this.frozenSubstrate = new ClientUI.common.box.Box(this.gridId + ":hs",
this.getElement());
this.frozenSubstrate.getElement().name = this.getElement().id + "HRFrm";
- this.frozenSubstrate.setHeight(this.headerRow.element.offsetHeight);
-
+ this.frozenSubstrate.setHeight(this.headerRow.getHeight());
+
return true;
},
_getCellElements: function(column) {
@@ -242,48 +238,50 @@
},
agjustSeparators: function() {
var i=0;
- var length = this.frozenCells.length;
+ var fcells = this.headerFrozenRow.getElement().rows[0].cells;
+ var ncells = this.headerRow.getElement().rows[0].cells;
+ var length = fcells.length;
var delta = 4;
- if (this.cells[0].offsetWidth == this.cells[0].clientWidth) {
+ if (ncells[0].offsetWidth == ncells[0].clientWidth) {
delta--;
}
for(var j=0; j<length; i++,j++) {
- this._columns[i].sep.moveToX(this.frozenCells[j].offsetLeft +
this.frozenCells[j].offsetWidth - delta);
+ this._columns[i].sep.moveToX(fcells[j].offsetLeft + fcells[j].offsetWidth - delta);
}
- var length = this.cells.length - 1;
+ var length = ncells.length - 1;
for(var j=0; j<length; i++,j++) {
- this._columns[i].sep.moveToX(this.cells[j].offsetLeft + this.cells[j].offsetWidth -
delta);
+ this._columns[i].sep.moveToX(ncells[j].offsetLeft + ncells[j].offsetWidth - delta);
}
},
updateSize: function() {
var defaultWidth = 0, defaultHeight = 0;
- var i = 0, h;
+ var i = 0, h, j=0;
var columns = this._columns;
var cols =
$A(this.headerFrozenRow.getElement().getElementsByTagName("col"));
- var count = this.frozenCells.length;
- for(j=0; j<count; j++) {
- cell = this.frozenCells[j];
+ var cells = $A(this.headerFrozenRow.getElement().rows[0].cells);
+ cells.each(function(cell) {
if(i<columns.length) {
columns[i].width = parseInt(cols[j].width);
- h = cell.offsetHeight;
+ h = Element.getHeight(cell);
if(h > defaultHeight) defaultHeight = h;
defaultWidth += columns[i].width;
}
- i++;
- }
+ i++;j++;
+ });
+
+ j=0;
cols = $A(this.headerRow.getElement().getElementsByTagName("col"));
- count = this.cells.length;
- for(j=0; j<count; j++) {
- cell = this.cells[j];
+ cells = $A(this.headerRow.getElement().rows[0].cells);
+ cells.each(function(cell) {
if(i<columns.length) {
columns[i].width = parseInt(cols[j].width);
- h = cell.offsetHeight;
+ h = Element.getHeight(cell);
if(h > defaultHeight) defaultHeight = h;
defaultWidth += columns[i].width;
}
- i++;
- }
+ i++;j++;
+ });
this.defaultHeight = defaultHeight;
this.defaultWidth = defaultWidth;
@@ -298,7 +296,7 @@
return;
}
$super();
- var height = this.element.offsetHeight;
+ var height = this.getHeight();
var totalWidth = this.grid.getColumnsTotalWidth();
var frozenContentWidth = this.grid.getColumnsFrozenWidth();
@@ -312,7 +310,6 @@
this.headerFrozenRow.setHeight(height);
this.frozenSubstrate.setWidth(frozenContentWidth);
this.updateHeaders();
- this.setFakeColumnWidth();
},
getColumns: function() {
return this._columns;
@@ -364,8 +361,8 @@
Event.stop(event);
}
},
- OnSepClick: function(event) {
- Event.stop(event);
+ OnSepDblClick: function(event) {
+ ClientUILib.log(ClientUILogger.INFO, "OnSepDblClick");
},
_showSplitter: function(index) {
if(!this.columnSplitter) {
@@ -378,7 +375,7 @@
}
this.dragColumnInfo.originalX = pos;
this.columnSplitter.show();
- this.columnSplitter.setHeight(this.defaultHeight +
this.grid.getBody().contentBox.element.offsetHeight);
+ this.columnSplitter.setHeight(this.defaultHeight +
this.grid.getBody().contentBox.getHeight());
this.columnSplitter.moveTo(pos, 0);
},
_hideSplitter: function() {
@@ -425,7 +422,9 @@
*/
var rows = this.grid.getBody().templFrozen.getElement().rows;
var startRow = rows && rows.length>0 ?
this.grid.getBody()._getRowIndex(rows[0].id) : 0;
- this.grid.element.fire("grid:onsort",{ column: index,
+ this.grid.eventOnSort.fire({
+ column: index,
+ /*order: dir,*/
startRow: startRow,
index: this.grid.getBody().currRange.start
});
@@ -438,12 +437,12 @@
var cols = this.getColumns();
for(var i = 0; i < cols.length; i++) {
var col = cols[i];
- var div = col.object.getElement().firstChild;
+ var th = col.object;
var icon = this._getCellElements(i)[1];
if (icon) {
- var newPosX = div.clientWidth - icon.getWidth();
- var newPosY = (div.clientHeight - icon.offsetHeight)/2;
+ var newPosX = th.getWidth() - icon.getWidth();
+ var newPosY = (th.getHeight() - icon.getHeight())/2;
newPosX = Math.floor(newPosX);
newPosY = Math.floor(newPosY);
Modified:
branches/3.1.x/ui/scrollableDataTable/src/main/javascript/ClientUI/controls/grid/ScrollableGrid.js
===================================================================
---
branches/3.1.x/ui/scrollableDataTable/src/main/javascript/ClientUI/controls/grid/ScrollableGrid.js 2008-01-16
15:23:05 UTC (rev 5427)
+++
branches/3.1.x/ui/scrollableDataTable/src/main/javascript/ClientUI/controls/grid/ScrollableGrid.js 2008-01-16
15:35:03 UTC (rev 5428)
@@ -7,6 +7,7 @@
this.options = options;
this.client_id = this.options.client_id;
this.rows_count = $(this.client_id + "_rows_input").value;
+ this.scroll_si = $(this.client_id + ":si");
this.columns_count = this.options.columnsCount;
this.splash_id = this.options.splash_id;
this.dataModel = new ClientUI.controls.grid.FakeArrayDataModel(this.rows_count,
this.columns_count, this.client_id);
@@ -16,36 +17,84 @@
{pane: GridLayout_Enum.BODY, ref: this.client_id +"_" +
"GridBodyTemplate"},
{pane: GridLayout_Enum.FOOTER, ref: this.client_id +"_" +
"GridFooterTemplate"}
];
- this.startCreateTime = (new Date()).getTime();
+ var grid = this;
+ var s = $super;
- $super(this.client_id, this.dataModel, this.templates);
-
- this.endCreateTime = (new Date()).getTime();
+ Event.onReady(function(){
+ grid.init(s);
+ });
+ Utils.execOnLoad(
+ function(){
+ grid.init(s);
+ },
+ Utils.Condition.ElementPresent(grid.client_id), 100);
- Event.observe(this.element, "grid:onsort",
this.onSorted.bindAsEventListener(this));
- if (this.options.selectionInput) {
- this.selectionManager = new ClientUI.controls.grid.SelectionManager(this);
- }
- this.getBody().restoreScrollState();
this.endInitTime = (new Date()).getTime();
this.rowCallbacks = [];
},
+
+// initialize parent Grid
+ init: function(superCtor){
+ // mark that grid control initialized
+ if(!this.isInitialized) {
+ this.isInitialized = true;
+ this.startCreateTime = (new Date()).getTime();
+
+ superCtor(this.client_id, this.dataModel, this.templates);
+
+ this.endCreateTime = (new Date()).getTime();
+
+ // suspend some processing
+ setTimeout(function() {
+ this.startPostProcessTime = (new Date()).getTime();
+
+ this.eventOnPostSort = new ClientUI.common.utils.CustomEvent('OnSort');
+ this.eventOnPostScroll = new ClientUI.common.utils.CustomEvent('OnScroll');
+
+ //var progress = new ClientUI.common.box.SplashBox(this.splash_id, null, 300, true);
+ //this.setProgressCtrl(progress);
+ Event.observe(this.eventOnSort, "on sort",
this.onSorted.bindAsEventListener(this));
+ if (this.options.selectionInput) {
+ this.selectionManager = new ClientUI.controls.grid.SelectionManager(this);
+ }
+
+ this.endPostProcessTime = (new Date()).getTime();
+ }.bind(this), 500);
+
+ if(this.scroll_si.value !=''){
+ var options = this.scroll_si.value.split(',');
+ this.restoreScrollState(options[0],options[1],options[2]);
+ }
+
+ var form = this.getForm($(this.client_id));
+ Event.observe(form,
"submit",this.restoreScrollPos.bindAsEventListener(this));
+ }
+ },
+
+ getForm: function(element){
+ var node = element;
+ if(node){
+ while(node.tagName.toUpperCase() != 'FORM'){
+ node = node.parentNode;
+ }
+ }
+
+ return node;
+ },
+
onSortComplete : function(request, event, data){
- this.dataModel.count = $(this.client_id + "_rows_input").value;
var options = request.getJSON("options");
Utils.AJAX.updateRows(options,request,
this,this.client_id,
[this.updateSelectionCallBack],
[function(){
this.selectionManager.restoreState();
- this.element.fire("grid:onpostsort",{column: options.column,
order:options.order});
+ this.eventOnPostSort.fire(options.column, options.order);
}]);
this.updateLayout();
- this.getBody().restoreScrollState();
},
onScrollComplete : function(request, event, data){
- this.dataModel.count = $(this.client_id + "_rows_input").value;
var options = this.dataModel.getCurrentOptions();
window.loadingServerTime = (new Date()).getTime();
Utils.AJAX.updateRows(options,request,
@@ -53,11 +102,9 @@
[this.updateSelectionCallBack],
[function(){
this.selectionManager.restoreState();
- this.element.fire("grid:onpostscroll",{start:this.getBody().currRange.start});
+ this.eventOnPostScroll.fire(this.getBody().currRange.start);
}]);
- this.updateLayout();
- this.getBody().restoreScrollState();
window.loadingEndTime = (new Date()).getTime();
// TODO: remove this time statistic logging
@@ -68,8 +115,8 @@
ClientUILib.log(ClientUILogger.WARNING, "...Selection mng time: " +
(window.loadingEndTime - window.loadingInvalidateTime));
},
- onSorted: function(event) {
- this.options.onSortAjaxUpdate(event.memo);
+ onSorted: function(sortEvent) {
+ this.options.onSortAjaxUpdate(sortEvent);
},
updateSelectionCallBack: function(argMap) {
@@ -104,5 +151,45 @@
this.getBody().hideColumn(index, frozen);
if(this.getFooter()) {this.getFooter().hideColumn(index, frozen);}
this.updateLayout();
+ },
+
+ restoreScrollState: function(scrollPos, start, end) {
+
+ var body = this.getBody();
+ body.scrollBox.getElement().scrollTop = scrollPos;
+ body.currentPos = scrollPos;
+ body.currRange.start = start;
+ body.currRange.end = end;
+ body._onContentVScroll(scrollPos);
+ var visibleRowPos = body.currRange.start * body.defaultRowHeight;
+ //setTimeout(function(){
+ body.templFrozen.moveToY(visibleRowPos);
+ body.templNormal.moveToY(visibleRowPos);
+ //}, 500);
+ },
+
+ getScrollPos: function() {
+ return this.getBody().currentPos;
+ },
+
+ restoreScrollPos: function(){
+ var body = this.getBody();
+ var start = body.currRange.start;
+ var end = body.currRange.end;
+ var index = this.getScrollPos();
+ this.scroll_si.value = index + "," + start + "," + end;
}
+});
+
+Object.extend(ClientUI.controls.grid.ScrollableGrid.prototype, {
+ /**
+ * Occured when scroll position adjusted
+ */
+ eventOnPostScroll: {},
+
+ /**
+ * Occured when sorting adjusted
+ */
+ eventOnPostSort: {}
+
});
\ No newline at end of file
Modified:
branches/3.1.x/ui/scrollableDataTable/src/main/javascript/ClientUI/controls/grid/Selection.js
===================================================================
---
branches/3.1.x/ui/scrollableDataTable/src/main/javascript/ClientUI/controls/grid/Selection.js 2008-01-16
15:23:05 UTC (rev 5427)
+++
branches/3.1.x/ui/scrollableDataTable/src/main/javascript/ClientUI/controls/grid/Selection.js 2008-01-16
15:35:03 UTC (rev 5428)
@@ -143,12 +143,13 @@
this.ranges = ranges;
},
- initRanges: function(rangeStrRArray) {
- if(rangeStrRArray.length == 0) {
+ initRanges: function(rangesStr) {
+ if(!rangesStr) {
this.ranges = [];
return;
}
- this.ranges = new Array(rangeStrRArray.length);
+ var rangeStrRArray = rangesStr.split(";");
+ this.ranges = new Array(rangeStrRArray.length -1);
var indexStrRArray;
for(var i = 0; i < this.ranges.length; i++) {
indexStrRArray = rangeStrRArray[i].split(",");
@@ -200,7 +201,6 @@
this.grid = grid;
this.selectionFlag;
this.firstIndex;
- this.activeRow = -1;
var gridElement = grid.getElement();
this.prefix = gridElement.id;
this.selection = new ClientUI.controls.grid.Selection();
@@ -214,13 +214,6 @@
this.setListeners();
this.eventKeyPress = this.processKeyDown.bindAsEventListener(this);
Event.observe(document, "keypress", this.eventKeyPress);
- A4J.AJAX.AddListener({
- onafterajax: function(req, event, data) {
- if(!$(this.prefix + ":n")) {
- Event.stopObserving(document, "keypress", this.eventKeyPress);
- }
- }.bind(this)
- });
if (document.selection) {
Event.observe(gridElement, "click",
this.resetSelection.bindAsEventListener(this));
}
@@ -246,15 +239,7 @@
restoreState: function() {
this.selectionFlag = null;
- var selStrAr = $(this.inputElement).value.split(";");
- if(selStrAr.length != 0) {
- var activeRowStr = selStrAr[selStrAr.length - 1];
- if(activeRowStr.indexOf(";") == -1) {
- this.setActiveRow(activeRowStr);
- selStrAr.pop();
- }
- }
- this.selection.initRanges(selStrAr);
+ this.selection.initRanges($(this.inputElement).value);
// this.firstIndex = Number($(this.prefix +
":f").rows[0].id.split(this.prefix)[1].split(":")[2]);;
var i = 0;
var j;
@@ -318,83 +303,81 @@
},
processKeyDown: function(event) {
- if ($(this.prefix + ":n").rows.length > 0) {
- if(!event.shiftKey) {
- this.shiftRow = null;
- }
- var range, rowIndex;
- var activeRow = this.activeRow;
- var noDefault = false;
- this.firstIndex = Number($(this.prefix +
":n").rows[0].id.split(this.prefix)[1].split(":")[2]);;
- switch (event.keyCode || event.charCode) {
- case Event.KEY_UP:
- if (this.inFocus && activeRow != null) {
- if(this.firstIndex != activeRow) {
- rowIndex = (this.rowCount + activeRow - 1) % this.rowCount;
- if (!event.ctrlKey && !event.shiftKey) {
- this.selectionFlag = "x";
- range = [rowIndex, rowIndex];
- this.setSelection(range);
- } else if (!event.ctrlKey && event.shiftKey) {
- if(!this.shiftRow) {
- this.shiftRow = this.activeRow;
- }
- if(this.shiftRow >= this.activeRow) {
- this.addRowToSelection(rowIndex);
- } else {
- this.removeRowFromSelection(activeRow);
- }
+ if(!event.shiftKey) {
+ this.shiftRow = null;
+ }
+ var range, rowIndex;
+ var activeRow = this.activeRow;
+ var noDefault = false;
+ this.firstIndex = Number($(this.prefix +
":n").rows[0].id.split(this.prefix)[1].split(":")[2]);;
+ switch (event.keyCode || event.charCode) {
+ case Event.KEY_UP:
+ if (this.inFocus && activeRow != null) {
+ if(this.firstIndex != activeRow) {
+ rowIndex = (this.rowCount + activeRow - 1) % this.rowCount;
+ if (!event.ctrlKey && !event.shiftKey) {
+ this.selectionFlag = "x";
+ range = [rowIndex, rowIndex];
+ this.setSelection(range);
+ } else if (!event.ctrlKey && event.shiftKey) {
+ if(!this.shiftRow) {
+ this.shiftRow = this.activeRow;
}
- noDefault = true;
- this.setActiveRow(rowIndex);
- } else {
- this.grid.getBody().showRow("up");
+ if(this.shiftRow >= this.activeRow) {
+ this.addRowToSelection(rowIndex);
+ } else {
+ this.removeRowFromSelection(activeRow);
+ }
}
+ noDefault = true;
+ this.setActiveRow(rowIndex);
+ } else {
+ this.grid.getBody().showRow("up");
}
- break;
- case Event.KEY_DOWN:
- if (this.inFocus && activeRow != null) {
- rowIndex = (activeRow + 1) % this.rowCount;
- if(this.firstIndex != rowIndex) {
- if (!event.ctrlKey && !event.shiftKey) {
- this.selectionFlag = "x";
- range = [rowIndex, rowIndex];
- this.setSelection(range);
- } else if (!event.ctrlKey && event.shiftKey) {
- if(!this.shiftRow) {
- this.shiftRow = this.activeRow;
- }
- if(this.shiftRow <= this.activeRow) {
- this.addRowToSelection(rowIndex);
- } else {
- this.removeRowFromSelection(activeRow);
- }
+ }
+ break;
+ case Event.KEY_DOWN:
+ if (this.inFocus && activeRow != null) {
+ rowIndex = (activeRow + 1) % this.rowCount;
+ if(this.firstIndex != rowIndex) {
+ if (!event.ctrlKey && !event.shiftKey) {
+ this.selectionFlag = "x";
+ range = [rowIndex, rowIndex];
+ this.setSelection(range);
+ } else if (!event.ctrlKey && event.shiftKey) {
+ if(!this.shiftRow) {
+ this.shiftRow = this.activeRow;
}
- noDefault = true;
- this.setActiveRow(rowIndex);
- } else {
- this.grid.getBody().showRow("down");
+ if(this.shiftRow <= this.activeRow) {
+ this.addRowToSelection(rowIndex);
+ } else {
+ this.removeRowFromSelection(activeRow);
+ }
}
- }
- break;
- case 65: case 97: // Ctrl-A
- if (this.inFocus && event.ctrlKey) {
- this.selectionFlag = "a";
- range = [0, this.rowCount];
- this.setSelection(range);
noDefault = true;
+ this.setActiveRow(rowIndex);
+ } else {
+ this.grid.getBody().showRow("down");
}
- break;
- case Event.KEY_TAB:
- this.lostFocus();
- }
- if (noDefault) {
- this.grid.getBody().showRow(this.activeRow);
- this.selectionChanged(event);
- if (event.preventBubble) event.preventBubble();
- Event.stop(event);
- }
+ }
+ break;
+ case 65: case 97: // Ctrl-A
+ if (this.inFocus && event.ctrlKey) {
+ this.selectionFlag = "a";
+ range = [0, this.rowCount];
+ this.setSelection(range);
+ noDefault = true;
+ }
+ break;
+ case Event.KEY_TAB:
+ this.lostFocus();
}
+ if (noDefault) {
+ this.grid.getBody().showRow(this.activeRow);
+ this.selectionChanged(event);
+ if (event.preventBubble) event.preventBubble();
+ Event.stop(event);
+ }
},
processClick: function(event, rowIndex) {
@@ -441,7 +424,7 @@
},
selectionChanged: function(event) {
- $(this.inputElement).value = this.selection.inspectRanges() + this.activeRow +
";" + (this.selectionFlag ? this.selectionFlag : "") ;
+ $(this.inputElement).value = this.selection.inspectRanges()+ (this.selectionFlag ?
this.selectionFlag : "") ;
var state = this.selection.getState();
event.oldSelection = this.oldState;
event.newSelection = state;
Modified:
branches/3.1.x/ui/scrollableDataTable/src/main/javascript/ClientUI/layouts/GridLayoutManager.js
===================================================================
---
branches/3.1.x/ui/scrollableDataTable/src/main/javascript/ClientUI/layouts/GridLayoutManager.js 2008-01-16
15:23:05 UTC (rev 5427)
+++
branches/3.1.x/ui/scrollableDataTable/src/main/javascript/ClientUI/layouts/GridLayoutManager.js 2008-01-16
15:35:03 UTC (rev 5428)
@@ -30,7 +30,7 @@
var parentBox = this.getContainer();
if(parentBox==null) parentBox = this;
- var height = parentBox.element.offsetHeight;
+ var height = parentBox.getHeight();
var width = parentBox.getViewportWidth();
// NOTE: not implemented in this class
@@ -41,7 +41,7 @@
// first get size of header
if(this.panels[GridLayout_Enum.HEADER]) {
- headerHeight = this.panels[GridLayout_Enum.HEADER].element.offsetHeight;
+ headerHeight = this.panels[GridLayout_Enum.HEADER].getHeight();
this.panels[GridLayout_Enum.HEADER].moveTo(0, 0);
this.panels[GridLayout_Enum.HEADER].setWidth(width);
this.panels[GridLayout_Enum.HEADER].updateLayout();
@@ -58,7 +58,7 @@
}
if(this.panels[GridLayout_Enum.FOOTER]) {
- footerHeight = this.panels[GridLayout_Enum.FOOTER].element.offsetHeight;
+ footerHeight = this.panels[GridLayout_Enum.FOOTER].getHeight();
this.panels[GridLayout_Enum.FOOTER].moveTo(0, bodyBottom - footerHeight);
this.panels[GridLayout_Enum.FOOTER].setWidth(width);
this.panels[GridLayout_Enum.FOOTER].updateLayout();
Modified:
branches/3.1.x/ui/scrollableDataTable/src/main/javascript/ClientUI/layouts/LayoutManager.js
===================================================================
---
branches/3.1.x/ui/scrollableDataTable/src/main/javascript/ClientUI/layouts/LayoutManager.js 2008-01-16
15:23:05 UTC (rev 5427)
+++
branches/3.1.x/ui/scrollableDataTable/src/main/javascript/ClientUI/layouts/LayoutManager.js 2008-01-16
15:35:03 UTC (rev 5428)
@@ -23,6 +23,10 @@
// declare event listeners
this.eventContainerResize = this.containerResize.bindAsEventListener(this);
+ // Create custom event producers
+ this.eventOnBeforeResize = new
ClientUI.common.utils.CustomEvent('OnBeforeResize');
+ this.eventOnAfterResize = new
ClientUI.common.utils.CustomEvent('OnAfterResize');
+
this.registerEvents();
},
registerEvents: function() {
@@ -32,12 +36,15 @@
Event.stopObserving(window, "resize", this.eventContainerResize);
},
containerResize: function(event) {
+ //Event.stop(event);
+ this.eventOnBeforeResize.fire();
this.updateLayout();
+ this.eventOnAfterResize.fire();
},
updateLayout: function($super) {
if(this.container) {
var w = this.container.getWidth();
- var h = this.container.element.offsetHeight;
+ var h = this.container.getHeight();
if(ClientUILib.isGecko) {
w -= this.container.getBorderWidth("lr") +
this.container.getPadding("lr");
h -= this.container.getBorderWidth("tb") +
this.container.getPadding("tb");
@@ -50,4 +57,18 @@
getContainer: function() {
return this.container;
}
+});
+
+Object.extend(ClientUI.layouts.LayoutManager.prototype, {
+
+ // Custom events
+ /**
+ * Occured before resizing
+ */
+ eventOnBeforeResize: {},
+ /**
+ * Occured after resizing
+ */
+ eventOnAfterResize: {}
+
});
\ No newline at end of file
Modified:
branches/3.1.x/ui/scrollableDataTable/src/main/javascript/ClientUI/layouts/VLayoutManager.js
===================================================================
---
branches/3.1.x/ui/scrollableDataTable/src/main/javascript/ClientUI/layouts/VLayoutManager.js 2008-01-16
15:23:05 UTC (rev 5427)
+++
branches/3.1.x/ui/scrollableDataTable/src/main/javascript/ClientUI/layouts/VLayoutManager.js 2008-01-16
15:35:03 UTC (rev 5428)
@@ -23,6 +23,10 @@
ClientUI.layouts.VLayoutManager = Class.create(ClientUI.layouts.LayoutManager, {
initialize: function($super, element, parentElement, config) {
$super(element, parentElement);
+ if(!element || !element.id) {
+ this.element.id = "ClientUI_VLayoutManager" +
ClientUI_layouts_VLayoutManager_idGenerator++;
+ }
+
this.registerEvents();
},
registerEvents: function($super) {
@@ -50,7 +54,7 @@
var parentBox = this.getContainer();
if(!parentBox) parentBox = this;
- var height = parentBox.element.offsetHeight;
+ var height = parentBox.getHeight();
var width = parentBox.getViewportWidth();
if(ClientUILib.isGecko) {
width -= parentBox.getBorderWidth("lr") +
parentBox.getPadding("lr");
@@ -64,13 +68,13 @@
// first get size of header
if(this.panels[GridLayout_Enum.HEADER]) {
- headerHeight = this.panels[GridLayout_Enum.HEADER].element.offsetHeight;
+ headerHeight = this.panels[GridLayout_Enum.HEADER].getHeight();
this.panels[GridLayout_Enum.HEADER].moveTo(0, 0);
this.panels[GridLayout_Enum.HEADER].setWidth(width);
this.panels[GridLayout_Enum.HEADER].updateLayout();
}
if(this.panels[GridLayout_Enum.FOOTER]) {
- footerHeight = this.panels[GridLayout_Enum.FOOTER].element.offsetHeight;
+ footerHeight = this.panels[GridLayout_Enum.FOOTER].getHeight();
this.panels[GridLayout_Enum.FOOTER].moveTo(0, height - footerHeight);
this.panels[GridLayout_Enum.FOOTER].setWidth(width);
this.panels[GridLayout_Enum.FOOTER].updateLayout();
Modified:
branches/3.1.x/ui/scrollableDataTable/src/main/resources/org/richfaces/renderkit/html/css/scrollable-data-table.xcss
===================================================================
---
branches/3.1.x/ui/scrollableDataTable/src/main/resources/org/richfaces/renderkit/html/css/scrollable-data-table.xcss 2008-01-16
15:23:05 UTC (rev 5427)
+++
branches/3.1.x/ui/scrollableDataTable/src/main/resources/org/richfaces/renderkit/html/css/scrollable-data-table.xcss 2008-01-16
15:35:03 UTC (rev 5428)
@@ -95,6 +95,8 @@
*/
.dr-sdt-hcbody {
white-space: nowrap;
+ position: relative;
+ display: block;
overflow: hidden;
width: 100%;
font-weight: normal;
@@ -149,6 +151,8 @@
font-weight: normal;
padding: 3px 5px;
white-space: nowrap;
+ position: relative;
+ display: block;
overflow: hidden;
}
@@ -157,6 +161,8 @@
font-weight: normal;
padding: 0px 0px;
white-space: nowrap;
+ position: relative;
+ display: block;
overflow: hidden;
width: 100%;
}
@@ -206,6 +212,9 @@
cursor: default;
font-weight: normal;
white-space: nowrap;
+ padding: 0px 0px;
+ position: relative;
+ display: block;
overflow: hidden;
-o-text-overflow: ellipsis;
text-overflow: ellipsis;
@@ -229,8 +238,7 @@
.dr-sdt-tmplbox {
display: block;
- float:left;
- position: absolute;
+ float:left;
}
.dr-sdt-inlinebox {
Modified:
branches/3.1.x/ui/scrollableDataTable/src/main/templates/org/richfaces/scrollable-data-table-footer-cell.jspx
===================================================================
---
branches/3.1.x/ui/scrollableDataTable/src/main/templates/org/richfaces/scrollable-data-table-footer-cell.jspx 2008-01-16
15:23:05 UTC (rev 5427)
+++
branches/3.1.x/ui/scrollableDataTable/src/main/templates/org/richfaces/scrollable-data-table-footer-cell.jspx 2008-01-16
15:35:03 UTC (rev 5428)
@@ -12,9 +12,11 @@
<th class="dr-sdt-fc rich-sdt-footer-cell #{footerColumnClass}
#{footerColumnSortClass} #{component.attributes['footerClass']}">
- <div id="#{client_id}:fc_#{cell_index}"
class="dr-sdt-fcbody1">
- <vcp:body/>
- </div>
+ <span id="#{client_id}:fc_#{cell_index}"
class="dr-sdt-fcbody1">
+ <span class="dr-sdt-fcbody">
+ <vcp:body/>
+ </span>
+ </span>
</th>
</f:root>
\ No newline at end of file
Modified:
branches/3.1.x/ui/scrollableDataTable/src/main/templates/org/richfaces/scrollable-data-table.jspx
===================================================================
---
branches/3.1.x/ui/scrollableDataTable/src/main/templates/org/richfaces/scrollable-data-table.jspx 2008-01-16
15:23:05 UTC (rev 5427)
+++
branches/3.1.x/ui/scrollableDataTable/src/main/templates/org/richfaces/scrollable-data-table.jspx 2008-01-16
15:35:03 UTC (rev 5428)
@@ -64,210 +64,174 @@
variables.setVariable("hStyle", hStyle);
]]>
</jsp:scriptlet>
-
- <table id="#{clientId}" cellpadding="0" cellspacing="0"
style="width: #{component.attributes['width']};height:
#{component.attributes['height']};" class="dr-sdt rich-sdt
#{component.attributes['styleClass']}" >
- <tbody>
- <jsp:scriptlet>
- <![CDATA[
- UIComponent facet = component.getFacet("header");
- if (null != facet && facet .isRendered()) {
- ]]>
- </jsp:scriptlet>
- <tr>
- <td>
- <u:insertFacet name="header" />
- </td>
- </tr>
- <jsp:scriptlet>
- <![CDATA[
- }
- ]]>
- </jsp:scriptlet>
- <tr>
- <td style="height: 100%;">
- <div id="#{clientId}:c" style="height: 100%; position:
relative;">
- <div id="#{clientId}:cs" class="dr-sdt-hsplit"
style="display: none;"/>
- <div id="#{clientId}_GridHeaderTemplate"
class="dr-sdt-inlinebox" style="#{hStyle}; width:
#{component.attributes['width']};">
- <iframe id="#{clientId}:hs" class="dr-sdt-substrate"
src="javascript:\'\'" scrolling="no" frameborder="0"
> <br/> </iframe>
- <div style="display: block; left: 0px; top: 0px; width:
#{sumWidth}px;">
- <span class="dr-sdt-tmplbox dr-sdt-fb"
id="#{clientId}:header:FrozenBox">
- <table cellpadding="0" cellspacing="0"
style="border-collapse:collapse; table-layout:fixed">
-
- <jsp:scriptlet>
- <![CDATA[
- renderCols(context, component, true);
- ]]>
- </jsp:scriptlet>
-
- <thead>
- <jsp:scriptlet>
- <![CDATA[
- renderHeaders(context, component, true);
- ]]>
- </jsp:scriptlet>
- </thead>
- </table>
- </span>
+
+
+ <div id="#{clientId}" style="width:
#{component.attributes['width']};height:
#{component.attributes['height']};" class="dr-sdt rich-sdt
#{component.attributes['styleClass']}" >
+ <div id="#{clientId}:cs" class="dr-sdt-hsplit"
style="display:none;"/>
+ <div id="#{clientId}_GridHeaderTemplate"
class="dr-sdt-inlinebox" style="#{hStyle}; width:
#{component.attributes['width']};">
+ <iframe id="#{clientId}:hs" class="dr-sdt-substrate"
src="" scrolling="no" frameborder="0" > <br/>
</iframe>
+ <div style="display: block; left: 0px; top: 0px; width:
#{sumWidth}px;">
+ <span class="dr-sdt-tmplbox dr-sdt-fb"
id="#{clientId}:header:FrozenBox">
+ <table cellpadding="0" cellspacing="0"
style="border-collapse:collapse; table-layout:fixed">
- <span class="dr-sdt-tmplbox dr-sdt-nb"
id="#{clientId}:header:NormalBox">
- <table cellpadding="0" cellspacing="0"
style="border-collapse:collapse; table-layout:fixed">
-
- <jsp:scriptlet>
- <![CDATA[
- renderCols(context, component, false);
- ]]>
- </jsp:scriptlet>
- <col width="1"/>
- <thead>
- <jsp:scriptlet>
- <![CDATA[
- renderHeaders(context, component, false);
- ]]>
- </jsp:scriptlet>
- </thead>
- </table>
- </span>
- </div>
- </div>
+ <jsp:scriptlet>
+ <![CDATA[
+ renderCols(context, component, true);
+ ]]>
+ </jsp:scriptlet>
+
+ <thead>
+ <tr class="dr-sdt-hr rich-std-header-row
#{component.attributes['headerClass']}">
+ <jsp:scriptlet>
+ <![CDATA[
+ renderHeaders(context, component, true);
+ ]]>
+ </jsp:scriptlet>
+ </tr>
+ </thead>
+ </table>
+ </span>
+
+ <span class="dr-sdt-tmplbox dr-sdt-nb"
id="#{clientId}:header:NormalBox">
+ <table cellpadding="0" cellspacing="0"
style="border-collapse:collapse; table-layout:fixed">
+
+ <jsp:scriptlet>
+ <![CDATA[
+ renderCols(context, component, false);
+ ]]>
+ </jsp:scriptlet>
+ <col width="1"/>
+ <thead>
+ <tr class="dr-sdt-hr rich-std-header-row
#{component.attributes['headerClass']}">
+ <jsp:scriptlet>
+ <![CDATA[
+ renderHeaders(context, component, false);
+ ]]>
+ </jsp:scriptlet>
+ <th></th>
+ </tr>
+ </thead>
+ </table>
+ </span>
+ </div>
+ </div>
+
+
+
+ <div id="#{clientId}_GridBodyTemplate" class="dr-sdt-inlinebox"
style="overflow: auto; width: #{component.attributes['width']}; height:
#{component.attributes['height']};">
+ <div id="#{clientId}:scb" style="position: absolute; z-index:
0;">
+ <div id="#{clientId}:sb" style="position: absolute;"
><br/> </div>
+ </div>
+ <div id="#{clientId}:bc" style="display: block; width:
#{sumWidth}px;">
+ <span class="dr-sdt-tmplbox dr-sdt-fb"
id="#{clientId}:body:FrozenBox">
+ <table id="#{clientId}:f" cellpadding="0"
cellspacing="0" style="border-collapse:collapse;
table-layout:fixed">
+ <jsp:scriptlet>
+ <![CDATA[
+ renderCols(context, component, true);
+ ]]>
+ </jsp:scriptlet>
+ <tbody>
+ <jsp:scriptlet>
+ <![CDATA[
+ renderGridBody(context, component, true);
+ ]]>
+ </jsp:scriptlet>
+ </tbody>
+ </table>
+ <span class="dr-sdt-ho" id="#{clientId}:fho"
><br/></span>
+ </span>
+ <span class="dr-sdt-tmplbox dr-sdt-nb"
id="#{clientId}:body:NormalBox">
+ <table id="#{clientId}:n" cellpadding="0"
cellspacing="0" style="border-collapse:collapse;
table-layout:fixed">
-
- <div id="#{clientId}_GridBodyTemplate"
class="dr-sdt-inlinebox" style="overflow: auto; width:
#{component.attributes['width']}; height:
#{component.attributes['height']};">
- <div id="#{clientId}:scb" style="position: absolute; z-index:
0;">
- <div id="#{clientId}:sb" style="position: absolute;"
><br/> </div>
- </div>
- <div id="#{clientId}:bc" style="display: block; width:
#{sumWidth}px;">
- <span class="dr-sdt-tmplbox dr-sdt-fb"
id="#{clientId}:body:FrozenBox">
- <table id="#{clientId}:f" cellpadding="0"
cellspacing="0" style="border-collapse:collapse;
table-layout:fixed">
-
- <jsp:scriptlet>
- <![CDATA[
- renderCols(context, component, true);
- ]]>
- </jsp:scriptlet>
- <tbody>
- <jsp:scriptlet>
- <![CDATA[
- renderGridBody(context, component, true);
- ]]>
- </jsp:scriptlet>
- </tbody>
- </table>
- <span class="dr-sdt-ho" id="#{clientId}:fho"
><br/></span>
- </span>
- <span class="dr-sdt-tmplbox dr-sdt-nb"
id="#{clientId}:body:NormalBox">
- <table id="#{clientId}:n" cellpadding="0"
cellspacing="0" style="border-collapse:collapse;
table-layout:fixed">
-
- <jsp:scriptlet>
- <![CDATA[
- renderCols(context, component, false);
- ]]>
- </jsp:scriptlet>
- <col width="1"/>
- <tbody>
- <jsp:scriptlet>
- <![CDATA[
- renderGridBody(context, component, false);
- ]]>
- </jsp:scriptlet>
- </tbody>
- </table>
- <span class="dr-sdt-ho" id="#{clientId}:nho"
><br/></span>
- </span>
- </div>
- </div>
-
- <div id="#{clientId}_GridFooterTemplate"
class="dr-sdt-inlinebox" style="#{fStyle}; width:
#{component.attributes['width']};">
- <iframe id="#{clientId}:fs" class="dr-sdt-substrate"
src="javascript:\'\'" scrolling="no" frameborder="0"
> <br/></iframe>
- <div style="display: block; width: width: #{sumWidth}px;">
- <span class="dr-sdt-tmplbox dr-sdt-fb"
id="#{clientId}:footer:FrozenBox">
- <table cellpadding="0" cellspacing="0"
style="border-collapse:collapse; table-layout:fixed">
-
- <jsp:scriptlet>
- <![CDATA[
- renderCols(context, component, true);
- ]]>
- </jsp:scriptlet>
- <tfoot>
- <tr class="dr-sdt-fr rich-std-footer-row
#{component.attributes['footerClass']}">
- <jsp:scriptlet>
- <![CDATA[
- renderFooters(context, component,true);
- ]]>
- </jsp:scriptlet>
- </tr>
- </tfoot>
- </table>
- </span>
-
- <span class="dr-sdt-tmplbox dr-sdt-nb"
id="#{clientId}:footer:NormalBox">
- <table cellpadding="0" cellspacing="0"
style="border-collapse:collapse; table-layout:fixed">
-
- <jsp:scriptlet>
- <![CDATA[
- renderCols(context, component, false);
- ]]>
- </jsp:scriptlet>
- <col width="1"/>
- <tfoot>
- <tr class="dr-sdt-fr rich-std-footer-row
#{component.attributes['footerClass']}">
- <jsp:scriptlet>
- <![CDATA[
- renderFooters(context, component,false);
- ]]>
- </jsp:scriptlet>
- <th class="dr-sdt-fc rich-sdt-footer-cell">
- <div class="dr-sdt-fcbody1" />
- </th>
- </tr>
- </tfoot>
- </table>
- </span>
- </div>
- </div>
-
- <input type="hidden" name="#{clientId}_hc"
id="#{clientId}_hc"/>
- <input type="hidden" name="#{clientId}_state_input"
id="#{clientId}_state_input"/>
- <input type="hidden" name="#{clientId}_options_input"
id="#{clientId}_options_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"/>
<jsp:scriptlet>
- <![CDATA[
- renderHiddenScrollInput(context, component);
+ <![CDATA[
+ renderCols(context, component, false);
]]>
- </jsp:scriptlet>
+ </jsp:scriptlet>
+ <col width="1"/>
+ <tbody>
+ <jsp:scriptlet>
+ <![CDATA[
+ renderGridBody(context, component, false);
+ ]]>
+ </jsp:scriptlet>
+ </tbody>
+ </table>
+ <span class="dr-sdt-ho" id="#{clientId}:nho"
><br/></span>
+ </span>
+ </div>
+ </div>
+
+ <div id="#{clientId}_GridFooterTemplate"
class="dr-sdt-inlinebox" style="#{fStyle}; width:
#{component.attributes['width']};">
+ <iframe id="#{clientId}:fs" class="dr-sdt-substrate"
src="" scrolling="no" frameborder="0" >
<br/></iframe>
+ <div style="display: block; width: width: #{sumWidth}px;">
+ <span class="dr-sdt-tmplbox dr-sdt-fb"
id="#{clientId}:footer:FrozenBox">
+ <table cellpadding="0" cellspacing="0"
style="border-collapse:collapse; table-layout:fixed">
- <f:call name="contributorsEncodeHere"/>
- <script id="#{clientId}_grid_create_scripts"
type="text/javascript">
- //<![CDATA[
-
- #{this:getJavaScriptVarName(context, component)} =
#{this:createClientScrollableGrid(context, component)};
- #{this:getScriptContributions(context, component)};
+ <jsp:scriptlet>
+ <![CDATA[
+ renderCols(context, component, true);
+ ]]>
+ </jsp:scriptlet>
+ <tfoot>
+ <tr class="dr-sdt-fr rich-std-footer-row
#{component.attributes['footerClass']}">
+ <jsp:scriptlet>
+ <![CDATA[
+ renderFooters(context, component,true);
+ ]]>
+ </jsp:scriptlet>
+ </tr>
+ </tfoot>
+ </table>
+ </span>
- // ]]>
- </script>
- <f:call name="tearDownState"/>
- </div>
- </td>
- </tr>
- <jsp:scriptlet>
- <![CDATA[
- facet = component.getFacet("footer");
- if (null != facet && facet .isRendered()) {
- ]]>
- </jsp:scriptlet>
- <tr>
- <td>
- <u:insertFacet name="footer" />
- </td>
- </tr>
- <jsp:scriptlet>
- <![CDATA[
- }
- ]]>
- </jsp:scriptlet>
- </tbody>
- </table>
+ <span class="dr-sdt-tmplbox dr-sdt-nb"
id="#{clientId}:footer:NormalBox">
+ <table cellpadding="0" cellspacing="0"
style="border-collapse:collapse; table-layout:fixed">
+
+ <jsp:scriptlet>
+ <![CDATA[
+ renderCols(context, component, false);
+ ]]>
+ </jsp:scriptlet>
+ <col width="1"/>
+ <tfoot>
+ <tr class="dr-sdt-fr rich-std-footer-row
#{component.attributes['footerClass']}">
+ <jsp:scriptlet>
+ <![CDATA[
+ renderFooters(context, component,false);
+ ]]>
+ </jsp:scriptlet>
+ <th></th>
+ </tr>
+ </tfoot>
+ </table>
+ </span>
+ </div>
+ </div>
+
+ <input type="hidden" name="#{clientId}_hc"
id="#{clientId}_hc"/>
+ <input type="hidden" name="#{clientId}_state_input"
id="#{clientId}_state_input"/>
+ <input type="hidden" name="#{clientId}_options_input"
id="#{clientId}_options_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"/>
+ <jsp:scriptlet>
+ <![CDATA[
+ renderHiddenScrollInput(context, component);
+ ]]>
+ </jsp:scriptlet>
+
+ <f:call name="contributorsEncodeHere"/>
+ <script id="#{clientId}_grid_create_scripts"
type="text/javascript">
+ //<![CDATA[
+
+ #{this:getJavaScriptVarName(context, component)} =
#{this:createClientScrollableGrid(context, component)};
+ #{this:getScriptContributions(context, component)};
+
+ // ]]>
+ </script>
+ <f:call name="tearDownState"/>
+ </div>
</f:root>
Modified:
branches/3.1.x/ui/scrollableDataTable/src/test/java/org/richfaces/renderkit/html/ScrollableDataTableRendererStateTest.java
===================================================================
---
branches/3.1.x/ui/scrollableDataTable/src/test/java/org/richfaces/renderkit/html/ScrollableDataTableRendererStateTest.java 2008-01-16
15:23:05 UTC (rev 5427)
+++
branches/3.1.x/ui/scrollableDataTable/src/test/java/org/richfaces/renderkit/html/ScrollableDataTableRendererStateTest.java 2008-01-16
15:35:03 UTC (rev 5428)
@@ -196,8 +196,7 @@
public void testRowClass() {
String rowClasses = "1,2,3";
state.setRowClasses(rowClasses);
- state.setRowIndex(1);
- assertEquals("2", state.getRowClass());
+ assertEquals("2", state.getRowClass(1));
}
public void testIds() {
Modified:
branches/3.1.x/ui/scrollableDataTable/src/test/java/org/richfaces/renderkit/html/ScrollableDataTableRendererTest.java
===================================================================
---
branches/3.1.x/ui/scrollableDataTable/src/test/java/org/richfaces/renderkit/html/ScrollableDataTableRendererTest.java 2008-01-16
15:23:05 UTC (rev 5427)
+++
branches/3.1.x/ui/scrollableDataTable/src/test/java/org/richfaces/renderkit/html/ScrollableDataTableRendererTest.java 2008-01-16
15:35:03 UTC (rev 5428)
@@ -35,7 +35,6 @@
javaScripts.add(PrototypeScript.class.getName());
javaScripts.add("org/richfaces/renderkit/html/scripts/scrollable-data-table.js");
- javaScripts.add("org/richfaces/renderkit/html/scripts/extend/extend.js");
}
public ScrollableDataTableRendererTest(String arg0) {
@@ -115,7 +114,7 @@
}
static final Set tagNames = new HashSet();
- static final String [] names = {"input","div","script",
"table", "tbody", "tr", "td", "thead",
"tfoot", "th"};
+ static final String [] names = {"input","div","script"};
static {
Collections.addAll(tagNames, names);
}
@@ -128,7 +127,7 @@
HtmlElement div = page.getHtmlElementById(grid.getClientId(facesContext));
assertNotNull(div);
- assertEquals("table", div.getNodeName());
+ assertEquals("div", div.getNodeName());
String classAttr = div.getAttributeValue("class");
assertTrue(classAttr.contains("dr-sdt"));