Author: Alex.Kolonitsky
Date: 2009-02-03 11:34:38 -0500 (Tue, 03 Feb 2009)
New Revision: 12554
Added:
trunk/test-applications/regressionArea/regressionArea-ejb/src/main/java/org/richfaces/regressionarea/issues/rf5948/
trunk/test-applications/regressionArea/regressionArea-ejb/src/main/java/org/richfaces/regressionarea/issues/rf5948/Bean.java
trunk/test-applications/regressionArea/regressionArea-tests/src/test/java/org/richfaces/testng/rf5851/
trunk/test-applications/regressionArea/regressionArea-tests/src/test/java/org/richfaces/testng/rf5851/Test.java
trunk/test-applications/regressionArea/regressionArea-tests/src/test/java/org/richfaces/testng/rf5948/
trunk/test-applications/regressionArea/regressionArea-tests/src/test/java/org/richfaces/testng/rf5948/Test.java
trunk/test-applications/regressionArea/regressionArea-web/src/main/webapp/pages/rf5851.xhtml
trunk/test-applications/regressionArea/regressionArea-web/src/main/webapp/pages/rf5948.xhtml
Modified:
trunk/framework/impl/src/main/java/org/ajax4jsf/renderkit/AjaxRendererUtils.java
trunk/test-applications/regressionArea/regressionArea-tests/src/test/resources/testng.xml
trunk/ui/menu-components/src/main/java/org/richfaces/renderkit/html/MenuItemRendererBase.java
trunk/ui/simpleTogglePanel/src/main/java/org/richfaces/renderkit/html/SimpleTogglePanelRenderer.java
Log:
Menu Item: process attribute does not work
https://jira.jboss.org/jira/browse/RF-5851
SimpleTogglePanel: process attribute does not work.
https://jira.jboss.org/jira/browse/RF-5948
Modified:
trunk/framework/impl/src/main/java/org/ajax4jsf/renderkit/AjaxRendererUtils.java
===================================================================
---
trunk/framework/impl/src/main/java/org/ajax4jsf/renderkit/AjaxRendererUtils.java 2009-02-03
16:24:09 UTC (rev 12553)
+++
trunk/framework/impl/src/main/java/org/ajax4jsf/renderkit/AjaxRendererUtils.java 2009-02-03
16:34:38 UTC (rev 12554)
@@ -566,7 +566,29 @@
}
return null;
}
+
+ public static void addProcessToAjaxContext(FacesContext facesContext, UIComponent
uiComponent){
+ if (!(uiComponent instanceof AjaxComponent)) {
+ return;
+ }
+ AjaxComponent ajaxComponent = (AjaxComponent) uiComponent;
+ Set<String> toProcess = asSet(ajaxComponent.getProcess());
+
+ if (null != toProcess) {
+ HashSet<String> componentIdsToProcess = new HashSet<String>();
+ for (String componentId : toProcess) {
+ UIComponent component = RendererUtils.getInstance().
+ findComponentFor(uiComponent, componentId);
+
+ componentIdsToProcess.add( null == component ?
+ componentId : component.getClientId(facesContext));
+ }
+ AjaxContext.getCurrentInstance(facesContext)
+ .setAjaxAreasToProcess(componentIdsToProcess);
+ }
+ }
+
/**
* Get status area Id for given component.
*
Added:
trunk/test-applications/regressionArea/regressionArea-ejb/src/main/java/org/richfaces/regressionarea/issues/rf5948/Bean.java
===================================================================
---
trunk/test-applications/regressionArea/regressionArea-ejb/src/main/java/org/richfaces/regressionarea/issues/rf5948/Bean.java
(rev 0)
+++
trunk/test-applications/regressionArea/regressionArea-ejb/src/main/java/org/richfaces/regressionarea/issues/rf5948/Bean.java 2009-02-03
16:34:38 UTC (rev 12554)
@@ -0,0 +1,27 @@
+package org.richfaces.regressionarea.issues.rf5948;
+
+import org.jboss.seam.ScopeType;
+import org.jboss.seam.annotations.Name;
+import org.jboss.seam.annotations.Scope;
+
+@Name("rf5948")
+(a)Scope(ScopeType.APPLICATION)
+public class Bean {
+ private String text;
+
+ public String getText() {
+ return text;
+ }
+
+ public void setText(String text) {
+ this.text = text;
+ }
+
+ public String getDuplicateText() {
+ return getText();
+ }
+
+ public void setDuplicateText(String duplicateText) {
+ this.text = duplicateText;
+ }
+}
Added:
trunk/test-applications/regressionArea/regressionArea-tests/src/test/java/org/richfaces/testng/rf5851/Test.java
===================================================================
---
trunk/test-applications/regressionArea/regressionArea-tests/src/test/java/org/richfaces/testng/rf5851/Test.java
(rev 0)
+++
trunk/test-applications/regressionArea/regressionArea-tests/src/test/java/org/richfaces/testng/rf5851/Test.java 2009-02-03
16:34:38 UTC (rev 12554)
@@ -0,0 +1,34 @@
+package org.richfaces.testng.rf5851;
+
+import org.richfaces.SeleniumTestBase;
+
+
+public class Test extends SeleniumTestBase {
+
+ private static final String TEST_STR = "test_02";
+
+ private static final String FORM = "form";
+ private static final String FORM_OUT = FORM + ":out";
+ private static final String FORM_MENU_ITEM = FORM + ":menu";
+ private static final String FORM_IN = FORM + ":in";
+
+ @org.testng.annotations.Test
+ public void testBeyondMinimum() throws Exception {
+ renderPage();
+
+ AssertPresent(FORM_IN);
+ selenium.type(FORM_IN, TEST_STR);
+
+ AssertPresent(FORM_MENU_ITEM);
+ AssertPresent(FORM_OUT);
+ clickAjaxCommandAndWait(FORM_MENU_ITEM);
+
+ AssertValueEquals(FORM_OUT, TEST_STR);
+ }
+
+ @Override
+ public String getTestUrl() {
+ return "pages/rf5851.xhtml";
+ }
+}
+
Added:
trunk/test-applications/regressionArea/regressionArea-tests/src/test/java/org/richfaces/testng/rf5948/Test.java
===================================================================
---
trunk/test-applications/regressionArea/regressionArea-tests/src/test/java/org/richfaces/testng/rf5948/Test.java
(rev 0)
+++
trunk/test-applications/regressionArea/regressionArea-tests/src/test/java/org/richfaces/testng/rf5948/Test.java 2009-02-03
16:34:38 UTC (rev 12554)
@@ -0,0 +1,32 @@
+package org.richfaces.testng.rf5948;
+
+import org.richfaces.SeleniumTestBase;
+
+public class Test extends SeleniumTestBase {
+
+ private static final String TEST_STR = "test_01";
+
+ private static final String FORM = "form";
+ private static final String FORM_OUT = FORM + ":out";
+ private static final String FORM_PANEL = FORM + ":panel_header";
+ private static final String FORM_IN = FORM + ":in";
+
+ @org.testng.annotations.Test
+ public void testProcessAttr() throws Exception {
+ renderPage();
+
+ AssertPresent(FORM_IN);
+ selenium.type(FORM_IN, TEST_STR);
+
+ AssertPresent(FORM_PANEL);
+ AssertPresent(FORM_OUT);
+ clickAjaxCommandAndWait(FORM_PANEL);
+
+ AssertValueEquals(FORM_OUT, TEST_STR);
+ }
+
+ @Override
+ public String getTestUrl() {
+ return "pages/rf5948.xhtml";
+ }
+}
Modified:
trunk/test-applications/regressionArea/regressionArea-tests/src/test/resources/testng.xml
===================================================================
---
trunk/test-applications/regressionArea/regressionArea-tests/src/test/resources/testng.xml 2009-02-03
16:24:09 UTC (rev 12553)
+++
trunk/test-applications/regressionArea/regressionArea-tests/src/test/resources/testng.xml 2009-02-03
16:34:38 UTC (rev 12554)
@@ -10,18 +10,22 @@
<package name="org.richfaces.testng.rf4507" />
<package name="org.richfaces.testng.rf4709" />
<package name="org.richfaces.testng.rf5264" />
+ <package name="org.richfaces.testng.rf5851" />
+ <package name="org.richfaces.testng.rf5948" />
</packages>
</test-->
<test name="FireFoxFunctionalTestsDANe">
<parameter name="loadStyleStrategy" value="DEFAULT"/>
<parameter name="loadScriptStrategy" value="ALL"/>
<parameter name="filterPrefix" value="/faces/NEKO/"/>
- <parameter name="browser" value="*firefox"/>
+ <parameter name="browser" value="*firefox"/>
<packages>
- <package name="org.richfaces.testng" />
+ <package name="org.richfaces.testng" />
<package name="org.richfaces.testng.rf4507" />
<package name="org.richfaces.testng.rf4709" />
<package name="org.richfaces.testng.rf5264" />
- </packages>
+ <package name="org.richfaces.testng.rf5851" />
+ <package name="org.richfaces.testng.rf5948" />
+ </packages>
</test>
</suite>
Added:
trunk/test-applications/regressionArea/regressionArea-web/src/main/webapp/pages/rf5851.xhtml
===================================================================
---
trunk/test-applications/regressionArea/regressionArea-web/src/main/webapp/pages/rf5851.xhtml
(rev 0)
+++
trunk/test-applications/regressionArea/regressionArea-web/src/main/webapp/pages/rf5851.xhtml 2009-02-03
16:34:38 UTC (rev 12554)
@@ -0,0 +1,22 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html
xmlns="http://www.w3.org/1999/xhtml"
+
xmlns:ui="http://java.sun.com/jsf/facelets"
+
xmlns:h="http://java.sun.com/jsf/html"
+
xmlns:f="http://java.sun.com/jsf/core"
+
xmlns:a4j="http://richfaces.org/a4j"
+
xmlns:rich="http://richfaces.org/rich">
+
+<ui:composition template="/layout/layout.xhtml">
+
+ <ui:define name="template">
+ <h:form id="form">
+ <!-- test process -->
+ <h:inputText value="#{rf5948.text}" id="in"
/><br />
+ <h:inputText value="#{rf5948.duplicateText}" id="out"
/>
+
+ <rich:menuItem id="menu" submitMode="ajax"
value="test item"
+ process="in" reRender="out"
ajaxSingle="true" ></rich:menuItem>
+ </h:form>
+ </ui:define>
+</ui:composition>
+</html>
Added:
trunk/test-applications/regressionArea/regressionArea-web/src/main/webapp/pages/rf5948.xhtml
===================================================================
---
trunk/test-applications/regressionArea/regressionArea-web/src/main/webapp/pages/rf5948.xhtml
(rev 0)
+++
trunk/test-applications/regressionArea/regressionArea-web/src/main/webapp/pages/rf5948.xhtml 2009-02-03
16:34:38 UTC (rev 12554)
@@ -0,0 +1,24 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html
xmlns="http://www.w3.org/1999/xhtml"
+
xmlns:ui="http://java.sun.com/jsf/facelets"
+
xmlns:h="http://java.sun.com/jsf/html"
+
xmlns:f="http://java.sun.com/jsf/core"
+
xmlns:a4j="http://richfaces.org/a4j"
+
xmlns:rich="http://richfaces.org/rich">
+
+<ui:composition template="/layout/layout.xhtml">
+
+ <ui:define name="template">
+ <h:form id="form">
+ <!-- test process -->
+ <h:inputText value="#{rf5948.text}" id="in"
/><br />
+ <h:inputText value="#{rf5948.duplicateText}" id="out" />
+
+ <rich:simpleTogglePanel opened="false"
switchType="ajax"
+ process="in" reRender="out"
id="panel" ajaxSingle="true">
+ Text text text text
+ </rich:simpleTogglePanel>
+ </h:form>
+ </ui:define>
+</ui:composition>
+</html>
Modified:
trunk/ui/menu-components/src/main/java/org/richfaces/renderkit/html/MenuItemRendererBase.java
===================================================================
---
trunk/ui/menu-components/src/main/java/org/richfaces/renderkit/html/MenuItemRendererBase.java 2009-02-03
16:24:09 UTC (rev 12553)
+++
trunk/ui/menu-components/src/main/java/org/richfaces/renderkit/html/MenuItemRendererBase.java 2009-02-03
16:34:38 UTC (rev 12554)
@@ -83,12 +83,23 @@
ActionEvent actionEvent = new ActionEvent(menuItem);
if(MenuComponent.MODE_AJAX.equalsIgnoreCase(mode)){
- new AjaxEvent(menuItem).queue();
+ new AjaxEvent(menuItem).queue();
+
+ if (AjaxRendererUtils.isAjaxRequest(context)) {
+
+ // add component itself to rendered list of components
+ AjaxRendererUtils.addRegionByName(context, menuItem,
menuItem.getId());
+
+ // add regions specified in the "reRender" attribute to
+ // rendered list of components
+ AjaxRendererUtils.addRegionsFromComponent(menuItem, context);
+
+ AjaxRendererUtils.addProcessToAjaxContext(context, menuItem);
+ }
}
if (menuItem.isImmediate()) {
actionEvent.setPhaseId(PhaseId.APPLY_REQUEST_VALUES);
-
} else {
actionEvent.setPhaseId(PhaseId.INVOKE_APPLICATION);
}
Modified:
trunk/ui/simpleTogglePanel/src/main/java/org/richfaces/renderkit/html/SimpleTogglePanelRenderer.java
===================================================================
---
trunk/ui/simpleTogglePanel/src/main/java/org/richfaces/renderkit/html/SimpleTogglePanelRenderer.java 2009-02-03
16:24:09 UTC (rev 12553)
+++
trunk/ui/simpleTogglePanel/src/main/java/org/richfaces/renderkit/html/SimpleTogglePanelRenderer.java 2009-02-03
16:34:38 UTC (rev 12554)
@@ -95,13 +95,17 @@
// in case of "ajax" request and "ajax" switch mode of toggle
panel
// set the regions to be rendered (reRendered) after operating this
// "ajax" request
- if (AjaxRendererUtils.isAjaxRequest(context) &&
panel.getSwitchType().equals(UISimpleTogglePanel.AJAX_SWITCH_TYPE)) {
- // add toggle panel itself to rendered list of components
+ if (AjaxRendererUtils.isAjaxRequest(context)
+ && panel.getSwitchType().equals(UISimpleTogglePanel.AJAX_SWITCH_TYPE))
{
+
+ // add toggle panel itself to rendered list of components
AjaxRendererUtils.addRegionByName(context, panel, panel.getId());
+
// add regions specified in the "reRender" attribute of toggle
- // panel
- // to rendered list of components
+ // panel to rendered list of components
AjaxRendererUtils.addRegionsFromComponent(panel, context);
+
+ AjaxRendererUtils.addProcessToAjaxContext(context, panel);
}
}