JBoss Rich Faces SVN: r19807 - in trunk/ui/output/ui/src/main/java/org/richfaces: renderkit/html and 1 other directory.
by richfaces-svn-commits@lists.jboss.org
Author: Alex.Kolonitsky
Date: 2010-10-31 16:46:11 -0400 (Sun, 31 Oct 2010)
New Revision: 19807
Modified:
trunk/ui/output/ui/src/main/java/org/richfaces/component/AbstractPanelMenuGroup.java
trunk/ui/output/ui/src/main/java/org/richfaces/renderkit/html/DivPanelRenderer.java
Log:
RF-9317 panelMenu components
Modified: trunk/ui/output/ui/src/main/java/org/richfaces/component/AbstractPanelMenuGroup.java
===================================================================
--- trunk/ui/output/ui/src/main/java/org/richfaces/component/AbstractPanelMenuGroup.java 2010-10-31 20:24:22 UTC (rev 19806)
+++ trunk/ui/output/ui/src/main/java/org/richfaces/component/AbstractPanelMenuGroup.java 2010-10-31 20:46:11 UTC (rev 19807)
@@ -23,8 +23,8 @@
package org.richfaces.component;
-import org.richfaces.event.ChangeExpandEvent;
import org.richfaces.event.ItemChangeEvent;
+import org.richfaces.event.PanelToggleEvent;
import javax.el.ValueExpression;
import javax.faces.context.FacesContext;
@@ -78,7 +78,7 @@
setExpanded(expanded);
setSubmittedExpanded(null);
if (previous != null && !previous.equals(expanded)) {
- queueEvent(new ChangeExpandEvent(this, previous));
+ queueEvent(new PanelToggleEvent(this, previous));
}
}
Modified: trunk/ui/output/ui/src/main/java/org/richfaces/renderkit/html/DivPanelRenderer.java
===================================================================
--- trunk/ui/output/ui/src/main/java/org/richfaces/renderkit/html/DivPanelRenderer.java 2010-10-31 20:24:22 UTC (rev 19806)
+++ trunk/ui/output/ui/src/main/java/org/richfaces/renderkit/html/DivPanelRenderer.java 2010-10-31 20:46:11 UTC (rev 19807)
@@ -98,7 +98,7 @@
writer.writeAttribute("id", component.getClientId(context), "clientId");
writer.writeAttribute("class", getStyleClass(component), null);
String style = getStyle(component);
- if (style != null) {
+ if (style != null && style.length() > 0) {
writer.writeAttribute(HtmlConstants.STYLE_ATTRIBUTE, style, null);
}
14 years, 1 month
JBoss Rich Faces SVN: r19806 - in trunk: examples/output-demo/src/main/webapp/examples and 15 other directories.
by richfaces-svn-commits@lists.jboss.org
Author: Alex.Kolonitsky
Date: 2010-10-31 16:24:22 -0400 (Sun, 31 Oct 2010)
New Revision: 19806
Added:
trunk/examples/output-demo/src/main/webapp/examples/panelMenu.xhtml
trunk/examples/output-demo/src/main/webapp/qunit/panelMenu.xhtml
trunk/examples/output-demo/src/main/webapp/resources/PanelMenu.js
trunk/examples/output-demo/src/main/webapp/resources/PanelMenuGroup.js
trunk/examples/output-demo/src/main/webapp/resources/PanelMenuItem.js
trunk/examples/output-demo/src/main/webapp/resources/tests/richfaces-panel-menu-group-qunit.js
trunk/examples/output-demo/src/main/webapp/resources/tests/richfaces-panel-menu-item-qunit.js
trunk/examples/output-demo/src/main/webapp/resources/tests/richfaces-panel-menu-qunit.js
trunk/ui/output/api/src/main/java/org/richfaces/ExpandMode.java
trunk/ui/output/api/src/main/java/org/richfaces/IconPosition.java
trunk/ui/output/api/src/main/java/org/richfaces/PanelMenuMode.java
trunk/ui/output/ui/src/main/java/org/richfaces/component/AbstractPanelMenu.java
trunk/ui/output/ui/src/main/java/org/richfaces/component/AbstractPanelMenuGroup.java
trunk/ui/output/ui/src/main/java/org/richfaces/component/AbstractPanelMenuItem.java
trunk/ui/output/ui/src/main/java/org/richfaces/component/UIPanelMenu.java
trunk/ui/output/ui/src/main/java/org/richfaces/component/UIPanelMenuGroup.java
trunk/ui/output/ui/src/main/java/org/richfaces/component/UIPanelMenuItem.java
trunk/ui/output/ui/src/main/java/org/richfaces/component/html/HtmlPanelMenu.java
trunk/ui/output/ui/src/main/java/org/richfaces/component/html/HtmlPanelMenuGroup.java
trunk/ui/output/ui/src/main/java/org/richfaces/component/html/HtmlPanelMenuItem.java
trunk/ui/output/ui/src/main/java/org/richfaces/renderkit/html/PanelMenuGroupRenderer.java
trunk/ui/output/ui/src/main/java/org/richfaces/renderkit/html/PanelMenuItemRenderer.java
trunk/ui/output/ui/src/main/java/org/richfaces/renderkit/html/PanelMenuRenderer.java
trunk/ui/output/ui/src/main/resources/META-INF/resources/org.richfaces/panelMenu.ecss
trunk/ui/output/ui/src/test/java/org/richfaces/component/UIPanelMenuGroupTest.java
trunk/ui/output/ui/src/test/java/org/richfaces/component/UIPanelMenuItemTest.java
trunk/ui/output/ui/src/test/java/org/richfaces/component/UIPanelMenuTest.java
trunk/ui/output/ui/src/test/java/org/richfaces/component/UITogglePanelTest.java
trunk/ui/output/ui/src/test/java/org/richfaces/renderkit/html/PanelMenuGroupRendererTest.java
trunk/ui/output/ui/src/test/java/org/richfaces/renderkit/html/PanelMenuItemRendererTest.java
trunk/ui/output/ui/src/test/resources/org/richfaces/renderkit/html/panelMenuGroup-expanded.xhtml
trunk/ui/output/ui/src/test/resources/org/richfaces/renderkit/html/panelMenuGroup-expanded.xmlunit.xml
trunk/ui/output/ui/src/test/resources/org/richfaces/renderkit/html/panelMenuGroup.xhtml
trunk/ui/output/ui/src/test/resources/org/richfaces/renderkit/html/panelMenuGroup.xmlunit.xml
trunk/ui/output/ui/src/test/resources/org/richfaces/renderkit/html/panelMenuItem.xhtml
trunk/ui/output/ui/src/test/resources/org/richfaces/renderkit/html/panelMenuItem.xmlunit.xml
Modified:
trunk/examples/output-demo/src/main/webapp/WEB-INF/faces-config.xml
trunk/examples/output-demo/src/main/webapp/templates/template.xhtml
trunk/ui/common/ui/src/main/resources/META-INF/resources/org.richfaces/popup.js
trunk/ui/output/ui/checkstyle-suppressions.xml
trunk/ui/output/ui/richfaces-suppressions.xml
trunk/ui/output/ui/src/main/java/org/richfaces/component/html/HtmlTab.java
trunk/ui/output/ui/src/main/resources/META-INF/pn.faces-config.xml
trunk/ui/output/ui/src/main/resources/META-INF/pn.taglib.xml
trunk/ui/output/ui/src/main/resources/META-INF/resources/org.richfaces/Tab.js
trunk/ui/output/ui/src/main/resources/META-INF/resources/org.richfaces/TogglePanelItem.js
trunk/ui/output/ui/src/test/java/org/richfaces/renderkit/html/IgnoreScriptsContent.java
trunk/ui/output/ui/src/test/java/org/richfaces/renderkit/html/PanelMenuRendererTest.java
trunk/ui/output/ui/src/test/java/org/richfaces/renderkit/html/RendererTestBase.java
trunk/ui/output/ui/src/test/resources/org/richfaces/renderkit/html/panelMenu.xhtml
trunk/ui/output/ui/src/test/resources/org/richfaces/renderkit/html/panelMenu.xmlunit.xml
Log:
RF-9317 panelMenu components
Modified: trunk/examples/output-demo/src/main/webapp/WEB-INF/faces-config.xml
===================================================================
--- trunk/examples/output-demo/src/main/webapp/WEB-INF/faces-config.xml 2010-10-31 17:38:22 UTC (rev 19805)
+++ trunk/examples/output-demo/src/main/webapp/WEB-INF/faces-config.xml 2010-10-31 20:24:22 UTC (rev 19806)
@@ -9,15 +9,15 @@
</managed-bean>
<navigation-rule>
- <navigation-case>
+ <navigation-case>
<from-outcome>panel</from-outcome>
<to-view-id>/examples/panel.xhtml</to-view-id>
</navigation-case>
- <navigation-case>
+ <navigation-case>
<from-outcome>popup</from-outcome>
<to-view-id>/examples/popupPanel.xhtml</to-view-id>
</navigation-case>
- <navigation-case>
+ <navigation-case>
<from-outcome>progressbar</from-outcome>
<to-view-id>/examples/progressbar.xhtml</to-view-id>
</navigation-case>
@@ -86,6 +86,16 @@
<to-view-id>/qunit/tabPanel.xhtml</to-view-id>
</navigation-case>
+ <!-- PanelMenu navigation -->
+ <navigation-case>
+ <from-outcome>panelMenu</from-outcome>
+ <to-view-id>/examples/panelMenu.xhtml</to-view-id>
+ </navigation-case>
+ <navigation-case>
+ <from-outcome>qunit/panelMenu</from-outcome>
+ <to-view-id>/qunit/panelMenu.xhtml</to-view-id>
+ </navigation-case>
+
<!-- Tooltip navigation -->
<navigation-case>
<from-outcome>tooltip</from-outcome>
Added: trunk/examples/output-demo/src/main/webapp/examples/panelMenu.xhtml
===================================================================
--- trunk/examples/output-demo/src/main/webapp/examples/panelMenu.xhtml (rev 0)
+++ trunk/examples/output-demo/src/main/webapp/examples/panelMenu.xhtml 2010-10-31 20:24:22 UTC (rev 19806)
@@ -0,0 +1,51 @@
+<!--
+ JBoss, Home of Professional Open Source
+ Copyright ${year}, 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.
+-->
+
+
+<!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:pn="http://richfaces.org/output">
+
+<body>
+<ui:composition template="/templates/template.xhtml">
+
+ <ui:define name="scripts">
+ <h:outputScript name="PanelMenu.js" />
+ </ui:define>
+
+ <ui:define name="title">PANEL MENU JS Development</ui:define>
+ <ui:define name="body_head">PANEL MENU JS Development</ui:define>
+
+ <ui:define name="body">
+ <h:form id="f" style="border:blue solid thin;">
+ <pn:panelMenu id="panelMenu">
+ <!-- TODO -->
+ </pn:panelMenu>
+ </h:form>
+ </ui:define>
+</ui:composition>
+</body>
+</html>
+
Added: trunk/examples/output-demo/src/main/webapp/qunit/panelMenu.xhtml
===================================================================
--- trunk/examples/output-demo/src/main/webapp/qunit/panelMenu.xhtml (rev 0)
+++ trunk/examples/output-demo/src/main/webapp/qunit/panelMenu.xhtml 2010-10-31 20:24:22 UTC (rev 19806)
@@ -0,0 +1,88 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<!--
+ JBoss, Home of Professional Open Source
+ Copyright ${year}, 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.
+-->
+
+
+<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:pn="http://richfaces.org/output">
+
+<body>
+<ui:composition template="/templates/template.xhtml">
+
+ <ui:define name="scripts">
+ <h:outputScript name="qunit/qunit.js"/>
+ <h:outputScript name="qunit/richfaces-qunit.js"/>
+
+ <h:outputScript name="PanelMenu.js"/>
+ <h:outputScript name="PanelMenuItem.js"/>
+ <h:outputScript name="PanelMenuGroup.js"/>
+
+ <h:outputStylesheet name="qunit/qunit.css"/>
+ </ui:define>
+
+ <ui:define name="title">PanelMenu Example</ui:define>
+ <ui:define name="body_head">PanelMenu Example</ui:define>
+
+ <ui:define name="body">
+ <p>Page</p>
+
+ <h:form id="f" style="border:blue solid thin;">
+ <pn:panelMenu id="panelMenu" expandSingle="true" activeItem="myFavariteIten">
+ <pn:panelMenuGroup label="Group 1" mode="ajax" expandSingle="true">
+ <pn:panelMenuItem label="Item 1.1" mode="ajax"/>
+ <pn:panelMenuItem label="Item 1.2" mode="ajax"/>
+ <pn:panelMenuItem label="Item 1.3" mode="ajax"/>
+ </pn:panelMenuGroup>
+ <pn:panelMenuGroup label="Group 2" mode="ajax" expandSingle="true">
+ <pn:panelMenuItem label="Item 2.1" mode="ajax"/>
+ <pn:panelMenuGroup label="Group 2.2" mode="ajax" expandSingle="true">
+ <pn:panelMenuItem label="Item 2.2.1" mode="ajax"/>
+ <pn:panelMenuItem name="myFavariteIten" label="Item 2.2.2" mode="ajax"/>
+ <pn:panelMenuItem label="Item 2.2.3" mode="ajax"/>
+ </pn:panelMenuGroup>
+ <pn:panelMenuItem label="Item 2.3" mode="ajax"/>
+ </pn:panelMenuGroup>
+ <pn:panelMenuGroup label="Group 3" mode="ajax" expandSingle="true">
+ <pn:panelMenuItem label="Item 3.1" mode="ajax"/>
+ <pn:panelMenuItem label="Item 3.2" mode="ajax"/>
+ <pn:panelMenuItem label="Item 3.3" mode="ajax" />
+ </pn:panelMenuGroup>
+ </pn:panelMenu>
+ </h:form>
+
+ <p>Result</p>
+
+ <div>
+ <ol id="qunit-tests"></ol>
+
+ <div id="testDiv" style="margin-top:10px; border:1px solid #a0a0a0">Main Test Div</div>
+ </div>
+ <h:outputScript name="tests/richfaces-panel-menu-qunit.js"/>
+ </ui:define>
+</ui:composition>
+</body>
+</html>
+
Added: trunk/examples/output-demo/src/main/webapp/resources/PanelMenu.js
===================================================================
--- trunk/examples/output-demo/src/main/webapp/resources/PanelMenu.js (rev 0)
+++ trunk/examples/output-demo/src/main/webapp/resources/PanelMenu.js 2010-10-31 20:24:22 UTC (rev 19806)
@@ -0,0 +1,205 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright ${year}, 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.
+ */
+
+
+(function ($, rf) {
+
+ rf.ui = rf.ui || {};
+
+ var __DEFAULT_OPTIONS = {
+ expandSingle : true
+ };
+
+ rf.ui.PanelMenu = rf.BaseComponent.extendClass({
+ // class name
+ name:"PanelMenu",
+
+ /**
+ * @class PanelMenu
+ * @name PanelMenu
+ *
+ * @constructor
+ * @param {String} componentId - component id
+ * @param {Hash} options - params
+ * */
+ init : function (componentId, options) {
+ this.id = componentId;
+ this.items = [];
+ this.attachToDom(componentId);
+
+ this.options = $.extend({}, __DEFAULT_OPTIONS, options || {});
+ this.activeItem = this.__getValueInput().value;
+
+ var menuGroup = this;
+ if (menuGroup.options.expandSingle) {
+ menuGroup.__panelMenu().bind("expand", function (event) {
+ menuGroup.__childGroups().each (function (index, group) {
+ if (event.target.id != group.id) {
+ rf.$(group.id).collapse();
+ }
+ });
+
+ event.stopPropagation();
+ });
+ }
+
+ if (menuGroup.activeItem) {
+ this.__panelMenu().ready(function () {
+ var item = menuGroup.items[menuGroup.activeItem];
+ item.__select();
+ item.__fireSelect();
+ })
+ }
+
+ this.__addUserEventHandler("collapse");
+ this.__addUserEventHandler("expand");
+ },
+
+ getItems: function () {
+ return this.items;
+ },
+
+ getItem: function (name) {
+ return this.items[name];
+ },
+
+ /***************************** Public Methods ****************************************************************/
+ /**
+ * @methodOf
+ * @name PanelMenu#selectItem
+ *
+ * TODO ...
+ *
+ * @param {String} name
+ * @return {void} TODO ...
+ */
+ selectItem: function (name) {
+ // TODO implement
+ },
+
+ /**
+ * @methodOf
+ * @name PanelMenu#selectedItem
+ *
+ * TODO ...
+ *
+ * @return {String} TODO ...
+ */
+ selectedItem: function (id) {
+ if (id != undefined) {
+ var valueInput = this.__getValueInput();
+ var prevActiveItem = valueInput.value;
+
+ this.activeItem = id;
+ valueInput.value = id;
+
+ return prevActiveItem;
+ } else {
+ return this.activeItem;
+ }
+ },
+
+ __getValueInput : function() {
+ return document.getElementById(this.id + "-value");
+ },
+
+ selectItem: function (itemName) {
+ // TODO
+ },
+
+ /**
+ * @methodOf
+ * @name PanelMenu#expandAll
+ *
+ * TODO ...
+ *
+ * @return {void} TODO ...
+ */
+ expandAll: function () {
+ // TODO implement
+ },
+
+ /**
+ * @methodOf
+ * @name PanelMenu#collapseAll
+ *
+ * TODO ...
+ *
+ * @return {void} TODO ...
+ */
+ collapseAll: function () {
+ // TODO implement
+ },
+
+ /**
+ * @methodOf
+ * @name PanelMenu#expandGroup
+ *
+ * TODO ...
+ *
+ * @param {String} groupName
+ * @return {void} TODO ...
+ */
+ expandGroup: function (groupName) {
+ // TODO implement
+ },
+
+ /**
+ * @methodOf
+ * @name PanelMenu#collapseGroup
+ *
+ * TODO ...
+ *
+ * @param {String} groupName
+ * @return {void} TODO ...
+ */
+ collapseGroup: function (groupName) {
+ // TODO implement
+ },
+
+
+ /***************************** Private Methods ****************************************************************/
+ __panelMenu : function () {
+ return $(rf.getDomElement(this.id));
+ },
+
+ __childGroups : function () {
+ return this.__panelMenu().children(".rf-pm-gr")
+ },
+
+ /**
+ * @private
+ * */
+ __addUserEventHandler : function (name) {
+ var handler = this.options["on" + name];
+ if (handler) {
+ rf.Event.bindById(this.id, name, handler);
+ }
+ },
+
+ destroy: function () {
+ rf.Event.unbindById(this.id, "."+this.namespace);
+
+ this.$super.destroy.call(this);
+ }
+ });
+})(jQuery, RichFaces);
Added: trunk/examples/output-demo/src/main/webapp/resources/PanelMenuGroup.js
===================================================================
--- trunk/examples/output-demo/src/main/webapp/resources/PanelMenuGroup.js (rev 0)
+++ trunk/examples/output-demo/src/main/webapp/resources/PanelMenuGroup.js 2010-10-31 20:24:22 UTC (rev 19806)
@@ -0,0 +1,363 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright ${year}, 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.
+ */
+
+
+(function ($, rf) {
+
+ rf.ui = rf.ui || {};
+
+ var __DEFAULT_OPTIONS = {
+ expanded : false,
+ expandSingle : true,
+ bubbleSelection : true,
+ stylePrefix : "rf-pm-gr",
+
+ // TODO we should use selectionType = {none, selectable, unselectable}
+ selectable : false,
+ unselectable : false // unselectable can be only selectable item => if selectable == false than unselectable = false
+ };
+
+ var EXPAND_ITEM = {
+
+ /**
+ *
+ * @return {void}
+ * */
+ exec : function (group, expand) {
+ var mode = group.mode;
+ if (mode == "server") {
+ return this.execServer(group);
+ } else if (mode == "ajax") {
+ return this.execAjax(group);
+ } else if (mode == "client" || mode == "none") {
+ return this.execClient(group, expand);
+ } else {
+ rf.log.error("EXPAND_ITEM.exec : unknown mode (" + mode + ")");
+ }
+ },
+
+ /**
+ * @protected
+ *
+ * @return {Boolean} false
+ * */
+ execServer : function (group) {
+ group.__changeState();
+ rf.submitForm(this.__getParentForm(group));
+
+ return false;
+ },
+
+ /**
+ * @protected
+ *
+ * @return {Boolean} false
+ * */
+ execAjax : function (group) {
+ var oldState = group.__changeState();
+ rf.ajax(group.id, null, $.extend({}, group.options["ajax"], {}));
+ group.__restoreState(oldState);
+
+ return true;
+ },
+
+ /**
+ * @protected
+ *
+ * @param {PanelMenuGroup} group
+ * @param {Boolean} expand
+ * @return {undefined}
+ * - false - if process has been terminated
+ * - true - in other cases
+ * */
+ execClient : function (group, expand) {
+ if (expand) {
+ group.expand();
+ } else {
+ group.collapse();
+ }
+
+ return group.__fireSwitch();
+ },
+
+ /**
+ * @private
+ * */
+ __getParentForm : function (item) {
+ return $($(rf.getDomElement(item.id)).parents("form")[0]);
+ }
+ };
+
+ rf.ui.PanelMenuGroup = rf.ui.PanelMenuItem.extendClass({
+ // class name
+ name:"PanelMenuGroup",
+
+ /**
+ * @class PanelMenuGroup
+ * @name PanelMenuGroup
+ *
+ * @constructor
+ * @param {String} componentId - component id
+ * @param {Hash} options - params
+ * */
+ init : function (componentId, options) {
+ this.options = $.extend({}, __DEFAULT_OPTIONS, options || {});
+
+ rf.ui.PanelMenuItem.call(this, componentId);
+
+ if (!this.options.disabled) {
+ var menuGroup = this;
+
+ if (!this.options.selectable) {
+ this.__header().bind("click", function () {
+ return menuGroup.switchExpantion();
+ });
+ }
+
+ if (this.options.selectable || this.options.bubbleSelection) {
+ this.__content().bind("select", function (event) {
+ if (menuGroup.options.selectable && menuGroup.__isMyEvent(event)) {
+ menuGroup.expand();
+ }
+
+ if (menuGroup.options.bubbleSelection && !menuGroup.__isMyEvent(event)) {
+ menuGroup.__select();
+ if (!menuGroup.expanded()) {
+ menuGroup.expand();
+ }
+ }
+ });
+
+ this.__content().bind("unselect", function (event) {
+ if (menuGroup.options.selectable && menuGroup.__isMyEvent(event)) {
+ menuGroup.collapse();
+ }
+
+ if (menuGroup.options.bubbleSelection && !menuGroup.__isMyEvent(event)) {
+ menuGroup.__unselect();
+ }
+ });
+ }
+
+ if (menuGroup.options.expandSingle) {
+ menuGroup.__group().bind("expand", function (event) {
+ if (menuGroup.__isMyEvent(event)) {
+ return;
+ }
+
+ menuGroup.__childGroups().each (function (index, group) {
+ var rfGroup = rf.$(group);
+ if (!rfGroup.__isMyEvent(event)) {
+ rfGroup.collapse();
+ }
+ });
+
+ event.stopPropagation();
+ });
+ }
+
+ this.__addUserEventHandler("collapse");
+ this.__addUserEventHandler("expand");
+ }
+ },
+
+ /***************************** Public Methods ****************************************************************/
+ expanded : function () {
+ // TODO check invariant in dev mode
+ // return this.__content().hasClass("rf-pm-exp")
+ return this.__getExpandValue();
+ },
+
+ expand : function () {
+ this.__expand();
+
+ return this.__fireExpand();
+ },
+
+ __expand : function () {
+ this.__content().removeClass("rf-pm-colps").addClass("rf-pm-exp");
+ this.__setExpandValue(true);
+ },
+
+ collapsed : function () {
+ // TODO check invariant in dev mode
+ // return this.__content().hasClass("rf-pm-colps")
+ return !this.__getExpandValue();
+ },
+
+ collapse : function () {
+ this.__collapse();
+
+ this.__childGroups().each (function(index, group) {
+ rf.$(group.id).__collapse();
+ });
+
+ this.__fireCollapse();
+ },
+
+ __collapse : function () {
+ this.__content().addClass("rf-pm-colps").removeClass("rf-pm-exp");
+ this.__setExpandValue(false);
+ },
+
+ /**
+ * @methodOf
+ * @name PanelMenuGroup#switch
+ *
+ * TODO ...
+ *
+ * @param {boolean} expand
+ * @return {void} TODO ...
+ */
+ switchExpantion : function () { // TODO rename
+ var continueProcess = this.__fireBeforeSwitch();
+ if (!continueProcess) {
+ return false;
+ }
+
+ EXPAND_ITEM.exec(this, !this.expanded());
+ },
+
+ /**
+ * please, remove this method when client side ajax events will be added
+ *
+ * */
+ onCompleteHandler : function () {
+ EXPAND_ITEM.execClient(this, this.expanded());
+ },
+
+ __switch : function (expand) {
+ if (expand) {
+ this.expand();
+ } else {
+ this.collapse();
+ }
+ },
+
+ /***************************** Private Methods ****************************************************************/
+ __parentGroup : function () {
+ var parentGroup = this.__group().parents(".rf-pm-gr")[0];
+ if (parentGroup) {
+ return parentGroup;
+ }
+ return this.__panelMenu();
+ },
+
+ __childGroups : function () {
+ return this.__content().children(".rf-pm-gr")
+ },
+
+ __group : function () {
+ return $(rf.getDomElement(this.id))
+ },
+
+ __header : function () {
+ return $(rf.getDomElement(this.id + ":hdr"))
+ },
+
+ __content : function () {
+ return $(rf.getDomElement(this.id + ":cnt"))
+ },
+
+ __expandValueInput : function () {
+ return document.getElementById(this.id + ":expanded");
+ },
+
+ __getExpandValue : function () {
+ return this.__expandValueInput().value == "true";
+ },
+
+ /**
+ * @methodOf
+ * @name PanelMenuGroup#__setExpandValue
+ *
+ * @param {boolean} value - is group expanded?
+ * @return {boolean} preview value
+ */
+ __setExpandValue : function (value) {
+ var input = this.__expandValueInput();
+ var oldValue = input.value;
+
+ input.value = value;
+
+ return oldValue;
+ },
+
+ __changeState : function () {
+ var state = {};
+ state["expanded"] = this.__setExpandValue(this.__getExpandValue());
+ if (this.options.selectable) {
+ state["itemName"] = this.__rfPanelMenu().selectedItem(this.itemName); // TODO bad function name for function which change component state
+ }
+
+ return state;
+ },
+
+ __restoreState : function (state) {
+ if (!state) {
+ return;
+ }
+
+ if (state["expanded"]) {
+ this.__setExpandValue(state["expanded"]);
+ }
+
+ if (state["itemName"]) {
+ this.__rfPanelMenu().selectedItem(state["itemName"]);
+ }
+ },
+
+ __fireSwitch : function () {
+ return new rf.Event.fireById(this.id, "switch", {
+ id: this.id
+ });
+ },
+
+ __isMyEvent: function (event) {
+ return this.id == event.target.id;
+ },
+
+ __fireBeforeSwitch : function () {
+ return rf.Event.fireById(this.id, "beforeswitch", {
+ id: this.id
+ });
+ },
+
+ __fireCollapse : function () {
+ return new rf.Event.fireById(this.id, "collapse", {
+ id: this.id
+ });
+ },
+
+ __fireExpand : function () {
+ return new rf.Event.fireById(this.id, "expand", {
+ id: this.id
+ });
+ },
+
+ destroy: function () {
+ rf.Event.unbindById(this.id, "."+this.namespace);
+
+ this.$super.destroy.call(this);
+ }
+ });
+})(jQuery, RichFaces);
Added: trunk/examples/output-demo/src/main/webapp/resources/PanelMenuItem.js
===================================================================
--- trunk/examples/output-demo/src/main/webapp/resources/PanelMenuItem.js (rev 0)
+++ trunk/examples/output-demo/src/main/webapp/resources/PanelMenuItem.js 2010-10-31 20:24:22 UTC (rev 19806)
@@ -0,0 +1,283 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright ${year}, 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.
+ */
+
+
+(function ($, rf) {
+
+ rf.ui = rf.ui || {};
+
+ var __DEFAULT_OPTIONS = {
+ disabled : false,
+ selectable: true,
+ mode: "client",
+ unselectable: false,
+ highlight: true,
+ stylePrefix: "rf-pm-itm"
+ };
+
+ var SELECT_ITEM = {
+
+ /**
+ *
+ * @return {void}
+ * */
+ exec : function (item) {
+ var mode = item.mode;
+ if (mode == "server") {
+ return this.execServer(item);
+ } else if (mode == "ajax") {
+ return this.execAjax(item);
+ } else if (mode == "client" || mode == "none") {
+ return this.execClient(item);
+ } else {
+ rf.log.error("SELECT_ITEM.exec : unknown mode (" + mode + ")");
+ }
+ },
+
+ /**
+ * @protected
+ *
+ * @return {Boolean} false
+ * */
+ execServer : function (item) {
+ item.__changeState();
+ rf.submitForm(this.__getParentForm(item));
+
+ return false;
+ },
+
+ /**
+ * @protected
+ *
+ * @return {Boolean} false
+ * */
+ execAjax : function (item) {
+ var oldItem = item.__changeState();
+ rf.ajax(item.__panelMenu().id, null, $.extend({}, item.options["ajax"], {}));
+ item.__restoreState(oldItem);
+
+ return true;
+ },
+
+ /**
+ * @protected
+ *
+ * @return {undefined}
+ * - false - if process has been terminated
+ * - true - in other cases
+ * */
+ execClient : function (item) {
+ var panelMenu = item.__rfPanelMenu();
+ if (panelMenu.selectedItem()) {
+ panelMenu.getItems()[panelMenu.selectedItem()].unselect();
+ }
+ panelMenu.selectedItem(item.itemName);
+
+ item.__select();
+
+ return item.__fireSelect();
+ },
+
+ /**
+ * @private
+ * */
+ __getParentForm : function (item) {
+ return $($(rf.getDomElement(item.id)).parents("form")[0]);
+ }
+ };
+
+ rf.ui.PanelMenuItem = rf.BaseComponent.extendClass({
+ // class name
+ name:"PanelMenuItem",
+
+ /**
+ * @class PanelMenuItem
+ * @name PanelMenuItem
+ *
+ * @constructor
+ * @param {String} componentId - component id
+ * @param {Hash} options - params
+ * */
+ init : function (componentId, options) {
+ this.id = componentId;
+ this.attachToDom(componentId);
+
+ this.options = $.extend({}, __DEFAULT_OPTIONS, this.options || {}, options || {});
+
+ this.mode = this.options.mode
+ this.itemName = this.options.name
+ this.__rfPanelMenu().getItems()[this.itemName] = this;
+
+ // todo move it
+ this.selectionClass = this.options.stylePrefix + "-sel";
+ this.hoverClass = this.options.stylePrefix + "-hov";
+
+ if (!this.options.disabled) {
+ var item = this;
+ if (this.options.highlight) {
+ this.__item().bind("mouseenter", function() {
+ item.highlight(true);
+ });
+ this.__item().bind("mouseleave", function() {
+ item.highlight(false);
+ });
+ }
+
+ if (this.options.selectable) {
+ this.__header().bind("click", function() {
+ if (item.__rfPanelMenu().selectedItem() == item.id) {
+ if (item.options.unselectable) {
+ return item.unselect();
+ }
+
+ // we shouldn't select one item several times
+ } else {
+ return item.select();
+ }
+ });
+ }
+ }
+
+ this.__addUserEventHandler("select");
+ },
+
+ /***************************** Public Methods ****************************************************************/
+ highlight : function (highlight) {
+ if (highlight && !this.selected()) {
+ this.__header().addClass(this.hoverClass);
+ } else {
+ this.__header().removeClass(this.hoverClass);
+ }
+ },
+
+ selected : function () {
+ return this.__header().hasClass(this.selectionClass);
+ },
+
+ /**
+ * @methodOf
+ * @name PanelMenuItem#select
+ *
+ * TODO ...
+ *
+ * @return {void} TODO ...
+ */
+ select: function () {
+ var continueProcess = this.__fireBeforeSelect();
+ if (!continueProcess) {
+ return false;
+ }
+
+ return SELECT_ITEM.exec(this)
+ },
+
+ /**
+ * please, remove this method when client side ajax events will be added
+ *
+ * */
+ onCompleteHandler : function () {
+ SELECT_ITEM.execClient(this);
+ },
+
+ unselect: function () {
+ var panelMenu = this.__rfPanelMenu();
+ if (panelMenu.selectedItem() == this.itemName) {
+ panelMenu.selectedItem(null);
+ } else {
+ rf.warn("You try unselect item (name=" + this.itemName + ") that isn't seleted")
+ }
+
+ this.__unselect();
+
+ return this.__fireUnselect();
+ },
+
+ /***************************** Private Methods ****************************************************************/
+ __panelMenu : function () {
+ return this.__item().parents(".rf-pm")[0];
+ },
+
+ __rfPanelMenu : function () {
+ return rf.$(this.__item().parents(".rf-pm")[0]);
+ },
+
+ __changeState : function () {
+ return this.__rfPanelMenu().selectedItem(this.itemName);
+ },
+
+ __restoreState : function (state) {
+ if (state) {
+ this.__rfPanelMenu().selectedItem(state);
+ }
+ },
+
+ __item : function () {
+ return $(rf.getDomElement(this.id));
+ },
+
+ __header : function () {
+ return this.__item();
+ },
+
+ __select: function () {
+ this.__header().addClass(this.selectionClass);
+ },
+
+ __unselect: function () {
+ this.__header().removeClass(this.selectionClass);
+ },
+
+ __fireBeforeSelect : function () {
+ return new rf.Event.fireById(this.id, "beforeselect", {
+ id: this.id
+ });
+ },
+
+ __fireSelect : function () {
+ return new rf.Event.fireById(this.id, "select", {
+ id: this.id
+ });
+ },
+
+ __fireUnselect : function () {
+ return new rf.Event.fireById(this.id, "unselect", {
+ id: this.id
+ });
+ },
+
+ /**
+ * @private
+ * */
+ __addUserEventHandler : function (name) {
+ var handler = this.options["on" + name];
+ if (handler) {
+ rf.Event.bindById(this.id, name, handler);
+ }
+ },
+
+ destroy: function () {
+ delete this.__rfPanelMenu().getItems()[this.itemName];
+
+ rf.ui.PanelMenuItem.$super.destroy.call(this);
+ }
+ });
+})(jQuery, RichFaces);
Added: trunk/examples/output-demo/src/main/webapp/resources/tests/richfaces-panel-menu-group-qunit.js
===================================================================
--- trunk/examples/output-demo/src/main/webapp/resources/tests/richfaces-panel-menu-group-qunit.js (rev 0)
+++ trunk/examples/output-demo/src/main/webapp/resources/tests/richfaces-panel-menu-group-qunit.js 2010-10-31 20:24:22 UTC (rev 19806)
@@ -0,0 +1,149 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright ${year}, 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.
+ */
+
+
+RichFaces.QUnit.run(function() {
+ module("richfaces-panel-menu-group");
+
+ var PANEL_MENU_GROUP_ID = "f:panelMenuGroup";
+
+ test("RichFaces.ui.PanelMenuGroup test constructor", function () {
+ var c = RichFaces.$(PANEL_MENU_GROUP_ID);
+
+ ok(c instanceof RichFaces.ui.PanelMenuGroup, "instance of RichFaces.ui.PanelMenuGroup");
+ equals(c.id, PANEL_MENU_GROUP_ID, "id");
+
+ // test default options
+ same(c.options.expandEvent, "click", "Expand Event");
+ same(c.options.collapseEvent, "click", "Collapse Event");
+ same(c.options.expandSingle, false, "Expand Single");
+ same(c.options.bubbleSelection, {}, "Bubble Selection");
+
+ });
+
+ test("RichFaces.ui.PanelMenuGroup test public api", function () {
+ var c = RichFaces.$(PANEL_MENU_GROUP_ID);
+
+ var PUBLIC_API = ["collapsed", "expanded", "collapse", "expand", "switch"];
+
+ for (var i in PUBLIC_API) {
+ var funcName = PUBLIC_API[i];
+ ok(c[funcName], funcName + "present in component");
+ equals(typeof c[funcName], "function", funcName + " is function");
+ }
+ });
+
+ function testCollapseEvents(cancelEvent) {
+ var c = RichFaces.$(PANEL_MENU_GROUP_ID);
+
+ expect(cancelEvent ? 2 : 3);
+ var beforeCollapseHandler = function (event, comp, data) {
+ ok(true, "beforecollapse handler invoked");
+ same(data.id, PANEL_MENU_GROUP_ID, "Component Id");
+
+ return cancelEvent;
+ };
+ var beforeCollapseHandlerWrapper = RichFaces.Event.bindById(PANEL_MENU_GROUP_ID, "beforecollapse", beforeCollapseHandler);
+
+ var collapseHandler = handler("collapse handler invoked", undefined);
+ var collapseHandlerWrapper = RichFaces.Event.bindById(PANEL_MENU_GROUP_ID, "collapse", collapseHandler);
+
+ c.collapse();
+
+ RichFaces.Event.unbindById(PANEL_MENU_GROUP_ID, "beforecollapse", beforeCollapseHandlerWrapper);
+ RichFaces.Event.unbindById(PANEL_MENU_GROUP_ID, "collapse", collapseHandlerWrapper);
+
+ // TODO undo changes
+ }
+
+ test("RichFaces.ui.Tooltip.collapse test", function () {
+ testCollapseEvents(false);
+ });
+
+ test("RichFaces.ui.Tooltip.collapse test cancelable event", function () {
+ testCollapseEvents(true);
+ });
+
+ function testExpandEvents(cancelEvent) {
+ var c = RichFaces.$(PANEL_MENU_GROUP_ID);
+
+ expect(cancelEvent ? 2 : 3);
+ var beforeExpandHandler = function (event, comp, data) {
+ ok(true, "beforeexpand handler invoked");
+ same(data.id, PANEL_MENU_GROUP_ID, "Component Id");
+
+ return cancelEvent;
+ };
+ var beforeExpandHandlerWrapper = RichFaces.Event.bindById(PANEL_MENU_GROUP_ID, "beforeexpand", beforeExpandHandler);
+
+ var expandHandler = handler("expand handler invoked", undefined);
+ var expandHandlerWrapper = RichFaces.Event.bindById(PANEL_MENU_GROUP_ID, "expand", expandHandler);
+
+ c.expand();
+
+ RichFaces.Event.unbindById(PANEL_MENU_GROUP_ID, "beforeexpand", beforeExpandHandlerWrapper);
+ RichFaces.Event.unbindById(PANEL_MENU_GROUP_ID, "expand", expandHandlerWrapper);
+
+ // TODO undo changes
+ }
+
+ test("RichFaces.ui.Tooltip.expand test", function () {
+ testExpandEvents(false);
+ });
+
+ test("RichFaces.ui.Tooltip.expand test cancelable event", function () {
+ testExpandEvents(true);
+ });
+
+ function testSwitchEvents(cancelEvent) {
+ var c = RichFaces.$(PANEL_MENU_GROUP_ID);
+
+ expect(cancelEvent ? 2 : 3);
+ var beforeSwitchHandler = function (event, comp, data) {
+ ok(true, "beforeswitch handler invoked");
+ same(data.id, PANEL_MENU_GROUP_ID, "Component Id");
+
+ return cancelEvent;
+ };
+ var beforeSwitchHandlerWrapper = RichFaces.Event.bindById(PANEL_MENU_GROUP_ID, "beforeswitch", beforeSwitchHandler);
+
+ var switchHandler = handler("switch handler invoked", undefined);
+ var switchHandlerWrapper = RichFaces.Event.bindById(PANEL_MENU_GROUP_ID, "switch", switchHandler);
+
+ c.switch();
+
+ RichFaces.Event.unbindById(PANEL_MENU_GROUP_ID, "beforeswitch", beforeSwitchHandlerWrapper);
+ RichFaces.Event.unbindById(PANEL_MENU_GROUP_ID, "switch", switchHandlerWrapper);
+
+ // TODO undo changes
+ }
+
+ test("RichFaces.ui.Tooltip.switch test", function () {
+ testSwitchEvents(false);
+ });
+
+ test("RichFaces.ui.Tooltip.switch test cancelable event", function () {
+ testSwitchEvents(true);
+ });
+
+
+});
Added: trunk/examples/output-demo/src/main/webapp/resources/tests/richfaces-panel-menu-item-qunit.js
===================================================================
--- trunk/examples/output-demo/src/main/webapp/resources/tests/richfaces-panel-menu-item-qunit.js (rev 0)
+++ trunk/examples/output-demo/src/main/webapp/resources/tests/richfaces-panel-menu-item-qunit.js 2010-10-31 20:24:22 UTC (rev 19806)
@@ -0,0 +1,88 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright ${year}, 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.
+ */
+
+
+RichFaces.QUnit.run(function() {
+ module("richfaces-panel-menu-item");
+
+ var PANEL_MENU_ITEM_ID = "f:panelMenuItem";
+
+ test("RichFaces.ui.PanelMenuItem test constructor", function () {
+ var c = RichFaces.$(PANEL_MENU_ITEM_ID);
+
+ ok(c instanceof RichFaces.ui.PanelMenuItem, "instance of RichFaces.ui.PanelMenuItem");
+ equals(c.id, PANEL_MENU_ITEM_ID, "id");
+
+ // test default options
+ same(c.options.disable, {}, "Disable");
+ same(c.options.mode, Richfaces.ui.PanelMenuMode.DEFAULT, "Mode");
+ same(c.options.selectable, {}, "Selectable");
+ same(c.options.unselectable, {}, "Unselectable");
+ same(c.options.highlight, {}, "Highlight");
+
+ });
+
+ test("RichFaces.ui.PanelMenuItem test public api", function () {
+ var c = RichFaces.$(PANEL_MENU_ITEM_ID);
+
+ var PUBLIC_API = ["selected", "unselect", "select"];
+
+ for (var i in PUBLIC_API) {
+ var funcName = PUBLIC_API[i];
+ ok(c[funcName], funcName + "present in component");
+ equals(typeof c[funcName], "function", funcName + " is function");
+ }
+ });
+
+ function testSelectEvents(cancelEvent) {
+ var c = RichFaces.$(PANEL_MENU_ITEM_ID);
+
+ expect(cancelEvent ? 2 : 3);
+ var beforeSelectHandler = function (event, comp, data) {
+ ok(true, "beforeselect handler invoked");
+ same(data.id, PANEL_MENU_ITEM_ID, "Component Id");
+
+ return cancelEvent;
+ };
+ var beforeSelectHandlerWrapper = RichFaces.Event.bindById(PANEL_MENU_ITEM_ID, "beforeselect", beforeSelectHandler);
+
+ var selectHandler = handler("select handler invoked", undefined);
+ var selectHandlerWrapper = RichFaces.Event.bindById(PANEL_MENU_ITEM_ID, "select", selectHandler);
+
+ c.select();
+
+ RichFaces.Event.unbindById(PANEL_MENU_ITEM_ID, "beforeselect", beforeSelectHandlerWrapper);
+ RichFaces.Event.unbindById(PANEL_MENU_ITEM_ID, "select", selectHandlerWrapper);
+
+ // TODO undo changes
+ }
+
+ test("RichFaces.ui.Tooltip.select test", function () {
+ testSelectEvents(false);
+ });
+
+ test("RichFaces.ui.Tooltip.select test cancelable event", function () {
+ testSelectEvents(true);
+ });
+
+
+});
Added: trunk/examples/output-demo/src/main/webapp/resources/tests/richfaces-panel-menu-qunit.js
===================================================================
--- trunk/examples/output-demo/src/main/webapp/resources/tests/richfaces-panel-menu-qunit.js (rev 0)
+++ trunk/examples/output-demo/src/main/webapp/resources/tests/richfaces-panel-menu-qunit.js 2010-10-31 20:24:22 UTC (rev 19806)
@@ -0,0 +1,55 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright ${year}, 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.
+ */
+
+
+RichFaces.QUnit.run(function() {
+ module("richfaces-panel-menu");
+
+ var PANEL_MENU_ID = "f:panelMenu";
+
+ test("RichFaces.ui.PanelMenu test constructor", function () {
+ var c = RichFaces.$(PANEL_MENU_ID);
+
+ ok(c instanceof RichFaces.ui.PanelMenu, "instance of RichFaces.ui.PanelMenu");
+ equals(c.id, PANEL_MENU_ID, "id");
+
+ // test default options
+ same(c.options.disabled, false, "Disabled");
+ same(c.options.expandSingle, true, "Expand Single");
+ same(c.options.activeItem, null, "Active Item");
+
+ });
+
+ test("RichFaces.ui.PanelMenu test public api", function () {
+ var c = RichFaces.$(PANEL_MENU_ID);
+
+ var PUBLIC_API = ["selectItem", "selectedItem", "expandAll", "collapseAll", "expandGroup", "collapseGroup"];
+
+ for (var i in PUBLIC_API) {
+ var funcName = PUBLIC_API[i];
+ ok(c[funcName], funcName + "present in component");
+ equals(typeof c[funcName], "function", funcName + " is function");
+ }
+ });
+
+
+});
Modified: trunk/examples/output-demo/src/main/webapp/templates/template.xhtml
===================================================================
--- trunk/examples/output-demo/src/main/webapp/templates/template.xhtml 2010-10-31 17:38:22 UTC (rev 19805)
+++ trunk/examples/output-demo/src/main/webapp/templates/template.xhtml 2010-10-31 20:24:22 UTC (rev 19806)
@@ -13,9 +13,20 @@
</h:head>
<h:body>
+ <ui:insert name="scripts" ></ui:insert>
+ <h:form>
+ <h:commandButton value="Classic">
+ <f:setPropertyActionListener target="#{skinBean.skin}" value="classic"/>
+ </h:commandButton>
+ <h:commandButton value="BlueSky">
+ <f:setPropertyActionListener target="#{skinBean.skin}" value="blueSky"/>
+ </h:commandButton>
+ <h:commandButton value="DeepMarine">
+ <f:setPropertyActionListener target="#{skinBean.skin}" value="deepMarine"/>
+ </h:commandButton>
+ </h:form>
- <ui:insert name="scripts" ></ui:insert>
<table width="100%">
<thead>
<tr>
@@ -29,85 +40,104 @@
<tr valign="top">
<td>
<h:form id="nav">
- <p>Examples</p>
- <ul>
- <li>
- <p>Toggle Panel</p>
- <ul>
- <li><h:commandLink value="togglePanel" action="togglePanel" /></li>
- <li><h:commandLink value="togglePanel Ajax" action="togglePanel/ajax" /></li>
- <li><h:commandLink value="togglePanel Client" action="togglePanel/client" /></li>
- <li><h:commandLink value="togglePanel Server" action="togglePanel/server" /></li>
- <li><h:commandLink value="togglePanel Mixed" action="togglePanel/mixed" /></li>
- </ul>
- </li>
- <li>
- <p>Accordion</p>
- <ul>
- <li><h:commandLink value="accordion" action="accordion" /></li>
- </ul>
- </li>
- <li>
- <p>Panel</p>
- <ul>
- <li><h:commandLink value="panel" action="panel" /></li>
- </ul>
- </li>
- <li>
- <p>Popup panel</p>
- <ul>
- <li><h:commandLink value="popup" action="popup" /></li>
- </ul>
- </li>
- <li>
- <p>ProgressBar</p>
- <ul>
- <li><h:commandLink value="progressbar" action="progressbar" /></li>
- </ul>
- </li>
- <li>
- <p>Collapsible Panel</p>
- <ul>
- <li><h:commandLink value="Collapsible Panel" action="collapsiblePanel" /></li>
- </ul>
- </li>
- <li>
- <p>Tab Panel</p>
- <ul>
- <li><h:commandLink value="Tab Panel" action="tabPanel" /></li>
- </ul>
- </li>
- <li>
- <p>Tooltip</p>
- <ul>
- <li>
- <p>Examples</p>
- <ul>
- <li>
- <h:commandLink value="Tooltip" action="tooltip"/>
- </li>
- </ul>
- <p>QUnit</p>
- <ul>
- <li>
- <h:commandLink value="Tooltip" action="qunit/tooltip"/>
- </li>
- </ul>
- </li>
- </ul>
- </li>
- </ul>
- <p>QUnit</p>
- <ul>
- <li><h:commandLink value="togglePanel" action="qunit/togglePanel" /></li>
- <li><h:commandLink value="togglePanelItem" action="qunit/togglePanelItem" /></li>
- <li><h:commandLink value="accordion" action="qunit/accordion" /></li>
- <li><h:commandLink value="accordionHeaders" action="qunit/accordionHeaders" /></li>
- <li><h:commandLink value="collapsiblePanel" action="qunit/collapsiblePanel" /></li>
- <li><h:commandLink value="tabPanel" action="qunit/tabPanel" /></li>
- </ul>
+ <p>Toggle Panel</p>
+ <ul>
+ <li>
+ <p>Examples</p>
+ <ul>
+ <li><h:commandLink value="togglePanel" action="togglePanel" /></li>
+ <li><h:commandLink value="togglePanel Ajax" action="togglePanel/ajax" /></li>
+ <li><h:commandLink value="togglePanel Client" action="togglePanel/client" /></li>
+ <li><h:commandLink value="togglePanel Server" action="togglePanel/server" /></li>
+ <li><h:commandLink value="togglePanel Mixed" action="togglePanel/mixed" /></li>
+ </ul>
+ <p>QUnit</p>
+ <ul>
+ <li><h:commandLink value="togglePanel" action="qunit/togglePanel" /></li>
+ <li><h:commandLink value="togglePanelItem" action="qunit/togglePanelItem" /></li>
+ </ul>
+ </li>
+ </ul>
+
+
+ <p>Accordion</p>
+ <ul>
+ <li>
+ <p>Examples</p>
+ <ul>
+ <li><h:commandLink value="accordion" action="accordion" /></li>
+ </ul>
+ <p>QUnit</p>
+ <ul>
+ <li><h:commandLink value="accordion" action="qunit/accordion" /></li>
+ <li><h:commandLink value="accordionHeaders" action="qunit/accordionHeaders" /></li>
+ </ul>
+ </li>
+ </ul>
+
+ <p>Collapsible Panel</p>
+ <ul>
+ <li>
+ <p>Examples</p>
+ <ul>
+ <li><h:commandLink value="Collapsible Panel" action="collapsiblePanel" /></li>
+ </ul>
+ <p>QUnit</p>
+ <ul>
+ <li><h:commandLink value="tabPanel" action="qunit/tabPanel" /></li>
+ </ul>
+ </li>
+ </ul>
+
+ <p>Tab Panel</p>
+ <ul>
+ <li>
+ <p>Examples</p>
+ <ul>
+ <li><h:commandLink value="Tab Panel" action="tabPanel" /></li>
+ </ul>
+ <p>QUnit</p>
+ <ul>
+ <li><h:commandLink value="tabPanel" action="qunit/tabPanel" /></li>
+ </ul>
+ </li>
+ </ul>
+
+ <p>Panel Menu</p>
+ <ul>
+ <li>
+ <p>Examples</p>
+ <ul>
+ <li><h:commandLink value="Panel Menu" action="panelMenu" /></li>
+ </ul>
+ <p>QUnit</p>
+ <ul>
+ <li><h:commandLink value="Panel Menu" action="qunit/panelMenu" /></li>
+ </ul>
+ </li>
+ </ul>
+
+ <p>Tooltip</p>
+ <ul>
+ <li>
+ <p>Examples</p>
+ <ul>
+ <li>
+ <h:commandLink value="Tooltip" action="tooltip"/>
+ </li>
+ </ul>
+ <p>QUnit</p>
+ <ul>
+ <li>
+ <h:commandLink value="Tooltip" action="qunit/tooltip"/>
+ </li>
+ </ul>
+ </li>
+ </ul>
+
</h:form>
</td>
+
<td>
<ui:insert name="body">Default content</ui:insert>
</td>
Modified: trunk/ui/common/ui/src/main/resources/META-INF/resources/org.richfaces/popup.js
===================================================================
--- trunk/ui/common/ui/src/main/resources/META-INF/resources/org.richfaces/popup.js 2010-10-31 17:38:22 UTC (rev 19805)
+++ trunk/ui/common/ui/src/main/resources/META-INF/resources/org.richfaces/popup.js 2010-10-31 20:24:22 UTC (rev 19806)
@@ -39,7 +39,6 @@
rf.BaseComponent.extend(rf.ui.Popup);
var $super = rf.ui.Popup.$super;
-
var defaultOptions = {
visible: false
};
Added: trunk/ui/output/api/src/main/java/org/richfaces/ExpandMode.java
===================================================================
--- trunk/ui/output/api/src/main/java/org/richfaces/ExpandMode.java (rev 0)
+++ trunk/ui/output/api/src/main/java/org/richfaces/ExpandMode.java 2010-10-31 20:24:22 UTC (rev 19806)
@@ -0,0 +1,35 @@
+/**
+ * License Agreement.
+ *
+ * Rich Faces - Natural Ajax for Java Server Faces (JSF)
+ *
+ * Copyright (C) 2007 Exadel, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1 as published by the Free Software Foundation.
+ *
+ * This library 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 library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+package org.richfaces;
+
+/**
+ * @author akolonitsky
+ * @since Oct 19, 2010
+ */
+public enum ExpandMode {
+ ajax,
+ server,
+ client,
+ none;
+
+ public static final ExpandMode DEFAULT = client;
+}
Added: trunk/ui/output/api/src/main/java/org/richfaces/IconPosition.java
===================================================================
--- trunk/ui/output/api/src/main/java/org/richfaces/IconPosition.java (rev 0)
+++ trunk/ui/output/api/src/main/java/org/richfaces/IconPosition.java 2010-10-31 20:24:22 UTC (rev 19806)
@@ -0,0 +1,13 @@
+package org.richfaces;
+
+/**
+ * @author akolonitsky
+ * @since Oct 19, 2010
+ */
+public enum IconPosition {
+ left,
+ right,
+ none;
+
+ public static final IconPosition DEFAULT = none;
+}
Added: trunk/ui/output/api/src/main/java/org/richfaces/PanelMenuMode.java
===================================================================
--- trunk/ui/output/api/src/main/java/org/richfaces/PanelMenuMode.java (rev 0)
+++ trunk/ui/output/api/src/main/java/org/richfaces/PanelMenuMode.java 2010-10-31 20:24:22 UTC (rev 19806)
@@ -0,0 +1,12 @@
+package org.richfaces;
+
+/**
+ * @author akolonitsky
+ * @since Oct 19, 2010
+ */
+public enum PanelMenuMode {
+ ajax,
+ server;
+
+ public static final PanelMenuMode DEFAULT = server;
+}
Modified: trunk/ui/output/ui/checkstyle-suppressions.xml
===================================================================
--- trunk/ui/output/ui/checkstyle-suppressions.xml 2010-10-31 17:38:22 UTC (rev 19805)
+++ trunk/ui/output/ui/checkstyle-suppressions.xml 2010-10-31 20:24:22 UTC (rev 19806)
@@ -33,4 +33,5 @@
<!-- TODO it is hot fix for building process, this files belong to the ui/output/trunk/panela/ui module,
and must be removed from here -->
<suppress checks="IllegalCatch" files="AbstractTogglePanel.java" />
+ <suppress checks="IllegalCatch" files="AbstractPanelMenu.java" />
</suppressions>
Modified: trunk/ui/output/ui/richfaces-suppressions.xml
===================================================================
--- trunk/ui/output/ui/richfaces-suppressions.xml 2010-10-31 17:38:22 UTC (rev 19805)
+++ trunk/ui/output/ui/richfaces-suppressions.xml 2010-10-31 20:24:22 UTC (rev 19806)
@@ -6,4 +6,6 @@
<suppressions>
<suppress checks="IllegalCatch" files="AbstractTogglePanel.java" />
+ <suppress checks="IllegalCatch" files="AbstractPanelMenu.java" />
+ <suppress checks="IllegalCatch" files="AbstractPanelMenuGroup.java" />
</suppressions>
Added: trunk/ui/output/ui/src/main/java/org/richfaces/component/AbstractPanelMenu.java
===================================================================
--- trunk/ui/output/ui/src/main/java/org/richfaces/component/AbstractPanelMenu.java (rev 0)
+++ trunk/ui/output/ui/src/main/java/org/richfaces/component/AbstractPanelMenu.java 2010-10-31 20:24:22 UTC (rev 19806)
@@ -0,0 +1,216 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright ${year}, 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.component;
+
+import org.richfaces.ExpandMode;
+import org.richfaces.PanelMenuMode;
+import org.richfaces.event.ItemChangeEvent;
+
+import javax.el.ValueExpression;
+import javax.faces.component.UIComponent;
+import javax.faces.component.UIOutput;
+import javax.faces.context.FacesContext;
+import javax.faces.event.FacesEvent;
+import javax.faces.event.PhaseId;
+
+/**
+ * @author akolonitsky
+ * @since 2010-10-25
+ */
+public abstract class AbstractPanelMenu extends UIOutput {
+
+ public static final String COMPONENT_TYPE = "org.richfaces.PanelMenu";
+
+ public static final String COMPONENT_FAMILY = "org.richfaces.PanelMenu";
+
+ private String submittedActiveItem;
+
+ private enum PropertyKeys {
+ valid,
+ immediate
+ }
+
+ protected AbstractPanelMenu() {
+ setRendererType("org.richfaces.PanelMenu");
+ }
+
+ @Override
+ public void processDecodes(FacesContext context) {
+ super.processDecodes(context);
+
+ executeValidate(context);
+ }
+
+ public void validate(FacesContext context) {
+ if (context == null) {
+ throw new NullPointerException();
+ }
+
+ // Submitted value == null means "the component was not submitted at all".
+ String activeItem = getSubmittedActiveItem();
+ if (activeItem == null) {
+ return;
+ }
+
+ String previous = (String) getValue();
+ setActiveItem(activeItem);
+ setSubmittedActiveItem(null);
+ if (previous != null && !previous.equalsIgnoreCase(activeItem)) {
+ queueEvent(new ItemChangeEvent(this, previous, activeItem));
+ }
+ }
+
+ private void executeValidate(FacesContext context) {
+ try {
+ validate(context);
+ } catch (RuntimeException e) {
+ context.renderResponse();
+ throw e;
+ }
+
+ if (!isValid()) {
+ context.validationFailed();
+ context.renderResponse();
+ }
+ }
+
+ @Override
+ public void queueEvent(FacesEvent event) {
+ if ((event instanceof ItemChangeEvent) && (event.getComponent() == this)) {
+ setEventPhase(event);
+ }
+
+ super.queueEvent(event);
+ }
+
+ protected void setEventPhase(FacesEvent event) {
+ if (isImmediate()) {
+ event.setPhaseId(PhaseId.APPLY_REQUEST_VALUES);
+ } else if (isBypassUpdates()) {
+ event.setPhaseId(PhaseId.PROCESS_VALIDATIONS);
+ } else {
+ event.setPhaseId(PhaseId.INVOKE_APPLICATION);
+ }
+ }
+
+
+
+ public String getSubmittedActiveItem() {
+ return this.submittedActiveItem;
+ }
+
+ public void setSubmittedActiveItem(Object submittedValue) {
+ this.submittedActiveItem = String.valueOf(submittedValue);
+ }
+
+ public boolean isValid() {
+ return (Boolean) getStateHelper().eval(PropertyKeys.valid, true);
+ }
+
+ public void setValid(boolean valid) {
+ getStateHelper().put(PropertyKeys.valid, valid);
+ }
+
+ public String getActiveItem() {
+ return (String) getValue();
+ }
+
+ public void setActiveItem(String value) {
+ setValue(value);
+ }
+
+ @Override
+ public void setValueExpression(String name, ValueExpression binding) {
+ if ("activeItem".equals(name)) {
+ super.setValueExpression("value", binding);
+ } else {
+ super.setValueExpression(name, binding);
+ }
+ }
+
+ public boolean isImmediate() {
+ return (Boolean) getStateHelper().eval(PropertyKeys.immediate, false);
+ }
+
+ public void setImmediate(boolean immediate) {
+ getStateHelper().put(PropertyKeys.immediate, immediate);
+ }
+
+ @Override
+ public String getFamily() {
+ return COMPONENT_FAMILY;
+ }
+
+ public abstract boolean isDisabled();
+
+ public abstract String getExpandEvent();
+
+ public abstract String getCollapseEvent();
+
+ public abstract ExpandMode getGroupMode();
+
+ public abstract boolean isExpandSingle();
+
+ public abstract PanelMenuMode getItemMode();
+
+ public abstract boolean isBubbleSelection();
+
+ public abstract String getItemChangeListener();
+
+ public abstract boolean isBypassUpdates();
+
+ public abstract boolean isLimitToList();
+
+ public abstract Object getData();
+
+ public abstract String getStatus();
+
+ public abstract Object getExecute();
+
+ public abstract Object getRender();
+
+ public AbstractPanelMenuItem getItem(String itemName) {
+ if (itemName == null) {
+ throw new IllegalArgumentException("Icon name can't be null");
+ }
+
+ return getItem(itemName, this);
+ }
+
+ private static AbstractPanelMenuItem getItem(String itemName, UIComponent comp) {
+ if (comp instanceof AbstractPanelMenuItem
+ && itemName.equals(((AbstractPanelMenuItem) comp).getName())) {
+ return (AbstractPanelMenuItem) comp;
+ }
+
+ for (UIComponent item : comp.getChildren()) {
+ AbstractPanelMenuItem resItem = getItem(itemName, item);
+ if (resItem != null) {
+ return resItem;
+ }
+ }
+
+ return null;
+ }
+}
Added: trunk/ui/output/ui/src/main/java/org/richfaces/component/AbstractPanelMenuGroup.java
===================================================================
--- trunk/ui/output/ui/src/main/java/org/richfaces/component/AbstractPanelMenuGroup.java (rev 0)
+++ trunk/ui/output/ui/src/main/java/org/richfaces/component/AbstractPanelMenuGroup.java 2010-10-31 20:24:22 UTC (rev 19806)
@@ -0,0 +1,180 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright ${year}, 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.component;
+
+import org.richfaces.event.ChangeExpandEvent;
+import org.richfaces.event.ItemChangeEvent;
+
+import javax.el.ValueExpression;
+import javax.faces.context.FacesContext;
+import javax.faces.event.FacesEvent;
+import javax.faces.event.PhaseId;
+
+/**
+ * @author akolonitsky
+ * @since 2010-10-25
+ */
+public abstract class AbstractPanelMenuGroup extends UIPanelMenuItem {
+
+ public static final String COMPONENT_TYPE = "org.richfaces.PanelMenuGroup";
+
+ public static final String COMPONENT_FAMILY = "org.richfaces.PanelMenuGroup";
+ private Boolean submittedExpanded;
+
+ private enum PropertyKeys {
+ valid,
+ immediate
+ }
+
+ protected AbstractPanelMenuGroup() {
+ setRendererType("org.richfaces.PanelMenuGroup");
+ }
+
+ @Override
+ public String getFamily() {
+ return COMPONENT_FAMILY;
+ }
+
+ @Override
+ public void processDecodes(FacesContext context) {
+ super.processDecodes(context);
+
+ executeValidate(context);
+ }
+
+ public void validate(FacesContext context) {
+ if (context == null) {
+ throw new NullPointerException();
+ }
+
+ // Submitted value == null means "the component was not submitted at all".
+ Boolean expanded = getSubmittedExpanded();
+ if (expanded == null) {
+ return;
+ }
+
+ Boolean previous = (Boolean) getValue();
+ setExpanded(expanded);
+ setSubmittedExpanded(null);
+ if (previous != null && !previous.equals(expanded)) {
+ queueEvent(new ChangeExpandEvent(this, previous));
+ }
+ }
+
+ private void executeValidate(FacesContext context) {
+ try {
+ validate(context);
+ } catch (RuntimeException e) {
+ context.renderResponse();
+ throw e;
+ }
+
+ if (!isValid()) {
+ context.validationFailed();
+ context.renderResponse();
+ }
+ }
+
+ @Override
+ public void queueEvent(FacesEvent event) {
+ if ((event instanceof ItemChangeEvent) && (event.getComponent() == this)) {
+ setEventPhase(event);
+ }
+
+ super.queueEvent(event);
+ }
+
+ protected void setEventPhase(FacesEvent event) {
+ if (isImmediate()) {
+ event.setPhaseId(PhaseId.APPLY_REQUEST_VALUES);
+ } else if (isBypassUpdates()) {
+ event.setPhaseId(PhaseId.PROCESS_VALIDATIONS);
+ } else {
+ event.setPhaseId(PhaseId.INVOKE_APPLICATION);
+ }
+ }
+
+
+
+ public Boolean getSubmittedExpanded() {
+ return this.submittedExpanded;
+ }
+
+ public void setSubmittedExpanded(Object submittedValue) {
+ this.submittedExpanded = Boolean.parseBoolean(String.valueOf(submittedValue));
+ }
+
+ public boolean isValid() {
+ return (Boolean) getStateHelper().eval(PropertyKeys.valid, true);
+ }
+
+ public void setValid(boolean valid) {
+ getStateHelper().put(PropertyKeys.valid, valid);
+ }
+
+ public boolean isExpanded() {
+ return getValue() == null ? false : (Boolean) getValue();
+ }
+
+ public void setExpanded(boolean expanded) {
+ setValue(expanded);
+ }
+
+ @Override
+ public void setValueExpression(String name, ValueExpression binding) {
+ if ("expanded".equals(name)) {
+ super.setValueExpression("value", binding);
+ } else {
+ super.setValueExpression(name, binding);
+ }
+ }
+
+ public boolean isImmediate() {
+ return (Boolean) getStateHelper().eval(PropertyKeys.immediate, false);
+ }
+
+ public void setImmediate(boolean immediate) {
+ getStateHelper().put(PropertyKeys.immediate, immediate);
+ }
+
+
+
+
+ public abstract boolean getBubbleSelection();
+
+ public abstract boolean isExpandSingle();
+
+ public abstract String getCollapseEvent();
+
+ public abstract String getExpandEvent();
+
+ public abstract String getIconCollapsed();
+
+ public abstract String getIconExpanded();
+
+ public abstract String getChangeExpandListener();
+
+
+
+}
Added: trunk/ui/output/ui/src/main/java/org/richfaces/component/AbstractPanelMenuItem.java
===================================================================
--- trunk/ui/output/ui/src/main/java/org/richfaces/component/AbstractPanelMenuItem.java (rev 0)
+++ trunk/ui/output/ui/src/main/java/org/richfaces/component/AbstractPanelMenuItem.java 2010-10-31 20:24:22 UTC (rev 19806)
@@ -0,0 +1,73 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright ${year}, 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.component;
+
+import org.richfaces.PanelMenuMode;
+
+import javax.faces.component.UIOutput;
+
+/**
+ * @author akolonitsky
+ * @since 2010-10-25
+ */
+public abstract class AbstractPanelMenuItem extends UIOutput {
+
+ public static final String COMPONENT_TYPE = "org.richfaces.PanelMenuItem";
+
+ public static final String COMPONENT_FAMILY = "org.richfaces.PanelMenuItem";
+
+ protected AbstractPanelMenuItem() {
+ setRendererType("org.richfaces.PanelMenuItem");
+ }
+
+ @Override
+ public String getFamily() {
+ return COMPONENT_FAMILY;
+ }
+
+ public abstract String getIcon();
+
+ public abstract PanelMenuMode getMode();
+
+ public abstract String getLabel();
+
+ public abstract String getName();
+
+ public abstract boolean isDisabled();
+
+ public abstract boolean isBypassUpdates();
+
+ public abstract boolean isLimitToList();
+
+ public abstract Object getData();
+
+ public abstract String getStatus();
+
+ public abstract Object getExecute();
+
+ public abstract Object getRender();
+
+
+
+}
Added: trunk/ui/output/ui/src/main/java/org/richfaces/component/UIPanelMenu.java
===================================================================
--- trunk/ui/output/ui/src/main/java/org/richfaces/component/UIPanelMenu.java (rev 0)
+++ trunk/ui/output/ui/src/main/java/org/richfaces/component/UIPanelMenu.java 2010-10-31 20:24:22 UTC (rev 19806)
@@ -0,0 +1,165 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright ${year}, 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.component;
+
+import org.richfaces.ExpandMode;
+import org.richfaces.PanelMenuMode;
+
+/**
+ * @author akolonitsky
+ * @since 2010-10-25
+ */
+public class UIPanelMenu extends AbstractPanelMenu {
+
+ public enum PropertyKeys {
+ disabled,
+ expandEvent,
+ collapseEvent,
+ groupMode,
+ expandSingle,
+ itemMode,
+ bubbleSelection,
+ itemChangeListener,
+ bypassUpdates,
+ limitToList,
+ data,
+ status,
+ execute,
+ render
+ }
+
+ public boolean isDisabled() {
+ return Boolean.valueOf(String.valueOf(getStateHelper().eval(PropertyKeys.disabled)));
+ }
+
+ public void setDisabled(boolean disabled) {
+ getStateHelper().put(PropertyKeys.disabled, disabled);
+ }
+
+ public String getExpandEvent() {
+ return (String) getStateHelper().eval(PropertyKeys.expandEvent, "click");
+ }
+
+ public void setExpandEvent(String expandEvent) {
+ getStateHelper().put(PropertyKeys.expandEvent, expandEvent);
+ }
+
+ public String getCollapseEvent() {
+ return (String) getStateHelper().eval(PropertyKeys.collapseEvent, "click");
+ }
+
+ public void setCollapseEvent(String collapseEvent) {
+ getStateHelper().put(PropertyKeys.collapseEvent, collapseEvent);
+ }
+
+ public ExpandMode getGroupMode() {
+ return (ExpandMode) getStateHelper().eval(PropertyKeys.groupMode, ExpandMode.DEFAULT);
+ }
+
+ public void setGroupMode(ExpandMode groupMode) {
+ getStateHelper().put(PropertyKeys.groupMode, groupMode);
+ }
+
+ public boolean isExpandSingle() {
+ return Boolean.valueOf(String.valueOf(getStateHelper().eval(PropertyKeys.expandSingle, true)));
+ }
+
+ public void setExpandSingle(boolean expandSingle) {
+ getStateHelper().put(PropertyKeys.expandSingle, expandSingle);
+ }
+
+ public PanelMenuMode getItemMode() {
+ return (PanelMenuMode) getStateHelper().eval(PropertyKeys.itemMode, PanelMenuMode.DEFAULT);
+ }
+
+ public void setItemMode(PanelMenuMode itemMode) {
+ getStateHelper().put(PropertyKeys.itemMode, itemMode);
+ }
+
+ public boolean isBubbleSelection() {
+ return Boolean.valueOf(String.valueOf(getStateHelper().eval(PropertyKeys.bubbleSelection, true)));
+ }
+
+ public void setBubbleSelection(boolean bubbleSelection) {
+ getStateHelper().put(PropertyKeys.bubbleSelection, bubbleSelection);
+ }
+
+ public String getItemChangeListener() {
+ return (String) getStateHelper().eval(PropertyKeys.itemChangeListener);
+ }
+
+ public void setItemChangeListener(String itemChangeListener) {
+ getStateHelper().put(PropertyKeys.itemChangeListener, itemChangeListener);
+ }
+
+ public boolean isBypassUpdates() {
+ return Boolean.valueOf(String.valueOf(getStateHelper().eval(PropertyKeys.bypassUpdates)));
+ }
+
+ public void setBypassUpdates(boolean bypassUpdates) {
+ getStateHelper().put(PropertyKeys.bypassUpdates, bypassUpdates);
+ }
+
+ public boolean isLimitToList() {
+ return Boolean.valueOf(String.valueOf(getStateHelper().eval(PropertyKeys.limitToList)));
+ }
+
+ public void setLimitToList(boolean limitToList) {
+ getStateHelper().put(PropertyKeys.limitToList, limitToList);
+ }
+
+ public Object getData() {
+ return getStateHelper().eval(PropertyKeys.data);
+ }
+
+ public void setData(Object data) {
+ getStateHelper().put(PropertyKeys.data, data);
+ }
+
+ public String getStatus() {
+ return (String) getStateHelper().eval(PropertyKeys.status);
+ }
+
+ public void setStatus(String status) {
+ getStateHelper().put(PropertyKeys.status, status);
+ }
+
+ public Object getExecute() {
+ return getStateHelper().eval(PropertyKeys.execute);
+ }
+
+ public void setExecute(Object execute) {
+ getStateHelper().put(PropertyKeys.execute, execute);
+ }
+
+ public Object getRender() {
+ return getStateHelper().eval(PropertyKeys.render);
+ }
+
+ public void setRender(Object render) {
+ getStateHelper().put(PropertyKeys.render, render);
+ }
+
+
+}
Added: trunk/ui/output/ui/src/main/java/org/richfaces/component/UIPanelMenuGroup.java
===================================================================
--- trunk/ui/output/ui/src/main/java/org/richfaces/component/UIPanelMenuGroup.java (rev 0)
+++ trunk/ui/output/ui/src/main/java/org/richfaces/component/UIPanelMenuGroup.java 2010-10-31 20:24:22 UTC (rev 19806)
@@ -0,0 +1,104 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright ${year}, 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.component;
+
+
+
+/**
+ * @author akolonitsky
+ * @since 2010-10-25
+ */
+public class UIPanelMenuGroup extends AbstractPanelMenuGroup {
+
+ public enum PropertyKeys {
+ bubbleSelection,
+ expanded,
+ expandSingle,
+ collapseEvent,
+ expandEvent,
+ iconCollapsed,
+ iconExpanded,
+ changeExpandListener
+ }
+
+
+
+ public boolean getBubbleSelection() {
+ return Boolean.valueOf(String.valueOf(getStateHelper().eval(PropertyKeys.bubbleSelection, true)));
+ }
+
+ public void setBubbleSelection(boolean bubbleSelection) {
+ getStateHelper().put(PropertyKeys.bubbleSelection, bubbleSelection);
+ }
+
+ public boolean isExpandSingle() {
+ return Boolean.valueOf(String.valueOf(getStateHelper().eval(PropertyKeys.expandSingle, true)));
+ }
+
+ public void setExpandSingle(boolean expandSingle) {
+ getStateHelper().put(PropertyKeys.expandSingle, expandSingle);
+ }
+
+ public String getCollapseEvent() {
+ return (String) getStateHelper().eval(PropertyKeys.collapseEvent, "click");
+ }
+
+ public void setCollapseEvent(String collapseEvent) {
+ getStateHelper().put(PropertyKeys.collapseEvent, collapseEvent);
+ }
+
+ public String getExpandEvent() {
+ return (String) getStateHelper().eval(PropertyKeys.expandEvent, "click");
+ }
+
+ public void setExpandEvent(String expandEvent) {
+ getStateHelper().put(PropertyKeys.expandEvent, expandEvent);
+ }
+
+ public String getIconCollapsed() {
+ return (String) getStateHelper().eval(PropertyKeys.iconCollapsed);
+ }
+
+ public void setIconCollapsed(String iconCollapsed) {
+ getStateHelper().put(PropertyKeys.iconCollapsed, iconCollapsed);
+ }
+
+ public String getIconExpanded() {
+ return (String) getStateHelper().eval(PropertyKeys.iconExpanded);
+ }
+
+ public void setIconExpanded(String iconExpanded) {
+ getStateHelper().put(PropertyKeys.iconExpanded, iconExpanded);
+ }
+
+ public String getChangeExpandListener() {
+ return (String) getStateHelper().eval(PropertyKeys.changeExpandListener);
+ }
+
+ public void setChangeExpandListener(String changeExpandListener) {
+ getStateHelper().put(PropertyKeys.changeExpandListener, changeExpandListener);
+ }
+
+
+}
Added: trunk/ui/output/ui/src/main/java/org/richfaces/component/UIPanelMenuItem.java
===================================================================
--- trunk/ui/output/ui/src/main/java/org/richfaces/component/UIPanelMenuItem.java (rev 0)
+++ trunk/ui/output/ui/src/main/java/org/richfaces/component/UIPanelMenuItem.java 2010-10-31 20:24:22 UTC (rev 19806)
@@ -0,0 +1,137 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright ${year}, 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.component;
+
+import org.richfaces.PanelMenuMode;
+
+/**
+ * @author akolonitsky
+ * @since 2010-10-25
+ */
+public class UIPanelMenuItem extends AbstractPanelMenuItem {
+
+ public enum PropertyKeys {
+ icon,
+ mode,
+ label,
+ name,
+ disabled,
+ bypassUpdates,
+ limitToList,
+ data,
+ status,
+ execute,
+ render
+ }
+
+ public String getIcon() {
+ return (String) getStateHelper().eval(PropertyKeys.icon);
+ }
+
+ public void setIcon(String icon) {
+ getStateHelper().put(PropertyKeys.icon, icon);
+ }
+
+ public PanelMenuMode getMode() {
+ return (PanelMenuMode) getStateHelper().eval(PropertyKeys.mode, PanelMenuMode.DEFAULT);
+ }
+
+ public void setMode(PanelMenuMode mode) {
+ getStateHelper().put(PropertyKeys.mode, mode);
+ }
+
+ public String getLabel() {
+ return (String) getStateHelper().eval(PropertyKeys.label, getName());
+ }
+
+ public void setLabel(String label) {
+ getStateHelper().put(PropertyKeys.label, label);
+ }
+
+ public String getName() {
+ return (String) getStateHelper().eval(PropertyKeys.name, getId());
+ }
+
+ public void setName(String name) {
+ getStateHelper().put(PropertyKeys.name, name);
+ }
+
+ public boolean isDisabled() {
+ return Boolean.valueOf(String.valueOf(getStateHelper().eval(PropertyKeys.disabled)));
+ }
+
+ public void setDisabled(boolean disabled) {
+ getStateHelper().put(PropertyKeys.disabled, disabled);
+ }
+
+ public boolean isBypassUpdates() {
+ return Boolean.valueOf(String.valueOf(getStateHelper().eval(PropertyKeys.bypassUpdates)));
+ }
+
+ public void setBypassUpdates(boolean bypassUpdates) {
+ getStateHelper().put(PropertyKeys.bypassUpdates, bypassUpdates);
+ }
+
+ public boolean isLimitToList() {
+ return Boolean.valueOf(String.valueOf(getStateHelper().eval(PropertyKeys.limitToList)));
+ }
+
+ public void setLimitToList(boolean limitToList) {
+ getStateHelper().put(PropertyKeys.limitToList, limitToList);
+ }
+
+ public Object getData() {
+ return getStateHelper().eval(PropertyKeys.data);
+ }
+
+ public void setData(Object data) {
+ getStateHelper().put(PropertyKeys.data, data);
+ }
+
+ public String getStatus() {
+ return (String) getStateHelper().eval(PropertyKeys.status);
+ }
+
+ public void setStatus(String status) {
+ getStateHelper().put(PropertyKeys.status, status);
+ }
+
+ public Object getExecute() {
+ return getStateHelper().eval(PropertyKeys.execute);
+ }
+
+ public void setExecute(Object execute) {
+ getStateHelper().put(PropertyKeys.execute, execute);
+ }
+
+ public Object getRender() {
+ return getStateHelper().eval(PropertyKeys.render);
+ }
+
+ public void setRender(Object render) {
+ getStateHelper().put(PropertyKeys.render, render);
+ }
+
+
+}
Added: trunk/ui/output/ui/src/main/java/org/richfaces/component/html/HtmlPanelMenu.java
===================================================================
--- trunk/ui/output/ui/src/main/java/org/richfaces/component/html/HtmlPanelMenu.java (rev 0)
+++ trunk/ui/output/ui/src/main/java/org/richfaces/component/html/HtmlPanelMenu.java 2010-10-31 20:24:22 UTC (rev 19806)
@@ -0,0 +1,397 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright ${year}, 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.component.html;
+
+import org.richfaces.component.UIPanelMenu;
+import javax.faces.component.behavior.ClientBehaviorHolder;
+
+import java.util.Arrays;
+import java.util.Collection;
+import java.util.Collections;
+
+/**
+ * @author akolonitsky
+ * @since 2010-10-25
+ */
+public class HtmlPanelMenu extends UIPanelMenu implements ClientBehaviorHolder {
+
+ public static final String COMPONENT_TYPE = "org.richfaces.PanelMenu";
+
+ public static final String COMPONENT_FAMILY = "org.richfaces.PanelMenu";
+
+ private static final Collection<String> EVENT_NAMES = Collections.unmodifiableCollection(Arrays.asList(
+ "click",
+ "dblclick",
+ "mousedown",
+ "mousemove",
+ "mouseout",
+ "mouseover",
+ "mouseup"
+ ));
+
+
+ public enum PropertyKeys {
+ style,
+ styleClass,
+ width,
+ itemClass,
+ itemHoverClass,
+ itemDisableClass,
+ itemIcon,
+ itemDisableIcon,
+ itemIconPosition,
+ topItemClass,
+ topItemHoverClass,
+ topItemDisableClass,
+ topItemIcon,
+ topItemDisableIcon,
+ topItemIconPosition,
+ groupClass,
+ groupHoverClass,
+ groupDisableClass,
+ groupCollapseIcon,
+ groupExpandIcon,
+ groupDisableIcon,
+ groupIconPosition,
+ topGroupClass,
+ topGroupHoverClass,
+ topGroupDisableClass,
+ topGroupCollapseIcon,
+ topGroupExpandIcon,
+ topGroupDisableIcon,
+ topGroupIconPosition,
+ onclick,
+ ondblclick,
+ onmousedown,
+ onmousemove,
+ onmouseout,
+ onmouseover,
+ onmouseup
+ }
+
+ public HtmlPanelMenu() {
+ setRendererType("org.richfaces.PanelMenu");
+ }
+
+ @Override
+ public String getFamily() {
+ return COMPONENT_FAMILY;
+ }
+
+ public String getStyle() {
+ return (String) getStateHelper().eval(PropertyKeys.style);
+ }
+
+ public void setStyle(String style) {
+ getStateHelper().put(PropertyKeys.style, style);
+ }
+
+ public String getStyleClass() {
+ return (String) getStateHelper().eval(PropertyKeys.styleClass);
+ }
+
+ public void setStyleClass(String styleClass) {
+ getStateHelper().put(PropertyKeys.styleClass, styleClass);
+ }
+
+ public String getWidth() {
+ return (String) getStateHelper().eval(PropertyKeys.width);
+ }
+
+ public void setWidth(String width) {
+ getStateHelper().put(PropertyKeys.width, width);
+ }
+
+ public String getItemClass() {
+ return (String) getStateHelper().eval(PropertyKeys.itemClass);
+ }
+
+ public void setItemClass(String itemClass) {
+ getStateHelper().put(PropertyKeys.itemClass, itemClass);
+ }
+
+ public String getItemHoverClass() {
+ return (String) getStateHelper().eval(PropertyKeys.itemHoverClass);
+ }
+
+ public void setItemHoverClass(String itemHoverClass) {
+ getStateHelper().put(PropertyKeys.itemHoverClass, itemHoverClass);
+ }
+
+ public String getItemDisableClass() {
+ return (String) getStateHelper().eval(PropertyKeys.itemDisableClass);
+ }
+
+ public void setItemDisableClass(String itemDisableClass) {
+ getStateHelper().put(PropertyKeys.itemDisableClass, itemDisableClass);
+ }
+
+ public String getItemIcon() {
+ return (String) getStateHelper().eval(PropertyKeys.itemIcon);
+ }
+
+ public void setItemIcon(String itemIcon) {
+ getStateHelper().put(PropertyKeys.itemIcon, itemIcon);
+ }
+
+ public String getItemDisableIcon() {
+ return (String) getStateHelper().eval(PropertyKeys.itemDisableIcon);
+ }
+
+ public void setItemDisableIcon(String itemDisableIcon) {
+ getStateHelper().put(PropertyKeys.itemDisableIcon, itemDisableIcon);
+ }
+
+ public String getItemIconPosition() {
+ return (String) getStateHelper().eval(PropertyKeys.itemIconPosition);
+ }
+
+ public void setItemIconPosition(String itemIconPosition) {
+ getStateHelper().put(PropertyKeys.itemIconPosition, itemIconPosition);
+ }
+
+ public String getTopItemClass() {
+ return (String) getStateHelper().eval(PropertyKeys.topItemClass);
+ }
+
+ public void setTopItemClass(String topItemClass) {
+ getStateHelper().put(PropertyKeys.topItemClass, topItemClass);
+ }
+
+ public String getTopItemHoverClass() {
+ return (String) getStateHelper().eval(PropertyKeys.topItemHoverClass);
+ }
+
+ public void setTopItemHoverClass(String topItemHoverClass) {
+ getStateHelper().put(PropertyKeys.topItemHoverClass, topItemHoverClass);
+ }
+
+ public String getTopItemDisableClass() {
+ return (String) getStateHelper().eval(PropertyKeys.topItemDisableClass);
+ }
+
+ public void setTopItemDisableClass(String topItemDisableClass) {
+ getStateHelper().put(PropertyKeys.topItemDisableClass, topItemDisableClass);
+ }
+
+ public String getTopItemIcon() {
+ return (String) getStateHelper().eval(PropertyKeys.topItemIcon);
+ }
+
+ public void setTopItemIcon(String topItemIcon) {
+ getStateHelper().put(PropertyKeys.topItemIcon, topItemIcon);
+ }
+
+ public String getTopItemDisableIcon() {
+ return (String) getStateHelper().eval(PropertyKeys.topItemDisableIcon);
+ }
+
+ public void setTopItemDisableIcon(String topItemDisableIcon) {
+ getStateHelper().put(PropertyKeys.topItemDisableIcon, topItemDisableIcon);
+ }
+
+ public String getTopItemIconPosition() {
+ return (String) getStateHelper().eval(PropertyKeys.topItemIconPosition);
+ }
+
+ public void setTopItemIconPosition(String topItemIconPosition) {
+ getStateHelper().put(PropertyKeys.topItemIconPosition, topItemIconPosition);
+ }
+
+ public String getGroupClass() {
+ return (String) getStateHelper().eval(PropertyKeys.groupClass);
+ }
+
+ public void setGroupClass(String groupClass) {
+ getStateHelper().put(PropertyKeys.groupClass, groupClass);
+ }
+
+ public String getGroupHoverClass() {
+ return (String) getStateHelper().eval(PropertyKeys.groupHoverClass);
+ }
+
+ public void setGroupHoverClass(String groupHoverClass) {
+ getStateHelper().put(PropertyKeys.groupHoverClass, groupHoverClass);
+ }
+
+ public String getGroupDisableClass() {
+ return (String) getStateHelper().eval(PropertyKeys.groupDisableClass);
+ }
+
+ public void setGroupDisableClass(String groupDisableClass) {
+ getStateHelper().put(PropertyKeys.groupDisableClass, groupDisableClass);
+ }
+
+ public String getGroupCollapseIcon() {
+ return (String) getStateHelper().eval(PropertyKeys.groupCollapseIcon);
+ }
+
+ public void setGroupCollapseIcon(String groupCollapseIcon) {
+ getStateHelper().put(PropertyKeys.groupCollapseIcon, groupCollapseIcon);
+ }
+
+ public String getGroupExpandIcon() {
+ return (String) getStateHelper().eval(PropertyKeys.groupExpandIcon);
+ }
+
+ public void setGroupExpandIcon(String groupExpandIcon) {
+ getStateHelper().put(PropertyKeys.groupExpandIcon, groupExpandIcon);
+ }
+
+ public String getGroupDisableIcon() {
+ return (String) getStateHelper().eval(PropertyKeys.groupDisableIcon);
+ }
+
+ public void setGroupDisableIcon(String groupDisableIcon) {
+ getStateHelper().put(PropertyKeys.groupDisableIcon, groupDisableIcon);
+ }
+
+ public String getGroupIconPosition() {
+ return (String) getStateHelper().eval(PropertyKeys.groupIconPosition);
+ }
+
+ public void setGroupIconPosition(String groupIconPosition) {
+ getStateHelper().put(PropertyKeys.groupIconPosition, groupIconPosition);
+ }
+
+ public String getTopGroupClass() {
+ return (String) getStateHelper().eval(PropertyKeys.topGroupClass);
+ }
+
+ public void setTopGroupClass(String topGroupClass) {
+ getStateHelper().put(PropertyKeys.topGroupClass, topGroupClass);
+ }
+
+ public String getTopGroupHoverClass() {
+ return (String) getStateHelper().eval(PropertyKeys.topGroupHoverClass);
+ }
+
+ public void setTopGroupHoverClass(String topGroupHoverClass) {
+ getStateHelper().put(PropertyKeys.topGroupHoverClass, topGroupHoverClass);
+ }
+
+ public String getTopGroupDisableClass() {
+ return (String) getStateHelper().eval(PropertyKeys.topGroupDisableClass);
+ }
+
+ public void setTopGroupDisableClass(String topGroupDisableClass) {
+ getStateHelper().put(PropertyKeys.topGroupDisableClass, topGroupDisableClass);
+ }
+
+ public String getTopGroupCollapseIcon() {
+ return (String) getStateHelper().eval(PropertyKeys.topGroupCollapseIcon);
+ }
+
+ public void setTopGroupCollapseIcon(String topGroupCollapseIcon) {
+ getStateHelper().put(PropertyKeys.topGroupCollapseIcon, topGroupCollapseIcon);
+ }
+
+ public String getTopGroupExpandIcon() {
+ return (String) getStateHelper().eval(PropertyKeys.topGroupExpandIcon);
+ }
+
+ public void setTopGroupExpandIcon(String topGroupExpandIcon) {
+ getStateHelper().put(PropertyKeys.topGroupExpandIcon, topGroupExpandIcon);
+ }
+
+ public String getTopGroupDisableIcon() {
+ return (String) getStateHelper().eval(PropertyKeys.topGroupDisableIcon);
+ }
+
+ public void setTopGroupDisableIcon(String topGroupDisableIcon) {
+ getStateHelper().put(PropertyKeys.topGroupDisableIcon, topGroupDisableIcon);
+ }
+
+ public String getTopGroupIconPosition() {
+ return (String) getStateHelper().eval(PropertyKeys.topGroupIconPosition);
+ }
+
+ public void setTopGroupIconPosition(String topGroupIconPosition) {
+ getStateHelper().put(PropertyKeys.topGroupIconPosition, topGroupIconPosition);
+ }
+
+ public String getOnclick() {
+ return (String) getStateHelper().eval(PropertyKeys.onclick);
+ }
+
+ public void setOnclick(String onclick) {
+ getStateHelper().put(PropertyKeys.onclick, onclick);
+ }
+
+ public String getOndblclick() {
+ return (String) getStateHelper().eval(PropertyKeys.ondblclick);
+ }
+
+ public void setOndblclick(String ondblclick) {
+ getStateHelper().put(PropertyKeys.ondblclick, ondblclick);
+ }
+
+ public String getOnmousedown() {
+ return (String) getStateHelper().eval(PropertyKeys.onmousedown);
+ }
+
+ public void setOnmousedown(String onmousedown) {
+ getStateHelper().put(PropertyKeys.onmousedown, onmousedown);
+ }
+
+ public String getOnmousemove() {
+ return (String) getStateHelper().eval(PropertyKeys.onmousemove);
+ }
+
+ public void setOnmousemove(String onmousemove) {
+ getStateHelper().put(PropertyKeys.onmousemove, onmousemove);
+ }
+
+ public String getOnmouseout() {
+ return (String) getStateHelper().eval(PropertyKeys.onmouseout);
+ }
+
+ public void setOnmouseout(String onmouseout) {
+ getStateHelper().put(PropertyKeys.onmouseout, onmouseout);
+ }
+
+ public String getOnmouseover() {
+ return (String) getStateHelper().eval(PropertyKeys.onmouseover);
+ }
+
+ public void setOnmouseover(String onmouseover) {
+ getStateHelper().put(PropertyKeys.onmouseover, onmouseover);
+ }
+
+ public String getOnmouseup() {
+ return (String) getStateHelper().eval(PropertyKeys.onmouseup);
+ }
+
+ public void setOnmouseup(String onmouseup) {
+ getStateHelper().put(PropertyKeys.onmouseup, onmouseup);
+ }
+
+
+
+ @Override
+ public Collection<String> getEventNames() {
+ return EVENT_NAMES;
+ }
+}
+
Added: trunk/ui/output/ui/src/main/java/org/richfaces/component/html/HtmlPanelMenuGroup.java
===================================================================
--- trunk/ui/output/ui/src/main/java/org/richfaces/component/html/HtmlPanelMenuGroup.java (rev 0)
+++ trunk/ui/output/ui/src/main/java/org/richfaces/component/html/HtmlPanelMenuGroup.java 2010-10-31 20:24:22 UTC (rev 19806)
@@ -0,0 +1,126 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright ${year}, 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.component.html;
+
+import org.richfaces.component.UIPanelMenuGroup;
+import javax.faces.component.behavior.ClientBehaviorHolder;
+
+import java.util.Arrays;
+import java.util.Collection;
+import java.util.Collections;
+
+/**
+ * @author akolonitsky
+ * @since 2010-10-25
+ */
+public class HtmlPanelMenuGroup extends UIPanelMenuGroup implements ClientBehaviorHolder {
+
+ public static final String COMPONENT_TYPE = "org.richfaces.PanelMenuGroup";
+
+ public static final String COMPONENT_FAMILY = "org.richfaces.PanelMenuGroup";
+
+ private static final Collection<String> EVENT_NAMES = Collections.unmodifiableCollection(Arrays.asList(
+ "collapse",
+ "expand",
+ "switch",
+ "beforecollapse",
+ "beforeexpand",
+ "beforeswitch"
+ ));
+
+
+ public enum PropertyKeys {
+ oncollapse,
+ onexpand,
+ onswitch,
+ onbeforecollapse,
+ onbeforeexpand,
+ onbeforeswitch
+ }
+
+ public HtmlPanelMenuGroup() {
+ setRendererType("org.richfaces.PanelMenuGroup");
+ }
+
+ @Override
+ public String getFamily() {
+ return COMPONENT_FAMILY;
+ }
+
+ public String getOncollapse() {
+ return (String) getStateHelper().eval(PropertyKeys.oncollapse);
+ }
+
+ public void setOncollapse(String oncollapse) {
+ getStateHelper().put(PropertyKeys.oncollapse, oncollapse);
+ }
+
+ public String getOnexpand() {
+ return (String) getStateHelper().eval(PropertyKeys.onexpand);
+ }
+
+ public void setOnexpand(String onexpand) {
+ getStateHelper().put(PropertyKeys.onexpand, onexpand);
+ }
+
+ public String getOnswitch() {
+ return (String) getStateHelper().eval(PropertyKeys.onswitch);
+ }
+
+ public void setOnswitch(String onswitch) {
+ getStateHelper().put(PropertyKeys.onswitch, onswitch);
+ }
+
+ public String getOnbeforecollapse() {
+ return (String) getStateHelper().eval(PropertyKeys.onbeforecollapse);
+ }
+
+ public void setOnbeforecollapse(String onbeforecollapse) {
+ getStateHelper().put(PropertyKeys.onbeforecollapse, onbeforecollapse);
+ }
+
+ public String getOnbeforeexpand() {
+ return (String) getStateHelper().eval(PropertyKeys.onbeforeexpand);
+ }
+
+ public void setOnbeforeexpand(String onbeforeexpand) {
+ getStateHelper().put(PropertyKeys.onbeforeexpand, onbeforeexpand);
+ }
+
+ public String getOnbeforeswitch() {
+ return (String) getStateHelper().eval(PropertyKeys.onbeforeswitch);
+ }
+
+ public void setOnbeforeswitch(String onbeforeswitch) {
+ getStateHelper().put(PropertyKeys.onbeforeswitch, onbeforeswitch);
+ }
+
+
+
+ @Override
+ public Collection<String> getEventNames() {
+ return EVENT_NAMES;
+ }
+}
+
Added: trunk/ui/output/ui/src/main/java/org/richfaces/component/html/HtmlPanelMenuItem.java
===================================================================
--- trunk/ui/output/ui/src/main/java/org/richfaces/component/html/HtmlPanelMenuItem.java (rev 0)
+++ trunk/ui/output/ui/src/main/java/org/richfaces/component/html/HtmlPanelMenuItem.java 2010-10-31 20:24:22 UTC (rev 19806)
@@ -0,0 +1,267 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright ${year}, 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.component.html;
+
+import org.richfaces.component.UIPanelMenuItem;
+import javax.faces.component.behavior.ClientBehaviorHolder;
+
+import java.util.Arrays;
+import java.util.Collection;
+import java.util.Collections;
+
+/**
+ * @author akolonitsky
+ * @since 2010-10-25
+ */
+public class HtmlPanelMenuItem extends UIPanelMenuItem implements ClientBehaviorHolder {
+
+ public static final String COMPONENT_TYPE = "org.richfaces.PanelMenuItem";
+
+ public static final String COMPONENT_FAMILY = "org.richfaces.PanelMenuItem";
+
+ private static final Collection<String> EVENT_NAMES = Collections.unmodifiableCollection(Arrays.asList(
+ "beforedomupdate",
+ "complete",
+ "click",
+ "dblclick",
+ "mousedown",
+ "mousemove",
+ "mouseout",
+ "mouseover",
+ "mouseup",
+ "unselect",
+ "select",
+ "beforeselect"
+ ));
+
+
+ public enum PropertyKeys {
+ disabledClass,
+ disabledStyle,
+ hoverClass,
+ hoverStyle,
+ iconClass,
+ iconDisabled,
+ iconStyle,
+ style,
+ styleClass,
+ onbeforedomupdate,
+ oncomplete,
+ onclick,
+ ondblclick,
+ onmousedown,
+ onmousemove,
+ onmouseout,
+ onmouseover,
+ onmouseup,
+ onunselect,
+ onselect,
+ onbeforeselect
+ }
+
+ public HtmlPanelMenuItem() {
+ setRendererType("org.richfaces.PanelMenuItem");
+ }
+
+ @Override
+ public String getFamily() {
+ return COMPONENT_FAMILY;
+ }
+
+ public String getDisabledClass() {
+ return (String) getStateHelper().eval(PropertyKeys.disabledClass);
+ }
+
+ public void setDisabledClass(String disabledClass) {
+ getStateHelper().put(PropertyKeys.disabledClass, disabledClass);
+ }
+
+ public String getDisabledStyle() {
+ return (String) getStateHelper().eval(PropertyKeys.disabledStyle);
+ }
+
+ public void setDisabledStyle(String disabledStyle) {
+ getStateHelper().put(PropertyKeys.disabledStyle, disabledStyle);
+ }
+
+ public String getHoverClass() {
+ return (String) getStateHelper().eval(PropertyKeys.hoverClass);
+ }
+
+ public void setHoverClass(String hoverClass) {
+ getStateHelper().put(PropertyKeys.hoverClass, hoverClass);
+ }
+
+ public String getHoverStyle() {
+ return (String) getStateHelper().eval(PropertyKeys.hoverStyle);
+ }
+
+ public void setHoverStyle(String hoverStyle) {
+ getStateHelper().put(PropertyKeys.hoverStyle, hoverStyle);
+ }
+
+ public String getIconClass() {
+ return (String) getStateHelper().eval(PropertyKeys.iconClass);
+ }
+
+ public void setIconClass(String iconClass) {
+ getStateHelper().put(PropertyKeys.iconClass, iconClass);
+ }
+
+ public String getIconDisabled() {
+ return (String) getStateHelper().eval(PropertyKeys.iconDisabled);
+ }
+
+ public void setIconDisabled(String iconDisabled) {
+ getStateHelper().put(PropertyKeys.iconDisabled, iconDisabled);
+ }
+
+ public String getIconStyle() {
+ return (String) getStateHelper().eval(PropertyKeys.iconStyle);
+ }
+
+ public void setIconStyle(String iconStyle) {
+ getStateHelper().put(PropertyKeys.iconStyle, iconStyle);
+ }
+
+ public String getStyle() {
+ return (String) getStateHelper().eval(PropertyKeys.style);
+ }
+
+ public void setStyle(String style) {
+ getStateHelper().put(PropertyKeys.style, style);
+ }
+
+ public String getStyleClass() {
+ return (String) getStateHelper().eval(PropertyKeys.styleClass);
+ }
+
+ public void setStyleClass(String styleClass) {
+ getStateHelper().put(PropertyKeys.styleClass, styleClass);
+ }
+
+ public String getOnbeforedomupdate() {
+ return (String) getStateHelper().eval(PropertyKeys.onbeforedomupdate);
+ }
+
+ public void setOnbeforedomupdate(String onbeforedomupdate) {
+ getStateHelper().put(PropertyKeys.onbeforedomupdate, onbeforedomupdate);
+ }
+
+ public String getOncomplete() {
+ return (String) getStateHelper().eval(PropertyKeys.oncomplete);
+ }
+
+ public void setOncomplete(String oncomplete) {
+ getStateHelper().put(PropertyKeys.oncomplete, oncomplete);
+ }
+
+ public String getOnclick() {
+ return (String) getStateHelper().eval(PropertyKeys.onclick);
+ }
+
+ public void setOnclick(String onclick) {
+ getStateHelper().put(PropertyKeys.onclick, onclick);
+ }
+
+ public String getOndblclick() {
+ return (String) getStateHelper().eval(PropertyKeys.ondblclick);
+ }
+
+ public void setOndblclick(String ondblclick) {
+ getStateHelper().put(PropertyKeys.ondblclick, ondblclick);
+ }
+
+ public String getOnmousedown() {
+ return (String) getStateHelper().eval(PropertyKeys.onmousedown);
+ }
+
+ public void setOnmousedown(String onmousedown) {
+ getStateHelper().put(PropertyKeys.onmousedown, onmousedown);
+ }
+
+ public String getOnmousemove() {
+ return (String) getStateHelper().eval(PropertyKeys.onmousemove);
+ }
+
+ public void setOnmousemove(String onmousemove) {
+ getStateHelper().put(PropertyKeys.onmousemove, onmousemove);
+ }
+
+ public String getOnmouseout() {
+ return (String) getStateHelper().eval(PropertyKeys.onmouseout);
+ }
+
+ public void setOnmouseout(String onmouseout) {
+ getStateHelper().put(PropertyKeys.onmouseout, onmouseout);
+ }
+
+ public String getOnmouseover() {
+ return (String) getStateHelper().eval(PropertyKeys.onmouseover);
+ }
+
+ public void setOnmouseover(String onmouseover) {
+ getStateHelper().put(PropertyKeys.onmouseover, onmouseover);
+ }
+
+ public String getOnmouseup() {
+ return (String) getStateHelper().eval(PropertyKeys.onmouseup);
+ }
+
+ public void setOnmouseup(String onmouseup) {
+ getStateHelper().put(PropertyKeys.onmouseup, onmouseup);
+ }
+
+ public String getOnunselect() {
+ return (String) getStateHelper().eval(PropertyKeys.onunselect);
+ }
+
+ public void setOnunselect(String onunselect) {
+ getStateHelper().put(PropertyKeys.onunselect, onunselect);
+ }
+
+ public String getOnselect() {
+ return (String) getStateHelper().eval(PropertyKeys.onselect);
+ }
+
+ public void setOnselect(String onselect) {
+ getStateHelper().put(PropertyKeys.onselect, onselect);
+ }
+
+ public String getOnbeforeselect() {
+ return (String) getStateHelper().eval(PropertyKeys.onbeforeselect);
+ }
+
+ public void setOnbeforeselect(String onbeforeselect) {
+ getStateHelper().put(PropertyKeys.onbeforeselect, onbeforeselect);
+ }
+
+
+
+ @Override
+ public Collection<String> getEventNames() {
+ return EVENT_NAMES;
+ }
+}
+
Modified: trunk/ui/output/ui/src/main/java/org/richfaces/component/html/HtmlTab.java
===================================================================
--- trunk/ui/output/ui/src/main/java/org/richfaces/component/html/HtmlTab.java 2010-10-31 17:38:22 UTC (rev 19805)
+++ trunk/ui/output/ui/src/main/java/org/richfaces/component/html/HtmlTab.java 2010-10-31 20:24:22 UTC (rev 19806)
@@ -22,21 +22,20 @@
package org.richfaces.component.html;
+import org.richfaces.component.UITogglePanelTitledItem;
+import javax.faces.component.behavior.ClientBehaviorHolder;
+
import java.util.Arrays;
import java.util.Collection;
import java.util.Collections;
-import javax.faces.component.behavior.ClientBehaviorHolder;
-
-import org.richfaces.component.UITogglePanelTitledItem;
-
/**
* @author akolonitsky
- * @since 2010-08-27
+ * @since 2010-10-19
*/
public class HtmlTab extends UITogglePanelTitledItem implements ClientBehaviorHolder {
- public static final String COMPONENT_TYPE = "org.richfaces.TabPanelItem";
+ public static final String COMPONENT_TYPE = "org.richfaces.TogglePanelTitledItem";
public static final String COMPONENT_FAMILY = "org.richfaces.TogglePanelTitledItem";
Added: trunk/ui/output/ui/src/main/java/org/richfaces/renderkit/html/PanelMenuGroupRenderer.java
===================================================================
--- trunk/ui/output/ui/src/main/java/org/richfaces/renderkit/html/PanelMenuGroupRenderer.java (rev 0)
+++ trunk/ui/output/ui/src/main/java/org/richfaces/renderkit/html/PanelMenuGroupRenderer.java 2010-10-31 20:24:22 UTC (rev 19806)
@@ -0,0 +1,171 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright ${year}, 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.renderkit.html;
+
+import org.ajax4jsf.context.AjaxContext;
+import org.ajax4jsf.javascript.JSObject;
+import org.richfaces.component.AbstractPanelMenuGroup;
+import org.richfaces.component.html.HtmlPanelMenuGroup;
+import org.richfaces.renderkit.HtmlConstants;
+
+import javax.faces.component.UIComponent;
+import javax.faces.context.FacesContext;
+import javax.faces.context.ResponseWriter;
+import java.io.IOException;
+import java.util.HashMap;
+import java.util.Map;
+
+import static org.richfaces.component.util.HtmlUtil.concatClasses;
+import static org.richfaces.renderkit.html.TogglePanelRenderer.addEventOption;
+import static org.richfaces.renderkit.html.TogglePanelRenderer.getAjaxOptions;
+
+/**
+ * @author akolonitsky
+ * @since 2010-10-25
+ */
+public class PanelMenuGroupRenderer extends DivPanelRenderer {
+
+ public static final String COLLAPSE = "collapse";
+ public static final String EXPAND = "expand";
+ public static final String SWITCH = "switch";
+ public static final String BEFORE_COLLAPSE = "beforecollapse";
+ public static final String BEFORE_EXPAND = "beforeexpand";
+ public static final String BEFORE_SWITCH = "beforeswitch";
+
+
+ @Override
+ protected void doDecode(FacesContext context, UIComponent component) {
+ AbstractPanelMenuGroup menuGroup = (AbstractPanelMenuGroup) component;
+
+ Map<String, String> requestMap =
+ context.getExternalContext().getRequestParameterMap();
+
+ // Don't overwrite the value unless you have to!
+ String newValue = requestMap.get(component.getClientId() + ":expanded");
+ if (newValue != null) {
+ menuGroup.setSubmittedExpanded(newValue);
+ }
+
+ String compClientId = component.getClientId(context);
+ String clientId = requestMap.get(compClientId);
+ if (clientId != null && clientId.equals(compClientId)) {
+ context.getPartialViewContext().getRenderIds().add(clientId);
+
+ //TODO nick - this should be done on encode, not on decode
+ addOnCompleteParam(clientId);
+ }
+ }
+
+ protected static void addOnCompleteParam(String itemId) {
+ AjaxContext.getCurrentInstance().appendOncomplete(new StringBuilder()
+ .append("RichFaces.$('").append(itemId).append("').onCompleteHandler();").toString());
+ }
+
+
+
+ @Override
+ protected void doEncodeBegin(ResponseWriter writer, FacesContext context, UIComponent component) throws IOException {
+ super.doEncodeBegin(writer, context, component);
+
+ HtmlPanelMenuGroup menuGroup = (HtmlPanelMenuGroup) component;
+
+ writer.startElement(HtmlConstants.INPUT_ELEM, component);
+
+ final String expanded = component.getClientId(context) + ":expanded";
+ writer.writeAttribute(HtmlConstants.ID_ATTRIBUTE, expanded, null);
+ writer.writeAttribute(HtmlConstants.NAME_ATTRIBUTE, expanded, null);
+ writer.writeAttribute(HtmlConstants.TYPE_ATTR, HtmlConstants.INPUT_TYPE_HIDDEN, null);
+ writer.writeAttribute(HtmlConstants.VALUE_ATTRIBUTE, String.valueOf(menuGroup.isExpanded()), null);
+ writer.endElement(HtmlConstants.INPUT_ELEM);
+
+ encodeHeader(writer, context, menuGroup);
+ encodeContentBegin(writer, context, menuGroup);
+ }
+
+ private void encodeHeader(ResponseWriter writer, FacesContext context, HtmlPanelMenuGroup menuGroup) throws IOException {
+ writer.startElement("div", null);
+ writer.writeAttribute("id", menuGroup.getClientId(context) + ":hdr", null);
+ writer.writeAttribute("class", "rf-pm-gr-hdr", null);
+ writer.writeText(menuGroup.getLabel(), null);
+ writer.endElement("div");
+ }
+
+ private void encodeContentBegin(ResponseWriter writer, FacesContext context, HtmlPanelMenuGroup menuGroup) throws IOException {
+ writer.startElement("div", null);
+ writer.writeAttribute("id", menuGroup.getClientId(context) + ":cnt", null);
+ writer.writeAttribute("class", concatClasses("rf-pm-gr-cnt", menuGroup.isExpanded() ? "rf-pm-exp" : "rf-pm-colps"), null);
+ }
+
+ private void encodeContentEnd(ResponseWriter writer, FacesContext context, UIComponent component) throws IOException {
+ writer.endElement("div");
+ }
+
+ @Override
+ protected String getStyleClass(UIComponent component) {
+ return concatClasses("rf-pm-gr", attributeAsString(component, "styleClass"));
+ }
+
+ @Override
+ protected JSObject getScriptObject(FacesContext context, UIComponent component) {
+ return new JSObject("RichFaces.ui.PanelMenuGroup",
+ component.getClientId(), getScriptObjectOptions(context, component));
+ }
+
+ @Override
+ protected Map<String, Object> getScriptObjectOptions(FacesContext context, UIComponent component) {
+ HtmlPanelMenuGroup panelMenuGroup = (HtmlPanelMenuGroup) component;
+
+ Map<String, Object> options = new HashMap<String, Object>();
+ options.put("ajax", getAjaxOptions(context, panelMenuGroup));
+ options.put("name", panelMenuGroup.getName());
+ options.put("mode", panelMenuGroup.getMode());
+ options.put("expandEvent", panelMenuGroup.getExpandEvent());
+ options.put("collapseEvent", panelMenuGroup.getCollapseEvent());
+ options.put("expandSingle", panelMenuGroup.isExpandSingle());
+ options.put("bubbleSelection", panelMenuGroup.getBubbleSelection());
+ options.put("expanded", panelMenuGroup.isExpanded());
+
+ addEventOption(context, panelMenuGroup, options, COLLAPSE);
+ addEventOption(context, panelMenuGroup, options, EXPAND);
+ addEventOption(context, panelMenuGroup, options, SWITCH);
+ addEventOption(context, panelMenuGroup, options, BEFORE_COLLAPSE);
+ addEventOption(context, panelMenuGroup, options, BEFORE_EXPAND);
+ addEventOption(context, panelMenuGroup, options, BEFORE_SWITCH);
+
+ return options;
+ }
+
+ @Override
+ protected void doEncodeEnd(ResponseWriter writer, FacesContext context, UIComponent component) throws IOException {
+ encodeContentEnd(writer, context, component);
+
+ super.doEncodeEnd(writer, context, component);
+ }
+
+ @Override
+ protected Class<? extends UIComponent> getComponentClass() {
+ return AbstractPanelMenuGroup.class;
+ }
+}
+
Added: trunk/ui/output/ui/src/main/java/org/richfaces/renderkit/html/PanelMenuItemRenderer.java
===================================================================
--- trunk/ui/output/ui/src/main/java/org/richfaces/renderkit/html/PanelMenuItemRenderer.java (rev 0)
+++ trunk/ui/output/ui/src/main/java/org/richfaces/renderkit/html/PanelMenuItemRenderer.java 2010-10-31 20:24:22 UTC (rev 19806)
@@ -0,0 +1,96 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright ${year}, 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.renderkit.html;
+
+import org.ajax4jsf.javascript.JSObject;
+import org.richfaces.component.AbstractPanelMenuItem;
+import org.richfaces.component.html.HtmlPanelMenuItem;
+
+import javax.faces.component.UIComponent;
+import javax.faces.context.FacesContext;
+import javax.faces.context.ResponseWriter;
+import java.io.IOException;
+import java.util.HashMap;
+import java.util.Map;
+
+import static org.richfaces.component.util.HtmlUtil.concatClasses;
+import static org.richfaces.renderkit.html.TogglePanelRenderer.addEventOption;
+import static org.richfaces.renderkit.html.TogglePanelRenderer.getAjaxOptions;
+
+/**
+ * @author akolonitsky
+ * @since 2010-10-25
+ */
+public class PanelMenuItemRenderer extends DivPanelRenderer {
+
+ public static final String UNSELECT = "unselect";
+ public static final String SELECT = "select";
+ public static final String BEFORE_SELECT = "beforeselect";
+
+ @Override
+ protected void doEncodeBegin(ResponseWriter writer, FacesContext context, UIComponent component) throws IOException {
+ super.doEncodeBegin(writer, context, component);
+
+ writer.writeText(((AbstractPanelMenuItem) component).getLabel(), null);
+ }
+
+ @Override
+ protected String getStyleClass(UIComponent component) {
+ return concatClasses("rf-pm-itm", attributeAsString(component, "styleClass"));
+ }
+
+ @Override
+ protected JSObject getScriptObject(FacesContext context, UIComponent component) {
+ return new JSObject("RichFaces.ui.PanelMenuItem",
+ component.getClientId(), getScriptObjectOptions(context, component));
+ }
+
+ @Override
+ protected Map<String, Object> getScriptObjectOptions(FacesContext context, UIComponent component) {
+ HtmlPanelMenuItem panelMenuItem = (HtmlPanelMenuItem) component;
+
+ Map<String, Object> options = new HashMap<String, Object>();
+ options.put("ajax", getAjaxOptions(context, panelMenuItem));
+ options.put("disabled", panelMenuItem.isDisabled());
+ options.put("mode", panelMenuItem.getMode());
+ options.put("name", panelMenuItem.getName());
+
+ addEventOption(context, panelMenuItem, options, UNSELECT);
+ addEventOption(context, panelMenuItem, options, SELECT);
+ addEventOption(context, panelMenuItem, options, BEFORE_SELECT);
+
+ return options;
+ }
+
+ @Override
+ protected void doEncodeEnd(ResponseWriter writer, FacesContext context, UIComponent component) throws IOException {
+ super.doEncodeEnd(writer, context, component);
+ }
+
+ @Override
+ protected Class<? extends UIComponent> getComponentClass() {
+ return AbstractPanelMenuItem.class;
+ }
+}
+
Added: trunk/ui/output/ui/src/main/java/org/richfaces/renderkit/html/PanelMenuRenderer.java
===================================================================
--- trunk/ui/output/ui/src/main/java/org/richfaces/renderkit/html/PanelMenuRenderer.java (rev 0)
+++ trunk/ui/output/ui/src/main/java/org/richfaces/renderkit/html/PanelMenuRenderer.java 2010-10-31 20:24:22 UTC (rev 19806)
@@ -0,0 +1,142 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright ${year}, 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.renderkit.html;
+
+import org.ajax4jsf.context.AjaxContext;
+import org.ajax4jsf.javascript.JSObject;
+import org.richfaces.component.AbstractPanelMenu;
+import org.richfaces.component.AbstractPanelMenuItem;
+import org.richfaces.component.html.HtmlPanelMenu;
+import org.richfaces.renderkit.HtmlConstants;
+
+import javax.faces.application.ResourceDependencies;
+import javax.faces.application.ResourceDependency;
+import javax.faces.component.UIComponent;
+import javax.faces.context.FacesContext;
+import javax.faces.context.ResponseWriter;
+import java.io.IOException;
+import java.util.HashMap;
+import java.util.Map;
+
+import static org.richfaces.component.util.HtmlUtil.concatClasses;
+import static org.richfaces.renderkit.html.TogglePanelRenderer.getAjaxOptions;
+import static org.richfaces.renderkit.html.TogglePanelRenderer.getValueRequestParamName;
+
+/**
+ * @author akolonitsky
+ * @since 2010-10-25
+ */
+@ResourceDependencies( { // TODO review
+ @ResourceDependency(library = "javax.faces", name = "jsf.js"),
+ @ResourceDependency(name = "jquery.js"),
+ @ResourceDependency(name = "richfaces.js"),
+ @ResourceDependency(name = "richfaces-event.js"),
+ @ResourceDependency(name = "richfaces-base-component.js"),
+ @ResourceDependency(library = "org.richfaces", name = "PanelMenu.js"),
+ @ResourceDependency(library = "org.richfaces", name = "PanelMenuItem.js"),
+ @ResourceDependency(library = "org.richfaces", name = "PanelMenuGroup.js"),
+ @ResourceDependency(library = "org.richfaces", name = "panelMenu.ecss") })
+public class PanelMenuRenderer extends DivPanelRenderer {
+
+ @Override
+ protected void doDecode(FacesContext context, UIComponent component) {
+ AbstractPanelMenu panelMenu = (AbstractPanelMenu) component;
+
+ Map<String, String> requestMap =
+ context.getExternalContext().getRequestParameterMap();
+
+ // Don't overwrite the value unless you have to!
+ String newValue = requestMap.get(getValueRequestParamName(context, component));
+ if (newValue != null) {
+ panelMenu.setSubmittedActiveItem(newValue);
+ }
+
+ String compClientId = component.getClientId(context);
+ String clientId = requestMap.get(compClientId);
+ if (clientId != null && clientId.equals(compClientId)) {
+ AbstractPanelMenuItem panelItem = panelMenu.getItem(newValue);
+ if (panelItem != null) {
+ context.getPartialViewContext().getRenderIds().add(panelItem.getClientId(context));
+
+ //TODO nick - this should be done on encode, not on decode
+ addOnCompleteParam(panelItem.getClientId(context));
+ }
+ }
+ }
+
+ protected static void addOnCompleteParam(String itemId) {
+ AjaxContext.getCurrentInstance().appendOncomplete(new StringBuilder()
+ .append("RichFaces.$('").append(itemId).append("').onCompleteHandler();").toString());
+ }
+
+ @Override
+ protected void doEncodeBegin(ResponseWriter writer, FacesContext context, UIComponent component) throws IOException {
+ super.doEncodeBegin(writer, context, component);
+
+ AbstractPanelMenu panelMenu = (AbstractPanelMenu) component;
+
+ writer.startElement(HtmlConstants.INPUT_ELEM, component);
+ writer.writeAttribute(HtmlConstants.ID_ATTRIBUTE, getValueRequestParamName(context, component), null);
+ writer.writeAttribute(HtmlConstants.NAME_ATTRIBUTE, getValueRequestParamName(context, component), null);
+ writer.writeAttribute(HtmlConstants.TYPE_ATTR, HtmlConstants.INPUT_TYPE_HIDDEN, null);
+ writer.writeAttribute(HtmlConstants.VALUE_ATTRIBUTE, panelMenu.getActiveItem(), null);
+ writer.endElement(HtmlConstants.INPUT_ELEM);
+
+ writeJavaScript(writer, context, component);
+ }
+
+ @Override
+ protected String getStyleClass(UIComponent component) {
+ return concatClasses("rf-pm", attributeAsString(component, "styleClass"));
+ }
+
+ @Override
+ protected JSObject getScriptObject(FacesContext context, UIComponent component) {
+ return new JSObject("RichFaces.ui.PanelMenu",
+ component.getClientId(), getScriptObjectOptions(context, component));
+ }
+
+ @Override
+ protected Map<String, Object> getScriptObjectOptions(FacesContext context, UIComponent component) {
+ HtmlPanelMenu panelMenu = (HtmlPanelMenu) component;
+
+ Map<String, Object> options = new HashMap<String, Object>();
+ options.put("ajax", getAjaxOptions(context, panelMenu));
+ options.put("disabled", panelMenu.isDisabled());
+ options.put("expandSingle", panelMenu.isExpandSingle());
+
+ return options;
+ }
+
+ @Override
+ protected void doEncodeEnd(ResponseWriter writer, FacesContext context, UIComponent component) throws IOException {
+ writer.endElement(HtmlConstants.DIV_ELEM);
+ }
+
+ @Override
+ protected Class<? extends UIComponent> getComponentClass() {
+ return AbstractPanelMenu.class;
+ }
+}
+
Modified: trunk/ui/output/ui/src/main/resources/META-INF/pn.faces-config.xml
===================================================================
--- trunk/ui/output/ui/src/main/resources/META-INF/pn.faces-config.xml 2010-10-31 17:38:22 UTC (rev 19805)
+++ trunk/ui/output/ui/src/main/resources/META-INF/pn.faces-config.xml 2010-10-31 20:24:22 UTC (rev 19806)
@@ -769,6 +769,186 @@
<component-class>org.richfaces.component.html.HtmlTab</component-class>
</component>
+ <component>
+ <component-type>org.richfaces.PanelMenuItem</component-type>
+ <component-class>org.richfaces.component.html.HtmlPanelMenuItem</component-class>
+ <property>
+ <description></description>
+ <property-name>icon</property-name>
+ <property-class>java.lang.String</property-class>
+ </property>
+ <property>
+ <description></description>
+ <property-name>mode</property-name>
+ <property-class>org.richfaces.PanelMenuMode</property-class>
+ </property>
+ <property>
+ <description></description>
+ <property-name>label</property-name>
+ <property-class>java.lang.String</property-class>
+ </property>
+ <property>
+ <description></description>
+ <property-name>name</property-name>
+ <property-class>java.lang.String</property-class>
+ </property>
+ <property>
+ <description></description>
+ <property-name>disabled</property-name>
+ <property-class>boolean</property-class>
+ </property>
+ <property>
+ <description></description>
+ <property-name>bypassUpdates</property-name>
+ <property-class>boolean</property-class>
+ </property>
+ <property>
+ <description></description>
+ <property-name>limitToList</property-name>
+ <property-class>boolean</property-class>
+ </property>
+ <property>
+ <description></description>
+ <property-name>data</property-name>
+ <property-class>java.lang.Object</property-class>
+ </property>
+ <property>
+ <description></description>
+ <property-name>status</property-name>
+ <property-class>java.lang.String</property-class>
+ </property>
+ <property>
+ <description></description>
+ <property-name>execute</property-name>
+ <property-class>java.lang.Object</property-class>
+ </property>
+ <property>
+ <description></description>
+ <property-name>render</property-name>
+ <property-class>java.lang.Object</property-class>
+ </property>
+
+ </component>
+ <component>
+ <component-type>org.richfaces.PanelMenuGroup</component-type>
+ <component-class>org.richfaces.component.html.HtmlPanelMenuGroup</component-class>
+ <property>
+ <description></description>
+ <property-name>expanded</property-name>
+ <property-class>boolean</property-class>
+ </property>
+ <property>
+ <description></description>
+ <property-name>expandSingle</property-name>
+ <property-class>boolean</property-class>
+ </property>
+ <property>
+ <description></description>
+ <property-name>collapseEvent</property-name>
+ <property-class>java.lang.String</property-class>
+ </property>
+ <property>
+ <description></description>
+ <property-name>expandEvent</property-name>
+ <property-class>java.lang.String</property-class>
+ </property>
+ <property>
+ <description></description>
+ <property-name>iconCollapsed</property-name>
+ <property-class>java.lang.String</property-class>
+ </property>
+ <property>
+ <description></description>
+ <property-name>iconExpanded</property-name>
+ <property-class>java.lang.String</property-class>
+ </property>
+ <property>
+ <description></description>
+ <property-name>changeExpandListener</property-name>
+ <property-class>java.lang.String</property-class>
+ </property>
+
+ </component>
+ <component>
+ <component-type>org.richfaces.PanelMenu</component-type>
+ <component-class>org.richfaces.component.html.HtmlPanelMenu</component-class>
+ <property>
+ <description></description>
+ <property-name>disabled</property-name>
+ <property-class>boolean</property-class>
+ </property>
+ <property>
+ <description></description>
+ <property-name>expandEvent</property-name>
+ <property-class>java.lang.String</property-class>
+ </property>
+ <property>
+ <description></description>
+ <property-name>collapseEvent</property-name>
+ <property-class>java.lang.String</property-class>
+ </property>
+ <property>
+ <description></description>
+ <property-name>groupMode</property-name>
+ <property-class>org.richfaces.ExpandMode</property-class>
+ </property>
+ <property>
+ <description></description>
+ <property-name>expandSingle</property-name>
+ <property-class>boolean</property-class>
+ </property>
+ <property>
+ <description></description>
+ <property-name>itemMode</property-name>
+ <property-class>org.richfaces.PanelMenuMode</property-class>
+ </property>
+ <property>
+ <description></description>
+ <property-name>bubbleSelection</property-name>
+ <property-class>boolean</property-class>
+ </property>
+ <property>
+ <description></description>
+ <property-name>activeItem</property-name>
+ <property-class>java.lang.String</property-class>
+ </property>
+ <property>
+ <description></description>
+ <property-name>itemChangeListener</property-name>
+ <property-class>java.lang.String</property-class>
+ </property>
+ <property>
+ <description></description>
+ <property-name>bypassUpdates</property-name>
+ <property-class>boolean</property-class>
+ </property>
+ <property>
+ <description></description>
+ <property-name>limitToList</property-name>
+ <property-class>boolean</property-class>
+ </property>
+ <property>
+ <description></description>
+ <property-name>data</property-name>
+ <property-class>java.lang.Object</property-class>
+ </property>
+ <property>
+ <description></description>
+ <property-name>status</property-name>
+ <property-class>java.lang.String</property-class>
+ </property>
+ <property>
+ <description></description>
+ <property-name>execute</property-name>
+ <property-class>java.lang.Object</property-class>
+ </property>
+ <property>
+ <description></description>
+ <property-name>render</property-name>
+ <property-class>java.lang.Object</property-class>
+ </property>
+ </component>
+
<render-kit>
<render-kit-id>HTML_BASIC</render-kit-id>
<renderer>
@@ -839,6 +1019,22 @@
</renderer-extension>
</renderer>
+ <renderer>
+ <component-family>org.richfaces.PanelMenuItem</component-family>
+ <renderer-type>org.richfaces.PanelMenuItem</renderer-type>
+ <renderer-class>org.richfaces.renderkit.html.PanelMenuItemRenderer</renderer-class>
+ </renderer>
+ <renderer>
+ <component-family>org.richfaces.PanelMenuGroup</component-family>
+ <renderer-type>org.richfaces.PanelMenuGroup</renderer-type>
+ <renderer-class>org.richfaces.renderkit.html.PanelMenuGroupRenderer</renderer-class>
+ </renderer>
+ <renderer>
+ <component-family>org.richfaces.PanelMenu</component-family>
+ <renderer-type>org.richfaces.PanelMenu</renderer-type>
+ <renderer-class>org.richfaces.renderkit.html.PanelMenuRenderer</renderer-class>
+ </renderer>
+
<client-behavior-renderer>
<client-behavior-renderer-type>org.richfaces.component.behavior.ToggleControl</client-behavior-renderer-type>
<client-behavior-renderer-class>org.richfaces.renderkit.html.ToggleControlRenderer</client-behavior-renderer-class>
Modified: trunk/ui/output/ui/src/main/resources/META-INF/pn.taglib.xml
===================================================================
--- trunk/ui/output/ui/src/main/resources/META-INF/pn.taglib.xml 2010-10-31 17:38:22 UTC (rev 19805)
+++ trunk/ui/output/ui/src/main/resources/META-INF/pn.taglib.xml 2010-10-31 20:24:22 UTC (rev 19806)
@@ -50,8 +50,615 @@
</component>
</tag>
+ <tag>
+ <tag-name>panelMenuItem</tag-name>
+ <component>
+ <component-type>org.richfaces.PanelMenuItem</component-type>
+ <renderer-type>org.richfaces.PanelMenuItem</renderer-type>
+ </component>
+ <attribute>
+ <description></description>
+ <name>icon</name>
+ <type>java.lang.String</type>
+ </attribute>
+ <attribute>
+ <description></description>
+ <name>mode</name>
+ <type>org.richfaces.PanelMenuMode</type>
+ </attribute>
+ <attribute>
+ <description></description>
+ <name>label</name>
+ <type>java.lang.String</type>
+ </attribute>
+ <attribute>
+ <description></description>
+ <name>name</name>
+ <type>java.lang.String</type>
+ </attribute>
+ <attribute>
+ <description></description>
+ <name>disabled</name>
+ <type>boolean</type>
+ </attribute>
+ <attribute>
+ <description></description>
+ <name>bypassUpdates</name>
+ <type>boolean</type>
+ </attribute>
+ <attribute>
+ <description></description>
+ <name>limitToList</name>
+ <type>boolean</type>
+ </attribute>
+ <attribute>
+ <description></description>
+ <name>data</name>
+ <type>java.lang.Object</type>
+ </attribute>
+ <attribute>
+ <description></description>
+ <name>status</name>
+ <type>java.lang.String</type>
+ </attribute>
+ <attribute>
+ <description></description>
+ <name>execute</name>
+ <type>java.lang.Object</type>
+ </attribute>
+ <attribute>
+ <description></description>
+ <name>render</name>
+ <type>java.lang.Object</type>
+ </attribute>
+ <attribute>
+ <description></description>
+ <name>id</name>
+ <type>java.lang.String</type>
+ </attribute>
+ <attribute>
+ <description></description>
+ <name>binding</name>
+ <type>javax.faces.component.UIComponent</type>
+ </attribute>
+ <attribute>
+ <description></description>
+ <name>rendered</name>
+ <type>boolean</type>
+ </attribute>
+ <attribute>
+ <description></description>
+ <name>disabledClass</name>
+ <type>java.lang.String</type>
+ </attribute>
+ <attribute>
+ <description></description>
+ <name>disabledStyle</name>
+ <type>java.lang.String</type>
+ </attribute>
+ <attribute>
+ <description></description>
+ <name>hoverClass</name>
+ <type>java.lang.String</type>
+ </attribute>
+ <attribute>
+ <description></description>
+ <name>hoverStyle</name>
+ <type>java.lang.String</type>
+ </attribute>
+ <attribute>
+ <description></description>
+ <name>iconClass</name>
+ <type>java.lang.String</type>
+ </attribute>
+ <attribute>
+ <description></description>
+ <name>iconDisabled</name>
+ <type>java.lang.String</type>
+ </attribute>
+ <attribute>
+ <description></description>
+ <name>iconStyle</name>
+ <type>java.lang.String</type>
+ </attribute>
+ <attribute>
+ <description></description>
+ <name>style</name>
+ <type>java.lang.String</type>
+ </attribute>
+ <attribute>
+ <description></description>
+ <name>styleClass</name>
+ <type>java.lang.String</type>
+ </attribute>
+ <attribute>
+ <description></description>
+ <name>onbeforedomupdate</name>
+ <type>java.lang.String</type>
+ </attribute>
+ <attribute>
+ <description></description>
+ <name>oncomplete</name>
+ <type>java.lang.String</type>
+ </attribute>
+ <attribute>
+ <description></description>
+ <name>onclick</name>
+ <type>java.lang.String</type>
+ </attribute>
+ <attribute>
+ <description></description>
+ <name>ondblclick</name>
+ <type>java.lang.String</type>
+ </attribute>
+ <attribute>
+ <description></description>
+ <name>onmousedown</name>
+ <type>java.lang.String</type>
+ </attribute>
+ <attribute>
+ <description></description>
+ <name>onmousemove</name>
+ <type>java.lang.String</type>
+ </attribute>
+ <attribute>
+ <description></description>
+ <name>onmouseout</name>
+ <type>java.lang.String</type>
+ </attribute>
+ <attribute>
+ <description></description>
+ <name>onmouseover</name>
+ <type>java.lang.String</type>
+ </attribute>
+ <attribute>
+ <description></description>
+ <name>onmouseup</name>
+ <type>java.lang.String</type>
+ </attribute>
+ <attribute>
+ <description></description>
+ <name>onunselect</name>
+ <type>java.lang.String</type>
+ </attribute>
+ <attribute>
+ <description></description>
+ <name>onselect</name>
+ <type>java.lang.String</type>
+ </attribute>
+ <attribute>
+ <description></description>
+ <name>onbeforeselect</name>
+ <type>java.lang.String</type>
+ </attribute>
+
+ </tag>
<tag>
+ <tag-name>panelMenuGroup</tag-name>
+ <component>
+ <component-type>org.richfaces.PanelMenuGroup</component-type>
+ <renderer-type>org.richfaces.PanelMenuGroup</renderer-type>
+
+ </component>
+ <attribute>
+ <description></description>
+ <name>expanded</name>
+ <type>boolean</type>
+ </attribute>
+ <attribute>
+ <description></description>
+ <name>expandSingle</name>
+ <type>boolean</type>
+ </attribute>
+ <attribute>
+ <description></description>
+ <name>collapseEvent</name>
+ <type>java.lang.String</type>
+ </attribute>
+ <attribute>
+ <description></description>
+ <name>expandEvent</name>
+ <type>java.lang.String</type>
+ </attribute>
+ <attribute>
+ <description></description>
+ <name>iconCollapsed</name>
+ <type>java.lang.String</type>
+ </attribute>
+ <attribute>
+ <description></description>
+ <name>iconExpanded</name>
+ <type>java.lang.String</type>
+ </attribute>
+ <attribute>
+ <description></description>
+ <name>changeExpandListener</name>
+ <type>java.lang.String</type>
+ </attribute>
+ <attribute>
+ <description></description>
+ <name>icon</name>
+ <type>java.lang.String</type>
+ </attribute>
+ <attribute>
+ <description></description>
+ <name>mode</name>
+ <type>org.richfaces.PanelMenuMode</type>
+ </attribute>
+ <attribute>
+ <description></description>
+ <name>label</name>
+ <type>java.lang.String</type>
+ </attribute>
+ <attribute>
+ <description></description>
+ <name>name</name>
+ <type>java.lang.String</type>
+ </attribute>
+ <attribute>
+ <description></description>
+ <name>disabled</name>
+ <type>boolean</type>
+ </attribute>
+ <attribute>
+ <description></description>
+ <name>bypassUpdates</name>
+ <type>boolean</type>
+ </attribute>
+ <attribute>
+ <description></description>
+ <name>limitToList</name>
+ <type>boolean</type>
+ </attribute>
+ <attribute>
+ <description></description>
+ <name>data</name>
+ <type>java.lang.Object</type>
+ </attribute>
+ <attribute>
+ <description></description>
+ <name>status</name>
+ <type>java.lang.String</type>
+ </attribute>
+ <attribute>
+ <description></description>
+ <name>execute</name>
+ <type>java.lang.Object</type>
+ </attribute>
+ <attribute>
+ <description></description>
+ <name>render</name>
+ <type>java.lang.Object</type>
+ </attribute>
+ <attribute>
+ <description></description>
+ <name>id</name>
+ <type>java.lang.String</type>
+ </attribute>
+ <attribute>
+ <description></description>
+ <name>binding</name>
+ <type>javax.faces.component.UIComponent</type>
+ </attribute>
+ <attribute>
+ <description></description>
+ <name>rendered</name>
+ <type>boolean</type>
+ </attribute>
+ <attribute>
+ <description></description>
+ <name>oncollapse</name>
+ <type>java.lang.String</type>
+ </attribute>
+ <attribute>
+ <description></description>
+ <name>onexpand</name>
+ <type>java.lang.String</type>
+ </attribute>
+ <attribute>
+ <description></description>
+ <name>onswitch</name>
+ <type>java.lang.String</type>
+ </attribute>
+ <attribute>
+ <description></description>
+ <name>onbeforecollapse</name>
+ <type>java.lang.String</type>
+ </attribute>
+ <attribute>
+ <description></description>
+ <name>onbeforeexpand</name>
+ <type>java.lang.String</type>
+ </attribute>
+ <attribute>
+ <description></description>
+ <name>onbeforeswitch</name>
+ <type>java.lang.String</type>
+ </attribute>
+
+ </tag>
+ <tag>
+ <tag-name>panelMenu</tag-name>
+ <component>
+ <component-type>org.richfaces.PanelMenu</component-type>
+ <renderer-type>org.richfaces.PanelMenu</renderer-type>
+
+ </component>
+ <attribute>
+ <description></description>
+ <name>disabled</name>
+ <type>boolean</type>
+ </attribute>
+ <attribute>
+ <description></description>
+ <name>expandEvent</name>
+ <type>java.lang.String</type>
+ </attribute>
+ <attribute>
+ <description></description>
+ <name>collapseEvent</name>
+ <type>java.lang.String</type>
+ </attribute>
+ <attribute>
+ <description></description>
+ <name>groupMode</name>
+ <type>org.richfaces.ExpandMode</type>
+ </attribute>
+ <attribute>
+ <description></description>
+ <name>expandSingle</name>
+ <type>boolean</type>
+ </attribute>
+ <attribute>
+ <description></description>
+ <name>itemMode</name>
+ <type>org.richfaces.PanelMenuMode</type>
+ </attribute>
+ <attribute>
+ <description></description>
+ <name>bubbleSelection</name>
+ <type>boolean</type>
+ </attribute>
+ <attribute>
+ <description></description>
+ <name>activeItem</name>
+ <type>java.lang.String</type>
+ </attribute>
+ <attribute>
+ <description></description>
+ <name>itemChangeListener</name>
+ <type>java.lang.String</type>
+ </attribute>
+ <attribute>
+ <description></description>
+ <name>bypassUpdates</name>
+ <type>boolean</type>
+ </attribute>
+ <attribute>
+ <description></description>
+ <name>limitToList</name>
+ <type>boolean</type>
+ </attribute>
+ <attribute>
+ <description></description>
+ <name>data</name>
+ <type>java.lang.Object</type>
+ </attribute>
+ <attribute>
+ <description></description>
+ <name>status</name>
+ <type>java.lang.String</type>
+ </attribute>
+ <attribute>
+ <description></description>
+ <name>execute</name>
+ <type>java.lang.Object</type>
+ </attribute>
+ <attribute>
+ <description></description>
+ <name>render</name>
+ <type>java.lang.Object</type>
+ </attribute>
+ <attribute>
+ <description></description>
+ <name>id</name>
+ <type>java.lang.String</type>
+ </attribute>
+ <attribute>
+ <description></description>
+ <name>binding</name>
+ <type>javax.faces.component.UIComponent</type>
+ </attribute>
+ <attribute>
+ <description></description>
+ <name>rendered</name>
+ <type>boolean</type>
+ </attribute>
+ <attribute>
+ <description></description>
+ <name>style</name>
+ <type>java.lang.String</type>
+ </attribute>
+ <attribute>
+ <description></description>
+ <name>styleClass</name>
+ <type>java.lang.String</type>
+ </attribute>
+ <attribute>
+ <description></description>
+ <name>width</name>
+ <type>java.lang.String</type>
+ </attribute>
+ <attribute>
+ <description></description>
+ <name>itemClass</name>
+ <type>java.lang.String</type>
+ </attribute>
+ <attribute>
+ <description></description>
+ <name>itemHoverClass</name>
+ <type>java.lang.String</type>
+ </attribute>
+ <attribute>
+ <description></description>
+ <name>itemDisableClass</name>
+ <type>java.lang.String</type>
+ </attribute>
+ <attribute>
+ <description></description>
+ <name>itemIcon</name>
+ <type>java.lang.String</type>
+ </attribute>
+ <attribute>
+ <description></description>
+ <name>itemDisableIcon</name>
+ <type>java.lang.String</type>
+ </attribute>
+ <attribute>
+ <description></description>
+ <name>itemIconPosition</name>
+ <type>java.lang.String</type>
+ </attribute>
+ <attribute>
+ <description></description>
+ <name>topItemClass</name>
+ <type>java.lang.String</type>
+ </attribute>
+ <attribute>
+ <description></description>
+ <name>topItemHoverClass</name>
+ <type>java.lang.String</type>
+ </attribute>
+ <attribute>
+ <description></description>
+ <name>topItemDisableClass</name>
+ <type>java.lang.String</type>
+ </attribute>
+ <attribute>
+ <description></description>
+ <name>topItemIcon</name>
+ <type>java.lang.String</type>
+ </attribute>
+ <attribute>
+ <description></description>
+ <name>topItemDisableIcon</name>
+ <type>java.lang.String</type>
+ </attribute>
+ <attribute>
+ <description></description>
+ <name>topItemIconPosition</name>
+ <type>java.lang.String</type>
+ </attribute>
+ <attribute>
+ <description></description>
+ <name>groupClass</name>
+ <type>java.lang.String</type>
+ </attribute>
+ <attribute>
+ <description></description>
+ <name>groupHoverClass</name>
+ <type>java.lang.String</type>
+ </attribute>
+ <attribute>
+ <description></description>
+ <name>groupDisableClass</name>
+ <type>java.lang.String</type>
+ </attribute>
+ <attribute>
+ <description></description>
+ <name>groupCollapseIcon</name>
+ <type>java.lang.String</type>
+ </attribute>
+ <attribute>
+ <description></description>
+ <name>groupExpandIcon</name>
+ <type>java.lang.String</type>
+ </attribute>
+ <attribute>
+ <description></description>
+ <name>groupDisableIcon</name>
+ <type>java.lang.String</type>
+ </attribute>
+ <attribute>
+ <description></description>
+ <name>groupIconPosition</name>
+ <type>java.lang.String</type>
+ </attribute>
+ <attribute>
+ <description></description>
+ <name>topGroupClass</name>
+ <type>java.lang.String</type>
+ </attribute>
+ <attribute>
+ <description></description>
+ <name>topGroupHoverClass</name>
+ <type>java.lang.String</type>
+ </attribute>
+ <attribute>
+ <description></description>
+ <name>topGroupDisableClass</name>
+ <type>java.lang.String</type>
+ </attribute>
+ <attribute>
+ <description></description>
+ <name>topGroupCollapseIcon</name>
+ <type>java.lang.String</type>
+ </attribute>
+ <attribute>
+ <description></description>
+ <name>topGroupExpandIcon</name>
+ <type>java.lang.String</type>
+ </attribute>
+ <attribute>
+ <description></description>
+ <name>topGroupDisableIcon</name>
+ <type>java.lang.String</type>
+ </attribute>
+ <attribute>
+ <description></description>
+ <name>topGroupIconPosition</name>
+ <type>java.lang.String</type>
+ </attribute>
+ <attribute>
+ <description></description>
+ <name>onclick</name>
+ <type>java.lang.String</type>
+ </attribute>
+ <attribute>
+ <description></description>
+ <name>ondblclick</name>
+ <type>java.lang.String</type>
+ </attribute>
+ <attribute>
+ <description></description>
+ <name>onmousedown</name>
+ <type>java.lang.String</type>
+ </attribute>
+ <attribute>
+ <description></description>
+ <name>onmousemove</name>
+ <type>java.lang.String</type>
+ </attribute>
+ <attribute>
+ <description></description>
+ <name>onmouseout</name>
+ <type>java.lang.String</type>
+ </attribute>
+ <attribute>
+ <description></description>
+ <name>onmouseover</name>
+ <type>java.lang.String</type>
+ </attribute>
+ <attribute>
+ <description></description>
+ <name>onmouseup</name>
+ <type>java.lang.String</type>
+ </attribute>
+
+ </tag>
+
+ <tag>
<tag-name>tooltip</tag-name>
<component>
<component-type>org.richfaces.Tooltip</component-type>
Modified: trunk/ui/output/ui/src/main/resources/META-INF/resources/org.richfaces/Tab.js
===================================================================
--- trunk/ui/output/ui/src/main/resources/META-INF/resources/org.richfaces/Tab.js 2010-10-31 17:38:22 UTC (rev 19805)
+++ trunk/ui/output/ui/src/main/resources/META-INF/resources/org.richfaces/Tab.js 2010-10-31 20:24:22 UTC (rev 19806)
@@ -42,7 +42,7 @@
this.getTogglePanel().getItems()[this.index] = this;
//TODO - optimize this
- rf.Event.bindById(this.id + ":header:active", "click", this.__onHeaderClick, this)
+ rf.Event.bindById(this.id + ":header:active", "click", this.__onHeaderClick, this);
rf.Event.bindById(this.id + ":header:inactive", "click", this.__onHeaderClick, this)
},
Modified: trunk/ui/output/ui/src/main/resources/META-INF/resources/org.richfaces/TogglePanelItem.js
===================================================================
--- trunk/ui/output/ui/src/main/resources/META-INF/resources/org.richfaces/TogglePanelItem.js 2010-10-31 17:38:22 UTC (rev 19805)
+++ trunk/ui/output/ui/src/main/resources/META-INF/resources/org.richfaces/TogglePanelItem.js 2010-10-31 20:24:22 UTC (rev 19806)
@@ -111,9 +111,7 @@
// class stuff
destroy: function () {
- // rf.Event.unbindById(this.options.buttonId, "."+this.namespace);
- // rf.Event.unbindById(this.componentId, "."+this.namespace);
- // $super.destroy.call(this);
+ rf.ui.TogglePanelItem.$super.destroy.call(this);
}
});
})(jQuery, RichFaces);
Added: trunk/ui/output/ui/src/main/resources/META-INF/resources/org.richfaces/panelMenu.ecss
===================================================================
--- trunk/ui/output/ui/src/main/resources/META-INF/resources/org.richfaces/panelMenu.ecss (rev 0)
+++ trunk/ui/output/ui/src/main/resources/META-INF/resources/org.richfaces/panelMenu.ecss 2010-10-31 20:24:22 UTC (rev 19806)
@@ -0,0 +1,72 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright ${year}, 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.
+ */
+
+.rf-pm {
+ border:1px solid red;
+ padding:10px;
+}
+
+.rf-pm-itm {
+ border:1px solid #ffd700;
+}
+
+.rf-pm-itm-hov {
+ background-color:#ffd700;
+}
+
+.rf-pm-itm-sel {
+ background-color:blue;
+ color:#f5f5f5;
+}
+
+.rf-pm-gr {
+
+}
+
+.rf-pm-gr-hov {
+ background-color:green;
+ color:white;
+}
+
+.rf-pm-gr-sel {
+ background-color:blue;
+ color:#f5f5f5;
+}
+
+.rf-pm-gr-hdr {
+ border:1px solid green;
+ padding:2px;
+}
+
+.rf-pm-gr-cnt {
+ border:1px solid yellow;
+ padding:2px;
+ margin-left: 10px;
+}
+
+.rf-pm-colps {
+ display : none;
+}
+
+.rf-pm-exp {
+ display : block;
+}
Added: trunk/ui/output/ui/src/test/java/org/richfaces/component/UIPanelMenuGroupTest.java
===================================================================
--- trunk/ui/output/ui/src/test/java/org/richfaces/component/UIPanelMenuGroupTest.java (rev 0)
+++ trunk/ui/output/ui/src/test/java/org/richfaces/component/UIPanelMenuGroupTest.java 2010-10-31 20:24:22 UTC (rev 19806)
@@ -0,0 +1,51 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright ${year}, 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.component;
+
+import org.junit.Assert;
+import org.junit.Before;
+import org.junit.Test;
+
+import javax.faces.component.UIComponent;
+import java.util.List;
+
+/**
+ * @author akolonitsky
+ * @since 2010-10-25
+ */
+public class UIPanelMenuGroupTest {
+
+ private UIPanelMenuGroup panelMenuGroup;
+
+ @Before
+ public void setUp () {
+ panelMenuGroup = new UIPanelMenuGroup();
+ }
+
+ @Test
+ public void testSomething() {
+ Assert.assertNotNull(panelMenuGroup);
+ }
+}
+
Added: trunk/ui/output/ui/src/test/java/org/richfaces/component/UIPanelMenuItemTest.java
===================================================================
--- trunk/ui/output/ui/src/test/java/org/richfaces/component/UIPanelMenuItemTest.java (rev 0)
+++ trunk/ui/output/ui/src/test/java/org/richfaces/component/UIPanelMenuItemTest.java 2010-10-31 20:24:22 UTC (rev 19806)
@@ -0,0 +1,51 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright ${year}, 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.component;
+
+import org.junit.Assert;
+import org.junit.Before;
+import org.junit.Test;
+
+import javax.faces.component.UIComponent;
+import java.util.List;
+
+/**
+ * @author akolonitsky
+ * @since 2010-10-25
+ */
+public class UIPanelMenuItemTest {
+
+ private UIPanelMenuItem panelMenuItem;
+
+ @Before
+ public void setUp () {
+ panelMenuItem = new UIPanelMenuItem();
+ }
+
+ @Test
+ public void testSomething() {
+ Assert.assertNotNull(panelMenuItem);
+ }
+}
+
Added: trunk/ui/output/ui/src/test/java/org/richfaces/component/UIPanelMenuTest.java
===================================================================
--- trunk/ui/output/ui/src/test/java/org/richfaces/component/UIPanelMenuTest.java (rev 0)
+++ trunk/ui/output/ui/src/test/java/org/richfaces/component/UIPanelMenuTest.java 2010-10-31 20:24:22 UTC (rev 19806)
@@ -0,0 +1,51 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright ${year}, 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.component;
+
+import org.junit.Assert;
+import org.junit.Before;
+import org.junit.Test;
+
+import javax.faces.component.UIComponent;
+import java.util.List;
+
+/**
+ * @author akolonitsky
+ * @since 2010-10-25
+ */
+public class UIPanelMenuTest {
+
+ private UIPanelMenu panelMenu;
+
+ @Before
+ public void setUp () {
+ panelMenu = new UIPanelMenu();
+ }
+
+ @Test
+ public void testSomething() {
+ Assert.assertNotNull(panelMenu);
+ }
+}
+
Added: trunk/ui/output/ui/src/test/java/org/richfaces/component/UITogglePanelTest.java
===================================================================
--- trunk/ui/output/ui/src/test/java/org/richfaces/component/UITogglePanelTest.java (rev 0)
+++ trunk/ui/output/ui/src/test/java/org/richfaces/component/UITogglePanelTest.java 2010-10-31 20:24:22 UTC (rev 19806)
@@ -0,0 +1,50 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright ${year}, 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.component;
+
+import org.junit.Assert;
+import org.junit.Before;
+import org.junit.Test;
+
+import javax.faces.component.UIComponent;
+import java.util.List;
+
+/**
+ * @author akolonitsky
+ * @since 2010-10-19
+ */
+public class UITogglePanelTest {
+
+ private UITogglePanel togglePanel;
+
+ @Before
+ public void setUp () {
+ togglePanel = new UITogglePanel();
+ }
+
+ @Test
+ public void testSomething() {
+ Assert.assertNotNull(togglePanel);
+ }
+}
+
Modified: trunk/ui/output/ui/src/test/java/org/richfaces/renderkit/html/IgnoreScriptsContent.java
===================================================================
--- trunk/ui/output/ui/src/test/java/org/richfaces/renderkit/html/IgnoreScriptsContent.java 2010-10-31 17:38:22 UTC (rev 19805)
+++ trunk/ui/output/ui/src/test/java/org/richfaces/renderkit/html/IgnoreScriptsContent.java 2010-10-31 20:24:22 UTC (rev 19806)
@@ -34,17 +34,7 @@
* @since Oct 22, 2010
*/
public class IgnoreScriptsContent implements DifferenceListener {
- private static final int[] IGNORE = new int[] {
- DifferenceConstants.HAS_DOCTYPE_DECLARATION_ID,
- DifferenceConstants.DOCTYPE_NAME_ID,
- DifferenceConstants.DOCTYPE_PUBLIC_ID_ID,
- DifferenceConstants.DOCTYPE_SYSTEM_ID_ID
- };
- static {
- Arrays.sort(IGNORE);
- }
-
public int differenceFound(Difference difference) {
if (DifferenceConstants.TEXT_VALUE_ID == difference.getId()
&& !"script".equalsIgnoreCase(difference.getTestNodeDetail().getNode().getLocalName())) {
Added: trunk/ui/output/ui/src/test/java/org/richfaces/renderkit/html/PanelMenuGroupRendererTest.java
===================================================================
--- trunk/ui/output/ui/src/test/java/org/richfaces/renderkit/html/PanelMenuGroupRendererTest.java (rev 0)
+++ trunk/ui/output/ui/src/test/java/org/richfaces/renderkit/html/PanelMenuGroupRendererTest.java 2010-10-31 20:24:22 UTC (rev 19806)
@@ -0,0 +1,50 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright ${year}, 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.renderkit.html;
+
+import org.junit.Test;
+import org.xml.sax.SAXException;
+
+import java.io.IOException;
+
+ /**
+ * @author akolonitsky
+ * @since 2010-10-25
+ */
+public class PanelMenuGroupRendererTest extends RendererTestBase {
+
+ @Test
+ public void testEmpty() throws IOException, SAXException {
+ doTest("panelMenuGroup", "f:panelMenuGroup");
+ }
+
+ @Test
+ public void testExpanded() throws IOException, SAXException {
+ doTest("panelMenuGroup-expanded", "f:panelMenuGroup");
+ }
+
+}
+
+
+
Added: trunk/ui/output/ui/src/test/java/org/richfaces/renderkit/html/PanelMenuItemRendererTest.java
===================================================================
--- trunk/ui/output/ui/src/test/java/org/richfaces/renderkit/html/PanelMenuItemRendererTest.java (rev 0)
+++ trunk/ui/output/ui/src/test/java/org/richfaces/renderkit/html/PanelMenuItemRendererTest.java 2010-10-31 20:24:22 UTC (rev 19806)
@@ -0,0 +1,45 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright ${year}, 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.renderkit.html;
+
+import org.junit.Test;
+import org.xml.sax.SAXException;
+
+import java.io.IOException;
+
+ /**
+ * @author akolonitsky
+ * @since 2010-10-25
+ */
+public class PanelMenuItemRendererTest extends RendererTestBase {
+
+ @Test
+ public void testDoEncode() throws IOException, SAXException {
+ doTest("panelMenuItem", "f:panelMenuItem");
+ }
+
+}
+
+
+
Modified: trunk/ui/output/ui/src/test/java/org/richfaces/renderkit/html/PanelMenuRendererTest.java
===================================================================
--- trunk/ui/output/ui/src/test/java/org/richfaces/renderkit/html/PanelMenuRendererTest.java 2010-10-31 17:38:22 UTC (rev 19805)
+++ trunk/ui/output/ui/src/test/java/org/richfaces/renderkit/html/PanelMenuRendererTest.java 2010-10-31 20:24:22 UTC (rev 19806)
@@ -23,7 +23,6 @@
package org.richfaces.renderkit.html;
-import org.junit.Ignore;
import org.junit.Test;
import org.xml.sax.SAXException;
@@ -36,9 +35,8 @@
public class PanelMenuRendererTest extends RendererTestBase {
@Test
- @Ignore
public void testDoEncode() throws IOException, SAXException {
- doTest("panelMenu", "panelMenu");
+ doTest("panelMenu", "f:panelMenu");
}
}
Modified: trunk/ui/output/ui/src/test/java/org/richfaces/renderkit/html/RendererTestBase.java
===================================================================
--- trunk/ui/output/ui/src/test/java/org/richfaces/renderkit/html/RendererTestBase.java 2010-10-31 17:38:22 UTC (rev 19805)
+++ trunk/ui/output/ui/src/test/java/org/richfaces/renderkit/html/RendererTestBase.java 2010-10-31 20:24:22 UTC (rev 19806)
@@ -60,6 +60,8 @@
environment = new HtmlUnitEnvironment();
environment.withWebRoot(new File(this.getClass().getResource(".").toURI()));
environment.start();
+
+ environment.getWebClient().setJavaScriptEnabled(false);
}
@After
@@ -82,7 +84,7 @@
return;
}
- Diff xmlDiff = new Diff(new StringReader(pageCode), new InputStreamReader(expectedPageCode));
+ Diff xmlDiff = new Diff(new InputStreamReader(expectedPageCode), new StringReader(pageCode));
xmlDiff.overrideDifferenceListener(new IgnoreScriptsContent());
Assert.assertTrue("XML was not similar:" + xmlDiff.toString() + "\n\n" + pageCode, xmlDiff.similar());
}
Modified: trunk/ui/output/ui/src/test/resources/org/richfaces/renderkit/html/panelMenu.xhtml
===================================================================
--- trunk/ui/output/ui/src/test/resources/org/richfaces/renderkit/html/panelMenu.xhtml 2010-10-31 17:38:22 UTC (rev 19805)
+++ trunk/ui/output/ui/src/test/resources/org/richfaces/renderkit/html/panelMenu.xhtml 2010-10-31 20:24:22 UTC (rev 19806)
@@ -37,9 +37,7 @@
<h:body>
<h:form id="f" style="border:blue solid thin;">
- <pn:panelMenu id="panelMenu">
- <!-- TODO -->
- </pn:panelMenu>
+ <pn:panelMenu id="panelMenu"></pn:panelMenu>
</h:form>
</h:body>
</html>
Modified: trunk/ui/output/ui/src/test/resources/org/richfaces/renderkit/html/panelMenu.xmlunit.xml
===================================================================
--- trunk/ui/output/ui/src/test/resources/org/richfaces/renderkit/html/panelMenu.xmlunit.xml 2010-10-31 17:38:22 UTC (rev 19805)
+++ trunk/ui/output/ui/src/test/resources/org/richfaces/renderkit/html/panelMenu.xmlunit.xml 2010-10-31 20:24:22 UTC (rev 19806)
@@ -1,5 +1,7 @@
-<div id="panelMenu" class="rf-panelMenu">
- <script type="text/javascript">
- // Text between <script> ... </script> don't compared
- </script>
+<div id="f:panelMenu" class="rf-pm">
+ <input id="f:panelMenu-value" name="f:panelMenu-value" type="hidden"/>
+ <script type="text/javascript">
+ // Text
+ </script>
+
</div>
Added: trunk/ui/output/ui/src/test/resources/org/richfaces/renderkit/html/panelMenuGroup-expanded.xhtml
===================================================================
--- trunk/ui/output/ui/src/test/resources/org/richfaces/renderkit/html/panelMenuGroup-expanded.xhtml (rev 0)
+++ trunk/ui/output/ui/src/test/resources/org/richfaces/renderkit/html/panelMenuGroup-expanded.xhtml 2010-10-31 20:24:22 UTC (rev 19806)
@@ -0,0 +1,47 @@
+<?xml version='1.0' encoding='UTF-8'?>
+<!--
+ JBoss, Home of Professional Open Source
+ Copyright ${year}, 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.
+-->
+
+
+<!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:fn="http://java.sun.com/jsp/jstl/functions"
+ 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:pn="http://richfaces.org/output"
+ xmlns:rich="http://richfaces.org/rich">
+
+ <h:head>
+ <title>Richfaces PanelMenuGroup Test</title>
+ </h:head>
+
+<h:body>
+ <h:form id="f" style="border:blue solid thin;">
+ <pn:panelMenuGroup id="panelMenuGroup" expanded="true" label="Group Label">
+ <!-- TODO -->
+ </pn:panelMenuGroup>
+ </h:form>
+</h:body>
+</html>
+
+
Added: trunk/ui/output/ui/src/test/resources/org/richfaces/renderkit/html/panelMenuGroup-expanded.xmlunit.xml
===================================================================
--- trunk/ui/output/ui/src/test/resources/org/richfaces/renderkit/html/panelMenuGroup-expanded.xmlunit.xml (rev 0)
+++ trunk/ui/output/ui/src/test/resources/org/richfaces/renderkit/html/panelMenuGroup-expanded.xmlunit.xml 2010-10-31 20:24:22 UTC (rev 19806)
@@ -0,0 +1,12 @@
+<div id="f:panelMenuGroup" class="rf-pm-gr">
+ <input id="f:panelMenuGroup:expanded" name="f:panelMenuGroup:expanded" type="hidden" value="true"/>
+ <div id="f:panelMenuGroup:hdr" class="rf-pm-gr-hdr">
+ Group Label
+ </div>
+ <div id="f:panelMenuGroup:cnt" class="rf-pm-gr-cnt rf-pm-exp">
+
+ </div>
+ <script type="text/javascript">
+ // Text
+ </script>
+</div>
Added: trunk/ui/output/ui/src/test/resources/org/richfaces/renderkit/html/panelMenuGroup.xhtml
===================================================================
--- trunk/ui/output/ui/src/test/resources/org/richfaces/renderkit/html/panelMenuGroup.xhtml (rev 0)
+++ trunk/ui/output/ui/src/test/resources/org/richfaces/renderkit/html/panelMenuGroup.xhtml 2010-10-31 20:24:22 UTC (rev 19806)
@@ -0,0 +1,47 @@
+<?xml version='1.0' encoding='UTF-8'?>
+<!--
+ JBoss, Home of Professional Open Source
+ Copyright ${year}, 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.
+-->
+
+
+<!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:fn="http://java.sun.com/jsp/jstl/functions"
+ 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:pn="http://richfaces.org/output"
+ xmlns:rich="http://richfaces.org/rich">
+
+ <h:head>
+ <title>Richfaces PanelMenuGroup Test</title>
+ </h:head>
+
+<h:body>
+ <h:form id="f" style="border:blue solid thin;">
+ <pn:panelMenuGroup id="panelMenuGroup">
+ <!-- TODO -->
+ </pn:panelMenuGroup>
+ </h:form>
+</h:body>
+</html>
+
+
Added: trunk/ui/output/ui/src/test/resources/org/richfaces/renderkit/html/panelMenuGroup.xmlunit.xml
===================================================================
--- trunk/ui/output/ui/src/test/resources/org/richfaces/renderkit/html/panelMenuGroup.xmlunit.xml (rev 0)
+++ trunk/ui/output/ui/src/test/resources/org/richfaces/renderkit/html/panelMenuGroup.xmlunit.xml 2010-10-31 20:24:22 UTC (rev 19806)
@@ -0,0 +1,12 @@
+<div id="f:panelMenuGroup" class="rf-pm-gr">
+ <input id="f:panelMenuGroup:expanded" name="f:panelMenuGroup:expanded" type="hidden" value="false"/>
+ <div id="f:panelMenuGroup:hdr" class="rf-pm-gr-hdr">
+ panelMenuGroup
+ </div>
+ <div id="f:panelMenuGroup:cnt" class="rf-pm-gr-cnt rf-pm-colps">
+
+ </div>
+ <script type="text/javascript">
+ // Text
+ </script>
+</div>
Added: trunk/ui/output/ui/src/test/resources/org/richfaces/renderkit/html/panelMenuItem.xhtml
===================================================================
--- trunk/ui/output/ui/src/test/resources/org/richfaces/renderkit/html/panelMenuItem.xhtml (rev 0)
+++ trunk/ui/output/ui/src/test/resources/org/richfaces/renderkit/html/panelMenuItem.xhtml 2010-10-31 20:24:22 UTC (rev 19806)
@@ -0,0 +1,47 @@
+<?xml version='1.0' encoding='UTF-8'?>
+<!--
+ JBoss, Home of Professional Open Source
+ Copyright ${year}, 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.
+-->
+
+
+<!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:fn="http://java.sun.com/jsp/jstl/functions"
+ 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:pn="http://richfaces.org/output"
+ xmlns:rich="http://richfaces.org/rich">
+
+ <h:head>
+ <title>Richfaces PanelMenuItem Test</title>
+ </h:head>
+
+<h:body>
+ <h:form id="f" style="border:blue solid thin;">
+ <pn:panelMenuItem id="panelMenuItem">
+ <!-- TODO -->
+ </pn:panelMenuItem>
+ </h:form>
+</h:body>
+</html>
+
+
Added: trunk/ui/output/ui/src/test/resources/org/richfaces/renderkit/html/panelMenuItem.xmlunit.xml
===================================================================
--- trunk/ui/output/ui/src/test/resources/org/richfaces/renderkit/html/panelMenuItem.xmlunit.xml (rev 0)
+++ trunk/ui/output/ui/src/test/resources/org/richfaces/renderkit/html/panelMenuItem.xmlunit.xml 2010-10-31 20:24:22 UTC (rev 19806)
@@ -0,0 +1,7 @@
+<div id="f:panelMenuItem" class="rf-pm-itm">
+ panelMenuItem
+
+ <script type="text/javascript">
+ // Text
+ </script>
+</div>
14 years, 1 month
JBoss Rich Faces SVN: r19805 - trunk/examples/richfaces-showcase/src/main/webapp/richfaces/tooltip.
by richfaces-svn-commits@lists.jboss.org
Author: ilya_shaikovsky
Date: 2010-10-31 13:38:22 -0400 (Sun, 31 Oct 2010)
New Revision: 19805
Modified:
trunk/examples/richfaces-showcase/src/main/webapp/richfaces/tooltip/tooltip.xhtml
Log:
https://jira.jboss.org/browse/RF-9583
Modified: trunk/examples/richfaces-showcase/src/main/webapp/richfaces/tooltip/tooltip.xhtml
===================================================================
--- trunk/examples/richfaces-showcase/src/main/webapp/richfaces/tooltip/tooltip.xhtml 2010-10-31 17:35:36 UTC (rev 19804)
+++ trunk/examples/richfaces-showcase/src/main/webapp/richfaces/tooltip/tooltip.xhtml 2010-10-31 17:38:22 UTC (rev 19805)
@@ -5,7 +5,18 @@
xmlns:ui="http://java.sun.com/jsf/facelets">
<ui:composition>
- <p>DESC</p>
+ <p>ToolTip is a small non-modal pop-up that could be used to
+ display additional information, that is usually hidden.<br />
+ </p>
+ <p>Major toolTip features:</p>
+ <ul>
+ <li>Tool-tip content may be <b>pre-rendered</b> on a page (client
+ mode) or <b>loaded on separate Ajax request</b> (ajax mode)</li>
+ <li>In "ajax" mode <b>default content</b> could be shown while
+ request is executed</li>
+ <li>Tooltip <b>look is fully customizable</b> using both -
+ Richfaces skins and CSS style classes</li>
+ </ul>
<ui:include src="#{demoNavigator.sampleIncludeURI}" />
<ui:include src="/templates/includes/source-view.xhtml">
14 years, 1 month
JBoss Rich Faces SVN: r19804 - in trunk/examples/richfaces-showcase/src/main: webapp/richfaces/calendar and 1 other directories.
by richfaces-svn-commits@lists.jboss.org
Author: ilya_shaikovsky
Date: 2010-10-31 13:35:36 -0400 (Sun, 31 Oct 2010)
New Revision: 19804
Modified:
trunk/examples/richfaces-showcase/src/main/resources/org/richfaces/demo/data/common/navigation.xml
trunk/examples/richfaces-showcase/src/main/webapp/richfaces/calendar/calendar.xhtml
trunk/examples/richfaces-showcase/src/main/webapp/richfaces/calendar/samples/calendar-sample.xhtml
Log:
https://jira.jboss.org/browse/RF-9175
Modified: trunk/examples/richfaces-showcase/src/main/resources/org/richfaces/demo/data/common/navigation.xml
===================================================================
--- trunk/examples/richfaces-showcase/src/main/resources/org/richfaces/demo/data/common/navigation.xml 2010-10-31 17:23:23 UTC (rev 19803)
+++ trunk/examples/richfaces-showcase/src/main/resources/org/richfaces/demo/data/common/navigation.xml 2010-10-31 17:35:36 UTC (rev 19804)
@@ -401,7 +401,7 @@
<group>
<name>Inputs and Selects</name>
<demos>
- <demo>
+ <demo new="true">
<id>autocomplete</id>
<name>rich:autocomplete</name>
<samples>
@@ -409,13 +409,13 @@
<id>cachedAjax</id>
<name>Autocomplete in Cached Ajax mode</name>
</sample>
- <sample>
+ <sample new="true">
<id>clientFilter</id>
<name>Custom client filter</name>
</sample>
</samples>
</demo>
- <!--demo>
+ <demo new="true">
<id>calendar</id>
<name>rich:calendar</name>
<samples>
@@ -424,7 +424,7 @@
<name>Simple Calendar</name>
</sample>
</samples>
- </demo-->
+ </demo>
<demo>
<id>inputNumberSlider</id>
<name>rich:inputNumberSlider</name>
Modified: trunk/examples/richfaces-showcase/src/main/webapp/richfaces/calendar/calendar.xhtml
===================================================================
--- trunk/examples/richfaces-showcase/src/main/webapp/richfaces/calendar/calendar.xhtml 2010-10-31 17:23:23 UTC (rev 19803)
+++ trunk/examples/richfaces-showcase/src/main/webapp/richfaces/calendar/calendar.xhtml 2010-10-31 17:35:36 UTC (rev 19804)
@@ -5,7 +5,11 @@
xmlns:ui="http://java.sun.com/jsf/facelets">
<ui:composition>
- <p>DESC</p>
+ <p><b>rich:calendar</b> allows to select the date using monthly calendar
+ elements on pages. It is possible to use the component in a <b>popup or
+ inline mode.</b> At a popup mode Calendar is initially rendered as input for
+ date and button on the right side to call a popup. In case of an inline
+ mode, the monthly calendar is located on a page initially.</p>
<ui:include src="#{demoNavigator.sampleIncludeURI}" />
<ui:include src="/templates/includes/source-view.xhtml">
Modified: trunk/examples/richfaces-showcase/src/main/webapp/richfaces/calendar/samples/calendar-sample.xhtml
===================================================================
--- trunk/examples/richfaces-showcase/src/main/webapp/richfaces/calendar/samples/calendar-sample.xhtml 2010-10-31 17:23:23 UTC (rev 19803)
+++ trunk/examples/richfaces-showcase/src/main/webapp/richfaces/calendar/samples/calendar-sample.xhtml 2010-10-31 17:35:36 UTC (rev 19804)
@@ -5,10 +5,66 @@
xmlns:ui="http://java.sun.com/jsf/facelets"
xmlns:a4j="http://richfaces.org/a4j"
xmlns:rich="http://richfaces.org/rich">
- <rich:panel style="width:220px;">
- <f:facet name="header">
- <h:outputText value="Calendar"></h:outputText>
- </f:facet>
- <rich:calendar />
- </rich:panel>
+ <style type="text/css">
+.ecol1 {
+ vertical-align: top;
+ padding-right: 25px
+}
+
+.ecol2 {
+ vertical-align: top;
+ border-left: #ACBECE 1px solid;
+ padding-left: 10px
+}
+
+.rich-calendar-tool-btn {
+ font-family: Arial, Verdana;
+}
+</style>
+ <h:form>
+
+ <h:panelGrid id="panel" columns="2" columnClasses="ecol1, ecol2">
+ <a4j:outputPanel id="calendar" layout="block">
+ <rich:calendar value="#{calendarBean.selectedDate}"
+ locale="#{calendarBean.locale}" popup="#{calendarBean.popup}"
+ datePattern="#{calendarBean.pattern}"
+ showApplyButton="#{calendarBean.showApply}" cellWidth="24px"
+ cellHeight="22px" style="width:200px">
+ <f:convertDateTime pattern="#{calendarBean.pattern}" />
+ </rich:calendar>
+ </a4j:outputPanel>
+
+ <h:panelGrid columns="2">
+ <h:outputText value="Popup Mode:" />
+ <h:selectBooleanCheckbox value="#{calendarBean.popup}">
+ <a4j:ajax event="click" render="calendar" />
+ </h:selectBooleanCheckbox>
+ <h:outputText value="Apply Button:" />
+ <h:selectBooleanCheckbox value="#{calendarBean.showApply}">
+ <a4j:ajax event="click" render="calendar" />
+ </h:selectBooleanCheckbox>
+ <h:outputText value="Select Locale" />
+ <h:selectOneRadio value="en/US"
+ valueChangeListener="#{calendarBean.selectLocale}">
+ <a4j:ajax event="click" render="calendar" />
+ <f:selectItem itemLabel="US" itemValue="en/US" />
+ <f:selectItem itemLabel="DE" itemValue="de/DE" />
+ <f:selectItem itemLabel="FR" itemValue="fr/FR" />
+ <f:selectItem itemLabel="RU" itemValue="ru/RU" />
+ </h:selectOneRadio>
+
+ <h:outputText value="Select Date Pattern:" />
+ <h:selectOneMenu value="#{calendarBean.pattern}">
+ <a4j:ajax event="change" render="calendar" />
+ <f:selectItem itemLabel="d/M/yy HH:mm" itemValue="d/M/yy HH:mm" />
+ <f:selectItem itemLabel="dd/M/yy hh:mm a"
+ itemValue="dd/M/yy hh:mm a" />
+ <f:selectItem itemLabel="d/MMM/y" itemValue="d/MMM/y" />
+ <f:selectItem itemLabel="MMM d, yyyy" itemValue="MMM d, yyyy" />
+ </h:selectOneMenu>
+
+ </h:panelGrid>
+
+ </h:panelGrid>
+ </h:form>
</ui:composition>
\ No newline at end of file
14 years, 1 month
JBoss Rich Faces SVN: r19803 - in trunk/ui/input/ui/src/main: resources/META-INF/resources/org.richfaces and 1 other directory.
by richfaces-svn-commits@lists.jboss.org
Author: ilya_shaikovsky
Date: 2010-10-31 13:23:23 -0400 (Sun, 31 Oct 2010)
New Revision: 19803
Modified:
trunk/ui/input/ui/src/main/java/org/richfaces/renderkit/CalendarRendererBase.java
trunk/ui/input/ui/src/main/resources/META-INF/resources/org.richfaces/calendar.ecss
Log:
https://jira.jboss.org/browse/RF-9597
+ minor addition of package to resource in ecss.
Modified: trunk/ui/input/ui/src/main/java/org/richfaces/renderkit/CalendarRendererBase.java
===================================================================
--- trunk/ui/input/ui/src/main/java/org/richfaces/renderkit/CalendarRendererBase.java 2010-10-31 17:06:53 UTC (rev 19802)
+++ trunk/ui/input/ui/src/main/java/org/richfaces/renderkit/CalendarRendererBase.java 2010-10-31 17:23:23 UTC (rev 19803)
@@ -443,7 +443,11 @@
result.put(MINUTES_VALUE, minutes);
}
}
- return result;
+ if (result.size() > 0) {
+ return result;
+ } else {
+ return null;
+ }
}
private static String[] shiftDates(int minimum, int maximum, String[] labels) {
Modified: trunk/ui/input/ui/src/main/resources/META-INF/resources/org.richfaces/calendar.ecss
===================================================================
--- trunk/ui/input/ui/src/main/resources/META-INF/resources/org.richfaces/calendar.ecss 2010-10-31 17:06:53 UTC (rev 19802)
+++ trunk/ui/input/ui/src/main/resources/META-INF/resources/org.richfaces/calendar.ecss 2010-10-31 17:23:23 UTC (rev 19803)
@@ -329,7 +329,7 @@
}
.rf-ca-sp-up {
- background-image: "url(#{resource['StandardButtonBgImage']})";
+ background-image: "url(#{resource['org.richfaces.renderkit.html.images.StandardButtonBgImage']})";
height: 7px;
width: 14px;
margin: 0px 1px 1px 0px;
14 years, 1 month
JBoss Rich Faces SVN: r19802 - in trunk/examples/iteration-demo/src/main: resources/org/richfaces/demo and 1 other directories.
by richfaces-svn-commits@lists.jboss.org
Author: nbelaevski
Date: 2010-10-31 13:06:53 -0400 (Sun, 31 Oct 2010)
New Revision: 19802
Modified:
trunk/examples/iteration-demo/src/main/java/org/richfaces/demo/TreeBean.java
trunk/examples/iteration-demo/src/main/resources/org/richfaces/demo/plants.xml
trunk/examples/iteration-demo/src/main/webapp/tree.xhtml
Log:
https://jira.jboss.org/browse/RF-9315
Modified: trunk/examples/iteration-demo/src/main/java/org/richfaces/demo/TreeBean.java
===================================================================
--- trunk/examples/iteration-demo/src/main/java/org/richfaces/demo/TreeBean.java 2010-10-31 17:05:52 UTC (rev 19801)
+++ trunk/examples/iteration-demo/src/main/java/org/richfaces/demo/TreeBean.java 2010-10-31 17:06:53 UTC (rev 19802)
@@ -25,8 +25,10 @@
import java.util.List;
import javax.annotation.PostConstruct;
+import javax.faces.application.FacesMessage;
import javax.faces.bean.ManagedBean;
import javax.faces.bean.SessionScoped;
+import javax.faces.context.FacesContext;
import javax.swing.tree.TreeNode;
import org.richfaces.component.SwitchType;
@@ -49,6 +51,8 @@
private SwitchType toggleMode = SwitchType.DEFAULT;
+ private Object nodeData;
+
@PostConstruct
public void init() {
try {
@@ -75,4 +79,17 @@
public void setToggleMode(SwitchType switchType) {
this.toggleMode = switchType;
}
+
+ public Object getNodeData() {
+ return nodeData;
+ }
+
+ public void setNodeData(Object nodeData) {
+ this.nodeData = nodeData;
+ }
+
+ public void clickNode() {
+ FacesContext facesContext = FacesContext.getCurrentInstance();
+ facesContext.addMessage(null, new FacesMessage("Clicked node: " + getNodeData()));
+ }
}
Modified: trunk/examples/iteration-demo/src/main/resources/org/richfaces/demo/plants.xml
===================================================================
--- trunk/examples/iteration-demo/src/main/resources/org/richfaces/demo/plants.xml 2010-10-31 17:05:52 UTC (rev 19801)
+++ trunk/examples/iteration-demo/src/main/resources/org/richfaces/demo/plants.xml 2010-10-31 17:06:53 UTC (rev 19802)
@@ -3,7 +3,7 @@
<!-- Taken from http://www.xmlfiles.com/examples/ -->
<CATALOG>
- <PLANT>
+ <PLANT>1
<COMMON>Bloodroot</COMMON>
<BOTANICAL>Sanguinaria canadensis</BOTANICAL>
<ZONE>4</ZONE>
@@ -11,7 +11,7 @@
<PRICE>$2.44</PRICE>
<AVAILABILITY>031599</AVAILABILITY>
</PLANT>
- <PLANT>
+ <PLANT>2
<COMMON>Columbine</COMMON>
<BOTANICAL>Aquilegia canadensis</BOTANICAL>
<ZONE>3</ZONE>
@@ -19,7 +19,7 @@
<PRICE>$9.37</PRICE>
<AVAILABILITY>030699</AVAILABILITY>
</PLANT>
- <PLANT>
+ <PLANT>3
<COMMON>Marsh Marigold</COMMON>
<BOTANICAL>Caltha palustris</BOTANICAL>
<ZONE>4</ZONE>
@@ -27,7 +27,7 @@
<PRICE>$6.81</PRICE>
<AVAILABILITY>051799</AVAILABILITY>
</PLANT>
- <PLANT>
+ <PLANT>4
<COMMON>Cowslip</COMMON>
<BOTANICAL>Caltha palustris</BOTANICAL>
<ZONE>4</ZONE>
@@ -35,7 +35,7 @@
<PRICE>$9.90</PRICE>
<AVAILABILITY>030699</AVAILABILITY>
</PLANT>
- <PLANT>
+ <PLANT>5
<COMMON>Dutchman's-Breeches</COMMON>
<BOTANICAL>Diecentra cucullaria</BOTANICAL>
<ZONE>3</ZONE>
@@ -43,7 +43,7 @@
<PRICE>$6.44</PRICE>
<AVAILABILITY>012099</AVAILABILITY>
</PLANT>
- <PLANT>
+ <PLANT>6
<COMMON>Ginger, Wild</COMMON>
<BOTANICAL>Asarum canadense</BOTANICAL>
<ZONE>3</ZONE>
@@ -51,7 +51,7 @@
<PRICE>$9.03</PRICE>
<AVAILABILITY>041899</AVAILABILITY>
</PLANT>
- <PLANT>
+ <PLANT>7
<COMMON>Hepatica</COMMON>
<BOTANICAL>Hepatica americana</BOTANICAL>
<ZONE>4</ZONE>
@@ -59,7 +59,7 @@
<PRICE>$4.45</PRICE>
<AVAILABILITY>012699</AVAILABILITY>
</PLANT>
- <PLANT>
+ <PLANT>8
<COMMON>Liverleaf</COMMON>
<BOTANICAL>Hepatica americana</BOTANICAL>
<ZONE>4</ZONE>
@@ -67,7 +67,7 @@
<PRICE>$3.99</PRICE>
<AVAILABILITY>010299</AVAILABILITY>
</PLANT>
- <PLANT>
+ <PLANT>9
<COMMON>Jack-In-The-Pulpit</COMMON>
<BOTANICAL>Arisaema triphyllum</BOTANICAL>
<ZONE>4</ZONE>
@@ -75,7 +75,7 @@
<PRICE>$3.23</PRICE>
<AVAILABILITY>020199</AVAILABILITY>
</PLANT>
- <PLANT>
+ <PLANT>10
<COMMON>Mayapple</COMMON>
<BOTANICAL>Podophyllum peltatum</BOTANICAL>
<ZONE>3</ZONE>
@@ -83,7 +83,7 @@
<PRICE>$2.98</PRICE>
<AVAILABILITY>060599</AVAILABILITY>
</PLANT>
- <PLANT>
+ <PLANT>11
<COMMON>Phlox, Woodland</COMMON>
<BOTANICAL>Phlox divaricata</BOTANICAL>
<ZONE>3</ZONE>
@@ -91,7 +91,7 @@
<PRICE>$2.80</PRICE>
<AVAILABILITY>012299</AVAILABILITY>
</PLANT>
- <PLANT>
+ <PLANT>12
<COMMON>Phlox, Blue</COMMON>
<BOTANICAL>Phlox divaricata</BOTANICAL>
<ZONE>3</ZONE>
@@ -99,7 +99,7 @@
<PRICE>$5.59</PRICE>
<AVAILABILITY>021699</AVAILABILITY>
</PLANT>
- <PLANT>
+ <PLANT>13
<COMMON>Spring-Beauty</COMMON>
<BOTANICAL>Claytonia Virginica</BOTANICAL>
<ZONE>7</ZONE>
@@ -107,7 +107,7 @@
<PRICE>$6.59</PRICE>
<AVAILABILITY>020199</AVAILABILITY>
</PLANT>
- <PLANT>
+ <PLANT>14
<COMMON>Trillium</COMMON>
<BOTANICAL>Trillium grandiflorum</BOTANICAL>
<ZONE>5</ZONE>
@@ -115,7 +115,7 @@
<PRICE>$3.90</PRICE>
<AVAILABILITY>042999</AVAILABILITY>
</PLANT>
- <PLANT>
+ <PLANT>15
<COMMON>Wake Robin</COMMON>
<BOTANICAL>Trillium grandiflorum</BOTANICAL>
<ZONE>5</ZONE>
@@ -123,7 +123,7 @@
<PRICE>$3.20</PRICE>
<AVAILABILITY>022199</AVAILABILITY>
</PLANT>
- <PLANT>
+ <PLANT>16
<COMMON>Violet, Dog-Tooth</COMMON>
<BOTANICAL>Erythronium americanum</BOTANICAL>
<ZONE>4</ZONE>
@@ -131,7 +131,7 @@
<PRICE>$9.04</PRICE>
<AVAILABILITY>020199</AVAILABILITY>
</PLANT>
- <PLANT>
+ <PLANT>17
<COMMON>Trout Lily</COMMON>
<BOTANICAL>Erythronium americanum</BOTANICAL>
<ZONE>4</ZONE>
@@ -139,7 +139,7 @@
<PRICE>$6.94</PRICE>
<AVAILABILITY>032499</AVAILABILITY>
</PLANT>
- <PLANT>
+ <PLANT>18
<COMMON>Adder's-Tongue</COMMON>
<BOTANICAL>Erythronium americanum</BOTANICAL>
<ZONE>4</ZONE>
@@ -147,7 +147,7 @@
<PRICE>$9.58</PRICE>
<AVAILABILITY>041399</AVAILABILITY>
</PLANT>
- <PLANT>
+ <PLANT>19
<COMMON>Anemone</COMMON>
<BOTANICAL>Anemone blanda</BOTANICAL>
<ZONE>6</ZONE>
@@ -155,7 +155,7 @@
<PRICE>$8.86</PRICE>
<AVAILABILITY>122698</AVAILABILITY>
</PLANT>
- <PLANT>
+ <PLANT>20
<COMMON>Grecian Windflower</COMMON>
<BOTANICAL>Anemone blanda</BOTANICAL>
<ZONE>6</ZONE>
@@ -163,7 +163,7 @@
<PRICE>$9.16</PRICE>
<AVAILABILITY>071099</AVAILABILITY>
</PLANT>
- <PLANT>
+ <PLANT>21
<COMMON>Bee Balm</COMMON>
<BOTANICAL>Monarda didyma</BOTANICAL>
<ZONE>4</ZONE>
@@ -171,7 +171,7 @@
<PRICE>$4.59</PRICE>
<AVAILABILITY>050399</AVAILABILITY>
</PLANT>
- <PLANT>
+ <PLANT>22
<COMMON>Bergamont</COMMON>
<BOTANICAL>Monarda didyma</BOTANICAL>
<ZONE>4</ZONE>
@@ -179,7 +179,7 @@
<PRICE>$7.16</PRICE>
<AVAILABILITY>042799</AVAILABILITY>
</PLANT>
- <PLANT>
+ <PLANT>23
<COMMON>Black-Eyed Susan</COMMON>
<BOTANICAL>Rudbeckia hirta</BOTANICAL>
<ZONE>Annual</ZONE>
@@ -187,7 +187,7 @@
<PRICE>$9.80</PRICE>
<AVAILABILITY>061899</AVAILABILITY>
</PLANT>
- <PLANT>
+ <PLANT>24
<COMMON>Buttercup</COMMON>
<BOTANICAL>Ranunculus</BOTANICAL>
<ZONE>4</ZONE>
@@ -195,7 +195,7 @@
<PRICE>$2.57</PRICE>
<AVAILABILITY>061099</AVAILABILITY>
</PLANT>
- <PLANT>
+ <PLANT>25
<COMMON>Crowfoot</COMMON>
<BOTANICAL>Ranunculus</BOTANICAL>
<ZONE>4</ZONE>
@@ -203,7 +203,7 @@
<PRICE>$9.34</PRICE>
<AVAILABILITY>040399</AVAILABILITY>
</PLANT>
- <PLANT>
+ <PLANT>26
<COMMON>Butterfly Weed</COMMON>
<BOTANICAL>Asclepias tuberosa</BOTANICAL>
<ZONE>Annual</ZONE>
@@ -211,7 +211,7 @@
<PRICE>$2.78</PRICE>
<AVAILABILITY>063099</AVAILABILITY>
</PLANT>
- <PLANT>
+ <PLANT>27
<COMMON>Cinquefoil</COMMON>
<BOTANICAL>Potentilla</BOTANICAL>
<ZONE>Annual</ZONE>
@@ -219,7 +219,7 @@
<PRICE>$7.06</PRICE>
<AVAILABILITY>052599</AVAILABILITY>
</PLANT>
- <PLANT>
+ <PLANT>28
<COMMON>Primrose</COMMON>
<BOTANICAL>Oenothera</BOTANICAL>
<ZONE>3 - 5</ZONE>
@@ -227,7 +227,7 @@
<PRICE>$6.56</PRICE>
<AVAILABILITY>013099</AVAILABILITY>
</PLANT>
- <PLANT>
+ <PLANT>29
<COMMON>Gentian</COMMON>
<BOTANICAL>Gentiana</BOTANICAL>
<ZONE>4</ZONE>
@@ -235,7 +235,7 @@
<PRICE>$7.81</PRICE>
<AVAILABILITY>051899</AVAILABILITY>
</PLANT>
- <PLANT>
+ <PLANT>30
<COMMON>Blue Gentian</COMMON>
<BOTANICAL>Gentiana</BOTANICAL>
<ZONE>4</ZONE>
@@ -243,7 +243,7 @@
<PRICE>$8.56</PRICE>
<AVAILABILITY>050299</AVAILABILITY>
</PLANT>
- <PLANT>
+ <PLANT>31
<COMMON>Jacob's Ladder</COMMON>
<BOTANICAL>Polemonium caeruleum</BOTANICAL>
<ZONE>Annual</ZONE>
@@ -251,7 +251,7 @@
<PRICE>$9.26</PRICE>
<AVAILABILITY>022199</AVAILABILITY>
</PLANT>
- <PLANT>
+ <PLANT>32
<COMMON>Greek Valerian</COMMON>
<BOTANICAL>Polemonium caeruleum</BOTANICAL>
<ZONE>Annual</ZONE>
@@ -259,7 +259,7 @@
<PRICE>$4.36</PRICE>
<AVAILABILITY>071499</AVAILABILITY>
</PLANT>
- <PLANT>
+ <PLANT>33
<COMMON>California Poppy</COMMON>
<BOTANICAL>Eschscholzia californica</BOTANICAL>
<ZONE>Annual</ZONE>
@@ -267,7 +267,7 @@
<PRICE>$7.89</PRICE>
<AVAILABILITY>032799</AVAILABILITY>
</PLANT>
- <PLANT>
+ <PLANT>34
<COMMON>Shooting Star</COMMON>
<BOTANICAL>Dodecatheon</BOTANICAL>
<ZONE>Annual</ZONE>
@@ -275,7 +275,7 @@
<PRICE>$8.60</PRICE>
<AVAILABILITY>051399</AVAILABILITY>
</PLANT>
- <PLANT>
+ <PLANT>35
<COMMON>Snakeroot</COMMON>
<BOTANICAL>Cimicifuga</BOTANICAL>
<ZONE>Annual</ZONE>
@@ -283,7 +283,7 @@
<PRICE>$5.63</PRICE>
<AVAILABILITY>071199</AVAILABILITY>
</PLANT>
- <PLANT>
+ <PLANT>36
<COMMON>Cardinal Flower</COMMON>
<BOTANICAL>Lobelia cardinalis</BOTANICAL>
<ZONE>2</ZONE>
Modified: trunk/examples/iteration-demo/src/main/webapp/tree.xhtml
===================================================================
--- trunk/examples/iteration-demo/src/main/webapp/tree.xhtml 2010-10-31 17:05:52 UTC (rev 19801)
+++ trunk/examples/iteration-demo/src/main/webapp/tree.xhtml 2010-10-31 17:06:53 UTC (rev 19802)
@@ -11,6 +11,8 @@
</h:head>
<h:body>
+ <h:messages id="messages" />
+
<h:form>
<h:selectOneRadio value="#{treeBean.toggleMode}" onclick="submit()">
<f:selectItems value="#{treeBean.modes}" var="item" itemValue="#{item}" />
@@ -21,7 +23,11 @@
<it:tree id="tree" var="node" value="#{treeBean.rootNodes}" toggleMode="#{treeBean.toggleMode}">
<it:treeNode>
<h:panelGroup id="group">
- #{node.data}
+ <h:commandLink value="#{node.data}" action="#{treeBean.clickNode}">
+ <f:setPropertyActionListener value="#{node.data}" target="#{treeBean.nodeData}" />
+
+ <f:ajax render=":messages" />
+ </h:commandLink>
</h:panelGroup>
</it:treeNode>
</it:tree>
14 years, 1 month
JBoss Rich Faces SVN: r19801 - in sandbox/trunk/ui/tree-actual/ui/src/main/java/org/richfaces: model and 1 other directories.
by richfaces-svn-commits@lists.jboss.org
Author: nbelaevski
Date: 2010-10-31 13:05:52 -0400 (Sun, 31 Oct 2010)
New Revision: 19801
Modified:
sandbox/trunk/ui/tree-actual/ui/src/main/java/org/richfaces/component/TreeRange.java
sandbox/trunk/ui/tree-actual/ui/src/main/java/org/richfaces/model/TreeDataModelImpl.java
sandbox/trunk/ui/tree-actual/ui/src/main/java/org/richfaces/renderkit/TreeEncoderBase.java
Log:
https://jira.jboss.org/browse/RF-9315
Modified: sandbox/trunk/ui/tree-actual/ui/src/main/java/org/richfaces/component/TreeRange.java
===================================================================
--- sandbox/trunk/ui/tree-actual/ui/src/main/java/org/richfaces/component/TreeRange.java 2010-10-31 17:00:29 UTC (rev 19800)
+++ sandbox/trunk/ui/tree-actual/ui/src/main/java/org/richfaces/component/TreeRange.java 2010-10-31 17:05:52 UTC (rev 19801)
@@ -45,7 +45,7 @@
traverseAll = SwitchType.client == tree.getToggleMode();
}
- public boolean processNodeChildren(Object rowKey) {
+ public boolean shouldIterateChildren(Object rowKey) {
if (traverseAll) {
return true;
}
Modified: sandbox/trunk/ui/tree-actual/ui/src/main/java/org/richfaces/model/TreeDataModelImpl.java
===================================================================
--- sandbox/trunk/ui/tree-actual/ui/src/main/java/org/richfaces/model/TreeDataModelImpl.java 2010-10-31 17:00:29 UTC (rev 19800)
+++ sandbox/trunk/ui/tree-actual/ui/src/main/java/org/richfaces/model/TreeDataModelImpl.java 2010-10-31 17:05:52 UTC (rev 19801)
@@ -160,7 +160,7 @@
DataVisitResult visitResult = visitor.process(context, object, argument);
if (visitResult == DataVisitResult.CONTINUE) {
- if (((TreeRange) range).processNodeChildren(object)) {
+ if (((TreeRange) range).shouldIterateChildren(object)) {
Iterator<Object> childrenIterator = getChildrenIterator(context, object);
walk(context, visitor, range, argument, childrenIterator);
}
@@ -175,7 +175,7 @@
public void walk(FacesContext context, DataVisitor visitor, Range range, Object argument) {
// TODO Auto-generated method stub
- if (((TreeRange) range).processNodeChildren(null)) {
+ if (((TreeRange) range).shouldIterateChildren(null)) {
Iterator<Object> iterator = getChildrenIterator(context, null);
walk(context, visitor, range, argument, iterator);
}
Modified: sandbox/trunk/ui/tree-actual/ui/src/main/java/org/richfaces/renderkit/TreeEncoderBase.java
===================================================================
--- sandbox/trunk/ui/tree-actual/ui/src/main/java/org/richfaces/renderkit/TreeEncoderBase.java 2010-10-31 17:00:29 UTC (rev 19800)
+++ sandbox/trunk/ui/tree-actual/ui/src/main/java/org/richfaces/renderkit/TreeEncoderBase.java 2010-10-31 17:05:52 UTC (rev 19801)
@@ -29,7 +29,7 @@
import javax.faces.context.ResponseWriter;
import org.richfaces.component.AbstractTree;
-import org.richfaces.component.SwitchType;
+import org.richfaces.component.TreeRange;
import org.richfaces.component.util.HtmlUtil;
import org.richfaces.renderkit.TreeRendererBase.NodeState;
import org.richfaces.renderkit.TreeRendererBase.QueuedData;
@@ -50,7 +50,7 @@
protected final AbstractTree tree;
- private boolean traverseCollapsedNode;
+ private TreeRange treeRange;
private LinkedList<QueuedData> queuedData = new LinkedList<QueuedData>();
@@ -60,7 +60,7 @@
this.responseWriter = context.getResponseWriter();
this.tree = tree;
- this.traverseCollapsedNode = SwitchType.client.equals(tree.getToggleMode());
+ this.treeRange = (TreeRange) tree.getComponentState().getRange();
}
protected void encodeTree(Iterator<Object> childrenIterator) throws IOException {
@@ -101,7 +101,7 @@
boolean expanded = tree.isExpanded();
queuedData.add(new QueuedData(rowKey, isLastNode, expanded));
- boolean iterateChildren = traverseCollapsedNode || expanded;
+ boolean iterateChildren = treeRange.shouldIterateChildren(rowKey);
if (iterateChildren) {
encodeTree(tree.getChildrenIterator(context, rowKey));
14 years, 1 month
JBoss Rich Faces SVN: r19800 - in sandbox/trunk/ui/tree-actual/ui/src/main/java/org/richfaces: model and 1 other directory.
by richfaces-svn-commits@lists.jboss.org
Author: nbelaevski
Date: 2010-10-31 13:00:29 -0400 (Sun, 31 Oct 2010)
New Revision: 19800
Added:
sandbox/trunk/ui/tree-actual/ui/src/main/java/org/richfaces/component/TreeRange.java
Modified:
sandbox/trunk/ui/tree-actual/ui/src/main/java/org/richfaces/component/AbstractTree.java
sandbox/trunk/ui/tree-actual/ui/src/main/java/org/richfaces/model/TreeDataModelImpl.java
Log:
https://jira.jboss.org/browse/RF-9315
Modified: sandbox/trunk/ui/tree-actual/ui/src/main/java/org/richfaces/component/AbstractTree.java
===================================================================
--- sandbox/trunk/ui/tree-actual/ui/src/main/java/org/richfaces/component/AbstractTree.java 2010-10-31 16:27:50 UTC (rev 19799)
+++ sandbox/trunk/ui/tree-actual/ui/src/main/java/org/richfaces/component/AbstractTree.java 2010-10-31 17:00:29 UTC (rev 19800)
@@ -43,6 +43,7 @@
import org.ajax4jsf.model.DataComponentState;
import org.ajax4jsf.model.ExtendedDataModel;
+import org.ajax4jsf.model.Range;
import org.richfaces.application.MessageFactory;
import org.richfaces.application.ServiceTracker;
import org.richfaces.appplication.FacesMessages;
@@ -87,6 +88,16 @@
private static final Converter ROW_KEY_CONVERTER = new SequenceRowKeyConverter();
+ /**
+ * @author Nick Belaevski
+ *
+ */
+ private final class TreeComponentState implements DataComponentState {
+ public Range getRange() {
+ return new TreeRange(getFacesContext(), AbstractTree.this);
+ }
+ }
+
private enum PropertyKeys {
expanded
}
@@ -121,6 +132,10 @@
}
public boolean isExpanded() {
+ if (getRowKey() == null) {
+ return true;
+ }
+
FacesContext context = getFacesContext();
Boolean localExpandedValue = getLocalExpandedValue(context);
if (localExpandedValue != null) {
@@ -149,9 +164,6 @@
return model;
}
- /* (non-Javadoc)
- * @see org.richfaces.component.UIDataAdaptor#createComponentState()
- */
@Override
protected DataComponentState createComponentState() {
// TODO Auto-generated method stub
@@ -278,4 +290,10 @@
protected Iterator<UIComponent> dataChildren() {
return Iterators.<UIComponent>concat(super.dataChildren(), Iterators.singletonIterator(treeDecoderHelper));
}
+
+ @Override
+ public DataComponentState getComponentState() {
+ return new TreeComponentState();
+ }
+
}
Added: sandbox/trunk/ui/tree-actual/ui/src/main/java/org/richfaces/component/TreeRange.java
===================================================================
--- sandbox/trunk/ui/tree-actual/ui/src/main/java/org/richfaces/component/TreeRange.java (rev 0)
+++ sandbox/trunk/ui/tree-actual/ui/src/main/java/org/richfaces/component/TreeRange.java 2010-10-31 17:00:29 UTC (rev 19800)
@@ -0,0 +1,57 @@
+/*
+ * 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.component;
+
+import javax.faces.context.FacesContext;
+
+import org.ajax4jsf.model.Range;
+
+/**
+ * @author Nick Belaevski
+ *
+ */
+public class TreeRange implements Range {
+
+ private FacesContext facesContext;
+
+ private AbstractTree tree;
+
+ private boolean traverseAll;
+
+ public TreeRange(FacesContext facesContext, AbstractTree tree) {
+ super();
+ this.facesContext = facesContext;
+ this.tree = tree;
+
+ traverseAll = SwitchType.client == tree.getToggleMode();
+ }
+
+ public boolean processNodeChildren(Object rowKey) {
+ if (traverseAll) {
+ return true;
+ }
+
+ tree.setRowKey(facesContext, rowKey);
+ return tree.isExpanded();
+ }
+
+}
Modified: sandbox/trunk/ui/tree-actual/ui/src/main/java/org/richfaces/model/TreeDataModelImpl.java
===================================================================
--- sandbox/trunk/ui/tree-actual/ui/src/main/java/org/richfaces/model/TreeDataModelImpl.java 2010-10-31 16:27:50 UTC (rev 19799)
+++ sandbox/trunk/ui/tree-actual/ui/src/main/java/org/richfaces/model/TreeDataModelImpl.java 2010-10-31 17:00:29 UTC (rev 19800)
@@ -32,6 +32,7 @@
import org.ajax4jsf.model.DataVisitor;
import org.ajax4jsf.model.ExtendedDataModel;
import org.ajax4jsf.model.Range;
+import org.richfaces.component.TreeRange;
import com.google.common.collect.Iterators;
@@ -43,21 +44,12 @@
private static final SequenceRowKey<Integer> EMPTY_SEQUENCE_ROW_KEY = new SequenceRowKey<Integer>();
- private SwingTreeNodeImpl rootNode;
+ private SwingTreeNodeImpl<?> rootNode;
private TreeNode selectedNode;
private SequenceRowKey<Integer> selectedRowKey;
- private TreeNode walkNode;
-
- private SequenceRowKey<Integer> walkRowKey;
-
- private void setWalkContextData(TreeNode node, SequenceRowKey<Integer> key) {
- this.walkNode = node;
- this.walkRowKey = key;
- }
-
private Iterator<TreeNode> findChildren(SequenceRowKey<Integer> compositeKey) {
TreeNode treeNode = findNode(compositeKey);
@@ -92,12 +84,7 @@
@Override
public void setRowKey(Object key) {
this.selectedRowKey = (SequenceRowKey<Integer>) key;
-
- if (walkRowKey != null && walkRowKey.equals(key)) {
- this.selectedNode = walkNode;
- } else {
- this.selectedNode = findNode(selectedRowKey);
- }
+ this.selectedNode = findNode(selectedRowKey);
}
@Override
@@ -173,8 +160,10 @@
DataVisitResult visitResult = visitor.process(context, object, argument);
if (visitResult == DataVisitResult.CONTINUE) {
- Iterator<Object> childrenIterator = getChildrenIterator(context, object);
- walk(context, visitor, range, argument, childrenIterator);
+ if (((TreeRange) range).processNodeChildren(object)) {
+ Iterator<Object> childrenIterator = getChildrenIterator(context, object);
+ walk(context, visitor, range, argument, childrenIterator);
+ }
}
}
}
@@ -186,8 +175,10 @@
public void walk(FacesContext context, DataVisitor visitor, Range range, Object argument) {
// TODO Auto-generated method stub
- Iterator<Object> iterator = getChildrenIterator(context, null);
- walk(context, visitor, range, argument, iterator);
+ if (((TreeRange) range).processNodeChildren(null)) {
+ Iterator<Object> iterator = getChildrenIterator(context, null);
+ walk(context, visitor, range, argument, iterator);
+ }
}
}
14 years, 1 month
JBoss Rich Faces SVN: r19799 - in trunk/examples/iteration-demo/src/main: webapp and 1 other directory.
by richfaces-svn-commits@lists.jboss.org
Author: nbelaevski
Date: 2010-10-31 12:27:50 -0400 (Sun, 31 Oct 2010)
New Revision: 19799
Modified:
trunk/examples/iteration-demo/src/main/java/org/richfaces/demo/TreeBean.java
trunk/examples/iteration-demo/src/main/webapp/tree.xhtml
Log:
https://jira.jboss.org/browse/RF-9315
Modified: trunk/examples/iteration-demo/src/main/java/org/richfaces/demo/TreeBean.java
===================================================================
--- trunk/examples/iteration-demo/src/main/java/org/richfaces/demo/TreeBean.java 2010-10-31 16:26:17 UTC (rev 19798)
+++ trunk/examples/iteration-demo/src/main/java/org/richfaces/demo/TreeBean.java 2010-10-31 16:27:50 UTC (rev 19799)
@@ -29,6 +29,7 @@
import javax.faces.bean.SessionScoped;
import javax.swing.tree.TreeNode;
+import org.richfaces.component.SwitchType;
import org.richfaces.log.LogFactory;
import org.richfaces.log.Logger;
@@ -46,6 +47,8 @@
private List<TreeNode> rootNodes;
+ private SwitchType toggleMode = SwitchType.DEFAULT;
+
@PostConstruct
public void init() {
try {
@@ -60,5 +63,16 @@
public List<TreeNode> getRootNodes() {
return rootNodes;
}
+
+ public SwitchType[] getModes() {
+ return SwitchType.values();
+ }
+ public SwitchType getToggleMode() {
+ return toggleMode;
+ }
+
+ public void setToggleMode(SwitchType switchType) {
+ this.toggleMode = switchType;
+ }
}
Modified: trunk/examples/iteration-demo/src/main/webapp/tree.xhtml
===================================================================
--- trunk/examples/iteration-demo/src/main/webapp/tree.xhtml 2010-10-31 16:26:17 UTC (rev 19798)
+++ trunk/examples/iteration-demo/src/main/webapp/tree.xhtml 2010-10-31 16:27:50 UTC (rev 19799)
@@ -11,17 +11,23 @@
</h:head>
<h:body>
- <it:tree id="tree" var="node" value="#{treeBean.rootNodes}">
- <it:treeNode>
- <h:panelGroup id="group">
- #{node.data}
- </h:panelGroup>
- </it:treeNode>
- </it:tree>
-
<h:form>
+ <h:selectOneRadio value="#{treeBean.toggleMode}" onclick="submit()">
+ <f:selectItems value="#{treeBean.modes}" var="item" itemValue="#{item}" />
+ </h:selectOneRadio>
+ </h:form>
+
+ <h:form id="form">
+ <it:tree id="tree" var="node" value="#{treeBean.rootNodes}" toggleMode="#{treeBean.toggleMode}">
+ <it:treeNode>
+ <h:panelGroup id="group">
+ #{node.data}
+ </h:panelGroup>
+ </it:treeNode>
+ </it:tree>
+
<h:commandLink value="Re-render">
- <f:ajax render=":tree" />
+ <f:ajax render=":form:tree" execute="@all" />
</h:commandLink>
</h:form>
</h:body>
14 years, 1 month
JBoss Rich Faces SVN: r19798 - in sandbox/trunk/ui/tree-actual/ui/src/main: java/org/richfaces/renderkit and 2 other directories.
by richfaces-svn-commits@lists.jboss.org
Author: nbelaevski
Date: 2010-10-31 12:26:17 -0400 (Sun, 31 Oct 2010)
New Revision: 19798
Added:
sandbox/trunk/ui/tree-actual/ui/src/main/java/org/richfaces/component/TreeDecoderHelper.java
Modified:
sandbox/trunk/ui/tree-actual/ui/src/main/java/org/richfaces/component/AbstractTree.java
sandbox/trunk/ui/tree-actual/ui/src/main/java/org/richfaces/renderkit/TreeRendererBase.java
sandbox/trunk/ui/tree-actual/ui/src/main/resources/META-INF/resources/org.richfaces/tree.js
sandbox/trunk/ui/tree-actual/ui/src/main/templates/tree.template.xml
Log:
https://jira.jboss.org/browse/RF-9315
Modified: sandbox/trunk/ui/tree-actual/ui/src/main/java/org/richfaces/component/AbstractTree.java
===================================================================
--- sandbox/trunk/ui/tree-actual/ui/src/main/java/org/richfaces/component/AbstractTree.java 2010-10-31 15:21:51 UTC (rev 19797)
+++ sandbox/trunk/ui/tree-actual/ui/src/main/java/org/richfaces/component/AbstractTree.java 2010-10-31 16:26:17 UTC (rev 19798)
@@ -52,6 +52,7 @@
import org.richfaces.cdk.annotations.Tag;
import org.richfaces.component.util.MessageUtil;
import org.richfaces.context.ExtendedVisitContext;
+import org.richfaces.context.ExtendedVisitContextMode;
import org.richfaces.convert.SequenceRowKeyConverter;
import org.richfaces.event.TreeToggleEvent;
import org.richfaces.model.TreeDataModelImpl;
@@ -70,7 +71,7 @@
tag = @Tag(name = "tree"),
renderer = @JsfRenderer(type = "org.richfaces.TreeRenderer")
)
-public abstract class AbstractTree extends UIDataAdaptor implements MetaComponentProcessor, MetaComponentResolver, MetaComponentEncoder {
+public abstract class AbstractTree extends UIDataAdaptor implements MetaComponentResolver, MetaComponentEncoder {
public static final String COMPONENT_TYPE = "org.richfaces.Tree";
@@ -90,6 +91,8 @@
expanded
}
+ private transient TreeDecoderHelper treeDecoderHelper = new TreeDecoderHelper(this);
+
public AbstractTree() {
setRendererType("org.richfaces.TreeRenderer");
}
@@ -245,18 +248,18 @@
protected VisitResult visitDataChildrenMetaComponents(ExtendedVisitContext extendedVisitContext,
VisitCallback callback) {
- VisitResult result = extendedVisitContext.invokeMetaComponentVisitCallback(this, callback, NODE_META_COMPONENT_ID);
- if (result != VisitResult.ACCEPT) {
- return result;
+ if (ExtendedVisitContextMode.RENDER == extendedVisitContext.getVisitMode()) {
+ VisitResult result = extendedVisitContext.invokeMetaComponentVisitCallback(this, callback, NODE_META_COMPONENT_ID);
+ if (result != VisitResult.ACCEPT) {
+ return result;
+ }
}
return super.visitDataChildrenMetaComponents(extendedVisitContext, callback);
}
- public void processMetaComponent(FacesContext context, String metaComponentId) {
- if (context.getCurrentPhaseId() == PhaseId.APPLY_REQUEST_VALUES) {
- ((MetaComponentRenderer) getRenderer(context)).decodeMetaComponent(context, this, metaComponentId);
- }
+ void decodeMetaComponent(FacesContext context, String metaComponentId) {
+ ((MetaComponentRenderer) getRenderer(context)).decodeMetaComponent(context, this, metaComponentId);
}
public void encodeMetaComponent(FacesContext context, String metaComponentId) throws IOException {
@@ -270,4 +273,9 @@
return null;
}
+
+ @Override
+ protected Iterator<UIComponent> dataChildren() {
+ return Iterators.<UIComponent>concat(super.dataChildren(), Iterators.singletonIterator(treeDecoderHelper));
+ }
}
Added: sandbox/trunk/ui/tree-actual/ui/src/main/java/org/richfaces/component/TreeDecoderHelper.java
===================================================================
--- sandbox/trunk/ui/tree-actual/ui/src/main/java/org/richfaces/component/TreeDecoderHelper.java (rev 0)
+++ sandbox/trunk/ui/tree-actual/ui/src/main/java/org/richfaces/component/TreeDecoderHelper.java 2010-10-31 16:26:17 UTC (rev 19798)
@@ -0,0 +1,66 @@
+/*
+ * 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.component;
+
+import javax.faces.component.UIComponent;
+import javax.faces.component.UIComponentBase;
+import javax.faces.context.FacesContext;
+
+/**
+ * @author Nick Belaevski
+ *
+ */
+public class TreeDecoderHelper extends UIComponentBase {
+
+ public static final String HELPER_ID = "__treeDecoderHelper";
+
+ private AbstractTree tree;
+
+ public TreeDecoderHelper(AbstractTree tree) {
+ super();
+ this.tree = tree;
+
+ setId(HELPER_ID);
+ setTransient(true);
+ }
+
+ @Override
+ public UIComponent getParent() {
+ return tree;
+ }
+
+ @Override
+ public boolean isInView() {
+ return tree.isInView();
+ }
+
+ @Override
+ public String getFamily() {
+ return null;
+ }
+
+ @Override
+ public void decode(FacesContext context) {
+ super.decode(context);
+ tree.decodeMetaComponent(context, AbstractTree.NODE_META_COMPONENT_ID);
+ }
+}
Modified: sandbox/trunk/ui/tree-actual/ui/src/main/java/org/richfaces/renderkit/TreeRendererBase.java
===================================================================
--- sandbox/trunk/ui/tree-actual/ui/src/main/java/org/richfaces/renderkit/TreeRendererBase.java 2010-10-31 15:21:51 UTC (rev 19797)
+++ sandbox/trunk/ui/tree-actual/ui/src/main/java/org/richfaces/renderkit/TreeRendererBase.java 2010-10-31 16:26:17 UTC (rev 19798)
@@ -30,6 +30,7 @@
import java.util.Map;
import javax.faces.component.UIComponent;
+import javax.faces.component.UINamingContainer;
import javax.faces.context.FacesContext;
import javax.faces.context.PartialViewContext;
@@ -39,6 +40,7 @@
import org.richfaces.component.AbstractTreeNode;
import org.richfaces.component.MetaComponentResolver;
import org.richfaces.component.SwitchType;
+import org.richfaces.component.TreeDecoderHelper;
import org.richfaces.event.TreeToggleEvent;
import org.richfaces.log.Logger;
import org.richfaces.log.RichfacesLogger;
@@ -56,12 +58,8 @@
private static final JSReference TOGGLE_SOURCE = new JSReference("toggleSource");
- private static final String TREE_TOGGLE_ID_PARAM = "org.richfaces.Tree.TREE_TOGGLE_ID";
-
- private static final String NODE_TOGGLE_ID_PARAM = "org.richfaces.Tree.NODE_TOGGLE_ID";
+ private static final String NEW_NODE_TOGGLE_STATE = "__NEW_NODE_TOGGLE_STATE";
- private static final String NEW_STATE_PARAM = "org.richfaces.Tree.NEW_STATE";
-
enum NodeState {
expanded("rf-tr-nd-exp", "rf-trn-hnd-exp", "rf-trn-ico-nd"),
collapsed("rf-tr-nd-colps", "rf-trn-hnd-colps", "rf-trn-ico-nd"),
@@ -136,10 +134,15 @@
new TreeEncoderFull(context, tree).encode();
}
+ protected String getDecoderHelperId(FacesContext facesContext) {
+ return UINamingContainer.getSeparatorChar(facesContext) + TreeDecoderHelper.HELPER_ID;
+ }
+
protected String getAjaxToggler(FacesContext context, UIComponent component) {
AbstractTree tree = (AbstractTree) component;
- if (!SwitchType.ajax.equals(tree.getToggleMode())) {
+ SwitchType toggleMode = tree.getToggleMode();
+ if (toggleMode != SwitchType.ajax) {
return null;
}
@@ -152,16 +155,9 @@
if (!eventOptions.isEmpty()) {
ajaxFunction.addParameter(eventOptions);
}
-
return ajaxFunction.toScript();
}
-
- @Override
- protected void doDecode(FacesContext context, UIComponent component) {
- super.doDecode(context, component);
-
- }
-
+
/* (non-Javadoc)
* @see org.richfaces.renderkit.MetaComponentRenderer#encodeMetaComponent(javax.faces.context.FacesContext, javax.faces.component.UIComponent, java.lang.String)
*/
@@ -182,12 +178,12 @@
public void decodeMetaComponent(FacesContext context, UIComponent component, String metaComponentId) {
if (NODE_META_COMPONENT_ID.equals(metaComponentId)) {
final Map<String, String> map = context.getExternalContext().getRequestParameterMap();
- String toggleId = map.get(NODE_TOGGLE_ID_PARAM);
- if (component.getClientId(context).equals(toggleId)) {
+ String newToggleState = map.get(component.getClientId(context) + NEW_NODE_TOGGLE_STATE);
+ if (newToggleState != null) {
AbstractTree tree = (AbstractTree) component;
AbstractTreeNode treeNode = tree.getTreeNodeComponent();
- boolean expanded = Boolean.valueOf(map.get(NEW_STATE_PARAM));
+ boolean expanded = Boolean.valueOf(newToggleState);
if (tree.isExpanded() ^ expanded) {
new TreeToggleEvent(treeNode, expanded).queue();
}
Modified: sandbox/trunk/ui/tree-actual/ui/src/main/resources/META-INF/resources/org.richfaces/tree.js
===================================================================
--- sandbox/trunk/ui/tree-actual/ui/src/main/resources/META-INF/resources/org.richfaces/tree.js 2010-10-31 15:21:51 UTC (rev 19797)
+++ sandbox/trunk/ui/tree-actual/ui/src/main/resources/META-INF/resources/org.richfaces/tree.js 2010-10-31 16:26:17 UTC (rev 19798)
@@ -28,11 +28,7 @@
});
}
- var TOGGLE_TREE_ID_PARAM = "org.richfaces.Tree.TREE_TOGGLE_ID";
-
- var TOGGLE_NODE_ID_PARAM = "org.richfaces.Tree.NODE_TOGGLE_ID";
-
- var TOGGLE_NEW_STATE_PARAM = "org.richfaces.Tree.NEW_STATE";
+ var NEW_NODE_TOGGLE_STATE = "__NEW_NODE_TOGGLE_STATE"
var TREE_CLASSES = ["rf-tr-nd-colps", "rf-tr-nd-exp"];
@@ -123,6 +119,16 @@
}
},
+ __updateClientToggleStateInput: function(newState) {
+ if (!this.__clientStateInput) {
+ this.__clientStateInput = $("<input type='hidden' />").appendTo(this.elt)
+ .attr({name: this.elt.attr("id") + NEW_NODE_TOGGLE_STATE});
+ }
+
+ this.__clientStateInput.val(newState.toString());
+
+ },
+
__changeToggleState: function(newState) {
if (!this.isLeaf()) {
var tree = this.getTree();
@@ -131,16 +137,14 @@
case 'client':
this.elt.addClass(TREE_CLASSES[newState ? 1 : 0]).removeClass(TREE_CLASSES[!newState ? 1 : 0]);
this.handler.addClass(TREE_HANDLE_CLASSES[newState ? 1 : 0]).removeClass(TREE_HANDLE_CLASSES[!newState ? 1 : 0]);
+ this.__updateClientToggleStateInput(newState);
break;
case 'ajax':
+ case 'server':
//TODO - event?
- tree.toggleByAjax(null, richfaces.getDomElement(this.id).id, newState);
+ tree.sendToggleRequest(null, richfaces.getDomElement(this.id).id, newState);
break;
-
- case 'server':
-
- break;
}
}
@@ -163,6 +167,8 @@
},
destroy: function() {
+ this.__clientStateInput = null;
+
if (this.parent) {
this.parent.removeChild(this);
}
@@ -189,6 +195,8 @@
parentNode.addChild(new richfaces.ui.TreeNode(node[0]), idx);
};
+ var decoderHelperId;
+
richfaces.ui.Tree = richfaces.ui.TreeNode.extendClass({
name: "Tree",
@@ -210,13 +218,16 @@
this.__ajaxToggler = null;
},
- toggleByAjax: function(event, toggleSource, newNodeState) {
+ sendToggleRequest: function(event, toggleSource, newNodeState) {
var clientParams = {};
- clientParams[TOGGLE_NEW_STATE_PARAM] = newNodeState;
- clientParams[TOGGLE_NODE_ID_PARAM] = toggleSource;
- clientParams[TOGGLE_TREE_ID_PARAM] = this.id;
+ clientParams[toggleSource + NEW_NODE_TOGGLE_STATE] = newNodeState;
- this.__ajaxToggler(event, toggleSource + '@node', clientParams);
+ if (this.__toggleMode == 'server') {
+ var form = $(richfaces.getDomElement(this.id)).closest('form');
+ richfaces.submitForm(form, clientParams);
+ } else {
+ this.__ajaxToggler(event, toggleSource + decoderHelperId, clientParams);
+ }
},
getToggleMode: function() {
@@ -228,4 +239,8 @@
}
});
+ richfaces.ui.Tree.setDecoderHelperId = function(id) {
+ decoderHelperId = id;
+ };
+
}(jQuery, RichFaces));
\ No newline at end of file
Modified: sandbox/trunk/ui/tree-actual/ui/src/main/templates/tree.template.xml
===================================================================
--- sandbox/trunk/ui/tree-actual/ui/src/main/templates/tree.template.xml 2010-10-31 15:21:51 UTC (rev 19797)
+++ sandbox/trunk/ui/tree-actual/ui/src/main/templates/tree.template.xml 2010-10-31 16:26:17 UTC (rev 19798)
@@ -26,6 +26,7 @@
</cdk:body>
<script type="text/javascript">
+ RichFaces.ui.Tree.setDecoderHelperId(#{toScriptArgs(getDecoderHelperId(facesContext))});
<cdk:scriptObject name="options">
<cdk:scriptOption attributes="toggleMode selectionMode" defaultValue="SwitchType.DEFAULT" />
<cdk:scriptOption name="ajaxToggler" value="#{getAjaxToggler(facesContext, component)}" />
14 years, 1 month