JBoss Rich Faces SVN: r9150 - trunk/docs/userguide/en/src/main/resources/css.
by richfaces-svn-commits@lists.jboss.org
Author: msorokin
Date: 2008-06-20 13:42:58 -0400 (Fri, 20 Jun 2008)
New Revision: 9150
Modified:
trunk/docs/userguide/en/src/main/resources/css/html.css
Log:
RF-2305 Document component JS API
A CSS class for highlighting incorrect js api is added
Modified: trunk/docs/userguide/en/src/main/resources/css/html.css
===================================================================
--- trunk/docs/userguide/en/src/main/resources/css/html.css 2008-06-20 17:33:53 UTC (rev 9149)
+++ trunk/docs/userguide/en/src/main/resources/css/html.css 2008-06-20 17:42:58 UTC (rev 9150)
@@ -83,4 +83,6 @@
a.updated {
background:transparent url(../images/updated.png) no-repeat scroll right top;
padding-right:70px;
-}
\ No newline at end of file
+}
+.tbi {color: #aaaaaa;}
+.tbi p {color: #333333;}
\ No newline at end of file
15 years, 11 months
JBoss Rich Faces SVN: r9149 - trunk/docs/userguide/en/src/main/docbook/included.
by richfaces-svn-commits@lists.jboss.org
Author: msorokin
Date: 2008-06-20 13:33:53 -0400 (Fri, 20 Jun 2008)
New Revision: 9149
Modified:
trunk/docs/userguide/en/src/main/docbook/included/comboBox.xml
Log:
RF-2305 Document component JS API
JS API is corrected
Modified: trunk/docs/userguide/en/src/main/docbook/included/comboBox.xml
===================================================================
--- trunk/docs/userguide/en/src/main/docbook/included/comboBox.xml 2008-06-20 17:33:43 UTC (rev 9148)
+++ trunk/docs/userguide/en/src/main/docbook/included/comboBox.xml 2008-06-20 17:33:53 UTC (rev 9149)
@@ -274,12 +274,12 @@
<entry>Hides the popup list</entry>
</row>
<row>
- <entry>enable()</entry>
- <entry>Enables the control for input</entry>
+ <entry role="tbi">enable()</entry>
+ <entry role="tbi">Enables the control for input <para>(to be implemented)</para></entry>
</row>
<row>
- <entry>disable()</entry>
- <entry>Disables the control for input</entry>
+ <entry role="tbi">disable()</entry>
+ <entry role="tbi">Disables the control for input <para>(to be implemented)</para></entry>
</row>
</tbody>
</tgroup>
15 years, 11 months
JBoss Rich Faces SVN: r9148 - trunk/docs/userguide/en/src/main/docbook/included.
by richfaces-svn-commits@lists.jboss.org
Author: msorokin
Date: 2008-06-20 13:33:43 -0400 (Fri, 20 Jun 2008)
New Revision: 9148
Modified:
trunk/docs/userguide/en/src/main/docbook/included/calendar.xml
Log:
RF-2305 Document component JS API
JS API is corrected
Modified: trunk/docs/userguide/en/src/main/docbook/included/calendar.xml
===================================================================
--- trunk/docs/userguide/en/src/main/docbook/included/calendar.xml 2008-06-20 15:11:23 UTC (rev 9147)
+++ trunk/docs/userguide/en/src/main/docbook/included/calendar.xml 2008-06-20 17:33:43 UTC (rev 9148)
@@ -486,33 +486,33 @@
</row>
<row>
- <entry>isDateEnabled(date)</entry>
+ <entry role="tbi">isDateEnabled(date)</entry>
- <entry>Checks if given date is selectable</entry>
+ <entry role="tbi">Checks if given date is selectable <para>(to be implemented)</para></entry>
</row>
<row>
- <entry>enableDate(date)</entry>
+ <entry role="tbi">enableDate(date)</entry>
- <entry>Enables date cell control on the calendar</entry>
+ <entry role="tbi">Enables date cell control on the calendar <para>(to be implemented)</para></entry>
</row>
<row>
- <entry>disableDate(date)</entry>
+ <entry role="tbi">disableDate(date)</entry>
- <entry>Disables date cell control on the calendar</entry>
+ <entry role="tbi">Disables date cell control on the calendar <para>(to be implemented)</para></entry>
</row>
<row>
- <entry>enableDates(date[])</entry>
+ <entry role="tbi">enableDates(date[])</entry>
- <entry>Enables dates cell controls set on the calendar</entry>
+ <entry role="tbi">Enables dates cell controls set on the calendar <para>(to be implemented)</para></entry>
</row>
<row>
- <entry>disableDates(date[])</entry>
+ <entry role="tbi">disableDates(date[])</entry>
- <entry>Disables dates cell controls set on the calendar</entry>
+ <entry role="tbi">Disables dates cell controls set on the calendar <para>(to be implemented)</para></entry>
</row>
<row>
15 years, 11 months
JBoss Rich Faces SVN: r9147 - in trunk/docs/cdkguide/en/src/main: docbook/modules and 1 other directories.
by richfaces-svn-commits@lists.jboss.org
Author: artdaw
Date: 2008-06-20 11:11:23 -0400 (Fri, 20 Jun 2008)
New Revision: 9147
Added:
trunk/docs/cdkguide/en/src/main/docbook/modules/ide.xml
trunk/docs/cdkguide/en/src/main/docbook/modules/ref.xml
trunk/docs/cdkguide/en/src/main/docbook/modules/test.xml
Modified:
trunk/docs/cdkguide/en/src/main/docbook/master.xml
trunk/docs/cdkguide/en/src/main/docbook/modules/ccreate.xml
trunk/docs/cdkguide/en/src/main/docbook/modules/compdev.xml
trunk/docs/cdkguide/en/src/main/docbook/modules/namingconv.xml
trunk/docs/cdkguide/en/src/main/docbook/modules/overview.xml
trunk/docs/cdkguide/en/src/main/docbook/modules/roadmap.xml
trunk/docs/cdkguide/en/src/main/resources/xslt/org/jboss/richfaces/xhtml-common.xsl
Log:
http://jira.jboss.com/jira/browse/RF-3692 - TOC was fixed
Modified: trunk/docs/cdkguide/en/src/main/docbook/master.xml
===================================================================
--- trunk/docs/cdkguide/en/src/main/docbook/master.xml 2008-06-20 15:08:44 UTC (rev 9146)
+++ trunk/docs/cdkguide/en/src/main/docbook/master.xml 2008-06-20 15:11:23 UTC (rev 9147)
@@ -10,10 +10,15 @@
<!ENTITY ccreate SYSTEM "modules/ccreate.xml">
<!ENTITY compdev SYSTEM "modules/compdev.xml">
<!ENTITY overview SYSTEM "modules/overview.xml">
-<!ENTITY links SYSTEM "modules/links.xml">
+<!ENTITY ide SYSTEM "modules/ide.xml">
+<!ENTITY ref SYSTEM "modules/ref.xml">
+<!ENTITY test SYSTEM "modules/test.xml">
<!ENTITY devinput SYSTEM "includes/devinput.xml">
<!ENTITY devcommand SYSTEM "includes/devcommand.xml">
+
+<!--Check the links page -->
+<!ENTITY links SYSTEM "modules/links.xml">
]>
<book>
@@ -34,6 +39,7 @@
&pcreate;
&ccreate;
&compdev;
+ &test;
&overview;
<chapter id="tutorial" xreflabel="tutorial">
@@ -53,5 +59,6 @@
&devinput;
&devcommand;
</chapter>
- &links;
+ &ide;
+ &ref;
</book>
Modified: trunk/docs/cdkguide/en/src/main/docbook/modules/ccreate.xml
===================================================================
--- trunk/docs/cdkguide/en/src/main/docbook/modules/ccreate.xml 2008-06-20 15:08:44 UTC (rev 9146)
+++ trunk/docs/cdkguide/en/src/main/docbook/modules/ccreate.xml 2008-06-20 15:11:23 UTC (rev 9147)
@@ -15,14 +15,14 @@
</para>
<section id="skeleton" xreflabel="skeleton">
<?dbhtml filename="skeleton.html"?>
- <title>Building the Component Skeleton</title>
+ <title>Building the component skeleton</title>
<para>
TBD Skeleton
</para>
</section>
<section id="structure" xreflabel="structure">
<?dbhtml filename="structure.html"?>
- <title>Component Project Structure</title>
+ <title>Component project structure</title>
<para>
TBD structure
</para>
Modified: trunk/docs/cdkguide/en/src/main/docbook/modules/compdev.xml
===================================================================
--- trunk/docs/cdkguide/en/src/main/docbook/modules/compdev.xml 2008-06-20 15:08:44 UTC (rev 9146)
+++ trunk/docs/cdkguide/en/src/main/docbook/modules/compdev.xml 2008-06-20 15:11:23 UTC (rev 9147)
@@ -20,39 +20,46 @@
</para>
</section>
<section id="settings">
- <title>Specifying component settings</title>
+ <title>Specifying component attributes</title>
<para>
settings
</para>
</section>
- <section id="template">
- <title>Templating</title>
+
+ <section id="renderer">
+ <title>Creating component renderer</title>
<para>
- Templating
+ Renderer explanation.
</para>
- <section id="tempex">
- <title>Template Example</title>
+ <section id="template">
+ <title>Templating</title>
<para>
- Example
+ 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>
- <section id="tempmech">
- <title>Templating Mechanism</title>
- <para>
- Mechanism
- </para>
- </section>
- <section id="temptags">
- <title>Templates Tags Overview</title>
- <para>
- tags
- </para>
- </section>
</section>
<section id="skin">
- <title>Skinability</title>
+ <title>Skinnability</title>
<para>
- Skinability
+ Plug-n-Skin creation
</para>
</section>
<section id="resource">
@@ -60,6 +67,18 @@
<para>
Resources Handling
</para>
+ <section id="regres">
+ <title>Component resources registration</title>
+ <para>
+ How to register component resources
+ </para>
+ </section>
+ <section id="resconf">
+ <title>resources-config.xml file format</title>
+ <para>
+ resources-config.xml file format
+ </para>
+ </section>
</section>
</chapter>
Added: trunk/docs/cdkguide/en/src/main/docbook/modules/ide.xml
===================================================================
--- trunk/docs/cdkguide/en/src/main/docbook/modules/ide.xml (rev 0)
+++ trunk/docs/cdkguide/en/src/main/docbook/modules/ide.xml 2008-06-20 15:11:23 UTC (rev 9147)
@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<chapter id="ide" xreflabel="ide">
+ <?dbhtml filename="ide.html"?>
+ <chapterinfo>
+ <keywordset>
+ <keyword>ide</keyword>
+ <keyword>CDK</keyword>
+ <keyword>Guide</keyword>
+ </keywordset>
+ </chapterinfo>
+
+ <title>IDE Integration</title>
+ <para>
+ Integration with Eclipse, IDEA.
+ </para>
+
+</chapter>
\ No newline at end of file
Modified: trunk/docs/cdkguide/en/src/main/docbook/modules/namingconv.xml
===================================================================
--- trunk/docs/cdkguide/en/src/main/docbook/modules/namingconv.xml 2008-06-20 15:08:44 UTC (rev 9146)
+++ trunk/docs/cdkguide/en/src/main/docbook/modules/namingconv.xml 2008-06-20 15:11:23 UTC (rev 9147)
@@ -9,7 +9,7 @@
</keywordset>
</chapterinfo>
- <title>Naming Convention</title>
+ <title>Naming conventions</title>
<para>
Naming
</para>
Modified: trunk/docs/cdkguide/en/src/main/docbook/modules/overview.xml
===================================================================
--- trunk/docs/cdkguide/en/src/main/docbook/modules/overview.xml 2008-06-20 15:08:44 UTC (rev 9146)
+++ trunk/docs/cdkguide/en/src/main/docbook/modules/overview.xml 2008-06-20 15:11:23 UTC (rev 9147)
@@ -13,7 +13,12 @@
<para>
overview
</para>
-
+ <section id="devsample">
+ <title>Developer sample creation</title>
+ <para>
+Sample creation
+ </para>
+ </section>
</chapter>
Added: trunk/docs/cdkguide/en/src/main/docbook/modules/ref.xml
===================================================================
--- trunk/docs/cdkguide/en/src/main/docbook/modules/ref.xml (rev 0)
+++ trunk/docs/cdkguide/en/src/main/docbook/modules/ref.xml 2008-06-20 15:11:23 UTC (rev 9147)
@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<chapter id="ref" xreflabel="ref">
+ <?dbhtml filename="ref.html"?>
+ <chapterinfo>
+ <keywordset>
+ <keyword>reference</keyword>
+ <keyword>CDK</keyword>
+ <keyword>Guide</keyword>
+ </keywordset>
+ </chapterinfo>
+
+ <title>CDK Tag Reference</title>
+ <para>
+ Tag Reference
+ </para>
+
+</chapter>
\ No newline at end of file
Modified: trunk/docs/cdkguide/en/src/main/docbook/modules/roadmap.xml
===================================================================
--- trunk/docs/cdkguide/en/src/main/docbook/modules/roadmap.xml 2008-06-20 15:08:44 UTC (rev 9146)
+++ trunk/docs/cdkguide/en/src/main/docbook/modules/roadmap.xml 2008-06-20 15:11:23 UTC (rev 9147)
@@ -9,7 +9,7 @@
</keywordset>
</chapterinfo>
- <title>Document Roadmap</title>
+ <title>Roadmap document</title>
<para>
This document is aimed to describe components development with Ajax4jsf Component Factory and factory features.
</para>
Added: trunk/docs/cdkguide/en/src/main/docbook/modules/test.xml
===================================================================
--- trunk/docs/cdkguide/en/src/main/docbook/modules/test.xml (rev 0)
+++ trunk/docs/cdkguide/en/src/main/docbook/modules/test.xml 2008-06-20 15:11:23 UTC (rev 9147)
@@ -0,0 +1,18 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<chapter id="test" xreflabel="test">
+ <?dbhtml filename="test.html"?>
+ <chapterinfo>
+ <keywordset>
+ <keyword>test</keyword>
+ <keyword>unit</keyword>
+ <keyword>CDK</keyword>
+ <keyword>Guide</keyword>
+ </keywordset>
+ </chapterinfo>
+
+ <title>Generating unit tests</title>
+ <para>
+ Unit Tests
+ </para>
+
+</chapter>
\ No newline at end of file
Modified: trunk/docs/cdkguide/en/src/main/resources/xslt/org/jboss/richfaces/xhtml-common.xsl
===================================================================
--- trunk/docs/cdkguide/en/src/main/resources/xslt/org/jboss/richfaces/xhtml-common.xsl 2008-06-20 15:08:44 UTC (rev 9146)
+++ trunk/docs/cdkguide/en/src/main/resources/xslt/org/jboss/richfaces/xhtml-common.xsl 2008-06-20 15:11:23 UTC (rev 9147)
@@ -8,11 +8,11 @@
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
- <xsl:import href="collapsing-navigation.xsl"/>
+ <!--xsl:import href="collapsing-navigation.xsl"/-->
<xsl:param name="html.stylesheet" select="'css/html.css'"/>
<xsl:param name="generate.toc" select="'book toc'"/>
-
+ <xsl:param name="toc.section.depth" select="5"/>
<!--
From: xhtml/docbook.xsl
Reason: Remove inline style for draft mode
15 years, 11 months
JBoss Rich Faces SVN: r9146 - trunk/test-applications/seleniumTest/src/test/java/org/richfaces/testng.
by richfaces-svn-commits@lists.jboss.org
Author: alevkovsky
Date: 2008-06-20 11:08:44 -0400 (Fri, 20 Jun 2008)
New Revision: 9146
Added:
trunk/test-applications/seleniumTest/src/test/java/org/richfaces/testng/AjaxOutputPanelTest.java
Removed:
trunk/test-applications/seleniumTest/src/test/java/org/richfaces/testng/AjaxOutputPanelTest.java
Log:
Adjust test code
Deleted: trunk/test-applications/seleniumTest/src/test/java/org/richfaces/testng/AjaxOutputPanelTest.java
===================================================================
--- trunk/test-applications/seleniumTest/src/test/java/org/richfaces/testng/AjaxOutputPanelTest.java 2008-06-20 14:33:23 UTC (rev 9145)
+++ trunk/test-applications/seleniumTest/src/test/java/org/richfaces/testng/AjaxOutputPanelTest.java 2008-06-20 15:08:44 UTC (rev 9146)
@@ -1,303 +0,0 @@
-/*
- * AjaxOutputPanel.java Date created: 10.06.2008
- * Last modified by: $Author$
- * $Revision$ $Date$
- */
-
-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;
-
-/**
- * Ajax Output Panel selenium test
- *
- * @author Alexandr Levkovsky
- *
- */
-public class AjaxOutputPanelTest extends SeleniumTestBase implements RichSeleniumTest {
-
- private final static String FORM_ID = "form:";
-
- private final static String PANEL1_ID = "panel_1";
-
- private final static String PANEL2_ID = "panel_2";
-
- private final static String PANEL3_ID = "panel_3";
-
- private final static String PANEL4_ID = "panel_4";
-
- private final static String BUTTON1_ID = "b1";
-
- private final static String BUTTON2_ID = "b2";
-
- private final static String BUTTON3_ID = "b3";
-
- private final static String BUTTON4_ID = "b4";
-
- private final static String TEXT_SUFFIX = "_text";
-
- private final static String RESULT_SUFFIX = "_result";
-
- public AjaxOutputPanelTest() {
- 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);
-
- // TODO should pass as parameter
- renderPage(Template.SIMPLE);
- }
-
- @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();
- }
-
- public String getTestUrl() {
- return "pages/ajaxOutputPanel/ajaxOutputPanelTest.xhtml";
- }
-
- @Test
- public void testLayoutAttribute() throws Exception {
- // panel_1 has layout=inline(default)
- // panel_2 has layout=block
- // panel_3 has layout=none
- writeStatus("Testing layout attribute...");
-
- String panelId = getParentId() + FORM_ID + PANEL1_ID;
- String panel2Id = getParentId() + FORM_ID + PANEL2_ID;
- String panel3Id = getParentId() + FORM_ID + PANEL3_ID;
-
- Assert.assertTrue(isPresentById(panelId));
- String type = runScript("getElementType('" + panelId + "')");
- Assert.assertEquals(type.toLowerCase(), "span", "panel_1 has layout=inline(default) and should be 'span' element");
-
- Assert.assertTrue(isPresentById(panel2Id));
- type = runScript("getElementType('" + panel2Id + "')");
- Assert.assertEquals(type.toLowerCase(), "div", "panel_2 has layout=block and should be 'div' element");
-
- // panel_3 has layout=none and should not present if a child component
- // is rendered
- Assert.assertFalse(isPresentById(panel3Id), "panel_3 has layout=none and should not peresent if a child component is rendered ");
-
- // remove child component rendering
- writeStatus("Click button 3");
- String buttonId = getParentId() + FORM_ID + BUTTON3_ID;
- clickById(buttonId);
- waitForAjaxCompletion();
-
- // panel_3 has layout=none and should present if no child component is
- // rendered with id of a child component and display:none style
- Assert.assertTrue(isPresentById(panel3Id + "_text"), "panel_3 has layout=none and should peresent if no child component is rendered with id of a child component");
- Assert.assertFalse(isVisibleById(panel3Id + "_text"), "panel_3 has layout=none and should peresent if no child component is rendered with display:none style");
-
- }
-
- @Test
- public void testRenderedAttribute() throws Exception {
- writeStatus("Testing rendered attribute...");
-
- String panelId = getParentId() + FORM_ID + PANEL4_ID;
-
- // panel_4 has rendered=true and should present on page
- AssertRendered(panelId);
-
- // change rendered attribute to false
- writeStatus("Click button 4");
- String buttonId = getParentId() + FORM_ID + BUTTON4_ID;
- clickCommandAndWait(buttonId);
-
- // panel_4 has rendered=false and should not present on page
- AssertNotRendered(panelId);
- }
-
- @Test
- public void testAjaxRenderedAttribute() throws Exception {
- // panel_1 has ajaxRendered=false and is reRender by b1
- // panel_2 has ajaxRendered=true
- writeStatus("Testing ajaxRendered attribute...");
-
- String parentId = getParentId() + FORM_ID;
- String panelId = parentId + PANEL1_ID + TEXT_SUFFIX;
- String panelId2 = parentId + PANEL2_ID + TEXT_SUFFIX;
- String buttonId = parentId + BUTTON2_ID;
- writeStatus("Click button 2");
- // set panel_1 text visible flag to false
- clickById(buttonId);
- waitForAjaxCompletion();
- // panel_1 text should be visible as it reRendered only by b1
- Assert.assertTrue(isPresentById(panelId), "panel_1 text should be visible as it reRendered only by b1");
-
- // panel_2 text should not be visible as it has ajaxRendered=true
- Assert.assertFalse(isPresentById(panelId2), "panel_2 text should not be visible as it has ajaxRendered=true");
-
- buttonId = parentId + BUTTON1_ID;
- writeStatus("Click button 1");
- clickById(buttonId);
- waitForAjaxCompletion();
- // panel text should NOT be visible as it reRendered by b1
- Assert.assertFalse(isPresentById(panelId), "panel_1 text should not be visible as it reRendered by b1");
-
- }
-
- @Test
- public void testAjaxRenderedAttributeWithLimitToList() throws Exception {
- // panel_1 has ajaxRendered=false and is reRender by b1 with
- // limitToList=true
- // panel_2 has ajaxRendered=true
- writeStatus("Testing ajaxRendered attribute with limitToList=true...");
-
- String parentId = getParentId() + FORM_ID;
- String panelId2 = parentId + PANEL2_ID + TEXT_SUFFIX;
- String buttonId = parentId + BUTTON1_ID;
- String button2Id = parentId + BUTTON2_ID;
-
- Assert.assertTrue(isPresentById(panelId2));
- writeStatus("Click button 1");
- // set panel_2 text visible flag to false
- clickById(buttonId);
- waitForAjaxCompletion();
- // panel_2 text should be visible as b1 has limitToList=true and
- // rerender only panel_1
- Assert.assertTrue(isPresentById(panelId2), "panel_2 text should be visible as b1 has limitToList=true and rerender only panel_1");
- writeStatus("Click button 2");
- clickById(button2Id);
- waitForAjaxCompletion();
- // panel_2 text should not be visible as it has ajaxRendered=true and b2
- // has limitToList=false
- Assert.assertFalse(isPresentById(panelId2), "panel_2 text should not be visible as it has ajaxRendered=true and b2 has limitToList=false");
-
- }
-
- @Test
- public void testOnDoubleClickEvent() throws Exception {
- String parentId = getParentId() + FORM_ID;
- String panelId = parentId + "panel_5";
- String panelResultId = panelId + RESULT_SUFFIX;
- writeStatus("Check ondoubleclick event");
- AssertTextEquals(panelResultId, "No");
- selenium.doubleClick(panelId);
- AssertTextEquals(panelResultId, "Yes");
- }
-
- @Test
- public void testOnKeyDownEvent() throws Exception {
- String parentId = getParentId() + FORM_ID;
- String panelId = parentId + "panel_6";
- String panelResultId = panelId + RESULT_SUFFIX;
- writeStatus("Check onkeydown event");
- AssertTextEquals(panelResultId, "No");
- selenium.keyDown(panelId, "1");
- AssertTextEquals(panelResultId, "Yes");
- }
-
- @Test
- public void testOnKeyPressEvent() throws Exception {
- String parentId = getParentId() + FORM_ID;
- String panelId = parentId + "panel_7";
- String panelResultId = panelId + RESULT_SUFFIX;
- writeStatus("Check onkeypress event");
- AssertTextEquals(panelResultId, "No");
- selenium.keyPress(panelId, "1");
- AssertTextEquals(panelResultId, "Yes");
- }
-
- @Test
- public void testOnKeyUpEvent() throws Exception {
- String parentId = getParentId() + FORM_ID;
- String panelId = parentId + "panel_8";
- String panelResultId = panelId + RESULT_SUFFIX;
- writeStatus("Check onkeyup event");
- AssertTextEquals(panelResultId, "No");
- selenium.keyUp(panelId, "1");
- AssertTextEquals(panelResultId, "Yes");
- }
-
- @Test
- public void testOnMouseDownEvent() throws Exception {
- String parentId = getParentId() + FORM_ID;
- String panelId = parentId + "panel_9";
- String panelResultId = panelId + RESULT_SUFFIX;
- writeStatus("Check onmousedown event");
- AssertTextEquals(panelResultId, "No");
- selenium.mouseDown(panelId);
- AssertTextEquals(panelResultId, "Yes");
- }
-
- @Test
- public void testOnMouseMoveEvent() throws Exception {
- String parentId = getParentId() + FORM_ID;
- String panelId = parentId + "panel_10";
- String panelResultId = panelId + RESULT_SUFFIX;
- writeStatus("Check onmousemove event");
- AssertTextEquals(panelResultId, "No");
- selenium.mouseMove(panelId);
- AssertTextEquals(panelResultId, "Yes");
- }
-
- @Test
- public void testOnMouseOutEvent() throws Exception {
- String parentId = getParentId() + FORM_ID;
- String panelId = parentId + "panel_11";
- String panelResultId = panelId + RESULT_SUFFIX;
- writeStatus("Check onmouseout event");
- AssertTextEquals(panelResultId, "No");
- selenium.mouseOut(panelId);
- AssertTextEquals(panelResultId, "Yes");
- }
-
- @Test
- public void testOnMouseOverEvent() throws Exception {
- String parentId = getParentId() + FORM_ID;
- String panelId = parentId + "panel_12";
- String panelResultId = panelId + RESULT_SUFFIX;
- writeStatus("Check onmouseover event");
- AssertTextEquals(panelResultId, "No");
- selenium.mouseOver(panelId);
- AssertTextEquals(panelResultId, "Yes");
- }
-
- @Test
- public void testOnMouseUpEvent() throws Exception {
- String parentId = getParentId() + FORM_ID;
- String panelId = parentId + "panel_13";
- String panelResultId = panelId + RESULT_SUFFIX;
- writeStatus("Check onmouseup event");
- AssertTextEquals(panelResultId, "No");
- selenium.mouseUp(panelId);
- AssertTextEquals(panelResultId, "Yes");
- }
-
- @Test
- public void testOnClickEvent() throws Exception {
- String parentId = getParentId() + FORM_ID;
- String panelId = parentId + "panel_14";
- String panelResultId = panelId + RESULT_SUFFIX;
- writeStatus("Check onclick event");
- AssertTextEquals(panelResultId, "No");
- selenium.click(panelId);
- AssertTextEquals(panelResultId, "Yes");
- }
-}
Added: trunk/test-applications/seleniumTest/src/test/java/org/richfaces/testng/AjaxOutputPanelTest.java
===================================================================
--- trunk/test-applications/seleniumTest/src/test/java/org/richfaces/testng/AjaxOutputPanelTest.java (rev 0)
+++ trunk/test-applications/seleniumTest/src/test/java/org/richfaces/testng/AjaxOutputPanelTest.java 2008-06-20 15:08:44 UTC (rev 9146)
@@ -0,0 +1,283 @@
+/*
+ * AjaxOutputPanel.java Date created: 10.06.2008
+ * Last modified by: $Author$
+ * $Revision$ $Date$
+ */
+
+package org.richfaces.testng;
+
+import org.ajax4jsf.template.Template;
+import org.richfaces.SeleniumTestBase;
+import org.testng.Assert;
+import org.testng.annotations.BeforeMethod;
+import org.testng.annotations.Parameters;
+import org.testng.annotations.Test;
+
+/**
+ * Ajax Output Panel selenium test
+ *
+ * @author Alexandr Levkovsky
+ *
+ */
+public class AjaxOutputPanelTest extends SeleniumTestBase {
+
+ private final static String FORM_ID = "form:";
+
+ private final static String PANEL1_ID = "panel_1";
+
+ private final static String PANEL2_ID = "panel_2";
+
+ private final static String PANEL3_ID = "panel_3";
+
+ private final static String PANEL4_ID = "panel_4";
+
+ private final static String BUTTON1_ID = "b1";
+
+ private final static String BUTTON2_ID = "b2";
+
+ private final static String BUTTON3_ID = "b3";
+
+ private final static String BUTTON4_ID = "b4";
+
+ private final static String TEXT_SUFFIX = "_text";
+
+ private final static String RESULT_SUFFIX = "_result";
+
+ public String getTestUrl() {
+ return "pages/ajaxOutputPanel/ajaxOutputPanelTest.xhtml";
+ }
+
+ /**
+ * This method are invoking before selenium tests started
+ */
+ @BeforeMethod
+ @Parameters( { "browser", "filterPrefix" })
+ public void startSelenium(String browser, String filterPrefix) {
+ super.startSelenium(browser, filterPrefix);
+
+ // TODO remove template - it should pass as parameter
+ renderPage(Template.SIMPLE);
+ }
+
+ @Test
+ public void testLayoutAttribute() throws Exception {
+ // panel_1 has layout=inline(default)
+ // panel_2 has layout=block
+ // panel_3 has layout=none
+ writeStatus("Testing layout attribute...");
+
+ String panelId = FORM_ID + PANEL1_ID;
+ String panel2Id = FORM_ID + PANEL2_ID;
+ String panel3Id = getParentId() + FORM_ID + PANEL3_ID;
+
+ Assert.assertTrue(isPresentById(panelId));
+ Number type = selenium.getXpathCount("//*[@id='" + panelId + "' and (name()='span' or name()='SPAN')]");
+ Assert.assertTrue(type.intValue() == 1, "panel_1 has layout=inline(default) and should be 'span' element");
+
+ Assert.assertTrue(isPresentById(panel2Id));
+ type = selenium.getXpathCount("//*[@id='" + panel2Id + "' and (name()='DIV' or name()='div')]");
+ Assert.assertTrue(type.intValue() == 1, "panel_2 has layout=block and should be 'div' element");
+
+ // panel_3 has layout=none and should not present if a child component
+ // is rendered
+ Assert.assertFalse(isPresentById(panel3Id), "panel_3 has layout=none and should not peresent if a child component is rendered ");
+
+ // remove child component rendering
+ writeStatus("Click button 3");
+ String buttonId = getParentId() + FORM_ID + BUTTON3_ID;
+ clickById(buttonId);
+ waitForAjaxCompletion();
+
+ // panel_3 has layout=none and should present if no child component is
+ // rendered with id of a child component and display:none style
+ Assert.assertTrue(isPresentById(panel3Id + "_text"), "panel_3 has layout=none and should peresent if no child component is rendered with id of a child component");
+ Assert.assertFalse(isVisibleById(panel3Id + "_text"), "panel_3 has layout=none and should peresent if no child component is rendered with display:none style");
+
+ }
+
+ @Test
+ public void testRenderedAttribute() throws Exception {
+ writeStatus("Testing rendered attribute...");
+
+ String panelId = getParentId() + FORM_ID + PANEL4_ID;
+
+ // panel_4 has rendered=true and should present on page
+ AssertRendered(panelId);
+
+ // change rendered attribute to false
+ writeStatus("Click button 4");
+ String buttonId = getParentId() + FORM_ID + BUTTON4_ID;
+ clickCommandAndWait(buttonId);
+
+ // panel_4 has rendered=false and should not present on page
+ AssertNotRendered(panelId);
+ }
+
+ @Test
+ public void testAjaxRenderedAttribute() throws Exception {
+ // panel_1 has ajaxRendered=false and is reRender by b1
+ // panel_2 has ajaxRendered=true
+ writeStatus("Testing ajaxRendered attribute...");
+
+ String parentId = getParentId() + FORM_ID;
+ String panelId = parentId + PANEL1_ID + TEXT_SUFFIX;
+ String panelId2 = parentId + PANEL2_ID + TEXT_SUFFIX;
+ String buttonId = parentId + BUTTON2_ID;
+ writeStatus("Click button 2");
+ // set panel_1 text visible flag to false
+ clickById(buttonId);
+ waitForAjaxCompletion();
+ // panel_1 text should be visible as it reRendered only by b1
+ Assert.assertTrue(isPresentById(panelId), "panel_1 text should be visible as it reRendered only by b1");
+
+ // panel_2 text should not be visible as it has ajaxRendered=true
+ Assert.assertFalse(isPresentById(panelId2), "panel_2 text should not be visible as it has ajaxRendered=true");
+
+ buttonId = parentId + BUTTON1_ID;
+ writeStatus("Click button 1");
+ clickById(buttonId);
+ waitForAjaxCompletion();
+ // panel text should NOT be visible as it reRendered by b1
+ Assert.assertFalse(isPresentById(panelId), "panel_1 text should not be visible as it reRendered by b1");
+
+ }
+
+ @Test
+ public void testAjaxRenderedAttributeWithLimitToList() throws Exception {
+ // panel_1 has ajaxRendered=false and is reRender by b1 with
+ // limitToList=true
+ // panel_2 has ajaxRendered=true
+ writeStatus("Testing ajaxRendered attribute with limitToList=true...");
+
+ String parentId = getParentId() + FORM_ID;
+ String panelId2 = parentId + PANEL2_ID + TEXT_SUFFIX;
+ String buttonId = parentId + BUTTON1_ID;
+ String button2Id = parentId + BUTTON2_ID;
+
+ Assert.assertTrue(isPresentById(panelId2));
+ writeStatus("Click button 1");
+ // set panel_2 text visible flag to false
+ clickById(buttonId);
+ waitForAjaxCompletion();
+ // panel_2 text should be visible as b1 has limitToList=true and
+ // rerender only panel_1
+ Assert.assertTrue(isPresentById(panelId2), "panel_2 text should be visible as b1 has limitToList=true and rerender only panel_1");
+ writeStatus("Click button 2");
+ clickById(button2Id);
+ waitForAjaxCompletion();
+ // panel_2 text should not be visible as it has ajaxRendered=true and b2
+ // has limitToList=false
+ Assert.assertFalse(isPresentById(panelId2), "panel_2 text should not be visible as it has ajaxRendered=true and b2 has limitToList=false");
+
+ }
+
+ @Test
+ public void testOnDoubleClickEvent() throws Exception {
+ String parentId = getParentId() + FORM_ID;
+ String panelId = parentId + "panel_5";
+ String panelResultId = panelId + RESULT_SUFFIX;
+ writeStatus("Check ondoubleclick event");
+ AssertTextEquals(panelResultId, "No");
+ selenium.doubleClick(panelId);
+ AssertTextEquals(panelResultId, "Yes");
+ }
+
+ @Test
+ public void testOnKeyDownEvent() throws Exception {
+ String parentId = getParentId() + FORM_ID;
+ String panelId = parentId + "panel_6";
+ String panelResultId = panelId + RESULT_SUFFIX;
+ writeStatus("Check onkeydown event");
+ AssertTextEquals(panelResultId, "No");
+ selenium.keyDown(panelId, "1");
+ AssertTextEquals(panelResultId, "Yes");
+ }
+
+ @Test
+ public void testOnKeyPressEvent() throws Exception {
+ String parentId = getParentId() + FORM_ID;
+ String panelId = parentId + "panel_7";
+ String panelResultId = panelId + RESULT_SUFFIX;
+ writeStatus("Check onkeypress event");
+ AssertTextEquals(panelResultId, "No");
+ selenium.keyPress(panelId, "1");
+ AssertTextEquals(panelResultId, "Yes");
+ }
+
+ @Test
+ public void testOnKeyUpEvent() throws Exception {
+ String parentId = getParentId() + FORM_ID;
+ String panelId = parentId + "panel_8";
+ String panelResultId = panelId + RESULT_SUFFIX;
+ writeStatus("Check onkeyup event");
+ AssertTextEquals(panelResultId, "No");
+ selenium.keyUp(panelId, "1");
+ AssertTextEquals(panelResultId, "Yes");
+ }
+
+ @Test
+ public void testOnMouseDownEvent() throws Exception {
+ String parentId = getParentId() + FORM_ID;
+ String panelId = parentId + "panel_9";
+ String panelResultId = panelId + RESULT_SUFFIX;
+ writeStatus("Check onmousedown event");
+ AssertTextEquals(panelResultId, "No");
+ selenium.mouseDown(panelId);
+ AssertTextEquals(panelResultId, "Yes");
+ }
+
+ @Test
+ public void testOnMouseMoveEvent() throws Exception {
+ String parentId = getParentId() + FORM_ID;
+ String panelId = parentId + "panel_10";
+ String panelResultId = panelId + RESULT_SUFFIX;
+ writeStatus("Check onmousemove event");
+ AssertTextEquals(panelResultId, "No");
+ selenium.mouseMove(panelId);
+ AssertTextEquals(panelResultId, "Yes");
+ }
+
+ @Test
+ public void testOnMouseOutEvent() throws Exception {
+ String parentId = getParentId() + FORM_ID;
+ String panelId = parentId + "panel_11";
+ String panelResultId = panelId + RESULT_SUFFIX;
+ writeStatus("Check onmouseout event");
+ AssertTextEquals(panelResultId, "No");
+ selenium.mouseOut(panelId);
+ AssertTextEquals(panelResultId, "Yes");
+ }
+
+ @Test
+ public void testOnMouseOverEvent() throws Exception {
+ String parentId = getParentId() + FORM_ID;
+ String panelId = parentId + "panel_12";
+ String panelResultId = panelId + RESULT_SUFFIX;
+ writeStatus("Check onmouseover event");
+ AssertTextEquals(panelResultId, "No");
+ selenium.mouseOver(panelId);
+ AssertTextEquals(panelResultId, "Yes");
+ }
+
+ @Test
+ public void testOnMouseUpEvent() throws Exception {
+ String parentId = getParentId() + FORM_ID;
+ String panelId = parentId + "panel_13";
+ String panelResultId = panelId + RESULT_SUFFIX;
+ writeStatus("Check onmouseup event");
+ AssertTextEquals(panelResultId, "No");
+ selenium.mouseUp(panelId);
+ AssertTextEquals(panelResultId, "Yes");
+ }
+
+ @Test
+ public void testOnClickEvent() throws Exception {
+ String parentId = getParentId() + FORM_ID;
+ String panelId = parentId + "panel_14";
+ String panelResultId = panelId + RESULT_SUFFIX;
+ writeStatus("Check onclick event");
+ AssertTextEquals(panelResultId, "No");
+ selenium.click(panelId);
+ AssertTextEquals(panelResultId, "Yes");
+ }
+}
Property changes on: trunk/test-applications/seleniumTest/src/test/java/org/richfaces/testng/AjaxOutputPanelTest.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Name: svn:keywords
+ Author Id Revision Date
Name: svn:eol-style
+ native
15 years, 11 months
JBoss Rich Faces SVN: r9145 - in trunk/ui/panelbar/src: main/templates and 1 other directories.
by richfaces-svn-commits@lists.jboss.org
Author: nbelaevski
Date: 2008-06-20 10:33:23 -0400 (Fri, 20 Jun 2008)
New Revision: 9145
Modified:
trunk/ui/panelbar/src/main/resources/org/richfaces/renderkit/html/css/panelbar.xcss
trunk/ui/panelbar/src/main/templates/panelBarItem.jspx
trunk/ui/panelbar/src/test/java/org/richfaces/component/PanelBarComponentTest.java
Log:
http://jira.jboss.com/jira/browse/RF-3584
Modified: trunk/ui/panelbar/src/main/resources/org/richfaces/renderkit/html/css/panelbar.xcss
===================================================================
--- trunk/ui/panelbar/src/main/resources/org/richfaces/renderkit/html/css/panelbar.xcss 2008-06-20 14:27:16 UTC (rev 9144)
+++ trunk/ui/panelbar/src/main/resources/org/richfaces/renderkit/html/css/panelbar.xcss 2008-06-20 14:33:23 UTC (rev 9145)
@@ -8,7 +8,7 @@
border : 1px solid;
padding : 1px;
}
-.dr-pnlbar-ext{
+.dr-pnlbar-int{
border-bottom : 0px !important;
}
.dr-pnlbar-h{
@@ -80,7 +80,7 @@
</u:selector>
-<u:selector name=".dr-pnlbar-ext">
+<u:selector name=".dr-pnlbar-int">
<u:style name="background-color" skin="generalBackgroundColor" />
</u:selector>
Modified: trunk/ui/panelbar/src/main/templates/panelBarItem.jspx
===================================================================
--- trunk/ui/panelbar/src/main/templates/panelBarItem.jspx 2008-06-20 14:27:16 UTC (rev 9144)
+++ trunk/ui/panelbar/src/main/templates/panelBarItem.jspx 2008-06-20 14:33:23 UTC (rev 9145)
@@ -13,7 +13,7 @@
<c:object var="panel" value="#{component.panel}" type="javax.faces.component.UIComponent" />
- <div id="#{clientId}" class="dr-pnlbar rich-panelbar dr-pnlbar-ext rich-panelbar-exterior #{panel.attributes['styleClass']}" style="#{panel.attributes['style']}">
+ <div id="#{clientId}" class="dr-pnlbar rich-panelbar dr-pnlbar-int rich-panelbar-interior #{panel.attributes['styleClass']}" style="#{panel.attributes['style']}">
<div class="dr-pnlbar-h rich-panelbar-header #{panel.attributes['headerClass']} #{component.attributes['headerClass']}"
style="#{panel.attributes['headerStyle']};#{component.attributes['headerStyle']}">
<jsp:scriptlet><![CDATA[
Modified: trunk/ui/panelbar/src/test/java/org/richfaces/component/PanelBarComponentTest.java
===================================================================
--- trunk/ui/panelbar/src/test/java/org/richfaces/component/PanelBarComponentTest.java 2008-06-20 14:27:16 UTC (rev 9144)
+++ trunk/ui/panelbar/src/test/java/org/richfaces/component/PanelBarComponentTest.java 2008-06-20 14:33:23 UTC (rev 9145)
@@ -186,7 +186,7 @@
assertNotNull(div);
assertEquals("div", div.getNodeName());
classAttr = div.getAttributeValue("class");
- assertTrue(classAttr.contains("dr-pnlbar rich-panelbar dr-pnlbar-ext rich-panelbar-exterior"));
+ assertTrue(classAttr.contains("dr-pnlbar rich-panelbar dr-pnlbar-int rich-panelbar-interior"));
assertTrue(classAttr.contains("panelBarStyleClass"));
classAttr = div.getAttributeValue("style");
assertTrue(classAttr.contains("panelBarHeaderStyle"));
15 years, 11 months
JBoss Rich Faces SVN: r9144 - trunk/ui/progressBAR/src/main/resources/org/richfaces/renderkit/html/js.
by richfaces-svn-commits@lists.jboss.org
Author: andrei_exadel
Date: 2008-06-20 10:27:16 -0400 (Fri, 20 Jun 2008)
New Revision: 9144
Modified:
trunk/ui/progressBAR/src/main/resources/org/richfaces/renderkit/html/js/progressBar.js
Log:
RF-3740
Modified: trunk/ui/progressBAR/src/main/resources/org/richfaces/renderkit/html/js/progressBar.js
===================================================================
--- trunk/ui/progressBAR/src/main/resources/org/richfaces/renderkit/html/js/progressBar.js 2008-06-20 14:18:44 UTC (rev 9143)
+++ trunk/ui/progressBAR/src/main/resources/org/richfaces/renderkit/html/js/progressBar.js 2008-06-20 14:27:16 UTC (rev 9144)
@@ -41,6 +41,17 @@
getValue: function () {
return this.value;
},
+
+ getParameter: function (ev, params, paramName) {
+ if (!params) {
+ params = ev;
+ }
+ if (params && params[paramName]) {
+ return params[paramName];
+ }
+ return params;
+ },
+
onComplete: function (data) {
if (!$(this.id) || this.disabled) { return; }
if (data) {
@@ -135,11 +146,12 @@
}
return placeholders;
},
- setLabel: function (str) {
+ setLabel: function (ev, str) {
+ str = this.getParameter(ev, str, "label");
if (this.state != "progressState") { return; }
var d = $(this.id + ":remain");
if (!d) { return; }
- var lbl = this.interpolate(str, this.getContext());
+ var lbl = this.interpolate(str + "", this.getContext());
if (lbl)
d.innerHTML = $(this.id + ":complete").innerHTML = lbl;
this.markup = null;
@@ -165,7 +177,8 @@
}
return value;
},
- setValue: function (val) {
+ setValue: function (ev, val) {
+ val = this.getParameter(ev, val, "value");
this.value = val;
if (!this.isAjaxMode()) {
if (parseFloat(val) <= parseFloat(this.getMinValue())) {
15 years, 11 months
JBoss Rich Faces SVN: r9143 - in trunk: samples/tree-demo/src/main/java/org/richfaces and 7 other directories.
by richfaces-svn-commits@lists.jboss.org
Author: dmorozov
Date: 2008-06-20 10:18:44 -0400 (Fri, 20 Jun 2008)
New Revision: 9143
Added:
trunk/samples/tree-demo/src/main/java/org/richfaces/TreeContainer.java
trunk/samples/tree-demo/src/main/java/org/richfaces/TreeDndBean.java
trunk/samples/tree-demo/src/main/resources/org/richfaces/simpleTreeData.properties
trunk/samples/tree-demo/src/main/webapp/pages/dnd.jsp
Modified:
trunk/framework/api/src/main/java/org/richfaces/model/AbstractTreeDataModel.java
trunk/framework/api/src/main/java/org/richfaces/model/ListRowKey.java
trunk/framework/api/src/main/java/org/richfaces/model/TreeDataModel.java
trunk/framework/api/src/main/java/org/richfaces/model/TreeDataModelNodeAdaptor.java
trunk/samples/tree-demo/src/main/java/org/richfaces/Bean.java
trunk/samples/tree-demo/src/main/webapp/WEB-INF/faces-config.xml
trunk/ui/drag-drop/src/main/java/org/richfaces/renderkit/DnDEventsExchangeMailer.java
trunk/ui/tree/src/main/java/org/richfaces/component/UITree.java
trunk/ui/tree/src/main/java/org/richfaces/component/UITreeNode.java
trunk/ui/tree/src/main/java/org/richfaces/component/state/TreeState.java
trunk/ui/tree/src/main/java/org/richfaces/renderkit/NodeRendererBase.java
Log:
http://jira.jboss.com/jira/browse/RF-2987
Modified: trunk/framework/api/src/main/java/org/richfaces/model/AbstractTreeDataModel.java
===================================================================
--- trunk/framework/api/src/main/java/org/richfaces/model/AbstractTreeDataModel.java 2008-06-20 14:15:20 UTC (rev 9142)
+++ trunk/framework/api/src/main/java/org/richfaces/model/AbstractTreeDataModel.java 2008-06-20 14:18:44 UTC (rev 9143)
@@ -125,8 +125,34 @@
}
}
+ /**
+ * Get current tree node.
+ * Note: valid only for classical TreeNode based tree data model implementation
+ *
+ * @return current tree node
+ */
public abstract TreeNode getTreeNode();
public abstract Object convertToKey(FacesContext context, String keyString,
UIComponent component, Converter converter);
+
+ /**
+ * Get row key for certain tree node object
+ *
+ * @param node to get key for
+ * @return node row key
+ */
+ public Object getTreeNodeRowKey(Object node) {
+ throw new UnsupportedOperationException();
+ }
+
+ /**
+ * Get node local id in it's parent childs collection
+ *
+ * @param childNode node to get identifier for
+ * @return node local identifier
+ */
+ public Object getChildNodeId(Object childNode) {
+ throw new UnsupportedOperationException();
+ }
}
Modified: trunk/framework/api/src/main/java/org/richfaces/model/ListRowKey.java
===================================================================
--- trunk/framework/api/src/main/java/org/richfaces/model/ListRowKey.java 2008-06-20 14:15:20 UTC (rev 9142)
+++ trunk/framework/api/src/main/java/org/richfaces/model/ListRowKey.java 2008-06-20 14:18:44 UTC (rev 9143)
@@ -71,6 +71,7 @@
/**
* Appending constructor
+ *
* @param parentRowKey base row key
* @param pathElement path segment to append to base row key
*/
@@ -79,6 +80,15 @@
this.path.add(pathElement);
}
+ /**
+ * Appending constructor
+ * @param parentRowKey base row key
+ * @param pathElement path segment to append to base row key
+ */
+ public ListRowKey(ListRowKey<T> parentRowKey, ListRowKey<T> childRowKey) {
+ this(parentRowKey);
+ this.path.addAll(childRowKey.path);
+ }
/**
* List constructor
Modified: trunk/framework/api/src/main/java/org/richfaces/model/TreeDataModel.java
===================================================================
--- trunk/framework/api/src/main/java/org/richfaces/model/TreeDataModel.java 2008-06-20 14:15:20 UTC (rev 9142)
+++ trunk/framework/api/src/main/java/org/richfaces/model/TreeDataModel.java 2008-06-20 14:18:44 UTC (rev 9143)
@@ -23,6 +23,8 @@
import java.io.IOException;
import java.util.Iterator;
+import java.util.LinkedList;
+import java.util.List;
import java.util.Map;
import javax.faces.context.FacesContext;
@@ -313,4 +315,46 @@
return null;
}
+ /**
+ * Get row key for certain tree node object
+ *
+ * @param node to get key for
+ * @return node row key
+ */
+ @Override
+ @SuppressWarnings("unchecked")
+ public Object getTreeNodeRowKey(Object node) {
+ if (node == null) {
+ throw new UnsupportedOperationException();
+ }
+
+ T childNode = (T) node;
+ List<Object> path = new LinkedList<Object>();
+ Object id = nodeAdaptor.getChildNodeId(childNode);
+ if (id != null) {
+ path.add(id);
+ }
+
+ T parentNode = childNode;
+ while ((parentNode = nodeAdaptor.getParent(parentNode)) != null) {
+ id = nodeAdaptor.getChildNodeId(parentNode);
+ if (id != null) {
+ path.add(0, id);
+ } else if (nodeAdaptor.getParent(parentNode) != null) {
+ throw new UnsupportedOperationException();
+ }
+ }
+ return new ListRowKey(path);
+ }
+
+ /**
+ * Get node local id in it's parent childs collection
+ *
+ * @param childNode node to get identifier for
+ * @return node local identifier
+ */
+ @Override
+ public Object getChildNodeId(Object childNode) {
+ return getNodeAdaptor().getChildNodeId((T) childNode);
+ }
}
Modified: trunk/framework/api/src/main/java/org/richfaces/model/TreeDataModelNodeAdaptor.java
===================================================================
--- trunk/framework/api/src/main/java/org/richfaces/model/TreeDataModelNodeAdaptor.java 2008-06-20 14:15:20 UTC (rev 9142)
+++ trunk/framework/api/src/main/java/org/richfaces/model/TreeDataModelNodeAdaptor.java 2008-06-20 14:18:44 UTC (rev 9143)
@@ -48,6 +48,14 @@
public Iterator<Map.Entry<Object, T>> getChildren(T node);
public Object getRowData(T node);
+
+ /**
+ * Get node local id in it's parent childs collection
+ *
+ * @param childNode node to get identifier for
+ * @return node local identifier
+ */
+ public Object getChildNodeId(T childNode);
/**
* Instance of {@link TreeDataModelNodeAdaptor} for {@link org.richfaces.model.TreeNode} nodes handling
@@ -76,7 +84,26 @@
public boolean isLeaf(org.richfaces.model.TreeNode node) {
return node.isLeaf();
}
-
+
+ /**
+ * Get node local id in it's parent childs collection
+ *
+ * @param childNode node to get identifier for
+ * @return node local identifier
+ */
+ public Object getChildNodeId(org.richfaces.model.TreeNode childNode) {
+ org.richfaces.model.TreeNode parentNode = getParent(childNode);
+ if (childNode != null && parentNode != null) {
+ Iterator<Map.Entry<Object, TreeNode>> iter = parentNode.getChildren();
+ while (iter != null && iter.hasNext()) {
+ Map.Entry<Object, TreeNode> entry = iter.next();
+ if (entry != null && childNode.equals(entry.getValue())) {
+ return entry.getKey();
+ }
+ }
+ }
+ return null;
+ }
};
/**
@@ -165,5 +192,25 @@
public boolean isLeaf(javax.swing.tree.TreeNode node) {
return !node.getAllowsChildren() || node.isLeaf();
}
+
+ /**
+ * Get node local id in it's parent childs collection
+ *
+ * @param childNode node to get identifier for
+ * @return node local identifier
+ */
+ public Object getChildNodeId(javax.swing.tree.TreeNode childNode) {
+ javax.swing.tree.TreeNode parentNode = getParent(childNode);
+ if (childNode != null && parentNode != null) {
+ Iterator<Map.Entry<Object, TreeNode>> iter = getChildren(parentNode);
+ while (iter != null && iter.hasNext()) {
+ Map.Entry<Object, TreeNode> entry = iter.next();
+ if (entry != null && childNode.equals(entry.getValue())) {
+ return entry.getKey();
+ }
+ }
+ }
+ return null;
+ }
};
}
Modified: trunk/samples/tree-demo/src/main/java/org/richfaces/Bean.java
===================================================================
--- trunk/samples/tree-demo/src/main/java/org/richfaces/Bean.java 2008-06-20 14:15:20 UTC (rev 9142)
+++ trunk/samples/tree-demo/src/main/java/org/richfaces/Bean.java 2008-06-20 14:18:44 UTC (rev 9143)
@@ -34,11 +34,9 @@
import javax.faces.component.UIComponent;
import javax.faces.context.FacesContext;
import javax.faces.event.ActionEvent;
-import javax.faces.event.FacesEvent;
import org.ajax4jsf.context.AjaxContext;
import org.richfaces.component.UITree;
-import org.richfaces.component.UITreeNode;
import org.richfaces.component.xml.XmlTreeDataBuilder;
import org.richfaces.event.DropEvent;
import org.richfaces.event.NodeExpandedEvent;
@@ -54,7 +52,7 @@
* @author $Autor$
*
*/
-public class Bean {
+public class Bean extends TreeContainer {
private String switchType = "client";
private TreeNode data;
@@ -199,19 +197,6 @@
this.switchType = switchType;
}
- private UITree getTree(FacesEvent event) {
- UIComponent component = event.getComponent();
- if (component instanceof UITree) {
- return ((UITree) component);
- }
-
- if (component instanceof UITreeNode) {
- return ((UITree) component.getParent());
- }
-
- return null;
- }
-
public void up() {
if(selectedNode.getParent()!=null) {
selectedNode = selectedNode.getParent();
Added: trunk/samples/tree-demo/src/main/java/org/richfaces/TreeContainer.java
===================================================================
--- trunk/samples/tree-demo/src/main/java/org/richfaces/TreeContainer.java (rev 0)
+++ trunk/samples/tree-demo/src/main/java/org/richfaces/TreeContainer.java 2008-06-20 14:18:44 UTC (rev 9143)
@@ -0,0 +1,44 @@
+/**
+ *
+ */
+package org.richfaces;
+
+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/samples/tree-demo/src/main/java/org/richfaces/TreeDndBean.java
===================================================================
--- trunk/samples/tree-demo/src/main/java/org/richfaces/TreeDndBean.java (rev 0)
+++ trunk/samples/tree-demo/src/main/java/org/richfaces/TreeDndBean.java 2008-06-20 14:18:44 UTC (rev 9143)
@@ -0,0 +1,333 @@
+/**
+ *
+ */
+package org.richfaces;
+
+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 dmorozov
+ *
+ */
+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/samples/tree-demo/src/main/resources/org/richfaces/simpleTreeData.properties
===================================================================
--- trunk/samples/tree-demo/src/main/resources/org/richfaces/simpleTreeData.properties (rev 0)
+++ trunk/samples/tree-demo/src/main/resources/org/richfaces/simpleTreeData.properties 2008-06-20 14:18:44 UTC (rev 9143)
@@ -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/samples/tree-demo/src/main/webapp/WEB-INF/faces-config.xml
===================================================================
--- trunk/samples/tree-demo/src/main/webapp/WEB-INF/faces-config.xml 2008-06-20 14:15:20 UTC (rev 9142)
+++ trunk/samples/tree-demo/src/main/webapp/WEB-INF/faces-config.xml 2008-06-20 14:18:44 UTC (rev 9143)
@@ -1,20 +1,27 @@
-<?xml version="1.0"?>
+<?xml version="1.0"?>
<!DOCTYPE faces-config PUBLIC "-//Sun Microsystems, Inc.//DTD JavaServer Faces Config 1.1//EN"
"http://java.sun.com/dtd/web-facesconfig_1_1.dtd">
<faces-config>
- <managed-bean>
- <managed-bean-name>bean</managed-bean-name>
- <managed-bean-class>org.richfaces.Bean</managed-bean-class>
- <managed-bean-scope>session</managed-bean-scope>
- </managed-bean>
-<managed-bean>
- <managed-bean-name>pathwayBean</managed-bean-name>
- <managed-bean-class>org.richfaces.TreeBean</managed-bean-class>
- <managed-bean-scope>session</managed-bean-scope>
-</managed-bean>
- <managed-bean>
- <managed-bean-name>skinBean</managed-bean-name>
- <managed-bean-class>org.richfaces.SkinBean</managed-bean-class>
- <managed-bean-scope>session</managed-bean-scope>
- </managed-bean>
+ <managed-bean>
+ <managed-bean-name>bean</managed-bean-name>
+ <managed-bean-class>org.richfaces.Bean</managed-bean-class>
+ <managed-bean-scope>session</managed-bean-scope>
+ </managed-bean>
+ <managed-bean>
+ <managed-bean-name>pathwayBean</managed-bean-name>
+ <managed-bean-class>org.richfaces.TreeBean</managed-bean-class>
+ <managed-bean-scope>session</managed-bean-scope>
+ </managed-bean>
+
+ <managed-bean>
+ <managed-bean-name>treeDndBean</managed-bean-name>
+ <managed-bean-class>org.richfaces.TreeDndBean</managed-bean-class>
+ <managed-bean-scope>session</managed-bean-scope>
+ </managed-bean>
+
+ <managed-bean>
+ <managed-bean-name>skinBean</managed-bean-name>
+ <managed-bean-class>org.richfaces.SkinBean</managed-bean-class>
+ <managed-bean-scope>session</managed-bean-scope>
+ </managed-bean>
</faces-config>
Added: trunk/samples/tree-demo/src/main/webapp/pages/dnd.jsp
===================================================================
--- trunk/samples/tree-demo/src/main/webapp/pages/dnd.jsp (rev 0)
+++ trunk/samples/tree-demo/src/main/webapp/pages/dnd.jsp 2008-06-20 14:18:44 UTC (rev 9143)
@@ -0,0 +1,114 @@
+<!doctype html public "-//w3c//dtd html 4.0 transitional//en">
+<%@ taglib uri="http://java.sun.com/jsf/html" prefix="h"%>
+<%@ taglib uri="http://java.sun.com/jsf/core" prefix="f"%>
+<%@ taglib uri="http://richfaces.org/a4j" prefix="a4j"%>
+<%@ taglib uri="http://labs.jboss.com/jbossrichfaces/ui/drag-drop" prefix="dnd" %>
+<%@ taglib uri="http://labs.jboss.com/jbossrichfaces/ui/tree" prefix="rich"%>
+<html>
+<head>
+ <title>Tree Drag & Drop sample</title>
+ <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>
+</head>
+<body>
+<f:view>
+ <h:form>
+ <dnd:dragIndicator id="treeIndicator">
+ <f:facet name="single">
+ <f:verbatim>{marker} {nodeParam}({treeParam})</f:verbatim>
+ </f:facet>
+ </dnd:dragIndicator>
+
+ <h:panelGrid columns="2" columnClasses="LeftTreePane,RightTreePane">
+
+ <h:panelGroup id="leftContainer" layout="block" styleClass="TreeContainer">
+ <h:outputText escape="false"
+ value="Selected Node: <b>#{treeDndBean.leftSelectedNodeTitle}</b>"
+ id="selectedNodeL" />
+
+ <rich:tree id="leftTree" style="width:300px"
+ nodeSelectListener="#{treeDndBean.processLSelection}"
+ reRender="selectedNodeL" ajaxSubmitSelection="false"
+ 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">
+
+ <dnd:dndParam name="treeParam" value="leftTree" />
+ </rich:tree>
+
+ </h:panelGroup>
+
+ <h:panelGroup id="rightContainer" layout="block" styleClass="TreeContainer">
+ <h:outputText escape="false"
+ value="Selected Node: <b>#{treeDndBean.rightSelectedNodeTitle}</b>"
+ id="selectedNodeR" />
+
+ <rich:tree id="rightTree" style="width:300px"
+ nodeSelectListener="#{treeDndBean.processRSelection}"
+ reRender="selectedNodeR" ajaxSubmitSelection="false"
+ 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">
+
+ <dnd:dndParam name="treeParam" value="rightTree" />
+ </rich:tree>
+ </h:panelGroup>
+
+ </h:panelGrid>
+ </h:form>
+
+ <a4j:log hotkey="O" />
+
+</f:view>
+</body>
+</html>
Modified: trunk/ui/drag-drop/src/main/java/org/richfaces/renderkit/DnDEventsExchangeMailer.java
===================================================================
--- trunk/ui/drag-drop/src/main/java/org/richfaces/renderkit/DnDEventsExchangeMailer.java 2008-06-20 14:15:20 UTC (rev 9142)
+++ trunk/ui/drag-drop/src/main/java/org/richfaces/renderkit/DnDEventsExchangeMailer.java 2008-06-20 14:18:44 UTC (rev 9143)
@@ -26,6 +26,7 @@
import java.util.List;
import java.util.Map;
+import javax.faces.component.ContextCallback;
import javax.faces.component.UIComponent;
import javax.faces.context.FacesContext;
@@ -82,82 +83,98 @@
}
}
- private MultiHashMap queuedMap = new MultiHashMap();
+ private Map<String, EventInfoStructure> queuedMap = new HashMap<String, EventInfoStructure>();
- private Map components = new HashMap();
+ private Map<String, UIComponent> components = new HashMap<String, UIComponent>();
private void processEvent(UIComponent source, FacesContext facesContext, DnDEvent dndEvent, EventCallback callback, Object type, Object value) {
if (callback != null) {
callback.processEvent(dndEvent, source, facesContext, type, value);
}
}
-
- public void mailEvent(String sourceId, UIComponent target, FacesContext facesContext, DnDEvent dndEvent,
- EventCallback callback, Object type, Object value, boolean isDraggable) {
+
+ /**
+ * Decode drag & drop events. Collect pairs of correspondent drag & drop events and send them
+ * together where OnDrag becomes always before OnDrop.
+ *
+ * @param sourceId Id of element event come from
+ * @param target component that receive event
+ * @param facesContext Faces context
+ * @param dndEvent drag & drop event descriptor
+ * @param callback call back method
+ * @param type type of dragged/dropped value
+ * @param value dragged/dropped value
+ * @param isDraggable whether the event related draggable component or dropzone one.
+ */
+ public void mailEvent(String sourceId, UIComponent target, FacesContext facesContext, final DnDEvent dndEvent,
+ final EventCallback callback, final Object type, final Object value, boolean isDraggable) {
- //we should queue event right now to preserve row key if its generator
- //is nested in UIData...
- dndEvent.queue();
-
- UIComponent component = (UIComponent) components.get(sourceId);
+ final UIComponent component = components.get(sourceId);
String targetId = target.getClientId(facesContext);
if (component == null) {
//component with that sourceId have never mailed anything before - wait
+ if (queuedMap.containsKey(sourceId)) {
+ throw new IllegalStateException("Drag source with id '" + sourceId + "' already specified.");
+ }
queuedMap.put(sourceId, new EventInfoStructure(dndEvent, callback, type, value));
components.put(targetId, target);
} else {
//check queued mail lists for current component
- List queue = (List) queuedMap.get(targetId);
- if (queue != null) {
- Iterator iterator = queue.iterator();
- if (iterator.hasNext()) {
- EventInfoStructure eventInfo = (EventInfoStructure) iterator.next();
+ final EventInfoStructure eventInfo = (EventInfoStructure) queuedMap.get(targetId);
+ if (eventInfo != null) {
+ Draggable draggable;
+ Dropzone dropzone;
+
+ final EventInfoStructure dragEventInfo = isDraggable ? eventInfo : new EventInfoStructure(dndEvent, callback, type, value);
+ final EventInfoStructure dropEventInfo = isDraggable ? new EventInfoStructure(dndEvent, callback, type, value) : eventInfo;
+
+ Object acceptedTypes;
+ Object dragType;
+
+ if (isDraggable) {
+ draggable = (Draggable) target;
+ dropzone = (Dropzone) component;
- Draggable draggable;
- Dropzone dropzone;
+ acceptedTypes = eventInfo.type;
+ dragType = type;
+ } else {
+ draggable = (Draggable) component;
+ dropzone = (Dropzone) target;
- Object acceptedTypes;
- Object dragType;
+ acceptedTypes = type;
+ dragType = eventInfo.type;
+ }
- if (isDraggable) {
- draggable = (Draggable) target;
- dropzone = (Dropzone) component;
-
- acceptedTypes = eventInfo.type;
- dragType = type;
- } else {
- draggable = (Draggable) component;
- dropzone = (Dropzone) target;
-
- acceptedTypes = type;
- dragType = eventInfo.type;
- }
-
- if (DnDValidator.validateAcceptTypes(facesContext,
- draggable, dropzone,
- dragType, acceptedTypes)) {
-
-
- processEvent(target, facesContext, eventInfo.dndEvent, eventInfo.eventCallback,
- type, value);
-
- //we know the component - process event now
- processEvent(component, facesContext, dndEvent, callback,
- eventInfo.type, eventInfo.value);
-
- } else {
- dndEvent.invalidate();
-
- eventInfo.dndEvent.invalidate();
- }
+ if (DnDValidator.validateAcceptTypes(facesContext,
+ draggable, dropzone,
+ dragType, acceptedTypes)) {
- iterator.remove();
+ // Make sure that we will have OnDrag event occur first
+ facesContext.getViewRoot().invokeOnComponent(facesContext, isDraggable ? targetId : sourceId, new ContextCallback() {
+ public void invokeContextCallback(FacesContext fc,
+ UIComponent targetComponent) {
+
+ processEvent(targetComponent, fc, dragEventInfo.dndEvent, dragEventInfo.eventCallback,
+ dropEventInfo.type, dropEventInfo.value);
+
+ dropEventInfo.dndEvent.queue();
+ }
+ });
+
+ facesContext.getViewRoot().invokeOnComponent(facesContext, isDraggable ? sourceId : targetId, new ContextCallback() {
+ public void invokeContextCallback(FacesContext fc,
+ UIComponent targetComponent) {
+
+ processEvent(targetComponent, fc, dropEventInfo.dndEvent, dropEventInfo.eventCallback,
+ dragEventInfo.type, dragEventInfo.value);
+
+ dragEventInfo.dndEvent.queue();
+ }
+ });
}
-
- if (!iterator.hasNext()) {
- queuedMap.remove(targetId);
- }
+
+ queuedMap.remove(targetId);
}
}
}
Modified: trunk/ui/tree/src/main/java/org/richfaces/component/UITree.java
===================================================================
--- trunk/ui/tree/src/main/java/org/richfaces/component/UITree.java 2008-06-20 14:15:20 UTC (rev 9142)
+++ trunk/ui/tree/src/main/java/org/richfaces/component/UITree.java 2008-06-20 14:18:44 UTC (rev 9143)
@@ -22,10 +22,13 @@
package org.richfaces.component;
import java.io.IOException;
+import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
import java.util.Iterator;
+import java.util.List;
import java.util.Map;
+import java.util.Set;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
@@ -58,9 +61,7 @@
import org.richfaces.component.state.events.ExpandAllCommandEvent;
import org.richfaces.component.state.events.ExpandNodeCommandEvent;
import org.richfaces.component.state.events.TreeStateCommandEvent;
-import org.richfaces.event.DragEvent;
import org.richfaces.event.DragListener;
-import org.richfaces.event.DropEvent;
import org.richfaces.event.DropListener;
import org.richfaces.event.NodeExpandedEvent;
import org.richfaces.event.NodeExpandedListener;
@@ -234,12 +235,6 @@
} else {
event.setPhaseId(PhaseId.INVOKE_APPLICATION);
}
- } else if (event instanceof DragEvent || event instanceof DropEvent) {
- if (isImmediate()) {
- event.setPhaseId(PhaseId.APPLY_REQUEST_VALUES);
- } else {
- event.setPhaseId(PhaseId.INVOKE_APPLICATION);
- }
}
super.queueEvent(resultEvent);
@@ -1015,6 +1010,202 @@
public void setRowKeyConverter(Converter rowKeyConverter) {
throw new UnsupportedOperationException();
}
+
+ /**
+ * Return row key for certain model's tree node
+ *
+ * @return row key
+ */
+ public Object getTreeNodeRowKey(TreeNode node) {
+ return ((AbstractTreeDataModel) getExtendedDataModel()).getTreeNodeRowKey(node);
+ }
+
+ /**
+ * Collect current tree node state including node selection and expanded nodes list
+ *
+ * @param transferQueuedNodes whether to collect queued expanded nodes states or not
+ * @return tree node state
+ */
+ public Object getTreeNodeState(boolean transferQueuedNodes) {
+ // Check for node were choosed
+ TreeRowKey rowKey = (TreeRowKey) getRowKey();
+ if (rowKey == null) {
+ return null;
+ }
+ TreeState state = (TreeState) getComponentState();
+ if (transferQueuedNodes) {
+ state.transferQueuedNodes();
+ }
+ TreeState subTreeState = (TreeState) createComponentState();
+ if (state.getSelectedNode() != null && rowKey.equals(state.getSelectedNode())) {
+ subTreeState.setSelected(rowKey);
+ }
+
+ Set subNodes = subTreeState.getExpandedNodes();
+ Set nodes = state.getExpandedNodes();
+ Iterator iter = nodes.iterator();
+ while (iter != null && iter.hasNext()) {
+ ListRowKey key = (ListRowKey) iter.next();
+ if (key != null && (rowKey.isSubKey(key) || rowKey.equals(key))) {
+ subNodes.add(key.getSubKey(rowKey.depth() - 1));
+ }
+ }
+ return subTreeState;
+ }
+
+ /**
+ * Set current tree node state.
+ *
+ * @param state node state to apply.
+ */
+ public void setTreeNodeState(Object state) {
+ // Check for node were choosed
+ ListRowKey rowKey = (ListRowKey) getRowKey();
+ if (rowKey == null) {
+ return;
+ }
+
+ TreeState currentState = (TreeState) getComponentState();
+ Set currentNodes = currentState.getExpandedNodes();
+
+ if (state instanceof TreeState) {
+ Set nodes = ((TreeState) state).getExpandedNodes();
+ Iterator iter = nodes.iterator();
+ while (iter != null && iter.hasNext()) {
+ ListRowKey key = ((ListRowKey) iter.next()).getSubKey(1);
+ if (key.depth() > 0) {
+ currentNodes.add(new ListRowKey(rowKey, key));
+ } else if (!currentNodes.contains(rowKey)) {
+ currentNodes.add(rowKey);
+ }
+ }
+ }
+ }
+
+ /**
+ * Cleanup current tree node state information.
+ */
+ public void clearTreeNodeState() {
+ TreeRowKey rowKey = (TreeRowKey) getRowKey();
+ if (rowKey == null) {
+ return;
+ }
+ TreeState state = (TreeState) getComponentState();
+ state.transferQueuedNodes();
+ Set nodes = state.getExpandedNodes();
+
+ if (rowKey.equals(state.getSelectedNode())) {
+ state.setSelected(null);
+ }
+
+ // collect nodes to clean up
+ List<TreeRowKey> nodesForRemove = new ArrayList<TreeRowKey>();
+ Iterator iter = nodes.iterator();
+ while (iter != null && iter.hasNext()) {
+ TreeRowKey key = (TreeRowKey) iter.next();
+ if (key != null && (rowKey.getPath().equals("null")
+ || rowKey.isSubKey(key)
+ || rowKey.equals(key))) {
+ nodesForRemove.add(key);
+ }
+ }
+
+ // remove states
+ for (TreeRowKey key : nodesForRemove) {
+ nodes.remove(key);
+ }
+ }
+
+ /**
+ * Remove node from tree
+ *
+ * @param context JSF context
+ * @param node Node to remove
+ * @return removed node state description
+ */
+ public Object removeNode(FacesContext context, Object rowKey) {
+ Object nodeState = null;
+ if (rowKey != null) {
+ Object storedKey = getRowKey();
+ try {
+ setRowKey(context, rowKey);
+ TreeNode node = getTreeNode();
+ TreeNode parentNode = node.getParent();
+
+ // 1. remove node from data model
+ Object id = ((AbstractTreeDataModel) getExtendedDataModel()).getChildNodeId(node);
+ parentNode.removeChild(id);
+
+ // 2. clean up node state
+ nodeState = getTreeNodeState(true);
+ clearTreeNodeState();
+ } finally {
+ try {
+ setRowKey(context, storedKey);
+ } catch (Exception e) {
+ context.getExternalContext().log(e.getMessage(), e);
+ nodeState = null;
+ }
+ }
+ }
+
+ return nodeState;
+ }
+
+ /**
+ * Remove node from tree
+ *
+ * @param node Node to remove
+ * @return removed node state
+ */
+ public Object removeNode(Object rowKey) {
+ return removeNode(getFacesContext(), rowKey);
+ }
+
+ /**
+ * Add node to tree
+ *
+ * @param context JSF context
+ * @param parentRowKey parent node row key
+ * @param newNode inserted node
+ * @param id inserted node parent's local identifier
+ * @param state inserted tree node state. Optional
+ */
+ public void addNode(FacesContext context, Object parentRowKey, TreeNode newNode, Object id, Object state) {
+ if (newNode != null) {
+ Object storedKey = getRowKey();
+ try {
+ setRowKey(context, parentRowKey);
+ TreeNode parentNode = getTreeNode();
+
+ parentNode.addChild(id, newNode);
+
+ // select new node as current
+ setRowKey(getTreeNodeRowKey(newNode));
+ if (state != null) {
+ setTreeNodeState(state);
+ }
+ } finally {
+ try {
+ setRowKey(context, storedKey);
+ } catch (Exception e) {
+ context.getExternalContext().log(e.getMessage(), e);
+ }
+ }
+ }
+ }
+
+ /**
+ * Add node to tree
+ *
+ * @param parentRowKey parent node row key
+ * @param newNode inserted node
+ * @param id inserted node parent's local identifier
+ * @param state inserted tree node state. Optional
+ */
+ public void addNode(Object parentRowKey, TreeNode draggedNode, Object id, Object state) {
+ addNode(getFacesContext(), parentRowKey, draggedNode, id, state);
+ }
}
Modified: trunk/ui/tree/src/main/java/org/richfaces/component/UITreeNode.java
===================================================================
--- trunk/ui/tree/src/main/java/org/richfaces/component/UITreeNode.java 2008-06-20 14:15:20 UTC (rev 9142)
+++ trunk/ui/tree/src/main/java/org/richfaces/component/UITreeNode.java 2008-06-20 14:18:44 UTC (rev 9143)
@@ -7,10 +7,13 @@
import javax.faces.component.UIComponent;
import javax.faces.component.UIComponentBase;
+import javax.faces.component.UIViewRoot;
import javax.faces.context.FacesContext;
import javax.faces.el.ValueBinding;
import javax.faces.event.AbortProcessingException;
import javax.faces.event.FacesEvent;
+import javax.faces.event.FacesListener;
+import javax.faces.event.PhaseId;
import org.ajax4jsf.component.AjaxComponent;
import org.ajax4jsf.event.AjaxEvent;
@@ -132,10 +135,11 @@
TreeEvents.invokeListenerBindings(this, event, context);
//TODO quick fix for UITree to invoke listeners
- if (tree != null) {
- if (event instanceof DragEvent || event instanceof DropEvent) {
- tree.broadcast(event);
- }
+
+ if (tree != null && (event instanceof DragEvent || event instanceof DropEvent)) {
+ tree.broadcast(event);
+ } else if (event instanceof DnDEventWrapper) {
+ event.queue();
}
if (event instanceof AjaxEvent) {
@@ -143,6 +147,39 @@
}
}
+ /**
+ * <p>
+ * Queue an event for broadcast at the end of the current request
+ * processing lifecycle phase. The default implementation in
+ * {@link UIComponentBase} must delegate this call to the
+ * <code>queueEvent()</code> method of the parent {@link UIComponent}.
+ * </p>
+ *
+ * @param event {@link FacesEvent} to be queued
+ *
+ * @throws IllegalStateException if this component is not a descendant of a {@link UIViewRoot}
+ * @throws NullPointerException if <code>event</code> is <code>null</code>
+ */
+ @Override
+ public void queueEvent(FacesEvent event) {
+ FacesEvent resultEvent = event;
+
+ UITree tree = getUITree();
+ if (tree != null && (event instanceof DragEvent || event instanceof DropEvent)) {
+ if (tree.isImmediate()) {
+ event.setPhaseId(PhaseId.APPLY_REQUEST_VALUES);
+ } else {
+ event.setPhaseId(PhaseId.INVOKE_APPLICATION);
+ }
+
+ resultEvent = new DnDEventWrapper(this, event, tree.getRowKey());
+ } else if (event instanceof DnDEventWrapper) {
+ resultEvent = ((DnDEventWrapper) event).getTarget();
+ }
+
+ super.queueEvent(resultEvent);
+ }
+
public void addChangeExpandListener(NodeExpandedListener listener) {
addFacesListener(listener);
}
@@ -879,4 +916,97 @@
return (this.timeout);
}
}
+
+ /**
+ * Helper inner class used to wrap drag and drop events to suspend them to ensure
+ * that events will processed last.
+ *
+ * Note: We should ensure that all drag & drop events will be processed after all other events
+ * to avoid problems with removed while drop operation tree nodes and their event handlers.
+ *
+ * @author dmorozov
+ */
+ protected static final class DnDEventWrapper extends FacesEvent {
+
+ private static final long serialVersionUID = -5479811879939203868L;
+
+ private final FacesEvent target;
+
+ private Object key;
+
+ /**
+ * Construct a new event object that wrap original event and store target node row key
+ * to be processed in future.
+ *
+ * @param owner event owner component
+ * @param target wrapped event
+ * @param key target tree node row key
+ */
+ public DnDEventWrapper(UIComponent owner, FacesEvent target, Object key) {
+ super(owner);
+ this.target = target;
+ this.key = key;
+ if (this.target == null) {
+ throw new NullPointerException();
+ }
+ }
+
+ /**
+ * <p>
+ * Return the identifier of the request processing phase during which
+ * this event should be delivered.
+ * </p>
+ */
+ public PhaseId getPhaseId() {
+ return target.getPhaseId();
+ }
+
+ /**
+ * <p> Set the {@link PhaseId} during which this event will be delivered.</p>
+ * @throws IllegalArgumentException phaseId is null.
+ */
+ public void setPhaseId(PhaseId phaseId) {
+ throw new UnsupportedOperationException();
+ }
+
+ /**
+ * Get wrapped event
+ * @return wrapped event
+ */
+ public FacesEvent getTarget() {
+ return target;
+ }
+
+ /* (non-Javadoc)
+ * @see javax.faces.event.FacesEvent#isAppropriateListener(javax.faces.event.FacesListener)
+ */
+ @Override
+ public boolean isAppropriateListener(FacesListener listener) {
+ return false;
+ }
+
+ /* (non-Javadoc)
+ * @see javax.faces.event.FacesEvent#processListener(javax.faces.event.FacesListener)
+ */
+ @Override
+ public void processListener(FacesListener listener) {
+ throw new UnsupportedOperationException();
+ }
+
+ /**
+ * Get target component row key
+ * @return the row key
+ */
+ public Object getKey() {
+ return key;
+ }
+
+ /**
+ * Set target component row key
+ * @param key the row key to set
+ */
+ public void setKey(Object key) {
+ this.key = key;
+ }
+ }
}
Modified: trunk/ui/tree/src/main/java/org/richfaces/component/state/TreeState.java
===================================================================
--- trunk/ui/tree/src/main/java/org/richfaces/component/state/TreeState.java 2008-06-20 14:15:20 UTC (rev 9142)
+++ trunk/ui/tree/src/main/java/org/richfaces/component/state/TreeState.java 2008-06-20 14:18:44 UTC (rev 9143)
@@ -24,6 +24,7 @@
import java.io.IOException;
import java.io.Serializable;
import java.util.HashSet;
+import java.util.Iterator;
import java.util.Set;
import javax.faces.application.FacesMessage;
@@ -280,5 +281,13 @@
expandedNodes.removeAll(queuedCollapsedNodes);
queuedCollapsedNodes.clear();
}
+
+ /**
+ * Get list of expanded tree nodes
+ * @return list of expanded tree nodes
+ */
+ public Set getExpandedNodes() {
+ return expandedNodes;
+ }
}
Modified: trunk/ui/tree/src/main/java/org/richfaces/renderkit/NodeRendererBase.java
===================================================================
--- trunk/ui/tree/src/main/java/org/richfaces/renderkit/NodeRendererBase.java 2008-06-20 14:15:20 UTC (rev 9142)
+++ trunk/ui/tree/src/main/java/org/richfaces/renderkit/NodeRendererBase.java 2008-06-20 14:18:44 UTC (rev 9143)
@@ -224,8 +224,6 @@
}
protected void doDecode(FacesContext context, UIComponent component) {
- super.doDecode(context, component);
-
UITreeNode node = (UITreeNode) component;
UITree tree = node.getUITree();
TreeRowKey key = (TreeRowKey) tree.getRowKey();
@@ -271,6 +269,8 @@
tree.getAttributes().remove(UITree.SELECTION_INPUT_ATTRIBUTE);
}
+
+ super.doDecode(context, component);
}
public String getAjaxSelectedListenerFlag(FacesContext context,
15 years, 11 months
JBoss Rich Faces SVN: r9142 - trunk/framework/impl/src/main/java/org/richfaces/component/util.
by richfaces-svn-commits@lists.jboss.org
Author: nbelaevski
Date: 2008-06-20 10:15:20 -0400 (Fri, 20 Jun 2008)
New Revision: 9142
Modified:
trunk/framework/impl/src/main/java/org/richfaces/component/util/HtmlUtil.java
Log:
Proper escapement for JavaScript parameters added
Modified: trunk/framework/impl/src/main/java/org/richfaces/component/util/HtmlUtil.java
===================================================================
--- trunk/framework/impl/src/main/java/org/richfaces/component/util/HtmlUtil.java 2008-06-20 14:13:01 UTC (rev 9141)
+++ trunk/framework/impl/src/main/java/org/richfaces/component/util/HtmlUtil.java 2008-06-20 14:15:20 UTC (rev 9142)
@@ -77,7 +77,7 @@
if (target != null) {
matcher.appendReplacement(sb, "#"
+ target.getClientId(context).replaceAll(":",
- "\\\\\\\\\\\\\\\\:"));
+ "\\\\\\\\:"));
}
}
matcher.appendTail(sb);
15 years, 11 months
JBoss Rich Faces SVN: r9141 - trunk/ui/fileUpload/src/main/resources/org/richfaces/renderkit/html/js.
by richfaces-svn-commits@lists.jboss.org
Author: andrei_exadel
Date: 2008-06-20 10:13:01 -0400 (Fri, 20 Jun 2008)
New Revision: 9141
Modified:
trunk/ui/fileUpload/src/main/resources/org/richfaces/renderkit/html/js/FileUpload.js
Log:
RF-3756
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-20 13:49:57 UTC (rev 9140)
+++ trunk/ui/fileUpload/src/main/resources/org/richfaces/renderkit/html/js/FileUpload.js 2008-06-20 14:13:01 UTC (rev 9141)
@@ -721,7 +721,7 @@
this.disableAddButton();
this.disableCleanButton();
this.disableUploadButton();
- this.switchUploadButton();
+
},
cleanAllDisabled: function () {
@@ -752,22 +752,6 @@
}
return s;
},
-
- switchUploadButton: function () {
- if (this.runUpload) {
- var d = $(this.id + ":upload2");
- d.innerHTML = FileUploadEntry.LABELS['stop'];
- d.onclick = function () {
- return this.stop();
- }.bind(this);
- }else {
- var d = $(this.id + ":upload2");
- d.innerHTML = FileUploadEntry.LABELS['upload'];;
- d.onclick = function () {
- return this.upload();
- }.bind(this);
- }
- },
disableCleanButton: function() {
var disabled = this.cleanAllDisabled();
@@ -814,7 +798,13 @@
if (this.disabled) {
d1.onclick = function() {return false;};
}else {
- d1.onclick = function() { return this.upload();}.bind(this);
+ if (!this.runUpload) {
+ d1.onclick = function() { return this.upload();}.bind(this);
+ d2.innerHTML = FileUploadEntry.LABELS['upload'];
+ }else {
+ d1.onclick = function() { return this.stop();}.bind(this);
+ d2.innerHTML = FileUploadEntry.LABELS['stop'];
+ }
}
this._updateClassNames(d1, d2, (this.runUpload) ? this.classes.STOP : this.classes.UPDATE, (this.runUpload) ? this.classes.STOP_CONTENT : this.classes.UPDATE_CONTENT);
},
15 years, 11 months