JBoss Rich Faces SVN: r8822 - trunk/docs/userguide/en/src/main/resources/xslt/org/jboss/richfaces.
by richfaces-svn-commits@lists.jboss.org
Author: smukhina
Date: 2008-05-29 09:35:53 -0400 (Thu, 29 May 2008)
New Revision: 8822
Modified:
trunk/docs/userguide/en/src/main/resources/xslt/org/jboss/richfaces/collapsing-navigation.xsl
Log:
http://jira.jboss.com/jira/browse/RF-3501
fixed
Modified: trunk/docs/userguide/en/src/main/resources/xslt/org/jboss/richfaces/collapsing-navigation.xsl
===================================================================
--- trunk/docs/userguide/en/src/main/resources/xslt/org/jboss/richfaces/…
[View More]collapsing-navigation.xsl 2008-05-29 12:21:21 UTC (rev 8821)
+++ trunk/docs/userguide/en/src/main/resources/xslt/org/jboss/richfaces/collapsing-navigation.xsl 2008-05-29 13:35:53 UTC (rev 8822)
@@ -165,7 +165,7 @@
<xsl:template name="user.head.content">
<xsl:param name="node" select="." />
- <script type="text/javascript" src="script/toggle.js"></script>
+ <script type="text/javascript" src="script/toggle.js"><xsl:comment>If you see this message, your web browser doesn't support JavaScript or JavaScript is disabled.</xsl:comment></script>
</xsl:template>
<xsl:template name="toggle.expand.mark">
[View Less]
16 years, 7 months
JBoss Rich Faces SVN: r8821 - in trunk/test-applications/seleniumTest/src/test/java/org/richfaces: testng and 1 other directory.
by richfaces-svn-commits@lists.jboss.org
Author: andrei_exadel
Date: 2008-05-29 08:21:21 -0400 (Thu, 29 May 2008)
New Revision: 8821
Modified:
trunk/test-applications/seleniumTest/src/test/java/org/richfaces/SeleniumTestBase.java
trunk/test-applications/seleniumTest/src/test/java/org/richfaces/testng/AjaxCommandButtonTest.java
trunk/test-applications/seleniumTest/src/test/java/org/richfaces/testng/AjaxCommandLinkTest.java
trunk/test-applications/seleniumTest/src/test/java/org/richfaces/testng/AjaxPollTest.java
Log:
Poll …
[View More]test refactoring
Modified: trunk/test-applications/seleniumTest/src/test/java/org/richfaces/SeleniumTestBase.java
===================================================================
--- trunk/test-applications/seleniumTest/src/test/java/org/richfaces/SeleniumTestBase.java 2008-05-29 09:34:47 UTC (rev 8820)
+++ trunk/test-applications/seleniumTest/src/test/java/org/richfaces/SeleniumTestBase.java 2008-05-29 12:21:21 UTC (rev 8821)
@@ -94,6 +94,7 @@
/**
* Renders page
*/
+ @Deprecated
protected void renderPage(String homePage) {
selenium.open(protocol + "://" + host + ":" + port + "/" + APPLICATION_NAME + homePage);
selenium.waitForPageToLoad(String.valueOf(pageRenderTime));
@@ -112,6 +113,7 @@
/**
* Renders page
*/
+ @Deprecated
protected void renderPage(String homePage, Templates template) {
selenium.open(protocol + "://" + host + ":" + port + "/" + APPLICATION_NAME + homePage);
selenium.waitForPageToLoad(String.valueOf(pageRenderTime));
@@ -128,7 +130,28 @@
checkJSError();
}
+
+ /**
+ * Renders page
+ */
+ protected void renderPage(Templates template) {
+ selenium.open(protocol + "://" + host + ":" + port + "/" + APPLICATION_NAME + getTestUrl());
+ selenium.waitForPageToLoad(String.valueOf(pageRenderTime));
+
+ template.loadTemplate(this);
+ checkPageRendering(); // At the first we check if page has been
+ // rendered
+ checkJSError(); // At the second we check if JS errors occurred
+
+ reRenderForm(); // ReRender component
+
+ checkPageRendering(); // Check all again
+ checkJSError();
+
+ }
+
+
/**
* Writes status message on client side
*
@@ -273,6 +296,20 @@
String _v = getValueById(id);
Assert.assertEquals(_v, value);
}
+
+ /**
+ * Asserts DOM node value equals to value defined
+ *
+ * @param id -
+ * DOM element id
+ * @param value -
+ * value defined
+ * @param message = message to be displayed in failure case
+ */
+ public void AssertValueEquals(String id, String value, String message) {
+ String _v = getValueById(id);
+ Assert.assertEquals(_v, value, message);
+ }
/**
* Asserts DOM node value does not equal to value defined
@@ -286,7 +323,23 @@
String _v = getValueById(id);
Assert.assertNotSame(_v, value);
}
+
+
+ /**
+ * Asserts DOM node value does not equal to value defined
+ *
+ * @param id -
+ * DOM element id
+ * @param value -
+ * value defined
+ * @param message = message to be displayed in failure case
+ */
+ public void AssertValueNotEquals(String id, String value, String message) {
+ String _v = getValueById(id);
+ Assert.assertNotSame(_v, value, message);
+ }
+
/**
* Asserts DOM node text equals to text defined
*
@@ -299,7 +352,22 @@
String _v = getTextById(id);
Assert.assertEquals(_v, value);
}
+
+ /**
+ * Asserts DOM node text equals to text defined
+ *
+ * @param id -
+ * DOM element id
+ * @param value -
+ * text defined
+ * @param message = message to be displayed in failure case
+ */
+ public void AssertTextEquals(String id, String value, String message) {
+ String _v = getTextById(id);
+ Assert.assertEquals(_v, value, message);
+ }
+
/**
* Asserts DOM node text does not equal to text defined
*
@@ -312,6 +380,20 @@
String _v = getTextById(id);
Assert.assertNotSame(_v, value);
}
+
+ /**
+ * Asserts DOM node text does not equal to text defined
+ *
+ * @param id -
+ * DOM element id
+ * @param value -
+ * text defined
+ * @param message = message to be displayed in failure case
+ */
+ public void AssertTextNotEquals(String id, String value, String message) {
+ String _v = getTextById(id);
+ Assert.assertNotSame(_v, value, message);
+ }
/**
* Asserts DOM node is visible
@@ -538,7 +620,16 @@
}
}
+
+ /**
+ * Returns the url to test page to be opened by selenium
+ * @return
+ */
+ protected String getTestUrl() {
+ return null;
+ }
+
public boolean isFF() {
return new Boolean(selenium.getEval("navigator.userAgent.indexOf('Firefox') > -1"));
}
Modified: trunk/test-applications/seleniumTest/src/test/java/org/richfaces/testng/AjaxCommandButtonTest.java
===================================================================
--- trunk/test-applications/seleniumTest/src/test/java/org/richfaces/testng/AjaxCommandButtonTest.java 2008-05-29 09:34:47 UTC (rev 8820)
+++ trunk/test-applications/seleniumTest/src/test/java/org/richfaces/testng/AjaxCommandButtonTest.java 2008-05-29 12:21:21 UTC (rev 8821)
@@ -41,7 +41,7 @@
}
private void _testAjaxCommandButtonComponent(Templates template) {
- renderPage(getTestUrl(), template);
+ renderPage(template);
String parentId = getParentId() + "_form:";
Modified: trunk/test-applications/seleniumTest/src/test/java/org/richfaces/testng/AjaxCommandLinkTest.java
===================================================================
--- trunk/test-applications/seleniumTest/src/test/java/org/richfaces/testng/AjaxCommandLinkTest.java 2008-05-29 09:34:47 UTC (rev 8820)
+++ trunk/test-applications/seleniumTest/src/test/java/org/richfaces/testng/AjaxCommandLinkTest.java 2008-05-29 12:21:21 UTC (rev 8821)
@@ -41,7 +41,7 @@
}
private void _testAjaxCommandLinkComponent(Templates template) {
- renderPage(getTestUrl(), template);
+ renderPage(template);
String parentId = getParentId() + "_form:";
Modified: trunk/test-applications/seleniumTest/src/test/java/org/richfaces/testng/AjaxPollTest.java
===================================================================
--- trunk/test-applications/seleniumTest/src/test/java/org/richfaces/testng/AjaxPollTest.java 2008-05-29 09:34:47 UTC (rev 8820)
+++ trunk/test-applications/seleniumTest/src/test/java/org/richfaces/testng/AjaxPollTest.java 2008-05-29 12:21:21 UTC (rev 8821)
@@ -6,6 +6,7 @@
import org.richfaces.RichSeleniumTest;
import org.richfaces.SeleniumTestBase;
import org.richfaces.Templates;
+import org.testng.Assert;
import org.testng.annotations.AfterTest;
import org.testng.annotations.BeforeTest;
import org.testng.annotations.Parameters;
@@ -46,27 +47,37 @@
}
private void _testAjaxPollComponent(Templates template) {
- renderPage(getTestUrl(), template);
+ renderPage(template);
String parentId = getParentId() + "_form:";
String pollId = parentId + "poll";
String inputId = parentId + "_value";
- writeStatus("Start polling...");
- clickById(parentId + "_enabled");
- waitForAjaxCompletion();
+ enablePoll(parentId + "_enabled");
AssertValueEquals(inputId, "1");
writeStatus("Polling in progress...");
pause(1500, pollId);
- AssertValueNotEquals(inputId, "1");
+ AssertValueNotEquals(inputId, "1", "Polling does not fire after component was enabled. Or 'ReRender' attribute does not work");
+
waiteForCondition("document.getElementById('"+inputId+"').value == 8", 7000);
pause(1500, pollId);
writeStatus("Polling should be stopped...");
- AssertValueEquals(inputId, "8");
- AssertTextEquals(parentId + "_text", "Polling");
+
+ AssertValueEquals(inputId, "8", "Polling should be stopped. It continues to poll after component was disabled.");
+ AssertTextEquals(parentId + "_text", "Polling", "Polling terminated abnormal or invalid count of ajax requests has been submitted");
}
+
+ private void enablePoll(String id) {
+ writeStatus("Enable polling...");
+ try {
+ clickById(id);
+ waitForAjaxCompletion();
+ }catch (Exception e) {
+ Assert.fail("Poll component failed after attempt to enable polling. Caused by " + e);
+ }
+ }
/*
* (non-Javadoc)
[View Less]
16 years, 7 months
JBoss Rich Faces SVN: r8820 - trunk/docs/userguide/en/src/main/docbook/modules.
by richfaces-svn-commits@lists.jboss.org
Author: msorokin
Date: 2008-05-29 05:34:47 -0400 (Thu, 29 May 2008)
New Revision: 8820
Modified:
trunk/docs/userguide/en/src/main/docbook/modules/RFCarchitectover.xml
Log:
http://jira.jboss.com/jira/browse/RF-2408
Language correction
Modified: trunk/docs/userguide/en/src/main/docbook/modules/RFCarchitectover.xml
===================================================================
--- trunk/docs/userguide/en/src/main/docbook/modules/RFCarchitectover.xml 2008-05-29 09:08:30 UTC (rev 8819)
+++ …
[View More]trunk/docs/userguide/en/src/main/docbook/modules/RFCarchitectover.xml 2008-05-29 09:34:47 UTC (rev 8820)
@@ -1770,7 +1770,7 @@
<para>To get a better idea of standard component skinning we recommend to explore CSS files located in ui/core/src/main/resources/org/richfaces/ folder
- of RichFaces svn</para>
+ of Richfaces svn.</para>
<section id="Standard">
[View Less]
16 years, 7 months
JBoss Rich Faces SVN: r8819 - trunk/samples/richfaces-demo/src/main/webapp/richfaces/standardSkinning.
by richfaces-svn-commits@lists.jboss.org
Author: msorokin
Date: 2008-05-29 05:08:30 -0400 (Thu, 29 May 2008)
New Revision: 8819
Modified:
trunk/samples/richfaces-demo/src/main/webapp/richfaces/standardSkinning/usage.xhtml
Log:
http://jira.jboss.com/jira/browse/RF-2408
Language correction
Modified: trunk/samples/richfaces-demo/src/main/webapp/richfaces/standardSkinning/usage.xhtml
===================================================================
--- trunk/samples/richfaces-demo/src/main/webapp/richfaces/standardSkinning/usage.…
[View More]xhtml 2008-05-29 08:52:44 UTC (rev 8818)
+++ trunk/samples/richfaces-demo/src/main/webapp/richfaces/standardSkinning/usage.xhtml 2008-05-29 09:08:30 UTC (rev 8819)
@@ -138,9 +138,7 @@
</rich:panel>
</fieldset>
<p>
- In order to explore standard skinning css files you could check out
- resources located in <i>ui/core/src/main/resources/org/richfaces/</i> folder
- of Rich Fases svn.
+ To get a better idea of standard component skinning we recommend to explore CSS files located in ui/core/src/main/resources/org/richfaces/ folder of RichFaces svn.
</p>
<rich:modalPanel id="panel" width="300" height="230">
<f:facet name="header">
[View Less]
16 years, 7 months
JBoss Rich Faces SVN: r8818 - trunk/ui/columns/src/main/java/org/richfaces/taglib.
by richfaces-svn-commits@lists.jboss.org
Author: andrei_exadel
Date: 2008-05-29 04:52:44 -0400 (Thu, 29 May 2008)
New Revision: 8818
Modified:
trunk/ui/columns/src/main/java/org/richfaces/taglib/ColumnsTag.java
Log:
RF-3582
Modified: trunk/ui/columns/src/main/java/org/richfaces/taglib/ColumnsTag.java
===================================================================
--- trunk/ui/columns/src/main/java/org/richfaces/taglib/ColumnsTag.java 2008-05-29 08:21:40 UTC (rev 8817)
+++ trunk/ui/columns/src/main/java/org/richfaces/taglib/…
[View More]ColumnsTag.java 2008-05-29 08:52:44 UTC (rev 8818)
@@ -449,8 +449,8 @@
private void initItarationId() {
String jspId = getJspId();
if (jspId != null) {
- setJspId(getJspId()); // We need it twice!
- setJspId(getJspId());
+ setJspId(jspId); // We need it twice!
+ setJspId(jspId);
}
}
[View Less]
16 years, 7 months
JBoss Rich Faces SVN: r8817 - trunk/test-applications/seleniumTest/src/test/java/org/richfaces/testng.
by richfaces-svn-commits@lists.jboss.org
Author: dsvyatobatsko
Date: 2008-05-29 04:21:40 -0400 (Thu, 29 May 2008)
New Revision: 8817
Modified:
trunk/test-applications/seleniumTest/src/test/java/org/richfaces/testng/ComboBoxTest.java
Log:
Modified: trunk/test-applications/seleniumTest/src/test/java/org/richfaces/testng/ComboBoxTest.java
===================================================================
--- trunk/test-applications/seleniumTest/src/test/java/org/richfaces/testng/ComboBoxTest.java 2008-05-29 07:45:35 UTC (rev 8816)
…
[View More]+++ trunk/test-applications/seleniumTest/src/test/java/org/richfaces/testng/ComboBoxTest.java 2008-05-29 08:21:40 UTC (rev 8817)
@@ -35,8 +35,8 @@
@Test
public void testComboBoxComponent() throws Exception {
_testComboBoxComponent(Templates.SIMPLE);
-// _testComboBoxComponent(Templates.DATATABLE);
-// _testComboBoxComponent(Templates.MODALPANEL);
+ _testComboBoxComponent(Templates.DATATABLE);
+ _testComboBoxComponent(Templates.MODALPANEL);
}
private void _testComboBoxComponent(Templates template) {
@@ -76,9 +76,6 @@
writeStatus("type \"O\"");
-// selenium.type(selectItemsCBId + "comboboxField", "O");
-// selenium.typeKeys(selectItemsCBId + "comboboxField", "O");
-
type(selectItemsCBId + "comboboxField", "O");
Assert.assertTrue(isVisibleById(selectItemsCBId + "list"), "Component's pop-up must show up on key typing");
@@ -89,9 +86,6 @@
clickById(suggestionValuesCBId);
writeStatus("type \"Ma\"");
-// selenium.type(suggestionValuesCBId + "comboboxField", "Ma");
-// selenium.typeKeys(suggestionValuesCBId + "comboboxField", "Ma");
-
type(suggestionValuesCBId + "comboboxField", "Ma");
Assert.assertTrue(isVisibleById(suggestionValuesCBId + "list"), "Component's pop-up must show up on key typing");
[View Less]
16 years, 7 months
JBoss Rich Faces SVN: r8816 - trunk/test-applications/seleniumTest/src/test/java/org/richfaces.
by richfaces-svn-commits@lists.jboss.org
Author: dsvyatobatsko
Date: 2008-05-29 03:45:35 -0400 (Thu, 29 May 2008)
New Revision: 8816
Modified:
trunk/test-applications/seleniumTest/src/test/java/org/richfaces/SeleniumTestBase.java
Log:
organized imports
Modified: trunk/test-applications/seleniumTest/src/test/java/org/richfaces/SeleniumTestBase.java
===================================================================
--- trunk/test-applications/seleniumTest/src/test/java/org/richfaces/SeleniumTestBase.java 2008-05-29 01:14:23 UTC (…
[View More]rev 8815)
+++ trunk/test-applications/seleniumTest/src/test/java/org/richfaces/SeleniumTestBase.java 2008-05-29 07:45:35 UTC (rev 8816)
@@ -24,7 +24,6 @@
import org.ajax4jsf.javascript.ScriptUtils;
import org.testng.Assert;
-import com.sun.org.apache.xpath.internal.operations.Bool;
import com.thoughtworks.selenium.DefaultSelenium;
/**
[View Less]
16 years, 7 months
JBoss Rich Faces SVN: r8815 - in trunk/framework/test: src/test/java/org/ajax4jsf/application and 1 other directory.
by richfaces-svn-commits@lists.jboss.org
Author: nbelaevski
Date: 2008-05-28 21:14:23 -0400 (Wed, 28 May 2008)
New Revision: 8815
Modified:
trunk/framework/test/pom.xml
trunk/framework/test/src/test/java/org/ajax4jsf/application/AjaxStateHolderTest.java
Log:
AjaxStateHolderTest.java updated and excluded from surefire
Modified: trunk/framework/test/pom.xml
===================================================================
--- trunk/framework/test/pom.xml 2008-05-28 23:48:55 UTC (rev 8814)
+++ trunk/framework/test/pom.xml 2008-…
[View More]05-29 01:14:23 UTC (rev 8815)
@@ -70,4 +70,16 @@
<version>1.6R7</version>
</dependency>
</dependencies>
+ <build>
+ <plugins>
+ <plugin>
+ <artifactId>maven-surefire-plugin</artifactId>
+ <configuration>
+ <excludes>
+ <exclude>**/AjaxStateHolderTest.java</exclude>
+ </excludes>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
</project>
\ No newline at end of file
Modified: trunk/framework/test/src/test/java/org/ajax4jsf/application/AjaxStateHolderTest.java
===================================================================
--- trunk/framework/test/src/test/java/org/ajax4jsf/application/AjaxStateHolderTest.java 2008-05-28 23:48:55 UTC (rev 8814)
+++ trunk/framework/test/src/test/java/org/ajax4jsf/application/AjaxStateHolderTest.java 2008-05-29 01:14:23 UTC (rev 8815)
@@ -50,16 +50,16 @@
Object state2 = new Object();
StateHolder ajaxStateHolder = AjaxStateHolder.getInstance(facesContext);
assertNull(ajaxStateHolder.getState("foo", "_id1"));
- ajaxStateHolder.saveState("foo", "_id1", state);
- ajaxStateHolder.saveState("foo", "_id2", state2);
+ ajaxStateHolder.saveState("foo", "_id1", new Object[]{state});
+ ajaxStateHolder.saveState("foo", "_id2", new Object[]{state2});
assertNull(ajaxStateHolder.getState("bar", "_id1"));
assertSame(state2,ajaxStateHolder.getState("foo",null));
assertSame(state,ajaxStateHolder.getState("foo","_id1"));
assertSame(state,ajaxStateHolder.getState("foo","_id3"));
Object state3 = new Object();
Object state4 = new Object();
- ajaxStateHolder.saveState("bar", "_id1", state3);
- ajaxStateHolder.saveState("bar", "_id2", state4);
+ ajaxStateHolder.saveState("bar", "_id1", new Object[]{state3});
+ ajaxStateHolder.saveState("bar", "_id2", new Object[]{state4});
assertSame(state3,ajaxStateHolder.getState("bar","_id1"));
assertSame(state,ajaxStateHolder.getState("foo","_id3"));
}
[View Less]
16 years, 7 months
JBoss Rich Faces SVN: r8814 - trunk/framework/impl/src/main/java/org/ajax4jsf/io/parser.
by richfaces-svn-commits@lists.jboss.org
Author: alexsmirnov
Date: 2008-05-28 19:48:55 -0400 (Wed, 28 May 2008)
New Revision: 8814
Modified:
trunk/framework/impl/src/main/java/org/ajax4jsf/io/parser/FastHtmlParser.java
Log:
fix http://jira.jboss.com/jira/browse/RF-3577
Modified: trunk/framework/impl/src/main/java/org/ajax4jsf/io/parser/FastHtmlParser.java
===================================================================
--- trunk/framework/impl/src/main/java/org/ajax4jsf/io/parser/FastHtmlParser.java 2008-05-28 18:57:34 UTC (…
[View More]rev 8813)
+++ trunk/framework/impl/src/main/java/org/ajax4jsf/io/parser/FastHtmlParser.java 2008-05-28 23:48:55 UTC (rev 8814)
@@ -64,7 +64,8 @@
boolean haveHtml = false;
boolean haveHead = false;
boolean closingElement = false;
- if (null != scripts || null != styles || null != userStyles) {
+// Always parse content, see http://jira.jboss.com/jira/browse/RF-3577
+// if (null != scripts || null != styles || null != userStyles) {
ParsingStateManager stateManager = ParsingStateManager
.getInstance();
ParserState state = stateManager.getInitialState();
@@ -147,9 +148,9 @@
}
}
context.send();
- } else {
- haveHtml = true;
- }
+// } else {
+// haveHtml = true;
+// }
// Send rest of input.
if (in instanceof FastBufferReader) {
FastBufferReader fastIn = (FastBufferReader) in;
[View Less]
16 years, 7 months
JBoss Rich Faces SVN: r8813 - in trunk/framework: test/src/test/java/org/ajax4jsf/application and 1 other directory.
by richfaces-svn-commits@lists.jboss.org
Author: alexsmirnov
Date: 2008-05-28 14:57:34 -0400 (Wed, 28 May 2008)
New Revision: 8813
Added:
trunk/framework/impl/src/main/java/org/ajax4jsf/application/TreeStructureNode.java
Removed:
trunk/framework/impl/src/main/java/org/ajax4jsf/application/TreeStrutureNode.java
Modified:
trunk/framework/impl/src/main/java/org/ajax4jsf/application/AjaxStateManager.java
trunk/framework/test/src/test/java/org/ajax4jsf/application/AjaxStateManagerTest.java
Log:
fix class name grammar error
…
[View More]Modified: trunk/framework/impl/src/main/java/org/ajax4jsf/application/AjaxStateManager.java
===================================================================
--- trunk/framework/impl/src/main/java/org/ajax4jsf/application/AjaxStateManager.java 2008-05-28 18:25:43 UTC (rev 8812)
+++ trunk/framework/impl/src/main/java/org/ajax4jsf/application/AjaxStateManager.java 2008-05-28 18:57:34 UTC (rev 8813)
@@ -160,7 +160,7 @@
* @see javax.faces.application.StateManager#getTreeStructureToSave(javax.faces.context.FacesContext)
*/
protected Object getTreeStructureToSave(FacesContext context) {
- TreeStrutureNode treeStructure = new TreeStrutureNode();
+ TreeStructureNode treeStructure = new TreeStructureNode();
treeStructure.apply(context, context.getViewRoot(), new HashSet<String>());
return treeStructure;
}
@@ -214,10 +214,10 @@
UIViewRoot viewRoot = null;
ResponseStateManager responseStateManager = getRenderKit(context,
renderKitId).getResponseStateManager();
- TreeStrutureNode treeStructure = null;
+ TreeStructureNode treeStructure = null;
Object[] state = null;
if (isSavingStateInClient(context)) {
- treeStructure = (TreeStrutureNode) responseStateManager
+ treeStructure = (TreeStructureNode) responseStateManager
.getTreeStructureToRestore(context, viewId);
// viewRoot = parent.restoreView(context, viewId, renderKitId);
state = (Object[]) responseStateManager
@@ -226,7 +226,7 @@
Object[] serializedView = restoreStateFromSession(context, viewId,
renderKitId);
if (null != serializedView) {
- treeStructure = (TreeStrutureNode) serializedView[0];
+ treeStructure = (TreeStructureNode) serializedView[0];
state = (Object[]) serializedView[1];
}
}
@@ -268,7 +268,7 @@
SerializedView serializedView = null;
UIViewRoot viewRoot = context.getViewRoot();
if (null !=viewRoot && !viewRoot.isTransient()) {
- TreeStrutureNode treeStructure = (TreeStrutureNode) getTreeStructureToSave(context);
+ TreeStructureNode treeStructure = (TreeStructureNode) getTreeStructureToSave(context);
Object state = getComponentStateToSave(context);
if (isSavingStateInClient(context)) {
serializedView = new SerializedView(treeStructure, state);
Copied: trunk/framework/impl/src/main/java/org/ajax4jsf/application/TreeStructureNode.java (from rev 8808, trunk/framework/impl/src/main/java/org/ajax4jsf/application/TreeStrutureNode.java)
===================================================================
--- trunk/framework/impl/src/main/java/org/ajax4jsf/application/TreeStructureNode.java (rev 0)
+++ trunk/framework/impl/src/main/java/org/ajax4jsf/application/TreeStructureNode.java 2008-05-28 18:57:34 UTC (rev 8813)
@@ -0,0 +1,220 @@
+/**
+ *
+ */
+package org.ajax4jsf.application;
+
+import java.io.Externalizable;
+import java.io.IOException;
+import java.io.ObjectInput;
+import java.io.ObjectOutput;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+import java.util.Map.Entry;
+
+import javax.faces.component.UIComponent;
+import javax.faces.context.FacesContext;
+
+/**
+ * @author asmirnov
+ *
+ */
+final class TreeStructureNode implements Externalizable {
+ /**
+ * TODO - implement Externalizable to reduce serialized state.
+ */
+ private static final long serialVersionUID = -9038742487716977911L;
+
+ private static final String NULL_ID = "";
+
+ private Map<String, TreeStructureNode> facets = null;
+
+ private List<TreeStructureNode> children = null;
+
+ private String type;
+
+ private String id;
+
+ public TreeStructureNode() {
+ }
+
+ public void apply(FacesContext context, UIComponent component,
+ Set<String> uniqueIds) {
+ type = component.getClass().getName();
+ id = component.getId();
+ String clientId = component.getClientId(context);
+ if (!uniqueIds.add(clientId)) {
+ throw new IllegalStateException("duplicate Id for a component "
+ + clientId);
+ }
+ Map<String, UIComponent> componentFacets = component.getFacets();
+ for (Iterator<Entry<String,UIComponent>> i = componentFacets.entrySet().iterator(); i
+ .hasNext();) {
+ Entry<String,UIComponent> element = i.next();
+ UIComponent f = element.getValue();
+ if (!f.isTransient()) {
+ TreeStructureNode facet = new TreeStructureNode();
+ facet.apply(context, f, uniqueIds);
+ if (null == facets) {
+ facets = new HashMap<String, TreeStructureNode>();
+ }
+ facets.put(element.getKey(), facet);
+
+ }
+ }
+ for (Iterator<UIComponent> i = component.getChildren().iterator(); i.hasNext();) {
+ UIComponent child = i.next();
+ if (!child.isTransient()) {
+ TreeStructureNode t = new TreeStructureNode();
+ t.apply(context, child, uniqueIds);
+ if (null == children) {
+ children = new ArrayList<TreeStructureNode>();
+ }
+ children.add(t);
+
+ }
+ }
+ }
+
+ public UIComponent restore(ComponentsLoader loader) {
+ UIComponent component;
+ component = loader.createComponent(type);
+ component.setId(id);
+ if (null != facets) {
+ for (Iterator<Entry<String, TreeStructureNode>> i = facets.entrySet().iterator(); i.hasNext();) {
+ Entry<String, TreeStructureNode> element = i.next();
+ UIComponent facet = ( element.getValue())
+ .restore(loader);
+ component.getFacets().put(element.getKey(), facet);
+ }
+
+ }
+ if (null != children) {
+ for (Iterator<TreeStructureNode> i = children.iterator(); i.hasNext();) {
+ TreeStructureNode node = i.next();
+ UIComponent child = node.restore(loader);
+ component.getChildren().add(child);
+ }
+
+ }
+ return component;
+ }
+
+ /**
+ * @return the facets
+ */
+ public Map<String, TreeStructureNode> getFacets() {
+ return facets;
+ }
+
+ /**
+ * @param facets
+ * the facets to set
+ */
+ public void setFacets(Map<String, TreeStructureNode> facets) {
+ this.facets = facets;
+ }
+
+ /**
+ * @return the children
+ */
+ public List<TreeStructureNode> getChildren() {
+ return children;
+ }
+
+ /**
+ * @param children
+ * the children to set
+ */
+ public void setChildren(List<TreeStructureNode> children) {
+ this.children = children;
+ }
+
+ /**
+ * @return the type
+ */
+ public String getType() {
+ return type;
+ }
+
+ /**
+ * @param type
+ * the type to set
+ */
+ public void setType(String type) {
+ this.type = type;
+ }
+
+ /**
+ * @return the id
+ */
+ public String getId() {
+ return id;
+ }
+
+ /**
+ * @param id
+ * the id to set
+ */
+ public void setId(String id) {
+ this.id = id;
+ }
+
+ public void readExternal(ObjectInput in) throws IOException,
+ ClassNotFoundException {
+ type = in.readUTF();
+ id = in.readUTF();
+ if (NULL_ID.equals(id)) {
+ id = null;
+ }
+ int facetsSize = in.readInt();
+ if (facetsSize > 0) {
+ facets = new HashMap<String, TreeStructureNode>(facetsSize);
+ for (int i = 0; i < facetsSize; i++) {
+ String facetName = in.readUTF();
+ TreeStructureNode facet = new TreeStructureNode();
+ facet.readExternal(in);
+ facets.put(facetName, facet);
+ }
+ }
+ int childrenSize = in.readInt();
+ if (childrenSize > 0) {
+ children = new ArrayList<TreeStructureNode>(childrenSize);
+ for (int i = 0; i < childrenSize; i++) {
+ TreeStructureNode child = new TreeStructureNode();
+ child.readExternal(in);
+ children.add(child);
+ }
+ }
+ }
+
+ public void writeExternal(ObjectOutput out) throws IOException {
+ out.writeUTF(type);
+ out.writeUTF(null == id ? NULL_ID : id);
+ if (null != facets) {
+ out.writeInt(facets.size());
+ for (Iterator<Map.Entry<String, TreeStructureNode>> i = facets.entrySet().iterator(); i.hasNext();) {
+ Map.Entry<String, TreeStructureNode> entry = i.next();
+ out.writeUTF(entry.getKey());
+ TreeStructureNode node = entry.getValue();
+ node.writeExternal(out);
+ }
+
+ } else {
+ out.writeInt(0);
+ }
+ if (null != children) {
+ out.writeInt(children.size());
+ for (Iterator<TreeStructureNode> i = children.iterator(); i.hasNext();) {
+ TreeStructureNode child = i.next();
+ child.writeExternal(out);
+ }
+
+ } else {
+ out.writeInt(0);
+ }
+ }
+}
\ No newline at end of file
Property changes on: trunk/framework/impl/src/main/java/org/ajax4jsf/application/TreeStructureNode.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Name: svn:keywords
+ Date Revision Author
Deleted: trunk/framework/impl/src/main/java/org/ajax4jsf/application/TreeStrutureNode.java
===================================================================
--- trunk/framework/impl/src/main/java/org/ajax4jsf/application/TreeStrutureNode.java 2008-05-28 18:25:43 UTC (rev 8812)
+++ trunk/framework/impl/src/main/java/org/ajax4jsf/application/TreeStrutureNode.java 2008-05-28 18:57:34 UTC (rev 8813)
@@ -1,220 +0,0 @@
-/**
- *
- */
-package org.ajax4jsf.application;
-
-import java.io.Externalizable;
-import java.io.IOException;
-import java.io.ObjectInput;
-import java.io.ObjectOutput;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-import java.util.Map.Entry;
-
-import javax.faces.component.UIComponent;
-import javax.faces.context.FacesContext;
-
-/**
- * @author asmirnov
- *
- */
-final class TreeStrutureNode implements Externalizable {
- /**
- * TODO - implement Externalizable to reduce serialized state.
- */
- private static final long serialVersionUID = -9038742487716977911L;
-
- private static final String NULL_ID = "";
-
- private Map<String, TreeStrutureNode> facets = null;
-
- private List<TreeStrutureNode> children = null;
-
- private String type;
-
- private String id;
-
- public TreeStrutureNode() {
- }
-
- public void apply(FacesContext context, UIComponent component,
- Set<String> uniqueIds) {
- type = component.getClass().getName();
- id = component.getId();
- String clientId = component.getClientId(context);
- if (!uniqueIds.add(clientId)) {
- throw new IllegalStateException("duplicate Id for a component "
- + clientId);
- }
- Map<String, UIComponent> componentFacets = component.getFacets();
- for (Iterator<Entry<String,UIComponent>> i = componentFacets.entrySet().iterator(); i
- .hasNext();) {
- Entry<String,UIComponent> element = i.next();
- UIComponent f = element.getValue();
- if (!f.isTransient()) {
- TreeStrutureNode facet = new TreeStrutureNode();
- facet.apply(context, f, uniqueIds);
- if (null == facets) {
- facets = new HashMap<String, TreeStrutureNode>();
- }
- facets.put(element.getKey(), facet);
-
- }
- }
- for (Iterator<UIComponent> i = component.getChildren().iterator(); i.hasNext();) {
- UIComponent child = i.next();
- if (!child.isTransient()) {
- TreeStrutureNode t = new TreeStrutureNode();
- t.apply(context, child, uniqueIds);
- if (null == children) {
- children = new ArrayList<TreeStrutureNode>();
- }
- children.add(t);
-
- }
- }
- }
-
- public UIComponent restore(ComponentsLoader loader) {
- UIComponent component;
- component = loader.createComponent(type);
- component.setId(id);
- if (null != facets) {
- for (Iterator<Entry<String, TreeStrutureNode>> i = facets.entrySet().iterator(); i.hasNext();) {
- Entry<String, TreeStrutureNode> element = i.next();
- UIComponent facet = ( element.getValue())
- .restore(loader);
- component.getFacets().put(element.getKey(), facet);
- }
-
- }
- if (null != children) {
- for (Iterator<TreeStrutureNode> i = children.iterator(); i.hasNext();) {
- TreeStrutureNode node = i.next();
- UIComponent child = node.restore(loader);
- component.getChildren().add(child);
- }
-
- }
- return component;
- }
-
- /**
- * @return the facets
- */
- public Map<String, TreeStrutureNode> getFacets() {
- return facets;
- }
-
- /**
- * @param facets
- * the facets to set
- */
- public void setFacets(Map<String, TreeStrutureNode> facets) {
- this.facets = facets;
- }
-
- /**
- * @return the children
- */
- public List<TreeStrutureNode> getChildren() {
- return children;
- }
-
- /**
- * @param children
- * the children to set
- */
- public void setChildren(List<TreeStrutureNode> children) {
- this.children = children;
- }
-
- /**
- * @return the type
- */
- public String getType() {
- return type;
- }
-
- /**
- * @param type
- * the type to set
- */
- public void setType(String type) {
- this.type = type;
- }
-
- /**
- * @return the id
- */
- public String getId() {
- return id;
- }
-
- /**
- * @param id
- * the id to set
- */
- public void setId(String id) {
- this.id = id;
- }
-
- public void readExternal(ObjectInput in) throws IOException,
- ClassNotFoundException {
- type = in.readUTF();
- id = in.readUTF();
- if (NULL_ID.equals(id)) {
- id = null;
- }
- int facetsSize = in.readInt();
- if (facetsSize > 0) {
- facets = new HashMap<String, TreeStrutureNode>(facetsSize);
- for (int i = 0; i < facetsSize; i++) {
- String facetName = in.readUTF();
- TreeStrutureNode facet = new TreeStrutureNode();
- facet.readExternal(in);
- facets.put(facetName, facet);
- }
- }
- int childrenSize = in.readInt();
- if (childrenSize > 0) {
- children = new ArrayList<TreeStrutureNode>(childrenSize);
- for (int i = 0; i < childrenSize; i++) {
- TreeStrutureNode child = new TreeStrutureNode();
- child.readExternal(in);
- children.add(child);
- }
- }
- }
-
- public void writeExternal(ObjectOutput out) throws IOException {
- out.writeUTF(type);
- out.writeUTF(null == id ? NULL_ID : id);
- if (null != facets) {
- out.writeInt(facets.size());
- for (Iterator<Map.Entry<String, TreeStrutureNode>> i = facets.entrySet().iterator(); i.hasNext();) {
- Map.Entry<String, TreeStrutureNode> entry = i.next();
- out.writeUTF(entry.getKey());
- TreeStrutureNode node = entry.getValue();
- node.writeExternal(out);
- }
-
- } else {
- out.writeInt(0);
- }
- if (null != children) {
- out.writeInt(children.size());
- for (Iterator<TreeStrutureNode> i = children.iterator(); i.hasNext();) {
- TreeStrutureNode child = i.next();
- child.writeExternal(out);
- }
-
- } else {
- out.writeInt(0);
- }
- }
-}
\ No newline at end of file
Modified: trunk/framework/test/src/test/java/org/ajax4jsf/application/AjaxStateManagerTest.java
===================================================================
--- trunk/framework/test/src/test/java/org/ajax4jsf/application/AjaxStateManagerTest.java 2008-05-28 18:25:43 UTC (rev 8812)
+++ trunk/framework/test/src/test/java/org/ajax4jsf/application/AjaxStateManagerTest.java 2008-05-28 18:57:34 UTC (rev 8813)
@@ -133,11 +133,11 @@
public void testTreeNodeApply() throws Exception {
buildTestTree();
- TreeStrutureNode node = new TreeStrutureNode();
+ TreeStructureNode node = new TreeStructureNode();
node.apply(facesContext, facesContext.getViewRoot(), new HashSet());
assertEquals(2, node.getChildren().size());
assertEquals(1, node.getFacets().size());
- TreeStrutureNode nodeA = (TreeStrutureNode) node.getFacets().get(FACET_A);
+ TreeStructureNode nodeA = (TreeStructureNode) node.getFacets().get(FACET_A);
assertNotNull(nodeA);
assertEquals(1, nodeA.getChildren().size());
assertEquals(1, nodeA.getFacets().size());
@@ -145,7 +145,7 @@
public void testTreeNodeCheckUniqueId() throws Exception {
buildTestTree();
- TreeStrutureNode node = new TreeStrutureNode();
+ TreeStructureNode node = new TreeStructureNode();
UIViewRoot viewRoot = facesContext.getViewRoot();
((UIComponent)viewRoot.getChildren().get(0)).setId(FACET_A);
((UIComponent)viewRoot.getChildren().get(1)).setId(FACET_A);
@@ -161,17 +161,17 @@
public void testTreeNodeSerialisation() throws Exception {
buildTestTree();
- TreeStrutureNode node = new TreeStrutureNode();
+ TreeStructureNode node = new TreeStructureNode();
node.apply(facesContext, facesContext.getViewRoot(), new HashSet());
ByteArrayOutputStream byteOut = new ByteArrayOutputStream();
ObjectOutputStream out = new ObjectOutputStream(byteOut);
out.writeObject(node);
ByteArrayInputStream byteIn = new ByteArrayInputStream(byteOut.toByteArray());
ObjectInputStream in = new ObjectInputStream(byteIn);
- TreeStrutureNode nodeIn = (TreeStrutureNode) in.readObject();
+ TreeStructureNode nodeIn = (TreeStructureNode) in.readObject();
assertEquals(2, nodeIn.getChildren().size());
assertEquals(1, nodeIn.getFacets().size());
- TreeStrutureNode nodeA = (TreeStrutureNode) nodeIn.getFacets().get(FACET_A);
+ TreeStructureNode nodeA = (TreeStructureNode) nodeIn.getFacets().get(FACET_A);
assertNotNull(nodeA);
assertEquals(1, nodeA.getChildren().size());
assertEquals(1, nodeA.getFacets().size());
[View Less]
16 years, 7 months