Author: Alex.Kolonitsky
Date: 2010-07-20 11:17:30 -0400 (Tue, 20 Jul 2010)
New Revision: 18161
Added:
root/ui/output/trunk/panels/api/src/main/java/org/richfaces/
root/ui/output/trunk/panels/api/src/main/java/org/richfaces/component/
root/ui/output/trunk/panels/api/src/main/java/org/richfaces/component/SwitchType.java
root/ui/output/trunk/panels/api/src/main/java/org/richfaces/event/
root/ui/output/trunk/panels/api/src/main/java/org/richfaces/event/ItemChangeEvent.java
root/ui/output/trunk/panels/api/src/main/java/org/richfaces/event/ItemChangeListener.java
root/ui/output/trunk/panels/ui/src/main/java/org/richfaces/event/MethodExpressionItemChangeListener.java
root/ui/output/trunk/panels/ui/src/main/java/org/richfaces/view/
root/ui/output/trunk/panels/ui/src/main/java/org/richfaces/view/facelets/
root/ui/output/trunk/panels/ui/src/main/java/org/richfaces/view/facelets/html/
root/ui/output/trunk/panels/ui/src/main/java/org/richfaces/view/facelets/html/ItemChangeListenerHandler.java
root/ui/output/trunk/panels/ui/src/main/java/org/richfaces/view/facelets/html/TogglePanelTagHandler.java
Removed:
root/ui/output/trunk/panels/ui/src/main/java/org/richfaces/component/Method.java
root/ui/output/trunk/panels/ui/src/main/java/org/richfaces/component/UIDivPanel.java
root/ui/output/trunk/panels/ui/src/main/java/org/richfaces/event/MethodExpressionSelectedItemChangeListener.java
root/ui/output/trunk/panels/ui/src/main/java/org/richfaces/event/SelectedItemChangeEvent.java
root/ui/output/trunk/panels/ui/src/main/java/org/richfaces/event/SelectedItemChangeListener.java
root/ui/output/trunk/panels/ui/src/main/java/org/richfaces/taglib/
Modified:
root/core/trunk/impl/src/main/resources/META-INF/resources/richfaces-base-component.js
root/dist/trunk/readme-ui.txt
root/examples/output-demo/trunk/pom.xml
root/examples/output-demo/trunk/src/main/webapp/examples/togglePanel-ajax.xhtml
root/examples/output-demo/trunk/src/main/webapp/examples/togglePanel-client.xhtml
root/examples/output-demo/trunk/src/main/webapp/examples/togglePanel-server.xhtml
root/examples/output-demo/trunk/src/main/webapp/examples/togglePanel.xhtml
root/examples/output-demo/trunk/src/main/webapp/qunit/togglePanel.xhtml
root/examples/output-demo/trunk/src/main/webapp/qunit/togglePanelItem.xhtml
root/examples/output-demo/trunk/src/main/webapp/resources/tests/richfaces-toggle-panel-item-qunit.js
root/examples/output-demo/trunk/src/main/webapp/resources/tests/richfaces-toggle-panel-qunit.js
root/ui/misc/trunk/parent/pom.xml
root/ui/output/trunk/panels/ui/src/main/java/org/richfaces/component/AbstractDivPanel.java
root/ui/output/trunk/panels/ui/src/main/java/org/richfaces/component/AbstractTogglePanel.java
root/ui/output/trunk/panels/ui/src/main/java/org/richfaces/component/AbstractTogglePanelItem.java
root/ui/output/trunk/panels/ui/src/main/java/org/richfaces/component/UITogglePanel.java
root/ui/output/trunk/panels/ui/src/main/java/org/richfaces/component/UITogglePanelItem.java
root/ui/output/trunk/panels/ui/src/main/java/org/richfaces/component/behavior/ToggleControl.java
root/ui/output/trunk/panels/ui/src/main/java/org/richfaces/component/html/HtmlDivPanel.java
root/ui/output/trunk/panels/ui/src/main/java/org/richfaces/component/html/HtmlTogglePanel.java
root/ui/output/trunk/panels/ui/src/main/java/org/richfaces/component/html/HtmlTogglePanelItem.java
root/ui/output/trunk/panels/ui/src/main/java/org/richfaces/renderkit/html/DivPanelRenderer.java
root/ui/output/trunk/panels/ui/src/main/java/org/richfaces/renderkit/html/ToggleControlRenderer.java
root/ui/output/trunk/panels/ui/src/main/java/org/richfaces/renderkit/html/TogglePanelRenderer.java
root/ui/output/trunk/panels/ui/src/main/resources/META-INF/pn.faces-config.xml
root/ui/output/trunk/panels/ui/src/main/resources/META-INF/pn.taglib.xml
root/ui/output/trunk/panels/ui/src/main/resources/META-INF/resources/script/TogglePanel.js
root/ui/output/trunk/panels/ui/src/main/resources/META-INF/resources/script/TogglePanelItem.js
Log:
fix toggle-panel review
rename selectedItem to activeItem
rename selectedItemChangeListener to itemChangeListener
Modified:
root/core/trunk/impl/src/main/resources/META-INF/resources/richfaces-base-component.js
===================================================================
---
root/core/trunk/impl/src/main/resources/META-INF/resources/richfaces-base-component.js 2010-07-20
15:11:58 UTC (rev 18160)
+++
root/core/trunk/impl/src/main/resources/META-INF/resources/richfaces-base-component.js 2010-07-20
15:17:30 UTC (rev 18161)
@@ -125,6 +125,17 @@
*
* });
*
+ * RichFaces.ui.MySecondClass = RichFaces.ui.MyClass({
+ * //
+ * name : "MySecondClass",
+ *
+ * // Constructor
+ * init : function (...) {
+ * // ...
+ * }
+ *
+ * })
+ *
* */
richfaces.BaseComponent.extendClass = function (methods) {
var DerivedClass = methods.init || richfaces.blankFunction;
@@ -140,8 +151,6 @@
return DerivedClass;
},
-
-
$.extend(richfaces.BaseComponent.prototype, (function (params) {
return {
/**
Modified: root/dist/trunk/readme-ui.txt
===================================================================
--- root/dist/trunk/readme-ui.txt 2010-07-20 15:11:58 UTC (rev 18160)
+++ root/dist/trunk/readme-ui.txt 2010-07-20 15:17:30 UTC (rev 18161)
@@ -86,7 +86,7 @@
rich:togglePanel
rich:toggleControl
rich:togglePanelItem
-rich:selectedItemChangeListener
+rich:itemChangeListener
Learn more
Modified: root/examples/output-demo/trunk/pom.xml
===================================================================
--- root/examples/output-demo/trunk/pom.xml 2010-07-20 15:11:58 UTC (rev 18160)
+++ root/examples/output-demo/trunk/pom.xml 2010-07-20 15:17:30 UTC (rev 18161)
@@ -2,6 +2,12 @@
<project
xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
http://maven.apache.org/xsd/maven-4.0.0.xsd">
+ <parent>
+ <groupId>org.richfaces</groupId>
+ <artifactId>richfaces-parent</artifactId>
+ <version>9</version>
+ </parent>
+
<modelVersion>4.0.0</modelVersion>
<groupId>org.richfaces.ui.panels</groupId>
@@ -127,43 +133,32 @@
<dependencyManagement>
<dependencies>
<dependency>
- <groupId>org.richfaces.ui.panels</groupId>
- <artifactId>richfaces-ui-panels-bom</artifactId>
+ <groupId>org.richfaces.ui.output</groupId>
+ <artifactId>richfaces-ui-output-bom</artifactId>
<version>${version}</version>
<scope>import</scope>
<type>pom</type>
</dependency>
- <dependency>
- <groupId>org.richfaces.ui.misc</groupId>
- <artifactId>richfaces-ui-misc-bom</artifactId>
- <version>${version}</version>
- <scope>import</scope>
- <type>pom</type>
- </dependency>
</dependencies>
</dependencyManagement>
<dependencies>
<dependency>
- <groupId>org.richfaces.ui.panels</groupId>
- <artifactId>richfaces-ui-panels-ui</artifactId>
+ <groupId>org.richfaces.ui.output</groupId>
+ <artifactId>richfaces-ui-output-ui</artifactId>
</dependency>
<dependency>
<groupId>org.richfaces.ui.core</groupId>
<artifactId>richfaces-ui-core-ui</artifactId>
</dependency>
- <dependency>
- <groupId>org.richfaces.ui.misc</groupId>
- <artifactId>richfaces-ui-misc-ui</artifactId>
- </dependency>
<dependency>
- <groupId>com.sun.faces</groupId>
- <artifactId>jsf-api</artifactId>
+ <groupId>${jsf2.api.groupid}</groupId>
+ <artifactId>${jsf2.api.artifactid}</artifactId>
</dependency>
<dependency>
- <groupId>com.sun.faces</groupId>
- <artifactId>jsf-impl</artifactId>
+ <groupId>${jsf2.impl.groupid}</groupId>
+ <artifactId>${jsf2.impl.artifactid}</artifactId>
</dependency>
<dependency>
<groupId>javax.servlet</groupId>
Modified: root/examples/output-demo/trunk/src/main/webapp/examples/togglePanel-ajax.xhtml
===================================================================
---
root/examples/output-demo/trunk/src/main/webapp/examples/togglePanel-ajax.xhtml 2010-07-20
15:11:58 UTC (rev 18160)
+++
root/examples/output-demo/trunk/src/main/webapp/examples/togglePanel-ajax.xhtml 2010-07-20
15:17:30 UTC (rev 18161)
@@ -3,7 +3,7 @@
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/panels">
+
xmlns:pn="http://richfaces.org/output">
<body>
<ui:composition template="/templates/template.xhtml">
@@ -14,8 +14,8 @@
<ui:define name="body">
<f:view>
<h:form id="f">
- <pn:togglePanel id="my_id" selectedItem="name1"
switchType="ajax"
-
selectedItemChangeListener="#{togglePanelBean.itemChangeActionListener}" >
+ <pn:togglePanel id="my_id" activeItem="name1"
switchType="ajax"
+
itemChangeListener="#{togglePanelBean.itemChangeActionListener}" >
<pn:togglePanelItem name="name1">hello
name1</pn:togglePanelItem>
<pn:togglePanelItem name="name2">hello
name2</pn:togglePanelItem>
<pn:togglePanelItem name="name3">hello
name3</pn:togglePanelItem>
Modified:
root/examples/output-demo/trunk/src/main/webapp/examples/togglePanel-client.xhtml
===================================================================
---
root/examples/output-demo/trunk/src/main/webapp/examples/togglePanel-client.xhtml 2010-07-20
15:11:58 UTC (rev 18160)
+++
root/examples/output-demo/trunk/src/main/webapp/examples/togglePanel-client.xhtml 2010-07-20
15:17:30 UTC (rev 18161)
@@ -3,7 +3,7 @@
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/panels">
+
xmlns:pn="http://richfaces.org/output">
<body>
<ui:composition template="/templates/template.xhtml">
@@ -13,7 +13,7 @@
<ui:define name="body">
<h:form id="f">
- <pn:togglePanel id="panel" selectedItem="name1"
switchType="client" lang="en">
+ <pn:togglePanel id="panel" activeItem="name1"
switchType="client" lang="en">
<pn:togglePanelItem name="name1">hello
name1</pn:togglePanelItem>
<pn:togglePanelItem name="name2">hello
name2</pn:togglePanelItem>
<pn:togglePanelItem name="name3">hello
name3</pn:togglePanelItem>
Modified:
root/examples/output-demo/trunk/src/main/webapp/examples/togglePanel-server.xhtml
===================================================================
---
root/examples/output-demo/trunk/src/main/webapp/examples/togglePanel-server.xhtml 2010-07-20
15:11:58 UTC (rev 18160)
+++
root/examples/output-demo/trunk/src/main/webapp/examples/togglePanel-server.xhtml 2010-07-20
15:17:30 UTC (rev 18161)
@@ -3,7 +3,7 @@
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/panels">
+
xmlns:pn="http://richfaces.org/output">
<body>
<ui:composition template="/templates/template.xhtml">
@@ -14,7 +14,7 @@
<ui:define name="body">
<f:view>
<h:form id="f">
- <pn:togglePanel id="my_id" selectedItem="name1"
switchType="server" lang="en">
+ <pn:togglePanel id="my_id" activeItem="name1"
switchType="server" lang="en">
<pn:togglePanelItem name="name1">hello
name1</pn:togglePanelItem>
<pn:togglePanelItem name="name2">hello
name2</pn:togglePanelItem>
<pn:togglePanelItem name="name3">hello
name3</pn:togglePanelItem>
Modified: root/examples/output-demo/trunk/src/main/webapp/examples/togglePanel.xhtml
===================================================================
--- root/examples/output-demo/trunk/src/main/webapp/examples/togglePanel.xhtml 2010-07-20
15:11:58 UTC (rev 18160)
+++ root/examples/output-demo/trunk/src/main/webapp/examples/togglePanel.xhtml 2010-07-20
15:17:30 UTC (rev 18161)
@@ -3,7 +3,7 @@
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/panels">
+
xmlns:pn="http://richfaces.org/output">
<body>
<ui:composition template="/templates/template.xhtml">
@@ -13,7 +13,7 @@
<ui:define name="body">
<h:form id="f">
- <pn:togglePanel id="my_id" lang="en"
selectedItem="name1">
+ <pn:togglePanel id="my_id" lang="en"
activeItem="name1">
<pn:togglePanelItem name="name1">
hello name1
</pn:togglePanelItem>
Modified: root/examples/output-demo/trunk/src/main/webapp/qunit/togglePanel.xhtml
===================================================================
--- root/examples/output-demo/trunk/src/main/webapp/qunit/togglePanel.xhtml 2010-07-20
15:11:58 UTC (rev 18160)
+++ root/examples/output-demo/trunk/src/main/webapp/qunit/togglePanel.xhtml 2010-07-20
15:17:30 UTC (rev 18161)
@@ -3,7 +3,7 @@
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/panels">
+
xmlns:pn="http://richfaces.org/output">
<body>
<ui:composition template="/templates/template.xhtml">
@@ -22,7 +22,7 @@
<p>Page</p>
<h:form id="f" style="border:blue solid thin;">
- <pn:togglePanel id="panel" selectedItem="name1"
switchType="client" lang="en">
+ <pn:togglePanel id="panel" activeItem="name1"
switchType="client" lang="en">
<pn:togglePanelItem id="name1"
name="name1">hello name1</pn:togglePanelItem>
<pn:togglePanelItem id="name2"
name="name2">hello name2</pn:togglePanelItem>
<pn:togglePanelItem id="name3"
name="name3">hello name3</pn:togglePanelItem>
Modified: root/examples/output-demo/trunk/src/main/webapp/qunit/togglePanelItem.xhtml
===================================================================
--- root/examples/output-demo/trunk/src/main/webapp/qunit/togglePanelItem.xhtml 2010-07-20
15:11:58 UTC (rev 18160)
+++ root/examples/output-demo/trunk/src/main/webapp/qunit/togglePanelItem.xhtml 2010-07-20
15:17:30 UTC (rev 18161)
@@ -3,7 +3,7 @@
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/panels">
+
xmlns:pn="http://richfaces.org/output">
<body>
<ui:composition template="/templates/template.xhtml">
@@ -22,7 +22,7 @@
<p>Page</p>
<h:form id="f" style="border:blue solid thin;">
- <pn:togglePanel id="panel" selectedItem="name1"
switchType="client" lang="en">
+ <pn:togglePanel id="panel" activeItem="name1"
switchType="client" lang="en">
<pn:togglePanelItem id="name1"
name="name1">hello name1</pn:togglePanelItem>
<pn:togglePanelItem id="name2"
name="name2">hello name2</pn:togglePanelItem>
<pn:togglePanelItem id="name3"
name="name3">hello name3</pn:togglePanelItem>
Modified:
root/examples/output-demo/trunk/src/main/webapp/resources/tests/richfaces-toggle-panel-item-qunit.js
===================================================================
---
root/examples/output-demo/trunk/src/main/webapp/resources/tests/richfaces-toggle-panel-item-qunit.js 2010-07-20
15:11:58 UTC (rev 18160)
+++
root/examples/output-demo/trunk/src/main/webapp/resources/tests/richfaces-toggle-panel-item-qunit.js 2010-07-20
15:17:30 UTC (rev 18161)
@@ -20,22 +20,22 @@
expect(2);
var state = 1;
- var leave = RichFaces.Event.bindById(componentId, "leave", function ()
{
+ var leave = RichFaces.Event.bindById(componentId, "__leave", function
() {
ok(state == 1, "leave handler invouked (state == 1)");
state++;
});
- item.leave();
+ item.__leave();
- var enter = RichFaces.Event.bindById(componentId, "enter", function ()
{
+ var enter = RichFaces.Event.bindById(componentId, "__enter", function
() {
ok(state == 2, "enter handler invouked (state == 2)");
state++;
});
- item.enter();
+ item.__enter();
- RichFaces.Event.unbindById(componentId, "leave", leave);
- RichFaces.Event.unbindById(componentId, "enter", enter);
+ RichFaces.Event.unbindById(componentId, "__leave", leave);
+ RichFaces.Event.unbindById(componentId, "__enter", enter);
});
test("TogglePanelItem test cacelable of leave", function () {
@@ -44,14 +44,14 @@
expect(2);
var state = 1;
- var leave = RichFaces.Event.bindById(componentId, "leave", function ()
{
+ var leave = RichFaces.Event.bindById(componentId, "__leave", function
() {
ok(true, "leave handler invouked");
return false;
});
- ok(!item.leave(), "!item.leave()");
+ ok(!item.__leave(), "!item.leave()");
- RichFaces.Event.bindById(componentId, "leave", leave);
+ RichFaces.Event.bindById(componentId, "__leave", leave);
});
});
\ No newline at end of file
Modified:
root/examples/output-demo/trunk/src/main/webapp/resources/tests/richfaces-toggle-panel-qunit.js
===================================================================
---
root/examples/output-demo/trunk/src/main/webapp/resources/tests/richfaces-toggle-panel-qunit.js 2010-07-20
15:11:58 UTC (rev 18160)
+++
root/examples/output-demo/trunk/src/main/webapp/resources/tests/richfaces-toggle-panel-qunit.js 2010-07-20
15:17:30 UTC (rev 18161)
@@ -20,7 +20,7 @@
equals(c.componentId, undefined, "componentId shouldn't be here, we must
use id form component base");
equals(c.id, TOGGLE_PANEL_ID, "id");
equals(c.switchMode, "client", "switchMode");
- equals(c.selectedItem, "name1", "selectedItem");
+ equals(c.activeItem, "name1", "activeItem");
equals(c.items.length, 3, "items");
// test public api
@@ -155,14 +155,14 @@
});
var fromItem = c.getItems()[0];
- var leave = RichFaces.Event.bindById(fromItem.id, "leave", function ()
{
+ var leave = RichFaces.Event.bindById(fromItem.id, "__leave", function
() {
ok(state == 2, "leave handler invouked (state = " + state +
")");
state++;
});
var toItem = c.getItems()[2];
- var enter = RichFaces.Event.bindById(toItem.id, "enter", function () {
+ var enter = RichFaces.Event.bindById(toItem.id, "__enter", function ()
{
ok(state == 3, "enter handler invouked (state = " + state +
")");
state++;
@@ -178,8 +178,8 @@
c.switchToItem("name3");
RichFaces.Event.unbindById(componentId, "beforeitemchange",
beforeitemchange);
- RichFaces.Event.unbindById(fromItem.id, "leave", leave);
- RichFaces.Event.unbindById(toItem.id, "enter", enter);
+ RichFaces.Event.unbindById(fromItem.id, "__leave", leave);
+ RichFaces.Event.unbindById(toItem.id, "__enter", enter);
RichFaces.Event.unbindById(componentId, "itemchange", itemchange);
c.switchToItem("name1");
@@ -199,7 +199,7 @@
});
var fromItem = c.getItems()[0];
- var leave = RichFaces.Event.bindById(fromItem.id, "leave", function ()
{
+ var leave = RichFaces.Event.bindById(fromItem.id, "__leave", function
() {
ok(state == 2, "leave handler invouked (state = " + state +
")");
state++;
@@ -207,7 +207,7 @@
});
var toItem = c.getItems()[2];
- var enter = RichFaces.Event.bindById(toItem.id, "enter", function () {
+ var enter = RichFaces.Event.bindById(toItem.id, "__enter", function ()
{
ok(state == 3, "enter handler invouked (state = " + state +
")");
state++;
@@ -223,8 +223,8 @@
c.switchToItem("name3");
RichFaces.Event.unbindById(componentId, "beforeitemchange",
beforeitemchange);
- RichFaces.Event.unbindById(componentId, "leave", leave);
- RichFaces.Event.unbindById(componentId, "enter", enter);
+ RichFaces.Event.unbindById(componentId, "__leave", leave);
+ RichFaces.Event.unbindById(componentId, "__enter", enter);
RichFaces.Event.unbindById(componentId, "itemchange", itemchange);
});
Modified: root/ui/misc/trunk/parent/pom.xml
===================================================================
--- root/ui/misc/trunk/parent/pom.xml 2010-07-20 15:11:58 UTC (rev 18160)
+++ root/ui/misc/trunk/parent/pom.xml 2010-07-20 15:17:30 UTC (rev 18161)
@@ -41,8 +41,8 @@
<dependencyManagement>
<dependencies>
-
- <!-- TODO: remove this dependency used by componentControl -->
+
+ <!-- TODO: remove this dependency used by componentControl -->
<dependency>
<groupId>org.richfaces.ui.core</groupId>
<artifactId>richfaces-ui-core-bom</artifactId>
Copied:
root/ui/output/trunk/panels/api/src/main/java/org/richfaces/component/SwitchType.java
(from rev 18081,
root/ui/output/trunk/panels/ui/src/main/java/org/richfaces/component/Method.java)
===================================================================
--- root/ui/output/trunk/panels/api/src/main/java/org/richfaces/component/SwitchType.java
(rev 0)
+++
root/ui/output/trunk/panels/api/src/main/java/org/richfaces/component/SwitchType.java 2010-07-20
15:17:30 UTC (rev 18161)
@@ -0,0 +1,24 @@
+package org.richfaces.component;
+
+/**
+ * @author akolonitsky
+ * @since Jun 15, 2010
+ */
+public enum SwitchType {
+ /**
+ * value for tab change method for - client-side tabs.
+ */
+ client,
+
+ /**
+ * value for tab change method - server-side tabs
+ */
+ server,
+
+ /**
+ * value for tab change method - ajax tabs
+ */
+ ajax;
+
+ public static final SwitchType DEFAULT = SwitchType.ajax;
+}
Copied:
root/ui/output/trunk/panels/api/src/main/java/org/richfaces/event/ItemChangeEvent.java
(from rev 18081,
root/ui/output/trunk/panels/ui/src/main/java/org/richfaces/event/SelectedItemChangeEvent.java)
===================================================================
---
root/ui/output/trunk/panels/api/src/main/java/org/richfaces/event/ItemChangeEvent.java
(rev 0)
+++
root/ui/output/trunk/panels/api/src/main/java/org/richfaces/event/ItemChangeEvent.java 2010-07-20
15:17:30 UTC (rev 18161)
@@ -0,0 +1,94 @@
+/*
+ * 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;
+
+
+/**
+ * <p>A {@link ItemChangeEvent} is a ...</p>
+ *
+ * @author akolonitsky
+ * @version 1.0
+ * @since -4712-01-01
+ */
+public class ItemChangeEvent extends FacesEvent {
+
+ private static final long serialVersionUID = -4747704006016875163L;
+
+ private final String oldItem;
+ private final String newItem;
+
+ // ------------------------------------------------------------ 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 oldItem
+ * @param newItem
+ *
+ * @throws IllegalArgumentException if <code>component</code> is
+ * <code>null</code>
+ */
+ public ItemChangeEvent(UIComponent component, String oldItem, String newItem) {
+ super(component);
+ this.oldItem = oldItem;
+ this.newItem = newItem;
+ }
+
+
+ // -------------------------------------------------------------- Properties
+
+ public String getOldItem() {
+ return oldItem;
+ }
+
+ public String getNewItem() {
+ return newItem;
+ }
+
+ // ------------------------------------------------- Event Broadcast Methods
+
+
+ @Override
+ public boolean isAppropriateListener(FacesListener listener) {
+ return listener instanceof ItemChangeListener;
+ }
+
+ /**
+ * @throws javax.faces.event.AbortProcessingException {@inheritDoc}
+ */
+ @Override
+ public void processListener(FacesListener listener) {
+ ((ItemChangeListener) listener).processItemChange(this);
+ }
+}
+
Copied:
root/ui/output/trunk/panels/api/src/main/java/org/richfaces/event/ItemChangeListener.java
(from rev 18081,
root/ui/output/trunk/panels/ui/src/main/java/org/richfaces/event/SelectedItemChangeListener.java)
===================================================================
---
root/ui/output/trunk/panels/api/src/main/java/org/richfaces/event/ItemChangeListener.java
(rev 0)
+++
root/ui/output/trunk/panels/api/src/main/java/org/richfaces/event/ItemChangeListener.java 2010-07-20
15:17:30 UTC (rev 18161)
@@ -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.event;
+
+import javax.faces.event.AbortProcessingException;
+import javax.faces.event.FacesListener;
+
+/**
+ * <p>A listener interface for receiving {@link ItemChangeEvent}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>addItemChangeListener()</code>.</p>
+ *
+ * @author akolonitsky
+ * @version 1.0
+ * @since -4712-01-01
+ *
+ */
+public interface ItemChangeListener extends FacesListener {
+
+
+ /**
+ * <p>Invoked when {@link ItemChangeEvent} occurs.</p>
+ *
+ * @param event The {@link ItemChangeEvent} that has occurred
+ *
+ * @throws AbortProcessingException Signal the JavaServer Faces
+ * implementation that no further processing on the current event
+ * should be performed
+ */
+ void processItemChange(ItemChangeEvent event) throws AbortProcessingException;
+
+}
Modified:
root/ui/output/trunk/panels/ui/src/main/java/org/richfaces/component/AbstractDivPanel.java
===================================================================
---
root/ui/output/trunk/panels/ui/src/main/java/org/richfaces/component/AbstractDivPanel.java 2010-07-20
15:11:58 UTC (rev 18160)
+++
root/ui/output/trunk/panels/ui/src/main/java/org/richfaces/component/AbstractDivPanel.java 2010-07-20
15:17:30 UTC (rev 18161)
@@ -32,15 +32,12 @@
*/
public abstract class AbstractDivPanel extends UIOutput {
- //TODO nick -
http://community.jboss.org/docs/DOC-13693
- public static final String COMPONENT_TYPE =
"org.richfaces.panels.DivPanel";
+ public static final String COMPONENT_TYPE = "org.richfaces.DivPanel";
- //TODO nick -
http://community.jboss.org/docs/DOC-13693
- public static final String COMPONENT_FAMILY =
"org.richfaces.panels.DivPanel";
+ public static final String COMPONENT_FAMILY = "org.richfaces.DivPanel";
protected AbstractDivPanel() {
- //TODO nick -
http://community.jboss.org/docs/DOC-13693
- setRendererType("org.richfaces.panels.DivPanelRenderer");
+ setRendererType("org.richfaces.DivPanel");
}
@Override
Modified:
root/ui/output/trunk/panels/ui/src/main/java/org/richfaces/component/AbstractTogglePanel.java
===================================================================
---
root/ui/output/trunk/panels/ui/src/main/java/org/richfaces/component/AbstractTogglePanel.java 2010-07-20
15:11:58 UTC (rev 18160)
+++
root/ui/output/trunk/panels/ui/src/main/java/org/richfaces/component/AbstractTogglePanel.java 2010-07-20
15:17:30 UTC (rev 18161)
@@ -22,6 +22,7 @@
package org.richfaces.component;
+import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
@@ -45,8 +46,9 @@
import javax.faces.event.ValueChangeListener;
import javax.faces.validator.Validator;
-import org.richfaces.event.SelectedItemChangeEvent;
-import org.richfaces.event.SelectedItemChangeListener;
+import org.richfaces.component.util.MessageUtil;
+import org.richfaces.event.ItemChangeEvent;
+import org.richfaces.event.ItemChangeListener;
/**
* @author akolonitsky
@@ -54,14 +56,15 @@
*/
public abstract class AbstractTogglePanel extends AbstractDivPanel implements
EditableValueHolder {
- //TODO nick -
http://community.jboss.org/docs/DOC-13693
- public static final String COMPONENT_TYPE =
"org.richfaces.panels.TogglePanel";
+ public static final String COMPONENT_TYPE = "org.richfaces.TogglePanel";
- //TODO nick -
http://community.jboss.org/docs/DOC-13693
- public static final String COMPONENT_FAMILY =
"org.richfaces.panels.TogglePanel";
+ public static final String COMPONENT_FAMILY = "org.richfaces.TogglePanel";
- private String submittedSelectedItem = null;
+ // TODO What is MessageId ?
+ public static final String UPDATE_MESSAGE_ID =
"javax.faces.component.UIInput.UPDATE";
+ private String submittedActiveItem = null;
+
private enum PropertyKeys {
localValueSet,
required,
@@ -70,14 +73,14 @@
}
protected AbstractTogglePanel() {
- setRendererType("org.richfaces.panels.TogglePanelRenderer");
+ setRendererType("org.richfaces.TogglePanel");
}
// -------------------------------------------------- Editable Value Holder
public Object getSubmittedValue() {
- return this.submittedSelectedItem;
+ return this.submittedActiveItem;
}
public void resetValue() {
@@ -88,7 +91,7 @@
}
public void setSubmittedValue(Object submittedValue) {
- this.submittedSelectedItem = String.valueOf(submittedValue);
+ this.submittedActiveItem = String.valueOf(submittedValue);
}
/**
@@ -143,13 +146,11 @@
}
public MethodBinding getValidator() {
- //TODO nick - Errors shouldn't ne thrown
- throw new UnknownError();
+ throw new UnsupportedOperationException();
}
public void setValidator(MethodBinding validatorBinding) {
- //TODO nick - Errors shouldn't ne thrown
- throw new UnknownError();
+ throw new UnsupportedOperationException();
}
public MethodBinding getValueChangeListener() {
@@ -212,9 +213,10 @@
// Process all facets and children of this component
Iterator<UIComponent> kids = getFacetsAndChildren();
+ String activeItem = getActiveItemValue();
while (kids.hasNext()) {
UIComponent kid = kids.next();
- if (isSelectedItem(kid)) {
+ if (isActiveItem(kid, activeItem)) {
kid.processDecodes(context);
}
}
@@ -263,9 +265,10 @@
app.publishEvent(context, PreValidateEvent.class, this);
// Process all the facets and children of this component
Iterator<UIComponent> kids = getFacetsAndChildren();
+ String activeItem = getActiveItemValue();
while (kids.hasNext()) {
UIComponent kid = kids.next();
- if (isSelectedItem(kid)) {
+ if (isActiveItem(kid, activeItem)) {
kid.processValidators(context);
}
}
@@ -302,9 +305,10 @@
// Process all facets and children of this component
Iterator<UIComponent> kids = getFacetsAndChildren();
+ String activeItem = getActiveItemValue();
while (kids.hasNext()) {
UIComponent kid = kids.next();
- if (isSelectedItem(kid)) {
+ if (isActiveItem(kid, activeItem)) {
kid.processUpdates(context);
}
}
@@ -348,8 +352,7 @@
return;
}
- //TODO nick - selectedItem attribute?
- ValueExpression ve = getValueExpression("value");
+ ValueExpression ve = getValueExpression("activeItem");
if (ve == null) {
return;
}
@@ -370,11 +373,10 @@
}
if (messageStr == null) {
- // todo
- //message = MessageFactory.getMessage(context, UPDATE_MESSAGE_ID,
- // MessageFactory.getLabel(context, this));
+ message = MessageUtil.getMessage(context, UPDATE_MESSAGE_ID,
+ new Object[] {MessageUtil.getLabel(context, this)});
} else {
- //message = new FacesMessage(FacesMessage.SEVERITY_ERROR, messageStr,
messageStr);
+ message = new FacesMessage(FacesMessage.SEVERITY_ERROR, messageStr,
messageStr);
}
setValid(false);
} catch (Exception e) {
@@ -418,21 +420,21 @@
}
// Submitted value == null means "the component was not submitted at
all".
- String submittedValue = getSubmittedSelectedItem();
- if (submittedValue == null) {
+ String activeItem = getSubmittedActiveItem();
+ if (activeItem == null) {
return;
}
String previous = (String) getValue();
- setValue(submittedValue);
- setSubmittedSelectedItem(null);
- if (!previous.equalsIgnoreCase(submittedValue)) {
- queueEvent(new SelectedItemChangeEvent(this, previous, submittedValue));
+ setValue(activeItem);
+ setSubmittedActiveItem(null);
+ if (!previous.equalsIgnoreCase(activeItem)) {
+ queueEvent(new ItemChangeEvent(this, previous, activeItem));
}
}
public void queueEvent(FacesEvent event) {
- if ((event instanceof SelectedItemChangeEvent) && (event.getComponent()
== this)) {
+ if ((event instanceof ItemChangeEvent) && (event.getComponent() == this))
{
if (isImmediate()) {
event.setPhaseId(PhaseId.APPLY_REQUEST_VALUES);
} else if (isBypassUpdates()) {
@@ -449,8 +451,8 @@
public void broadcast(FacesEvent event) throws AbortProcessingException {
super.broadcast(event);
- //TODO nick - immediate?
- if (event instanceof SelectedItemChangeEvent && isBypassUpdates()) {
+ if (event instanceof ItemChangeEvent
+ && (isBypassUpdates() || isImmediate())) {
FacesContext.getCurrentInstance().renderResponse();
}
}
@@ -466,37 +468,46 @@
return true;
}
- private boolean isSelectedItem(UIComponent kid) {
- //TODO nick - selectedItem should be cached in local variable
- String value = getSelectedItem();
+ private boolean isActiveItem(UIComponent kid) {
+ return getChildName(kid).equals(getActiveItemValue());
+ }
+
+ private String getActiveItemValue() {
+ String value = getActiveItem();
if (value == null) {
- value = getSubmittedSelectedItem();
+ value = getSubmittedActiveItem();
}
+ return value;
+ }
+
+ private static boolean isActiveItem(UIComponent kid, String value) {
return getChildName(kid).equals(value);
}
public String getFirstItem() {
- checkChildCount(getChildCount());
+ List<UIComponent> children = getRenderedChildren();
+// if (chi)
- //TODO nick - children can be rendered or not
- return getChildName(getChildren().get(0));
+ return getChildName(children.get(0));
}
- private static void checkChildCount(int childCount) {
- //TODO nick - remove this check
- if (childCount < 1) {
- throw new IllegalStateException("TogglePanel must have at least one
TogglePanelItem.");
+// public UIComponent getItemByIndex
+
+ private List<UIComponent> getRenderedChildren() {
+ List<UIComponent> res = new ArrayList<UIComponent>(getChildCount());
+ for (UIComponent child : getChildren()) {
+ res.add(child);
}
+
+ return res;
}
public AbstractTogglePanelItem getItem(String name) {
if (name == null) {
throw new IllegalArgumentException("Name is required parameter.");
}
- checkChildCount(getChildCount());
List<UIComponent> children = getChildren();
- //TODO nick - return child itself
int index = getChildIndex(name, children);
if (index == -1) {
return null;
@@ -508,9 +519,7 @@
if (name == null) {
throw new IllegalArgumentException("Name is required parameter.");
}
- checkChildCount(getChildCount());
-
List<UIComponent> children = getChildren();
int nextItem = getChildIndex(name, children) + 1;
@@ -531,12 +540,11 @@
ind++;
}
-// throw new IllegalStateException("Can't find child panel item with
name: " + name);
return -1;
}
private static String getChildName(UIComponent item) {
- //TODO nick - panel can include UIParam children - remove this exception
+ // TODO nick - panel can include UIParam children - remove this exception
if (!(item instanceof AbstractTogglePanelItem)) {
throw new IllegalStateException("TogglePanel can contain only
TogglePanelItem as child.");
}
@@ -546,26 +554,26 @@
// ------------------------------------------------
- public String getSubmittedSelectedItem() {
- return submittedSelectedItem;
+ public String getSubmittedActiveItem() {
+ return submittedActiveItem;
}
- public void setSubmittedSelectedItem(String submittedSelectedItem) {
- this.submittedSelectedItem = submittedSelectedItem;
+ public void setSubmittedActiveItem(String submittedActiveItem) {
+ this.submittedActiveItem = submittedActiveItem;
}
// ------------------------------------------------ Properties
- public String getSelectedItem() {
+ public String getActiveItem() {
return (String) getValue();
}
- public void setSelectedItem(String value) {
+ public void setActiveItem(String value) {
setValue(value);
}
- public abstract Method getSwitchType();
+ public abstract SwitchType getSwitchType();
public abstract boolean isBypassUpdates();
@@ -579,42 +587,42 @@
public abstract Object getRender();
- public abstract MethodExpression getSelectedItemChangeListener();
+ public abstract MethodExpression getItemChangeListener();
// ------------------------------------------------ Event Processing Methods
/**
- * <p>Add a new {@link SelectedItemChangeListener} to the set of listeners
- * interested in being notified when {@link
org.richfaces.event.SelectedItemChangeEvent}s occur.</p>
+ * <p>Add a new {@link org.richfaces.event.ItemChangeListener} to the set of
listeners
+ * interested in being notified when {@link org.richfaces.event.ItemChangeEvent}s
occur.</p>
*
- * @param listener The {@link SelectedItemChangeListener} to be added
+ * @param listener The {@link org.richfaces.event.ItemChangeListener} to be added
* @throws NullPointerException if <code>listener</code>
* is <code>null</code>
*/
- public void addSelectedItemChangeListener(SelectedItemChangeListener listener) {
+ public void addItemChangeListener(ItemChangeListener listener) {
addFacesListener(listener);
}
/**
- * <p>Return the set of registered {@link SelectedItemChangeListener}s for this
instance.
+ * <p>Return the set of registered {@link
org.richfaces.event.ItemChangeListener}s for this instance.
* If there are no registered listeners, a zero-length array is returned.</p>
*/
- public SelectedItemChangeListener[] getSelectedItemChangeListeners() {
- return (SelectedItemChangeListener[])
getFacesListeners(SelectedItemChangeListener.class);
+ public ItemChangeListener[] getItemChangeListeners() {
+ return (ItemChangeListener[]) getFacesListeners(ItemChangeListener.class);
}
/**
- * <p>Remove an existing {@link SelectedItemChangeListener} (if any) from the
+ * <p>Remove an existing {@link org.richfaces.event.ItemChangeListener} (if
any) from the
* set of listeners interested in being notified when
- * {@link org.richfaces.event.SelectedItemChangeEvent}s occur.</p>
+ * {@link org.richfaces.event.ItemChangeEvent}s occur.</p>
*
- * @param listener The {@link SelectedItemChangeListener} to be removed
+ * @param listener The {@link org.richfaces.event.ItemChangeListener} to be removed
* @throws NullPointerException if <code>listener</code>
* is <code>null</code>
*/
- public void removeSelectedItemChangeListener(SelectedItemChangeListener listener) {
+ public void removeItemChangeListener(ItemChangeListener listener) {
removeFacesListener(listener);
}
Modified:
root/ui/output/trunk/panels/ui/src/main/java/org/richfaces/component/AbstractTogglePanelItem.java
===================================================================
---
root/ui/output/trunk/panels/ui/src/main/java/org/richfaces/component/AbstractTogglePanelItem.java 2010-07-20
15:11:58 UTC (rev 18160)
+++
root/ui/output/trunk/panels/ui/src/main/java/org/richfaces/component/AbstractTogglePanelItem.java 2010-07-20
15:17:30 UTC (rev 18161)
@@ -33,12 +33,12 @@
*/
public abstract class AbstractTogglePanelItem extends AbstractDivPanel {
- public static final String COMPONENT_TYPE =
"org.richfaces.panels.TogglePanelItem";
+ public static final String COMPONENT_TYPE =
"org.richfaces.TogglePanelItem";
- public static final String COMPONENT_FAMILY =
"org.richfaces.panels.TogglePanelItem";
+ public static final String COMPONENT_FAMILY =
"org.richfaces.TogglePanelItem";
protected AbstractTogglePanelItem() {
- setRendererType("org.richfaces.panels.TogglePanelItemRenderer");
+ setRendererType("org.richfaces.TogglePanelItem");
}
@Override
@@ -66,7 +66,7 @@
public abstract String getName();
- public abstract Method getSwitchType();
+ public abstract SwitchType getSwitchType();
public String toString() {
return "TogglePanelItem {name: " + getName() + ", switchType:
" + getSwitchType() + '}';
Deleted: root/ui/output/trunk/panels/ui/src/main/java/org/richfaces/component/Method.java
===================================================================
---
root/ui/output/trunk/panels/ui/src/main/java/org/richfaces/component/Method.java 2010-07-20
15:11:58 UTC (rev 18160)
+++
root/ui/output/trunk/panels/ui/src/main/java/org/richfaces/component/Method.java 2010-07-20
15:17:30 UTC (rev 18161)
@@ -1,26 +0,0 @@
-package org.richfaces.component;
-
-/**
- * @author akolonitsky
- * @since Jun 15, 2010
- */
-//TODO nick - rename into SwitchType or PanelSwitchType
-//TODO nick - move to API
-public enum Method {
- /**
- * value for tab change method for - client-side tabs.
- */
- client,
-
- /**
- * value for tab change method - server-side tabs
- */
- server,
-
- /**
- * value for tab change method - ajax tabs
- */
- ajax
-
- //TODO nick - add DEFAULT constant
-}
Deleted:
root/ui/output/trunk/panels/ui/src/main/java/org/richfaces/component/UIDivPanel.java
===================================================================
---
root/ui/output/trunk/panels/ui/src/main/java/org/richfaces/component/UIDivPanel.java 2010-07-20
15:11:58 UTC (rev 18160)
+++
root/ui/output/trunk/panels/ui/src/main/java/org/richfaces/component/UIDivPanel.java 2010-07-20
15:17:30 UTC (rev 18161)
@@ -1,46 +0,0 @@
-/*
- * 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 -4712-01-01
- */
-//TODO nick - remove
-public class UIDivPanel extends AbstractDivPanel {
-
- public static final String COMPONENT_TYPE =
"org.richfaces.panels.DivPanel";
-
- public static final String COMPONENT_FAMILY =
"org.richfaces.panels.DivPanel";
-
-
-
- @Override
- public String getFamily() {
- return COMPONENT_FAMILY;
- }
-
-
-}
Modified:
root/ui/output/trunk/panels/ui/src/main/java/org/richfaces/component/UITogglePanel.java
===================================================================
---
root/ui/output/trunk/panels/ui/src/main/java/org/richfaces/component/UITogglePanel.java 2010-07-20
15:11:58 UTC (rev 18160)
+++
root/ui/output/trunk/panels/ui/src/main/java/org/richfaces/component/UITogglePanel.java 2010-07-20
15:17:30 UTC (rev 18161)
@@ -26,15 +26,9 @@
/**
* @author akolonitsky
- * @since -4712-01-01
*/
-//TODO nick - no behaviors support!
public class UITogglePanel extends AbstractTogglePanel {
- public static final String COMPONENT_TYPE =
"org.richfaces.panels.TogglePanel";
-
- public static final String COMPONENT_FAMILY =
"org.richfaces.panels.TogglePanel";
-
private enum PropertyKeys {
switchType,
bypassUpdates,
@@ -43,20 +37,14 @@
status,
execute,
render,
- selectedItemChangeListener
+ itemChangeListener
}
-
- @Override
- public String getFamily() {
- return COMPONENT_FAMILY;
+ public SwitchType getSwitchType() {
+ return (SwitchType) getStateHelper().eval(PropertyKeys.switchType,
SwitchType.DEFAULT);
}
- public Method getSwitchType() {
- return (Method) getStateHelper().eval(PropertyKeys.switchType, Method.ajax);
- }
-
- public void setSwitchType(Method switchType) {
+ public void setSwitchType(SwitchType switchType) {
getStateHelper().put(PropertyKeys.switchType, switchType);
}
@@ -108,13 +96,12 @@
getStateHelper().put(PropertyKeys.render, render);
}
- public MethodExpression getSelectedItemChangeListener() {
- //TODO nick - get, not eval
- return (MethodExpression)
getStateHelper().eval(PropertyKeys.selectedItemChangeListener);
+ public MethodExpression getItemChangeListener() {
+ return (MethodExpression) getStateHelper().get(PropertyKeys.itemChangeListener);
}
- public void setSelectedItemChangeListener(MethodExpression
selectedItemChangeListener) {
- getStateHelper().put(PropertyKeys.selectedItemChangeListener,
selectedItemChangeListener);
+ public void setItemChangeListener(MethodExpression itemChangeListener) {
+ getStateHelper().put(PropertyKeys.itemChangeListener, itemChangeListener);
}
Modified:
root/ui/output/trunk/panels/ui/src/main/java/org/richfaces/component/UITogglePanelItem.java
===================================================================
---
root/ui/output/trunk/panels/ui/src/main/java/org/richfaces/component/UITogglePanelItem.java 2010-07-20
15:11:58 UTC (rev 18160)
+++
root/ui/output/trunk/panels/ui/src/main/java/org/richfaces/component/UITogglePanelItem.java 2010-07-20
15:17:30 UTC (rev 18161)
@@ -24,27 +24,15 @@
/**
* @author akolonitsky
- * @since -4712-01-01
*/
-//TODO nick - no behaviors support!
public class UITogglePanelItem extends AbstractTogglePanelItem {
- public static final String COMPONENT_TYPE =
"org.richfaces.panels.TogglePanelItem";
-
- public static final String COMPONENT_FAMILY =
"org.richfaces.panels.TogglePanelItem";
-
private enum PropertyKeys {
name,
switchType
}
-
@Override
- public String getFamily() {
- return COMPONENT_FAMILY;
- }
-
- @Override
public String getName() {
return String.valueOf(getStateHelper().eval(PropertyKeys.name));
}
@@ -54,13 +42,11 @@
}
@Override
- public Method getSwitchType() {
- return (Method) getStateHelper().eval(PropertyKeys.switchType,
getParent().getSwitchType());
+ public SwitchType getSwitchType() {
+ return (SwitchType) getStateHelper().eval(PropertyKeys.switchType,
getParent().getSwitchType());
}
- public void setSwitchType(Method switchType) {
+ public void setSwitchType(SwitchType switchType) {
getStateHelper().put(PropertyKeys.switchType, switchType);
}
-
-
}
Modified:
root/ui/output/trunk/panels/ui/src/main/java/org/richfaces/component/behavior/ToggleControl.java
===================================================================
---
root/ui/output/trunk/panels/ui/src/main/java/org/richfaces/component/behavior/ToggleControl.java 2010-07-20
15:11:58 UTC (rev 18160)
+++
root/ui/output/trunk/panels/ui/src/main/java/org/richfaces/component/behavior/ToggleControl.java 2010-07-20
15:17:30 UTC (rev 18161)
@@ -62,7 +62,6 @@
}
public String getForPanel() {
- //TODO nick - get, not eval
return (String) getStateHelper().eval(PropertyKeys.forPanel);
}
@@ -70,8 +69,7 @@
getStateHelper().put(PropertyKeys.forPanel, selector);
}
- //TODO nick - argument type is incorrect
- public void setDisableDefault(String disableDefault) {
+ public void setDisableDefault(Boolean disableDefault) {
getStateHelper().put(PropertyKeys.disableDefault, disableDefault);
}
Modified:
root/ui/output/trunk/panels/ui/src/main/java/org/richfaces/component/html/HtmlDivPanel.java
===================================================================
---
root/ui/output/trunk/panels/ui/src/main/java/org/richfaces/component/html/HtmlDivPanel.java 2010-07-20
15:11:58 UTC (rev 18160)
+++
root/ui/output/trunk/panels/ui/src/main/java/org/richfaces/component/html/HtmlDivPanel.java 2010-07-20
15:17:30 UTC (rev 18161)
@@ -23,13 +23,13 @@
package org.richfaces.component.html;
-import org.richfaces.component.UIDivPanel;
+import org.richfaces.component.AbstractDivPanel;
-public class HtmlDivPanel extends UIDivPanel {
+public class HtmlDivPanel extends AbstractDivPanel {
- public static final String COMPONENT_TYPE =
"org.richfaces.panels.DivPanel";
+ public static final String COMPONENT_TYPE = "org.richfaces.DivPanel";
- public static final String COMPONENT_FAMILY =
"org.richfaces.panels.DivPanel";
+ public static final String COMPONENT_FAMILY = "org.richfaces.DivPanel";
private enum PropertyKeys {
lang,
@@ -47,7 +47,7 @@
}
public HtmlDivPanel() {
- setRendererType("org.richfaces.panels.DivPanelRenderer");
+ setRendererType("org.richfaces.DivPanel");
}
@Override
Modified:
root/ui/output/trunk/panels/ui/src/main/java/org/richfaces/component/html/HtmlTogglePanel.java
===================================================================
---
root/ui/output/trunk/panels/ui/src/main/java/org/richfaces/component/html/HtmlTogglePanel.java 2010-07-20
15:11:58 UTC (rev 18160)
+++
root/ui/output/trunk/panels/ui/src/main/java/org/richfaces/component/html/HtmlTogglePanel.java 2010-07-20
15:17:30 UTC (rev 18161)
@@ -24,12 +24,31 @@
import org.richfaces.component.UITogglePanel;
-public class HtmlTogglePanel extends UITogglePanel {
+import javax.faces.component.behavior.ClientBehaviorHolder;
+import java.util.Arrays;
+import java.util.Collection;
+import java.util.Collections;
- public static final String COMPONENT_TYPE =
"org.richfaces.panels.TogglePanel";
+// TODO nick - no behaviors support! check Push renderer to implement
+public class HtmlTogglePanel extends UITogglePanel implements ClientBehaviorHolder {
- public static final String COMPONENT_FAMILY =
"org.richfaces.panels.TogglePanel";
+ // todo Html prefix
+ public static final String COMPONENT_TYPE = "org.richfaces.TogglePanel";
+ public static final String COMPONENT_FAMILY = "org.richfaces.TogglePanel";
+
+ private static final Collection<String> EVENT_NAMES =
Collections.unmodifiableCollection(Arrays.asList(
+ "click",
+ "dblclick",
+ "mousedown",
+ "mousemove",
+ "mouseout",
+ "mouseover",
+ "mouseup",
+ "complete",
+ "beforedomupdate"
+ ));
+
private enum PropertyKeys {
lang,
onclick,
@@ -50,7 +69,7 @@
}
public HtmlTogglePanel() {
- setRendererType("org.richfaces.panels.TogglePanelRenderer");
+ setRendererType("org.richfaces.TogglePanel");
}
@Override
@@ -186,6 +205,8 @@
getStateHelper().put(PropertyKeys.onitemchanged, onitemchanged);
}
-
+ @Override
+ public Collection<String> getEventNames() {
+ return EVENT_NAMES;
+ }
}
-
Modified:
root/ui/output/trunk/panels/ui/src/main/java/org/richfaces/component/html/HtmlTogglePanelItem.java
===================================================================
---
root/ui/output/trunk/panels/ui/src/main/java/org/richfaces/component/html/HtmlTogglePanelItem.java 2010-07-20
15:11:58 UTC (rev 18160)
+++
root/ui/output/trunk/panels/ui/src/main/java/org/richfaces/component/html/HtmlTogglePanelItem.java 2010-07-20
15:17:30 UTC (rev 18161)
@@ -24,12 +24,28 @@
import org.richfaces.component.UITogglePanelItem;
-public class HtmlTogglePanelItem extends UITogglePanelItem {
+import javax.faces.component.behavior.ClientBehaviorHolder;
+import java.util.Arrays;
+import java.util.Collection;
+import java.util.Collections;
- public static final String COMPONENT_TYPE =
"org.richfaces.panels.TogglePanelItem";
+// TODO nick - no behaviors support!
+public class HtmlTogglePanelItem extends UITogglePanelItem implements
ClientBehaviorHolder {
- public static final String COMPONENT_FAMILY =
"org.richfaces.panels.TogglePanelItem";
+ public static final String COMPONENT_TYPE =
"org.richfaces.TogglePanelItem";
+ public static final String COMPONENT_FAMILY =
"org.richfaces.TogglePanelItem";
+
+ private static final Collection<String> EVENT_NAMES =
Collections.unmodifiableCollection(Arrays.asList(
+ "click",
+ "dblclick",
+ "mousedown",
+ "mousemove",
+ "mouseout",
+ "mouseover",
+ "mouseup"
+ ));
+
private enum PropertyKeys {
lang,
onclick,
@@ -48,7 +64,7 @@
}
public HtmlTogglePanelItem() {
- setRendererType("org.richfaces.panels.TogglePanelItemRenderer");
+ setRendererType("org.richfaces.TogglePanelItem");
}
@Override
@@ -168,6 +184,9 @@
getStateHelper().put(PropertyKeys.onleave, onleave);
}
-
+ @Override
+ public Collection<String> getEventNames() {
+ return EVENT_NAMES;
+ }
}
Copied:
root/ui/output/trunk/panels/ui/src/main/java/org/richfaces/event/MethodExpressionItemChangeListener.java
(from rev 18154,
root/ui/output/trunk/panels/ui/src/main/java/org/richfaces/event/MethodExpressionSelectedItemChangeListener.java)
===================================================================
---
root/ui/output/trunk/panels/ui/src/main/java/org/richfaces/event/MethodExpressionItemChangeListener.java
(rev 0)
+++
root/ui/output/trunk/panels/ui/src/main/java/org/richfaces/event/MethodExpressionItemChangeListener.java 2010-07-20
15:17:30 UTC (rev 18161)
@@ -0,0 +1,199 @@
+/*
+ * 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;
+
+/**
+ * <p><strong><span
+ *
class="changed_modified_2_0">MethodExpressionItemChangeListener</span></strong>
+ * is a {@link ItemChangeListener} that wraps a {@link
+ * MethodExpression}. When it receives a {@link ItemChangeEvent}, it
+ * executes a method on an object identified by the {@link
+ * MethodExpression}.</p>
+ *
+ * @author akolonitsky
+ * @version 1.0
+ * @since -4712-01-01
+ *
+ */
+//TODO nick - good candidate for utility class
+public class MethodExpressionItemChangeListener implements ItemChangeListener,
StateHolder {
+
+ private static final Class<?>[] ITEM_CHANGE_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;
+
+ public MethodExpressionItemChangeListener() {
+ }
+
+ /**
+ * <p><span class="changed_modified_2_0">Construct</span>
a {@link
+ * ItemChangeListener} 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
+ * ItemChangeEvent} 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 #processItemChange}.</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 ItemChangeEvent}.
+ */
+ public MethodExpressionItemChangeListener(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,
+ ITEM_CHANGE_LISTENER_ZERO_ARG_SIG);
+ }
+
+ /**
+ * <p>Construct a {@link ItemChangeListener} that contains a {@link
MethodExpression}.</p>
+ *
+ * @param methodExpressionOneArg
+ * @param methodExpressionZeroArg
+ */
+ public MethodExpressionItemChangeListener(MethodExpression methodExpressionOneArg,
+ MethodExpression methodExpressionZeroArg) {
+
+ super();
+ this.methodExpressionOneArg = methodExpressionOneArg;
+ this.methodExpressionZeroArg = methodExpressionZeroArg;
+ }
+
+ // ------------------------------------------------------- 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 ItemChangeEvent} 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 processItemChange(ItemChangeEvent itemChangeEvent) throws
AbortProcessingException {
+
+ if (itemChangeEvent == 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[] {itemChangeEvent});
+ } 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;
+ }
+}
+
Deleted:
root/ui/output/trunk/panels/ui/src/main/java/org/richfaces/event/MethodExpressionSelectedItemChangeListener.java
===================================================================
---
root/ui/output/trunk/panels/ui/src/main/java/org/richfaces/event/MethodExpressionSelectedItemChangeListener.java 2010-07-20
15:11:58 UTC (rev 18160)
+++
root/ui/output/trunk/panels/ui/src/main/java/org/richfaces/event/MethodExpressionSelectedItemChangeListener.java 2010-07-20
15:17:30 UTC (rev 18161)
@@ -1,193 +0,0 @@
-/*
- * 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.context.FacesContext;
-import javax.faces.event.AbortProcessingException;
-
-/**
- * <p><strong><span
- *
class="changed_modified_2_0">MethodExpressionSelectedItemChangeListener</span></strong>
- * is a {@link SelectedItemChangeListener} that wraps a {@link
- * MethodExpression}. When it receives a {@link SelectedItemChangeEvent}, it
- * executes a method on an object identified by the {@link
- * MethodExpression}.</p>
- *
- * @author akolonitsky
- * @version 1.0
- * @since -4712-01-01
- *
- */
-//TODO nick - good candidate for utility class
-public class MethodExpressionSelectedItemChangeListener implements
SelectedItemChangeListener, StateHolder {
-
- //TODO nick - classes should be generified too
- private static final Class[] SELECTED_ITEM_CHANGE_LISTENER_ZERO_ARG_SIG = new Class[]
{};
-
- // ------------------------------------------------------ Instance Variables
-
- private MethodExpression methodExpressionOneArg = null;
- private MethodExpression methodExpressionZeroArg = null;
-
- private boolean isTransient;
-
-
- public MethodExpressionSelectedItemChangeListener() { }
-
- /**
- * <p><span class="changed_modified_2_0">Construct</span>
a {@link
- * SelectedItemChangeListener} 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
- * SelectedItemChangeEvent} 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 #processSelectedItemChange}.</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 SelectedItemChangeEvent}.
- */
- public MethodExpressionSelectedItemChangeListener(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,
- SELECTED_ITEM_CHANGE_LISTENER_ZERO_ARG_SIG);
- }
-
- /**
- * <p>Construct a {@link SelectedItemChangeListener} that contains a {@link
MethodExpression}.</p>
- */
- public MethodExpressionSelectedItemChangeListener(MethodExpression
methodExpressionOneArg,
- MethodExpression methodExpressionZeroArg) {
-
- super();
- this.methodExpressionOneArg = methodExpressionOneArg;
- this.methodExpressionZeroArg = methodExpressionZeroArg;
- }
-
- // ------------------------------------------------------- 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 SelectedItemChangeEvent} 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 processSelectedItemChange(SelectedItemChangeEvent
selectedItemChangeEvent) throws AbortProcessingException {
-
- if (selectedItemChangeEvent == 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[]
{selectedItemChangeEvent});
- } catch (MethodNotFoundException mnf) {
- if (null != methodExpressionZeroArg) {
-
- try {
- // try to invoke a no-arg version
- methodExpressionZeroArg.invoke(elContext, new Object[]{});
- } catch (ELException ee) {
- throw new AbortProcessingException(ee.getMessage(), ee.getCause());
- }
- }
- } catch (ELException ee) {
- throw new AbortProcessingException(ee.getMessage(), ee.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();
- }
-
- //TODO nick - use
javax.faces.component.UIComponentBase.saveAttachedState(FacesContext, Object)
- return new Object[] {methodExpressionOneArg, 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;
- }
-
- //TODO nick - use
javax.faces.component.UIComponentBase.restoreAttachedState(FacesContext, Object)
- methodExpressionOneArg = (MethodExpression) ((Object[]) state)[0];
- methodExpressionZeroArg = (MethodExpression) ((Object[]) state)[1];
- }
-
-
- public boolean isTransient() {
- return isTransient;
- }
-
- public void setTransient(boolean newTransientValue) {
- isTransient = newTransientValue;
- }
-}
-
Deleted:
root/ui/output/trunk/panels/ui/src/main/java/org/richfaces/event/SelectedItemChangeEvent.java
===================================================================
---
root/ui/output/trunk/panels/ui/src/main/java/org/richfaces/event/SelectedItemChangeEvent.java 2010-07-20
15:11:58 UTC (rev 18160)
+++
root/ui/output/trunk/panels/ui/src/main/java/org/richfaces/event/SelectedItemChangeEvent.java 2010-07-20
15:17:30 UTC (rev 18161)
@@ -1,92 +0,0 @@
-/*
- * 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;
-
-
-/**
- * <p>A {@link SelectedItemChangeEvent} is a ...</p>
- *
- * @author akolonitsky
- * @version 1.0
- * @since -4712-01-01
- */
-//TODO nick - move to API
-//TODO nick - serialVersionUUID is missing
-public class SelectedItemChangeEvent extends FacesEvent {
-
- private final String oldItem;
- private final String newItem;
-
- // ------------------------------------------------------------ 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 oldItem
- * @param newItem
- *
- * @throws IllegalArgumentException if <code>component</code> is
- * <code>null</code>
- */
- public SelectedItemChangeEvent(UIComponent component, String oldItem, String newItem)
{
- super(component);
- this.oldItem = oldItem;
- this.newItem = newItem;
- }
-
-
- // -------------------------------------------------------------- Properties
-
- public String getOldItem() {
- return oldItem;
- }
-
- public String getNewItem() {
- return newItem;
- }
-
- // ------------------------------------------------- Event Broadcast Methods
-
-
- public boolean isAppropriateListener(FacesListener listener) {
- return listener instanceof SelectedItemChangeListener;
- }
-
- /**
- * @throws javax.faces.event.AbortProcessingException {@inheritDoc}
- */
- public void processListener(FacesListener listener) {
- ((SelectedItemChangeListener) listener).processSelectedItemChange(this);
- }
-}
-
Deleted:
root/ui/output/trunk/panels/ui/src/main/java/org/richfaces/event/SelectedItemChangeListener.java
===================================================================
---
root/ui/output/trunk/panels/ui/src/main/java/org/richfaces/event/SelectedItemChangeListener.java 2010-07-20
15:11:58 UTC (rev 18160)
+++
root/ui/output/trunk/panels/ui/src/main/java/org/richfaces/event/SelectedItemChangeListener.java 2010-07-20
15:17:30 UTC (rev 18161)
@@ -1,54 +0,0 @@
-/*
- * 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 SelectedItemChangeEvent}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>addSelectedItemChangeListener()</code>.</p>
- *
- * @author akolonitsky
- * @version 1.0
- * @since -4712-01-01
- *
- */
-//TODO nick - move to API
-public interface SelectedItemChangeListener extends FacesListener {
-
-
- /**
- * <p>Invoked when {@link SelectedItemChangeEvent} occurs.</p>
- *
- * @param event The {@link SelectedItemChangeEvent} that has occurred
- *
- * @throws AbortProcessingException Signal the JavaServer Faces
- * implementation that no further processing on the current event
- * should be performed
- */
- void processSelectedItemChange(SelectedItemChangeEvent event) throws
AbortProcessingException;
-
-}
Modified:
root/ui/output/trunk/panels/ui/src/main/java/org/richfaces/renderkit/html/DivPanelRenderer.java
===================================================================
---
root/ui/output/trunk/panels/ui/src/main/java/org/richfaces/renderkit/html/DivPanelRenderer.java 2010-07-20
15:11:58 UTC (rev 18160)
+++
root/ui/output/trunk/panels/ui/src/main/java/org/richfaces/renderkit/html/DivPanelRenderer.java 2010-07-20
15:17:30 UTC (rev 18161)
@@ -37,7 +37,6 @@
* @author akolonitsky
*
*/
-//TODO nick - use Renderer instead of RendererBase
public class DivPanelRenderer extends RendererBase {
public static final String[] ATTRIBUTES = new String[] {
@@ -69,9 +68,8 @@
Map<String, Object> componentAttributes = component.getAttributes();
for (String attrName : attributes) {
Object attrValue = componentAttributes.get(attrName);
- //TODO nick - ???
if (!"null".equalsIgnoreCase(String.valueOf(attrValue))) {
- writer.writeAttribute(attrName, attrValue, attrName); // TODO Use
RendererUtils
+ writer.writeAttribute(attrName, attrValue, attrName); // TODO Use
RendererUtils use writeAttribute
}
}
}
@@ -88,7 +86,8 @@
protected void writeJavaScript(ResponseWriter writer, FacesContext context,
UIComponent component) throws IOException {
Object script = getScriptObject(context, component);
if (script != null) {
- //TODO nick - how does script relate to DIV?
+
+ // TODO nick - how does script relate to DIV?
writer.startElement(HTML.SCRIPT_ELEM, component);
writer.writeAttribute(HTML.TYPE_ATTR, "text/javascript",
"type");
writer.writeText(script, null);
Modified:
root/ui/output/trunk/panels/ui/src/main/java/org/richfaces/renderkit/html/ToggleControlRenderer.java
===================================================================
---
root/ui/output/trunk/panels/ui/src/main/java/org/richfaces/renderkit/html/ToggleControlRenderer.java 2010-07-20
15:11:58 UTC (rev 18160)
+++
root/ui/output/trunk/panels/ui/src/main/java/org/richfaces/renderkit/html/ToggleControlRenderer.java 2010-07-20
15:17:30 UTC (rev 18161)
@@ -39,8 +39,7 @@
@FacesBehaviorRenderer(
rendererType = "org.richfaces.component.behavior.ToggleControl",
renderKitId = RenderKitFactory.HTML_BASIC_RENDER_KIT)
-@ResourceDependencies({ // TODO review
- @ResourceDependency(library = "javax.faces", name = "jsf.js"),
+@ResourceDependencies({
@ResourceDependency(name = "jquery.js"),
@ResourceDependency(name = "richfaces.js") })
public class ToggleControlRenderer extends ClientBehaviorRenderer {
Modified:
root/ui/output/trunk/panels/ui/src/main/java/org/richfaces/renderkit/html/TogglePanelRenderer.java
===================================================================
---
root/ui/output/trunk/panels/ui/src/main/java/org/richfaces/renderkit/html/TogglePanelRenderer.java 2010-07-20
15:11:58 UTC (rev 18160)
+++
root/ui/output/trunk/panels/ui/src/main/java/org/richfaces/renderkit/html/TogglePanelRenderer.java 2010-07-20
15:17:30 UTC (rev 18161)
@@ -63,7 +63,7 @@
context.getExternalContext().getRequestParameterMap();
// Don't overwrite the value unless you have to!
- String newValue = requestMap.get(getSelectedItemRequestParamName(context,
component));
+ String newValue = requestMap.get(getActiveItemRequestParamName(context,
component));
if (newValue != null) {
setSubmittedValue(component, newValue);
@@ -89,19 +89,19 @@
private void addOnCompleteParam(String newValue, AbstractTogglePanel panel) {
StringBuilder onComplete = new StringBuilder();
onComplete.append("RichFaces.$('").append(panel.getClientId()).append("').onCompleteHandler('")
-
.append(panel.getSelectedItem()).append("','").append(newValue).append("');");
+
.append(panel.getActiveItem()).append("','").append(newValue).append("');");
AjaxContext.getCurrentInstance().appendOncomplete(onComplete.toString());
}
- private static String getSelectedItemRequestParamName(FacesContext context,
UIComponent component) {
+ private static String getActiveItemRequestParamName(FacesContext context, UIComponent
component) {
return component.getClientId(context) + VALUE_POSTFIX;
}
// @Override
public void setSubmittedValue(UIComponent component, Object value) {
if (component instanceof AbstractTogglePanel) {
- ((AbstractTogglePanel) component).setSubmittedSelectedItem((String) value);
+ ((AbstractTogglePanel) component).setSubmittedActiveItem((String) value);
// if (logger.isLoggable(Level.FINE)) {
// logger.fine("Set submitted value " + value + " on
component ");
@@ -123,9 +123,9 @@
writer.startElement(HTML.INPUT_ELEM, comp);
writer.writeAttribute(HTML.TYPE_ATTR, HTML.INPUT_TYPE_HIDDEN, null);
- writer.writeAttribute(HTML.VALUE_ATTRIBUTE, panel.getSelectedItem(),
"selectedItem");
- writer.writeAttribute(HTML.ID_ATTRIBUTE, getSelectedItemRequestParamName(context,
comp), null);
- writer.writeAttribute(HTML.NAME_ATTRIBUTE,
getSelectedItemRequestParamName(context, comp), 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.endElement(HTML.INPUT_ELEM);
}
@@ -135,6 +135,7 @@
return;
}
+ //TODO nick - non-rendered items shouldn't be processed
for (UIComponent child : component.getChildren()) {
if (!(child instanceof AbstractTogglePanelItem)) {
throw new IllegalStateException("Child of TogglePanel can be only
TogglePanelItem");
@@ -147,14 +148,13 @@
private void doEncodeChild(FacesContext facesContext, AbstractTogglePanel panel,
AbstractTogglePanelItem item)
throws IOException {
- boolean isSelected = panel.getSelectedItem().equals(item.getName());
+ boolean isSelected = panel.getActiveItem().equals(item.getName());
if (isSelected) {
item.encodeAll(facesContext);
} else {
switch (item.getSwitchType()) {
- //TODO nick - non-rendered items shouldn't be processed
case client:
hidePanelItem(item);
@@ -172,7 +172,7 @@
break;
case server:
- //TODO nick - why nothing?
+ // Do nothing.
break;
default:
@@ -183,8 +183,10 @@
}
+ // TODO why item don't know how it should be rendered
private static void hidePanelItem(UIComponent item) {
//TODO nick - attributes shouldn't be overwritten
+
item.getAttributes().put(HTML.STYLE_ATTRIBUTE, "display:none");
}
@@ -198,7 +200,7 @@
AbstractTogglePanel panel = (AbstractTogglePanel) component;
Map<String, Object> options = new HashMap<String, Object>(3);
- options.put("selectedItem", panel.getValue());
+ options.put("activeItem", panel.getValue());
options.put("switchMode", panel.getSwitchType());
options.put("items", getChildrenScriptObjects(context, panel));
Copied:
root/ui/output/trunk/panels/ui/src/main/java/org/richfaces/view/facelets/html/ItemChangeListenerHandler.java
(from rev 18081,
root/ui/output/trunk/panels/ui/src/main/java/org/richfaces/taglib/SelectedItemChangeListenerHandler.java)
===================================================================
---
root/ui/output/trunk/panels/ui/src/main/java/org/richfaces/view/facelets/html/ItemChangeListenerHandler.java
(rev 0)
+++
root/ui/output/trunk/panels/ui/src/main/java/org/richfaces/view/facelets/html/ItemChangeListenerHandler.java 2010-07-20
15:17:30 UTC (rev 18161)
@@ -0,0 +1,158 @@
+/*
+ * 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.AbstractTogglePanel;
+import org.richfaces.event.ItemChangeEvent;
+import org.richfaces.event.ItemChangeListener;
+
+import javax.el.ValueExpression;
+import javax.faces.component.UIComponent;
+import javax.faces.context.FacesContext;
+import javax.faces.event.AbortProcessingException;
+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
+ * @version 1.0
+ */
+public final class ItemChangeListenerHandler extends TagHandler implements
EditableValueHolderAttachedObjectHandler {
+
+ private static class LazyItemChangeListener implements ItemChangeListener,
Serializable {
+
+ private static final long serialVersionUID = 1L;
+
+ private final String type;
+
+ private final ValueExpression binding;
+
+ LazyItemChangeListener(String type, ValueExpression binding) {
+ this.type = type;
+ this.binding = binding;
+ }
+
+ public void processItemChange(ItemChangeEvent event)
+ throws AbortProcessingException {
+
+ FacesContext faces = FacesContext.getCurrentInstance();
+ if (faces == null) {
+ return;
+ }
+
+ ItemChangeListener instance = null;
+ if (this.binding != null) {
+ instance = (ItemChangeListener) binding.getValue(faces.getELContext());
+ }
+ if (instance == null && this.type != null) {
+ try {
+ instance = (ItemChangeListener) forName(this.type).newInstance();
+ } catch (Exception e) {
+ throw new AbortProcessingException("Couldn't Lazily
instantiate ItemChangeListener", e);
+ }
+ if (this.binding != null) {
+ binding.setValue(faces.getELContext(), instance);
+ }
+ }
+ if (instance != null) {
+ instance.processItemChange(event);
+ }
+ }
+ }
+
+ private final TagAttribute binding;
+
+ private final String listenerType;
+
+ public ItemChangeListenerHandler(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
ItemChangeListener", e);
+ }
+ } else {
+ throw new TagAttributeException(type, "Must be a literal class name
of type ItemChangeListener");
+ }
+ 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 AbstractTogglePanel) {
+ 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 void applyAttachedObject(FacesContext context, UIComponent parent) {
+ ValueExpression valueExpr = null;
+ if (this.binding != null) {
+ FaceletContext ctx = (FaceletContext)
context.getAttributes().get(FaceletContext.FACELET_CONTEXT_KEY);
+ valueExpr = this.binding.getValueExpression(ctx, ItemChangeListener.class);
+ }
+
+ AbstractTogglePanel evh = (AbstractTogglePanel) parent;
+ //TODO nick - this should be done via API interface define interfaces
SelectedItemChangeSource
+ evh.addItemChangeListener(new LazyItemChangeListener(this.listenerType,
valueExpr));
+ }
+
+ 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());
+ }
+}
+
Copied:
root/ui/output/trunk/panels/ui/src/main/java/org/richfaces/view/facelets/html/TogglePanelTagHandler.java
(from rev 18081,
root/ui/output/trunk/panels/ui/src/main/java/org/richfaces/taglib/TogglePanelTagHandler.java)
===================================================================
---
root/ui/output/trunk/panels/ui/src/main/java/org/richfaces/view/facelets/html/TogglePanelTagHandler.java
(rev 0)
+++
root/ui/output/trunk/panels/ui/src/main/java/org/richfaces/view/facelets/html/TogglePanelTagHandler.java 2010-07-20
15:17:30 UTC (rev 18161)
@@ -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 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;
+
+import org.richfaces.component.AbstractTogglePanel;
+import org.richfaces.event.ItemChangeEvent;
+import org.richfaces.event.MethodExpressionItemChangeListener;
+
+/**
+ * @author akolonitsky
+ * @version 1.0
+ * @since -4712-01-01
+ */
+public class TogglePanelTagHandler extends ComponentHandler {
+
+ private static final MetaRule META_RULE = new TogglePanelMetaRule();
+
+
+ public TogglePanelTagHandler(ComponentConfig config) {
+ super(config);
+ }
+
+ @Override
+ protected MetaRuleset createMetaRuleset(Class type) {
+ MetaRuleset metaRuleset = super.createMetaRuleset(type);
+ metaRuleset.addRule(META_RULE);
+ return metaRuleset;
+ }
+
+ private static class TogglePanelMetaRule extends MetaRule{
+
+ @Override
+ public Metadata applyRule(String name, TagAttribute attribute, MetadataTarget
meta) {
+ if (meta.isTargetInstanceOf(AbstractTogglePanel.class)) {
+ if ("itemChangeListener".equals(name)) {
+ return new ItemChangeExpressionMetadata(attribute);
+ }
+
+ }
+ return null;
+ }
+ }
+
+ private static final class ItemChangeExpressionMetadata extends Metadata {
+ private static final Class<?>[] ITEM_CHANGE_SIG = new Class[]
{ItemChangeEvent.class };
+
+ private final TagAttribute attr;
+
+ ItemChangeExpressionMetadata(TagAttribute attr) {
+ this.attr = attr;
+ }
+
+ @Override
+ public void applyMetadata(FaceletContext ctx, Object instance) {
+ ((AbstractTogglePanel) instance).addItemChangeListener(new
MethodExpressionItemChangeListener(
+ this.attr.getMethodExpression(ctx, null, ITEM_CHANGE_SIG)));
+ }
+ }
+
+
+
+}
+
Modified: root/ui/output/trunk/panels/ui/src/main/resources/META-INF/pn.faces-config.xml
===================================================================
---
root/ui/output/trunk/panels/ui/src/main/resources/META-INF/pn.faces-config.xml 2010-07-20
15:11:58 UTC (rev 18160)
+++
root/ui/output/trunk/panels/ui/src/main/resources/META-INF/pn.faces-config.xml 2010-07-20
15:17:30 UTC (rev 18161)
@@ -11,7 +11,7 @@
</behavior>
<component>
- <component-type>org.richfaces.panels.DivPanel</component-type>
+ <component-type>org.richfaces.DivPanel</component-type>
<component-class>org.richfaces.component.html.HtmlDivPanel</component-class>
<property>
<description></description>
@@ -91,7 +91,7 @@
</component>
<component>
- <component-type>org.richfaces.panels.TogglePanel</component-type>
+ <component-type>org.richfaces.TogglePanel</component-type>
<component-class>org.richfaces.component.html.HtmlTogglePanel</component-class>
<property>
<description></description>
@@ -191,11 +191,11 @@
<property>
<description></description>
<property-name>switchType</property-name>
- <property-class>org.richfaces.component.Method</property-class>
+
<property-class>org.richfaces.component.SwitchType</property-class>
</property>
<property>
<description></description>
- <property-name>selectedItem</property-name>
+ <property-name>activeItem</property-name>
<property-class>java.lang.String</property-class>
</property>
<property>
@@ -235,13 +235,13 @@
</property>
<property>
<description></description>
- <property-name>selectedItemChangeListener</property-name>
+ <property-name>itemChangeListener</property-name>
<property-class>javax.el.MethodExpression</property-class>
</property>
</component>
<component>
-
<component-type>org.richfaces.panels.TogglePanelItem</component-type>
+ <component-type>org.richfaces.TogglePanelItem</component-type>
<component-class>org.richfaces.component.html.HtmlTogglePanelItem</component-class>
<property>
<description></description>
@@ -326,7 +326,7 @@
<property>
<description></description>
<property-name>switchType</property-name>
- <property-class>org.richfaces.component.Method</property-class>
+
<property-class>org.richfaces.component.SwitchType</property-class>
</property>
<property>
<description></description>
@@ -345,18 +345,18 @@
<render-kit>
<render-kit-id>HTML_BASIC</render-kit-id>
<renderer>
-
<component-family>org.richfaces.panels.DivPanel</component-family>
-
<renderer-type>org.richfaces.panels.DivPanelRenderer</renderer-type>
+ <component-family>org.richfaces.DivPanel</component-family>
+ <renderer-type>org.richfaces.DivPanel</renderer-type>
<renderer-class>org.richfaces.renderkit.html.DivPanelRenderer</renderer-class>
</renderer>
<renderer>
-
<component-family>org.richfaces.panels.TogglePanel</component-family>
-
<renderer-type>org.richfaces.panels.TogglePanelRenderer</renderer-type>
+ <component-family>org.richfaces.TogglePanel</component-family>
+ <renderer-type>org.richfaces.TogglePanel</renderer-type>
<renderer-class>org.richfaces.renderkit.html.TogglePanelRenderer</renderer-class>
</renderer>
<renderer>
-
<component-family>org.richfaces.panels.TogglePanelItem</component-family>
-
<renderer-type>org.richfaces.panels.TogglePanelItemRenderer</renderer-type>
+
<component-family>org.richfaces.TogglePanelItem</component-family>
+ <renderer-type>org.richfaces.TogglePanelItem</renderer-type>
<renderer-class>org.richfaces.renderkit.html.TogglePanelItemRenderer</renderer-class>
</renderer>
Modified: root/ui/output/trunk/panels/ui/src/main/resources/META-INF/pn.taglib.xml
===================================================================
--- root/ui/output/trunk/panels/ui/src/main/resources/META-INF/pn.taglib.xml 2010-07-20
15:11:58 UTC (rev 18160)
+++ root/ui/output/trunk/panels/ui/src/main/resources/META-INF/pn.taglib.xml 2010-07-20
15:17:30 UTC (rev 18161)
@@ -16,9 +16,8 @@
<tag>
<tag-name>divPanel</tag-name>
<component>
- <component-type>org.richfaces.panels.DivPanel</component-type>
-
<renderer-type>org.richfaces.panels.DivPanelRenderer</renderer-type>
-
+ <component-type>org.richfaces.DivPanel</component-type>
+ <renderer-type>org.richfaces.DivPanel</renderer-type>
</component>
<attribute>
<description></description>
@@ -101,9 +100,9 @@
<tag>
<tag-name>togglePanel</tag-name>
<component>
-
<component-type>org.richfaces.panels.TogglePanel</component-type>
-
<renderer-type>org.richfaces.panels.TogglePanelRenderer</renderer-type>
-
<handler-class>org.richfaces.taglib.TogglePanelTagHandler</handler-class>
+ <component-type>org.richfaces.TogglePanel</component-type>
+ <renderer-type>org.richfaces.TogglePanel</renderer-type>
+
<handler-class>org.richfaces.view.facelets.html.TogglePanelTagHandler</handler-class>
</component>
<attribute>
<description></description>
@@ -203,11 +202,11 @@
<attribute>
<description></description>
<name>switchType</name>
- <type>org.richfaces.component.Method</type>
+ <type>org.richfaces.component.SwitchType</type>
</attribute>
<attribute>
<description></description>
- <name>selectedItem</name>
+ <name>activeItem</name>
<type>java.lang.String</type>
</attribute>
<attribute>
@@ -247,23 +246,23 @@
</attribute>
<attribute>
<description></description>
- <name>selectedItemChangeListener</name>
+ <name>itemChangeListener</name>
<type>javax.el.MethodExpression</type>
</attribute>
</tag>
<tag>
<description>
- Register a SelectedItemChangeListener instance on the UIComponent
+ Register a ItemChangeListener instance on the UIComponent
associated with the closest parent UIComponent custom
action.
</description>
- <tag-name>selectedItemChangeListener</tag-name>
-
<handler-class>org.richfaces.taglib.SelectedItemChangeListenerHandler</handler-class>
+ <tag-name>itemChangeListener</tag-name>
+
<handler-class>org.richfaces.view.facelets.html.ItemChangeListenerHandler</handler-class>
<attribute>
<description>
Fully qualified Java class name of a
- SelectedItemChangeListener to be created and registered.
+ ItemChangeListener to be created and registered.
</description>
<name>type</name>
<type>java.lang.String</type>
@@ -271,11 +270,11 @@
<attribute>
<description>
Value binding expression that evaluates to an object that
- implements org.richfaces.event.SelectedItemChangeListener.
+ implements org.richfaces.event.ItemChangeListener.
</description>
<name>binding</name>
<required>false</required>
- <type>org.richfaces.event.SelectedItemChangeListener</type>
+ <type>org.richfaces.event.ItemChangeListener</type>
</attribute>
<attribute>
<description>
@@ -291,8 +290,8 @@
<tag>
<tag-name>togglePanelItem</tag-name>
<component>
-
<component-type>org.richfaces.panels.TogglePanelItem</component-type>
-
<renderer-type>org.richfaces.panels.TogglePanelItemRenderer</renderer-type>
+ <component-type>org.richfaces.TogglePanelItem</component-type>
+ <renderer-type>org.richfaces.TogglePanelItem</renderer-type>
</component>
<attribute>
@@ -379,7 +378,7 @@
<attribute>
<description></description>
<name>switchType</name>
- <type>org.richfaces.component.Method</type>
+ <type>org.richfaces.component.SwitchType</type>
</attribute>
<attribute>
<description></description>
Modified:
root/ui/output/trunk/panels/ui/src/main/resources/META-INF/resources/script/TogglePanel.js
===================================================================
---
root/ui/output/trunk/panels/ui/src/main/resources/META-INF/resources/script/TogglePanel.js 2010-07-20
15:11:58 UTC (rev 18160)
+++
root/ui/output/trunk/panels/ui/src/main/resources/META-INF/resources/script/TogglePanel.js 2010-07-20
15:17:30 UTC (rev 18161)
@@ -57,13 +57,13 @@
* @return {Boolean} false
* */
execServer : function (oldPanel, newPanel) {
- var continueProcess = oldPanel.leave();
+ var continueProcess = oldPanel.__leave();
if (!continueProcess) {
return false;
}
- this.__setSelectedItem(newPanel.getName());
+ this.__setActiveItem(newPanel.getName());
rf.submitForm(this.__getParentForm(), null, {});
@@ -80,9 +80,9 @@
execAjax : function (oldPanel, newPanel) {
var options = $.extend({}, this.comp.options["ajax"],
{}/*this.getParameters(newPanel)*/);
- this.__setSelectedItem(newPanel.getName());
+ this.__setActiveItem(newPanel.getName());
rf.ajax(this.comp.id, null, options);
- this.__setSelectedItem(oldPanel.getName());
+ this.__setActiveItem(oldPanel.getName());
return false;
},
@@ -97,14 +97,14 @@
* - true - in other cases
* */
execClient : function (oldPanel, newPanel) {
- var continueProcess = oldPanel.leave();
+ var continueProcess = oldPanel.__leave();
if (!continueProcess) {
return false;
}
- this.__setSelectedItem(newPanel.getName());
+ this.__setActiveItem(newPanel.getName());
- newPanel.enter();
+ newPanel.__enter();
this.__fireItemChange(oldPanel, newPanel);
return true;
@@ -120,9 +120,9 @@
/**
* @private
* */
- __setSelectedItem : function (name) {
+ __setActiveItem : function (name) {
rf.getDomElement(this.__getValueInputId()).value = name;
- this.comp.selectedItem = name;
+ this.comp.activeItem = name;
},
/**
@@ -153,7 +153,7 @@
this.attachToDom(componentId);
this.options = options;
- this.selectedItem = this.options.selectedItem;
+ this.activeItem = this.options.activeItem;
this.switchMode = this.options.switchMode;
this.items = this.options.items;
},
@@ -167,7 +167,7 @@
* @return {String} name of current selected panel item
*/
getSelectItem: function () {
- return this.selectedItem;
+ return this.activeItem;
},
/**
@@ -257,11 +257,11 @@
* @methodOf
* @name TogglePanel#nextItem
*
- * @param {String} [itemName = selectedItem]
+ * @param {String} [itemName = activeItem]
* @return {String} name of next panel item
*/
nextItem: function (itemName) {
- var itemIndex = this.__getItemIndex(itemName || this.selectedItem);
+ var itemIndex = this.__getItemIndex(itemName || this.activeItem);
if (itemIndex == -1) {
return null;
}
@@ -298,7 +298,7 @@
* null if it is first item
*/
prevItem: function (itemName) {
- var itemIndex = this.__getItemIndex(itemName || this.selectedItem);
+ var itemIndex = this.__getItemIndex(itemName || this.activeItem);
if (itemIndex < 1) {
return null;
}
@@ -335,8 +335,8 @@
__ITEMS_META_NAMES : {
"@first" : function (comp) { return 0; },
- "@prev" : function (comp) { return
comp.__getItemIndex(comp.selectedItem) - 1; },
- "@next" : function (comp) { return
comp.__getItemIndex(comp.selectedItem) + 1; },
+ "@prev" : function (comp) { return
comp.__getItemIndex(comp.activeItem) - 1; },
+ "@next" : function (comp) { return
comp.__getItemIndex(comp.activeItem) + 1; },
"@last" : function (comp) { return comp.items.length - 1; }
},
Modified:
root/ui/output/trunk/panels/ui/src/main/resources/META-INF/resources/script/TogglePanelItem.js
===================================================================
---
root/ui/output/trunk/panels/ui/src/main/resources/META-INF/resources/script/TogglePanelItem.js 2010-07-20
15:11:58 UTC (rev 18160)
+++
root/ui/output/trunk/panels/ui/src/main/resources/META-INF/resources/script/TogglePanelItem.js 2010-07-20
15:17:30 UTC (rev 18161)
@@ -22,104 +22,97 @@
(function ($, rf) {
- /***************************** Stuff
******************************************************************************/
rf.ui = rf.ui || {};
- rf.ui.TogglePanelItem = function(componentId, options) {
- // call constructor of parent class
- $super.constructor.call(this, componentId);
- this.attachToDom(componentId);
+ rf.ui.TogglePanelItem = rf.BaseComponent.extendClass({
- this.options = options;
- this.name = this.options.name;
- this.togglePanelId = this.options.togglePanelId;
- this.switchMode = this.options.switchMode;
- };
+ // class name
+ name:"TogglePanelItem",
- rf.BaseComponent.extend(rf.ui.TogglePanelItem);
+ init : function (componentId, options) {
+ // call constructor of parent class
+ this.$super.constructor.call(this, componentId);
+ this.$super.attachToDom.call(this, componentId);
- // define super class link
- var $super = rf.ui.TogglePanelItem.$super;
+ this.options = options;
+ this.name = this.options.name;
+ this.togglePanelId = this.options.togglePanelId;
+ this.switchMode = this.options.switchMode;
+ },
- /***************************** Private Static Methods
*************************************************************/
+ /***************************** Public Methods
*****************************************************************/
+ /**
+ * @methodOf TogglePanelItem
+ * @name TogglePanelItem#getName
+ *
+ * @return {String} panel item name
+ */
+ getName: function () {
+ return this.options.name;
+ },
- function fireLeave($this) {
- return rf.Event.fireById($this.id, "leave");
- }
+ /**
+ * @methodOf
+ * @name TogglePanelItem#getTogglePanel
+ *
+ * @return {TogglePanel} parent TogglePanel
+ * */
+ getTogglePanel : function () {
+ return rf.$(this.togglePanelId);
+ },
- function fireEnter($this) {
- return rf.Event.fireById($this.id, "enter");
- }
+ /**
+ * @methodOf
+ * @name TogglePanelItem#isSelected
+ *
+ * @return {Boolean} true if this panel item is selected in the parent toggle
panel
+ * */
+ isSelected : function () {
+ return this.getName() == this.getTogglePanel().getSelectItem();
+ },
- /***************************** Public Methods
********************************************************************/
- $.extend(rf.ui.TogglePanelItem.prototype, (function () {
- return {
- // class name
- name:"TogglePanelItem",
- // public api
- /**
- * @methodOf
- * @name TogglePanelItem#getName
- *
- * @return {String} panel item name
- */
- getName: function () {
- return this.options.name;
- },
+ /***************************** Private Methods
****************************************************************/
- /**
- * @methodOf
- * @name TogglePanelItem#getTogglePanel
- *
- * @return {TogglePanel} parent TogglePanel
- * */
- getTogglePanel : function () {
- return rf.$(this.togglePanelId);
- },
+ /**
+ * @private
+ *
+ * used in TogglePanel
+ * */
+ __enter : function () {
+ rf.getDomElement(this.id).style.display = "block";
- /**
- * @methodOf
- * @name TogglePanelItem#isSelected
- *
- * @return {Boolean} true if this panel item is selected in the parent toggle
panel
- * */
- isSelected : function () {
- return this.getName() == this.getTogglePanel().getSelectItem();
- },
+ return this.__fireEnter();
+ },
- /**
- * @private
- *
- * used in TogglePanel
- * */
- enter : function () {
- rf.getDomElement(this.id).style.display = "block";
+ /**
+ * @private
+ *
+ * used in TogglePanel
+ * */
+ __leave : function () {
+ var continueProcess = this.__fireLeave();
+ if (!continueProcess) {
+ return false;
+ }
- return fireEnter(this);
- },
+ rf.getDomElement(this.id).style.display = "none";
+ return true;
+ },
- /**
- * @private
- *
- * used in TogglePanel
- * */
- leave : function () {
- var continueProcess = fireLeave(this);
- if (!continueProcess) {
- return false;
- }
+ __fireLeave : function () {
+ return rf.Event.fireById(this.id, "__leave");
+ },
- rf.getDomElement(this.id).style.display = "none";
- return true;
- },
+ __fireEnter : function () {
+ return rf.Event.fireById(this.id, "__enter");
+ },
- // class stuff
- destroy: function () {
- // rf.Event.unbindById(this.options.buttonId,
"."+this.namespace);
- // rf.Event.unbindById(this.componentId,
"."+this.namespace);
-// $super.destroy.call(this);
- }
- };
- })());
+ // class stuff
+ destroy: function () {
+ // rf.Event.unbindById(this.options.buttonId,
"."+this.namespace);
+ // rf.Event.unbindById(this.componentId,
"."+this.namespace);
+ // $super.destroy.call(this);
+ }
+ });
})(jQuery, RichFaces);