JBoss Rich Faces SVN: r16906 - in root/cdk/trunk/plugins/xinclude/src/main/java/org/apache/cocoon/pipeline/component: xpointer and 1 other directory.
by richfaces-svn-commits@lists.jboss.org
Author: Alex.Kolonitsky
Date: 2010-05-06 04:41:13 -0400 (Thu, 06 May 2010)
New Revision: 16906
Modified:
root/cdk/trunk/plugins/xinclude/src/main/java/org/apache/cocoon/pipeline/component/sax/XIncludeTransformer.java
root/cdk/trunk/plugins/xinclude/src/main/java/org/apache/cocoon/pipeline/component/xpointer/XPointerContext.java
Log:
fix checkstyle
Modified: root/cdk/trunk/plugins/xinclude/src/main/java/org/apache/cocoon/pipeline/component/sax/XIncludeTransformer.java
===================================================================
--- root/cdk/trunk/plugins/xinclude/src/main/java/org/apache/cocoon/pipeline/component/sax/XIncludeTransformer.java 2010-05-06 03:58:58 UTC (rev 16905)
+++ root/cdk/trunk/plugins/xinclude/src/main/java/org/apache/cocoon/pipeline/component/sax/XIncludeTransformer.java 2010-05-06 08:41:13 UTC (rev 16906)
@@ -1,4 +1,3 @@
-
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
@@ -16,15 +15,9 @@
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
- */
+*/
package org.apache.cocoon.pipeline.component.sax;
-import java.io.IOException;
-import java.net.URI;
-import java.util.HashMap;
-import java.util.Map;
-import java.util.Map.Entry;
-
import org.apache.cocoon.pipeline.component.xpointer.XPointer;
import org.apache.cocoon.pipeline.component.xpointer.XPointerContext;
import org.apache.cocoon.pipeline.component.xpointer.parser.ParseException;
@@ -40,6 +33,12 @@
import org.xml.sax.ext.LexicalHandler;
import org.xml.sax.helpers.XMLReaderFactory;
+import java.io.IOException;
+import java.net.URI;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.Map.Entry;
+
public final class XIncludeTransformer implements SAXConsumer {
private static final String DEFAULT_CHARSET = "UTF-8";
private static final String HTTP_ACCEPT = "Accept";
@@ -56,12 +55,17 @@
private static final String XINCLUDE_PARSE_TEXT = "text";
private static final String XINCLUDE_PARSE_XML = "xml";
private static final String XINCLUDE_XPOINTER = "xpointer";
- private final Logger LOG ;
- /** The nesting level of fallback that should be used */
+ private final Logger log;
+
+ /**
+ * The nesting level of fallback that should be used
+ */
private int useFallbackLevel = 0;
- /** The nesting level of xi:include elements that have been encountered. */
+ /**
+ * The nesting level of xi:include elements that have been encountered.
+ */
private int xIncludeElementLevel = 0;
/**
@@ -72,7 +76,9 @@
private URI baseUri;
private ContentHandler contentHandler;
- /** The nesting level of xi:fallback elements that have been encountered. */
+ /**
+ * The nesting level of xi:fallback elements that have been encountered.
+ */
private int fallbackElementLevel;
private LexicalHandler lexicalHandler;
@@ -84,16 +90,17 @@
private EntityResolver2 resolver;
public XIncludeTransformer(Logger log) {
- this.LOG = log;
+ this.log = log;
}
- public XIncludeTransformer(URI baseUri,Logger log) {
+ public XIncludeTransformer(URI baseUri, Logger log) {
this(log);
this.setBaseUri(baseUri);
}
/**
* <p class="changed_added_4_0"></p>
+ *
* @return the resolver
*/
public EntityResolver2 getResolver() {
@@ -102,6 +109,7 @@
/**
* <p class="changed_added_4_0"></p>
+ *
* @param resolver the resolver to set
*/
public void setResolver(EntityResolver2 resolver) {
@@ -110,6 +118,7 @@
/**
* <p class="changed_added_4_0"></p>
+ *
* @return the contentHandler
*/
public ContentHandler getContentHandler() {
@@ -118,6 +127,7 @@
/**
* <p class="changed_added_4_0"></p>
+ *
* @return the lexicalHandler
*/
public LexicalHandler getLexicalHandler() {
@@ -222,21 +232,21 @@
}
private void processXIncludeElement(String href, String parse, String xpointer, String encoding, String accept,
- String acceptLanguage) throws SAXException {
-
- if (LOG.isDebugEnabled()) {
- LOG.debug("Processing XInclude element: href=" + href + ", parse=" + parse + ", xpointer=" + xpointer
- + ", encoding=" + encoding + ", accept=" + accept + ", acceptLanguage=" + acceptLanguage);
+ String acceptLanguage) throws SAXException {
+
+ if (log.isDebugEnabled()) {
+ log.debug("Processing XInclude element: href=" + href + ", parse=" + parse + ", xpointer=" + xpointer
+ + ", encoding=" + encoding + ", accept=" + accept + ", acceptLanguage=" + acceptLanguage);
}
int fragmentIdentifierPos = href.indexOf('#');
if (fragmentIdentifierPos != -1) {
- LOG.warn("Fragment identifer found in 'href' attribute: " + href
- + "\nFragment identifiers are forbidden by the XInclude specification. "
- + "They are still handled by XIncludeTransformer for backward "
- + "compatibility, but their use is deprecated and will be prohibited "
- + "in a future release. Use the 'xpointer' attribute instead.");
+ log.warn("Fragment identifer found in 'href' attribute: " + href
+ + "\nFragment identifiers are forbidden by the XInclude specification. "
+ + "They are still handled by XIncludeTransformer for backward "
+ + "compatibility, but their use is deprecated and will be prohibited "
+ + "in a future release. Use the 'xpointer' attribute instead.");
if (xpointer == null) {
xpointer = href.substring(fragmentIdentifierPos + 1);
@@ -253,15 +263,15 @@
InputSource source = createSource(href);
- if (LOG.isDebugEnabled()) {
- LOG.debug("Parse type=" + parse);
+ if (log.isDebugEnabled()) {
+ log.debug("Parse type=" + parse);
}
if (XINCLUDE_PARSE_XML.equals(parse)) {
try {
if (xpointer != null && xpointer.length() > 0) {
XPointer xPointer = XPointerFrameworkParser.parse(xpointer);
- XPointerContext xPointerContext = new XPointerContext(xpointer, source, this, resolver,LOG);
+ XPointerContext xPointerContext = new XPointerContext(xpointer, source, this, resolver, log);
for (Entry<String, String> namespace : namespaces.entrySet()) {
xPointerContext.addPrefix(namespace.getKey(), namespace.getValue());
@@ -282,13 +292,13 @@
// this exception is thrown in case of an invalid xpointer expression
useFallbackLevel++;
- LOG.info("Error parsing XPointer expression: "+e.getMessage()+" , will try to use fallback.");
+ log.info("Error parsing XPointer expression: " + e.getMessage() + " , will try to use fallback.");
} catch (IOException e) {
useFallbackLevel++;
- LOG.info("Error processing an xInclude: "+e.getMessage()+" will try to use fallback.");
+ log.info("Error processing an xInclude: " + e.getMessage() + " will try to use fallback.");
} catch (SAXException e) {
useFallbackLevel++;
- LOG.info("Error processing an xInclude: "+e.getMessage()+" will try to use fallback.");
+ log.info("Error processing an xInclude: " + e.getMessage() + " will try to use fallback.");
}
} else if (XINCLUDE_PARSE_TEXT.equals(parse)) {
if (xpointer != null) {
@@ -307,7 +317,7 @@
// get from url.
} else {
useFallbackLevel++;
- LOG.error("Can't read XInclude href " + href + " at " + getLocation());
+ log.error("Can't read XInclude href " + href + " at " + getLocation());
}
} else {
throw new SAXException("Found 'parse' attribute with unknown value " + parse + " at " + getLocation());
@@ -331,21 +341,21 @@
source = new InputSource(sourceAtt);
}
- if (this.LOG.isDebugEnabled()) {
- this.LOG.debug("Including source: " + sourceAtt);
+ if (this.log.isDebugEnabled()) {
+ this.log.debug("Including source: " + sourceAtt);
}
return source;
} catch (IllegalArgumentException e) {
String message = "Invalid xinclude URI " + sourceAtt;
- this.LOG.error(message, e);
+ this.log.error(message, e);
throw new ProcessingException(message, e);
} catch (IOException e) {
String message = "Can't resolve URL " + sourceAtt;
- this.LOG.error(message, e);
+ this.log.error(message, e);
throw new ProcessingException(message, e);
}
@@ -452,8 +462,8 @@
}
public void setDocumentLocator(Locator locator) {
- if (LOG.isDebugEnabled()) {
- LOG.debug("setDocumentLocator called " + locator.getSystemId());
+ if (log.isDebugEnabled()) {
+ log.debug("setDocumentLocator called " + locator.getSystemId());
}
this.locator = locator;
@@ -467,18 +477,18 @@
}
private static final class DummyLexicalHandler implements LexicalHandler {
- public void startEntity(String name) throws SAXException {}
+ public void startEntity(String name) throws SAXException { }
- public void startDTD(String name, String publicId, String systemId) throws SAXException {}
+ public void startDTD(String name, String publicId, String systemId) throws SAXException { }
- public void startCDATA() throws SAXException {}
+ public void startCDATA() throws SAXException { }
- public void endEntity(String name) throws SAXException {}
+ public void endEntity(String name) throws SAXException { }
- public void endDTD() throws SAXException {}
+ public void endDTD() throws SAXException { }
- public void endCDATA() throws SAXException {}
+ public void endCDATA() throws SAXException { }
- public void comment(char[] ch, int start, int length) throws SAXException {}
+ public void comment(char[] ch, int start, int length) throws SAXException { }
}
}
Modified: root/cdk/trunk/plugins/xinclude/src/main/java/org/apache/cocoon/pipeline/component/xpointer/XPointerContext.java
===================================================================
--- root/cdk/trunk/plugins/xinclude/src/main/java/org/apache/cocoon/pipeline/component/xpointer/XPointerContext.java 2010-05-06 03:58:58 UTC (rev 16905)
+++ root/cdk/trunk/plugins/xinclude/src/main/java/org/apache/cocoon/pipeline/component/xpointer/XPointerContext.java 2010-05-06 08:41:13 UTC (rev 16906)
@@ -39,7 +39,8 @@
private static final String XMLNS = "xmlns";
private static final String XMLNS_NAMESPACE = "http://www.w3.org/2000/xmlns/";
private static final String XML_NAMESPACE = "http://www.w3.org/XML/1998/namespace";
- private final Logger LOGGER ;
+
+ private final Logger logger;
private Map<String, String> prefixes = new HashMap<String, String>();
private Document document;
private final EntityResolver resolver;
@@ -47,12 +48,13 @@
private String xPointer;
private SAXConsumer xmlConsumer;
- public XPointerContext(String xPointer, InputSource source, SAXConsumer xmlConsumer, EntityResolver resolver, Logger log) {
+ public XPointerContext(String xPointer, InputSource source,
+ SAXConsumer xmlConsumer, EntityResolver resolver, Logger log) {
this.xPointer = xPointer;
this.source = source;
this.xmlConsumer = xmlConsumer;
this.resolver = resolver;
- this.LOGGER = log;
+ this.logger = log;
}
public String getXPointer() {
@@ -68,7 +70,7 @@
}
public Logger getLogger() {
- return LOGGER;
+ return logger;
}
public Document getDocument() throws IOException, SAXException {
14 years, 9 months
JBoss Rich Faces SVN: r16905 - in root/docs/trunk: Developer_Guide/en-US and 1 other directories.
by richfaces-svn-commits@lists.jboss.org
Author: SeanRogers
Date: 2010-05-05 23:58:58 -0400 (Wed, 05 May 2010)
New Revision: 16905
Added:
root/docs/trunk/Developer_Guide/en-US/extras/prog-Developer_Guide-Using_RichFaces_with_Maven-Add_required_repositories.xml_sample
root/docs/trunk/Developer_Guide/en-US/extras/prog-Developer_Guide-Using_RichFaces_with_Maven-Add_required_repositories_(legacy).xml_sample
Modified:
root/docs/trunk/Component_Reference/en-US/chap-Component_Reference-Tables_and_grids.xml
root/docs/trunk/Developer_Guide/en-US/chap-Developer_Guide-Basic_concepts.xml
root/docs/trunk/Developer_Guide/en-US/chap-Developer_Guide-Getting_started_with_RichFaces.xml
root/docs/trunk/Developer_Guide/en-US/chap-Developer_Guide-RichFaces_overview.xml
Log:
Completed revision of Developer Guide based on tech review.
Modified: root/docs/trunk/Component_Reference/en-US/chap-Component_Reference-Tables_and_grids.xml
===================================================================
--- root/docs/trunk/Component_Reference/en-US/chap-Component_Reference-Tables_and_grids.xml 2010-05-06 00:27:39 UTC (rev 16904)
+++ root/docs/trunk/Component_Reference/en-US/chap-Component_Reference-Tables_and_grids.xml 2010-05-06 03:58:58 UTC (rev 16905)
@@ -633,6 +633,33 @@
<section id="sect-Component_Reference-Tables_and_grids-richdataOrderedList">
<title><sgmltag><rich:dataOrderedList></sgmltag></title>
+ <itemizedlist>
+ <listitem>
+ <para>
+ component-type: <classname>org.richfaces.DataOrderedList</classname>
+ </para>
+ </listitem>
+ <listitem>
+ <para>
+ component-class: <classname>org.richfaces.component.html.HtmlDataOrderedList</classname>
+ </para>
+ </listitem>
+ <listitem>
+ <para>
+ component-family: <classname>org.richfaces.DataOrderedList</classname>
+ </para>
+ </listitem>
+ <listitem>
+ <para>
+ renderer-type: <classname>org.richfaces.DataOrderedListRenderer</classname>
+ </para>
+ </listitem>
+ <listitem>
+ <para>
+ tag-class: <classname>org.richfaces.taglib.DataOrderedListTag</classname>
+ </para>
+ </listitem>
+ </itemizedlist>
<para>
Incomplete
</para>
Modified: root/docs/trunk/Developer_Guide/en-US/chap-Developer_Guide-Basic_concepts.xml
===================================================================
--- root/docs/trunk/Developer_Guide/en-US/chap-Developer_Guide-Basic_concepts.xml 2010-05-06 00:27:39 UTC (rev 16904)
+++ root/docs/trunk/Developer_Guide/en-US/chap-Developer_Guide-Basic_concepts.xml 2010-05-06 03:58:58 UTC (rev 16905)
@@ -14,7 +14,7 @@
<itemizedlist>
<listitem>
<para>
- The <sgmltag><a4j:commandButton></sgmltag> and <sgmltag><a4j:commandLink></sgmltag> tags are used to send an Ajax request on the <varname>onclick</varname> JavaScript event.
+ The <sgmltag><a4j:commandButton></sgmltag> and <sgmltag><a4j:commandLink></sgmltag> tags are used to send an Ajax request on the <varname>click</varname> JavaScript event.
</para>
</listitem>
<listitem>
@@ -24,7 +24,7 @@
</listitem>
<listitem>
<para>
- The <sgmltag><a4j:ajax></sgmltag> tag allows you to add Ajax functionality to standard JSF components and send Ajax request on a chosen JavaScript event, such as <varname>onkeyup</varname> or <varname>onmouseover</varname>, for example.
+ The <sgmltag><a4j:ajax></sgmltag> tag allows you to add Ajax functionality to standard JSF components and send Ajax request on a chosen JavaScript event, such as <varname>keyup</varname> or <varname>mouseover</varname>, for example.
</para>
</listitem>
<listitem>
@@ -51,7 +51,7 @@
<section id="sect-Developer_Guide-Receiving_events_and_updates-Partial_page_updates">
<title>Partial page updates</title>
<para>
- Specific regions of a page can be defined through the use of container components such as <sgmltag><a4j:region></sgmltag>. These regions can then be specified with their <varname>id</varname> identifiers in the <varname>render</varname> attribute of a component so that when the component sends an Ajax request, only the specified regions are updated. In this way you can control which part of the JSF View is decoded on the server side when the Ajax request is sent. Multiple regions can be defined and sent, and regions can be nested inside other regions.
+ Specific regions of a page can be defined through the use of container components such as <sgmltag><a4j:region></sgmltag>. These regions can then be specified with their <varname>id</varname> identifiers in the <varname>render</varname> attribute of a component so that when the component sends an Ajax request, only the specified regions are updated. In this way you can control which part of the JSF View is decoded on the server side when the Ajax request is sent. Multiple regions can be defined and sent, and regions can be nested inside other regions. Controls and components from third-party libraries contained in these regions are also updated.
</para>
<para>
Additionally, regions can be wrapped with the <sgmltag><a4j:outputPanel ajaxRendered="true"></sgmltag> tag. This causes all contents of the region to be updated on every Ajax response, even if not explicitly listed in the requesting component's <varname>render</varname> attribute.
Modified: root/docs/trunk/Developer_Guide/en-US/chap-Developer_Guide-Getting_started_with_RichFaces.xml
===================================================================
--- root/docs/trunk/Developer_Guide/en-US/chap-Developer_Guide-Getting_started_with_RichFaces.xml 2010-05-06 00:27:39 UTC (rev 16904)
+++ root/docs/trunk/Developer_Guide/en-US/chap-Developer_Guide-Getting_started_with_RichFaces.xml 2010-05-06 03:58:58 UTC (rev 16905)
@@ -215,7 +215,7 @@
<step id="step-Developer_Guide-Creating_a_project-Create_a_new_project">
<title>Create a new project</title>
<para>
- Create a new project based on the JSF 2 environment by using the JSF Project wizard in <application>JBoss Tools</application>.
+ Create a new project based on the JSF 2 environment. In <application>JBoss Tools</application>, select <menuchoice><guimenu>File</guimenu><guimenu>New</guimenu><guimenuitem>JSF Project</guimenuitem></menuchoice> from the menu. Name the project, select <guilabel>JSF 2</guilabel> from the <guilabel>JSF Environment</guilabel> drop-down box, and click the <guibutton>Finish</guibutton> button to create the project.
</para>
</step>
<step id="step-Developer_Guide-Creating_a_project-Add_the_RichFaces_libraries_to_the_project">
@@ -226,7 +226,7 @@
<note>
<title>Other required libraries</title>
<para>
- RichFaces also requires the following libraries to be referenced in your project. Typically they are already included when creating a JSF project in <application>JBoss Tools</application>. <remark>These dependencies need to be confirmed.</remark>
+ RichFaces also requires the following libraries to be referenced in your project. Typically they are already included when creating a JSF project in <application>JBoss Tools</application>.
</para>
<itemizedlist>
<listitem>
@@ -287,44 +287,10 @@
<step id="step-Developer_Guide-Using_RichFaces_with_Maven-Add_required_repositories">
<title>Add required repositories</title>
<para>
- A structure for the Maven project with minimal content can be created with the Maven archetype named <filename>maven-archetype-jsfwebapp</filename> <remark>(may be renamed in a later release)</remark> included as part of the RichFaces Component Development Kit (<acronym>CDK</acronym>). The archetype and the project itself require extra repositories to be provided, namely <filename>http://snapshots.jboss.org/maven2/</filename> and <filename>http://repository.jboss.com/maven2/</filename>. To make the repositories accessible to Maven, add a profile in the <filename>maven_installation_folder/conf/settings.xml</filename> file under the <sgmltag><profiles></sgmltag> element:
+ A structure for the Maven project with minimal content can be created with the Maven archetype named <filename>maven-archetype-jsfwebapp</filename> <remark>(may be renamed in a later release)</remark> included as part of the RichFaces Component Development Kit (<acronym>CDK</acronym>). The archetype and the project itself require the JBoss repository to be provided (<filename>https://repository.jboss.org/nexus/content/groups/public/</filename>). To make the repositories accessible to Maven, add a profile in the <filename><replaceable>maven_installation_folder</replaceable>/conf/settings.xml</filename> file under the <sgmltag><profiles></sgmltag> element:
</para>
-<programlisting language="XML" role="XML"><profiles>
- <profile>
- <id>jsf-app-profile</id>
- <repositories>
- <repository>
- <releases>
- <enabled>true</enabled>
- </releases>
- <snapshots>
- <enabled>true</enabled>
- <updatePolicy>always</updatePolicy>
- </snapshots>
- <id>snapshots.jboss.org</id>
- <name>Snapshot Jboss Repository for Maven</name>
- <url>http://snapshots.jboss.org/maven2/</url>
- <layout>default</layout>
- </repository>
- <repository>
- <releases>
- <enabled>true</enabled>
- </releases>
- <snapshots>
- <enabled>true</enabled>
- <updatePolicy>always</updatePolicy>
- </snapshots>
- <id>repository.jboss.com</id>
- <name>Jboss Repository for Maven</name>
- <url>http://repository.jboss.com/maven2/</url>
- <layout>default</layout>
- </repository>
- </repositories>
- </profile>
- ...
-</profiles>
-</programlisting>
+<programlisting language="XML" role="XML"><xi:include parse="text" href="extras/prog-Developer_Guide-Using_RichFaces_with_Maven-Add_required_repositories.xml_sample" xmlns:xi="http://www.w3.org/2001/XInclude" /></programlisting>
<para>
The profile then needs to be activated in the <sgmltag><activeProfiles></sgmltag> element:
</para>
@@ -396,107 +362,26 @@
The <filename>jsf-app</filename> directory contains a project descriptor file, <filename>pom.xml</filename>. To add RichFaces libraries to your project, edit the project descriptor to add dependencies to the <sgmltag><dependencies></sgmltag> element as follows:
</para>
-<programlisting language="XML" role="XML"><dependencies>
- <dependency>
- <groupId>junit</groupId>
- <artifactId>junit</artifactId>
- <version>3.8.1</version>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>javax.servlet</groupId>
- <artifactId>servlet-api</artifactId>
- <version>2.4</version>
- <scope>provided</scope>
- </dependency>
- <dependency>
- <groupId>javax.servlet</groupId>
- <artifactId>jsp-api</artifactId>
- <version>2.0</version>
- <scope>provided</scope>
- </dependency>
- <dependency>
- <groupId>jstl</groupId>
- <artifactId>jstl</artifactId>
- <version>1.1.2</version>
- </dependency>
- <dependency>
- <groupId>javax.servlet.jsp</groupId>
- <artifactId>jsp-api</artifactId>
- <version>2.1</version>
- <scope>provided</scope>
- </dependency>
- <dependency>
- <groupId>javax.faces</groupId>
- <artifactId>jsf-api</artifactId>
- <version>1.2_12</version>
- </dependency>
- <dependency>
- <groupId>javax.faces</groupId>
- <artifactId>jsf-impl</artifactId>
- <version>1.2_12</version>
- </dependency>
- <dependency>
- <groupId>javax.el</groupId>
- <artifactId>el-api</artifactId>
- <version>1.0</version>
- <scope>provided</scope>
- </dependency>
- <dependency>
- <groupId>el-impl</groupId>
- <artifactId>el-impl</artifactId>
- <version>1.0</version>
- <scope>provided</scope>
- </dependency>
- <dependency>
- <groupId>javax.annotation</groupId>
- <artifactId>jsr250-api</artifactId>
- <version>1.0</version>
- </dependency>
- <!-- RichFaces libraries -->
- <dependency>
- <groupId>org.richfaces.framework</groupId>
- <artifactId>richfaces-api</artifactId>
- <version>4.0.0</version>
- </dependency>
- <dependency>
- <groupId>org.richfaces.framework</groupId>
- <artifactId>richfaces-impl</artifactId>
- <version>4.0.0</version>
- </dependency>
- <dependency>
- <groupId>org.richfaces.ui</groupId>
- <artifactId>richfaces-ui</artifactId>
- <version>4.0.0</version>
- </dependency>
-</dependencies>
-</programlisting>
+<programlisting language="XML" role="XML"><xi:include parse="text" href="extras/prog-Developer_Guide-Using_RichFaces_with_Maven-Add_dependencies.xml_sample" xmlns:xi="http://www.w3.org/2001/XInclude" /></programlisting>
</step>
<step id="step-Developer_Guide-Using_RichFaces_with_Maven-Build_the_project">
<title>Build the project</title>
- <stepalternatives>
- <step id="step-Developer_Guide-Build_the_project-Standard_building">
- <title>Standard building</title>
- <para>
- Build the project from the command line by entering the <command>mvn install</command> command.
- </para>
- <para>
- The <computeroutput>BUILD SUCCESSFUL</computeroutput> message indicates the project has been assembled and is ready to import into an IDE (integrated development environment) and run on a server.
- </para>
- </step>
- <step id="step-Developer_Guide-Build_the_project-Building_for_Eclipse_and_JBoss_Tools">
- <title>Building for <application>Eclipse</application> and <application>JBoss Tools</application></title>
- <para>
- To build the project for <application>Eclipse</application> and <application>JBoss Tools</application>, enter the following command at the command line:
-<screen>mvn eclipse:eclipse -Dwtpversion=2.0
-</screen>
- </para>
- <para>
- The <computeroutput>BUILD SUCCESSFUL</computeroutput> message indicates the project has been assembled and is ready to import into <application>Eclipse</application>.
- </para>
- </step>
- </stepalternatives>
+ <para>
+ Build the project from the command line by entering the <command>mvn install</command> command.
+ </para>
+ <para>
+ The <computeroutput>BUILD SUCCESSFUL</computeroutput> message indicates the project has been assembled and is ready to import into an IDE (integrated development environment).
+ </para>
</step>
+ <step id="step-Developer_Guide-Build_the_project-Building_for_Eclipse_and_JBoss_Tools">
+ <title>Import the project into an IDE</title>
+ <para>
+ Import the Maven project into your IDE.
+ </para>
+ <para>
+ For <application>Eclipse</application> and <application>JBoss Tools</application>, you need to have the <productname>M2Eclipse</productname> plug-in installed. You can then import the <application>Maven</application> project through a wizard by choosing <menuchoice><guimenu>File</guimenu><guimenuitem>Import</guimenuitem></menuchoice> from the menu. Select <guilabel>Maven Projects</guilabel> as the input source and choose the <filename>pom.xml</filename> file for your project.
+ </para>
+ </step>
<step id="step-Developer_Guide-Using_RichFaces_with_Maven-Add_tag_library_references">
<title>Add tag library references</title>
<para>
Modified: root/docs/trunk/Developer_Guide/en-US/chap-Developer_Guide-RichFaces_overview.xml
===================================================================
--- root/docs/trunk/Developer_Guide/en-US/chap-Developer_Guide-RichFaces_overview.xml 2010-05-06 00:27:39 UTC (rev 16904)
+++ root/docs/trunk/Developer_Guide/en-US/chap-Developer_Guide-RichFaces_overview.xml 2010-05-06 03:58:58 UTC (rev 16905)
@@ -26,7 +26,7 @@
</mediaobject>
</figure>
<para>
- Using JSF tags, RichFaces allows different parts of a JSF page to be updated with an Ajax request. JSF pages using RichFaces do not change from "regular" JSF pages, and additional JavaScript or XMLHTTPRequest objects do not need to be written.
+ Using JSF tags, RichFaces allows different parts of a JSF page to be updated with an Ajax request. JSF pages using RichFaces do not change from "regular" JSF pages, and additional JavaScript code is not required.
</para>
<section id="sect-Developer_Guide-RichFaces_overview-Architecture">
<title>Architecture</title>
Added: root/docs/trunk/Developer_Guide/en-US/extras/prog-Developer_Guide-Using_RichFaces_with_Maven-Add_required_repositories.xml_sample
===================================================================
--- root/docs/trunk/Developer_Guide/en-US/extras/prog-Developer_Guide-Using_RichFaces_with_Maven-Add_required_repositories.xml_sample (rev 0)
+++ root/docs/trunk/Developer_Guide/en-US/extras/prog-Developer_Guide-Using_RichFaces_with_Maven-Add_required_repositories.xml_sample 2010-05-06 03:58:58 UTC (rev 16905)
@@ -0,0 +1,47 @@
+<settings>
+ ...
+ <profiles>
+ ...
+ <profile>
+ <id>jboss-public-repository</id>
+ <repositories>
+ <repository>
+ <id>jboss-public-repository-group</id>
+ <name>JBoss Public Maven Repository Group</name>
+ <url>https://repository.jboss.org/nexus/content/groups/public/</url>
+ <layout>default</layout>
+ <releases>
+ <enabled>true</enabled>
+ <updatePolicy>never</updatePolicy>
+ </releases>
+ <snapshots>
+ <enabled>true</enabled>
+ <updatePolicy>never</updatePolicy>
+ </snapshots>
+ </repository>
+ </repositories>
+ <pluginRepositories>
+ <pluginRepository>
+ <id>jboss-public-repository-group</id>
+ <name>JBoss Public Maven Repository Group</name>
+ <url>https://repository.jboss.org/nexus/content/groups/public/</url>
+ <layout>default</layout>
+ <releases>
+ <enabled>true</enabled>
+ <updatePolicy>never</updatePolicy>
+ </releases>
+ <snapshots>
+ <enabled>true</enabled>
+ <updatePolicy>never</updatePolicy>
+ </snapshots>
+ </pluginRepository>
+ </pluginRepositories>
+ </profile>
+
+ </profiles>
+
+ <activeProfiles>
+ <activeProfile>jboss-public-repository</activeProfile>
+ </activeProfiles>
+ ...
+</settings>
Added: root/docs/trunk/Developer_Guide/en-US/extras/prog-Developer_Guide-Using_RichFaces_with_Maven-Add_required_repositories_(legacy).xml_sample
===================================================================
--- root/docs/trunk/Developer_Guide/en-US/extras/prog-Developer_Guide-Using_RichFaces_with_Maven-Add_required_repositories_(legacy).xml_sample (rev 0)
+++ root/docs/trunk/Developer_Guide/en-US/extras/prog-Developer_Guide-Using_RichFaces_with_Maven-Add_required_repositories_(legacy).xml_sample 2010-05-06 03:58:58 UTC (rev 16905)
@@ -0,0 +1,34 @@
+<profiles>
+ <profile>
+ <id>jsf-app-profile</id>
+ <repositories>
+ <repository>
+ <releases>
+ <enabled>true</enabled>
+ </releases>
+ <snapshots>
+ <enabled>true</enabled>
+ <updatePolicy>always</updatePolicy>
+ </snapshots>
+ <id>snapshots.jboss.org</id>
+ <name>Snapshot Jboss Repository for Maven</name>
+ <url>http://snapshots.jboss.org/maven2/</url>
+ <layout>default</layout>
+ </repository>
+ <repository>
+ <releases>
+ <enabled>true</enabled>
+ </releases>
+ <snapshots>
+ <enabled>true</enabled>
+ <updatePolicy>always</updatePolicy>
+ </snapshots>
+ <id>repository.jboss.com</id>
+ <name>Jboss Repository for Maven</name>
+ <url>http://repository.jboss.com/maven2/</url>
+ <layout>default</layout>
+ </repository>
+ </repositories>
+ </profile>
+ ...
+</profiles>
14 years, 9 months
JBoss Rich Faces SVN: r16904 - in root: framework/trunk/api/src/main/java/org/ajax4jsf/model and 5 other directories.
by richfaces-svn-commits@lists.jboss.org
Author: nbelaevski
Date: 2010-05-05 20:27:39 -0400 (Wed, 05 May 2010)
New Revision: 16904
Added:
root/framework/trunk/api/src/main/java/org/ajax4jsf/model/SequenceState.java
Removed:
root/framework/trunk/api/src/main/java/org/ajax4jsf/model/RepeatState.java
root/framework/trunk/impl/src/main/java/org/richfaces/component/DataAdaptorStateHelper.java
Modified:
root/framework/trunk/api/src/main/java/org/ajax4jsf/component/IterationStateHolder.java
root/framework/trunk/impl/src/main/java/org/richfaces/component/SavedState.java
root/framework/trunk/impl/src/main/java/org/richfaces/component/UIDataAdaptor.java
root/framework/trunk/impl/src/main/java/org/richfaces/component/UISequence.java
root/framework/trunk/impl/src/test/java/org/richfaces/component/DataAdaptorTestCase.java
root/ui-sandbox/trunk/components/datascroller/ui/src/main/java/org/richfaces/component/UIDataScroller.java
root/ui-sandbox/trunk/components/tables/ui/src/main/java/org/richfaces/component/UIExtendedDataTable.java
root/ui-sandbox/trunk/components/tables/ui/src/main/java/org/richfaces/component/UISubTable.java
root/ui-sandbox/trunk/components/tables/ui/src/main/java/org/richfaces/renderkit/ExtendedDataTableRenderer.java
Log:
https://jira.jboss.org/jira/browse/RF-8626
Modified: root/framework/trunk/api/src/main/java/org/ajax4jsf/component/IterationStateHolder.java
===================================================================
--- root/framework/trunk/api/src/main/java/org/ajax4jsf/component/IterationStateHolder.java 2010-05-06 00:26:30 UTC (rev 16903)
+++ root/framework/trunk/api/src/main/java/org/ajax4jsf/component/IterationStateHolder.java 2010-05-06 00:27:39 UTC (rev 16904)
@@ -23,7 +23,6 @@
package org.ajax4jsf.component;
-import javax.faces.context.FacesContext;
/**
* In the original {@link javax.faces.component.UIData} component, only state for a
@@ -37,18 +36,17 @@
/**
* Get component state for a current iteration.
- * @param context current {@link FacesContext}
* @return request-scope component state. Details are subject for a component implementation
*/
- public Object getIterationState(FacesContext context);
+ public Object getIterationState();
/**
* Set component state for the next iteration. State can be either previously saved iteration state
* or <code>null</code> value. In the second case component should reset its state to the initial.
*
- * @param context current {@link FacesContext}
* @param state request-scope component state or <code>null</code>. Details are subject for a component
* implementation
*/
- public void setIterationState(FacesContext context, Object state);
+ public void setIterationState(Object state);
+
}
Deleted: root/framework/trunk/api/src/main/java/org/ajax4jsf/model/RepeatState.java
===================================================================
--- root/framework/trunk/api/src/main/java/org/ajax4jsf/model/RepeatState.java 2010-05-06 00:26:30 UTC (rev 16903)
+++ root/framework/trunk/api/src/main/java/org/ajax4jsf/model/RepeatState.java 2010-05-06 00:27:39 UTC (rev 16904)
@@ -1,38 +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.ajax4jsf.model;
-
-/**
- * @author shura
- *
- */
-public abstract class RepeatState implements DataComponentState {
- public abstract int getFirst();
-
- public abstract int getRows();
-
- public Range getRange() {
- return new SequenceRange(getFirst(), getRows());
- }
-}
Copied: root/framework/trunk/api/src/main/java/org/ajax4jsf/model/SequenceState.java (from rev 16894, root/framework/trunk/api/src/main/java/org/ajax4jsf/model/RepeatState.java)
===================================================================
--- root/framework/trunk/api/src/main/java/org/ajax4jsf/model/SequenceState.java (rev 0)
+++ root/framework/trunk/api/src/main/java/org/ajax4jsf/model/SequenceState.java 2010-05-06 00:27:39 UTC (rev 16904)
@@ -0,0 +1,57 @@
+/**
+ * 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.ajax4jsf.model;
+
+
+
+/**
+ * @author shura
+ *
+ */
+public class SequenceState implements DataComponentState {
+
+ private int first;
+
+ private int rows;
+
+ public int getFirst() {
+ return first;
+ }
+
+ public void setFirst(int first) {
+ this.first = first;
+ }
+
+ public int getRows() {
+ return rows;
+ }
+
+ public void setRows(int rows) {
+ this.rows = rows;
+ }
+
+ public Range getRange() {
+ return new SequenceRange(getFirst(), getRows());
+ }
+}
Deleted: root/framework/trunk/impl/src/main/java/org/richfaces/component/DataAdaptorStateHelper.java
===================================================================
--- root/framework/trunk/impl/src/main/java/org/richfaces/component/DataAdaptorStateHelper.java 2010-05-06 00:26:30 UTC (rev 16903)
+++ root/framework/trunk/impl/src/main/java/org/richfaces/component/DataAdaptorStateHelper.java 2010-05-06 00:27:39 UTC (rev 16904)
@@ -1,137 +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.component;
-
-import java.io.Serializable;
-
-import javax.faces.component.StateHolder;
-import javax.faces.component.UIComponentBase;
-import javax.faces.context.FacesContext;
-
-import org.ajax4jsf.model.DataComponentState;
-import org.ajax4jsf.model.ExtendedDataModel;
-import org.ajax4jsf.model.SerializableDataModel;
-
-/**
- * @author Nick Belaevski
- *
- */
-public final class DataAdaptorStateHelper implements StateHolder {
-
- private boolean tranzient = false;
-
- private boolean componentStateIsStateHolder = false;
-
- private Object savedComponentState;
-
- private DataComponentState dataComponentState;
-
- private ExtendedDataModel<?> extendedDataModel;
-
- public DataAdaptorStateHelper() {
- }
-
- DataAdaptorStateHelper(DataComponentState dataComponentState, ExtendedDataModel<?> extendedDataModel) {
- super();
- this.dataComponentState = dataComponentState;
- this.extendedDataModel = extendedDataModel;
- }
-
- public DataComponentState getDataComponentState() {
- return dataComponentState;
- }
-
- public ExtendedDataModel<?> getExtendedDataModel() {
- return extendedDataModel;
- }
-
- public boolean isTransient() {
- return tranzient;
- }
-
- public void setTransient(boolean newTransientValue) {
- tranzient = newTransientValue;
- }
-
- public Object saveState(FacesContext context) {
- //TODO - save only encoded states (see UIDataAdaptor#getEncodedIds())?
-
- if (dataComponentState != null) {
- if (dataComponentState instanceof StateHolder) {
- componentStateIsStateHolder = true;
-
- StateHolder stateHolder = (StateHolder) dataComponentState;
- if (!stateHolder.isTransient()) {
- savedComponentState = stateHolder.saveState(context);
- }
- } else {
- componentStateIsStateHolder = false;
-
- if (dataComponentState instanceof Serializable) {
- savedComponentState = dataComponentState;
- }
- }
- }
-
- Object savedSerializableModel = null;
-
- if (dataComponentState != null && extendedDataModel != null) {
- // TODO handle model serialization - "execute" model
- savedSerializableModel = extendedDataModel.getSerializableModel(dataComponentState.getRange());
- }
-
- if (savedComponentState != null || savedSerializableModel != null) {
- return new Object[] {
- componentStateIsStateHolder ? Boolean.TRUE : Boolean.FALSE,
- savedComponentState,
- savedSerializableModel
- };
- } else {
- return null;
- }
- }
-
- public void restoreState(FacesContext context, Object stateObject) {
- if (stateObject != null) {
- Object[] state = (Object[]) stateObject;
-
- componentStateIsStateHolder = Boolean.TRUE.equals(state[0]);
-
- if (componentStateIsStateHolder) {
- savedComponentState = state[1];
- } else {
- dataComponentState = (DataComponentState) UIComponentBase.restoreAttachedState(context,
- savedComponentState);
- }
-
- extendedDataModel = (SerializableDataModel) UIComponentBase.restoreAttachedState(context, state[2]);
- }
- }
-
- void restoreComponentState(FacesContext context, UIDataAdaptor dataAdaptor) {
- if (savedComponentState != null && componentStateIsStateHolder) {
- dataComponentState = dataAdaptor.createComponentState();
- ((StateHolder) dataComponentState).restoreState(context, savedComponentState);
- savedComponentState = null;
- }
- }
-}
Modified: root/framework/trunk/impl/src/main/java/org/richfaces/component/SavedState.java
===================================================================
--- root/framework/trunk/impl/src/main/java/org/richfaces/component/SavedState.java 2010-05-06 00:26:30 UTC (rev 16903)
+++ root/framework/trunk/impl/src/main/java/org/richfaces/component/SavedState.java 2010-05-06 00:27:39 UTC (rev 16904)
@@ -22,11 +22,10 @@
package org.richfaces.component;
+import java.io.Serializable;
+
import javax.faces.component.EditableValueHolder;
-import javax.faces.component.StateHolder;
-import javax.faces.component.UIComponentBase;
import javax.faces.component.UIForm;
-import javax.faces.context.FacesContext;
import org.ajax4jsf.component.IterationStateHolder;
@@ -38,18 +37,20 @@
*
* @author shura
*/
-public final class SavedState implements StateHolder {
+final class SavedState implements Serializable {
public static final SavedState EMPTY = new SavedState();
- private boolean tranzient = false;
+ private static final long serialVersionUID = -1563864456074187422L;
+
private boolean valid = true;
- private Object iterationState;
private boolean localValueSet;
private boolean submitted;
private Object submittedValue;
private Object value;
+ private Object iterationState;
+
public SavedState() {
super();
}
@@ -62,9 +63,10 @@
this.localValueSet = evh.isLocalValueSet();
}
- public SavedState(FacesContext context, IterationStateHolder ish) {
+ public SavedState(IterationStateHolder ish) {
super();
- this.iterationState = ish.getIterationState(context);
+
+ this.iterationState = ish.getIterationState();
}
public SavedState(UIForm form) {
@@ -92,7 +94,7 @@
return this.value;
}
- public void setValue(Object value) {
+ void setValue(Object value) {
this.value = value;
}
@@ -100,15 +102,15 @@
return this.localValueSet;
}
- public void setLocalValueSet(boolean localValueSet) {
+ void setLocalValueSet(boolean localValueSet) {
this.localValueSet = localValueSet;
}
- public Object getIterationState() {
+ Object getIterationState() {
return iterationState;
}
- public void setIterationState(Object iterationState) {
+ void setIterationState(Object iterationState) {
this.iterationState = iterationState;
}
@@ -129,40 +131,11 @@
evh.setLocalValueSet(this.localValueSet);
}
- public void apply(FacesContext context, IterationStateHolder ish) {
- ish.setIterationState(context, this.iterationState);
+ public void apply(IterationStateHolder ish) {
+ ish.setIterationState(iterationState);
}
public void apply(UIForm form) {
form.setSubmitted(this.submitted);
}
-
- public boolean isTransient() {
- return tranzient;
- }
-
- public void restoreState(FacesContext context, Object stateObject) {
- Object[] state = (Object[]) stateObject;
- iterationState = UIComponentBase.restoreAttachedState(context, state[0]);
- localValueSet = Boolean.TRUE.equals(state[1]);
- submitted = Boolean.TRUE.equals(state[2]);
- submittedValue = state[3];
- value = state[4];
- valid = Boolean.TRUE.equals(state[5]);
- }
-
- public Object saveState(FacesContext context) {
- return new Object[] {
- UIComponentBase.saveAttachedState(context, iterationState),
- localValueSet ? Boolean.TRUE : Boolean.FALSE,
- submitted ? Boolean.TRUE : Boolean.FALSE,
- submittedValue,
- value,
- valid ? Boolean.TRUE : Boolean.FALSE
- };
- }
-
- public void setTransient(boolean newTransientValue) {
- tranzient = newTransientValue;
- }
}
Modified: root/framework/trunk/impl/src/main/java/org/richfaces/component/UIDataAdaptor.java
===================================================================
--- root/framework/trunk/impl/src/main/java/org/richfaces/component/UIDataAdaptor.java 2010-05-06 00:26:30 UTC (rev 16903)
+++ root/framework/trunk/impl/src/main/java/org/richfaces/component/UIDataAdaptor.java 2010-05-06 00:27:39 UTC (rev 16904)
@@ -23,6 +23,7 @@
package org.richfaces.component;
import java.io.IOException;
+import java.io.Serializable;
import java.text.MessageFormat;
import java.util.Collection;
import java.util.Collections;
@@ -89,6 +90,113 @@
*/
public static final String COMPONENT_TYPE = "org.richfaces.Data";
+ private static final class IterationState implements Serializable {
+
+ private static final long serialVersionUID = -3502645160277416066L;
+
+ private DataComponentState componentState;
+
+ private Object savedComponentState;
+
+ private boolean componentStateIsStateHolder;
+
+ private ExtendedDataModel<?> dataModel;
+
+ public IterationState() {
+ super();
+ }
+
+ public IterationState(DataComponentState componentState, ExtendedDataModel<?> dataModel) {
+ super();
+ this.componentState = componentState;
+ this.dataModel = dataModel;
+ }
+
+ public ExtendedDataModel<?> getDataModel() {
+ return dataModel;
+ }
+
+ public DataComponentState getComponentState() {
+ return componentState;
+ }
+
+ /**
+ * @param uiDataAdaptor
+ */
+ public void restoreComponentState(UIDataAdaptor uiDataAdaptor) {
+ if (savedComponentState != null && componentStateIsStateHolder) {
+ componentState = uiDataAdaptor.createComponentState();
+ ((StateHolder) componentState).restoreState(FacesContext.getCurrentInstance(), savedComponentState);
+ savedComponentState = null;
+ }
+ }
+
+ final Object saveState() {
+ boolean localComponentStateIsHolder = false;
+ Object localSavedComponentState = null;
+
+ if (componentState != null) {
+ if (componentState instanceof StateHolder) {
+ localComponentStateIsHolder = true;
+
+ StateHolder stateHolder = (StateHolder) componentState;
+ if (!stateHolder.isTransient()) {
+ localSavedComponentState = stateHolder.saveState(FacesContext.getCurrentInstance());
+ }
+ } else {
+ if (componentState instanceof Serializable) {
+ localSavedComponentState = componentState;
+ }
+ }
+ }
+
+ Object savedSerializableModel = null;
+
+ if (componentState != null && dataModel != null) {
+ // TODO handle model serialization - "execute" model
+ savedSerializableModel = dataModel.getSerializableModel(componentState.getRange());
+ }
+
+ if (localSavedComponentState != null || savedSerializableModel != null) {
+ return new Object[] {
+ localComponentStateIsHolder,
+ localSavedComponentState,
+ savedSerializableModel
+ };
+ } else {
+ return null;
+ }
+ }
+
+ final void restoreState(Object stateObject) {
+ if (stateObject != null) {
+ Object[] state = (Object[]) stateObject;
+ componentStateIsStateHolder = Boolean.TRUE.equals(state[0]);
+ Object localSavedComponentState = state[1];
+
+ if (componentStateIsStateHolder) {
+ savedComponentState = localSavedComponentState;
+ } else {
+ componentState = (DataComponentState) localSavedComponentState;
+ }
+
+ dataModel = (ExtendedDataModel<?>) state[2];
+ }
+ }
+
+ private void writeObject(java.io.ObjectOutputStream out)
+ throws IOException {
+
+ out.writeObject(saveState());
+ }
+
+ private void readObject(java.io.ObjectInputStream in)
+ throws IOException, ClassNotFoundException {
+
+ restoreState(in.readObject());
+ }
+ }
+
private static final VisitCallback STUB_CALLBACK = new VisitCallback() {
public VisitResult visit(VisitContext context, UIComponent target) {
@@ -310,7 +418,7 @@
if (component instanceof IterationStateHolder) {
IterationStateHolder ish = (IterationStateHolder) component;
- state = new SavedState(facesContext, ish);
+ state = new SavedState(ish);
} else if (component instanceof EditableValueHolder) {
EditableValueHolder evh = (EditableValueHolder) component;
@@ -396,7 +504,7 @@
if (component instanceof IterationStateHolder) {
IterationStateHolder ish = (IterationStateHolder) component;
- savedState.apply(facesContext, ish);
+ savedState.apply(ish);
} else if (component instanceof EditableValueHolder) {
EditableValueHolder evh = (EditableValueHolder) component;
@@ -914,10 +1022,10 @@
* (non-Javadoc)
* @see org.ajax4jsf.component.IterationStateHolder#getIterationState()
*/
- public Object getIterationState(FacesContext context) {
+ public Object getIterationState() {
assert rowKey == null;
- return new DataAdaptorStateHelper(this.componentState, this.extendedDataModel);
+ return new IterationState(this.componentState, this.extendedDataModel);
}
/*
@@ -925,17 +1033,17 @@
*
* @see org.ajax4jsf.component.IterationStateHolder#setIterationState(java.lang.Object)
*/
- public void setIterationState(FacesContext context, Object stateObject) {
+ public void setIterationState(Object stateObject) {
assert rowKey == null;
// TODO - ?
// restoreChildState(getFacesContext());
if (stateObject != null) {
- DataAdaptorStateHelper stateHelper = (DataAdaptorStateHelper) stateObject;
- stateHelper.restoreComponentState(context, this);
-
- this.componentState = stateHelper.getDataComponentState();
- this.extendedDataModel = stateHelper.getExtendedDataModel();
+ IterationState iterationState = (IterationState) stateObject;
+ iterationState.restoreComponentState(this);
+
+ this.componentState = iterationState.getComponentState();
+ this.extendedDataModel = iterationState.getDataModel();
} else {
this.componentState = null;
this.extendedDataModel = null;
@@ -1008,7 +1116,7 @@
@Override
public Object saveState(FacesContext context) {
Object parentState = super.saveState(context);
- Object savedComponentState = new DataAdaptorStateHelper(componentState, extendedDataModel).saveState(context);
+ Object savedComponentState = new IterationState(componentState, extendedDataModel).saveState();
Object converterState = null;
boolean nullDelta = true;
@@ -1067,13 +1175,13 @@
super.restoreState(context, state[0]);
if (state[1] != null) {
- DataAdaptorStateHelper dataAdaptorStateHelper = new DataAdaptorStateHelper();
- dataAdaptorStateHelper.restoreState(context, state[1]);
- dataAdaptorStateHelper.restoreComponentState(context, this);
+ IterationState iterationState = new IterationState();
+ iterationState.restoreState(state[1]);
+ iterationState.restoreComponentState(this);
// TODO update state model binding
- componentState = dataAdaptorStateHelper.getDataComponentState();
- extendedDataModel = dataAdaptorStateHelper.getExtendedDataModel();
+ componentState = iterationState.getComponentState();
+ extendedDataModel = iterationState.getDataModel();
}
boolean converterHasPartialState = Boolean.TRUE.equals(state[2]);
Modified: root/framework/trunk/impl/src/main/java/org/richfaces/component/UISequence.java
===================================================================
--- root/framework/trunk/impl/src/main/java/org/richfaces/component/UISequence.java 2010-05-06 00:26:30 UTC (rev 16903)
+++ root/framework/trunk/impl/src/main/java/org/richfaces/component/UISequence.java 2010-05-06 00:27:39 UTC (rev 16904)
@@ -43,9 +43,9 @@
import org.ajax4jsf.model.DataComponentState;
import org.ajax4jsf.model.ExtendedDataModel;
import org.ajax4jsf.model.Range;
-import org.ajax4jsf.model.RepeatState;
import org.ajax4jsf.model.SequenceDataModel;
import org.ajax4jsf.model.SequenceRange;
+import org.ajax4jsf.model.SequenceState;
/**
* @author Nick Belaevski
@@ -58,6 +58,19 @@
first, rows, value, iterationStatusVar
}
+ private void updateSequenceState(SequenceState state) {
+ state.setFirst(getActualFirst());
+ state.setRows(getActualRows());
+ }
+
+ protected int getActualFirst() {
+ return getFirst();
+ }
+
+ protected int getActualRows() {
+ return getRows();
+ }
+
@SuppressWarnings("unchecked")
protected DataModel<?> createFacesModel(Object value) {
DataModel<?> model = null;
@@ -111,17 +124,11 @@
@Override
protected DataComponentState createComponentState() {
- return new RepeatState() {
- @Override
- public int getFirst() {
- return UISequence.this.getFirst();
- }
+ SequenceState state = new SequenceState();
- @Override
- public int getRows() {
- return UISequence.this.getRows();
- }
- };
+ updateSequenceState(state);
+
+ return state;
}
/*
@@ -206,6 +213,8 @@
protected void setupVariable(FacesContext faces, boolean rowSelected) {
super.setupVariable(faces, rowSelected);
+ //TODO nick - should iterationStatus be available out of iteration?
+ // if yes, better name than "iterationStatusVar" is required
String iterationStatusVar = getIterationStatusVar();
if (iterationStatusVar != null) {
Map<String, Object> requestMap = getVariablesMap(faces);
@@ -254,4 +263,14 @@
super.setValueExpression(name, binding);
}
+
+ @Override
+ protected void preEncodeBegin(FacesContext context) {
+ super.preEncodeBegin(context);
+
+ DataComponentState componentState = getComponentState();
+ if (componentState instanceof SequenceState) {
+ updateSequenceState((SequenceState) componentState);
+ }
+ }
}
Modified: root/framework/trunk/impl/src/test/java/org/richfaces/component/DataAdaptorTestCase.java
===================================================================
--- root/framework/trunk/impl/src/test/java/org/richfaces/component/DataAdaptorTestCase.java 2010-05-06 00:26:30 UTC (rev 16903)
+++ root/framework/trunk/impl/src/test/java/org/richfaces/component/DataAdaptorTestCase.java 2010-05-06 00:27:39 UTC (rev 16904)
@@ -227,14 +227,14 @@
assertNull(input.getLocalValue());
assertTrue(input.isValid());
assertFalse(input.isLocalValueSet());
- assertNull(stateHolder.getIterationState(facesContext));
+ assertNull(stateHolder.getIterationState());
form.setSubmitted(true);
input.setSubmittedValue("user input");
input.setValue("component value");
input.setValid(false);
input.setLocalValueSet(true);
- stateHolder.setIterationState(facesContext, "state");
+ stateHolder.setIterationState("state");
mockDataAdaptor.setRowKey(facesContext, Integer.valueOf(1));
@@ -243,12 +243,12 @@
assertNull(input.getLocalValue());
assertTrue(input.isValid());
assertFalse(input.isLocalValueSet());
- assertNull(stateHolder.getIterationState(facesContext));
+ assertNull(stateHolder.getIterationState());
input.setSubmittedValue("another input from user");
input.setValue("123");
assertTrue(input.isLocalValueSet());
- stateHolder.setIterationState(facesContext, "456");
+ stateHolder.setIterationState("456");
mockDataAdaptor.setRowKey(facesContext, Integer.valueOf(0));
assertTrue(form.isSubmitted());
@@ -256,7 +256,7 @@
assertEquals("component value", input.getLocalValue());
assertFalse(input.isValid());
assertTrue(input.isLocalValueSet());
- assertEquals("state", stateHolder.getIterationState(facesContext));
+ assertEquals("state", stateHolder.getIterationState());
mockDataAdaptor.setRowKey(facesContext, Integer.valueOf(1));
assertFalse(form.isSubmitted());
@@ -264,7 +264,7 @@
assertEquals("123", input.getLocalValue());
assertTrue(input.isValid());
assertTrue(input.isLocalValueSet());
- assertEquals("456", stateHolder.getIterationState(facesContext));
+ assertEquals("456", stateHolder.getIterationState());
mockDataAdaptor.setRowKey(facesContext, null);
assertFalse(form.isSubmitted());
@@ -272,7 +272,7 @@
assertNull(input.getLocalValue());
assertTrue(input.isValid());
assertFalse(input.isLocalValueSet());
- assertNull(stateHolder.getIterationState(facesContext));
+ assertNull(stateHolder.getIterationState());
}
public void testSaveRestoreChildrenStateNestedDataAdaptors() throws Exception {
@@ -492,11 +492,11 @@
return "test.Component";
}
- public Object getIterationState(FacesContext context) {
+ public Object getIterationState() {
return iterationState;
}
- public void setIterationState(FacesContext context, Object state) {
+ public void setIterationState(Object state) {
iterationState = state;
}
Modified: root/ui-sandbox/trunk/components/datascroller/ui/src/main/java/org/richfaces/component/UIDataScroller.java
===================================================================
--- root/ui-sandbox/trunk/components/datascroller/ui/src/main/java/org/richfaces/component/UIDataScroller.java 2010-05-06 00:26:30 UTC (rev 16903)
+++ root/ui-sandbox/trunk/components/datascroller/ui/src/main/java/org/richfaces/component/UIDataScroller.java 2010-05-06 00:27:39 UTC (rev 16904)
@@ -381,18 +381,13 @@
}
@Override
- public Object getIterationState(FacesContext context) {
- return new Object[] { this.page };
+ public Object getIterationState() {
+ return this.page;
}
@Override
- public void setIterationState(FacesContext context, Object state) {
- if (state != null) {
- Object[] stateObject = (Object[]) state;
- this.page = (Integer) stateObject[0];
- } else {
- this.page = null;
- }
+ public void setIterationState(Object state) {
+ this.page = (Integer) state;
}
}
Modified: root/ui-sandbox/trunk/components/tables/ui/src/main/java/org/richfaces/component/UIExtendedDataTable.java
===================================================================
--- root/ui-sandbox/trunk/components/tables/ui/src/main/java/org/richfaces/component/UIExtendedDataTable.java 2010-05-06 00:26:30 UTC (rev 16903)
+++ root/ui-sandbox/trunk/components/tables/ui/src/main/java/org/richfaces/component/UIExtendedDataTable.java 2010-05-06 00:27:39 UTC (rev 16904)
@@ -35,7 +35,6 @@
import org.ajax4jsf.model.DataComponentState;
import org.ajax4jsf.model.DataVisitor;
import org.ajax4jsf.model.Range;
-import org.ajax4jsf.model.RepeatState;
import org.richfaces.context.ExtendedVisitContext;
import org.richfaces.context.ExtendedVisitContextMode;
import org.richfaces.log.RichfacesLogger;
@@ -140,25 +139,20 @@
restoreOrigValue(faces);
}
- @Override
- protected DataComponentState createComponentState() {
- return new RepeatState() {
- @Override
- public int getFirst() {
- return UIExtendedDataTable.this.getFirst() + UIExtendedDataTable.this.getClientFirst();
- }
+ protected int getActualFirst() {
+ return getFirst() + getClientFirst();
+ }
+
+ protected int getActualRows() {
+ int rows = getClientRows();
+
+ if (rows > 0) {
+ rows = Math.min(rows, getRows());
+ } else {
+ rows = getRows();
+ }
- @Override
- public int getRows() {
- int rows = getClientRows();
- if (rows > 0) {
- rows = Math.min(rows, UIExtendedDataTable.this.getRows());
- } else {
- rows = UIExtendedDataTable.this.getRows();
- }
- return rows;
- }
- };
+ return rows;
}
public int getClientFirst() {
Modified: root/ui-sandbox/trunk/components/tables/ui/src/main/java/org/richfaces/component/UISubTable.java
===================================================================
--- root/ui-sandbox/trunk/components/tables/ui/src/main/java/org/richfaces/component/UISubTable.java 2010-05-06 00:26:30 UTC (rev 16903)
+++ root/ui-sandbox/trunk/components/tables/ui/src/main/java/org/richfaces/component/UISubTable.java 2010-05-06 00:27:39 UTC (rev 16904)
@@ -132,21 +132,21 @@
}
@Override
- public void setIterationState(FacesContext context, Object stateObject) {
+ public void setIterationState(Object stateObject) {
Object[] state = (Object[])stateObject;
if(state != null) {
- super.setIterationState(context, state[0]);
+ super.setIterationState(state[0]);
getStateHelper().put(PropertyKeys.expanded, state[1]);
} else {
- super.setIterationState(context, null);
+ super.setIterationState(null);
getStateHelper().put(PropertyKeys.expanded, null);
}
}
@Override
- public Object getIterationState(FacesContext context) {
+ public Object getIterationState() {
Object [] state = new Object[2];
- state[0] = super.getIterationState(context);
+ state[0] = super.getIterationState();
state[1] = getStateHelper().get(PropertyKeys.expanded);
return state;
}
Modified: root/ui-sandbox/trunk/components/tables/ui/src/main/java/org/richfaces/renderkit/ExtendedDataTableRenderer.java
===================================================================
--- root/ui-sandbox/trunk/components/tables/ui/src/main/java/org/richfaces/renderkit/ExtendedDataTableRenderer.java 2010-05-06 00:26:30 UTC (rev 16903)
+++ root/ui-sandbox/trunk/components/tables/ui/src/main/java/org/richfaces/renderkit/ExtendedDataTableRenderer.java 2010-05-06 00:27:39 UTC (rev 16904)
@@ -231,6 +231,8 @@
if (difference < 0) {
difference += clientRows;
}
+
+ //TODO nick - move this to external JavaScript file
writer.write("var richTBody = document.getElementById('" + component.getClientId(context) + ":tb"
+ partNameFirstChar + "');");
writer.write("var richRows = richTBody.rows;");
@@ -239,6 +241,7 @@
writer.endEval();
}
writer.startEval();
+ //TODO nick - make this utility function in RendererUtils
writer.write("jQuery('#" + component.getClientId(context).replace(":", "\\\\:")
+ "').triggerHandler('rich:onscrollcomplete', " + table.getClientFirst() + ");");
writer.endEval();
14 years, 9 months
JBoss Rich Faces SVN: r16903 - in root/cdk/trunk/plugins/generator/src: main/java/org/richfaces/cdk/apt and 3 other directories.
by richfaces-svn-commits@lists.jboss.org
Author: alexsmirnov
Date: 2010-05-05 20:26:30 -0400 (Wed, 05 May 2010)
New Revision: 16903
Modified:
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/ModelValidator.java
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/apt/CdkProcessor.java
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/model/validator/ValidatorImpl.java
root/cdk/trunk/plugins/generator/src/test/java/org/richfaces/cdk/apt/CdkProcessorTest.java
root/cdk/trunk/plugins/generator/src/test/java/org/richfaces/cdk/model/validator/ModelValidatorTest.java
Log:
CODING IN PROGRESS - issue RF-7736: Library model verifier.
https://jira.jboss.org/jira/browse/RF-7736
Modified: root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/ModelValidator.java
===================================================================
--- root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/ModelValidator.java 2010-05-05 23:50:39 UTC (rev 16902)
+++ root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/ModelValidator.java 2010-05-06 00:26:30 UTC (rev 16903)
@@ -23,7 +23,9 @@
package org.richfaces.cdk;
+import org.richfaces.cdk.model.ComponentLibrary;
+
/**
* <p class="changed_added_4_0">Interface for CDK library model verifier.</p>
*
@@ -37,5 +39,5 @@
* @param library
* @throws CdkException
*/
- public void verify() throws CdkException;
+ public void verify(ComponentLibrary library) throws CdkException;
}
Modified: root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/apt/CdkProcessor.java
===================================================================
--- root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/apt/CdkProcessor.java 2010-05-05 23:50:39 UTC (rev 16902)
+++ root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/apt/CdkProcessor.java 2010-05-06 00:26:30 UTC (rev 16903)
@@ -94,7 +94,7 @@
for (ModelBuilder builder : builders) {
builder.build();
}
- validator.verify();
+ validator.verify(library);
} else if (0 == log.getErrorCount()) {
// processing over, generate files.
builder.generate();
Modified: root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/model/validator/ValidatorImpl.java
===================================================================
--- root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/model/validator/ValidatorImpl.java 2010-05-05 23:50:39 UTC (rev 16902)
+++ root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/model/validator/ValidatorImpl.java 2010-05-06 00:26:30 UTC (rev 16903)
@@ -52,14 +52,12 @@
@Inject
private Logger log;
- private final ComponentLibrary library;
private final NamingConventions namingConventions;
private final SourceUtils sourceUtils;
@Inject
- public ValidatorImpl(ComponentLibrary library, NamingConventions namingConventions, SourceUtils sourceUtils) {
- this.library = library;
+ public ValidatorImpl(NamingConventions namingConventions, SourceUtils sourceUtils) {
this.namingConventions = namingConventions;
this.sourceUtils = sourceUtils;
}
@@ -68,21 +66,21 @@
* @see org.richfaces.cdk.ValidatorModel#verify(org.richfaces.cdk.model.ComponentLibrary)
*/
@Override
- public void verify() throws CdkException {
- verifyRenderers();
- verifyComponents();
+ public void verify(ComponentLibrary library) throws CdkException {
+ verifyRenderers(library);
+ verifyComponents(library);
// After all, merge all similar elements.
compact(library.getComponents());
}
- protected void verifyRenderers() {
+ protected void verifyRenderers(ComponentLibrary library) {
for (RenderKitModel.Id renderKitId : library.getRenderKits().keySet()) {
// Check render kit name and class.
RenderKitModel renderKit = library.getRenderKits().get(renderKitId);
for (RendererModel renderer : renderKit.getRenderers()) {
- vefifyRenderer(renderer);
+ vefifyRenderer(library,renderer);
// Check type.
// Check family.
@@ -94,17 +92,17 @@
}
}
- protected void vefifyRenderer(RendererModel renderer) {
+ protected void vefifyRenderer(ComponentLibrary library,RendererModel renderer) {
// TODO Auto-generated method stub
}
- protected void verifyComponents() throws CdkException {
+ protected void verifyComponents(ComponentLibrary library) throws CdkException {
for (ComponentModel component : library.getComponents()) {
- verifyComponent(component);
+ verifyComponent(library,component);
}
}
- protected void verifyComponent(ComponentModel component) {
+ protected void verifyComponent(ComponentLibrary library,ComponentModel component) {
// Check JsfComponent type.
if (null == component.getType()) {
if (null != component.getTargetClass()) {
@@ -137,7 +135,11 @@
if (null == component.getFamily()) {
component.setFamily(namingConventions.inferUIComponentFamily(component.getType()));
}
- // TODO Propagate attributes from parent component.
+ // Propagate attributes from parent component, if any.
+ if(component.isGenerate()){
+ // Step one, lookup for parent.
+
+ }
// Check attributes.
for (PropertyBase attribute : component.getAttributes()) {
verifyAttribute(attribute, component.isGenerate());
Modified: root/cdk/trunk/plugins/generator/src/test/java/org/richfaces/cdk/apt/CdkProcessorTest.java
===================================================================
--- root/cdk/trunk/plugins/generator/src/test/java/org/richfaces/cdk/apt/CdkProcessorTest.java 2010-05-05 23:50:39 UTC (rev 16902)
+++ root/cdk/trunk/plugins/generator/src/test/java/org/richfaces/cdk/apt/CdkProcessorTest.java 2010-05-06 00:26:30 UTC (rev 16903)
@@ -128,7 +128,7 @@
expect(element.getKind()).andReturn(ElementKind.CLASS);
cdkProcessor.process(element, library);
expectLastCall();
- validator.verify();
+ validator.verify(library);
expectLastCall();
replay(element, roundEnv, builder, validator, cdkProcessor);
processor.process(Collections.singleton(element), roundEnv);
@@ -163,7 +163,7 @@
expect((Class<TestAnnotation>) cdkProcessor.getProcessedAnnotation()).andStubReturn(TestAnnotation.class);
expect((Set<TypeElement>) roundEnv.getElementsAnnotatedWith(TestAnnotation.class)).andReturn(
Collections.<TypeElement> emptySet());
- validator.verify();
+ validator.verify(library);
expectLastCall();
replay(element, roundEnv, builder, validator, cdkProcessor);
processor.process(Collections.singleton(element), roundEnv);
Modified: root/cdk/trunk/plugins/generator/src/test/java/org/richfaces/cdk/model/validator/ModelValidatorTest.java
===================================================================
--- root/cdk/trunk/plugins/generator/src/test/java/org/richfaces/cdk/model/validator/ModelValidatorTest.java 2010-05-05 23:50:39 UTC (rev 16902)
+++ root/cdk/trunk/plugins/generator/src/test/java/org/richfaces/cdk/model/validator/ModelValidatorTest.java 2010-05-06 00:26:30 UTC (rev 16903)
@@ -72,7 +72,7 @@
ComponentModel component = new ComponentModel();
log.error((CharSequence) anyObject());expectLastCall();
replay(log,utils,namiingConventions);
- validator.verifyComponent(component);
+ validator.verifyComponent(library,component);
verify(log,utils,namiingConventions);
}
@@ -86,7 +86,7 @@
expect(namiingConventions.inferUIComponentFamily(type)).andReturn("foo.baz");
replay(log,utils,namiingConventions);
// Validator should set component type from base class.
- validator.verifyComponent(component);
+ validator.verifyComponent(library,component);
verify(log,utils,namiingConventions);
assertEquals(type, component.getType());
assertEquals("foo.baz", component.getFamily());
14 years, 9 months
JBoss Rich Faces SVN: r16902 - in root/cdk/trunk/plugins: generator/src/main/java/org/richfaces/cdk/xmlconfig and 4 other directories.
by richfaces-svn-commits@lists.jboss.org
Author: alexsmirnov
Date: 2010-05-05 19:50:39 -0400 (Wed, 05 May 2010)
New Revision: 16902
Modified:
root/cdk/trunk/plugins/commons/src/test/java/org/richfaces/cdk/CdkTestRunner.java
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/xmlconfig/JAXBBinding.java
root/cdk/trunk/plugins/xinclude/pom.xml
root/cdk/trunk/plugins/xinclude/src/main/java/org/apache/cocoon/pipeline/component/sax/XIncludeTransformer.java
root/cdk/trunk/plugins/xinclude/src/main/java/org/apache/cocoon/pipeline/component/xpointer/XPointerContext.java
root/cdk/trunk/plugins/xinclude/src/test/java/org/apache/cocoon/pipeline/component/sax/XIncludeTransformerTest.java
Log:
switch Xinclude to CDK logger
Modified: root/cdk/trunk/plugins/commons/src/test/java/org/richfaces/cdk/CdkTestRunner.java
===================================================================
--- root/cdk/trunk/plugins/commons/src/test/java/org/richfaces/cdk/CdkTestRunner.java 2010-05-05 23:22:04 UTC (rev 16901)
+++ root/cdk/trunk/plugins/commons/src/test/java/org/richfaces/cdk/CdkTestRunner.java 2010-05-05 23:50:39 UTC (rev 16902)
@@ -111,8 +111,8 @@
for (Field field : fieldValues.keySet()) {
Binding binding = fieldValues.get(field);
field.setAccessible(true);
- if (null != binding.value && field.get(test) == null) {
- field.set(test, binding.value);
+ if (null != binding.getValue() && field.get(test) == null) {
+ field.set(test, binding.getValue());
}
}
@@ -178,12 +178,12 @@
}
}
Binding binding = fields.get(field);
- if (null != binding.value) {
- builder.toInstance(binding.value);
- } else if (null != binding.implementation) {
- builder.to(binding.implementation);
- } else if (null != binding.provider) {
- builder.toProvider(binding.provider);
+ if (null != binding.getValue()) {
+ builder.toInstance(binding.getValue());
+ } else if (null != binding.getImplementation()) {
+ builder.to(binding.getImplementation());
+ } else if (null != binding.getProvider()) {
+ builder.toProvider(binding.getProvider());
}
}
}
@@ -191,8 +191,8 @@
@Override
public void replay() {
for (Binding field : fields.values()) {
- if(null != field.value){
- EasyMock.replay(field.value);
+ if(null != field.getValue()){
+ EasyMock.replay(field.getValue());
}
}
}
@@ -200,17 +200,66 @@
@Override
public void verify() {
for (Binding field : fields.values()) {
- if(null != field.value){
- EasyMock.verify(field.value);
+ if(null != field.getValue()){
+ EasyMock.verify(field.getValue());
}
}
}
}
+ /**
+ * <p class="changed_added_4_0">Binding definition storage</p>
+ * @author asmirnov(a)exadel.com
+ *
+ */
protected static final class Binding {
private Object value;
private Class<?> implementation;
private Class<? extends Provider<?>> provider;
+ protected Binding() {
+ }
+ /**
+ * <p class="changed_added_4_0"></p>
+ * @param value the value to set
+ */
+ void setValue(Object value) {
+ this.value = value;
+ }
+ /**
+ * <p class="changed_added_4_0"></p>
+ * @return the value
+ */
+ Object getValue() {
+ return value;
+ }
+ /**
+ * <p class="changed_added_4_0"></p>
+ * @param implementation the implementation to set
+ */
+ void setImplementation(Class<?> implementation) {
+ this.implementation = implementation;
+ }
+ /**
+ * <p class="changed_added_4_0"></p>
+ * @return the implementation
+ */
+ Class<?> getImplementation() {
+ return implementation;
+ }
+ /**
+ * <p class="changed_added_4_0"></p>
+ * @param provider the provider to set
+ */
+ void setProvider(Class<? extends Provider<?>> provider) {
+ this.provider = provider;
+ }
+ /**
+ * <p class="changed_added_4_0"></p>
+ * @return the provider
+ */
+ Class<? extends Provider<?>> getProvider() {
+ return provider;
+ }
}
private Map<Field, Binding> getMockValues(Set<Field> testFields) {
@@ -219,19 +268,19 @@
for (Field field : testFields) {
if (field.getAnnotation(Mock.class) != null) {
Binding bind = new Binding();
- bind.value = EasyMock.createStrictMock(field.getType());
+ bind.setValue(EasyMock.createStrictMock(field.getType()));
mocksAndStubs.put(field, bind);
} else if (field.getAnnotation(Stub.class) != null) {
Binding bind = new Binding();
- bind.value = EasyMock.createNiceMock(field.getType());
+ bind.setValue(EasyMock.createNiceMock(field.getType()));
mocksAndStubs.put(field, bind);
} else if (null != field.getAnnotation(As.class)) {
Binding bind = new Binding();
- bind.implementation = field.getAnnotation(As.class).value();
+ bind.setImplementation(field.getAnnotation(As.class).value());
mocksAndStubs.put(field, bind);
} else if (null != field.getAnnotation(AsProvider.class)) {
Binding bind = new Binding();
- bind.provider = field.getAnnotation(AsProvider.class).value();
+ bind.setProvider(field.getAnnotation(AsProvider.class).value());
mocksAndStubs.put(field, bind);
}
}
Modified: root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/xmlconfig/JAXBBinding.java
===================================================================
--- root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/xmlconfig/JAXBBinding.java 2010-05-05 23:22:04 UTC (rev 16901)
+++ root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/xmlconfig/JAXBBinding.java 2010-05-05 23:50:39 UTC (rev 16902)
@@ -29,6 +29,7 @@
import com.google.inject.Inject;
import org.apache.cocoon.pipeline.component.sax.XIncludeTransformer;
import org.richfaces.cdk.CdkException;
+import org.richfaces.cdk.Logger;
import org.xml.sax.InputSource;
import org.xml.sax.SAXException;
import org.xml.sax.XMLReader;
@@ -59,7 +60,11 @@
@Inject
private EntityResolver2 resolver;
+
+ @Inject
+ private Logger log;
+
public JAXBBinding() { }
/* (non-Javadoc)
@@ -124,7 +129,7 @@
Unmarshaller u = JAXBContext.newInstance(bindClass).createUnmarshaller();
u.setEventHandler(new ValidationEventCollector());
- XIncludeTransformer xIncludeTransformer = new XIncludeTransformer();
+ XIncludeTransformer xIncludeTransformer = new XIncludeTransformer(log);
if (null != inputSource.getSystemId()) {
xIncludeTransformer.setBaseUri(new URI(inputSource.getSystemId()));
Modified: root/cdk/trunk/plugins/xinclude/pom.xml
===================================================================
--- root/cdk/trunk/plugins/xinclude/pom.xml 2010-05-05 23:22:04 UTC (rev 16901)
+++ root/cdk/trunk/plugins/xinclude/pom.xml 2010-05-05 23:50:39 UTC (rev 16902)
@@ -45,8 +45,8 @@
<artifactId>xmlunit</artifactId>
</dependency>
<dependency>
- <groupId>commons-logging</groupId>
- <artifactId>commons-logging</artifactId>
+ <groupId>org.richfaces.cdk</groupId>
+ <artifactId>commons</artifactId>
<!--<scope>test</scope>-->
</dependency>
</dependencies>
Modified: root/cdk/trunk/plugins/xinclude/src/main/java/org/apache/cocoon/pipeline/component/sax/XIncludeTransformer.java
===================================================================
--- root/cdk/trunk/plugins/xinclude/src/main/java/org/apache/cocoon/pipeline/component/sax/XIncludeTransformer.java 2010-05-05 23:22:04 UTC (rev 16901)
+++ root/cdk/trunk/plugins/xinclude/src/main/java/org/apache/cocoon/pipeline/component/sax/XIncludeTransformer.java 2010-05-05 23:50:39 UTC (rev 16902)
@@ -19,26 +19,27 @@
*/
package org.apache.cocoon.pipeline.component.sax;
+import java.io.IOException;
+import java.net.URI;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.Map.Entry;
+
import org.apache.cocoon.pipeline.component.xpointer.XPointer;
import org.apache.cocoon.pipeline.component.xpointer.XPointerContext;
import org.apache.cocoon.pipeline.component.xpointer.parser.ParseException;
import org.apache.cocoon.pipeline.component.xpointer.parser.XPointerFrameworkParser;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-
-import org.xml.sax.*;
+import org.richfaces.cdk.Logger;
+import org.xml.sax.Attributes;
+import org.xml.sax.ContentHandler;
+import org.xml.sax.InputSource;
+import org.xml.sax.Locator;
+import org.xml.sax.SAXException;
+import org.xml.sax.XMLReader;
import org.xml.sax.ext.EntityResolver2;
import org.xml.sax.ext.LexicalHandler;
import org.xml.sax.helpers.XMLReaderFactory;
-import java.io.IOException;
-
-import java.net.URI;
-
-import java.util.HashMap;
-import java.util.Map;
-import java.util.Map.Entry;
-
public final class XIncludeTransformer implements SAXConsumer {
private static final String DEFAULT_CHARSET = "UTF-8";
private static final String HTTP_ACCEPT = "Accept";
@@ -55,7 +56,7 @@
private static final String XINCLUDE_PARSE_TEXT = "text";
private static final String XINCLUDE_PARSE_XML = "xml";
private static final String XINCLUDE_XPOINTER = "xpointer";
- private static final Log LOG = LogFactory.getLog(XIncludeTransformer.class);
+ private final Logger LOG ;
/** The nesting level of fallback that should be used */
private int useFallbackLevel = 0;
@@ -82,12 +83,12 @@
private Locator locator;
private EntityResolver2 resolver;
- public XIncludeTransformer() {
-
- // default empty constructor
+ public XIncludeTransformer(Logger log) {
+ this.LOG = log;
}
- public XIncludeTransformer(URI baseUri) {
+ public XIncludeTransformer(URI baseUri,Logger log) {
+ this(log);
this.setBaseUri(baseUri);
}
@@ -260,7 +261,7 @@
try {
if (xpointer != null && xpointer.length() > 0) {
XPointer xPointer = XPointerFrameworkParser.parse(xpointer);
- XPointerContext xPointerContext = new XPointerContext(xpointer, source, this, resolver);
+ XPointerContext xPointerContext = new XPointerContext(xpointer, source, this, resolver,LOG);
for (Entry<String, String> namespace : namespaces.entrySet()) {
xPointerContext.addPrefix(namespace.getKey(), namespace.getValue());
@@ -281,13 +282,13 @@
// this exception is thrown in case of an invalid xpointer expression
useFallbackLevel++;
- LOG.error("Error parsing XPointer expression, will try to use fallback.", e);
+ LOG.info("Error parsing XPointer expression: "+e.getMessage()+" , will try to use fallback.");
} catch (IOException e) {
useFallbackLevel++;
- LOG.error("Error processing an xInclude, will try to use fallback.", e);
+ LOG.info("Error processing an xInclude: "+e.getMessage()+" will try to use fallback.");
} catch (SAXException e) {
useFallbackLevel++;
- LOG.error("Error processing an xInclude, will try to use fallback.", e);
+ LOG.info("Error processing an xInclude: "+e.getMessage()+" will try to use fallback.");
}
} else if (XINCLUDE_PARSE_TEXT.equals(parse)) {
if (xpointer != null) {
Modified: root/cdk/trunk/plugins/xinclude/src/main/java/org/apache/cocoon/pipeline/component/xpointer/XPointerContext.java
===================================================================
--- root/cdk/trunk/plugins/xinclude/src/main/java/org/apache/cocoon/pipeline/component/xpointer/XPointerContext.java 2010-05-05 23:22:04 UTC (rev 16901)
+++ root/cdk/trunk/plugins/xinclude/src/main/java/org/apache/cocoon/pipeline/component/xpointer/XPointerContext.java 2010-05-05 23:50:39 UTC (rev 16902)
@@ -19,32 +19,27 @@
*/
package org.apache.cocoon.pipeline.component.xpointer;
+import java.io.IOException;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.Map;
+
+import javax.xml.namespace.NamespaceContext;
+
import org.apache.cocoon.pipeline.component.sax.SAXConsumer;
-import org.apache.cocoon.pipeline.component.sax.XIncludeTransformer;
import org.apache.cocoon.pipeline.util.dom.DOMUtils;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-
+import org.richfaces.cdk.Logger;
import org.w3c.dom.Document;
-
import org.xml.sax.EntityResolver;
import org.xml.sax.InputSource;
import org.xml.sax.SAXException;
-import javax.xml.namespace.NamespaceContext;
-
-import java.io.IOException;
-
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.Map;
-
public final class XPointerContext implements NamespaceContext {
private static final String XML = "xml";
private static final String XMLNS = "xmlns";
private static final String XMLNS_NAMESPACE = "http://www.w3.org/2000/xmlns/";
private static final String XML_NAMESPACE = "http://www.w3.org/XML/1998/namespace";
- private static final Log LOGGER = LogFactory.getLog(XIncludeTransformer.class);
+ private final Logger LOGGER ;
private Map<String, String> prefixes = new HashMap<String, String>();
private Document document;
private final EntityResolver resolver;
@@ -52,11 +47,12 @@
private String xPointer;
private SAXConsumer xmlConsumer;
- public XPointerContext(String xPointer, InputSource source, SAXConsumer xmlConsumer, EntityResolver resolver) {
+ public XPointerContext(String xPointer, InputSource source, SAXConsumer xmlConsumer, EntityResolver resolver, Logger log) {
this.xPointer = xPointer;
this.source = source;
this.xmlConsumer = xmlConsumer;
this.resolver = resolver;
+ this.LOGGER = log;
}
public String getXPointer() {
@@ -71,7 +67,7 @@
return xmlConsumer;
}
- public Log getLogger() {
+ public Logger getLogger() {
return LOGGER;
}
Modified: root/cdk/trunk/plugins/xinclude/src/test/java/org/apache/cocoon/pipeline/component/sax/XIncludeTransformerTest.java
===================================================================
--- root/cdk/trunk/plugins/xinclude/src/test/java/org/apache/cocoon/pipeline/component/sax/XIncludeTransformerTest.java 2010-05-05 23:22:04 UTC (rev 16901)
+++ root/cdk/trunk/plugins/xinclude/src/test/java/org/apache/cocoon/pipeline/component/sax/XIncludeTransformerTest.java 2010-05-05 23:50:39 UTC (rev 16902)
@@ -37,6 +37,7 @@
import org.junit.Ignore;
import org.junit.Test;
+import org.richfaces.cdk.JavaLogger;
import org.xml.sax.XMLReader;
import org.xml.sax.helpers.XMLReaderFactory;
@@ -109,7 +110,7 @@
transformerHandler.getTransformer().setOutputProperties(properties);
transformerHandler.setResult(new StreamResult(baos));
- XIncludeTransformer xinclude = new XIncludeTransformer(base.toURI());
+ XIncludeTransformer xinclude = new XIncludeTransformer(base.toURI(),new JavaLogger());
xinclude.setContentHandler(transformerHandler);
14 years, 9 months
JBoss Rich Faces SVN: r16901 - in root/cdk/trunk/plugins: attributes/src/main and 4 other directories.
by richfaces-svn-commits@lists.jboss.org
Author: alexsmirnov
Date: 2010-05-05 19:22:04 -0400 (Wed, 05 May 2010)
New Revision: 16901
Added:
root/cdk/trunk/plugins/attributes/src/main/resources/
Removed:
root/cdk/trunk/plugins/annotations/src/main/resources/
Modified:
root/cdk/trunk/plugins/attributes/src/main/resources/META-INF/cdk/attributes/javax.faces.component.ValueHolder.xml
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/apt/processors/AttributesProcessorImpl.java
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/apt/processors/ComponentProcessor.java
root/cdk/trunk/plugins/generator/src/test/java/org/richfaces/cdk/apt/processors/AttributesProcessorTest.java
root/cdk/trunk/plugins/maven-cdk-plugin/src/it/annotated-component/src/main/resources/META-INF/cdk/attributes/html5.xml
Log:
Move xml templates to "attributes" project, fix attributes for @Subcomponent
Copied: root/cdk/trunk/plugins/attributes/src/main/resources (from rev 16897, root/cdk/trunk/plugins/annotations/src/main/resources)
Modified: root/cdk/trunk/plugins/attributes/src/main/resources/META-INF/cdk/attributes/javax.faces.component.ValueHolder.xml
===================================================================
--- root/cdk/trunk/plugins/annotations/src/main/resources/META-INF/cdk/attributes/javax.faces.component.ValueHolder.xml 2010-05-05 15:40:30 UTC (rev 16897)
+++ root/cdk/trunk/plugins/attributes/src/main/resources/META-INF/cdk/attributes/javax.faces.component.ValueHolder.xml 2010-05-05 23:22:04 UTC (rev 16901)
@@ -44,6 +44,7 @@
<property-name>localValue</property-name>
<property-class>java.lang.Object</property-class>
<property-extension>
+ <cdk:read-only>true</cdk:read-only>
<cdk:hidden>true</cdk:hidden>
</property-extension>
</property>
Modified: root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/apt/processors/AttributesProcessorImpl.java
===================================================================
--- root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/apt/processors/AttributesProcessorImpl.java 2010-05-05 21:45:59 UTC (rev 16900)
+++ root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/apt/processors/AttributesProcessorImpl.java 2010-05-05 23:22:04 UTC (rev 16901)
@@ -255,7 +255,7 @@
try {
log.debug(" -> visit - " + type.toString());
component.getAttributes().addAll(
- parseProperties(CdkEntityResolver.URN_ATTRIBUTES + type.toString() + ".xml"));
+ parseProperties(type.toString() + ".xml"));
} catch (CdkException e) {
// TODO - log errors ?
}
@@ -267,7 +267,7 @@
log.debug(" -- Process Java files.");
Set<BeanProperty> properties = Sets.newHashSet();
properties.addAll(sourceUtils.getBeanPropertiesAnnotatedWith(Attribute.class, element));
- properties.addAll(sourceUtils.getAbstractBeanProperties(element));
+// properties.addAll(sourceUtils.getAbstractBeanProperties(element));
// TODO - encapsulate attribute builder into utility class.
for (BeanProperty beanProperty : properties) {
processAttribute(beanProperty, component.getOrCreateAttribute(beanProperty.getName()));
@@ -275,7 +275,7 @@
}
private Collection<? extends PropertyBase> parseProperties(String uri) {
- return parser.parseProperties(uri);
+ return parser.parseProperties(CdkEntityResolver.URN_ATTRIBUTES + uri);
}
private SourceUtils getSourceUtils() {
@@ -288,7 +288,7 @@
// Process all files from @Jsf.. attributes property.
for (String attributes : attributesConfig) {
try {
- component.getAttributes().addAll(parseProperties(CdkEntityResolver.URN_ATTRIBUTES + attributes));
+ component.getAttributes().addAll(parseProperties(attributes));
} catch (CdkException e) {
// TODO - log errors ?
}
Modified: root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/apt/processors/ComponentProcessor.java
===================================================================
--- root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/apt/processors/ComponentProcessor.java 2010-05-05 21:45:59 UTC (rev 16900)
+++ root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/apt/processors/ComponentProcessor.java 2010-05-05 23:22:04 UTC (rev 16901)
@@ -38,6 +38,7 @@
import org.richfaces.cdk.model.ComponentModel;
import org.richfaces.cdk.model.FacesId;
import org.richfaces.cdk.model.FacetModel;
+import org.richfaces.cdk.model.PropertyBase;
import org.richfaces.cdk.model.RendererModel;
import org.richfaces.cdk.util.Strings;
@@ -91,6 +92,13 @@
subcomponentModel.setTargetClass(ClassName.parseName(subcomponent.generate()));
subcomponentModel.setGenerate(!Strings.isEmpty(subcomponent.generate()));
setComponentProperties(null, subcomponentModel, subAnnotation);
+ // Propagate attributes from parent element.
+ for (PropertyBase property : component.getAttributes()) {
+ PropertyBase subcomponentAttribute = subcomponentModel.getOrCreateAttribute(property.getName());
+ subcomponentAttribute.merge(property);
+ // parent component should be concrete. TODO - move to validator.
+ subcomponentAttribute.setGenerate(false);
+ }
library.getComponents().add(subcomponentModel);
}
}
Modified: root/cdk/trunk/plugins/generator/src/test/java/org/richfaces/cdk/apt/processors/AttributesProcessorTest.java
===================================================================
--- root/cdk/trunk/plugins/generator/src/test/java/org/richfaces/cdk/apt/processors/AttributesProcessorTest.java 2010-05-05 21:45:59 UTC (rev 16900)
+++ root/cdk/trunk/plugins/generator/src/test/java/org/richfaces/cdk/apt/processors/AttributesProcessorTest.java 2010-05-05 23:22:04 UTC (rev 16901)
@@ -88,7 +88,6 @@
expectLastCall();
BeanProperty beanProperty = createNiceMock(BeanProperty.class);
expect(utils.getBeanPropertiesAnnotatedWith(eq(Attribute.class), same(element))).andReturn(Collections.singleton(beanProperty));
- expect(utils.getAbstractBeanProperties(element)).andReturn(Collections.<BeanProperty>emptySet());
expect(beanProperty.getName()).andReturn(FOO);
expect(beanProperty.getType()).andReturn(ClassName.parseName(String.class.getName()));
mockController.replay();replay(element,beanProperty);
Modified: root/cdk/trunk/plugins/maven-cdk-plugin/src/it/annotated-component/src/main/resources/META-INF/cdk/attributes/html5.xml
===================================================================
--- root/cdk/trunk/plugins/maven-cdk-plugin/src/it/annotated-component/src/main/resources/META-INF/cdk/attributes/html5.xml 2010-05-05 21:45:59 UTC (rev 16900)
+++ root/cdk/trunk/plugins/maven-cdk-plugin/src/it/annotated-component/src/main/resources/META-INF/cdk/attributes/html5.xml 2010-05-05 23:22:04 UTC (rev 16901)
@@ -29,6 +29,7 @@
<property-class>java.lang.String</property-class>
<property-extension>
<cdk:pass-through>true</cdk:pass-through>
+ <cdk:generate>true</cdk:generate>
</property-extension>
</property>
@@ -42,6 +43,7 @@
<property-class>boolean</property-class>
<property-extension>
<cdk:pass-through>true</cdk:pass-through>
+ <cdk:generate>true</cdk:generate>
</property-extension>
</property>
@@ -58,6 +60,9 @@
<icon />
<property-name>autocomplete</property-name>
<property-class>java.lang.String</property-class>
+ <property-extension>
+ <cdk:generate>true</cdk:generate>
+ </property-extension>
</property>
</cdk:properties>
14 years, 9 months
JBoss Rich Faces SVN: r16900 - branches/community/3.3.X/framework/impl/src/main/java/org/ajax4jsf/component.
by richfaces-svn-commits@lists.jboss.org
Author: nbelaevski
Date: 2010-05-05 17:45:59 -0400 (Wed, 05 May 2010)
New Revision: 16900
Modified:
branches/community/3.3.X/framework/impl/src/main/java/org/ajax4jsf/component/UIDataAdaptorBase.java
Log:
https://jira.jboss.org/jira/browse/RFPL-568
https://jira.jboss.org/jira/browse/RF-7248
Modified: branches/community/3.3.X/framework/impl/src/main/java/org/ajax4jsf/component/UIDataAdaptorBase.java
===================================================================
--- branches/community/3.3.X/framework/impl/src/main/java/org/ajax4jsf/component/UIDataAdaptorBase.java 2010-05-05 21:26:35 UTC (rev 16899)
+++ branches/community/3.3.X/framework/impl/src/main/java/org/ajax4jsf/component/UIDataAdaptorBase.java 2010-05-05 21:45:59 UTC (rev 16900)
@@ -878,29 +878,39 @@
return currentChildState;
}
- private Map<String, Map<String, SavedState>> createChildStateCopy() {
- Map<String, Map<String, SavedState>> childStateCopy = null;
-
- if (this.childState != null) {
- childStateCopy = new HashMap<String, Map<String,SavedState>>();
-
- for (Entry<String, Map<String, SavedState>> entry : this.childState.entrySet()) {
+ private Map<String, Map<String, SavedState>> createChildStateCopy(
+ Map<String, Map<String, SavedState>> originalChildState) {
+ Map<String, Map<String, SavedState>> copiedChildState = null;
+
+ if (originalChildState != null) {
+ int originalMapSize = originalChildState.size();
+
+ // formula copied from HashMap implementation code
+ int copiedMapCapacity = Math.max(
+ (int) (originalMapSize / 0.75) + 1, 16);
+
+ copiedChildState = new HashMap<String, Map<String, SavedState>>(
+ copiedMapCapacity);
+
+ for (Entry<String, Map<String, SavedState>> entry : originalChildState
+ .entrySet()) {
String entryKey = entry.getKey();
Map<String, SavedState> entryValue = entry.getValue();
-
- Map<String, SavedState> entryValueCopy = null;
-
+
+ Map<String, SavedState> copiedEntryValue = null;
+
if (entryValue != null) {
- entryValueCopy = new HashMap<String, SavedState>(entryValue);
+ copiedEntryValue = new HashMap<String, SavedState>(
+ entryValue);
}
-
- childStateCopy.put(entryKey, entryValueCopy);
+
+ copiedChildState.put(entryKey, copiedEntryValue);
}
}
-
- return childStateCopy;
+
+ return copiedChildState;
}
-
+
/**
* Save values of {@link EditableValueHolder} fields before change current
* row.
@@ -1509,7 +1519,7 @@
private SerializableDataModel model;
}
-
+
public void restoreState(FacesContext faces, Object object) {
DataState state = (DataState) object;
super.restoreState(faces, state.superState);
@@ -1517,7 +1527,7 @@
this._statesMap = new HashMap<String, DataComponentState>();
this._rowKeyVar = state.rowKeyVar;
this._stateVar = state.stateVar;
- this.childState = state.childStates;
+ this.childState = createChildStateCopy(state.childStates);
if (null != state.rowKeyConverter) {
this._rowKeyConverter = (Converter) restoreAttachedState(faces,
state.rowKeyConverter);
@@ -1551,7 +1561,7 @@
state.ajaxKeys = this._ajaxKeys;
state.rowKeyVar = this._rowKeyVar;
state.stateVar = this._stateVar;
- state.childStates = createChildStateCopy();
+ state.childStates = this.childState;
if (null != this._rowKeyConverter) {
state.rowKeyConverter = saveAttachedState(faces,this._rowKeyConverter);
}
14 years, 9 months
JBoss Rich Faces SVN: r16899 - in branches/community/3.3.X/framework: api/src/main/java/org/ajax4jsf/javascript and 3 other directories.
by richfaces-svn-commits@lists.jboss.org
Author: nbelaevski
Date: 2010-05-05 17:26:35 -0400 (Wed, 05 May 2010)
New Revision: 16899
Removed:
branches/community/3.3.X/framework/api/src/test/java/org/ajax4jsf/framework/util/javascript/
Modified:
branches/community/3.3.X/framework/api/src/main/java/org/ajax4jsf/Messages.java
branches/community/3.3.X/framework/api/src/main/java/org/ajax4jsf/javascript/ScriptUtils.java
branches/community/3.3.X/framework/api/src/test/java/org/ajax4jsf/javascript/ScriptUtilsTest.java
branches/community/3.3.X/framework/impl/src/main/resources/org/ajax4jsf/messages.properties
Log:
https://jira.jboss.org/jira/browse/RFPL-570
https://jira.jboss.org/jira/browse/RFPL-540
https://jira.jboss.org/jira/browse/RF-4903
Modified: branches/community/3.3.X/framework/api/src/main/java/org/ajax4jsf/Messages.java
===================================================================
--- branches/community/3.3.X/framework/api/src/main/java/org/ajax4jsf/Messages.java 2010-05-05 19:47:22 UTC (rev 16898)
+++ branches/community/3.3.X/framework/api/src/main/java/org/ajax4jsf/Messages.java 2010-05-05 21:26:35 UTC (rev 16899)
@@ -365,7 +365,8 @@
public static final String DATASCROLLER_PAGE_MISSING = "DATASCROLLER_PAGE_MISSING";
public static final String DATASCROLLER_PAGES_DIFFERENT = "DATASCROLLER_PAGES_DIFFERENT";
public static final String COMPONENT_CONVERSION_ERROR = "COMPONENT_CONVERSION_ERROR";
-
+ public static final String JAVASCRIPT_CIRCULAR_REFERENCE = "JAVASCRIPT_CIRCULAR_REFERENCE";
+
public static void main(String[] args) {
String m = getMessage(INVALID_ATTRIBUTE_VALUE, "A", "B");
System.out.println(m);
Modified: branches/community/3.3.X/framework/api/src/main/java/org/ajax4jsf/javascript/ScriptUtils.java
===================================================================
--- branches/community/3.3.X/framework/api/src/main/java/org/ajax4jsf/javascript/ScriptUtils.java 2010-05-05 19:47:22 UTC (rev 16898)
+++ branches/community/3.3.X/framework/api/src/main/java/org/ajax4jsf/javascript/ScriptUtils.java 2010-05-05 21:26:35 UTC (rev 16899)
@@ -26,32 +26,55 @@
import java.io.UnsupportedEncodingException;
import java.io.Writer;
import java.lang.reflect.Array;
+import java.text.MessageFormat;
import java.util.Collection;
+import java.util.IdentityHashMap;
import java.util.Iterator;
import java.util.Map;
+import java.util.MissingResourceException;
import javax.faces.FacesException;
import javax.faces.context.ResponseWriter;
+import org.ajax4jsf.Messages;
import org.apache.commons.beanutils.PropertyUtils;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
/**
* @author shura (latest modification by $Author: alexsmirnov $)
* @version $Revision: 1.1.2.3 $ $Date: 2007/01/24 13:22:31 $
- *
+ *
*/
public class ScriptUtils {
- /**
+ private static final Log LOG = LogFactory.getLog(ScriptUtils.class);
+
+ /**
* This is utility class, don't instantiate.
*/
private ScriptUtils() {
}
- private static void writeScriptToStream(Writer writer, Object obj) throws IOException {
- if (null == obj) {
+ private static void writeScriptToStream(Writer writer, Object obj, Map<Object, Boolean> cycleBusterMap) throws IOException {
+ Boolean cycleBusterValue = cycleBusterMap.put(obj, Boolean.TRUE);
+
+ if (cycleBusterValue != null) {
+ if (LOG.isDebugEnabled()) {
+ String formattedMessage;
+ try {
+ formattedMessage = Messages.getMessage(Messages.JAVASCRIPT_CIRCULAR_REFERENCE, obj);
+ } catch (MissingResourceException e) {
+ //ignore exception: workaround for unit tests
+ formattedMessage = MessageFormat.format("Circular reference serializing object to JS: {0}", obj);
+ }
+
+ LOG.debug(formattedMessage);
+ }
writer.write("null");
+ } else if (null == obj) {
+ writer.write("null");
} else if (obj instanceof ScriptString) {
writer.write(((ScriptString) obj).toScript());
} else if (obj.getClass().isArray()) {
@@ -62,17 +85,17 @@
if (!first) {
writer.write(',');
}
- writeScriptToStream(writer, element);
+ writeScriptToStream(writer, element, cycleBusterMap);
first = false;
}
-
+
writer.write("] ");
- } else if (obj instanceof Collection) {
+ } else if (obj instanceof Collection<?>) {
// Collections put as JavaScript array.
-
+
@SuppressWarnings("unchecked")
Collection<Object> collection = (Collection<Object>) obj;
-
+
writer.write("[");
boolean first = true;
for (Iterator<Object> iter = collection.iterator(); iter.hasNext();) {
@@ -80,12 +103,12 @@
if (!first) {
writer.write(',');
}
- writeScriptToStream(writer, element);
+ writeScriptToStream(writer, element, cycleBusterMap);
first = false;
}
writer.write("] ");
- } else if (obj instanceof Map) {
-
+ } else if (obj instanceof Map<?, ?>) {
+
// Maps put as JavaScript hash.
@SuppressWarnings("unchecked")
Map<Object, Object> map = (Map<Object, Object>) obj;
@@ -96,10 +119,10 @@
if (!first) {
writer.write(',');
}
-
+
writeEncodedString(writer, entry.getKey());
writer.write(":");
- writeScriptToStream(writer, entry.getValue());
+ writeScriptToStream(writer, entry.getValue(), cycleBusterMap);
first = false;
}
writer.write("} ");
@@ -109,13 +132,13 @@
} else if (obj instanceof String) {
// all other put as encoded strings.
writeEncodedString(writer, obj);
- } else if (obj instanceof Enum) {
+ } else if (obj instanceof Enum<?>) {
// all other put as encoded strings.
writeEncodedString(writer, obj);
} else if (obj.getClass().getName().startsWith("java.sql.")) {
writer.write("{");
boolean first = true;
- for (PropertyDescriptor propertyDescriptor :
+ for (PropertyDescriptor propertyDescriptor :
PropertyUtils.getPropertyDescriptors(obj)) {
String key = propertyDescriptor.getName();
if ("class".equals(key)) {
@@ -131,11 +154,11 @@
if (!first) {
writer.write(',');
}
-
+
writeEncodedString(writer, key);
writer.write(":");
- writeScriptToStream(writer, value);
-
+ writeScriptToStream(writer, value, cycleBusterMap);
+
first = false;
}
writer.write("} ");
@@ -162,7 +185,7 @@
}
writeEncodedString(writer, key);
writer.write(":");
-
+
Object propertyValue;
try{
propertyValue = PropertyUtils.getProperty(obj, key);
@@ -170,27 +193,32 @@
throw new FacesException(
"Error in conversion Java Object to JavaScript", e);
}
-
- writeScriptToStream(writer, propertyValue);
+
+ writeScriptToStream(writer, propertyValue, cycleBusterMap);
first = false;
}
writer.write("} ");
}
+
+ if (cycleBusterValue == null) {
+ cycleBusterMap.remove(obj);
+ }
}
-
+
/**
- * Convert any Java Object to JavaScript representation ( as possible ) and write it to
+ * Convert any Java Object to JavaScript representation ( as possible ) and write it to
* writer immediately
- *
+ *
* @param responseWriter
* @param obj
* @throws IOException
*/
public static void writeToStream(final ResponseWriter responseWriter, Object obj) throws IOException {
- writeScriptToStream(new ResponseWriterWrapper(responseWriter), obj);
+ Map<Object, Boolean> cycleBusterMap = new IdentityHashMap<Object, Boolean>();
+ writeScriptToStream(new ResponseWriterWrapper(responseWriter), obj, cycleBusterMap);
}
-
+
/**
* Convert any Java Object to JavaScript representation ( as possible ).
* @param obj
@@ -199,7 +227,8 @@
public static String toScript(Object obj) {
StringBuilder sb = new StringBuilder();
try {
- writeScriptToStream(new StringBuilderWriter(sb), obj);
+ Map<Object, Boolean> cycleBusterMap = new IdentityHashMap<Object, Boolean>();
+ writeScriptToStream(new StringBuilderWriter(sb), obj, cycleBusterMap);
} catch (IOException e) {
//ignore
}
@@ -211,7 +240,7 @@
writeEncoded(w, obj);
w.write("'");
}
-
+
public static void addEncodedString(StringBuilder buff, Object obj) {
try {
writeEncodedString(new StringBuilderWriter(buff), obj);
@@ -232,7 +261,7 @@
}
}
}
-
+
public static void addEncoded(StringBuilder buff, Object obj) {
try {
writeEncoded(new StringBuilderWriter(buff), obj);
@@ -242,11 +271,11 @@
}
public static String getValidJavascriptName(String s) {
-
+
StringBuffer buf = null;
for (int i = 0, len = s.length(); i < len; i++) {
char c = s.charAt(i);
-
+
if (Character.isLetterOrDigit(c)||c=='_' ) {
// allowed char
if (buf != null)
@@ -256,13 +285,13 @@
buf = new StringBuffer(s.length() + 10);
buf.append(s.substring(0, i));
}
-
+
buf.append('_');
if (c < 16) {
// pad single hex digit values with '0' on the left
buf.append('0');
}
-
+
if (c < 128) {
// first 128 chars match their byte representation in UTF-8
buf.append(Integer.toHexString(c).toUpperCase());
@@ -273,7 +302,7 @@
} catch (UnsupportedEncodingException e) {
throw new RuntimeException(e);
}
-
+
for (int j = 0; j < bytes.length; j++) {
int intVal = bytes[j];
if (intVal < 0) {
@@ -287,9 +316,9 @@
}
}
}
-
+
}
-
+
return buf == null ? s : buf.toString();
}
}
Modified: branches/community/3.3.X/framework/api/src/test/java/org/ajax4jsf/javascript/ScriptUtilsTest.java
===================================================================
--- branches/community/3.3.X/framework/api/src/test/java/org/ajax4jsf/javascript/ScriptUtilsTest.java 2010-05-05 19:47:22 UTC (rev 16898)
+++ branches/community/3.3.X/framework/api/src/test/java/org/ajax4jsf/javascript/ScriptUtilsTest.java 2010-05-05 21:26:35 UTC (rev 16899)
@@ -22,14 +22,18 @@
package org.ajax4jsf.javascript;
import static org.easymock.EasyMock.capture;
+import static org.easymock.EasyMock.eq;
+import static org.easymock.EasyMock.expectLastCall;
import static org.easymock.EasyMock.isNull;
import static org.easymock.classextension.EasyMock.createNiceMock;
import static org.easymock.classextension.EasyMock.replay;
-import static org.easymock.classextension.EasyMock.*;
+import static org.easymock.classextension.EasyMock.verify;
import java.util.ArrayList;
import java.util.Arrays;
+import java.util.Collection;
import java.util.Collections;
+import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Set;
@@ -54,11 +58,11 @@
*
*/
public static class Bean {
-
+
int _integer;
boolean _bool;
Object _foo;
-
+
public Bean() {
}
/**
@@ -109,6 +113,56 @@
}
}
+ public static class ReferencedBean {
+
+ private String name;
+
+ private ReferenceHolderBean parent;
+
+ public ReferencedBean(String name, ReferenceHolderBean parent) {
+ super();
+ this.name = name;
+ this.parent = parent;
+ }
+
+ public ReferenceHolderBean getParent() {
+ return parent;
+ }
+
+ public String getName() {
+ return name;
+ }
+ }
+
+ public static class ReferenceHolderBean {
+
+ private String name;
+
+ private Object reference;
+
+ public ReferenceHolderBean(String name) {
+ super();
+ this.name = name;
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public Object getReference() {
+ return reference;
+ }
+
+ public void setReference(Object reference) {
+ this.reference = reference;
+ }
+
+ }
+
+ private static String dehydrate(String s) {
+ return s != null ? s.replaceAll("\\s", "") : s;
+ }
+
/**
* @param name
*/
@@ -139,7 +193,7 @@
java.sql.Date obj1 = new java.sql.Date(1);
assertNotNull(ScriptUtils.toScript(obj1));
}
-
+
/**
* Test method for {@link org.ajax4jsf.javascript.ScriptUtils#toScript(java.lang.Object)}.
*/
@@ -200,7 +254,7 @@
List<Bean> obj = Arrays.asList(array);
assertEquals("[{'bool':true,'foo':'foo',\'integer\':1} ,{'bool':false,'foo':'bar','integer':2} ] ", ScriptUtils.toScript(obj));
}
-
+
/**
* Test method for {@link org.ajax4jsf.javascript.ScriptUtils#toScript(java.lang.Object)}.
*/
@@ -235,30 +289,30 @@
public void testNull() throws Exception {
assertEquals("null", ScriptUtils.toScript(null));
}
-
+
/**
* Test method for {@link ScriptUtils#toScript(Object)}
*/
public void testScriptString() throws Exception {
assertEquals("alert(x<y);", ScriptUtils.toScript(new JSLiteral("alert(x<y);")));
}
-
+
private static enum TestEnum {
A, B, C;
-
+
@Override
public String toString() {
return "TestEnum: " + super.toString();
}
}
-
+
/**
* Test method for {@link ScriptUtils#toScript(Object)}
*/
public void testEnum() throws Exception {
assertEquals("'TestEnum: B'", ScriptUtils.toScript(TestEnum.B));
}
-
+
private void assertCaptureEquals(Capture<? extends Object> capture, String expected) {
StringBuilder sb = new StringBuilder();
List<? extends Object> list = capture.getValues();
@@ -266,10 +320,10 @@
assertNotNull(o);
sb.append(o);
}
-
+
assertEquals(expected, sb.toString().trim());
}
-
+
/**
* Test method for {@link ScriptUtils#writeToStream(javax.faces.context.ResponseWriter, Object)}
*/
@@ -277,7 +331,7 @@
ResponseWriter mockWriter = createNiceMock(ResponseWriter.class);
Capture<? extends Object> capture = new Capture<Object>(CaptureType.ALL) {
/**
- *
+ *
*/
private static final long serialVersionUID = -4915440411892856583L;
@@ -291,17 +345,70 @@
}
}
};
-
-
+
+
mockWriter.writeText(capture(capture), (String) isNull());
expectLastCall().anyTimes();
mockWriter.writeText((char[])capture(capture), eq(0), eq(1));
expectLastCall().anyTimes();
-
+
replay(mockWriter);
ScriptUtils.writeToStream(mockWriter, Collections.singletonMap("delay", Integer.valueOf(1500)));
verify(mockWriter);
-
+
assertCaptureEquals(capture, "{'delay':1500}");
}
+
+ public void testCircularReferenceBeans() throws Exception {
+ ReferenceHolderBean parent = new ReferenceHolderBean("parent");
+ ReferencedBean child = new ReferencedBean("child", parent);
+
+ assertEquals(dehydrate("{'name': 'child', 'parent': {'name': 'parent', 'reference': null}}"),
+ dehydrate(ScriptUtils.toScript(child)));
+ }
+
+ public void testCircularReferenceViaProperty() throws Exception {
+ ReferenceHolderBean parent = new ReferenceHolderBean("parent");
+ ReferencedBean child = new ReferencedBean("child", parent);
+
+ parent.setReference(child);
+
+ assertEquals(dehydrate("{'name': 'parent', 'reference': {'name': 'child', 'parent': null}}"),
+ dehydrate(ScriptUtils.toScript(parent)));
+ }
+
+ public void testCircularReferenceViaArray() throws Exception {
+ ReferenceHolderBean parent = new ReferenceHolderBean("parent");
+ ReferencedBean child = new ReferencedBean("child", parent);
+
+ parent.setReference(new Object[] {child});
+
+ assertEquals(dehydrate("{'name': 'parent', 'reference': [{'name': 'child', 'parent': null}]}"),
+ dehydrate(ScriptUtils.toScript(parent)));
+ }
+
+ public void testCircularReferenceViaCollection() throws Exception {
+ ReferenceHolderBean parent = new ReferenceHolderBean("parent");
+ ReferencedBean child = new ReferencedBean("child", parent);
+
+ Collection<Object> set = new ArrayList<Object>();
+ set.add(child);
+ parent.setReference(set);
+
+ assertEquals(dehydrate("{'name': 'parent', 'reference': [{'name': 'child', 'parent': null}]}"),
+ dehydrate(ScriptUtils.toScript(parent)));
+ }
+
+ public void testCircularReferenceViaMap() throws Exception {
+ ReferenceHolderBean parent = new ReferenceHolderBean("parent");
+ ReferencedBean child = new ReferencedBean("child", parent);
+
+ Map<String, Object> map = new HashMap<String, Object>();
+ map.put("key", child);
+ parent.setReference(map);
+
+ assertEquals(dehydrate("{'name': 'parent', 'reference': {'key': {'name': 'child', 'parent': null}}}"),
+ dehydrate(ScriptUtils.toScript(parent)));
+ }
+
}
Modified: branches/community/3.3.X/framework/impl/src/main/resources/org/ajax4jsf/messages.properties
===================================================================
--- branches/community/3.3.X/framework/impl/src/main/resources/org/ajax4jsf/messages.properties 2010-05-05 19:47:22 UTC (rev 16898)
+++ branches/community/3.3.X/framework/impl/src/main/resources/org/ajax4jsf/messages.properties 2010-05-05 21:26:35 UTC (rev 16899)
@@ -259,4 +259,5 @@
INVALID_VALUE="Component {0} has invalid value expression {1}"
DATASCROLLER_PAGE_MISSING=Datascroller {0}: The requested page #{1} isn''t found in the model containing {2} pages. Paging is reset to page #{3}
DATASCROLLER_PAGES_DIFFERENT=Datascroller components attached to component\: {0} have different values of ''page'' attribute \: {1}
-COMPONENT_CONVERSION_ERROR=Component {0}\: conversion error occurred for value {1}
\ No newline at end of file
+COMPONENT_CONVERSION_ERROR=Component {0}\: conversion error occurred for value {1}
+JAVASCRIPT_CIRCULAR_REFERENCE=Circular reference occurred during serialization of {0} object to JavaScript. Such references are not currently supported and will be nullified.
\ No newline at end of file
14 years, 9 months
JBoss Rich Faces SVN: r16898 - in root/cdk/trunk/plugins/generator/src: main/java/org/richfaces/cdk/model and 5 other directories.
by richfaces-svn-commits@lists.jboss.org
Author: alexsmirnov
Date: 2010-05-05 15:47:22 -0400 (Wed, 05 May 2010)
New Revision: 16898
Modified:
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/apt/processors/AttributesProcessorImpl.java
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/model/BeanModelBase.java
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/model/RendererModel.java
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/templatecompiler/RendererTemplateParser.java
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/xmlconfig/model/RendererBean.java
root/cdk/trunk/plugins/generator/src/test/java/org/richfaces/cdk/apt/processors/AttributesProcessorTest.java
root/cdk/trunk/plugins/generator/src/test/java/org/richfaces/cdk/xmlconfig/testmodel/BehaviorBeanTest.java
root/cdk/trunk/plugins/generator/src/test/resources/org/richfaces/cdk/generate/java/GeneratedBehavior.java
root/cdk/trunk/plugins/generator/src/test/resources/org/richfaces/cdk/generate/java/GeneratedComponent.java
root/cdk/trunk/plugins/generator/src/test/resources/org/richfaces/cdk/generate/java/GeneratedConverter.java
root/cdk/trunk/plugins/generator/src/test/resources/org/richfaces/cdk/generate/java/GeneratedValidator.java
Log:
Fix unit tests and renderer attributes marshaling.
Modified: root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/apt/processors/AttributesProcessorImpl.java
===================================================================
--- root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/apt/processors/AttributesProcessorImpl.java 2010-05-05 15:40:30 UTC (rev 16897)
+++ root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/apt/processors/AttributesProcessorImpl.java 2010-05-05 19:47:22 UTC (rev 16898)
@@ -254,7 +254,7 @@
public void visit(TypeMirror type) {
try {
log.debug(" -> visit - " + type.toString());
- component.addAttributes(
+ component.getAttributes().addAll(
parseProperties(CdkEntityResolver.URN_ATTRIBUTES + type.toString() + ".xml"));
} catch (CdkException e) {
// TODO - log errors ?
@@ -288,7 +288,7 @@
// Process all files from @Jsf.. attributes property.
for (String attributes : attributesConfig) {
try {
- component.addAttributes(parseProperties(CdkEntityResolver.URN_ATTRIBUTES + attributes));
+ component.getAttributes().addAll(parseProperties(CdkEntityResolver.URN_ATTRIBUTES + attributes));
} catch (CdkException e) {
// TODO - log errors ?
}
Modified: root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/model/BeanModelBase.java
===================================================================
--- root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/model/BeanModelBase.java 2010-05-05 15:40:30 UTC (rev 16897)
+++ root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/model/BeanModelBase.java 2010-05-05 19:47:22 UTC (rev 16898)
@@ -33,7 +33,7 @@
*/
public class BeanModelBase extends DescriptionGroupBase {
- private final ModelMap<String, PropertyBase> attributes = ModelMap.<String, PropertyBase>create();
+ private final ModelCollection<PropertyBase> attributes = ModelCollection.<PropertyBase>create();
/**
* <p class="changed_added_4_0">
@@ -43,44 +43,30 @@
* @return the attributes
*/
public Collection<PropertyBase> getAttributes() {
- return attributes.values();
+ return attributes;
}
- public void addAttribute(PropertyBase attribute) {
- if (attributes != null) {
- this.attributes.put(attribute.getName(), attribute);
- }
- }
-
- public void addAttributes(Iterable<? extends PropertyBase> attributes) {
- if (attributes != null) {
- for (PropertyBase attribute : attributes) {
- addAttribute(attribute);
- }
- }
- }
-
- public int getAttributesCount() {
- return this.attributes.size();
- }
-
/**
* <p class="changed_added_4_0">Return bean attribute for given name.</p>
* @param name
* @return
*/
public PropertyBase getAttribute(final String name) {
- return attributes.get(name);
+ return attributes.find(new Named.NamedPredicate(name));
}
public PropertyBase getOrCreateAttribute(String attributeName) {
PropertyBase attribute = getAttribute(attributeName);
if (null == attribute) {
- attribute = new PropertyModel();
+ attribute = createAttribute();
attribute.setName(attributeName);
- attributes.put(attributeName, attribute);
+ attributes.add(attribute);
}
return attribute;
}
+
+ protected PropertyBase createAttribute() {
+ return new PropertyModel();
+ }
}
Modified: root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/model/RendererModel.java
===================================================================
--- root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/model/RendererModel.java 2010-05-05 15:40:30 UTC (rev 16897)
+++ root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/model/RendererModel.java 2010-05-05 19:47:22 UTC (rev 16898)
@@ -175,6 +175,11 @@
public void setComponentType(String componentType) {
this.componentType = componentType;
}
+
+ @Override
+ protected PropertyBase createAttribute() {
+ return new AttributeModel();
+ }
/**
* <p class="changed_added_4_0">FacesId for lookup renderer in the model.</p>
Modified: root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/templatecompiler/RendererTemplateParser.java
===================================================================
--- root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/templatecompiler/RendererTemplateParser.java 2010-05-05 15:40:30 UTC (rev 16897)
+++ root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/templatecompiler/RendererTemplateParser.java 2010-05-05 19:47:22 UTC (rev 16898)
@@ -211,7 +211,7 @@
String importURI = attributesImport.getSource();
Collection<PropertyBase> properties = fragmentParser.parseProperties(importURI);
if (properties != null) {
- renderer.addAttributes(properties);
+ renderer.getAttributes().addAll(properties);
}
}
}
@@ -219,7 +219,7 @@
List<Attribute> templateAttributes = compositeInterface.getAttributes();
if (templateAttributes != null) {
for (Attribute templateAttribute : templateAttributes) {
- renderer.addAttribute(buildProperty(templateAttribute));
+ renderer.getAttributes().add(buildProperty(templateAttribute));
}
}
}
Modified: root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/xmlconfig/model/RendererBean.java
===================================================================
--- root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/xmlconfig/model/RendererBean.java 2010-05-05 15:40:30 UTC (rev 16897)
+++ root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/xmlconfig/model/RendererBean.java 2010-05-05 19:47:22 UTC (rev 16898)
@@ -23,18 +23,19 @@
package org.richfaces.cdk.xmlconfig.model;
-import com.google.common.collect.Lists;
+import java.util.Collection;
+
+import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlType;
+import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter;
+
import org.richfaces.cdk.model.AttributeModel;
import org.richfaces.cdk.model.ClassName;
import org.richfaces.cdk.model.ComponentLibrary;
import org.richfaces.cdk.model.ConfigExtension;
+import org.richfaces.cdk.model.PropertyBase;
import org.richfaces.cdk.model.TagModel;
-import javax.xml.bind.annotation.XmlElement;
-import javax.xml.bind.annotation.XmlType;
-import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter;
-import java.util.List;
-
/**
* <p class="changed_added_4_0">
* </p>
@@ -42,11 +43,10 @@
* @author asmirnov(a)exadel.com
*/
@XmlType(name = "faces-config-rendererType", namespace = ComponentLibrary.FACES_CONFIG_NAMESPACE,
- propOrder = {"family", "type", "rendererClass",/*"facet",*/"attributes", "extension"})
+ propOrder = {"family", "type", "rendererClass",/*"facet",*/"facesAttributes", "extension"})
public class RendererBean extends
- ExtensibleBean<RendererBean.RendererExtension> {
+ ElementBeanBase<RendererBean.RendererExtension> {
- private List<AttributeModel> attributes = Lists.newArrayList();
private String family;
private ClassName rendererClass;
private String type;
@@ -122,19 +122,11 @@
* @return the attributes
*/
@XmlElement(name = "attribute", namespace = ComponentLibrary.FACES_CONFIG_NAMESPACE, type = AttributeBean.class)
- public List<AttributeModel> getAttributes() {
- return this.attributes;
+ @XmlJavaTypeAdapter(AttributeAdapter.class)
+ public Collection<AttributeModel> getFacesAttributes() {
+ return super.getFacesAttributes();
}
- /**
- * <p class="changed_added_4_0">
- * </p>
- *
- * @param attributes the attributes to set
- */
- public void setAttributes(List<AttributeModel> attributes) {
- this.attributes = attributes;
- }
/**
* <p class="changed_added_4_0">
Modified: root/cdk/trunk/plugins/generator/src/test/java/org/richfaces/cdk/apt/processors/AttributesProcessorTest.java
===================================================================
--- root/cdk/trunk/plugins/generator/src/test/java/org/richfaces/cdk/apt/processors/AttributesProcessorTest.java 2010-05-05 15:40:30 UTC (rev 16897)
+++ root/cdk/trunk/plugins/generator/src/test/java/org/richfaces/cdk/apt/processors/AttributesProcessorTest.java 2010-05-05 19:47:22 UTC (rev 16898)
@@ -94,7 +94,7 @@
mockController.replay();replay(element,beanProperty);
processor.processType(bean, element);
mockController.verify();verify(element,beanProperty);
- assertEquals(1, bean.getAttributesCount());
+ assertEquals(1, bean.getAttributes().size());
}
/**
@@ -111,7 +111,7 @@
mockController.replay();
processor.processXmlFragment(bean, FOO_XML);
mockController.verify();
- assertEquals(1, bean.getAttributesCount());
+ assertEquals(1, bean.getAttributes().size());
}
@Override
Modified: root/cdk/trunk/plugins/generator/src/test/java/org/richfaces/cdk/xmlconfig/testmodel/BehaviorBeanTest.java
===================================================================
--- root/cdk/trunk/plugins/generator/src/test/java/org/richfaces/cdk/xmlconfig/testmodel/BehaviorBeanTest.java 2010-05-05 15:40:30 UTC (rev 16897)
+++ root/cdk/trunk/plugins/generator/src/test/java/org/richfaces/cdk/xmlconfig/testmodel/BehaviorBeanTest.java 2010-05-05 19:47:22 UTC (rev 16898)
@@ -51,7 +51,7 @@
AttributeModel attributeModel = new AttributeModel();
attributeModel.setName("attr2");
attributeModel.setType(new ClassName(String.class));
- behaviorModel.addAttribute(attributeModel);
+ behaviorModel.getAttributes().add(attributeModel);
library.getBehaviors().add(behaviorModel);
Modified: root/cdk/trunk/plugins/generator/src/test/resources/org/richfaces/cdk/generate/java/GeneratedBehavior.java
===================================================================
--- root/cdk/trunk/plugins/generator/src/test/resources/org/richfaces/cdk/generate/java/GeneratedBehavior.java 2010-05-05 15:40:30 UTC (rev 16897)
+++ root/cdk/trunk/plugins/generator/src/test/resources/org/richfaces/cdk/generate/java/GeneratedBehavior.java 2010-05-05 19:47:22 UTC (rev 16898)
@@ -29,7 +29,7 @@
import javax.faces.el.ValueBinding;
/**
- *
+ *
**/
@Generated({"RichFaces CDK", "4.0.0-SNAPSHOT"})
public class GeneratedBehavior extends Object implements Behavior, PartialStateHolder {
@@ -38,14 +38,30 @@
public void broadcast(BehaviorEvent event) {
}
+
+ private Object testValue;
+
private Boolean testFlag;
+
+
+ public void setTestValue(Object testValue) {
+ this.testValue = testValue;
+ }
- private Object testValue;
+ public Object getTestValue() {
+ if (testValue != null) {
+ return testValue;
+ }
+ ValueBinding vb = getValueBinding("testValue");
+ if (null != vb) {
+ return (Object) vb.getValue(getFacesContext());
+ }
-
+ return testValue;
+ }
public void setTestFlag(Boolean testFlag) {
this.testFlag = testFlag;
}
@@ -62,22 +78,6 @@
return testFlag;
}
- public void setTestValue(Object testValue) {
- this.testValue = testValue;
- }
-
- public Object getTestValue() {
- if (testValue != null) {
- return testValue;
- }
-
- ValueBinding vb = getValueBinding("testValue");
- if (null != vb) {
- return (Object) vb.getValue(getFacesContext());
- }
-
- return testValue;
- }
private static FacesContext getFacesContext() {
return FacesContext.getCurrentInstance();
}
@@ -94,8 +94,8 @@
}
if (!initialStateMarked()) {
Object values[] = new Object[1];
- values[0] = this.isTestFlag();
- values[1] = this.getTestValue();
+ values[0] = this.getTestValue();
+ values[1] = this.isTestFlag();
return values;
}
@@ -112,8 +112,8 @@
}
Object values[] = (Object[]) state;
- setTestFlag((Boolean) values[0]);
- setTestValue((Object) values[1]);
+ setTestValue((Object) values[0]);
+ setTestFlag((Boolean) values[1]);
}
private boolean transientValue = false;
Modified: root/cdk/trunk/plugins/generator/src/test/resources/org/richfaces/cdk/generate/java/GeneratedComponent.java
===================================================================
--- root/cdk/trunk/plugins/generator/src/test/resources/org/richfaces/cdk/generate/java/GeneratedComponent.java 2010-05-05 15:40:30 UTC (rev 16897)
+++ root/cdk/trunk/plugins/generator/src/test/resources/org/richfaces/cdk/generate/java/GeneratedComponent.java 2010-05-05 19:47:22 UTC (rev 16898)
@@ -41,7 +41,7 @@
import javax.faces.el.MethodBinding;
/**
- *
+ *
**/
@Generated({"RichFaces CDK", "4.0.0-SNAPSHOT"})
public class GeneratedComponent extends UIOutput
@@ -61,7 +61,7 @@
"action"
));
-
+
public Collection<String> getEventNames() {
return EVENT_NAMES;
}
@@ -72,45 +72,37 @@
}
protected static enum Properties {
- list,
- listInteger,
- listStrings,
+ testValue,
+ testFlag,
testBinding,
testExpr,
- testFlag,
- testValue
+ listStrings,
+ listInteger,
+ list
}
- public ArrayList getList() {
- return (ArrayList) getStateHelper().eval(Properties.list);
+ public Object getTestValue() {
+ return getStateHelper().get(Properties.testValue);
}
-
- public void setList(ArrayList list) {
- getStateHelper().put(Properties.list, list);
+
+ public void setTestValue(Object testValue) {
+ getStateHelper().put(Properties.testValue, testValue);
}
- public ArrayList getListInteger() {
- return (ArrayList) getStateHelper().eval(Properties.listInteger);
+ public Boolean isTestFlag() {
+ return Boolean.valueOf(getStateHelper().eval(Properties.testFlag).toString());
}
-
- public void setListInteger(ArrayList listInteger) {
- getStateHelper().put(Properties.listInteger, listInteger);
+
+ public void setTestFlag(Boolean testFlag) {
+ getStateHelper().put(Properties.testFlag, testFlag);
}
- public ArrayList getListStrings() {
- return (ArrayList) getStateHelper().eval(Properties.listStrings);
- }
-
- public void setListStrings(ArrayList listStrings) {
- getStateHelper().put(Properties.listStrings, listStrings);
- }
-
public MethodBinding getTestBinding() {
return (MethodBinding) getStateHelper().get(Properties.testBinding);
}
-
+
public void setTestBinding(MethodBinding testBinding) {
getStateHelper().put(Properties.testBinding, testBinding);
}
@@ -118,24 +110,32 @@
public MethodExpression getTestExpr() {
return (MethodExpression) getStateHelper().get(Properties.testExpr);
}
-
+
public void setTestExpr(MethodExpression testExpr) {
getStateHelper().put(Properties.testExpr, testExpr);
}
- public Boolean isTestFlag() {
- return Boolean.valueOf(getStateHelper().eval(Properties.testFlag).toString());
+ public ArrayList getListStrings() {
+ return (ArrayList) getStateHelper().eval(Properties.listStrings);
}
-
- public void setTestFlag(Boolean testFlag) {
- getStateHelper().put(Properties.testFlag, testFlag);
+
+ public void setListStrings(ArrayList listStrings) {
+ getStateHelper().put(Properties.listStrings, listStrings);
}
- public Object getTestValue() {
- return getStateHelper().get(Properties.testValue);
+ public ArrayList getListInteger() {
+ return (ArrayList) getStateHelper().eval(Properties.listInteger);
}
+
+ public void setListInteger(ArrayList listInteger) {
+ getStateHelper().put(Properties.listInteger, listInteger);
+ }
- public void setTestValue(Object testValue) {
- getStateHelper().put(Properties.testValue, testValue);
+ public ArrayList getList() {
+ return (ArrayList) getStateHelper().eval(Properties.list);
}
+
+ public void setList(ArrayList list) {
+ getStateHelper().put(Properties.list, list);
+ }
}
\ No newline at end of file
Modified: root/cdk/trunk/plugins/generator/src/test/resources/org/richfaces/cdk/generate/java/GeneratedConverter.java
===================================================================
--- root/cdk/trunk/plugins/generator/src/test/resources/org/richfaces/cdk/generate/java/GeneratedConverter.java 2010-05-05 15:40:30 UTC (rev 16897)
+++ root/cdk/trunk/plugins/generator/src/test/resources/org/richfaces/cdk/generate/java/GeneratedConverter.java 2010-05-05 19:47:22 UTC (rev 16898)
@@ -31,7 +31,7 @@
import org.richfaces.cdk.generate.freemarker.PropertyModel;
/**
- *
+ *
**/
@Generated({"RichFaces CDK", "4.0.0-SNAPSHOT"})
public class GeneratedConverter extends Object implements Converter, PartialStateHolder {
@@ -48,9 +48,9 @@
protected enum Properties {
myClass,
+ testObject,
testBoolean,
testInteger,
- testObject,
visible
}
@@ -58,15 +58,23 @@
public PropertyModel getMyClass() {
return (PropertyModel) getStateHelper().eval(Properties.myClass);
}
-
+
public void setMyClass(PropertyModel myClass) {
getStateHelper().put(Properties.myClass, myClass);
}
+ public Object getTestObject() {
+ return getStateHelper().get(Properties.testObject);
+ }
+
+ public void setTestObject(Object testObject) {
+ getStateHelper().put(Properties.testObject, testObject);
+ }
+
public Boolean isTestBoolean() {
return Boolean.valueOf(getStateHelper().eval(Properties.testBoolean).toString());
}
-
+
public void setTestBoolean(Boolean testBoolean) {
getStateHelper().put(Properties.testBoolean, testBoolean);
}
@@ -74,29 +82,21 @@
public Integer getTestInteger() {
return (Integer) getStateHelper().eval(Properties.testInteger);
}
-
+
public void setTestInteger(Integer testInteger) {
getStateHelper().put(Properties.testInteger, testInteger);
}
- public Object getTestObject() {
- return getStateHelper().get(Properties.testObject);
- }
-
- public void setTestObject(Object testObject) {
- getStateHelper().put(Properties.testObject, testObject);
- }
-
public boolean isVisible() {
return Boolean.valueOf(getStateHelper().eval(Properties.visible).toString());
}
-
+
public void setVisible(boolean visible) {
getStateHelper().put(Properties.visible, visible);
}
private StateHelper stateHelper = null;
-
+
protected StateHelper getStateHelper() {
if (stateHelper == null) {
stateHelper = new PartialStateHolderHelper(this);
Modified: root/cdk/trunk/plugins/generator/src/test/resources/org/richfaces/cdk/generate/java/GeneratedValidator.java
===================================================================
--- root/cdk/trunk/plugins/generator/src/test/resources/org/richfaces/cdk/generate/java/GeneratedValidator.java 2010-05-05 15:40:30 UTC (rev 16897)
+++ root/cdk/trunk/plugins/generator/src/test/resources/org/richfaces/cdk/generate/java/GeneratedValidator.java 2010-05-05 19:47:22 UTC (rev 16898)
@@ -30,24 +30,40 @@
import javax.faces.el.ValueBinding;
/**
- *
+ *
**/
@Generated({"RichFaces CDK", "4.0.0-SNAPSHOT"})
public class GeneratedValidator extends Object implements Validator, PartialStateHolder {
@Override
public void validate(FacesContext context, UIComponent component, Object value) throws ValidatorException {
-
+
}
+
+ private Object testValue;
+
private Boolean testFlag;
+
+
+ public void setTestValue(Object testValue) {
+ this.testValue = testValue;
+ }
- private Object testValue;
+ public Object getTestValue() {
+ if (testValue != null) {
+ return testValue;
+ }
+ ValueBinding vb = getValueBinding("testValue");
+ if (null != vb) {
+ return (Object) vb.getValue(getFacesContext());
+ }
-
+ return testValue;
+ }
public void setTestFlag(Boolean testFlag) {
this.testFlag = testFlag;
}
@@ -64,22 +80,6 @@
return testFlag;
}
- public void setTestValue(Object testValue) {
- this.testValue = testValue;
- }
-
- public Object getTestValue() {
- if (testValue != null) {
- return testValue;
- }
-
- ValueBinding vb = getValueBinding("testValue");
- if (null != vb) {
- return (Object) vb.getValue(getFacesContext());
- }
-
- return testValue;
- }
private static FacesContext getFacesContext() {
return FacesContext.getCurrentInstance();
}
@@ -96,8 +96,8 @@
}
if (!initialStateMarked()) {
Object values[] = new Object[1];
- values[0] = this.isTestFlag();
- values[1] = this.getTestValue();
+ values[0] = this.getTestValue();
+ values[1] = this.isTestFlag();
return values;
}
@@ -114,8 +114,8 @@
}
Object values[] = (Object[]) state;
- setTestFlag((Boolean) values[0]);
- setTestValue((Object) values[1]);
+ setTestValue((Object) values[0]);
+ setTestFlag((Boolean) values[1]);
}
private boolean transientValue = false;
14 years, 9 months
JBoss Rich Faces SVN: r16897 - root/framework/trunk/impl/src/main/resources/META-INF/resources.
by richfaces-svn-commits@lists.jboss.org
Author: pyaschenko
Date: 2010-05-05 11:40:30 -0400 (Wed, 05 May 2010)
New Revision: 16897
Modified:
root/framework/trunk/impl/src/main/resources/META-INF/resources/richfaces.js
Log:
queue options changes
Modified: root/framework/trunk/impl/src/main/resources/META-INF/resources/richfaces.js
===================================================================
--- root/framework/trunk/impl/src/main/resources/META-INF/resources/richfaces.js 2010-05-05 15:07:26 UTC (rev 16896)
+++ root/framework/trunk/impl/src/main/resources/META-INF/resources/richfaces.js 2010-05-05 15:40:30 UTC (rev 16897)
@@ -480,12 +480,18 @@
}
}());
- richfaces.ajax = function(source, event, parameters, queueId) {
+ richfaces.ajax = function(source, event, options) {
+ var sourceId = (typeof source == 'object' && source.id) ? source.id : source;
- var sourceId = (typeof source == 'object' && source.id) ? source.id : source;
- var options = (richfaces.queue) ? richfaces.queue.getQueueOptions(queueId || sourceId) : {};
+ options = options || {};
+ if (richfaces.queue) {
+ var queueOptions = richfaces.queue.getQueueOptions(options.queueId || sourceId);
+ var saveQueueId = queueOptions.queueId;
+ options = jQuery.extend({}, queueOptions, options);
+ options.queueId = saveQueueId;
+ }
- //parameters = options.parameters || {}; // TODO: change "parameters" to "richfaces.ajax.params"
+ parameters = options.parameters || {}; // TODO: change "parameters" to "richfaces.ajax.params"
parameters.execute = "@component";
parameters.render = "@component";
14 years, 9 months