[richfaces-svn-commits] JBoss Rich Faces SVN: r4860 - in trunk/sandbox/ui/columns/src/test: java/org/richfaces and 11 other directories.
richfaces-svn-commits at lists.jboss.org
richfaces-svn-commits at lists.jboss.org
Fri Dec 14 12:01:30 EST 2007
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
More information about the richfaces-svn-commits
mailing list