JBoss Rich Faces SVN: r13321 - trunk/ui/modal-panel/src/main/resources/org/richfaces/renderkit/html/scripts.
by richfaces-svn-commits@lists.jboss.org
Author: nbelaevski
Date: 2009-03-31 13:26:13 -0400 (Tue, 31 Mar 2009)
New Revision: 13321
Modified:
trunk/ui/modal-panel/src/main/resources/org/richfaces/renderkit/html/scripts/modalPanel.js
Log:
https://jira.jboss.org/jira/browse/RF-6027
Modified: trunk/ui/modal-panel/src/main/resources/org/richfaces/renderkit/html/scripts/modalPanel.js
===================================================================
--- trunk/ui/modal-panel/src/main/resources/org/richfaces/renderkit/html/scripts/modalPanel.js 2009-03-31 16:12:10 UTC (rev 13320)
+++ trunk/ui/modal-panel/src/main/resources/org/richfaces/renderkit/html/scripts/modalPanel.js 2009-03-31 17:26:13 UTC (rev 13321)
@@ -203,9 +203,9 @@
destroy: function() {
- if( this.shown && this.options.autosized && this.observerSize)
- {
- window.clearInterval(this.observerSize);
+ if (this.observerSize) {
+ window.clearInterval(this.observerSize);
+ this.observerSize = null;
}
this._contentElement = null;
@@ -650,7 +650,7 @@
element.style.visibility = "hidden";
Element.show(element);
- this.correctShadowSizeEx();
+ this.correctShadowSize();
if (options.left) {
var _left;
@@ -797,7 +797,7 @@
this.shown = false;
- if (this.options.autosized) {
+ if (this.observerSize) {
window.clearInterval(this.observerSize);
this.observerSize = null;
}
@@ -904,7 +904,7 @@
Element.setStyle(eCdiv, cssHash);
- this.correctShadowSizeEx();
+ this.correctShadowSize();
Object.extend(this.userOptions, cssHash);
Object.extend(this.userOptions, cssHashWH);
@@ -979,12 +979,7 @@
}
},
- correctShadowSize: function(event) {
- this.correctShadowSizeEx();
- this.observerSize = null;
- },
-
- correctShadowSizeEx: function() {
+ correctShadowSize: function() {
var eShadowDiv = $(this.shadowDiv);
if (!eShadowDiv) {
return;
15 years, 8 months
JBoss Rich Faces SVN: r13320 - in trunk/ui/datascroller/src/main: java/org/richfaces/component and 1 other directory.
by richfaces-svn-commits@lists.jboss.org
Author: nbelaevski
Date: 2009-03-31 12:12:10 -0400 (Tue, 31 Mar 2009)
New Revision: 13320
Modified:
trunk/ui/datascroller/src/main/config/component/datascroller.xml
trunk/ui/datascroller/src/main/java/org/richfaces/component/UIDatascroller.java
Log:
https://jira.jboss.org/jira/browse/RF-6637
Modified: trunk/ui/datascroller/src/main/config/component/datascroller.xml
===================================================================
--- trunk/ui/datascroller/src/main/config/component/datascroller.xml 2009-03-31 16:04:25 UTC (rev 13319)
+++ trunk/ui/datascroller/src/main/config/component/datascroller.xml 2009-03-31 16:12:10 UTC (rev 13320)
@@ -322,9 +322,8 @@
</property>
<property>
- <name>showShortLastPage</name>
- <classname>boolean</classname>
- <defaultvalue>true</defaultvalue>
+ <name>lastPageMode</name>
+ <classname>java.lang.String</classname>
</property>
<property hidden="true" existintag="false" exist="false" >
Modified: trunk/ui/datascroller/src/main/java/org/richfaces/component/UIDatascroller.java
===================================================================
--- trunk/ui/datascroller/src/main/java/org/richfaces/component/UIDatascroller.java 2009-03-31 16:04:25 UTC (rev 13319)
+++ trunk/ui/datascroller/src/main/java/org/richfaces/component/UIDatascroller.java 2009-03-31 16:12:10 UTC (rev 13320)
@@ -56,6 +56,10 @@
public abstract class UIDatascroller extends AjaxActionComponent
implements DataScrollerSource, ActionSource {
+ public static final String LAST_PAGE_MODE_FULL = "full";
+
+ public static final String LAST_PAGE_MODE_SHORT = "short";
+
private static final Log log = LogFactory.getLog(UIDatascroller.class);
private Integer page;
@@ -207,8 +211,8 @@
public abstract void setInactiveStyle(String inactiveStyle);
- public abstract boolean isShowShortLastPage();
- public abstract void setShowShortLastPage(boolean showShortLastPage);
+ public abstract String getLastPageMode();
+ public abstract void setLastPageMode(String lastPageMode);
/**
* Finds the dataTable which id is mapped to the "for" property
@@ -472,8 +476,17 @@
if (isRendered(dataTable)) {
int first;
-
- if (page != pageCount || isShowShortLastPage()) {
+
+ String lastPageMode = getLastPageMode();
+ if (lastPageMode == null) {
+ lastPageMode = LAST_PAGE_MODE_SHORT;
+ } else if (!LAST_PAGE_MODE_SHORT.equals(lastPageMode) &&
+ !LAST_PAGE_MODE_FULL.equals(lastPageMode)) {
+
+ throw new IllegalArgumentException("Illegal value of 'lastPageMode' attribute: '" + lastPageMode + "'");
+ }
+
+ if (page != pageCount || LAST_PAGE_MODE_SHORT.equals(lastPageMode)) {
first = (page - 1) * rows;
} else {
first = rowCount - rows;
15 years, 8 months
JBoss Rich Faces SVN: r13319 - trunk/docs/userguide/en/src/main/docbook/included.
by richfaces-svn-commits@lists.jboss.org
Author: artdaw
Date: 2009-03-31 12:04:25 -0400 (Tue, 31 Mar 2009)
New Revision: 13319
Added:
trunk/docs/userguide/en/src/main/docbook/included/colorPicker.desc.xml
trunk/docs/userguide/en/src/main/docbook/included/colorPicker.xml
Log:
https://jira.jboss.org/jira/browse/RF-6581 - Description, Details of Usage sections are done
Added: trunk/docs/userguide/en/src/main/docbook/included/colorPicker.desc.xml
===================================================================
--- trunk/docs/userguide/en/src/main/docbook/included/colorPicker.desc.xml (rev 0)
+++ trunk/docs/userguide/en/src/main/docbook/included/colorPicker.desc.xml 2009-03-31 16:04:25 UTC (rev 13319)
@@ -0,0 +1,48 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<section>
+ <sectioninfo>
+ <keywordset>
+ <keyword>rich:colorPicker</keyword>
+ <keyword>colorPicker</keyword>
+ </keywordset>
+ </sectioninfo>
+ <section>
+ <title>Description</title>
+ <para>
+ The
+ <emphasis role="bold">
+ <property><rich:colorPicker></property>
+ </emphasis>
+ component
+ lets you visually choose a color or define it in hex, RGB, or HSB input fields.
+ </para>
+ <figure>
+ <title>
+ Simple
+ <emphasis role="bold">
+ <property><rich:colorPicker></property>
+ </emphasis>
+ component
+ </title>
+ <mediaobject>
+ <imageobject>
+ <imagedata fileref="images/colorPicker_init.png"/>
+ </imageobject>
+ </mediaobject>
+ </figure>
+ </section>
+ <section>
+ <title>Key Features</title>
+ <itemizedlist>
+ <listitem>
+ <para>Possibility to get color in hex, or RGB color models</para>
+ </listitem>
+ <listitem>
+ <para>Flat/inline representation</para>
+ </listitem>
+ <listitem>
+ <para>Highly customizable look and feel</para>
+ </listitem>
+ </itemizedlist>
+ </section>
+</section>
Added: trunk/docs/userguide/en/src/main/docbook/included/colorPicker.xml
===================================================================
--- trunk/docs/userguide/en/src/main/docbook/included/colorPicker.xml (rev 0)
+++ trunk/docs/userguide/en/src/main/docbook/included/colorPicker.xml 2009-03-31 16:04:25 UTC (rev 13319)
@@ -0,0 +1,169 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<section>
+ <sectioninfo>
+ <keywordset>
+ <keyword>rich:colorPicker</keyword>
+ <keyword>colorPicker</keyword>
+ </keywordset>
+ </sectioninfo>
+ <table>
+ <title>Component identification parameters</title>
+ <tgroup cols="2">
+ <thead>
+ <row>
+ <entry>Name</entry>
+ <entry>Value</entry>
+ </row>
+ </thead>
+ <tbody>
+ <row>
+ <entry>component-type</entry>
+ <entry>org.richfaces.ColorPicker</entry>
+ </row>
+ <row>
+ <entry>component-class</entry>
+ <entry>org.richfaces.component.html.HtmlColorPicker</entry>
+ </row>
+ <row>
+ <entry>component-family</entry>
+ <entry>org.richfaces.ColorPicker</entry>
+ </row>
+ <row>
+ <entry>renderer-type</entry>
+ <entry>org.richfaces.ColorPickerRenderer</entry>
+ </row>
+ <row>
+ <entry>tag-class</entry>
+ <entry>org.richfaces.taglib.ColorPickerTag</entry>
+ </row>
+ </tbody>
+ </tgroup>
+ </table>
+ <section>
+ <title>Creating the Component with a Page Tag</title>
+ <para>Here is a simple example of how the component can be used on a page:</para>
+ <para>
+ <emphasis role="bold">Example:</emphasis>
+ </para>
+ <!-- itemLabels has to have realy value-->
+ <programlisting role="XML">
+<![CDATA[...
+<rich:colorPicker value="#{bean.color}" />
+...]]>
+ </programlisting>
+ </section>
+ <section>
+ <title>Creating the Component Dynamically Using Java</title>
+ <para>
+ <emphasis role="bold">Example:</emphasis>
+ </para>
+ <programlisting role="JAVA">
+<![CDATA[import org.richfaces.component.html.colorPicker;
+...
+HtmlColorPicker myColorPicker = new ColorPicker();
+...]]>
+ </programlisting>
+ </section>
+ <section>
+ <title>Details of Usage</title>
+ <para>
+ The <emphasis role="bold">
+ <property><rich:colorPicker></property>
+ </emphasis>
+ component allows you simply select a color or define it in hex, RGB, or HSB input fields.
+ There are two squares in the widget that help you to compare the currently selected color and
+ the already selected color.
+ </para>
+ <para>
+ The
+ <property>
+ <emphasis>"value"</emphasis>
+ </property>
+ attribute stores
+ selected color.
+ </para>
+ <para>
+ The value of the
+ <emphasis role="bold">
+ <property><rich:colorPicker></property>
+ </emphasis>
+ component could be saved in hex or RGB color models.
+ You can explicitly define a color model in the
+ <property>
+ <emphasis>"colorMode"</emphasis>
+ </property>
+ attribute.
+ </para>
+ <para>
+ <emphasis role="bold">Example:</emphasis>
+ </para>
+ <programlisting role="XML">
+<![CDATA[...
+<rich:colorPicker value="#{bean.color}" colorMode="rgb" />
+...]]>
+ </programlisting>
+ <para>
+ The
+ <emphasis role="bold">
+ <property><rich:colorPicker></property>
+ </emphasis>
+ component has two representation states: flat and inline.
+ With the help of the
+ <property>
+ <emphasis>"flat"</emphasis>
+ </property>
+ attribute
+ you can define whether the component is rendered flat.
+ </para>
+ <para>
+ <emphasis role="bold">Example:</emphasis>
+ </para>
+ <programlisting role="XML">
+<![CDATA[...
+<rich:colorPicker value="#{bean.color}" flat="true" />
+...]]>
+ </programlisting>
+ <figure>
+ <title>
+ Usage of the
+ <emphasis>
+ <property><flat></property>
+ </emphasis>
+ attribute
+ </title>
+ <mediaobject>
+ <imageobject>
+ <imagedata fileref="images/colorPicker_flat.png"/>
+ </imageobject>
+ </mediaobject>
+ </figure>
+ <para>
+ The <property><emphasis>"showEvent"</emphasis></property> attribute defines
+ the event that shows
+ <emphasis role="bold">
+ <property><rich:colorPicker></property>
+ </emphasis> widget. The default value is "onclick".
+ </para>
+ <para>
+ The <emphasis role="bold">
+ <property><rich:colorPicker></property>
+ </emphasis>
+ component allows to use the <emphasis><property>"icon"</property></emphasis> facet.
+ </para>
+ <para>
+ You can also customize <emphasis role="bold">
+ <property><rich:colorPicker></property>
+ </emphasis> rainbow slider (
+<inlinemediaobject>
+<imageobject>
+<imagedata fileref="images/colorPicker_arrows.png"/>
+</imageobject>
+</inlinemediaobject>
+)
+
+ with the help of the
+ <property><emphasis>"arrows"</emphasis></property> facet.
+ </para>
+
+ </section>
+</section>
15 years, 8 months
JBoss Rich Faces SVN: r13318 - in trunk/docs/userguide: en/src/main/docbook and 1 other directory.
by richfaces-svn-commits@lists.jboss.org
Author: artdaw
Date: 2009-03-31 12:01:55 -0400 (Tue, 31 Mar 2009)
New Revision: 13318
Modified:
trunk/docs/userguide/en/src/main/docbook/master.xml
trunk/docs/userguide/pom.xml
Log:
https://jira.jboss.org/jira/browse/RF-6581 - Description, Details of Usage sections are done
Modified: trunk/docs/userguide/en/src/main/docbook/master.xml
===================================================================
--- trunk/docs/userguide/en/src/main/docbook/master.xml 2009-03-31 15:41:58 UTC (rev 13317)
+++ trunk/docs/userguide/en/src/main/docbook/master.xml 2009-03-31 16:01:55 UTC (rev 13318)
@@ -58,7 +58,7 @@
<!ENTITY coreComponents_table SYSTEM "../../../target/generated/a4j.xml">
<!ENTITY beanValidator_table SYSTEM "../../../target/generated/beanValidator.xml">
<!ENTITY editor_table SYSTEM "../../../target/generated/editor.xml">
-
+ <!ENTITY colorPicker_table SYSTEM "../../../target/generated/colorPicker.xml">
]>
<book>
<bookinfo>
@@ -103,6 +103,7 @@
&coreComponents_table;
&beanValidator_table;
&calendar_table;
+&colorPicker_table;
&comboBox_table;
&componentControl_table;
&contextMenu_table;
Modified: trunk/docs/userguide/pom.xml
===================================================================
--- trunk/docs/userguide/pom.xml 2009-03-31 15:41:58 UTC (rev 13317)
+++ trunk/docs/userguide/pom.xml 2009-03-31 16:01:55 UTC (rev 13318)
@@ -587,8 +587,36 @@
</version>
</artifactItem>
+
<artifactItem>
<groupId>
+ org.richfaces.ui
+ </groupId>
+ <artifactId>jQuery</artifactId>
+ <version>
+ ${project.version}
+ </version>
+ </artifactItem>
+ <artifactItem>
+ <groupId>
+ org.richfaces.ui
+ </groupId>
+ <artifactId>layout</artifactId>
+ <version>
+ ${project.version}
+ </version>
+ </artifactItem>
+ <artifactItem>
+ <groupId>
+ org.richfaces.ui
+ </groupId>
+ <artifactId>colorPicker</artifactId>
+ <version>
+ ${project.version}
+ </version>
+ </artifactItem>
+ <artifactItem>
+ <groupId>
org.richfaces.docs.common-resources
</groupId>
<artifactId>
@@ -603,15 +631,6 @@
${project.build.directory}
</outputDirectory>
</artifactItem>
- <artifactItem>
- <groupId>
- org.richfaces.ui
- </groupId>
- <artifactId>jQuery</artifactId>
- <version>
- ${project.version}
- </version>
- </artifactItem>
</artifactItems>
<outputDirectory>
${project.build.directory}/library
@@ -655,6 +674,46 @@
<transformationSets>
<transformationSet>
<dir>
+ ${project.build.directory}/library/org/richfaces/renderkit/html/css
+ </dir>
+ <includes>
+ <include>*.xcss</include>
+ </includes>
+ <excludes>
+ <exclude>*.xml</exclude>
+ </excludes>
+ <outputDir>
+ ${project.build.directory}${file.separator}generated${file.separator}xcss
+ </outputDir>
+ <stylesheet>
+ ${project.build.directory}/common-resources/xslt/f.xsl
+ </stylesheet>
+ <fileMappers>
+ <fileMapper implementation="org.codehaus.plexus.components.io.filemappers.FileExtensionMapper">
+ <targetExtension>
+ xml
+ </targetExtension>
+ </fileMapper>
+ </fileMappers>
+ <parameters>
+ <parameter>
+ <name>lang</name>
+ <value>
+ ..${file.separator}..${file.separator}..${file.separator}src${file.separator}main${file.separator}docbook
+ </value>
+ </parameter>
+ <parameter>
+ <name>title</name>
+ <value>${project.name}</value>
+ </parameter>
+ <parameter>
+ <name>separator</name>
+ <value>${file.separator}</value>
+ </parameter>
+ </parameters>
+ </transformationSet>
+ <transformationSet>
+ <dir>
${project.build.directory}/library/META-INF
</dir>
<includes>
@@ -695,6 +754,10 @@
<name>prefix</name>
<value>rich</value>
</parameter>
+ <parameter>
+ <name>xcssPath</name>
+ <value>..${file.separator}..${file.separator}generated${file.separator}xcss</value>
+ </parameter>
</parameters>
</transformationSet>
<transformationSet>
@@ -739,6 +802,10 @@
<name>prefix</name>
<value>a4j</value>
</parameter>
+ <parameter>
+ <name>xcssPath</name>
+ <value>..${file.separator}..${file.separator}generated${file.separator}xcss</value>
+ </parameter>
</parameters>
</transformationSet>
</transformationSets>
@@ -909,4 +976,4 @@
<module>en</module>
</modules>
-</project>
+</project>
15 years, 8 months
JBoss Rich Faces SVN: r13317 - in trunk/ui/paint2D/src/main: config/resources and 1 other directories.
by richfaces-svn-commits@lists.jboss.org
Author: nbelaevski
Date: 2009-03-31 11:41:58 -0400 (Tue, 31 Mar 2009)
New Revision: 13317
Added:
trunk/ui/paint2D/src/main/config/resources/
trunk/ui/paint2D/src/main/config/resources/resources-config.xml
Modified:
trunk/ui/paint2D/src/main/java/org/richfaces/renderkit/html/Paint2DResource.java
Log:
https://jira.jboss.org/jira/browse/RF-6652
Added: trunk/ui/paint2D/src/main/config/resources/resources-config.xml
===================================================================
--- trunk/ui/paint2D/src/main/config/resources/resources-config.xml (rev 0)
+++ trunk/ui/paint2D/src/main/config/resources/resources-config.xml 2009-03-31 15:41:58 UTC (rev 13317)
@@ -0,0 +1,10 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<resource-config>
+ <resource class="org.richfaces.renderkit.html.Paint2DResource">
+ <name>org.richfaces.renderkit.html.Paint2DResource</name>
+ </resource>
+
+ <resource class="org.richfaces.renderkit.html.Paint2DCachedResource">
+ <name>org.richfaces.renderkit.html.Paint2DCachedResource</name>
+ </resource>
+</resource-config>
Modified: trunk/ui/paint2D/src/main/java/org/richfaces/renderkit/html/Paint2DResource.java
===================================================================
--- trunk/ui/paint2D/src/main/java/org/richfaces/renderkit/html/Paint2DResource.java 2009-03-31 14:23:02 UTC (rev 13316)
+++ trunk/ui/paint2D/src/main/java/org/richfaces/renderkit/html/Paint2DResource.java 2009-03-31 15:41:58 UTC (rev 13317)
@@ -65,7 +65,12 @@
}
public ResourceRenderer getRenderer(ResourceContext context) {
- ImageData data = (ImageData) restoreData(context);
+ ImageData data = null;
+
+ if (context != null) {
+ data = (ImageData) restoreData(context);
+ }
+
ImageRenderer renderer = _renderers[null==data?0:data._format];
return renderer;
}
15 years, 8 months
JBoss Rich Faces SVN: r13316 - trunk/ui/modal-panel/src/main/resources/org/richfaces/renderkit/html/scripts.
by richfaces-svn-commits@lists.jboss.org
Author: nbelaevski
Date: 2009-03-31 10:23:02 -0400 (Tue, 31 Mar 2009)
New Revision: 13316
Modified:
trunk/ui/modal-panel/src/main/resources/org/richfaces/renderkit/html/scripts/modalPanel.js
Log:
https://jira.jboss.org/jira/browse/RF-6662
https://jira.jboss.org/jira/browse/RF-6437
Modified: trunk/ui/modal-panel/src/main/resources/org/richfaces/renderkit/html/scripts/modalPanel.js
===================================================================
--- trunk/ui/modal-panel/src/main/resources/org/richfaces/renderkit/html/scripts/modalPanel.js 2009-03-31 12:26:11 UTC (rev 13315)
+++ trunk/ui/modal-panel/src/main/resources/org/richfaces/renderkit/html/scripts/modalPanel.js 2009-03-31 14:23:02 UTC (rev 13316)
@@ -146,6 +146,7 @@
var eCdiv = $(this.cdiv);
eCdiv.style.position = "absolute";
+ eCdiv.parentNode.style.position = "absolute";
eCdiv.mpUseExpr = true;
}
@@ -629,7 +630,6 @@
eCursorDiv.style.setExpression("left", le);
eCursorDiv.style.setExpression("top", te);
-
var leftExpr = "(this.mpLeft || 0) + -Position.cumulativeOffset(this.parentNode)[0] + getSizeElement().scrollLeft + \"px\"";
var topExpr = "(this.mpTop || 0) + -Position.cumulativeOffset(this.parentNode)[1] + getSizeElement().scrollTop + \"px\"";
@@ -745,7 +745,7 @@
var eDiv = $(this.div);
var eCdiv = $(this.cdiv);
- if (eDiv.style.removeExpression) {
+ if (eDiv.style.position == "absolute") {
eDiv.style.removeExpression("width");
eDiv.style.removeExpression("height");
15 years, 8 months
JBoss Rich Faces SVN: r13315 - in trunk/ui/editor/src: main/java/org/richfaces/convert/seamtext/tags and 1 other directories.
by richfaces-svn-commits@lists.jboss.org
Author: Alex.Kolonitsky
Date: 2009-03-31 08:26:11 -0400 (Tue, 31 Mar 2009)
New Revision: 13315
Added:
trunk/ui/editor/src/main/java/org/richfaces/convert/seamtext/tags/
trunk/ui/editor/src/main/java/org/richfaces/convert/seamtext/tags/FormattingTag.java
trunk/ui/editor/src/main/java/org/richfaces/convert/seamtext/tags/HtmlTag.java
trunk/ui/editor/src/main/java/org/richfaces/convert/seamtext/tags/LineTag.java
trunk/ui/editor/src/main/java/org/richfaces/convert/seamtext/tags/LinkTag.java
trunk/ui/editor/src/main/java/org/richfaces/convert/seamtext/tags/OrderedListTag.java
trunk/ui/editor/src/main/java/org/richfaces/convert/seamtext/tags/TagFactory.java
trunk/ui/editor/src/main/java/org/richfaces/convert/seamtext/tags/UnorderedListTag.java
Removed:
trunk/ui/editor/src/main/java/org/richfaces/convert/seamtext/Tag.java
trunk/ui/editor/src/main/java/org/richfaces/convert/seamtext/TagFactory.java
Modified:
trunk/ui/editor/src/main/java/org/richfaces/convert/seamtext/DefaultSeamTextConverter.java
trunk/ui/editor/src/main/java/org/richfaces/convert/seamtext/HtmlToSeamSAXParser.java
trunk/ui/editor/src/main/java/org/richfaces/convert/seamtext/HtmlToSeamTransformer.java
trunk/ui/editor/src/test/java/org/richfaces/seamparser/HtmlSeamParserTest.java
Log:
Editor: converter error if use nesting formatting.
https://jira.jboss.org/jira/browse/RF-5790
Editor: convertion failed in case past formatted text in editor.
https://jira.jboss.org/jira/browse/RF-5825
Modified: trunk/ui/editor/src/main/java/org/richfaces/convert/seamtext/DefaultSeamTextConverter.java
===================================================================
--- trunk/ui/editor/src/main/java/org/richfaces/convert/seamtext/DefaultSeamTextConverter.java 2009-03-31 12:06:53 UTC (rev 13314)
+++ trunk/ui/editor/src/main/java/org/richfaces/convert/seamtext/DefaultSeamTextConverter.java 2009-03-31 12:26:11 UTC (rev 13315)
@@ -59,7 +59,7 @@
}
try {
- return HtmlToSeamSAXParser.convertHtmlToSeamText(value);
+ return new HtmlToSeamSAXParser().convertHtmlToSeamText(value);
} catch (Exception e) {
FacesMessage message = new FacesMessage(
Modified: trunk/ui/editor/src/main/java/org/richfaces/convert/seamtext/HtmlToSeamSAXParser.java
===================================================================
--- trunk/ui/editor/src/main/java/org/richfaces/convert/seamtext/HtmlToSeamSAXParser.java 2009-03-31 12:06:53 UTC (rev 13314)
+++ trunk/ui/editor/src/main/java/org/richfaces/convert/seamtext/HtmlToSeamSAXParser.java 2009-03-31 12:26:11 UTC (rev 13315)
@@ -2,13 +2,15 @@
import antlr.SemanticException;
import antlr.Token;
-import com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser;
-import com.sun.org.apache.xerces.internal.parsers.SAXParser;
import org.jboss.seam.text.SeamTextParser;
+import org.richfaces.convert.seamtext.tags.HtmlTag;
+import org.richfaces.convert.seamtext.tags.TagFactory;
import org.xml.sax.Attributes;
import org.xml.sax.InputSource;
import org.xml.sax.SAXException;
+import org.xml.sax.XMLReader;
import org.xml.sax.helpers.DefaultHandler;
+import org.xml.sax.helpers.XMLReaderFactory;
import java.io.IOException;
import java.io.StringReader;
@@ -25,24 +27,28 @@
private static final TagFactory TAG_FACTORY = new TagFactory();
public static final String ROOT_TAG_NAME = "root";
- public static final Tag ROOT_TAG = TAG_FACTORY.getInstance(ROOT_TAG_NAME);
-
+ public final HtmlTag rootTag = TAG_FACTORY.getInstance(ROOT_TAG_NAME);
+
+ public HtmlTag getRootTag() {
+ return rootTag;
+ }
+
private SeamTextParser.Sanitizer sanitizer = new SeamTextParser.DefaultSanitizer();
private HtmlToSeamTransformer transformer;
- private Stack<Tag> tagStack;
+ private Stack<HtmlTag> tagStack;
public HtmlToSeamSAXParser() {
- tagStack = new Stack<Tag>();
+ tagStack = new Stack<HtmlTag>();
transformer = new HtmlToSeamTransformer();
transformer.setHtmlElementStack(tagStack);
}
public static String convertHtmlToSeamText(final String html) throws IOException, SAXException {
- final HtmlToSeamSAXParser t = new HtmlToSeamSAXParser();
- final AbstractSAXParser p = new SAXParser();
- p.setContentHandler(t);
+ final HtmlToSeamSAXParser parser = new HtmlToSeamSAXParser();
+ final XMLReader p = XMLReaderFactory.createXMLReader();
+ p.setContentHandler(parser);
try {
p.setFeature("http://xml.org/sax/features/namespaces", false);
p.setFeature("http://xml.org/sax/features/namespace-prefixes", false);
@@ -54,7 +60,7 @@
p.parse(new InputSource(new StringReader(str.toString())));
- return t.getTransformer().toString();
+ return parser.getRootTag().toString();
}
@Override
@@ -64,14 +70,15 @@
}
if (ROOT_TAG_NAME.equalsIgnoreCase(qName)) {
- tagStack.push(ROOT_TAG);
+ tagStack.push(rootTag);
+ transformer.setCurrentTag(rootTag);
} else if (hasInvalidParentTag()) {
if (!isValidTag(qName)) {
tagStack.push(TAG_FACTORY.getInstance(qName, processAttr(qName, attributes)));
}
} else {
- final Tag tag = TAG_FACTORY.getInstance(qName, processAttr(qName, attributes)); // process attr invoked when it is invalid tag? is is can be optimized
+ final HtmlTag tag = TAG_FACTORY.getInstance(qName, processAttr(qName, attributes)); // process attr invoked when it is invalid tag? is is can be optimized
if (isValidTag(tag)) {
transformer.openTag(tag);
} else {
@@ -85,7 +92,7 @@
private Map<String, String> processAttr(final String tag, Attributes attributes) {
final Map<String, String> map = new HashMap<String, String>(attributes.getLength());
for (int i = 0; i < attributes.getLength(); i++) {
- if (isValidAttr(tag, attributes.getQName(i))) {
+ if (isValidAttr(tag, attributes.getQName(i), attributes.getValue(i))) {
map.put(attributes.getQName(i), attributes.getValue(i));
}
}
@@ -95,7 +102,7 @@
@Override
public void endElement(String uri, String localName, String qName) {
- final Tag tag;
+ final HtmlTag tag;
if (ROOT_TAG_NAME.equalsIgnoreCase(qName)) {
tag = tagStack.pop();
@@ -170,9 +177,12 @@
}
}
- private boolean isValidAttr(String tag, String name) {
+ private boolean isValidAttr(String tag, String name, String value) {
try {
- sanitizer.validateHtmlAttribute(new FakeToken(0, tag), new FakeToken(0, name));
+ final FakeToken tagToken = new FakeToken(0, tag);
+ final FakeToken attrToken = new FakeToken(0, name);
+ sanitizer.validateHtmlAttribute(tagToken, attrToken);
+ sanitizer.validateHtmlAttributeValue(tagToken, attrToken, value);
} catch (SemanticException e) {
return false;
}
@@ -188,14 +198,14 @@
return true;
}
- private boolean isValidTag(Tag tag) {
+ private boolean isValidTag(HtmlTag tag) {
return isValidTag(tag.getName());
}
/*
* Handling invalid tags by sanitizer
* */
- private Tag firstInvalidTag = null;
+ private HtmlTag firstInvalidTag = null;
private boolean hasInvalidParentTag() {
return firstInvalidTag != null;
@@ -205,11 +215,11 @@
this.firstInvalidTag = null;
}
- private void setFirstInvalidTag(Tag firstInvalidTag) {
+ private void setFirstInvalidTag(HtmlTag firstInvalidTag) {
this.firstInvalidTag = firstInvalidTag;
}
- private Tag getFirstInvalidTag() {
+ private HtmlTag getFirstInvalidTag() {
return this.firstInvalidTag;
}
Modified: trunk/ui/editor/src/main/java/org/richfaces/convert/seamtext/HtmlToSeamTransformer.java
===================================================================
--- trunk/ui/editor/src/main/java/org/richfaces/convert/seamtext/HtmlToSeamTransformer.java 2009-03-31 12:06:53 UTC (rev 13314)
+++ trunk/ui/editor/src/main/java/org/richfaces/convert/seamtext/HtmlToSeamTransformer.java 2009-03-31 12:26:11 UTC (rev 13315)
@@ -5,92 +5,22 @@
import java.util.HashSet;
import java.util.Stack;
+import org.richfaces.convert.seamtext.tags.HtmlTag;
+
+import static org.richfaces.convert.seamtext.tags.HtmlTag.*;
+
/**
* @user: akolonitsky
* Date: Mar 24, 2009
*/
public class HtmlToSeamTransformer {
-
- private static final String HTML_A = "a";
- private static final String HTML_H1 = "h1";
- private static final String HTML_H2 = "h2";
- private static final String HTML_H3 = "h3";
- private static final String HTML_H4 = "h4";
- private static final String HTML_P = "p";
- private static final String HTML_UL = "ul";
- private static final String HTML_OL = "ol";
- private static final String HTML_LI = "li";
- private static final String HTML_PRE = "pre";
- private static final String HTML_TT = "tt";
- private static final String HTML_DEL = "del";
- private static final String HTML_SUP = "sup";
- private static final String HTML_Q = "q";
- private static final String HTML_I = "i";
- private static final String HTML_U = "u";
- private static final String HTML_BLOCKQOUTE = "blockqoute";
-
- private static final String SEAM_MONOSPACE = "|";
- private static final String SEAM_TWIDDLE = "~";
- private static final String SEAM_HASH = "#";
- private static final String SEAM_HAT = "^";
- private static final String SEAM_PLUS = "+";
- private static final String SEAM_STAR = "*";
- private static final String SEAM_UNDERSCORE = "_";
- private static final String SEAM_EQ = "=";
- private static final String SEAM_BACKTICK = "`";
- private static final String SEAM_DOUBLEQUOTE = "\"";
- private static final String SEAM_LINK_START = "[";
- private static final String SEAM_LINK_END = "]";
-
- private static final String SEAM_GT = ">";
- private static final String SEAM_LT = "<";
- private static final String SEAM_AMP = "&";
-
- private static final String BLANK_LINE = "\n\n";
-
public boolean preformatted = false;
- private static final Collection<String> SEAM_TEXT_SYMBOLS = new HashSet<String>(Arrays.asList(
- SEAM_MONOSPACE,
- SEAM_TWIDDLE,
- SEAM_HASH,
- SEAM_HAT,
- SEAM_PLUS,
- SEAM_STAR,
- SEAM_UNDERSCORE,
- SEAM_EQ,
- SEAM_BACKTICK,
- SEAM_DOUBLEQUOTE,
- SEAM_LINK_START,
- SEAM_LINK_END,
- SEAM_LT,
- SEAM_GT,
- SEAM_AMP,
-
- BLANK_LINE
- ));
-
-
private static final Collection<String> SIMPLE_HTML_SEAM_TEXT_ELEMENTS = new HashSet<String>(Arrays.asList(
- HTML_DEL,
- HTML_SUP,
- HTML_PRE,
- HTML_Q,
- HTML_I,
- HTML_TT,
- HTML_U));
+ DEL, SUP, PRE, Q, I, TT, U));
private static final Collection<String> FORMATTED_HTML_SEAM_TEXT_ELEMENTS = new HashSet<String>(Arrays.asList(
- HTML_H1,
- HTML_H2,
- HTML_H3,
- HTML_H4,
- HTML_P,
- HTML_UL,
- HTML_OL,
- HTML_LI,
- HTML_A,
- HTML_BLOCKQOUTE));
+ H1, H2, H3, H4, P, UL, OL, LI, A, BLOCKQOUTE));
private static final Collection<String> HTML_SEAM_TEXT_ELEMENTS =
new HashSet<String>(SIMPLE_HTML_SEAM_TEXT_ELEMENTS.size() + FORMATTED_HTML_SEAM_TEXT_ELEMENTS.size());
@@ -99,83 +29,63 @@
HTML_SEAM_TEXT_ELEMENTS.addAll(FORMATTED_HTML_SEAM_TEXT_ELEMENTS);
}
- private Stack<Tag> htmlElementStack = new Stack<Tag>();
+ private Stack<HtmlTag> htmlElementStack = new Stack<HtmlTag>();
- public Stack<Tag> getHtmlElementStack() {
- return htmlElementStack;
- }
+ private StringBuilder newLinesCollector;
+
+ private HtmlTag currentTag = null;
- public void setHtmlElementStack(Stack<Tag> htmlElementStack) {
- this.htmlElementStack = htmlElementStack;
- }
-
- private StringBuilder mainBuilder = new StringBuilder();
-
private boolean isHeaderProcessed = false;
private boolean isFirstChars = false;
- private StringBuilder builder = mainBuilder;
+ public Stack<HtmlTag> getHtmlElementStack() {
+ return htmlElementStack;
+ }
- public StringBuilder newLinesCollector;
+ public void setHtmlElementStack(Stack<HtmlTag> htmlElementStack) {
+ this.htmlElementStack = htmlElementStack;
+ }
- @Override
- public String toString() {
- return builder.toString();
+ private void appendStart(HtmlTag tag) {
+ currentTag.appendBody(tag);
+ currentTag = tag;
}
- private void append(String ... strings) {
+ private void appendBody(String ... strings) {
for (String str : strings) {
- builder.append(str);
+ currentTag.appendBody(str);
}
}
-
- public boolean isLink(Tag tag) {
- return HTML_A.equalsIgnoreCase(tag.getName());
+
+ private void appendEnd() {
+ currentTag = htmlElementStack.peek();
}
+
+ public String escapeSeamText(String tokenName, boolean preformatted) {
+ final StringBuilder result = new StringBuilder(tokenName.length() + 1);
+ if (!preformatted) {
+ result.append('\\');
+ }
+ result.append(tokenName);
- public boolean isHeader(Tag tag) {
- final String name = tag.getName().toLowerCase();
- return HTML_H1.equals(name) || HTML_H2.equals(name) || HTML_H3.equals(name) || HTML_H4.equals(name);
+ return result.toString();
}
- public boolean isParagraph(Tag tag) {
- return HTML_P.equalsIgnoreCase(tag.getName());
+ public boolean isSeamTextElement(HtmlTag element) {
+ return HTML_SEAM_TEXT_ELEMENTS.contains(element.getName().toLowerCase());
}
- public boolean isList(Tag token) {
- final String name = token.getName().toLowerCase();
- return HTML_UL.equals(name) || HTML_OL.equals(name);
+ public boolean isSimpleSeamTextElement(HtmlTag element) {
+ return SIMPLE_HTML_SEAM_TEXT_ELEMENTS.contains(element.getName().toLowerCase());
}
- public boolean isListItem(Tag token) {
- final String name = token.getName().toLowerCase();
- return HTML_LI.equals(name);
+ public boolean isFormattedHtmlSeamTextElement(HtmlTag element) {
+ return FORMATTED_HTML_SEAM_TEXT_ELEMENTS.contains(element.getName().toLowerCase());
}
- public boolean isPreFormattedElement(Tag tag) {
- final String name = tag.getName().toLowerCase();
- return HTML_PRE.equals(name) || HTML_TT.equals(name);
- }
+ public boolean isPlainHtmlRequired(HtmlTag name) {
- public String createSeamTextList() {
- final String seamText;
-
- final Tag parent = htmlElementStack.peek();
- final String parentName = parent.getName().toLowerCase();
- if (parentName.equals(HTML_UL)) {
- seamText = SEAM_EQ;
- } else if (parentName.equals(HTML_OL)) {
- seamText = SEAM_HASH;
- } else {
- throw new IllegalStateException("<li> must follow <ol> or <ul> not <" + parent.getName() + '>');
- }
-
- return seamText;
- }
-
- public boolean isPlainHtmlRequired(Tag name) {
-
if (!isSeamTextElement(name)) {
return true;
}
@@ -184,11 +94,9 @@
return false;
}
- if (!HTML_A.equals(name.getName().toLowerCase())
- && !HTML_P.equals(name.getName().toLowerCase())) {
-
- for (Tag token : htmlElementStack) {
- if (isHeader(token) || isListItem(token)) {
+ if (!name.isLink() && !name.isParagraph()) {
+ for (HtmlTag token : htmlElementStack) {
+ if (token.isHeader() || token.isListItem()) {
return true;
}
}
@@ -196,85 +104,7 @@
return false;
}
-
- public String getSimpleSeamText(Tag tag) {
-
- final String name = tag.getName().toLowerCase();
- final StringBuilder seamText = new StringBuilder();
-
- if (HTML_TT.equals(name)) {
- seamText.append(SEAM_MONOSPACE);
- } else if (HTML_DEL.equals(name)) {
- seamText.append(SEAM_TWIDDLE);
- } else if (HTML_I.equals(name)) {
- seamText.append(SEAM_STAR);
- } else if (HTML_SUP.equals(name)) {
- seamText.append(SEAM_HAT);
- } else if (HTML_U.equals(name)) {
- seamText.append(SEAM_UNDERSCORE);
- } else if (HTML_PRE.equals(name)) {
- seamText.append(SEAM_BACKTICK);
- } else if (HTML_Q.equals(name)) {
- seamText.append(SEAM_DOUBLEQUOTE);
- }
- return seamText.toString();
-
- }
-
-
- public String escapeSeamText(String tokenName, boolean preformatted) {
- final StringBuilder result = new StringBuilder();
-
- if (preformatted) {
- if ("<".equals(tokenName)) {
- result.append('<');
- } else if ("&".equals(tokenName)) {
- result.append('&');
- } else if (">".equals(tokenName)) {
- result.append('>');
- } else if (""".equals(tokenName)) {
- result.append('"');
- } else if (" ".equals(tokenName)) {
- result.append(' ');
- } else if (SEAM_TEXT_SYMBOLS.contains(tokenName)) {
- result.append(tokenName);
- }
-
- } else {
-
- if ("<".equals(tokenName)) {
- result.append("\\<");
- } else if ("&".equals(tokenName)) {
- result.append("\\&");
- } else if (">".equals(tokenName)) {
- result.append("\\>");
- } else if (""".equals(tokenName)) {
- result.append('\"');
- } else if (" ".equals(tokenName)) {
- result.append(' ');
- } else if ("\\".equals(tokenName)) {
- result.append("\\\\");
- } else if (SEAM_TEXT_SYMBOLS.contains(tokenName)) {
- result.append('\\').append(tokenName);
- }
- }
-
- return result.toString();
- }
-
-
- public boolean isSeamTextElement(Tag element) {
- return HTML_SEAM_TEXT_ELEMENTS.contains(element.getName().toLowerCase());
- }
-
- public boolean isSimpleSeamTextElement(Tag element) {
- return SIMPLE_HTML_SEAM_TEXT_ELEMENTS.contains(element.getName().toLowerCase());
- }
-
- public boolean isFormattedHtmlSeamTextElement(Tag element) {
- return FORMATTED_HTML_SEAM_TEXT_ELEMENTS.contains(element.getName().toLowerCase());
- }
-
+
public void text(char[] text, int start, int length) {
if (isFirstChars) {
// append(htmlElementStack.peek().printStartSuffix());
@@ -298,8 +128,8 @@
}
private void setHeaderProcessed() {
- final Tag token = htmlElementStack.peek();
- if (!isParagraph(token) && isHeaderProcessed) {
+ final HtmlTag token = htmlElementStack.peek();
+ if (!token.isParagraph() && isHeaderProcessed) {
isHeaderProcessed = false;
}
}
@@ -314,11 +144,11 @@
break;
case '\n':
- final Tag token = htmlElementStack.peek();
- if (!(isParagraph(token)
+ final HtmlTag token = htmlElementStack.peek();
+ if (!(token.isParagraph()
|| isHeaderProcessed
|| HtmlToSeamSAXParser.ROOT_TAG_NAME.equals(token.getName())
- || isList(token))) {
+ || token.isList())) {
out(text, start, localLength);
}
@@ -330,7 +160,7 @@
}
public void seamCharacters(char[] text, int start, int length) {
- append(escapeSeamText(new String(text, start, length), preformatted));
+ appendBody(escapeSeamText(new String(text, start, length), preformatted));
}
public void plain(char[] text, int start, int length) {
@@ -340,12 +170,12 @@
}
public void out(char[] text, int start, int length) {
- append(new String(text, start, length));
+ appendBody(new String(text, start, length));
}
public void space(char[] text, int start, int length) {
if (!htmlElementStack.isEmpty()) {
- final Tag token = htmlElementStack.peek();
+ final HtmlTag token = htmlElementStack.peek();
if (isPlainHtmlRequired(token)) {
out(text, start, length);
}
@@ -358,34 +188,20 @@
}
}
- public void openTag(Tag tag) {
-
- if (isPreFormattedElement(tag)) {
+ public void openTag(HtmlTag tag) {
+
+ if (tag.isPreFormattedElement()) {
preformatted = true;
}
if (isPlainHtmlRequired(tag)) {
outValueCollector();
- append(tag.printPlainStart());
+ appendStart(tag);
} else {
-
- if (isFormattedHtmlSeamTextElement(tag)) {
- if (isLink(tag)) {
- append(tag.printStart());
- } else if (isList(tag)) {
- } else if (isListItem(tag)) {
- append(createSeamTextList());
- } else if (isHeader(tag)) {
- append(tag.printStart());
- } else if (isParagraph(tag) && !isHeaderProcessed) {
- }
- } else if (isSimpleSeamTextElement(tag)) {
-
+ if (!isFormattedHtmlSeamTextElement(tag)) {
outValueCollector();
- append(getSimpleSeamText(tag));
- } else {
- throw new IllegalStateException("Unknow situation. ");
- }
+ }
+ appendStart(tag);
}
isFirstChars = true;
@@ -393,12 +209,12 @@
private void outValueCollector() {
if (newLinesCollector != null) {
- append(newLinesCollector.toString());
+ appendBody(newLinesCollector.toString());
newLinesCollector = null;
}
}
- public void closeTagWithBody(Tag tag) {
+ public void closeTagWithBody(HtmlTag tag) {
if (!tag.getName().equals(tag.getName())) {
throw new IllegalStateException("Can not convert to the Seam Text: </" + tag.getName() + "> expected");
}
@@ -408,42 +224,29 @@
value = newLinesCollector.toString();
}
- if (isPlainHtmlRequired(tag)) {
- append(value);
- append(tag.printPlainEnd());
- } else {
- if (isFormattedHtmlSeamTextElement(tag)) {
- if (isLink(tag)) {
- append(tag.printEnd());
- } else if (isParagraph(tag)) {
- append(value);
- append(tag.printEnd());
-
- isHeaderProcessed = false;
- } else {
- append(value);
- }
-
- if (isList(tag) || isListItem(tag)) {
- append("\n");
- } else if (isHeader(tag)) {
- append(tag.printEnd());
- isHeaderProcessed = true;
- }
-
- } else if (isSimpleSeamTextElement(tag)) {
- append(value.trim());
- append(getSimpleSeamText(tag));
- } else {
- throw new IllegalStateException("Unknow situation. ");
- }
+ if (tag.isLink()) {
+ value = "";
+ } else if (tag.isParagraph()) {
+ isHeaderProcessed = false;
+ } else if (tag.isHeader()) {
+ isHeaderProcessed = true;
}
+
+ appendBody(value);
+ appendEnd();
-
newLinesCollector = null;
- if (isPreFormattedElement(tag)) {
+ if (tag.isPreFormattedElement()) {
preformatted = false;
}
}
+
+ public HtmlTag getCurrentTag() {
+ return currentTag;
+ }
+
+ public void setCurrentTag(HtmlTag currentTag) {
+ this.currentTag = currentTag;
+ }
}
Deleted: trunk/ui/editor/src/main/java/org/richfaces/convert/seamtext/Tag.java
===================================================================
--- trunk/ui/editor/src/main/java/org/richfaces/convert/seamtext/Tag.java 2009-03-31 12:06:53 UTC (rev 13314)
+++ trunk/ui/editor/src/main/java/org/richfaces/convert/seamtext/Tag.java 2009-03-31 12:26:11 UTC (rev 13315)
@@ -1,106 +0,0 @@
-package org.richfaces.convert.seamtext;
-
-import java.util.Map;
-
-/**
- * @user: akolonitsky
- * Date: Mar 24, 2009
- */
-public class Tag {
- private String name;
- private Map<String, String> attributes;
-
- private boolean isEmpty = true;
-
- public Tag() {
- }
-
- public Tag(String name) {
- setName(name);
- }
-
- public Tag(String name, Map<String, String> attributes) {
- setName(name);
- setAttributes(attributes);
- }
-
- public String printPlainStart(){
- final StringBuilder builder = new StringBuilder();
- builder.append('<').append(getName());
-
- if (!attributes.isEmpty()) {
- builder.append(' ').append(printAttributes());
- }
- builder.append('>');
-
- return builder.toString();
- }
-
- public String printStartSuffix(){
- return ">";
- }
-
- public String printStart(){
- return printPlainStart();
- }
-
- private String printAttributes() {
- if (attributes == null) {
- return "";
- }
-
- final StringBuilder builder = new StringBuilder();
- for (Map.Entry<String, String> pair : attributes.entrySet()) {
- builder.append(pair.getKey()).append("=\"").append(pair.getValue()).append("\" ");
- }
- return builder.substring(0, builder.length() - 1);
- }
-
- public String printPlainEnd(){
- if (isEmpty) {
-// return "/>";
- }
-
- final StringBuilder builder = new StringBuilder(getName().length() + 3);
- builder.append("</").append(getName()).append('>');
-
- return builder.toString();
- }
-
- public void setEmpty() {
- isEmpty = true;
- }
-
- public void setNotEmpty() {
- isEmpty = false;
- }
-
- public String printEnd(){
- return printPlainEnd();
- }
-
- public String getName() {
- return name;
- }
-
- public void setName(String name) {
- this.name = name;
- }
-
- public String getAttribute(String attr) {
- return attributes.get(attr);
- }
-
- public Map<String, String> getAttributes() {
- return attributes;
- }
-
- public void setAttributes(Map<String, String> attributes) {
- this.attributes = attributes;
- }
-
- @Override
- public String toString() {
- return printStart();
- }
-}
Deleted: trunk/ui/editor/src/main/java/org/richfaces/convert/seamtext/TagFactory.java
===================================================================
--- trunk/ui/editor/src/main/java/org/richfaces/convert/seamtext/TagFactory.java 2009-03-31 12:06:53 UTC (rev 13314)
+++ trunk/ui/editor/src/main/java/org/richfaces/convert/seamtext/TagFactory.java 2009-03-31 12:26:11 UTC (rev 13315)
@@ -1,89 +0,0 @@
-package org.richfaces.convert.seamtext;
-
-import java.util.*;
-
-/**
- * @user: akolonitsky
- * Date: Mar 25, 2009
- */
-
-public class TagFactory {
- /**
- * Collection of special Seam Tags
- * */
- private static final Collection<Tag> TAGS = Arrays.asList(
- getNewTagDefinition("h1", "+ ", "\n"),
- getNewTagDefinition("h2", "++ ", "\n"),
- getNewTagDefinition("h3", "+++ ", "\n"),
- getNewTagDefinition("h4", "++++ ", "\n"),
- getNewTagDefinition("p", "", "\n\n"),
- getNewTagDefinition("i", "*", "*"),
- new Tag("a") {
- @Override
- public String printStart() {
- return "[";
- }
-
- @Override
- public String printEnd() {
- String s = getAttribute("href");
- if (s == null) {
- s = "/";
- }
- return "=>"+ s + ']';
- }
-
- @Override
- public String printStartSuffix() {
- return "";
- }
- }
- );
-
- private static final Map<String, Tag> TAGS_MAP = new HashMap<String, Tag>(TAGS.size());
- static {
- for (Tag tag : TAGS) {
- TAGS_MAP.put(tag.getName(), tag);
- }
- }
-
-// private static Tag getNewTagDefinition(final String tagName, final String startTag) {
-// return getNewTagDefinition(tagName, startTag, "");
-// }
-
- /**
- * Create subclass for Tag class with overrided printStart, printEnd methods
- * */
- private static Tag getNewTagDefinition(final String tagName, final String startTag, final String endTag) {
- return new Tag(tagName) {
- @Override
- public String printStart() {
- return startTag;
- }
-
- @Override
- public String printEnd() {
- return endTag;
- }
-
- @Override
- public String printStartSuffix() {
- return "";
- }
- };
- }
-
- public Tag getInstance(String tagName) {
- return getInstance(tagName, null);
- }
-
- public Tag getInstance(String tagName, Map<String, String> attr) {
- Tag tag = TAGS_MAP.get(tagName);
- if (tag == null) {
- tag = new Tag(tagName);
- }
- tag.setAttributes(attr);
-
- return tag;
- }
-}
Added: trunk/ui/editor/src/main/java/org/richfaces/convert/seamtext/tags/FormattingTag.java
===================================================================
--- trunk/ui/editor/src/main/java/org/richfaces/convert/seamtext/tags/FormattingTag.java (rev 0)
+++ trunk/ui/editor/src/main/java/org/richfaces/convert/seamtext/tags/FormattingTag.java 2009-03-31 12:26:11 UTC (rev 13315)
@@ -0,0 +1,71 @@
+package org.richfaces.convert.seamtext.tags;
+
+class FormattingTag extends HtmlTag {
+ private static final long serialVersionUID = 2688496380368279023L;
+
+ private String seamTag;
+ private Boolean formating;
+
+ public FormattingTag(String tagName, String seamTag) {
+ super(tagName);
+ this.seamTag = seamTag;
+ }
+
+ @Override
+ public void appendBody(HtmlTag tag) {
+ super.appendBody(tag);
+
+ if (!(tag instanceof FormattingTag)) {
+ formating = false;
+ }
+ }
+
+ @Override
+ public String print() {
+ if (isFormating()) {
+ return super.print();
+ }
+
+ return printPlain();
+ }
+
+ @Override
+ public String printEnd() {
+ return seamTag;
+ }
+
+ @Override
+ public String printStart() {
+ return seamTag;
+ }
+
+ public boolean isFormating() {
+ if (formating != null) {
+ return formating;
+ }
+
+ for (Object child : body) {
+ if (child instanceof FormattingTag) {
+ FormattingTag formattingChild = (FormattingTag) child;
+ if (!formattingChild.isFormating()) {
+ formating = false;
+ return false;
+ }
+ } else if (child instanceof HtmlTag) {
+ throw new IllegalStateException(
+ "It is imposible, in this case we must have formating = false");
+ }
+ }
+
+ formating = true;
+ return true;
+ }
+
+ public String getSeamTag() {
+ return seamTag;
+ }
+
+ public void setSeamTag(String seamTag) {
+ this.seamTag = seamTag;
+ }
+}
Copied: trunk/ui/editor/src/main/java/org/richfaces/convert/seamtext/tags/HtmlTag.java (from rev 13275, trunk/ui/editor/src/main/java/org/richfaces/convert/seamtext/Tag.java)
===================================================================
--- trunk/ui/editor/src/main/java/org/richfaces/convert/seamtext/tags/HtmlTag.java (rev 0)
+++ trunk/ui/editor/src/main/java/org/richfaces/convert/seamtext/tags/HtmlTag.java 2009-03-31 12:26:11 UTC (rev 13315)
@@ -0,0 +1,225 @@
+package org.richfaces.convert.seamtext.tags;
+
+import java.io.Serializable;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * @user: akolonitsky
+ * Date: Mar 24, 2009
+ *
+ * TODO Rename to HtmlTag
+ */
+public class HtmlTag implements Cloneable, Serializable{
+
+ private static final long serialVersionUID = -372761460000118889L;
+
+ public static final String A = "a";
+ public static final String H1 = "h1";
+ public static final String H2 = "h2";
+ public static final String H3 = "h3";
+ public static final String H4 = "h4";
+ public static final String P = "p";
+ public static final String UL = "ul";
+ public static final String OL = "ol";
+ public static final String LI = "li";
+ public static final String PRE = "pre";
+ public static final String TT = "tt";
+ public static final String DEL = "del";
+ public static final String SUP = "sup";
+ public static final String Q = "q";
+ public static final String I = "i";
+ public static final String U = "u";
+ public static final String BLOCKQOUTE = "blockqoute";
+
+ private String name;
+ private Map<String, String> attributes;
+
+ protected List<Object> body;
+
+ private boolean isEmpty = true;
+
+ HtmlTag() {
+ cleanBody();
+ }
+
+ HtmlTag(String name) {
+ this();
+
+ setName(name);
+ }
+
+ HtmlTag(String name, Map<String, String> attributes) {
+ this();
+
+ setName(name);
+ setAttributes(attributes);
+ }
+
+ public String printPlainStart(){
+ final StringBuilder builder = new StringBuilder();
+ builder.append('<').append(getName());
+
+ if (!attributes.isEmpty()) {
+ builder.append(' ').append(printAttributes());
+ }
+ builder.append('>');
+
+ return builder.toString();
+ }
+
+ public String printStartSuffix(){
+ return ">";
+ }
+
+ public String printStart(){
+ return printPlainStart();
+ }
+
+ private String printAttributes() {
+ if (attributes == null) {
+ return "";
+ }
+
+ final StringBuilder builder = new StringBuilder();
+ for (Map.Entry<String, String> pair : attributes.entrySet()) {
+ builder.append(pair.getKey())
+ .append("=\"").append(prepareValue(pair.getValue())).append("\" ");
+ }
+ return builder.substring(0, builder.length() - 1);
+ }
+
+ private String prepareValue(String value) {
+ return value.replace('"', '^');
+ }
+
+ protected void appendChildTag(StringBuilder res, HtmlTag child) {
+ res.append(child);
+ }
+
+ public String printBody() {
+ final StringBuilder res = new StringBuilder();
+ for (Object child : body) {
+ if (child instanceof HtmlTag) {
+ appendChildTag(res, (HtmlTag)child);
+ } else {
+ res.append(child);
+ }
+ }
+ return res.toString();
+ }
+
+ public void appendBody(HtmlTag tag) {
+ body.add(tag);
+ }
+
+ public void appendBody(String str) {
+ body.add(str);
+ }
+
+ public void cleanBody() {
+ body = new ArrayList<Object>();
+ }
+
+ public String printPlainEnd(){
+ if (isEmpty) {
+// return "/>";
+ }
+
+ final StringBuilder builder = new StringBuilder(getName().length() + 3);
+ builder.append("</").append(getName()).append('>');
+
+ return builder.toString();
+ }
+
+ public String printEnd(){
+ return printPlainEnd();
+ }
+
+ public boolean isLink() {
+ return A.equals(name);
+ }
+
+ public boolean isHeader() {
+ return H1.equals(name) || H2.equals(name) || H3.equals(name) || H4.equals(name);
+ }
+
+ public boolean isParagraph() {
+ return P.equals(name);
+ }
+
+ public boolean isList() {
+ return UL.equals(name) || OL.equals(name);
+ }
+
+ public boolean isListItem() {
+ return LI.equals(name);
+ }
+
+ public boolean isPreFormattedElement() {
+ return PRE.equals(name) || TT.equals(name);
+ }
+
+ public void setEmpty() {
+ isEmpty = true;
+ }
+
+ public void setNotEmpty() {
+ isEmpty = false;
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public void setName(String name) {
+ this.name = name.toLowerCase();
+ }
+
+ public String getAttribute(String attr) {
+ return attributes.get(attr);
+ }
+
+ public Map<String, String> getAttributes() {
+ return attributes;
+ }
+
+ public void setAttributes(Map<String, String> attributes) {
+ this.attributes = attributes;
+ }
+
+ @Override
+ public String toString() {
+ return print();
+ }
+
+ public String print() {
+ return printStart() + printBody() + printEnd();
+ }
+
+ public String printPlain() {
+ return printPlainStart() + printBody() + printPlainEnd();
+ }
+
+ protected HtmlTag cloneTag() {
+ HtmlTag clone;
+ try {
+ clone = (HtmlTag) this.clone();
+ } catch (CloneNotSupportedException e) {
+ e.printStackTrace();
+ return null;
+ }
+
+ clone.name = this.name;
+ clone.cleanBody();
+
+ return clone;
+ }
+
+ @Override
+ protected Object clone() throws CloneNotSupportedException {
+ return super.clone();
+ }
+
+}
Added: trunk/ui/editor/src/main/java/org/richfaces/convert/seamtext/tags/LineTag.java
===================================================================
--- trunk/ui/editor/src/main/java/org/richfaces/convert/seamtext/tags/LineTag.java (rev 0)
+++ trunk/ui/editor/src/main/java/org/richfaces/convert/seamtext/tags/LineTag.java 2009-03-31 12:26:11 UTC (rev 13315)
@@ -0,0 +1,40 @@
+package org.richfaces.convert.seamtext.tags;
+
+class LineTag extends HtmlTag {
+ private static final long serialVersionUID = 6972613670825989225L;
+
+ private String startTag;
+
+ public LineTag(String name, String startTag) {
+ super(name);
+ setStartTag(startTag);
+ }
+
+ @Override
+ public String printStart() {
+ return startTag;
+ }
+
+ @Override
+ protected void appendChildTag(StringBuilder res, HtmlTag child) {
+ if (child instanceof LineTag) {
+ res.append(((LineTag)child).printPlain());
+ } else {
+ res.append(child);
+ }
+ }
+
+ @Override
+ public String printEnd() {
+ return "\n";
+ }
+
+ public String getStartTag() {
+ return startTag;
+ }
+
+ public void setStartTag(String startTag) {
+ this.startTag = startTag;
+ }
+}
+
Added: trunk/ui/editor/src/main/java/org/richfaces/convert/seamtext/tags/LinkTag.java
===================================================================
--- trunk/ui/editor/src/main/java/org/richfaces/convert/seamtext/tags/LinkTag.java (rev 0)
+++ trunk/ui/editor/src/main/java/org/richfaces/convert/seamtext/tags/LinkTag.java 2009-03-31 12:26:11 UTC (rev 13315)
@@ -0,0 +1,46 @@
+package org.richfaces.convert.seamtext.tags;
+
+class LinkTag extends HtmlTag {
+
+ private static final long serialVersionUID = -6944275891941825069L;
+ private Boolean haveHtml = false;
+
+ public LinkTag() {
+ super(A);
+ }
+
+ @Override
+ public void appendBody(HtmlTag tag) {
+ super.appendBody(tag);
+
+ haveHtml = true;
+ }
+
+ @Override
+ public String print() {
+ if (haveHtml) {
+ return printPlain();
+ }
+
+ return super.print();
+ }
+
+ @Override
+ public String printStart() {
+ return "[";
+ }
+
+ @Override
+ public String printEnd() {
+ String s = getAttribute("href");
+ if (s == null) {
+ s = "/";
+ }
+ return "=>"+ s + ']';
+ }
+
+ @Override
+ public String printStartSuffix() {
+ return "";
+ }
+}
Added: trunk/ui/editor/src/main/java/org/richfaces/convert/seamtext/tags/OrderedListTag.java
===================================================================
--- trunk/ui/editor/src/main/java/org/richfaces/convert/seamtext/tags/OrderedListTag.java (rev 0)
+++ trunk/ui/editor/src/main/java/org/richfaces/convert/seamtext/tags/OrderedListTag.java 2009-03-31 12:26:11 UTC (rev 13315)
@@ -0,0 +1,28 @@
+package org.richfaces.convert.seamtext.tags;
+
+class OrderedListTag extends HtmlTag {
+ private static final long serialVersionUID = 1L;
+
+ public OrderedListTag() {
+ super(OL);
+ }
+
+ @Override
+ public String printStart() {
+ return "";
+ }
+
+ @Override
+ public String printEnd() {
+ return "\n";
+ }
+
+ @Override
+ protected void appendChildTag(StringBuilder res, HtmlTag child) {
+ if (LI.equals(child.getName())) {
+ res.append(TagFactory.SEAM_HASH).append(child.print());
+ } else {
+ res.append(child);
+ }
+ }
+}
Copied: trunk/ui/editor/src/main/java/org/richfaces/convert/seamtext/tags/TagFactory.java (from rev 13275, trunk/ui/editor/src/main/java/org/richfaces/convert/seamtext/TagFactory.java)
===================================================================
--- trunk/ui/editor/src/main/java/org/richfaces/convert/seamtext/tags/TagFactory.java (rev 0)
+++ trunk/ui/editor/src/main/java/org/richfaces/convert/seamtext/tags/TagFactory.java 2009-03-31 12:26:11 UTC (rev 13315)
@@ -0,0 +1,103 @@
+package org.richfaces.convert.seamtext.tags;
+
+import static org.richfaces.convert.seamtext.tags.HtmlTag.*;
+
+import java.util.*;
+
+
+/**
+ * @user: akolonitsky
+ * Date: Mar 25, 2009
+ */
+public class TagFactory {
+
+ public static final String SEAM_PLUS = "+";
+ public static final String SEAM_MONOSPACE = "|";
+ public static final String SEAM_TWIDDLE = "~";
+ public static final String SEAM_HASH = "#";
+ public static final String SEAM_HAT = "^";
+ public static final String SEAM_STAR = "*";
+ public static final String SEAM_UNDERSCORE = "_";
+ public static final String SEAM_EQ = "=";
+ public static final String SEAM_BACKTICK = "`";
+ public static final String SEAM_DOUBLEQUOTE = "\"";
+ public static final String SEAM_LINK_START = "[";
+ public static final String SEAM_LINK_END = "]";
+
+ /**
+ * Collection of special Seam Tags
+ * */
+ private static final Collection<HtmlTag> TAGS = Arrays.asList(
+ getNewTagDefinition("root", "", ""),
+ new LineTag(H1, "+ "),
+ new LineTag(H2, "++ "),
+ new LineTag(H3, "+++ "),
+ new LineTag(H4, "++++ "),
+ new LineTag(LI, ""),
+ getNewTagDefinition(P, "", "\n\n"),
+
+ new FormattingTag(I, SEAM_STAR),
+ new FormattingTag(DEL, SEAM_TWIDDLE),
+ new FormattingTag(SUP, SEAM_HAT),
+ new FormattingTag(U, SEAM_UNDERSCORE),
+ new FormattingTag(TT, SEAM_MONOSPACE){
+
+ @Override
+ public boolean isFormating() {
+ return true;
+ }
+ },
+
+ getNewTagDefinition(PRE, SEAM_BACKTICK, SEAM_BACKTICK),
+ getNewTagDefinition(Q, SEAM_DOUBLEQUOTE, SEAM_DOUBLEQUOTE),
+
+ new LinkTag(),
+ new UnorderedListTag(),
+ new OrderedListTag()
+ );
+
+ private static final Map<String, HtmlTag> TAGS_MAP = new HashMap<String, HtmlTag>(TAGS.size());
+ static {
+ for (HtmlTag tag : TAGS) {
+ TAGS_MAP.put(tag.getName(), tag);
+ }
+ }
+
+ /**
+ * Create subclass for Tag class with overrided printStart, printEnd methods
+ * */
+ private static HtmlTag getNewTagDefinition(final String tagName, final String startTag, final String endTag) {
+ return new HtmlTag(tagName) {
+ @Override
+ public String printStart() {
+ return startTag;
+ }
+
+ @Override
+ public String printEnd() {
+ return endTag;
+ }
+
+ @Override
+ public String printStartSuffix() {
+ return "";
+ }
+ };
+ }
+
+ public HtmlTag getInstance(String tagName) {
+ return getInstance(tagName, null);
+ }
+
+ public HtmlTag getInstance(String tagName, Map<String, String> attr) {
+ HtmlTag tag = TAGS_MAP.get(tagName);
+ if (tag == null) {
+ tag = new HtmlTag(tagName);
+ } else {
+ tag = tag.cloneTag();
+ }
+ tag.setAttributes(attr);
+
+ return tag;
+ }
+}
Added: trunk/ui/editor/src/main/java/org/richfaces/convert/seamtext/tags/UnorderedListTag.java
===================================================================
--- trunk/ui/editor/src/main/java/org/richfaces/convert/seamtext/tags/UnorderedListTag.java (rev 0)
+++ trunk/ui/editor/src/main/java/org/richfaces/convert/seamtext/tags/UnorderedListTag.java 2009-03-31 12:26:11 UTC (rev 13315)
@@ -0,0 +1,28 @@
+package org.richfaces.convert.seamtext.tags;
+
+class UnorderedListTag extends HtmlTag{
+ private static final long serialVersionUID = 1L;
+
+ public UnorderedListTag() {
+ super(UL);
+ }
+
+ @Override
+ public String printStart() {
+ return "";
+ }
+
+ @Override
+ public String printEnd() {
+ return "\n";
+ }
+
+ @Override
+ protected void appendChildTag(StringBuilder res, HtmlTag child) {
+ if (LI.equals(child.getName())) {
+ res.append(TagFactory.SEAM_EQ).append(child.print());
+ } else {
+ res.append(child);
+ }
+ }
+}
Modified: trunk/ui/editor/src/test/java/org/richfaces/seamparser/HtmlSeamParserTest.java
===================================================================
--- trunk/ui/editor/src/test/java/org/richfaces/seamparser/HtmlSeamParserTest.java 2009-03-31 12:06:53 UTC (rev 13314)
+++ trunk/ui/editor/src/test/java/org/richfaces/seamparser/HtmlSeamParserTest.java 2009-03-31 12:26:11 UTC (rev 13315)
@@ -16,7 +16,7 @@
public class HtmlSeamParserTest extends TestCase {
- private final static String SEAM_TEXT_EXPRESSION_1 = "It's easy to make *emphasis*, |monospace|, "
+ private final static String SEAM_TEXT_EXPRESSION_1 = "It's easy to make *emphasis* -1- *emphasis*, |monospace|, "
+ "~deleted text~, super^scripts^ or_underlines_.";
private final static String SEAM_TEXT_EXPRESSION_2 = "+ This is a big heading\n"
@@ -102,9 +102,6 @@
private final static String SEAM_TEXT_EXPRESSION_29 = "A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S, T, U, V, W, X, Y, Z, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9";
-// private final static String SEAM_TEXT_EXPRESSION_30 = "<div/>";
-
-
public HtmlSeamParserTest(String name) {
super(name);
}
@@ -226,27 +223,23 @@
assertSeamConverting(SEAM_TEXT_EXPRESSION_29);
}
-// public void testStandartSeamTextConverting30() throws Exception {
-// assertSeamConverting(SEAM_TEXT_EXPRESSION_30);
-// }
-
public void testRF5717() throws Exception {
assertHtml2SeamConverting("<p>a<b a&b</p>");
}
- public void testRF5717_() throws Exception {
+ public void testNestingFormating() throws Exception {
assertHtml2SeamConverting("<p><b>aaaaaaaaa <u><i class=\"seamTextEmphasis\">sssssssss</i> dddddddddddddddd</u></b></p>");
}
-// public void testRF5717__() throws Exception {
-// assertHtml2SeamConverting("<P><STRONG>aaaaaaaaad <U><B>ddddddddddddd</B> sssssssssssss</U></STRONG></P>", "");
-// }
+ public void testNestingFormating1() throws Exception {
+ assertHtml2SeamConverting("<P><STRONG>aaaaaaaaad <U><B>ddddddddddddd</B> sssssssssssss</U></STRONG></P>");
+ }
- public void testRF5798_() throws Exception {
+ public void testSkipComment() throws Exception {
assertHtml2SeamConverting("<!-- Hello Cfif -->");
}
- public void noTestRF5798__() throws Exception {
+ public void testUglyTextFromWord() throws Exception {
final String str = "<p><meta content=\"text/html; charset=utf-8\" http-equiv=\"Content-Type\"/><meta content=\"Word.Document\" name=\"ProgId\"/><meta content=\"Microsoft Word 12\" name=\"Generator\"/><meta content=\"Microsoft Word 12\" name=\"Originator\"/><link href=\"file:///E:\\TEMP~1\\msohtmlclip1\\01\\clip_filelist.xml\" rel=\"File-List\"/><link href=\"file:///E:\\TEMP~1\\msohtmlclip1\\01\\clip_themedata.thmx\" rel=\"themeData\"/><link href=\"file:///E:\\TEMP~1\\msohtmlclip1\\01\\clip_colorschememapping.xml\" rel=\"colorSchemeMapping\"/>" +
"<!--[if gte mso 9]><xml>\n" +
" <w:WordDocument>\n" +
@@ -691,7 +684,7 @@
assertHtml2SeamConverting(str);
}
- public void testRF5798() throws Exception {
+ public void testTextFromOpenOffice() throws Exception {
assertHtml2SeamConverting(
"<p style=\"margin-bottom: 0in; line-height: 100%;\" >" +
" <meta http-equiv=\"CONTENT-TYPE\" content=\"text/html;\" charset=\"utf-8\" />" +
@@ -726,7 +719,6 @@
" </font>" +
" </font>" +
"</p>");
-// assertSeamConverting("<b>aaa _*bbb*ccc_ ddd</b>");
}
private String assertHtml2SeamConverting(String htmlText)
15 years, 8 months
JBoss Rich Faces SVN: r13314 - in trunk/test-applications/realworld2/web/src/main: webapp/includes and 2 other directories.
by richfaces-svn-commits@lists.jboss.org
Author: alevkovsky
Date: 2009-03-31 08:06:53 -0400 (Tue, 31 Mar 2009)
New Revision: 13314
Added:
trunk/test-applications/realworld2/web/src/main/webapp/includes/userPrefs/userPrefsEdit.xhtml
Modified:
trunk/test-applications/realworld2/web/src/main/java/org/richfaces/realworld/manager/Authenticator.java
trunk/test-applications/realworld2/web/src/main/webapp/includes/userPrefs.xhtml
trunk/test-applications/realworld2/web/src/main/webapp/includes/userPrefs/userPrefs.xhtml
trunk/test-applications/realworld2/web/src/main/webapp/scripts/realworld.js
Log:
Realworld: correct authentication add user prefs edit template
Modified: trunk/test-applications/realworld2/web/src/main/java/org/richfaces/realworld/manager/Authenticator.java
===================================================================
--- trunk/test-applications/realworld2/web/src/main/java/org/richfaces/realworld/manager/Authenticator.java 2009-03-31 09:34:42 UTC (rev 13313)
+++ trunk/test-applications/realworld2/web/src/main/java/org/richfaces/realworld/manager/Authenticator.java 2009-03-31 12:06:53 UTC (rev 13314)
@@ -96,7 +96,11 @@
shelfManager.clearShelfs();
} catch (LoginException e) {
setLoginFailed(true);
+ credentials.clear();
+ identity.login();
identity.addRole(Constants.GUEST_ROLE);
+ facesMessages.clear();
+ facesMessages.add(INVALID_LOGIN_OR_PASSWORD);
FacesContext.getCurrentInstance().renderResponse();
}
return "main";
Modified: trunk/test-applications/realworld2/web/src/main/webapp/includes/userPrefs/userPrefs.xhtml
===================================================================
(Binary files differ)
Added: trunk/test-applications/realworld2/web/src/main/webapp/includes/userPrefs/userPrefsEdit.xhtml
===================================================================
(Binary files differ)
Property changes on: trunk/test-applications/realworld2/web/src/main/webapp/includes/userPrefs/userPrefsEdit.xhtml
___________________________________________________________________
Name: svn:mime-type
+ application/xhtml+xml
Modified: trunk/test-applications/realworld2/web/src/main/webapp/includes/userPrefs.xhtml
===================================================================
(Binary files differ)
Modified: trunk/test-applications/realworld2/web/src/main/webapp/scripts/realworld.js
===================================================================
--- trunk/test-applications/realworld2/web/src/main/webapp/scripts/realworld.js 2009-03-31 09:34:42 UTC (rev 13313)
+++ trunk/test-applications/realworld2/web/src/main/webapp/scripts/realworld.js 2009-03-31 12:06:53 UTC (rev 13314)
@@ -1,17 +1,3 @@
-
-function storeButtonDisabled(){
- var nodes = $$('.rich-message-label');
- var disabled = false;
- for(var i = 0; i < nodes.length; i++){
- var node = nodes[i];
- if(node.innerHTML != ""){
- disabled = true;
- break;
- }
- }
- return disabled;
- }
-
function selectAllFiles(f) {
for (var i = 0; i < filesCount; i++) {
var b = $('mainform:files:'+i+':file_selected');
15 years, 8 months
JBoss Rich Faces SVN: r13313 - in trunk/docs/userguide/en/src/main/docbook: modules and 1 other directory.
by richfaces-svn-commits@lists.jboss.org
Author: cluts
Date: 2009-03-31 05:34:42 -0400 (Tue, 31 Mar 2009)
New Revision: 13313
Modified:
trunk/docs/userguide/en/src/main/docbook/included/a4j_page.xml
trunk/docs/userguide/en/src/main/docbook/included/actionparam.xml
trunk/docs/userguide/en/src/main/docbook/included/ajaxListener.xml
trunk/docs/userguide/en/src/main/docbook/included/commandButton.xml
trunk/docs/userguide/en/src/main/docbook/included/include.xml
trunk/docs/userguide/en/src/main/docbook/included/jsFunction.xml
trunk/docs/userguide/en/src/main/docbook/included/keepAlive.xml
trunk/docs/userguide/en/src/main/docbook/included/outputPanel.xml
trunk/docs/userguide/en/src/main/docbook/included/poll.xml
trunk/docs/userguide/en/src/main/docbook/included/portlet.xml
trunk/docs/userguide/en/src/main/docbook/included/push.xml
trunk/docs/userguide/en/src/main/docbook/included/region.xml
trunk/docs/userguide/en/src/main/docbook/modules/RFCSettings.xml
trunk/docs/userguide/en/src/main/docbook/modules/RFCarchitectover.xml
Log:
RF-5117 - updated code samples for some chapters
Modified: trunk/docs/userguide/en/src/main/docbook/included/a4j_page.xml
===================================================================
--- trunk/docs/userguide/en/src/main/docbook/included/a4j_page.xml 2009-03-30 23:18:08 UTC (rev 13312)
+++ trunk/docs/userguide/en/src/main/docbook/included/a4j_page.xml 2009-03-31 09:34:42 UTC (rev 13313)
@@ -41,14 +41,13 @@
<property><f:view>:</property>
</emphasis></para>
<programlisting role="XML"><![CDATA[<f:view>
- <a4j:page>
- <f:facet name="head">
- <!--...Head Content here-->
- </f:facet>
- <!--...Page Content here-->
- </a4j:page>
-</f:view>
-]]></programlisting>
+ <a4j:page>
+ <f:facet name="head">
+ <!--...Head Content here-->
+ </f:facet>
+ <!--...Page Content here-->
+ </a4j:page>
+</f:view>]]></programlisting>
</section>
<section>
<title>Creating the Component Dynamically Using Java</title>
@@ -59,8 +58,7 @@
<programlisting role="JAVA"><![CDATA[import org.ajax4jsf.component.html.HtmlPage;
...
HtmlPage myPage = new HtmlPage();
-...
-]]></programlisting>
+...]]></programlisting>
</section>
<section>
<title>Facets</title>
@@ -115,8 +113,7 @@
<!--Head Content here-->
</f:facet>
<!--Page Content Here-->
-</a4j:page>
-]]></programlisting>
+</a4j:page>]]></programlisting>
<para>This structure is rendered as:</para>
<para id="exampl">
Modified: trunk/docs/userguide/en/src/main/docbook/included/actionparam.xml
===================================================================
--- trunk/docs/userguide/en/src/main/docbook/included/actionparam.xml 2009-03-30 23:18:08 UTC (rev 13312)
+++ trunk/docs/userguide/en/src/main/docbook/included/actionparam.xml 2009-03-31 09:34:42 UTC (rev 13313)
@@ -71,13 +71,13 @@
<emphasis role="bold">Example:</emphasis>
</para>
<programlisting role="XML"><![CDATA[...
- <script>
- ...
- var foo = "bar";
- ...
- </script>
- ...
- <a4j:actionparam noEscape="true" name="param1" value="foo" assignTo="#{bean.prop1}" />
+<script>
+ ...
+ var foo = "bar";
+ ...
+</script>
+...
+<a4j:actionparam noEscape="true" name="param1" value="foo" assignTo="#{bean.prop1}" />
...]]></programlisting>
<para>
The <emphasis role="bold"><property><a4j:param></property></emphasis> extends
Modified: trunk/docs/userguide/en/src/main/docbook/included/ajaxListener.xml
===================================================================
--- trunk/docs/userguide/en/src/main/docbook/included/ajaxListener.xml 2009-03-30 23:18:08 UTC (rev 13312)
+++ trunk/docs/userguide/en/src/main/docbook/included/ajaxListener.xml 2009-03-31 09:34:42 UTC (rev 13313)
@@ -59,12 +59,10 @@
}
]]></programlisting>
- <programlisting role="JAVA"><![CDATA[
-import demo.ImplBean;
+ <programlisting role="JAVA"><![CDATA[import demo.ImplBean;
...
ImplBean myListener = new ImplBean();
-...
-]]></programlisting>
+...]]></programlisting>
</section>
@@ -88,18 +86,17 @@
</para>
<programlisting role="XML"><![CDATA[...
- <a4j:commandLink id="cLink" value="Click it To Send Ajax Request">
- <a4j:ajaxListener type="demo.Bean"/>
- </a4j:commandLink>
-...
-]]></programlisting>
+<a4j:commandLink id="cLink" value="Click it To Send Ajax Request">
+ <a4j:ajaxListener type="demo.Bean"/>
+</a4j:commandLink>
+...]]></programlisting>
<para>
<emphasis role="bold">Example:</emphasis>
</para>
<programlisting role="JAVA"><![CDATA[package demo;
-
+
import org.ajax4jsf.event.AjaxEvent;
public class Bean implements org.ajax4jsf.event.AjaxListener{
@@ -108,8 +105,7 @@
//Custom Developer Code
}
...
-}
-]]></programlisting>
+}]]></programlisting>
</section>
<section>
Modified: trunk/docs/userguide/en/src/main/docbook/included/commandButton.xml
===================================================================
--- trunk/docs/userguide/en/src/main/docbook/included/commandButton.xml 2009-03-30 23:18:08 UTC (rev 13312)
+++ trunk/docs/userguide/en/src/main/docbook/included/commandButton.xml 2009-03-31 09:34:42 UTC (rev 13313)
@@ -54,8 +54,7 @@
<programlisting role="JAVA"><![CDATA[import org.ajax4jsf.component.html.HtmlAjaxCommandButton;
...
HtmlAjaxCommandButton myButton = new HtmlAjaxCommandButton();
-...
-]]></programlisting>
+...]]></programlisting>
</section>
<section>
<title>Key attributes and ways of usage</title>
@@ -77,12 +76,9 @@
</para>
<programlisting role="XML"><![CDATA[...
<h:form id="form">
- <a4j:commandButton id="cbutton" action="director.rollCamera"
- onclick="this.disabled=true"
- oncomplete="this.disabled=false" />
+ <a4j:commandButton id="cbutton" action="director.rollCamera" onclick="this.disabled=true" oncomplete="this.disabled=false" />
</h:form>
-...
-]]></programlisting>
+...]]></programlisting>
<para>
Otherwise if the <property>commandButton</property> contained in re-rendered region
the <emphasis><property>"oncomplete"</property></emphasis> attribute has a problem obtaining a reference of the <property>commandButton</property> object
@@ -90,12 +86,11 @@
</para>
<programlisting role="XML"><![CDATA[...
<h:form id="form">
-<a4j:commandButton id="cbutton" action="director.rollCamera"
+ <a4j:commandButton id="cbutton" action="director.rollCamera"
onclick="this.disabled=true"
oncomplete="document.getElementById('form:cbutton').disabled=false" />
</h:form>
-...
-]]></programlisting>
+...]]></programlisting>
<para>Common JSF navigation could be performed after an Ajax submit and partial rendering, but Navigation Case must be defined as <emphasis role="bold"><property><redirect/></property></emphasis> in order to avoid problems with some browsers.</para>
<para>As any Core Ajax component sending Ajax requests and processing server responses
<emphasis role="bold"><property><a4j:commandButton></property></emphasis> has all attributes described above
Modified: trunk/docs/userguide/en/src/main/docbook/included/include.xml
===================================================================
--- trunk/docs/userguide/en/src/main/docbook/included/include.xml 2009-03-30 23:18:08 UTC (rev 13312)
+++ trunk/docs/userguide/en/src/main/docbook/included/include.xml 2009-03-31 09:34:42 UTC (rev 13313)
@@ -44,8 +44,7 @@
</para>
<programlisting role="XML"><![CDATA[<h:panelGroup id="wizard">
<a4j:include viewId="/pages/include/first.xhtml" />
-</h:panelGroup>
-]]></programlisting>
+</h:panelGroup>]]></programlisting>
<para>For navigation inside a page defined in viewId any components responsible for Ajax requests to the server generation are used.</para>
<para>For example, the following component on a page <code>"/pages/include/first.xhtml"</code></para>
@@ -54,21 +53,19 @@
</para>
<programlisting role="XML"><![CDATA[...
<a4j:commandButton action="next" reRender="wizard"/>
-...
-]]></programlisting>
+...]]></programlisting>
<para>And in faces-config it's defined:</para>
<para>
<emphasis role="bold">Example:</emphasis>
</para>
<programlisting role="XML"><![CDATA[<navigation-rule>
- <from-view-id>/pages/include/first.xhtml</from-view-id>
- <navigation-case>
- <from-outcome>next</from-outcome>
- <to-view-id>/pages/include/second.xhtml</to-view-id>
- </navigation-case>
- </navigation-rule>
-]]></programlisting>
+ <from-view-id>/pages/include/first.xhtml</from-view-id>
+ <navigation-case>
+ <from-outcome>next</from-outcome>
+ <to-view-id>/pages/include/second.xhtml</to-view-id>
+ </navigation-case>
+</navigation-rule>]]></programlisting>
<para>In this case after a click on a button defined inside <code>"first.xhtml"</code> view, navigation is performed after an Ajax request (the same as standard JSF one) only inside this view.</para>
</section>
<section>
Modified: trunk/docs/userguide/en/src/main/docbook/included/jsFunction.xml
===================================================================
--- trunk/docs/userguide/en/src/main/docbook/included/jsFunction.xml 2009-03-30 23:18:08 UTC (rev 13312)
+++ trunk/docs/userguide/en/src/main/docbook/included/jsFunction.xml 2009-03-31 09:34:42 UTC (rev 13313)
@@ -49,8 +49,10 @@
</script>
</head>
<body>
-...
-<a4j:jsFunction data="#{bean.someProperty}" name="callScript" oncomplete="myScript(data.subProperty1, data.subProperty2)"/>
+ ...
+ <a4j:jsFunction data="#{bean.someProperty}" name="callScript" oncomplete="myScript(data.subProperty1, data.subProperty2)"/>
+ ...
+</body>
...]]>
</programlisting>
<para> The script <code>"myScript"</code> is called after
@@ -66,8 +68,7 @@
<programlisting role="JAVA"><![CDATA[import org.ajax4jsf.component.html.HtmlajaxFunction;
...
HtmlajaxFunction myFunction = new HtmlajaxFunction();
-...
-]]></programlisting>
+...]]></programlisting>
</section>
<section>
<title>Key attributes and ways of usage</title>
@@ -83,12 +84,12 @@
<body onload="callScript()">
...
<h:form>
- ...
- <a4j:jsFunction name="callScript" data="#{bean.someProperty1}"
- reRender="someComponent" oncomplete="myScript(data.subProperty1, data.subProperty2)">
- <a4j:actionparam name="param_name" assignTo="#{bean.someProperty2}"/>
- </a4j:jsFunction>
- ...
+ ...
+ <a4j:jsFunction name="callScript" data="#{bean.someProperty1}"
+ reRender="someComponent" oncomplete="myScript(data.subProperty1, data.subProperty2)">
+ <a4j:actionparam name="param_name" assignTo="#{bean.someProperty2}"/>
+ </a4j:jsFunction>
+ ...
</h:form>
...
</body>
Modified: trunk/docs/userguide/en/src/main/docbook/included/keepAlive.xml
===================================================================
--- trunk/docs/userguide/en/src/main/docbook/included/keepAlive.xml 2009-03-30 23:18:08 UTC (rev 13312)
+++ trunk/docs/userguide/en/src/main/docbook/included/keepAlive.xml 2009-03-31 09:34:42 UTC (rev 13313)
@@ -90,8 +90,7 @@
a legal JSF EL expression which resolves to a managed mean instance.
For example for the above code the class definition may look like this
one: </para>
- <programlisting role="JAVA"><![CDATA[
-class MyClass{
+ <programlisting role="JAVA"><![CDATA[class MyClass{
...
private TestBean testBean;
// Getters and Setters for testBean.
Modified: trunk/docs/userguide/en/src/main/docbook/included/outputPanel.xml
===================================================================
--- trunk/docs/userguide/en/src/main/docbook/included/outputPanel.xml 2009-03-30 23:18:08 UTC (rev 13312)
+++ trunk/docs/userguide/en/src/main/docbook/included/outputPanel.xml 2009-03-31 09:34:42 UTC (rev 13313)
@@ -52,14 +52,12 @@
<para>
<emphasis role="bold">Example:</emphasis>
</para>
- <programlisting role="XML"><![CDATA[ <a4j:outputPanel>
- <h:form>
- <h:outputText value="Some text"/>
- <h:inputText id="text1" label="text1" value="#{rsBean.text1}">
- </h:inputText>
- </h:form>
- </a4j:outputPanel>
-]]></programlisting>
+ <programlisting role="XML"><![CDATA[<a4j:outputPanel>
+ <h:form>
+ <h:outputText value="Some text"/>
+ <h:inputText id="text1" label="text1" value="#{rsBean.text1}"/>
+ </h:form>
+</a4j:outputPanel>]]></programlisting>
</section>
<section>
<title>Creating the Component Dynamically Using Java</title>
@@ -69,8 +67,7 @@
</para>
<programlisting role="JAVA"><![CDATA[import org.ajax4jsf.component.html.HtmlAjaxOutputPanel;
...
-HtmlAjaxOutputPanel myPanel = new HtmlAjaxOutputPanel();
-]]></programlisting>
+HtmlAjaxOutputPanel myPanel = new HtmlAjaxOutputPanel();]]></programlisting>
</section>
<section>
<title>Key attributes and ways of usage</title>
@@ -102,11 +99,10 @@
<programlisting role="XML"><![CDATA[<a4j:support ... reRender="mypanel"/>
...
<a4j:outputPanel id="mypanel">
- <h:panelGrid rendered="#{not empty foo.bar}">
- ...
- </h:panelGrid>
-</a4j:outputPanel>
-]]></programlisting>
+ <h:panelGrid rendered="#{not empty foo.bar}">
+ ...
+ </h:panelGrid>
+</a4j:outputPanel>]]></programlisting>
<para>
In addition to the areas directly indicated in
<emphasis>
@@ -128,9 +124,8 @@
<emphasis role="bold">Example:</emphasis>
</para>
<programlisting role="XML"><![CDATA[<a4j:outputPanel ajaxRendered="true">
- <h:messages/>
-</a4j:outputPanel>
-]]></programlisting>
+ <h:messages/>
+</a4j:outputPanel>]]></programlisting>
<para>
On default
<emphasis role="bold">
@@ -195,11 +190,10 @@
<programlisting role="XML"><![CDATA[<a4j:support .... reRender="mypanel"/>
...
<a4j:outputPanel layout="none">
- <h:panelGrid id="mypanel" rendered="#{not empty foo.bar}">
- ...
- </h:panelGrid>
-</a4j:outputPanel>
-]]></programlisting>
+ <h:panelGrid id="mypanel" rendered="#{not empty foo.bar}">
+ ...
+ </h:panelGrid>
+</a4j:outputPanel>]]></programlisting>
<para>
As you see, the code is very similar to the one shown above,
but
Modified: trunk/docs/userguide/en/src/main/docbook/included/poll.xml
===================================================================
--- trunk/docs/userguide/en/src/main/docbook/included/poll.xml 2009-03-30 23:18:08 UTC (rev 13312)
+++ trunk/docs/userguide/en/src/main/docbook/included/poll.xml 2009-03-31 09:34:42 UTC (rev 13313)
@@ -60,8 +60,7 @@
<programlisting role="JAVA"><![CDATA[import org.ajax4jsf.component.html.AjaxPoll;
...
AjaxPoll myPoll = new AjaxPoll();
-...
-]]></programlisting>
+...]]></programlisting>
</section>
<section>
<title>Key attributes and ways of usage</title>
@@ -106,28 +105,27 @@
</para>
<programlisting role="XML"><![CDATA[...
- <a4j:region>
- <h:form>
+<a4j:region>
+ <h:form>
<a4j:poll id="poll" interval="1000" enabled="#{userBean.pollEnabled}" reRender="poll,grid"/>
- </h:form>
- </a4j:region>
- <h:form>
- <h:panelGrid columns="2" width="80%" id="grid">
- <h:panelGrid columns="1">
- <h:outputText value="Polling Inactive" rendered="#{not userBean.pollEnabled}"></h:outputText>
- <h:outputText value="Polling Active" rendered="#{userBean.pollEnabled}"></h:outputText>
+ </h:form>
+</a4j:region>
+<h:form>
+ <h:panelGrid columns="2" width="80%" id="grid">
+ <h:panelGrid columns="1">
+ <h:outputText value="Polling Inactive" rendered="#{not userBean.pollEnabled}" />
+ <h:outputText value="Polling Active" rendered="#{userBean.pollEnabled}" />
<a4j:commandButton style="width:120px" id="control"
- value="#{userBean.pollEnabled?'Stop':'Start'} Polling"
- reRender="poll, grid">
- <a4j:actionparam name="polling" value="#{!userBean.pollEnabled}"
- assignTo="#{userBean.pollEnabled}"/>
+ value="#{userBean.pollEnabled?'Stop':'Start'} Polling"
+ reRender="poll, grid">
+ <a4j:actionparam name="polling" value="#{!userBean.pollEnabled}"
+ assignTo="#{userBean.pollEnabled}"/>
</a4j:commandButton>
- </h:panelGrid>
- <h:outputText id="serverDate" style="font-size:16px" value="Server Date: #{userBean.date}"/>
- </h:panelGrid>
- </h:form>
-...
-]]></programlisting>
+ </h:panelGrid>
+ <h:outputText id="serverDate" style="font-size:16px" value="Server Date: #{userBean.date}"/>
+ </h:panelGrid>
+</h:form>
+...]]></programlisting>
<para>The example shows how date and time are updated on a page in compliance with data taken
from a server. The <emphasis role="bold">
Modified: trunk/docs/userguide/en/src/main/docbook/included/portlet.xml
===================================================================
--- trunk/docs/userguide/en/src/main/docbook/included/portlet.xml 2009-03-30 23:18:08 UTC (rev 13312)
+++ trunk/docs/userguide/en/src/main/docbook/included/portlet.xml 2009-03-31 09:34:42 UTC (rev 13313)
@@ -34,13 +34,11 @@
<section>
<title>Creating the Component with a Page Tag</title>
<para>To create the simplest variant on a page use the following syntax:</para>
- <programlisting role="XML"><![CDATA[
-<f:view>
- <a4j:portlet>
- ...
- </a4j:portlet>
-</f:view>
-]]></programlisting>
+ <programlisting role="XML"><![CDATA[<f:view>
+ <a4j:portlet>
+ ...
+ </a4j:portlet>
+</f:view>]]></programlisting>
</section>
<section>
Modified: trunk/docs/userguide/en/src/main/docbook/included/push.xml
===================================================================
--- trunk/docs/userguide/en/src/main/docbook/included/push.xml 2009-03-30 23:18:08 UTC (rev 13312)
+++ trunk/docs/userguide/en/src/main/docbook/included/push.xml 2009-03-31 09:34:42 UTC (rev 13313)
@@ -80,8 +80,8 @@
System.out.println(evt.getSource());
//Some action
}
-...
-]]></programlisting>
+}
+...]]></programlisting>
<para>Code for <code>EventListener</code> registration in the bean is placed
below:</para>
@@ -91,11 +91,12 @@
<programlisting role="JAVA"><![CDATA[...
public void addListener(EventListener listener) {
synchronized (listener) {
- if (this.listener != listener) {
- this.listener = (PushEventListener) listener;
+ if (this.listener != listener) {
+ this.listener = (PushEventListener) listener;
+ }
+ }
}
-...
-]]></programlisting>
+...]]></programlisting>
<para>A page code for this example is placed below.</para>
@@ -103,20 +104,19 @@
<emphasis role="bold">Example:</emphasis>
</para>
<programlisting role="XML"><![CDATA[...
- <a4j:status startText="in progress" stopText="done"/>
+<a4j:status startText="in progress" stopText="done"/>
<a4j:form>
- <a4j:region>
- <a4j:push reRender="msg" eventProducer="#{pushBean.addListener}" interval="2000"/>
- </a4j:region>
- <a4j:outputPanel id="msg" >
- <h:outputText value="#{pushBean.date}">
- <f:convertDateTime type="time"/>
- </h:outputText>
- </a4j:outputPanel>
- <a4j:commandButton value="Push!!" action="#{pushBean.push}" ajaxSingle="true"/>
- </a4j:form>
-...
-]]></programlisting>
+ <a4j:region>
+ <a4j:push reRender="msg" eventProducer="#{pushBean.addListener}" interval="2000"/>
+ </a4j:region>
+ <a4j:outputPanel id="msg" >
+ <h:outputText value="#{pushBean.date}">
+ <f:convertDateTime type="time"/>
+ </h:outputText>
+ </a4j:outputPanel>
+ <a4j:commandButton value="Push!!" action="#{pushBean.push}" ajaxSingle="true"/>
+</a4j:form>
+...]]></programlisting>
<para>The example shows how date is updated on a page in compliance with data
taken from a server. In the example <emphasis>
Modified: trunk/docs/userguide/en/src/main/docbook/included/region.xml
===================================================================
--- trunk/docs/userguide/en/src/main/docbook/included/region.xml 2009-03-30 23:18:08 UTC (rev 13312)
+++ trunk/docs/userguide/en/src/main/docbook/included/region.xml 2009-03-31 09:34:42 UTC (rev 13313)
@@ -38,11 +38,11 @@
<section>
<title>Creating on a page</title>
<para>Here is an example of the region decoding on a page. </para>
- <programlisting role="XML"><![CDATA[ <a4j:region>
- <h:inputText value="#{userBean.name}">
- <a4j:support event="onkeyup" reRender="outname" />
- </h:inputText>
- </a4j:region>]]></programlisting>
+ <programlisting role="XML"><![CDATA[<a4j:region>
+ <h:inputText value="#{userBean.name}">
+ <a4j:support event="onkeyup" reRender="outname" />
+ </h:inputText>
+</a4j:region>]]></programlisting>
</section>
<section>
<title>Creating the Component Dynamically Using Java</title>
@@ -53,8 +53,7 @@
<programlisting role="JAVA"><![CDATA[import org.ajax4jsf.component.html.HtmlAjaxRegion;
...
HtmlAjaxRegion newRegion = new HtmlAjaxRegion();
-...
-]]></programlisting>
+...]]></programlisting>
</section>
<section>
<title>Key attributes and ways of usage</title>
@@ -72,10 +71,10 @@
</itemizedlist></para>
<para><emphasis role="bold">Example:</emphasis></para>
<programlisting role="XML"><![CDATA[<h:form id="form1">
- <a4j:region>
- <a4j:commandLink reRender="someID" value="Link" id="link1"/>
- <!--..Some content that will be decoded on server after Ajax request.-->
- </a4j:region>
+ <a4j:region>
+ <a4j:commandLink reRender="someID" value="Link" id="link1"/>
+ <!--..Some content that will be decoded on server after Ajax request.-->
+ </a4j:region>
<h:form>]]></programlisting>
<para>Hence, the <emphasis role="bold">
<property><a4j:commandLink></property>
@@ -83,12 +82,12 @@
<para>The regions could be nested in any order, the server picks out and decodes only the region, which contains a particular component that sends a request.</para>
<para><emphasis role="bold">Example:</emphasis></para>
<programlisting role="XML"><![CDATA[<a4j:region>
- <a4j:commandLink reRender="someID" value="Link" id="link1"/>
- <a4j:region>
- <a4j:commandLink reRender="someID" value="Link" id="link2"/>
- <!--..Some content that will be decoded on server after Ajax request.-->
- </a4j:region >
- <!--..Some content that will be decoded on server after Ajax request.-->
+ <a4j:commandLink reRender="someID" value="Link" id="link1"/>
+ <a4j:region>
+ <a4j:commandLink reRender="someID" value="Link" id="link2"/>
+ <!--..Some content that will be decoded on server after Ajax request.-->
+ </a4j:region >
+ <!--..Some content that will be decoded on server after Ajax request.-->
</a4j:region >]]></programlisting>
<para>Therefore, the external region is decoded for the <code>"link1"</code> and the internal one is decoded for the <code>"link2"</code>.</para>
<para>RichFaces allows setting Ajax responses rendering directly basing on component tree nodes without referring to the JSP (XHTML) page code. It could be defined by<emphasis><property> "selfRendered" </property></emphasis>attribute setting to "true" on <emphasis role="bold">
@@ -99,8 +98,8 @@
</para>
<para><emphasis role="bold">Example:</emphasis></para>
<programlisting role="XML"><![CDATA[<a4j:region selfRendered ="true">
- <a4j:commandLink reRender="someID" value="Link" id="link1"/>
- <!--..Some content with HTML used ("br","h1" and other tags used)-->
+ <a4j:commandLink reRender="someID" value="Link" id="link1"/>
+ <!--..Some content with HTML used ("br","h1" and other tags used)-->
</a4j:region >]]></programlisting>
<para>In this case, the processing is quicker and going on without referring to a page code, but the HTML code that isn't saved in a component tree could be lost. Thus, this optimization should be very carefully performed and a usage of the additional components RichFaces (<emphasis role="bold"><property><a4j:outputPanel></property></emphasis>) is required. </para>
<para>The processing could be also accelerated if a region decoded for the processing passes straight away into Encode. But to update some data out of the region or on another region, use the <emphasis >
@@ -109,14 +108,12 @@
attribute set to "false" ("true" on default) to change this behaviour.</para>
<para><emphasis role="bold">Example:</emphasis></para>
<programlisting role="XML"><![CDATA[<a4j:region renderRegionOnly="true">
- <a4j:commandLink reRender="someID2" value="Link1" id="link1"/>
- <h:panelGroup id="someId1">
- </h:panelGroup>
+ <a4j:commandLink reRender="someID2" value="Link1" id="link1"/>
+ <h:panelGroup id="someId1" />
</a4j:region>
<a4j:region renderRegionOnly="false">
- <a4j:commandLink reRender="someID1" value="Link2" id="link2"/>
- <h:panelGroup id="someId1">
- </h:panelGroup>
+ <a4j:commandLink reRender="someID1" value="Link2" id="link2"/>
+ <h:panelGroup id="someId1" />
</a4j:region>]]></programlisting>
<para>This example shows that one of the regions is decoded when a link is used inside. Nevertheless,
if after processing the <code>"link1"</code> is clicked, the first region passes into Encode as a root
Modified: trunk/docs/userguide/en/src/main/docbook/modules/RFCSettings.xml
===================================================================
--- trunk/docs/userguide/en/src/main/docbook/modules/RFCSettings.xml 2009-03-30 23:18:08 UTC (rev 13312)
+++ trunk/docs/userguide/en/src/main/docbook/modules/RFCSettings.xml 2009-03-31 09:34:42 UTC (rev 13313)
@@ -87,11 +87,12 @@
<para>
<emphasis role="bold">Example:</emphasis>
</para>
- <programlisting role="XML">
- <context-param>
- <param-name>org.ajax4jsf.VIEW_HANDLERS</param-name>
- <param-value>com.sun.facelets.FaceletViewHandler</param-value>
- </context-param>
+ <programlisting role="XML"><![CDATA[...
+ <context-param>
+ <param-name>org.ajax4jsf.VIEW_HANDLERS</param-name>
+ <param-value>com.sun.facelets.FaceletViewHandler</param-value>
+ </context-param>
+...]]>
</programlisting>
<para> says that <property>Facelets</property> will officially be the first,
however <code>AjaxViewHandler</code> will be a little ahead
@@ -275,7 +276,7 @@
<emphasis role="bold">Example:</emphasis>
</para>
<programlisting role="XML"><![CDATA[...
- <servlet>
+ <servlet>
<servlet-name>Faces Servlet</servlet-name>
<servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
<load-on-startup>0</load-on-startup>
Modified: trunk/docs/userguide/en/src/main/docbook/modules/RFCarchitectover.xml
===================================================================
--- trunk/docs/userguide/en/src/main/docbook/modules/RFCarchitectover.xml 2009-03-30 23:18:08 UTC (rev 13312)
+++ trunk/docs/userguide/en/src/main/docbook/modules/RFCarchitectover.xml 2009-03-31 09:34:42 UTC (rev 13313)
@@ -222,13 +222,12 @@
</emphasis> attribute is an id of the JSF component or an id list. </para>
<para>A simple example is placed below:</para>
<programlisting role="XML"><![CDATA[...
- <a4j:commandButton value="update" reRender="infoBlock"/>
- ...
- <h:panelGrid id="infoBlock">
- ...
- </h:panelGrid>
+<a4j:commandButton value="update" reRender="infoBlock"/>
...
-]]></programlisting>
+<h:panelGrid id="infoBlock">
+ ...
+</h:panelGrid>
+...]]></programlisting>
<para> The value of <emphasis>
<property>"reRender"</property>
</emphasis> attribute of the <emphasis role="bold">
@@ -254,24 +253,23 @@
it more precisely. The following example shows the difference in approaches (both
buttons will work successfully): </para>
<programlisting role="XML"><![CDATA[...
- <h:form id="form1">
- ...
- <a4j: commandButton value="Usual Way" reRender="infoBlock, infoBlock2" />
- <a4j:commandButton value="Shortcut" reRender=":infoBlockl,:sv:infoBlock2" />
- ...
- </h:form>
- <h:panelGrid id="infoBlock">
- ...
- </h:panelGrid>
+<h:form id="form1">
+ ...
+ <a4j: commandButton value="Usual Way" reRender="infoBlock, infoBlock2" />
+ <a4j:commandButton value="Shortcut" reRender=":infoBlockl,:sv:infoBlock2" />
...
- <f:subview id="sv">
- <h:panelGrid id="infoBlock2">
- ...
- </h:panelGrid>
- ...
- </f:subview>
+</h:form>
+<h:panelGrid id="infoBlock">
+ ...
+</h:panelGrid>
...
-]]></programlisting>
+<f:subview id="sv">
+ <h:panelGrid id="infoBlock2">
+ ...
+ </h:panelGrid>
+ ...
+</f:subview>
+...]]></programlisting>
<para> It's also possible to use JSF EL expression as a value of the reRender
attribute. It might be a property of types Set, Collection, Array or simple String.
The EL for reRender is resolved right before the Render Response phase. Hence, you
@@ -304,11 +302,10 @@
on any Ajax request. For example, the following code allows to output error messages
regardless of what Ajax request causes the Validation phase failed. </para>
<programlisting role="XML"><![CDATA[...
- <a4j:outputPanel ajaxRendered="true">
- <h:messages />
- </a4j:outputPanel>
-...
-]]></programlisting>
+<a4j:outputPanel ajaxRendered="true">
+ <h:messages />
+</a4j:outputPanel>
+...]]></programlisting>
<para>
<emphasis>
<property>"limitToList"</property>
@@ -324,14 +321,13 @@
<code>ajaxRendered="true"</code> is ignored. An example is placed
below: </para>
<programlisting role="XML"><![CDATA[...
- <h:form>
- <h:inputText value="#{person.name}">
- <a4j:support event="onkeyup" reRender="test" limitToList="true"/>
- </h:inputText>
- <h:outputText value="#{person.name}" id="test"/>
- </form>
-...
-]]></programlisting>
+<h:form>
+ <h:inputText value="#{person.name}">
+ <a4j:support event="onkeyup" reRender="test" limitToList="true"/>
+ </h:inputText>
+ <h:outputText value="#{person.name}" id="test"/>
+</form>
+...]]></programlisting>
</section>
<section id="QueueandTrafficFloodProtection">
<?dbhtml filename="QueueandTrafficFloodProtection.html"?>
@@ -356,11 +352,10 @@
newest request will be sent to the server if you type very fast and has typed the
several characters already before the previous Ajax Response is back. </para>
<programlisting role="XML"><![CDATA[...
- <h:inputText value="#{userBean.name}">
- <a4j:support event="onkeyup" eventsQueue="foo" reRender="bar" />
- </h:inputText>
-...
-]]></programlisting>
+<h:inputText value="#{userBean.name}">
+ <a4j:support event="onkeyup" eventsQueue="foo" reRender="bar" />
+</h:inputText>
+...]]></programlisting>
<para>
<emphasis>
<property>"requestDelay"</property>
@@ -501,8 +496,7 @@
view using the following:</para>
<programlisting role="XML"><![CDATA[...
<a4j:queue name="org.richfaces.global_queue" disabled="true"... />
-...
-]]></programlisting>
+...]]></programlisting>
<para>Hence, to enable the queue for a single view page you need to define the
<property>"disable"</property> attribute with
"false". </para>
@@ -523,8 +517,7 @@
the forms in order not to be recognized as a form-based queue. </para>
<programlisting role="XML"><![CDATA[...
<a4j:queue ... />
-...
-]]></programlisting>
+...]]></programlisting>
</section>
<section>
<title>View scoped named queue</title>
@@ -550,12 +543,10 @@
<programlisting role="XML"><![CDATA[...
<a4j:queue name="sampleQueue"/>
-
<h:inputText value="#{bean.inputValue}" >
-<a4j:support id="inputSupport" event="onkeyup" eventsQueue="sample"/>
+ <a4j:support id="inputSupport" event="onkeyup" eventsQueue="sample"/>
</h:inputText>
<rich:comboBox value="#{bean.state}" suggestionValues="#{bean.suggestions}" eventsQueue="sample" />
-
...]]></programlisting>
<para>In this example, two components(<a4j:queue>,
<rich:comboBox>,) reference the named queue via the
@@ -589,8 +580,8 @@
</para>
<programlisting role="XML"><![CDATA[...
<h:form ... >
-<a4j:queue ... /><!-- note no name specified -->
- ...
+ <a4j:queue ... /><!-- note no name specified -->
+ ...
</h:form>
...]]></programlisting>
@@ -601,7 +592,7 @@
</para>
<programlisting role="XML"><![CDATA[...
<a4j:form eventsQueue="fooQueue" ...>
- ...
+ ...
</a4j:form>
...]]></programlisting>
<para>However the implementation of the queue allows you to reference a named queue from the form with a form-based queue.</para>
@@ -614,9 +605,9 @@
<a4j:queue name="sampleQueue" ... /> <!-- named queue -->
...
<h:form ... >
- <a4j:queue ... /><!-- form-based queue-->
- <a4j:commandButton ... > <!-- uses the form-based queue -->
- <a4j:commandButton eventsQueue="sampleQueue" > <!-- uses named queue -->
+ <a4j:queue ... /><!-- form-based queue-->
+ <a4j:commandButton ... /> <!-- uses the form-based queue -->
+ <a4j:commandButton eventsQueue="sampleQueue" /> <!-- uses named queue -->
</h:form>
...]]></programlisting>
@@ -742,14 +733,13 @@
<property><a4j:support></property>
</emphasis> , it is a value of the parent component. An example is placed below: </para>
<programlisting role="XML"><![CDATA[...
- <h:form>
- <h:inputText value="#{person.name}">
- <a4j:support event="onkeyup" reRender="test" ajaxSingle="true"/>
- </h:inputText>
- <h:inputText value="#{person.middleName}"/>
- </form>
-...
-]]></programlisting>
+<h:form>
+ <h:inputText value="#{person.name}">
+ <a4j:support event="onkeyup" reRender="test" ajaxSingle="true"/>
+ </h:inputText>
+ <h:inputText value="#{person.middleName}"/>
+</form>
+...]]></programlisting>
<para> In this example the request contains only the input component causes the request
generation, not all the components contained on a form, because of
<code>ajaxSingle="true"</code> usage. </para>
@@ -869,9 +859,8 @@
"true" or "false" , use the conditional statement to return
something only when you need to cancel the request. For example: </para>
<programlisting role="XML"><![CDATA[...
- onsubmit="if (mynosendfunct()==false){return false}"
-...
-]]></programlisting>
+onsubmit="if (mynosendfunct()==false){return false}"
+...]]></programlisting>
<para>
<emphasis>
<property>"onclick"</property>
@@ -903,9 +892,8 @@
<property>"data"</property>
</emphasis> variable. For example: </para>
<programlisting role="XML"><![CDATA[...
- <a4j:commandButton value="Update" data="#{userBean.name}" oncomplete="showTheName(data.name)" />
-...
-]]></programlisting>
+<a4j:commandButton value="Update" data="#{userBean.name}" oncomplete="showTheName(data.name)" />
+...]]></programlisting>
<para> RichFaces allows to serialize not only primitive types into JSON format, but also
complex types including arrays and collections. The beans should be serializable to
be refered with <emphasis>
@@ -936,7 +924,7 @@
taking the short ID of the component as a parameter. </para>
<programlisting role="XML"><![CDATA[...
<h:inputText id="myInput">
- <a4j:support event="onkeyup" reRender="outtext"/>
+ <a4j:support event="onkeyup" reRender="outtext"/>
</h:inputText>
<h:outputText id="outtext" value="#{rich:findComponent('myInput').value}" />
...]]></programlisting>
@@ -953,21 +941,20 @@
provides possibility to update several child components separately without updating
the whole page. </para>
<programlisting role="XML"><![CDATA[...
- <a4j:poll intervall="1000" action="#{repeater.action}" reRender="text">
- <table>
- <tbody>
- <a4j:repeat value="#{bean.props}" var="detail" ajaxKeys="#{repeater.ajaxedRowsSet}">
- <tr>
- <td>
- <h:outputText value="detail.someProperty" id="text"/>
- </td>
- </tr>
- </a4j:repeat>
- </tbody>
- </table>
- </a4j:poll>
-...
-]]></programlisting>
+<a4j:poll intervall="1000" action="#{repeater.action}" reRender="text">
+ <table>
+ <tbody>
+ <a4j:repeat value="#{bean.props}" var="detail" ajaxKeys="#{repeater.ajaxedRowsSet}">
+ <tr>
+ <td>
+ <h:outputText value="detail.someProperty" id="text"/>
+ </td>
+ </tr>
+ </a4j:repeat>
+ </tbody>
+ </table>
+</a4j:poll>
+...]]></programlisting>
</section>
<section id="Otherusefulattributes">
<?dbhtml filename="Otherusefulattributes.html"?>
@@ -987,35 +974,33 @@
</emphasis> component between different Ajax components from different regions. The
following example shows it. </para>
<programlisting role="XML"><![CDATA[...
- <a4j:region id="extr">
- <h:form>
- <h:outputText value="Status:" />
- <a4j:status id="commonstatus" startText="In Progress...." stopText=""/>
- <h:panelGrid columns="2">
- <h:outputText value="Name"/>
- <h:inputText id="name" value="#{userBean.name}">
- <a4j:support event="onkeyup" reRender="out" />
+<a4j:region id="extr">
+ <h:form>
+ <h:outputText value="Status:" />
+ <a4j:status id="commonstatus" startText="In Progress...." stopText=""/>
+ <h:panelGrid columns="2">
+ <h:outputText value="Name"/>
+ <h:inputText id="name" value="#{userBean.name}">
+ <a4j:support event="onkeyup" reRender="out" />
+ </h:inputText>
+ <h:outputText value="Job"/>
+ <a4j:region id="intr">
+ <h:inputText id="job" value="#{userBean.job}">
+ <a4j:support event="onkeyup" reRender="out" status="commonstatus"/>
</h:inputText>
- <h:outputText value="Job"/>
- <a4j:region id="intr">
- <h:inputText id="job" value="#{userBean.job}">
- <a4j:support event="onkeyup" reRender="out" status="commonstatus"/>
- </h:inputText>
- </a4j:region>
- </h:panelGrid>
-
- <a4j:region>
- <h:outputText id="out" value="Name: #{userBean.name}, Job: #{userBean.job}" />
- <br />
- <a4j:commandButton ajaxSingle="true" value="Clean Up Form" reRender="name, job, out" status="commonstatus">
- <a4j:actionparam name="n" value="" assignTo="#{userBean.name}" />
- <a4j:actionparam name="j" value="" assignTo="#{userBean.job}" />
- </a4j:commandButton>
</a4j:region>
- </h:form>
- </a4j:region>
-...
-]]></programlisting>
+ </h:panelGrid>
+ <a4j:region>
+ <h:outputText id="out" value="Name: #{userBean.name}, Job: #{userBean.job}" />
+ <br />
+ <a4j:commandButton ajaxSingle="true" value="Clean Up Form" reRender="name, job, out" status="commonstatus">
+ <a4j:actionparam name="n" value="" assignTo="#{userBean.name}" />
+ <a4j:actionparam name="j" value="" assignTo="#{userBean.job}" />
+ </a4j:commandButton>
+ </a4j:region>
+ </h:form>
+</a4j:region>
+...]]></programlisting>
<para> In the example <emphasis role="bold">
<property><a4j:support></property>
</emphasis> and <emphasis role="bold">
@@ -1306,13 +1291,12 @@
<emphasis role="bold">Example:</emphasis>
</para>
<programlisting role="XML"><![CDATA[...
- <filter>
- <display-name>RichFaces Filter</display-name>
- <filter-name>richfaces</filter-name>
- <filter-class>org.ajax4jsf.Filter</filter-class>
- </filter>
-...
-]]></programlisting>
+<filter>
+ <display-name>RichFaces Filter</display-name>
+ <filter-name>richfaces</filter-name>
+ <filter-class>org.ajax4jsf.Filter</filter-class>
+</filter>
+...]]></programlisting>
<note>
<title>Note:</title>
<para> Fast Filter is deprecated and available only for backward compatibility with
@@ -1352,50 +1336,43 @@
<emphasis role="bold">Example:</emphasis>
</para>
<programlisting role="XML"><![CDATA[...
- <context-param>
- <param-name>org.ajax4jsf.xmlparser.ORDER</param-name>
- <param-value>NONE,NEKO,TIDY</param-value>
- </context-param>
-
- <context-param>
- <param-name>org.ajax4jsf.xmlparser.NONE</param-name>
- <param-value>/pages/performance\.xhtml,/pages/default.*\.xhtml</param-value>
- </context-param>
-
- <context-param>
- <param-name>org.ajax4jsf.xmlparser.NEKO</param-name>
- <param-value>/pages/repeat\.xhtml</param-value>
- </context-param>
-
- <filter>
- <display-name>RichFaces Filter</display-name>
- <filter-name>richfaces</filter-name>
- <filter-class>org.ajax4jsf.Filter</filter-class>
- </filter>
-
- <filter-mapping>
- <filter-name>richfaces</filter-name>
- <servlet-name>Faces Servlet</servlet-name>
- <dispatcher>FORWARD</dispatcher>
- <dispatcher>REQUEST</dispatcher>
- <dispatcher>INCLUDE</dispatcher>
- </filter-mapping>
-...
-]]></programlisting>
+<context-param>
+ <param-name>org.ajax4jsf.xmlparser.ORDER</param-name>
+ <param-value>NONE,NEKO,TIDY</param-value>
+</context-param>
+<context-param>
+ <param-name>org.ajax4jsf.xmlparser.NONE</param-name>
+ <param-value>/pages/performance\.xhtml,/pages/default.*\.xhtml</param-value>
+</context-param>
+<context-param>
+ <param-name>org.ajax4jsf.xmlparser.NEKO</param-name>
+ <param-value>/pages/repeat\.xhtml</param-value>
+</context-param>
+<filter>
+ <display-name>RichFaces Filter</display-name>
+ <filter-name>richfaces</filter-name>
+ <filter-class>org.ajax4jsf.Filter</filter-class>
+</filter>
+<filter-mapping>
+ <filter-name>richfaces</filter-name>
+ <servlet-name>Faces Servlet</servlet-name>
+ <dispatcher>FORWARD</dispatcher>
+ <dispatcher>REQUEST</dispatcher>
+ <dispatcher>INCLUDE</dispatcher>
+</filter-mapping>
+...]]></programlisting>
<para> The example shows that <code>ORDER</code> parameter defines the order in which
particular filter types are used for pages code correction. </para>
<para> First of all "NONE" type is specified for the filter. Then two different
sets of pages are defined for which two filter types (NONE and NEKO) are used
correspondingly. If a page relates to the first set that is defined in the following
way: </para>
- <programlisting role="XML"><![CDATA[<param-value>/pages/performance\.xhtml,/pages/default.*\.xhtml</param-value>,
-]]></programlisting>
+ <programlisting role="XML"><![CDATA[<param-value>/pages/performance\.xhtml,/pages/default.*\.xhtml</param-value>]]></programlisting>
<para> it's not corrected, because filter type for this page is defined as
"NONE". If a page is not from the first set, then "NEKO" type is
set. </para>
<para> If a page relates to the second set that is defined in the following way: </para>
- <programlisting role="XML"><![CDATA[<param-value>/pages/repeat\.xhtml</param-value>,
-]]></programlisting>
+ <programlisting role="XML"><![CDATA[<param-value>/pages/repeat\.xhtml</param-value>]]></programlisting>
<para> then "NEKO" filter type is used for correction. If it's not related to
the second set, "TIDY" type is set for the filter ("TIDY" filter
type is used for code correction). </para>
@@ -1412,21 +1389,19 @@
</para>
<para> The following declaration in your web.xml allows loading the integrated script files. </para>
<programlisting role="XML"><![CDATA[...
- <context-param>
- <param-name>org.richfaces.LoadScriptStrategy</param-name>
- <param-value>ALL</param-value>
- </context-param>
-...
-]]></programlisting>
+<context-param>
+ <param-name>org.richfaces.LoadScriptStrategy</param-name>
+ <param-value>ALL</param-value>
+</context-param>
+...]]></programlisting>
<para> If you do not declare the <code>org.richfaces.LoadScriptStrategy</code> in the
web.xml, it equals to: </para>
<programlisting role="XML"><![CDATA[...
- <context-param>
- <param-name>org.richfaces.LoadScriptStrategy</param-name>
- <param-value>DEFAULT</param-value>
- </context-param>
-...
-]]></programlisting>
+<context-param>
+ <param-name>org.richfaces.LoadScriptStrategy</param-name>
+ <param-value>DEFAULT</param-value>
+</context-param>
+...]]></programlisting>
<para> The third possible value is "NONE". You have no a special reason to use it
unless you obtain the newest (or modified) version of the script and want to include it
manually in a page header. </para>
@@ -1447,12 +1422,11 @@
</para>
<para> The following declaration allows to load only one integrated style sheet file. </para>
<programlisting role="XML"><![CDATA[...
- <context-param>
- <param-name>org.richfaces.LoadStyleStrategy</param-name>
- <param-value>ALL</param-value>
- </context-param>
-...
-]]></programlisting>
+<context-param>
+ <param-name>org.richfaces.LoadStyleStrategy</param-name>
+ <param-value>ALL</param-value>
+</context-param>
+...]]></programlisting>
<para> The integrated style sheet contains style for all shipped components. The
skinnability feature still works. </para>
<para> The "DEFAULT" value is a classical on-demand variant. </para>
@@ -1641,8 +1615,7 @@
<para>
<emphasis role="bold">Example:</emphasis>
</para>
- <programlisting role="XML">
- <rich:panel> ... </rich:panel>
+ <programlisting role="XML"><![CDATA[<rich:panel> ... </rich:panel>]]>
</programlisting>
<para> The code generates a panel component on a page, which consists of two elements: a
wrapper <emphasis role="bold">
@@ -1657,7 +1630,7 @@
<emphasis role="bold">Example:</emphasis>
</para>
<programlisting role="XML">
- <div class="dr-pnl rich-panel"> ... </div>
+ <![CDATA[<div class="dr-pnl rich-panel"> ... </div>]]>
</programlisting>
<para> dr-pnl is a CSS class specified in the framework via skin parameters: </para>
<itemizedlist>
@@ -1686,8 +1659,7 @@
<emphasis role="bold">Example:</emphasis>
</para>
<programlisting role="XML">
- <rich:panel styleClass="customClass"> ...
- </rich:panel>
+ <![CDATA[<rich:panel styleClass="customClass" />]]>
</programlisting>
<para> Could add some style properties from customClass to one particular panel, as a
result we get three styles: </para>
@@ -1695,8 +1667,9 @@
<emphasis role="bold">Example:</emphasis>
</para>
<programlisting role="XML">
- <div class="dr_pnl rich-panel customClass"> ...
- </div>
+<![CDATA[<div class="dr_pnl rich-panel customClass">
+ ...
+</div>]]>
</programlisting>
</section>
<section id="SkinParametersTablesInRichFaces">
@@ -1929,12 +1902,11 @@
<emphasis role="bold">Example:</emphasis>
</para>
<programlisting role="XML"><![CDATA[...
- <context-param>
- <param-name>org.richfaces.SKIN</param-name>
- <param-value>name</param-value>
- </context-param>
-...
-]]></programlisting>
+<context-param>
+ <param-name>org.richfaces.SKIN</param-name>
+ <param-value>name</param-value>
+</context-param>
+...]]></programlisting>
</listitem>
<listitem>
<para> Put your <code><name>.skin.properties</code> file in one of the
@@ -1967,8 +1939,8 @@
<para> Create a custom render kit and register it in the faces-config.xml like
this: </para>
<programlisting role="XML"><![CDATA[<render-kit>
- <render-kit-id>NEW_SKIN</render-kit-id>
- <render-kit-class>
+ <render-kit-id>NEW_SKIN</render-kit-id>
+ <render-kit-class>
org.ajax4jsf.framework.renderer.ChameleonRenderKitImpl
</render-kit-class>
</render-kit>]]></programlisting>
@@ -1977,11 +1949,9 @@
<para> Then you need to create and register custom renderers for the component
based on the look-and-feel predefined variables: </para>
<programlisting role="XML"><![CDATA[<renderer>
- <component-family>javax.faces.Command</component-family>
- <renderer-type>javax.faces.Link</renderer-type>
- <renderer-class>
- newskin.HtmlCommandLinkRenderer
- </renderer-class>
+ <component-family>javax.faces.Command</component-family>
+ <renderer-type>javax.faces.Link</renderer-type>
+ <renderer-class>newskin.HtmlCommandLinkRenderer</renderer-class>
</renderer>]]></programlisting>
</listitem>
<listitem>
@@ -2019,8 +1989,8 @@
For example:
</para>
<programlisting role="XML"><![CDATA[<context-param>
- <param-name>org.richfaces.SKIN</param-name>
- <param-value>#{skinBean.skin}</param-value>
+ <param-name>org.richfaces.SKIN</param-name>
+ <param-value>#{skinBean.skin}</param-value>
</context-param>]]>
</programlisting>
<para>
@@ -2042,13 +2012,13 @@
For example, "classic":
</para>
<programlisting role="XML"><![CDATA[<managed-bean>
- <managed-bean-name>skinBean</managed-bean-name>
- <managed-bean-class>SkinBean</managed-bean-class>
- <managed-bean-scope>session</managed-bean-scope>
- <managed-property>
- <property-name>skin</property-name>
- <value>classic</value>
- </managed-property>
+ <managed-bean-name>skinBean</managed-bean-name>
+ <managed-bean-class>SkinBean</managed-bean-class>
+ <managed-bean-scope>session</managed-bean-scope>
+ <managed-property>
+ <property-name>skin</property-name>
+ <value>classic</value>
+ </managed-property>
</managed-bean>]]>
</programlisting>
<para>
@@ -2277,7 +2247,6 @@
<u:style name="background-color" skin="generalBackgroundColor" />
</u:selector>
...
-
//gradient elements
...
<u:selector name=".rich-gradient-menu">
@@ -2286,7 +2255,6 @@
</u:style>
<u:style name="background-repeat" value="repeat-x" />
</u:selector>
-
<u:selector name=".rich-gradient-tab">
<u:style name="background-image">
<f:resource f:key="org.richfaces.renderkit.html.gradientimages.TabGradientImage"/>
@@ -3166,8 +3134,7 @@
<param-name>org.richfaces.LoadStyleStrategy</param-name>
<param-value>NONE</param-value>
</context-param>
-...
-]]></programlisting>
+...]]></programlisting>
<para> Additionally, you should include the style sheets that perform skinning of the
RichFaces component and standard HTML controls. </para>
<para> In order to resolve the problem with extended skinning in Opera and Safari a
@@ -3175,11 +3142,9 @@
the browser type and enables extended skinning only for those browsers that fully
support it. </para>
<para> The script can be activated by inserting this JavaScript code to the page: </para>
- <programlisting role="XML"><![CDATA[
-<script type="text/javascript">
-window.RICH_FACES_EXTENDED_SKINNING_ON = true;
-</script>
-]]></programlisting>
+ <programlisting role="XML"><![CDATA[<script type="text/javascript">
+ window.RICH_FACES_EXTENDED_SKINNING_ON = true;
+</script>]]></programlisting>
<para> When NO script loading strategy is used and extended skinning is turned on then
corresponding warning message will appears in the console. </para>
<para> You also need to specify <emphasis>
@@ -3190,11 +3155,9 @@
"rich-extended-skinning". </para>
<para> This is how you can include the style sheets to the page, in case automatic
skinnability implementation is disabled. </para>
- <programlisting role="XML"><![CDATA[
-<link href='/YOUR_PROJECT_NAME/a4j_3_2_2-SNAPSHOTorg/richfaces/renderkit/html/css/basic_both.xcss/DATB/eAF7sqpgb-jyGdIAFrMEaw__.jsf' type='text/css' rel='stylesheet' class='component' />
+ <programlisting role="XML"><![CDATA[<link href='/YOUR_PROJECT_NAME/a4j_3_2_2-SNAPSHOTorg/richfaces/renderkit/html/css/basic_both.xcss/DATB/eAF7sqpgb-jyGdIAFrMEaw__.jsf' type='text/css' rel='stylesheet' class='component' />
<link media='rich-extended-skinning' href='/ YOUR_PROJECT_NAME /a4j_3_2_2-SNAPSHOTorg/richfaces/renderkit/html/css/extended_both.xcss/DATB/eAF7sqpgb-jyGdIAFrMEaw__.jsf' type='text/css' rel='stylesheet' class='component' />
-<link href='/ YOUR_PROJECT_NAME /a4j_3_2_2-SNAPSHOT/org/richfaces/skin.xcss/DATB/eAF7sqpgb-jyGdIAFrMEaw__.jsf' type='text/css' rel='stylesheet' class='component' />
-]]></programlisting>
+<link href='/ YOUR_PROJECT_NAME /a4j_3_2_2-SNAPSHOT/org/richfaces/skin.xcss/DATB/eAF7sqpgb-jyGdIAFrMEaw__.jsf' type='text/css' rel='stylesheet' class='component' />]]></programlisting>
<note>
<para> Now it's necessary to use <code>a4j/versionXXX</code> resources prefix instead of
<code>a4j_versionXXX</code>. Base64 encoder changed to use
@@ -3217,25 +3180,23 @@
</emphasis> XML tags that form the mapping structure. Please study the example
below. </para>
<programlisting role="XML"><![CDATA[...
- <u:selector name=".rich-component-name">
- <u:style name="background-color" skin="additionalBackgroundColor" />
- <u:style name="border-color" skin="tableBorderColor" />
- <u:style name="border-width" skin="tableBorderWidth" />
- <u:style name="border-style" value="solid" />
- </u:selector>
-...
-]]></programlisting>
+<u:selector name=".rich-component-name">
+ <u:style name="background-color" skin="additionalBackgroundColor" />
+ <u:style name="border-color" skin="tableBorderColor" />
+ <u:style name="border-width" skin="tableBorderWidth" />
+ <u:style name="border-style" value="solid" />
+</u:selector>
+...]]></programlisting>
<para> During processing the code in the shown example is parsed into a standard
CSS format. </para>
<programlisting role="CSS"><![CDATA[...
.rich-component-name {
-background-color: additionalBackgroundColor; /*the value of the constant defined by your skin*/
-border-color: tableBorderColor; /*the value of the constant defined by your skin*/
-border-width: tableBorderWidth /*the value of the constant defined by your skin*/
-border-style: solid;
+ background-color: additionalBackgroundColor; /*the value of the constant defined by your skin*/
+ border-color: tableBorderColor; /*the value of the constant defined by your skin*/
+ border-width: tableBorderWidth /*the value of the constant defined by your skin*/
+ border-style: solid;
}
-...
-]]></programlisting>
+...]]></programlisting>
<para> The <emphasis>
<property>"name"</property>
</emphasis> attribute of <emphasis role="bold">
@@ -3254,10 +3215,9 @@
list. </para>
<programlisting role="XML"><![CDATA[...
<u:selector name=".rich-ordering-control-disabled, .rich-ordering-control-top, .rich-ordering-control-bottom, .rich-ordering-control-up, .rich-ordering-control-down">
- <u:style name="border-color" skin="tableBorderColor" />
+ <u:style name="border-color" skin="tableBorderColor" />
</u:selector>
-...
-]]></programlisting>
+...]]></programlisting>
</section>
<section id="PlugnSkin" role="new">
<?dbhtml filename="PlugnSkin.html"?>
@@ -3282,8 +3242,7 @@
-DartifactId=ARTIFACT-ID
-DgroupId=GROUP-ID
-Dversion=VERSION
-...
-]]></programlisting>
+...]]></programlisting>
<para>Primary keys for the command:</para>
<itemizedlist>
<listitem>
@@ -3451,10 +3410,9 @@
<programlisting role="XML">
<![CDATA[...
.rich-calendar-cell {
-background: #537df8;
+ background: #537df8;
}
-...
-]]></programlisting>
+...]]></programlisting>
</listitem>
<listitem>
<para> Using XCSS coding approach, the same way as XCSS files are normally
@@ -3470,8 +3428,7 @@
<u:style name="font-size" skin="generalSizeFont"/>
<u:style name="font-family" skin="generalFamilyFont"/>
</u:selector>
-...
-]]></programlisting>
+...]]></programlisting>
</listitem>
</itemizedlist>
<para>
@@ -3482,8 +3439,7 @@
folder of you skin project (the one that contains pom.xml file). </para>
<programlisting role="XML"><![CDATA[...
mvn clean install
-...
-]]></programlisting>
+...]]></programlisting>
<para>In addition Plug-n-Skin has a number of predefined gradients that you can also use
to make your application look nicer. The given below code snippet shows how a
gradient can be used </para>
@@ -3501,8 +3457,7 @@
</f:resource>
</u:style>
</u:selector>
-...
-]]></programlisting>
+...]]></programlisting>
<para> So, as you can see, the <property>background-image</property> CSS property is
defined with <code> <f:resource
f:key="org.richfaces.renderkit.html.CustomizeableGradient">
@@ -3521,8 +3476,7 @@
<param-name>org.ajax4jsf.SKIN</param-name>
<param-value>SKIN-NAME</param-value>
</context-param>
-...
-]]></programlisting>
+...]]></programlisting>
<section>
<sectioninfo>
<keywordset>
@@ -3549,9 +3503,7 @@
folders were created there. </para>
<para> Next, we will use Maven to add all needed files to the skin project. This
will done by the following command: </para>
- <programlisting role="XML"><![CDATA[
-mvn cdk:add-skin -DbaseSkin=blueSky -DcreateExt=true -Dname=PlugnSkinDemo -Dpackage=SKINPACKAGE
-]]></programlisting>
+ <programlisting role="XML"><![CDATA[mvn cdk:add-skin -DbaseSkin=blueSky -DcreateExt=true -Dname=PlugnSkinDemo -Dpackage=SKINPACKAGE]]></programlisting>
<para> As you remember from the previous section "-DbaseSkin" key defines
what RichFaces built-in skin to be used as a base one,
"-DcreateExt=true" determines that the new skin will come with XCSS
@@ -3595,9 +3547,8 @@
this. </para>
<programlisting role="XML"><![CDATA[
button[type="button"], button[type="reset"], button[type="submit"], input[type="reset"], input[type="submit"], input[type="button"] {
-font-weight: bold;
-}
-]]></programlisting>
+ font-weight: bold;
+}]]></programlisting>
<para>All the changes that were planned to be preformed are done and now you can
proceed to building the new PlugnSkinDemo skin and import it into the project.
As you read in the previous section, the skin should be built in the
@@ -3616,23 +3567,19 @@
<listitem>
<para>Add the new skin's name to the "web.xml" file. It is
done like this</para>
- <programlisting role="XML"><![CDATA[
- <context-param>
- <param-name>org.ajax4jsf.SKIN</param-name>
- <param-value>PlugnSkinDemo</param-value>
- </context-param>
-]]></programlisting>
+ <programlisting role="XML"><![CDATA[ <context-param>
+ <param-name>org.ajax4jsf.SKIN</param-name>
+ <param-value>PlugnSkinDemo</param-value>
+</context-param>]]></programlisting>
</listitem>
</itemizedlist>
<para> Please, do not forget that standard controls skinning has to be enabled in
the "web.xml" file, which can be done by adding the following code to
the "web.xml" file: </para>
- <programlisting role="XML"><![CDATA[
- <context-param>
- <param-name>org.richfaces.CONTROL_SKINNING</param-name>
- <param-value>enable</param-value>
- </context-param>
-]]></programlisting>
+ <programlisting role="XML"><![CDATA[<context-param>
+ <param-name>org.richfaces.CONTROL_SKINNING</param-name>
+ <param-value>enable</param-value>
+</context-param>]]></programlisting>
<para>The result of both operations is displayed on the figure below.</para>
<figure>
<title>Plug-n-Skin feature in action. </title>
15 years, 8 months
JBoss Rich Faces SVN: r13312 - trunk/ui/colorPicker/src/main/resources/org/richfaces/renderkit/html/scripts.
by richfaces-svn-commits@lists.jboss.org
Author: artdaw
Date: 2009-03-30 19:18:08 -0400 (Mon, 30 Mar 2009)
New Revision: 13312
Modified:
trunk/ui/colorPicker/src/main/resources/org/richfaces/renderkit/html/scripts/ui.colorpicker.js
Log:
https://jira.jboss.org/jira/browse/RF-6645 - hex field was fixed
Modified: trunk/ui/colorPicker/src/main/resources/org/richfaces/renderkit/html/scripts/ui.colorpicker.js
===================================================================
--- trunk/ui/colorPicker/src/main/resources/org/richfaces/renderkit/html/scripts/ui.colorpicker.js 2009-03-30 22:48:22 UTC (rev 13311)
+++ trunk/ui/colorPicker/src/main/resources/org/richfaces/renderkit/html/scripts/ui.colorpicker.js 2009-03-30 23:18:08 UTC (rev 13312)
@@ -140,7 +140,7 @@
_keyDown: function(e) {
var pressedKey = e.charCode || e.keyCode || -1;
- if ((pressedKey > this.charMin-1 && pressedKey <= 90) || pressedKey == 32) {
+ if ((pressedKey > this.charMin && pressedKey <= 90) || pressedKey == 32) {
return false;
}
},
15 years, 9 months