Author: ppitonak(a)redhat.com
Date: 2010-12-14 13:07:01 -0500 (Tue, 14 Dec 2010)
New Revision: 20566
Added:
modules/tests/metamer/trunk/application/src/main/java/org/richfaces/tests/metamer/bean/RichMenuItemBean.java
modules/tests/metamer/trunk/application/src/main/webapp/components/richMenuItem/
modules/tests/metamer/trunk/application/src/main/webapp/components/richMenuItem/list.xhtml
modules/tests/metamer/trunk/application/src/main/webapp/components/richMenuItem/simple.xhtml
Modified:
modules/tests/metamer/trunk/application/src/main/java/org/richfaces/tests/metamer/bean/RichBean.java
Log:
https://issues.jboss.org/browse/RFPL-958
* added sample for rich:menuItem
Modified:
modules/tests/metamer/trunk/application/src/main/java/org/richfaces/tests/metamer/bean/RichBean.java
===================================================================
---
modules/tests/metamer/trunk/application/src/main/java/org/richfaces/tests/metamer/bean/RichBean.java 2010-12-14
17:44:21 UTC (rev 20565)
+++
modules/tests/metamer/trunk/application/src/main/java/org/richfaces/tests/metamer/bean/RichBean.java 2010-12-14
18:07:01 UTC (rev 20566)
@@ -36,6 +36,7 @@
import javax.faces.bean.SessionScoped;
import javax.faces.context.FacesContext;
import javax.faces.event.ActionEvent;
+import javax.faces.event.AjaxBehaviorEvent;
import javax.faces.event.ValueChangeEvent;
import javax.faces.model.SelectItem;
import javax.servlet.http.HttpSession;
@@ -138,6 +139,7 @@
components.put("richJQuery", "Rich jQuery");
components.put("richList", "Rich List");
components.put("richMenuGroup", "Rich Menu Group");
+ components.put("richMenuItem", "Rich Menu Item");
components.put("richPanel", "Rich Panel");
components.put("richPanelMenu", "Rich Panel Menu");
components.put("richPopupPanel", "Rich Popup Panel");
@@ -380,6 +382,16 @@
}
/**
+ * An action listener that does nothing.
+ *
+ * @param event
+ * an event representing the activation of a user interface component (not
used)
+ */
+ public void actionListener(AjaxBehaviorEvent event) {
+ logToPage("* action listener invoked");
+ }
+
+ /**
* An item change listener that logs to the page old and new value.
*
* @param event
@@ -396,6 +408,6 @@
* an event representing the activation of a user interface component
*/
public void valueChangeListener(ValueChangeEvent event) {
- RichBean.logToPage("* value changed: " + event.getOldValue() + "
-> " + event.getNewValue());
+ logToPage("* value changed: " + event.getOldValue() + " ->
" + event.getNewValue());
}
}
Added:
modules/tests/metamer/trunk/application/src/main/java/org/richfaces/tests/metamer/bean/RichMenuItemBean.java
===================================================================
---
modules/tests/metamer/trunk/application/src/main/java/org/richfaces/tests/metamer/bean/RichMenuItemBean.java
(rev 0)
+++
modules/tests/metamer/trunk/application/src/main/java/org/richfaces/tests/metamer/bean/RichMenuItemBean.java 2010-12-14
18:07:01 UTC (rev 20566)
@@ -0,0 +1,70 @@
+/*******************************************************************************
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc. and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
+ *******************************************************************************/
+package org.richfaces.tests.metamer.bean;
+
+import java.io.Serializable;
+import javax.annotation.PostConstruct;
+import javax.faces.bean.ManagedBean;
+import javax.faces.bean.ViewScoped;
+import org.richfaces.component.UIMenuItem;
+import org.richfaces.tests.metamer.Attributes;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+/**
+ * Managed bean for rich:menuItem.
+ *
+ * @author <a href="mailto:ppitonak@redhat.com">Pavol Pitonak</a>
+ * @version $Revision$
+ */
+@ManagedBean(name = "richMenuItemBean")
+@ViewScoped
+public class RichMenuItemBean implements Serializable {
+
+ private static final long serialVersionUID = -1L;
+ private static Logger logger;
+ private Attributes attributes;
+
+ /**
+ * Initializes the managed bean.
+ */
+ @PostConstruct
+ public void init() {
+ logger = LoggerFactory.getLogger(getClass());
+ logger.debug("initializing bean " + getClass().getName());
+
+ attributes = Attributes.getUIComponentAttributes(UIMenuItem.class, getClass(),
false);
+
+ attributes.setAttribute("icon",
"/resources/images/icons/create_doc.gif");
+ attributes.setAttribute("label", "New");
+ attributes.setAttribute("mode", "ajax");
+ attributes.setAttribute("rendered", true);
+ }
+
+ public Attributes getAttributes() {
+ return attributes;
+ }
+
+ public void setAttributes(Attributes attributes) {
+ this.attributes = attributes;
+ }
+}
Property changes on:
modules/tests/metamer/trunk/application/src/main/java/org/richfaces/tests/metamer/bean/RichMenuItemBean.java
___________________________________________________________________
Name: svn:keywords
+ Revision
Added:
modules/tests/metamer/trunk/application/src/main/webapp/components/richMenuItem/list.xhtml
===================================================================
---
modules/tests/metamer/trunk/application/src/main/webapp/components/richMenuItem/list.xhtml
(rev 0)
+++
modules/tests/metamer/trunk/application/src/main/webapp/components/richMenuItem/list.xhtml 2010-12-14
18:07:01 UTC (rev 20566)
@@ -0,0 +1,42 @@
+<?xml version="1.0" encoding="UTF-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:ui="http://java.sun.com/jsf/facelets"
+
xmlns:metamer="http://java.sun.com/jsf/composite/metamer">
+
+ <!--
+JBoss, Home of Professional Open Source
+Copyright 2010, Red Hat, Inc. and individual contributors
+by the @authors tag. See the copyright.txt in the distribution for a
+full listing of individual contributors.
+
+This is free software; you can redistribute it and/or modify it
+under the terms of the GNU Lesser General Public License as
+published by the Free Software Foundation; either version 2.1 of
+the License, or (at your option) any later version.
+
+This software is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+Lesser General Public License for more details.
+
+You should have received a copy of the GNU Lesser General Public
+License along with this software; if not, write to the Free
+Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+02110-1301 USA, or see the FSF site:
http://www.fsf.org.
+ -->
+
+ <ui:composition template="/templates/list.xhtml">
+
+ <ui:define name="pageTitle">Rich Menu Item</ui:define>
+
+ <ui:define name="links">
+
+ <metamer:testPageLink id="simple" outcome="simple"
value="Simple">
+ Simple page containing a drop down menu with several
<b>rich:menuItem</b>s and inputs for all attributes.
+ </metamer:testPageLink>
+
+ </ui:define>
+
+ </ui:composition>
+
+</html>
Added:
modules/tests/metamer/trunk/application/src/main/webapp/components/richMenuItem/simple.xhtml
===================================================================
---
modules/tests/metamer/trunk/application/src/main/webapp/components/richMenuItem/simple.xhtml
(rev 0)
+++
modules/tests/metamer/trunk/application/src/main/webapp/components/richMenuItem/simple.xhtml 2010-12-14
18:07:01 UTC (rev 20566)
@@ -0,0 +1,145 @@
+<?xml version="1.0" encoding="UTF-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: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:h="http://java.sun.com/jsf/html">
+
+ <!--
+JBoss, Home of Professional Open Source
+Copyright 2010, Red Hat, Inc. and individual contributors
+by the @authors tag. See the copyright.txt in the distribution for a
+full listing of individual contributors.
+
+This is free software; you can redistribute it and/or modify it
+under the terms of the GNU Lesser General Public License as
+published by the Free Software Foundation; either version 2.1 of
+the License, or (at your option) any later version.
+
+This software is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+Lesser General Public License for more details.
+
+You should have received a copy of the GNU Lesser General Public
+License along with this software; if not, write to the Free
+Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+02110-1301 USA, or see the FSF site:
http://www.fsf.org.
+ -->
+
+ <ui:composition template="/templates/template.xhtml">
+
+ <ui:define name="head">
+ <f:metadata>
+ <f:viewParam name="templates"
value="#{templateBean.templates}">
+ <f:converter converterId="templatesListConverter" />
+ </f:viewParam>
+ </f:metadata>
+ <style type="text/css">
+ .pic {
+ margin-bottom: -4px;
+ margin-right: 2px;
+ }
+
+ .search .rf-ddm-itm-sel {
+ background-color: transparent;
+ background-image:none;
+ border-color: transparent;
+ cursor: default;
+ }
+ </style>
+ </ui:define>
+
+ <ui:define name="outOfTemplateBefore">
+ </ui:define>
+
+ <ui:define name="component">
+ <rich:toolbar id="toolbar" height="26px">
+ <rich:dropDownMenu id="menu1" mode="ajax">
+ <f:facet name="label">
+ <h:panelGroup>
+ <h:graphicImage library="images/icons"
name="copy.gif" styleClass="pic" />
+ <h:outputText value="File" />
+ </h:panelGroup>
+ </f:facet>
+
+ <rich:menuItem id="menuItem"
+ action="#{richBean.dummyAction}"
+
actionListener="#{richBean.dummyActionListener}"
+
data="#{richMenuItemBean.attributes['data'].value}"
+
dir="#{richMenuItemBean.attributes['dir'].value}"
+
disabled="#{richMenuItemBean.attributes['disabled'].value}"
+
execute="#{richMenuItemBean.attributes['execute'].value}"
+
icon="#{richMenuItemBean.attributes['icon'].value}"
+
iconDisabled="#{richMenuItemBean.attributes['iconDisabled'].value}"
+
immediate="#{richMenuItemBean.attributes['immediate'].value}"
+
label="#{richMenuItemBean.attributes['label'].value}"
+
lang="#{richMenuItemBean.attributes['lang'].value}"
+
limitRender="#{richMenuItemBean.attributes['limitRender'].value}"
+
mode="#{richMenuItemBean.attributes['mode'].value}"
+
onbeforedomupdate="#{richMenuItemBean.attributes['onbeforedomupdate'].value}"
+
onbegin="#{richMenuItemBean.attributes['onbegin'].value}"
+
onclick="#{richMenuItemBean.attributes['onclick'].value}"
+
oncomplete="#{richMenuItemBean.attributes['oncomplete'].value}"
+
ondblclick="#{richMenuItemBean.attributes['ondblclick'].value}"
+
onkeydown="#{richMenuItemBean.attributes['onkeydown'].value}"
+
onkeypress="#{richMenuItemBean.attributes['onkeypress'].value}"
+
onkeyup="#{richMenuItemBean.attributes['onkeyup'].value}"
+
onmousedown="#{richMenuItemBean.attributes['onmousedown'].value}"
+
onmousemove="#{richMenuItemBean.attributes['onmousemove'].value}"
+
onmouseout="#{richMenuItemBean.attributes['onmouseout'].value}"
+
onmouseover="#{richMenuItemBean.attributes['onmouseover'].value}"
+
onmouseup="#{richMenuItemBean.attributes['onmouseup'].value}"
+
render="#{richMenuItemBean.attributes['render'].value}"
+
rendered="#{richMenuItemBean.attributes['rendered'].value}"
+
status="#{richMenuItemBean.attributes['status'].value}"
+
style="#{richMenuItemBean.attributes['style'].value}"
+
styleClass="#{richMenuItemBean.attributes['styleClass'].value}"
+
title="#{richMenuItemBean.attributes['title'].value}"
+
value="#{richMenuItemBean.attributes['value'].value}"
+ />
+
+ <rich:menuItem label="Open"
icon="/resources/images/icons/open.gif" />
+
+ <rich:menuGroup label="Open Recent..."
disabled="true">
+ <rich:menuItem label="Save"
icon="/resources/images/icons/save.gif" />
+ <rich:menuItem label="Save All">
+ <f:facet name="icon">
+ <h:graphicImage library="images/icons"
name="save_all.gif" />
+ </f:facet>
+ </rich:menuItem>
+ </rich:menuGroup>
+
+ <rich:menuSeparator id="menuSeparator11" />
+
+ <rich:menuGroup id="menuGroup" label="Save
As...">
+ <rich:menuItem label="Save"
icon="/resources/images/icons/save.gif" />
+ <rich:menuItem label="Save All" >
+ <f:facet name="icon">
+ <h:graphicImage library="images/icons"
name="save_all.gif" />
+ </f:facet>
+ </rich:menuItem>
+ <rich:menuItem label="Send Online"
icon="/resources/images/icons/save.gif" disabled="true" />
+ </rich:menuGroup>
+
+ <rich:menuItem label="Print"
disabled="true"/>
+
+ <rich:menuItem label="Close" />
+
+ <rich:menuSeparator id="menuSeparator12" />
+
+ <rich:menuItem label="Exit" />
+
+ </rich:dropDownMenu>
+
+ </rich:toolbar>
+
+ <br /><br />
+ </ui:define>
+
+ <ui:define name="outOfTemplateAfter">
+ Settings for the first menu item:
+ <metamer:attributes value="#{richMenuItemBean.attributes}"
id="attributes" />
+ </ui:define>
+
+ </ui:composition>
+</html>
\ No newline at end of file