Author: Alex.Kolonitsky
Date: 2010-08-31 11:51:59 -0400 (Tue, 31 Aug 2010)
New Revision: 19045
Added:
trunk/examples/output-demo/src/main/webapp/examples/collapsiblePanel.xhtml
trunk/examples/output-demo/src/main/webapp/qunit/collapsiblePanel.xhtml
trunk/examples/output-demo/src/main/webapp/resources/tests/richfaces-collapsible-panel-qunit.js
trunk/ui/output/api/src/main/java/org/richfaces/event/ChangeExpandEvent.java
trunk/ui/output/api/src/main/java/org/richfaces/event/ChangeExpandListener.java
trunk/ui/output/api/src/main/java/org/richfaces/event/ChangeExpandSource.java
trunk/ui/output/ui/src/main/java/org/richfaces/component/AbstractCollapsiblePanel.java
trunk/ui/output/ui/src/main/java/org/richfaces/component/UICollapsiblePanel.java
trunk/ui/output/ui/src/main/java/org/richfaces/component/html/HtmlCollapsiblePanel.java
trunk/ui/output/ui/src/main/java/org/richfaces/event/MethodExpressionChangeExpandListener.java
trunk/ui/output/ui/src/main/java/org/richfaces/event/MethodExpressionEventListener.java
trunk/ui/output/ui/src/main/java/org/richfaces/renderkit/html/CollapsiblePanelRenderer.java
trunk/ui/output/ui/src/main/java/org/richfaces/view/facelets/html/ChangeExpandListenerHandler.java
trunk/ui/output/ui/src/main/java/org/richfaces/view/facelets/html/CollapsiblePanelTagHandler.java
trunk/ui/output/ui/src/main/java/org/richfaces/view/facelets/html/EventListenerHandler.java
trunk/ui/output/ui/src/main/resources/META-INF/resources/org.richfaces/CollapsiblePanel.js
trunk/ui/output/ui/src/main/resources/META-INF/resources/org.richfaces/CollapsiblePanelItem.js
trunk/ui/output/ui/src/main/resources/META-INF/resources/org.richfaces/collapsiblePanel.ecss
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/output/ui/src/main/java/org/richfaces/component/AbstractTogglePanel.java
trunk/ui/output/ui/src/main/java/org/richfaces/renderkit/html/DivPanelRenderer.java
trunk/ui/output/ui/src/main/java/org/richfaces/renderkit/html/TogglePanelRenderer.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/TogglePanel.js
Log:
RF-8818 collapsiblePanel component
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-08-31
14:36:18 UTC (rev 19044)
+++ trunk/examples/output-demo/src/main/webapp/WEB-INF/faces-config.xml 2010-08-31
15:51:59 UTC (rev 19045)
@@ -34,6 +34,10 @@
<from-outcome>accordion</from-outcome>
<to-view-id>/examples/accordion.xhtml</to-view-id>
</navigation-case>
+ <navigation-case>
+ <from-outcome>collapsiblePanel</from-outcome>
+ <to-view-id>/examples/collapsiblePanel.xhtml</to-view-id>
+ </navigation-case>
<!-- QUnit -->
<navigation-case>
@@ -52,5 +56,9 @@
<from-outcome>qunit/accordionHeaders</from-outcome>
<to-view-id>/qunit/accordionHeaders.xhtml</to-view-id>
</navigation-case>
+ <navigation-case>
+ <from-outcome>qunit/collapsiblePanel</from-outcome>
+ <to-view-id>/qunit/collapsiblePanel.xhtml</to-view-id>
+ </navigation-case>
</navigation-rule>
</faces-config>
Added: trunk/examples/output-demo/src/main/webapp/examples/collapsiblePanel.xhtml
===================================================================
--- trunk/examples/output-demo/src/main/webapp/examples/collapsiblePanel.xhtml
(rev 0)
+++ trunk/examples/output-demo/src/main/webapp/examples/collapsiblePanel.xhtml 2010-08-31
15:51:59 UTC (rev 19045)
@@ -0,0 +1,44 @@
+<!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="title">Collapsible Panel QUnit</ui:define>
+ <ui:define name="body_head">Collapsible Panel
QUnit</ui:define>
+
+ <ui:define name="body">
+ <p>Page</p>
+
+ <h:form id="f">
+ <pn:collapsiblePanel id="panel">
+ <f:facet name="headerExpanded" >
+ header exanded
+ </f:facet>
+ <f:facet name="headerCollapsed" >
+ header collapsed
+ </f:facet>
+
+ Hello!!!
+
+ </pn:collapsiblePanel>
+
+ </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-collapsible-panel-qunit.js"
/>
+ </ui:define>
+</ui:composition>
+</body>
+</html>
+
Added: trunk/examples/output-demo/src/main/webapp/qunit/collapsiblePanel.xhtml
===================================================================
--- trunk/examples/output-demo/src/main/webapp/qunit/collapsiblePanel.xhtml
(rev 0)
+++ trunk/examples/output-demo/src/main/webapp/qunit/collapsiblePanel.xhtml 2010-08-31
15:51:59 UTC (rev 19045)
@@ -0,0 +1,51 @@
+<!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="qunit/qunit.js" />
+ <h:outputScript name="qunit/richfaces-qunit.js" />
+
+ <h:outputStylesheet name="qunit/qunit.css" />
+ </ui:define>
+
+ <ui:define name="title">Collapsible Panel QUnit</ui:define>
+ <ui:define name="body_head">Collapsible Panel
QUnit</ui:define>
+
+ <ui:define name="body">
+ <p>Page</p>
+
+ <h:form id="f">
+ <pn:collapsiblePanel id="panel"
switchType="client">
+ <f:facet name="headerExpanded" >
+ header exanded
+ </f:facet>
+ <f:facet name="headerCollapsed" >
+ header collapsed
+ </f:facet>
+
+ Hello!!!
+
+ </pn:collapsiblePanel>
+
+ </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-collapsible-panel-qunit.js"
/>
+ </ui:define>
+</ui:composition>
+</body>
+</html>
+
Added:
trunk/examples/output-demo/src/main/webapp/resources/tests/richfaces-collapsible-panel-qunit.js
===================================================================
---
trunk/examples/output-demo/src/main/webapp/resources/tests/richfaces-collapsible-panel-qunit.js
(rev 0)
+++
trunk/examples/output-demo/src/main/webapp/resources/tests/richfaces-collapsible-panel-qunit.js 2010-08-31
15:51:59 UTC (rev 19045)
@@ -0,0 +1,115 @@
+/*
+ * 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-collapsible-panel");
+
+ var COLLAPSIBLE_PANEL_ID = "f:panel";
+
+ function handler (msg, returnValue) {
+ return function () {
+ ok(true, msg);
+
+ if (returnValue != undefined) {
+ return returnValue;
+ }
+ };
+ }
+
+ test("RichFaces.ui.CollapsiblePanel test constructor", function () {
+ var c = RichFaces.$(COLLAPSIBLE_PANEL_ID);
+
+ ok(c instanceof RichFaces.ui.CollapsiblePanel, "inctance of
RichFaces.ui.CollapsiblePanel");
+ equals(c.id, COLLAPSIBLE_PANEL_ID, "id");
+ // TODO other params
+
+ });
+
+ test("RichFaces.ui.CollapsiblePanel test public api", function () {
+ var c = RichFaces.$(COLLAPSIBLE_PANEL_ID);
+
+ var PUBLIC_API = ["switchPanel"];
+
+ 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");
+ }
+ });
+
+ test("RichFaces.ui.CollapsiblePanel.Events", function () {
+ var componentId = COLLAPSIBLE_PANEL_ID;
+ var c = RichFaces.$(componentId);
+
+ expect(4);
+
+ var beforeswitchHandler = function (event, comp, data) {
+ ok(true, "beforeswitch handler invouked");
+
+ same(data.id, componentId, "component id");
+ same(data.isExpanded, "false", "panel collapsed");
+
+ return true;
+ };
+
+ var beforeswitchHandlerWrapper = RichFaces.Event.bindById(componentId,
"beforeswitch", beforeswitchHandler);
+
+ var switchHandler = handler("switch handler invouked", undefined);
+ var switchHandlerWrapper = RichFaces.Event.bindById(componentId,
"switch", switchHandler);
+
+ c.switchPanel();
+
+ RichFaces.Event.unbindById(componentId, "beforeswitch",
beforeswitchHandlerWrapper);
+ RichFaces.Event.unbindById(componentId, "switch",
switchHandlerWrapper);
+
+ c.switchPanel();
+ });
+
+ test("RichFaces.ui.CollapsiblePanel.Events test cancelable", function () {
+ var c = RichFaces.$(COLLAPSIBLE_PANEL_ID);
+
+ expect(2);
+ var beforeswitch1 = RichFaces.Event.bindById(COLLAPSIBLE_PANEL_ID,
"beforeswitch", function () {
+ ok(true, "beforeswitch handler invouked");
+
+ return false;
+ });
+
+ var beforeswitch2 = RichFaces.Event.bindById(COLLAPSIBLE_PANEL_ID,
"beforeswitch", function () {
+ ok(true, "beforeswitch handler invouked");
+
+ return true;
+ });
+
+ var switchHandler = RichFaces.Event.bindById(COLLAPSIBLE_PANEL_ID,
"switch", function () {
+ ok(false, "switch handler should't been invouked");
+ });
+
+ c.switchPanel();
+
+ RichFaces.Event.unbindById(COLLAPSIBLE_PANEL_ID, "beforeswitch",
beforeswitch1);
+ RichFaces.Event.unbindById(COLLAPSIBLE_PANEL_ID, "beforeswitch",
beforeswitch2);
+ RichFaces.Event.unbindById(COLLAPSIBLE_PANEL_ID, "switch",
switchHandler);
+
+ c.switchPanel();
+ });
+});
Modified: trunk/examples/output-demo/src/main/webapp/templates/template.xhtml
===================================================================
--- trunk/examples/output-demo/src/main/webapp/templates/template.xhtml 2010-08-31
14:36:18 UTC (rev 19044)
+++ trunk/examples/output-demo/src/main/webapp/templates/template.xhtml 2010-08-31
15:51:59 UTC (rev 19045)
@@ -11,9 +11,161 @@
<meta http-equiv="content-type" content="text/xhtml;
charset=UTF-8" />
+ <style type="text/css">
+ * {
+ font-family: verdana
+ }
+
+ .rftp_toptab {
+ display: table-cell;
+ border: 1px solid #A6A6A6;
+ padding: 0px 0px 3px 0px;
+ vertical-align: bottom;
+ background: url(tab_bg.gif) top repeat-x #DAE7F5;
+ }
+
+ .rftp_active_top {
+ border-bottom: 0px;
+ font-weight: bold;
+ padding: 3px 0px 0px 0px;
+ vertical-align: top;
+ background: url(acttab_bg.gif) top repeat-x #C9DBEF;
+ }
+
+ .rftp_active2_top {
+ border-bottom: 0px;
+ font-weight: bold;
+ padding: 3px 0px 0px 0px;
+ vertical-align: top;
+ background: url(acttab2_bg.gif) top repeat-x #FFFFFF;
+ }
+
+ .rftp_toptab_tabline_vis {
+ border: 1px solid #a6a6a6;
+ background: url(tabline_bg.gif) top repeat-x #EEF4FB;
+ border-bottom: 0px;
+ padding-top: 2px;
+ overflow: hidden;
+ height: 23px;
+ white-space: nowrap;
+ position: relative;
+ }
+
+ .rftp_toptab_tabline_dis {
+ border-bottom: 0px;
+ padding-top: 2px;
+ overflow: hidden;
+ height: 25px;
+ white-space: nowrap;
+ position: relative;
+ }
+
+ .rftp_toptab_tabs {
+ display: table;
+ border: 0px;
+ width: 100%;
+ height: 100%;
+ }
+
+ .rftp_toptab_spacer {
+ display: table-cell;
+ border-bottom: 1px solid #A6A6A6;
+ }
+
+ .rftp_horizonttab_tabspacer_width {
+ padding-left: 1px;
+ }
+
+ .rftp_icon {
+ display: table-cell;
+ vertical-align: middle;
+ padding: 0px 5px 0px 5px;
+ }
+
+ .rftp_close {
+ display: table-cell;
+ vertical-align: middle;
+ padding: 0px 3px 0px 15px;
+ }
+
+ .rftp_label {
+ display: table-cell;
+ vertical-align: middle;
+ font-family: verdana;
+ font-size: 11px;
+ }
+
+ .rftp_toptab_scroll_left {
+ background: url(acttab_bg.gif) top repeat-x #C9DBEF;
+ position: absolute;
+ top: 1px;
+ left: 1px;
+ width: 15px;
+ height: 250px;
+ border: 1px solid #a6a6a6;
+ font-weight: bold;
+ text-align: center;
+ font-family: verdana;
+ font-size: 11px;
+ padding-top: 6px;
+ }
+
+ .rftp_toptab_scroll_right {
+ background: url(acttab_bg.gif) top repeat-x #C9DBEF;
+ position: absolute;
+ top: 1px;
+ right: 17px;
+ width: 15px;
+ height: 250px;
+ border: 1px solid #a6a6a6;
+ font-weight: bold;
+ text-align: center;
+ font-family: verdana;
+ font-size: 11px;
+ padding-top: 6px;
+ }
+
+ .rftp_toptab_tabslist {
+ background: url(acttab_bg.gif) top repeat-x #C9DBEF;
+ position: absolute;
+ top: 1px;
+ right: 1px;
+ width: 15px;
+ height: 250px;
+ border: 1px solid #a6a6a6;
+ font-weight: bold;
+ text-align: center;
+ font-family: verdana;
+ font-size: 14px;
+ padding-top: 2px;
+ }
+
+ .rftp_toptab_border {
+ border: 1px solid #A6A6A6;
+ border-top: 0px;
+ height: 2px;
+ background: #C9DBEF;
+ }
+
+ .rftp_toptab_content {
+ border: 1px solid #A6A6A6;
+ border-top: 0px;
+ font-family: verdana;
+ font-size: 11px;
+ padding: 10px;
+ background: #ffffff;
+ }
+
+ .rftp_hidden {
+ display: none
+ }
+ </style>
+
</h:head>
<h:body>
+
+
<ui:insert name="scripts" ></ui:insert>
<table width="100%">
<thead>
@@ -46,6 +198,12 @@
<li><h:commandLink
value="accordion" action="accordion" /></li>
</ul>
</li>
+ <li>
+ <p>Collapsible Panel</p>
+ <ul>
+ <li><h:commandLink value="Collapsible
Panel" action="collapsiblePanel" /></li>
+ </ul>
+ </li>
</ul>
<p>QUnit</p>
<ul>
@@ -53,6 +211,7 @@
<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>
</ul>
</h:form>
</td>
Added: trunk/ui/output/api/src/main/java/org/richfaces/event/ChangeExpandEvent.java
===================================================================
--- trunk/ui/output/api/src/main/java/org/richfaces/event/ChangeExpandEvent.java
(rev 0)
+++
trunk/ui/output/api/src/main/java/org/richfaces/event/ChangeExpandEvent.java 2010-08-31
15:51:59 UTC (rev 19045)
@@ -0,0 +1,82 @@
+/*
+ * 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.event;
+
+import javax.faces.component.UIComponent;
+import javax.faces.event.FacesEvent;
+import javax.faces.event.FacesListener;
+
+
+/**
+ * @author akolonitsky
+ * @since 2010-08-27
+ */
+public class ChangeExpandEvent extends FacesEvent {
+
+ private final Boolean isExpanded;
+
+
+ // ------------------------------------------------------------ Constructors
+
+ /**
+ * <p>Construct a new event object from the specified source component,
+ * old value, and new value.</p>
+ *
+ * <p>The default {@link javax.faces.event.PhaseId} for this event is {@link
+ * javax.faces.event.PhaseId#ANY_PHASE}.</p>
+ *
+ * @param component Source {@link UIComponent} for this event
+ * @param isExpanded
+ *
+ * @throws IllegalArgumentException if <code>component</code> is
+ * <code>null</code>
+ */
+ public ChangeExpandEvent(UIComponent component, Boolean isExpanded) {
+ super(component);
+ this.isExpanded = isExpanded;
+ }
+
+
+ // -------------------------------------------------------------- Properties
+
+ public Boolean getExpanded() {
+ return isExpanded;
+ }
+
+ // ------------------------------------------------- Event Broadcast Methods
+
+
+ @Override
+ public boolean isAppropriateListener(FacesListener listener) {
+ return listener instanceof ChangeExpandListener;
+ }
+
+ /**
+ * @throws javax.faces.event.AbortProcessingException {@inheritDoc}
+ */
+ @Override
+ public void processListener(FacesListener listener) {
+ ((ChangeExpandListener) listener).processChangeExpand(this);
+ }
+}
+
Added: trunk/ui/output/api/src/main/java/org/richfaces/event/ChangeExpandListener.java
===================================================================
--- trunk/ui/output/api/src/main/java/org/richfaces/event/ChangeExpandListener.java
(rev 0)
+++
trunk/ui/output/api/src/main/java/org/richfaces/event/ChangeExpandListener.java 2010-08-31
15:51:59 UTC (rev 19045)
@@ -0,0 +1,54 @@
+/*
+ * 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.event;
+
+import javax.faces.event.AbortProcessingException;
+import javax.faces.event.FacesListener;
+
+/**
+ * <p>A listener interface for receiving {@link ChangeExpandEvent}s. A class
+ * that is interested in receiving such events implements this interface, and
+ * then registers itself with the source {@link javax.faces.component.UIComponent} of
interest, by
+ * calling <code>addChangeExpandListener()</code>.</p>
+ *
+ * @author akolonitsky
+ * @version 1.0
+ * @since 2010-08-27
+ *
+ */
+public interface ChangeExpandListener extends FacesListener {
+
+
+ /**
+ * <p>Invoked when {@link ChangeExpandEvent} occurs.</p>
+ *
+ * @param event The {@link ChangeExpandEvent} that has occurred
+ *
+ * @throws AbortProcessingException Signal the JavaServer Faces
+ * implementation that no further processing on the current event
+ * should be performed
+ */
+ public void processChangeExpand(ChangeExpandEvent event)
+ throws AbortProcessingException;
+
+}
Added: trunk/ui/output/api/src/main/java/org/richfaces/event/ChangeExpandSource.java
===================================================================
--- trunk/ui/output/api/src/main/java/org/richfaces/event/ChangeExpandSource.java
(rev 0)
+++
trunk/ui/output/api/src/main/java/org/richfaces/event/ChangeExpandSource.java 2010-08-31
15:51:59 UTC (rev 19045)
@@ -0,0 +1,58 @@
+/*
+ * 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.event;
+
+/**
+ * @author akolonitsky
+ * @since 2010-08-27
+ */
+public interface ChangeExpandSource {
+
+ /**
+ * <p>Add a new {@link org.richfaces.event.ChangeExpandListener} to the set of
listeners
+ * interested in being notified when {@link org.richfaces.event.ChangeExpandEvent}s
occur.</p>
+ *
+ * @param listener The {@link org.richfaces.event.ChangeExpandListener} to be added
+ * @throws NullPointerException if <code>listener</code>
+ * is <code>null</code>
+ */
+ void addChangeExpandListener(ChangeExpandListener listener);
+
+ /**
+ * <p>Return the set of registered {@link
org.richfaces.event.ChangeExpandListener}s for this instance.
+ * If there are no registered listeners, a zero-length array is returned.</p>
+ */
+ ChangeExpandListener[] getChangeExpandListeners();
+
+ /**
+ * <p>Remove an existing {@link org.richfaces.event.ChangeExpandListener} (if
any) from the
+ * set of listeners interested in being notified when
+ * {@link org.richfaces.event.ChangeExpandEvent}s occur.</p>
+ *
+ * @param listener The {@link org.richfaces.event.ChangeExpandListener} to be
removed
+ * @throws NullPointerException if <code>listener</code>
+ * is <code>null</code>
+ */
+ void removeChangeExpandListener(ChangeExpandListener listener);
+
+}
Added:
trunk/ui/output/ui/src/main/java/org/richfaces/component/AbstractCollapsiblePanel.java
===================================================================
---
trunk/ui/output/ui/src/main/java/org/richfaces/component/AbstractCollapsiblePanel.java
(rev 0)
+++
trunk/ui/output/ui/src/main/java/org/richfaces/component/AbstractCollapsiblePanel.java 2010-08-31
15:51:59 UTC (rev 19045)
@@ -0,0 +1,97 @@
+/*
+ * 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 javax.el.MethodExpression;
+import javax.faces.component.UIComponent;
+
+import org.richfaces.event.ChangeExpandSource;
+import org.richfaces.event.ChangeExpandListener;
+
+/**
+ * @author akolonitsky
+ * @since 2010-08-27
+ */
+public abstract class AbstractCollapsiblePanel extends UITogglePanel implements
ChangeExpandSource {
+
+ public static final String COMPONENT_TYPE =
"org.richfaces.CollapsiblePanel";
+
+ public static final String COMPONENT_FAMILY =
"org.richfaces.CollapsiblePanel";
+ private static final String STATE_EXPANDED = "expanded";
+ private static final String STATE_COLLAPSED = "collapsed";
+
+ protected AbstractCollapsiblePanel() {
+ setRendererType("org.richfaces.CollapsiblePanel");
+ }
+
+ @Override
+ public String getFamily() {
+ return COMPONENT_FAMILY;
+ }
+
+ @Override
+ public String getActiveItem() {
+ String ai = super.getActiveItem();
+ return ai == null ? "true" : ai;
+ }
+
+ @Override
+ protected boolean isActiveItem(UIComponent kid) {
+ return isExpanded();
+ }
+
+ @Override
+ protected boolean isActiveItem(UIComponent kid, String value) {
+ return isExpanded();
+ }
+
+
+ public boolean isExpanded() {
+ return Boolean.parseBoolean(getActiveItem());
+ }
+
+ public void setExpanded(boolean isExpanded) {
+ setActiveItem(String.valueOf(isExpanded));
+ }
+
+ public abstract String getHeader();
+
+ public abstract MethodExpression getChangeExpandListener();
+
+
+
+
+ // ------------------------------------------------ Event Processing Methods
+
+ public void addChangeExpandListener(ChangeExpandListener listener) {
+ addFacesListener(listener);
+ }
+
+ public ChangeExpandListener[] getChangeExpandListeners() {
+ return (ChangeExpandListener[]) getFacesListeners(ChangeExpandListener.class);
+ }
+
+ public void removeChangeExpandListener(ChangeExpandListener listener) {
+ removeFacesListener(listener);
+ }
+}
Modified:
trunk/ui/output/ui/src/main/java/org/richfaces/component/AbstractTogglePanel.java
===================================================================
---
trunk/ui/output/ui/src/main/java/org/richfaces/component/AbstractTogglePanel.java 2010-08-31
14:36:18 UTC (rev 19044)
+++
trunk/ui/output/ui/src/main/java/org/richfaces/component/AbstractTogglePanel.java 2010-08-31
15:51:59 UTC (rev 19045)
@@ -423,7 +423,7 @@
return isActiveItem(kid, getActiveItemValue());
}
- protected static boolean isActiveItem(UIComponent kid, String value) {
+ protected boolean isActiveItem(UIComponent kid, String value) {
if (kid == null || value == null) {
return false;
}
Added: trunk/ui/output/ui/src/main/java/org/richfaces/component/UICollapsiblePanel.java
===================================================================
--- trunk/ui/output/ui/src/main/java/org/richfaces/component/UICollapsiblePanel.java
(rev 0)
+++
trunk/ui/output/ui/src/main/java/org/richfaces/component/UICollapsiblePanel.java 2010-08-31
15:51:59 UTC (rev 19045)
@@ -0,0 +1,53 @@
+/*
+ * 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 javax.el.MethodExpression;
+
+/**
+ * @author akolonitsky
+ * @since 2010-08-27
+ */
+public class UICollapsiblePanel extends AbstractCollapsiblePanel {
+
+ public enum PropertyKeys {
+ header,
+ changeExpandListener
+ }
+
+ public String getHeader() {
+ return (String) getStateHelper().eval(PropertyKeys.header);
+ }
+
+ public void setHeader(String header) {
+ getStateHelper().put(PropertyKeys.header, header);
+ }
+
+ public MethodExpression getChangeExpandListener() {
+ return (MethodExpression)
getStateHelper().get(PropertyKeys.changeExpandListener);
+ }
+
+ public void setChangeExpandListener(MethodExpression changeExpandListener) {
+ getStateHelper().put(PropertyKeys.changeExpandListener, changeExpandListener);
+ }
+}
Added:
trunk/ui/output/ui/src/main/java/org/richfaces/component/html/HtmlCollapsiblePanel.java
===================================================================
---
trunk/ui/output/ui/src/main/java/org/richfaces/component/html/HtmlCollapsiblePanel.java
(rev 0)
+++
trunk/ui/output/ui/src/main/java/org/richfaces/component/html/HtmlCollapsiblePanel.java 2010-08-31
15:51:59 UTC (rev 19045)
@@ -0,0 +1,245 @@
+/*
+ * 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.UICollapsiblePanel;
+import javax.faces.component.behavior.ClientBehaviorHolder;
+
+import java.util.Arrays;
+import java.util.Collection;
+import java.util.Collections;
+
+/**
+ * @author akolonitsky
+ * @since 2010-08-27
+ */
+public class HtmlCollapsiblePanel extends UICollapsiblePanel implements
ClientBehaviorHolder {
+
+ public static final String COMPONENT_TYPE =
"org.richfaces.CollapsiblePanel";
+
+ public static final String COMPONENT_FAMILY =
"org.richfaces.CollapsiblePanel";
+
+ private static final Collection<String> EVENT_NAMES =
Collections.unmodifiableCollection(Arrays.asList(
+ "onswitch",
+ "onbeforeswitch",
+ "click",
+ "dblclick",
+ "mousedown",
+ "mousemove",
+ "mouseout",
+ "mouseover",
+ "mouseup"
+ ));
+
+
+ public enum PropertyKeys {
+ bodyClass,
+ headerClass,
+ headerControlClass,
+ oncomplete,
+ onbeforedomupdate,
+ ononswitch,
+ ononbeforeswitch,
+ lang,
+ title,
+ style,
+ styleClass,
+ dir,
+ onclick,
+ ondblclick,
+ onmousedown,
+ onmousemove,
+ onmouseout,
+ onmouseover,
+ onmouseup
+ }
+
+ public HtmlCollapsiblePanel() {
+ setRendererType("org.richfaces.CollapsiblePanel");
+ }
+
+ @Override
+ public String getFamily() {
+ return COMPONENT_FAMILY;
+ }
+
+ public String getBodyClass() {
+ return (String) getStateHelper().eval(PropertyKeys.bodyClass);
+ }
+
+ public void setBodyClass(String bodyClass) {
+ getStateHelper().put(PropertyKeys.bodyClass, bodyClass);
+ }
+
+ public String getHeaderClass() {
+ return (String) getStateHelper().eval(PropertyKeys.headerClass);
+ }
+
+ public void setHeaderClass(String headerClass) {
+ getStateHelper().put(PropertyKeys.headerClass, headerClass);
+ }
+
+ public String getHeaderControlClass() {
+ return (String) getStateHelper().eval(PropertyKeys.headerControlClass);
+ }
+
+ public void setHeaderControlClass(String headerControlClass) {
+ getStateHelper().put(PropertyKeys.headerControlClass, headerControlClass);
+ }
+
+ public String getOncomplete() {
+ return (String) getStateHelper().eval(PropertyKeys.oncomplete);
+ }
+
+ public void setOncomplete(String oncomplete) {
+ getStateHelper().put(PropertyKeys.oncomplete, oncomplete);
+ }
+
+ public String getOnbeforedomupdate() {
+ return (String) getStateHelper().eval(PropertyKeys.onbeforedomupdate);
+ }
+
+ public void setOnbeforedomupdate(String onbeforedomupdate) {
+ getStateHelper().put(PropertyKeys.onbeforedomupdate, onbeforedomupdate);
+ }
+
+ public String getOnonswitch() {
+ return (String) getStateHelper().eval(PropertyKeys.ononswitch);
+ }
+
+ public void setOnonswitch(String ononswitch) {
+ getStateHelper().put(PropertyKeys.ononswitch, ononswitch);
+ }
+
+ public String getOnonbeforeswitch() {
+ return (String) getStateHelper().eval(PropertyKeys.ononbeforeswitch);
+ }
+
+ public void setOnonbeforeswitch(String ononbeforeswitch) {
+ getStateHelper().put(PropertyKeys.ononbeforeswitch, ononbeforeswitch);
+ }
+
+ public String getLang() {
+ return (String) getStateHelper().eval(PropertyKeys.lang);
+ }
+
+ public void setLang(String lang) {
+ getStateHelper().put(PropertyKeys.lang, lang);
+ }
+
+ public String getTitle() {
+ return (String) getStateHelper().eval(PropertyKeys.title);
+ }
+
+ public void setTitle(String title) {
+ getStateHelper().put(PropertyKeys.title, title);
+ }
+
+ 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 getDir() {
+ return (String) getStateHelper().eval(PropertyKeys.dir);
+ }
+
+ public void setDir(String dir) {
+ getStateHelper().put(PropertyKeys.dir, dir);
+ }
+
+ 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/event/MethodExpressionChangeExpandListener.java
===================================================================
---
trunk/ui/output/ui/src/main/java/org/richfaces/event/MethodExpressionChangeExpandListener.java
(rev 0)
+++
trunk/ui/output/ui/src/main/java/org/richfaces/event/MethodExpressionChangeExpandListener.java 2010-08-31
15:51:59 UTC (rev 19045)
@@ -0,0 +1,59 @@
+/*
+ * 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.event;
+
+import javax.el.MethodExpression;
+import javax.faces.event.AbortProcessingException;
+
+/**
+ * <p><strong><span
+ *
class="changed_modified_2_0">MethodExpressionChangeExpandListener</span></strong>
+ * is a {@link ChangeExpandListener} that wraps a {@link
+ * MethodExpression}. When it receives a {@link ChangeExpandEvent}, it
+ * executes a method on an object identified by the {@link
+ * MethodExpression}.</p>
+ *
+ * @author akolonitsky
+ * @version 1.0
+ *
+ */
+public class MethodExpressionChangeExpandListener extends MethodExpressionEventListener
implements ChangeExpandListener {
+
+ public MethodExpressionChangeExpandListener() {
+ super();
+ }
+
+ public MethodExpressionChangeExpandListener(MethodExpression methodExprOneArg) {
+ super(methodExprOneArg);
+ }
+
+ public MethodExpressionChangeExpandListener(MethodExpression methodExprOneArg,
MethodExpression methodExprZeroArg) {
+ super(methodExprOneArg, methodExprZeroArg);
+ }
+
+ // ------------------------------------------------------- Event Method
+
+ public void processChangeExpand(ChangeExpandEvent changeExpandEvent) throws
AbortProcessingException {
+ processEvent(changeExpandEvent);
+ }
+}
Added:
trunk/ui/output/ui/src/main/java/org/richfaces/event/MethodExpressionEventListener.java
===================================================================
---
trunk/ui/output/ui/src/main/java/org/richfaces/event/MethodExpressionEventListener.java
(rev 0)
+++
trunk/ui/output/ui/src/main/java/org/richfaces/event/MethodExpressionEventListener.java 2010-08-31
15:51:59 UTC (rev 19045)
@@ -0,0 +1,197 @@
+/*
+ * 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.event;
+
+import javax.el.ELContext;
+import javax.el.ELException;
+import javax.el.MethodExpression;
+import javax.el.MethodNotFoundException;
+import javax.faces.component.StateHolder;
+import javax.faces.component.UIComponentBase;
+import javax.faces.context.FacesContext;
+import javax.faces.event.AbortProcessingException;
+import javax.faces.event.FacesEvent;
+import javax.faces.event.FacesListener;
+
+/**
+ * <p><strong><span
+ *
class="changed_modified_2_0">MethodExpressionEventListener</span></strong>
+ * is a {@link FacesListener} that wraps a {@link
+ * MethodExpression}. When it receives a {@link FacesEvent}, it
+ * executes a method on an object identified by the {@link
+ * MethodExpression}.</p>
+ *
+ * @author akolonitsky
+ * @version 1.0
+ *
+ */
+public abstract class MethodExpressionEventListener implements FacesListener, StateHolder
{
+
+ private static final Class<?>[] EVENT_LISTENER_ZERO_ARG_SIG = new Class[] { };
+
+ private static final Object[] NO_PARAMS = new Object[0];
+
+ // ------------------------------------------------------ Instance Variables
+
+ private MethodExpression methodExpressionOneArg = null;
+ private MethodExpression methodExpressionZeroArg = null;
+
+ private boolean isTransient;
+
+ protected MethodExpressionEventListener() {
+ }
+
+ /**
+ * <p><span class="changed_modified_2_0">Construct</span>
a {@link
+ * FacesListener} that contains a {@link
+ * MethodExpression}.<span
+ * class="changed_added_2_0">To accomodate method expression targets
+ * that take no arguments instead of taking a {@link
+ * FacesEvent} argument</span>, the implementation of this
+ * class must take the argument <code>methodExpressionOneArg</code>,
+ * extract its expression string, and create another
+ * <code>MethodExpression</code> whose expected param types match
+ * those of a zero argument method. The usage requirements for both
+ * of these <code>MethodExpression</code> instances are described in
+ * {@link #processEvent}.</span></p>
+ *
+ * @param methodExpressionOneArg a <code>MethodExpression</code>
+ * that points to a method that returns <code>void</code> and takes
+ * a single argument of type {@link FacesEvent}.
+ */
+ protected MethodExpressionEventListener(MethodExpression methodExpressionOneArg) {
+
+ super();
+ this.methodExpressionOneArg = methodExpressionOneArg;
+ FacesContext context = FacesContext.getCurrentInstance();
+ ELContext elContext = context.getELContext();
+ this.methodExpressionZeroArg =
context.getApplication().getExpressionFactory().createMethodExpression(
+ elContext, methodExpressionOneArg.getExpressionString(), Void.class,
EVENT_LISTENER_ZERO_ARG_SIG);
+ }
+
+ /**
+ * <p>Construct a {@link FacesListener} that contains a {@link
MethodExpression}.</p>
+ *
+ * @param methodExprOneArg
+ * @param methodExprZeroArg
+ */
+ protected MethodExpressionEventListener(MethodExpression methodExprOneArg,
MethodExpression methodExprZeroArg) {
+
+ super();
+ this.methodExpressionOneArg = methodExprOneArg;
+ this.methodExpressionZeroArg = methodExprZeroArg;
+ }
+
+ // ------------------------------------------------------- Event Method
+
+ /**
+ * <p><span class="changed_modified_2_0">Call</span>
through to the
+ * {@link MethodExpression} passed in our constructor. <span
+ * class="changed_added_2_0">First, try to invoke the
+ * <code>MethodExpression</code> passed to the constructor of this
+ * instance, passing the argument {@link FacesEvent} as the
+ * argument. If a {@link MethodNotFoundException} is thrown, call
+ * to the zero argument <code>MethodExpression</code> derived from
+ * the <code>MethodExpression</code> passed to the constructor of
+ * this instance. If that fails for any reason, throw an {@link
+ * AbortProcessingException}, including the cause of the
+ * failure.</span></p>
+ *
+ * @throws NullPointerException {@inheritDoc}
+ * @throws AbortProcessingException {@inheritDoc}
+ */
+ public void processEvent(FacesEvent event) throws AbortProcessingException {
+
+ if (event == null) {
+ throw new NullPointerException();
+ }
+ FacesContext context = FacesContext.getCurrentInstance();
+ ELContext elContext = context.getELContext();
+ // PENDING: The corresponding code in MethodExpressionActionListener
+ // has an elaborate message capture, logging, and rethrowing block.
+ // Why not here?
+ try {
+ methodExpressionOneArg.invoke(elContext, new Object[] {event});
+ } catch (MethodNotFoundException mnf) {
+ if (null != methodExpressionZeroArg) {
+
+ try {
+ // try to invoke a no-arg version
+ methodExpressionZeroArg.invoke(elContext, NO_PARAMS);
+ } catch (ELException e) {
+ throw new AbortProcessingException(e.getMessage(), e.getCause());
+ }
+ }
+ } catch (ELException e) {
+ throw new AbortProcessingException(e.getMessage(), e.getCause());
+ }
+ }
+
+
+ // ------------------------------------------------ Methods from StateHolder
+
+
+ /**
+ * <p class="changed_modified_2_0">Both {@link MethodExpression}
+ * instances described in the constructor must be saved.</p>
+ */
+ public Object saveState(FacesContext context) {
+ if (context == null) {
+ throw new NullPointerException();
+ }
+
+ return new Object[] {
+ UIComponentBase.saveAttachedState(context, methodExpressionOneArg),
+ UIComponentBase.saveAttachedState(context, methodExpressionZeroArg)
+ };
+ }
+
+
+ /**
+ * <p class="changed_modified_2_0">Both {@link MethodExpression}
+ * instances described in the constructor must be restored.</p>
+ */
+ public void restoreState(FacesContext context, Object state) {
+
+ if (context == null) {
+ throw new NullPointerException();
+ }
+ if (state == null) {
+ return;
+ }
+
+ methodExpressionOneArg = (MethodExpression) UIComponentBase
+ .restoreAttachedState(context, ((Object[]) state)[0]);
+ methodExpressionZeroArg = (MethodExpression) UIComponentBase
+ .restoreAttachedState(context, ((Object[]) state)[1]);
+ }
+
+
+ public boolean isTransient() {
+ return isTransient;
+ }
+
+ public void setTransient(boolean newTransientValue) {
+ isTransient = newTransientValue;
+ }
+}
Added:
trunk/ui/output/ui/src/main/java/org/richfaces/renderkit/html/CollapsiblePanelRenderer.java
===================================================================
---
trunk/ui/output/ui/src/main/java/org/richfaces/renderkit/html/CollapsiblePanelRenderer.java
(rev 0)
+++
trunk/ui/output/ui/src/main/java/org/richfaces/renderkit/html/CollapsiblePanelRenderer.java 2010-08-31
15:51:59 UTC (rev 19045)
@@ -0,0 +1,235 @@
+/*
+ * 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.AbstractCollapsiblePanel;
+import org.richfaces.component.AbstractTogglePanel;
+
+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.List;
+import java.util.Map;
+
+import static org.richfaces.component.util.HtmlUtil.concatClasses;
+import static org.richfaces.component.util.HtmlUtil.concatStyles;
+
+/**
+ * @author akolonitsky
+ * @since 2010-08-27
+ */
+@ResourceDependencies( {
+ @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 =
"TogglePanel.js"),
+ @ResourceDependency(library = "org.richfaces", name =
"TogglePanelItem.js"),
+ @ResourceDependency(library = "org.richfaces", name =
"CollapsiblePanel.js"),
+ @ResourceDependency(library = "org.richfaces", name =
"CollapsiblePanelItem.js"),
+ @ResourceDependency(library = "org.richfaces", name =
"collapsiblePanel.ecss") })
+public class CollapsiblePanelRenderer extends TogglePanelRenderer {
+
+ public static final String SWITCH = "switch";
+ public static final String BEFORE_SWITCH = "beforeswitch";
+
+ @Override
+ protected void doDecode(FacesContext context, UIComponent component) {
+ AbstractTogglePanel panel = (AbstractTogglePanel) 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) {
+ panel.setSubmittedActiveItem(newValue);
+ }
+
+ String compClientId = component.getClientId(context);
+ String clientId = requestMap.get(compClientId);
+ if (clientId != null && clientId.equals(compClientId)) {
+ String itemClientId = clientId + (Boolean.parseBoolean(newValue) ?
":content" : ":empty");
+ context.getPartialViewContext().getRenderIds().add(itemClientId);
+
+ //TODO nick - this should be done on encode, not on decode
+ addOnCompleteParam(newValue, panel.getClientId());
+ }
+ }
+
+ @Override
+ protected void doEncodeBegin(ResponseWriter writer, FacesContext context, UIComponent
comp) throws IOException {
+ super.doEncodeBegin(writer, context, comp);
+
+ encodeHeader(context, comp, writer);
+ }
+
+ @Override
+ protected String getStyleClass(UIComponent component) {
+ return concatClasses("rf-cp", super.getStyleClass(component));
+ }
+
+ @Override
+ protected JSObject getScriptObject(FacesContext context, UIComponent component) {
+ return new JSObject("RichFaces.ui.CollapsiblePanel",
+ component.getClientId(), getScriptObjectOptions(context, component));
+ }
+
+ @Override
+ protected Map<String, Object> getScriptObjectOptions(FacesContext context,
UIComponent component) {
+ AbstractTogglePanel panel = (AbstractTogglePanel) component;
+
+ Map<String, Object> options = super.getScriptObjectOptions(context,
component);
+ options.put("switchMode", panel.getSwitchType());
+
+// TogglePanelRenderer.addEventOption(context, panel, options, SWITCH);
+// TogglePanelRenderer.addEventOption(context, panel, options, BEFORE_SWITCH);
+
+ return options;
+ }
+
+ private void encodeHeader(FacesContext context, UIComponent component, ResponseWriter
writer) throws IOException {
+ writer.startElement("div", component);
+ writer.writeAttribute("id", component.getClientId(context) +
":header", null);
+ writer.writeAttribute("class", concatClasses("rf-cp-hr",
attributeAsString(component, "headerClass")), null);
+
+ AbstractCollapsiblePanel panel = (AbstractCollapsiblePanel) component;
+ encodeHeader(context, component, writer, "expanded",
panel.isExpanded());
+ encodeHeader(context, component, writer, "collapsed",
!panel.isExpanded());
+
+ writer.endElement("div");
+ }
+
+ private void encodeHeader(FacesContext context, UIComponent component, ResponseWriter
responseWriter, String state, boolean isVisible) throws IOException {
+ responseWriter.startElement("div", component);
+ responseWriter.writeAttribute("class", "rf-cp-hr-" + state,
null);
+ responseWriter.writeAttribute("style",
concatStyles(styleElement("display", isVisible ? "" :
"none"), attributeAsString(component, "headerClass")), null);
+
+ UIComponent header = component.getFacet("header" + capitalize(state));
+ if (header != null && header.isRendered()) {
+ header.encodeAll(context);
+ } else {
+ String headerText = (String)
component.getAttributes().get("header");
+ if (headerText != null && !headerText.isEmpty()) {
+ responseWriter.writeText(headerText, null);
+ }
+ }
+
+ responseWriter.endElement("div");
+ }
+
+ @Override
+ protected void doEncodeChildren(ResponseWriter writer, FacesContext context,
UIComponent component)
+ throws IOException {
+
+ AbstractCollapsiblePanel panel = (AbstractCollapsiblePanel) component;
+
+ encodeContentChild(writer, context, component, panel);
+ encodeEmptyChild(writer, context, component, panel);
+ }
+
+ private void encodeContentChild(ResponseWriter writer, FacesContext context,
UIComponent component, AbstractCollapsiblePanel panel) throws IOException {
+ if (panel.isExpanded()) {
+ encodeContent(writer, context, component, true);
+ } else {
+ switch (panel.getSwitchType()) {
+ case client:
+ encodeContent(writer, context, component, false);
+ break;
+
+ case ajax:
+ context.getResponseWriter().write(getPlaceHolder(panel.getClientId()
+ ":content"));
+ break;
+
+ case server:
+ // Do nothing.
+ break;
+
+ default:
+ throw new IllegalStateException("Unknown switch type : " +
panel.getSwitchType());
+ }
+ }
+ }
+
+ private void encodeEmptyChild(ResponseWriter writer, FacesContext context,
UIComponent component, AbstractCollapsiblePanel panel) throws IOException {
+ if (!panel.isExpanded()) {
+ encodeEmptyDiv(writer, context, component, true);
+ } else {
+ switch (panel.getSwitchType()) {
+ case client:
+ encodeEmptyDiv(writer, context, component, false);
+ break;
+
+ case ajax:
+ context.getResponseWriter().write(getPlaceHolder(panel.getClientId()
+ ":empty"));
+ break;
+
+ case server:
+ // Do nothing.
+ break;
+
+ default:
+ throw new IllegalStateException("Unknown switch type : " +
panel.getSwitchType());
+ }
+ }
+ }
+
+ private String getPlaceHolder(String id) {
+ return "<div id=\"" + id + "\" style=\"display:
none\" ></div>";
+ }
+
+ private void encodeContent(ResponseWriter writer, FacesContext context, UIComponent
component, boolean visible) throws IOException {
+ writer.startElement("div", component);
+ writer.writeAttribute("id", component.getClientId() +
":content", null);
+ writer.writeAttribute("class", concatClasses("rf-cp-b",
attributeAsString(component, "bodyClass")), null);
+ writer.writeAttribute("style", concatStyles(visible ? "" :
"none", attributeAsString(component, "style")), null);
+
+ renderChildren(context, component);
+
+ writer.endElement("div");
+ }
+
+ private void encodeEmptyDiv(ResponseWriter writer, FacesContext context, UIComponent
component, boolean visible) throws IOException {
+ writer.startElement("div", component);
+ writer.writeAttribute("id", component.getClientId() +
":empty", null);
+ writer.writeAttribute("class", "rf-cp-empty", null);
+ writer.writeAttribute("style", styleElement("display",
visible ? "" : "none"), null);
+ writer.endElement("div");
+ }
+
+ @Override
+ protected List<JSObject> getChildrenScriptObjects(FacesContext context,
UIComponent component) {
+ return null;
+ }
+
+ @Override
+ protected Class<? extends UIComponent> getComponentClass() {
+ return AbstractCollapsiblePanel.class;
+ }
+}
+
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-08-31
14:36:18 UTC (rev 19044)
+++
trunk/ui/output/ui/src/main/java/org/richfaces/renderkit/html/DivPanelRenderer.java 2010-08-31
15:51:59 UTC (rev 19045)
@@ -62,12 +62,18 @@
return "";
}
+ return styleElement(attr, value);
+ }
+
+ protected static String styleElement(Object name, Object value) {
return new StringBuilder()
- .append(attr).append(':').append(value).toString();
+ .append(name).append(':').append(value).toString();
}
+
protected static String attributeAsString(UIComponent comp, Enum attr) {
return attributeAsString(comp, attr.toString());
}
+
protected static String attributeAsString(UIComponent comp, String attr) {
Object o = comp.getAttributes().get(attr);
return o == null ? "" : o.toString();
Modified:
trunk/ui/output/ui/src/main/java/org/richfaces/renderkit/html/TogglePanelRenderer.java
===================================================================
---
trunk/ui/output/ui/src/main/java/org/richfaces/renderkit/html/TogglePanelRenderer.java 2010-08-31
14:36:18 UTC (rev 19044)
+++
trunk/ui/output/ui/src/main/java/org/richfaces/renderkit/html/TogglePanelRenderer.java 2010-08-31
15:51:59 UTC (rev 19045)
@@ -60,7 +60,7 @@
@ResourceDependency(library = "org.richfaces", name =
"TogglePanel.js") })
public class TogglePanelRenderer extends DivPanelRenderer {
- private static final String VALUE_POSTFIX = "-value";
+ public static final String VALUE_POSTFIX = "-value";
private static final String ON = "on";
private static final String ITEM_CHANGE = "itemchange";
@@ -74,7 +74,7 @@
context.getExternalContext().getRequestParameterMap();
// Don't overwrite the value unless you have to!
- String newValue = requestMap.get(getActiveItemRequestParamName(context,
component));
+ String newValue = requestMap.get(getValueRequestParamName(context, component));
if (newValue != null) {
panel.setSubmittedActiveItem(newValue);
}
@@ -92,7 +92,7 @@
}
}
- private static void addOnCompleteParam(String newValue, String panelId) {
+ protected static void addOnCompleteParam(String newValue, String panelId) {
StringBuilder onComplete = new StringBuilder();
onComplete.append("RichFaces.$('").append(panelId)
.append("').onCompleteHandler('").append(newValue).append("');");
@@ -100,7 +100,7 @@
AjaxContext.getCurrentInstance().appendOncomplete(onComplete.toString());
}
- private static String getActiveItemRequestParamName(FacesContext context, UIComponent
component) {
+ public static String getValueRequestParamName(FacesContext context, UIComponent
component) {
return component.getClientId(context) + VALUE_POSTFIX;
}
@@ -114,8 +114,8 @@
writer.startElement(HTML.INPUT_ELEM, comp);
writer.writeAttribute(HTML.TYPE_ATTR, HTML.INPUT_TYPE_HIDDEN, null);
writer.writeAttribute(HTML.VALUE_ATTRIBUTE, panel.getActiveItem(),
"activeItem");
- writer.writeAttribute(HTML.ID_ATTRIBUTE, getActiveItemRequestParamName(context,
comp), null);
- writer.writeAttribute(HTML.NAME_ATTRIBUTE, getActiveItemRequestParamName(context,
comp), null);
+ writer.writeAttribute(HTML.ID_ATTRIBUTE, getValueRequestParamName(context, comp),
null);
+ writer.writeAttribute(HTML.NAME_ATTRIBUTE, getValueRequestParamName(context,
comp), null);
writer.endElement(HTML.INPUT_ELEM);
}
@@ -127,7 +127,7 @@
@Override
protected void doEncodeChildren(ResponseWriter writer, FacesContext context,
UIComponent component)
throws IOException {
-
+
renderChildren(context, component);
}
@@ -141,7 +141,7 @@
protected Map<String, Object> getScriptObjectOptions(FacesContext context,
UIComponent component) {
AbstractTogglePanel panel = (AbstractTogglePanel) component;
- Map<String, Object> options = new HashMap<String, Object>(5);
+ Map<String, Object> options = new HashMap<String, Object>();
options.put("activeItem", panel.getActiveItem());
options.put("cycledSwitching", panel.isCycledSwitching());
options.put("items", getChildrenScriptObjects(context, panel));
@@ -155,7 +155,7 @@
public static void addEventOption(FacesContext context, UIComponent component,
Map<String, Object> options,
String eventName) {
-
+
HandlersChain handlersChain = new HandlersChain(context, component);
handlersChain.addInlineHandlerFromAttribute(ON + eventName);
handlersChain.addBehaviors(eventName);
@@ -168,11 +168,11 @@
}
}
- private static AjaxEventOptions getAjaxOptions(FacesContext context, UIComponent
panel) {
+ public static AjaxEventOptions getAjaxOptions(FacesContext context, UIComponent
panel) {
return AjaxRendererUtils.buildEventOptions(context, panel);
}
- private List<JSObject> getChildrenScriptObjects(FacesContext context,
UIComponent component) {
+ protected List<JSObject> getChildrenScriptObjects(FacesContext context,
UIComponent component) {
List<JSObject> res = new
ArrayList<JSObject>(component.getChildCount());
for (UIComponent child : component.getChildren()) {
res.add(getChildScriptObject(context, (AbstractTogglePanelItem) child));
Added:
trunk/ui/output/ui/src/main/java/org/richfaces/view/facelets/html/ChangeExpandListenerHandler.java
===================================================================
---
trunk/ui/output/ui/src/main/java/org/richfaces/view/facelets/html/ChangeExpandListenerHandler.java
(rev 0)
+++
trunk/ui/output/ui/src/main/java/org/richfaces/view/facelets/html/ChangeExpandListenerHandler.java 2010-08-31
15:51:59 UTC (rev 19045)
@@ -0,0 +1,70 @@
+/*
+ * 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.view.facelets.html;
+
+import org.richfaces.event.ChangeExpandEvent;
+import org.richfaces.event.ChangeExpandListener;
+import org.richfaces.event.ChangeExpandSource;
+
+import javax.el.ValueExpression;
+import javax.faces.component.UIComponent;
+import javax.faces.context.FacesContext;
+import javax.faces.event.AbortProcessingException;
+import javax.faces.view.facelets.FaceletContext;
+import javax.faces.view.facelets.TagConfig;
+
+/**
+ *
+ * @author akolonitsky
+ * @version 1.0
+ */
+public final class ChangeExpandListenerHandler extends EventListenerHandler {
+
+ private static class LazyChangeExpandListener extends
LazyEventListener<ChangeExpandListener> implements ChangeExpandListener {
+ private static final long serialVersionUID = -391020876192823200L;
+
+ LazyChangeExpandListener(String type, ValueExpression binding) {
+ super(type, binding);
+ }
+
+ public void processChangeExpand(ChangeExpandEvent event) throws
AbortProcessingException {
+ processEvent(event);
+ }
+ }
+
+ public ChangeExpandListenerHandler(TagConfig config) {
+ super(config);
+ }
+
+ public void applyAttachedObject(FacesContext context, UIComponent parent) {
+ ValueExpression expression = null;
+ if (this.binding != null) {
+ FaceletContext ctx = (FaceletContext)
context.getAttributes().get(FaceletContext.FACELET_CONTEXT_KEY);
+ expression = this.binding.getValueExpression(ctx,
ChangeExpandListener.class);
+ }
+
+ ChangeExpandSource source = (ChangeExpandSource) parent;
+ source.addChangeExpandListener(new LazyChangeExpandListener(this.listenerType,
expression));
+ }
+}
+
Added:
trunk/ui/output/ui/src/main/java/org/richfaces/view/facelets/html/CollapsiblePanelTagHandler.java
===================================================================
---
trunk/ui/output/ui/src/main/java/org/richfaces/view/facelets/html/CollapsiblePanelTagHandler.java
(rev 0)
+++
trunk/ui/output/ui/src/main/java/org/richfaces/view/facelets/html/CollapsiblePanelTagHandler.java 2010-08-31
15:51:59 UTC (rev 19045)
@@ -0,0 +1,92 @@
+/*
+ * 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.view.facelets.html;
+
+import org.richfaces.component.AbstractCollapsiblePanel;
+
+import org.richfaces.event.MethodExpressionChangeExpandListener;
+import org.richfaces.event.ChangeExpandEvent;
+
+import javax.faces.view.facelets.ComponentConfig;
+import javax.faces.view.facelets.ComponentHandler;
+import javax.faces.view.facelets.FaceletContext;
+import javax.faces.view.facelets.MetaRule;
+import javax.faces.view.facelets.MetaRuleset;
+import javax.faces.view.facelets.Metadata;
+import javax.faces.view.facelets.MetadataTarget;
+import javax.faces.view.facelets.TagAttribute;
+
+/**
+ * @author akolonitsky
+ * @since 2010-08-27
+ */
+public class CollapsiblePanelTagHandler extends ComponentHandler {
+
+ private static final MetaRule META_RULE = new CollapsiblePanelMetaRule();
+
+
+ public CollapsiblePanelTagHandler(ComponentConfig config) {
+ super(config);
+ }
+
+ @Override
+ protected MetaRuleset createMetaRuleset(Class type) {
+ MetaRuleset metaRuleset = super.createMetaRuleset(type);
+ metaRuleset.addRule(META_RULE);
+ return metaRuleset;
+ }
+
+ private static class CollapsiblePanelMetaRule extends MetaRule{
+
+ @Override
+ public Metadata applyRule(String name, TagAttribute attribute, MetadataTarget
meta) {
+ if (meta.isTargetInstanceOf(AbstractCollapsiblePanel.class)) {
+ if ("changeExpandListener".equals(name)) {
+ return new ChangeExpandExpressionMetadata(attribute);
+ }
+
+ }
+ return null;
+ }
+ }
+
+ private static final class ChangeExpandExpressionMetadata extends Metadata {
+ private static final Class<?>[] CHANGE_EXPAND_SIG = new Class[]
{ChangeExpandEvent.class };
+
+ private final TagAttribute attr;
+
+ ChangeExpandExpressionMetadata(TagAttribute attr) {
+ this.attr = attr;
+ }
+
+ @Override
+ public void applyMetadata(FaceletContext ctx, Object instance) {
+ ((AbstractCollapsiblePanel) instance).addChangeExpandListener(new
MethodExpressionChangeExpandListener(
+ this.attr.getMethodExpression(ctx, null,
CHANGE_EXPAND_SIG)));
+ }
+ }
+
+
+
+}
+
Added:
trunk/ui/output/ui/src/main/java/org/richfaces/view/facelets/html/EventListenerHandler.java
===================================================================
---
trunk/ui/output/ui/src/main/java/org/richfaces/view/facelets/html/EventListenerHandler.java
(rev 0)
+++
trunk/ui/output/ui/src/main/java/org/richfaces/view/facelets/html/EventListenerHandler.java 2010-08-31
15:51:59 UTC (rev 19045)
@@ -0,0 +1,145 @@
+/**
+ * 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.view.facelets.html;
+
+import org.richfaces.component.AbstractCollapsiblePanel;
+
+import javax.el.ValueExpression;
+import javax.faces.component.UIComponent;
+import javax.faces.context.FacesContext;
+import javax.faces.event.AbortProcessingException;
+import javax.faces.event.FacesEvent;
+import javax.faces.event.FacesListener;
+import javax.faces.view.EditableValueHolderAttachedObjectHandler;
+import javax.faces.view.facelets.ComponentHandler;
+import javax.faces.view.facelets.FaceletContext;
+import javax.faces.view.facelets.TagAttribute;
+import javax.faces.view.facelets.TagAttributeException;
+import javax.faces.view.facelets.TagConfig;
+import javax.faces.view.facelets.TagException;
+import javax.faces.view.facelets.TagHandler;
+import java.io.IOException;
+import java.io.Serializable;
+
+/**
+ * @author akolonitsky
+ * @since Aug 31, 2010
+ */
+public abstract class EventListenerHandler extends TagHandler implements
EditableValueHolderAttachedObjectHandler {
+
+ protected final TagAttribute binding;
+
+ protected final String listenerType;
+
+ public abstract static class LazyEventListener<L extends FacesListener>
implements FacesListener, Serializable {
+
+ private static final long serialVersionUID = 1L;
+
+ protected final String type;
+
+ protected final ValueExpression binding;
+
+ protected LazyEventListener(String type, ValueExpression binding) {
+ this.type = type;
+ this.binding = binding;
+ }
+
+ public void processEvent(FacesEvent event) throws AbortProcessingException {
+
+ FacesContext faces = FacesContext.getCurrentInstance();
+ if (faces == null) {
+ return;
+ }
+
+ L instance = null;
+ if (this.binding != null) {
+ instance = (L) binding.getValue(faces.getELContext());
+ }
+ if (instance == null && this.type != null) {
+ try {
+ instance = (L) forName(this.type).newInstance();
+ } catch (Exception e) {
+ throw new AbortProcessingException("Couldn't Lazily
instantiate EventListener", e);
+ }
+ if (this.binding != null) {
+ binding.setValue(faces.getELContext(), instance);
+ }
+ }
+
+ if (instance != null) {
+ event.processListener(instance);
+ }
+ }
+ }
+
+ public EventListenerHandler(TagConfig config) {
+ super(config);
+ this.binding = this.getAttribute("binding");
+ TagAttribute type = this.getAttribute("type");
+ if (type != null) {
+ if (type.isLiteral()) {
+ try {
+ forName(type.getValue());
+ } catch (ClassNotFoundException e) {
+ throw new TagAttributeException(type, "Couldn't qualify
EventListener", e);
+ }
+ } else {
+ throw new TagAttributeException(type, "Must be a literal class name
of type EventListener");
+ }
+ this.listenerType = type.getValue();
+ } else {
+ this.listenerType = null;
+ }
+ }
+
+ public void apply(FaceletContext ctx, UIComponent parent) throws IOException {
+
+ // only process if it's been created
+ if (parent == null || !ComponentHandler.isNew(parent)) {
+ return;
+ }
+
+ if (parent instanceof AbstractCollapsiblePanel) {
+ applyAttachedObject(ctx.getFacesContext(), parent);
+ } else if (UIComponent.isCompositeComponent(parent)) {
+ // Allow the composite component to know about the target component.
+ TagHandlerUtils.getOrCreateRetargetableHandlersList(parent).add(this);
+ } else {
+ throw new TagException(this.tag, "Parent is not of type
EditableValueHolder, type is: " + parent);
+ }
+ }
+
+ public String getFor() {
+ TagAttribute attr = this.getAttribute("for");
+ return attr == null ? null : attr.getValue();
+ }
+
+ public static Class<?> forName(String name) throws ClassNotFoundException {
+ if (null == name || "".equals(name)) {
+ return null;
+ }
+
+ return Class.forName(name, false,
Thread.currentThread().getContextClassLoader());
+ }
+}
+
+
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-08-31 14:36:18
UTC (rev 19044)
+++ trunk/ui/output/ui/src/main/resources/META-INF/pn.faces-config.xml 2010-08-31 15:51:59
UTC (rev 19045)
@@ -11,6 +11,61 @@
</behavior>
<component>
+ <component-type>org.richfaces.CollapsiblePanel</component-type>
+
<component-class>org.richfaces.component.html.HtmlCollapsiblePanel</component-class>
+ <property>
+ <description></description>
+ <property-name>switchType</property-name>
+
<property-class>org.richfaces.component.SwitchType</property-class>
+ </property>
+ <property>
+ <description></description>
+ <property-name>expanded</property-name>
+ <property-class>boolean</property-class>
+ </property>
+ <property>
+ <description></description>
+ <property-name>header</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>
+ <property>
+ <description></description>
+ <property-name>changeExpandListener</property-name>
+ <property-class>javax.el.MethodExpression</property-class>
+ </property>
+
+ </component>
+ <component>
<component-type>org.richfaces.TogglePanel</component-type>
<component-class>org.richfaces.component.html.HtmlTogglePanel</component-class>
<property>
@@ -604,6 +659,11 @@
<render-kit>
<render-kit-id>HTML_BASIC</render-kit-id>
<renderer>
+
<component-family>org.richfaces.CollapsiblePanel</component-family>
+ <renderer-type>org.richfaces.CollapsiblePanel</renderer-type>
+
<renderer-class>org.richfaces.renderkit.html.CollapsiblePanelRenderer</renderer-class>
+ </renderer>
+ <renderer>
<component-family>org.richfaces.TogglePanel</component-family>
<renderer-type>org.richfaces.TogglePanel</renderer-type>
<renderer-class>org.richfaces.renderkit.html.TogglePanelRenderer</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-08-31 14:36:18 UTC
(rev 19044)
+++ trunk/ui/output/ui/src/main/resources/META-INF/pn.taglib.xml 2010-08-31 15:51:59 UTC
(rev 19045)
@@ -29,6 +29,217 @@
</tag>
<tag>
+ <tag-name>collapsiblePanel</tag-name>
+ <component>
+ <component-type>org.richfaces.CollapsiblePanel</component-type>
+ <renderer-type>org.richfaces.CollapsiblePanel</renderer-type>
+
<handler-class>org.richfaces.view.facelets.html.CollapsiblePanelTagHandler</handler-class>
+ </component>
+ <attribute>
+ <description></description>
+ <name>switchType</name>
+ <type>org.richfaces.component.SwitchType</type>
+ </attribute>
+ <attribute>
+ <description></description>
+ <name>expanded</name>
+ <type>boolean</type>
+ </attribute>
+ <attribute>
+ <description></description>
+ <name>header</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>immediate</name>
+ <type>boolean</type>
+ </attribute>
+ <attribute>
+ <description></description>
+ <name>changeExpandListener</name>
+ <type>javax.el.MethodExpression</type>
+ </attribute>
+ <attribute>
+ <description></description>
+ <name>bodyClass</name>
+ <type>java.lang.String</type>
+ </attribute>
+ <attribute>
+ <description></description>
+ <name>headerClass</name>
+ <type>java.lang.String</type>
+ </attribute>
+ <attribute>
+ <description></description>
+ <name>headerControlClass</name>
+ <type>java.lang.String</type>
+ </attribute>
+ <attribute>
+ <description></description>
+ <name>oncomplete</name>
+ <type>java.lang.String</type>
+ </attribute>
+ <attribute>
+ <description></description>
+ <name>onbeforedomupdate</name>
+ <type>java.lang.String</type>
+ </attribute>
+ <attribute>
+ <description></description>
+ <name>ononswitch</name>
+ <type>java.lang.String</type>
+ </attribute>
+ <attribute>
+ <description></description>
+ <name>ononbeforeswitch</name>
+ <type>java.lang.String</type>
+ </attribute>
+ <attribute>
+ <description></description>
+ <name>lang</name>
+ <type>java.lang.String</type>
+ </attribute>
+ <attribute>
+ <description></description>
+ <name>title</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>dir</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>
+ <description>
+ Register a ChangeExpandListener instance on the UIComponent
+ associated with the closest parent UIComponent custom
+ action.
+ </description>
+ <tag-name>changeExpandListener</tag-name>
+
<handler-class>org.richfaces.view.facelets.html.ChangeExpandListenerHandler</handler-class>
+ <attribute>
+ <description>
+ Fully qualified Java class name of a
+ ChangeExpandListener to be created and registered.
+ </description>
+ <name>type</name>
+ <type>java.lang.String</type>
+ </attribute>
+ <attribute>
+ <description>
+ Value binding expression that evaluates to an object that
+ implements org.richfaces.event.ChangeExpandListener.
+ </description>
+ <name>binding</name>
+ <required>false</required>
+ <type>org.richfaces.event.ChangeExpandListener</type>
+ </attribute>
+ <attribute>
+ <description>
+ <p class="changed_added_2_0">If present, this
attribute refers
+ to the value of one of the exposed attached objects within the
+ composite component inside of which this tag is
nested.</p>
+ </description>
+ <name>for</name>
+ <required>false</required>
+ <type>java.lang.String</type>
+ </attribute>
+ </tag>
+
+ <tag>
<tag-name>togglePanel</tag-name>
<component>
<component-type>org.richfaces.TogglePanel</component-type>
@@ -37,6 +248,11 @@
</component>
<attribute>
<description></description>
+ <name>cycledSwitching</name>
+ <type>boolean</type>
+ </attribute>
+ <attribute>
+ <description></description>
<name>switchType</name>
<type>org.richfaces.component.SwitchType</type>
</attribute>
@@ -57,11 +273,6 @@
</attribute>
<attribute>
<description></description>
- <name>cycledSwitching</name>
- <type>boolean</type>
- </attribute>
- <attribute>
- <description></description>
<name>data</name>
<type>java.lang.Object</type>
</attribute>
@@ -219,7 +430,7 @@
<component>
<component-type>org.richfaces.TogglePanelItem</component-type>
<renderer-type>org.richfaces.TogglePanelItem</renderer-type>
-
+
</component>
<attribute>
<description></description>
@@ -324,10 +535,15 @@
<component>
<component-type>org.richfaces.Accordion</component-type>
<renderer-type>org.richfaces.Accordion</renderer-type>
-
+
</component>
<attribute>
<description></description>
+ <name>cycledSwitching</name>
+ <type>boolean</type>
+ </attribute>
+ <attribute>
+ <description></description>
<name>switchType</name>
<type>org.richfaces.component.SwitchType</type>
</attribute>
@@ -338,16 +554,6 @@
</attribute>
<attribute>
<description></description>
- <name>height</name>
- <type>java.lang.String</type>
- </attribute>
- <attribute>
- <description></description>
- <name>width</name>
- <type>java.lang.String</type>
- </attribute>
- <attribute>
- <description></description>
<name>bypassUpdates</name>
<type>boolean</type>
</attribute>
@@ -358,11 +564,6 @@
</attribute>
<attribute>
<description></description>
- <name>cycledSwitching</name>
- <type>boolean</type>
- </attribute>
- <attribute>
- <description></description>
<name>data</name>
<type>java.lang.Object</type>
</attribute>
@@ -408,6 +609,16 @@
</attribute>
<attribute>
<description></description>
+ <name>width</name>
+ <type>java.lang.String</type>
+ </attribute>
+ <attribute>
+ <description></description>
+ <name>height</name>
+ <type>java.lang.String</type>
+ </attribute>
+ <attribute>
+ <description></description>
<name>itemHeaderClassActive</name>
<type>java.lang.String</type>
</attribute>
@@ -509,7 +720,7 @@
<component>
<component-type>org.richfaces.TogglePanelTitledItem</component-type>
<renderer-type>org.richfaces.AccordionItem</renderer-type>
-
+
</component>
<attribute>
<description></description>
@@ -673,8 +884,4 @@
</attribute>
</tag>
-
-
-
-
</facelet-taglib>
Added:
trunk/ui/output/ui/src/main/resources/META-INF/resources/org.richfaces/CollapsiblePanel.js
===================================================================
---
trunk/ui/output/ui/src/main/resources/META-INF/resources/org.richfaces/CollapsiblePanel.js
(rev 0)
+++
trunk/ui/output/ui/src/main/resources/META-INF/resources/org.richfaces/CollapsiblePanel.js 2010-08-31
15:51:59 UTC (rev 19045)
@@ -0,0 +1,84 @@
+/*
+ * 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 || {};
+
+ rf.ui.CollapsiblePanel = rf.ui.TogglePanel.extendClass({
+
+ name:"CollapsiblePanel",
+
+ /**
+ * @class CollapsiblePanel
+ * @name CollapsiblePanel
+ *
+ * @constructor
+ * @param {String} componentId - component id
+ * @param {Hash} options - params
+ * */
+ init : function (componentId, options) {
+ rf.ui.TogglePanel.call(this, componentId, options);
+ this.switchMode = options.switchMode;
+
+ this.items = [
+ new RichFaces.ui.CollapsiblePanelItem(
+ this.id + ":content", {"index":0,
"togglePanelId":this.id, "switchMode":this.switchMode,
"name":"true"}),
+
+ new RichFaces.ui.CollapsiblePanelItem(
+ this.id + ":empty", {"index":1,
"togglePanelId":this.id, "switchMode":this.switchMode,
"name":"false"})
+ ];
+ this.options.cycledSwitching = true;
+
+ rf.Event.bindById(this.id + ":header", "click",
this.__onHeaderClick, this)
+ },
+
+ switchPanel : function (to) {
+ this.switchToItem(to || "@next");
+ },
+
+ /***************************** Private Methods
********************************************************/
+
+ __onHeaderClick : function () {
+ this.switchToItem("@next");
+ },
+
+ __fireItemChange : function (oldItem, newItem) {
+ return new rf.Event.fireById(this.id, "switch", {
+ id: this.id,
+ isExpanded : newItem.getName()
+ });
+ },
+
+ __fireBeforeItemChange : function (oldItem, newItem) {
+ return rf.Event.fireById(this.id, "beforeswitch", {
+ id: this.id,
+ isExpanded : newItem.getName()
+ });
+ },
+
+
+ destroy: function () {
+ rf.ui.TogglePanel.destroy.call(this);
+ }
+ });
+})(jQuery, RichFaces);
Added:
trunk/ui/output/ui/src/main/resources/META-INF/resources/org.richfaces/CollapsiblePanelItem.js
===================================================================
---
trunk/ui/output/ui/src/main/resources/META-INF/resources/org.richfaces/CollapsiblePanelItem.js
(rev 0)
+++
trunk/ui/output/ui/src/main/resources/META-INF/resources/org.richfaces/CollapsiblePanelItem.js 2010-08-31
15:51:59 UTC (rev 19045)
@@ -0,0 +1,60 @@
+/*
+ * 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 || {};
+
+ rf.ui.CollapsiblePanelItem = rf.ui.TogglePanelItem.extendClass({
+
+ init : function (componentId, options) {
+ rf.ui.TogglePanelItem.call(this, componentId, options);
+ },
+
+ __enter : function () {
+ rf.getDomElement(this.id).style.display = "block";
+ this.__header(this.__state()).show();
+
+ return true;
+ },
+
+ __leave : function () {
+ rf.getDomElement(this.id).style.display = "none";
+ this.__header(this.__state()).hide();
+
+ return true;
+ },
+
+ __state : function () {
+ return this.getName() === "true" ? "expanded" :
"collapsed";
+ },
+
+ __header : function (state) {
+ var res = $(rf.getDomElement(this.togglePanelId + ":header"));
+ if (state) {
+ return res.find(".rf-cp-hr-" + state);
+ }
+
+ return res;
+ }
+ });
+})(jQuery, RichFaces);
Modified:
trunk/ui/output/ui/src/main/resources/META-INF/resources/org.richfaces/TogglePanel.js
===================================================================
---
trunk/ui/output/ui/src/main/resources/META-INF/resources/org.richfaces/TogglePanel.js 2010-08-31
14:36:18 UTC (rev 19044)
+++
trunk/ui/output/ui/src/main/resources/META-INF/resources/org.richfaces/TogglePanel.js 2010-08-31
15:51:59 UTC (rev 19045)
@@ -111,7 +111,7 @@
this.__setActiveItem(newPanel.getName());
newPanel.__enter();
- this.__fireItemChange(oldPanel, newPanel);
+ this.comp.__fireItemChange(oldPanel, newPanel);
return true;
},
@@ -136,16 +136,6 @@
* */
__getValueInputId: function () {
return this.comp.id + "-value"
- },
-
- /********************* Events *************************/
-
- __fireItemChange : function (oldItem, newItem) {
- return new rf.Event.fireById(this.comp.id, "itemchange", {
- id: this.comp.id,
- oldItem : oldItem,
- newItem : newItem
- });
}
};
@@ -163,7 +153,6 @@
name:"TogglePanel",
init : function (componentId, options) {
- // call constructor of parent class
rf.BaseComponent.call(this, componentId);
this.attachToDom(componentId);
@@ -381,6 +370,15 @@
/**
* Fire Concealable Event
* */
+
+ __fireItemChange : function (oldItem, newItem) {
+ return new rf.Event.fireById(this.id, "itemchange", {
+ id: this.id,
+ oldItem : oldItem,
+ newItem : newItem
+ });
+ },
+
__fireBeforeItemChange : function (oldItem, newItem) {
return rf.Event.fireById(this.id, "beforeitemchange", {
id: this.id,
@@ -389,11 +387,8 @@
});
},
- // class stuff
destroy: function () {
- // rf.Event.unbindById(this.options.buttonId,
"."+this.namespace);
- // rf.Event.unbindById(this.componentId,
"."+this.namespace);
- // $super.destroy.call(this);
+ rf.BaseComponent.destroy.call(this);
}
});
})(jQuery, RichFaces);
Added:
trunk/ui/output/ui/src/main/resources/META-INF/resources/org.richfaces/collapsiblePanel.ecss
===================================================================
---
trunk/ui/output/ui/src/main/resources/META-INF/resources/org.richfaces/collapsiblePanel.ecss
(rev 0)
+++
trunk/ui/output/ui/src/main/resources/META-INF/resources/org.richfaces/collapsiblePanel.ecss 2010-08-31
15:51:59 UTC (rev 19045)
@@ -0,0 +1,29 @@
+.rf-cp{
+ background-color:'#{richSkin.generalBackgroundColor}';
+ color:'#{richSkin.panelBorderColor}';
+ border-width:1px;
+ border-style:solid;
+ padding:1px;
+}
+
+.rf-cp-hr{
+ background-color:'#{richSkin.headerBackgroundColor}';
+ border-color:'#{richSkin.headerBackgroundColor}';
+ font-size:'#{richSkin.headerSizeFont}';
+ color:'#{richSkin.headerTextColor}';
+ font-weight:'#{richSkin.headerWeightFont}';
+ font-family:'#{richSkin.headerFamilyFont}';
+ padding:2px;
+ border-width:1px;
+ border-style:solid;
+ background-position:top left;
+ background-repeat:repeat-x;
+ background-image:"url(#{resource['org.richfaces.renderkit.html.GradientA']})";
+}
+
+.rf-cp-b{
+ font-size:'#{richSkin.generalSizeFont}';
+ color:'#{richSkin.generalTextColor}';
+ font-family:'#{richSkin.generalFamilyFont}';
+ padding:10px;
+}
\ No newline at end of file