JBoss Rich Faces SVN: r9190 - trunk/ui/orderingList/src/main/java/org/richfaces/renderkit/html/images.
by richfaces-svn-commits@lists.jboss.org
Author: nbelaevski
Date: 2008-06-24 10:12:46 -0400 (Tue, 24 Jun 2008)
New Revision: 9190
Modified:
trunk/ui/orderingList/src/main/java/org/richfaces/renderkit/html/images/OrderingListIconBottomDisabled.java
trunk/ui/orderingList/src/main/java/org/richfaces/renderkit/html/images/OrderingListIconDownDisabled.java
trunk/ui/orderingList/src/main/java/org/richfaces/renderkit/html/images/OrderingListIconTopDisabled.java
trunk/ui/orderingList/src/main/java/org/richfaces/renderkit/html/images/OrderingListIconUpDisabled.java
Log:
Changes reverted
Modified: trunk/ui/orderingList/src/main/java/org/richfaces/renderkit/html/images/OrderingListIconBottomDisabled.java
===================================================================
--- trunk/ui/orderingList/src/main/java/org/richfaces/renderkit/html/images/OrderingListIconBottomDisabled.java 2008-06-24 14:09:35 UTC (rev 9189)
+++ trunk/ui/orderingList/src/main/java/org/richfaces/renderkit/html/images/OrderingListIconBottomDisabled.java 2008-06-24 14:12:46 UTC (rev 9190)
@@ -30,6 +30,6 @@
public class OrderingListIconBottomDisabled extends OrderingListIconBottom {
protected Object getDataToStore(FacesContext context, Object data) {
return storeData(context, DISABLED_ICON_COLOR, DISABLED_BACKGROUND_COLOR,
- DISABLED_BORDER_COLOR, data);
+ DISABLED_BORDER_COLOR);
}
}
Modified: trunk/ui/orderingList/src/main/java/org/richfaces/renderkit/html/images/OrderingListIconDownDisabled.java
===================================================================
--- trunk/ui/orderingList/src/main/java/org/richfaces/renderkit/html/images/OrderingListIconDownDisabled.java 2008-06-24 14:09:35 UTC (rev 9189)
+++ trunk/ui/orderingList/src/main/java/org/richfaces/renderkit/html/images/OrderingListIconDownDisabled.java 2008-06-24 14:12:46 UTC (rev 9190)
@@ -30,6 +30,6 @@
public class OrderingListIconDownDisabled extends TriangleIconDown {
protected Object getDataToStore(FacesContext context, Object data) {
return storeData(context, DISABLED_ICON_COLOR, DISABLED_BACKGROUND_COLOR,
- DISABLED_BORDER_COLOR, data);
+ DISABLED_BORDER_COLOR);
}
}
Modified: trunk/ui/orderingList/src/main/java/org/richfaces/renderkit/html/images/OrderingListIconTopDisabled.java
===================================================================
--- trunk/ui/orderingList/src/main/java/org/richfaces/renderkit/html/images/OrderingListIconTopDisabled.java 2008-06-24 14:09:35 UTC (rev 9189)
+++ trunk/ui/orderingList/src/main/java/org/richfaces/renderkit/html/images/OrderingListIconTopDisabled.java 2008-06-24 14:12:46 UTC (rev 9190)
@@ -30,6 +30,6 @@
public class OrderingListIconTopDisabled extends OrderingListIconTop {
protected Object getDataToStore(FacesContext context, Object data) {
return storeData(context, DISABLED_ICON_COLOR, DISABLED_BACKGROUND_COLOR,
- DISABLED_BORDER_COLOR, data);
+ DISABLED_BORDER_COLOR);
}
}
Modified: trunk/ui/orderingList/src/main/java/org/richfaces/renderkit/html/images/OrderingListIconUpDisabled.java
===================================================================
--- trunk/ui/orderingList/src/main/java/org/richfaces/renderkit/html/images/OrderingListIconUpDisabled.java 2008-06-24 14:09:35 UTC (rev 9189)
+++ trunk/ui/orderingList/src/main/java/org/richfaces/renderkit/html/images/OrderingListIconUpDisabled.java 2008-06-24 14:12:46 UTC (rev 9190)
@@ -30,6 +30,6 @@
public class OrderingListIconUpDisabled extends TriangleIconUp {
protected Object getDataToStore(FacesContext context, Object data) {
return storeData(context, DISABLED_ICON_COLOR, DISABLED_BACKGROUND_COLOR,
- DISABLED_BORDER_COLOR, data);
+ DISABLED_BORDER_COLOR);
}
}
15 years, 10 months
JBoss Rich Faces SVN: r9189 - trunk/framework/impl/src/main/java/org/richfaces/renderkit/html/images.
by richfaces-svn-commits@lists.jboss.org
Author: nbelaevski
Date: 2008-06-24 10:09:35 -0400 (Tue, 24 Jun 2008)
New Revision: 9189
Modified:
trunk/framework/impl/src/main/java/org/richfaces/renderkit/html/images/TriangleIconBase.java
Log:
Changes reverted
Modified: trunk/framework/impl/src/main/java/org/richfaces/renderkit/html/images/TriangleIconBase.java
===================================================================
--- trunk/framework/impl/src/main/java/org/richfaces/renderkit/html/images/TriangleIconBase.java 2008-06-24 14:08:01 UTC (rev 9188)
+++ trunk/framework/impl/src/main/java/org/richfaces/renderkit/html/images/TriangleIconBase.java 2008-06-24 14:09:35 UTC (rev 9189)
@@ -26,7 +26,6 @@
import java.awt.Graphics2D;
import java.awt.RenderingHints;
import java.util.Date;
-import java.util.Map;
import javax.faces.context.FacesContext;
@@ -45,12 +44,6 @@
*/
public abstract class TriangleIconBase extends Java2Dresource {
- private static final String BORDER_COLOR_PARAMETER = "borderColor";
-
- private static final String BACKGROUND_COLOR_PARAMETER = "backgroundColor";
-
- private static final String ICON_COLOR_PARAMETER = "iconColor";
-
private static final Dimension DIMENSION = new Dimension(15, 15);
protected static final String ICON_COLOR = "generalTextColor";
@@ -113,15 +106,10 @@
* @param data - pass icon color and background color
*/
protected Object getDataToStore(FacesContext context, Object data) {
- return storeData(context, ICON_COLOR, BACKGROUND_COLOR, BORDER_COLOR, data);
+ return storeData(context, ICON_COLOR, BACKGROUND_COLOR, BORDER_COLOR);
}
- private static final boolean isEmpty(String s) {
- return s == null || s.length() == 0;
- }
-
- protected Object storeData(FacesContext context, String colorSkinParam, String backgroundSkinParam, String borderSkinParam,
- Object data) {
+ protected Object storeData(FacesContext context, String colorSkinParam, String backgroundSkinParam, String borderSkinParam) {
Skin skin = SkinFactory.getInstance().getSkin(context);
Skin defaultSkin = SkinFactory.getInstance().getDefaultSkin(context);
@@ -130,62 +118,38 @@
Color color = null;
Zipper2 zipper = new Zipper2(ret);
- String iconColorString = null;
- String backgroundColorString = null;
- String borderColorString = null;
-
- if (data instanceof Map) {
- Map map = (Map) data;
-
- iconColorString = (String) map.get(ICON_COLOR_PARAMETER);
- backgroundColorString = (String) map.get(BACKGROUND_COLOR_PARAMETER);
- borderColorString = (String) map.get(BORDER_COLOR_PARAMETER);
- }
+ String color1 = (String) skin.getParameter(context, colorSkinParam);
+ if (null == color1 || "".equals(color1))
+ color1 = (String) defaultSkin.getParameter(context, colorSkinParam);
- if (isEmpty(iconColorString)) {
- iconColorString = (String) skin.getParameter(context, colorSkinParam);
+ if (color1 == null) {
+ color1 = "#FFFFFF";
}
-
- if (isEmpty(iconColorString)) {
- iconColorString = (String) defaultSkin.getParameter(context, colorSkinParam);
- }
- if (isEmpty(iconColorString)) {
- iconColorString = "#FFFFFF";
- }
+ color = HtmlColor.decode(color1);
- color = HtmlColor.decode(iconColorString);
-
zipper.addColor(color);
- if (isEmpty(backgroundColorString)) {
- backgroundColorString = (String) skin.getParameter(context, backgroundSkinParam);
- }
+ String color2 = (String) skin.getParameter(context, backgroundSkinParam);
+ if (null == color2 || "".equals(color2))
+ color2 = (String) defaultSkin.getParameter(context, backgroundSkinParam);
- if (isEmpty(backgroundColorString)) {
- backgroundColorString = (String) defaultSkin.getParameter(context, backgroundSkinParam);
- }
-
- if (isEmpty(backgroundColorString)) {
- backgroundColorString = "#000000";
+ if (color2 == null) {
+ color2 = "#000000";
}
- color = HtmlColor.decode(backgroundColorString);
+ color = HtmlColor.decode(color2);
zipper.addColor(color);
-
- if (isEmpty(borderColorString)) {
- borderColorString = (String) skin.getParameter(context, borderSkinParam);
+
+ String color3 = (String) skin.getParameter(context, borderSkinParam);
+ if (null == color3 || "".equals(color3))
+ color3 = (String) defaultSkin.getParameter(context, backgroundSkinParam);
+
+ if (color3 == null) {
+ color3 = "#000000";
}
-
- if (isEmpty(borderColorString)) {
- borderColorString = (String) defaultSkin.getParameter(context, borderSkinParam);
- }
-
- if (isEmpty(borderColorString)) {
- borderColorString = "#000000";
- }
- color = HtmlColor.decode(borderColorString);
+ color = HtmlColor.decode(color3);
zipper.addColor(color);
return ret;
15 years, 10 months
JBoss Rich Faces SVN: r9188 - management/design/hotKey.
by richfaces-svn-commits@lists.jboss.org
Author: ilya_shaikovsky
Date: 2008-06-24 10:08:01 -0400 (Tue, 24 Jun 2008)
New Revision: 9188
Removed:
management/design/hotKey/~$nc Spec hot Key.doc
Modified:
management/design/hotKey/Func Spec hot Key.doc
Log:
attachToParent removed
Modified: management/design/hotKey/Func Spec hot Key.doc
===================================================================
(Binary files differ)
Deleted: management/design/hotKey/~$nc Spec hot Key.doc
===================================================================
(Binary files differ)
15 years, 10 months
JBoss Rich Faces SVN: r9187 - in trunk/ui/fileUpload/src/main: resources/org/richfaces/renderkit/html/js and 1 other directories.
by richfaces-svn-commits@lists.jboss.org
Author: andrei_exadel
Date: 2008-06-24 09:29:20 -0400 (Tue, 24 Jun 2008)
New Revision: 9187
Modified:
trunk/ui/fileUpload/src/main/config/component/fileUpload.xml
trunk/ui/fileUpload/src/main/resources/org/richfaces/renderkit/html/js/FileUpload.js
trunk/ui/fileUpload/src/main/templates/org/richfaces/fileUpload.jspx
Log:
RF-3787
Modified: trunk/ui/fileUpload/src/main/config/component/fileUpload.xml
===================================================================
--- trunk/ui/fileUpload/src/main/config/component/fileUpload.xml 2008-06-24 13:21:53 UTC (rev 9186)
+++ trunk/ui/fileUpload/src/main/config/component/fileUpload.xml 2008-06-24 13:29:20 UTC (rev 9187)
@@ -232,6 +232,11 @@
</description>
</property>
<property>
+ <name>onadd</name>
+ <classname>java.lang.String</classname>
+ <description>A JavaScript event handler called on an add file operation</description>
+ </property>
+ <property>
<name>onupload</name>
<classname>java.lang.String</classname>
<description>A JavaScript event handler called on an upload operation</description>
Modified: trunk/ui/fileUpload/src/main/resources/org/richfaces/renderkit/html/js/FileUpload.js
===================================================================
--- trunk/ui/fileUpload/src/main/resources/org/richfaces/renderkit/html/js/FileUpload.js 2008-06-24 13:21:53 UTC (rev 9186)
+++ trunk/ui/fileUpload/src/main/resources/org/richfaces/renderkit/html/js/FileUpload.js 2008-06-24 13:29:20 UTC (rev 9187)
@@ -618,9 +618,13 @@
}
return;
}
- //this.createFrame();
+
var newEntry = new FileUploadEntry(elt, this);
this.entries.push(newEntry);
+
+ if (this.events.onadd) {
+ this.element.fire("rich:onadd", { entry : newEntry });
+ }
if (this.runUpload) {
newEntry.setState(FileUploadEntry.READY);
@@ -1091,6 +1095,10 @@
this.createFrame();
var newEntry = new FileUploadEntry(this.currentInput, this);
this.entries.push(newEntry);
+
+ if (this.events.onadd) {
+ this.element.fire("rich:onadd", { entry : newEntry });
+ }
if (this.runUpload) {
newEntry.setState(FileUploadEntry.READY);
Modified: trunk/ui/fileUpload/src/main/templates/org/richfaces/fileUpload.jspx
===================================================================
--- trunk/ui/fileUpload/src/main/templates/org/richfaces/fileUpload.jspx 2008-06-24 13:21:53 UTC (rev 9186)
+++ trunk/ui/fileUpload/src/main/templates/org/richfaces/fileUpload.jspx 2008-06-24 13:29:20 UTC (rev 9187)
@@ -184,7 +184,8 @@
onerror : #{this:getAsEventHandler(context, component, "onerror")},
ontyperejected : #{this:getAsEventHandler(context, component, "ontyperejected")},
onsizerejected : #{this:getAsEventHandler(context, component, "onsizerejected")},
- onclear : #{this:getAsEventHandler(context, component, "onclear")}
+ onclear : #{this:getAsEventHandler(context, component, "onclear")},
+ onadd : #{this:getAsEventHandler(context, component, "onadd")}
};
new FileUpload('#{clientId}','#{formId}','#{actionUrl}',#{this:getStopScript(context, component)}, #{this:getFileSizeScript(context, component)} ,'#{this:getProgressBarId(context, component)}', FileUpload.CLASSES, #{this:getLabelMarkup(context, component)}, #{maxCount}, events, #{component.attributes["disabled"]}, #{this:getAcceptedTypes(context, component)}, {'autoclear':#{component.attributes["autoclear"]},'autoUpload':#{component.attributes["immediateUpload"]},'noDuplicate':#{component.attributes["noDuplicate"]}, 'allowFlash':'#{allowFlash}', 'flashComponentUrl':'#{flashComponent}'},#{this:_getLabels(labels)},#{this:getChildrenParams(context, component)});
15 years, 10 months
JBoss Rich Faces SVN: r9186 - in trunk/test-applications/seleniumTest/src: test/java/org/richfaces/testng and 1 other directory.
by richfaces-svn-commits@lists.jboss.org
Author: dsvyatobatsko
Date: 2008-06-24 09:21:53 -0400 (Tue, 24 Jun 2008)
New Revision: 9186
Modified:
trunk/test-applications/seleniumTest/src/main/webapp/pages/ajaxListener/ajaxListenerTest.xhtml
trunk/test-applications/seleniumTest/src/test/java/org/richfaces/testng/AjaxListenerTest.java
Log:
http://jira.jboss.com/jira/browse/RF-3766
Modified: trunk/test-applications/seleniumTest/src/main/webapp/pages/ajaxListener/ajaxListenerTest.xhtml
===================================================================
(Binary files differ)
Modified: trunk/test-applications/seleniumTest/src/test/java/org/richfaces/testng/AjaxListenerTest.java
===================================================================
--- trunk/test-applications/seleniumTest/src/test/java/org/richfaces/testng/AjaxListenerTest.java 2008-06-24 13:17:50 UTC (rev 9185)
+++ trunk/test-applications/seleniumTest/src/test/java/org/richfaces/testng/AjaxListenerTest.java 2008-06-24 13:21:53 UTC (rev 9186)
@@ -9,6 +9,26 @@
@Test(dataProvider = "templates")
public void testAjaxListenerComponent(Template template) {
renderPage(template);
+
+ String parentId = getParentId() + "_form:";
+
+ String inputElemId = parentId + "input";
+ String outputElemId = parentId + "output";
+ String ajaxSubmitElemId = outputElemId;
+
+ writeStatus("Try to submit form with invalid input. In contrast to <f:actionListener> and "
+ + "<f:valueChangeListener> ajax listener must be invoked anyway");
+
+ clickAjaxCommandAndWait(ajaxSubmitElemId);
+ AssertTextEquals(outputElemId, "Validation failed, but ajax listener is invoked anyway",
+ "Ajax listener must be invoked even through validation failed");
+
+ writeStatus("Correct input and try to submit again");
+ type(inputElemId, "5");
+
+ clickAjaxCommandAndWait(ajaxSubmitElemId);
+ AssertTextEquals(outputElemId, "Ajax listener has been invoked successfully", "Ajax listener has not been invoked");
+
}
@Override
15 years, 10 months
JBoss Rich Faces SVN: r9185 - trunk/ui/tree/src/main/config/component.
by richfaces-svn-commits@lists.jboss.org
Author: abelevich
Date: 2008-06-24 09:17:50 -0400 (Tue, 24 Jun 2008)
New Revision: 9185
Modified:
trunk/ui/tree/src/main/config/component/tree.xml
Log:
http://jira.jboss.com/jira/browse/RF-3696
Modified: trunk/ui/tree/src/main/config/component/tree.xml
===================================================================
--- trunk/ui/tree/src/main/config/component/tree.xml 2008-06-24 13:03:30 UTC (rev 9184)
+++ trunk/ui/tree/src/main/config/component/tree.xml 2008-06-24 13:17:50 UTC (rev 9185)
@@ -244,6 +244,7 @@
null, a particular treeNode saves the current state
</description>
<methodargs>org.richfaces.component.UITree</methodargs>
+ <returntype>java.lang.Boolean</returntype>
</property>
<property>
<name>adviseNodeSelected</name>
@@ -256,6 +257,7 @@
null, a particular treeNode saves the current state
</description>
<methodargs>org.richfaces.component.UITree</methodargs>
+ <returntype>java.lang.Boolean</returntype>
</property>
<property>
15 years, 10 months
JBoss Rich Faces SVN: r9184 - in trunk/docs/cdkguide/en/src/main/docbook: includes and 1 other directories.
by richfaces-svn-commits@lists.jboss.org
Author: artdaw
Date: 2008-06-24 09:03:30 -0400 (Tue, 24 Jun 2008)
New Revision: 9184
Added:
trunk/docs/cdkguide/en/src/main/docbook/modules/temptags.xml
Modified:
trunk/docs/cdkguide/en/src/main/docbook/includes/register.xml
trunk/docs/cdkguide/en/src/main/docbook/includes/template.xml
trunk/docs/cdkguide/en/src/main/docbook/includes/ui.xml
trunk/docs/cdkguide/en/src/main/docbook/master.xml
Log:
http://jira.jboss.com/jira/browse/RF-3692 - TOC was fixed
Modified: trunk/docs/cdkguide/en/src/main/docbook/includes/register.xml
===================================================================
--- trunk/docs/cdkguide/en/src/main/docbook/includes/register.xml 2008-06-24 12:53:17 UTC (rev 9183)
+++ trunk/docs/cdkguide/en/src/main/docbook/includes/register.xml 2008-06-24 13:03:30 UTC (rev 9184)
@@ -9,33 +9,14 @@
<keyword>Guide</keyword>
</keywordset>
</sectioninfo>
- <title>Registering UIComponent, Renderer and Component resources</title>
+ <title>Component resources registration</title>
<para>
- Registering UIComponent, Renderer and component resources
+ Registering component resources
</para>
- <section id="regrenderer">
- <title>Register the Renderer</title>
- <para>
- Register the Renderer
- </para>
- </section>
- <section id="regsubclass">
- <title>Register the Renderer-Specific Subclass</title>
- <para>
- Register the Renderer-Specific Subclass
- </para>
- </section>
-
- <section id="regres">
- <title>Component resources registration</title>
- <para>
- How to register component resources
- </para>
<section id="resconf">
<title>resources-config.xml file format</title>
<para>
resources-config.xml file format
</para>
</section>
- </section>
</section>
\ No newline at end of file
Modified: trunk/docs/cdkguide/en/src/main/docbook/includes/template.xml
===================================================================
--- trunk/docs/cdkguide/en/src/main/docbook/includes/template.xml 2008-06-24 12:53:17 UTC (rev 9183)
+++ trunk/docs/cdkguide/en/src/main/docbook/includes/template.xml 2008-06-24 13:03:30 UTC (rev 9184)
@@ -13,22 +13,4 @@
<para>
How to write your renderer with the help of template.
</para>
- <section id="tempex">
- <title>Template example</title>
- <para>
- Example
- </para>
- </section>
- <section id="tempmech">
- <title>Templating mechanism</title>
- <para>
- Mechanism
- </para>
- </section>
- <section id="temptags">
- <title>Template tags overview</title>
- <para>
- tags
- </para>
- </section>
</section>
\ No newline at end of file
Modified: trunk/docs/cdkguide/en/src/main/docbook/includes/ui.xml
===================================================================
--- trunk/docs/cdkguide/en/src/main/docbook/includes/ui.xml 2008-06-24 12:53:17 UTC (rev 9183)
+++ trunk/docs/cdkguide/en/src/main/docbook/includes/ui.xml 2008-06-24 13:03:30 UTC (rev 9184)
@@ -9,9 +9,9 @@
<keyword>Guide</keyword>
</keywordset>
</sectioninfo>
- <title>Creating UI Component class</title>
+ <title>Configuration file creation</title>
<para>
- UI Component
+ UI Component generation
</para>
</section>
Modified: trunk/docs/cdkguide/en/src/main/docbook/master.xml
===================================================================
--- trunk/docs/cdkguide/en/src/main/docbook/master.xml 2008-06-24 12:53:17 UTC (rev 9183)
+++ trunk/docs/cdkguide/en/src/main/docbook/master.xml 2008-06-24 13:03:30 UTC (rev 9184)
@@ -11,8 +11,8 @@
<!ENTITY ide SYSTEM "modules/ide.xml">
<!ENTITY ref SYSTEM "modules/ref.xml">
<!ENTITY test SYSTEM "modules/test.xml">
+<!ENTITY temptags SYSTEM "modules/temptags.xml">
-
<!ENTITY pcreate SYSTEM "includes/pcreate.xml">
<!ENTITY ccreate SYSTEM "includes/ccreate.xml">
<!ENTITY ui SYSTEM "includes/ui.xml">
@@ -72,7 +72,6 @@
&pcreate;
&ccreate;
&protoui;
- &ui;
&csrenderer;
<section id="rssubclass" xreflabel="rssubclass">
@@ -93,7 +92,7 @@
&template;
&skin;
</section>
-
+ &ui;
®ister;
&taghandler;
@@ -120,4 +119,5 @@
</chapter>
&ide;
&ref;
+ &temptags;
</book>
Added: trunk/docs/cdkguide/en/src/main/docbook/modules/temptags.xml
===================================================================
--- trunk/docs/cdkguide/en/src/main/docbook/modules/temptags.xml (rev 0)
+++ trunk/docs/cdkguide/en/src/main/docbook/modules/temptags.xml 2008-06-24 13:03:30 UTC (rev 9184)
@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<chapter id="temptags" xreflabel="temptags">
+ <?dbhtml filename="temptags.html"?>
+ <chapterinfo>
+ <keywordset>
+ <keyword>template</keyword>
+ <keyword>CDK</keyword>
+ <keyword>Guide</keyword>
+ </keywordset>
+ </chapterinfo>
+
+<title>Template tags overview</title>
+ <para>
+ tags
+ </para>
+
+</chapter>
\ No newline at end of file
15 years, 10 months
JBoss Rich Faces SVN: r9183 - in trunk/test-applications/facelets/src/main: resources and 4 other directories.
by richfaces-svn-commits@lists.jboss.org
Author: mvitenkov
Date: 2008-06-24 08:53:17 -0400 (Tue, 24 Jun 2008)
New Revision: 9183
Added:
trunk/test-applications/facelets/src/main/java/tree/TreeContainer.java
trunk/test-applications/facelets/src/main/java/tree/TreeDndBean.java
trunk/test-applications/facelets/src/main/resources/org/
trunk/test-applications/facelets/src/main/resources/org/richfaces/
trunk/test-applications/facelets/src/main/resources/org/richfaces/simpleTreeData.properties
Modified:
trunk/test-applications/facelets/src/main/webapp/Tree/Tree.xhtml
trunk/test-applications/facelets/src/main/webapp/WEB-INF/faces-config-Tree.xml
Log:
D'n'D API for rich:tree was added.
Added: trunk/test-applications/facelets/src/main/java/tree/TreeContainer.java
===================================================================
--- trunk/test-applications/facelets/src/main/java/tree/TreeContainer.java (rev 0)
+++ trunk/test-applications/facelets/src/main/java/tree/TreeContainer.java 2008-06-24 12:53:17 UTC (rev 9183)
@@ -0,0 +1,44 @@
+/**
+ *
+ */
+package tree;
+
+import javax.faces.component.UIComponent;
+import javax.faces.event.FacesEvent;
+
+import org.richfaces.component.UITree;
+import org.richfaces.component.UITreeNode;
+
+/**
+ * @author dmorozov
+ *
+ */
+public class TreeContainer {
+
+ /**
+ * Get tree component from event
+ *
+ * @param event tree event
+ * @return tree component
+ */
+ protected UITree getTree(FacesEvent event) {
+ return getTree(event.getComponent());
+ }
+
+ /**
+ * Safe getter of tree component
+ * @param component component to process
+ * @return tree component
+ */
+ protected UITree getTree(UIComponent component) {
+ if (component instanceof UITree) {
+ return ((UITree) component);
+ }
+
+ if (component instanceof UITreeNode) {
+ return ((UITree) component.getParent());
+ }
+
+ return null;
+ }
+}
Added: trunk/test-applications/facelets/src/main/java/tree/TreeDndBean.java
===================================================================
--- trunk/test-applications/facelets/src/main/java/tree/TreeDndBean.java (rev 0)
+++ trunk/test-applications/facelets/src/main/java/tree/TreeDndBean.java 2008-06-24 12:53:17 UTC (rev 9183)
@@ -0,0 +1,332 @@
+/**
+ *
+ */
+package tree;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.Map;
+import java.util.Properties;
+
+import javax.faces.FacesException;
+import javax.faces.context.ExternalContext;
+import javax.faces.context.FacesContext;
+
+import org.ajax4jsf.context.AjaxContext;
+import org.richfaces.component.UITree;
+import org.richfaces.component.UITreeNode;
+import org.richfaces.event.DragEvent;
+import org.richfaces.event.DropEvent;
+import org.richfaces.event.NodeExpandedEvent;
+import org.richfaces.event.NodeSelectedEvent;
+import org.richfaces.model.TreeNode;
+import org.richfaces.model.TreeNodeImpl;
+import org.richfaces.model.TreeRowKey;
+/**
+ * @author mvitenkov
+ *
+ */
+public class TreeDndBean extends TreeContainer {
+ private static final String DATA_PATH1 = "org/richfaces/simpleTreeData.properties";
+
+ private TreeNode<String> treeNodeLeft;
+
+ private TreeNode<String> treeNodeRight;
+
+ private String leftSelectedNodeTitle;
+
+ private String rightSelectedNodeTitle;
+
+ private UITree leftTree;
+
+ private UITree rightTree;
+
+ /**
+ * Helper tree model creation method from properties object
+ *
+ * @param path node path
+ * @param node parent node
+ * @param properties properties object
+ */
+ private void addNodes(String path, TreeNode<String> node, Properties properties) {
+ boolean end = false;
+ int counter = 1;
+ while (!end) {
+ String key = path != null ? path + '.' + counter : String.valueOf(counter);
+ String value = properties.getProperty(key);
+ if (value != null) {
+ TreeNodeImpl<String> nodeImpl = new TreeNodeImpl<String>();
+ nodeImpl.setData(value);
+ node.addChild(new Integer(counter), nodeImpl);
+ addNodes(key, nodeImpl, properties);
+ counter++;
+ } else {
+ end = true;
+ }
+ }
+ }
+
+ /**
+ * Init sample tree model
+ *
+ * @return tree model
+ */
+ private TreeNode<String> initPaneTree() {
+ TreeNode<String> rootNode = null;
+ FacesContext facesContext = FacesContext.getCurrentInstance();
+ ExternalContext externalContext = facesContext.getExternalContext();
+
+ InputStream dataStream = this.getClass().getClassLoader().getResourceAsStream(DATA_PATH1);
+
+ try {
+ Properties properties = new Properties();
+ properties.load(dataStream);
+ rootNode = new TreeNodeImpl<String>();
+ addNodes(null, rootNode, properties);
+ } catch (IOException e) {
+
+ throw new FacesException(e.getMessage(), e);
+
+ } finally {
+ if (dataStream != null) {
+ try {
+ dataStream.close();
+ } catch (IOException e) {
+ externalContext.log(e.getMessage(), e);
+ }
+ }
+ }
+
+ return rootNode;
+ }
+
+ /**
+ * Left tree demo selection handler.
+ * @param event node selection event
+ */
+ public void processLSelection(NodeSelectedEvent event) {
+ UITree tree = (UITree) event.getComponent();
+ leftSelectedNodeTitle = (String) tree.getRowData();
+ }
+
+ /**
+ * Right tree demo selection handler.
+ * @param event node selection event
+ */
+ public void processRSelection(NodeSelectedEvent event) {
+ UITree tree = (UITree) event.getComponent();
+ if (tree != null) {
+ rightSelectedNodeTitle = (String) tree.getRowData();
+ }
+ }
+
+ /**
+ * Left tree value binding
+ * @return the treeNodeLeft
+ */
+ public TreeNode<String> getTreeNodeLeft() {
+ if (treeNodeLeft == null) {
+ treeNodeLeft = initPaneTree();
+ }
+ return treeNodeLeft;
+ }
+
+ /**
+ * Left tree value binding
+ * @param treeNodeLeft
+ * the treeNodeLeft to set
+ */
+ public void setTreeNodeLeft(TreeNode<String> treeNodeLeft) {
+ this.treeNodeLeft = treeNodeLeft;
+ }
+
+ /**
+ * @return the leftSelectedNodeTitle
+ */
+ public String getLeftSelectedNodeTitle() {
+ return leftSelectedNodeTitle;
+ }
+
+ /**
+ * @param leftSelectedNodeTitle
+ * the leftSelectedNodeTitle to set
+ */
+ public void setLeftSelectedNodeTitle(String leftSelectedNodeTitle) {
+ this.leftSelectedNodeTitle = leftSelectedNodeTitle;
+ }
+
+ /**
+ * @return the rightSelectedNodeTitle
+ */
+ public String getRightSelectedNodeTitle() {
+ return rightSelectedNodeTitle;
+ }
+
+ /**
+ * @param rightSelectedNodeTitle
+ * the rightSelectedNodeTitle to set
+ */
+ public void setRightSelectedNodeTitle(String rightSelectedNodeTitle) {
+ this.rightSelectedNodeTitle = rightSelectedNodeTitle;
+ }
+
+ /**
+ * Right tree value binding
+ * @return the treeNodeRight
+ */
+ public TreeNode<String> getTreeNodeRight() {
+ if (treeNodeRight == null) {
+ treeNodeRight = initPaneTree();
+ }
+ return treeNodeRight;
+ }
+
+ /**
+ * Right tree value binding
+ * @param treeNodeRight
+ * the treeNodeRight to set
+ */
+ public void setTreeNodeRight(TreeNode<String> treeNodeRight) {
+ this.treeNodeRight = treeNodeRight;
+ }
+
+ /**
+ * Left tree binding
+ * @return the leftTree
+ */
+ public UITree getLeftTree() {
+ return leftTree;
+ }
+
+ /**
+ * Left tree binding
+ * @param leftTree
+ * the leftTree to set
+ */
+ public void setLeftTree(UITree leftTree) {
+ this.leftTree = leftTree;
+ }
+
+ /**
+ * Right tree binding
+ * @return the rightTree
+ */
+ public UITree getRightTree() {
+ return rightTree;
+ }
+
+ /**
+ * Right tree binding
+ * @param rightTree
+ * the rightTree to set
+ */
+ public void setRightTree(UITree rightTree) {
+ this.rightTree = rightTree;
+ }
+
+ /**
+ * Expand event handler
+ * @param event expand event
+ */
+ public void onExpand(NodeExpandedEvent event) {
+ UITree tree = getTree(event);
+ System.out.println("Tree ('"+tree.getId()+"') node " + (tree.isExpanded() ? "expanded" : "collapsed") + " " + tree.getRowKey());
+ }
+
+ /**
+ * Drag event handler
+ * @param dragEvent event handler
+ */
+ public void onDrag(DragEvent dragEvent) {
+ System.out.println("onDrag occured.");
+ System.out.println("DragValue: " + dragEvent.getDragValue());
+ System.out.println("DropValue: " + dragEvent.getDropValue());
+ }
+
+ /**
+ * Sample unique subnode identifier generation
+ *
+ * @param parentNode parent node
+ * @return unique subnode identifier
+ */
+ private Object getNewId(TreeNode parentNode) {
+ Map<Object, TreeNode> childs = new HashMap<Object, TreeNode>();
+ Iterator<Map.Entry<Object, TreeNode>> iter = parentNode.getChildren();
+ while (iter != null && iter.hasNext()) {
+ Map.Entry<Object, TreeNode> entry = iter.next();
+ childs.put(entry.getKey(), entry.getValue());
+ }
+
+ Integer index = 1;
+ while (childs.containsKey(index)) {
+ index++;
+ }
+ return index;
+ }
+
+ /**
+ * Drop event handler
+ * @param dropEvent Drop event
+ */
+ public void onDrop(DropEvent dropEvent) {
+ System.out.println("onDrop occured.");
+ System.out.println("DragValue: " + dropEvent.getDragValue());
+ System.out.println("DropValue: " + dropEvent.getDropValue());
+
+ // resolve drag source attributes
+ UITreeNode srcNode = (dropEvent.getDraggableSource() instanceof UITreeNode) ? (UITreeNode) dropEvent.getDraggableSource() : null;
+ UITree srcTree = srcNode != null ? srcNode.getUITree() : null;
+ TreeRowKey dragNodeKey = (dropEvent.getDragValue() instanceof TreeRowKey) ? (TreeRowKey) dropEvent.getDragValue() : null;
+
+ // resolve drag destination attributes
+ UITreeNode destNode = (dropEvent.getSource() instanceof UITreeNode) ? (UITreeNode) dropEvent.getSource() : null;
+ UITree destTree = destNode != null ? destNode.getUITree() : getTree(dropEvent);
+ TreeRowKey dropNodeKey = (dropEvent.getDropValue() instanceof TreeRowKey) ? (TreeRowKey) dropEvent.getDropValue() : null;
+
+ FacesContext context = FacesContext.getCurrentInstance();
+
+ if (dropNodeKey != null) {
+ // add destination node for rerender
+ destTree.addRequestKey(dropNodeKey);
+
+ Object state = null;
+ TreeNode draggedNode = null;
+ if (dragNodeKey != null) { // Drag from this or other tree
+ draggedNode = srcTree.getTreeNode(dragNodeKey);
+
+ TreeNode parentNode = draggedNode.getParent();
+ // 1. remove node from tree
+ state = srcTree.removeNode(dragNodeKey);
+ // 2. add parent for rerender
+ Object rowKey = srcTree.getTreeNodeRowKey(parentNode);
+ srcTree.addRequestKey(rowKey);
+ } else if (dropEvent.getDragValue() != null) { // Drag from some drag source
+ draggedNode = new TreeNodeImpl<String>();
+ draggedNode.setData(dropEvent.getDragValue().toString());
+ }
+
+ // generate new node id
+ Object id = getNewId(destTree.getTreeNode(dropNodeKey));
+ destTree.addNode(dropNodeKey, draggedNode, id, state);
+ }
+
+ AjaxContext ac = AjaxContext.getCurrentInstance();
+ // Add destination tree to reRender
+ try {
+ ac.addComponentToAjaxRender(destTree);
+ } catch (Exception e) {
+ System.err.print(e.getMessage());
+ }
+
+ // Add source tree to reRender
+ try {
+ ac.addComponentToAjaxRender(srcTree);
+ } catch (Exception e) {
+ System.err.print(e.getMessage());
+ }
+
+ System.out.println("+++++");
+ }
+}
Added: trunk/test-applications/facelets/src/main/resources/org/richfaces/simpleTreeData.properties
===================================================================
--- trunk/test-applications/facelets/src/main/resources/org/richfaces/simpleTreeData.properties (rev 0)
+++ trunk/test-applications/facelets/src/main/resources/org/richfaces/simpleTreeData.properties 2008-06-24 12:53:17 UTC (rev 9183)
@@ -0,0 +1,67 @@
+1=Daniel Defo
+1.1=Robinson Crusoe
+1.1.1=Start In Life
+1.1.2=Slavery And Escape
+1.1.3=Wrecked On A Desert Island
+1.1.4=First Weeks On The Island
+1.1.5=Builds A House - The Journal
+1.1.6=Ill And Conscience-Stricken
+1.1.7=Agricultural Experience
+1.1.8=Surveys His Position
+1.1.9=A Boat
+1.1.10=Tames Goats
+1.1.11=Finds Print Of Man's Foot On The Sand
+1.1.12=A Cave Retreat
+1.1.13=Wreck Of A Spanish Ship
+1.1.14=A Dream Realised
+1.1.15=Friday's Education
+1.1.16=Rescue Of Prisoners From Cannibals
+1.1.17=Visit Of Mutineers
+1.1.18=The Ship Recovered
+1.1.19=Return To England
+1.1.20=Fight Between Friday And A Bear
+2=Edgar Allan Poe
+2.1=Plays
+2.1.1=Politian
+2.2=Short stories
+2.2.1=The Assignation
+2.2.2=Berenice
+2.2.3=The Black Cat
+2.2.4=The Cask of Amontillado
+2.2.5=A Descent into the Maelstrom
+2.3=Poetry
+2.3.1=Alone
+2.3.2=An Enigma
+2.3.3=Annabel Lee
+2.3.4=Bridal Ballad
+3=Henry Wadsworth Longfellow
+3.1=The Song of Hiawatha
+3.1.1=Introduction
+3.1.2=I. The Peace-Pipe
+3.1.3=II. The Four Winds
+3.1.4=III. Hiawatha's Childhood
+3.1.5=IV. Hiawatha and Mudjekeewis
+3.1.6=V. Hiawatha's Fasting
+3.1.7=VI. Hiawatha's Friends
+3.1.8=VII. Hiawatha's Sailing
+3.1.9=VIII. Hiawatha's Fishing
+3.1.10=IX. Hiawatha and the Pearl-Feather
+3.1.11=X. Hiawatha's Wooing
+3.1.12=XI. Hiawatha's Wedding-Feast
+3.1.13=XII. The Son of the Evening Star
+3.1.14=XIII. Blessing the Cornfields
+3.1.15=XIV. Picture-Writing
+3.1.16=XV. Hiawatha's Lamentation
+3.1.17=XVI. Pau-Puk-Keewis
+3.1.18=XVII. The Hunting of Pau-Puk-Keewis
+3.1.19=XVIII. The Death of Kwasind
+3.1.20=XIX. The Ghosts
+3.1.21=XX. The Famine
+3.1.22=XXI. The White Man's Foot
+3.1.23=XXII. Hiawatha's Departure
+3.2=Poetry
+3.2.1=A Psalm Of Life
+3.2.2=Birds Of Passage
+3.2.3=Hiawatha's Childhood
+3.2.4=Hymn To The Night
+
Modified: trunk/test-applications/facelets/src/main/webapp/Tree/Tree.xhtml
===================================================================
--- trunk/test-applications/facelets/src/main/webapp/Tree/Tree.xhtml 2008-06-24 12:44:11 UTC (rev 9182)
+++ trunk/test-applications/facelets/src/main/webapp/Tree/Tree.xhtml 2008-06-24 12:53:17 UTC (rev 9183)
@@ -1,5 +1,34 @@
<f:subview xmlns:ui="http://java.sun.com/jsf/facelets" xmlns:f="http://java.sun.com/jsf/core" xmlns:a4j="http://richfaces.org/a4j" xmlns:h="http://java.sun.com/jsf/html" xmlns:rich="http://richfaces.org/rich" id="treeSubviewID">
+<style type="text/css">
+.LeftTreePane {
+
+}
+
+.RightTreePane {
+
+}
+
+.TreeContainer {
+ overflow: auto;
+ height: 400px;
+ border: 3px inset gray;
+}
+</style>
+<script type="text/javascript">
+ // <![CDATA[
+ function blinkElement(elt) {
+ while (elt.tagName.toLowerCase() != 'table') {
+ elt = elt.parentNode;
+ }
+
+ elt.style.borderColor= '#5555FF';
+ elt.style.borderStyle= 'dotted';
+ elt.style.borderWidth = '3px';
+ setTimeout( function() { this.style.borderStyle = 'none'; }.bind(elt), 300);
+ }
+ // ]]>
+ </script>
<a4j:outputPanel ajaxRendered="true">
<h:messages />
</a4j:outputPanel>
@@ -101,4 +130,65 @@
</rich:tree>
<rich:spacer></rich:spacer>
+ <!-- Drag and Drop API for rich:tree component -->
+ <div style="FONT-WEIGHT: bold;">Drag and Drop example</div>
+ <br />
+ <h:form>
+ <rich:dragIndicator id="treeIndicator">
+ <f:facet name="single">
+ <f:verbatim>{marker} {nodeParam}({treeParam})</f:verbatim>
+ </f:facet>
+ </rich:dragIndicator>
+
+ <h:panelGrid columns="2" columnClasses="LeftTreePane,RightTreePane">
+
+ <h:panelGroup id="leftContainer" layout="block"
+ styleClass="TreeContainer">
+ <h:outputText escape="false"
+ value="Selected Node: #{treeDndBean.leftSelectedNodeTitle}"
+ id="selectedNodeL" />
+
+ <rich:tree id="leftTree" style="width:300px"
+ nodeSelectListener="#{treeDndBean.processLSelection}"
+ reRender="selectedNodeL" ajaxSubmitSelection="true"
+ switchType="client" value="#{treeDndBean.treeNodeLeft}"
+ changeExpandListener="#{treeDndBean.onExpand}"
+ binding="#{treeDndBean.leftTree}"
+ onselected="window.status='selectedNode: '+event.selectedNode;"
+ onexpand="window.status='expandedNode: '+event.expandedNode"
+ oncollapse="window.status='collapsedNode: '+event.collapsedNode"
+ dropListener="#{treeDndBean.onDrop}"
+ dragListener="#{treeDndBean.onDrag}" dragIndicator="treeIndicator"
+ acceptedTypes="treeNode" dragType="treeNode" rowKeyVar="key"
+ var="item" >
+
+ <rich:dndParam name="treeParam" value="leftTree" />
+ </rich:tree>
+
+ </h:panelGroup>
+
+ <h:panelGroup id="rightContainer" layout="block"
+ styleClass="TreeContainer">
+ <h:outputText escape="false"
+ value="Selected Node: #{treeDndBean.rightSelectedNodeTitle}"
+ id="selectedNodeR" />
+
+ <rich:tree id="rightTree" style="width:300px"
+ nodeSelectListener="#{treeDndBean.processRSelection}"
+ reRender="selectedNodeR,rightContainer" ajaxSubmitSelection="true"
+ switchType="client" value="#{treeDndBean.treeNodeRight}"
+ changeExpandListener="#{treeDndBean.onExpand}"
+ binding="#{treeDndBean.rightTree}"
+ onselected="window.status='selectedNode: '+event.selectedNode;"
+ onexpand="window.status='expandedNode: '+event.expandedNode"
+ oncollapse="window.status='collapsedNode: '+event.collapsedNode"
+ rowKeyVar="key" dropListener="#{treeDndBean.onDrop}"
+ dragListener="#{treeDndBean.onDrag}" dragIndicator="treeIndicator"
+ acceptedTypes="treeNode" dragType="treeNode" var="item">
+ <rich:dndParam name="treeParam" value="rightTree" />
+ </rich:tree>
+ </h:panelGroup>
+
+ </h:panelGrid>
+ </h:form>
</f:subview>
Modified: trunk/test-applications/facelets/src/main/webapp/WEB-INF/faces-config-Tree.xml
===================================================================
--- trunk/test-applications/facelets/src/main/webapp/WEB-INF/faces-config-Tree.xml 2008-06-24 12:44:11 UTC (rev 9182)
+++ trunk/test-applications/facelets/src/main/webapp/WEB-INF/faces-config-Tree.xml 2008-06-24 12:53:17 UTC (rev 9183)
@@ -8,6 +8,11 @@
<managed-bean-scope>session</managed-bean-scope>
</managed-bean>
<managed-bean>
+ <managed-bean-name>treeDndBean</managed-bean-name>
+ <managed-bean-class>tree.TreeDndBean</managed-bean-class>
+ <managed-bean-scope>session</managed-bean-scope>
+ </managed-bean>
+ <managed-bean>
<managed-bean-name>pathwayBean</managed-bean-name>
<managed-bean-class>tree.TreeBean</managed-bean-class>
<managed-bean-scope>session</managed-bean-scope>
15 years, 10 months
JBoss Rich Faces SVN: r9182 - trunk/ui/fileUpload/src/main/resources/org/richfaces/renderkit/html/js.
by richfaces-svn-commits@lists.jboss.org
Author: pyaschenko
Date: 2008-06-24 08:44:11 -0400 (Tue, 24 Jun 2008)
New Revision: 9182
Added:
trunk/ui/fileUpload/src/main/resources/org/richfaces/renderkit/html/js/swfobject.js
Log:
http://jira.jboss.com/jira/browse/RF-3549
Added: trunk/ui/fileUpload/src/main/resources/org/richfaces/renderkit/html/js/swfobject.js
===================================================================
--- trunk/ui/fileUpload/src/main/resources/org/richfaces/renderkit/html/js/swfobject.js (rev 0)
+++ trunk/ui/fileUpload/src/main/resources/org/richfaces/renderkit/html/js/swfobject.js 2008-06-24 12:44:11 UTC (rev 9182)
@@ -0,0 +1,33 @@
+/* SWFObject v2.0 <http://code.google.com/p/swfobject/>
+ Copyright (c) 2007 Geoff Stearns, Michael Williams, and Bobby van der Sluis
+ This software is released under the MIT License <http://www.opensource.org/licenses/mit-license.php>
+*/
+
+/*
+Open Source Initiative OSI - The MIT License:Licensing
+Tue, 2006-10-31 04:56 � nelson
+
+The MIT License
+
+Copyright (c) <year> <copyright holders>
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+THE SOFTWARE.
+*/
+
+var swfobject=function(){var Z="undefined",P="object",B="Shockwave Flash",h="ShockwaveFlash.ShockwaveFlash",W="application/x-shockwave-flash",K="SWFObjectExprInst",G=window,g=document,N=navigator,f=[],H=[],Q=null,L=null,T=null,S=false,C=false;var a=function(){var l=typeof g.getElementById!=Z&&typeof g.getElementsByTagName!=Z&&typeof g.createElement!=Z&&typeof g.appendChild!=Z&&typeof g.replaceChild!=Z&&typeof g.removeChild!=Z&&typeof g.cloneNode!=Z,t=[0,0,0],n=null;if(typeof N.plugins!=Z&&typeof N.plugins[B]==P){n=N.plugins[B].description;if(n){n=n.replace(/^.*\s+(\S+\s+\S+$)/,"$1");t[0]=parseInt(n.replace(/^(.*)\..*$/,"$1"),10);t[1]=parseInt(n.replace(/^.*\.(.*)\s.*$/,"$1"),10);t[2]=/r/.test(n)?parseInt(n.replace(/^.*r(.*)$/,"$1"),10):0}}else{if(typeof G.ActiveXObject!=Z){var o=null,s=false;try{o=new ActiveXObject(h+".7")}catch(k){try{o=new ActiveXObject(h+".6");t=[6,0,21];o.AllowScriptAccess="always"}catch(k){if(t[0]==6){s=true}}if(!s){try{o=new ActiveXObject(h)}catch(k){!
}}}if(!s&&o){try{n=o.GetVariable("$version");if(n){n=n.split(" ")[1].split(",");t=[parseInt(n[0],10),parseInt(n[1],10),parseInt(n[2],10)]}}catch(k){}}}}var v=N.userAgent.toLowerCase(),j=N.platform.toLowerCase(),r=/webkit/.test(v)?parseFloat(v.replace(/^.*webkit\/(\d+(\.\d+)?).*$/,"$1")):false,i=false,q=j?/win/.test(j):/win/.test(v),m=j?/mac/.test(j):/mac/.test(v);/*@cc_on i=true;@if(@_win32)q=true;@elif(@_mac)m=true;@end@*/return{w3cdom:l,pv:t,webkit:r,ie:i,win:q,mac:m}}();var e=function(){if(!a.w3cdom){return }J(I);if(a.ie&&a.win){try{g.write("<script id=__ie_ondomload defer=true src=//:><\/script>");var i=c("__ie_ondomload");if(i){i.onreadystatechange=function(){if(this.readyState=="complete"){this.parentNode.removeChild(this);V()}}}}catch(j){}}if(a.webkit&&typeof g.readyState!=Z){Q=setInterval(function(){if(/loaded|complete/.test(g.readyState)){V()}},10)}if(typeof g.addEventListener!=Z){g.addEventListener("DOMContentLoaded",V,null)}M(V)}();function V(){if(S){return }if(a!
.ie&&a.win){var m=Y("span");try{var l=g.getElementsByTagName("body")[0
].appendChild(m);l.parentNode.removeChild(l)}catch(n){return }}S=true;if(Q){clearInterval(Q);Q=null}var j=f.length;for(var k=0;k<j;k++){f[k]()}}function J(i){if(S){i()}else{f[f.length]=i}}function M(j){if(typeof G.addEventListener!=Z){G.addEventListener("load",j,false)}else{if(typeof g.addEventListener!=Z){g.addEventListener("load",j,false)}else{if(typeof G.attachEvent!=Z){G.attachEvent("onload",j)}else{if(typeof G.onload=="function"){var i=G.onload;G.onload=function(){i();j()}}else{G.onload=j}}}}}function I(){var l=H.length;for(var j=0;j<l;j++){var m=H[j].id;if(a.pv[0]>0){var k=c(m);if(k){H[j].width=k.getAttribute("width")?k.getAttribute("width"):"0";H[j].height=k.getAttribute("height")?k.getAttribute("height"):"0";if(O(H[j].swfVersion)){if(a.webkit&&a.webkit<312){U(k)}X(m,true)}else{if(H[j].expressInstall&&!C&&O("6.0.65")&&(a.win||a.mac)){D(H[j])}else{d(k)}}}}else{X(m,true)}}}function U(m){var k=m.getElementsByTagName(P)[0];if(k){var p=Y("embed"),r=k.attributes;if(r){var o!
=r.length;for(var n=0;n<o;n++){if(r[n].nodeName.toLowerCase()=="data"){p.setAttribute("src",r[n].nodeValue)}else{p.setAttribute(r[n].nodeName,r[n].nodeValue)}}}var q=k.childNodes;if(q){var s=q.length;for(var l=0;l<s;l++){if(q[l].nodeType==1&&q[l].nodeName.toLowerCase()=="param"){p.setAttribute(q[l].getAttribute("name"),q[l].getAttribute("value"))}}}m.parentNode.replaceChild(p,m)}}function F(i){if(a.ie&&a.win&&O("8.0.0")){G.attachEvent("onunload",function(){var k=c(i);if(k){for(var j in k){if(typeof k[j]=="function"){k[j]=function(){}}}k.parentNode.removeChild(k)}})}}function D(j){C=true;var o=c(j.id);if(o){if(j.altContentId){var l=c(j.altContentId);if(l){L=l;T=j.altContentId}}else{L=b(o)}if(!(/%$/.test(j.width))&&parseInt(j.width,10)<310){j.width="310"}if(!(/%$/.test(j.height))&&parseInt(j.height,10)<137){j.height="137"}g.title=g.title.slice(0,47)+" - Flash Player Installation";var n=a.ie&&a.win?"ActiveX":"PlugIn",k=g.title,m="MMredirectURL="+G.location+"&MMplayerType="+n+"!
&MMdoctitle="+k,p=j.id;if(a.ie&&a.win&&o.readyState!=4){var i=Y("div")
;p+="SWFObjectNew";i.setAttribute("id",p);o.parentNode.insertBefore(i,o);o.style.display="none";G.attachEvent("onload",function(){o.parentNode.removeChild(o)})}R({data:j.expressInstall,id:K,width:j.width,height:j.height},{flashvars:m},p)}}function d(j){if(a.ie&&a.win&&j.readyState!=4){var i=Y("div");j.parentNode.insertBefore(i,j);i.parentNode.replaceChild(b(j),i);j.style.display="none";G.attachEvent("onload",function(){j.parentNode.removeChild(j)})}else{j.parentNode.replaceChild(b(j),j)}}function b(n){var m=Y("div");if(a.win&&a.ie){m.innerHTML=n.innerHTML}else{var k=n.getElementsByTagName(P)[0];if(k){var o=k.childNodes;if(o){var j=o.length;for(var l=0;l<j;l++){if(!(o[l].nodeType==1&&o[l].nodeName.toLowerCase()=="param")&&!(o[l].nodeType==8)){m.appendChild(o[l].cloneNode(true))}}}}}return m}function R(AE,AC,q){var p,t=c(q);if(typeof AE.id==Z){AE.id=q}if(a.ie&&a.win){var AD="";for(var z in AE){if(AE[z]!=Object.prototype[z]){if(z=="data"){AC.movie=AE[z]}else{if(z.toLowerCase()=!
="styleclass"){AD+=' class="'+AE[z]+'"'}else{if(z!="classid"){AD+=" "+z+'="'+AE[z]+'"'}}}}}var AB="";for(var y in AC){if(AC[y]!=Object.prototype[y]){AB+='<param name="'+y+'" value="'+AC[y]+'" />'}}t.outerHTML='<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"'+AD+">"+AB+"</object>";F(AE.id);p=c(AE.id)}else{if(a.webkit&&a.webkit<312){var AA=Y("embed");AA.setAttribute("type",W);for(var x in AE){if(AE[x]!=Object.prototype[x]){if(x=="data"){AA.setAttribute("src",AE[x])}else{if(x.toLowerCase()=="styleclass"){AA.setAttribute("class",AE[x])}else{if(x!="classid"){AA.setAttribute(x,AE[x])}}}}}for(var w in AC){if(AC[w]!=Object.prototype[w]){if(w!="movie"){AA.setAttribute(w,AC[w])}}}t.parentNode.replaceChild(AA,t);p=AA}else{var s=Y(P);s.setAttribute("type",W);for(var v in AE){if(AE[v]!=Object.prototype[v]){if(v.toLowerCase()=="styleclass"){s.setAttribute("class",AE[v])}else{if(v!="classid"){s.setAttribute(v,AE[v])}}}}for(var u in AC){if(AC[u]!=Object.prototype[u]&&u!="movie!
"){E(s,u,AC[u])}}t.parentNode.replaceChild(s,t);p=s}}return p}function
E(k,i,j){var l=Y("param");l.setAttribute("name",i);l.setAttribute("value",j);k.appendChild(l)}function c(i){return g.getElementById(i)}function Y(i){return g.createElement(i)}function O(k){var j=a.pv,i=k.split(".");i[0]=parseInt(i[0],10);i[1]=parseInt(i[1],10);i[2]=parseInt(i[2],10);return(j[0]>i[0]||(j[0]==i[0]&&j[1]>i[1])||(j[0]==i[0]&&j[1]==i[1]&&j[2]>=i[2]))?true:false}function A(m,j){if(a.ie&&a.mac){return }var l=g.getElementsByTagName("head")[0],k=Y("style");k.setAttribute("type","text/css");k.setAttribute("media","screen");if(!(a.ie&&a.win)&&typeof g.createTextNode!=Z){k.appendChild(g.createTextNode(m+" {"+j+"}"))}l.appendChild(k);if(a.ie&&a.win&&typeof g.styleSheets!=Z&&g.styleSheets.length>0){var i=g.styleSheets[g.styleSheets.length-1];if(typeof i.addRule==P){i.addRule(m,j)}}}function X(k,i){var j=i?"visible":"hidden";if(S){c(k).style.visibility=j}else{A("#"+k,"visibility:"+j)}}return{registerObject:function(l,i,k){if(!a.w3cdom||!l||!i){return }var j={};j.id=l;j.sw!
fVersion=i;j.expressInstall=k?k:false;H[H.length]=j;X(l,false)},getObjectById:function(l){var i=null;if(a.w3cdom&&S){var j=c(l);if(j){var k=j.getElementsByTagName(P)[0];if(!k||(k&&typeof j.SetVariable!=Z)){i=j}else{if(typeof k.SetVariable!=Z){i=k}}}}return i},embedSWF:function(n,u,r,t,j,m,k,p,s){if(!a.w3cdom||!n||!u||!r||!t||!j){return }r+="";t+="";if(O(j)){X(u,false);var q=(typeof s==P)?s:{};q.data=n;q.width=r;q.height=t;var o=(typeof p==P)?p:{};if(typeof k==P){for(var l in k){if(k[l]!=Object.prototype[l]){if(typeof o.flashvars!=Z){o.flashvars+="&"+l+"="+k[l]}else{o.flashvars=l+"="+k[l]}}}}J(function(){R(q,o,u);if(q.id==u){X(u,true)}})}else{if(m&&!C&&O("6.0.65")&&(a.win||a.mac)){X(u,false);J(function(){var i={};i.id=i.altContentId=u;i.width=r;i.height=t;i.expressInstall=m;D(i)})}}},getFlashPlayerVersion:function(){return{major:a.pv[0],minor:a.pv[1],release:a.pv[2]}},hasFlashPlayerVersion:O,createSWF:function(k,j,i){if(a.w3cdom&&S){return R(k,j,i)}else{return undefined}},cr!
eateCSS:function(j,i){if(a.w3cdom){A(j,i)}},addDomLoadEvent:J,addLoadE
vent:M,getQueryParamValue:function(m){var l=g.location.search||g.location.hash;if(m==null){return l}if(l){var k=l.substring(1).split("&");for(var j=0;j<k.length;j++){if(k[j].substring(0,k[j].indexOf("="))==m){return k[j].substring((k[j].indexOf("=")+1))}}}return""},expressInstallCallback:function(){if(C&&L){var i=c(K);if(i){i.parentNode.replaceChild(L,i);if(T){X(T,true);if(a.ie&&a.win){L.style.display="block"}}L=null;T=null;C=false}}}}}();
\ No newline at end of file
15 years, 10 months
JBoss Rich Faces SVN: r9181 - in trunk/test-applications/seleniumTest/src: main/webapp/WEB-INF and 3 other directories.
by richfaces-svn-commits@lists.jboss.org
Author: andrei_exadel
Date: 2008-06-24 08:33:22 -0400 (Tue, 24 Jun 2008)
New Revision: 9181
Added:
trunk/test-applications/seleniumTest/src/main/java/org/ajax4jsf/bean/A4JActionParam.java
trunk/test-applications/seleniumTest/src/main/webapp/pages/actionParam/
trunk/test-applications/seleniumTest/src/main/webapp/pages/actionParam/actionParam.xhtml
trunk/test-applications/seleniumTest/src/test/java/org/richfaces/testng/AjaxActionParameterTest.java
Modified:
trunk/test-applications/seleniumTest/src/main/webapp/WEB-INF/faces-config.xml
Log:
actionParameter test
Added: trunk/test-applications/seleniumTest/src/main/java/org/ajax4jsf/bean/A4JActionParam.java
===================================================================
--- trunk/test-applications/seleniumTest/src/main/java/org/ajax4jsf/bean/A4JActionParam.java (rev 0)
+++ trunk/test-applications/seleniumTest/src/main/java/org/ajax4jsf/bean/A4JActionParam.java 2008-06-24 12:33:22 UTC (rev 9181)
@@ -0,0 +1,58 @@
+package org.ajax4jsf.bean;
+
+import java.util.Map;
+
+import javax.faces.context.FacesContext;
+import javax.faces.event.ActionEvent;
+
+import com.sun.faces.context.FacesContextImpl;
+
+public class A4JActionParam {
+
+ private static final String PARAMETER_NAME = "param";
+
+ private static final String PARAMETER_VALUE = "Action Parameter";
+
+ private String parameterName;
+
+ private String parameterValue;
+
+ public void listener(ActionEvent event) {
+ FacesContext context = FacesContextImpl.getCurrentInstance();
+ Map<String, String> p = context.getExternalContext().getRequestParameterMap();
+ if (p.get(PARAMETER_NAME) != null && p.get(PARAMETER_NAME).equals(PARAMETER_VALUE)) {
+ parameterName = PARAMETER_NAME;
+ }
+ }
+
+ /**
+ * @return the parameter
+ */
+ public String getParameter() {
+ return (parameterName != null || parameterValue!=null) ? (parameterName + "='" + parameterValue + "'") : "";
+ }
+
+ /**
+ * @param parameter the parameter to set
+ */
+ public void setParameter(String parameter) {
+ ;
+ }
+
+ /**
+ * @return the parameterValue
+ */
+ public String getParameterValue() {
+ return parameterValue;
+ }
+
+ /**
+ * @param parameterValue the parameterValue to set
+ */
+ public void setParameterValue(String parameterValue) {
+ this.parameterValue = parameterValue;
+ }
+
+
+
+}
Modified: trunk/test-applications/seleniumTest/src/main/webapp/WEB-INF/faces-config.xml
===================================================================
--- trunk/test-applications/seleniumTest/src/main/webapp/WEB-INF/faces-config.xml 2008-06-24 12:26:06 UTC (rev 9180)
+++ trunk/test-applications/seleniumTest/src/main/webapp/WEB-INF/faces-config.xml 2008-06-24 12:33:22 UTC (rev 9181)
@@ -145,4 +145,9 @@
<managed-bean-class>org.ajax4jsf.bean.AjaxListenerTestBean</managed-bean-class>
<managed-bean-scope>request</managed-bean-scope>
</managed-bean>
+ <managed-bean>
+ <managed-bean-name>actionParam</managed-bean-name>
+ <managed-bean-class>org.ajax4jsf.bean.A4JActionParam</managed-bean-class>
+ <managed-bean-scope>request</managed-bean-scope>
+ </managed-bean>
</faces-config>
\ No newline at end of file
Added: trunk/test-applications/seleniumTest/src/main/webapp/pages/actionParam/actionParam.xhtml
===================================================================
--- trunk/test-applications/seleniumTest/src/main/webapp/pages/actionParam/actionParam.xhtml (rev 0)
+++ trunk/test-applications/seleniumTest/src/main/webapp/pages/actionParam/actionParam.xhtml 2008-06-24 12:33:22 UTC (rev 9181)
@@ -0,0 +1,32 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml"
+ xmlns:a4j="http://richfaces.org/a4j"
+ xmlns:rich="http://richfaces.org/rich"
+ xmlns:h="http://java.sun.com/jsf/html"
+ xmlns:f="http://java.sun.com/jsf/core"
+ xmlns:ui="http://java.sun.com/jsf/facelets">
+
+<ui:composition template="#{templateBean.template}">
+ <ui:define name="style">
+
+ </ui:define>
+ <ui:define name="component">
+
+ <table style="width: 600px"><tr>
+ <td><b>Parameter:</b></td>
+ <td><h:outputText style="color: green" value="#{actionParam.parameter}" id="_parameter"></h:outputText></td>
+ </tr></table>
+ <h:form id="_form1">
+ <a4j:commandLink value="Ajax Submit" id="ajaxSubmit" reRender="_parameter" actionListener="#{actionParam.listener}">
+ <a4j:actionparam assignTo="#{actionParam.parameterValue}" name="param" value="Action Parameter"></a4j:actionparam>
+ </a4j:commandLink>
+ </h:form>
+
+ <h:form id="_form2">
+ <h:commandLink value="Html Submit" id="htmlSubmit" actionListener="#{actionParam.listener}">
+ <a4j:actionparam assignTo="#{actionParam.parameterValue}" name="param" value="Action Parameter"></a4j:actionparam>
+ </h:commandLink>
+ </h:form>
+ </ui:define>
+</ui:composition>
+</html>
\ No newline at end of file
Added: trunk/test-applications/seleniumTest/src/test/java/org/richfaces/testng/AjaxActionParameterTest.java
===================================================================
--- trunk/test-applications/seleniumTest/src/test/java/org/richfaces/testng/AjaxActionParameterTest.java (rev 0)
+++ trunk/test-applications/seleniumTest/src/test/java/org/richfaces/testng/AjaxActionParameterTest.java 2008-06-24 12:33:22 UTC (rev 9181)
@@ -0,0 +1,90 @@
+package org.richfaces.testng;
+
+import org.ajax4jsf.template.Template;
+import org.richfaces.RichSeleniumTest;
+import org.richfaces.SeleniumTestBase;
+import org.testng.Assert;
+import org.testng.annotations.AfterMethod;
+import org.testng.annotations.BeforeMethod;
+import org.testng.annotations.Parameters;
+import org.testng.annotations.Test;
+
+public class AjaxActionParameterTest extends SeleniumTestBase implements
+ RichSeleniumTest {
+
+ public AjaxActionParameterTest() {
+ super("http", "localhost", serverPort);
+ }
+
+ /**
+ * This method are invoking before selenium tests started
+ */
+ @BeforeMethod
+ @Parameters( { "browser", "filterPrefix" })
+ public void startSelenium(String browser, String filterPrefix) {
+ super.startSelenium(browser, filterPrefix);
+ }
+
+ @BeforeMethod
+ @Parameters( { "loadStyleStrategy", "loadScriptStrategy" })
+ protected void loadConfiguration(String loadStyleStrategy,
+ String loadScriptStrategy) throws Exception {
+ super.loadConfiguration(loadStyleStrategy, loadScriptStrategy);
+ }
+
+ /**
+ * This method are invoking after selenium tests completed
+ */
+ @AfterMethod(alwaysRun = true)
+ public void stopSelenium() {
+ super.stopSelenium();
+ }
+
+ @Test
+ public void testAjaxCommandLinkComponent() throws Exception {
+ _testAjaxCommandLinkComponent(Template.SIMPLE);
+ _testAjaxCommandLinkComponent(Template.DATA_TABLE);
+ }
+
+ private void _testAjaxCommandLinkComponent(Template template) {
+ renderPage(template);
+ String parentId = getParentId();
+
+ String paramID = parentId + "_parameter";
+ String ajaxButttonID = parentId + "_form1:ajaxSubmit";
+ String htmlButttonID = parentId + "_form2:htmlSubmit";
+
+ clickById(ajaxButttonID);
+ waitForAjaxCompletion();
+
+ String parameter = getTextById(paramID);
+ if (parameter == null) {
+ writeStatus("<a4j:actionParameter> failed. Parameter has been not sent with ajax request.");
+ Assert.fail("<a4j:actionParameter> failed. Parameter has been not sent with ajax request.");
+ } else if (parameter != null && parameter.equals("param='null'")) {
+ writeStatus("<a4j:actionParameter> failed. Parameter value has been not assigned to bean");
+ Assert.fail("<a4j:actionParameter> failed. Parameter value has been not assigned to bean");
+ } else {
+ writeStatus("<a4j:actionParameter> passed successfully");
+ }
+
+ clickCommandAndWait(htmlButttonID);
+
+ parameter = getTextById(paramID);
+ if (parameter == null) {
+ writeStatus("<a4j:actionParameter> failed. Parameter has been not sent with ajax request.");
+ Assert.fail("<a4j:actionParameter> failed. Parameter has been not sent with ajax request.");
+ } else if (parameter != null && parameter.equals("param='null'")) {
+ writeStatus("<a4j:actionParameter> failed. Parameter value has been not assigned to bean");
+ Assert.fail("<a4j:actionParameter> failed. Parameter value has been not assigned to bean");
+ } else {
+ writeStatus("<a4j:actionParameter> passed successfully");
+ }
+ }
+
+ @Override
+ public String getTestUrl() {
+ return "pages/actionParam/actionParam.xhtml";
+ }
+
+}
15 years, 10 months