Author: Alex.Kolonitsky
Date: 2010-08-09 09:27:29 -0400 (Mon, 09 Aug 2010)
New Revision: 18507
Added:
trunk/ui/iteration/dist/richfaces-ui-iteration-api/src/main/java/org/richfaces/component/
trunk/ui/iteration/dist/richfaces-ui-iteration-ui/src/main/java/org/richfaces/component/AbstractList.java
trunk/ui/iteration/dist/richfaces-ui-iteration-ui/src/main/java/org/richfaces/package-info.java
trunk/ui/iteration/dist/richfaces-ui-iteration-ui/src/main/java/org/richfaces/renderkit/ListRendererBase.java
trunk/ui/iteration/dist/richfaces-ui-iteration-ui/src/main/resources/META-INF/resources/org.richfaces/
trunk/ui/iteration/dist/richfaces-ui-iteration-ui/src/main/templates/list.template.xml
Removed:
trunk/ui/iteration/dist/richfaces-ui-iteration-api/pom.xml
trunk/ui/iteration/dist/richfaces-ui-iteration-ui/pom.xml
trunk/ui/iteration/lists/api/src/main/java/org/richfaces/component/
trunk/ui/iteration/lists/ui/src/main/java/org/richfaces/component/AbstractList.java
trunk/ui/iteration/lists/ui/src/main/java/org/richfaces/package-info.java
trunk/ui/iteration/lists/ui/src/main/java/org/richfaces/renderkit/ListRendererBase.java
trunk/ui/iteration/lists/ui/src/main/resources/META-INF/resources/org.richfaces/
trunk/ui/iteration/lists/ui/src/main/templates/list.template.xml
Log:
Richfaces 4.0 restructurization of svn repository structure
Deleted: trunk/ui/iteration/dist/richfaces-ui-iteration-api/pom.xml
===================================================================
--- trunk/ui/iteration/dist/richfaces-ui-iteration-api/pom.xml 2010-08-09 13:04:26 UTC
(rev 18506)
+++ trunk/ui/iteration/dist/richfaces-ui-iteration-api/pom.xml 2010-08-09 13:27:29 UTC
(rev 18507)
@@ -1,169 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
- JBoss, Home of Professional Open Source Copyright 2010, Red Hat,
- Inc. and individual contributors by the @authors tag. See the
- copyright.txt in the distribution for a full listing of
- individual contributors. This is free software; you can
- redistribute it and/or modify it under the terms of the GNU
- Lesser General Public License as published by the Free Software
- Foundation; either version 2.1 of the License, or (at your
- option) any later version. This software 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 software; if not,
- write to the Free Software Foundation, Inc., 51 Franklin St,
- Fifth Floor, Boston, MA 02110-1301 USA, or see the FSF site:
-
http://www.fsf.org.
--->
-<project
xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
http://maven.apache.org/xsd/maven-4.0.0.xsd">
-
- <modelVersion>4.0.0</modelVersion>
-
- <parent>
- <groupId>org.richfaces.ui.iteration</groupId>
- <artifactId>richfaces-ui-iteration-assembler</artifactId>
- <version>4.0.0-SNAPSHOT</version>
- <relativePath>../pom.xml</relativePath>
- </parent>
-
- <groupId>org.richfaces.ui.iteration</groupId>
- <artifactId>richfaces-ui-iteration-api</artifactId>
- <version>4.0.0-SNAPSHOT</version>
- <packaging>jar</packaging>
- <name>Richfaces UI Iteration API</name>
-
- <properties>
-
<assembly.projects.group>org.richfaces.ui.iteration</assembly.projects.group>
-
<faces-shade-transformers.version>2</faces-shade-transformers.version>
- </properties>
-
- <dependencyManagement>
- <dependencies>
- <dependency>
- <groupId>org.richfaces.ui.iteration</groupId>
- <artifactId>richfaces-ui-iteration-bom</artifactId>
- <version>${project.version}</version>
- <scope>import</scope>
- <type>pom</type>
- </dependency>
- </dependencies>
- </dependencyManagement>
-
- <dependencies>
- <!-- artifacts for aggregation -->
- <dependency>
- <groupId>${assembly.projects.group}</groupId>
- <artifactId>datascroller-api</artifactId>
- <version>${project.version}</version>
- </dependency>
- <dependency>
- <groupId>${assembly.projects.group}</groupId>
- <artifactId>tables-api</artifactId>
- <version>${project.version}</version>
- </dependency>
- <dependency>
- <groupId>${assembly.projects.group}</groupId>
- <artifactId>lists-api</artifactId>
- <version>${project.version}</version>
- </dependency>
-
- <!-- artifacts for javadoc generation -->
- <dependency>
- <groupId>${jsf2.api.groupid}</groupId>
- <artifactId>${jsf2.api.artifactid}</artifactId>
- </dependency>
- <dependency>
- <groupId>javax.el</groupId>
- <artifactId>el-api</artifactId>
- </dependency>
- </dependencies>
-
- <build>
- <plugins>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-shade-plugin</artifactId>
- <version>1.3.3</version>
- <executions>
- <execution>
- <phase>package</phase>
- <goals>
- <goal>shade</goal>
- </goals>
- <configuration>
- <artifactSet>
- <includes>
-
<include>${assembly.projects.group}:*-api:*</include>
- </includes>
- </artifactSet>
- <createSourcesJar>true</createSourcesJar>
- </configuration>
- </execution>
- </executions>
- <dependencies>
- <dependency>
- <groupId>org.richfaces.build.resources</groupId>
- <artifactId>faces-shade-transformers</artifactId>
-
<version>${faces-shade-transformers.version}</version>
- </dependency>
- </dependencies>
- </plugin>
- </plugins>
- </build>
-
-
- <profiles>
- <profile>
- <id>release</id>
-
- <build>
- <plugins>
- <plugin>
- <!-- unpack necessary dependencies for collecting javadocs
-->
- <artifactId>maven-dependency-plugin</artifactId>
- <executions>
- <execution>
- <id>deps</id>
- <phase>process-sources</phase>
- <goals>
- <goal>unpack-dependencies</goal>
- </goals>
- <configuration>
- <classifier>sources</classifier>
-
-
<includeGroupIds>${assembly.projects.group}</includeGroupIds>
-
<useSubDirectoryPerArtifact>true</useSubDirectoryPerArtifact>
-
<excludeTransitive>true</excludeTransitive>
- </configuration>
- </execution>
- </executions>
- </plugin>
- <plugin>
- <artifactId>maven-javadoc-plugin</artifactId>
- <version>2.7</version>
- <executions>
- <execution>
- <id>javadoc-jar</id>
- <phase>package</phase>
- <goals>
- <goal>jar</goal>
- </goals>
- <configuration>
-
<sourcepath>${basedir}/target/dependency</sourcepath>
- </configuration>
- </execution>
- </executions>
- </plugin>
- </plugins>
- </build>
- </profile>
- </profiles>
-
- <scm>
-
<
connection>scm:svn:http://anonsvn.jboss.org/repos/richfaces/trunk/ui/i...
-
<
developerConnection>scm:svn:https://svn.jboss.org/repos/richfaces/trun...
- <
url>http://fisheye.jboss.org/browse/richfaces</url>
- </scm>
-</project>
\ No newline at end of file
Copied:
trunk/ui/iteration/dist/richfaces-ui-iteration-api/src/main/java/org/richfaces/component
(from rev 18497, trunk/ui/iteration/lists/api/src/main/java/org/richfaces/component)
Deleted: trunk/ui/iteration/dist/richfaces-ui-iteration-ui/pom.xml
===================================================================
--- trunk/ui/iteration/dist/richfaces-ui-iteration-ui/pom.xml 2010-08-09 13:04:26 UTC (rev
18506)
+++ trunk/ui/iteration/dist/richfaces-ui-iteration-ui/pom.xml 2010-08-09 13:27:29 UTC (rev
18507)
@@ -1,232 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
- JBoss, Home of Professional Open Source Copyright 2010, Red Hat,
- Inc. and individual contributors by the @authors tag. See the
- copyright.txt in the distribution for a full listing of
- individual contributors. This is free software; you can
- redistribute it and/or modify it under the terms of the GNU
- Lesser General Public License as published by the Free Software
- Foundation; either version 2.1 of the License, or (at your
- option) any later version. This software 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 software; if not,
- write to the Free Software Foundation, Inc., 51 Franklin St,
- Fifth Floor, Boston, MA 02110-1301 USA, or see the FSF site:
-
http://www.fsf.org.
--->
-<project
xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
http://maven.apache.org/xsd/maven-4.0.0.xsd">
-
- <modelVersion>4.0.0</modelVersion>
-
- <parent>
- <groupId>org.richfaces.ui.iteration</groupId>
- <artifactId>richfaces-ui-iteration-assembler</artifactId>
- <version>4.0.0-SNAPSHOT</version>
- <relativePath>../pom.xml</relativePath>
- </parent>
-
- <groupId>org.richfaces.ui.iteration</groupId>
- <artifactId>richfaces-ui-iteration-ui</artifactId>
- <version>4.0.0-SNAPSHOT</version>
- <packaging>jar</packaging>
- <name>Richfaces UI Iteration UI</name>
-
- <properties>
-
<assembly.projects.group>org.richfaces.ui.iteration</assembly.projects.group>
-
<faces-shade-transformers.version>2</faces-shade-transformers.version>
- </properties>
-
- <dependencyManagement>
- <dependencies>
- <dependency>
- <groupId>org.richfaces.ui.iteration</groupId>
- <artifactId>richfaces-ui-iteration-bom</artifactId>
- <version>${project.version}</version>
- <scope>import</scope>
- <type>pom</type>
- </dependency>
- </dependencies>
- </dependencyManagement>
-
- <dependencies>
- <dependency>
- <groupId>${project.groupId}</groupId>
- <artifactId>richfaces-ui-iteration-impl</artifactId>
- <version>${project.version}</version>
- </dependency>
-
- <!-- artifacts for aggregation -->
- <dependency>
- <groupId>${assembly.projects.group}</groupId>
- <artifactId>datascroller-ui</artifactId>
- <version>${project.version}</version>
- </dependency>
- <dependency>
- <groupId>${assembly.projects.group}</groupId>
- <artifactId>tables-ui</artifactId>
- <version>${project.version}</version>
- </dependency>
- <dependency>
- <groupId>${assembly.projects.group}</groupId>
- <artifactId>lists-ui</artifactId>
- <version>${project.version}</version>
- </dependency>
-
- <!-- artifacts for javadoc generation -->
- <dependency>
- <groupId>${jsf2.api.groupid}</groupId>
- <artifactId>${jsf2.api.artifactid}</artifactId>
- <scope>provided</scope>
- </dependency>
- <dependency>
- <groupId>javax.el</groupId>
- <artifactId>el-api</artifactId>
- </dependency>
- <dependency>
- <!-- necessary for javadocs generation -->
- <groupId>org.richfaces.cdk</groupId>
- <artifactId>annotations</artifactId>
- <scope>provided</scope>
- </dependency>
- </dependencies>
-
- <build>
- <plugins>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-shade-plugin</artifactId>
- <version>1.3.3</version>
- <executions>
- <execution>
- <phase>package</phase>
- <goals>
- <goal>shade</goal>
- </goals>
- <configuration>
- <artifactSet>
- <includes>
-
<include>${assembly.projects.group}:*-ui:*</include>
- </includes>
- </artifactSet>
- <createSourcesJar>true</createSourcesJar>
- <transformers>
- <transformer
implementation="org.richfaces.build.shade.resource.TaglibXmlResourceTransformer">
- <taglibs>
- <taglib>
-
<
targetNamespace>http://richfaces.org/iteration</targetNamespace>
-
<sourceNamespacesPattern>.*</sourceNamespacesPattern>
- </taglib>
- </taglibs>
- </transformer>
- <transformer
implementation="org.richfaces.build.shade.resource.FacesConfigXmlResourceTransformer"
/>
- </transformers>
- </configuration>
- </execution>
- </executions>
- <dependencies>
- <dependency>
- <groupId>org.richfaces.build.resources</groupId>
- <artifactId>faces-shade-transformers</artifactId>
-
<version>${faces-shade-transformers.version}</version>
- </dependency>
- </dependencies>
- </plugin>
- </plugins>
- </build>
- <profiles>
- <profile>
- <id>release</id>
-
- <build>
- <plugins>
- <plugin>
- <!-- unpack necessary dependencies for collecting jsdoc and
javadocs -->
- <artifactId>maven-dependency-plugin</artifactId>
- <executions>
- <execution>
- <id>deps</id>
- <phase>process-sources</phase>
- <goals>
- <goal>unpack-dependencies</goal>
- </goals>
- <configuration>
- <classifier>sources</classifier>
-
-
<includeGroupIds>${assembly.projects.group}</includeGroupIds>
-
<useSubDirectoryPerArtifact>true</useSubDirectoryPerArtifact>
-
<excludeTransitive>true</excludeTransitive>
- </configuration>
- </execution>
- </executions>
- </plugin>
- <plugin>
- <!-- collecting jsdoc -->
- <groupId>gr.abiss.mvn.plugins</groupId>
- <artifactId>maven-jstools-plugin</artifactId>
- <executions>
- <execution>
- <id>jsdoc</id>
- <phase>prepare-package</phase>
- <configuration>
-
<outputBaseDirectory>${basedir}/target</outputBaseDirectory>
-
<jsDir>${basedir}/target/dependency</jsDir>
- <includes>**/*.js</includes>
- <caseSensitive>true</caseSensitive>
- </configuration>
- <goals>
- <goal>jsdoc</goal>
- </goals>
- </execution>
- </executions>
- </plugin>
- <plugin>
- <!-- pack jsdoc to jar -->
- <artifactId>maven-jar-plugin</artifactId>
- <executions>
- <execution>
- <id>pack-jsodcs</id>
- <phase>package</phase>
- <goals>
- <goal>jar</goal>
- </goals>
- <configuration>
-
<classesDirectory>${basedir}/target/jsdoc</classesDirectory>
- <classifier>jsdoc</classifier>
- <excludes>
- <exclude>**/symbols/src/*</exclude>
- </excludes>
- </configuration>
- </execution>
- </executions>
- </plugin>
- <plugin>
- <!-- collecting javadoc -->
- <artifactId>maven-javadoc-plugin</artifactId>
- <version>2.7</version>
- <executions>
- <execution>
- <id>javadoc-jar</id>
- <phase>package</phase>
- <goals>
- <goal>jar</goal>
- </goals>
- <configuration>
-
<sourcepath>${basedir}/target/dependency</sourcepath>
- </configuration>
- </execution>
- </executions>
- </plugin>
- </plugins>
- </build>
- </profile>
- </profiles>
-
- <scm>
-
<
connection>scm:svn:http://anonsvn.jboss.org/repos/richfaces/trunk/ui/i...
-
<
developerConnection>scm:svn:https://svn.jboss.org/repos/richfaces/trun...
- <
url>http://fisheye.jboss.org/browse/richfaces</url>
- </scm>
-</project>
\ No newline at end of file
Copied:
trunk/ui/iteration/dist/richfaces-ui-iteration-ui/src/main/java/org/richfaces/component/AbstractList.java
(from rev 18497,
trunk/ui/iteration/lists/ui/src/main/java/org/richfaces/component/AbstractList.java)
===================================================================
---
trunk/ui/iteration/dist/richfaces-ui-iteration-ui/src/main/java/org/richfaces/component/AbstractList.java
(rev 0)
+++
trunk/ui/iteration/dist/richfaces-ui-iteration-ui/src/main/java/org/richfaces/component/AbstractList.java 2010-08-09
13:27:29 UTC (rev 18507)
@@ -0,0 +1,161 @@
+/**
+ * License Agreement.
+ *
+ * JBoss RichFaces - Ajax4jsf Component Library
+ *
+ * Copyright (C) 2007 Exadel, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1 as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+package org.richfaces.component;
+
+import java.util.Iterator;
+
+import javax.faces.component.UIComponent;
+
+import org.richfaces.cdk.annotations.Attribute;
+import org.richfaces.cdk.annotations.EventName;
+import org.richfaces.cdk.annotations.Facet;
+import org.richfaces.cdk.annotations.JsfComponent;
+import org.richfaces.cdk.annotations.JsfRenderer;
+
+import com.google.common.base.Predicate;
+import com.google.common.base.Predicates;
+import com.google.common.collect.Iterators;
+import com.google.common.collect.Maps;
+
+/**
+ * JSF component class
+ *
+ */
+@JsfComponent(type = "org.richfaces.List", family =
"org.richfaces.List", facets = @Facet(name = AbstractList.TERM),
+ renderer = @JsfRenderer(type = "org.richfaces.ListRenderer"))
+public abstract class AbstractList extends UISequence {
+
+ public static final String TERM = "term";
+
+ private static final Predicate<String> TERM_PREDICATE = new
Predicate<String>() {
+
+ public boolean apply(String input) {
+ return TERM.equals(input);
+ }
+ };
+
+ private static final Predicate<String> NON_TERM_PREDICATE =
Predicates.not(TERM_PREDICATE);
+
+ private Iterator<UIComponent> getFacetsIterator(Predicate<? super String>
namePredicate) {
+ if (getFacetCount() > 0) {
+ return Maps.filterKeys(getFacets(), namePredicate).values().iterator();
+ }
+
+ return Iterators.emptyIterator();
+ }
+
+ protected Iterator<UIComponent> dataChildren() {
+ return Iterators.concat(getChildren().iterator(),
getFacetsIterator(TERM_PREDICATE));
+ }
+
+ protected Iterator<UIComponent> fixedChildren() {
+ return getFacetsIterator(NON_TERM_PREDICATE);
+ }
+
+ @Attribute(required = true)
+ public abstract ListType getType();
+
+ public UIComponent getTerm() {
+ return getFacet(TERM);
+ }
+
+ @Attribute(events = @EventName("click"))
+ public abstract String getOnclick();
+
+ @Attribute(events = @EventName("dblclick"))
+ public abstract String getOndblclick();
+
+ @Attribute(events = @EventName("mousedown"))
+ public abstract String getOnmousedown();
+
+ @Attribute(events = @EventName("mouseup"))
+ public abstract String getOnmouseup();
+
+ @Attribute(events = @EventName("mouseover"))
+ public abstract String getOnmouseover();
+
+ @Attribute(events = @EventName("mousemove"))
+ public abstract String getOnmousemove();
+
+ @Attribute(events = @EventName("mouseout"))
+ public abstract String getOnmouseout();
+
+ @Attribute(events = @EventName("keypress"))
+ public abstract String getOnkeypress();
+
+ @Attribute(events = @EventName("keydown"))
+ public abstract String getOnkeydown();
+
+ @Attribute(events = @EventName("keyup"))
+ public abstract String getOnkeyup();
+
+ @Attribute(events = @EventName("rowclick"))
+ public abstract String getOnrowclick();
+
+ @Attribute(events = @EventName("rowdblclick"))
+ public abstract String getOnrowdblclick();
+
+ @Attribute(events = @EventName("rowmousedown"))
+ public abstract String getOnrowmousedown();
+
+ @Attribute(events = @EventName("rowmouseup"))
+ public abstract String getOnrowmouseup();
+
+ @Attribute(events = @EventName("rowmouseover"))
+ public abstract String getOnrowmouseover();
+
+ @Attribute(events = @EventName("rowmousemove"))
+ public abstract String getOnrowmousemove();
+
+ @Attribute(events = @EventName("rowmouseout"))
+ public abstract String getOnrowmouseout();
+
+ @Attribute(events = @EventName("rowkeypress"))
+ public abstract String getOnrowkeypress();
+
+ @Attribute(events = @EventName("rowkeydown"))
+ public abstract String getOnrowkeydown();
+
+ @Attribute(events = @EventName("rowkeyup"))
+ public abstract String getOnrowkeyup();
+
+ @Attribute
+ public abstract String getStyle();
+
+ @Attribute
+ public abstract String getStyleClass();
+
+ @Attribute
+ public abstract String getTitle();
+
+ @Attribute
+ public abstract String getDir();
+
+ @Attribute
+ public abstract String getLang();
+
+ @Attribute
+ public abstract String getRowClasses();
+
+ @Attribute
+ public abstract String getRowClass();
+}
Copied:
trunk/ui/iteration/dist/richfaces-ui-iteration-ui/src/main/java/org/richfaces/package-info.java
(from rev 18497,
trunk/ui/iteration/lists/ui/src/main/java/org/richfaces/package-info.java)
===================================================================
---
trunk/ui/iteration/dist/richfaces-ui-iteration-ui/src/main/java/org/richfaces/package-info.java
(rev 0)
+++
trunk/ui/iteration/dist/richfaces-ui-iteration-ui/src/main/java/org/richfaces/package-info.java 2010-08-09
13:27:29 UTC (rev 18507)
@@ -0,0 +1,5 @@
+/**
+ * Implementation of RichFaces data lists
+ */
+@org.richfaces.cdk.annotations.TagLibrary(uri="http://richfaces.org/lists",
shortName="lists")
+package org.richfaces;
\ No newline at end of file
Copied:
trunk/ui/iteration/dist/richfaces-ui-iteration-ui/src/main/java/org/richfaces/renderkit/ListRendererBase.java
(from rev 18497,
trunk/ui/iteration/lists/ui/src/main/java/org/richfaces/renderkit/ListRendererBase.java)
===================================================================
---
trunk/ui/iteration/dist/richfaces-ui-iteration-ui/src/main/java/org/richfaces/renderkit/ListRendererBase.java
(rev 0)
+++
trunk/ui/iteration/dist/richfaces-ui-iteration-ui/src/main/java/org/richfaces/renderkit/ListRendererBase.java 2010-08-09
13:27:29 UTC (rev 18507)
@@ -0,0 +1,272 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc. and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software 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 software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
+ */
+package org.richfaces.renderkit;
+
+import java.io.IOException;
+import java.text.MessageFormat;
+import java.util.Collections;
+import java.util.Map;
+
+import javax.faces.FacesException;
+import javax.faces.application.ResourceDependency;
+import javax.faces.component.UIComponent;
+import javax.faces.context.FacesContext;
+import javax.faces.context.ResponseWriter;
+import javax.faces.render.Renderer;
+
+import org.ajax4jsf.model.DataVisitResult;
+import org.ajax4jsf.model.DataVisitor;
+import org.ajax4jsf.renderkit.RendererUtils;
+import org.ajax4jsf.renderkit.RendererUtils.HTML;
+import org.richfaces.component.AbstractList;
+import org.richfaces.component.ListType;
+import org.richfaces.component.UISequence;
+import org.richfaces.component.util.HtmlUtil;
+import org.richfaces.log.RichfacesLogger;
+
+/**
+ * @author Nick Belaevski
+ *
+ */
+@ResourceDependency(library = "org.richfaces", name = "list.ecss")
+public abstract class ListRendererBase extends Renderer {
+
+ private static final Map<String, ComponentAttribute> ROW_HANDLER_ATTRIBUTES =
Collections
+ .unmodifiableMap(ComponentAttribute.createMap(
+ new
ComponentAttribute(HTML.ONCLICK_ATTRIBUTE).setEventNames("rowclick").
+ setComponentAttributeName("onrowclick"),
+ new
ComponentAttribute(HTML.ONDBLCLICK_ATTRIBUTE).setEventNames("rowdblclick").
+ setComponentAttributeName("onrowdblclick"),
+ new
ComponentAttribute(HTML.ONMOUSEDOWN_ATTRIBUTE).setEventNames("rowmousedown").
+ setComponentAttributeName("onrowmousedown"),
+ new
ComponentAttribute(HTML.ONMOUSEUP_ATTRIBUTE).setEventNames("rowmouseup").
+ setComponentAttributeName("onrowmouseup"),
+ new
ComponentAttribute(HTML.ONMOUSEOVER_ATTRIBUTE).setEventNames("rowmouseover").
+ setComponentAttributeName("onrowmouseover"),
+ new
ComponentAttribute(HTML.ONMOUSEMOVE_ATTRIBUTE).setEventNames("rowmousemove").
+ setComponentAttributeName("onrowmousemove"),
+ new
ComponentAttribute(HTML.ONMOUSEOUT_ATTRIBUTE).setEventNames("rowmouseout").
+ setComponentAttributeName("onrowmouseout"),
+ new
ComponentAttribute(HTML.ONKEYPRESS_ATTRIBUTE).setEventNames("rowkeypress").
+ setComponentAttributeName("onrowkeypress"),
+ new
ComponentAttribute(HTML.ONKEYDOWN_ATTRIBUTE).setEventNames("rowkeydown").
+ setComponentAttributeName("onrowkeydown"),
+ new
ComponentAttribute(HTML.ONKEYUP_ATTRIBUTE).setEventNames("rowkeyup").
+ setComponentAttributeName("onrowkeyup")
+ ));
+
+ private RendererUtils rendererUtils = RendererUtils.getInstance();
+
+ /**
+ * @author Nick Belaevski
+ *
+ */
+ private class SimpleItemsEncoder extends ItemsEncoder {
+
+ private String itemClass;
+
+ public SimpleItemsEncoder(String itemClass) {
+ super();
+ this.itemClass = itemClass;
+ }
+
+ @Override
+ protected void encodeRow(FacesContext context, UISequence sequence,
SequenceRendererHelper helper)
+ throws IOException {
+ ResponseWriter writer = context.getResponseWriter();
+
+ writer.startElement(HTML.LI_ELEMENT, sequence);
+
+ if (rendererUtils.hasExplicitId(sequence)) {
+ rendererUtils.writeAttribute(writer, HTML.ID_ATTRIBUTE,
sequence.getClientId(context));
+ }
+
+ rendererUtils.writeAttribute(writer, HTML.CLASS_ATTRIBUTE,
+ HtmlUtil.concatClasses(helper.getRowClass(), helper.getColumnClass(),
itemClass));
+ renderHandlers(context, sequence);
+ rendererUtils.encodeChildren(context, sequence);
+ writer.endElement(HTML.LI_ELEMENT);
+ }
+
+ public void encodeFakeItem(FacesContext context, UIComponent component) throws
IOException {
+ ResponseWriter writer = context.getResponseWriter();
+ writer.startElement(HTML.LI_ELEMENT, component);
+ writer.writeAttribute(HTML.STYLE_ATTRIBUTE, "display:none", null);
+ writer.endElement(HTML.LI_ELEMENT);
+ }
+ }
+
+ /**
+ * @author Nick Belaevski
+ *
+ */
+ private final class DefinitionItemsEncoder extends ItemsEncoder {
+ @Override
+ protected void encodeRow(FacesContext context, UISequence sequence,
SequenceRendererHelper helper)
+ throws IOException {
+ ResponseWriter writer = context.getResponseWriter();
+
+ UIComponent termFacet = sequence.getFacet(AbstractList.TERM);
+ if (termFacet != null) {
+ writer.startElement(HTML.DT_ELEMENT, sequence);
+
+ if (rendererUtils.hasExplicitId(sequence)) {
+ rendererUtils.writeAttribute(writer, HTML.ID_ATTRIBUTE,
sequence.getClientId(context) + ".dt");
+ }
+
+ rendererUtils.writeAttribute(writer, HTML.CLASS_ATTRIBUTE,
+ HtmlUtil.concatClasses(helper.getRowClass(), helper.getColumnClass(),
"rf-dlst-t"));
+ termFacet.encodeAll(context);
+ writer.endElement(HTML.DT_ELEMENT);
+ }
+
+ writer.startElement(HTML.DD_ELEMENT, sequence);
+
+ if (rendererUtils.hasExplicitId(sequence)) {
+ rendererUtils.writeAttribute(writer, HTML.ID_ATTRIBUTE,
sequence.getClientId(context));
+ }
+
+ rendererUtils.writeAttribute(writer, HTML.CLASS_ATTRIBUTE,
+ HtmlUtil.concatClasses(helper.getRowClass(), helper.getColumnClass(),
"rf-dlst-d"));
+ renderHandlers(context, sequence);
+ rendererUtils.encodeChildren(context, sequence);
+ writer.endElement(HTML.DD_ELEMENT);
+ }
+
+ public void encodeFakeItem(FacesContext context, UIComponent component) throws
IOException {
+ ResponseWriter writer = context.getResponseWriter();
+ writer.startElement(HTML.DD_ELEMENT, component);
+ writer.writeAttribute(HTML.STYLE_ATTRIBUTE, "display:none", null);
+ writer.endElement(HTML.DD_ELEMENT);
+ }
+ }
+
+ private abstract class ItemsEncoder implements DataVisitor {
+
+ protected void renderHandlers(FacesContext context, UISequence sequence) throws
IOException {
+ RenderKitUtils.renderPassThroughAttributesOptimized(context, sequence,
ROW_HANDLER_ATTRIBUTES);
+ }
+
+ protected abstract void encodeRow(FacesContext context, UISequence sequence,
SequenceRendererHelper helper)
+ throws IOException;
+
+ public DataVisitResult process(FacesContext context, Object rowKey, Object
argument) {
+ SequenceRendererHelper helper = (SequenceRendererHelper) argument;
+ UISequence sequence = helper.getSequence();
+ sequence.setRowKey(context, rowKey);
+ if (sequence.isRowAvailable()) {
+ helper.nextRow();
+
+ try {
+ encodeRow(context, sequence, helper);
+ } catch (IOException e) {
+ throw new FacesException(e.getMessage(), e);
+ }
+
+ return DataVisitResult.CONTINUE;
+ } else {
+ return DataVisitResult.STOP;
+ }
+ }
+
+ public abstract void encodeFakeItem(FacesContext context, UIComponent component)
throws IOException;
+
+ }
+
+ private ItemsEncoder unorderedListItemsEncoder = new
SimpleItemsEncoder("rf-ulst-i");
+
+ private ItemsEncoder orderedListItemsEncoder = new
SimpleItemsEncoder("rf-olst-i");
+
+ private ItemsEncoder definitionItemsEncoder = new DefinitionItemsEncoder();
+
+ protected String getListClass(ListType type) {
+ switch (type) {
+ case ordered:
+ return "rf-olst";
+ case unordered:
+ return "rf-ulst";
+ case definitions:
+ return "rf-dlst";
+
+ default:
+ throw new IllegalArgumentException(type.toString());
+ }
+ }
+
+ protected ItemsEncoder getItemsEncoderByType(ListType type) {
+ switch (type) {
+ case ordered:
+ return orderedListItemsEncoder;
+ case unordered:
+ return unorderedListItemsEncoder;
+ case definitions:
+ return definitionItemsEncoder;
+
+ default:
+ throw new IllegalArgumentException(type.toString());
+ }
+ }
+
+ protected ListType getType(UIComponent component) {
+ ListType type = ((AbstractList) component).getType();
+ if (type == null) {
+ String exceptionMessage = MessageFormat.format("Type for rich:list {0}
is required!", RichfacesLogger.getComponentPath(component));
+ throw new IllegalArgumentException(exceptionMessage);
+ }
+
+ return type;
+ }
+
+ protected String getStyleClass(UIComponent component, ListType listType) {
+ String styleClass = (String)
component.getAttributes().get(HTML.STYLE_CLASS_ATTR);
+ return HtmlUtil.concatClasses(styleClass, getListClass(listType));
+ }
+
+ protected String getElementId(FacesContext facesContext, UIComponent component) {
+ if (rendererUtils.hasExplicitId(component)) {
+ return component.getClientId(facesContext);
+ }
+
+ return null;
+ }
+
+ protected void encodeListItems(FacesContext context, UIComponent component, ListType
listType)
+ throws IOException {
+ AbstractList list = (AbstractList) component;
+ try {
+ ItemsEncoder itemsEncoder = getItemsEncoderByType(listType);
+ SequenceRendererHelper rendererHelper = new SequenceRendererHelper(list);
+ list.walk(context, itemsEncoder, rendererHelper);
+
+ if (!rendererHelper.hasWalkedOverRows()) {
+ itemsEncoder.encodeFakeItem(context, component);
+ }
+ } catch (FacesException e) {
+ // TODO nick - review
+ if (e.getCause() instanceof IOException) {
+ throw (IOException) e.getCause();
+ } else {
+ throw e;
+ }
+ }
+ }
+}
Copied:
trunk/ui/iteration/dist/richfaces-ui-iteration-ui/src/main/resources/META-INF/resources/org.richfaces
(from rev 18497,
trunk/ui/iteration/lists/ui/src/main/resources/META-INF/resources/org.richfaces)
Copied:
trunk/ui/iteration/dist/richfaces-ui-iteration-ui/src/main/templates/list.template.xml
(from rev 18497, trunk/ui/iteration/lists/ui/src/main/templates/list.template.xml)
===================================================================
---
trunk/ui/iteration/dist/richfaces-ui-iteration-ui/src/main/templates/list.template.xml
(rev 0)
+++
trunk/ui/iteration/dist/richfaces-ui-iteration-ui/src/main/templates/list.template.xml 2010-08-09
13:27:29 UTC (rev 18507)
@@ -0,0 +1,104 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<cdk:root
xmlns="http://richfaces.org/cdk/xhtml-el"
xmlns:cdk="http://richfaces.org/cdk/core"
+
xmlns:c="http://richfaces.org/cdk/jstl/core"
xmlns:cc="http://richfaces.org/cdk/jsf/composite"
+
xmlns:javaee="http://java.sun.com/xml/ns/javaee">
+
+ <cc:interface>
+ <cdk:class>org.richfaces.renderkit.html.ListRenderer</cdk:class>
+
<cdk:superclass>org.richfaces.renderkit.ListRendererBase</cdk:superclass>
+ <cdk:component-family>org.richfaces.List</cdk:component-family>
+ <cdk:renderer-type>org.richfaces.ListRenderer
+ </cdk:renderer-type>
+ <cdk:renders-children>true</cdk:renders-children>
+
+ <!--
+ <cc:attribute name="onclick" type="java.lang.String">
+ <cc:clientBehavior event="click" />
+ </cc:attribute>
+ <cc:attribute name="ondblclick"
type="java.lang.String">
+ <cc:clientBehavior event="dblclick" />
+ </cc:attribute>
+ <cc:attribute name="onmousedown"
type="java.lang.String">
+ <cc:clientBehavior event="mousedown" />
+ </cc:attribute>
+ <cc:attribute name="onmouseup"
type="java.lang.String">
+ <cc:clientBehavior event="mouseup" />
+ </cc:attribute>
+ <cc:attribute name="onmouseover"
type="java.lang.String">
+ <cc:clientBehavior event="mouseover" />
+ </cc:attribute>
+ <cc:attribute name="onmousemove"
type="java.lang.String">
+ <cc:clientBehavior event="mousemove" />
+ </cc:attribute>
+ <cc:attribute name="onmouseout"
type="java.lang.String">
+ <cc:clientBehavior event="mouseout" />
+ </cc:attribute>
+ <cc:attribute name="onkeypress"
type="java.lang.String">
+ <cc:clientBehavior event="keypress" />
+ </cc:attribute>
+ <cc:attribute name="onkeydown"
type="java.lang.String">
+ <cc:clientBehavior event="keydown" />
+ </cc:attribute>
+ <cc:attribute name="onkeyup" type="java.lang.String">
+ <cc:clientBehavior event="keyup" />
+ </cc:attribute>
+ <cc:attribute name="onrowclick"
type="java.lang.String">
+ <cc:clientBehavior event="rowclick" />
+ </cc:attribute>
+ <cc:attribute name="onrowdblclick"
type="java.lang.String">
+ <cc:clientBehavior event="rowdblclick" />
+ </cc:attribute>
+ <cc:attribute name="onrowmousedown"
type="java.lang.String">
+ <cc:clientBehavior event="rowmousedown" />
+ </cc:attribute>
+ <cc:attribute name="onrowmouseup"
type="java.lang.String">
+ <cc:clientBehavior event="rowmouseup" />
+ </cc:attribute>
+ <cc:attribute name="onrowmouseover"
type="java.lang.String">
+ <cc:clientBehavior event="rowmouseover" />
+ </cc:attribute>
+ <cc:attribute name="onrowmousemove"
type="java.lang.String">
+ <cc:clientBehavior event="rowmousemove" />
+ </cc:attribute>
+ <cc:attribute name="onrowmouseout"
type="java.lang.String">
+ <cc:clientBehavior event="rowmouseout" />
+ </cc:attribute>
+ <cc:attribute name="onrowkeypress"
type="java.lang.String">
+ <cc:clientBehavior event="rowkeypress" />
+ </cc:attribute>
+ <cc:attribute name="onrowkeydown"
type="java.lang.String">
+ <cc:clientBehavior event="rowkeydown" />
+ </cc:attribute>
+ <cc:attribute name="onrowkeyup"
type="java.lang.String">
+ <cc:clientBehavior event="rowkeyup" />
+ </cc:attribute>
+ -->
+ </cc:interface>
+
+ <cc:implementation>
+ <cdk:object type="org.richfaces.component.ListType"
name="listType" value="#{getType(component)}" />
+
+ <cdk:object name="styleClass" value="#{getStyleClass(component,
listType)}" />
+ <cdk:object name="elementId"
value="#{getElementId(facesContext, component)}" />
+
+ <cdk:switch key="#{listType}">
+ <cdk:case values="ordered">
+ <ol id="#{elementId}" class="#{styleClass}"
cdk:passThroughWithExclusions="type value">
+ <cdk:call expression="encodeListItems(facesContext, component,
listType)" />
+ </ol>
+ </cdk:case>
+ <cdk:case values="unordered">
+ <ul id="#{elementId}" class="#{styleClass}"
cdk:passThroughWithExclusions="type value">
+ <cdk:call expression="encodeListItems(facesContext, component,
listType)" />
+ </ul>
+ </cdk:case>
+ <cdk:case values="definitions">
+ <dl id="#{elementId}" class="#{styleClass}"
cdk:passThroughWithExclusions="type value">
+ <cdk:call expression="encodeListItems(facesContext, component,
listType)" />
+ </dl>
+ </cdk:case>
+ </cdk:switch>
+ </cc:implementation>
+
+</cdk:root>
Deleted:
trunk/ui/iteration/lists/ui/src/main/java/org/richfaces/component/AbstractList.java
===================================================================
---
trunk/ui/iteration/lists/ui/src/main/java/org/richfaces/component/AbstractList.java 2010-08-09
13:04:26 UTC (rev 18506)
+++
trunk/ui/iteration/lists/ui/src/main/java/org/richfaces/component/AbstractList.java 2010-08-09
13:27:29 UTC (rev 18507)
@@ -1,161 +0,0 @@
-/**
- * License Agreement.
- *
- * JBoss RichFaces - Ajax4jsf Component Library
- *
- * Copyright (C) 2007 Exadel, Inc.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License version 2.1 as published by the Free Software Foundation.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-package org.richfaces.component;
-
-import java.util.Iterator;
-
-import javax.faces.component.UIComponent;
-
-import org.richfaces.cdk.annotations.Attribute;
-import org.richfaces.cdk.annotations.EventName;
-import org.richfaces.cdk.annotations.Facet;
-import org.richfaces.cdk.annotations.JsfComponent;
-import org.richfaces.cdk.annotations.JsfRenderer;
-
-import com.google.common.base.Predicate;
-import com.google.common.base.Predicates;
-import com.google.common.collect.Iterators;
-import com.google.common.collect.Maps;
-
-/**
- * JSF component class
- *
- */
-@JsfComponent(type = "org.richfaces.List", family =
"org.richfaces.List", facets = @Facet(name = AbstractList.TERM),
- renderer = @JsfRenderer(type = "org.richfaces.ListRenderer"))
-public abstract class AbstractList extends UISequence {
-
- public static final String TERM = "term";
-
- private static final Predicate<String> TERM_PREDICATE = new
Predicate<String>() {
-
- public boolean apply(String input) {
- return TERM.equals(input);
- }
- };
-
- private static final Predicate<String> NON_TERM_PREDICATE =
Predicates.not(TERM_PREDICATE);
-
- private Iterator<UIComponent> getFacetsIterator(Predicate<? super String>
namePredicate) {
- if (getFacetCount() > 0) {
- return Maps.filterKeys(getFacets(), namePredicate).values().iterator();
- }
-
- return Iterators.emptyIterator();
- }
-
- protected Iterator<UIComponent> dataChildren() {
- return Iterators.concat(getChildren().iterator(),
getFacetsIterator(TERM_PREDICATE));
- }
-
- protected Iterator<UIComponent> fixedChildren() {
- return getFacetsIterator(NON_TERM_PREDICATE);
- }
-
- @Attribute(required = true)
- public abstract ListType getType();
-
- public UIComponent getTerm() {
- return getFacet(TERM);
- }
-
- @Attribute(events = @EventName("click"))
- public abstract String getOnclick();
-
- @Attribute(events = @EventName("dblclick"))
- public abstract String getOndblclick();
-
- @Attribute(events = @EventName("mousedown"))
- public abstract String getOnmousedown();
-
- @Attribute(events = @EventName("mouseup"))
- public abstract String getOnmouseup();
-
- @Attribute(events = @EventName("mouseover"))
- public abstract String getOnmouseover();
-
- @Attribute(events = @EventName("mousemove"))
- public abstract String getOnmousemove();
-
- @Attribute(events = @EventName("mouseout"))
- public abstract String getOnmouseout();
-
- @Attribute(events = @EventName("keypress"))
- public abstract String getOnkeypress();
-
- @Attribute(events = @EventName("keydown"))
- public abstract String getOnkeydown();
-
- @Attribute(events = @EventName("keyup"))
- public abstract String getOnkeyup();
-
- @Attribute(events = @EventName("rowclick"))
- public abstract String getOnrowclick();
-
- @Attribute(events = @EventName("rowdblclick"))
- public abstract String getOnrowdblclick();
-
- @Attribute(events = @EventName("rowmousedown"))
- public abstract String getOnrowmousedown();
-
- @Attribute(events = @EventName("rowmouseup"))
- public abstract String getOnrowmouseup();
-
- @Attribute(events = @EventName("rowmouseover"))
- public abstract String getOnrowmouseover();
-
- @Attribute(events = @EventName("rowmousemove"))
- public abstract String getOnrowmousemove();
-
- @Attribute(events = @EventName("rowmouseout"))
- public abstract String getOnrowmouseout();
-
- @Attribute(events = @EventName("rowkeypress"))
- public abstract String getOnrowkeypress();
-
- @Attribute(events = @EventName("rowkeydown"))
- public abstract String getOnrowkeydown();
-
- @Attribute(events = @EventName("rowkeyup"))
- public abstract String getOnrowkeyup();
-
- @Attribute
- public abstract String getStyle();
-
- @Attribute
- public abstract String getStyleClass();
-
- @Attribute
- public abstract String getTitle();
-
- @Attribute
- public abstract String getDir();
-
- @Attribute
- public abstract String getLang();
-
- @Attribute
- public abstract String getRowClasses();
-
- @Attribute
- public abstract String getRowClass();
-}
Deleted: trunk/ui/iteration/lists/ui/src/main/java/org/richfaces/package-info.java
===================================================================
--- trunk/ui/iteration/lists/ui/src/main/java/org/richfaces/package-info.java 2010-08-09
13:04:26 UTC (rev 18506)
+++ trunk/ui/iteration/lists/ui/src/main/java/org/richfaces/package-info.java 2010-08-09
13:27:29 UTC (rev 18507)
@@ -1,5 +0,0 @@
-/**
- * Implementation of RichFaces data lists
- */
-@org.richfaces.cdk.annotations.TagLibrary(uri="http://richfaces.org/lists",
shortName="lists")
-package org.richfaces;
\ No newline at end of file
Deleted:
trunk/ui/iteration/lists/ui/src/main/java/org/richfaces/renderkit/ListRendererBase.java
===================================================================
---
trunk/ui/iteration/lists/ui/src/main/java/org/richfaces/renderkit/ListRendererBase.java 2010-08-09
13:04:26 UTC (rev 18506)
+++
trunk/ui/iteration/lists/ui/src/main/java/org/richfaces/renderkit/ListRendererBase.java 2010-08-09
13:27:29 UTC (rev 18507)
@@ -1,272 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2010, Red Hat, Inc. and individual contributors
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software 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 software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
- */
-package org.richfaces.renderkit;
-
-import java.io.IOException;
-import java.text.MessageFormat;
-import java.util.Collections;
-import java.util.Map;
-
-import javax.faces.FacesException;
-import javax.faces.application.ResourceDependency;
-import javax.faces.component.UIComponent;
-import javax.faces.context.FacesContext;
-import javax.faces.context.ResponseWriter;
-import javax.faces.render.Renderer;
-
-import org.ajax4jsf.model.DataVisitResult;
-import org.ajax4jsf.model.DataVisitor;
-import org.ajax4jsf.renderkit.RendererUtils;
-import org.ajax4jsf.renderkit.RendererUtils.HTML;
-import org.richfaces.component.AbstractList;
-import org.richfaces.component.ListType;
-import org.richfaces.component.UISequence;
-import org.richfaces.component.util.HtmlUtil;
-import org.richfaces.log.RichfacesLogger;
-
-/**
- * @author Nick Belaevski
- *
- */
-@ResourceDependency(library = "org.richfaces", name = "list.ecss")
-public abstract class ListRendererBase extends Renderer {
-
- private static final Map<String, ComponentAttribute> ROW_HANDLER_ATTRIBUTES =
Collections
- .unmodifiableMap(ComponentAttribute.createMap(
- new
ComponentAttribute(HTML.ONCLICK_ATTRIBUTE).setEventNames("rowclick").
- setComponentAttributeName("onrowclick"),
- new
ComponentAttribute(HTML.ONDBLCLICK_ATTRIBUTE).setEventNames("rowdblclick").
- setComponentAttributeName("onrowdblclick"),
- new
ComponentAttribute(HTML.ONMOUSEDOWN_ATTRIBUTE).setEventNames("rowmousedown").
- setComponentAttributeName("onrowmousedown"),
- new
ComponentAttribute(HTML.ONMOUSEUP_ATTRIBUTE).setEventNames("rowmouseup").
- setComponentAttributeName("onrowmouseup"),
- new
ComponentAttribute(HTML.ONMOUSEOVER_ATTRIBUTE).setEventNames("rowmouseover").
- setComponentAttributeName("onrowmouseover"),
- new
ComponentAttribute(HTML.ONMOUSEMOVE_ATTRIBUTE).setEventNames("rowmousemove").
- setComponentAttributeName("onrowmousemove"),
- new
ComponentAttribute(HTML.ONMOUSEOUT_ATTRIBUTE).setEventNames("rowmouseout").
- setComponentAttributeName("onrowmouseout"),
- new
ComponentAttribute(HTML.ONKEYPRESS_ATTRIBUTE).setEventNames("rowkeypress").
- setComponentAttributeName("onrowkeypress"),
- new
ComponentAttribute(HTML.ONKEYDOWN_ATTRIBUTE).setEventNames("rowkeydown").
- setComponentAttributeName("onrowkeydown"),
- new
ComponentAttribute(HTML.ONKEYUP_ATTRIBUTE).setEventNames("rowkeyup").
- setComponentAttributeName("onrowkeyup")
- ));
-
- private RendererUtils rendererUtils = RendererUtils.getInstance();
-
- /**
- * @author Nick Belaevski
- *
- */
- private class SimpleItemsEncoder extends ItemsEncoder {
-
- private String itemClass;
-
- public SimpleItemsEncoder(String itemClass) {
- super();
- this.itemClass = itemClass;
- }
-
- @Override
- protected void encodeRow(FacesContext context, UISequence sequence,
SequenceRendererHelper helper)
- throws IOException {
- ResponseWriter writer = context.getResponseWriter();
-
- writer.startElement(HTML.LI_ELEMENT, sequence);
-
- if (rendererUtils.hasExplicitId(sequence)) {
- rendererUtils.writeAttribute(writer, HTML.ID_ATTRIBUTE,
sequence.getClientId(context));
- }
-
- rendererUtils.writeAttribute(writer, HTML.CLASS_ATTRIBUTE,
- HtmlUtil.concatClasses(helper.getRowClass(), helper.getColumnClass(),
itemClass));
- renderHandlers(context, sequence);
- rendererUtils.encodeChildren(context, sequence);
- writer.endElement(HTML.LI_ELEMENT);
- }
-
- public void encodeFakeItem(FacesContext context, UIComponent component) throws
IOException {
- ResponseWriter writer = context.getResponseWriter();
- writer.startElement(HTML.LI_ELEMENT, component);
- writer.writeAttribute(HTML.STYLE_ATTRIBUTE, "display:none", null);
- writer.endElement(HTML.LI_ELEMENT);
- }
- }
-
- /**
- * @author Nick Belaevski
- *
- */
- private final class DefinitionItemsEncoder extends ItemsEncoder {
- @Override
- protected void encodeRow(FacesContext context, UISequence sequence,
SequenceRendererHelper helper)
- throws IOException {
- ResponseWriter writer = context.getResponseWriter();
-
- UIComponent termFacet = sequence.getFacet(AbstractList.TERM);
- if (termFacet != null) {
- writer.startElement(HTML.DT_ELEMENT, sequence);
-
- if (rendererUtils.hasExplicitId(sequence)) {
- rendererUtils.writeAttribute(writer, HTML.ID_ATTRIBUTE,
sequence.getClientId(context) + ".dt");
- }
-
- rendererUtils.writeAttribute(writer, HTML.CLASS_ATTRIBUTE,
- HtmlUtil.concatClasses(helper.getRowClass(), helper.getColumnClass(),
"rf-dlst-t"));
- termFacet.encodeAll(context);
- writer.endElement(HTML.DT_ELEMENT);
- }
-
- writer.startElement(HTML.DD_ELEMENT, sequence);
-
- if (rendererUtils.hasExplicitId(sequence)) {
- rendererUtils.writeAttribute(writer, HTML.ID_ATTRIBUTE,
sequence.getClientId(context));
- }
-
- rendererUtils.writeAttribute(writer, HTML.CLASS_ATTRIBUTE,
- HtmlUtil.concatClasses(helper.getRowClass(), helper.getColumnClass(),
"rf-dlst-d"));
- renderHandlers(context, sequence);
- rendererUtils.encodeChildren(context, sequence);
- writer.endElement(HTML.DD_ELEMENT);
- }
-
- public void encodeFakeItem(FacesContext context, UIComponent component) throws
IOException {
- ResponseWriter writer = context.getResponseWriter();
- writer.startElement(HTML.DD_ELEMENT, component);
- writer.writeAttribute(HTML.STYLE_ATTRIBUTE, "display:none", null);
- writer.endElement(HTML.DD_ELEMENT);
- }
- }
-
- private abstract class ItemsEncoder implements DataVisitor {
-
- protected void renderHandlers(FacesContext context, UISequence sequence) throws
IOException {
- RenderKitUtils.renderPassThroughAttributesOptimized(context, sequence,
ROW_HANDLER_ATTRIBUTES);
- }
-
- protected abstract void encodeRow(FacesContext context, UISequence sequence,
SequenceRendererHelper helper)
- throws IOException;
-
- public DataVisitResult process(FacesContext context, Object rowKey, Object
argument) {
- SequenceRendererHelper helper = (SequenceRendererHelper) argument;
- UISequence sequence = helper.getSequence();
- sequence.setRowKey(context, rowKey);
- if (sequence.isRowAvailable()) {
- helper.nextRow();
-
- try {
- encodeRow(context, sequence, helper);
- } catch (IOException e) {
- throw new FacesException(e.getMessage(), e);
- }
-
- return DataVisitResult.CONTINUE;
- } else {
- return DataVisitResult.STOP;
- }
- }
-
- public abstract void encodeFakeItem(FacesContext context, UIComponent component)
throws IOException;
-
- }
-
- private ItemsEncoder unorderedListItemsEncoder = new
SimpleItemsEncoder("rf-ulst-i");
-
- private ItemsEncoder orderedListItemsEncoder = new
SimpleItemsEncoder("rf-olst-i");
-
- private ItemsEncoder definitionItemsEncoder = new DefinitionItemsEncoder();
-
- protected String getListClass(ListType type) {
- switch (type) {
- case ordered:
- return "rf-olst";
- case unordered:
- return "rf-ulst";
- case definitions:
- return "rf-dlst";
-
- default:
- throw new IllegalArgumentException(type.toString());
- }
- }
-
- protected ItemsEncoder getItemsEncoderByType(ListType type) {
- switch (type) {
- case ordered:
- return orderedListItemsEncoder;
- case unordered:
- return unorderedListItemsEncoder;
- case definitions:
- return definitionItemsEncoder;
-
- default:
- throw new IllegalArgumentException(type.toString());
- }
- }
-
- protected ListType getType(UIComponent component) {
- ListType type = ((AbstractList) component).getType();
- if (type == null) {
- String exceptionMessage = MessageFormat.format("Type for rich:list {0}
is required!", RichfacesLogger.getComponentPath(component));
- throw new IllegalArgumentException(exceptionMessage);
- }
-
- return type;
- }
-
- protected String getStyleClass(UIComponent component, ListType listType) {
- String styleClass = (String)
component.getAttributes().get(HTML.STYLE_CLASS_ATTR);
- return HtmlUtil.concatClasses(styleClass, getListClass(listType));
- }
-
- protected String getElementId(FacesContext facesContext, UIComponent component) {
- if (rendererUtils.hasExplicitId(component)) {
- return component.getClientId(facesContext);
- }
-
- return null;
- }
-
- protected void encodeListItems(FacesContext context, UIComponent component, ListType
listType)
- throws IOException {
- AbstractList list = (AbstractList) component;
- try {
- ItemsEncoder itemsEncoder = getItemsEncoderByType(listType);
- SequenceRendererHelper rendererHelper = new SequenceRendererHelper(list);
- list.walk(context, itemsEncoder, rendererHelper);
-
- if (!rendererHelper.hasWalkedOverRows()) {
- itemsEncoder.encodeFakeItem(context, component);
- }
- } catch (FacesException e) {
- // TODO nick - review
- if (e.getCause() instanceof IOException) {
- throw (IOException) e.getCause();
- } else {
- throw e;
- }
- }
- }
-}
Deleted: trunk/ui/iteration/lists/ui/src/main/templates/list.template.xml
===================================================================
--- trunk/ui/iteration/lists/ui/src/main/templates/list.template.xml 2010-08-09 13:04:26
UTC (rev 18506)
+++ trunk/ui/iteration/lists/ui/src/main/templates/list.template.xml 2010-08-09 13:27:29
UTC (rev 18507)
@@ -1,104 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-
-<cdk:root
xmlns="http://richfaces.org/cdk/xhtml-el"
xmlns:cdk="http://richfaces.org/cdk/core"
-
xmlns:c="http://richfaces.org/cdk/jstl/core"
xmlns:cc="http://richfaces.org/cdk/jsf/composite"
-
xmlns:javaee="http://java.sun.com/xml/ns/javaee">
-
- <cc:interface>
- <cdk:class>org.richfaces.renderkit.html.ListRenderer</cdk:class>
-
<cdk:superclass>org.richfaces.renderkit.ListRendererBase</cdk:superclass>
- <cdk:component-family>org.richfaces.List</cdk:component-family>
- <cdk:renderer-type>org.richfaces.ListRenderer
- </cdk:renderer-type>
- <cdk:renders-children>true</cdk:renders-children>
-
- <!--
- <cc:attribute name="onclick" type="java.lang.String">
- <cc:clientBehavior event="click" />
- </cc:attribute>
- <cc:attribute name="ondblclick"
type="java.lang.String">
- <cc:clientBehavior event="dblclick" />
- </cc:attribute>
- <cc:attribute name="onmousedown"
type="java.lang.String">
- <cc:clientBehavior event="mousedown" />
- </cc:attribute>
- <cc:attribute name="onmouseup"
type="java.lang.String">
- <cc:clientBehavior event="mouseup" />
- </cc:attribute>
- <cc:attribute name="onmouseover"
type="java.lang.String">
- <cc:clientBehavior event="mouseover" />
- </cc:attribute>
- <cc:attribute name="onmousemove"
type="java.lang.String">
- <cc:clientBehavior event="mousemove" />
- </cc:attribute>
- <cc:attribute name="onmouseout"
type="java.lang.String">
- <cc:clientBehavior event="mouseout" />
- </cc:attribute>
- <cc:attribute name="onkeypress"
type="java.lang.String">
- <cc:clientBehavior event="keypress" />
- </cc:attribute>
- <cc:attribute name="onkeydown"
type="java.lang.String">
- <cc:clientBehavior event="keydown" />
- </cc:attribute>
- <cc:attribute name="onkeyup" type="java.lang.String">
- <cc:clientBehavior event="keyup" />
- </cc:attribute>
- <cc:attribute name="onrowclick"
type="java.lang.String">
- <cc:clientBehavior event="rowclick" />
- </cc:attribute>
- <cc:attribute name="onrowdblclick"
type="java.lang.String">
- <cc:clientBehavior event="rowdblclick" />
- </cc:attribute>
- <cc:attribute name="onrowmousedown"
type="java.lang.String">
- <cc:clientBehavior event="rowmousedown" />
- </cc:attribute>
- <cc:attribute name="onrowmouseup"
type="java.lang.String">
- <cc:clientBehavior event="rowmouseup" />
- </cc:attribute>
- <cc:attribute name="onrowmouseover"
type="java.lang.String">
- <cc:clientBehavior event="rowmouseover" />
- </cc:attribute>
- <cc:attribute name="onrowmousemove"
type="java.lang.String">
- <cc:clientBehavior event="rowmousemove" />
- </cc:attribute>
- <cc:attribute name="onrowmouseout"
type="java.lang.String">
- <cc:clientBehavior event="rowmouseout" />
- </cc:attribute>
- <cc:attribute name="onrowkeypress"
type="java.lang.String">
- <cc:clientBehavior event="rowkeypress" />
- </cc:attribute>
- <cc:attribute name="onrowkeydown"
type="java.lang.String">
- <cc:clientBehavior event="rowkeydown" />
- </cc:attribute>
- <cc:attribute name="onrowkeyup"
type="java.lang.String">
- <cc:clientBehavior event="rowkeyup" />
- </cc:attribute>
- -->
- </cc:interface>
-
- <cc:implementation>
- <cdk:object type="org.richfaces.component.ListType"
name="listType" value="#{getType(component)}" />
-
- <cdk:object name="styleClass" value="#{getStyleClass(component,
listType)}" />
- <cdk:object name="elementId"
value="#{getElementId(facesContext, component)}" />
-
- <cdk:switch key="#{listType}">
- <cdk:case values="ordered">
- <ol id="#{elementId}" class="#{styleClass}"
cdk:passThroughWithExclusions="type value">
- <cdk:call expression="encodeListItems(facesContext, component,
listType)" />
- </ol>
- </cdk:case>
- <cdk:case values="unordered">
- <ul id="#{elementId}" class="#{styleClass}"
cdk:passThroughWithExclusions="type value">
- <cdk:call expression="encodeListItems(facesContext, component,
listType)" />
- </ul>
- </cdk:case>
- <cdk:case values="definitions">
- <dl id="#{elementId}" class="#{styleClass}"
cdk:passThroughWithExclusions="type value">
- <cdk:call expression="encodeListItems(facesContext, component,
listType)" />
- </dl>
- </cdk:case>
- </cdk:switch>
- </cc:implementation>
-
-</cdk:root>