JBoss Rich Faces SVN: r4864 - branches/3.1.x/ui/scrollableDataTable/src/test/java/org/richfaces/renderkit/html.
by richfaces-svn-commits@lists.jboss.org
Author: nbelaevski
Date: 2007-12-14 13:04:49 -0500 (Fri, 14 Dec 2007)
New Revision: 4864
Modified:
branches/3.1.x/ui/scrollableDataTable/src/test/java/org/richfaces/renderkit/html/ScrollableDataTableRendererTest.java
Log:
Unit test for SDT updated
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 2007-12-14 17:35:12 UTC (rev 4863)
+++ branches/3.1.x/ui/scrollableDataTable/src/test/java/org/richfaces/renderkit/html/ScrollableDataTableRendererTest.java 2007-12-14 18:04:49 UTC (rev 4864)
@@ -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) {
18 years, 4 months
JBoss Rich Faces SVN: r4863 - trunk/cdk/maven-javascript-plugin/src/main/java/net/sf/alchim/mojo/yuicompressor.
by richfaces-svn-commits@lists.jboss.org
Author: alexsmirnov
Date: 2007-12-14 12:35:12 -0500 (Fri, 14 Dec 2007)
New Revision: 4863
Modified:
trunk/cdk/maven-javascript-plugin/src/main/java/net/sf/alchim/mojo/yuicompressor/YuiCompressorMojo.java
Log:
Fix http://jira.jboss.com/jira/browse/RF-1647 - close output file before rename.
Modified: trunk/cdk/maven-javascript-plugin/src/main/java/net/sf/alchim/mojo/yuicompressor/YuiCompressorMojo.java
===================================================================
--- trunk/cdk/maven-javascript-plugin/src/main/java/net/sf/alchim/mojo/yuicompressor/YuiCompressorMojo.java 2007-12-14 17:13:08 UTC (rev 4862)
+++ trunk/cdk/maven-javascript-plugin/src/main/java/net/sf/alchim/mojo/yuicompressor/YuiCompressorMojo.java 2007-12-14 17:35:12 UTC (rev 4863)
@@ -182,6 +182,8 @@
compressor.compress(out, linebreakpos);
}
getLog().debug("end compression");
+ // Close output file before rename.
+ IOUtil.close(out);out=null;
FileUtils.forceDelete(outFile);
FileUtils.rename(outFileTmp, outFile);
} finally {
18 years, 4 months
JBoss Rich Faces SVN: r4862 - in trunk/ui/scrollableDataTable: src/main/javascript/ClientUI/common/box and 3 other directories.
by richfaces-svn-commits@lists.jboss.org
Author: konstantin.mishin
Date: 2007-12-14 12:13:08 -0500 (Fri, 14 Dec 2007)
New Revision: 4862
Removed:
trunk/ui/scrollableDataTable/src/main/javascript/ClientUI/common/utils/CustomEvent.js
Modified:
trunk/ui/scrollableDataTable/generatescript.xml
trunk/ui/scrollableDataTable/src/main/javascript/ClientUI/common/box/ScrollableBox.js
trunk/ui/scrollableDataTable/src/main/javascript/ClientUI/common/utils/Utils.js
trunk/ui/scrollableDataTable/src/main/javascript/ClientUI/controls/grid/DataModel.js
trunk/ui/scrollableDataTable/src/main/javascript/ClientUI/controls/grid/GridBody.js
trunk/ui/scrollableDataTable/src/main/javascript/ClientUI/controls/grid/ScrollableGrid.js
trunk/ui/scrollableDataTable/src/main/javascript/ClientUI/layouts/LayoutManager.js
Log:
RF-1592
Modified: trunk/ui/scrollableDataTable/generatescript.xml
===================================================================
--- trunk/ui/scrollableDataTable/generatescript.xml 2007-12-14 17:01:43 UTC (rev 4861)
+++ trunk/ui/scrollableDataTable/generatescript.xml 2007-12-14 17:13:08 UTC (rev 4862)
@@ -27,7 +27,6 @@
<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"/>
@@ -61,7 +60,6 @@
<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"/>
Modified: trunk/ui/scrollableDataTable/src/main/javascript/ClientUI/common/box/ScrollableBox.js
===================================================================
--- trunk/ui/scrollableDataTable/src/main/javascript/ClientUI/common/box/ScrollableBox.js 2007-12-14 17:01:43 UTC (rev 4861)
+++ trunk/ui/scrollableDataTable/src/main/javascript/ClientUI/common/box/ScrollableBox.js 2007-12-14 17:13:08 UTC (rev 4862)
@@ -6,7 +6,6 @@
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.
@@ -18,10 +17,6 @@
$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);
},
@@ -34,13 +29,13 @@
// process horizontal scrolling
if(this.scrollLeft!==this.getViewportScrollX()) {
this.scrollLeft = this.getViewportScrollX();
- this.eventHScroll.fire(this.getViewportScrollX());
+ this.element.fire("grid:onhcroll", {pos:this.getViewportScrollX()});
}
// process vertical scrolling
if(this.scrollTop!==this.getViewportScrollY()) {
this.scrollTop = this.getViewportScrollY();
- this.eventVScroll.fire(this.getViewportScrollY());
+ this.element.fire("grid:onvcroll", {pos:this.getViewportScrollY()});
}
},
updateLayout: function($super) {
@@ -117,16 +112,4 @@
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
Deleted: trunk/ui/scrollableDataTable/src/main/javascript/ClientUI/common/utils/CustomEvent.js
===================================================================
--- trunk/ui/scrollableDataTable/src/main/javascript/ClientUI/common/utils/CustomEvent.js 2007-12-14 17:01:43 UTC (rev 4861)
+++ trunk/ui/scrollableDataTable/src/main/javascript/ClientUI/common/utils/CustomEvent.js 2007-12-14 17:13:08 UTC (rev 4862)
@@ -1,102 +0,0 @@
-/**
- * CustomEvent.js Date created: 6.04.2007
- * Copyright (c) 2007 Exadel Inc.
- * @author Denis Morozov <dmorozov(a)exadel.com>
- */
-ClientUILib.declarePackage("ClientUI.common.utils");
-
-if(!ClientUI.common.utils.CustomEvent) {
-ClientUILib.declarePackage("ClientUI.common.utils.CustomEvent");
-
-ClientUI.common.utils.CustomEvent = Class.create({
- // Constructor
- initialize: function(event) {
- this._eventName = event;
- // WARNING: If too many events will be in system with dynamic
- // observation/stop observation than integer idGenerator can be overflowed
- this._id = ClientUI_common_utils_CustomEvent_idGenerator++;
- },
- getName: function() {
- return this._eventName;
- },
- getId: function() {
- return this._id;
- },
-
- // Fire this event and notifies the subscribers.
- fire: function() {
- if (!Event.subscribers || !Event.subscribers.length) {
- return true;
- }
-
- var id = this.getId();
- var subscribers = Event.subscribers;
- var subscribersToNotify = Event.subscribers.findAll(
- function(subscriber) {
- return subscriber.event.getId()===id;
- });
-
- var args = $A(arguments);
- subscribersToNotify.unbreakableEach(function(subscriber) {
- subscriber.callback.apply(subscriber.callback, args);
- });
- }
-});
-
-Object.extend(ClientUI.common.utils.CustomEvent, {
- _eventName: 'undefined',
- _id: -1
-});
-
-Event._observe = Event.observe;
-Event.observe = function( element, name, observer, useCapture ) {
- if(element && element.getName && element.getId) {
- var customEvent = element;
- if (!this.subscribers) {
- this.subscribers = [];
- }
-
- this.subscribers.push({
- event: customEvent,
- desc: name,
- callback: observer
- });
- }
- else {
- Event._observe(element, name, observer, useCapture);
- }
-};
-
-Event._stopObserving = Event.stopObserving;
-Event.stopObserving = function( element, name, observer, useCapture ) {
- if(element && element.getName && element.getId) {
- var customEvent = element;
- if (this.subscribers && this.subscribers.length && this.subscribers.length!==0) {
- var id = customEvent.getId();
- this.subscribers = this.subscribers.select(
- function(subscriber) {
- return subscriber.event.getId()!==id;
- });
- }
- }
- else {
- Event._stopObserving(element, name, observer, useCapture);
- }
-};
-
-Event._unloadCache = Event.unloadCache;
-Event.unloadCache = function() {
- if (Event.subscribers) {
- for (var i = 0, length = Event.subscribers.length; i < length; i++) {
- Event.stopObserving.apply(this, Event.subscribers[i]);
- Event.subscribers[i][0] = null;
- }
- Event.subscribers = false;
- }
- Event._unloadCache();
-};
-
-var ClientUI_common_utils_CustomEvent_idGenerator = 0;
-
-};
-
\ No newline at end of file
Modified: trunk/ui/scrollableDataTable/src/main/javascript/ClientUI/common/utils/Utils.js
===================================================================
--- trunk/ui/scrollableDataTable/src/main/javascript/ClientUI/common/utils/Utils.js 2007-12-14 17:01:43 UTC (rev 4861)
+++ trunk/ui/scrollableDataTable/src/main/javascript/ClientUI/common/utils/Utils.js 2007-12-14 17:13:08 UTC (rev 4862)
@@ -255,7 +255,7 @@
}, 100);
}
- dataModel.eventDataReady.fire(localOptions);
+ grid.getBody()._onDataReady(localOptions);
}
}
};
Modified: trunk/ui/scrollableDataTable/src/main/javascript/ClientUI/controls/grid/DataModel.js
===================================================================
--- trunk/ui/scrollableDataTable/src/main/javascript/ClientUI/controls/grid/DataModel.js 2007-12-14 17:01:43 UTC (rev 4861)
+++ trunk/ui/scrollableDataTable/src/main/javascript/ClientUI/controls/grid/DataModel.js 2007-12-14 17:13:08 UTC (rev 4862)
@@ -5,8 +5,6 @@
*/
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.
@@ -16,7 +14,6 @@
initialize: function() {
// constructor
- this.eventDataReady = new ClientUI.common.utils.CustomEvent('DataModel::OnDataReady');
},
// interface method
@@ -38,9 +35,4 @@
getRequestDelay: function() {
return 1000;
}
-});
-
-Object.extend(ClientUI.controls.grid.DataModel.prototype, {
- eventDataReady: {}
-});
-
+});
Modified: trunk/ui/scrollableDataTable/src/main/javascript/ClientUI/controls/grid/GridBody.js
===================================================================
--- trunk/ui/scrollableDataTable/src/main/javascript/ClientUI/controls/grid/GridBody.js 2007-12-14 17:01:43 UTC (rev 4861)
+++ trunk/ui/scrollableDataTable/src/main/javascript/ClientUI/controls/grid/GridBody.js 2007-12-14 17:13:08 UTC (rev 4862)
@@ -24,26 +24,23 @@
$super(template);
// declare event listeners
- this._eventOnHScroll = this._onContentHScroll.bind(this);
- this._eventOnVScroll = this._onContentVScroll.bind(this);
- this._eventOnDataReady = this._onDataReady.bind(this);
+ this._eventOnHScroll = this._onContentHScroll.bindAsEventListener(this);
+ this._eventOnVScroll = this._onContentVScroll.bindAsEventListener(this);
this.createControl(template);
this.registerEvents();
},
registerEvents: function() {
- 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);
+ Event.observe(this.scrollBox.element, "grid:onhcroll", this._eventOnHScroll);
+ Event.observe(this.scrollBox.element, "grid:onvcroll", this._eventOnVScroll);
},
destroy: function() {
- 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.stopObserving(this.scrollBox.element, "grid:onhcroll", this._eventOnHScroll);
+ Event.stopObserving(this.scrollBox.element, "grid:onvcroll", this._eventOnVScroll);
},
// event listeners
- _onContentHScroll: function(xpos) {
- this.grid.adjustScrollPosition(xpos);
+ _onContentHScroll: function(event) {
+ this.grid.adjustScrollPosition(event.memo.pos);
},
_onDataReady: function(options) {
// load rows data
@@ -53,11 +50,11 @@
window.loadingInvalidateTime = (new Date()).getTime();
},
- _onContentVScroll: function(ypos) {
+ _onContentVScroll: function(event) {
this.helpObject1.moveToY(this.sizeBox.getHeight()+ this.defaultRowHeight + 5);
this.helpObject2.moveToY(this.sizeBox.getHeight()+ this.defaultRowHeight + 5);
- this.setScrollPos(ypos);
- this.adjustDataPosition(ypos);
+ this.setScrollPos(event.memo.pos);
+ this.adjustDataPosition(event.memo.pos);
},
createControl: function(template) {
this.scrollInput = $(this.gridId + ":si");
Modified: trunk/ui/scrollableDataTable/src/main/javascript/ClientUI/controls/grid/ScrollableGrid.js
===================================================================
--- trunk/ui/scrollableDataTable/src/main/javascript/ClientUI/controls/grid/ScrollableGrid.js 2007-12-14 17:01:43 UTC (rev 4861)
+++ trunk/ui/scrollableDataTable/src/main/javascript/ClientUI/controls/grid/ScrollableGrid.js 2007-12-14 17:13:08 UTC (rev 4862)
@@ -71,7 +71,7 @@
[this.updateSelectionCallBack],
[function(){
this.selectionManager.restoreState();
- this.element.fire("grid:onpostsort",{start:this.getBody().currRange.start});
+ this.element.fire("grid:onpostscroll",{start:this.getBody().currRange.start});
}]);
this.updateLayout();
Modified: trunk/ui/scrollableDataTable/src/main/javascript/ClientUI/layouts/LayoutManager.js
===================================================================
--- trunk/ui/scrollableDataTable/src/main/javascript/ClientUI/layouts/LayoutManager.js 2007-12-14 17:01:43 UTC (rev 4861)
+++ trunk/ui/scrollableDataTable/src/main/javascript/ClientUI/layouts/LayoutManager.js 2007-12-14 17:13:08 UTC (rev 4862)
@@ -23,10 +23,6 @@
// 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() {
@@ -36,10 +32,7 @@
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) {
@@ -57,18 +50,4 @@
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
18 years, 4 months
JBoss Rich Faces SVN: r4861 - trunk/sandbox/ui/columns.
by richfaces-svn-commits@lists.jboss.org
Author: andrei_exadel
Date: 2007-12-14 12:01:43 -0500 (Fri, 14 Dec 2007)
New Revision: 4861
Modified:
trunk/sandbox/ui/columns/pom.xml
Log:
RF-1202
Modified: trunk/sandbox/ui/columns/pom.xml
===================================================================
--- trunk/sandbox/ui/columns/pom.xml 2007-12-14 17:01:30 UTC (rev 4860)
+++ trunk/sandbox/ui/columns/pom.xml 2007-12-14 17:01:43 UTC (rev 4861)
@@ -51,6 +51,12 @@
<artifactId>dataTable</artifactId>
<version>3.2.0-SNAPSHOT</version>
<scope>test</scope>
- </dependency>
+ </dependency>
+ <dependency>
+ <groupId>el-impl</groupId>
+ <artifactId>el-impl</artifactId>
+ <version>1.0</version>
+ <scope>test</scope>
+ </dependency>
</dependencies>
</project>
\ No newline at end of file
18 years, 4 months
JBoss Rich Faces SVN: r4860 - in trunk/sandbox/ui/columns/src/test: java/org/richfaces and 11 other directories.
by richfaces-svn-commits@lists.jboss.org
Author: andrei_exadel
Date: 2007-12-14 12:01:30 -0500 (Fri, 14 Dec 2007)
New Revision: 4860
Added:
trunk/sandbox/ui/columns/src/test/java/org/richfaces/facelet/
trunk/sandbox/ui/columns/src/test/java/org/richfaces/facelet/FaceletTagTestCase.java
trunk/sandbox/ui/columns/src/test/java/org/richfaces/facelet/mock/
trunk/sandbox/ui/columns/src/test/java/org/richfaces/facelet/mock/MockHttpServletRequest.java
trunk/sandbox/ui/columns/src/test/java/org/richfaces/facelet/mock/MockHttpServletResponse.java
trunk/sandbox/ui/columns/src/test/java/org/richfaces/facelet/mock/MockHttpSession.java
trunk/sandbox/ui/columns/src/test/java/org/richfaces/facelet/mock/MockRequestDispatcher.java
trunk/sandbox/ui/columns/src/test/java/org/richfaces/facelet/mock/MockResponseWriter.java
trunk/sandbox/ui/columns/src/test/java/org/richfaces/facelet/mock/MockServletContext.java
trunk/sandbox/ui/columns/src/test/java/org/richfaces/facelet/mock/MockServletInputStream.java
trunk/sandbox/ui/columns/src/test/java/org/richfaces/facelet/mock/MockServletOutputStream.java
trunk/sandbox/ui/columns/src/test/java/org/richfaces/facelet/tag/
trunk/sandbox/ui/columns/src/test/java/org/richfaces/facelet/tag/ColumnsFaceletTagTest.java
trunk/sandbox/ui/columns/src/test/java/org/richfaces/jsp/
trunk/sandbox/ui/columns/src/test/java/org/richfaces/jsp/mock/
trunk/sandbox/ui/columns/src/test/java/org/richfaces/jsp/mock/DataTableTagMock.java
trunk/sandbox/ui/columns/src/test/java/org/richfaces/jsp/mock/ELContextMock.java
trunk/sandbox/ui/columns/src/test/java/org/richfaces/jsp/mock/PageContextMock.java
trunk/sandbox/ui/columns/src/test/java/org/richfaces/jsp/mock/ValueExpressionMock.java
trunk/sandbox/ui/columns/src/test/java/org/richfaces/jsp/tag/
trunk/sandbox/ui/columns/src/test/java/org/richfaces/jsp/tag/ColumnsJspTagTest.java
trunk/sandbox/ui/columns/src/test/resources/
trunk/sandbox/ui/columns/src/test/resources/org/
trunk/sandbox/ui/columns/src/test/resources/org/richfaces/
trunk/sandbox/ui/columns/src/test/resources/org/richfaces/facelet/
trunk/sandbox/ui/columns/src/test/resources/org/richfaces/facelet/tag/
trunk/sandbox/ui/columns/src/test/resources/org/richfaces/facelet/tag/columns.xml
Removed:
trunk/sandbox/ui/columns/src/test/java/org/richfaces/component/
trunk/sandbox/ui/columns/src/test/java/org/richfaces/facelet/tag/JSFComponentTest.java
Log:
RF-1202
Added: trunk/sandbox/ui/columns/src/test/java/org/richfaces/facelet/FaceletTagTestCase.java
===================================================================
--- trunk/sandbox/ui/columns/src/test/java/org/richfaces/facelet/FaceletTagTestCase.java (rev 0)
+++ trunk/sandbox/ui/columns/src/test/java/org/richfaces/facelet/FaceletTagTestCase.java 2007-12-14 17:01:30 UTC (rev 4860)
@@ -0,0 +1,185 @@
+/**
+ * Copyright 2005 Sun Microsystems, Inc. All rights reserved.
+ * Licensed under the Common Development and Distribution License,
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.sun.com/cddl/
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * permissions and limitations under the License.
+ */
+
+package org.richfaces.facelet;
+
+import java.io.FileNotFoundException;
+import java.io.OutputStream;
+import java.io.StringWriter;
+import java.net.URI;
+import java.net.URL;
+
+import javax.faces.FacesException;
+import javax.faces.FactoryFinder;
+import javax.faces.application.ApplicationFactory;
+import javax.faces.context.FacesContext;
+import javax.faces.context.FacesContextFactory;
+import javax.faces.context.ResponseWriter;
+import javax.faces.lifecycle.LifecycleFactory;
+import javax.servlet.ServletContext;
+import javax.servlet.ServletContextEvent;
+import javax.servlet.ServletContextListener;
+
+import junit.framework.TestCase;
+
+import org.richfaces.facelet.mock.MockHttpServletRequest;
+import org.richfaces.facelet.mock.MockHttpServletResponse;
+import org.richfaces.facelet.mock.MockServletContext;
+
+import com.sun.facelets.FaceletFactory;
+import com.sun.facelets.compiler.Compiler;
+import com.sun.facelets.compiler.SAXCompiler;
+import com.sun.facelets.impl.DefaultFaceletFactory;
+import com.sun.facelets.impl.ResourceResolver;
+
+public abstract class FaceletTagTestCase extends TestCase implements ResourceResolver {
+
+private final String filePath = this.getDirectory();
+
+private final URI base = this.getContext();
+
+protected MockServletContext servletContext;
+
+protected MockHttpServletRequest servletRequest;
+
+protected MockHttpServletResponse servletResponse;
+
+private ApplicationFactory factoryApplication;
+
+private FacesContextFactory factoryFacesContext;
+
+private LifecycleFactory factoryLifecycle;
+
+private boolean initialized = false;
+
+protected URI getContext() {
+ try {
+ ClassLoader cl = Thread.currentThread().getContextClassLoader();
+ URL url = cl.getResource(this.filePath);
+ System.out.println(new URI(url.toString()));
+ if (url == null) {
+ throw new FileNotFoundException(cl.getResource("").getFile()
+ + this.filePath + " was not found");
+ } else {
+ return new URI(url.toString());
+ }
+ } catch (Exception e) {
+ throw new RuntimeException("Error Initializing Context", e);
+ }
+}
+
+protected URL getLocalFile(String name) throws FileNotFoundException {
+ ClassLoader cl = Thread.currentThread().getContextClassLoader();
+ URL url = cl.getResource(this.filePath + "/" + name);
+ if (url == null) {
+ throw new FileNotFoundException(cl.getResource("").getFile() + name
+ + " was not found");
+ }
+ return url;
+}
+
+private String getDirectory() {
+ return this.getClass().getName().substring(0,
+ this.getClass().getName().lastIndexOf('.')).replace('.', '/') + "/";
+}
+
+protected void setUp() throws Exception {
+ super.setUp();
+ URI context = this.getContext();
+ System.out.println(context.getPath());
+ this.servletContext = new MockServletContext(context);
+ this.servletRequest = new MockHttpServletRequest(this.servletContext,
+ context);
+ this.servletResponse = new MockHttpServletResponse();
+
+ // initialize Faces
+ this.initFaces();
+
+ FacesContext faces = this.factoryFacesContext.getFacesContext(this.servletContext,
+ this.servletRequest, this.servletResponse,
+ this.factoryLifecycle
+ .getLifecycle(LifecycleFactory.DEFAULT_LIFECYCLE));
+
+
+ Compiler c = new SAXCompiler();
+ //c.setTrimmingWhitespace(true);
+ FaceletFactory factory = new DefaultFaceletFactory(c, this);
+ FaceletFactory.setInstance(factory);
+
+ faces.setViewRoot(faces.getApplication().getViewHandler().createView(faces, "/test"));
+
+ ResponseWriter rw = faces.getRenderKit().createResponseWriter(new StringWriter(), null, null);
+ faces.setResponseWriter(rw);
+}
+
+public void setRequest(String method, String path, OutputStream os) {
+ this.servletRequest = new MockHttpServletRequest(this.servletContext, method, path);
+ //this.servletResponse = new MockHttpServletResponse(os);
+ this.factoryFacesContext.getFacesContext(this.servletContext,
+ this.servletRequest, this.servletResponse,
+ this.factoryLifecycle
+ .getLifecycle(LifecycleFactory.DEFAULT_LIFECYCLE));
+}
+
+private void initFaces() throws Exception {
+ if (!this.initialized) {
+ this.initialized = true;
+ this.initFacesListener(this.servletContext);
+ this.factoryApplication = (ApplicationFactory) FactoryFinder
+ .getFactory(FactoryFinder.APPLICATION_FACTORY);
+ this.factoryFacesContext = (FacesContextFactory) FactoryFinder
+ .getFactory(FactoryFinder.FACES_CONTEXT_FACTORY);
+ this.factoryLifecycle = (LifecycleFactory) FactoryFinder
+ .getFactory(FactoryFinder.LIFECYCLE_FACTORY);
+
+ /*
+ Application application = this.factoryApplication.getApplication();
+ application.setViewHandler(new FaceletViewHandler(application
+ .getViewHandler()));
+ */
+ }
+}
+
+protected void initFacesListener(ServletContext context) throws Exception {
+ ServletContextListener listener;
+ Class type;
+ try {
+ type = Class.forName("com.sun.faces.config.ConfigureListener");
+ } catch (ClassNotFoundException e) {
+ try {
+ type = Class.forName("");
+ } catch (ClassNotFoundException e2) {
+ throw new FileNotFoundException(
+ "Either JSF-RI or MyFaces needs to be on the classpath with their supported Jars");
+ }
+ }
+ listener = (ServletContextListener) type.newInstance();
+ listener.contextInitialized(new ServletContextEvent(context));
+}
+
+protected void tearDown() throws Exception {
+ super.tearDown();
+ this.servletContext = null;
+}
+
+public URL resolveUrl(String path) {
+ try {
+ return new URL(this.getContext().toURL(), path.substring(1));
+ } catch (Exception e) {
+ throw new FacesException(e);
+ }
+}
+
+}
Added: trunk/sandbox/ui/columns/src/test/java/org/richfaces/facelet/mock/MockHttpServletRequest.java
===================================================================
--- trunk/sandbox/ui/columns/src/test/java/org/richfaces/facelet/mock/MockHttpServletRequest.java (rev 0)
+++ trunk/sandbox/ui/columns/src/test/java/org/richfaces/facelet/mock/MockHttpServletRequest.java 2007-12-14 17:01:30 UTC (rev 4860)
@@ -0,0 +1,399 @@
+/**
+ * Copyright 2005 Sun Microsystems, Inc. All rights reserved.
+ * Licensed under the Common Development and Distribution License,
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.sun.com/cddl/
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * permissions and limitations under the License.
+ */
+
+package org.richfaces.facelet.mock;
+
+import java.io.BufferedReader;
+import java.io.IOException;
+import java.io.InputStreamReader;
+import java.io.Reader;
+import java.io.UnsupportedEncodingException;
+import java.net.URI;
+import java.security.Principal;
+import java.text.DateFormat;
+import java.text.ParseException;
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.Enumeration;
+import java.util.Hashtable;
+import java.util.List;
+import java.util.Locale;
+import java.util.Map;
+import java.util.Properties;
+import java.util.Vector;
+
+import javax.servlet.RequestDispatcher;
+import javax.servlet.ServletContext;
+import javax.servlet.ServletInputStream;
+import javax.servlet.http.Cookie;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpSession;
+
+import org.ajax4jsf.tests.facelet.mock.MockHttpSession;
+import org.ajax4jsf.tests.facelet.mock.MockServletInputStream;
+
+/**
+ *
+ * @author Jacob Hookom
+ * @version $Id: MockHttpServletRequest.java,v 1.2 2005/12/21 05:51:05 jhook Exp $
+ */
+public class MockHttpServletRequest implements HttpServletRequest {
+
+ private final ServletContext servletContext;
+
+ private final URI uri;
+
+ private final String method;
+
+ private Cookie[] cookies = new Cookie[0];
+
+ private final Hashtable headers = new Hashtable();
+
+ private String remoteUser;
+
+ private String servletPath;
+
+ private HttpSession session;
+
+ private final Hashtable attributes = new Hashtable();
+
+ private final Properties param = new Properties();
+
+ private String characterEncoding = "ISO-8859-1";
+
+ private String contentType = "text/html";
+
+ private int contentLength = 0;
+
+ private String protocol = "HTTP/1.1";
+
+ private String localName = "localhost";
+
+ private int localPort = 80;
+
+ private String remoteAddr = "127.0.0.1";
+
+ private String remoteHost = "localhost";
+
+ private Locale locale = Locale.getDefault();
+
+ private Vector locales = new Vector(Arrays.asList(Locale
+ .getAvailableLocales()));
+
+ private boolean secure = false;
+
+ private int remotePort = 1024;
+
+ private String localAddr = "127.0.0.1";
+
+ private ServletInputStream inputStream = new MockServletInputStream();
+
+ public MockHttpServletRequest(ServletContext servletContext, URI uri) {
+ this(servletContext, "GET", uri);
+ }
+
+ public MockHttpServletRequest(ServletContext servletContext, String uri) {
+ this(servletContext, "GET", uri);
+ }
+
+ public MockHttpServletRequest(ServletContext servletContext, String method,
+ String uri) {
+ this(servletContext, method, URI.create(uri));
+ }
+
+ public MockHttpServletRequest(ServletContext servletContext, String method,
+ URI uri) {
+ this.servletContext = servletContext;
+ this.uri = uri;
+ this.method = method;
+
+ String q = this.uri.getRawQuery();
+ if (q != null) {
+ String[] p = q.split("(&|=)");
+ for (int i = 0; i < p.length; i += 2) {
+ this.param.put(p[i], p[i + 1]);
+ }
+ }
+ }
+
+ public String getAuthType() {
+ return BASIC_AUTH;
+ }
+
+ public Cookie[] getCookies() {
+ return this.cookies;
+ }
+
+ public long getDateHeader(String name) {
+ String hdr = this.getHeader(name);
+ if (hdr != null) {
+ try {
+ return DateFormat.getDateInstance(DateFormat.FULL).parse(hdr)
+ .getTime();
+ } catch (ParseException e) {
+ throw new IllegalArgumentException("Header " + name + ": "
+ + hdr);
+ }
+ }
+ return -1;
+ }
+
+ public String getHeader(String name) {
+ Object obj = this.headers.get(name);
+ if (obj instanceof List) {
+ return ((List) obj).get(0).toString();
+ } else if (obj instanceof String) {
+ return (String) obj;
+ }
+ return null;
+ }
+
+ public Enumeration getHeaders(String name) {
+ Object obj = this.headers.get(name);
+ if (obj instanceof Vector) {
+ return ((Vector) obj).elements();
+ } else if (obj instanceof String) {
+ Vector v = new Vector();
+ v.add(obj);
+ return v.elements();
+ }
+ return null;
+ }
+
+ public Enumeration getHeaderNames() {
+ return this.headers.keys();
+ }
+
+ public int getIntHeader(String name) {
+ String hdr = this.getHeader(name);
+ if (hdr != null) {
+ try {
+ return Integer.parseInt(hdr);
+ } catch (Exception e) {
+ throw new IllegalArgumentException("Header " + name + ": "
+ + hdr);
+ }
+ }
+ return -1;
+ }
+
+ public String getMethod() {
+ return this.method;
+ }
+
+ public String getPathInfo() {
+ return this.uri.getPath();
+ }
+
+ public String getPathTranslated() {
+ return this.servletContext.getRealPath(this.uri.getPath());
+ }
+
+ public String getContextPath() {
+ return this.uri.getPath();
+ }
+
+ public String getQueryString() {
+ return this.uri.getQuery();
+ }
+
+ public String getRemoteUser() {
+ return this.remoteUser;
+ }
+
+ public boolean isUserInRole(String role) {
+ throw new UnsupportedOperationException();
+ }
+
+ public Principal getUserPrincipal() {
+ throw new UnsupportedOperationException();
+ }
+
+ public String getRequestedSessionId() {
+ return this.getParameter("jsessionid");
+ }
+
+ public String getRequestURI() {
+ return this.uri.getPath();
+ }
+
+ public StringBuffer getRequestURL() {
+ return new StringBuffer(this.uri.toString());
+ }
+
+ public String getServletPath() {
+ return this.servletPath;
+ }
+
+ public HttpSession getSession(boolean create) {
+ if (this.session == null && create) {
+ this.session = new MockHttpSession(this.servletContext);
+ }
+ return this.session;
+ }
+
+ public HttpSession getSession() {
+ return this.getSession(true);
+ }
+
+ public boolean isRequestedSessionIdValid() {
+ throw new UnsupportedOperationException();
+ }
+
+ public boolean isRequestedSessionIdFromCookie() {
+ throw new UnsupportedOperationException();
+ }
+
+ public boolean isRequestedSessionIdFromURL() {
+ throw new UnsupportedOperationException();
+ }
+
+ public boolean isRequestedSessionIdFromUrl() {
+ throw new UnsupportedOperationException();
+ }
+
+ public Object getAttribute(String name) {
+ return this.attributes.get(name);
+ }
+
+ public Enumeration getAttributeNames() {
+ return this.attributes.keys();
+ }
+
+ public String getCharacterEncoding() {
+ return this.characterEncoding;
+ }
+
+ public void setCharacterEncoding(String characterEncoding)
+ throws UnsupportedEncodingException {
+ this.characterEncoding = characterEncoding;
+ }
+
+ public int getContentLength() {
+ return this.contentLength;
+ }
+
+ public String getContentType() {
+ return this.contentType;
+ }
+
+ public ServletInputStream getInputStream() throws IOException {
+ return this.inputStream;
+ }
+
+ public String getParameter(String name) {
+ return this.param.getProperty(name);
+ }
+
+ public Enumeration getParameterNames() {
+ return this.param.keys();
+ }
+
+ public String[] getParameterValues(String name) {
+ String p = this.param.getProperty(name);
+ if (p != null) {
+ return p.split(",");
+ }
+ return null;
+ }
+
+ public void setParameter(String name, String value) {
+ this.param.put(name, value);
+ }
+
+ public Map getParameterMap() {
+ return Collections.unmodifiableMap(this.param);
+ }
+
+ public String getProtocol() {
+ return this.protocol;
+ }
+
+ public String getScheme() {
+ return this.uri.getScheme();
+ }
+
+ public String getServerName() {
+ return this.localName;
+ }
+
+ public int getServerPort() {
+ return this.localPort;
+ }
+
+ public BufferedReader getReader() throws IOException {
+ if (this.inputStream != null) {
+ Reader sourceReader = (this.characterEncoding != null) ? new InputStreamReader(
+ this.inputStream, this.characterEncoding)
+ : new InputStreamReader(this.inputStream);
+ return new BufferedReader(sourceReader);
+ } else {
+ return null;
+ }
+ }
+
+ public String getRemoteAddr() {
+ return this.remoteAddr;
+ }
+
+ public String getRemoteHost() {
+ return this.remoteHost;
+ }
+
+ public void setAttribute(String name, Object value) {
+ this.attributes.put(name, value);
+ }
+
+ public void removeAttribute(String name) {
+ this.attributes.remove(name);
+ }
+
+ public Locale getLocale() {
+ return this.locale;
+ }
+
+ public Enumeration getLocales() {
+ return this.locales.elements();
+ }
+
+ public boolean isSecure() {
+ return this.secure;
+ }
+
+ public RequestDispatcher getRequestDispatcher(String path) {
+ return this.servletContext.getRequestDispatcher(path);
+ }
+
+ public String getRealPath(String path) {
+ return this.servletContext.getRealPath(path);
+ }
+
+ public int getRemotePort() {
+ return this.remotePort;
+ }
+
+ public String getLocalName() {
+ return this.localName;
+ }
+
+ public String getLocalAddr() {
+ return this.localAddr;
+ }
+
+ public int getLocalPort() {
+ return this.localPort;
+ }
+
+}
Added: trunk/sandbox/ui/columns/src/test/java/org/richfaces/facelet/mock/MockHttpServletResponse.java
===================================================================
--- trunk/sandbox/ui/columns/src/test/java/org/richfaces/facelet/mock/MockHttpServletResponse.java (rev 0)
+++ trunk/sandbox/ui/columns/src/test/java/org/richfaces/facelet/mock/MockHttpServletResponse.java 2007-12-14 17:01:30 UTC (rev 4860)
@@ -0,0 +1,193 @@
+/**
+ * Copyright 2005 Sun Microsystems, Inc. All rights reserved.
+ * Licensed under the Common Development and Distribution License,
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.sun.com/cddl/
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * permissions and limitations under the License.
+ */
+
+package org.richfaces.facelet.mock;
+
+import java.io.IOException;
+import java.io.PrintWriter;
+import java.util.Hashtable;
+import java.util.Locale;
+
+import javax.servlet.ServletOutputStream;
+import javax.servlet.http.Cookie;
+import javax.servlet.http.HttpServletResponse;
+
+/**
+ *
+ * @author Jacob Hookom
+ * @version $Id: MockHttpServletResponse.java,v 1.2 2005/07/19 00:49:01 jhook Exp $
+ */
+public class MockHttpServletResponse implements HttpServletResponse {
+
+ private boolean committed = false;
+ private int status;
+ private String message;
+ private Hashtable headers = new Hashtable();
+ private String characterEncoding = "ISO-8859-1";
+ private String contentType = "text/html";
+ private long contentLength = 0;
+ private int bufferSize = 0;
+ private Locale locale = Locale.getDefault();
+
+ public MockHttpServletResponse() {
+ super();
+ }
+
+ public void addCookie(Cookie cookie) {
+ // TODO Auto-generated method stub
+
+ }
+
+ public boolean containsHeader(String name) {
+ return this.headers.contains(name);
+ }
+
+ public String encodeURL(String url) {
+ return url;
+ }
+
+ public String encodeRedirectURL(String url) {
+ return url;
+ }
+
+ public String encodeUrl(String url) {
+ return url;
+ }
+
+ public String encodeRedirectUrl(String url) {
+ return this.encodeRedirectURL(url);
+ }
+
+ public void sendError(int status, String message) throws IOException {
+ if (this.committed) {
+ throw new IllegalStateException("Response is already committed");
+ }
+ this.status = status;
+ this.message = message;
+ this.committed = true;
+ }
+
+ public void sendError(int status) throws IOException {
+ if (this.committed) {
+ throw new IllegalStateException("Response is already committed");
+ }
+ this.status = status;
+ this.committed = true;
+ }
+
+ public void sendRedirect(String path) throws IOException {
+ if (this.committed) {
+ throw new IllegalStateException("Response is already committed");
+ }
+ this.committed = true;
+ }
+
+ public void setDateHeader(String name, long date) {
+ this.headers.put(name, ""+date);
+ }
+
+ public void addDateHeader(String name, long date) {
+ this.headers.put(name, ""+date);
+ }
+
+ public void setHeader(String name, String value) {
+ this.headers.put(name, value);
+ }
+
+ public void addHeader(String name, String value) {
+ this.headers.put(name, value);
+ }
+
+ public void setIntHeader(String name, int value) {
+ this.headers.put(name, ""+value);
+ }
+
+ public void addIntHeader(String name, int value) {
+ this.headers.put(name, ""+value);
+ }
+
+ public void setStatus(int sc) {
+ this.status = sc;
+ }
+
+ public void setStatus(int sc, String message) {
+ this.status = sc;
+ this.message = message;
+ }
+
+ public String getCharacterEncoding() {
+ return this.characterEncoding;
+ }
+
+ public String getContentType() {
+ return this.contentType;
+ }
+
+ public ServletOutputStream getOutputStream() throws IOException {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ public PrintWriter getWriter() throws IOException {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ public void setCharacterEncoding(String characterEncoding) {
+ this.characterEncoding = characterEncoding;
+ }
+
+ public void setContentLength(int contentLength) {
+ this.contentLength = contentLength;
+ }
+
+ public void setContentType(String contentType) {
+ this.contentType = contentType;
+ }
+
+ public void setBufferSize(int sz) {
+ this.bufferSize = sz;
+ }
+
+ public int getBufferSize() {
+ return this.bufferSize;
+ }
+
+ public void flushBuffer() throws IOException {
+
+ }
+
+ public void resetBuffer() {
+
+ }
+
+ public boolean isCommitted() {
+ return this.committed;
+ }
+
+ public void reset() {
+ // TODO Auto-generated method stub
+
+ }
+
+ public void setLocale(Locale locale) {
+ this.locale = locale;
+ }
+
+ public Locale getLocale() {
+ return this.locale;
+ }
+
+}
Added: trunk/sandbox/ui/columns/src/test/java/org/richfaces/facelet/mock/MockHttpSession.java
===================================================================
--- trunk/sandbox/ui/columns/src/test/java/org/richfaces/facelet/mock/MockHttpSession.java (rev 0)
+++ trunk/sandbox/ui/columns/src/test/java/org/richfaces/facelet/mock/MockHttpSession.java 2007-12-14 17:01:30 UTC (rev 4860)
@@ -0,0 +1,115 @@
+/**
+ * Copyright 2005 Sun Microsystems, Inc. All rights reserved.
+ * Licensed under the Common Development and Distribution License,
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.sun.com/cddl/
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * permissions and limitations under the License.
+ */
+
+package org.richfaces.facelet.mock;
+
+import java.util.Enumeration;
+import java.util.Hashtable;
+
+import javax.servlet.ServletContext;
+import javax.servlet.http.HttpSession;
+import javax.servlet.http.HttpSessionContext;
+
+/**
+ *
+ * @author Jacob Hookom
+ * @version $Id: MockHttpSession.java,v 1.2 2005/07/19 00:49:02 jhook Exp $
+ */
+public class MockHttpSession implements HttpSession {
+
+ private final Hashtable attributes = new Hashtable();
+ private final long creationTime;
+ private String id;
+ private long lastAccessedTime;
+ private final ServletContext servletContext;
+ private int maxInactiveInterval = 20;
+
+ public MockHttpSession(ServletContext servletContext) {
+ this.servletContext = servletContext;
+ this.creationTime = System.currentTimeMillis();
+ this.id = "" + this.creationTime;
+ this.lastAccessedTime = this.creationTime;
+ }
+
+ public long getCreationTime() {
+ return this.creationTime;
+ }
+
+ public String getId() {
+ return this.id;
+ }
+
+ public long getLastAccessedTime() {
+ return this.lastAccessedTime;
+ }
+
+ public ServletContext getServletContext() {
+ return this.servletContext;
+ }
+
+ public void setMaxInactiveInterval(int interval) {
+ this.maxInactiveInterval = interval;
+ }
+
+ public int getMaxInactiveInterval() {
+ return this.maxInactiveInterval;
+ }
+
+ public HttpSessionContext getSessionContext() {
+ throw new UnsupportedOperationException();
+ }
+
+ public Object getAttribute(String name) {
+ return this.attributes.get(name);
+ }
+
+ public Object getValue(String name) {
+ throw new UnsupportedOperationException();
+ }
+
+ public Enumeration getAttributeNames() {
+ return this.attributes.keys();
+ }
+
+ public String[] getValueNames() {
+ throw new UnsupportedOperationException();
+ }
+
+ public void setAttribute(String name, Object value) {
+ this.attributes.put(name, value);
+ }
+
+ public void putValue(String arg0, Object arg1) {
+ throw new UnsupportedOperationException();
+
+ }
+
+ public void removeAttribute(String name) {
+ this.attributes.remove(name);
+ }
+
+ public void removeValue(String arg0) {
+ throw new UnsupportedOperationException();
+ }
+
+ public void invalidate() {
+
+ }
+
+ public boolean isNew() {
+ return false;
+ }
+
+}
Added: trunk/sandbox/ui/columns/src/test/java/org/richfaces/facelet/mock/MockRequestDispatcher.java
===================================================================
--- trunk/sandbox/ui/columns/src/test/java/org/richfaces/facelet/mock/MockRequestDispatcher.java (rev 0)
+++ trunk/sandbox/ui/columns/src/test/java/org/richfaces/facelet/mock/MockRequestDispatcher.java 2007-12-14 17:01:30 UTC (rev 4860)
@@ -0,0 +1,51 @@
+/**
+ * Copyright 2005 Sun Microsystems, Inc. All rights reserved.
+ * Licensed under the Common Development and Distribution License,
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.sun.com/cddl/
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * permissions and limitations under the License.
+ */
+
+package org.richfaces.facelet.mock;
+
+import java.io.IOException;
+import java.net.URL;
+
+import javax.servlet.RequestDispatcher;
+import javax.servlet.ServletException;
+import javax.servlet.ServletRequest;
+import javax.servlet.ServletResponse;
+
+/**
+ *
+ * @author Jacob Hookom
+ * @version $Id: MockRequestDispatcher.java,v 1.1 2005/07/18 08:25:42 jhook Exp $
+ */
+public class MockRequestDispatcher implements RequestDispatcher {
+
+ protected final URL url;
+
+ public MockRequestDispatcher(URL url) {
+ this.url = url;
+ }
+
+ public void forward(ServletRequest request, ServletResponse response)
+ throws ServletException, IOException {
+ // TODO Auto-generated method stub
+
+ }
+
+ public void include(ServletRequest request, ServletResponse response)
+ throws ServletException, IOException {
+ // TODO Auto-generated method stub
+
+ }
+
+}
Added: trunk/sandbox/ui/columns/src/test/java/org/richfaces/facelet/mock/MockResponseWriter.java
===================================================================
--- trunk/sandbox/ui/columns/src/test/java/org/richfaces/facelet/mock/MockResponseWriter.java (rev 0)
+++ trunk/sandbox/ui/columns/src/test/java/org/richfaces/facelet/mock/MockResponseWriter.java 2007-12-14 17:01:30 UTC (rev 4860)
@@ -0,0 +1,178 @@
+/**
+ * Licensed under the Common Development and Distribution License,
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.sun.com/cddl/
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * permissions and limitations under the License.
+ */
+package org.richfaces.facelet.mock;
+
+
+import java.io.IOException;
+import java.io.Writer;
+
+import javax.faces.component.UIComponent;
+import javax.faces.context.ResponseWriter;
+
+
+
+/**
+ * @author Jacob Hookom
+ *
+ */
+public class MockResponseWriter extends ResponseWriter {
+
+ private final Writer writer;
+ private boolean startOpen;
+
+ public MockResponseWriter(Writer writer) {
+ this.writer = writer;
+ }
+
+ /* (non-Javadoc)
+ * @see javax.faces.context.ResponseWriter#getContentType()
+ */
+ public String getContentType() {
+ return "text/html";
+ }
+
+ /* (non-Javadoc)
+ * @see javax.faces.context.ResponseWriter#getCharacterEncoding()
+ */
+ public String getCharacterEncoding() {
+ return "UTF-8";
+ }
+
+ /* (non-Javadoc)
+ * @see javax.faces.context.ResponseWriter#flush()
+ */
+ public void flush() throws IOException {
+ // TODO Auto-generated method stub
+
+ }
+
+ /* (non-Javadoc)
+ * @see javax.faces.context.ResponseWriter#startDocument()
+ */
+ public void startDocument() throws IOException {
+ // TODO Auto-generated method stub
+
+ }
+
+ /* (non-Javadoc)
+ * @see javax.faces.context.ResponseWriter#endDocument()
+ */
+ public void endDocument() throws IOException {
+ // TODO Auto-generated method stub
+
+ }
+
+ private void closeStart() throws IOException {
+ if (this.startOpen) {
+ this.writer.write('>');
+ }
+ this.startOpen = false;
+ }
+
+ /* (non-Javadoc)
+ * @see javax.faces.context.ResponseWriter#startElement(java.lang.String, javax.faces.component.UIComponent)
+ */
+ public void startElement(String arg0, UIComponent arg1) throws IOException {
+ this.closeStart();
+ this.writer.write('<');
+ this.writer.write(arg0);
+ this.startOpen = true;
+ }
+
+ /* (non-Javadoc)
+ * @see javax.faces.context.ResponseWriter#endElement(java.lang.String)
+ */
+ public void endElement(String arg0) throws IOException {
+ if (this.startOpen) {
+ this.writer.write("/>");
+ this.startOpen = false;
+ } else {
+ this.writer.write("</");
+ this.writer.write(arg0);
+ this.writer.write('>');
+ }
+
+ }
+
+ /* (non-Javadoc)
+ * @see javax.faces.context.ResponseWriter#writeAttribute(java.lang.String, java.lang.Object, java.lang.String)
+ */
+ public void writeAttribute(String arg0, Object arg1, String arg2)
+ throws IOException {
+ if (arg1 != null) {
+ writer.write(' ');
+ writer.write(arg0);
+ writer.write("=\"");
+ writer.write(arg1.toString());
+ writer.write('"');
+ }
+ }
+
+ /* (non-Javadoc)
+ * @see javax.faces.context.ResponseWriter#writeURIAttribute(java.lang.String, java.lang.Object, java.lang.String)
+ */
+ public void writeURIAttribute(String arg0, Object arg1, String arg2)
+ throws IOException {
+ this.writeAttribute(arg0, arg1, arg2);
+ }
+
+ /* (non-Javadoc)
+ * @see javax.faces.context.ResponseWriter#writeComment(java.lang.Object)
+ */
+ public void writeComment(Object arg0) throws IOException {
+ this.closeStart();
+ this.writer.write("<!-- ");
+ this.writer.write(arg0 != null ? arg0.toString() : "null");
+ this.writer.write(" -->");
+ }
+
+ /* (non-Javadoc)
+ * @see javax.faces.context.ResponseWriter#writeText(java.lang.Object, java.lang.String)
+ */
+ public void writeText(Object arg0, String arg1) throws IOException {
+ this.closeStart();
+ this.writer.write(arg0 != null ? arg0.toString() : "null");
+ }
+
+ /* (non-Javadoc)
+ * @see javax.faces.context.ResponseWriter#writeText(char[], int, int)
+ */
+ public void writeText(char[] arg0, int arg1, int arg2) throws IOException {
+ this.closeStart();
+ this.writer.write(arg0, arg1, arg2);
+ }
+
+ /* (non-Javadoc)
+ * @see javax.faces.context.ResponseWriter#cloneWithWriter(java.io.Writer)
+ */
+ public ResponseWriter cloneWithWriter(Writer arg0) {
+ return new MockResponseWriter(arg0);
+ }
+
+ /* (non-Javadoc)
+ * @see java.io.Writer#write(char[], int, int)
+ */
+ public void write(char[] cbuf, int off, int len) throws IOException {
+ this.writer.write(cbuf, off, len);
+ }
+
+ /* (non-Javadoc)
+ * @see java.io.Writer#close()
+ */
+ public void close() throws IOException {
+ // TODO Auto-generated method stub
+
+ }
+
+}
Added: trunk/sandbox/ui/columns/src/test/java/org/richfaces/facelet/mock/MockServletContext.java
===================================================================
--- trunk/sandbox/ui/columns/src/test/java/org/richfaces/facelet/mock/MockServletContext.java (rev 0)
+++ trunk/sandbox/ui/columns/src/test/java/org/richfaces/facelet/mock/MockServletContext.java 2007-12-14 17:01:30 UTC (rev 4860)
@@ -0,0 +1,242 @@
+/**
+ * Copyright 2005 Sun Microsystems, Inc. All rights reserved.
+ * Licensed under the Common Development and Distribution License,
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.sun.com/cddl/
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * permissions and limitations under the License.
+ */
+
+package org.richfaces.facelet.mock;
+
+import java.io.File;
+import java.io.IOException;
+import java.io.InputStream;
+import java.net.MalformedURLException;
+import java.net.URI;
+import java.net.URL;
+import java.util.Collections;
+import java.util.Enumeration;
+import java.util.HashSet;
+import java.util.Hashtable;
+import java.util.Properties;
+import java.util.Set;
+import java.util.logging.Level;
+import java.util.logging.Logger;
+
+import javax.servlet.RequestDispatcher;
+import javax.servlet.Servlet;
+import javax.servlet.ServletContext;
+import javax.servlet.ServletException;
+
+import org.ajax4jsf.tests.facelet.mock.MockRequestDispatcher;
+
+/**
+ *
+ * @author Jacob Hookom
+ * @version $Id: MockServletContext.java,v 1.1 2005/07/18 08:25:42 jhook Exp $
+ */
+public class MockServletContext implements ServletContext {
+
+ protected final Properties initParams = new Properties();
+
+ protected final Logger log = Logger
+ .getLogger("facelets.mock.ServletContext");
+
+ protected final Hashtable attributes = new Hashtable();
+
+ protected final URI base;
+
+ public MockServletContext(URI base) {
+ this.base = base;
+ File f = new File(base);
+ if (!f.exists()) {
+ throw new IllegalArgumentException("File: " + base.getPath()
+ + " doesn't exist");
+ }
+ }
+
+ public ServletContext getContext(String name) {
+ throw new UnsupportedOperationException();
+ }
+
+ public int getMajorVersion() {
+ return 2;
+ }
+
+ public int getMinorVersion() {
+ return 3;
+ }
+
+ public String getMimeType(String path) {
+ throw new UnsupportedOperationException();
+ }
+
+ public Set getResourcePaths(String path) {
+ URI uri = this.resolve(path);
+ if (uri != null) {
+ File f = new File(uri);
+ if (f.exists() && f.isDirectory()) {
+ File[] c = f.listFiles();
+ Set s = new HashSet();
+ int start = f.getAbsolutePath().length();
+ for (int i = 0; i < c.length; i++) {
+ s.add(c[i].getAbsolutePath().substring(start));
+ }
+ return s;
+ }
+ }
+ return Collections.EMPTY_SET;
+ }
+
+ public URL getResource(String path) throws MalformedURLException {
+ URI uri = this.resolve(path);
+ if (uri != null) {
+ File f = new File(uri);
+ if (f.exists()) {
+ return uri.toURL();
+ }
+ }
+ return null;
+ }
+
+ public InputStream getResourceAsStream(String path) {
+ URI uri = this.resolve(path);
+ if (uri != null) {
+ try {
+ File f = new File(uri);
+ if (f.exists()) {
+ return uri.toURL().openStream();
+ }
+ } catch (MalformedURLException e) {
+ this.log.severe(e.getMessage());
+ return null;
+ } catch (IOException e) {
+ this.log.severe(e.getMessage());
+ return null;
+ }
+ }
+ return null;
+ }
+
+ public RequestDispatcher getRequestDispatcher(String path) {
+ URI uri = this.resolve(path);
+ if (uri != null) {
+ File f = new File(uri);
+ if (f.exists()) {
+ try {
+ return new MockRequestDispatcher(uri.toURL());
+ } catch (MalformedURLException e) {
+ this.log.severe(e.getMessage());
+ return null;
+ }
+ }
+
+ }
+ return null;
+ }
+
+ public RequestDispatcher getNamedDispatcher(String fileName) {
+ throw new UnsupportedOperationException();
+ }
+
+ public Servlet getServlet(String name) throws ServletException {
+ throw new UnsupportedOperationException();
+ }
+
+ public Enumeration getServlets() {
+ throw new UnsupportedOperationException();
+ }
+
+ public Enumeration getServletNames() {
+ throw new UnsupportedOperationException();
+ }
+
+ public void log(String message) {
+ this.log.info(message);
+ }
+
+ public void log(Exception error, String message) {
+ this.log.log(Level.INFO, message, error);
+
+ }
+
+ public void log(String message, Throwable error) {
+ this.log.log(Level.INFO, message, error);
+ }
+
+ public String getRealPath(String path) {
+ URI uri = this.resolve(path);
+ if (uri != null) {
+ File f = new File(uri);
+ if (f.exists()) {
+ return f.getAbsolutePath();
+ }
+ }
+ return null;
+ }
+
+ /* (non-Javadoc)
+ * @see javax.servlet.ServletContext#getContextPath()
+ */
+ public String getContextPath() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ private final URI resolve(String path) {
+ if (path == null) {
+ throw new NullPointerException("Path cannot be null");
+ }
+ if (path.charAt(0) == '/') {
+ if (path.length() > 1) {
+ return this.base.resolve(path.substring(1));
+ }
+ return this.base;
+ }
+ return null;
+ }
+
+ public String getServerInfo() {
+ return this.getClass().getName();
+ }
+
+ public String getInitParameter(String name) {
+ return this.initParams.getProperty(name);
+ }
+
+ public Enumeration getInitParameterNames() {
+ return this.initParams.keys();
+ }
+
+ public void setInitParameter(String name, String value) {
+ this.initParams.setProperty(name, value);
+ }
+
+ public Object getAttribute(String name) {
+ return this.attributes.get(name);
+ }
+
+ public Enumeration getAttributeNames() {
+ return this.attributes.keys();
+ }
+
+ public void setAttribute(String name, Object value) {
+ this.attributes.put(name, value);
+ }
+
+ public void removeAttribute(String name) {
+ this.attributes.remove(name);
+ }
+
+ public String getServletContextName() {
+ return this.getClass().getName();
+ }
+
+}
Added: trunk/sandbox/ui/columns/src/test/java/org/richfaces/facelet/mock/MockServletInputStream.java
===================================================================
--- trunk/sandbox/ui/columns/src/test/java/org/richfaces/facelet/mock/MockServletInputStream.java (rev 0)
+++ trunk/sandbox/ui/columns/src/test/java/org/richfaces/facelet/mock/MockServletInputStream.java 2007-12-14 17:01:30 UTC (rev 4860)
@@ -0,0 +1,45 @@
+/**
+ * Copyright 2005 Sun Microsystems, Inc. All rights reserved.
+ * Licensed under the Common Development and Distribution License,
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.sun.com/cddl/
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * permissions and limitations under the License.
+ */
+
+package org.richfaces.facelet.mock;
+
+import java.io.ByteArrayInputStream;
+import java.io.IOException;
+import java.io.InputStream;
+
+import javax.servlet.ServletInputStream;
+
+/**
+ *
+ * @author Jacob Hookom
+ * @version $Id: MockServletInputStream.java,v 1.1 2005/07/18 08:25:42 jhook Exp $
+ */
+public class MockServletInputStream extends ServletInputStream {
+
+ private final InputStream source;
+
+ public MockServletInputStream() {
+ this.source = new ByteArrayInputStream(new byte[0]);
+ }
+
+ public MockServletInputStream(InputStream source) {
+ this.source = source;
+ }
+
+ public int read() throws IOException {
+ return this.source.read();
+ }
+
+}
Added: trunk/sandbox/ui/columns/src/test/java/org/richfaces/facelet/mock/MockServletOutputStream.java
===================================================================
--- trunk/sandbox/ui/columns/src/test/java/org/richfaces/facelet/mock/MockServletOutputStream.java (rev 0)
+++ trunk/sandbox/ui/columns/src/test/java/org/richfaces/facelet/mock/MockServletOutputStream.java 2007-12-14 17:01:30 UTC (rev 4860)
@@ -0,0 +1,44 @@
+/**
+ * Copyright 2005 Sun Microsystems, Inc. All rights reserved.
+ * Licensed under the Common Development and Distribution License,
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.sun.com/cddl/
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * permissions and limitations under the License.
+ */
+
+package org.richfaces.facelet.mock;
+
+import java.io.ByteArrayOutputStream;
+import java.io.IOException;
+import java.io.OutputStream;
+
+import javax.servlet.ServletOutputStream;
+
+/**
+ *
+ * @author Jacob Hookom
+ * @version $Id: MockServletOutputStream.java,v 1.1 2005/07/18 08:25:43 jhook Exp $
+ */
+public class MockServletOutputStream extends ServletOutputStream {
+
+ private final OutputStream dest;
+
+ public MockServletOutputStream() {
+ this.dest = new ByteArrayOutputStream();
+ }
+
+ public MockServletOutputStream(OutputStream dest) {
+ this.dest = dest;
+ }
+
+ public void write(int b) throws IOException {
+ this.dest.write(b);
+ }
+}
Copied: trunk/sandbox/ui/columns/src/test/java/org/richfaces/facelet/tag (from rev 4176, trunk/sandbox/ui/columns/src/test/java/org/richfaces/component)
Added: trunk/sandbox/ui/columns/src/test/java/org/richfaces/facelet/tag/ColumnsFaceletTagTest.java
===================================================================
--- trunk/sandbox/ui/columns/src/test/java/org/richfaces/facelet/tag/ColumnsFaceletTagTest.java (rev 0)
+++ trunk/sandbox/ui/columns/src/test/java/org/richfaces/facelet/tag/ColumnsFaceletTagTest.java 2007-12-14 17:01:30 UTC (rev 4860)
@@ -0,0 +1,102 @@
+/*
+ * ColumnsFaceletTagTest.java Date created: 14.12.2007
+ * Last modified by: $Author$
+ * $Revision$ $Date$
+ */
+package org.richfaces.facelet.tag;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Map;
+
+import javax.faces.component.UIComponent;
+import javax.faces.component.UIOutput;
+import javax.faces.component.UIViewRoot;
+import javax.faces.context.FacesContext;
+
+import org.richfaces.component.UIColumn;
+import org.richfaces.component.html.HtmlColumn;
+import org.richfaces.facelet.FaceletTagTestCase;
+
+import com.sun.facelets.Facelet;
+import com.sun.facelets.FaceletFactory;
+
+/**
+ * Unit test for simple Component.
+ */
+/**
+ * TODO Class description goes here.
+ * @author Andrey Markavtsov
+ *
+ */
+public class ColumnsFaceletTagTest extends FaceletTagTestCase {
+
+
+
+ /* (non-Javadoc)
+ * @see org.ajax4jsf.tests.AbstractAjax4JsfTestCase#setUp()
+ */
+ @Override
+ public void setUp() throws Exception {
+ // TODO Auto-generated method stub
+ super.setUp();
+ }
+
+
+ public void testFacelet() throws Exception {
+ FacesContext faces = FacesContext.getCurrentInstance();
+ Map session = faces.getExternalContext().getSessionMap();
+ Collection c = new ArrayList();
+ for (int i = 0; i < 10; i++) {
+ c.add(i);
+ }
+ session.put("list", c);
+
+
+ FaceletFactory f = FaceletFactory.getInstance();
+ Facelet at = f.getFacelet("columns.xml");
+
+ UIViewRoot root = faces.getViewRoot();
+ at.apply(faces, root);
+
+ int count = root.getChildCount();
+ assertTrue(count == 1);
+
+ UIComponent dataTable = root.getChildren().get(0);
+ assertNotNull(dataTable);
+
+ count = dataTable.getChildCount();
+ assertTrue(count == 5);
+
+ UIComponent component = dataTable.getChildren().get(0);
+ assertTrue(component instanceof UIColumn);
+
+ HtmlColumn column = (HtmlColumn) component;
+ assertTrue("color: Red;".equals(column.getStyle()));
+ assertTrue("100px;".equals(column.getWidth()));
+
+ column = (HtmlColumn)dataTable.getChildren().get(4);
+ UIComponent facet = column.getFacet("header");
+ assertNotNull(facet);
+ assertTrue(facet instanceof UIOutput);
+ UIOutput output = (UIOutput)facet;
+ Integer val = (Integer) output.getValue();
+ assertTrue(val.equals(4));
+
+ assertTrue(component.getChildCount() == 1 );
+
+ output = (UIOutput)component.getChildren().get(0);
+ String value = (String) output.getValue();
+ assertTrue("1".equals(value));
+ }
+
+ /* (non-Javadoc)
+ * @see org.ajax4jsf.tests.AbstractAjax4JsfTestCase#tearDown()
+ */
+ @Override
+ public void tearDown() throws Exception {
+ // TODO Auto-generated method stub
+ super.tearDown();
+ }
+
+}
Deleted: trunk/sandbox/ui/columns/src/test/java/org/richfaces/facelet/tag/JSFComponentTest.java
===================================================================
--- trunk/sandbox/ui/columns/src/test/java/org/richfaces/component/JSFComponentTest.java 2007-11-22 12:07:03 UTC (rev 4176)
+++ trunk/sandbox/ui/columns/src/test/java/org/richfaces/facelet/tag/JSFComponentTest.java 2007-12-14 17:01:30 UTC (rev 4860)
@@ -1,53 +0,0 @@
-/**
- * License Agreement.
- *
- * Rich Faces - Natural Ajax for Java Server Faces (JSF)
- *
- * 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.component;
-
-import junit.framework.Test;
-import junit.framework.TestCase;
-import junit.framework.TestSuite;
-import javax.faces.component.UIComponent;
-
-/**
- * Unit test for simple Component.
- */
-public class JSFComponentTest
- extends TestCase
-{
- /**
- * Create the test case
- *
- * @param testName name of the test case
- */
- public JSFComponentTest( String testName )
- {
- super( testName );
- }
-
-
- /**
- * Rigourous Test :-)
- */
- public void testComponent()
- {
- assertTrue( true );
- }
-}
Added: trunk/sandbox/ui/columns/src/test/java/org/richfaces/jsp/mock/DataTableTagMock.java
===================================================================
--- trunk/sandbox/ui/columns/src/test/java/org/richfaces/jsp/mock/DataTableTagMock.java (rev 0)
+++ trunk/sandbox/ui/columns/src/test/java/org/richfaces/jsp/mock/DataTableTagMock.java 2007-12-14 17:01:30 UTC (rev 4860)
@@ -0,0 +1,42 @@
+/*
+ * DataTableTagMock.java Date created: 14.12.2007
+ * Last modified by: $Author$
+ * $Revision$ $Date$
+ */
+
+package org.richfaces.jsp.mock;
+
+import javax.faces.component.UIComponent;
+
+import org.richfaces.taglib.DataTableTag;
+
+/**
+ * TODO Class description goes here.
+ * @author Andrey Markavtsov
+ *
+ */
+public class DataTableTagMock extends DataTableTag {
+
+ /** Component to be returned by getComponentInstatnce method */
+ private UIComponent component;
+
+ /**
+ * TODO Description goes here.
+ * @param component
+ */
+ public DataTableTagMock(UIComponent component) {
+ super();
+ this.component = component;
+ }
+
+ /* (non-Javadoc)
+ * @see javax.faces.webapp.UIComponentClassicTagBase#getComponentInstance()
+ */
+ @Override
+ public UIComponent getComponentInstance() {
+ return component;
+ }
+
+
+
+}
Added: trunk/sandbox/ui/columns/src/test/java/org/richfaces/jsp/mock/ELContextMock.java
===================================================================
--- trunk/sandbox/ui/columns/src/test/java/org/richfaces/jsp/mock/ELContextMock.java (rev 0)
+++ trunk/sandbox/ui/columns/src/test/java/org/richfaces/jsp/mock/ELContextMock.java 2007-12-14 17:01:30 UTC (rev 4860)
@@ -0,0 +1,48 @@
+/*
+ * ELContextMock.java Date created: 14.12.2007
+ * Last modified by: $Author$
+ * $Revision$ $Date$
+ */
+
+package org.richfaces.jsp.mock;
+
+import javax.el.ELContext;
+import javax.el.ELResolver;
+import javax.el.FunctionMapper;
+import javax.el.VariableMapper;
+
+/**
+ * TODO Class description goes here.
+ * @author Andrey Markavtsov
+ *
+ */
+public class ELContextMock extends ELContext {
+
+ /* (non-Javadoc)
+ * @see javax.el.ELContext#getELResolver()
+ */
+ @Override
+ public ELResolver getELResolver() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ /* (non-Javadoc)
+ * @see javax.el.ELContext#getFunctionMapper()
+ */
+ @Override
+ public FunctionMapper getFunctionMapper() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ /* (non-Javadoc)
+ * @see javax.el.ELContext#getVariableMapper()
+ */
+ @Override
+ public VariableMapper getVariableMapper() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+}
Added: trunk/sandbox/ui/columns/src/test/java/org/richfaces/jsp/mock/PageContextMock.java
===================================================================
--- trunk/sandbox/ui/columns/src/test/java/org/richfaces/jsp/mock/PageContextMock.java (rev 0)
+++ trunk/sandbox/ui/columns/src/test/java/org/richfaces/jsp/mock/PageContextMock.java 2007-12-14 17:01:30 UTC (rev 4860)
@@ -0,0 +1,297 @@
+/*
+ * PageContextMock.java Date created: 14.12.2007
+ * Last modified by: $Author$
+ * $Revision$ $Date$
+ */
+
+package org.richfaces.jsp.mock;
+
+import java.io.IOException;
+import java.util.Enumeration;
+
+import javax.el.ELContext;
+import javax.servlet.Servlet;
+import javax.servlet.ServletConfig;
+import javax.servlet.ServletContext;
+import javax.servlet.ServletException;
+import javax.servlet.ServletRequest;
+import javax.servlet.ServletResponse;
+import javax.servlet.http.HttpSession;
+import javax.servlet.jsp.JspWriter;
+import javax.servlet.jsp.PageContext;
+import javax.servlet.jsp.el.ExpressionEvaluator;
+import javax.servlet.jsp.el.VariableResolver;
+
+/**
+ * TODO Class description goes here.
+ * @author Andrey Markavtsov
+ *
+ */
+public class PageContextMock extends PageContext {
+
+
+ private ELContext ELContext;
+
+
+
+ /**
+ * TODO Description goes here.
+ */
+ public PageContextMock() {
+ super();
+ ELContext = new ELContextMock();
+ // TODO Auto-generated constructor stub
+ }
+
+ /* (non-Javadoc)
+ * @see javax.servlet.jsp.PageContext#forward(java.lang.String)
+ */
+ @Override
+ public void forward(String relativeUrlPath) throws ServletException,
+ IOException {
+ // TODO Auto-generated method stub
+
+ }
+
+ /* (non-Javadoc)
+ * @see javax.servlet.jsp.PageContext#getException()
+ */
+ @Override
+ public Exception getException() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ /* (non-Javadoc)
+ * @see javax.servlet.jsp.PageContext#getPage()
+ */
+ @Override
+ public Object getPage() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ /* (non-Javadoc)
+ * @see javax.servlet.jsp.PageContext#getRequest()
+ */
+ @Override
+ public ServletRequest getRequest() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ /* (non-Javadoc)
+ * @see javax.servlet.jsp.PageContext#getResponse()
+ */
+ @Override
+ public ServletResponse getResponse() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ /* (non-Javadoc)
+ * @see javax.servlet.jsp.PageContext#getServletConfig()
+ */
+ @Override
+ public ServletConfig getServletConfig() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ /* (non-Javadoc)
+ * @see javax.servlet.jsp.PageContext#getServletContext()
+ */
+ @Override
+ public ServletContext getServletContext() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ /* (non-Javadoc)
+ * @see javax.servlet.jsp.PageContext#getSession()
+ */
+ @Override
+ public HttpSession getSession() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ /* (non-Javadoc)
+ * @see javax.servlet.jsp.PageContext#handlePageException(java.lang.Exception)
+ */
+ @Override
+ public void handlePageException(Exception e) throws ServletException,
+ IOException {
+ // TODO Auto-generated method stub
+
+ }
+
+ /* (non-Javadoc)
+ * @see javax.servlet.jsp.PageContext#handlePageException(java.lang.Throwable)
+ */
+ @Override
+ public void handlePageException(Throwable t) throws ServletException,
+ IOException {
+ // TODO Auto-generated method stub
+
+ }
+
+ /* (non-Javadoc)
+ * @see javax.servlet.jsp.PageContext#include(java.lang.String)
+ */
+ @Override
+ public void include(String relativeUrlPath) throws ServletException,
+ IOException {
+ // TODO Auto-generated method stub
+
+ }
+
+ /* (non-Javadoc)
+ * @see javax.servlet.jsp.PageContext#include(java.lang.String, boolean)
+ */
+ @Override
+ public void include(String relativeUrlPath, boolean flush)
+ throws ServletException, IOException {
+ // TODO Auto-generated method stub
+
+ }
+
+ /* (non-Javadoc)
+ * @see javax.servlet.jsp.PageContext#initialize(javax.servlet.Servlet, javax.servlet.ServletRequest, javax.servlet.ServletResponse, java.lang.String, boolean, int, boolean)
+ */
+ @Override
+ public void initialize(Servlet servlet, ServletRequest request,
+ ServletResponse response, String errorPageURL,
+ boolean needsSession, int bufferSize, boolean autoFlush)
+ throws IOException, IllegalStateException, IllegalArgumentException {
+ // TODO Auto-generated method stub
+
+ }
+
+ /* (non-Javadoc)
+ * @see javax.servlet.jsp.PageContext#release()
+ */
+ @Override
+ public void release() {
+ // TODO Auto-generated method stub
+
+ }
+
+ /* (non-Javadoc)
+ * @see javax.servlet.jsp.JspContext#findAttribute(java.lang.String)
+ */
+ @Override
+ public Object findAttribute(String name) {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ /* (non-Javadoc)
+ * @see javax.servlet.jsp.JspContext#getAttribute(java.lang.String)
+ */
+ @Override
+ public Object getAttribute(String name) {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ /* (non-Javadoc)
+ * @see javax.servlet.jsp.JspContext#getAttribute(java.lang.String, int)
+ */
+ @Override
+ public Object getAttribute(String name, int scope) {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ /* (non-Javadoc)
+ * @see javax.servlet.jsp.JspContext#getAttributeNamesInScope(int)
+ */
+ @Override
+ public Enumeration<String> getAttributeNamesInScope(int scope) {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ /* (non-Javadoc)
+ * @see javax.servlet.jsp.JspContext#getAttributesScope(java.lang.String)
+ */
+ @Override
+ public int getAttributesScope(String name) {
+ // TODO Auto-generated method stub
+ return 0;
+ }
+
+ /* (non-Javadoc)
+ * @see javax.servlet.jsp.JspContext#getELContext()
+ */
+ @Override
+ public ELContext getELContext() {
+ // TODO Auto-generated method stub
+ return this.ELContext;
+ }
+
+ /* (non-Javadoc)
+ * @see javax.servlet.jsp.JspContext#getExpressionEvaluator()
+ */
+ @Override
+ public ExpressionEvaluator getExpressionEvaluator() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ /* (non-Javadoc)
+ * @see javax.servlet.jsp.JspContext#getOut()
+ */
+ @Override
+ public JspWriter getOut() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ /* (non-Javadoc)
+ * @see javax.servlet.jsp.JspContext#getVariableResolver()
+ */
+ @Override
+ public VariableResolver getVariableResolver() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ /* (non-Javadoc)
+ * @see javax.servlet.jsp.JspContext#removeAttribute(java.lang.String)
+ */
+ @Override
+ public void removeAttribute(String name) {
+ // TODO Auto-generated method stub
+
+ }
+
+ /* (non-Javadoc)
+ * @see javax.servlet.jsp.JspContext#removeAttribute(java.lang.String, int)
+ */
+ @Override
+ public void removeAttribute(String name, int scope) {
+ // TODO Auto-generated method stub
+
+ }
+
+ /* (non-Javadoc)
+ * @see javax.servlet.jsp.JspContext#setAttribute(java.lang.String, java.lang.Object)
+ */
+ @Override
+ public void setAttribute(String name, Object value) {
+ // TODO Auto-generated method stub
+
+ }
+
+ /* (non-Javadoc)
+ * @see javax.servlet.jsp.JspContext#setAttribute(java.lang.String, java.lang.Object, int)
+ */
+ @Override
+ public void setAttribute(String name, Object value, int scope) {
+ // TODO Auto-generated method stub
+
+ }
+
+}
Added: trunk/sandbox/ui/columns/src/test/java/org/richfaces/jsp/mock/ValueExpressionMock.java
===================================================================
--- trunk/sandbox/ui/columns/src/test/java/org/richfaces/jsp/mock/ValueExpressionMock.java (rev 0)
+++ trunk/sandbox/ui/columns/src/test/java/org/richfaces/jsp/mock/ValueExpressionMock.java 2007-12-14 17:01:30 UTC (rev 4860)
@@ -0,0 +1,110 @@
+/*
+ * ValueExpressionMock.java Date created: 14.12.2007
+ * Last modified by: $Author$
+ * $Revision$ $Date$
+ */
+
+package org.richfaces.jsp.mock;
+
+import javax.el.ELContext;
+import javax.el.ValueExpression;
+
+/**
+ * TODO Class description goes here.
+ * @author Andrey Markavtsov
+ *
+ */
+public class ValueExpressionMock extends ValueExpression {
+
+ /** Object to returned by getValue method */
+ private Object o;
+
+ /**
+ * TODO Description goes here.
+ */
+ public ValueExpressionMock(Object o) {
+ this.o = o;
+ }
+
+ /* (non-Javadoc)
+ * @see javax.el.ValueExpression#getExpectedType()
+ */
+ @Override
+ public Class<?> getExpectedType() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ /* (non-Javadoc)
+ * @see javax.el.ValueExpression#getType(javax.el.ELContext)
+ */
+ @Override
+ public Class<?> getType(ELContext context) {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ /* (non-Javadoc)
+ * @see javax.el.ValueExpression#getValue(javax.el.ELContext)
+ */
+ @Override
+ public Object getValue(ELContext context) {
+ // TODO Auto-generated method stub
+ return o;
+ }
+
+ /* (non-Javadoc)
+ * @see javax.el.ValueExpression#isReadOnly(javax.el.ELContext)
+ */
+ @Override
+ public boolean isReadOnly(ELContext context) {
+ // TODO Auto-generated method stub
+ return false;
+ }
+
+ /* (non-Javadoc)
+ * @see javax.el.ValueExpression#setValue(javax.el.ELContext, java.lang.Object)
+ */
+ @Override
+ public void setValue(ELContext context, Object value) {
+ // TODO Auto-generated method stub
+
+ }
+
+ /* (non-Javadoc)
+ * @see javax.el.Expression#equals(java.lang.Object)
+ */
+ @Override
+ public boolean equals(Object obj) {
+ // TODO Auto-generated method stub
+ return false;
+ }
+
+ /* (non-Javadoc)
+ * @see javax.el.Expression#getExpressionString()
+ */
+ @Override
+ public String getExpressionString() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ /* (non-Javadoc)
+ * @see javax.el.Expression#hashCode()
+ */
+ @Override
+ public int hashCode() {
+ // TODO Auto-generated method stub
+ return 0;
+ }
+
+ /* (non-Javadoc)
+ * @see javax.el.Expression#isLiteralText()
+ */
+ @Override
+ public boolean isLiteralText() {
+ // TODO Auto-generated method stub
+ return false;
+ }
+
+}
Added: trunk/sandbox/ui/columns/src/test/java/org/richfaces/jsp/tag/ColumnsJspTagTest.java
===================================================================
--- trunk/sandbox/ui/columns/src/test/java/org/richfaces/jsp/tag/ColumnsJspTagTest.java (rev 0)
+++ trunk/sandbox/ui/columns/src/test/java/org/richfaces/jsp/tag/ColumnsJspTagTest.java 2007-12-14 17:01:30 UTC (rev 4860)
@@ -0,0 +1,189 @@
+/*
+ * JspTagTest.java Date created: 14.12.2007
+ * Last modified by: $Author$
+ * $Revision$ $Date$
+ */
+
+package org.richfaces.jsp.tag;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import javax.el.ELContext;
+import javax.el.ValueExpression;
+import javax.faces.component.UIComponent;
+import javax.faces.webapp.UIComponentClassicTagBase;
+
+import org.apache.shale.test.base.AbstractJsfTestCase;
+import org.richfaces.component.UIColumn;
+import org.richfaces.component.html.HtmlDataTable;
+import org.richfaces.jsp.mock.DataTableTagMock;
+import org.richfaces.jsp.mock.PageContextMock;
+import org.richfaces.jsp.mock.ValueExpressionMock;
+import org.richfaces.taglib.ColumnsTag;
+
+/**
+ * Test class for JSP columns tag
+ *
+ * @author Andrey Markavtsov
+ *
+ */
+public class ColumnsJspTagTest extends AbstractJsfTestCase {
+
+ /** Jsp tag to be tested */
+ private ColumnsTag tag;
+
+ /** Columns count to be created */
+ private int columnsCount;
+
+ /** Key to store executed tags */
+ private static final String COMPONENT_TAG_STACK_ATTR = "javax.faces.webapp.COMPONENT_TAG_STACK";
+
+ /**
+ * TODO Description goes here.
+ *
+ * @param name
+ */
+ public ColumnsJspTagTest(String name) {
+ super(name);
+ // TODO Auto-generated constructor stub
+ }
+
+ /**
+ * Creates value expression
+ *
+ * @param o -
+ * object to be returned by this expression
+ * @param el -
+ * ELContext
+ * @return - created value expression
+ */
+ private ValueExpression getValueExpression(Object o, ELContext el) {
+ ValueExpression exp = new ValueExpressionMock(o);
+ return exp;
+ }
+
+ /**
+ * Inits parent tag contained Data Table component
+ */
+ private void initParentTag() {
+
+ HtmlDataTable dataTable = new HtmlDataTable();
+ DataTableTagMock mock = new DataTableTagMock(dataTable);
+ List<UIComponentClassicTagBase> list = new ArrayList<UIComponentClassicTagBase>();
+ list.add(mock);
+
+ facesContext.getExternalContext().getRequestMap().put(
+ COMPONENT_TAG_STACK_ATTR, list);
+ }
+
+ /**
+ * Gets table from context
+ *
+ * @return
+ */
+ private UIComponent getTable() {
+ List list = (List) facesContext.getExternalContext().getRequestMap()
+ .get(COMPONENT_TAG_STACK_ATTR);
+ if (list != null) {
+ return ((UIComponentClassicTagBase) list.get(list.size() - 1))
+ .getComponentInstance();
+ }
+ return null;
+ }
+
+ private void initTag() {
+ ELContext el = facesContext.getELContext();
+ ValueExpression expr = null;
+
+ // begin
+ expr = getValueExpression(0, el);
+ tag.setBegin(expr);
+
+ // value
+ List<String> list = new ArrayList<String>();
+ columnsCount = (int) Math.random() * 10;
+ if (columnsCount == 0)
+ columnsCount = 1;
+ for (int i = 0; i < columnsCount; i++) {
+ list.add(Integer.toString(i));
+ }
+ expr = getValueExpression(list, el);
+ tag.setValue(expr);
+
+ // style
+ expr = getValueExpression("color: Blue;", el);
+ tag.setStyle(expr);
+
+ // var
+ expr = getValueExpression("var", el);
+ tag.setVar(expr);
+
+ // width
+ expr = getValueExpression("100px;", el);
+ tag.setWidth(expr);
+
+ // index
+ expr = getValueExpression("counter", el);
+ tag.setIndex(expr);
+
+ PageContextMock pageContext = new PageContextMock();
+ tag.setPageContext(pageContext);
+
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see junit.framework.TestCase#setUp()
+ */
+ @Override
+ protected void setUp() throws Exception {
+ super.setUp();
+
+ facesContext.getApplication().addComponent("org.richfaces.Column",
+ "org.richfaces.component.html.HtmlColumn");
+
+ tag = new ColumnsTag();
+ initTag();
+ initParentTag();
+
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see junit.framework.TestCase#tearDown()
+ */
+ @Override
+ protected void tearDown() throws Exception {
+ // TODO Auto-generated method stub
+ super.tearDown();
+ this.tag = null;
+ this.columnsCount = 0;
+ }
+
+ /**
+ * Tests JSP columns tag
+ *
+ * @throws Exception
+ */
+ public void testJspTag() throws Exception {
+ tag.doStartTag();
+
+ int body = tag.doAfterBody();
+ while (body == tag.EVAL_BODY_AGAIN) {
+ body = tag.doAfterBody();
+ }
+ tag.doEndTag();
+
+ UIComponent dataTable = getTable();
+ assertNotNull(dataTable);
+ assertTrue(dataTable.getChildCount() == columnsCount);
+
+ UIColumn column = (UIColumn) dataTable.getChildren().get(0);
+ assertNotNull(column);
+ assertTrue(column.getParent().equals(dataTable));
+ }
+
+}
Added: trunk/sandbox/ui/columns/src/test/resources/org/richfaces/facelet/tag/columns.xml
===================================================================
--- trunk/sandbox/ui/columns/src/test/resources/org/richfaces/facelet/tag/columns.xml (rev 0)
+++ trunk/sandbox/ui/columns/src/test/resources/org/richfaces/facelet/tag/columns.xml 2007-12-14 17:01:30 UTC (rev 4860)
@@ -0,0 +1,24 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml"
+ xmlns:f="http://java.sun.com/jsf/core"
+ xmlns:ui="http://java.sun.com/jsf/facelets"
+ xmlns:h="http://java.sun.com/jsf/html"
+ xmlns:dt="http://labs.jboss.com/jbossrichfaces/ui/dataTable"
+ xmlns:columns="http://labs.jboss.com/jbossrichfaces/ui/ui/columns">
+<body>
+
+<ui:composition>
+<dt:dataTable value="#{list}" var="var" id="tb">
+ <columns:columns value="1,2,3,4,5" var="col" index="counter"
+ style="color: Red;" width="100px;">
+ <f:facet name="header">
+ <h:outputText value="#{counter}"></h:outputText>
+ </f:facet>
+ <h:outputText value="#{col}"></h:outputText>
+ </columns:columns>
+</dt:dataTable>
+
+</ui:composition>
+
+</body>
+</html>
\ No newline at end of file
18 years, 4 months
JBoss Rich Faces SVN: r4859 - trunk/docs/userguide/en/src/main/docbook/included.
by richfaces-svn-commits@lists.jboss.org
Author: smukhina
Date: 2007-12-14 10:56:41 -0500 (Fri, 14 Dec 2007)
New Revision: 4859
Modified:
trunk/docs/userguide/en/src/main/docbook/included/outputPanel.xml
trunk/docs/userguide/en/src/main/docbook/included/toolTip.xml
Log:
incorrect symbols are fixed
Modified: trunk/docs/userguide/en/src/main/docbook/included/outputPanel.xml
===================================================================
--- trunk/docs/userguide/en/src/main/docbook/included/outputPanel.xml 2007-12-14 15:51:09 UTC (rev 4858)
+++ trunk/docs/userguide/en/src/main/docbook/included/outputPanel.xml 2007-12-14 15:56:41 UTC (rev 4859)
@@ -100,7 +100,7 @@
</listitem>
</itemizedlist>
<para>If layout="block" is chosen, the component is rendered as a pair of opening and closing <emphasis role="bold"><property><div></property></emphasis> tag, to which it's possible to apply any available style attributes available for block tags. </para>
- <para>Layout="none" helps to avoid an unnecessary tag round a context that could or couldn't be rendered according to the defined <emphasis><property>"rendered"</property></emphasis> attribute conditions. If an inner context isn’t rendered, <emphasis role="bold">
+ <para>Layout="none" helps to avoid an unnecessary tag round a context that could or couldn't be rendered according to the defined <emphasis><property>"rendered"</property></emphasis> attribute conditions. If an inner context isn't rendered, <emphasis role="bold">
<property><a4j:outputPanel></property>
</emphasis> is rendered as a <emphasis role="bold"><property><span></property></emphasis> tag with the id equal to an id of a child component and "display:none" style. If a child component is rendered, <emphasis role="bold">
<property><a4j:outputPanel></property>
Modified: trunk/docs/userguide/en/src/main/docbook/included/toolTip.xml
===================================================================
--- trunk/docs/userguide/en/src/main/docbook/included/toolTip.xml 2007-12-14 15:51:09 UTC (rev 4858)
+++ trunk/docs/userguide/en/src/main/docbook/included/toolTip.xml 2007-12-14 15:56:41 UTC (rev 4859)
@@ -157,7 +157,7 @@
<para>Here, the attribute <emphasis><property>"for"</property></emphasis> of a <emphasis role="bold">
<property><rich:tooltip></property>
- </emphasis> component is required. Whithout it an example doesn’t work because HTML elements aren't presented in component tree built by facelets.
+ </emphasis> component is required. Whithout it an example doesn't work because HTML elements aren't presented in component tree built by facelets.
</para>
<para>
18 years, 4 months
JBoss Rich Faces SVN: r4858 - in trunk/ui/scrollableDataTable/src/main: javascript/ClientUI/common/box and 4 other directories.
by richfaces-svn-commits@lists.jboss.org
Author: konstantin.mishin
Date: 2007-12-14 10:51:09 -0500 (Fri, 14 Dec 2007)
New Revision: 4858
Modified:
trunk/ui/scrollableDataTable/src/main/javascript/ClientUI/common/box/Box.js
trunk/ui/scrollableDataTable/src/main/javascript/ClientUI/common/box/InlineBox.js
trunk/ui/scrollableDataTable/src/main/javascript/ClientUI/common/box/ScrollableBox.js
trunk/ui/scrollableDataTable/src/main/javascript/ClientUI/common/box/SplashBox.js
trunk/ui/scrollableDataTable/src/main/javascript/ClientUI/common/box/Substrate.js
trunk/ui/scrollableDataTable/src/main/javascript/ClientUI/common/utils/CustomEvent.js
trunk/ui/scrollableDataTable/src/main/javascript/ClientUI/common/utils/StringBuilder.js
trunk/ui/scrollableDataTable/src/main/javascript/ClientUI/controls/grid/ArrayDataModel.js
trunk/ui/scrollableDataTable/src/main/javascript/ClientUI/controls/grid/DataCash.js
trunk/ui/scrollableDataTable/src/main/javascript/ClientUI/controls/grid/DataModel.js
trunk/ui/scrollableDataTable/src/main/javascript/ClientUI/controls/grid/DefaultColumnModel.js
trunk/ui/scrollableDataTable/src/main/javascript/ClientUI/controls/grid/FakeArrayDataModel.js
trunk/ui/scrollableDataTable/src/main/javascript/ClientUI/controls/grid/Grid.js
trunk/ui/scrollableDataTable/src/main/javascript/ClientUI/controls/grid/GridBody.js
trunk/ui/scrollableDataTable/src/main/javascript/ClientUI/controls/grid/GridFooter.js
trunk/ui/scrollableDataTable/src/main/javascript/ClientUI/controls/grid/GridHeader.js
trunk/ui/scrollableDataTable/src/main/javascript/ClientUI/controls/grid/ScrollableGrid.js
trunk/ui/scrollableDataTable/src/main/javascript/ClientUI/controls/grid/Selection.js
trunk/ui/scrollableDataTable/src/main/javascript/ClientUI/layouts/GridLayoutManager.js
trunk/ui/scrollableDataTable/src/main/javascript/ClientUI/layouts/LayoutManager.js
trunk/ui/scrollableDataTable/src/main/javascript/ClientUI/layouts/VLayoutManager.js
trunk/ui/scrollableDataTable/src/main/javascript/ClientUILib.js
trunk/ui/scrollableDataTable/src/main/templates/org/richfaces/scrollable-data-table.jspx
Log:
RF-1592
Modified: trunk/ui/scrollableDataTable/src/main/javascript/ClientUI/common/box/Box.js
===================================================================
--- trunk/ui/scrollableDataTable/src/main/javascript/ClientUI/common/box/Box.js 2007-12-14 15:21:34 UTC (rev 4857)
+++ trunk/ui/scrollableDataTable/src/main/javascript/ClientUI/common/box/Box.js 2007-12-14 15:51:09 UTC (rev 4858)
@@ -27,13 +27,7 @@
* })
*/
ClientUI.common.box.Box = Class.create({
- CLASSDEF: {
- name: 'ClientUI.common.box.Box'
- }
-});
-Object.extend(ClientUI.common.box.Box.prototype, {
-
initialize: function(element, parentElement, dontUpdateStyles) {
this.element = $(element);
if(!this.element) {
Modified: trunk/ui/scrollableDataTable/src/main/javascript/ClientUI/common/box/InlineBox.js
===================================================================
--- trunk/ui/scrollableDataTable/src/main/javascript/ClientUI/common/box/InlineBox.js 2007-12-14 15:21:34 UTC (rev 4857)
+++ trunk/ui/scrollableDataTable/src/main/javascript/ClientUI/common/box/InlineBox.js 2007-12-14 15:51:09 UTC (rev 4858)
@@ -10,16 +10,9 @@
/**
* Base class that wrap work with inline blocks like span
*/
-ClientUI.common.box.InlineBox = Class.create({
- CLASSDEF: {
- name: 'ClientUI.common.box.InlineBox',
- parent: ClientUI.common.box.Box
- }
-});
+ClientUI.common.box.InlineBox = Class.create(ClientUI.common.box.Box, {
-Object.extend(ClientUI.common.box.InlineBox.prototype, {
-
- initialize: function(element, parentElement, dontUpdateStyles) {
+ initialize: function($super, element, parentElement, dontUpdateStyles) {
if(!element) {
element = $(document.createElement("span"));
if($(parentElement)) {
@@ -33,7 +26,7 @@
element.id = "ClientUI_InlineBox" + ClientUI_common_box_InlineBox_idGenerator++;
}
- ClientUI.common.box.InlineBox.parentClass.constructor().call(this, element, parentElement, dontUpdateStyles);
+ $super(element, parentElement, dontUpdateStyles);
// additional styles
if(!dontUpdateStyles) {
Modified: trunk/ui/scrollableDataTable/src/main/javascript/ClientUI/common/box/ScrollableBox.js
===================================================================
--- trunk/ui/scrollableDataTable/src/main/javascript/ClientUI/common/box/ScrollableBox.js 2007-12-14 15:21:34 UTC (rev 4857)
+++ trunk/ui/scrollableDataTable/src/main/javascript/ClientUI/common/box/ScrollableBox.js 2007-12-14 15:51:09 UTC (rev 4858)
@@ -11,29 +11,11 @@
/**
* This class target to manage scrollable box object.
*/
-ClientUI.common.box.ScrollableBox = Class.create({
- CLASSDEF: {
- name: 'ClientUI.common.box.ScrollableBox',
- parent: ClientUI.common.box.Box
- }
-
-});
+ClientUI.common.box.ScrollableBox = Class.create(ClientUI.common.box.Box, {
-Object.extend(ClientUI.common.box.ScrollableBox.prototype, {
-
- // Custom events
- /**
- * Occured when content scrolled in horizontal
- */
- eventHScroll: {},
- /**
- * Occured when content scrolled in vertical
- */
- eventVScroll: {},
-
//Constructor
- initialize: function(element, parentElement) {
- ClientUI.common.box.ScrollableBox.parentClass.constructor().call(this, element, parentElement);
+ initialize: function($super, element, parentElement) {
+ $super(element, parentElement);
this.element.setStyle({overflow: 'auto'});
// Create custom event producers
@@ -61,9 +43,9 @@
this.eventVScroll.fire(this.getViewportScrollY());
}
},
- updateLayout: function() {
+ updateLayout: function($super) {
// NOTE: not implemented in this class
- ClientUI.common.box.ScrollableBox.parentClass.method("updateLayout").call(this);
+ $super();
},
getViewportScrollX: function() {
var scrollX = 0;
@@ -135,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
Modified: trunk/ui/scrollableDataTable/src/main/javascript/ClientUI/common/box/SplashBox.js
===================================================================
--- trunk/ui/scrollableDataTable/src/main/javascript/ClientUI/common/box/SplashBox.js 2007-12-14 15:21:34 UTC (rev 4857)
+++ trunk/ui/scrollableDataTable/src/main/javascript/ClientUI/common/box/SplashBox.js 2007-12-14 15:51:09 UTC (rev 4858)
@@ -11,17 +11,10 @@
/**
* Base class that wrap work with inline blocks like span
*/
-ClientUI.common.box.SplashBox = Class.create({
- CLASSDEF: {
- name: 'ClientUI.common.box.SplashBox',
- parent: ClientUI.common.box.Box
- }
-});
+ClientUI.common.box.SplashBox = Class.create(ClientUI.common.box.Box, {
-Object.extend(ClientUI.common.box.SplashBox.prototype, {
-
- initialize: function(text, parentElement, zIndex, supressSplash) {
- ClientUI.common.box.SplashBox.parentClass.constructor().call(this, null, parentElement);
+ initialize: function($super, text, parentElement, zIndex, supressSplash) {
+ $super(null, parentElement);
this.moveTo(-1000, -1000);
this.zIndex = zIndex || 500;
this.supressSplash = supressSplash || false;
Modified: trunk/ui/scrollableDataTable/src/main/javascript/ClientUI/common/box/Substrate.js
===================================================================
--- trunk/ui/scrollableDataTable/src/main/javascript/ClientUI/common/box/Substrate.js 2007-12-14 15:21:34 UTC (rev 4857)
+++ trunk/ui/scrollableDataTable/src/main/javascript/ClientUI/common/box/Substrate.js 2007-12-14 15:51:09 UTC (rev 4858)
@@ -10,17 +10,9 @@
/**
* Base class that wrap work with inline blocks like span
*/
-ClientUI.common.box.Substrate = Class.create({
- CLASSDEF: {
- name: 'ClientUI.common.box.Substrate',
- parent: ClientUI.common.box.Box
- }
-
-});
+ClientUI.common.box.Substrate = Class.create(ClientUI.common.box.Box, {
-Object.extend(ClientUI.common.box.Substrate.prototype, {
-
- initialize: function(element, parentElement, dontUpdateStyles) {
+ 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="" scrolling="no" frameborder="0" style="filter:Alpha(opacity=0);position:absolute;top:0px;left:0px;display:block"></iframe>';
@@ -28,7 +20,7 @@
fakeElement.removeChild(element);
}
- ClientUI.common.box.Substrate.parentClass.constructor().call(this, element, parentElement, dontUpdateStyles);
+ $super(element, parentElement, dontUpdateStyles);
// additional styles
if(!dontUpdateStyles) {
Modified: trunk/ui/scrollableDataTable/src/main/javascript/ClientUI/common/utils/CustomEvent.js
===================================================================
--- trunk/ui/scrollableDataTable/src/main/javascript/ClientUI/common/utils/CustomEvent.js 2007-12-14 15:21:34 UTC (rev 4857)
+++ trunk/ui/scrollableDataTable/src/main/javascript/ClientUI/common/utils/CustomEvent.js 2007-12-14 15:51:09 UTC (rev 4858)
@@ -9,16 +9,6 @@
ClientUILib.declarePackage("ClientUI.common.utils.CustomEvent");
ClientUI.common.utils.CustomEvent = Class.create({
- CLASSDEF: {
- name: 'ClientUI.common.utils.CustomEvent'
- }
-
-});
-
-Object.extend(ClientUI.common.utils.CustomEvent.prototype, {
- _eventName: 'undefined',
- _id: -1,
-
// Constructor
initialize: function(event) {
this._eventName = event;
@@ -53,6 +43,11 @@
}
});
+Object.extend(ClientUI.common.utils.CustomEvent, {
+ _eventName: 'undefined',
+ _id: -1
+});
+
Event._observe = Event.observe;
Event.observe = function( element, name, observer, useCapture ) {
if(element && element.getName && element.getId) {
Modified: trunk/ui/scrollableDataTable/src/main/javascript/ClientUI/common/utils/StringBuilder.js
===================================================================
--- trunk/ui/scrollableDataTable/src/main/javascript/ClientUI/common/utils/StringBuilder.js 2007-12-14 15:21:34 UTC (rev 4857)
+++ trunk/ui/scrollableDataTable/src/main/javascript/ClientUI/common/utils/StringBuilder.js 2007-12-14 15:51:09 UTC (rev 4858)
@@ -16,17 +16,7 @@
* var str = sb.toString();
*/
StringBuilder = Class.create({
- CLASSDEF: {
- name: 'StringBuilder'
- },
- length: 0,
-
- // private
- _current: 0,
- _parts: [],
- _string: null, // used to cache the string
-
initialize: function(str) {
this._string = null;
this._current = 0;
@@ -63,4 +53,11 @@
}
});
-
+Object.extend(StringBuilder.prototype, {
+ length: 0,
+
+ // private
+ _current: 0,
+ _parts: [],
+ _string: null // used to cache the string
+});
Modified: trunk/ui/scrollableDataTable/src/main/javascript/ClientUI/controls/grid/ArrayDataModel.js
===================================================================
--- trunk/ui/scrollableDataTable/src/main/javascript/ClientUI/controls/grid/ArrayDataModel.js 2007-12-14 15:21:34 UTC (rev 4857)
+++ trunk/ui/scrollableDataTable/src/main/javascript/ClientUI/controls/grid/ArrayDataModel.js 2007-12-14 15:51:09 UTC (rev 4858)
@@ -11,17 +11,9 @@
* by Denis Morozov <dmorozov(a)exadel.com> distributed under the BSD license.
*
*/
-ClientUI.controls.grid.ArrayDataModel = Class.create({
- CLASSDEF: {
- name: 'ClientUI.controls.grid.ArrayDataModel',
- parent: ClientUI.controls.grid.DataModel
- }
-
-});
-
-Object.extend(ClientUI.controls.grid.ArrayDataModel.prototype, {
- initialize: function(data) {
- this.parentClass().constructor().call(this);
+ClientUI.controls.grid.ArrayDataModel = Class.create(ClientUI.controls.grid.DataModel, {
+ initialize: function($super, data) {
+ $super();
this.data = $A(data || []);
},
getRow: function(index) {
Modified: trunk/ui/scrollableDataTable/src/main/javascript/ClientUI/controls/grid/DataCash.js
===================================================================
--- trunk/ui/scrollableDataTable/src/main/javascript/ClientUI/controls/grid/DataCash.js 2007-12-14 15:21:34 UTC (rev 4857)
+++ trunk/ui/scrollableDataTable/src/main/javascript/ClientUI/controls/grid/DataCash.js 2007-12-14 15:51:09 UTC (rev 4858)
@@ -11,14 +11,7 @@
*
*/
ClientUI.controls.grid.DataCash = Class.create({
- CLASSDEF: {
- name: 'ClientUI.controls.grid.DataCash'
- },
- PKG_SIZE: 20
-});
-
-Object.extend(ClientUI.controls.grid.DataCash.prototype, {
initialize: function(cashSize) {
var count = parseInt(cashSize/this.PKG_SIZE + 1);
this.cash = new Array(count);
@@ -34,4 +27,8 @@
var i = parseInt(index/this.PKG_SIZE), j = index%this.PKG_SIZE;
this.cash[i][j] = row;
}
+});
+
+Object.extend(ClientUI.controls.grid.DataCash.prototype, {
+ PKG_SIZE: 20
});
\ No newline at end of file
Modified: trunk/ui/scrollableDataTable/src/main/javascript/ClientUI/controls/grid/DataModel.js
===================================================================
--- trunk/ui/scrollableDataTable/src/main/javascript/ClientUI/controls/grid/DataModel.js 2007-12-14 15:21:34 UTC (rev 4857)
+++ trunk/ui/scrollableDataTable/src/main/javascript/ClientUI/controls/grid/DataModel.js 2007-12-14 15:51:09 UTC (rev 4858)
@@ -13,13 +13,6 @@
*
*/
ClientUI.controls.grid.DataModel = Class.create({
- CLASSDEF: {
- name: 'ClientUI.controls.grid.DataModel'
- }
-});
-
-Object.extend(ClientUI.controls.grid.DataModel.prototype, {
- eventDataReady: {},
initialize: function() {
// constructor
@@ -47,4 +40,7 @@
}
});
+Object.extend(ClientUI.controls.grid.DataModel.prototype, {
+ eventDataReady: {}
+});
Modified: trunk/ui/scrollableDataTable/src/main/javascript/ClientUI/controls/grid/DefaultColumnModel.js
===================================================================
--- trunk/ui/scrollableDataTable/src/main/javascript/ClientUI/controls/grid/DefaultColumnModel.js 2007-12-14 15:21:34 UTC (rev 4857)
+++ trunk/ui/scrollableDataTable/src/main/javascript/ClientUI/controls/grid/DefaultColumnModel.js 2007-12-14 15:51:09 UTC (rev 4858)
@@ -7,13 +7,6 @@
ClientUI.controls.grid.DefaultColumnModel = Class.create({
- CLASSDEF: {
- name: 'ClientUI.controls.grid.DefaultColumnModel'
- }
-
-});
-
-Object.extend(ClientUI.controls.grid.DefaultColumnModel.prototype, {
initialize: function(config) {
this.config = config;
Modified: trunk/ui/scrollableDataTable/src/main/javascript/ClientUI/controls/grid/FakeArrayDataModel.js
===================================================================
--- trunk/ui/scrollableDataTable/src/main/javascript/ClientUI/controls/grid/FakeArrayDataModel.js 2007-12-14 15:21:34 UTC (rev 4857)
+++ trunk/ui/scrollableDataTable/src/main/javascript/ClientUI/controls/grid/FakeArrayDataModel.js 2007-12-14 15:51:09 UTC (rev 4858)
@@ -1,14 +1,7 @@
ClientUILib.declarePackage("ClientUI.controls.grid.FakeArrayDataModel ");
-ClientUI.controls.grid.FakeArrayDataModel = Class.create({
- CLASSDEF: {
- name: 'ClientUI.controls.grid.FakeArrayDataModel',
- parent: ClientUI.controls.grid.DataModel
- }
- });
-
- Object.extend(ClientUI.controls.grid.FakeArrayDataModel.prototype, {
- initialize: function(rows_count, columns_count, grid_id) {
- ClientUI.controls.grid.FakeArrayDataModel.parentClass.constructor().call(this);
+ClientUI.controls.grid.FakeArrayDataModel = Class.create(ClientUI.controls.grid.DataModel, {
+ initialize: function($super, rows_count, columns_count, grid_id) {
+ $super();
this.data = [];
this.count = rows_count;
this.columns = columns_count;
Modified: trunk/ui/scrollableDataTable/src/main/javascript/ClientUI/controls/grid/Grid.js
===================================================================
--- trunk/ui/scrollableDataTable/src/main/javascript/ClientUI/controls/grid/Grid.js 2007-12-14 15:21:34 UTC (rev 4857)
+++ trunk/ui/scrollableDataTable/src/main/javascript/ClientUI/controls/grid/Grid.js 2007-12-14 15:51:09 UTC (rev 4858)
@@ -29,36 +29,14 @@
* var grid = new ClientUI.controls.grid.Grid('id_of_trigger_element', 'a nice description')
* </script>
*/
-ClientUI.controls.grid.Grid = Class.create({
- CLASSDEF: {
- name: 'ClientUI.controls.grid.Grid',
- parent: ClientUI.common.box.Box
- }
-
-});
-
-Object.extend(ClientUI.controls.grid.Grid.prototype, {
- // Custom events
- /**
- * Occured when content header clicked
- */
- eventOnSort: {},
- /**
- * Occured when column width adjusted
- */
- eventOnResizeColumn: {},
+ClientUI.controls.grid.Grid = Class.create(ClientUI.common.box.Box, {
- initialize: function(element, dataModel, templates) {
- ClientUI.controls.grid.Grid.parentClass.constructor().call(this, element);
- if(!this.element || !this.element.id)
- this.element.id = "ClientUI_Grid" + ClientUI_controls_grid_Grid_idGenerator++;
+ initialize: function($super, element, dataModel, templates) {
+ $super(element);
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();
},
@@ -97,11 +75,11 @@
setTimeout(function() {grid.updateLayout()}, 50);
}
},
- updateLayout: function() {
+ updateLayout: function($super) {
if(!this.controlCreated || this.getHeight()==0) {
return;
}
- ClientUI.controls.grid.Grid.parentClass.method("updateLayout").call(this);
+ $super();
var header = this.getHeader();
if(header.getHeight() == 0) {
@@ -133,7 +111,7 @@
if(this.getFooter()) this.getFooter().adjustColumnWidth(index, width);
this.updateLayout();
this.getHeader().agjustSeparators();
- this.eventOnResizeColumn.fire(index, width);
+ // this.eventOnResizeColumn.fire(index, width);
},
adjustScrollPosition: function(pos) {
if(pos<0) {pos = 0;}
@@ -220,9 +198,4 @@
this.updateLayout();
}
}
-});
-
-if(!ClientUI_controls_grid_Grid_idGenerator) {
-var ClientUI_controls_grid_Grid_idGenerator = 0;
-};
-
+});
Modified: trunk/ui/scrollableDataTable/src/main/javascript/ClientUI/controls/grid/GridBody.js
===================================================================
--- trunk/ui/scrollableDataTable/src/main/javascript/ClientUI/controls/grid/GridBody.js 2007-12-14 15:21:34 UTC (rev 4857)
+++ trunk/ui/scrollableDataTable/src/main/javascript/ClientUI/controls/grid/GridBody.js 2007-12-14 15:51:09 UTC (rev 4858)
@@ -12,39 +12,16 @@
* GridHeader.js - Grid control header pane
* TODO: add comments
*/
-ClientUI.controls.grid.GridBody = Class.create({
- CLASSDEF: {
- name: 'ClientUI.controls.grid.GridBody',
- parent: ClientUI.common.box.Box
- }
-
-});
-
-Object.extend(ClientUI.controls.grid.GridBody.prototype, {
+ClientUI.controls.grid.GridBody = Class.create(ClientUI.common.box.Box, {
/**
- * Count of rows can be viewed in the same time in grid
- */
- dataVisible: 50,
-
- /**
- * Count of rows loaded additianally to dataVisible rows
- */
- dataDelta: 5,
-
- /**
- * Current data position
- */
- currentPos: 0,
-
- /**
* Constructor
* @param {Object} template for Grid body row
* @param {Object} grid parent grid object
*/
- initialize: function(template, grid) {
+ initialize: function($super, template, grid) {
this.grid = grid;
this.gridId = grid.getElement().id;
- ClientUI.controls.grid.GridBody.parentClass.constructor().call(this, template);
+ $super(template);
// declare event listeners
this._eventOnHScroll = this._onContentHScroll.bind(this);
@@ -219,11 +196,11 @@
// this.defaultRowHeight -= this.getBorderWidth("tb") + this.getPadding("tb");
//}
},
- updateLayout: function() {
+ updateLayout: function($super) {
if(!this.controlCreated || !this.grid.controlCreated) {
return;
}
- ClientUI.controls.grid.GridBody.parentClass.method("updateLayout").call(this);
+ $super();
if(!this.scrollBox || !this.contentBox || !this.sizeBox) {
return;
}
@@ -822,3 +799,21 @@
}
}
});
+
+Object.extend(ClientUI.controls.grid.GridBody.prototype, {
+ /**
+ * Count of rows can be viewed in the same time in grid
+ */
+ dataVisible: 50,
+
+ /**
+ * Count of rows loaded additianally to dataVisible rows
+ */
+ dataDelta: 5,
+
+ /**
+ * Current data position
+ */
+ currentPos: 0
+
+});
Modified: trunk/ui/scrollableDataTable/src/main/javascript/ClientUI/controls/grid/GridFooter.js
===================================================================
--- trunk/ui/scrollableDataTable/src/main/javascript/ClientUI/controls/grid/GridFooter.js 2007-12-14 15:21:34 UTC (rev 4857)
+++ trunk/ui/scrollableDataTable/src/main/javascript/ClientUI/controls/grid/GridFooter.js 2007-12-14 15:51:09 UTC (rev 4858)
@@ -11,18 +11,10 @@
/* GridHeader.js - Grid control header pane
* TODO: add comments
*/
-ClientUI.controls.grid.GridFooter = Class.create({
- CLASSDEF: {
- name: 'ClientUI.controls.grid.GridFooter',
- parent: ClientUI.common.box.Box
- }
-
-});
-
-Object.extend(ClientUI.controls.grid.GridFooter.prototype, {
- initialize: function(template, grid) {
+ClientUI.controls.grid.GridFooter = Class.create(ClientUI.common.box.Box, {
+ initialize: function($super, template, grid) {
this.grid = grid;
- ClientUI.controls.grid.GridFooter.parentClass.constructor().call(this, template);
+ $super(template);
this.createControl(template);
},
createControl: function(template) {
@@ -133,11 +125,11 @@
this.setHeight(this.defaultHeight);
this.setWidth(this.defaultWidth);
},
- updateLayout: function() {
+ updateLayout: function($super) {
if(!this.controlCreated || !this.grid.controlCreated) {
return;
}
- ClientUI.controls.grid.GridFooter.parentClass.method("updateLayout").call(this);
+ $super();
var height = this.getHeight();
var totalWidth = this.grid.getColumnsTotalWidth();
Modified: trunk/ui/scrollableDataTable/src/main/javascript/ClientUI/controls/grid/GridHeader.js
===================================================================
--- trunk/ui/scrollableDataTable/src/main/javascript/ClientUI/controls/grid/GridHeader.js 2007-12-14 15:21:34 UTC (rev 4857)
+++ trunk/ui/scrollableDataTable/src/main/javascript/ClientUI/controls/grid/GridHeader.js 2007-12-14 15:51:09 UTC (rev 4858)
@@ -12,24 +12,12 @@
* GridHeader.js - Grid control header pane
* TODO: add comments
*/
-ClientUI.controls.grid.GridHeader = Class.create({
- CLASSDEF: {
- name: 'ClientUI.controls.grid.GridHeader',
- parent: ClientUI.common.box.Box,
- sepStyleClass: "dr-sdt-hsep"
- }
-
-});
-
-Object.extend(ClientUI.controls.grid.GridHeader.prototype, {
- // internal variables
- _columns: [],
-
+ClientUI.controls.grid.GridHeader = Class.create(ClientUI.common.box.Box, {
// constructor
- initialize: function(template, grid) {
+ initialize: function($super, template, grid) {
this.grid = grid;
this.gridId = this.grid.getElement().id;
- ClientUI.controls.grid.GridHeader.parentClass.constructor().call(this, template);
+ $super(template);
// register event handlers
this.eventSepDblClick = this.OnSepDblClick.bindAsEventListener(this);
@@ -303,11 +291,11 @@
this.agjustSeparators();
this.updateHeaders();
},
- updateLayout: function() {
+ updateLayout: function($super) {
if(!this.controlCreated || !this.grid.controlCreated) {
return;
}
- ClientUI.controls.grid.GridHeader.parentClass.method("updateLayout").call(this);
+ $super();
var height = this.getHeight();
var totalWidth = this.grid.getColumnsTotalWidth();
var frozenContentWidth = this.grid.getColumnsFrozenWidth();
@@ -434,9 +422,7 @@
*/
var rows = this.grid.getBody().templFrozen.getElement().rows;
var startRow = rows && rows.length>0 ? this.grid.getBody()._getRowIndex(rows[0].id) : 0;
- this.grid.eventOnSort.fire({
- column: index,
- /*order: dir,*/
+ this.grid.element.fire("grid:onsort",{ column: index,
startRow: startRow,
index: this.grid.getBody().currRange.start
});
@@ -497,3 +483,9 @@
}
}
});
+
+Object.extend(ClientUI.controls.grid.GridHeader.prototype, {
+ sepStyleClass: "dr-sdt-hsep",
+ // internal variables
+ _columns: []
+});
\ No newline at end of file
Modified: trunk/ui/scrollableDataTable/src/main/javascript/ClientUI/controls/grid/ScrollableGrid.js
===================================================================
--- trunk/ui/scrollableDataTable/src/main/javascript/ClientUI/controls/grid/ScrollableGrid.js 2007-12-14 15:21:34 UTC (rev 4857)
+++ trunk/ui/scrollableDataTable/src/main/javascript/ClientUI/controls/grid/ScrollableGrid.js 2007-12-14 15:51:09 UTC (rev 4858)
@@ -1,24 +1,7 @@
ClientUILib.declarePackage("ClientUI.controls.grid.ScrollableGrid");
-ClientUI.controls.grid.ScrollableGrid = Class.create({
- CLASSDEF: {
- name: 'ClientUI.controls.grid.ScrollableGrid',
- parent: ClientUI.controls.grid.Grid
- }
-});
-
-Object.extend(ClientUI.controls.grid.ScrollableGrid.prototype, {
- /**
- * Occured when scroll position adjusted
- */
- eventOnPostScroll: {},
-
- /**
- * Occured when sorting adjusted
- */
- eventOnPostSort: {},
-
- initialize: function(options) {
+ClientUI.controls.grid.ScrollableGrid = Class.create(ClientUI.controls.grid.Grid, {
+ initialize: function($super, options) {
this.startInitTime = (new Date()).getTime();
this.options = options;
@@ -34,9 +17,10 @@
{pane: GridLayout_Enum.FOOTER, ref: this.client_id +"_" + "GridFooterTemplate"}
];
var grid = this;
+ var s = $super;
Utils.execOnLoad(
function(){
- grid.init();
+ grid.init(s);
},
Utils.Condition.ElementPresent(grid.client_id), 100);
@@ -46,33 +30,22 @@
// initialize parent Grid
- init: function(){
+ init: function(superCtor){
// mark that grid control initialized
if(!this.isInitialized) {
this.isInitialized = true;
this.startCreateTime = (new Date()).getTime();
- ClientUI.controls.grid.ScrollableGrid.parentClass.constructor().call(this, this.client_id, this.dataModel, this.templates);
+ 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.element.fire("grid:initialized");
- this.endPostProcessTime = (new Date()).getTime();
- }.bind(this), 500);
- this.getBody().restoreScrollState();
+
+ Event.observe(this.element, "grid:onsort", this.onSorted.bindAsEventListener(this));
+ if (this.options.selectionInput) {
+ this.selectionManager = new ClientUI.controls.grid.SelectionManager(this);
+ }
+ this.element.fire("grid:initialized");
+ this.getBody().restoreScrollState();
}
},
@@ -84,7 +57,7 @@
[this.updateSelectionCallBack],
[function(){
this.selectionManager.restoreState();
- this.eventOnPostSort.fire(options.column, options.order);
+ this.element.fire("grid:onpostsort",{column: options.column, order:options.order});
}]);
this.updateLayout();
this.getBody().restoreScrollState();
@@ -98,7 +71,7 @@
[this.updateSelectionCallBack],
[function(){
this.selectionManager.restoreState();
- this.eventOnPostScroll.fire(this.getBody().currRange.start);
+ this.element.fire("grid:onpostsort",{start:this.getBody().currRange.start});
}]);
this.updateLayout();
@@ -113,8 +86,8 @@
ClientUILib.log(ClientUILogger.WARNING, "...Selection mng time: " + (window.loadingEndTime - window.loadingInvalidateTime));
},
- onSorted: function(sortEvent) {
- this.options.onSortAjaxUpdate(sortEvent);
+ onSorted: function(event) {
+ this.options.onSortAjaxUpdate(event.memo);
},
updateSelectionCallBack: function(argMap) {
@@ -150,12 +123,4 @@
if(this.getFooter()) {this.getFooter().hideColumn(index, frozen);}
this.updateLayout();
}
-});
-
-
-
-
-
-
-
-
+});
\ No newline at end of file
Modified: trunk/ui/scrollableDataTable/src/main/javascript/ClientUI/controls/grid/Selection.js
===================================================================
--- trunk/ui/scrollableDataTable/src/main/javascript/ClientUI/controls/grid/Selection.js 2007-12-14 15:21:34 UTC (rev 4857)
+++ trunk/ui/scrollableDataTable/src/main/javascript/ClientUI/controls/grid/Selection.js 2007-12-14 15:51:09 UTC (rev 4858)
@@ -1,11 +1,4 @@
ClientUI.controls.grid.Selection = Class.create({
- CLASSDEF: {
- name: 'ClientUI.controls.grid.Selection'
- }
-
-});
-
-Object.extend(ClientUI.controls.grid.Selection.prototype, {
initialize: function() {
this.ranges = [];
},
@@ -173,13 +166,6 @@
});
ClientUI.controls.grid.Range = Class.create({
- CLASSDEF: {
- name: 'ClientUI.controls.grid.Range'
- }
-
-});
-
-Object.extend(ClientUI.controls.grid.Range.prototype, {
initialize: function(startIndex, endIndex) {
this.indexes = [startIndex, endIndex];
},
@@ -210,13 +196,6 @@
});
ClientUI.controls.grid.SelectionManager = Class.create({
- CLASSDEF: {
- name: 'ClientUI.controls.grid.SelectionManager'
- }
-
-});
-
-Object.extend(ClientUI.controls.grid.SelectionManager.prototype, {
initialize: function(grid) {
this.grid = grid;
this.selectionFlag;
Modified: trunk/ui/scrollableDataTable/src/main/javascript/ClientUI/layouts/GridLayoutManager.js
===================================================================
--- trunk/ui/scrollableDataTable/src/main/javascript/ClientUI/layouts/GridLayoutManager.js 2007-12-14 15:21:34 UTC (rev 4857)
+++ trunk/ui/scrollableDataTable/src/main/javascript/ClientUI/layouts/GridLayoutManager.js 2007-12-14 15:51:09 UTC (rev 4858)
@@ -21,20 +21,12 @@
*
* TODO: description of control
*/
-ClientUI.layouts.GridLayoutManager = Class.create({
- CLASSDEF: {
- name: 'ClientUI.layouts.GridLayoutManager',
- parent: ClientUI.layouts.VLayoutManager
- }
-
-});
-
-Object.extend(ClientUI.layouts.GridLayoutManager.prototype, {
- initialize: function(element, parentElement, config) {
- ClientUI.layouts.GridLayoutManager.parentClass.constructor().call(this, element, parentElement);
+ClientUI.layouts.GridLayoutManager = Class.create(ClientUI.layouts.VLayoutManager, {
+ initialize: function($super, element, parentElement, config) {
+ $super(element, parentElement);
},
updateLayout: function() {
- ClientUI.layouts.LayoutManager.method("updateLayout").call(this);
+ ClientUI.layouts.LayoutManager.prototype.updateLayout.call(this);
var parentBox = this.getContainer();
if(parentBox==null) parentBox = this;
Modified: trunk/ui/scrollableDataTable/src/main/javascript/ClientUI/layouts/LayoutManager.js
===================================================================
--- trunk/ui/scrollableDataTable/src/main/javascript/ClientUI/layouts/LayoutManager.js 2007-12-14 15:21:34 UTC (rev 4857)
+++ trunk/ui/scrollableDataTable/src/main/javascript/ClientUI/layouts/LayoutManager.js 2007-12-14 15:51:09 UTC (rev 4858)
@@ -11,27 +11,9 @@
*
* TODO: description of control
*/
-ClientUI.layouts.LayoutManager = Class.create({
- CLASSDEF: {
- name: 'ClientUI.layouts.LayoutManager',
- parent: ClientUI.common.box.Box
- },
-
- // Custom events
- /**
- * Occured before resizing
- */
- eventOnBeforeResize: {},
- /**
- * Occured after resizing
- */
- eventOnAfterResize: {}
-
-});
-
-Object.extend(ClientUI.layouts.LayoutManager.prototype, {
- initialize: function(element, parentElement) {
- ClientUI.layouts.LayoutManager.parentClass.constructor().call(this, element, parentElement);
+ClientUI.layouts.LayoutManager = Class.create(ClientUI.common.box.Box, {
+ initialize: function($super, element, parentElement) {
+ $super(element, parentElement);
// store container element to look after
this.container = parentElement;
@@ -59,7 +41,7 @@
this.updateLayout();
this.eventOnAfterResize.fire();
},
- updateLayout: function() {
+ updateLayout: function($super) {
if(this.container) {
var w = this.container.getWidth();
var h = this.container.getHeight();
@@ -70,9 +52,23 @@
this.setWidth(w);
this.setHeight(h);
}
- ClientUI.layouts.LayoutManager.parentClass.method("updateLayout").call(this);
+ $super();
},
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: trunk/ui/scrollableDataTable/src/main/javascript/ClientUI/layouts/VLayoutManager.js
===================================================================
--- trunk/ui/scrollableDataTable/src/main/javascript/ClientUI/layouts/VLayoutManager.js 2007-12-14 15:21:34 UTC (rev 4857)
+++ trunk/ui/scrollableDataTable/src/main/javascript/ClientUI/layouts/VLayoutManager.js 2007-12-14 15:51:09 UTC (rev 4858)
@@ -20,28 +20,20 @@
*
* TODO: description of control
*/
-ClientUI.layouts.VLayoutManager = Class.create({
- CLASSDEF: {
- name: 'ClientUI.layouts.VLayoutManager',
- parent: ClientUI.layouts.LayoutManager
- }
-
-});
-
-Object.extend(ClientUI.layouts.VLayoutManager.prototype, {
- initialize: function(element, parentElement, config) {
- ClientUI.layouts.VLayoutManager.parentClass.constructor().call(this, element, parentElement);
+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() {
- ClientUI.layouts.VLayoutManager.parentClass.method("registerEvents").call(this);
+ registerEvents: function($super) {
+ $super();
},
- destroy: function() {
- ClientUI.layouts.VLayoutManager.parentClass.method("destroy").call(this);
+ destroy: function($super) {
+ $super();
},
/*containerResize: function(event) {
ClientUI.layouts.VLayoutManager.parentClass.method("containerResize").call(this, event);
@@ -57,8 +49,8 @@
getPane: function(align) {
return this.panels[align];
},
- updateLayout: function() {
- ClientUI.layouts.VLayoutManager.parentClass.method("updateLayout").call(this);
+ updateLayout: function($super) {
+ $super();
var parentBox = this.getContainer();
if(!parentBox) parentBox = this;
Modified: trunk/ui/scrollableDataTable/src/main/javascript/ClientUILib.js
===================================================================
--- trunk/ui/scrollableDataTable/src/main/javascript/ClientUILib.js 2007-12-14 15:21:34 UTC (rev 4857)
+++ trunk/ui/scrollableDataTable/src/main/javascript/ClientUILib.js 2007-12-14 15:51:09 UTC (rev 4858)
@@ -21,9 +21,9 @@
throw("ClientUILib requires the Prototype JavaScript framework >= 1.5.0");
// Check for Extend JavaScript library
- if((typeof Extend=='undefined') ||
- Extend.VERSION < 1.1)
- throw("ClientUILib requires the Extend JavaScript library >= 1.1");
+// if((typeof Extend=='undefined') ||
+// Extend.VERSION < 1.1)
+// throw("ClientUILib requires the Extend JavaScript library >= 1.1");
$A(document.getElementsByTagName("script")).findAll( function(s) {
return (s.src && s.src.match(/ClientUILib\.js(\?.*)?$/))
Modified: trunk/ui/scrollableDataTable/src/main/templates/org/richfaces/scrollable-data-table.jspx
===================================================================
--- trunk/ui/scrollableDataTable/src/main/templates/org/richfaces/scrollable-data-table.jspx 2007-12-14 15:21:34 UTC (rev 4857)
+++ trunk/ui/scrollableDataTable/src/main/templates/org/richfaces/scrollable-data-table.jspx 2007-12-14 15:51:09 UTC (rev 4858)
@@ -19,7 +19,6 @@
<h:scripts>
new org.ajax4jsf.javascript.PrototypeScript(),
new org.ajax4jsf.javascript.AjaxScript(),
- /org/richfaces/renderkit/html/scripts/extend/extend.js,
/org/richfaces/renderkit/html/scripts/scrollable-data-table.js
</h:scripts>
18 years, 4 months
JBoss Rich Faces SVN: r4857 - branches/3.1.x/docs/userguide/en/src/main/docbook/included.
by richfaces-svn-commits@lists.jboss.org
Author: artdaw
Date: 2007-12-14 10:21:34 -0500 (Fri, 14 Dec 2007)
New Revision: 4857
Modified:
branches/3.1.x/docs/userguide/en/src/main/docbook/included/outputPanel.xml
Log:
incorrect symbols are fixed
Modified: branches/3.1.x/docs/userguide/en/src/main/docbook/included/outputPanel.xml
===================================================================
--- branches/3.1.x/docs/userguide/en/src/main/docbook/included/outputPanel.xml 2007-12-14 15:21:26 UTC (rev 4856)
+++ branches/3.1.x/docs/userguide/en/src/main/docbook/included/outputPanel.xml 2007-12-14 15:21:34 UTC (rev 4857)
@@ -99,7 +99,7 @@
none
</listitem>
</itemizedlist>
- <para>If layout="block" is chosen, the component is rendered as a pair of opening and closing <emphasis role="bold"><property><div></property></emphasis> tag, to which it’s possible to apply any available style attributes available for block tags. </para>
+ <para>If layout="block" is chosen, the component is rendered as a pair of opening and closing <emphasis role="bold"><property><div></property></emphasis> tag, to which it's possible to apply any available style attributes available for block tags. </para>
<para>Layout="none" helps to avoid an unnecessary tag round a context that could or couldn't be rendered according to the defined <emphasis><property>"rendered"</property></emphasis> attribute conditions. If an inner context isn’t rendered, <emphasis role="bold">
<property><a4j:outputPanel></property>
</emphasis> is rendered as a <emphasis role="bold"><property><span></property></emphasis> tag with the id equal to an id of a child component and "display:none" style. If a child component is rendered, <emphasis role="bold">
18 years, 4 months
JBoss Rich Faces SVN: r4856 - branches/3.1.x/docs/userguide/en/src/main/docbook/included.
by richfaces-svn-commits@lists.jboss.org
Author: artdaw
Date: 2007-12-14 10:21:26 -0500 (Fri, 14 Dec 2007)
New Revision: 4856
Modified:
branches/3.1.x/docs/userguide/en/src/main/docbook/included/listShuttle.xml
Log:
incorrect symbols are fixed
Modified: branches/3.1.x/docs/userguide/en/src/main/docbook/included/listShuttle.xml
===================================================================
--- branches/3.1.x/docs/userguide/en/src/main/docbook/included/listShuttle.xml 2007-12-14 15:21:15 UTC (rev 4855)
+++ branches/3.1.x/docs/userguide/en/src/main/docbook/included/listShuttle.xml 2007-12-14 15:21:26 UTC (rev 4856)
@@ -61,7 +61,7 @@
</emphasis> and <emphasis>
<property>"target"</property>
</emphasis> facets. It is possible to use the facets only together defined. In case the
- facets definition skipped – both lists contain the columns defined nested to listShuttle
+ facets definition skipped both lists contain the columns defined nested to listShuttle
component.</para>
<para>Here is a simple example as it could be used on a page.</para>
<para>
18 years, 4 months
JBoss Rich Faces SVN: r4855 - branches/3.1.x/docs/userguide/en/src/main/docbook/included.
by richfaces-svn-commits@lists.jboss.org
Author: artdaw
Date: 2007-12-14 10:21:15 -0500 (Fri, 14 Dec 2007)
New Revision: 4855
Modified:
branches/3.1.x/docs/userguide/en/src/main/docbook/included/effect.xml
Log:
incorrect symbols are fixed
Modified: branches/3.1.x/docs/userguide/en/src/main/docbook/included/effect.xml
===================================================================
--- branches/3.1.x/docs/userguide/en/src/main/docbook/included/effect.xml 2007-12-14 15:04:15 UTC (rev 4854)
+++ branches/3.1.x/docs/userguide/en/src/main/docbook/included/effect.xml 2007-12-14 15:21:15 UTC (rev 4855)
@@ -189,7 +189,7 @@
]]></programlisting>
<para> If you do use the <emphasis role="bold">
<property><rich:effect></property>
- </emphasis>component, there is no need to include this library because it’s already here. </para>
+ </emphasis>component, there is no need to include this library because it's already here. </para>
<para>For more information look at <ulink
url="http://jboss.com/index.html?module=bb&op=viewtopic&t=119044">RichFaces
18 years, 4 months