Author: jjamrich
Date: 2012-01-18 10:21:38 -0500 (Wed, 18 Jan 2012)
New Revision: 23163
Modified:
modules/tests/metamer/branches/contextMenu/application/src/main/java/org/richfaces/tests/metamer/bean/rich/RichContextMenuBean.java
modules/tests/metamer/branches/contextMenu/application/src/main/webapp/components/richContextMenu/simple.xhtml
Log:
rf-10197: Add current menu selection indicator
Add menu item selection indicator for rich:contextMenu component example
Modified:
modules/tests/metamer/branches/contextMenu/application/src/main/java/org/richfaces/tests/metamer/bean/rich/RichContextMenuBean.java
===================================================================
---
modules/tests/metamer/branches/contextMenu/application/src/main/java/org/richfaces/tests/metamer/bean/rich/RichContextMenuBean.java 2012-01-18
15:21:22 UTC (rev 23162)
+++
modules/tests/metamer/branches/contextMenu/application/src/main/java/org/richfaces/tests/metamer/bean/rich/RichContextMenuBean.java 2012-01-18
15:21:38 UTC (rev 23163)
@@ -25,6 +25,7 @@
import javax.annotation.PostConstruct;
import javax.faces.bean.ManagedBean;
+import javax.faces.bean.ViewScoped;
import org.richfaces.component.UIContextMenu;
import org.richfaces.tests.metamer.Attributes;
@@ -38,6 +39,7 @@
* @version $Revision$
*/
@ManagedBean(name = "richContextMenuBean")
+@ViewScoped
public class RichContextMenuBean implements Serializable {
/** Generated serial version UID */
@@ -45,6 +47,7 @@
private static Logger log = LoggerFactory.getLogger(RichContextMenuBean.class);
private Attributes attributes;
+ private String current;
@PostConstruct
public void init() {
@@ -56,7 +59,37 @@
attributes.remove("attachTo");
}
+
+ public String doNew() {
+ this.current = "New";
+ return null;
+ }
+ public String doOpen() {
+ this.current = "Open";
+ return null;
+ }
+
+ public String doClose() {
+ this.current = "Close";
+ return null;
+ }
+
+ public String doSave() {
+ this.current = "Save";
+ return null;
+ }
+
+ public String doSaveAll() {
+ this.current = "Save All";
+ return null;
+ }
+
+ public String doExit() {
+ this.current = "Exit";
+ return null;
+ }
+
public Attributes getAttributes() {
return attributes;
}
@@ -64,5 +97,13 @@
public void setAttributes(Attributes attributes) {
this.attributes = attributes;
}
+
+ public String getCurrent() {
+ return current;
+ }
+
+ public void setCurrent(String current) {
+ this.current = current;
+ }
}
Modified:
modules/tests/metamer/branches/contextMenu/application/src/main/webapp/components/richContextMenu/simple.xhtml
===================================================================
---
modules/tests/metamer/branches/contextMenu/application/src/main/webapp/components/richContextMenu/simple.xhtml 2012-01-18
15:21:22 UTC (rev 23162)
+++
modules/tests/metamer/branches/contextMenu/application/src/main/webapp/components/richContextMenu/simple.xhtml 2012-01-18
15:21:38 UTC (rev 23163)
@@ -2,7 +2,8 @@
<!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:h="http://java.sun.com/jsf/html"
xmlns:f="http://java.sun.com/jsf/core"
xmlns:ui="http://java.sun.com/jsf/facelets"
xmlns:metamer="http://java.sun.com/jsf/composite/metamer"
-
xmlns:rich="http://richfaces.org/rich" >
+
xmlns:rich="http://richfaces.org/rich"
+
xmlns:a4j="http://richfaces.org/a4j" >
<!--
JBoss, Home of Professional Open Source
@@ -76,11 +77,11 @@
title="#{richContextMenuBean.attributes['title'].value}"
verticalOffset="#{richContextMenuBean.attributes['verticalOffset'].value}"
- <rich:menuItem id="menuItem2"
label="Open" icon="/resources/images/icons/open.gif" />
+ <rich:menuItem id="menuItem2" label="Open"
action="#{richContextMenuBean.doOpen}"
icon="/resources/images/icons/open.gif" />
<rich:menuGroup id="menuGroup3" label="Open
Recent..." disabled="true">
- <rich:menuItem id="menuItem31"
label="Save" icon="/resources/images/icons/save.gif" />
- <rich:menuItem id="menuItem32" label="Save
All">
+ <rich:menuItem id="menuItem31"
label="Save" action="#{richContextMenuBean.doSave}"
icon="/resources/images/icons/save.gif" />
+ <rich:menuItem id="menuItem32" label="Save
All" action="#{richContextMenuBean.doSaveAll}">
<f:facet name="icon">
<h:graphicImage library="images/icons"
name="save_all.gif" />
</f:facet>
@@ -90,8 +91,8 @@
<rich:menuSeparator id="menuSeparator11" />
<rich:menuGroup id="menuGroup4" label="Save
As...">
- <rich:menuItem id="menuItem41"
label="Save" icon="/resources/images/icons/save.gif" />
- <rich:menuItem id="menuItem42" label="Save
All" >
+ <rich:menuItem id="menuItem41"
label="Save" action="#{richContextMenuBean.doSave}"
icon="/resources/images/icons/save.gif" />
+ <rich:menuItem id="menuItem42" label="Save
All" action="#{richContextMenuBean.doSaveAll}" >
<f:facet name="icon">
<h:graphicImage library="images/icons"
name="save_all.gif" />
</f:facet>
@@ -107,6 +108,13 @@
<rich:menuItem id="menuItem7" label="Exit"
/>
</rich:contextMenu>
+
+ <br/>
+ <a4j:outputPanel ajaxRendered="true">
+ Current Selection:
+ <h:outputText id="output" style="font-weight:bold"
value="#{richContextMenuBean.current}"></h:outputText>
+ </a4j:outputPanel>
+
</ui:define>
<ui:define name="outOfTemplateAfter">