Author: ilya_shaikovsky
Date: 2010-05-18 09:44:47 -0400 (Tue, 18 May 2010)
New Revision: 17094
Modified:
root/examples/richfaces-showcase/trunk/src/main/java/org/richfaces/demo/common/navigation/DemoNavigator.java
root/examples/richfaces-showcase/trunk/src/main/webapp/richfaces/ajax.xhtml
root/examples/richfaces-showcase/trunk/src/main/webapp/templates/includes/navigation.xhtml
root/examples/richfaces-showcase/trunk/src/main/webapp/templates/main.xhtml
Log:
https://jira.jboss.org/browse/RF-8663
Modified:
root/examples/richfaces-showcase/trunk/src/main/java/org/richfaces/demo/common/navigation/DemoNavigator.java
===================================================================
---
root/examples/richfaces-showcase/trunk/src/main/java/org/richfaces/demo/common/navigation/DemoNavigator.java 2010-05-17
20:23:29 UTC (rev 17093)
+++
root/examples/richfaces-showcase/trunk/src/main/java/org/richfaces/demo/common/navigation/DemoNavigator.java 2010-05-18
13:44:47 UTC (rev 17094)
@@ -3,10 +3,16 @@
import java.util.Iterator;
import java.util.List;
+import javax.faces.application.ConfigurableNavigationHandler;
+import javax.faces.application.NavigationCase;
+import javax.faces.application.NavigationHandler;
import javax.faces.bean.ManagedBean;
import javax.faces.bean.ManagedProperty;
import javax.faces.bean.SessionScoped;
+import javax.faces.component.UIComponent;
import javax.faces.context.FacesContext;
+import javax.faces.convert.Converter;
+import javax.faces.event.ComponentSystemEvent;
import javax.servlet.http.HttpServletRequest;
@ManagedBean
@@ -17,6 +23,8 @@
private DemoDescriptor currentDemo = null;
private String currentSample;
+ private String demoName;
+
public DemoDescriptor getCurrentDemo() {
String id = getDemoParam("demo");
if (id != null) {
@@ -106,4 +114,40 @@
this.currentSample = currentSample;
}
+ public String getDemoName() {
+ return demoName;
+ }
+
+ public void setDemoName(String demoName) {
+ this.demoName = demoName;
+ }
+
+ public void preRenderEvent(ComponentSystemEvent event) {
+ System.out.println("DemoNavigator.preRenderEvent()");
+ }
+
+ private static Converter demoViewConverter = new Converter() {
+
+ public String getAsString(FacesContext context, UIComponent component, Object
value) {
+ return (String) value;
+ }
+
+ public Object getAsObject(FacesContext context, UIComponent component, String
value) {
+ NavigationHandler handler = context.getApplication().getNavigationHandler();
+
+ if (handler instanceof ConfigurableNavigationHandler) {
+ ConfigurableNavigationHandler navigationHandler =
(ConfigurableNavigationHandler) handler;
+
+ NavigationCase navCase = navigationHandler.getNavigationCase(context,
null, "/richfaces/" + value);
+
+ return navCase.getToViewId(context);
+ }
+
+ return null;
+ }
+ };
+
+ public Converter getDemoViewConverter() {
+ return demoViewConverter;
+ }
}
Modified: root/examples/richfaces-showcase/trunk/src/main/webapp/richfaces/ajax.xhtml
===================================================================
--- root/examples/richfaces-showcase/trunk/src/main/webapp/richfaces/ajax.xhtml 2010-05-17
20:23:29 UTC (rev 17093)
+++ root/examples/richfaces-showcase/trunk/src/main/webapp/richfaces/ajax.xhtml 2010-05-18
13:44:47 UTC (rev 17094)
@@ -6,16 +6,29 @@
<ui:composition template="/templates/main.xhtml">
<ui:define name="demoSampleParameters">
- <f:viewParam name="simple"
value="#{demoNavigator.currentSample}" />
+ <f:metadata>
+ <f:viewParam name="demoName" value="#{demoNavigator.demoName}"
converter="#{demoNavigator.demoViewConverter}" />
+ <f:event listener="#{demoNavigator.preRenderEvent}"
type="javax.faces.event.PreRenderViewEvent" />
+ </f:metadata>
</ui:define>
<ui:define name="body">
+ <h:link value="Ajax" includeViewParams="false">
+ <f:param name="demoName" value="ajax/ajax" />
+ </h:link>
+ <h:outputText value=" | "/>
+
+ <h:link value="Selects updates" includeViewParams="false">
+ <f:param name="demoName" value="ajax/selectsUpdates" />
+ </h:link>
+
+
<p>
The behavior that adds javascript call for sending Ajax request
to specified event on parent component
</p>
<fieldset>
<legend>Simple sample</legend>
- <ui:include src="#{demoNavigator.currentDemo.sampleURI}" />
+ <ui:include src="#{demoNavigator.demoName}" />
</fieldset>
<p>Typical use-case of dependent select components. When you choosing
Modified:
root/examples/richfaces-showcase/trunk/src/main/webapp/templates/includes/navigation.xhtml
===================================================================
---
root/examples/richfaces-showcase/trunk/src/main/webapp/templates/includes/navigation.xhtml 2010-05-17
20:23:29 UTC (rev 17093)
+++
root/examples/richfaces-showcase/trunk/src/main/webapp/templates/includes/navigation.xhtml 2010-05-18
13:44:47 UTC (rev 17094)
@@ -17,7 +17,7 @@
<ul>
<a4j:repeat value="#{gr.demos}" var="d">
<li>
- <h:link outcome="#{d.demoURI}" value="#{d.name}"
includeViewParams="true">
+ <h:link outcome="#{d.demoURI}" value="#{d.name}"
includeViewParams="false">
<f:param name="demo" value="#{d.id}"/>
</h:link>
<h:outputText value="NEW!" rendered="#{d.newItem or
gr.newItem}" style="color:red"/>
Modified: root/examples/richfaces-showcase/trunk/src/main/webapp/templates/main.xhtml
===================================================================
--- root/examples/richfaces-showcase/trunk/src/main/webapp/templates/main.xhtml 2010-05-17
20:23:29 UTC (rev 17093)
+++ root/examples/richfaces-showcase/trunk/src/main/webapp/templates/main.xhtml 2010-05-18
13:44:47 UTC (rev 17094)
@@ -4,6 +4,9 @@
xmlns:f="http://java.sun.com/jsf/core"
xmlns:ui="http://java.sun.com/jsf/facelets"
xmlns:rich="http://java.sun.com/jsf/composite/rich">
+<f:view>
+ <ui:insert name="demoSampleParameters"/>
+
<h:head>
</h:head>
<h:body>
@@ -13,9 +16,6 @@
<title>Components Gallery</title>
</h:head>
<h:body>
- <f:metadata>
- <ui:insert name="demoSampleParameters"/>
- </f:metadata>
<h:outputStylesheet name="rich/css/page.css" />
<table border="0" cellpadding="0" cellspacing="0"
class="rich-page #{cc.attrs.pageClass}">
@@ -67,4 +67,5 @@
</html>
</ui:composition>
</h:body>
+</f:view>
</html>
\ No newline at end of file