JBoss Rich Faces SVN: r19113 - in branches/RF-7944: examples/output-demo/src/main/webapp/resources/tests and 5 other directories.
by richfaces-svn-commits@lists.jboss.org
Author: Alex.Kolonitsky
Date: 2010-09-03 10:08:46 -0400 (Fri, 03 Sep 2010)
New Revision: 19113
Added:
branches/RF-7944/examples/output-demo/src/main/webapp/qunit/tab.xhtml
branches/RF-7944/examples/output-demo/src/main/webapp/qunit/tabPanel.xhtml
branches/RF-7944/examples/output-demo/src/main/webapp/resources/tests/richfaces-accordion-item-qunit.js
branches/RF-7944/examples/output-demo/src/main/webapp/resources/tests/richfaces-tab-panel-qunit.js
branches/RF-7944/examples/output-demo/src/main/webapp/resources/tests/richfaces-tab-qunit.js
branches/RF-7944/ui/output/api/src/main/java/org/richfaces/HeaderAlignment.java
branches/RF-7944/ui/output/api/src/main/java/org/richfaces/HeaderPosition.java
branches/RF-7944/ui/output/ui/src/main/java/org/richfaces/component/AbstractTabPanel.java
branches/RF-7944/ui/output/ui/src/main/java/org/richfaces/component/html/HtmlTab.java
branches/RF-7944/ui/output/ui/src/main/java/org/richfaces/component/html/HtmlTabPanel.java
branches/RF-7944/ui/output/ui/src/main/java/org/richfaces/renderkit/html/TabPanelRenderer.java
branches/RF-7944/ui/output/ui/src/main/java/org/richfaces/renderkit/html/TabRenderer.java
branches/RF-7944/ui/output/ui/src/test/java/org/richfaces/component/UICollapsiblePanelTest.java
branches/RF-7944/ui/output/ui/src/test/java/org/richfaces/component/UITogglePanelTitledItemTest.java
Log:
RF-7944 Tab Panel Component
Added: branches/RF-7944/examples/output-demo/src/main/webapp/qunit/tab.xhtml
===================================================================
--- branches/RF-7944/examples/output-demo/src/main/webapp/qunit/tab.xhtml (rev 0)
+++ branches/RF-7944/examples/output-demo/src/main/webapp/qunit/tab.xhtml 2010-09-03 14:08:46 UTC (rev 19113)
@@ -0,0 +1,259 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml"
+ xmlns:h="http://java.sun.com/jsf/html"
+ xmlns:f="http://java.sun.com/jsf/core"
+ xmlns:ui="http://java.sun.com/jsf/facelets"
+ xmlns:pn="http://richfaces.org/output">
+
+<body>
+<ui:composition template="/templates/template.xhtml">
+
+ <ui:define name="scripts">
+ <h:outputScript name="qunit/qunit.js" />
+ <h:outputScript name="qunit/richfaces-qunit.js" />
+
+ <h:outputScript name="Tab.js" />
+ <h:outputScript name="TabPanel.js" />
+
+ <h:outputStylesheet name="qunit/qunit.css" />
+ </ui:define>
+
+ <ui:define name="title">Tab Example</ui:define>
+ <ui:define name="body_head">Tab Example</ui:define>
+
+ <ui:define name="body">
+ <p>Page</p>
+
+ <h:form id="f" style="border:blue solid thin;">
+ <pn:accordion >
+ <pn:accordionItem></pn:accordionItem>
+ </pn:accordion>
+
+ <div id="f:panel" style="width: 100%;">
+ <input type="hidden" name="f:panel-value" id="f:panel-value" value="name1" />
+ <script type="text/javascript">
+ new RichFaces.ui.TabPanel(
+ "f:panel",
+ {
+ "onbeforeitemchange":function(event){RichFaces.ajax("f:panel",event,{"incId":"1"} )},
+ "onitemchange":function(event){RichFaces.ajax("f:panel",event,{"incId":"1"} )},
+ "activeItem":"name1",
+ "ajax":{"incId":"1"} ,
+ "cycledSwitching":false,
+ "isKeepHeight":true
+ }
+ )
+
+ </script>
+
+ <div id="f:panel:header" class="rftp_toptab_tabline_vis">
+ <div class="rftp_toptab_tabs">
+ <div style="display: table-row;">
+ <div style="padding-left: 5px;" class="rftp_toptab_spacer" ></div>
+
+ <div id="f:name1:header">
+ <div id="f:name1:header:active" class="rftp_toptab rftp_active_top">
+ <div style="display: table;">
+ <div style="display: table-row;">
+ <div class="rftp_icon">
+ <img width="16" height="16" src="ico.gif" alt=""/>
+ </div>
+ <div class="rftp_label">Tab name 1 Active</div>
+ <div class="rftp_close">
+ <img width="16" height="16" src="close.gif" alt=""/>
+ </div>
+ </div>
+ </div>
+ </div>
+ <div id="f:name1:header:inactive" style="display:none" class="rftp_toptab rftp_active_top">
+ <div style="display: table;">
+ <div style="display: table-row;">
+ <div class="rftp_icon">
+ <img width="16" height="16" src="ico.gif" alt=""/>
+ </div>
+ <div class="rftp_label">Tab name 1 Inactive</div>
+ <div class="rftp_close">
+ <img width="16" height="16" src="close.gif" alt=""/>
+ </div>
+ </div>
+ </div>
+ </div>
+ <div id="f:name1:header:disabled" style="display:none" class="rftp_toptab rftp_active_top">
+ <div style="display: table;">
+ <div style="display: table-row;">
+ <div class="rftp_icon">
+ <img width="16" height="16" src="ico.gif" alt=""/>
+ </div>
+ <div class="rftp_label">Tab name 1 Disabled</div>
+ <div class="rftp_close">
+ <img width="16" height="16" src="close.gif" alt=""/>
+ </div>
+ </div>
+ </div>
+ </div>
+ </div>
+ <div class="rftp_toptab_spacer rftp_horizonttab_tabspacer_width"></div>
+
+ <div id="f:name2:header">
+ <div id="f:name2:header:active" style="display:none" class="rftp_toptab">
+ <div style="display: table;">
+ <div style="display: table-row;">
+ <div class="rftp_icon">
+ <img width="16" height="16" src="ico.gif" alt="" />
+ </div>
+ <div class="rftp_label">Tab name 2 Active</div>
+ <div class="rftp_close">
+ <img width="16" height="16" src="close_act.gif" alt="" />
+ </div>
+ </div>
+ </div>
+ </div>
+ <div id="f:name2:header:inactive" class="rftp_toptab">
+ <div style="display: table;">
+ <div style="display: table-row;">
+ <div class="rftp_icon">
+ <img width="16" height="16" src="ico.gif" alt="" />
+ </div>
+ <div class="rftp_label">Tab name 2 Inactive</div>
+ <div class="rftp_close">
+ <img width="16" height="16" src="close_act.gif" alt="" />
+ </div>
+ </div>
+ </div>
+ </div>
+ <div id="f:name2:header:disabled" style="display:none" class="rftp_toptab">
+ <div style="display: table;">
+ <div style="display: table-row;">
+ <div class="rftp_icon">
+ <img width="16" height="16" src="ico.gif" alt="" />
+ </div>
+ <div class="rftp_label">Tab name 2 Disabled</div>
+ <div class="rftp_close">
+ <img width="16" height="16" src="close_act.gif" alt="" />
+ </div>
+ </div>
+ </div>
+ </div>
+ </div>
+ <div class="rftp_toptab_spacer rftp_horizonttab_tabspacer_width"></div>
+
+ <div id="f:name3:header">
+ <div id="f:name3:header:active" style="display:none" class="rftp_toptab">
+ <div style="display: table;">
+ <div style="display: table-row;">
+ <div class="rftp_icon">
+ <img width="16" height="16" src="ico.gif" alt="" />
+ </div>
+ <div class="rftp_label">Tab name 3 Active</div>
+ <div class="rftp_close">
+ <img width="16" height="16" src="close_act.gif" alt="" />
+ </div>
+ </div>
+ </div>
+ </div>
+ <div id="f:name3:header:inactive" class="rftp_toptab">
+ <div style="display: table;">
+ <div style="display: table-row;">
+ <div class="rftp_icon">
+ <img width="16" height="16" src="ico.gif" alt="" />
+ </div>
+ <div class="rftp_label">Tab name 3 Inactive</div>
+ <div class="rftp_close">
+ <img width="16" height="16" src="close_act.gif" alt="" />
+ </div>
+ </div>
+ </div>
+ </div>
+ <div id="f:name3:header:disabled" style="display:none" class="rftp_toptab">
+ <div style="display: table;">
+ <div style="display: table-row;">
+ <div class="rftp_icon">
+ <img width="16" height="16" src="ico.gif" alt="" />
+ </div>
+ <div class="rftp_label">Tab name 3 Disabled</div>
+ <div class="rftp_close">
+ <img width="16" height="16" src="close_act.gif" alt="" />
+ </div>
+ </div>
+ </div>
+ </div>
+ </div>
+ <div class="rftp_toptab_spacer rftp_horizonttab_tabspacer_width"></div>
+
+ <div style="padding-right: 5px; width: 100%;" class="rftp_toptab_spacer"></div>
+ </div>
+ </div>
+
+ <div class="rftp_toptab_scroll_left rftp_hidden">«</div>
+ <div class="rftp_toptab_tabslist rftp_hidden">↓</div>
+ <div class="rftp_toptab_scroll_right rftp_hidden">»</div>
+ </div>
+
+ <div class="rftp_toptab_border"></div>
+
+ <div id="f:panel:content" >
+ <div id="f:name1" class="rftp_toptab_content" >
+ <script type="text/javascript">
+ new RichFaces.ui.Tab(
+ "f:name1",
+ {
+ "onleave":function(event){RichFaces.ajax("f:name1",event,{"incId":"1"} )},
+ "onenter":function(event){RichFaces.ajax("f:name1",event,{"incId":"1"} )},
+ "index":0,
+ "togglePanelId":"f:panel",
+ "switchMode":"client",
+ "name":"name1"
+ }
+ )
+ </script>
+ Content 01 will be here.
+ </div>
+ <div id="f:name2" class="rftp_toptab_content" style="display:none;">
+ <script type="text/javascript">
+ new RichFaces.ui.Tab(
+ "f:name2",
+ {
+ "onleave":function(event){RichFaces.ajax("f:name2",event,{"incId":"1"} )},
+ "onenter":function(event){RichFaces.ajax("f:name2",event,{"incId":"1"} )},
+ "index":1,
+ "togglePanelId":"f:panel",
+ "switchMode":"client",
+ "name":"name2"
+ }
+ )
+ </script>
+ Content 02 will be here.
+ </div>
+ <div id="f:name3" class="rftp_toptab_content" style="display:none;">
+ <script type="text/javascript">
+ new RichFaces.ui.Tab(
+ "f:name3",
+ {
+ "onleave":function(event){RichFaces.ajax("f:name3",event,{"incId":"1"} )},
+ "onenter":function(event){RichFaces.ajax("f:name3",event,{"incId":"1"} )},
+ "index":2,
+ "togglePanelId":"f:panel",
+ "switchMode":"client",
+ "name":"name3"
+ }
+ )
+ </script>
+ Content 03 will be here.
+ </div>
+ </div>
+ </div>
+
+ </h:form>
+
+ <p>Result</p>
+ <div>
+ <ol id="qunit-tests"></ol>
+
+ <div id="testDiv" style="margin-top:10px; border:1px solid #a0a0a0">Main Test Div</div>
+ </div>
+ <h:outputScript name="tests/richfaces-tab-qunit.js" />
+ </ui:define>
+</ui:composition>
+</body>
+</html>
+
Added: branches/RF-7944/examples/output-demo/src/main/webapp/qunit/tabPanel.xhtml
===================================================================
--- branches/RF-7944/examples/output-demo/src/main/webapp/qunit/tabPanel.xhtml (rev 0)
+++ branches/RF-7944/examples/output-demo/src/main/webapp/qunit/tabPanel.xhtml 2010-09-03 14:08:46 UTC (rev 19113)
@@ -0,0 +1,43 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml"
+ xmlns:h="http://java.sun.com/jsf/html"
+ xmlns:f="http://java.sun.com/jsf/core"
+ xmlns:ui="http://java.sun.com/jsf/facelets"
+ xmlns:pn="http://richfaces.org/output">
+
+<body>
+<ui:composition template="/templates/template.xhtml">
+
+ <ui:define name="scripts">
+ <h:outputScript name="qunit/qunit.js" />
+ <h:outputScript name="qunit/richfaces-qunit.js" />
+
+ <h:outputStylesheet name="qunit/qunit.css" />
+ </ui:define>
+
+ <ui:define name="title">TABPANEL Example</ui:define>
+ <ui:define name="body_head">TABPANEL Example</ui:define>
+
+ <ui:define name="body">
+ <p>Page</p>
+
+ <h:form id="f" style="border:blue solid thin;">
+ <pn:tabPanel id="tabPanel">
+ <!-- TODO -->
+ </pn:tabPanel>
+
+ </h:form>
+
+ <p>Result</p>
+ <div>
+ <ol id="qunit-tests"></ol>
+
+ <div id="testDiv" style="margin-top:10px; border:1px solid #a0a0a0">Main Test Div</div>
+
+ </div>
+ <h:outputScript name="tests/richfaces-tab-panel-qunit.js" />
+ </ui:define>
+</ui:composition>
+</body>
+</html>
+
Added: branches/RF-7944/examples/output-demo/src/main/webapp/resources/tests/richfaces-accordion-item-qunit.js
===================================================================
--- branches/RF-7944/examples/output-demo/src/main/webapp/resources/tests/richfaces-accordion-item-qunit.js (rev 0)
+++ branches/RF-7944/examples/output-demo/src/main/webapp/resources/tests/richfaces-accordion-item-qunit.js 2010-09-03 14:08:46 UTC (rev 19113)
@@ -0,0 +1,76 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright ${year}, Red Hat, Inc. and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+
+RichFaces.QUnit.run(function() {
+ module("richfaces-accordion-item");
+
+ var ACCORDION_ITEM_ID = "f:panel";
+
+ test("RichFaces.ui.AccordionItem test constructor", function () {
+ var c = RichFaces.$(ACCORDION_ITEM_ID);
+
+ ok(c instanceof RichFaces.ui.AccordionItem, "inctance of RichFaces.ui.AccordionItem");
+ equals(c.id, ACCORDION_ITEM_ID, "id");
+ // TODO other params
+
+ });
+
+ test("RichFaces.ui.AccordionItem test public api", function () {
+ var c = RichFaces.$(ACCORDION_ITEM_ID);
+
+ var PUBLIC_API = [/* ... */];
+
+ for (i in PUBLIC_API) {
+ var funcName = PUBLIC_API[i];
+ ok(c.[funcName], funcName + "present in component")
+ // TODO check other functions + check is it function
+ }
+ });
+
+ test("RichFaces.ui.AccordionItem test events", function () {
+ var componentId = ACCORDION_ITEM_ID;
+ var c = RichFaces.$(componentId);
+
+ expect(5);
+ var beforeitemchngeHandler = function (event, comp, data) {
+ ok(true, "beforeitemchnge handler invouked");
+
+ same(data.id, componentId, "component id");
+ same(data.oldItem.getName(), c.items[0].getName(), "old item");
+ same(data.newItem.getName(), c.items[1].getName(), "new item");
+
+ return true;
+ };
+
+ var beforeitemchngeHandlerWrapper = RichFaces.Event.bindById(componentId, "beforeitemchange", beforeitemchngeHandler);
+
+ var itemchangeHandler = handler("itemchnge handler invouked", undefined);
+ var itemchangeHandlerWrapper = RichFaces.Event.bindById(componentId, "itemchange", itemchangeHandler);
+
+ c.switchToItem("name2");
+
+ RichFaces.Event.unbindById(componentId, "beforeitemchange", beforeitemchngeHandlerWrapper);
+ RichFaces.Event.unbindById(componentId, "itemchange", itemchangeHandlerWrapper);
+
+ c.switchToItem("name1");
+ });
+});
Added: branches/RF-7944/examples/output-demo/src/main/webapp/resources/tests/richfaces-tab-panel-qunit.js
===================================================================
--- branches/RF-7944/examples/output-demo/src/main/webapp/resources/tests/richfaces-tab-panel-qunit.js (rev 0)
+++ branches/RF-7944/examples/output-demo/src/main/webapp/resources/tests/richfaces-tab-panel-qunit.js 2010-09-03 14:08:46 UTC (rev 19113)
@@ -0,0 +1,76 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright ${year}, Red Hat, Inc. and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+
+RichFaces.QUnit.run(function() {
+ module("richfaces-tab-panel");
+
+ var TAB_PANEL_ID = "f:panel";
+
+ test("RichFaces.ui.TabPanel test constructor", function () {
+ var c = RichFaces.$(TAB_PANEL_ID);
+
+ ok(c instanceof RichFaces.ui.TabPanel, "inctance of RichFaces.ui.TabPanel");
+ equals(c.id, TAB_PANEL_ID, "id");
+ // TODO other params
+
+ });
+
+ test("RichFaces.ui.TabPanel test public api", function () {
+ var c = RichFaces.$(TAB_PANEL_ID);
+
+ var PUBLIC_API = [/* ... */];
+
+ for (i in PUBLIC_API) {
+ var funcName = PUBLIC_API[i];
+ ok(c.[funcName], funcName + "present in component")
+ // TODO check other functions + check is it function
+ }
+ });
+
+ test("RichFaces.ui.TabPanel test events", function () {
+ var componentId = TAB_PANEL_ID;
+ var c = RichFaces.$(componentId);
+
+ expect(5);
+ var beforeitemchngeHandler = function (event, comp, data) {
+ ok(true, "beforeitemchnge handler invouked");
+
+ same(data.id, componentId, "component id");
+ same(data.oldItem.getName(), c.items[0].getName(), "old item");
+ same(data.newItem.getName(), c.items[1].getName(), "new item");
+
+ return true;
+ };
+
+ var beforeitemchngeHandlerWrapper = RichFaces.Event.bindById(componentId, "beforeitemchange", beforeitemchngeHandler);
+
+ var itemchangeHandler = handler("itemchnge handler invouked", undefined);
+ var itemchangeHandlerWrapper = RichFaces.Event.bindById(componentId, "itemchange", itemchangeHandler);
+
+ c.switchToItem("name2");
+
+ RichFaces.Event.unbindById(componentId, "beforeitemchange", beforeitemchngeHandlerWrapper);
+ RichFaces.Event.unbindById(componentId, "itemchange", itemchangeHandlerWrapper);
+
+ c.switchToItem("name1");
+ });
+});
Added: branches/RF-7944/examples/output-demo/src/main/webapp/resources/tests/richfaces-tab-qunit.js
===================================================================
--- branches/RF-7944/examples/output-demo/src/main/webapp/resources/tests/richfaces-tab-qunit.js (rev 0)
+++ branches/RF-7944/examples/output-demo/src/main/webapp/resources/tests/richfaces-tab-qunit.js 2010-09-03 14:08:46 UTC (rev 19113)
@@ -0,0 +1,76 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright ${year}, Red Hat, Inc. and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+
+RichFaces.QUnit.run(function() {
+ module("richfaces-tab");
+
+ var TAB_ID = "f:panel";
+
+ test("RichFaces.ui.Tab test constructor", function () {
+ var c = RichFaces.$(TAB_ID);
+
+ ok(c instanceof RichFaces.ui.Tab, "inctance of RichFaces.ui.Tab");
+ equals(c.id, TAB_ID, "id");
+ // TODO other params
+
+ });
+
+ test("RichFaces.ui.Tab test public api", function () {
+ var c = RichFaces.$(TAB_ID);
+
+ var PUBLIC_API = [/* ... */];
+
+ for (var i in PUBLIC_API) {
+ var funcName = PUBLIC_API[i];
+ ok(c.[funcName], funcName + "present in component");
+ // TODO check other functions + check is it function
+ }
+ });
+
+ test("RichFaces.ui.Tab test events", function () {
+ var componentId = TAB_ID;
+ var c = RichFaces.$(componentId);
+
+ expect(5);
+ var beforeitemchngeHandler = function (event, comp, data) {
+ ok(true, "beforeitemchnge handler invouked");
+
+ same(data.id, componentId, "component id");
+ same(data.oldItem.getName(), c.items[0].getName(), "old item");
+ same(data.newItem.getName(), c.items[1].getName(), "new item");
+
+ return true;
+ };
+
+ var beforeitemchngeHandlerWrapper = RichFaces.Event.bindById(componentId, "beforeitemchange", beforeitemchngeHandler);
+
+ var itemchangeHandler = handler("itemchnge handler invouked", undefined);
+ var itemchangeHandlerWrapper = RichFaces.Event.bindById(componentId, "itemchange", itemchangeHandler);
+
+ c.switchToItem("name2");
+
+ RichFaces.Event.unbindById(componentId, "beforeitemchange", beforeitemchngeHandlerWrapper);
+ RichFaces.Event.unbindById(componentId, "itemchange", itemchangeHandlerWrapper);
+
+ c.switchToItem("name1");
+ });
+});
Added: branches/RF-7944/ui/output/api/src/main/java/org/richfaces/HeaderAlignment.java
===================================================================
--- branches/RF-7944/ui/output/api/src/main/java/org/richfaces/HeaderAlignment.java (rev 0)
+++ branches/RF-7944/ui/output/api/src/main/java/org/richfaces/HeaderAlignment.java 2010-09-03 14:08:46 UTC (rev 19113)
@@ -0,0 +1,9 @@
+package org.richfaces;
+
+/**
+ * @author akolonitsky
+ * @since Aug 24, 2010
+ */
+public enum HeaderAlignment {
+ left, center, right, bottom, top
+}
Added: branches/RF-7944/ui/output/api/src/main/java/org/richfaces/HeaderPosition.java
===================================================================
--- branches/RF-7944/ui/output/api/src/main/java/org/richfaces/HeaderPosition.java (rev 0)
+++ branches/RF-7944/ui/output/api/src/main/java/org/richfaces/HeaderPosition.java 2010-09-03 14:08:46 UTC (rev 19113)
@@ -0,0 +1,9 @@
+package org.richfaces;
+
+/**
+ * @author akolonitsky
+ * @since Aug 24, 2010
+ */
+public enum HeaderPosition {
+ top, left, right, bottom
+}
Added: branches/RF-7944/ui/output/ui/src/main/java/org/richfaces/component/AbstractTabPanel.java
===================================================================
--- branches/RF-7944/ui/output/ui/src/main/java/org/richfaces/component/AbstractTabPanel.java (rev 0)
+++ branches/RF-7944/ui/output/ui/src/main/java/org/richfaces/component/AbstractTabPanel.java 2010-09-03 14:08:46 UTC (rev 19113)
@@ -0,0 +1,48 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright ${year}, Red Hat, Inc. and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+
+package org.richfaces.component;
+
+
+
+/**
+ * @author akolonitsky
+ * @since 2010-08-24
+ */
+public abstract class AbstractTabPanel extends UITogglePanel {
+
+ public static final String COMPONENT_TYPE = "org.richfaces.TabPanel";
+
+ public static final String COMPONENT_FAMILY = "org.richfaces.TabPanel";
+
+ protected AbstractTabPanel() {
+ setRendererType("org.richfaces.TabPanel");
+ }
+
+ @Override
+ public String getFamily() {
+ return COMPONENT_FAMILY;
+ }
+
+
+
+}
Added: branches/RF-7944/ui/output/ui/src/main/java/org/richfaces/component/html/HtmlTab.java
===================================================================
--- branches/RF-7944/ui/output/ui/src/main/java/org/richfaces/component/html/HtmlTab.java (rev 0)
+++ branches/RF-7944/ui/output/ui/src/main/java/org/richfaces/component/html/HtmlTab.java 2010-09-03 14:08:46 UTC (rev 19113)
@@ -0,0 +1,304 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright ${year}, Red Hat, Inc. and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+
+package org.richfaces.component.html;
+
+import org.richfaces.component.UITogglePanelTitledItem;
+import javax.faces.component.behavior.ClientBehaviorHolder;
+
+import java.util.Arrays;
+import java.util.Collection;
+import java.util.Collections;
+
+/**
+ * @author akolonitsky
+ * @since 2010-08-27
+ */
+public class HtmlTab extends UITogglePanelTitledItem implements ClientBehaviorHolder {
+
+ public static final String COMPONENT_TYPE = "org.richfaces.TogglePanelTitledItem";
+
+ public static final String COMPONENT_FAMILY = "org.richfaces.TogglePanelTitledItem";
+
+ private static final Collection<String> EVENT_NAMES = Collections.unmodifiableCollection(Arrays.asList(
+ "headerclick",
+ "headerdblclick",
+ "headermousedown",
+ "headermousemove",
+ "headermouseup",
+ "enter",
+ "leave",
+ "click",
+ "dblclick",
+ "mousedown",
+ "mousemove",
+ "mouseout",
+ "mouseover",
+ "mouseup"
+ ));
+
+
+ public enum PropertyKeys {
+ headerClassActive,
+ headerClassDisabled,
+ headerClassInactive,
+ headerClass,
+ headerStyle,
+ contentClass,
+ onheaderclick,
+ onheaderdblclick,
+ onheadermousedown,
+ onheadermousemove,
+ onheadermouseup,
+ onenter,
+ onleave,
+ lang,
+ title,
+ style,
+ styleClass,
+ dir,
+ onclick,
+ ondblclick,
+ onmousedown,
+ onmousemove,
+ onmouseout,
+ onmouseover,
+ onmouseup
+ }
+
+ public HtmlTab() {
+ setRendererType("org.richfaces.Tab");
+ }
+
+ @Override
+ public String getFamily() {
+ return COMPONENT_FAMILY;
+ }
+
+ public String getHeaderClassActive() {
+ return (String) getStateHelper().eval(PropertyKeys.headerClassActive);
+ }
+
+ public void setHeaderClassActive(String headerClassActive) {
+ getStateHelper().put(PropertyKeys.headerClassActive, headerClassActive);
+ }
+
+ public String getHeaderClassDisabled() {
+ return (String) getStateHelper().eval(PropertyKeys.headerClassDisabled);
+ }
+
+ public void setHeaderClassDisabled(String headerClassDisabled) {
+ getStateHelper().put(PropertyKeys.headerClassDisabled, headerClassDisabled);
+ }
+
+ public String getHeaderClassInactive() {
+ return (String) getStateHelper().eval(PropertyKeys.headerClassInactive);
+ }
+
+ public void setHeaderClassInactive(String headerClassInactive) {
+ getStateHelper().put(PropertyKeys.headerClassInactive, headerClassInactive);
+ }
+
+ public String getHeaderClass() {
+ return (String) getStateHelper().eval(PropertyKeys.headerClass);
+ }
+
+ public void setHeaderClass(String headerClass) {
+ getStateHelper().put(PropertyKeys.headerClass, headerClass);
+ }
+
+ public String getHeaderStyle() {
+ return (String) getStateHelper().eval(PropertyKeys.headerStyle);
+ }
+
+ public void setHeaderStyle(String headerStyle) {
+ getStateHelper().put(PropertyKeys.headerStyle, headerStyle);
+ }
+
+ public String getContentClass() {
+ return (String) getStateHelper().eval(PropertyKeys.contentClass);
+ }
+
+ public void setContentClass(String contentClass) {
+ getStateHelper().put(PropertyKeys.contentClass, contentClass);
+ }
+
+ public String getOnheaderclick() {
+ return (String) getStateHelper().eval(PropertyKeys.onheaderclick);
+ }
+
+ public void setOnheaderclick(String onheaderclick) {
+ getStateHelper().put(PropertyKeys.onheaderclick, onheaderclick);
+ }
+
+ public String getOnheaderdblclick() {
+ return (String) getStateHelper().eval(PropertyKeys.onheaderdblclick);
+ }
+
+ public void setOnheaderdblclick(String onheaderdblclick) {
+ getStateHelper().put(PropertyKeys.onheaderdblclick, onheaderdblclick);
+ }
+
+ public String getOnheadermousedown() {
+ return (String) getStateHelper().eval(PropertyKeys.onheadermousedown);
+ }
+
+ public void setOnheadermousedown(String onheadermousedown) {
+ getStateHelper().put(PropertyKeys.onheadermousedown, onheadermousedown);
+ }
+
+ public String getOnheadermousemove() {
+ return (String) getStateHelper().eval(PropertyKeys.onheadermousemove);
+ }
+
+ public void setOnheadermousemove(String onheadermousemove) {
+ getStateHelper().put(PropertyKeys.onheadermousemove, onheadermousemove);
+ }
+
+ public String getOnheadermouseup() {
+ return (String) getStateHelper().eval(PropertyKeys.onheadermouseup);
+ }
+
+ public void setOnheadermouseup(String onheadermouseup) {
+ getStateHelper().put(PropertyKeys.onheadermouseup, onheadermouseup);
+ }
+
+ public String getOnenter() {
+ return (String) getStateHelper().eval(PropertyKeys.onenter);
+ }
+
+ public void setOnenter(String onenter) {
+ getStateHelper().put(PropertyKeys.onenter, onenter);
+ }
+
+ public String getOnleave() {
+ return (String) getStateHelper().eval(PropertyKeys.onleave);
+ }
+
+ public void setOnleave(String onleave) {
+ getStateHelper().put(PropertyKeys.onleave, onleave);
+ }
+
+ public String getLang() {
+ return (String) getStateHelper().eval(PropertyKeys.lang);
+ }
+
+ public void setLang(String lang) {
+ getStateHelper().put(PropertyKeys.lang, lang);
+ }
+
+ public String getTitle() {
+ return (String) getStateHelper().eval(PropertyKeys.title);
+ }
+
+ public void setTitle(String title) {
+ getStateHelper().put(PropertyKeys.title, title);
+ }
+
+ public String getStyle() {
+ return (String) getStateHelper().eval(PropertyKeys.style);
+ }
+
+ public void setStyle(String style) {
+ getStateHelper().put(PropertyKeys.style, style);
+ }
+
+ public String getStyleClass() {
+ return (String) getStateHelper().eval(PropertyKeys.styleClass);
+ }
+
+ public void setStyleClass(String styleClass) {
+ getStateHelper().put(PropertyKeys.styleClass, styleClass);
+ }
+
+ public String getDir() {
+ return (String) getStateHelper().eval(PropertyKeys.dir);
+ }
+
+ public void setDir(String dir) {
+ getStateHelper().put(PropertyKeys.dir, dir);
+ }
+
+ public String getOnclick() {
+ return (String) getStateHelper().eval(PropertyKeys.onclick);
+ }
+
+ public void setOnclick(String onclick) {
+ getStateHelper().put(PropertyKeys.onclick, onclick);
+ }
+
+ public String getOndblclick() {
+ return (String) getStateHelper().eval(PropertyKeys.ondblclick);
+ }
+
+ public void setOndblclick(String ondblclick) {
+ getStateHelper().put(PropertyKeys.ondblclick, ondblclick);
+ }
+
+ public String getOnmousedown() {
+ return (String) getStateHelper().eval(PropertyKeys.onmousedown);
+ }
+
+ public void setOnmousedown(String onmousedown) {
+ getStateHelper().put(PropertyKeys.onmousedown, onmousedown);
+ }
+
+ public String getOnmousemove() {
+ return (String) getStateHelper().eval(PropertyKeys.onmousemove);
+ }
+
+ public void setOnmousemove(String onmousemove) {
+ getStateHelper().put(PropertyKeys.onmousemove, onmousemove);
+ }
+
+ public String getOnmouseout() {
+ return (String) getStateHelper().eval(PropertyKeys.onmouseout);
+ }
+
+ public void setOnmouseout(String onmouseout) {
+ getStateHelper().put(PropertyKeys.onmouseout, onmouseout);
+ }
+
+ public String getOnmouseover() {
+ return (String) getStateHelper().eval(PropertyKeys.onmouseover);
+ }
+
+ public void setOnmouseover(String onmouseover) {
+ getStateHelper().put(PropertyKeys.onmouseover, onmouseover);
+ }
+
+ public String getOnmouseup() {
+ return (String) getStateHelper().eval(PropertyKeys.onmouseup);
+ }
+
+ public void setOnmouseup(String onmouseup) {
+ getStateHelper().put(PropertyKeys.onmouseup, onmouseup);
+ }
+
+
+
+ @Override
+ public Collection<String> getEventNames() {
+ return EVENT_NAMES;
+ }
+}
+
Added: branches/RF-7944/ui/output/ui/src/main/java/org/richfaces/component/html/HtmlTabPanel.java
===================================================================
--- branches/RF-7944/ui/output/ui/src/main/java/org/richfaces/component/html/HtmlTabPanel.java (rev 0)
+++ branches/RF-7944/ui/output/ui/src/main/java/org/richfaces/component/html/HtmlTabPanel.java 2010-09-03 14:08:46 UTC (rev 19113)
@@ -0,0 +1,265 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright ${year}, Red Hat, Inc. and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+
+package org.richfaces.component.html;
+
+import org.richfaces.HeaderPosition;
+import org.richfaces.HeaderAlignment;
+import org.richfaces.component.AbstractTabPanel;
+import javax.faces.component.behavior.ClientBehaviorHolder;
+
+import java.util.Arrays;
+import java.util.Collection;
+import java.util.Collections;
+
+/**
+ * @author akolonitsky
+ * @since 2010-08-27
+ */
+public class HtmlTabPanel extends AbstractTabPanel implements ClientBehaviorHolder {
+
+ public static final String COMPONENT_TYPE = "org.richfaces.TabPanel";
+
+ public static final String COMPONENT_FAMILY = "org.richfaces.TabPanel";
+
+ private static final Collection<String> EVENT_NAMES = Collections.unmodifiableCollection(Arrays.asList(
+ "itemchange",
+ "beforeitemchange",
+ "click",
+ "dblclick",
+ "mousedown",
+ "mousemove",
+ "mouseout",
+ "mouseover",
+ "mouseup"
+ ));
+
+
+ public enum PropertyKeys {
+ headerPosition,
+ headerAlignment,
+ tabHeaderClassActive,
+ tabHeaderClassDisabled,
+ tabHeaderClassInactive,
+ tabContentClass,
+ tabHeaderClass,
+ onitemchange,
+ onbeforeitemchange,
+ lang,
+ title,
+ style,
+ styleClass,
+ dir,
+ onclick,
+ ondblclick,
+ onmousedown,
+ onmousemove,
+ onmouseout,
+ onmouseover,
+ onmouseup
+ }
+
+ public HtmlTabPanel() {
+ setRendererType("org.richfaces.TabPanel");
+ }
+
+ @Override
+ public String getFamily() {
+ return COMPONENT_FAMILY;
+ }
+
+ public HeaderPosition getHeaderPosition() {
+ return (HeaderPosition) getStateHelper().eval(PropertyKeys.headerPosition);
+ }
+
+ public void setHeaderPosition(HeaderPosition headerPosition) {
+ getStateHelper().put(PropertyKeys.headerPosition, headerPosition);
+ }
+
+ public HeaderAlignment getHeaderAlignment() {
+ return (HeaderAlignment) getStateHelper().eval(PropertyKeys.headerAlignment);
+ }
+
+ public void setHeaderAlignment(HeaderAlignment headerAlignment) {
+ getStateHelper().put(PropertyKeys.headerAlignment, headerAlignment);
+ }
+
+ public String getTabHeaderClassActive() {
+ return (String) getStateHelper().eval(PropertyKeys.tabHeaderClassActive);
+ }
+
+ public void setTabHeaderClassActive(String tabHeaderClassActive) {
+ getStateHelper().put(PropertyKeys.tabHeaderClassActive, tabHeaderClassActive);
+ }
+
+ public String getTabHeaderClassDisabled() {
+ return (String) getStateHelper().eval(PropertyKeys.tabHeaderClassDisabled);
+ }
+
+ public void setTabHeaderClassDisabled(String tabHeaderClassDisabled) {
+ getStateHelper().put(PropertyKeys.tabHeaderClassDisabled, tabHeaderClassDisabled);
+ }
+
+ public String getTabHeaderClassInactive() {
+ return (String) getStateHelper().eval(PropertyKeys.tabHeaderClassInactive);
+ }
+
+ public void setTabHeaderClassInactive(String tabHeaderClassInactive) {
+ getStateHelper().put(PropertyKeys.tabHeaderClassInactive, tabHeaderClassInactive);
+ }
+
+ public String getTabContentClass() {
+ return (String) getStateHelper().eval(PropertyKeys.tabContentClass);
+ }
+
+ public void setTabContentClass(String tabContentClass) {
+ getStateHelper().put(PropertyKeys.tabContentClass, tabContentClass);
+ }
+
+ public String getTabHeaderClass() {
+ return (String) getStateHelper().eval(PropertyKeys.tabHeaderClass);
+ }
+
+ public void setTabHeaderClass(String tabHeaderClass) {
+ getStateHelper().put(PropertyKeys.tabHeaderClass, tabHeaderClass);
+ }
+
+ public String getOnitemchange() {
+ return (String) getStateHelper().eval(PropertyKeys.onitemchange);
+ }
+
+ public void setOnitemchange(String onitemchange) {
+ getStateHelper().put(PropertyKeys.onitemchange, onitemchange);
+ }
+
+ public String getOnbeforeitemchange() {
+ return (String) getStateHelper().eval(PropertyKeys.onbeforeitemchange);
+ }
+
+ public void setOnbeforeitemchange(String onbeforeitemchange) {
+ getStateHelper().put(PropertyKeys.onbeforeitemchange, onbeforeitemchange);
+ }
+
+ public String getLang() {
+ return (String) getStateHelper().eval(PropertyKeys.lang);
+ }
+
+ public void setLang(String lang) {
+ getStateHelper().put(PropertyKeys.lang, lang);
+ }
+
+ public String getTitle() {
+ return (String) getStateHelper().eval(PropertyKeys.title);
+ }
+
+ public void setTitle(String title) {
+ getStateHelper().put(PropertyKeys.title, title);
+ }
+
+ public String getStyle() {
+ return (String) getStateHelper().eval(PropertyKeys.style);
+ }
+
+ public void setStyle(String style) {
+ getStateHelper().put(PropertyKeys.style, style);
+ }
+
+ public String getStyleClass() {
+ return (String) getStateHelper().eval(PropertyKeys.styleClass);
+ }
+
+ public void setStyleClass(String styleClass) {
+ getStateHelper().put(PropertyKeys.styleClass, styleClass);
+ }
+
+ public String getDir() {
+ return (String) getStateHelper().eval(PropertyKeys.dir);
+ }
+
+ public void setDir(String dir) {
+ getStateHelper().put(PropertyKeys.dir, dir);
+ }
+
+ public String getOnclick() {
+ return (String) getStateHelper().eval(PropertyKeys.onclick);
+ }
+
+ public void setOnclick(String onclick) {
+ getStateHelper().put(PropertyKeys.onclick, onclick);
+ }
+
+ public String getOndblclick() {
+ return (String) getStateHelper().eval(PropertyKeys.ondblclick);
+ }
+
+ public void setOndblclick(String ondblclick) {
+ getStateHelper().put(PropertyKeys.ondblclick, ondblclick);
+ }
+
+ public String getOnmousedown() {
+ return (String) getStateHelper().eval(PropertyKeys.onmousedown);
+ }
+
+ public void setOnmousedown(String onmousedown) {
+ getStateHelper().put(PropertyKeys.onmousedown, onmousedown);
+ }
+
+ public String getOnmousemove() {
+ return (String) getStateHelper().eval(PropertyKeys.onmousemove);
+ }
+
+ public void setOnmousemove(String onmousemove) {
+ getStateHelper().put(PropertyKeys.onmousemove, onmousemove);
+ }
+
+ public String getOnmouseout() {
+ return (String) getStateHelper().eval(PropertyKeys.onmouseout);
+ }
+
+ public void setOnmouseout(String onmouseout) {
+ getStateHelper().put(PropertyKeys.onmouseout, onmouseout);
+ }
+
+ public String getOnmouseover() {
+ return (String) getStateHelper().eval(PropertyKeys.onmouseover);
+ }
+
+ public void setOnmouseover(String onmouseover) {
+ getStateHelper().put(PropertyKeys.onmouseover, onmouseover);
+ }
+
+ public String getOnmouseup() {
+ return (String) getStateHelper().eval(PropertyKeys.onmouseup);
+ }
+
+ public void setOnmouseup(String onmouseup) {
+ getStateHelper().put(PropertyKeys.onmouseup, onmouseup);
+ }
+
+
+
+ @Override
+ public Collection<String> getEventNames() {
+ return EVENT_NAMES;
+ }
+}
+
Added: branches/RF-7944/ui/output/ui/src/main/java/org/richfaces/renderkit/html/TabPanelRenderer.java
===================================================================
--- branches/RF-7944/ui/output/ui/src/main/java/org/richfaces/renderkit/html/TabPanelRenderer.java (rev 0)
+++ branches/RF-7944/ui/output/ui/src/main/java/org/richfaces/renderkit/html/TabPanelRenderer.java 2010-09-03 14:08:46 UTC (rev 19113)
@@ -0,0 +1,61 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright ${year}, Red Hat, Inc. and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+
+package org.richfaces.renderkit.html;
+
+import org.richfaces.component.AbstractTabPanel;
+
+import javax.faces.application.ResourceDependencies;
+import javax.faces.application.ResourceDependency;
+import javax.faces.component.UIComponent;
+import javax.faces.context.FacesContext;
+import javax.faces.context.ResponseWriter;
+import java.io.IOException;
+
+/**
+ * @author akolonitsky
+ * @since 2010-08-24
+ */
+@ResourceDependencies( { // TODO review
+ @ResourceDependency(library = "javax.faces", name = "jsf.js"),
+ @ResourceDependency(name = "jquery.js"),
+ @ResourceDependency(name = "richfaces.js"),
+ @ResourceDependency(name = "richfaces-base-component.js"),
+ @ResourceDependency(name = "script/TabPanel.js") })
+public class TabPanelRenderer extends TogglePanelRenderer {
+
+ @Override
+ protected void doEncodeBegin(ResponseWriter writer, FacesContext context, UIComponent component) throws IOException {
+ super.doEncodeBegin(writer, context, component);
+ }
+
+ @Override
+ protected void doEncodeEnd(ResponseWriter writer, FacesContext context, UIComponent component) throws IOException {
+ super.doEncodeEnd(writer, context, component);
+ }
+
+ @Override
+ protected Class<? extends UIComponent> getComponentClass() {
+ return AbstractTabPanel.class;
+ }
+}
+
Added: branches/RF-7944/ui/output/ui/src/main/java/org/richfaces/renderkit/html/TabRenderer.java
===================================================================
--- branches/RF-7944/ui/output/ui/src/main/java/org/richfaces/renderkit/html/TabRenderer.java (rev 0)
+++ branches/RF-7944/ui/output/ui/src/main/java/org/richfaces/renderkit/html/TabRenderer.java 2010-09-03 14:08:46 UTC (rev 19113)
@@ -0,0 +1,61 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright ${year}, Red Hat, Inc. and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+
+package org.richfaces.renderkit.html;
+
+import org.richfaces.component.AbstractTogglePanelTitledItem;
+
+import javax.faces.application.ResourceDependencies;
+import javax.faces.application.ResourceDependency;
+import javax.faces.component.UIComponent;
+import javax.faces.context.FacesContext;
+import javax.faces.context.ResponseWriter;
+import java.io.IOException;
+
+/**
+ * @author akolonitsky
+ * @since 2010-08-24
+ */
+@ResourceDependencies( { // TODO review
+ @ResourceDependency(library = "javax.faces", name = "jsf.js"),
+ @ResourceDependency(name = "jquery.js"),
+ @ResourceDependency(name = "richfaces.js"),
+ @ResourceDependency(name = "richfaces-base-component.js"),
+ @ResourceDependency(name = "script/Tab.js") })
+public class TabRenderer extends TogglePanelItemRenderer {
+
+ @Override
+ protected void doEncodeBegin(ResponseWriter writer, FacesContext context, UIComponent component) throws IOException {
+ super.doEncodeBegin(writer, context, component);
+ }
+
+ @Override
+ protected void doEncodeEnd(ResponseWriter writer, FacesContext context, UIComponent component) throws IOException {
+ super.doEncodeEnd(writer, context, component);
+ }
+
+ @Override
+ protected Class<? extends UIComponent> getComponentClass() {
+ return AbstractTogglePanelTitledItem.class;
+ }
+}
+
Added: branches/RF-7944/ui/output/ui/src/test/java/org/richfaces/component/UICollapsiblePanelTest.java
===================================================================
--- branches/RF-7944/ui/output/ui/src/test/java/org/richfaces/component/UICollapsiblePanelTest.java (rev 0)
+++ branches/RF-7944/ui/output/ui/src/test/java/org/richfaces/component/UICollapsiblePanelTest.java 2010-09-03 14:08:46 UTC (rev 19113)
@@ -0,0 +1,50 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright ${year}, Red Hat, Inc. and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+
+package org.richfaces.component;
+
+import org.junit.Assert;
+import org.junit.Before;
+import org.junit.Test;
+
+import javax.faces.component.UIComponent;
+import java.util.List;
+
+/**
+ * @author akolonitsky
+ * @since 2010-08-27
+ */
+public class UICollapsiblePanelTest {
+
+ private UICollapsiblePanel collapsiblePanel;
+
+ @Before
+ public void setUp () {
+ collapsiblePanel = new UICollapsiblePanel();
+ }
+
+ @Test
+ public void testSomething() {
+ Assert.assertNotNull(collapsiblePanel);
+ }
+}
+
Added: branches/RF-7944/ui/output/ui/src/test/java/org/richfaces/component/UITogglePanelTitledItemTest.java
===================================================================
--- branches/RF-7944/ui/output/ui/src/test/java/org/richfaces/component/UITogglePanelTitledItemTest.java (rev 0)
+++ branches/RF-7944/ui/output/ui/src/test/java/org/richfaces/component/UITogglePanelTitledItemTest.java 2010-09-03 14:08:46 UTC (rev 19113)
@@ -0,0 +1,50 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright ${year}, Red Hat, Inc. and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+
+package org.richfaces.component;
+
+import org.junit.Assert;
+import org.junit.Before;
+import org.junit.Test;
+
+import javax.faces.component.UIComponent;
+import java.util.List;
+
+/**
+ * @author akolonitsky
+ * @since 2010-08-24
+ */
+public class UITogglePanelTitledItemTest {
+
+ private UITogglePanelTitledItem togglePanelTitledItem;
+
+ @Before
+ public void setUp () {
+ togglePanelTitledItem = new UITogglePanelTitledItem();
+ }
+
+ @Test
+ public void testSomething() {
+ Assert.assertNotNull(togglePanelTitledItem);
+ }
+}
+
14 years, 3 months
JBoss Rich Faces SVN: r19112 - branches.
by richfaces-svn-commits@lists.jboss.org
Author: Alex.Kolonitsky
Date: 2010-09-03 09:52:08 -0400 (Fri, 03 Sep 2010)
New Revision: 19112
Added:
branches/RF-9309/
Log:
Move panels to CDK
Copied: branches/RF-9309 (from rev 19111, trunk)
14 years, 3 months
JBoss Rich Faces SVN: r19111 - in modules/tests/metamer/trunk/ftest-source/src/main: java/org/jboss/cheiron and 6 other directories.
by richfaces-svn-commits@lists.jboss.org
Author: lfryc(a)redhat.com
Date: 2010-09-03 09:10:20 -0400 (Fri, 03 Sep 2010)
New Revision: 19111
Added:
modules/tests/metamer/trunk/ftest-source/src/main/java/org/jboss/cheiron/
modules/tests/metamer/trunk/ftest-source/src/main/java/org/jboss/cheiron/halt/
modules/tests/metamer/trunk/ftest-source/src/main/java/org/jboss/cheiron/halt/AbstractPageExtensions.java
modules/tests/metamer/trunk/ftest-source/src/main/java/org/jboss/cheiron/halt/SendHalt.java
modules/tests/metamer/trunk/ftest-source/src/main/resources/javascript/
modules/tests/metamer/trunk/ftest-source/src/main/resources/javascript/cheiron/
modules/tests/metamer/trunk/ftest-source/src/main/resources/javascript/cheiron/SendHalt.js
Removed:
modules/tests/metamer/trunk/ftest-source/src/main/resources/org/richfaces/tests/metamer/ftest/a4jStatus/status-halt.js
Modified:
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/a4jStatus/AbstracStatusTest.java
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/a4jStatus/TestFacets.java
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/a4jStatus/TestInstantAttributes.java
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/a4jStatus/TestReferencedUsage.java
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/a4jStatus/TestSimple.java
Log:
refactored a4j:status tests to expose SendHalt interface (will be used in queue tests)
Added: modules/tests/metamer/trunk/ftest-source/src/main/java/org/jboss/cheiron/halt/AbstractPageExtensions.java
===================================================================
--- modules/tests/metamer/trunk/ftest-source/src/main/java/org/jboss/cheiron/halt/AbstractPageExtensions.java (rev 0)
+++ modules/tests/metamer/trunk/ftest-source/src/main/java/org/jboss/cheiron/halt/AbstractPageExtensions.java 2010-09-03 13:10:20 UTC (rev 19111)
@@ -0,0 +1,105 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc. and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.cheiron.halt;
+
+import java.util.List;
+
+import org.jboss.test.selenium.encapsulated.JavaScript;
+import org.jboss.test.selenium.framework.AjaxSelenium;
+import org.jboss.test.selenium.framework.AjaxSeleniumProxy;
+import org.jboss.test.selenium.waiting.Wait;
+
+import static org.jboss.test.selenium.encapsulated.JavaScript.*;
+
+/**
+ * Defines methods for installing JavaScript page extension to the target page.
+ *
+ * @author <a href="mailto:lfryc@redhat.com">Lukas Fryc</a>
+ * @version $Revision$
+ */
+public abstract class AbstractPageExtensions {
+
+ /** The JavaScript for extending of the page. */
+ JavaScript pageExtensions;
+
+ /** Evaluates if the body is loaded */
+ final JavaScript isBodyLoaded = js("(selenium.browserbot.getCurrentWindow() != null) "
+ + " && (selenium.browserbot.getCurrentWindow().document != null) "
+ + " && (selenium.browserbot.getCurrentWindow().document.body != null)");
+
+ /** The associated selenium object. */
+ AjaxSelenium selenium = AjaxSeleniumProxy.getInstance();
+
+ public abstract JavaScript isExtensionInstalledScript();
+
+ /**
+ * Install.
+ */
+ public void install() {
+ if (!isInstalled()) {
+ waitForBodyLoaded();
+ installPageExtension();
+ }
+ }
+
+ /**
+ * Checks if RichFacesSelenium is already installed
+ *
+ * @return true, if is installed
+ */
+ public boolean isInstalled() {
+ return Boolean.valueOf(selenium.getEval(isExtensionInstalledScript()));
+ }
+
+ /**
+ * Install the page extensions
+ */
+ void installPageExtension() {
+ selenium.runScript(pageExtensions);
+ }
+
+ /**
+ * Wait for body to be loaded.
+ */
+ void waitForBodyLoaded() {
+ selenium.waitForCondition(isBodyLoaded, Wait.DEFAULT_TIMEOUT);
+ }
+
+ public void loadFromResource(String resourceName) {
+ this.pageExtensions = fromResource(resourceName);
+ }
+
+ /**
+ * Loads the page JS extensions from resources defined by list of resource names.
+ *
+ * @param resourceNames
+ * the list of full paths to resources
+ */
+ public void loadFromResources(List<String> resourceNames) {
+ JavaScript extensions = null;
+ for (String resourceName : resourceNames) {
+ JavaScript partial = fromResource(resourceName);
+ extensions = (extensions == null) ? partial : extensions.join(partial);
+ }
+ this.pageExtensions = extensions;
+ }
+}
Added: modules/tests/metamer/trunk/ftest-source/src/main/java/org/jboss/cheiron/halt/SendHalt.java
===================================================================
--- modules/tests/metamer/trunk/ftest-source/src/main/java/org/jboss/cheiron/halt/SendHalt.java (rev 0)
+++ modules/tests/metamer/trunk/ftest-source/src/main/java/org/jboss/cheiron/halt/SendHalt.java 2010-09-03 13:10:20 UTC (rev 19111)
@@ -0,0 +1,78 @@
+/*******************************************************************************
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc. and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ *******************************************************************************/
+package org.jboss.cheiron.halt;
+
+import static org.jboss.test.selenium.encapsulated.JavaScript.js;
+
+import org.jboss.test.selenium.encapsulated.JavaScript;
+import org.jboss.test.selenium.framework.AjaxSelenium;
+import org.jboss.test.selenium.framework.AjaxSeleniumProxy;
+
+/**
+ * @author <a href="mailto:lfryc@redhat.com">Lukas Fryc</a>
+ * @version $Revision$
+ */
+public class SendHalt {
+
+ private static JavaScript isHaltAvailable = js("selenium.browserbot.getCurrentWindow().SendHalt.isHaltAvailable()");
+ private static JavaScript getHalt = js("selenium.browserbot.getCurrentWindow().SendHalt.getHalt()");
+ private static JavaScript unhalt = js("selenium.browserbot.getCurrentWindow().SendHalt.unhalt({0})");
+ private static JavaScript setEnabled = js("selenium.browserbot.getCurrentWindow().SendHalt.setEnabled({0})");
+
+ private static final AbstractPageExtensions sendHaltExtensions = new AbstractPageExtensions() {
+ {
+ loadFromResource("javascript/cheiron/SendHalt.js");
+ }
+
+ public JavaScript isExtensionInstalledScript() {
+ return js("selenium.browserbot.getCurrentWindow().SendHalt != undefined");
+ }
+ };
+
+ int handle;
+
+ private SendHalt(int handle) {
+ this.handle = handle;
+ }
+
+ static AjaxSelenium selenium = AjaxSeleniumProxy.getInstance();
+
+ public static void enable() {
+ selenium.getPageExtensions().install();
+ sendHaltExtensions.install();
+ selenium.getEval(setEnabled.parametrize(true));
+ }
+
+ public static void disable() {
+ selenium.getEval(setEnabled.parametrize(false));
+ }
+
+ public static SendHalt getHalt() {
+ selenium.waitForCondition(isHaltAvailable);
+ return new SendHalt(Integer.valueOf(selenium.getEval(getHalt)));
+ }
+
+ public void unhalt() {
+ selenium.getEval(unhalt.parametrize(handle));
+ }
+
+}
Modified: modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/a4jStatus/AbstracStatusTest.java
===================================================================
--- modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/a4jStatus/AbstracStatusTest.java 2010-09-03 12:51:59 UTC (rev 19110)
+++ modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/a4jStatus/AbstracStatusTest.java 2010-09-03 13:10:20 UTC (rev 19111)
@@ -21,10 +21,9 @@
*******************************************************************************/
package org.richfaces.tests.metamer.ftest.a4jStatus;
-import static org.jboss.test.selenium.encapsulated.JavaScript.js;
import static org.testng.Assert.assertEquals;
-import org.jboss.test.selenium.encapsulated.JavaScript;
+import org.jboss.cheiron.halt.SendHalt;
import org.jboss.test.selenium.locator.ElementLocator;
import org.jboss.test.selenium.locator.JQueryLocator;
import org.jboss.test.selenium.waiting.retrievers.TextRetriever;
@@ -44,38 +43,14 @@
TextRetriever retrieveStatus = retrieveText.locator(status);
- JavaScript extension = JavaScript.fromResource(getClass().getPackage().getName().replaceAll("\\.", "/")
- + "/status-halt.js");
-
- void installStatusExtensions() {
- selenium.getPageExtensions().install();
- selenium.runScript(extension);
- }
-
void testRequestButton(ElementLocator<?> button, String startStatusText, String stopStatusText) {
- enableHalt();
+ SendHalt.enable();
selenium.click(button);
- waitForHalt();
+ SendHalt halt = SendHalt.getHalt();
assertEquals(retrieveStatus.retrieve(), startStatusText);
- unhalt();
+ halt.unhalt();
waitAjax.waitForChange(startStatusText, retrieveStatus);
assertEquals(retrieveStatus.retrieve(), stopStatusText);
- disableHalt();
+ SendHalt.disable();
}
-
- void waitForHalt() {
- selenium.waitForCondition(js("selenium.browserbot.getCurrentWindow().Metamer.waitForHalt()"));
- }
-
- void unhalt() {
- selenium.getEval(js("selenium.browserbot.getCurrentWindow().Metamer.unhalt()"));
- }
-
- void enableHalt() {
- selenium.getEval(js("selenium.browserbot.getCurrentWindow().Metamer.haltEnabled = true"));
- }
-
- void disableHalt() {
- selenium.getEval(js("selenium.browserbot.getCurrentWindow().Metamer.haltEnabled = false"));
- }
}
Modified: modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/a4jStatus/TestFacets.java
===================================================================
--- modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/a4jStatus/TestFacets.java 2010-09-03 12:51:59 UTC (rev 19110)
+++ modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/a4jStatus/TestFacets.java 2010-09-03 13:10:20 UTC (rev 19111)
@@ -26,7 +26,6 @@
import java.net.URL;
import org.jboss.test.selenium.locator.ElementLocator;
-import org.testng.annotations.BeforeMethod;
import org.testng.annotations.Test;
/**
@@ -41,11 +40,6 @@
return buildUrl(contextPath, "faces/components/a4jStatus/simple.xhtml");
}
- @BeforeMethod
- public void installStatusExtensions() {
- super.installStatusExtensions();
- }
-
@Test
public void testInterleavedChangingOfFacets() {
for (int i = 0; i < 13; i++) {
Modified: modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/a4jStatus/TestInstantAttributes.java
===================================================================
--- modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/a4jStatus/TestInstantAttributes.java 2010-09-03 12:51:59 UTC (rev 19110)
+++ modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/a4jStatus/TestInstantAttributes.java 2010-09-03 13:10:20 UTC (rev 19111)
@@ -28,10 +28,10 @@
import java.net.URL;
+import org.jboss.cheiron.halt.SendHalt;
import org.jboss.test.selenium.encapsulated.JavaScript;
import org.jboss.test.selenium.locator.ElementLocator;
import org.richfaces.tests.metamer.ftest.annotations.IssueTracking;
-import org.testng.annotations.BeforeMethod;
import org.testng.annotations.Test;
/**
@@ -54,23 +54,17 @@
return buildUrl(contextPath, "faces/components/a4jStatus/instantAttributes.xhtml");
}
- @BeforeMethod
- public void installStatusExtensions() {
- super.installStatusExtensions();
- }
-
@Test
public void testOnStart() {
for (int i = 0; i < 2; i++) {
attributes.setOnStart(alert.parametrize("start" + 1));
- enableHalt();
+ SendHalt.enable();
selenium.click(button1);
selenium.waitForCondition(js("selenium.isAlertPresent()"));
assertEquals(selenium.getAlert(), "start" + 1);
- waitForHalt();
- unhalt();
- disableHalt();
+ SendHalt.getHalt().unhalt();
+ SendHalt.disable();
}
}
Modified: modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/a4jStatus/TestReferencedUsage.java
===================================================================
--- modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/a4jStatus/TestReferencedUsage.java 2010-09-03 12:51:59 UTC (rev 19110)
+++ modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/a4jStatus/TestReferencedUsage.java 2010-09-03 13:10:20 UTC (rev 19111)
@@ -26,9 +26,9 @@
import java.net.URL;
+import org.jboss.cheiron.halt.SendHalt;
import org.jboss.test.selenium.locator.JQueryLocator;
import org.jboss.test.selenium.waiting.retrievers.TextRetriever;
-import org.testng.annotations.BeforeMethod;
import org.testng.annotations.Test;
/**
@@ -48,90 +48,84 @@
return buildUrl(contextPath, "faces/components/a4jStatus/referencedUsage.xhtml");
}
- @BeforeMethod
- public void installStatusExtensions() {
- super.installStatusExtensions();
- }
-
@Test
public void testClickBothButtonsInSequence() {
- enableHalt();
+ SendHalt.enable();
selenium.click(button1);
- waitForHalt();
+ SendHalt halt = SendHalt.getHalt();
assertEquals(retrieveStatus1.retrieve(), "START");
assertEquals(retrieveStatus2.retrieve(), "STOP");
- unhalt();
+ halt.unhalt();
waitAjax.waitForChange("START", retrieveStatus1);
selenium.click(button2);
- waitForHalt();
+ halt = SendHalt.getHalt();
assertEquals(retrieveStatus1.retrieve(), "STOP");
assertEquals(retrieveStatus2.retrieve(), "START");
- unhalt();
+ halt.unhalt();
waitAjax.waitForChange("START", retrieveStatus2);
assertEquals(retrieveStatus1.retrieve(), "STOP");
assertEquals(retrieveStatus2.retrieve(), "STOP");
- disableHalt();
+ SendHalt.disable();
}
@Test
public void testClickBothButtonsImmediately() {
- enableHalt();
+ SendHalt.enable();
selenium.click(button1);
selenium.click(button2);
- waitForHalt();
+ SendHalt halt = SendHalt.getHalt();
assertEquals(retrieveStatus1.retrieve(), "START");
assertEquals(retrieveStatus2.retrieve(), "STOP");
- unhalt();
- waitForHalt();
+ halt.unhalt();
+ halt = SendHalt.getHalt();
assertEquals(retrieveStatus1.retrieve(), "STOP");
assertEquals(retrieveStatus2.retrieve(), "START");
- unhalt();
+ halt.unhalt();
waitAjax.waitForChange("START", retrieveStatus2);
assertEquals(retrieveStatus1.retrieve(), "STOP");
assertEquals(retrieveStatus2.retrieve(), "STOP");
- disableHalt();
+ SendHalt.disable();
}
/**
- * @Test
- * TODO: selenium is causing 3 requests, but manually we triggers 2 requests (use Firebug to reproduce)
+ * @Test TODO: selenium is causing 3 requests, but manually we triggers 2 requests (use Firebug to reproduce)
*/
public void testClickFirstButtonThenSecondButtonThenAgainFirstButtonImmediately() {
- enableHalt();
+ SendHalt.enable();
selenium.click(button1);
selenium.click(button2);
selenium.click(button1);
- waitForHalt();
+ SendHalt halt = SendHalt.getHalt();
assertEquals(retrieveStatus1.retrieve(), "START");
assertEquals(retrieveStatus2.retrieve(), "STOP");
- unhalt();
- waitForHalt();
+ halt.unhalt();
+ halt = SendHalt.getHalt();
assertEquals(retrieveStatus1.retrieve(), "START");
assertEquals(retrieveStatus2.retrieve(), "STOP");
- unhalt();
+ halt.unhalt();
waitAjax.waitForChange("START", retrieveStatus1);
assertEquals(retrieveStatus1.retrieve(), "STOP");
assertEquals(retrieveStatus2.retrieve(), "STOP");
- disableHalt();
+ SendHalt.disable();
}
@Test
public void testDoubleClick() {
- enableHalt();
+ SendHalt.enable();
selenium.click(button1);
- waitForHalt();
+ SendHalt halt = SendHalt.getHalt();
assertEquals(retrieveStatus1.retrieve(), "START");
assertEquals(retrieveStatus2.retrieve(), "STOP");
- unhalt();
+ halt.unhalt();
selenium.click(button1);
- waitForHalt();
+ halt = SendHalt.getHalt();
assertEquals(retrieveStatus1.retrieve(), "START");
assertEquals(retrieveStatus2.retrieve(), "STOP");
- unhalt();
+ halt.unhalt();
waitAjax.waitForChange("START", retrieveStatus1);
assertEquals(retrieveStatus1.retrieve(), "STOP");
assertEquals(retrieveStatus2.retrieve(), "STOP");
- disableHalt();
+ SendHalt.disable();
}
}
Modified: modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/a4jStatus/TestSimple.java
===================================================================
--- modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/a4jStatus/TestSimple.java 2010-09-03 12:51:59 UTC (rev 19110)
+++ modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/a4jStatus/TestSimple.java 2010-09-03 13:10:20 UTC (rev 19111)
@@ -25,7 +25,6 @@
import java.net.URL;
-import org.testng.annotations.BeforeMethod;
import org.testng.annotations.Test;
/**
@@ -38,11 +37,6 @@
return buildUrl(contextPath, "faces/components/a4jStatus/simple.xhtml");
}
- @BeforeMethod
- public void installStatusExtensions() {
- super.installStatusExtensions();
- }
-
@Test
public void testRequestButton1() {
testRequestButton(button1, "START", "STOP");
Copied: modules/tests/metamer/trunk/ftest-source/src/main/resources/javascript/cheiron/SendHalt.js (from rev 19087, modules/tests/metamer/trunk/ftest-source/src/main/resources/org/richfaces/tests/metamer/ftest/a4jStatus/status-halt.js)
===================================================================
--- modules/tests/metamer/trunk/ftest-source/src/main/resources/javascript/cheiron/SendHalt.js (rev 0)
+++ modules/tests/metamer/trunk/ftest-source/src/main/resources/javascript/cheiron/SendHalt.js 2010-09-03 13:10:20 UTC (rev 19111)
@@ -0,0 +1,90 @@
+/*
+ * 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.
+ */
+var SendHalt = function(xhr, content, callback) {
+ SendHalt._instances.push(this);
+ this.halt = true;
+ this.xhr = xhr;
+ this.content = content;
+ this.callback = callback;
+ this.id = SendHalt._instances.length - 1;
+}
+
+SendHalt._instances = new Array();
+SendHalt._haltCounter = 0;
+SendHalt._enabled = false;
+
+SendHalt.setEnabled = function(enabled) {
+ SendHalt._enabled = enabled;
+}
+
+SendHalt.isEnabled = function(enabled) {
+ return SendHalt._enabled;
+}
+
+SendHalt.getLastId = function() {
+ return SendHalt._instances.length - 1;
+}
+
+SendHalt.getHalt = function() {
+ if (SendHalt.isHaltAvailable()) {
+ SendHalt._haltCounter += 1;
+ return SendHalt.getLastId();
+ }
+ return -1;
+}
+
+SendHalt.XHRWrapperInjection = {
+ send : RichFacesSelenium.XHRWrapper.prototype.send
+}
+
+SendHalt._repeatWait = function(id) {
+ var halt = SendHalt._instances[id];
+ if (halt.halt) {
+ setTimeout("SendHalt._repeatWait(" + id + ")", 100);
+ } else {
+ halt.callback(halt.xhr, halt.content);
+ }
+}
+
+SendHalt.prototype.wait = function() {
+ SendHalt._repeatWait(this.id);
+}
+
+SendHalt.unhalt = function(id) {
+ var halt = SendHalt._instances[id];
+ halt.halt = false;
+}
+
+SendHalt.isHaltAvailable = function() {
+ return SendHalt.getLastId() == SendHalt._haltCounter;
+}
+
+RichFacesSelenium.XHRWrapper.prototype.send = function(content) {
+ if (SendHalt.isEnabled()) {
+ var metamerHalt = new SendHalt(this, content, function(xhr, content1) {
+ SendHalt.XHRWrapperInjection.send.call(xhr, content1);
+ });
+ metamerHalt.wait();
+ } else {
+ SendHalt.XHRWrapperInjection.send.call(this, content);
+ }
+};
\ No newline at end of file
Deleted: modules/tests/metamer/trunk/ftest-source/src/main/resources/org/richfaces/tests/metamer/ftest/a4jStatus/status-halt.js
===================================================================
--- modules/tests/metamer/trunk/ftest-source/src/main/resources/org/richfaces/tests/metamer/ftest/a4jStatus/status-halt.js 2010-09-03 12:51:59 UTC (rev 19110)
+++ modules/tests/metamer/trunk/ftest-source/src/main/resources/org/richfaces/tests/metamer/ftest/a4jStatus/status-halt.js 2010-09-03 13:10:20 UTC (rev 19111)
@@ -1,74 +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.
- */
-var Metamer = {
- halts : new Array(),
- sequenceId : 0,
- haltIterator : 0,
- haltEnabled : false,
- passes : 0,
- wait : function(metamerHalt) {
- Metamer.halts.push(metamerHalt);
- Metamer._wait(metamerHalt.id);
- },
- _wait : function(id) {
- var metamerHalt = Metamer.halts[id];
- if (metamerHalt.halt) {
- setTimeout("Metamer._wait(" + id + ")", 100);
- } else {
- metamerHalt.callback(metamerHalt.xhr, metamerHalt.content);
- }
- },
- unhalt : function() {
- var metamerHalt = Metamer.halts[Metamer.haltIterator];
- Metamer.haltIterator += 1;
- metamerHalt.halt = false;
- },
- isHalted : function() {
- return Metamer.sequenceId > Metamer.haltIterator;
- },
- waitForHalt : function() {
- return Metamer.sequenceId == 1 + Metamer.haltIterator;
- }
-};
-
-var MetamerHalt = function(xhr, content, callback) {
- this.halt = true;
- this.xhr = xhr;
- this.content = content;
- this.callback = callback;
- this.id = Metamer.sequenceId++;
-}
-
-Metamer.XHRWrapperInjection = {
- send : RichFacesSelenium.XHRWrapper.prototype.send
-};
-
-RichFacesSelenium.XHRWrapper.prototype.send = function(content) {
- if (Metamer.haltEnabled) {
- var metamerHalt = new MetamerHalt(this, content, function(xhr, content1) {
- Metamer.XHRWrapperInjection.send.call(xhr, content1);
- });
- Metamer.wait(metamerHalt);
- } else {
- Metamer.XHRWrapperInjection.send.call(this, content);
- }
-};
\ No newline at end of file
14 years, 3 months
JBoss Rich Faces SVN: r19110 - in branches/RF-7944: examples/core-demo/src/main/java/org/richfaces/demo and 54 other directories.
by richfaces-svn-commits@lists.jboss.org
Author: Alex.Kolonitsky
Date: 2010-09-03 08:51:59 -0400 (Fri, 03 Sep 2010)
New Revision: 19110
Added:
branches/RF-7944/examples/output-demo/src/main/webapp/examples/collapsiblePanel.xhtml
branches/RF-7944/examples/output-demo/src/main/webapp/qunit/collapsiblePanel.xhtml
branches/RF-7944/examples/output-demo/src/main/webapp/resources/tests/richfaces-collapsible-panel-qunit.js
branches/RF-7944/ui/common/ui/src/main/java/org/richfaces/event/
branches/RF-7944/ui/common/ui/src/main/java/org/richfaces/event/MethodExpressionEventListener.java
branches/RF-7944/ui/common/ui/src/main/java/org/richfaces/view/
branches/RF-7944/ui/common/ui/src/main/java/org/richfaces/view/facelets/
branches/RF-7944/ui/common/ui/src/main/java/org/richfaces/view/facelets/html/
branches/RF-7944/ui/common/ui/src/main/java/org/richfaces/view/facelets/html/EventListenerHandler.java
branches/RF-7944/ui/common/ui/src/main/java/org/richfaces/view/facelets/html/TagHandlerUtils.java
branches/RF-7944/ui/input/ui/src/test/resources/org/richfaces/renderkit/inplaceInputTest.xhtml
branches/RF-7944/ui/iteration/ui/src/main/templates/buttons.template.include
branches/RF-7944/ui/iteration/ui/src/test/java/org/richfaces/component/UIDataTableTest.java
branches/RF-7944/ui/iteration/ui/src/test/java/org/richfaces/renderkit/DataScrollerBean.java
branches/RF-7944/ui/iteration/ui/src/test/java/org/richfaces/renderkit/DataScrollerRenderTest.java
branches/RF-7944/ui/iteration/ui/src/test/resources/org/richfaces/renderkit/dataTableTest.xhtml
branches/RF-7944/ui/output/api/src/main/java/org/richfaces/event/ChangeExpandEvent.java
branches/RF-7944/ui/output/api/src/main/java/org/richfaces/event/ChangeExpandListener.java
branches/RF-7944/ui/output/api/src/main/java/org/richfaces/event/ChangeExpandSource.java
branches/RF-7944/ui/output/ui/src/main/java/org/richfaces/component/AbstractCollapsiblePanel.java
branches/RF-7944/ui/output/ui/src/main/java/org/richfaces/component/UICollapsiblePanel.java
branches/RF-7944/ui/output/ui/src/main/java/org/richfaces/component/html/HtmlCollapsiblePanel.java
branches/RF-7944/ui/output/ui/src/main/java/org/richfaces/event/MethodExpressionChangeExpandListener.java
branches/RF-7944/ui/output/ui/src/main/java/org/richfaces/renderkit/html/CollapsiblePanelRenderer.java
branches/RF-7944/ui/output/ui/src/main/java/org/richfaces/view/facelets/html/ChangeExpandListenerHandler.java
branches/RF-7944/ui/output/ui/src/main/java/org/richfaces/view/facelets/html/CollapsiblePanelTagHandler.java
branches/RF-7944/ui/output/ui/src/main/resources/META-INF/resources/org.richfaces/CollapsiblePanel.js
branches/RF-7944/ui/output/ui/src/main/resources/META-INF/resources/org.richfaces/CollapsiblePanelItem.js
branches/RF-7944/ui/output/ui/src/main/resources/META-INF/resources/org.richfaces/collapsiblePanel.ecss
branches/RF-7944/ui/output/ui/src/test/java/org/richfaces/component/UITogglePanelItemTest.java
Removed:
branches/RF-7944/examples/core-demo/src/main/resources/log4j.xml
branches/RF-7944/examples/richfaces-showcase/src/main/resources/log4j.properties
branches/RF-7944/examples/richfaces-showcase/src/main/resources/log4j.xml
branches/RF-7944/ui/common/ui/src/main/java/org/richfaces/event/MethodExpressionEventListener.java
branches/RF-7944/ui/common/ui/src/main/java/org/richfaces/view/facelets/
branches/RF-7944/ui/common/ui/src/main/java/org/richfaces/view/facelets/html/
branches/RF-7944/ui/common/ui/src/main/java/org/richfaces/view/facelets/html/EventListenerHandler.java
branches/RF-7944/ui/common/ui/src/main/java/org/richfaces/view/facelets/html/TagHandlerUtils.java
branches/RF-7944/ui/core/ui/src/main/java/org/richfaces/view/facelets/html/TagHandlerUtils.java
branches/RF-7944/ui/input/ui/src/main/java/org/richfaces/renderkit/AutocompleteGridLayoutStrategy.java
branches/RF-7944/ui/input/ui/src/test/resources/org/richfaces/renderkit/rendererTest.xhtml
Modified:
branches/RF-7944/examples/core-demo/pom.xml
branches/RF-7944/examples/core-demo/src/main/java/org/richfaces/demo/PhaseTracker.java
branches/RF-7944/examples/core-demo/src/main/webapp/ajax.xhtml
branches/RF-7944/examples/core-demo/src/main/webapp/button.xhtml
branches/RF-7944/examples/input-demo/pom.xml
branches/RF-7944/examples/input-demo/src/main/java/org/richfaces/demo/AutoCompleteBean.java
branches/RF-7944/examples/input-demo/src/main/webapp/autocomplete.xhtml
branches/RF-7944/examples/iteration-demo/pom.xml
branches/RF-7944/examples/misc-demo/pom.xml
branches/RF-7944/examples/output-demo/pom.xml
branches/RF-7944/examples/output-demo/src/main/java/org/richfaces/TogglePanelBean.java
branches/RF-7944/examples/output-demo/src/main/webapp/WEB-INF/faces-config.xml
branches/RF-7944/examples/output-demo/src/main/webapp/qunit/accordionHeaders.xhtml
branches/RF-7944/examples/output-demo/src/main/webapp/resources/tests/richfaces-accordion-headers-qunit.js
branches/RF-7944/examples/output-demo/src/main/webapp/templates/template.xhtml
branches/RF-7944/examples/repeater-demo/pom.xml
branches/RF-7944/examples/richfaces-showcase/pom.xml
branches/RF-7944/examples/richfaces-showcase/src/main/webapp/richfaces/accordion/samples/simple-sample.xhtml
branches/RF-7944/examples/richfaces-showcase/src/main/webapp/richfaces/togglePanel/samples/simple-sample.xhtml
branches/RF-7944/ui/core/ui/src/main/java/org/richfaces/component/QueueRegistry.java
branches/RF-7944/ui/core/ui/src/main/java/org/richfaces/renderkit/AjaxCommandRendererBase.java
branches/RF-7944/ui/core/ui/src/main/java/org/richfaces/renderkit/html/QueueRendererBase.java
branches/RF-7944/ui/core/ui/src/main/java/org/richfaces/view/facelets/html/BehaviorsTagHandlerDelegateFactoryImpl.java
branches/RF-7944/ui/core/ui/src/main/java/org/richfaces/view/facelets/tag/BehaviorRule.java
branches/RF-7944/ui/input/ui/src/main/java/org/richfaces/component/AbstractAutocomplete.java
branches/RF-7944/ui/input/ui/src/main/java/org/richfaces/renderkit/AutocompleteDivLayoutStrategy.java
branches/RF-7944/ui/input/ui/src/main/java/org/richfaces/renderkit/AutocompleteEncodeStrategy.java
branches/RF-7944/ui/input/ui/src/main/java/org/richfaces/renderkit/AutocompleteListLayoutStrategy.java
branches/RF-7944/ui/input/ui/src/main/java/org/richfaces/renderkit/AutocompleteRendererBase.java
branches/RF-7944/ui/input/ui/src/main/java/org/richfaces/renderkit/AutocompleteTableLayoutStrategy.java
branches/RF-7944/ui/input/ui/src/main/java/org/richfaces/renderkit/InplaceInputBaseRenderer.java
branches/RF-7944/ui/input/ui/src/main/resources/META-INF/resources/org.richfaces/Autocomplete.js
branches/RF-7944/ui/input/ui/src/main/resources/META-INF/resources/org.richfaces/AutocompleteBase.js
branches/RF-7944/ui/input/ui/src/main/resources/META-INF/resources/org.richfaces/inplaceInput.js
branches/RF-7944/ui/input/ui/src/main/templates/autocomplete.template.xml
branches/RF-7944/ui/input/ui/src/main/templates/inplaceInput.template.xml
branches/RF-7944/ui/input/ui/src/test/java/org/richfaces/renderkit/InplaceInputRendererTest.java
branches/RF-7944/ui/iteration/ui/src/main/java/org/richfaces/component/AbstractColumn.java
branches/RF-7944/ui/iteration/ui/src/main/java/org/richfaces/component/AbstractDataGrid.java
branches/RF-7944/ui/iteration/ui/src/main/java/org/richfaces/component/AbstractDataScroller.java
branches/RF-7944/ui/iteration/ui/src/main/java/org/richfaces/component/AbstractExtendedDataTable.java
branches/RF-7944/ui/iteration/ui/src/main/java/org/richfaces/component/UIDataTableBase.java
branches/RF-7944/ui/iteration/ui/src/main/java/org/richfaces/event/DataTablePreRenderListener.java
branches/RF-7944/ui/iteration/ui/src/main/java/org/richfaces/renderkit/ColumnGroupRenderer.java
branches/RF-7944/ui/iteration/ui/src/main/java/org/richfaces/renderkit/ControlsState.java
branches/RF-7944/ui/iteration/ui/src/main/java/org/richfaces/renderkit/DataScrollerBaseRenderer.java
branches/RF-7944/ui/iteration/ui/src/main/java/org/richfaces/renderkit/DataTableRenderer.java
branches/RF-7944/ui/iteration/ui/src/main/java/org/richfaces/renderkit/SubTableRenderer.java
branches/RF-7944/ui/iteration/ui/src/main/resources/META-INF/resources/org.richfaces/datascroller.js
branches/RF-7944/ui/iteration/ui/src/main/templates/datascroller.template.xml
branches/RF-7944/ui/iteration/ui/src/test/java/org/richfaces/renderkit/DataGridRendererTest.java
branches/RF-7944/ui/iteration/ui/src/test/resources/org/richfaces/renderkit/faces-config.xml
branches/RF-7944/ui/output/ui/src/main/java/org/richfaces/component/AbstractDivPanel.java
branches/RF-7944/ui/output/ui/src/main/java/org/richfaces/component/AbstractTogglePanel.java
branches/RF-7944/ui/output/ui/src/main/java/org/richfaces/component/AbstractTogglePanelItem.java
branches/RF-7944/ui/output/ui/src/main/java/org/richfaces/component/AbstractTogglePanelTitledItem.java
branches/RF-7944/ui/output/ui/src/main/java/org/richfaces/component/UITogglePanelItem.java
branches/RF-7944/ui/output/ui/src/main/java/org/richfaces/component/behavior/ToggleControl.java
branches/RF-7944/ui/output/ui/src/main/java/org/richfaces/event/MethodExpressionItemChangeListener.java
branches/RF-7944/ui/output/ui/src/main/java/org/richfaces/renderkit/html/AccordionItemRenderer.java
branches/RF-7944/ui/output/ui/src/main/java/org/richfaces/renderkit/html/AccordionRenderer.java
branches/RF-7944/ui/output/ui/src/main/java/org/richfaces/renderkit/html/DivPanelRenderer.java
branches/RF-7944/ui/output/ui/src/main/java/org/richfaces/renderkit/html/TogglePanelItemRenderer.java
branches/RF-7944/ui/output/ui/src/main/java/org/richfaces/renderkit/html/TogglePanelRenderer.java
branches/RF-7944/ui/output/ui/src/main/java/org/richfaces/view/facelets/html/ItemChangeListenerHandler.java
branches/RF-7944/ui/output/ui/src/main/resources/META-INF/pn.faces-config.xml
branches/RF-7944/ui/output/ui/src/main/resources/META-INF/pn.taglib.xml
branches/RF-7944/ui/output/ui/src/main/resources/META-INF/resources/org.richfaces/AccordionItem.js
branches/RF-7944/ui/output/ui/src/main/resources/META-INF/resources/org.richfaces/TogglePanel.js
branches/RF-7944/ui/output/ui/src/main/resources/META-INF/resources/org.richfaces/TogglePanelItem.js
branches/RF-7944/ui/output/ui/src/main/resources/META-INF/resources/org.richfaces/accordion.ecss
branches/RF-7944/ui/parent/pom.xml
Log:
merge from trunk
Modified: branches/RF-7944/examples/core-demo/pom.xml
===================================================================
--- branches/RF-7944/examples/core-demo/pom.xml 2010-09-03 12:00:31 UTC (rev 19109)
+++ branches/RF-7944/examples/core-demo/pom.xml 2010-09-03 12:51:59 UTC (rev 19110)
@@ -39,22 +39,6 @@
<dependencyManagement>
<dependencies>
- <!--
- simple logger binding: only messages of level INFO and
- higher are printed
- -->
- <dependency>
- <groupId>org.slf4j</groupId>
- <artifactId>slf4j-simple</artifactId>
- <version>1.5.8</version>
- </dependency>
-
- <!-- Log4J dependency used in examples -->
- <dependency>
- <groupId>log4j</groupId>
- <artifactId>log4j</artifactId>
- <version>1.2.14</version>
- </dependency>
</dependencies>
</dependencyManagement>
@@ -87,14 +71,6 @@
<groupId>net.sf.ehcache</groupId>
<artifactId>ehcache</artifactId>
</dependency>
- <dependency>
- <groupId>org.slf4j</groupId>
- <artifactId>slf4j-log4j12</artifactId>
- </dependency>
- <dependency>
- <groupId>log4j</groupId>
- <artifactId>log4j</artifactId>
- </dependency>
</dependencies>
<build>
Modified: branches/RF-7944/examples/core-demo/src/main/java/org/richfaces/demo/PhaseTracker.java
===================================================================
--- branches/RF-7944/examples/core-demo/src/main/java/org/richfaces/demo/PhaseTracker.java 2010-09-03 12:00:31 UTC (rev 19109)
+++ branches/RF-7944/examples/core-demo/src/main/java/org/richfaces/demo/PhaseTracker.java 2010-09-03 12:51:59 UTC (rev 19110)
@@ -27,8 +27,8 @@
import javax.faces.event.PhaseId;
import javax.faces.event.PhaseListener;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
+import org.richfaces.log.LogFactory;
+import org.richfaces.log.Logger;
/**
* @author Nick Belaevski
@@ -38,7 +38,7 @@
private static final long serialVersionUID = 6358081870120864332L;
- private Logger logger = LoggerFactory.getLogger(PhaseTracker.class);
+ private Logger logger = LogFactory.getLogger(PhaseTracker.class);
private ThreadLocal<Long> phaseTimer = new ThreadLocal<Long>();
Deleted: branches/RF-7944/examples/core-demo/src/main/resources/log4j.xml
===================================================================
--- branches/RF-7944/examples/core-demo/src/main/resources/log4j.xml 2010-09-03 12:00:31 UTC (rev 19109)
+++ branches/RF-7944/examples/core-demo/src/main/resources/log4j.xml 2010-09-03 12:51:59 UTC (rev 19110)
@@ -1,22 +0,0 @@
-<?xml version="1.0" encoding="UTF-8" ?>
-<!DOCTYPE log4j:configuration SYSTEM "log4j.dtd">
-
-<log4j:configuration xmlns:log4j="http://jakarta.apache.org/log4j/">
- <appender name="console" class="org.apache.log4j.ConsoleAppender">
- <param name="Target" value="System.out" />
- <layout class="org.apache.log4j.PatternLayout">
- <param name="ConversionPattern" value="%d %-5p [%c] %m%n" />
- </layout>
- </appender>
- <logger name="org.richfaces">
- <level value="info" />
- </logger>
- <logger name="org.richfaces.demo.PhaseTracker">
- <level value="debug" />
- </logger>
- <root>
- <priority value="info" />
- <appender-ref ref="console" />
- </root>
-
-</log4j:configuration>
\ No newline at end of file
Modified: branches/RF-7944/examples/core-demo/src/main/webapp/ajax.xhtml
===================================================================
--- branches/RF-7944/examples/core-demo/src/main/webapp/ajax.xhtml 2010-09-03 12:00:31 UTC (rev 19109)
+++ branches/RF-7944/examples/core-demo/src/main/webapp/ajax.xhtml 2010-09-03 12:51:59 UTC (rev 19110)
@@ -88,7 +88,7 @@
<a:ajax bypassUpdates="true" />
</h:commandLink>
- bypassUpdates="#{true}"
+ bypassUpdates="#{'#'}{true}"
<h:inputText>
<a:ajax bypassUpdates="#{true}" event="keyup" />
</h:inputText>
Modified: branches/RF-7944/examples/core-demo/src/main/webapp/button.xhtml
===================================================================
--- branches/RF-7944/examples/core-demo/src/main/webapp/button.xhtml 2010-09-03 12:00:31 UTC (rev 19109)
+++ branches/RF-7944/examples/core-demo/src/main/webapp/button.xhtml 2010-09-03 12:51:59 UTC (rev 19110)
@@ -23,11 +23,28 @@
<f:ajax event="action" execute="@form" render=":out" listener="#{commandBean.listener}" />
</a4j:commandButton>
</h:form>
- <br />
+ <br />
<h:panelGroup id="out">
<h:outputText value="#{commandBean.name}" />
<h:outputText value="!" rendered="#{not empty commandBean.name}" />
</h:panelGroup>
+ <br /><hr />
+ RF-9146: request grouping id not set:
+ <br />
+ <h:panelGroup id="out1">
+ <h:outputText value="#{commandBean.name}" />
+ </h:panelGroup>
+ <h:form>
+ <a4j:queue requestDelay="5000"/>
+ <a4j:commandButton value="Update 1" render="out1">
+ <a4j:param name="v1" value="Update 1" assignTo="#{commandBean.name}" />
+ </a4j:commandButton>
+ <a4j:commandButton value="Update 2" render="out1">
+ <a4j:param name="v1" value="Update 2" assignTo="#{commandBean.name}" />
+ </a4j:commandButton>
+ <hr />
+ <a4j:log level="debug" style="border: solid red 1px" styleClass="log" mode="popup" />
+ </h:form>
</h:body>
</f:view>
</html>
\ No newline at end of file
Modified: branches/RF-7944/examples/input-demo/pom.xml
===================================================================
--- branches/RF-7944/examples/input-demo/pom.xml 2010-09-03 12:00:31 UTC (rev 19109)
+++ branches/RF-7944/examples/input-demo/pom.xml 2010-09-03 12:51:59 UTC (rev 19110)
@@ -83,8 +83,8 @@
<configuration>
<webappDirectory>${project.build.directory}/${project.build.finalName}-jee6</webappDirectory>
<classifier>jee6</classifier>
- <packagingExcludes>WEB-INF/lib/jsf-api*,WEB-INF/lib/jsf-impl*,WEB-INF/lib/slf4j-*</packagingExcludes>
- <warSourceExcludes>WEB-INF/lib/jsf-api*,WEB-INF/lib/jsf-impl*,WEB-INF/lib/slf4j-*</warSourceExcludes>
+ <packagingExcludes>WEB-INF/lib/jsf-api*,WEB-INF/lib/jsf-impl*</packagingExcludes>
+ <warSourceExcludes>WEB-INF/lib/jsf-api*,WEB-INF/lib/jsf-impl*</warSourceExcludes>
</configuration>
</execution>
</executions>
@@ -131,38 +131,12 @@
<groupId>javax.servlet</groupId>
<artifactId>jstl</artifactId>
</dependency>
- <dependency>
- <groupId>org.slf4j</groupId>
- <artifactId>slf4j-api</artifactId>
- </dependency>
- <dependency>
- <groupId>org.slf4j</groupId>
- <artifactId>slf4j-simple</artifactId>
- <version>1.5.8</version>
- </dependency>
<dependency>
<groupId>net.sf.ehcache</groupId>
<artifactId>ehcache</artifactId>
</dependency>
- <!--
- simple logger binding: only messages of level INFO and
- higher are printed
- -->
- <dependency>
- <groupId>org.slf4j</groupId>
- <artifactId>slf4j-log4j12</artifactId>
- <version>1.5.8</version>
- </dependency>
-
- <!-- Log4J dependency used in examples -->
- <dependency>
- <groupId>log4j</groupId>
- <artifactId>log4j</artifactId>
- <version>1.2.14</version>
- </dependency>
-
<!-- Tests -->
<dependency>
<groupId>org.testng</groupId>
Modified: branches/RF-7944/examples/input-demo/src/main/java/org/richfaces/demo/AutoCompleteBean.java
===================================================================
--- branches/RF-7944/examples/input-demo/src/main/java/org/richfaces/demo/AutoCompleteBean.java 2010-09-03 12:00:31 UTC (rev 19109)
+++ branches/RF-7944/examples/input-demo/src/main/java/org/richfaces/demo/AutoCompleteBean.java 2010-09-03 12:51:59 UTC (rev 19110)
@@ -22,6 +22,7 @@
package org.richfaces.demo;
import java.io.Serializable;
+import java.util.Arrays;
import java.util.Locale;
import javax.faces.bean.ManagedBean;
@@ -30,6 +31,8 @@
import javax.faces.component.UIComponent;
import javax.faces.context.FacesContext;
+import org.richfaces.component.UIAutocomplete;
+
import com.google.common.base.Predicate;
import com.google.common.collect.Collections2;
@@ -60,7 +63,17 @@
return input.getName().toLowerCase(Locale.US).startsWith(countryNamePrefix);
}
}
+
+ private String mode = "lazyClient";
+ public String getMode() {
+ return mode;
+ }
+
+ public void setMode(String mode) {
+ this.mode = mode;
+ }
+
@ManagedProperty(value = "#{countriesBean}")
private CountriesBean countriesBean;
@@ -69,7 +82,13 @@
}
public Object autocomplete(FacesContext facesContext, UIComponent component, String value) {
- return Collections2.filter(countriesBean.getCountries(), new CountryNamePredicate(value));
+ // for tests when value does not starts with prefix
+ /*String str = value;
+ if (str.charAt(0)=='i') {
+ str = str.substring(1);
+ }*/
+ String v = mode.equals("lazyClient") || mode.equals("client") ? "" : value;
+ return Collections2.filter(countriesBean.getCountries(), new CountryNamePredicate(v.toLowerCase()));
}
}
Modified: branches/RF-7944/examples/input-demo/src/main/webapp/autocomplete.xhtml
===================================================================
--- branches/RF-7944/examples/input-demo/src/main/webapp/autocomplete.xhtml 2010-09-03 12:00:31 UTC (rev 19109)
+++ branches/RF-7944/examples/input-demo/src/main/webapp/autocomplete.xhtml 2010-09-03 12:51:59 UTC (rev 19110)
@@ -13,11 +13,17 @@
<h:body style="margin: 30px;">
<h:form id="form">
+ <h:selectOneMenu value="#{autoCompleteBean.mode}" onchange="submit()">
+ <f:selectItem itemValue="lazyClient"/>
+ <f:selectItem itemValue="client"/>
+ <f:selectItem itemValue="cachedAjax"/>
+ <f:selectItem itemValue="ajax"/>
+ </h:selectOneMenu>
<div style="height: 300px; width: 300px; overflow: auto;">Text
block text block text block text block text block text block text
block text block
- <input:autocomplete autocompleteMethod="#{autoCompleteBean.autocomplete}" var="country" fetchValue="#{country.name}">
+ <input:autocomplete clientFilter="if(subString.length>1) if(value.indexOf(subString)!=-1) return true;" mode="#{autoCompleteBean.mode}" minChars="2" autocompleteMethod="#{autoCompleteBean.autocomplete}" var="country" fetchValue="#{country.name}" showButton="true">
#{country.name} #{country.iso} #{country.domain}
</input:autocomplete>
Modified: branches/RF-7944/examples/iteration-demo/pom.xml
===================================================================
--- branches/RF-7944/examples/iteration-demo/pom.xml 2010-09-03 12:00:31 UTC (rev 19109)
+++ branches/RF-7944/examples/iteration-demo/pom.xml 2010-09-03 12:51:59 UTC (rev 19110)
@@ -39,22 +39,6 @@
<dependencyManagement>
<dependencies>
- <!--
- simple logger binding: only messages of level INFO and
- higher are printed
- -->
- <dependency>
- <groupId>org.slf4j</groupId>
- <artifactId>slf4j-simple</artifactId>
- <version>1.5.8</version>
- </dependency>
-
- <!-- Log4J dependency used in examples -->
- <dependency>
- <groupId>log4j</groupId>
- <artifactId>log4j</artifactId>
- <version>1.2.14</version>
- </dependency>
</dependencies>
</dependencyManagement>
@@ -71,14 +55,6 @@
<groupId>org.richfaces.ui.misc</groupId>
<artifactId>richfaces-ui-misc-ui</artifactId>
</dependency>
- <dependency>
- <groupId>org.slf4j</groupId>
- <artifactId>slf4j-log4j12</artifactId>
- </dependency>
- <dependency>
- <groupId>log4j</groupId>
- <artifactId>log4j</artifactId>
- </dependency>
<!-- API implementation for runtime -->
Modified: branches/RF-7944/examples/misc-demo/pom.xml
===================================================================
--- branches/RF-7944/examples/misc-demo/pom.xml 2010-09-03 12:00:31 UTC (rev 19109)
+++ branches/RF-7944/examples/misc-demo/pom.xml 2010-09-03 12:51:59 UTC (rev 19110)
@@ -39,22 +39,6 @@
<dependencyManagement>
<dependencies>
- <!--
- simple logger binding: only messages of level INFO and
- higher are printed
- -->
- <dependency>
- <groupId>org.slf4j</groupId>
- <artifactId>slf4j-simple</artifactId>
- <version>1.5.8</version>
- </dependency>
-
- <!-- Log4J dependency used in examples -->
- <dependency>
- <groupId>log4j</groupId>
- <artifactId>log4j</artifactId>
- <version>1.2.14</version>
- </dependency>
</dependencies>
</dependencyManagement>
@@ -96,15 +80,6 @@
<groupId>net.sf.ehcache</groupId>
<artifactId>ehcache</artifactId>
</dependency>
- <dependency>
- <groupId>org.slf4j</groupId>
- <artifactId>slf4j-log4j12</artifactId>
- </dependency>
- <dependency>
- <groupId>org.slf4j</groupId>
- <artifactId>slf4j-simple</artifactId>
- <scope>provided</scope>
- </dependency>
</dependencies>
<profiles>
Modified: branches/RF-7944/examples/output-demo/pom.xml
===================================================================
--- branches/RF-7944/examples/output-demo/pom.xml 2010-09-03 12:00:31 UTC (rev 19109)
+++ branches/RF-7944/examples/output-demo/pom.xml 2010-09-03 12:51:59 UTC (rev 19110)
@@ -87,8 +87,8 @@
<configuration>
<webappDirectory>${project.build.directory}/${project.build.finalName}-jee6</webappDirectory>
<classifier>jee6</classifier>
- <packagingExcludes>WEB-INF/lib/jsf-api*,WEB-INF/lib/jsf-impl*,WEB-INF/lib/slf4j-*</packagingExcludes>
- <warSourceExcludes>WEB-INF/lib/jsf-api*,WEB-INF/lib/jsf-impl*,WEB-INF/lib/slf4j-*</warSourceExcludes>
+ <packagingExcludes>WEB-INF/lib/jsf-api*,WEB-INF/lib/jsf-impl*</packagingExcludes>
+ <warSourceExcludes>WEB-INF/lib/jsf-api*,WEB-INF/lib/jsf-impl*</warSourceExcludes>
</configuration>
</execution>
</executions>
@@ -135,38 +135,12 @@
<groupId>javax.servlet</groupId>
<artifactId>jstl</artifactId>
</dependency>
- <dependency>
- <groupId>org.slf4j</groupId>
- <artifactId>slf4j-api</artifactId>
- </dependency>
- <dependency>
- <groupId>org.slf4j</groupId>
- <artifactId>slf4j-simple</artifactId>
- <version>1.5.8</version>
- </dependency>
<dependency>
<groupId>net.sf.ehcache</groupId>
<artifactId>ehcache</artifactId>
</dependency>
- <!--
- simple logger binding: only messages of level INFO and
- higher are printed
- -->
- <dependency>
- <groupId>org.slf4j</groupId>
- <artifactId>slf4j-log4j12</artifactId>
- <version>1.5.8</version>
- </dependency>
-
- <!-- Log4J dependency used in examples -->
- <dependency>
- <groupId>log4j</groupId>
- <artifactId>log4j</artifactId>
- <version>1.2.14</version>
- </dependency>
-
<!-- Tests -->
<dependency>
<groupId>org.testng</groupId>
Modified: branches/RF-7944/examples/output-demo/src/main/java/org/richfaces/TogglePanelBean.java
===================================================================
--- branches/RF-7944/examples/output-demo/src/main/java/org/richfaces/TogglePanelBean.java 2010-09-03 12:00:31 UTC (rev 19109)
+++ branches/RF-7944/examples/output-demo/src/main/java/org/richfaces/TogglePanelBean.java 2010-09-03 12:51:59 UTC (rev 19110)
@@ -1,15 +1,15 @@
package org.richfaces;
-import org.slf4j.LoggerFactory;
-import org.slf4j.Logger;
-
import java.io.Serializable;
+import org.richfaces.log.LogFactory;
+import org.richfaces.log.Logger;
+
public class TogglePanelBean implements Serializable {
private static final long serialVersionUID = -2403138958014741653L;
- private static final Logger LOGGER = LoggerFactory.getLogger(TogglePanelBean.class);
+ private static final Logger LOGGER = LogFactory.getLogger(TogglePanelBean.class);
private String name;
Modified: branches/RF-7944/examples/output-demo/src/main/webapp/WEB-INF/faces-config.xml
===================================================================
--- branches/RF-7944/examples/output-demo/src/main/webapp/WEB-INF/faces-config.xml 2010-09-03 12:00:31 UTC (rev 19109)
+++ branches/RF-7944/examples/output-demo/src/main/webapp/WEB-INF/faces-config.xml 2010-09-03 12:51:59 UTC (rev 19110)
@@ -34,6 +34,10 @@
<from-outcome>accordion</from-outcome>
<to-view-id>/examples/accordion.xhtml</to-view-id>
</navigation-case>
+ <navigation-case>
+ <from-outcome>collapsiblePanel</from-outcome>
+ <to-view-id>/examples/collapsiblePanel.xhtml</to-view-id>
+ </navigation-case>
<!-- QUnit -->
<navigation-case>
@@ -52,5 +56,9 @@
<from-outcome>qunit/accordionHeaders</from-outcome>
<to-view-id>/qunit/accordionHeaders.xhtml</to-view-id>
</navigation-case>
+ <navigation-case>
+ <from-outcome>qunit/collapsiblePanel</from-outcome>
+ <to-view-id>/qunit/collapsiblePanel.xhtml</to-view-id>
+ </navigation-case>
</navigation-rule>
</faces-config>
Copied: branches/RF-7944/examples/output-demo/src/main/webapp/examples/collapsiblePanel.xhtml (from rev 19108, trunk/examples/output-demo/src/main/webapp/examples/collapsiblePanel.xhtml)
===================================================================
--- branches/RF-7944/examples/output-demo/src/main/webapp/examples/collapsiblePanel.xhtml (rev 0)
+++ branches/RF-7944/examples/output-demo/src/main/webapp/examples/collapsiblePanel.xhtml 2010-09-03 12:51:59 UTC (rev 19110)
@@ -0,0 +1,35 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml"
+ xmlns:h="http://java.sun.com/jsf/html"
+ xmlns:f="http://java.sun.com/jsf/core"
+ xmlns:ui="http://java.sun.com/jsf/facelets"
+ xmlns:pn="http://richfaces.org/output">
+
+<body>
+<ui:composition template="/templates/template.xhtml">
+
+ <ui:define name="title">Collapsible Panel QUnit</ui:define>
+ <ui:define name="body_head">Collapsible Panel QUnit</ui:define>
+
+ <ui:define name="body">
+ <p>Page</p>
+
+ <h:form id="f">
+ <pn:collapsiblePanel id="panel">
+ <f:facet name="headerExpanded" >
+ header exanded
+ </f:facet>
+ <f:facet name="headerCollapsed" >
+ header collapsed
+ </f:facet>
+
+ Hello!!!
+
+ </pn:collapsiblePanel>
+
+ </h:form>
+ </ui:define>
+</ui:composition>
+</body>
+</html>
+
Modified: branches/RF-7944/examples/output-demo/src/main/webapp/qunit/accordionHeaders.xhtml
===================================================================
--- branches/RF-7944/examples/output-demo/src/main/webapp/qunit/accordionHeaders.xhtml 2010-09-03 12:00:31 UTC (rev 19109)
+++ branches/RF-7944/examples/output-demo/src/main/webapp/qunit/accordionHeaders.xhtml 2010-09-03 12:51:59 UTC (rev 19110)
@@ -26,22 +26,43 @@
<pn:accordionItem header="label 1">
<f:facet name="headerInactive">headerInactive 1</f:facet>
<f:facet name="headerActive">headerActive 1</f:facet>
- <f:facet name="headerDisable">headerDisable 1</f:facet>
+ <f:facet name="header">headerDisable 1</f:facet>
content 1
</pn:accordionItem>
<pn:accordionItem header="label 2" disabled="true">
<f:facet name="headerInactive">headerInactive 2</f:facet>
- <f:facet name="headerActive">headerActive 2</f:facet>
+ <f:facet name="header">headerActive 2</f:facet>
<f:facet name="headerDisable">headerDisable 2</f:facet>
content 2
</pn:accordionItem>
<pn:accordionItem header="label 3">
- <f:facet name="headerInactive">headerInactive 3</f:facet>
+ <f:facet name="header">headerInactive 3</f:facet>
<f:facet name="headerActive">headerActive 3</f:facet>
<f:facet name="headerDisable">headerDisable 3</f:facet>
content 3
</pn:accordionItem>
</pn:accordion>
+
+ <h:outputLink>
+ <pn:toggleControl targetPanel="panel" targetItem="@first" event="click"/>
+ |< first
+ </h:outputLink>
+ |
+ <h:outputLink>
+ <pn:toggleControl targetPanel="panel" targetItem="@prev" event="click"/>
+ <- prev
+ </h:outputLink>
+ |
+ <h:outputLink>
+ <pn:toggleControl targetPanel="panel" targetItem="@next" event="click"/>
+ next ->
+ </h:outputLink>
+ |
+ <h:outputLink>
+ <pn:toggleControl targetPanel="panel" targetItem="@last" event="click"/>
+ last >|
+ </h:outputLink>
+
</h:form>
<p>Result</p>
Copied: branches/RF-7944/examples/output-demo/src/main/webapp/qunit/collapsiblePanel.xhtml (from rev 19108, trunk/examples/output-demo/src/main/webapp/qunit/collapsiblePanel.xhtml)
===================================================================
--- branches/RF-7944/examples/output-demo/src/main/webapp/qunit/collapsiblePanel.xhtml (rev 0)
+++ branches/RF-7944/examples/output-demo/src/main/webapp/qunit/collapsiblePanel.xhtml 2010-09-03 12:51:59 UTC (rev 19110)
@@ -0,0 +1,51 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml"
+ xmlns:h="http://java.sun.com/jsf/html"
+ xmlns:f="http://java.sun.com/jsf/core"
+ xmlns:ui="http://java.sun.com/jsf/facelets"
+ xmlns:pn="http://richfaces.org/output">
+
+<body>
+<ui:composition template="/templates/template.xhtml">
+
+ <ui:define name="scripts">
+ <h:outputScript name="qunit/qunit.js" />
+ <h:outputScript name="qunit/richfaces-qunit.js" />
+
+ <h:outputStylesheet name="qunit/qunit.css" />
+ </ui:define>
+
+ <ui:define name="title">Collapsible Panel QUnit</ui:define>
+ <ui:define name="body_head">Collapsible Panel QUnit</ui:define>
+
+ <ui:define name="body">
+ <p>Page</p>
+
+ <h:form id="f">
+ <pn:collapsiblePanel id="panel" switchType="client">
+ <f:facet name="headerExpanded" >
+ header exanded
+ </f:facet>
+ <f:facet name="headerCollapsed" >
+ header collapsed
+ </f:facet>
+
+ Hello!!!
+
+ </pn:collapsiblePanel>
+
+ </h:form>
+
+ <p>Result</p>
+ <div>
+ <ol id="qunit-tests"></ol>
+
+ <div id="testDiv" style="margin-top:10px; border:1px solid #a0a0a0">Main Test Div</div>
+
+ </div>
+ <h:outputScript name="tests/richfaces-collapsible-panel-qunit.js" />
+ </ui:define>
+</ui:composition>
+</body>
+</html>
+
Modified: branches/RF-7944/examples/output-demo/src/main/webapp/resources/tests/richfaces-accordion-headers-qunit.js
===================================================================
--- branches/RF-7944/examples/output-demo/src/main/webapp/resources/tests/richfaces-accordion-headers-qunit.js 2010-09-03 12:00:31 UTC (rev 19109)
+++ branches/RF-7944/examples/output-demo/src/main/webapp/resources/tests/richfaces-accordion-headers-qunit.js 2010-09-03 12:51:59 UTC (rev 19110)
@@ -25,6 +25,34 @@
var ACCORDION_ID = "f:panel";
+ function testFirst(items) {
+ ok(items[0].__header("act").is(":visible"), "1 item: active visible");
+ ok(!items[0].__header("inact").is(":visible"), "1 item: inactive unvisible");
+ ok(!items[0].__header("dis").is(":visible"), "1 item: disabled unvisible");
+
+ ok(!items[1].__header("act").is(":visible"), "2 item: active visible");
+ ok(!items[1].__header("inact").is(":visible"), "2 item: inactive unvisible");
+ ok(items[1].__header("dis").is(":visible"), "2 item: disabled unvisible");
+
+ ok(!items[2].__header("act").is(":visible"), "3 item: active unvisible");
+ ok(items[2].__header("inact").is(":visible"), "3 item: inactive visible");
+ ok(!items[2].__header("dis").is(":visible"), "3 item: disabled unvisible");
+ }
+
+ function testLast(items) {
+ ok(!items[0].__header("act").is(":visible"), "1 item: active unvisible");
+ ok(items[0].__header("inact").is(":visible"), "1 item: inactive visible");
+ ok(!items[0].__header("dis").is(":visible"), "1 item: disabled unvisible");
+
+ ok(!items[1].__header("act").is(":visible"), "2 item: active visible");
+ ok(!items[1].__header("inact").is(":visible"), "2 item: inactive unvisible");
+ ok(items[1].__header("dis").is(":visible"), "2 item: disabled unvisible");
+
+ ok(items[2].__header("act").is(":visible"), "3 item: active visible");
+ ok(!items[2].__header("inact").is(":visible"), "3 item: inactive unvisible");
+ ok(!items[2].__header("dis").is(":visible"), "3 item: disabled unvisible");
+ }
+
test("RichFaces.ui.Accordion change headers", function () {
var c = RichFaces.$(ACCORDION_ID);
@@ -34,31 +62,38 @@
equals(c.getItems().length, 3, "getItems().length");
var items = c.getItems();
- ok( items[0].__header("active" ).is(":visible"), "1 item: active visible");
- ok(!items[0].__header("inactive").is(":visible"), "1 item: inactive unvisible");
- ok(!items[0].__header("disable" ).is(":visible"), "1 item: disabled unvisible");
+ testFirst(items);
- ok(!items[1].__header("active" ).is(":visible"), "2 item: active unvisible");
- ok(!items[1].__header("inactive").is(":visible"), "2 item: inactive unvisible");
- ok( items[1].__header("disable" ).is(":visible"), "2 item: disabled visible");
+ c.switchToItem(items[2].getName());
+ testLast(items);
- ok(!items[2].__header("active" ).is(":visible"), "3 item: active unvisible");
- ok( items[2].__header("inactive").is(":visible"), "3 item: inactive visible");
- ok(!items[2].__header("disable" ).is(":visible"), "3 item: disabled unvisible");
+ c.switchToItem("@first");
+ testFirst(items);
- c.switchToItem(items[2].getName());
- ok(!items[0].__header("active" ).is(":visible"), "1 item: active unvisible");
- ok( items[0].__header("inactive").is(":visible"), "1 item: inactive visible");
- ok(!items[0].__header("disable" ).is(":visible"), "1 item: disabled unvisible");
+ c.switchToItem("@last");
+ testLast(items);
- ok(!items[1].__header("active" ).is(":visible"), "2 item: active unvisible");
- ok(!items[1].__header("inactive").is(":visible"), "2 item: inactive unvisible");
- ok( items[1].__header("disable" ).is(":visible"), "2 item: disabled visible");
+ c.switchToItem("@prev");
+ testFirst(items);
- ok( items[2].__header("active" ).is(":visible"), "3 item: active visible");
- ok(!items[2].__header("inactive").is(":visible"), "3 item: inactive unvisible");
- ok(!items[2].__header("disable" ).is(":visible"), "3 item: disabled unvisible");
+ c.switchToItem("@next");
+ testLast(items);
+ });
+ test("RichFaces.ui.Accordion change disabled headers", function () {
+ var c = RichFaces.$(ACCORDION_ID);
+
+ ok(c instanceof RichFaces.ui.Accordion, "inctance of RichFaces.ui.Accordion");
+ equals(c.id, ACCORDION_ID, "id");
+
+ equals(c.getItems().length, 3, "getItems().length");
+
+ var items = c.getItems();
+
c.switchToItem(items[0].getName());
+ testFirst(items);
+
+ c.switchToItem(items[1].getName());
+ testFirst(items);
});
});
Copied: branches/RF-7944/examples/output-demo/src/main/webapp/resources/tests/richfaces-collapsible-panel-qunit.js (from rev 19108, trunk/examples/output-demo/src/main/webapp/resources/tests/richfaces-collapsible-panel-qunit.js)
===================================================================
--- branches/RF-7944/examples/output-demo/src/main/webapp/resources/tests/richfaces-collapsible-panel-qunit.js (rev 0)
+++ branches/RF-7944/examples/output-demo/src/main/webapp/resources/tests/richfaces-collapsible-panel-qunit.js 2010-09-03 12:51:59 UTC (rev 19110)
@@ -0,0 +1,115 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright ${year}, Red Hat, Inc. and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+
+RichFaces.QUnit.run(function() {
+ module("richfaces-collapsible-panel");
+
+ var COLLAPSIBLE_PANEL_ID = "f:panel";
+
+ function handler (msg, returnValue) {
+ return function () {
+ ok(true, msg);
+
+ if (returnValue != undefined) {
+ return returnValue;
+ }
+ };
+ }
+
+ test("RichFaces.ui.CollapsiblePanel test constructor", function () {
+ var c = RichFaces.$(COLLAPSIBLE_PANEL_ID);
+
+ ok(c instanceof RichFaces.ui.CollapsiblePanel, "inctance of RichFaces.ui.CollapsiblePanel");
+ equals(c.id, COLLAPSIBLE_PANEL_ID, "id");
+ // TODO other params
+
+ });
+
+ test("RichFaces.ui.CollapsiblePanel test public api", function () {
+ var c = RichFaces.$(COLLAPSIBLE_PANEL_ID);
+
+ var PUBLIC_API = ["switchPanel"];
+
+ for (var i in PUBLIC_API) {
+ var funcName = PUBLIC_API[i];
+ ok(c[funcName], funcName + " present in component");
+ equals(typeof c[funcName], "function", funcName + "is function");
+ }
+ });
+
+ test("RichFaces.ui.CollapsiblePanel.Events", function () {
+ var componentId = COLLAPSIBLE_PANEL_ID;
+ var c = RichFaces.$(componentId);
+
+ expect(4);
+
+ var beforeswitchHandler = function (event, comp, data) {
+ ok(true, "beforeswitch handler invouked");
+
+ same(data.id, componentId, "component id");
+ same(data.isExpanded, "false", "panel collapsed");
+
+ return true;
+ };
+
+ var beforeswitchHandlerWrapper = RichFaces.Event.bindById(componentId, "beforeswitch", beforeswitchHandler);
+
+ var switchHandler = handler("switch handler invouked", undefined);
+ var switchHandlerWrapper = RichFaces.Event.bindById(componentId, "switch", switchHandler);
+
+ c.switchPanel();
+
+ RichFaces.Event.unbindById(componentId, "beforeswitch", beforeswitchHandlerWrapper);
+ RichFaces.Event.unbindById(componentId, "switch", switchHandlerWrapper);
+
+ c.switchPanel();
+ });
+
+ test("RichFaces.ui.CollapsiblePanel.Events test cancelable", function () {
+ var c = RichFaces.$(COLLAPSIBLE_PANEL_ID);
+
+ expect(2);
+ var beforeswitch1 = RichFaces.Event.bindById(COLLAPSIBLE_PANEL_ID, "beforeswitch", function () {
+ ok(true, "beforeswitch handler invouked");
+
+ return false;
+ });
+
+ var beforeswitch2 = RichFaces.Event.bindById(COLLAPSIBLE_PANEL_ID, "beforeswitch", function () {
+ ok(true, "beforeswitch handler invouked");
+
+ return true;
+ });
+
+ var switchHandler = RichFaces.Event.bindById(COLLAPSIBLE_PANEL_ID, "switch", function () {
+ ok(false, "switch handler should't been invouked");
+ });
+
+ c.switchPanel();
+
+ RichFaces.Event.unbindById(COLLAPSIBLE_PANEL_ID, "beforeswitch", beforeswitch1);
+ RichFaces.Event.unbindById(COLLAPSIBLE_PANEL_ID, "beforeswitch", beforeswitch2);
+ RichFaces.Event.unbindById(COLLAPSIBLE_PANEL_ID, "switch", switchHandler);
+
+ c.switchPanel();
+ });
+});
Modified: branches/RF-7944/examples/output-demo/src/main/webapp/templates/template.xhtml
===================================================================
--- branches/RF-7944/examples/output-demo/src/main/webapp/templates/template.xhtml 2010-09-03 12:00:31 UTC (rev 19109)
+++ branches/RF-7944/examples/output-demo/src/main/webapp/templates/template.xhtml 2010-09-03 12:51:59 UTC (rev 19110)
@@ -11,9 +11,161 @@
<meta http-equiv="content-type" content="text/xhtml; charset=UTF-8" />
+ <style type="text/css">
+ * {
+ font-family: verdana
+ }
+
+ .rftp_toptab {
+ display: table-cell;
+ border: 1px solid #A6A6A6;
+ padding: 0px 0px 3px 0px;
+ vertical-align: bottom;
+ background: url(tab_bg.gif) top repeat-x #DAE7F5;
+ }
+
+ .rftp_active_top {
+ border-bottom: 0px;
+ font-weight: bold;
+ padding: 3px 0px 0px 0px;
+ vertical-align: top;
+ background: url(acttab_bg.gif) top repeat-x #C9DBEF;
+ }
+
+ .rftp_active2_top {
+ border-bottom: 0px;
+ font-weight: bold;
+ padding: 3px 0px 0px 0px;
+ vertical-align: top;
+ background: url(acttab2_bg.gif) top repeat-x #FFFFFF;
+ }
+
+ .rftp_toptab_tabline_vis {
+ border: 1px solid #a6a6a6;
+ background: url(tabline_bg.gif) top repeat-x #EEF4FB;
+ border-bottom: 0px;
+ padding-top: 2px;
+ overflow: hidden;
+ height: 23px;
+ white-space: nowrap;
+ position: relative;
+ }
+
+ .rftp_toptab_tabline_dis {
+ border-bottom: 0px;
+ padding-top: 2px;
+ overflow: hidden;
+ height: 25px;
+ white-space: nowrap;
+ position: relative;
+ }
+
+ .rftp_toptab_tabs {
+ display: table;
+ border: 0px;
+ width: 100%;
+ height: 100%;
+ }
+
+ .rftp_toptab_spacer {
+ display: table-cell;
+ border-bottom: 1px solid #A6A6A6;
+ }
+
+ .rftp_horizonttab_tabspacer_width {
+ padding-left: 1px;
+ }
+
+ .rftp_icon {
+ display: table-cell;
+ vertical-align: middle;
+ padding: 0px 5px 0px 5px;
+ }
+
+ .rftp_close {
+ display: table-cell;
+ vertical-align: middle;
+ padding: 0px 3px 0px 15px;
+ }
+
+ .rftp_label {
+ display: table-cell;
+ vertical-align: middle;
+ font-family: verdana;
+ font-size: 11px;
+ }
+
+ .rftp_toptab_scroll_left {
+ background: url(acttab_bg.gif) top repeat-x #C9DBEF;
+ position: absolute;
+ top: 1px;
+ left: 1px;
+ width: 15px;
+ height: 250px;
+ border: 1px solid #a6a6a6;
+ font-weight: bold;
+ text-align: center;
+ font-family: verdana;
+ font-size: 11px;
+ padding-top: 6px;
+ }
+
+ .rftp_toptab_scroll_right {
+ background: url(acttab_bg.gif) top repeat-x #C9DBEF;
+ position: absolute;
+ top: 1px;
+ right: 17px;
+ width: 15px;
+ height: 250px;
+ border: 1px solid #a6a6a6;
+ font-weight: bold;
+ text-align: center;
+ font-family: verdana;
+ font-size: 11px;
+ padding-top: 6px;
+ }
+
+ .rftp_toptab_tabslist {
+ background: url(acttab_bg.gif) top repeat-x #C9DBEF;
+ position: absolute;
+ top: 1px;
+ right: 1px;
+ width: 15px;
+ height: 250px;
+ border: 1px solid #a6a6a6;
+ font-weight: bold;
+ text-align: center;
+ font-family: verdana;
+ font-size: 14px;
+ padding-top: 2px;
+ }
+
+ .rftp_toptab_border {
+ border: 1px solid #A6A6A6;
+ border-top: 0px;
+ height: 2px;
+ background: #C9DBEF;
+ }
+
+ .rftp_toptab_content {
+ border: 1px solid #A6A6A6;
+ border-top: 0px;
+ font-family: verdana;
+ font-size: 11px;
+ padding: 10px;
+ background: #ffffff;
+ }
+
+ .rftp_hidden {
+ display: none
+ }
+ </style>
+
</h:head>
<h:body>
+
+
<ui:insert name="scripts" ></ui:insert>
<table width="100%">
<thead>
@@ -46,6 +198,12 @@
<li><h:commandLink value="accordion" action="accordion" /></li>
</ul>
</li>
+ <li>
+ <p>Collapsible Panel</p>
+ <ul>
+ <li><h:commandLink value="Collapsible Panel" action="collapsiblePanel" /></li>
+ </ul>
+ </li>
</ul>
<p>QUnit</p>
<ul>
@@ -53,6 +211,7 @@
<li><h:commandLink value="togglePanelItem" action="qunit/togglePanelItem" /></li>
<li><h:commandLink value="accordion" action="qunit/accordion" /></li>
<li><h:commandLink value="accordionHeaders" action="qunit/accordionHeaders" /></li>
+ <li><h:commandLink value="collapsiblePanel" action="qunit/collapsiblePanel" /></li>
</ul>
</h:form>
</td>
Modified: branches/RF-7944/examples/repeater-demo/pom.xml
===================================================================
--- branches/RF-7944/examples/repeater-demo/pom.xml 2010-09-03 12:00:31 UTC (rev 19109)
+++ branches/RF-7944/examples/repeater-demo/pom.xml 2010-09-03 12:51:59 UTC (rev 19110)
@@ -40,22 +40,6 @@
<dependencyManagement>
<dependencies>
- <!--
- simple logger binding: only messages of level INFO and
- higher are printed
- -->
- <dependency>
- <groupId>org.slf4j</groupId>
- <artifactId>slf4j-simple</artifactId>
- <version>1.5.8</version>
- </dependency>
-
- <!-- Log4J dependency used in examples -->
- <dependency>
- <groupId>log4j</groupId>
- <artifactId>log4j</artifactId>
- <version>1.2.14</version>
- </dependency>
</dependencies>
</dependencyManagement>
Modified: branches/RF-7944/examples/richfaces-showcase/pom.xml
===================================================================
--- branches/RF-7944/examples/richfaces-showcase/pom.xml 2010-09-03 12:00:31 UTC (rev 19109)
+++ branches/RF-7944/examples/richfaces-showcase/pom.xml 2010-09-03 12:51:59 UTC (rev 19110)
@@ -54,22 +54,6 @@
<artifactId>ehcache</artifactId>
</dependency>
- <!--
- simple logger binding: only messages of level INFO and
- higher are printed
- -->
- <dependency>
- <groupId>org.slf4j</groupId>
- <artifactId>slf4j-log4j12</artifactId>
- <version>1.5.8</version>
- </dependency>
-
- <!-- Log4J dependency used in examples -->
- <dependency>
- <groupId>log4j</groupId>
- <artifactId>log4j</artifactId>
- <version>1.2.14</version>
- </dependency>
</dependencies>
<build>
Deleted: branches/RF-7944/examples/richfaces-showcase/src/main/resources/log4j.properties
===================================================================
--- branches/RF-7944/examples/richfaces-showcase/src/main/resources/log4j.properties 2010-09-03 12:00:31 UTC (rev 19109)
+++ branches/RF-7944/examples/richfaces-showcase/src/main/resources/log4j.properties 2010-09-03 12:51:59 UTC (rev 19110)
@@ -1,24 +0,0 @@
-# A default log4j configuration for log4j users.
-#
-# To use this configuration, deploy it into your application's WEB-INF/classes
-# directory. You are also encouraged to edit it as you like.
-
-# Configure the console as our one appender
-log4j.appender.A1=org.apache.log4j.ConsoleAppender
-log4j.appender.A1.layout=org.apache.log4j.PatternLayout
-log4j.appender.A1.layout.ConversionPattern=%d{HH:mm:ss,SSS} %-5p [%c] - %m%n
-
-# tighten logging on the DataNucleus Categories
-log4j.category.DataNucleus.JDO=WARN, A1
-log4j.category.DataNucleus.Persistence=WARN, A1
-log4j.category.DataNucleus.Cache=WARN, A1
-log4j.category.DataNucleus.MetaData=WARN, A1
-log4j.category.DataNucleus.General=WARN, A1
-log4j.category.DataNucleus.Utility=WARN, A1
-log4j.category.DataNucleus.Transaction=WARN, A1
-log4j.category.DataNucleus.Datastore=WARN, A1
-log4j.category.DataNucleus.ClassLoading=WARN, A1
-log4j.category.DataNucleus.Plugin=WARN, A1
-log4j.category.DataNucleus.ValueGeneration=WARN, A1
-log4j.category.DataNucleus.Enhancer=WARN, A1
-log4j.category.DataNucleus.SchemaTool=WARN, A1
Deleted: branches/RF-7944/examples/richfaces-showcase/src/main/resources/log4j.xml
===================================================================
--- branches/RF-7944/examples/richfaces-showcase/src/main/resources/log4j.xml 2010-09-03 12:00:31 UTC (rev 19109)
+++ branches/RF-7944/examples/richfaces-showcase/src/main/resources/log4j.xml 2010-09-03 12:51:59 UTC (rev 19110)
@@ -1,16 +0,0 @@
-<?xml version="1.0" encoding="UTF-8" ?>
-<!DOCTYPE log4j:configuration SYSTEM "log4j.dtd">
-
-<log4j:configuration xmlns:log4j="http://jakarta.apache.org/log4j/">
- <appender name="console" class="org.apache.log4j.ConsoleAppender">
- <param name="Target" value="System.out" />
- <layout class="org.apache.log4j.PatternLayout">
- <param name="ConversionPattern" value="%d %-5p [%c] %m%n" />
- </layout>
- </appender>
- <root>
- <priority value="info" />
- <appender-ref ref="console" />
- </root>
-
-</log4j:configuration>
\ No newline at end of file
Modified: branches/RF-7944/examples/richfaces-showcase/src/main/webapp/richfaces/accordion/samples/simple-sample.xhtml
===================================================================
--- branches/RF-7944/examples/richfaces-showcase/src/main/webapp/richfaces/accordion/samples/simple-sample.xhtml 2010-09-03 12:00:31 UTC (rev 19109)
+++ branches/RF-7944/examples/richfaces-showcase/src/main/webapp/richfaces/accordion/samples/simple-sample.xhtml 2010-09-03 12:51:59 UTC (rev 19110)
@@ -9,7 +9,7 @@
.rf-ac{
width: 500px;
}
-.rf-aci-c {
+.rf-ac-itm-c {
height: 220px;
}
</style>
Modified: branches/RF-7944/examples/richfaces-showcase/src/main/webapp/richfaces/togglePanel/samples/simple-sample.xhtml
===================================================================
--- branches/RF-7944/examples/richfaces-showcase/src/main/webapp/richfaces/togglePanel/samples/simple-sample.xhtml 2010-09-03 12:00:31 UTC (rev 19109)
+++ branches/RF-7944/examples/richfaces-showcase/src/main/webapp/richfaces/togglePanel/samples/simple-sample.xhtml 2010-09-03 12:51:59 UTC (rev 19110)
@@ -6,7 +6,7 @@
xmlns:a4j="http://richfaces.org/a4j"
xmlns:rich="http://richfaces.org/rich">
<style>
-.rf-tgp-i {
+.rf-tgp-itm {
border: 1px solid #{richSkin.panelBorderColor};
padding:5px;
}
Copied: branches/RF-7944/ui/common/ui/src/main/java/org/richfaces/event (from rev 19108, trunk/ui/common/ui/src/main/java/org/richfaces/event)
Deleted: branches/RF-7944/ui/common/ui/src/main/java/org/richfaces/event/MethodExpressionEventListener.java
===================================================================
--- trunk/ui/common/ui/src/main/java/org/richfaces/event/MethodExpressionEventListener.java 2010-09-03 08:56:24 UTC (rev 19108)
+++ branches/RF-7944/ui/common/ui/src/main/java/org/richfaces/event/MethodExpressionEventListener.java 2010-09-03 12:51:59 UTC (rev 19110)
@@ -1,197 +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.component.UIComponentBase;
-import javax.faces.context.FacesContext;
-import javax.faces.event.AbortProcessingException;
-import javax.faces.event.FacesEvent;
-import javax.faces.event.FacesListener;
-
-/**
- * <p><strong><span
- * class="changed_modified_2_0">MethodExpressionEventListener</span></strong>
- * is a {@link FacesListener} that wraps a {@link
- * MethodExpression}. When it receives a {@link FacesEvent}, it
- * executes a method on an object identified by the {@link
- * MethodExpression}.</p>
- *
- * @author akolonitsky
- * @version 1.0
- *
- */
-public abstract class MethodExpressionEventListener implements FacesListener, StateHolder {
-
- private static final Class<?>[] EVENT_LISTENER_ZERO_ARG_SIG = new Class[] { };
-
- private static final Object[] NO_PARAMS = new Object[0];
-
- // ------------------------------------------------------ Instance Variables
-
- private MethodExpression methodExpressionOneArg = null;
- private MethodExpression methodExpressionZeroArg = null;
-
- private boolean isTransient;
-
- protected MethodExpressionEventListener() {
- }
-
- /**
- * <p><span class="changed_modified_2_0">Construct</span> a {@link
- * FacesListener} that contains a {@link
- * MethodExpression}.<span
- * class="changed_added_2_0">To accomodate method expression targets
- * that take no arguments instead of taking a {@link
- * FacesEvent} argument</span>, the implementation of this
- * class must take the argument <code>methodExpressionOneArg</code>,
- * extract its expression string, and create another
- * <code>MethodExpression</code> whose expected param types match
- * those of a zero argument method. The usage requirements for both
- * of these <code>MethodExpression</code> instances are described in
- * {@link #processEvent}.</span></p>
- *
- * @param methodExpressionOneArg a <code>MethodExpression</code>
- * that points to a method that returns <code>void</code> and takes
- * a single argument of type {@link FacesEvent}.
- */
- protected MethodExpressionEventListener(MethodExpression methodExpressionOneArg) {
-
- super();
- this.methodExpressionOneArg = methodExpressionOneArg;
- FacesContext context = FacesContext.getCurrentInstance();
- ELContext elContext = context.getELContext();
- this.methodExpressionZeroArg = context.getApplication().getExpressionFactory().createMethodExpression(
- elContext, methodExpressionOneArg.getExpressionString(), Void.class, EVENT_LISTENER_ZERO_ARG_SIG);
- }
-
- /**
- * <p>Construct a {@link FacesListener} that contains a {@link MethodExpression}.</p>
- *
- * @param methodExprOneArg
- * @param methodExprZeroArg
- */
- protected MethodExpressionEventListener(MethodExpression methodExprOneArg, MethodExpression methodExprZeroArg) {
-
- super();
- this.methodExpressionOneArg = methodExprOneArg;
- this.methodExpressionZeroArg = methodExprZeroArg;
- }
-
- // ------------------------------------------------------- Event Method
-
- /**
- * <p><span class="changed_modified_2_0">Call</span> through to the
- * {@link MethodExpression} passed in our constructor. <span
- * class="changed_added_2_0">First, try to invoke the
- * <code>MethodExpression</code> passed to the constructor of this
- * instance, passing the argument {@link FacesEvent} as the
- * argument. If a {@link MethodNotFoundException} is thrown, call
- * to the zero argument <code>MethodExpression</code> derived from
- * the <code>MethodExpression</code> passed to the constructor of
- * this instance. If that fails for any reason, throw an {@link
- * AbortProcessingException}, including the cause of the
- * failure.</span></p>
- *
- * @throws NullPointerException {@inheritDoc}
- * @throws AbortProcessingException {@inheritDoc}
- */
- public void processEvent(FacesEvent event) throws AbortProcessingException {
-
- if (event == null) {
- throw new NullPointerException();
- }
- FacesContext context = FacesContext.getCurrentInstance();
- ELContext elContext = context.getELContext();
- // PENDING: The corresponding code in MethodExpressionActionListener
- // has an elaborate message capture, logging, and rethrowing block.
- // Why not here?
- try {
- methodExpressionOneArg.invoke(elContext, new Object[] {event});
- } catch (MethodNotFoundException mnf) {
- if (null != methodExpressionZeroArg) {
-
- try {
- // try to invoke a no-arg version
- methodExpressionZeroArg.invoke(elContext, NO_PARAMS);
- } catch (ELException e) {
- throw new AbortProcessingException(e.getMessage(), e.getCause());
- }
- }
- } catch (ELException e) {
- throw new AbortProcessingException(e.getMessage(), e.getCause());
- }
- }
-
-
- // ------------------------------------------------ Methods from StateHolder
-
-
- /**
- * <p class="changed_modified_2_0">Both {@link MethodExpression}
- * instances described in the constructor must be saved.</p>
- */
- public Object saveState(FacesContext context) {
- if (context == null) {
- throw new NullPointerException();
- }
-
- return new Object[] {
- UIComponentBase.saveAttachedState(context, methodExpressionOneArg),
- UIComponentBase.saveAttachedState(context, methodExpressionZeroArg)
- };
- }
-
-
- /**
- * <p class="changed_modified_2_0">Both {@link MethodExpression}
- * instances described in the constructor must be restored.</p>
- */
- public void restoreState(FacesContext context, Object state) {
-
- if (context == null) {
- throw new NullPointerException();
- }
- if (state == null) {
- return;
- }
-
- methodExpressionOneArg = (MethodExpression) UIComponentBase
- .restoreAttachedState(context, ((Object[]) state)[0]);
- methodExpressionZeroArg = (MethodExpression) UIComponentBase
- .restoreAttachedState(context, ((Object[]) state)[1]);
- }
-
-
- public boolean isTransient() {
- return isTransient;
- }
-
- public void setTransient(boolean newTransientValue) {
- isTransient = newTransientValue;
- }
-}
Copied: branches/RF-7944/ui/common/ui/src/main/java/org/richfaces/event/MethodExpressionEventListener.java (from rev 19108, trunk/ui/common/ui/src/main/java/org/richfaces/event/MethodExpressionEventListener.java)
===================================================================
--- branches/RF-7944/ui/common/ui/src/main/java/org/richfaces/event/MethodExpressionEventListener.java (rev 0)
+++ branches/RF-7944/ui/common/ui/src/main/java/org/richfaces/event/MethodExpressionEventListener.java 2010-09-03 12:51:59 UTC (rev 19110)
@@ -0,0 +1,197 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright ${year}, Red Hat, Inc. and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+
+package org.richfaces.event;
+
+import javax.el.ELContext;
+import javax.el.ELException;
+import javax.el.MethodExpression;
+import javax.el.MethodNotFoundException;
+import javax.faces.component.StateHolder;
+import javax.faces.component.UIComponentBase;
+import javax.faces.context.FacesContext;
+import javax.faces.event.AbortProcessingException;
+import javax.faces.event.FacesEvent;
+import javax.faces.event.FacesListener;
+
+/**
+ * <p><strong><span
+ * class="changed_modified_2_0">MethodExpressionEventListener</span></strong>
+ * is a {@link FacesListener} that wraps a {@link
+ * MethodExpression}. When it receives a {@link FacesEvent}, it
+ * executes a method on an object identified by the {@link
+ * MethodExpression}.</p>
+ *
+ * @author akolonitsky
+ * @version 1.0
+ *
+ */
+public abstract class MethodExpressionEventListener implements FacesListener, StateHolder {
+
+ private static final Class<?>[] EVENT_LISTENER_ZERO_ARG_SIG = new Class[] { };
+
+ private static final Object[] NO_PARAMS = new Object[0];
+
+ // ------------------------------------------------------ Instance Variables
+
+ private MethodExpression methodExpressionOneArg = null;
+ private MethodExpression methodExpressionZeroArg = null;
+
+ private boolean isTransient;
+
+ protected MethodExpressionEventListener() {
+ }
+
+ /**
+ * <p><span class="changed_modified_2_0">Construct</span> a {@link
+ * FacesListener} that contains a {@link
+ * MethodExpression}.<span
+ * class="changed_added_2_0">To accomodate method expression targets
+ * that take no arguments instead of taking a {@link
+ * FacesEvent} argument</span>, the implementation of this
+ * class must take the argument <code>methodExpressionOneArg</code>,
+ * extract its expression string, and create another
+ * <code>MethodExpression</code> whose expected param types match
+ * those of a zero argument method. The usage requirements for both
+ * of these <code>MethodExpression</code> instances are described in
+ * {@link #processEvent}.</span></p>
+ *
+ * @param methodExpressionOneArg a <code>MethodExpression</code>
+ * that points to a method that returns <code>void</code> and takes
+ * a single argument of type {@link FacesEvent}.
+ */
+ protected MethodExpressionEventListener(MethodExpression methodExpressionOneArg) {
+
+ super();
+ this.methodExpressionOneArg = methodExpressionOneArg;
+ FacesContext context = FacesContext.getCurrentInstance();
+ ELContext elContext = context.getELContext();
+ this.methodExpressionZeroArg = context.getApplication().getExpressionFactory().createMethodExpression(
+ elContext, methodExpressionOneArg.getExpressionString(), Void.class, EVENT_LISTENER_ZERO_ARG_SIG);
+ }
+
+ /**
+ * <p>Construct a {@link FacesListener} that contains a {@link MethodExpression}.</p>
+ *
+ * @param methodExprOneArg
+ * @param methodExprZeroArg
+ */
+ protected MethodExpressionEventListener(MethodExpression methodExprOneArg, MethodExpression methodExprZeroArg) {
+
+ super();
+ this.methodExpressionOneArg = methodExprOneArg;
+ this.methodExpressionZeroArg = methodExprZeroArg;
+ }
+
+ // ------------------------------------------------------- Event Method
+
+ /**
+ * <p><span class="changed_modified_2_0">Call</span> through to the
+ * {@link MethodExpression} passed in our constructor. <span
+ * class="changed_added_2_0">First, try to invoke the
+ * <code>MethodExpression</code> passed to the constructor of this
+ * instance, passing the argument {@link FacesEvent} as the
+ * argument. If a {@link MethodNotFoundException} is thrown, call
+ * to the zero argument <code>MethodExpression</code> derived from
+ * the <code>MethodExpression</code> passed to the constructor of
+ * this instance. If that fails for any reason, throw an {@link
+ * AbortProcessingException}, including the cause of the
+ * failure.</span></p>
+ *
+ * @throws NullPointerException {@inheritDoc}
+ * @throws AbortProcessingException {@inheritDoc}
+ */
+ public void processEvent(FacesEvent event) throws AbortProcessingException {
+
+ if (event == null) {
+ throw new NullPointerException();
+ }
+ FacesContext context = FacesContext.getCurrentInstance();
+ ELContext elContext = context.getELContext();
+ // PENDING: The corresponding code in MethodExpressionActionListener
+ // has an elaborate message capture, logging, and rethrowing block.
+ // Why not here?
+ try {
+ methodExpressionOneArg.invoke(elContext, new Object[] {event});
+ } catch (MethodNotFoundException mnf) {
+ if (null != methodExpressionZeroArg) {
+
+ try {
+ // try to invoke a no-arg version
+ methodExpressionZeroArg.invoke(elContext, NO_PARAMS);
+ } catch (ELException e) {
+ throw new AbortProcessingException(e.getMessage(), e.getCause());
+ }
+ }
+ } catch (ELException e) {
+ throw new AbortProcessingException(e.getMessage(), e.getCause());
+ }
+ }
+
+
+ // ------------------------------------------------ Methods from StateHolder
+
+
+ /**
+ * <p class="changed_modified_2_0">Both {@link MethodExpression}
+ * instances described in the constructor must be saved.</p>
+ */
+ public Object saveState(FacesContext context) {
+ if (context == null) {
+ throw new NullPointerException();
+ }
+
+ return new Object[] {
+ UIComponentBase.saveAttachedState(context, methodExpressionOneArg),
+ UIComponentBase.saveAttachedState(context, methodExpressionZeroArg)
+ };
+ }
+
+
+ /**
+ * <p class="changed_modified_2_0">Both {@link MethodExpression}
+ * instances described in the constructor must be restored.</p>
+ */
+ public void restoreState(FacesContext context, Object state) {
+
+ if (context == null) {
+ throw new NullPointerException();
+ }
+ if (state == null) {
+ return;
+ }
+
+ methodExpressionOneArg = (MethodExpression) UIComponentBase
+ .restoreAttachedState(context, ((Object[]) state)[0]);
+ methodExpressionZeroArg = (MethodExpression) UIComponentBase
+ .restoreAttachedState(context, ((Object[]) state)[1]);
+ }
+
+
+ public boolean isTransient() {
+ return isTransient;
+ }
+
+ public void setTransient(boolean newTransientValue) {
+ isTransient = newTransientValue;
+ }
+}
Copied: branches/RF-7944/ui/common/ui/src/main/java/org/richfaces/view (from rev 19108, trunk/ui/common/ui/src/main/java/org/richfaces/view)
Copied: branches/RF-7944/ui/common/ui/src/main/java/org/richfaces/view/facelets (from rev 19108, trunk/ui/common/ui/src/main/java/org/richfaces/view/facelets)
Copied: branches/RF-7944/ui/common/ui/src/main/java/org/richfaces/view/facelets/html (from rev 19108, trunk/ui/common/ui/src/main/java/org/richfaces/view/facelets/html)
Deleted: branches/RF-7944/ui/common/ui/src/main/java/org/richfaces/view/facelets/html/EventListenerHandler.java
===================================================================
--- trunk/ui/common/ui/src/main/java/org/richfaces/view/facelets/html/EventListenerHandler.java 2010-09-03 08:56:24 UTC (rev 19108)
+++ branches/RF-7944/ui/common/ui/src/main/java/org/richfaces/view/facelets/html/EventListenerHandler.java 2010-09-03 12:51:59 UTC (rev 19110)
@@ -1,145 +0,0 @@
-/**
- * License Agreement.
- *
- * Rich Faces - Natural Ajax for Java Server Faces (JSF)
- *
- * Copyright (C) 2007 Exadel, Inc.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License version 2.1 as published by the Free Software Foundation.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-package org.richfaces.view.facelets.html;
-
-import javax.el.ValueExpression;
-import javax.faces.component.UIComponent;
-import javax.faces.context.FacesContext;
-import javax.faces.event.AbortProcessingException;
-import javax.faces.event.FacesEvent;
-import javax.faces.event.FacesListener;
-import javax.faces.view.EditableValueHolderAttachedObjectHandler;
-import javax.faces.view.facelets.ComponentHandler;
-import javax.faces.view.facelets.FaceletContext;
-import javax.faces.view.facelets.TagAttribute;
-import javax.faces.view.facelets.TagAttributeException;
-import javax.faces.view.facelets.TagConfig;
-import javax.faces.view.facelets.TagException;
-import javax.faces.view.facelets.TagHandler;
-import java.io.IOException;
-import java.io.Serializable;
-
-/**
- * @author akolonitsky
- * @since Aug 31, 2010
- */
-public abstract class EventListenerHandler extends TagHandler implements EditableValueHolderAttachedObjectHandler {
-
- protected final TagAttribute binding;
-
- protected final String listenerType;
-
- public abstract static class LazyEventListener<L extends FacesListener> implements FacesListener, Serializable {
-
- private static final long serialVersionUID = 1L;
-
- protected final String type;
-
- protected final ValueExpression binding;
-
- protected LazyEventListener(String type, ValueExpression binding) {
- this.type = type;
- this.binding = binding;
- }
-
- public void processEvent(FacesEvent event) throws AbortProcessingException {
-
- FacesContext faces = FacesContext.getCurrentInstance();
- if (faces == null) {
- return;
- }
-
- L instance = null;
- if (this.binding != null) {
- instance = (L) binding.getValue(faces.getELContext());
- }
- if (instance == null && this.type != null) {
- try {
- instance = (L) forName(this.type).newInstance();
- } catch (Exception e) {
- throw new AbortProcessingException("Couldn't Lazily instantiate EventListener", e);
- }
- if (this.binding != null) {
- binding.setValue(faces.getELContext(), instance);
- }
- }
-
- if (instance != null) {
- event.processListener(instance);
- }
- }
- }
-
- public EventListenerHandler(TagConfig config) {
- super(config);
- this.binding = this.getAttribute("binding");
- TagAttribute type = this.getAttribute("type");
- if (type != null) {
- if (type.isLiteral()) {
- try {
- forName(type.getValue());
- } catch (ClassNotFoundException e) {
- throw new TagAttributeException(type, "Couldn't qualify EventListener", e);
- }
- } else {
- throw new TagAttributeException(type, "Must be a literal class name of type EventListener");
- }
- this.listenerType = type.getValue();
- } else {
- this.listenerType = null;
- }
- }
-
- public void apply(FaceletContext ctx, UIComponent parent) throws IOException {
-
- // only process if it's been created
- if (parent == null || !ComponentHandler.isNew(parent)) {
- return;
- }
-
- if (isEventSource(parent)) {
- applyAttachedObject(ctx.getFacesContext(), parent);
- } else if (UIComponent.isCompositeComponent(parent)) {
- // Allow the composite component to know about the target component.
- TagHandlerUtils.getOrCreateRetargetableHandlersList(parent).add(this);
- } else {
- throw new TagException(this.tag, "Parent is not of type EditableValueHolder, type is: " + parent);
- }
- }
-
- public String getFor() {
- TagAttribute attr = this.getAttribute("for");
- return attr == null ? null : attr.getValue();
- }
-
- public static Class<?> forName(String name) throws ClassNotFoundException {
- if (null == name || "".equals(name)) {
- return null;
- }
-
- return Class.forName(name, false, Thread.currentThread().getContextClassLoader());
- }
-
- public abstract boolean isEventSource(UIComponent comp);
-}
-
-
Copied: branches/RF-7944/ui/common/ui/src/main/java/org/richfaces/view/facelets/html/EventListenerHandler.java (from rev 19108, trunk/ui/common/ui/src/main/java/org/richfaces/view/facelets/html/EventListenerHandler.java)
===================================================================
--- branches/RF-7944/ui/common/ui/src/main/java/org/richfaces/view/facelets/html/EventListenerHandler.java (rev 0)
+++ branches/RF-7944/ui/common/ui/src/main/java/org/richfaces/view/facelets/html/EventListenerHandler.java 2010-09-03 12:51:59 UTC (rev 19110)
@@ -0,0 +1,145 @@
+/**
+ * License Agreement.
+ *
+ * Rich Faces - Natural Ajax for Java Server Faces (JSF)
+ *
+ * Copyright (C) 2007 Exadel, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1 as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+package org.richfaces.view.facelets.html;
+
+import javax.el.ValueExpression;
+import javax.faces.component.UIComponent;
+import javax.faces.context.FacesContext;
+import javax.faces.event.AbortProcessingException;
+import javax.faces.event.FacesEvent;
+import javax.faces.event.FacesListener;
+import javax.faces.view.EditableValueHolderAttachedObjectHandler;
+import javax.faces.view.facelets.ComponentHandler;
+import javax.faces.view.facelets.FaceletContext;
+import javax.faces.view.facelets.TagAttribute;
+import javax.faces.view.facelets.TagAttributeException;
+import javax.faces.view.facelets.TagConfig;
+import javax.faces.view.facelets.TagException;
+import javax.faces.view.facelets.TagHandler;
+import java.io.IOException;
+import java.io.Serializable;
+
+/**
+ * @author akolonitsky
+ * @since Aug 31, 2010
+ */
+public abstract class EventListenerHandler extends TagHandler implements EditableValueHolderAttachedObjectHandler {
+
+ protected final TagAttribute binding;
+
+ protected final String listenerType;
+
+ public abstract static class LazyEventListener<L extends FacesListener> implements FacesListener, Serializable {
+
+ private static final long serialVersionUID = 1L;
+
+ protected final String type;
+
+ protected final ValueExpression binding;
+
+ protected LazyEventListener(String type, ValueExpression binding) {
+ this.type = type;
+ this.binding = binding;
+ }
+
+ public void processEvent(FacesEvent event) throws AbortProcessingException {
+
+ FacesContext faces = FacesContext.getCurrentInstance();
+ if (faces == null) {
+ return;
+ }
+
+ L instance = null;
+ if (this.binding != null) {
+ instance = (L) binding.getValue(faces.getELContext());
+ }
+ if (instance == null && this.type != null) {
+ try {
+ instance = (L) forName(this.type).newInstance();
+ } catch (Exception e) {
+ throw new AbortProcessingException("Couldn't Lazily instantiate EventListener", e);
+ }
+ if (this.binding != null) {
+ binding.setValue(faces.getELContext(), instance);
+ }
+ }
+
+ if (instance != null) {
+ event.processListener(instance);
+ }
+ }
+ }
+
+ public EventListenerHandler(TagConfig config) {
+ super(config);
+ this.binding = this.getAttribute("binding");
+ TagAttribute type = this.getAttribute("type");
+ if (type != null) {
+ if (type.isLiteral()) {
+ try {
+ forName(type.getValue());
+ } catch (ClassNotFoundException e) {
+ throw new TagAttributeException(type, "Couldn't qualify EventListener", e);
+ }
+ } else {
+ throw new TagAttributeException(type, "Must be a literal class name of type EventListener");
+ }
+ this.listenerType = type.getValue();
+ } else {
+ this.listenerType = null;
+ }
+ }
+
+ public void apply(FaceletContext ctx, UIComponent parent) throws IOException {
+
+ // only process if it's been created
+ if (parent == null || !ComponentHandler.isNew(parent)) {
+ return;
+ }
+
+ if (isEventSource(parent)) {
+ applyAttachedObject(ctx.getFacesContext(), parent);
+ } else if (UIComponent.isCompositeComponent(parent)) {
+ // Allow the composite component to know about the target component.
+ TagHandlerUtils.getOrCreateRetargetableHandlersList(parent).add(this);
+ } else {
+ throw new TagException(this.tag, "Parent is not of type EditableValueHolder, type is: " + parent);
+ }
+ }
+
+ public String getFor() {
+ TagAttribute attr = this.getAttribute("for");
+ return attr == null ? null : attr.getValue();
+ }
+
+ public static Class<?> forName(String name) throws ClassNotFoundException {
+ if (null == name || "".equals(name)) {
+ return null;
+ }
+
+ return Class.forName(name, false, Thread.currentThread().getContextClassLoader());
+ }
+
+ public abstract boolean isEventSource(UIComponent comp);
+}
+
+
Deleted: branches/RF-7944/ui/common/ui/src/main/java/org/richfaces/view/facelets/html/TagHandlerUtils.java
===================================================================
--- trunk/ui/common/ui/src/main/java/org/richfaces/view/facelets/html/TagHandlerUtils.java 2010-09-03 08:56:24 UTC (rev 19108)
+++ branches/RF-7944/ui/common/ui/src/main/java/org/richfaces/view/facelets/html/TagHandlerUtils.java 2010-09-03 12:51:59 UTC (rev 19110)
@@ -1,67 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2010, Red Hat, Inc. and individual contributors
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.richfaces.view.facelets.html;
-
-import java.util.ArrayList;
-import java.util.List;
-import java.util.Map;
-
-import javax.faces.component.UIComponent;
-import javax.faces.view.AttachedObjectHandler;
-
-/**
- * @author Nick Belaevski
- *
- */
-final class TagHandlerUtils {
-
- // TODO - is that implementation dependency?
- private static final String JAVAX_FACES_RETARGETABLE_HANDLERS = "javax.faces.RetargetableHandlers";
-
- private TagHandlerUtils() {
- //utility class constructor
- }
-
- static List<AttachedObjectHandler> getOrCreateRetargetableHandlersList(UIComponent component) {
- Map<String, Object> attrs = component.getAttributes();
- @SuppressWarnings({
- "unchecked"}) List<AttachedObjectHandler> list =
- (List<AttachedObjectHandler>) attrs.get(JAVAX_FACES_RETARGETABLE_HANDLERS);
-
- if (list == null) {
- list = new ArrayList<AttachedObjectHandler>();
- attrs.put(JAVAX_FACES_RETARGETABLE_HANDLERS, list);
- }
-
- return list;
- }
-
- static <T> Class<? extends T> loadClass(String className, Class<T> type)
- throws ClassNotFoundException, ClassCastException {
-
- ClassLoader ccl = Thread.currentThread().getContextClassLoader();
- Class<?> loadedClass = Class.forName(className, false, ccl);
-
- return loadedClass.asSubclass(type);
- }
-
-}
Copied: branches/RF-7944/ui/common/ui/src/main/java/org/richfaces/view/facelets/html/TagHandlerUtils.java (from rev 19108, trunk/ui/common/ui/src/main/java/org/richfaces/view/facelets/html/TagHandlerUtils.java)
===================================================================
--- branches/RF-7944/ui/common/ui/src/main/java/org/richfaces/view/facelets/html/TagHandlerUtils.java (rev 0)
+++ branches/RF-7944/ui/common/ui/src/main/java/org/richfaces/view/facelets/html/TagHandlerUtils.java 2010-09-03 12:51:59 UTC (rev 19110)
@@ -0,0 +1,67 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc. and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.richfaces.view.facelets.html;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Map;
+
+import javax.faces.component.UIComponent;
+import javax.faces.view.AttachedObjectHandler;
+
+/**
+ * @author Nick Belaevski
+ *
+ */
+final class TagHandlerUtils {
+
+ // TODO - is that implementation dependency?
+ private static final String JAVAX_FACES_RETARGETABLE_HANDLERS = "javax.faces.RetargetableHandlers";
+
+ private TagHandlerUtils() {
+ //utility class constructor
+ }
+
+ static List<AttachedObjectHandler> getOrCreateRetargetableHandlersList(UIComponent component) {
+ Map<String, Object> attrs = component.getAttributes();
+ @SuppressWarnings({
+ "unchecked"}) List<AttachedObjectHandler> list =
+ (List<AttachedObjectHandler>) attrs.get(JAVAX_FACES_RETARGETABLE_HANDLERS);
+
+ if (list == null) {
+ list = new ArrayList<AttachedObjectHandler>();
+ attrs.put(JAVAX_FACES_RETARGETABLE_HANDLERS, list);
+ }
+
+ return list;
+ }
+
+ static <T> Class<? extends T> loadClass(String className, Class<T> type)
+ throws ClassNotFoundException, ClassCastException {
+
+ ClassLoader ccl = Thread.currentThread().getContextClassLoader();
+ Class<?> loadedClass = Class.forName(className, false, ccl);
+
+ return loadedClass.asSubclass(type);
+ }
+
+}
Modified: branches/RF-7944/ui/core/ui/src/main/java/org/richfaces/component/QueueRegistry.java
===================================================================
--- branches/RF-7944/ui/core/ui/src/main/java/org/richfaces/component/QueueRegistry.java 2010-09-03 12:00:31 UTC (rev 19109)
+++ branches/RF-7944/ui/core/ui/src/main/java/org/richfaces/component/QueueRegistry.java 2010-09-03 12:51:59 UTC (rev 19110)
@@ -29,7 +29,7 @@
import javax.faces.context.FacesContext;
import org.richfaces.log.RichfacesLogger;
-import org.slf4j.Logger;
+import org.richfaces.log.Logger;
/**
* @author Nick Belaevski
Modified: branches/RF-7944/ui/core/ui/src/main/java/org/richfaces/renderkit/AjaxCommandRendererBase.java
===================================================================
--- branches/RF-7944/ui/core/ui/src/main/java/org/richfaces/renderkit/AjaxCommandRendererBase.java 2010-09-03 12:00:31 UTC (rev 19109)
+++ branches/RF-7944/ui/core/ui/src/main/java/org/richfaces/renderkit/AjaxCommandRendererBase.java 2010-09-03 12:51:59 UTC (rev 19110)
@@ -34,7 +34,7 @@
import org.ajax4jsf.renderkit.HandlersChain;
import org.ajax4jsf.renderkit.RendererBase;
import org.richfaces.log.RichfacesLogger;
-import org.slf4j.Logger;
+import org.richfaces.log.Logger;
/**
* @author asmirnov(a)exadel.com (latest modification by $Author: alexsmirnov $)
Modified: branches/RF-7944/ui/core/ui/src/main/java/org/richfaces/renderkit/html/QueueRendererBase.java
===================================================================
--- branches/RF-7944/ui/core/ui/src/main/java/org/richfaces/renderkit/html/QueueRendererBase.java 2010-09-03 12:00:31 UTC (rev 19109)
+++ branches/RF-7944/ui/core/ui/src/main/java/org/richfaces/renderkit/html/QueueRendererBase.java 2010-09-03 12:51:59 UTC (rev 19110)
@@ -36,9 +36,10 @@
import org.ajax4jsf.context.ContextInitParameters;
import org.richfaces.component.QueueRegistry;
+import org.richfaces.log.Logger;
import org.richfaces.log.RichfacesLogger;
-import org.slf4j.Logger;
+
/**
* @author Nick Belaevski Base class for rendering Queue
*/
Modified: branches/RF-7944/ui/core/ui/src/main/java/org/richfaces/view/facelets/html/BehaviorsTagHandlerDelegateFactoryImpl.java
===================================================================
--- branches/RF-7944/ui/core/ui/src/main/java/org/richfaces/view/facelets/html/BehaviorsTagHandlerDelegateFactoryImpl.java 2010-09-03 12:00:31 UTC (rev 19109)
+++ branches/RF-7944/ui/core/ui/src/main/java/org/richfaces/view/facelets/html/BehaviorsTagHandlerDelegateFactoryImpl.java 2010-09-03 12:51:59 UTC (rev 19110)
@@ -34,7 +34,7 @@
import javax.faces.view.facelets.ValidatorHandler;
import org.richfaces.log.RichfacesLogger;
-import org.slf4j.Logger;
+import org.richfaces.log.Logger;
/**
* @author Nick Belaevski
Deleted: branches/RF-7944/ui/core/ui/src/main/java/org/richfaces/view/facelets/html/TagHandlerUtils.java
===================================================================
--- branches/RF-7944/ui/core/ui/src/main/java/org/richfaces/view/facelets/html/TagHandlerUtils.java 2010-09-03 12:00:31 UTC (rev 19109)
+++ branches/RF-7944/ui/core/ui/src/main/java/org/richfaces/view/facelets/html/TagHandlerUtils.java 2010-09-03 12:51:59 UTC (rev 19110)
@@ -1,67 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2010, Red Hat, Inc. and individual contributors
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.richfaces.view.facelets.html;
-
-import java.util.ArrayList;
-import java.util.List;
-import java.util.Map;
-
-import javax.faces.component.UIComponent;
-import javax.faces.view.AttachedObjectHandler;
-
-/**
- * @author Nick Belaevski
- *
- */
-final class TagHandlerUtils {
-
- // TODO - is that implementation dependency?
- private static final String JAVAX_FACES_RETARGETABLE_HANDLERS = "javax.faces.RetargetableHandlers";
-
- private TagHandlerUtils() {
- //utility class constructor
- }
-
- static List<AttachedObjectHandler> getOrCreateRetargetableHandlersList(UIComponent component) {
- Map<String, Object> attrs = component.getAttributes();
- @SuppressWarnings({
- "unchecked"}) List<AttachedObjectHandler> list =
- (List<AttachedObjectHandler>) attrs.get(JAVAX_FACES_RETARGETABLE_HANDLERS);
-
- if (list == null) {
- list = new ArrayList<AttachedObjectHandler>();
- attrs.put(JAVAX_FACES_RETARGETABLE_HANDLERS, list);
- }
-
- return list;
- }
-
- static <T> Class<? extends T> loadClass(String className, Class<T> type)
- throws ClassNotFoundException, ClassCastException {
-
- ClassLoader ccl = Thread.currentThread().getContextClassLoader();
- Class<?> loadedClass = Class.forName(className, false, ccl);
-
- return loadedClass.asSubclass(type);
- }
-
-}
Modified: branches/RF-7944/ui/core/ui/src/main/java/org/richfaces/view/facelets/tag/BehaviorRule.java
===================================================================
--- branches/RF-7944/ui/core/ui/src/main/java/org/richfaces/view/facelets/tag/BehaviorRule.java 2010-09-03 12:00:31 UTC (rev 19109)
+++ branches/RF-7944/ui/core/ui/src/main/java/org/richfaces/view/facelets/tag/BehaviorRule.java 2010-09-03 12:51:59 UTC (rev 19110)
@@ -30,7 +30,7 @@
import org.ajax4jsf.component.behavior.ClientBehavior;
import org.richfaces.log.RichfacesLogger;
-import org.slf4j.Logger;
+import org.richfaces.log.Logger;
/**
* @author Anton Belevich
Modified: branches/RF-7944/ui/input/ui/src/main/java/org/richfaces/component/AbstractAutocomplete.java
===================================================================
--- branches/RF-7944/ui/input/ui/src/main/java/org/richfaces/component/AbstractAutocomplete.java 2010-09-03 12:00:31 UTC (rev 19109)
+++ branches/RF-7944/ui/input/ui/src/main/java/org/richfaces/component/AbstractAutocomplete.java 2010-09-03 12:51:59 UTC (rev 19110)
@@ -195,6 +195,9 @@
@Attribute(events = @EventName("beforedomupdate"))
public abstract String getOnbeforedomupdate();
+
+ @Attribute
+ public abstract String getClientFilter();
@Override
public Converter getConverter() {
Modified: branches/RF-7944/ui/input/ui/src/main/java/org/richfaces/renderkit/AutocompleteDivLayoutStrategy.java
===================================================================
--- branches/RF-7944/ui/input/ui/src/main/java/org/richfaces/renderkit/AutocompleteDivLayoutStrategy.java 2010-09-03 12:00:31 UTC (rev 19109)
+++ branches/RF-7944/ui/input/ui/src/main/java/org/richfaces/renderkit/AutocompleteDivLayoutStrategy.java 2010-09-03 12:51:59 UTC (rev 19110)
@@ -29,7 +29,6 @@
import javax.faces.context.ResponseWriter;
import org.ajax4jsf.renderkit.RendererUtils.HTML;
-import org.richfaces.component.AbstractAutocomplete;
public class AutocompleteDivLayoutStrategy extends AbstractAutocompleteLayoutStrategy implements
AutocompleteEncodeStrategy {
@@ -46,41 +45,21 @@
ResponseWriter responseWriter = facesContext.getResponseWriter();
responseWriter.startElement(HTML.DIV_ELEM, component);
responseWriter.writeAttribute(HTML.ID_ATTRIBUTE, getContainerElementId(facesContext, component), null);
- // responseWriter.writeAttribute(HTML.CLASS_ATTRIBUTE, "cb_list_ul", null);
}
public void encodeItemsContainerEnd(FacesContext facesContext, UIComponent component) throws IOException {
ResponseWriter responseWriter = facesContext.getResponseWriter();
responseWriter.endElement(HTML.DIV_ELEM);
}
-
- public void encodeItem(FacesContext facesContext, AbstractAutocomplete comboBox, Object item) throws IOException {
+
+ public void encodeItemBegin(FacesContext facesContext, UIComponent component) throws IOException {
+ ResponseWriter writer = facesContext.getResponseWriter();
+ writer.startElement(HTML.DIV_ELEM, component);
+ }
+
+ public void encodeItemEnd(FacesContext facesContext, UIComponent component) throws IOException {
ResponseWriter writer = facesContext.getResponseWriter();
-
- writer.startElement(HTML.DIV_ELEM, comboBox);
- writer.writeAttribute(HTML.CLASS_ATTRIBUTE, "rf-au-option rf-au-font rf-au-input", null);
-
- if (comboBox.getChildCount() > 0) {
- for (UIComponent child : comboBox.getChildren()) {
- child.encodeAll(facesContext);
- }
- } else {
- if (item != null) {
- // TODO nick - use converter
- String value = null;
- if (comboBox.getItemConverter() != null) {
- value = comboBox.getItemConverter().getAsString(facesContext, comboBox, item);
- }
- if (value != null) {
- writer.writeText(value, null);
- }
- writer.writeText(item, null);
- // writer.writeText(InputUtils.getConvertedValue(facesContext, comboBox, item), null);
- }
- }
-
writer.endElement(HTML.DIV_ELEM);
-
}
}
Modified: branches/RF-7944/ui/input/ui/src/main/java/org/richfaces/renderkit/AutocompleteEncodeStrategy.java
===================================================================
--- branches/RF-7944/ui/input/ui/src/main/java/org/richfaces/renderkit/AutocompleteEncodeStrategy.java 2010-09-03 12:00:31 UTC (rev 19109)
+++ branches/RF-7944/ui/input/ui/src/main/java/org/richfaces/renderkit/AutocompleteEncodeStrategy.java 2010-09-03 12:51:59 UTC (rev 19110)
@@ -5,18 +5,18 @@
import javax.faces.component.UIComponent;
import javax.faces.context.FacesContext;
-import org.richfaces.component.AbstractAutocomplete;
public interface AutocompleteEncodeStrategy {
void encodeItemsContainerBegin(FacesContext facesContext, UIComponent component) throws IOException ;
void encodeItemsContainerEnd(FacesContext facesContext, UIComponent component) throws IOException ;
+
+ void encodeItemBegin(FacesContext facesContext, UIComponent component) throws IOException ;
+
+ void encodeItemEnd(FacesContext facesContext, UIComponent component) throws IOException ;
void encodeFakeItem(FacesContext facesContext, UIComponent component) throws IOException ;
- void encodeItem(FacesContext facesContext, AbstractAutocomplete comboBox,
- Object nextItem) throws IOException;
-
- public String getContainerElementId(FacesContext facesContext, UIComponent component);
+ String getContainerElementId(FacesContext facesContext, UIComponent component);
}
Deleted: branches/RF-7944/ui/input/ui/src/main/java/org/richfaces/renderkit/AutocompleteGridLayoutStrategy.java
===================================================================
--- branches/RF-7944/ui/input/ui/src/main/java/org/richfaces/renderkit/AutocompleteGridLayoutStrategy.java 2010-09-03 12:00:31 UTC (rev 19109)
+++ branches/RF-7944/ui/input/ui/src/main/java/org/richfaces/renderkit/AutocompleteGridLayoutStrategy.java 2010-09-03 12:51:59 UTC (rev 19110)
@@ -1,34 +0,0 @@
-package org.richfaces.renderkit;
-
-import java.io.IOException;
-
-import javax.faces.component.UIComponent;
-import javax.faces.context.FacesContext;
-
-import org.richfaces.component.AbstractAutocomplete;
-
-public class AutocompleteGridLayoutStrategy extends AbstractAutocompleteLayoutStrategy implements
- AutocompleteEncodeStrategy {
-
- public void encodeFakeItem(FacesContext facesContext, UIComponent component) throws IOException {
- // TODO Auto-generated method stub
-
- }
-
- public void encodeItemsContainerBegin(FacesContext facesContext, UIComponent component) throws IOException {
- // TODO Auto-generated method stub
-
- }
-
- public void encodeItemsContainerEnd(FacesContext facesContext, UIComponent component) throws IOException {
- // TODO Auto-generated method stub
-
- }
-
- public void encodeItem(FacesContext facesContext, AbstractAutocomplete comboBox, Object nextItem)
- throws IOException {
- // TODO Auto-generated method stub
-
- }
-
-}
Modified: branches/RF-7944/ui/input/ui/src/main/java/org/richfaces/renderkit/AutocompleteListLayoutStrategy.java
===================================================================
--- branches/RF-7944/ui/input/ui/src/main/java/org/richfaces/renderkit/AutocompleteListLayoutStrategy.java 2010-09-03 12:00:31 UTC (rev 19109)
+++ branches/RF-7944/ui/input/ui/src/main/java/org/richfaces/renderkit/AutocompleteListLayoutStrategy.java 2010-09-03 12:51:59 UTC (rev 19110)
@@ -7,7 +7,6 @@
import javax.faces.context.ResponseWriter;
import org.ajax4jsf.renderkit.RendererUtils.HTML;
-import org.richfaces.component.AbstractAutocomplete;
public class AutocompleteListLayoutStrategy extends AbstractAutocompleteLayoutStrategy implements
AutocompleteEncodeStrategy {
@@ -31,33 +30,15 @@
ResponseWriter responseWriter = facesContext.getResponseWriter();
responseWriter.endElement(HTML.UL_ELEMENT);
}
-
- public void encodeItem(FacesContext facesContext, AbstractAutocomplete comboBox, Object item) throws IOException {
+
+ public void encodeItemBegin(FacesContext facesContext, UIComponent component) throws IOException {
+ ResponseWriter writer = facesContext.getResponseWriter();
+ writer.startElement(HTML.LI_ELEMENT, component);
+ }
+
+ public void encodeItemEnd(FacesContext facesContext, UIComponent component) throws IOException {
ResponseWriter writer = facesContext.getResponseWriter();
-
- writer.startElement(HTML.LI_ELEMENT, comboBox);
- writer.writeAttribute(HTML.CLASS_ATTRIBUTE, "rf-au-option rf-au-font rf-au-input", null);
-
- if (comboBox.getChildCount() > 0) {
- for (UIComponent child : comboBox.getChildren()) {
- child.encodeAll(facesContext);
- }
- } else {
- if (item != null) {
- // TODO nick - use converter
- String value = null;
- if (comboBox.getItemConverter() != null) {
- value = comboBox.getItemConverter().getAsString(facesContext, comboBox, item);
- }
- if (value != null) {
- writer.writeText(value, null);
- }
- writer.writeText(item, null);
- }
- }
-
writer.endElement(HTML.LI_ELEMENT);
-
}
}
Modified: branches/RF-7944/ui/input/ui/src/main/java/org/richfaces/renderkit/AutocompleteRendererBase.java
===================================================================
--- branches/RF-7944/ui/input/ui/src/main/java/org/richfaces/renderkit/AutocompleteRendererBase.java 2010-09-03 12:00:31 UTC (rev 19109)
+++ branches/RF-7944/ui/input/ui/src/main/java/org/richfaces/renderkit/AutocompleteRendererBase.java 2010-09-03 12:51:59 UTC (rev 19110)
@@ -37,6 +37,7 @@
import javax.faces.context.FacesContext;
import javax.faces.context.PartialResponseWriter;
import javax.faces.context.PartialViewContext;
+import javax.faces.context.ResponseWriter;
import javax.faces.model.ArrayDataModel;
import javax.faces.model.DataModel;
import javax.faces.model.ListDataModel;
@@ -45,8 +46,10 @@
import javax.servlet.jsp.jstl.sql.Result;
import org.ajax4jsf.context.AjaxContext;
+import org.ajax4jsf.javascript.JSFunctionDefinition;
import org.ajax4jsf.javascript.ScriptUtils;
import org.ajax4jsf.renderkit.RendererUtils;
+import org.ajax4jsf.renderkit.RendererUtils.HTML;
import org.ajax4jsf.util.InputUtils;
import org.richfaces.component.AbstractAutocomplete;
import org.richfaces.component.AutocompleteLayout;
@@ -70,6 +73,19 @@
})
public abstract class AutocompleteRendererBase extends InputRendererBase implements MetaComponentRenderer {
+ public JSFunctionDefinition getClientFilterFunction(UIComponent component) {
+ AbstractAutocomplete autocomplete = (AbstractAutocomplete) component;
+ String clientFilter = (String)autocomplete.getAttributes().get("clientFilter");
+ if (clientFilter != null && clientFilter.length() != 0) {
+ JSFunctionDefinition clientFilterFunction = new JSFunctionDefinition("subString");
+ clientFilterFunction.addParameter("value");
+ clientFilterFunction.addToBody(clientFilter);
+ return clientFilterFunction;
+ }
+
+ return null;
+ }
+
public String getScriptOptions(UIComponent component) {
Map<String, Object> attributes = component.getAttributes();
Map<String, Object> options = new HashMap<String, Object>();
@@ -77,7 +93,6 @@
utils.addToScriptHash(options, "buttonId", component.getClientId() + "Button");
utils.addToScriptHash(options, "selectedItemClass", attributes.get("selectedItemClass"));
utils.addToScriptHash(options, "minChars", attributes.get("minChars"), "1");
- utils.addToScriptHash(options, "mode", attributes.get("mode"), "ajax");
utils.addToScriptHash(options, "filterFunction", attributes.get("filterFunction"));
utils.addToScriptHash(options, "autofill", attributes.get("autofill"), "true");
utils.addToScriptHash(options, "disabled", attributes.get("disabled"), "false");
@@ -88,10 +103,17 @@
utils.addToScriptHash(options, "onerror", attributes.get("onerror"));
utils.addToScriptHash(options, "onbeforedomupdate", attributes.get("onbeforedomupdate"));
utils.addToScriptHash(options, "onchange", attributes.get("onchange"));
- if (attributes.get("mode").equals("ajax")){
- utils.addToScriptHash(options, "isCachedAjax", false, "true");
- } else if (attributes.get("mode").equals("client")) {
- utils.addToScriptHash(options, "ajaxMode", false, "true");
+ utils.addToScriptHash(options, "filterFunction", getClientFilterFunction(component));
+ String mode = (String)attributes.get("mode");
+ if (mode != null) {
+ if (mode.equals("ajax")){
+ utils.addToScriptHash(options, "isCachedAjax", false, "true");
+ } else if (mode.equals("client") || mode.equals("lazyClient")) {
+ utils.addToScriptHash(options, "ajaxMode", false, "true");
+ if (mode.equals("lazyClient")) {
+ utils.addToScriptHash(options, "lazyClientMode", true, "false");
+ }
+ }
}
StringBuilder builder = new StringBuilder();
builder.append(ScriptUtils.toScript(options));
@@ -185,12 +207,17 @@
Object nextItem = items.next();
setVar(facesContext, comboBox.getVar(), nextItem);
- strategy.encodeItem(facesContext, comboBox, nextItem);
+ this.encodeItem(facesContext, comboBox, nextItem, strategy);
if (comboBox.getFetchValue() != null) {
fetchValues.add(comboBox.getFetchValue());
} else {
// TODO use converter
- fetchValues.add(nextItem);
+ if (comboBox.getItemConverter() != null) {
+ fetchValues.add(comboBox.getItemConverter().getAsString(facesContext, component, nextItem));
+ } else{
+ fetchValues.add(nextItem);
+ }
+
}
}
@@ -205,25 +232,50 @@
protected void encodeItemsContainer(FacesContext facesContext, UIComponent component) throws IOException {
AutocompleteEncodeStrategy strategy = getStrategy(component);
- strategy.encodeItemsContainerBegin(facesContext, component);
- if (component.getAttributes().get("mode").equals("client")) {
+ Object mode = component.getAttributes().get("mode");
+ if (mode!= null && mode.equals("client")) {
List<Object> fetchValues = new ArrayList<Object>();
this.encodeItems(facesContext, component, fetchValues);
} else {
- strategy.encodeFakeItem(facesContext, component);
+ strategy.encodeItemsContainerBegin(facesContext, component);
+ // TODO: is it needed
+ //strategy.encodeFakeItem(facesContext, component);
+ strategy.encodeItemsContainerEnd(facesContext, component);
}
- strategy.encodeItemsContainerEnd(facesContext, component);
}
+ public void encodeItem(FacesContext facesContext, AbstractAutocomplete comboBox, Object item, AutocompleteEncodeStrategy strategy) throws IOException {
+ strategy.encodeItemBegin(facesContext, comboBox);
+ ResponseWriter writer = facesContext.getResponseWriter();
+
+ writer.writeAttribute(HTML.CLASS_ATTRIBUTE, "rf-au-option rf-au-font rf-au-input", null);
+
+ if (comboBox.getChildCount() > 0) {
+ for (UIComponent child : comboBox.getChildren()) {
+ child.encodeAll(facesContext);
+ }
+ } else {
+ if (item != null) {
+ // TODO nick - use converter
+ String value = null;
+ if (comboBox.getItemConverter() != null) {
+ value = comboBox.getItemConverter().getAsString(facesContext, comboBox, item);
+ }
+ if (value != null) {
+ writer.writeText(value, null);
+ }
+ writer.writeText(item, null);
+ }
+ }
+ strategy.encodeItemEnd(facesContext, comboBox);
+ }
+
private AutocompleteEncodeStrategy getStrategy(UIComponent component) {
AbstractAutocomplete comboBox = (AbstractAutocomplete) component;
if (comboBox.getLayout() != null) {
if (comboBox.getLayout().equals(AutocompleteLayout.div.toString())) {
return new AutocompleteDivLayoutStrategy();
}
- if (comboBox.getLayout().equals(AutocompleteLayout.grid.toString())) {
- return new AutocompleteGridLayoutStrategy();
- }
if (comboBox.getLayout().equals(AutocompleteLayout.list.toString())) {
return new AutocompleteListLayoutStrategy();
}
Modified: branches/RF-7944/ui/input/ui/src/main/java/org/richfaces/renderkit/AutocompleteTableLayoutStrategy.java
===================================================================
--- branches/RF-7944/ui/input/ui/src/main/java/org/richfaces/renderkit/AutocompleteTableLayoutStrategy.java 2010-09-03 12:00:31 UTC (rev 19109)
+++ branches/RF-7944/ui/input/ui/src/main/java/org/richfaces/renderkit/AutocompleteTableLayoutStrategy.java 2010-09-03 12:51:59 UTC (rev 19110)
@@ -7,16 +7,17 @@
import javax.faces.context.ResponseWriter;
import org.ajax4jsf.renderkit.RendererUtils.HTML;
-import org.richfaces.component.AbstractAutocomplete;
public class AutocompleteTableLayoutStrategy extends AbstractAutocompleteLayoutStrategy implements
AutocompleteEncodeStrategy {
public void encodeFakeItem(FacesContext facesContext, UIComponent component) throws IOException {
ResponseWriter responseWriter = facesContext.getResponseWriter();
+ responseWriter.startElement(HTML.TR_ELEMENT, component);
responseWriter.startElement(HTML.TD_ELEM, component);
responseWriter.writeAttribute(HTML.STYLE_ATTRIBUTE, "display:none", null);
responseWriter.endElement(HTML.TD_ELEM);
+ responseWriter.endElement(HTML.TR_ELEMENT);
}
@@ -25,42 +26,24 @@
responseWriter.startElement(HTML.TABLE_ELEMENT, component);
responseWriter.writeAttribute(HTML.ID_ATTRIBUTE, getContainerElementId(facesContext, component), null);
responseWriter.startElement(HTML.TBODY_ELEMENT, component);
- // responseWriter.writeAttribute(HTML.CLASS_ATTRIBUTE, "cb_list_ul", null);
}
public void encodeItemsContainerEnd(FacesContext facesContext, UIComponent component) throws IOException {
ResponseWriter responseWriter = facesContext.getResponseWriter();
- responseWriter.endElement(HTML.TABLE_ELEMENT);
responseWriter.endElement(HTML.TBODY_ELEMENT);
+ responseWriter.endElement(HTML.TABLE_ELEMENT);
}
-
- public void encodeItem(FacesContext facesContext, AbstractAutocomplete comboBox, Object item) throws IOException {
+
+ public void encodeItemBegin(FacesContext facesContext, UIComponent component) throws IOException {
+ ResponseWriter writer = facesContext.getResponseWriter();
+ writer.startElement(HTML.TR_ELEMENT, component);
+ writer.startElement(HTML.TD_ELEM, component);
+ }
+
+ public void encodeItemEnd(FacesContext facesContext, UIComponent component) throws IOException {
ResponseWriter writer = facesContext.getResponseWriter();
-
- writer.startElement(HTML.TD_ELEM, comboBox);
- writer.writeAttribute(HTML.CLASS_ATTRIBUTE, "rf-au-option rf-au-font rf-au-input", null);
-
- if (comboBox.getChildCount() > 0) {
- for (UIComponent child : comboBox.getChildren()) {
- child.encodeAll(facesContext);
- }
- } else {
- if (item != null) {
- // TODO nick - use converter
- String value = null;
- if (comboBox.getItemConverter() != null) {
- value = comboBox.getItemConverter().getAsString(facesContext, comboBox, item);
- }
- if (value != null) {
- writer.writeText(value, null);
- }
- writer.writeText(item, null);
- // writer.writeText(InputUtils.getConvertedValue(facesContext, comboBox, item), null);
- }
- }
-
writer.endElement(HTML.TD_ELEM);
-
+ writer.endElement(HTML.TR_ELEMENT);
}
}
Modified: branches/RF-7944/ui/input/ui/src/main/java/org/richfaces/renderkit/InplaceInputBaseRenderer.java
===================================================================
--- branches/RF-7944/ui/input/ui/src/main/java/org/richfaces/renderkit/InplaceInputBaseRenderer.java 2010-09-03 12:00:31 UTC (rev 19109)
+++ branches/RF-7944/ui/input/ui/src/main/java/org/richfaces/renderkit/InplaceInputBaseRenderer.java 2010-09-03 12:51:59 UTC (rev 19110)
@@ -35,7 +35,6 @@
import javax.faces.context.ResponseWriter;
import org.ajax4jsf.javascript.JSFunction;
-import org.ajax4jsf.renderkit.RendererBase;
import org.ajax4jsf.renderkit.RendererUtils.HTML;
import org.richfaces.component.AbstractInplaceInput;
import org.richfaces.component.InplaceState;
@@ -51,7 +50,7 @@
@ResourceDependency(name = "richfaces-base-component.js"),
@ResourceDependency(library="org.richfaces", name = "inplaceInput.js"),
@ResourceDependency(library="org.richfaces", name = "inplaceInput.ecss") })
-public class InplaceInputBaseRenderer extends RendererBase {
+public class InplaceInputBaseRenderer extends InputRendererBase {
public static final String OPTIONS_EDIT_EVENT = "editEvent";
@@ -61,12 +60,14 @@
public static final String OPTIONS_FOCUS = "focusElement";
- public static final String OPTIONS_BTN_OK = "okbtn";
+ public static final String OPTIONS_BUTTON_OK = "okbtn";
public static final String OPTIONS_LABEL = "label";
- public static final String OPTIONS_BTN_CANCEL = "cancelbtn";
+ public static final String OPTIONS_DEFAULT_LABEL = "defaultLabel";
+ public static final String OPTIONS_BUTTON_CANCEL = "cancelbtn";
+
public static final String OPTIONS_SHOWCONTROLS = "showControls";
public static final String OPTIONS_NONE_CSS = "noneCss";
@@ -115,17 +116,6 @@
setComponentAttributeName("onselect")
));
-
- @Override
- protected void doDecode(FacesContext facesContext, UIComponent component) {
- AbstractInplaceInput inplaceInput = (AbstractInplaceInput)component;
- Map <String, String> parameterMap = facesContext.getExternalContext().getRequestParameterMap();
- String newValue = (String)parameterMap.get(inplaceInput.getClientId(facesContext));
- if (newValue != null) {
- inplaceInput.setSubmittedValue(newValue);
- }
- }
-
protected void renderInputHandlers(FacesContext facesContext, UIComponent component) throws IOException {
RenderKitUtils.renderPassThroughAttributesOptimized(facesContext, component, INPLACEINPUT_HANDLER_ATTRIBUTES);
}
@@ -134,12 +124,15 @@
return ((AbstractInplaceInput) component).getState();
}
- public String getValue(FacesContext context, UIComponent component) throws IOException {
- // TODO: convert?
- String value = (String) ((AbstractInplaceInput) component).getValue();
+ public String getValue(FacesContext facesContext, UIComponent component) throws IOException {
+ AbstractInplaceInput inplaceInput = (AbstractInplaceInput)component;
+ String value = getInputValue(facesContext, inplaceInput);
+ if(value == null || "".equals(value)) {
+ value = inplaceInput.getDefaultLabel();
+ }
return value;
}
-
+
public String getResourcePath(FacesContext context, String resourceName) {
if (resourceName != null) {
ResourceHandler resourceHandler = context.getApplication().getResourceHandler();
@@ -188,12 +181,13 @@
options.put(OPTIONS_INPUT, clientId + ":input");
options.put(OPTIONS_LABEL, clientId + ":label");
options.put(OPTIONS_FOCUS, clientId + ":focus");
+ options.put(OPTIONS_DEFAULT_LABEL, inplaceInput.getDefaultLabel());
boolean showControls = inplaceInput.isShowControls();
options.put(OPTIONS_SHOWCONTROLS, showControls);
if(showControls) {
- options.put(OPTIONS_BTN_OK, clientId + ":okbtn");
- options.put(OPTIONS_BTN_CANCEL, clientId + ":cancelbtn");
+ options.put(OPTIONS_BUTTON_OK, clientId + ":okbtn");
+ options.put(OPTIONS_BUTTON_CANCEL, clientId + ":cancelbtn");
}
function.addParameter(options);
Modified: branches/RF-7944/ui/input/ui/src/main/resources/META-INF/resources/org.richfaces/Autocomplete.js
===================================================================
--- branches/RF-7944/ui/input/ui/src/main/resources/META-INF/resources/org.richfaces/Autocomplete.js 2010-09-03 12:00:31 UTC (rev 19109)
+++ branches/RF-7944/ui/input/ui/src/main/resources/META-INF/resources/org.richfaces/Autocomplete.js 2010-09-03 12:51:59 UTC (rev 19110)
@@ -1,14 +1,35 @@
(function ($, rf) {
rf.utils = rf.utils || {};
- rf.utils.Cache = function (key, items, values) {
+ rf.utils.Cache = function (key, items, values, useCache) {
this.key = key.toLowerCase();
this.cache = {}
this.cache[this.key] = items || [];
- this.values = typeof values != "function" ? values || this.cache[this.key] : values(items);
+ this.originalValues = typeof values == "function" ? values(items) : values || this.cache[this.key];
+ this.values = processValues(this.originalValues);
+ this.useCache = useCache || checkValuesPrefix.call(this);
};
+
+ var processValues = function (values) {
+ var processedValues = [];
+ for (var i = 0; i<values.length; i++) {
+ processedValues.push(values[i].toLowerCase());
+ }
+ return processedValues;
+ }
+
+ var checkValuesPrefix = function () {
+ var result = true;
+ for (var i = 0; i<this.values.length; i++) {
+ if (this.values[i].indexOf(this.key)!=0) {
+ result = false;
+ break;
+ }
+ }
+ return result;
+ }
- var getItems = function (key) {
+ var getItems = function (key, filterFunction) {
key = key.toLowerCase();
var newCache = [];
@@ -19,12 +40,17 @@
if (this.cache[key]) {
newCache = this.cache[key];
} else {
+ var useCustomFilterFunction = typeof filterFunction == "function";
var itemsCache = this.cache[this.key];
for (var i = 0; i<this.values.length; i++) {
- var value = this.values[i].toLowerCase();
- var p = value.indexOf(key);
- if (p == 0) {
+ var value = this.values[i];
+ if (useCustomFilterFunction && filterFunction(key, value)) {
newCache.push(itemsCache[i]);
+ } else {
+ var p = value.indexOf(key);
+ if (p == 0) {
+ newCache.push(itemsCache[i]);
+ }
}
}
@@ -40,12 +66,12 @@
};
var getItemValue = function (item) {
- return this.values[this.cache[this.key].index(item)];
+ return this.originalValues[this.cache[this.key].index(item)];
};
var isCached = function (key) {
key = key.toLowerCase();
- return this.cache[key] || this.key.indexOf(key)==0;
+ return this.cache[key] || this.useCache && key.indexOf(this.key)==0;
};
$.extend(rf.utils.Cache.prototype, (function () {
@@ -95,9 +121,11 @@
minChars:1,
selectFirst:true,
ajaxMode:true,
+ lazyClientMode:false,
isCachedAjax:true,
- tokens: ",",
- attachToBody:true
+ tokens: "",
+ attachToBody:true,
+ filterFunction: undefined
};
var ID = {
@@ -138,9 +166,7 @@
if (element) {
if (event.type=="mouseover") {
var index = this.items.index(element);
- if (index!=this.index) {
- selectItem.call(this, index);
- }
+ selectItem.call(this, event, index);
} else {
this.__onChangeValue(event, getSelectedItemValue.call(this));
rf.Selection.setCaretTo(rf.getDomElement(this.fieldId));
@@ -152,7 +178,7 @@
var updateItemsList = function (value, fetchValues) {
this.items = $(rf.getDomElement(this.id+ID.ITEMS)).find("."+this.options.itemClass);
if (this.items.length>0) {
- this.cache = new rf.utils.Cache(value, this.items, fetchValues || getData);
+ this.cache = new rf.utils.Cache((this.options.ajaxMode ? value : ""), this.items, fetchValues || getData, !this.options.ajaxMode);
}
};
@@ -173,7 +199,7 @@
};
var autoFill = function (inputValue, value) {
- if( this.options.autofill) {
+ if( this.options.autofill && value.toLowerCase().indexOf(inputValue)==0) {
var field = rf.getDomElement(this.fieldId);
var start = rf.Selection.getStart(field);
this.setInputValue(inputValue + value.substring(inputValue.length));
@@ -182,18 +208,25 @@
}
};
- var callAjax = function(event, value) {
+ var callAjax = function(event, value, callback) {
- $(rf.getDomElement(this.id+ID.ITEMS)).removeData().empty();
+ clearItems.call(this);
rf.getDomElement(this.id+ID.VALUE).value = value;
var _this = this;
+ var _event = event;
var ajaxSuccess = function (event) {
updateItemsList.call(_this, _this.value, event.componentData && event.componentData[_this.id]);
- if (_this.isVisible && _this.options.selectFirst) {
- selectItem.call(_this, 0);
+ if (_this.options.lazyClientMode && _this.value.length!=0) {
+ updateItemsFromCache.call(_this, _this.value);
}
+ if (_this.focused && _this.items.length!=0 && callback) {
+ callback.call(_this, _event);
+ }
+ if (!callback && _this.isVisible && _this.options.selectFirst) {
+ selectItem.call(_this, _event, 0);
+ }
}
var ajaxError = function (event) {
@@ -207,8 +240,8 @@
rf.ajax(this.id, event, {parameters: params, error: ajaxError, complete:ajaxSuccess});
};
- var selectItem = function(index, isOffset, noAutoFill) {
- if (this.items.length==0) return;
+ var selectItem = function(event, index, isOffset) {
+ if (this.items.length==0 || (!isOffset && this.index == index)) return;
if (this.index!=-1) {
this.items.eq(this.index).removeClass(this.options.selectedItemClass);
@@ -221,11 +254,11 @@
if (isOffset) {
this.index += index;
- if ( this.index<0 ) {
- this.index = this.items.length - 1;
- } else if (this.index >= this.items.length) {
- this.index = 0;
- }
+ if ( this.index<0 ) {
+ this.index = this.items.length - 1;
+ } else if (this.index >= this.items.length) {
+ this.index = 0;
+ }
} else {
if (index<0) {
index = 0;
@@ -237,39 +270,61 @@
var item = this.items.eq(this.index);
item.addClass(this.options.selectedItemClass);
scrollToSelectedItem.call(this);
- !noAutoFill && autoFill.call(this, this.value, getSelectedItemValue.call(this));
+ if (event &&
+ event.which != rf.KEYS.BACKSPACE &&
+ event.which != rf.KEYS.DEL &&
+ event.which != rf.KEYS.LEFT &&
+ event.which != rf.KEYS.RIGHT) {
+ autoFill.call(this, this.value, getSelectedItemValue.call(this));
+ }
};
var updateItemsFromCache = function (value) {
- var newItems = this.cache.getItems(value);
+ var newItems = this.cache.getItems(value, this.options.filterFunction);
this.items = $(newItems);
//TODO: works only with simple markup, not with <tr>
- $(rf.getDomElement(this.id+ID.ITEMS)).empty().append(newItems);
- }
+ $(rf.getDomElement(this.id+ID.ITEMS)).empty().append(this.items);
+ window.console && console.log && console.log("updateItemsFromCache");
+ };
- var onChangeValue = function (event, value) {
- selectItem.call(this);
+ var clearItems = function () {
+ $(rf.getDomElement(this.id+ID.ITEMS)).removeData().empty();
+ this.items = [];
+ };
+
+ var onChangeValue = function (event, value, callback) {
+ selectItem.call(this, event);
// value is undefined if called from AutocompleteBase onChange
var subValue = (typeof value == "undefined") ? this.__getSubValue() : value;
+ var oldValue = this.value;
+ this.value = subValue;
- if (this.cache && this.cache.isCached(subValue)) {
- updateItemsFromCache.call(this, subValue);
- this.index = -1;
- this.value = subValue;
- if (this.options.selectFirst) {
- if (event.which == rf.KEYS.RETURN || event.type == "click") {
- this.setInputValue(subValue);
- } else {
- selectItem.call(this, 0, false, event.which == rf.KEYS.BACKSPACE || event.which == rf.KEYS.LEFT || event.which == rf.KEYS.RIGHT);
- }
+ if ((this.options.isCachedAjax || !this.options.ajaxMode) &&
+ this.cache && this.cache.isCached(subValue)) {
+ if (oldValue!=subValue) {
+ updateItemsFromCache.call(this, subValue);
}
+ if (this.items.length!=0 && callback) {
+ callback.call(this, event);
+ }
+ if (event.which == rf.KEYS.RETURN || event.type == "click") {
+ this.setInputValue(subValue);
+ } else if (this.options.selectFirst) {
+ selectItem.call(this, event, 0);
+ }
} else {
+ if (event.which == rf.KEYS.RETURN || event.type == "click") {
+ this.setInputValue(subValue);
+ }
if (subValue.length>=this.options.minChars) {
- if (this.options.ajaxMode && this.value!=subValue) {
- this.value = subValue;
- this.options.ajaxMode && callAjax.call(this, event, subValue);
+ if ((this.options.ajaxMode || this.options.lazyClientMode) && oldValue!=subValue) {
+ callAjax.call(this, event, subValue, callback);
}
+ } else {
+ if (this.options.ajaxMode) {
+ clearItems.call(this);
+ }
}
}
@@ -341,9 +396,11 @@
*/
__updateState: function (event) {
var subValue = this.__getSubValue();
- // called from onShow method, not actually value changed
- if (this.items.length==0 && subValue.length>=this.options.minChars && this.isFirstAjax) {
- this.options.ajaxMode && callAjax.call(this, event, subValue);
+ // called from AutocompleteBase when not actually value changed
+ if (this.items.length==0 && this.isFirstAjax) {
+ if ((this.options.ajaxMode && subValue.length>=this.options.minChars) || this.options.lazyClientMode) {
+ callAjax.call(this, event, subValue);
+ }
}
return;
},
@@ -359,16 +416,16 @@
/*
* Override abstract protected methods
*/
- __onKeyUp: function () {
- selectItem.call(this, -1, true);
+ __onKeyUp: function (event) {
+ selectItem.call(this, event, -1, true);
},
- __onKeyDown: function () {
- selectItem.call(this, 1, true);
+ __onKeyDown: function (event) {
+ selectItem.call(this, event, 1, true);
},
- __onPageUp: function () {
+ __onPageUp: function (event) {
},
- __onPageDown: function () {
+ __onPageDown: function (event) {
},
__onBeforeShow: function (event) {
@@ -380,14 +437,12 @@
//rf.getDomElement(this.fieldId).focus();
},
__onShow: function (event) {
- if (event.which != rf.KEYS.BACKSPACE && this.items && this.items.length>0) {
- if (this.index!=0 && this.options.selectFirst) {
- selectItem.call(this, 0);
- }
+ if (this.options.selectFirst) {
+ selectItem.call(this, event, 0);
}
},
- __onHide: function () {
- selectItem.call(this);
+ __onHide: function (event) {
+ selectItem.call(this, event);
},
/*
* Destructor
Modified: branches/RF-7944/ui/input/ui/src/main/resources/META-INF/resources/org.richfaces/AutocompleteBase.js
===================================================================
--- branches/RF-7944/ui/input/ui/src/main/resources/META-INF/resources/org.richfaces/AutocompleteBase.js 2010-09-03 12:00:31 UTC (rev 19109)
+++ branches/RF-7944/ui/input/ui/src/main/resources/META-INF/resources/org.richfaces/AutocompleteBase.js 2010-09-03 12:51:59 UTC (rev 19110)
@@ -107,6 +107,7 @@
};
var onFocus = function (event) {
+ this.focused = true;
};
var onBlur = function (event) {
@@ -116,6 +117,7 @@
} else if (this.isVisible && !this.isMouseDown) {
var _this = this;
this.timeoutId = window.setTimeout(function(){_this.hide();}, 200);
+ this.focused=false;
}
};
@@ -128,15 +130,11 @@
//TODO: is it needed to chesk keys?
//TODO: we need to set value when autoFill used when LEFT or RIGHT was pressed
if (event.which == rf.KEYS.LEFT || event.which == rf.KEYS.RIGHT || flag) {
- if (flag || this.isVisible) {
- this.__onChangeValue(event);
- }
if (flag) {
+ this.__onChangeValue(event, undefined, (!this.isVisible ? this.show : undefined));
this.currentValue = this.getInputValue();
- /*if(value && value.length>=this.options.minChars){
- onShow.call(this, event);
- }*/ // TODO: AMarkhel: is this check needed??? for what?
- onShow.call(this, event);
+ } else if (this.isVisible) {
+ this.__onChangeValue(event);
}
}
};
Modified: branches/RF-7944/ui/input/ui/src/main/resources/META-INF/resources/org.richfaces/inplaceInput.js
===================================================================
--- branches/RF-7944/ui/input/ui/src/main/resources/META-INF/resources/org.richfaces/inplaceInput.js 2010-09-03 12:00:31 UTC (rev 19109)
+++ branches/RF-7944/ui/input/ui/src/main/resources/META-INF/resources/org.richfaces/inplaceInput.js 2010-09-03 12:51:59 UTC (rev 19110)
@@ -28,21 +28,26 @@
$super.constructor.call(this, id);
this.attachToDom(id);
- this.namespace = this.namespace || "."+rf.Event.createNamespace(this.name, this.id);
+ this.namespace = this.namespace || "." + rf.Event.createNamespace(this.name, this.id);
this.currentState = options.state;
this.editEvent = options.editEvent;
this.noneCss = options.noneCss;
this.changedCss = options.changedCss;
this.showControls = options.showControls;
+ this.defaultLabel = options.defaultLabel;
this.element = $(document.getElementById(id));
this.editContainer = $(document.getElementById(options.editContainer));
this.input = $(document.getElementById(options.input));
this.label = $(document.getElementById(options.label));
this.focusElement = $(document.getElementById(options.focusElement));
- this.initialValue = this.label.text();
+ var label = this.label.text();
+ var inputLabel = this.input.val();
+
+ this.initialValue = (label == inputLabel) ? label : "";
+
this.element.bind(this.editEvent, $.proxy(this.__editHandler, this));
this.input.bind("focus", $.proxy(this.__editHandler, this));
this.input.bind("change", $.proxy(this.__changeHandler, this));
@@ -66,7 +71,8 @@
$.extend(rf.ui.InplaceInput.prototype, ( function () {
var isSaved = false;
-
+ var isValueChanged = false;
+
return {
name : "inplaceInput",
@@ -86,6 +92,10 @@
var inputValue = this.input.val();
if(inputValue.length > 0) {
this.label.text(inputValue);
+ isValueChanged = true;
+ } else {
+ this.label.text(this.defaultLabel);
+ isValueChanged = false;
}
if(inputValue != this.initialValue) {
@@ -98,7 +108,10 @@
},
cancel: function() {
- var text = this.label.text();
+ var text = "";
+ if(isValueChanged) {
+ text = this.label.text();
+ }
this.input.val(text);
isSaved = true;
this.__hide();
Modified: branches/RF-7944/ui/input/ui/src/main/templates/autocomplete.template.xml
===================================================================
--- branches/RF-7944/ui/input/ui/src/main/templates/autocomplete.template.xml 2010-09-03 12:00:31 UTC (rev 19109)
+++ branches/RF-7944/ui/input/ui/src/main/templates/autocomplete.template.xml 2010-09-03 12:51:59 UTC (rev 19110)
@@ -29,7 +29,7 @@
onmouseout="#{component.attributes['onmouseout']}"
onkeyup="#{component.attributes['onkeyup']}"
onkeydown="#{component.attributes['onkeydown']}"
- onkeypress="#{component.attributes['onkeypress']}" id="#{clientId}Input" value="#{component.attributes['value']}" disabled="#{disabled}" name="#{clientId}" type="text" class="rf-au-font rf-au-input" />
+ onkeypress="#{component.attributes['onkeypress']}" id="#{clientId}Input" value="#{component.attributes['value']}" disabled="#{disabled}" name="#{clientId}" type="text" class="rf-au-font rf-au-input" autocomplete="off"/>
<c:if test="#{component.attributes['showButton']}">
<c:if test="#{component.attributes['disabled']}">
<div id="#{clientId}Button" class="rf-au-button">
Modified: branches/RF-7944/ui/input/ui/src/main/templates/inplaceInput.template.xml
===================================================================
--- branches/RF-7944/ui/input/ui/src/main/templates/inplaceInput.template.xml 2010-09-03 12:00:31 UTC (rev 19109)
+++ branches/RF-7944/ui/input/ui/src/main/templates/inplaceInput.template.xml 2010-09-03 12:51:59 UTC (rev 19110)
@@ -1,5 +1,28 @@
<?xml version="1.0" encoding="UTF-8"?>
+<!--
+JBoss, Home of Professional Open Source
+Copyright ${year}, Red Hat, Inc. and individual contributors
+by the @authors tag. See the copyright.txt in the distribution for a
+full listing of individual contributors.
+
+This is free software; you can redistribute it and/or modify it
+under the terms of the GNU Lesser General Public License as
+published by the Free Software Foundation; either version 2.1 of
+the License, or (at your option) any later version.
+
+
+This software is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+Lesser General Public License for more details.
+
+
+You should have received a copy of the GNU Lesser General Public
+License along with this software; if not, write to the Free
+Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+02110-1301 USA, or see the FSF site: http://www.fsf.org.
+-->
<cdk:root xmlns="http://jboss.org/schema/richfaces/cdk/xhtml-el" xmlns:cdk="http://jboss.org/schema/richfaces/cdk/core"
xmlns:c="http://jboss.org/schema/richfaces/cdk/jstl/core" xmlns:cc="http://jboss.org/schema/richfaces/cdk/jsf/composite"
xmlns:javaee="http://java.sun.com/xml/ns/javaee">
@@ -25,8 +48,8 @@
</span>
<input id="#{clientId}:focus" type="image" style="position: absolute; top: 0px; left: 0px; outline-style: none;" class="rf-ii-none"/>
<span id="#{clientId}:edit" class="#{getEditStyleClass(component, inplaceState)}">
- <input id="#{clientId}:input" autocomplete="off" name="#{clientId}:input"
- type="text" value="#{inplaceValue}" class="rf-ii-f" style="width: #{component.attributes['inputWidth']};"
+ <input id="#{clientId}:input" autocomplete="off" name="#{clientId}"
+ type="text" value="#{getInputValue(facesContext, component)}" class="rf-ii-f" style="width: #{component.attributes['inputWidth']};"
cdk:passThrough="tabIndex">
<cdk:call expression="renderInputHandlers(facesContext, component);"/>
</input>
Modified: branches/RF-7944/ui/input/ui/src/test/java/org/richfaces/renderkit/InplaceInputRendererTest.java
===================================================================
--- branches/RF-7944/ui/input/ui/src/test/java/org/richfaces/renderkit/InplaceInputRendererTest.java 2010-09-03 12:00:31 UTC (rev 19109)
+++ branches/RF-7944/ui/input/ui/src/test/java/org/richfaces/renderkit/InplaceInputRendererTest.java 2010-09-03 12:51:59 UTC (rev 19110)
@@ -31,7 +31,6 @@
import org.jboss.test.faces.htmlunit.HtmlUnitEnvironment;
import org.junit.After;
import org.junit.Before;
-import org.junit.Ignore;
import org.junit.Test;
import com.gargoylesoftware.htmlunit.html.DomNode;
@@ -52,17 +51,14 @@
environment = new HtmlUnitEnvironment();
environment.withWebRoot(new File("src/test/resources"));
environment.withResource("/WEB-INF/faces-config.xml", "org/richfaces/renderkit/faces-config.xml");
- environment.withResource("/test.xhtml", "org/richfaces/renderkit/rendererTest.xhtml");
+ environment.withResource("/test.xhtml", "org/richfaces/renderkit/inplaceInputTest.xhtml");
environment.start();
}
@Test
- @Ignore("Updates to RF-9132 broke this test - it needs to be fixed, but is blocking M2 release")
public void testRenderDefaultState() throws Exception {
HtmlPage page = environment.getPage("/test.jsf");
- List<?> nodes = page.getByXPath("//*[@id = 'form:input_default']");
- assertEquals(1, nodes.size());
- HtmlElement span = (HtmlElement) nodes.get(0);
+ HtmlElement span = page.getFirstByXPath("//*[@id = 'form:input_default']");
assertEquals("span", span.getNodeName());
assertEquals("rf-ii-d-s", span.getAttribute(HTML.CLASS_ATTRIBUTE));
@@ -72,10 +68,7 @@
DomNode text = label.getFirstChild();
assertEquals(DomNode.TEXT_NODE, text.getNodeType());
- List<?> editNodes = page.getByXPath("//*[@id = 'form:input_default:edit']");
- assertEquals(1, editNodes.size());
- HtmlElement edit = (HtmlElement) editNodes.get(0);
-
+ HtmlElement edit = page.getFirstByXPath("//*[@id = 'form:input_default:edit']");
assertEquals("span", edit.getNodeName());
assertEquals("rf-ii-e-s rf-ii-none", edit.getAttribute(HTML.CLASS_ATTRIBUTE));
@@ -89,14 +82,11 @@
}
@Test
- @Ignore("Updates to RF-9132 broke this test - it needs to be fixed, but is blocking M2 release")
public void testRenderEditState() throws Exception {
HtmlPage page = environment.getPage("/test.jsf");
- List<?> nodes = page.getByXPath("//*[@id = 'form:input_edit']");
- assertEquals(1, nodes.size());
- HtmlElement span = (HtmlElement) nodes.get(0);
+ HtmlElement span = page.getFirstByXPath("//*[@id = 'form:input_edit']");
assertEquals("span", span.getNodeName());
assertEquals("rf-ii-d-s", span.getAttribute(HTML.CLASS_ATTRIBUTE));
@@ -106,9 +96,7 @@
DomNode text = label.getFirstChild();
assertEquals(DomNode.TEXT_NODE, text.getNodeType());
- List<?> editNodes = page.getByXPath("//*[@id = 'form:input_edit:edit']");
- assertEquals(1, editNodes.size());
- HtmlElement edit = (HtmlElement) editNodes.get(0);
+ HtmlElement edit = page.getFirstByXPath("//*[@id = 'form:input_edit:edit']");
assertEquals("span", edit.getNodeName());
assertEquals("rf-ii-e-s", edit.getAttribute(HTML.CLASS_ATTRIBUTE));
@@ -117,24 +105,15 @@
assertEquals("rf-ii-f", input.getAttribute(HTML.CLASS_ATTRIBUTE));
assertEquals(text.getNodeValue(), input.getAttribute(HTML.VALUE_ATTRIBUTE));
- List<?> buttonNodes = page.getByXPath("//*[@id = 'form:input_edit:btn']");
- assertEquals(1, buttonNodes.size());
-
- HtmlElement button = (HtmlElement) buttonNodes.get(0);
+ HtmlElement button = page.getFirstByXPath("//*[@id = 'form:input_edit:btn']");
assertEquals("span", button.getNodeName());
- List<?> okButtonNodes = page.getByXPath("//*[@id = 'form:input_edit:okbtn']");
- assertEquals(1, okButtonNodes.size());
-
- HtmlElement okButton = (HtmlElement) okButtonNodes.get(0);
+ HtmlElement okButton = page.getFirstByXPath("//*[@id = 'form:input_edit:okbtn']");
assertEquals("input", okButton.getNodeName());
assertEquals("rf-ii-btn", okButton.getAttribute(HTML.CLASS_ATTRIBUTE));
assertEquals("image", okButton.getAttribute(HTML.TYPE_ATTR));
- List<?> cancelButtonNodes = page.getByXPath("//*[@id = 'form:input_edit:cancelbtn']");
- assertEquals(1, cancelButtonNodes.size());
-
- HtmlElement cancelButton = (HtmlElement) cancelButtonNodes.get(0);
+ HtmlElement cancelButton = page.getFirstByXPath("//*[@id = 'form:input_edit:cancelbtn']");
assertEquals("input", cancelButton.getNodeName());
assertEquals("rf-ii-btn", cancelButton.getAttribute(HTML.CLASS_ATTRIBUTE));
assertEquals("image", cancelButton.getAttribute(HTML.TYPE_ATTR));
@@ -145,97 +124,62 @@
public void testEdit() throws Exception {
HtmlPage page = environment.getPage("/test.jsf");
edit(page, "input_default", "Another Test String");
-
blur(page);
-
- List<?> labelNodes = page.getByXPath("//*[@id = 'form:input_default:label']/text()");
- assertEquals(1, labelNodes.size());
- DomText text = (DomText) labelNodes.get(0);
+ DomText text = page.getFirstByXPath("//*[@id = 'form:input_default:label']/text()");
assertEquals("Another Test String", text.getTextContent());
-
- List<?>nodes = page.getByXPath("//*[@id = 'form:input_default']");
- assertEquals(1, nodes.size());
- HtmlElement span = (HtmlElement) nodes.get(0);
+ HtmlElement span = page.getFirstByXPath("//*[@id = 'form:input_default']");
assertEquals("rf-ii-d-s rf-ii-c-s", span.getAttribute(HTML.CLASS_ATTRIBUTE));
-
}
private void blur(HtmlPage page) throws Exception {
- List<?> panelNodes = page.getByXPath("//*[@id = 'form:panel']");
- assertEquals(1, panelNodes.size());
- HtmlElement panel = (HtmlElement) panelNodes.get(0);
+ HtmlElement panel = page.getFirstByXPath("//*[@id = 'form:panel']");
panel.click();
}
private void typeNewValue(HtmlPage page, String inplaceInputId, String value) throws Exception {
- List<?> inputNodes = page.getByXPath("//*[@id = 'form:" + inplaceInputId + ":input']");
- assertEquals(1, inputNodes.size());
- HtmlElement input = (HtmlElement) inputNodes.get(0);
+ HtmlElement input = page.getFirstByXPath("//*[@id = 'form:" + inplaceInputId + ":input']");
input.setAttribute(HTML.VALUE_ATTRIBUTE, "");
input.type(value);
}
private void edit(HtmlPage page, String inplaceInputId, String value) throws Exception {
- List<?> nodes = page.getByXPath("//*[@id = 'form:" + inplaceInputId + "']");
- assertEquals(1, nodes.size());
- HtmlElement span = (HtmlElement) nodes.get(0);
+ HtmlElement span = page.getFirstByXPath("//*[@id = 'form:" + inplaceInputId + "']");
span.click();
-
- List<?> editNodes = page.getByXPath("//*[@id = 'form:" + inplaceInputId + ":edit']");
- assertEquals(1, editNodes.size());
- HtmlElement edit = (HtmlElement) editNodes.get(0);
+ HtmlElement edit = page.getFirstByXPath("//*[@id = 'form:" + inplaceInputId + ":edit']");
assertEquals("rf-ii-e-s", edit.getAttribute(HTML.CLASS_ATTRIBUTE));
-
typeNewValue(page, inplaceInputId, value);
}
@Test
public void testEditWithControls() throws Exception {
HtmlPage page = environment.getPage("/test.jsf");
-
edit(page, "input_controls", "Another Test String");
-
- List<?> cancelNodes = page.getByXPath("//*[@id = 'form:input_controls:cancelbtn']");
- assertEquals(1, cancelNodes.size());
- HtmlElement cancel = (HtmlElement) cancelNodes.get(0);
-
+
+ HtmlElement cancel = page.getFirstByXPath("//*[@id = 'form:input_controls:cancelbtn']");
cancel.mouseDown();
- List<?> labelNodes = page.getByXPath("//*[@id = 'form:input_controls:label']/text()");
- assertEquals(1, labelNodes.size());
- DomText text = (DomText) labelNodes.get(0);
+ DomText text = page.getFirstByXPath("//*[@id = 'form:input_controls:label']/text()");
assertEquals("Test String", text.getTextContent());
- List<?> nodes = page.getByXPath("//*[@id = 'form:input_controls']");
- assertEquals(1, nodes.size());
- HtmlElement span = (HtmlElement) nodes.get(0);
+ HtmlElement span = page.getFirstByXPath("//*[@id = 'form:input_controls']");
assertEquals("rf-ii-d-s", span.getAttribute(HTML.CLASS_ATTRIBUTE));
edit(page, "input_controls", "Another Test String");
- List<?> okNodes = page.getByXPath("//*[@id = 'form:input_controls:okbtn']");
- assertEquals(1, okNodes.size());
- HtmlElement ok = (HtmlElement) okNodes.get(0);
-
+ HtmlElement ok = page.getFirstByXPath("//*[@id = 'form:input_controls:okbtn']");
ok.mouseDown();
- labelNodes = page.getByXPath("//*[@id = 'form:input_controls:label']/text()");
- assertEquals(1, labelNodes.size());
- text = (DomText) labelNodes.get(0);
+ text = page.getFirstByXPath("//*[@id = 'form:input_controls:label']/text()");
assertEquals("Another Test String", text.getTextContent());
- nodes = page.getByXPath("//*[@id = 'form:input_controls']");
- assertEquals(1, nodes.size());
- span = (HtmlElement) nodes.get(0);
+ span = page.getFirstByXPath("//*[@id = 'form:input_controls']");
assertEquals("rf-ii-d-s rf-ii-c-s", span.getAttribute(HTML.CLASS_ATTRIBUTE));
edit(page, "input_controls", "Test String");
blur(page);
- labelNodes = page.getByXPath("//*[@id = 'form:input_controls:label']/text()");
- assertEquals(1, labelNodes.size());
- text = (DomText) labelNodes.get(0);
+ text = page.getFirstByXPath("//*[@id = 'form:input_controls:label']/text()");
assertEquals("Test String", text.getTextContent());
}
Copied: branches/RF-7944/ui/input/ui/src/test/resources/org/richfaces/renderkit/inplaceInputTest.xhtml (from rev 19108, trunk/ui/input/ui/src/test/resources/org/richfaces/renderkit/inplaceInputTest.xhtml)
===================================================================
--- branches/RF-7944/ui/input/ui/src/test/resources/org/richfaces/renderkit/inplaceInputTest.xhtml (rev 0)
+++ branches/RF-7944/ui/input/ui/src/test/resources/org/richfaces/renderkit/inplaceInputTest.xhtml 2010-09-03 12:51:59 UTC (rev 19110)
@@ -0,0 +1,26 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml"
+ xmlns:h="http://java.sun.com/jsf/html"
+ xmlns:f="http://java.sun.com/jsf/core"
+ xmlns:ui="http://java.sun.com/jsf/facelets"
+ xmlns:in="http://richfaces.org/input">
+<f:view contentType="text/html" />
+
+<h:head>
+ <title>Richfaces InplaceInput</title>
+</h:head>
+
+<h:body>
+ <h:form id="form">
+ <in:inplaceInput id="input_default" value="#{dataBean.value}"/>
+
+ <in:inplaceInput id="input_controls" showControls="true" value="#{dataBean.value}"/>
+
+ <in:inplaceInput id="input_edit" state="edit" showControls="true" value="#{dataBean.value}"/>
+
+ <h:panelGroup id="panel">
+ <!-- click here for blur -->
+ </h:panelGroup>
+ </h:form>
+</h:body>
+</html>
Deleted: branches/RF-7944/ui/input/ui/src/test/resources/org/richfaces/renderkit/rendererTest.xhtml
===================================================================
--- branches/RF-7944/ui/input/ui/src/test/resources/org/richfaces/renderkit/rendererTest.xhtml 2010-09-03 12:00:31 UTC (rev 19109)
+++ branches/RF-7944/ui/input/ui/src/test/resources/org/richfaces/renderkit/rendererTest.xhtml 2010-09-03 12:51:59 UTC (rev 19110)
@@ -1,26 +0,0 @@
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
-<html xmlns="http://www.w3.org/1999/xhtml"
- xmlns:h="http://java.sun.com/jsf/html"
- xmlns:f="http://java.sun.com/jsf/core"
- xmlns:ui="http://java.sun.com/jsf/facelets"
- xmlns:in="http://richfaces.org/input">
-<f:view contentType="text/html" />
-
-<h:head>
- <title>Richfaces InplaceInput</title>
-</h:head>
-
-<h:body>
- <h:form id="form">
- <in:inplaceInput id="input_default" value="#{dataBean.value}"/>
-
- <in:inplaceInput id="input_controls" showControls="true" value="#{dataBean.value}"/>
-
- <in:inplaceInput id="input_edit" state="edit" showControls="true" value="#{dataBean.value}"/>
-
- <h:panelGroup id="panel">
- <!-- click here for blur -->
- </h:panelGroup>
- </h:form>
-</h:body>
-</html>
Modified: branches/RF-7944/ui/iteration/ui/src/main/java/org/richfaces/component/AbstractColumn.java
===================================================================
--- branches/RF-7944/ui/iteration/ui/src/main/java/org/richfaces/component/AbstractColumn.java 2010-09-03 12:00:31 UTC (rev 19109)
+++ branches/RF-7944/ui/iteration/ui/src/main/java/org/richfaces/component/AbstractColumn.java 2010-09-03 12:51:59 UTC (rev 19110)
@@ -50,7 +50,6 @@
public static final String COMPONENT_FAMILY = "org.richfaces.Column";
-
@Attribute
public abstract boolean isBreakRowBefore();
Modified: branches/RF-7944/ui/iteration/ui/src/main/java/org/richfaces/component/AbstractDataGrid.java
===================================================================
--- branches/RF-7944/ui/iteration/ui/src/main/java/org/richfaces/component/AbstractDataGrid.java 2010-09-03 12:00:31 UTC (rev 19109)
+++ branches/RF-7944/ui/iteration/ui/src/main/java/org/richfaces/component/AbstractDataGrid.java 2010-09-03 12:51:59 UTC (rev 19110)
@@ -44,7 +44,7 @@
import org.richfaces.context.ExtendedVisitContextMode;
import org.richfaces.log.RichfacesLogger;
import org.richfaces.renderkit.MetaComponentRenderer;
-import org.slf4j.Logger;
+import org.richfaces.log.Logger;
/**
* @author Anton Belevich
Modified: branches/RF-7944/ui/iteration/ui/src/main/java/org/richfaces/component/AbstractDataScroller.java
===================================================================
--- branches/RF-7944/ui/iteration/ui/src/main/java/org/richfaces/component/AbstractDataScroller.java 2010-09-03 12:00:31 UTC (rev 19109)
+++ branches/RF-7944/ui/iteration/ui/src/main/java/org/richfaces/component/AbstractDataScroller.java 2010-09-03 12:51:59 UTC (rev 19110)
@@ -68,6 +68,10 @@
public static final String LAST_FACET_NAME = "last";
+ public static final String NEXT_FACET_NAME = "next";
+
+ public static final String PREVIOUS_FACET_NAME = "previous";
+
public static final String FAST_FORWARD_FACET_NAME = "fastforward";
public static final String FAST_REWIND_FACET_NAME = "fastrewind";
@@ -82,16 +86,9 @@
private Integer page;
- protected enum PropertyKeys {
- boundaryControls, fastControls, fastStep, forComponent, inactiveStyle, selectStyle, inactiveStyleClass, selectStyleClass, scrollerListener, lastPageMode, maxPages, pageIndexVar, pagesVar, renderIfSinglePage, style, styleClass, stepControls
- }
-
@Attribute
public abstract String getLastPageMode();
- @Attribute(defaultValue="0")
- public abstract int getFastStep();
-
@Attribute
public abstract String getForComponent();
@@ -104,6 +101,12 @@
@Attribute(defaultValue="show")
public abstract String getFastControls();
+ @Attribute(defaultValue="show")
+ public abstract String getStepControls();
+
+ @Attribute(defaultValue="1")
+ public abstract int getFastStep();
+
public void addScrollerListener(DataScrollerListener listener) {
addFacesListener(listener);
}
@@ -163,10 +166,6 @@
return DataScrollerUtils.findDataTable(this);
}
- private int getFastStepOrDefault() {
- return (Integer) getStateHelper().eval(PropertyKeys.fastStep, 1);
- }
-
public int getPageForFacet(String facetName) {
if (facetName == null) {
throw new NullPointerException();
@@ -179,10 +178,14 @@
newPage = 1;
} else if (LAST_FACET_NAME.equals(facetName)) {
newPage = pageCount > 0 ? pageCount : 1;
+ } else if (PREVIOUS_FACET_NAME.equals(facetName)) {
+ newPage = getPage() - 1;
+ } else if (NEXT_FACET_NAME.equals(facetName)) {
+ newPage = getPage() + 1;
} else if (FAST_FORWARD_FACET_NAME.equals(facetName)) {
- newPage = getPage() + getFastStepOrDefault();
+ newPage = getPage() + getFastStep();
} else if (FAST_REWIND_FACET_NAME.equals(facetName)) {
- newPage = getPage() - getFastStepOrDefault();
+ newPage = getPage() - getFastStep();
} else {
try {
newPage = Integer.parseInt(facetName.toString());
@@ -234,7 +237,15 @@
public UIComponent getLast() {
return getFacetByKey(LAST_FACET_NAME);
}
+
+ public UIComponent getNext() {
+ return getFacetByKey(NEXT_FACET_NAME);
+ }
+ public UIComponent getPrevious() {
+ return getFacetByKey(PREVIOUS_FACET_NAME);
+ }
+
public UIComponent getFastForward() {
return getFacetByKey(FAST_FORWARD_FACET_NAME);
}
Modified: branches/RF-7944/ui/iteration/ui/src/main/java/org/richfaces/component/AbstractExtendedDataTable.java
===================================================================
--- branches/RF-7944/ui/iteration/ui/src/main/java/org/richfaces/component/AbstractExtendedDataTable.java 2010-09-03 12:00:31 UTC (rev 19109)
+++ branches/RF-7944/ui/iteration/ui/src/main/java/org/richfaces/component/AbstractExtendedDataTable.java 2010-09-03 12:51:59 UTC (rev 19110)
@@ -40,7 +40,7 @@
import org.richfaces.context.ExtendedVisitContext;
import org.richfaces.context.ExtendedVisitContextMode;
import org.richfaces.log.RichfacesLogger;
-import org.slf4j.Logger;
+import org.richfaces.log.Logger;
/**
Modified: branches/RF-7944/ui/iteration/ui/src/main/java/org/richfaces/component/UIDataTableBase.java
===================================================================
--- branches/RF-7944/ui/iteration/ui/src/main/java/org/richfaces/component/UIDataTableBase.java 2010-09-03 12:00:31 UTC (rev 19109)
+++ branches/RF-7944/ui/iteration/ui/src/main/java/org/richfaces/component/UIDataTableBase.java 2010-09-03 12:51:59 UTC (rev 19110)
@@ -60,7 +60,7 @@
import org.richfaces.model.SortField;
import org.richfaces.model.SortMode;
import org.richfaces.renderkit.MetaComponentRenderer;
-import org.slf4j.Logger;
+import org.richfaces.log.Logger;
public abstract class UIDataTableBase extends UISequence implements Row, MetaComponentResolver, MetaComponentEncoder {
Modified: branches/RF-7944/ui/iteration/ui/src/main/java/org/richfaces/event/DataTablePreRenderListener.java
===================================================================
--- branches/RF-7944/ui/iteration/ui/src/main/java/org/richfaces/event/DataTablePreRenderListener.java 2010-09-03 12:00:31 UTC (rev 19109)
+++ branches/RF-7944/ui/iteration/ui/src/main/java/org/richfaces/event/DataTablePreRenderListener.java 2010-09-03 12:51:59 UTC (rev 19110)
@@ -41,7 +41,7 @@
import org.richfaces.component.UIDataAdaptor;
import org.richfaces.component.util.MessageUtil;
import org.richfaces.log.RichfacesLogger;
-import org.slf4j.Logger;
+import org.richfaces.log.Logger;
public class DataTablePreRenderListener implements SystemEventListener {
Modified: branches/RF-7944/ui/iteration/ui/src/main/java/org/richfaces/renderkit/ColumnGroupRenderer.java
===================================================================
--- branches/RF-7944/ui/iteration/ui/src/main/java/org/richfaces/renderkit/ColumnGroupRenderer.java 2010-09-03 12:00:31 UTC (rev 19109)
+++ branches/RF-7944/ui/iteration/ui/src/main/java/org/richfaces/renderkit/ColumnGroupRenderer.java 2010-09-03 12:51:59 UTC (rev 19110)
@@ -52,7 +52,10 @@
Iterator<UIComponent> components = row.columns();
while(components.hasNext()){
- encodeColumn(facesContext, writer, (UIColumn)components.next(),rowHolder);
+ UIColumn column = (UIColumn)components.next();
+ if(column.isRendered()) {
+ encodeColumn(facesContext, writer, column,rowHolder);
+ }
}
encodeRowEnd(writer);
}
Modified: branches/RF-7944/ui/iteration/ui/src/main/java/org/richfaces/renderkit/ControlsState.java
===================================================================
--- branches/RF-7944/ui/iteration/ui/src/main/java/org/richfaces/renderkit/ControlsState.java 2010-09-03 12:00:31 UTC (rev 19109)
+++ branches/RF-7944/ui/iteration/ui/src/main/java/org/richfaces/renderkit/ControlsState.java 2010-09-03 12:51:59 UTC (rev 19110)
@@ -35,7 +35,15 @@
private boolean lastRendered = true;
private boolean lastEnabled = true;
+
+ private boolean nextRendered = true;
+
+ private boolean nextEnabled = true;
+ private boolean previousRendered = true;
+
+ private boolean previousEnabled = true;
+
private boolean fastRewindRendered = true;
private boolean fastRewindEnabled = true;
@@ -109,8 +117,40 @@
public void setFastForwardEnabled(boolean fastForwardEnabled) {
this.fastForwardEnabled = fastForwardEnabled;
}
+
+ public boolean getNextRendered() {
+ return nextRendered;
+ }
- public boolean isControlsSeparatorRendered() {
+ public void setNextRendered(boolean nextRendered) {
+ this.nextRendered = nextRendered;
+ }
+
+ public boolean getNextEnabled() {
+ return nextEnabled;
+ }
+
+ public void setNextEnabled(boolean nextEnabled) {
+ this.nextEnabled = nextEnabled;
+ }
+
+ public boolean getPreviousRendered() {
+ return previousRendered;
+ }
+
+ public void setPreviousRendered(boolean previousRendered) {
+ this.previousRendered = previousRendered;
+ }
+
+ public boolean getPreviousEnabled() {
+ return previousEnabled;
+ }
+
+ public void setPreviousEnabled(boolean previousEnabled) {
+ this.previousEnabled = previousEnabled;
+ }
+
+ public boolean getControlsSeparatorRendered() {
return controlsSeparatorRendered;
}
Modified: branches/RF-7944/ui/iteration/ui/src/main/java/org/richfaces/renderkit/DataScrollerBaseRenderer.java
===================================================================
--- branches/RF-7944/ui/iteration/ui/src/main/java/org/richfaces/renderkit/DataScrollerBaseRenderer.java 2010-09-03 12:00:31 UTC (rev 19109)
+++ branches/RF-7944/ui/iteration/ui/src/main/java/org/richfaces/renderkit/DataScrollerBaseRenderer.java 2010-09-03 12:51:59 UTC (rev 19110)
@@ -87,10 +87,10 @@
boolean useFirst = true;
boolean useLast = true;
-
+
boolean useBackFast = true;
boolean useForwFast = true;
-
+
ControlsState controlsState = new ControlsState();
if (pageIndex <= minPageIdx) {
@@ -110,6 +110,7 @@
}
String boundaryControls = (String) component.getAttributes().get("boundaryControls");
+ String stepControls = (String) component.getAttributes().get("stepControls");
String fastControls = (String) component.getAttributes().get("fastControls");
boolean isAuto = "auto".equals(boundaryControls);
@@ -125,7 +126,21 @@
controlsState.setFirstRendered(false);
controlsState.setLastRendered(false);
}
+
+ isAuto = "auto".equals(stepControls);
+ if (isAuto || "show".equals(stepControls)) {
+ if (isAuto) {
+ controlsState.setPreviousRendered(useFirst);
+ controlsState.setNextRendered(useLast);
+ }
+ controlsState.setPreviousEnabled(useFirst);
+ controlsState.setNextEnabled(useLast);
+ } else {
+ controlsState.setPreviousRendered(false);
+ controlsState.setNextRendered(false);
+ }
+
isAuto = "auto".equals(fastControls);
if (isAuto || "show".equals(fastControls)) {
if (isAuto) {
@@ -253,9 +268,17 @@
left.put(clientId + "_ds_fr", AbstractDataScroller.FAST_REWIND_FACET_NAME);
}
+ if (controlsState.getPreviousRendered() && controlsState.getPreviousEnabled()) {
+ left.put(clientId + "_ds_prev", AbstractDataScroller.PREVIOUS_FACET_NAME);
+ }
+
if (controlsState.getFastForwardRendered() && controlsState.getFastForwardEnabled()) {
right.put(clientId + "_ds_ff", AbstractDataScroller.FAST_FORWARD_FACET_NAME);
}
+
+ if (controlsState.getNextRendered() && controlsState.getNextEnabled()) {
+ right.put(clientId + "_ds_next", AbstractDataScroller.NEXT_FACET_NAME);
+ }
if (controlsState.getLastRendered() && controlsState.getLastEnabled()) {
right.put(clientId + "_ds_l", AbstractDataScroller.LAST_FACET_NAME);
@@ -306,6 +329,10 @@
definition.addToBody(buffer);
return definition;
}
+
+ public void encodeFacet(FacesContext context, UIComponent component) throws IOException {
+ component.encodeAll(context);
+ }
public boolean getRendersChildren() {
return true;
Modified: branches/RF-7944/ui/iteration/ui/src/main/java/org/richfaces/renderkit/DataTableRenderer.java
===================================================================
--- branches/RF-7944/ui/iteration/ui/src/main/java/org/richfaces/renderkit/DataTableRenderer.java 2010-09-03 12:00:31 UTC (rev 19109)
+++ branches/RF-7944/ui/iteration/ui/src/main/java/org/richfaces/renderkit/DataTableRenderer.java 2010-09-03 12:51:59 UTC (rev 19110)
@@ -149,72 +149,73 @@
RowHolder rowHolder = (RowHolder) holder;
Row row = rowHolder.getRow();
- AbstractDataTable dataTable = (AbstractDataTable)row;
-
- boolean partialUpdate = rowHolder.isUpdatePartial();
+ AbstractDataTable dataTable = (AbstractDataTable) row;
+
+ boolean partialUpdate = rowHolder.isUpdatePartial();
boolean parentTbodyStart = rowHolder.isEncodeParentTBody();
boolean tbodyStart = parentTbodyStart;
-
+
rowHolder.setRowStart(true);
Iterator<UIComponent> components = row.columns();
while (components.hasNext()) {
-
UIComponent child = components.next();
- if(child instanceof Row) {
- boolean isSubtable = (child instanceof AbstractSubTable);
- //new row -> close </tr>
- if (rowHolder.getProcessCell() != 0) {
- encodeRowEnd(writer);
+ if (child.isRendered()) {
+ if (child instanceof Row) {
+ boolean isSubtable = (child instanceof AbstractSubTable);
+ // new row -> close </tr>
+ if (rowHolder.getProcessCell() != 0) {
+ encodeRowEnd(writer);
- if(isSubtable) {
- encodeTableBodyEnd(writer);
- tbodyStart = false;
-
- if (partialUpdate) {
- partialEnd(facesContext);
+ if (isSubtable) {
+ encodeTableBodyEnd(writer);
+ tbodyStart = false;
+
+ if (partialUpdate) {
+ partialEnd(facesContext);
+ }
}
}
- }
-
- rowHolder.nextCell();
-
- if(isSubtable && partialUpdate){
- String id = dataTable.getRelativeClientId(facesContext) + ":"+ child.getId() +":c";
- partialStart(facesContext, id);
- }
-
- child.encodeAll(facesContext);
-
- if (isSubtable && partialUpdate) {
- partialEnd(facesContext);
- }
-
- } else if(child instanceof UIColumn) {
-
- if(!parentTbodyStart && !tbodyStart) {
- if (partialUpdate) {
- partialStart(facesContext, dataTable.getRelativeClientId(facesContext) + ":tb");
+
+ rowHolder.nextCell();
+
+ if (isSubtable && partialUpdate) {
+ String id = dataTable.getRelativeClientId(facesContext) + ":" + child.getId() + ":c";
+ partialStart(facesContext, id);
}
-
- encodeTableBodyStart(writer, facesContext, dataTable);
- rowHolder.setRowStart(true);
- tbodyStart = true;
- }
-
- encodeColumn(facesContext, writer, (UIColumn)child, rowHolder);
-
- if(!components.hasNext()) {
- encodeRowEnd(writer);
-
- if(!parentTbodyStart && tbodyStart) {
- encodeTableBodyEnd(writer);
- tbodyStart = false;
-
- if(partialUpdate) {
- partialEnd(facesContext);
+
+ child.encodeAll(facesContext);
+
+ if (isSubtable && partialUpdate) {
+ partialEnd(facesContext);
+ }
+
+ } else if (child instanceof UIColumn) {
+
+ if (!parentTbodyStart && !tbodyStart) {
+ if (partialUpdate) {
+ partialStart(facesContext, dataTable.getRelativeClientId(facesContext) + ":tb");
}
+
+ encodeTableBodyStart(writer, facesContext, dataTable);
+ rowHolder.setRowStart(true);
+ tbodyStart = true;
}
+
+ encodeColumn(facesContext, writer, (UIColumn) child, rowHolder);
+
+ if (!components.hasNext()) {
+ encodeRowEnd(writer);
+
+ if (!parentTbodyStart && tbodyStart) {
+ encodeTableBodyEnd(writer);
+ tbodyStart = false;
+
+ if (partialUpdate) {
+ partialEnd(facesContext);
+ }
+ }
+ }
}
}
}
Modified: branches/RF-7944/ui/iteration/ui/src/main/java/org/richfaces/renderkit/SubTableRenderer.java
===================================================================
--- branches/RF-7944/ui/iteration/ui/src/main/java/org/richfaces/renderkit/SubTableRenderer.java 2010-09-03 12:00:31 UTC (rev 19109)
+++ branches/RF-7944/ui/iteration/ui/src/main/java/org/richfaces/renderkit/SubTableRenderer.java 2010-09-03 12:51:59 UTC (rev 19110)
@@ -194,18 +194,19 @@
while (components.hasNext()) {
UIComponent component = components.next();
-
- if(component instanceof UIColumn) {
- encodeColumn(facesContext, writer, (UIColumn)component , rowHolder);
-
- } else if (component instanceof AbstractSubTable) {
- if(component.isRendered()) {
- encodeRowEnd(writer);
+ if(component.isRendered()) {
+ if(component instanceof UIColumn ) {
+ encodeColumn(facesContext, writer, (UIColumn)component , rowHolder);
+
+ } else if (component instanceof AbstractSubTable) {
+ if(component.isRendered()) {
+ encodeRowEnd(writer);
+ }
+
+ component.encodeAll(facesContext);
+ rowHolder.setRowStart(true);
}
-
- component.encodeAll(facesContext);
- rowHolder.setRowStart(true);
- }
+ }
}
encodeRowEnd(writer);
Modified: branches/RF-7944/ui/iteration/ui/src/main/resources/META-INF/resources/org.richfaces/datascroller.js
===================================================================
--- branches/RF-7944/ui/iteration/ui/src/main/resources/META-INF/resources/org.richfaces/datascroller.js 2010-09-03 12:00:31 UTC (rev 19109)
+++ branches/RF-7944/ui/iteration/ui/src/main/resources/META-INF/resources/org.richfaces/datascroller.js 2010-09-03 12:51:59 UTC (rev 19110)
@@ -132,13 +132,21 @@
RichFaces.Event.fireById(this.id, this.getScrollEventName(), {'page' : page});
}
},
-
+
+ fastForward: function() {
+ this.switchToPage("fastforward");
+ },
+
+ fastRewind: function() {
+ this.switchToPage("fastrewind");
+ },
+
next: function() {
- this.switchToPage("fastforward");
+ this.switchToPage("next");
},
previous: function() {
- this.switchToPage("fastrewind");
+ this.switchToPage("previous");
},
first: function() {
Copied: branches/RF-7944/ui/iteration/ui/src/main/templates/buttons.template.include (from rev 19108, trunk/ui/iteration/ui/src/main/templates/buttons.template.include)
===================================================================
--- branches/RF-7944/ui/iteration/ui/src/main/templates/buttons.template.include (rev 0)
+++ branches/RF-7944/ui/iteration/ui/src/main/templates/buttons.template.include 2010-09-03 12:51:59 UTC (rev 19110)
@@ -0,0 +1,51 @@
+<!--
+JBoss, Home of Professional Open Source
+Copyright ${year}, Red Hat, Inc. and individual contributors
+by the @authors tag. See the copyright.txt in the distribution for a
+full listing of individual contributors.
+
+
+This is free software; you can redistribute it and/or modify it
+under the terms of the GNU Lesser General Public License as
+published by the Free Software Foundation; either version 2.1 of
+the License, or (at your option) any later version.
+
+
+This software is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+Lesser General Public License for more details.
+
+
+You should have received a copy of the GNU Lesser General Public
+License along with this software; if not, write to the Free
+Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+02110-1301 USA, or see the FSF site: http://www.fsf.org.
+-->
+
+<c:choose xmlns:c="http://jboss.org/schema/richfaces/cdk/jstl/core" xmlns:cdk="http://jboss.org/schema/richfaces/cdk/core">
+ <c:when test="#{isEnabled}">
+ <a id="#{id}" class="#{enabledStyles}" href="javascript:void(0);" >
+ <c:choose>
+ <c:when test="#{facet != null}">
+ <cdk:call expression="encodeFacet(facesContext, facet);"/>
+ </c:when>
+ <c:otherwise>
+ #{defaultText}
+ </c:otherwise>
+ </c:choose>
+ </a>
+ </c:when>
+ <c:otherwise>
+ <span id="#{id}" class="#{disabledStyles}">
+ <c:choose>
+ <c:when test="#{facet != null}">
+ <cdk:call expression="encodeFacet(facesContext, facet);"/>
+ </c:when>
+ <c:otherwise>
+ #{defaultText}
+ </c:otherwise>
+ </c:choose>
+ </span>
+ </c:otherwise>
+</c:choose>
Modified: branches/RF-7944/ui/iteration/ui/src/main/templates/datascroller.template.xml
===================================================================
--- branches/RF-7944/ui/iteration/ui/src/main/templates/datascroller.template.xml 2010-09-03 12:00:31 UTC (rev 19109)
+++ branches/RF-7944/ui/iteration/ui/src/main/templates/datascroller.template.xml 2010-09-03 12:51:59 UTC (rev 19110)
@@ -1,8 +1,32 @@
<?xml version="1.0" encoding="UTF-8"?>
+<!--
+JBoss, Home of Professional Open Source
+Copyright ${year}, Red Hat, Inc. and individual contributors
+by the @authors tag. See the copyright.txt in the distribution for a
+full listing of individual contributors.
+
+This is free software; you can redistribute it and/or modify it
+under the terms of the GNU Lesser General Public License as
+published by the Free Software Foundation; either version 2.1 of
+the License, or (at your option) any later version.
+
+
+This software is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+Lesser General Public License for more details.
+
+
+You should have received a copy of the GNU Lesser General Public
+License along with this software; if not, write to the Free
+Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+02110-1301 USA, or see the FSF site: http://www.fsf.org.
+-->
+
<cdk:root xmlns="http://jboss.org/schema/richfaces/cdk/xhtml-el" xmlns:cdk="http://jboss.org/schema/richfaces/cdk/core"
xmlns:c="http://jboss.org/schema/richfaces/cdk/jstl/core" xmlns:cc="http://jboss.org/schema/richfaces/cdk/jsf/composite"
- xmlns:javaee="http://java.sun.com/xml/ns/javaee">
+ xmlns:javaee="http://java.sun.com/xml/ns/javaee" xmlns:xi="http://www.w3.org/2001/XInclude">
<cc:interface>
<cdk:class>org.richfaces.renderkit.html.DataScrollerRenderer</cdk:class>
@@ -12,81 +36,79 @@
</cc:interface>
<cc:implementation>
-
<cdk:object type="org.richfaces.renderkit.ControlsState" name="controlsState" value="#{getControlsState(facesContext,component)}" />
<span id="#{clientId}" class="rf-ds"><!-- Now decor is disabled !!! -->
+
<c:if test="#{controlsState.firstRendered}">
- <c:choose>
- <c:when test="#{controlsState.firstEnabled}">
- <a id="#{clientId}_ds_f" class="rf-ds-btn rf-ds-l" href="javascript:void(0)" >
- ««
- </a>
- </c:when>
- <c:otherwise>
- <span id="#{clientId}_ds_f" class="rf-ds-btn rf-ds-l rf-ds-dis">
- ««
- </span>
- </c:otherwise>
- </c:choose>
+ <cdk:object type="boolean" name="isEnabled" value="#{controlsState.firstEnabled}"/>
+ <cdk:object type="UIComponent" name="facet" value="#{component.getFacet('first')}"/>
+ <cdk:object type="String" name="enabledStyles" value="rf-ds-btn rf-ds-l"/>
+ <cdk:object type="String" name="disabledStyles" value="rf-ds-btn rf-ds-l rf-ds-dis"/>
+ <cdk:object type="String" name="id" value="#{clientId}_ds_f"/>
+ <cdk:object type="String" name="defaultText" value="««««"/>
+ <xi:include xpointer="xpointer(/*)" href="buttons.template.include" />
</c:if>
-
<c:if test="#{controlsState.fastRewindRendered}">
- <c:choose>
- <c:when test="#{controlsState.fastRewindEnabled}">
- <a id="#{clientId}_ds_fr" class="rf-ds-btn rf-ds-l" href="javascript:void(0)">
- «
- </a>
- </c:when>
- <c:otherwise>
- <span id="#{clientId}_ds_fr" class="rf-ds-btn rf-ds-l rf-ds-dis">
- «
- </span>
- </c:otherwise>
- </c:choose>
+ <cdk:object type="boolean" name="isEnabled" value="#{controlsState.fastRewindEnabled}"/>
+ <cdk:object type="UIComponent" name="facet" value="#{component.getFacet('fastRewind')}"/>
+ <cdk:object type="java.lang.String" name="enabledStyles" value="rf-ds-btn rf-ds-l"/>
+ <cdk:object type="java.lang.String" name="disabledStyles" value="rf-ds-btn rf-ds-l rf-ds-dis"/>
+ <cdk:object type="java.lang.String" name="id" value="#{clientId}_ds_fr"/>
+ <cdk:object type="java.lang.String" name="defaultText" value="««"/>
+ <xi:include xpointer="xpointer(/*)" href="buttons.template.include" />
</c:if>
+
+ <c:if test="#{controlsState.previousRendered}">
+ <cdk:object name="isEnabled" value="#{controlsState.previousEnabled}"/>
+ <cdk:object name="facet" value="#{component.getFacet('previous')}"/>
+ <cdk:object type="java.lang.String" name="enabledStyles" value="rf-ds-btn rf-ds-l"/>
+ <cdk:object type="java.lang.String" name="disabledStyles" value="rf-ds-btn rf-ds-l rf-ds-dis"/>
+ <cdk:object name="id" value="#{clientId}_ds_prev"/>
+ <cdk:object name="defaultText" value="«"/>
+ <xi:include xpointer="xpointer(/*)" href="buttons.template.include" />
+ </c:if>
- <cdk:object type="java.util.Map" name="digitals" value="#{renderPager(responseWriter, facesContext, component)}" />
-
- <c:if test="#{controlsState.fastForwardRendered}">
- <c:choose>
- <c:when test="#{controlsState.fastForwardEnabled}">
- <a id="#{clientId}_ds_ff" class="rf-ds-btn rf-ds-r" href="javascript:void(0)">
- »
- </a>
- </c:when>
- <c:otherwise>
- <span id="#{clientId}_ds_ff" class="rf-ds-btn rf-ds-r rf-ds-dis">
- »
- </span>
- </c:otherwise>
- </c:choose>
+ <cdk:object type="java.util.Map" name="digitals" value="#{renderPager(responseWriter, facesContext, component)}" />
+
+ <c:if test="#{controlsState.nextRendered}">
+ <cdk:object name="isEnabled" value="#{controlsState.nextEnabled}"/>
+ <cdk:object name="facet" value="#{component.getFacet('next')}"/>
+ <cdk:object type="java.lang.String" name="enabledStyles" value="rf-ds-btn rf-ds-r"/>
+ <cdk:object type="java.lang.String" name="disabledStyles" value="rf-ds-btn rf-ds-r rf-ds-dis"/>
+ <cdk:object name="id" value="#{clientId}_ds_next"/>
+ <cdk:object name="defaultText" value="»"/>
+ <xi:include xpointer="xpointer(/*)" href="buttons.template.include" />
</c:if>
+ <c:if test="#{controlsState.fastForwardRendered}">
+ <cdk:object name="isEnabled" value="#{controlsState.fastForwardEnabled}"/>
+ <cdk:object name="facet" value="#{component.getFacet('fastForward')}"/>
+ <cdk:object type="java.lang.String" name="enabledStyles" value="rf-ds-btn rf-ds-r"/>
+ <cdk:object type="java.lang.String" name="disabledStyles" value="rf-ds-btn rf-ds-r rf-ds-dis"/>
+ <cdk:object name="id" value="#{clientId}_ds_ff"/>
+ <cdk:object name="defaultText" value="»»"/>
+ <xi:include xpointer="xpointer(/*)" href="buttons.template.include" />
+ </c:if>
+
<c:if test="#{controlsState.lastRendered}">
- <c:choose>
- <c:when test="#{controlsState.lastEnabled}">
- <a id="#{clientId}_ds_l" class="rf-ds-btn rf-ds-r" href="javascript:void(0)">
- »»
- </a>
- </c:when>
- <c:otherwise>
- <span id="#{clientId}_ds_l" class="rf-ds-btn rf-ds-r rf-ds-dis">
- »»
- </span>
- </c:otherwise>
- </c:choose>
- </c:if>
-
+ <cdk:object name="isEnabled" value="#{controlsState.lastEnabled}"/>
+ <cdk:object name="facet" value="#{component.getFacet('last')}"/>
+ <cdk:object type="java.lang.String" name="enabledStyles" value="rf-ds-btn rf-ds-r"/>
+ <cdk:object type="java.lang.String" name="disabledStyles" value="rf-ds-btn rf-ds-r rf-ds-dis"/>
+ <cdk:object name="id" value="#{clientId}_ds_l"/>
+ <cdk:object name="defaultText" value="»»»»"/>
+ <xi:include xpointer="xpointer(/*)" href="buttons.template.include" />
+ </c:if>
+
<cdk:object type="java.util.Map" name="buttons" value="#{getControls(facesContext, component, controlsState)}" />
<script type="text/javascript">
<cdk:call expression="buildScript(responseWriter, facesContext, component, buttons, digitals);"/>
</script>
</span>
-
-
+
</cc:implementation>
</cdk:root>
\ No newline at end of file
Copied: branches/RF-7944/ui/iteration/ui/src/test/java/org/richfaces/component/UIDataTableTest.java (from rev 19108, trunk/ui/iteration/ui/src/test/java/org/richfaces/component/UIDataTableTest.java)
===================================================================
--- branches/RF-7944/ui/iteration/ui/src/test/java/org/richfaces/component/UIDataTableTest.java (rev 0)
+++ branches/RF-7944/ui/iteration/ui/src/test/java/org/richfaces/component/UIDataTableTest.java 2010-09-03 12:51:59 UTC (rev 19110)
@@ -0,0 +1,274 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright ${year}, Red Hat, Inc. and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+
+package org.richfaces.component;
+
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.List;
+
+import javax.el.ELContext;
+import javax.el.ExpressionFactory;
+import javax.faces.component.UIComponent;
+import javax.faces.component.UIOutput;
+import javax.faces.context.FacesContext;
+
+import org.ajax4jsf.model.DataVisitor;
+import org.ajax4jsf.model.ExtendedDataModel;
+import org.ajax4jsf.model.Range;
+import org.jboss.test.faces.AbstractFacesTest;
+import org.junit.After;
+import org.junit.Assert;
+import org.junit.Before;
+import org.junit.Test;
+import org.richfaces.model.Arrangeable;
+import org.richfaces.model.ArrangeableState;
+import org.richfaces.model.FilterField;
+import org.richfaces.model.SortField;
+import org.richfaces.model.SortMode;
+
+/**
+ * @author Konstantin Mishin
+ *
+ */
+public class UIDataTableTest extends AbstractFacesTest {
+
+ private class MockArrangeableModel extends ExtendedDataModel<Object> implements Arrangeable {
+
+ private ArrangeableState state;
+ @Override
+ public Object getRowKey() {
+ return null;
+ }
+
+ @Override
+ public void setRowKey(Object key) {
+ }
+
+ @Override
+ public void walk(FacesContext context, DataVisitor visitor, Range range, Object argument) {
+ }
+
+ @Override
+ public int getRowCount() {
+ return 0;
+ }
+
+ @Override
+ public Object getRowData() {
+ return null;
+ }
+
+ @Override
+ public int getRowIndex() {
+ return 0;
+ }
+
+ @Override
+ public Object getWrappedData() {
+ return null;
+ }
+
+ @Override
+ public boolean isRowAvailable() {
+ return false;
+ }
+
+ @Override
+ public void setRowIndex(int rowIndex) {
+ }
+
+ @Override
+ public void setWrappedData(Object data) {
+ }
+
+ public void arrange(FacesContext context, ArrangeableState state) {
+ this.state = state;
+ }
+
+ public ArrangeableState getState() {
+ return state;
+ }
+
+ }
+ private UIDataTable table = null;
+
+ /**
+ * @throws java.lang.Exception
+ */
+ @Before
+ public void setUp() throws Exception {
+ super.setUp();
+ setupFacesRequest();
+ table = new UIDataTable();
+ }
+
+ /**
+ * @throws java.lang.Exception
+ */
+ @After
+ public void tearDown() throws Exception {
+ table = null;
+ super.tearDown();
+ }
+
+ /**
+ * Test method for {@link org.richfaces.component.UIDataTableBase#getRendersChildren()}.
+ */
+ @Test
+ public void testGetRendersChildren() {
+ Assert.assertTrue(table.getRendersChildren());
+ }
+
+ /**
+ * Test method for {@link org.richfaces.component.UIDataTableBase#dataChildren()}.
+ */
+ @Test
+ public void testDataChildren() {
+ Assert.assertTrue(table.dataChildren() instanceof DataTableDataIterator);
+ }
+
+ /**
+ * Test method for {@link org.richfaces.component.UIDataTableBase#fixedChildren()}.
+ */
+ @Test
+ public void testFixedChildren() {
+ Assert.assertTrue(table.fixedChildren() instanceof DataTableFixedChildrenIterator);
+ }
+
+ /**
+ * Test method for {@link org.richfaces.component.UIDataTableBase#createExtendedDataModel()}.
+ */
+ @Test
+ public void testCreateExtendedDataModel() {
+ Assert.assertFalse(table.createExtendedDataModel() instanceof Arrangeable);
+ List<String> sortPriority = Arrays.asList("id2", "id0", "id1");
+ List<UIComponent> children = table.getChildren();
+ ExpressionFactory expressionFactory = facesContext.getApplication().getExpressionFactory();
+ ELContext elContext = facesContext.getELContext();
+ UIColumn column = new UIColumn();
+ column.setRendered(false);
+ children.add(column);
+ for (int i = 0; i < sortPriority.size(); i++) {
+ UIColumn child = new UIColumn();
+ child.setId("id" + i);
+ child.setValueExpression("filterExpression", expressionFactory
+ .createValueExpression(elContext, "#{'id" + i + "'}", Object.class));
+ child.setValueExpression("sortBy", expressionFactory
+ .createValueExpression(elContext, "#{'id" + i + "'}", Object.class));
+ child.setSortOrder(SortOrder.ascending);
+ children.add(child);
+ }
+ Assert.assertTrue(table.createExtendedDataModel() instanceof Arrangeable);
+ MockArrangeableModel model = new MockArrangeableModel();
+ table.setValue(model);
+ table.setSortPriority(sortPriority);
+ Assert.assertSame(model, table.createExtendedDataModel());
+ ArrangeableState state = model.getState();
+ List<FilterField> filterFields = state.getFilterFields();
+ for (int i = 0; i < sortPriority.size(); i++) {
+ Assert.assertEquals("id" + i , filterFields.get(i).getFilterExpression().getValue(elContext));
+ }
+ List<SortField> sortFields = state.getSortFields();
+ for (int i = 0; i < sortPriority.size(); i++) {
+ Assert.assertEquals(sortPriority.get(i), sortFields.get(i).getSortBy().getValue(elContext));
+ }
+ Assert.assertEquals(facesContext.getViewRoot().getLocale(), state.getLocale());
+ }
+
+ /**
+ * Test method for {@link org.richfaces.component.UIDataTableBase#columns()}.
+ */
+ @Test
+ public void testColumns() {
+ Assert.assertTrue(table.columns() instanceof DataTableColumnsIterator);
+ }
+
+ /**
+ * Test method for {@link org.richfaces.component.UIDataTableBase#getHeader()}.
+ */
+ @Test
+ public void testGetHeader() {
+ UIOutput component = new UIOutput();
+ table.getFacets().put("header", component);
+ Assert.assertSame(component, table.getHeader());
+ }
+
+ /**
+ * Test method for {@link org.richfaces.component.UIDataTableBase#getFooter()}.
+ */
+ @Test
+ public void testGetFooter() {
+ UIOutput component = new UIOutput();
+ table.getFacets().put("footer", component);
+ Assert.assertSame(component, table.getFooter());
+ }
+
+ /**
+ * Test method for {@link org.richfaces.component.UIDataTableBase#getFilterVar()} and
+ * {@link org.richfaces.component.UIDataTableBase#setFilterVar(java.lang.String)}.
+ */
+ @Test
+ public void testFilterVar() {
+ String string = "fv";
+ table.setFilterVar(string);
+ Assert.assertEquals(string, table.getFilterVar());
+ }
+
+ /**
+ * Test method for {@link org.richfaces.component.UIDataTableBase#getSortPriority()} and
+ * {@link org.richfaces.component.UIDataTableBase#setSortPriority(java.util.Collection)}.
+ */
+ @Test
+ public void testSortPriority() {
+ table.setSortPriority(Collections.EMPTY_LIST);
+ Assert.assertEquals(Collections.EMPTY_LIST, table.getSortPriority());
+ }
+
+ /**
+ * Test method for {@link org.richfaces.component.UIDataTableBase#getSortMode()} and
+ * {@link org.richfaces.component.UIDataTableBase#setSortMode(org.richfaces.model.SortMode)}.
+ */
+ @Test
+ public void testSortMode() {
+ table.setSortMode(SortMode.multi);
+ Assert.assertEquals(SortMode.multi, table.getSortMode());
+ }
+
+ /**
+ * Test method for {@link org.richfaces.component.UIDataTableBase#isColumnFacetPresent(java.lang.String)}.
+ */
+ @Test
+ public void testIsColumnFacetPresent() {
+ String facetName = "header";
+ Assert.assertFalse(table.isColumnFacetPresent(facetName));
+ UIColumn child = new UIColumn();
+ List<UIComponent> children = table.getChildren();
+ children.add(new UIColumn());
+ children.add(child);
+ Assert.assertFalse(table.isColumnFacetPresent(facetName));
+ child.getFacets().put(facetName, new UIOutput());
+ Assert.assertTrue(table.isColumnFacetPresent(facetName));
+ child.setRendered(false);
+ Assert.assertFalse(table.isColumnFacetPresent(facetName));
+ }
+}
Modified: branches/RF-7944/ui/iteration/ui/src/test/java/org/richfaces/renderkit/DataGridRendererTest.java
===================================================================
--- branches/RF-7944/ui/iteration/ui/src/test/java/org/richfaces/renderkit/DataGridRendererTest.java 2010-09-03 12:00:31 UTC (rev 19109)
+++ branches/RF-7944/ui/iteration/ui/src/test/java/org/richfaces/renderkit/DataGridRendererTest.java 2010-09-03 12:51:59 UTC (rev 19110)
@@ -15,7 +15,6 @@
import org.junit.Before;
import org.junit.Test;
import org.richfaces.component.AbstractDataGrid;
-import org.richfaces.component.UIDataGrid;
import com.gargoylesoftware.htmlunit.html.HtmlElement;
import com.gargoylesoftware.htmlunit.html.HtmlPage;
Copied: branches/RF-7944/ui/iteration/ui/src/test/java/org/richfaces/renderkit/DataScrollerBean.java (from rev 19108, trunk/ui/iteration/ui/src/test/java/org/richfaces/renderkit/DataScrollerBean.java)
===================================================================
--- branches/RF-7944/ui/iteration/ui/src/test/java/org/richfaces/renderkit/DataScrollerBean.java (rev 0)
+++ branches/RF-7944/ui/iteration/ui/src/test/java/org/richfaces/renderkit/DataScrollerBean.java 2010-09-03 12:51:59 UTC (rev 19110)
@@ -0,0 +1,37 @@
+package org.richfaces.renderkit;
+
+import java.util.ArrayList;
+import java.util.List;
+
+public class DataScrollerBean {
+
+ private List<String> content;
+
+ private int pageNumber = 1;
+
+
+ public DataScrollerBean() {
+ content = new ArrayList<String>();
+ content.add("1 page content");
+ content.add("2 page content");
+ content.add("3 page content");
+ content.add("4 page content");
+ content.add("5 page content");
+ }
+
+ public List<String> getContent() {
+ return content;
+ }
+
+ public void setContent(List<String> content) {
+ this.content = content;
+ }
+
+ public int getPageNumber() {
+ return pageNumber;
+ }
+
+ public void setPageNumber(int pageNumber) {
+ this.pageNumber = pageNumber;
+ }
+}
Copied: branches/RF-7944/ui/iteration/ui/src/test/java/org/richfaces/renderkit/DataScrollerRenderTest.java (from rev 19108, trunk/ui/iteration/ui/src/test/java/org/richfaces/renderkit/DataScrollerRenderTest.java)
===================================================================
--- branches/RF-7944/ui/iteration/ui/src/test/java/org/richfaces/renderkit/DataScrollerRenderTest.java (rev 0)
+++ branches/RF-7944/ui/iteration/ui/src/test/java/org/richfaces/renderkit/DataScrollerRenderTest.java 2010-09-03 12:51:59 UTC (rev 19110)
@@ -0,0 +1,582 @@
+package org.richfaces.renderkit;
+
+import static org.junit.Assert.assertEquals;
+
+import java.io.File;
+import java.util.List;
+
+import org.ajax4jsf.renderkit.RendererUtils.HTML;
+import org.jboss.test.faces.htmlunit.HtmlUnitEnvironment;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+
+import com.gargoylesoftware.htmlunit.html.DomNode;
+import com.gargoylesoftware.htmlunit.html.HtmlElement;
+import com.gargoylesoftware.htmlunit.html.HtmlPage;
+
+
+
+/**
+ * @author Anton Belevich
+ *
+ */
+public class DataScrollerRenderTest {
+
+ private HtmlUnitEnvironment environment;
+
+ @Before
+ public void setUp() {
+ environment = new HtmlUnitEnvironment();
+ environment.withWebRoot(new File("src/test/resources"));
+ environment.withResource("/WEB-INF/faces-config.xml", "org/richfaces/renderkit/faces-config.xml");
+ environment.withResource("/test.xhtml", "org/richfaces/renderkit/dataTableTest.xhtml");
+ environment.start();
+ }
+
+ @Test
+ public void testEncoding() throws Exception {
+ HtmlPage page = environment.getPage("/test.jsf");
+
+ String scrollerId = "scroller1";
+ //first scroll
+ List<?> nodes = page.getByXPath("//*[@id = 'form:scroller1']");
+
+ assertEquals(1, nodes.size());
+ HtmlElement span = (HtmlElement) nodes.get(0);
+ assertEquals("span", span.getNodeName());
+ assertEquals("rf-ds", span.getAttribute(HTML.CLASS_ATTRIBUTE).trim());
+
+ // first/fastRewind/previous buttons with arrows
+ HtmlElement first = getFirstButton(page, scrollerId);
+ assertEquals("span", first.getNodeName());
+ assertEquals("rf-ds-btn rf-ds-l rf-ds-dis", first.getAttribute(HTML.CLASS_ATTRIBUTE).trim());
+
+ HtmlElement fastRewind = getFastRewindButton(page, scrollerId);
+ assertEquals("span", fastRewind.getNodeName());
+ assertEquals("rf-ds-btn rf-ds-l rf-ds-dis", fastRewind.getAttribute(HTML.CLASS_ATTRIBUTE).trim());
+
+ HtmlElement previous = getPreviousButton(page, scrollerId);
+ assertEquals("span", previous.getNodeName());
+ assertEquals("rf-ds-btn rf-ds-l rf-ds-dis", previous.getAttribute(HTML.CLASS_ATTRIBUTE).trim());
+
+ // currently selected digital button
+ HtmlElement dc1 = getDigitalButton(page, scrollerId, 1);
+ assertEquals("span", dc1.getNodeName());
+ assertEquals("rf-ds-dtl rf-ds-cur", dc1.getAttribute(HTML.CLASS_ATTRIBUTE).trim());
+
+ // digital buttons
+ HtmlElement d2 = getDigitalButton(page, scrollerId, 2);
+ assertEquals("a", d2.getNodeName());
+ assertEquals("rf-ds-dtl", d2.getAttribute(HTML.CLASS_ATTRIBUTE).trim());
+ assertEquals("javascript:void(0);", d2.getAttribute(HTML.HREF_ATTR));
+
+ HtmlElement d3 = getDigitalButton(page, scrollerId, 3);
+ assertEquals("a", d3.getNodeName());
+ assertEquals("rf-ds-dtl", d3.getAttribute(HTML.CLASS_ATTRIBUTE).trim());
+ assertEquals("javascript:void(0);", d3.getAttribute(HTML.HREF_ATTR));
+
+ HtmlElement d4 = getDigitalButton(page, scrollerId, 4);
+ assertEquals("a", d4.getNodeName());
+ assertEquals("rf-ds-dtl", d4.getAttribute(HTML.CLASS_ATTRIBUTE).trim());
+ assertEquals("javascript:void(0);", d4.getAttribute(HTML.HREF_ATTR));
+
+ HtmlElement d5 = getDigitalButton(page, scrollerId, 5);
+ assertEquals("a", d5.getNodeName());
+ assertEquals("rf-ds-dtl", d5.getAttribute(HTML.CLASS_ATTRIBUTE).trim());
+ assertEquals("javascript:void(0);", d5.getAttribute(HTML.HREF_ATTR));
+
+ // next/fastForward/last buttons with arrows
+ HtmlElement next = getNextButton(page, scrollerId);
+ assertEquals("a", next.getNodeName());
+ assertEquals("rf-ds-btn rf-ds-r", next.getAttribute(HTML.CLASS_ATTRIBUTE).trim());
+ assertEquals("javascript:void(0);", next.getAttribute(HTML.HREF_ATTR));
+
+ HtmlElement fastForward = getFastForwardButton(page, scrollerId);
+ assertEquals("a", fastForward.getNodeName());
+ assertEquals("rf-ds-btn rf-ds-r", fastForward.getAttribute(HTML.CLASS_ATTRIBUTE).trim());
+ assertEquals("javascript:void(0);", fastForward.getAttribute(HTML.HREF_ATTR));
+
+ HtmlElement last = getLastButton(page, scrollerId);
+ assertEquals("a", last.getNodeName());
+ assertEquals("rf-ds-btn rf-ds-r", last.getAttribute(HTML.CLASS_ATTRIBUTE).trim());
+ assertEquals("javascript:void(0);", last.getAttribute(HTML.HREF_ATTR));
+ }
+
+ @Test
+ public void testOutDataScrollerFirstLastButtons() throws Exception {
+ HtmlPage page = environment.getPage("/test.jsf");
+ String firstScrollerId = "scroller1";
+
+ //dataScroller inside dataTable 'footer' facet
+ String secondScrollerId = "richTable:scroller2";
+
+ HtmlElement last = getLastButton(page, firstScrollerId);
+ last.click();
+ checkLastPageButtons(page, firstScrollerId, secondScrollerId);
+
+ HtmlElement first = getFirstButton(page, firstScrollerId);
+ first.click();
+ checkFirstPageButtons(page, firstScrollerId, secondScrollerId);
+ }
+
+ @Test
+ public void testInnerDataScrollerFirstLastButtons() throws Exception {
+ HtmlPage page = environment.getPage("/test.jsf");
+ String firstScrollerId = "scroller1";
+
+ //dataScroller inside dataTable 'footer' facet
+ String secondScrollerId = "richTable:scroller2";
+
+ HtmlElement last = getLastButton(page, secondScrollerId);
+ last.click();
+ checkLastPageButtons(page, firstScrollerId, secondScrollerId);
+
+ HtmlElement first = getFirstButton(page, secondScrollerId);
+ first.click();
+ checkFirstPageButtons(page, firstScrollerId, secondScrollerId);
+ }
+
+ @Test
+ public void testOutDataScrollerNextPreviousButtons() throws Exception {
+ HtmlPage page = environment.getPage("/test.jsf");
+ String firstScrollerId = "scroller1";
+
+ //dataScroller inside dataTable 'footer' facet
+ String secondScrollerId = "richTable:scroller2";
+
+ for(int i = 2; i <= 5; i++) {
+ HtmlElement next = getNextButton(page, firstScrollerId);
+
+ next.click();
+
+ HtmlElement currentDigital1 = getDigitalButton(page, firstScrollerId, i);
+ assertEquals("span", currentDigital1.getNodeName());
+ assertEquals("rf-ds-dtl rf-ds-cur", currentDigital1.getAttribute(HTML.CLASS_ATTRIBUTE).trim());
+
+ // if scroller inside dataTable has switched
+ HtmlElement currentDigital2 = getDigitalButton(page, secondScrollerId, i);
+ assertEquals("span", currentDigital2.getNodeName());
+ assertEquals("rf-ds-dtl rf-ds-cur", currentDigital2.getAttribute(HTML.CLASS_ATTRIBUTE).trim());
+
+ // check if page has switched
+ assertEquals(i + " page content", getCurrentPageContent(page, i));
+ }
+
+ checkLastPageButtons(page, firstScrollerId, secondScrollerId);
+
+ //scroll back
+ for(int i = 4; i >= 1; i--) {
+ HtmlElement previous = getPreviousButton(page, firstScrollerId);
+ previous.click();
+ HtmlElement currentDigital1 = getDigitalButton(page, firstScrollerId, i);
+
+ assertEquals("span", currentDigital1.getNodeName());
+ assertEquals("rf-ds-dtl rf-ds-cur", currentDigital1.getAttribute(HTML.CLASS_ATTRIBUTE).trim());
+
+ // if scroller inside dataTable has switched
+ HtmlElement currentDigital2 = getDigitalButton(page, secondScrollerId, i);
+ assertEquals("span", currentDigital2.getNodeName());
+ assertEquals("rf-ds-dtl rf-ds-cur", currentDigital2.getAttribute(HTML.CLASS_ATTRIBUTE).trim());
+
+ // check if page has switched
+ assertEquals(i + " page content", getCurrentPageContent(page, i));
+ }
+
+ checkFirstPageButtons(page, firstScrollerId, secondScrollerId);
+ }
+
+ @Test
+ public void testInnerDataScrollerNextPreviousButtons() throws Exception {
+ HtmlPage page = environment.getPage("/test.jsf");
+ String firstScrollerId = "scroller1";
+
+ //dataScroller inside dataTable 'footer' facet
+ String secondScrollerId = "richTable:scroller2";
+
+ for(int i = 2; i <= 5; i++) {
+ HtmlElement next = getNextButton(page, secondScrollerId);
+ next.click();
+ HtmlElement currentDigital2 = getDigitalButton(page, secondScrollerId, i);
+ assertEquals("span", currentDigital2.getNodeName());
+ assertEquals("rf-ds-dtl rf-ds-cur", currentDigital2.getAttribute(HTML.CLASS_ATTRIBUTE).trim());
+
+ // if scroller outside dataTable has switched
+ HtmlElement currentDigital1 = getDigitalButton(page, firstScrollerId, i);
+ assertEquals("span", currentDigital1.getNodeName());
+ assertEquals("rf-ds-dtl rf-ds-cur", currentDigital1.getAttribute(HTML.CLASS_ATTRIBUTE).trim());
+
+ // check if page has switched
+ assertEquals(i + " page content", getCurrentPageContent(page, i));
+ }
+
+ checkLastPageButtons(page, firstScrollerId, secondScrollerId);
+
+ //scroll back
+ for(int i = 4; i >= 1; i--) {
+ HtmlElement previous = getPreviousButton(page, secondScrollerId);
+ previous.click();
+
+ HtmlElement currentDigital2 = getDigitalButton(page, secondScrollerId, i);
+ assertEquals("span", currentDigital2.getNodeName());
+ assertEquals("rf-ds-dtl rf-ds-cur", currentDigital2.getAttribute(HTML.CLASS_ATTRIBUTE).trim());
+
+ // if scroller inside dataTable has switched
+ HtmlElement currentDigital1 = getDigitalButton(page, firstScrollerId, i);
+ assertEquals("span", currentDigital1.getNodeName());
+ assertEquals("rf-ds-dtl rf-ds-cur", currentDigital1.getAttribute(HTML.CLASS_ATTRIBUTE).trim());
+
+ // check if page has switched
+ assertEquals(i + " page content", getCurrentPageContent(page, i));
+ }
+
+ checkFirstPageButtons(page, firstScrollerId, secondScrollerId);
+ }
+
+ @Test
+ public void testOutDataScrollerFastButtons() throws Exception {
+ HtmlPage page = environment.getPage("/test.jsf");
+ String firstScrollerId = "scroller1";
+
+ //dataScroller inside dataTable 'footer' facet
+ String secondScrollerId = "richTable:scroller2";
+
+ for(int i = 3; i <= 5; i = i + 2) {
+ HtmlElement ff = getFastForwardButton(page, firstScrollerId);
+
+ ff.click();
+
+ HtmlElement currentDigital1 = getDigitalButton(page, firstScrollerId, i);
+ assertEquals("span", currentDigital1.getNodeName());
+ assertEquals("rf-ds-dtl rf-ds-cur", currentDigital1.getAttribute(HTML.CLASS_ATTRIBUTE).trim());
+
+ // if scroller inside dataTable has switched
+ HtmlElement currentDigital2 = getDigitalButton(page, secondScrollerId, i);
+ assertEquals("span", currentDigital2.getNodeName());
+ assertEquals("rf-ds-dtl rf-ds-cur", currentDigital2.getAttribute(HTML.CLASS_ATTRIBUTE).trim());
+
+ // check if page has switched
+ assertEquals(i + " page content", getCurrentPageContent(page, i));
+ }
+
+ checkLastPageButtons(page, firstScrollerId, secondScrollerId);
+
+ //scroll back
+ for(int i = 3; i >= 1; i = i - 2) {
+ HtmlElement fr = getFastRewindButton(page, firstScrollerId);
+ fr.click();
+ HtmlElement currentDigital1 = getDigitalButton(page, firstScrollerId, i);
+
+ assertEquals("span", currentDigital1.getNodeName());
+ assertEquals("rf-ds-dtl rf-ds-cur", currentDigital1.getAttribute(HTML.CLASS_ATTRIBUTE).trim());
+
+ // if scroller inside dataTable has switched
+ HtmlElement currentDigital2 = getDigitalButton(page, secondScrollerId, i);
+ assertEquals("span", currentDigital2.getNodeName());
+ assertEquals("rf-ds-dtl rf-ds-cur", currentDigital2.getAttribute(HTML.CLASS_ATTRIBUTE).trim());
+
+ // check if page has switched
+ assertEquals(i + " page content", getCurrentPageContent(page, i));
+ }
+
+ checkFirstPageButtons(page, firstScrollerId, secondScrollerId);
+ }
+
+ @Test
+ public void testInnerDataScrollerFastButtons() throws Exception {
+ HtmlPage page = environment.getPage("/test.jsf");
+ String firstScrollerId = "scroller1";
+
+ //dataScroller inside dataTable 'footer' facet
+ String secondScrollerId = "richTable:scroller2";
+
+ for(int i = 3; i <= 5; i = i + 2) {
+ HtmlElement ff = getFastForwardButton(page, secondScrollerId);
+ ff.click();
+ HtmlElement currentDigital2 = getDigitalButton(page, secondScrollerId, i);
+ assertEquals("span", currentDigital2.getNodeName());
+ assertEquals("rf-ds-dtl rf-ds-cur", currentDigital2.getAttribute(HTML.CLASS_ATTRIBUTE).trim());
+
+ // if scroller outside dataTable has switched
+ HtmlElement currentDigital1 = getDigitalButton(page, firstScrollerId, i);
+ assertEquals("span", currentDigital1.getNodeName());
+ assertEquals("rf-ds-dtl rf-ds-cur", currentDigital1.getAttribute(HTML.CLASS_ATTRIBUTE).trim());
+
+ // check if page has switched
+ assertEquals(i + " page content", getCurrentPageContent(page, i));
+ }
+
+ checkLastPageButtons(page, firstScrollerId, secondScrollerId);
+
+ //scroll back
+ for(int i = 3; i >= 1; i = i - 2) {
+ HtmlElement fr = getFastRewindButton(page, secondScrollerId);
+ fr.click();
+
+ HtmlElement currentDigital2 = getDigitalButton(page, secondScrollerId, i);
+ assertEquals("span", currentDigital2.getNodeName());
+ assertEquals("rf-ds-dtl rf-ds-cur", currentDigital2.getAttribute(HTML.CLASS_ATTRIBUTE).trim());
+
+ // if scroller inside dataTable has switched
+ HtmlElement currentDigital1 = getDigitalButton(page, firstScrollerId, i);
+ assertEquals("span", currentDigital1.getNodeName());
+ assertEquals("rf-ds-dtl rf-ds-cur", currentDigital1.getAttribute(HTML.CLASS_ATTRIBUTE).trim());
+
+ // check if page has switched
+ assertEquals(i + " page content", getCurrentPageContent(page, i));
+ }
+
+ checkFirstPageButtons(page, firstScrollerId, secondScrollerId);
+ }
+
+ @Test
+ public void testOutDataScrollerDigitalButtons() throws Exception {
+ HtmlPage page = environment.getPage("/test.jsf");
+ String firstScrollerId = "scroller1";
+
+ //dataScroller inside dataTable 'footer' facet
+ String secondScrollerId = "richTable:scroller2";
+
+ for(int i = 2; i <= 5; i++) {
+ HtmlElement currentDigital1 = getDigitalButton(page, firstScrollerId, i);
+ currentDigital1.click();
+
+ currentDigital1 = getDigitalButton(page, firstScrollerId, i);
+ assertEquals("span", currentDigital1.getNodeName());
+ assertEquals("rf-ds-dtl rf-ds-cur", currentDigital1.getAttribute(HTML.CLASS_ATTRIBUTE).trim());
+
+ // if scroller inside dataTable has switched
+ HtmlElement currentDigital2 = getDigitalButton(page, secondScrollerId, i);
+ assertEquals("span", currentDigital2.getNodeName());
+ assertEquals("rf-ds-dtl rf-ds-cur", currentDigital2.getAttribute(HTML.CLASS_ATTRIBUTE).trim());
+
+ // check if page has switched
+ assertEquals(i + " page content", getCurrentPageContent(page, i));
+ }
+
+ checkLastPageButtons(page, firstScrollerId, secondScrollerId);
+
+ //scroll back
+ for(int i = 4; i >= 1; i--) {
+ HtmlElement currentDigital1 = getDigitalButton(page, firstScrollerId, i);
+ currentDigital1.click();
+
+ currentDigital1 = getDigitalButton(page, firstScrollerId, i);
+ assertEquals("span", currentDigital1.getNodeName());
+ assertEquals("rf-ds-dtl rf-ds-cur", currentDigital1.getAttribute(HTML.CLASS_ATTRIBUTE).trim());
+
+ // if scroller inside dataTable has switched
+ HtmlElement currentDigital2 = getDigitalButton(page, secondScrollerId, i);
+ assertEquals("span", currentDigital2.getNodeName());
+ assertEquals("rf-ds-dtl rf-ds-cur", currentDigital2.getAttribute(HTML.CLASS_ATTRIBUTE).trim());
+
+ // check if page has switched
+ assertEquals(i + " page content", getCurrentPageContent(page, i));
+ }
+
+ checkFirstPageButtons(page, firstScrollerId, secondScrollerId);
+ }
+
+ @Test
+ public void testInnerDataScrollerDigitalButtons() throws Exception {
+ HtmlPage page = environment.getPage("/test.jsf");
+ String firstScrollerId = "scroller1";
+
+ //dataScroller inside dataTable 'footer' facet
+ String secondScrollerId = "richTable:scroller2";
+
+ for(int i = 2; i <= 5; i++) {
+ HtmlElement currentDigital2 = getDigitalButton(page, secondScrollerId, i);
+ currentDigital2.click();
+
+ currentDigital2 = getDigitalButton(page, secondScrollerId, i);
+ assertEquals("span", currentDigital2.getNodeName());
+ assertEquals("rf-ds-dtl rf-ds-cur", currentDigital2.getAttribute(HTML.CLASS_ATTRIBUTE).trim());
+
+ // if scroller outside dataTable has switched
+ HtmlElement currentDigital1 = getDigitalButton(page, firstScrollerId, i);
+ assertEquals("span", currentDigital1.getNodeName());
+ assertEquals("rf-ds-dtl rf-ds-cur", currentDigital1.getAttribute(HTML.CLASS_ATTRIBUTE).trim());
+
+ // check if page has switched
+ assertEquals(i + " page content", getCurrentPageContent(page, i));
+ }
+
+ checkLastPageButtons(page, firstScrollerId, secondScrollerId);
+
+ //scroll back
+ for(int i = 4; i >= 1; i--) {
+ HtmlElement currentDigital2 = getDigitalButton(page, secondScrollerId, i);
+ currentDigital2.click();
+
+ currentDigital2 = getDigitalButton(page, secondScrollerId, i);
+ assertEquals("span", currentDigital2.getNodeName());
+ assertEquals("rf-ds-dtl rf-ds-cur", currentDigital2.getAttribute(HTML.CLASS_ATTRIBUTE).trim());
+
+ // if scroller inside dataTable has switched
+ HtmlElement currentDigital1 = getDigitalButton(page, firstScrollerId, i);
+ assertEquals("span", currentDigital1.getNodeName());
+ assertEquals("rf-ds-dtl rf-ds-cur", currentDigital1.getAttribute(HTML.CLASS_ATTRIBUTE).trim());
+
+ // check if page has switched
+ assertEquals(i + " page content", getCurrentPageContent(page, i));
+ }
+
+ checkFirstPageButtons(page, firstScrollerId, secondScrollerId);
+ }
+
+ @After
+ public void tearDown() {
+ environment.release();
+ environment = null;
+ }
+
+ private void checkFirstPageButtons(HtmlPage page, String firstScrollerId, String secondScrollerId) throws Exception {
+ HtmlElement fastForward = getFastForwardButton(page, firstScrollerId);
+ HtmlElement last = getLastButton(page, firstScrollerId);
+ HtmlElement next = getNextButton(page, firstScrollerId);
+
+ //check right buttons
+ assertEquals("a", fastForward.getNodeName());
+ assertEquals("rf-ds-btn rf-ds-r", fastForward.getAttribute(HTML.CLASS_ATTRIBUTE).trim());
+
+ assertEquals("a", last.getNodeName());
+ assertEquals("rf-ds-btn rf-ds-r", last.getAttribute(HTML.CLASS_ATTRIBUTE).trim());
+
+ assertEquals("a", next.getNodeName());
+ assertEquals("rf-ds-btn rf-ds-r", next.getAttribute(HTML.CLASS_ATTRIBUTE).trim());
+
+ fastForward = getFastForwardButton(page, secondScrollerId);
+ last = getFastForwardButton(page, secondScrollerId);
+ next = getNextButton(page, secondScrollerId);
+
+ assertEquals("a", fastForward.getNodeName());
+ assertEquals("rf-ds-btn rf-ds-r", fastForward.getAttribute(HTML.CLASS_ATTRIBUTE).trim());
+
+ assertEquals("a", last.getNodeName());
+ assertEquals("rf-ds-btn rf-ds-r", last.getAttribute(HTML.CLASS_ATTRIBUTE).trim());
+
+ assertEquals("a", next.getNodeName());
+ assertEquals("rf-ds-btn rf-ds-r", next.getAttribute(HTML.CLASS_ATTRIBUTE).trim());
+
+ //check if left buttons is disabled
+ HtmlElement fastRewind = getFastRewindButton(page, firstScrollerId);
+ HtmlElement first = getFirstButton(page, firstScrollerId);
+ HtmlElement previous = getPreviousButton(page, firstScrollerId);
+
+ assertEquals("span", fastRewind.getNodeName());
+ assertEquals("rf-ds-btn rf-ds-l rf-ds-dis", fastRewind.getAttribute(HTML.CLASS_ATTRIBUTE).trim());
+
+ assertEquals("span", first.getNodeName());
+ assertEquals("rf-ds-btn rf-ds-l rf-ds-dis", first.getAttribute(HTML.CLASS_ATTRIBUTE).trim());
+
+ assertEquals("span", previous.getNodeName());
+ assertEquals("rf-ds-btn rf-ds-l rf-ds-dis", previous.getAttribute(HTML.CLASS_ATTRIBUTE).trim());
+
+ fastRewind = getFastRewindButton(page, secondScrollerId);
+ first = getFirstButton(page, secondScrollerId);
+ next = getNextButton(page, secondScrollerId);
+
+ assertEquals("span", fastRewind.getNodeName());
+ assertEquals("rf-ds-btn rf-ds-l rf-ds-dis", fastRewind.getAttribute(HTML.CLASS_ATTRIBUTE).trim());
+
+ assertEquals("span", first.getNodeName());
+ assertEquals("rf-ds-btn rf-ds-l rf-ds-dis", first.getAttribute(HTML.CLASS_ATTRIBUTE).trim());
+
+ assertEquals("span", previous.getNodeName());
+ assertEquals("rf-ds-btn rf-ds-l rf-ds-dis", previous.getAttribute(HTML.CLASS_ATTRIBUTE).trim());
+ }
+
+ private void checkLastPageButtons(HtmlPage page, String firstScrollerId, String secondScrollerId) throws Exception {
+ //check if right buttons is disabled
+ HtmlElement fastForward = getFastForwardButton(page, firstScrollerId);
+ HtmlElement last = getLastButton(page, firstScrollerId);
+ HtmlElement next = getNextButton(page, firstScrollerId);
+
+ assertEquals("span", fastForward.getNodeName());
+ assertEquals("rf-ds-btn rf-ds-r rf-ds-dis", fastForward.getAttribute(HTML.CLASS_ATTRIBUTE).trim());
+
+ assertEquals("span", last.getNodeName());
+ assertEquals("rf-ds-btn rf-ds-r rf-ds-dis", last.getAttribute(HTML.CLASS_ATTRIBUTE).trim());
+
+ assertEquals("span", next.getNodeName());
+ assertEquals("rf-ds-btn rf-ds-r rf-ds-dis", next.getAttribute(HTML.CLASS_ATTRIBUTE).trim());
+
+
+ fastForward = getFastForwardButton(page, secondScrollerId);
+ last = getFastForwardButton(page, secondScrollerId);
+ next = getNextButton(page, secondScrollerId);
+
+ assertEquals("span", fastForward.getNodeName());
+ assertEquals("rf-ds-btn rf-ds-r rf-ds-dis", fastForward.getAttribute(HTML.CLASS_ATTRIBUTE).trim());
+
+ assertEquals("span", last.getNodeName());
+ assertEquals("rf-ds-btn rf-ds-r rf-ds-dis", last.getAttribute(HTML.CLASS_ATTRIBUTE).trim());
+
+ assertEquals("span", next.getNodeName());
+ assertEquals("rf-ds-btn rf-ds-r rf-ds-dis", next.getAttribute(HTML.CLASS_ATTRIBUTE).trim());
+
+ //check if left buttons is enabled
+ HtmlElement fastRewind = getFastRewindButton(page, firstScrollerId);
+ HtmlElement first = getFirstButton(page, firstScrollerId);
+ HtmlElement previous = getPreviousButton(page, firstScrollerId);
+
+ assertEquals("a", fastRewind.getNodeName());
+ assertEquals("rf-ds-btn rf-ds-l", fastRewind.getAttribute(HTML.CLASS_ATTRIBUTE).trim());
+
+ assertEquals("a", first.getNodeName());
+ assertEquals("rf-ds-btn rf-ds-l", first.getAttribute(HTML.CLASS_ATTRIBUTE).trim());
+
+ assertEquals("a", previous.getNodeName());
+ assertEquals("rf-ds-btn rf-ds-l", previous.getAttribute(HTML.CLASS_ATTRIBUTE).trim());
+
+ fastRewind = getFastRewindButton(page, secondScrollerId);
+ first = getFirstButton(page, secondScrollerId);
+ previous = getPreviousButton(page, secondScrollerId);
+
+ assertEquals("a", fastRewind.getNodeName());
+ assertEquals("rf-ds-btn rf-ds-l", fastRewind.getAttribute(HTML.CLASS_ATTRIBUTE).trim());
+
+ assertEquals("a", first.getNodeName());
+ assertEquals("rf-ds-btn rf-ds-l", first.getAttribute(HTML.CLASS_ATTRIBUTE).trim());
+
+ assertEquals("a", previous.getNodeName());
+ assertEquals("rf-ds-btn rf-ds-l", previous.getAttribute(HTML.CLASS_ATTRIBUTE).trim());
+ }
+
+ private String getCurrentPageContent(HtmlPage page, int i) throws Exception {
+ HtmlElement content = page.getFirstByXPath("//*[@id = 'form:richTable:" + (--i) + ":pageContent']");
+ DomNode text = content.getFirstChild();
+ assertEquals(DomNode.TEXT_NODE, text.getNodeType());
+ return text.getNodeValue();
+ }
+
+ private HtmlElement getPreviousButton(HtmlPage page, String scrollerId) {
+ return page.getFirstByXPath("//*[@id = 'form:" + scrollerId +"_ds_prev']");
+ }
+
+ private HtmlElement getNextButton(HtmlPage page, String scrollerId) {
+ return page.getFirstByXPath("//*[@id = 'form:" + scrollerId +"_ds_next']");
+ }
+
+ private HtmlElement getFastRewindButton(HtmlPage page, String scrollerId) {
+ return page.getFirstByXPath("//*[@id = 'form:" + scrollerId +"_ds_fr']");
+ }
+
+ private HtmlElement getFirstButton(HtmlPage page, String scrollerId) {
+ return page.getFirstByXPath("//*[@id = 'form:" + scrollerId +"_ds_f']");
+ }
+
+ private HtmlElement getFastForwardButton(HtmlPage page, String scrollerId) {
+ return page.getFirstByXPath("//*[@id = 'form:" + scrollerId +"_ds_ff']");
+ }
+
+ private HtmlElement getLastButton(HtmlPage page, String scrollerId) {
+ return page.getFirstByXPath("//*[@id = 'form:" + scrollerId +"_ds_l']");
+ }
+
+ private HtmlElement getDigitalButton(HtmlPage page, String scrollerId, int i) {
+ return page.getFirstByXPath("//*[@id = 'form:" + scrollerId + "_ds_" + i +"']");
+ }
+
+}
Copied: branches/RF-7944/ui/iteration/ui/src/test/resources/org/richfaces/renderkit/dataTableTest.xhtml (from rev 19108, trunk/ui/iteration/ui/src/test/resources/org/richfaces/renderkit/dataTableTest.xhtml)
===================================================================
--- branches/RF-7944/ui/iteration/ui/src/test/resources/org/richfaces/renderkit/dataTableTest.xhtml (rev 0)
+++ branches/RF-7944/ui/iteration/ui/src/test/resources/org/richfaces/renderkit/dataTableTest.xhtml 2010-09-03 12:51:59 UTC (rev 19110)
@@ -0,0 +1,29 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml"
+ xmlns:h="http://java.sun.com/jsf/html"
+ xmlns:f="http://java.sun.com/jsf/core"
+ xmlns:ui="http://java.sun.com/jsf/facelets"
+ xmlns:it="http://richfaces.org/iteration">
+<f:view contentType="text/html" />
+
+<h:head>
+ <title>Richfaces List</title>
+</h:head>
+
+<h:body>
+ <h:form id="form">
+
+ <it:dataScroller fastStep="2" id="scroller1" for="richTable" page="#{dataScrollerBean.pageNumber}" maxPages="5"></it:dataScroller>
+ <it:dataTable id="richTable" rowKeyVar="rowKey" var="content" value="#{dataScrollerBean.content}" rows="1">
+ <it:column>
+ <h:panelGroup id="pageContent">
+ <h:outputText value="#{content}"/>
+ </h:panelGroup>
+ </it:column>
+ <f:facet name="footer">
+ <it:dataScroller fastStep="2" id="scroller2" for="richTable" page="#{dataScrollerBean.pageNumber}" maxPages="5"></it:dataScroller>
+ </f:facet>
+ </it:dataTable>
+ </h:form>
+</h:body>
+</html>
Modified: branches/RF-7944/ui/iteration/ui/src/test/resources/org/richfaces/renderkit/faces-config.xml
===================================================================
--- branches/RF-7944/ui/iteration/ui/src/test/resources/org/richfaces/renderkit/faces-config.xml 2010-09-03 12:00:31 UTC (rev 19109)
+++ branches/RF-7944/ui/iteration/ui/src/test/resources/org/richfaces/renderkit/faces-config.xml 2010-09-03 12:51:59 UTC (rev 19110)
@@ -10,5 +10,11 @@
<managed-bean-class>org.richfaces.renderkit.DataBean</managed-bean-class>
<managed-bean-scope>request</managed-bean-scope>
</managed-bean>
-
+
+ <managed-bean>
+ <managed-bean-name>dataScrollerBean</managed-bean-name>
+ <managed-bean-class>org.richfaces.renderkit.DataScrollerBean</managed-bean-class>
+ <managed-bean-scope>session</managed-bean-scope>
+ </managed-bean>
+
</faces-config>
\ No newline at end of file
Copied: branches/RF-7944/ui/output/api/src/main/java/org/richfaces/event/ChangeExpandEvent.java (from rev 19108, trunk/ui/output/api/src/main/java/org/richfaces/event/ChangeExpandEvent.java)
===================================================================
--- branches/RF-7944/ui/output/api/src/main/java/org/richfaces/event/ChangeExpandEvent.java (rev 0)
+++ branches/RF-7944/ui/output/api/src/main/java/org/richfaces/event/ChangeExpandEvent.java 2010-09-03 12:51:59 UTC (rev 19110)
@@ -0,0 +1,82 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright ${year}, Red Hat, Inc. and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+
+package org.richfaces.event;
+
+import javax.faces.component.UIComponent;
+import javax.faces.event.FacesEvent;
+import javax.faces.event.FacesListener;
+
+
+/**
+ * @author akolonitsky
+ * @since 2010-08-27
+ */
+public class ChangeExpandEvent extends FacesEvent {
+
+ private final Boolean isExpanded;
+
+
+ // ------------------------------------------------------------ Constructors
+
+ /**
+ * <p>Construct a new event object from the specified source component,
+ * old value, and new value.</p>
+ *
+ * <p>The default {@link javax.faces.event.PhaseId} for this event is {@link
+ * javax.faces.event.PhaseId#ANY_PHASE}.</p>
+ *
+ * @param component Source {@link UIComponent} for this event
+ * @param isExpanded
+ *
+ * @throws IllegalArgumentException if <code>component</code> is
+ * <code>null</code>
+ */
+ public ChangeExpandEvent(UIComponent component, Boolean isExpanded) {
+ super(component);
+ this.isExpanded = isExpanded;
+ }
+
+
+ // -------------------------------------------------------------- Properties
+
+ public Boolean getExpanded() {
+ return isExpanded;
+ }
+
+ // ------------------------------------------------- Event Broadcast Methods
+
+
+ @Override
+ public boolean isAppropriateListener(FacesListener listener) {
+ return listener instanceof ChangeExpandListener;
+ }
+
+ /**
+ * @throws javax.faces.event.AbortProcessingException {@inheritDoc}
+ */
+ @Override
+ public void processListener(FacesListener listener) {
+ ((ChangeExpandListener) listener).processChangeExpand(this);
+ }
+}
+
Copied: branches/RF-7944/ui/output/api/src/main/java/org/richfaces/event/ChangeExpandListener.java (from rev 19108, trunk/ui/output/api/src/main/java/org/richfaces/event/ChangeExpandListener.java)
===================================================================
--- branches/RF-7944/ui/output/api/src/main/java/org/richfaces/event/ChangeExpandListener.java (rev 0)
+++ branches/RF-7944/ui/output/api/src/main/java/org/richfaces/event/ChangeExpandListener.java 2010-09-03 12:51:59 UTC (rev 19110)
@@ -0,0 +1,54 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright ${year}, Red Hat, Inc. and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+
+package org.richfaces.event;
+
+import javax.faces.event.AbortProcessingException;
+import javax.faces.event.FacesListener;
+
+/**
+ * <p>A listener interface for receiving {@link ChangeExpandEvent}s. A class
+ * that is interested in receiving such events implements this interface, and
+ * then registers itself with the source {@link javax.faces.component.UIComponent} of interest, by
+ * calling <code>addChangeExpandListener()</code>.</p>
+ *
+ * @author akolonitsky
+ * @version 1.0
+ * @since 2010-08-27
+ *
+ */
+public interface ChangeExpandListener extends FacesListener {
+
+
+ /**
+ * <p>Invoked when {@link ChangeExpandEvent} occurs.</p>
+ *
+ * @param event The {@link ChangeExpandEvent} that has occurred
+ *
+ * @throws AbortProcessingException Signal the JavaServer Faces
+ * implementation that no further processing on the current event
+ * should be performed
+ */
+ public void processChangeExpand(ChangeExpandEvent event)
+ throws AbortProcessingException;
+
+}
Copied: branches/RF-7944/ui/output/api/src/main/java/org/richfaces/event/ChangeExpandSource.java (from rev 19108, trunk/ui/output/api/src/main/java/org/richfaces/event/ChangeExpandSource.java)
===================================================================
--- branches/RF-7944/ui/output/api/src/main/java/org/richfaces/event/ChangeExpandSource.java (rev 0)
+++ branches/RF-7944/ui/output/api/src/main/java/org/richfaces/event/ChangeExpandSource.java 2010-09-03 12:51:59 UTC (rev 19110)
@@ -0,0 +1,58 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright ${year}, Red Hat, Inc. and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+
+package org.richfaces.event;
+
+/**
+ * @author akolonitsky
+ * @since 2010-08-27
+ */
+public interface ChangeExpandSource {
+
+ /**
+ * <p>Add a new {@link org.richfaces.event.ChangeExpandListener} to the set of listeners
+ * interested in being notified when {@link org.richfaces.event.ChangeExpandEvent}s occur.</p>
+ *
+ * @param listener The {@link org.richfaces.event.ChangeExpandListener} to be added
+ * @throws NullPointerException if <code>listener</code>
+ * is <code>null</code>
+ */
+ void addChangeExpandListener(ChangeExpandListener listener);
+
+ /**
+ * <p>Return the set of registered {@link org.richfaces.event.ChangeExpandListener}s for this instance.
+ * If there are no registered listeners, a zero-length array is returned.</p>
+ */
+ ChangeExpandListener[] getChangeExpandListeners();
+
+ /**
+ * <p>Remove an existing {@link org.richfaces.event.ChangeExpandListener} (if any) from the
+ * set of listeners interested in being notified when
+ * {@link org.richfaces.event.ChangeExpandEvent}s occur.</p>
+ *
+ * @param listener The {@link org.richfaces.event.ChangeExpandListener} to be removed
+ * @throws NullPointerException if <code>listener</code>
+ * is <code>null</code>
+ */
+ void removeChangeExpandListener(ChangeExpandListener listener);
+
+}
Copied: branches/RF-7944/ui/output/ui/src/main/java/org/richfaces/component/AbstractCollapsiblePanel.java (from rev 19108, trunk/ui/output/ui/src/main/java/org/richfaces/component/AbstractCollapsiblePanel.java)
===================================================================
--- branches/RF-7944/ui/output/ui/src/main/java/org/richfaces/component/AbstractCollapsiblePanel.java (rev 0)
+++ branches/RF-7944/ui/output/ui/src/main/java/org/richfaces/component/AbstractCollapsiblePanel.java 2010-09-03 12:51:59 UTC (rev 19110)
@@ -0,0 +1,122 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright ${year}, Red Hat, Inc. and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+
+package org.richfaces.component;
+
+import org.richfaces.event.ChangeExpandEvent;
+import org.richfaces.event.ChangeExpandListener;
+import org.richfaces.event.ChangeExpandSource;
+import org.richfaces.event.ItemChangeEvent;
+
+import javax.el.MethodExpression;
+import javax.faces.component.UIComponent;
+import javax.faces.event.FacesEvent;
+
+/**
+ * @author akolonitsky
+ * @since 2010-08-27
+ */
+public abstract class AbstractCollapsiblePanel extends UITogglePanel implements ChangeExpandSource {
+
+ public static final String COMPONENT_TYPE = "org.richfaces.CollapsiblePanel";
+
+ public static final String COMPONENT_FAMILY = "org.richfaces.CollapsiblePanel";
+
+ public enum States {
+ expanded("exp"),
+ collapsed("colps");
+
+ private final String abbreviation;
+
+ States(String abbreviation) {
+ this.abbreviation = abbreviation;
+ }
+
+ public String abbreviation() {
+ return abbreviation;
+ }
+ }
+
+ protected AbstractCollapsiblePanel() {
+ setRendererType("org.richfaces.CollapsiblePanel");
+ }
+
+ @Override
+ public String getFamily() {
+ return COMPONENT_FAMILY;
+ }
+
+ @Override
+ public String getActiveItem() {
+ String ai = super.getActiveItem();
+ return ai == null ? "true" : ai;
+ }
+
+ @Override
+ protected boolean isActiveItem(UIComponent kid) {
+ return isExpanded();
+ }
+
+ @Override
+ protected boolean isActiveItem(UIComponent kid, String value) {
+ return isExpanded();
+ }
+
+
+ public boolean isExpanded() {
+ return Boolean.parseBoolean(getActiveItem());
+ }
+
+ public void setExpanded(boolean isExpanded) {
+ setActiveItem(String.valueOf(isExpanded));
+ }
+
+ public abstract String getHeader();
+
+ public abstract MethodExpression getChangeExpandListener();
+
+ @Override
+ public void queueEvent(FacesEvent facesEvent) {
+ ChangeExpandEvent event = null;
+ if ((facesEvent instanceof ItemChangeEvent) && (facesEvent.getComponent() == this)) {
+ event = new ChangeExpandEvent(this, Boolean.valueOf(((ItemChangeEvent) facesEvent).getNewItem()));
+
+ setEventPhase(event);
+ }
+
+ super.queueEvent(event != null ? event : facesEvent);
+ }
+
+ // ------------------------------------------------ Event Processing Methods
+
+ public void addChangeExpandListener(ChangeExpandListener listener) {
+ addFacesListener(listener);
+ }
+
+ public ChangeExpandListener[] getChangeExpandListeners() {
+ return (ChangeExpandListener[]) getFacesListeners(ChangeExpandListener.class);
+ }
+
+ public void removeChangeExpandListener(ChangeExpandListener listener) {
+ removeFacesListener(listener);
+ }
+}
Modified: branches/RF-7944/ui/output/ui/src/main/java/org/richfaces/component/AbstractDivPanel.java
===================================================================
--- branches/RF-7944/ui/output/ui/src/main/java/org/richfaces/component/AbstractDivPanel.java 2010-09-03 12:00:31 UTC (rev 19109)
+++ branches/RF-7944/ui/output/ui/src/main/java/org/richfaces/component/AbstractDivPanel.java 2010-09-03 12:51:59 UTC (rev 19110)
@@ -27,7 +27,6 @@
/**
* @author akolonitsky
* @version 1.0
- * @since -4712-01-01
*
*/
public abstract class AbstractDivPanel extends UIOutput {
Modified: branches/RF-7944/ui/output/ui/src/main/java/org/richfaces/component/AbstractTogglePanel.java
===================================================================
--- branches/RF-7944/ui/output/ui/src/main/java/org/richfaces/component/AbstractTogglePanel.java 2010-09-03 12:00:31 UTC (rev 19109)
+++ branches/RF-7944/ui/output/ui/src/main/java/org/richfaces/component/AbstractTogglePanel.java 2010-09-03 12:51:59 UTC (rev 19110)
@@ -56,6 +56,11 @@
public static final String COMPONENT_FAMILY = "org.richfaces.TogglePanel";
+ public static final String META_NAME_FIRST = "@first";
+ public static final String META_NAME_PREV = "@prev";
+ public static final String META_NAME_NEXT = "@next";
+ public static final String META_NAME_LAST = "@last";
+
// TODO What is MessageId ?
public static final String UPDATE_MESSAGE_ID = "javax.faces.component.UIInput.UPDATE";
@@ -370,7 +375,7 @@
String previous = (String) getValue();
setValue(activeItem);
setSubmittedActiveItem(null);
- if (!previous.equalsIgnoreCase(activeItem)) {
+ if (previous != null && !previous.equalsIgnoreCase(activeItem)) {
queueEvent(new ItemChangeEvent(this, previous, activeItem));
}
}
@@ -378,18 +383,23 @@
@Override
public void queueEvent(FacesEvent event) {
if ((event instanceof ItemChangeEvent) && (event.getComponent() == this)) {
- if (isImmediate()) {
- event.setPhaseId(PhaseId.APPLY_REQUEST_VALUES);
- } else if (isBypassUpdates()) {
- event.setPhaseId(PhaseId.PROCESS_VALIDATIONS);
- } else {
- event.setPhaseId(PhaseId.INVOKE_APPLICATION);
- }
+ setEventPhase(event);
}
super.queueEvent(event);
}
+ protected void setEventPhase(FacesEvent event) {
+ if (isImmediate()) {
+ event.setPhaseId(PhaseId.APPLY_REQUEST_VALUES);
+ } else if (isBypassUpdates()) {
+ event.setPhaseId(PhaseId.PROCESS_VALIDATIONS);
+ } else {
+ event.setPhaseId(PhaseId.INVOKE_APPLICATION);
+ }
+ }
+
+
@Override
public void broadcast(FacesEvent event) throws AbortProcessingException {
super.broadcast(event);
@@ -423,7 +433,7 @@
return isActiveItem(kid, getActiveItemValue());
}
- protected static boolean isActiveItem(UIComponent kid, String value) {
+ protected boolean isActiveItem(UIComponent kid, String value) {
if (kid == null || value == null) {
return false;
}
@@ -467,13 +477,13 @@
}
public AbstractTogglePanelItem getItem(String name) {
- if ("@first".equals(name)) {
+ if (META_NAME_FIRST.equals(name)) {
return getFirstItem();
- } else if ("@prev".equals(name)) {
+ } else if (META_NAME_PREV.equals(name)) {
return getPrevItem();
- } else if ("@next".equals(name)) {
+ } else if (META_NAME_NEXT.equals(name)) {
return getNextItem();
- } else if ("@last".equals(name)) {
+ } else if (META_NAME_LAST.equals(name)) {
return getLastItem();
} else {
return getItemByIndex(getChildIndex(name));
Modified: branches/RF-7944/ui/output/ui/src/main/java/org/richfaces/component/AbstractTogglePanelItem.java
===================================================================
--- branches/RF-7944/ui/output/ui/src/main/java/org/richfaces/component/AbstractTogglePanelItem.java 2010-09-03 12:00:31 UTC (rev 19109)
+++ branches/RF-7944/ui/output/ui/src/main/java/org/richfaces/component/AbstractTogglePanelItem.java 2010-09-03 12:51:59 UTC (rev 19110)
@@ -28,6 +28,7 @@
import javax.faces.context.FacesContext;
import javax.faces.render.Renderer;
import java.io.IOException;
+import java.util.Map;
/**
* @author akolonitsky
@@ -94,8 +95,9 @@
}
protected static void hidePanelItem(UIComponent item) {
- //TODO nick - attributes shouldn't be overwritten
- item.getAttributes().put(RendererUtils.HTML.STYLE_ATTRIBUTE, "display:none");
+ Map<String,Object> attrs = item.getAttributes();
+ Object style = attrs.get(RendererUtils.HTML.STYLE_ATTRIBUTE);
+ attrs.put(RendererUtils.HTML.STYLE_ATTRIBUTE, "display:none; " + style);
}
public abstract String getName();
Modified: branches/RF-7944/ui/output/ui/src/main/java/org/richfaces/component/AbstractTogglePanelTitledItem.java
===================================================================
--- branches/RF-7944/ui/output/ui/src/main/java/org/richfaces/component/AbstractTogglePanelTitledItem.java 2010-09-03 12:00:31 UTC (rev 19109)
+++ branches/RF-7944/ui/output/ui/src/main/java/org/richfaces/component/AbstractTogglePanelTitledItem.java 2010-09-03 12:51:59 UTC (rev 19110)
@@ -22,6 +22,8 @@
package org.richfaces.component;
+import org.richfaces.renderkit.html.DivPanelRenderer;
+
import javax.faces.component.UIComponent;
import javax.faces.context.FacesContext;
import java.io.IOException;
@@ -36,6 +38,22 @@
public static final String COMPONENT_FAMILY = "org.richfaces.TogglePanelTitledItem";
+ public enum HeaderStates {
+ active("act"),
+ inactive("inact"),
+ disable("dis");
+
+ private final String abbreviation;
+
+ HeaderStates(String abbreviation) {
+ this.abbreviation = abbreviation;
+ }
+
+ public String abbreviation() {
+ return abbreviation;
+ }
+ }
+
protected AbstractTogglePanelTitledItem() {
setRendererType("org.richfaces.TogglePanelTitledItem");
}
@@ -61,14 +79,32 @@
}
encodeBegin(context);
- if (getRendersChildren()) {
- encodeChildren(context);
- } else if (this.getChildCount() > 0) {
- for (UIComponent kid : getChildren()) {
- kid.encodeAll(context);
+ if (!isDisabled()) {
+ if (getRendersChildren()) {
+ encodeChildren(context);
+ } else if (this.getChildCount() > 0) {
+ for (UIComponent kid : getChildren()) {
+ kid.encodeAll(context);
+ }
}
}
-
+
encodeEnd(context);
}
+
+ public UIComponent getHeaderFacet(Enum<?> state) {
+ return getHeaderFacet(this, state);
+ }
+
+ public static UIComponent getHeaderFacet(UIComponent component, Enum<?> state) {
+ UIComponent headerFacet = null;
+ if (state != null) {
+ headerFacet = component.getFacet("header" + DivPanelRenderer.capitalize(state.toString()));
+ }
+
+ if (headerFacet == null) {
+ headerFacet = component.getFacet("header");
+ }
+ return headerFacet;
+ }
}
Copied: branches/RF-7944/ui/output/ui/src/main/java/org/richfaces/component/UICollapsiblePanel.java (from rev 19108, trunk/ui/output/ui/src/main/java/org/richfaces/component/UICollapsiblePanel.java)
===================================================================
--- branches/RF-7944/ui/output/ui/src/main/java/org/richfaces/component/UICollapsiblePanel.java (rev 0)
+++ branches/RF-7944/ui/output/ui/src/main/java/org/richfaces/component/UICollapsiblePanel.java 2010-09-03 12:51:59 UTC (rev 19110)
@@ -0,0 +1,53 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright ${year}, Red Hat, Inc. and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+
+package org.richfaces.component;
+
+import javax.el.MethodExpression;
+
+/**
+ * @author akolonitsky
+ * @since 2010-08-27
+ */
+public class UICollapsiblePanel extends AbstractCollapsiblePanel {
+
+ public enum PropertyKeys {
+ header,
+ changeExpandListener
+ }
+
+ public String getHeader() {
+ return (String) getStateHelper().eval(PropertyKeys.header);
+ }
+
+ public void setHeader(String header) {
+ getStateHelper().put(PropertyKeys.header, header);
+ }
+
+ public MethodExpression getChangeExpandListener() {
+ return (MethodExpression) getStateHelper().get(PropertyKeys.changeExpandListener);
+ }
+
+ public void setChangeExpandListener(MethodExpression changeExpandListener) {
+ getStateHelper().put(PropertyKeys.changeExpandListener, changeExpandListener);
+ }
+}
Modified: branches/RF-7944/ui/output/ui/src/main/java/org/richfaces/component/UITogglePanelItem.java
===================================================================
--- branches/RF-7944/ui/output/ui/src/main/java/org/richfaces/component/UITogglePanelItem.java 2010-09-03 12:00:31 UTC (rev 19109)
+++ branches/RF-7944/ui/output/ui/src/main/java/org/richfaces/component/UITogglePanelItem.java 2010-09-03 12:51:59 UTC (rev 19110)
@@ -36,7 +36,7 @@
}
public String getName() {
- return (String) getStateHelper().eval(PropertyKeys.name);
+ return (String) getStateHelper().eval(PropertyKeys.name, getId());
}
public void setName(String name) {
@@ -50,6 +50,4 @@
public void setSwitchType(SwitchType switchType) {
getStateHelper().put(PropertyKeys.switchType, switchType);
}
-
-
}
Modified: branches/RF-7944/ui/output/ui/src/main/java/org/richfaces/component/behavior/ToggleControl.java
===================================================================
--- branches/RF-7944/ui/output/ui/src/main/java/org/richfaces/component/behavior/ToggleControl.java 2010-09-03 12:00:31 UTC (rev 19109)
+++ branches/RF-7944/ui/output/ui/src/main/java/org/richfaces/component/behavior/ToggleControl.java 2010-09-03 12:51:59 UTC (rev 19110)
@@ -54,7 +54,7 @@
}
public String getTargetItem() {
- return (String) getStateHelper().eval(PropertyKeys.targetItem);
+ return (String) getStateHelper().eval(PropertyKeys.targetItem, AbstractTogglePanel.META_NAME_NEXT);
}
public void setTargetItem(String target) {
Copied: branches/RF-7944/ui/output/ui/src/main/java/org/richfaces/component/html/HtmlCollapsiblePanel.java (from rev 19108, trunk/ui/output/ui/src/main/java/org/richfaces/component/html/HtmlCollapsiblePanel.java)
===================================================================
--- branches/RF-7944/ui/output/ui/src/main/java/org/richfaces/component/html/HtmlCollapsiblePanel.java (rev 0)
+++ branches/RF-7944/ui/output/ui/src/main/java/org/richfaces/component/html/HtmlCollapsiblePanel.java 2010-09-03 12:51:59 UTC (rev 19110)
@@ -0,0 +1,245 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright ${year}, Red Hat, Inc. and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+
+package org.richfaces.component.html;
+
+import org.richfaces.component.UICollapsiblePanel;
+import javax.faces.component.behavior.ClientBehaviorHolder;
+
+import java.util.Arrays;
+import java.util.Collection;
+import java.util.Collections;
+
+/**
+ * @author akolonitsky
+ * @since 2010-08-27
+ */
+public class HtmlCollapsiblePanel extends UICollapsiblePanel implements ClientBehaviorHolder {
+
+ public static final String COMPONENT_TYPE = "org.richfaces.CollapsiblePanel";
+
+ public static final String COMPONENT_FAMILY = "org.richfaces.CollapsiblePanel";
+
+ private static final Collection<String> EVENT_NAMES = Collections.unmodifiableCollection(Arrays.asList(
+ "switch",
+ "beforeswitch",
+ "click",
+ "dblclick",
+ "mousedown",
+ "mousemove",
+ "mouseout",
+ "mouseover",
+ "mouseup"
+ ));
+
+
+ public enum PropertyKeys {
+ bodyClass,
+ headerClass,
+ headerControlClass,
+ oncomplete,
+ onbeforedomupdate,
+ onswitch,
+ onbeforeswitch,
+ lang,
+ title,
+ style,
+ styleClass,
+ dir,
+ onclick,
+ ondblclick,
+ onmousedown,
+ onmousemove,
+ onmouseout,
+ onmouseover,
+ onmouseup
+ }
+
+ public HtmlCollapsiblePanel() {
+ setRendererType("org.richfaces.CollapsiblePanel");
+ }
+
+ @Override
+ public String getFamily() {
+ return COMPONENT_FAMILY;
+ }
+
+ public String getBodyClass() {
+ return (String) getStateHelper().eval(PropertyKeys.bodyClass);
+ }
+
+ public void setBodyClass(String bodyClass) {
+ getStateHelper().put(PropertyKeys.bodyClass, bodyClass);
+ }
+
+ public String getHeaderClass() {
+ return (String) getStateHelper().eval(PropertyKeys.headerClass);
+ }
+
+ public void setHeaderClass(String headerClass) {
+ getStateHelper().put(PropertyKeys.headerClass, headerClass);
+ }
+
+ public String getHeaderControlClass() {
+ return (String) getStateHelper().eval(PropertyKeys.headerControlClass);
+ }
+
+ public void setHeaderControlClass(String headerControlClass) {
+ getStateHelper().put(PropertyKeys.headerControlClass, headerControlClass);
+ }
+
+ public String getOncomplete() {
+ return (String) getStateHelper().eval(PropertyKeys.oncomplete);
+ }
+
+ public void setOncomplete(String oncomplete) {
+ getStateHelper().put(PropertyKeys.oncomplete, oncomplete);
+ }
+
+ public String getOnbeforedomupdate() {
+ return (String) getStateHelper().eval(PropertyKeys.onbeforedomupdate);
+ }
+
+ public void setOnbeforedomupdate(String onbeforedomupdate) {
+ getStateHelper().put(PropertyKeys.onbeforedomupdate, onbeforedomupdate);
+ }
+
+ public String getOnswitch() {
+ return (String) getStateHelper().eval(PropertyKeys.onswitch);
+ }
+
+ public void setOnswitch(String onswitch) {
+ getStateHelper().put(PropertyKeys.onswitch, onswitch);
+ }
+
+ public String getOnbeforeswitch() {
+ return (String) getStateHelper().eval(PropertyKeys.onbeforeswitch);
+ }
+
+ public void setOnbeforeswitch(String onbeforeswitch) {
+ getStateHelper().put(PropertyKeys.onbeforeswitch, onbeforeswitch);
+ }
+
+ public String getLang() {
+ return (String) getStateHelper().eval(PropertyKeys.lang);
+ }
+
+ public void setLang(String lang) {
+ getStateHelper().put(PropertyKeys.lang, lang);
+ }
+
+ public String getTitle() {
+ return (String) getStateHelper().eval(PropertyKeys.title);
+ }
+
+ public void setTitle(String title) {
+ getStateHelper().put(PropertyKeys.title, title);
+ }
+
+ public String getStyle() {
+ return (String) getStateHelper().eval(PropertyKeys.style);
+ }
+
+ public void setStyle(String style) {
+ getStateHelper().put(PropertyKeys.style, style);
+ }
+
+ public String getStyleClass() {
+ return (String) getStateHelper().eval(PropertyKeys.styleClass);
+ }
+
+ public void setStyleClass(String styleClass) {
+ getStateHelper().put(PropertyKeys.styleClass, styleClass);
+ }
+
+ public String getDir() {
+ return (String) getStateHelper().eval(PropertyKeys.dir);
+ }
+
+ public void setDir(String dir) {
+ getStateHelper().put(PropertyKeys.dir, dir);
+ }
+
+ public String getOnclick() {
+ return (String) getStateHelper().eval(PropertyKeys.onclick);
+ }
+
+ public void setOnclick(String onclick) {
+ getStateHelper().put(PropertyKeys.onclick, onclick);
+ }
+
+ public String getOndblclick() {
+ return (String) getStateHelper().eval(PropertyKeys.ondblclick);
+ }
+
+ public void setOndblclick(String ondblclick) {
+ getStateHelper().put(PropertyKeys.ondblclick, ondblclick);
+ }
+
+ public String getOnmousedown() {
+ return (String) getStateHelper().eval(PropertyKeys.onmousedown);
+ }
+
+ public void setOnmousedown(String onmousedown) {
+ getStateHelper().put(PropertyKeys.onmousedown, onmousedown);
+ }
+
+ public String getOnmousemove() {
+ return (String) getStateHelper().eval(PropertyKeys.onmousemove);
+ }
+
+ public void setOnmousemove(String onmousemove) {
+ getStateHelper().put(PropertyKeys.onmousemove, onmousemove);
+ }
+
+ public String getOnmouseout() {
+ return (String) getStateHelper().eval(PropertyKeys.onmouseout);
+ }
+
+ public void setOnmouseout(String onmouseout) {
+ getStateHelper().put(PropertyKeys.onmouseout, onmouseout);
+ }
+
+ public String getOnmouseover() {
+ return (String) getStateHelper().eval(PropertyKeys.onmouseover);
+ }
+
+ public void setOnmouseover(String onmouseover) {
+ getStateHelper().put(PropertyKeys.onmouseover, onmouseover);
+ }
+
+ public String getOnmouseup() {
+ return (String) getStateHelper().eval(PropertyKeys.onmouseup);
+ }
+
+ public void setOnmouseup(String onmouseup) {
+ getStateHelper().put(PropertyKeys.onmouseup, onmouseup);
+ }
+
+
+
+ @Override
+ public Collection<String> getEventNames() {
+ return EVENT_NAMES;
+ }
+}
+
Copied: branches/RF-7944/ui/output/ui/src/main/java/org/richfaces/event/MethodExpressionChangeExpandListener.java (from rev 19108, trunk/ui/output/ui/src/main/java/org/richfaces/event/MethodExpressionChangeExpandListener.java)
===================================================================
--- branches/RF-7944/ui/output/ui/src/main/java/org/richfaces/event/MethodExpressionChangeExpandListener.java (rev 0)
+++ branches/RF-7944/ui/output/ui/src/main/java/org/richfaces/event/MethodExpressionChangeExpandListener.java 2010-09-03 12:51:59 UTC (rev 19110)
@@ -0,0 +1,59 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright ${year}, Red Hat, Inc. and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+
+package org.richfaces.event;
+
+import javax.el.MethodExpression;
+import javax.faces.event.AbortProcessingException;
+
+/**
+ * <p><strong><span
+ * class="changed_modified_2_0">MethodExpressionChangeExpandListener</span></strong>
+ * is a {@link ChangeExpandListener} that wraps a {@link
+ * MethodExpression}. When it receives a {@link ChangeExpandEvent}, it
+ * executes a method on an object identified by the {@link
+ * MethodExpression}.</p>
+ *
+ * @author akolonitsky
+ * @version 1.0
+ *
+ */
+public class MethodExpressionChangeExpandListener extends MethodExpressionEventListener implements ChangeExpandListener {
+
+ public MethodExpressionChangeExpandListener() {
+ super();
+ }
+
+ public MethodExpressionChangeExpandListener(MethodExpression methodExprOneArg) {
+ super(methodExprOneArg);
+ }
+
+ public MethodExpressionChangeExpandListener(MethodExpression methodExprOneArg, MethodExpression methodExprZeroArg) {
+ super(methodExprOneArg, methodExprZeroArg);
+ }
+
+ // ------------------------------------------------------- Listener Method
+
+ public void processChangeExpand(ChangeExpandEvent changeExpandEvent) throws AbortProcessingException {
+ processEvent(changeExpandEvent);
+ }
+}
Modified: branches/RF-7944/ui/output/ui/src/main/java/org/richfaces/event/MethodExpressionItemChangeListener.java
===================================================================
--- branches/RF-7944/ui/output/ui/src/main/java/org/richfaces/event/MethodExpressionItemChangeListener.java 2010-09-03 12:00:31 UTC (rev 19109)
+++ branches/RF-7944/ui/output/ui/src/main/java/org/richfaces/event/MethodExpressionItemChangeListener.java 2010-09-03 12:51:59 UTC (rev 19110)
@@ -22,13 +22,7 @@
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;
/**
@@ -44,158 +38,23 @@
* @since -4712-01-01
*
*/
-//TODO nick - good candidate for utility class
-public class MethodExpressionItemChangeListener implements ItemChangeListener, StateHolder {
+public class MethodExpressionItemChangeListener extends MethodExpressionEventListener implements ItemChangeListener {
- 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}.</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);
+ public MethodExpressionItemChangeListener(MethodExpression methodExprOneArg) {
+ super(methodExprOneArg);
}
- /**
- * <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;
+ public MethodExpressionItemChangeListener(MethodExpression methodExprOneArg, MethodExpression methodExprZeroArg) {
+ super(methodExprOneArg, methodExprZeroArg);
}
- // ------------------------------------------------------- Event Method
+ // ------------------------------------------------------- Listener 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());
- }
+ processEvent(itemChangeEvent);
}
-
-
- // ------------------------------------------------ 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;
- }
}
Modified: branches/RF-7944/ui/output/ui/src/main/java/org/richfaces/renderkit/html/AccordionItemRenderer.java
===================================================================
--- branches/RF-7944/ui/output/ui/src/main/java/org/richfaces/renderkit/html/AccordionItemRenderer.java 2010-09-03 12:00:31 UTC (rev 19109)
+++ branches/RF-7944/ui/output/ui/src/main/java/org/richfaces/renderkit/html/AccordionItemRenderer.java 2010-09-03 12:51:59 UTC (rev 19110)
@@ -24,8 +24,8 @@
import org.ajax4jsf.javascript.JSObject;
import org.ajax4jsf.renderkit.RendererUtils;
-import org.richfaces.component.AbstractTogglePanelItem;
import org.richfaces.component.AbstractTogglePanelTitledItem;
+import org.richfaces.renderkit.RenderKitUtils;
import javax.faces.application.ResourceDependencies;
import javax.faces.application.ResourceDependency;
@@ -33,16 +33,22 @@
import javax.faces.context.FacesContext;
import javax.faces.context.ResponseWriter;
import java.io.IOException;
+import java.util.Map;
+import static org.richfaces.component.AbstractTogglePanelTitledItem.HeaderStates;
+import static org.richfaces.component.html.HtmlAccordionItem.PropertyKeys;
+import static org.richfaces.component.util.HtmlUtil.concatClasses;
+import static org.richfaces.renderkit.RenderKitUtils.renderPassThroughAttributes;
+
/**
*
- * <div id="clientId" class="rf-aci">
- * <div id="clientId:header" class="rf-aci-h">
- * <div class="rf-aci-h-inactive">Level 1</div>
- * <div class="rf-aci-h-active" >Level 1</div>
- * <div class="rf-aci-h-disabled">Level 1</div>
+ * <div id="clientId" class="rf-ac-itm">
+ * <div id="clientId:header" class="rf-ac-itm-hdr">
+ * <div class="rf-ac-itm-hdr-inact">Level 1</div>
+ * <div class="rf-ac-itm-hdr-act" >Level 1</div>
+ * <div class="rf-ac-itm-hdr-dis">Level 1</div>
* </div>
- * <div id="clientId:content" class="rf-aci-c">
+ * <div id="clientId:content" class="rf-ac-itm-cnt">
* Content will be here.
* </div>
* </div>
@@ -50,7 +56,7 @@
* @author akolonitsky
* @since 2010-08-05
*/
-@ResourceDependencies({ // TODO review
+@ResourceDependencies({
@ResourceDependency(library = "javax.faces", name = "jsf.js"),
@ResourceDependency(name = "jquery.js"),
@ResourceDependency(name = "richfaces.js"),
@@ -61,6 +67,14 @@
})
public class AccordionItemRenderer extends TogglePanelItemRenderer {
+ private static final RenderKitUtils.Attributes HEADER_ATTRIBUTES = RenderKitUtils.attributes()
+ .generic("style", PropertyKeys.headerStyle.toString())
+ .generic("onclick", PropertyKeys.onheaderclick.toString(), "headerclick")
+ .generic("ondblclick", PropertyKeys.onheaderdblclick.toString(), "headerdblclick")
+ .generic("onmousedown", PropertyKeys.onheadermousedown.toString(), "headermousedown")
+ .generic("onmousemove", PropertyKeys.onheadermousemove.toString(), "headermousemove")
+ .generic("onmouseup", PropertyKeys.onheadermouseup.toString(), "headermouseup");
+
@Override
protected void doEncodeBegin(ResponseWriter writer, FacesContext context, UIComponent component) throws IOException {
super.doEncodeBegin(writer, context, component);
@@ -72,35 +86,36 @@
@Override
protected String getStyleClass(UIComponent component) {
- return "rf-aci " + attributeAsString(component, "styleClass");
+ return concatClasses("rf-ac-itm", attributeAsString(component, "styleClass"));
}
@Override
protected void doEncodeEnd(ResponseWriter writer, FacesContext context, UIComponent component) throws IOException {
encodeContentEnd(component, writer);
- super.doEncodeEnd(writer, context, component); //To change body of overridden methods use File | Settings | File Templates.
+ super.doEncodeEnd(writer, context, component);
}
@Override
protected void writeJavaScript(ResponseWriter writer, FacesContext context, UIComponent component) throws IOException {
- // todo how to call method from parent of parent class?
-
Object script = getScriptObject(context, component);
- if (script != null) {
- writer.startElement(RendererUtils.HTML.SCRIPT_ELEM, component);
- writer.writeAttribute(RendererUtils.HTML.TYPE_ATTR, "text/javascript", "type");
- writer.writeText(script, null);
- writer.endElement(RendererUtils.HTML.SCRIPT_ELEM);
+ if (script == null) {
+ return;
}
+
+ writer.startElement(RendererUtils.HTML.SCRIPT_ELEM, component);
+ writer.writeAttribute(RendererUtils.HTML.TYPE_ATTR, "text/javascript", "type");
+ writer.writeText(script, null);
+ writer.endElement(RendererUtils.HTML.SCRIPT_ELEM);
}
private void encodeContentBegin(UIComponent component, ResponseWriter writer) throws IOException {
writer.startElement("div", component);
- writer.writeAttribute("class", "rf-aci-c " + attributeAsString(component, "contentClass"), null);
+ writer.writeAttribute("class", concatClasses("rf-ac-itm-cnt", attributeAsString(component, "contentClass")), null);
writer.writeAttribute("id", component.getClientId() + ":content", null);
- if (!((AbstractTogglePanelItem) component).isActive()) {
+ AbstractTogglePanelTitledItem item = (AbstractTogglePanelTitledItem) component;
+ if (!item.isActive() || item.isDisabled()) {
writer.writeAttribute("style", "display: none", null);
}
}
@@ -109,24 +124,25 @@
responseWriter.endElement("div");
}
- private void encodeHeader(FacesContext facesContext, UIComponent component, ResponseWriter responseWriter) throws IOException {
+ private void encodeHeader(FacesContext context, UIComponent component, ResponseWriter writer) throws IOException {
- responseWriter.startElement("div", component);
- responseWriter.writeAttribute("class", "rf-aci-h " + attributeAsString(component, "contentClass"), null);
- responseWriter.writeAttribute("id", component.getClientId() + ":header", null);
+ writer.startElement("div", component);
+ writer.writeAttribute("class", concatClasses("rf-ac-itm-hdr", attributeAsString(component, PropertyKeys.headerClass)), null);
+ writer.writeAttribute("id", component.getClientId() + ":header", null);
+ renderPassThroughAttributes(context, component, HEADER_ATTRIBUTES);
AbstractTogglePanelTitledItem titledItem = (AbstractTogglePanelTitledItem) component;
boolean isActive = titledItem.isActive();
boolean isDisabled = titledItem.isDisabled();
- encodeHeader(facesContext, component, responseWriter, "inactive", !isActive && !isDisabled);
- encodeHeader(facesContext, component, responseWriter, "active", isActive && !isDisabled);
- encodeHeader(facesContext, component, responseWriter, "disable", isDisabled);
+ encodeHeader(context, titledItem, writer, HeaderStates.inactive, !isActive && !isDisabled);
+ encodeHeader(context, titledItem, writer, HeaderStates.active, isActive && !isDisabled);
+ encodeHeader(context, titledItem, writer, HeaderStates.disable, isDisabled);
- responseWriter.endElement("div");
+ writer.endElement("div");
}
- private void encodeHeader(FacesContext facesContext, UIComponent component, ResponseWriter writer,
- String state, Boolean isDisplay) throws IOException {
+ private void encodeHeader(FacesContext facesContext, AbstractTogglePanelTitledItem component, ResponseWriter writer,
+ HeaderStates state, Boolean isDisplay) throws IOException {
writer.startElement("div", component);
@@ -134,11 +150,10 @@
writer.writeAttribute("style", "display : none", null);
}
- String name = "headerClass" + capitalize(state);
- writer.writeAttribute("class", "rf-aci-h-" + state + " " + attributeAsString(component, name), name);
+ String name = "headerClass" + capitalize(state.toString());
+ writer.writeAttribute("class", concatClasses("rf-ac-itm-hdr-" + state.abbreviation(), attributeAsString(component, name)), null);
-
- UIComponent headerFacet = component.getFacet("header" + capitalize(state));
+ UIComponent headerFacet = component.getHeaderFacet(state);
if (headerFacet != null && headerFacet.isRendered()) {
headerFacet.encodeAll(facesContext);
} else {
@@ -158,6 +173,14 @@
}
@Override
+ protected Map<String, Object> getScriptObjectOptions(FacesContext context, UIComponent component) {
+ Map<String, Object> res = super.getScriptObjectOptions(context, component);
+ res.put("disabled", ((AbstractTogglePanelTitledItem) component).isDisabled());
+
+ return res;
+ }
+
+ @Override
protected Class<? extends UIComponent> getComponentClass() {
return AbstractTogglePanelTitledItem.class;
}
Modified: branches/RF-7944/ui/output/ui/src/main/java/org/richfaces/renderkit/html/AccordionRenderer.java
===================================================================
--- branches/RF-7944/ui/output/ui/src/main/java/org/richfaces/renderkit/html/AccordionRenderer.java 2010-09-03 12:00:31 UTC (rev 19109)
+++ branches/RF-7944/ui/output/ui/src/main/java/org/richfaces/renderkit/html/AccordionRenderer.java 2010-09-03 12:51:59 UTC (rev 19110)
@@ -39,9 +39,8 @@
/**
* @author akolonitsky
- * @since 2010-08-05
*/
-@ResourceDependencies( { // TODO review
+@ResourceDependencies( {
@ResourceDependency(library = "javax.faces", name = "jsf.js"),
@ResourceDependency(name = "jquery.js"),
@ResourceDependency(name = "richfaces.js"),
@@ -69,7 +68,7 @@
@Override
protected String getStyleClass(UIComponent component) {
- return "rf-ac " + attributeAsString(component, "styleClass");
+ return HtmlUtil.concatClasses("rf-ac", attributeAsString(component, "styleClass"));
}
@Override
Copied: branches/RF-7944/ui/output/ui/src/main/java/org/richfaces/renderkit/html/CollapsiblePanelRenderer.java (from rev 19108, trunk/ui/output/ui/src/main/java/org/richfaces/renderkit/html/CollapsiblePanelRenderer.java)
===================================================================
--- branches/RF-7944/ui/output/ui/src/main/java/org/richfaces/renderkit/html/CollapsiblePanelRenderer.java (rev 0)
+++ branches/RF-7944/ui/output/ui/src/main/java/org/richfaces/renderkit/html/CollapsiblePanelRenderer.java 2010-09-03 12:51:59 UTC (rev 19110)
@@ -0,0 +1,240 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright ${year}, Red Hat, Inc. and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+
+package org.richfaces.renderkit.html;
+
+import org.ajax4jsf.javascript.JSObject;
+import org.richfaces.component.AbstractCollapsiblePanel;
+import org.richfaces.component.AbstractTogglePanel;
+import org.richfaces.component.AbstractTogglePanelTitledItem;
+
+import javax.faces.application.ResourceDependencies;
+import javax.faces.application.ResourceDependency;
+import javax.faces.component.UIComponent;
+import javax.faces.context.FacesContext;
+import javax.faces.context.ResponseWriter;
+import java.io.IOException;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import static org.richfaces.component.AbstractCollapsiblePanel.States.*;
+import static org.richfaces.component.util.HtmlUtil.concatClasses;
+import static org.richfaces.component.util.HtmlUtil.concatStyles;
+
+/**
+ * @author akolonitsky
+ * @since 2010-08-27
+ */
+@ResourceDependencies( {
+ @ResourceDependency(library = "javax.faces", name = "jsf.js"),
+ @ResourceDependency(name = "jquery.js"),
+ @ResourceDependency(name = "richfaces.js"),
+ @ResourceDependency(name = "richfaces-event.js"),
+ @ResourceDependency(name = "richfaces-base-component.js"),
+ @ResourceDependency(library = "org.richfaces", name = "TogglePanel.js"),
+ @ResourceDependency(library = "org.richfaces", name = "TogglePanelItem.js"),
+ @ResourceDependency(library = "org.richfaces", name = "CollapsiblePanel.js"),
+ @ResourceDependency(library = "org.richfaces", name = "CollapsiblePanelItem.js"),
+ @ResourceDependency(library = "org.richfaces", name = "collapsiblePanel.ecss") })
+public class CollapsiblePanelRenderer extends TogglePanelRenderer {
+
+ public static final String SWITCH = "switch";
+ public static final String BEFORE_SWITCH = "beforeswitch";
+
+ @Override
+ protected void doDecode(FacesContext context, UIComponent component) {
+ AbstractTogglePanel panel = (AbstractTogglePanel) component;
+
+ Map<String, String> requestMap =
+ context.getExternalContext().getRequestParameterMap();
+
+ // Don't overwrite the value unless you have to!
+ String newValue = requestMap.get(getValueRequestParamName(context, component));
+ if (newValue != null) {
+ panel.setSubmittedActiveItem(newValue);
+ }
+
+ String compClientId = component.getClientId(context);
+ String clientId = requestMap.get(compClientId);
+ if (clientId != null && clientId.equals(compClientId)) {
+ String itemClientId = clientId + (Boolean.parseBoolean(newValue) ? ":content" : ":empty");
+ context.getPartialViewContext().getRenderIds().add(itemClientId);
+
+ //TODO nick - this should be done on encode, not on decode
+ addOnCompleteParam(newValue, panel.getClientId());
+ }
+ }
+
+ @Override
+ protected void doEncodeBegin(ResponseWriter writer, FacesContext context, UIComponent comp) throws IOException {
+ super.doEncodeBegin(writer, context, comp);
+
+ encodeHeader(context, comp, writer);
+ }
+
+ @Override
+ protected String getStyleClass(UIComponent component) {
+ return concatClasses("rf-cp", super.getStyleClass(component));
+ }
+
+ @Override
+ protected JSObject getScriptObject(FacesContext context, UIComponent component) {
+ return new JSObject("RichFaces.ui.CollapsiblePanel",
+ component.getClientId(), getScriptObjectOptions(context, component));
+ }
+
+ @Override
+ protected Map<String, Object> getScriptObjectOptions(FacesContext context, UIComponent component) {
+ AbstractTogglePanel panel = (AbstractTogglePanel) component;
+
+ Map<String, Object> options = new HashMap<String, Object>();
+ options.put("activeItem", panel.getActiveItem());
+ options.put("ajax", getAjaxOptions(context, panel));
+ options.put("switchMode", panel.getSwitchType());
+
+ TogglePanelRenderer.addEventOption(context, panel, options, SWITCH);
+ TogglePanelRenderer.addEventOption(context, panel, options, BEFORE_SWITCH);
+
+ return options;
+ }
+
+ private void encodeHeader(FacesContext context, UIComponent component, ResponseWriter writer) throws IOException {
+ writer.startElement("div", component);
+ writer.writeAttribute("id", component.getClientId(context) + ":header", null);
+ writer.writeAttribute("class", concatClasses("rf-cp-hdr", attributeAsString(component, "headerClass")), null);
+
+ AbstractCollapsiblePanel panel = (AbstractCollapsiblePanel) component;
+ encodeHeader(context, component, writer, expanded, panel.isExpanded());
+ encodeHeader(context, component, writer, collapsed, !panel.isExpanded());
+
+ writer.endElement("div");
+ }
+
+ private void encodeHeader(FacesContext context, UIComponent component, ResponseWriter responseWriter, AbstractCollapsiblePanel.States state, boolean isVisible) throws IOException {
+ responseWriter.startElement("div", component);
+ responseWriter.writeAttribute("class", "rf-cp-hdr-" + state.abbreviation(), null);
+ responseWriter.writeAttribute("style", concatStyles(styleElement("display", isVisible ? "" : "none"), attributeAsString(component, "headerClass")), null);
+
+ UIComponent header = AbstractTogglePanelTitledItem.getHeaderFacet(component, state);
+ if (header != null && header.isRendered()) {
+ header.encodeAll(context);
+ } else {
+ String headerText = (String) component.getAttributes().get("header");
+ if (headerText != null && !headerText.isEmpty()) {
+ responseWriter.writeText(headerText, null);
+ }
+ }
+
+ responseWriter.endElement("div");
+ }
+
+ @Override
+ protected void doEncodeChildren(ResponseWriter writer, FacesContext context, UIComponent component)
+ throws IOException {
+
+ AbstractCollapsiblePanel panel = (AbstractCollapsiblePanel) component;
+
+ encodeContentChild(writer, context, component, panel);
+ encodeEmptyChild(writer, context, component, panel);
+ }
+
+ private void encodeContentChild(ResponseWriter writer, FacesContext context, UIComponent component, AbstractCollapsiblePanel panel) throws IOException {
+ if (panel.isExpanded()) {
+ encodeContent(writer, context, component, true);
+ } else {
+ switch (panel.getSwitchType()) {
+ case client:
+ encodeContent(writer, context, component, false);
+ break;
+
+ case ajax:
+ context.getResponseWriter().write(getPlaceHolder(panel.getClientId() + ":content"));
+ break;
+
+ case server:
+ // Do nothing.
+ break;
+
+ default:
+ throw new IllegalStateException("Unknown switch type : " + panel.getSwitchType());
+ }
+ }
+ }
+
+ private void encodeEmptyChild(ResponseWriter writer, FacesContext context, UIComponent component, AbstractCollapsiblePanel panel) throws IOException {
+ if (!panel.isExpanded()) {
+ encodeEmptyDiv(writer, context, component, true);
+ } else {
+ switch (panel.getSwitchType()) {
+ case client:
+ encodeEmptyDiv(writer, context, component, false);
+ break;
+
+ case ajax:
+ context.getResponseWriter().write(getPlaceHolder(panel.getClientId() + ":empty"));
+ break;
+
+ case server:
+ // Do nothing.
+ break;
+
+ default:
+ throw new IllegalStateException("Unknown switch type : " + panel.getSwitchType());
+ }
+ }
+ }
+
+ private String getPlaceHolder(String id) {
+ return "<div id=\"" + id + "\" style=\"display: none\" ></div>";
+ }
+
+ private void encodeContent(ResponseWriter writer, FacesContext context, UIComponent component, boolean visible) throws IOException {
+ writer.startElement("div", component);
+ writer.writeAttribute("id", component.getClientId() + ":content", null);
+ writer.writeAttribute("class", concatClasses("rf-cp-b", attributeAsString(component, "bodyClass")), null);
+ writer.writeAttribute("style", concatStyles(visible ? "" : "none", attributeAsString(component, "style")), null);
+
+ renderChildren(context, component);
+
+ writer.endElement("div");
+ }
+
+ private void encodeEmptyDiv(ResponseWriter writer, FacesContext context, UIComponent component, boolean visible) throws IOException {
+ writer.startElement("div", component);
+ writer.writeAttribute("id", component.getClientId() + ":empty", null);
+ writer.writeAttribute("class", "rf-cp-empty", null);
+ writer.writeAttribute("style", styleElement("display", visible ? "" : "none"), null);
+ writer.endElement("div");
+ }
+
+ @Override
+ protected List<JSObject> getChildrenScriptObjects(FacesContext context, UIComponent component) {
+ return null;
+ }
+
+ @Override
+ protected Class<? extends UIComponent> getComponentClass() {
+ return AbstractCollapsiblePanel.class;
+ }
+}
+
Modified: branches/RF-7944/ui/output/ui/src/main/java/org/richfaces/renderkit/html/DivPanelRenderer.java
===================================================================
--- branches/RF-7944/ui/output/ui/src/main/java/org/richfaces/renderkit/html/DivPanelRenderer.java 2010-09-03 12:00:31 UTC (rev 19109)
+++ branches/RF-7944/ui/output/ui/src/main/java/org/richfaces/renderkit/html/DivPanelRenderer.java 2010-09-03 12:51:59 UTC (rev 19110)
@@ -62,12 +62,18 @@
return "";
}
+ return styleElement(attr, value);
+ }
+
+ protected static String styleElement(Object name, Object value) {
return new StringBuilder()
- .append(attr).append(':').append(value).toString();
+ .append(name).append(':').append(value).toString();
}
+
protected static String attributeAsString(UIComponent comp, Enum attr) {
return attributeAsString(comp, attr.toString());
}
+
protected static String attributeAsString(UIComponent comp, String attr) {
Object o = comp.getAttributes().get(attr);
return o == null ? "" : o.toString();
@@ -80,7 +86,7 @@
* @return Capitalized string.
* @throws IllegalArgumentException String is <kk>null</kk> or empty.
*/
- protected static String capitalize(final String string) {
+ public static String capitalize(final String string) {
return Character.toUpperCase(string.charAt(0)) + string.substring(1);
}
Modified: branches/RF-7944/ui/output/ui/src/main/java/org/richfaces/renderkit/html/TogglePanelItemRenderer.java
===================================================================
--- branches/RF-7944/ui/output/ui/src/main/java/org/richfaces/renderkit/html/TogglePanelItemRenderer.java 2010-09-03 12:00:31 UTC (rev 19109)
+++ branches/RF-7944/ui/output/ui/src/main/java/org/richfaces/renderkit/html/TogglePanelItemRenderer.java 2010-09-03 12:51:59 UTC (rev 19110)
@@ -54,7 +54,7 @@
@Override
protected String getStyleClass(UIComponent component) {
- return HtmlUtil.concatClasses("rf-tgp-i", attributeAsString(component, "styleClass"));
+ return HtmlUtil.concatClasses("rf-tgp-itm", attributeAsString(component, "styleClass"));
}
@Override
Modified: branches/RF-7944/ui/output/ui/src/main/java/org/richfaces/renderkit/html/TogglePanelRenderer.java
===================================================================
--- branches/RF-7944/ui/output/ui/src/main/java/org/richfaces/renderkit/html/TogglePanelRenderer.java 2010-09-03 12:00:31 UTC (rev 19109)
+++ branches/RF-7944/ui/output/ui/src/main/java/org/richfaces/renderkit/html/TogglePanelRenderer.java 2010-09-03 12:51:59 UTC (rev 19110)
@@ -60,7 +60,7 @@
@ResourceDependency(library = "org.richfaces", name = "TogglePanel.js") })
public class TogglePanelRenderer extends DivPanelRenderer {
- private static final String VALUE_POSTFIX = "-value";
+ public static final String VALUE_POSTFIX = "-value";
private static final String ON = "on";
private static final String ITEM_CHANGE = "itemchange";
@@ -74,7 +74,7 @@
context.getExternalContext().getRequestParameterMap();
// Don't overwrite the value unless you have to!
- String newValue = requestMap.get(getActiveItemRequestParamName(context, component));
+ String newValue = requestMap.get(getValueRequestParamName(context, component));
if (newValue != null) {
panel.setSubmittedActiveItem(newValue);
}
@@ -92,7 +92,7 @@
}
}
- private static void addOnCompleteParam(String newValue, String panelId) {
+ protected static void addOnCompleteParam(String newValue, String panelId) {
StringBuilder onComplete = new StringBuilder();
onComplete.append("RichFaces.$('").append(panelId)
.append("').onCompleteHandler('").append(newValue).append("');");
@@ -100,7 +100,7 @@
AjaxContext.getCurrentInstance().appendOncomplete(onComplete.toString());
}
- private static String getActiveItemRequestParamName(FacesContext context, UIComponent component) {
+ public static String getValueRequestParamName(FacesContext context, UIComponent component) {
return component.getClientId(context) + VALUE_POSTFIX;
}
@@ -114,8 +114,8 @@
writer.startElement(HTML.INPUT_ELEM, comp);
writer.writeAttribute(HTML.TYPE_ATTR, HTML.INPUT_TYPE_HIDDEN, null);
writer.writeAttribute(HTML.VALUE_ATTRIBUTE, panel.getActiveItem(), "activeItem");
- writer.writeAttribute(HTML.ID_ATTRIBUTE, getActiveItemRequestParamName(context, comp), null);
- writer.writeAttribute(HTML.NAME_ATTRIBUTE, getActiveItemRequestParamName(context, comp), null);
+ writer.writeAttribute(HTML.ID_ATTRIBUTE, getValueRequestParamName(context, comp), null);
+ writer.writeAttribute(HTML.NAME_ATTRIBUTE, getValueRequestParamName(context, comp), null);
writer.endElement(HTML.INPUT_ELEM);
}
@@ -127,7 +127,7 @@
@Override
protected void doEncodeChildren(ResponseWriter writer, FacesContext context, UIComponent component)
throws IOException {
-
+
renderChildren(context, component);
}
@@ -141,7 +141,7 @@
protected Map<String, Object> getScriptObjectOptions(FacesContext context, UIComponent component) {
AbstractTogglePanel panel = (AbstractTogglePanel) component;
- Map<String, Object> options = new HashMap<String, Object>(5);
+ Map<String, Object> options = new HashMap<String, Object>();
options.put("activeItem", panel.getActiveItem());
options.put("cycledSwitching", panel.isCycledSwitching());
options.put("items", getChildrenScriptObjects(context, panel));
@@ -155,11 +155,11 @@
public static void addEventOption(FacesContext context, UIComponent component, Map<String, Object> options,
String eventName) {
-
+
HandlersChain handlersChain = new HandlersChain(context, component);
handlersChain.addInlineHandlerFromAttribute(ON + eventName);
handlersChain.addBehaviors(eventName);
- handlersChain.addAjaxSubmitFunction();
+// handlersChain.addAjaxSubmitFunction();
String handler = handlersChain.toScript();
if (handler != null) {
@@ -168,11 +168,11 @@
}
}
- private static AjaxEventOptions getAjaxOptions(FacesContext context, UIComponent panel) {
+ public static AjaxEventOptions getAjaxOptions(FacesContext context, UIComponent panel) {
return AjaxRendererUtils.buildEventOptions(context, panel);
}
- private List<JSObject> getChildrenScriptObjects(FacesContext context, UIComponent component) {
+ protected List<JSObject> getChildrenScriptObjects(FacesContext context, UIComponent component) {
List<JSObject> res = new ArrayList<JSObject>(component.getChildCount());
for (UIComponent child : component.getChildren()) {
res.add(getChildScriptObject(context, (AbstractTogglePanelItem) child));
Copied: branches/RF-7944/ui/output/ui/src/main/java/org/richfaces/view/facelets/html/ChangeExpandListenerHandler.java (from rev 19108, trunk/ui/output/ui/src/main/java/org/richfaces/view/facelets/html/ChangeExpandListenerHandler.java)
===================================================================
--- branches/RF-7944/ui/output/ui/src/main/java/org/richfaces/view/facelets/html/ChangeExpandListenerHandler.java (rev 0)
+++ branches/RF-7944/ui/output/ui/src/main/java/org/richfaces/view/facelets/html/ChangeExpandListenerHandler.java 2010-09-03 12:51:59 UTC (rev 19110)
@@ -0,0 +1,75 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright ${year}, Red Hat, Inc. and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+
+package org.richfaces.view.facelets.html;
+
+import org.richfaces.event.ChangeExpandEvent;
+import org.richfaces.event.ChangeExpandListener;
+import org.richfaces.event.ChangeExpandSource;
+
+import javax.el.ValueExpression;
+import javax.faces.component.UIComponent;
+import javax.faces.context.FacesContext;
+import javax.faces.event.AbortProcessingException;
+import javax.faces.view.facelets.FaceletContext;
+import javax.faces.view.facelets.TagConfig;
+
+/**
+ *
+ * @author akolonitsky
+ * @version 1.0
+ */
+public final class ChangeExpandListenerHandler extends EventListenerHandler {
+
+ private static class LazyChangeExpandListener extends LazyEventListener<ChangeExpandListener> implements ChangeExpandListener {
+ private static final long serialVersionUID = -391020876192823200L;
+
+ LazyChangeExpandListener(String type, ValueExpression binding) {
+ super(type, binding);
+ }
+
+ public void processChangeExpand(ChangeExpandEvent event) throws AbortProcessingException {
+ processEvent(event);
+ }
+ }
+
+ public ChangeExpandListenerHandler(TagConfig config) {
+ super(config);
+ }
+
+ public void applyAttachedObject(FacesContext context, UIComponent parent) {
+ ValueExpression expression = null;
+ if (this.binding != null) {
+ FaceletContext ctx = (FaceletContext) context.getAttributes().get(FaceletContext.FACELET_CONTEXT_KEY);
+ expression = this.binding.getValueExpression(ctx, ChangeExpandListener.class);
+ }
+
+ ChangeExpandSource source = (ChangeExpandSource) parent;
+ source.addChangeExpandListener(new LazyChangeExpandListener(this.listenerType, expression));
+ }
+
+ @Override
+ public boolean isEventSource(UIComponent comp) {
+ return comp instanceof ChangeExpandSource;
+ }
+}
+
Copied: branches/RF-7944/ui/output/ui/src/main/java/org/richfaces/view/facelets/html/CollapsiblePanelTagHandler.java (from rev 19108, trunk/ui/output/ui/src/main/java/org/richfaces/view/facelets/html/CollapsiblePanelTagHandler.java)
===================================================================
--- branches/RF-7944/ui/output/ui/src/main/java/org/richfaces/view/facelets/html/CollapsiblePanelTagHandler.java (rev 0)
+++ branches/RF-7944/ui/output/ui/src/main/java/org/richfaces/view/facelets/html/CollapsiblePanelTagHandler.java 2010-09-03 12:51:59 UTC (rev 19110)
@@ -0,0 +1,92 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright ${year}, Red Hat, Inc. and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+
+package org.richfaces.view.facelets.html;
+
+import org.richfaces.component.AbstractCollapsiblePanel;
+
+import org.richfaces.event.MethodExpressionChangeExpandListener;
+import org.richfaces.event.ChangeExpandEvent;
+
+import javax.faces.view.facelets.ComponentConfig;
+import javax.faces.view.facelets.ComponentHandler;
+import javax.faces.view.facelets.FaceletContext;
+import javax.faces.view.facelets.MetaRule;
+import javax.faces.view.facelets.MetaRuleset;
+import javax.faces.view.facelets.Metadata;
+import javax.faces.view.facelets.MetadataTarget;
+import javax.faces.view.facelets.TagAttribute;
+
+/**
+ * @author akolonitsky
+ * @since 2010-08-27
+ */
+public class CollapsiblePanelTagHandler extends ComponentHandler {
+
+ private static final MetaRule META_RULE = new CollapsiblePanelMetaRule();
+
+
+ public CollapsiblePanelTagHandler(ComponentConfig config) {
+ super(config);
+ }
+
+ @Override
+ protected MetaRuleset createMetaRuleset(Class type) {
+ MetaRuleset metaRuleset = super.createMetaRuleset(type);
+ metaRuleset.addRule(META_RULE);
+ return metaRuleset;
+ }
+
+ private static class CollapsiblePanelMetaRule extends MetaRule{
+
+ @Override
+ public Metadata applyRule(String name, TagAttribute attribute, MetadataTarget meta) {
+ if (meta.isTargetInstanceOf(AbstractCollapsiblePanel.class)) {
+ if ("changeExpandListener".equals(name)) {
+ return new ChangeExpandExpressionMetadata(attribute);
+ }
+
+ }
+ return null;
+ }
+ }
+
+ private static final class ChangeExpandExpressionMetadata extends Metadata {
+ private static final Class<?>[] CHANGE_EXPAND_SIG = new Class[] {ChangeExpandEvent.class };
+
+ private final TagAttribute attr;
+
+ ChangeExpandExpressionMetadata(TagAttribute attr) {
+ this.attr = attr;
+ }
+
+ @Override
+ public void applyMetadata(FaceletContext ctx, Object instance) {
+ ((AbstractCollapsiblePanel) instance).addChangeExpandListener(new MethodExpressionChangeExpandListener(
+ this.attr.getMethodExpression(ctx, null, CHANGE_EXPAND_SIG)));
+ }
+ }
+
+
+
+}
+
Modified: branches/RF-7944/ui/output/ui/src/main/java/org/richfaces/view/facelets/html/ItemChangeListenerHandler.java
===================================================================
--- branches/RF-7944/ui/output/ui/src/main/java/org/richfaces/view/facelets/html/ItemChangeListenerHandler.java 2010-09-03 12:00:31 UTC (rev 19109)
+++ branches/RF-7944/ui/output/ui/src/main/java/org/richfaces/view/facelets/html/ItemChangeListenerHandler.java 2010-09-03 12:51:59 UTC (rev 19110)
@@ -22,7 +22,6 @@
package org.richfaces.view.facelets.html;
-import org.richfaces.component.AbstractTogglePanel;
import org.richfaces.event.ItemChangeEvent;
import org.richfaces.event.ItemChangeListener;
import org.richfaces.event.ItemChangeSource;
@@ -31,14 +30,8 @@
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.Serializable;
/**
@@ -46,90 +39,24 @@
* @author akolonitsky
* @version 1.0
*/
-public final class ItemChangeListenerHandler extends TagHandler implements EditableValueHolderAttachedObjectHandler {
+public final class ItemChangeListenerHandler extends EventListenerHandler {
- private static class LazyItemChangeListener implements ItemChangeListener, Serializable {
+ private static class LazyItemChangeListener extends LazyEventListener<ItemChangeListener> implements ItemChangeListener, Serializable {
+ private static final long serialVersionUID = 7715606467989165179L;
- 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;
+ super(type, 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);
- }
+ public void processItemChange(ItemChangeEvent event) throws AbortProcessingException {
+ processEvent(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) {
-
- // 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 AbstractTogglePanel, type is: " + parent);
- }
- }
-
public void applyAttachedObject(FacesContext context, UIComponent parent) {
ValueExpression valueExpr = null;
if (this.binding != null) {
@@ -141,17 +68,9 @@
evh.addItemChangeListener(new LazyItemChangeListener(this.listenerType, valueExpr));
}
- public String getFor() {
- TagAttribute attr = this.getAttribute("for");
- return attr == null ? null : attr.getValue();
+ @Override
+ public boolean isEventSource(UIComponent comp) {
+ return comp instanceof ItemChangeSource;
}
-
- public static Class<?> forName(String name) throws ClassNotFoundException {
- if (null == name || "".equals(name)) {
- return null;
- }
-
- return Class.forName(name, false, Thread.currentThread().getContextClassLoader());
- }
}
Modified: branches/RF-7944/ui/output/ui/src/main/resources/META-INF/pn.faces-config.xml
===================================================================
--- branches/RF-7944/ui/output/ui/src/main/resources/META-INF/pn.faces-config.xml 2010-09-03 12:00:31 UTC (rev 19109)
+++ branches/RF-7944/ui/output/ui/src/main/resources/META-INF/pn.faces-config.xml 2010-09-03 12:51:59 UTC (rev 19110)
@@ -11,6 +11,61 @@
</behavior>
<component>
+ <component-type>org.richfaces.CollapsiblePanel</component-type>
+ <component-class>org.richfaces.component.html.HtmlCollapsiblePanel</component-class>
+ <property>
+ <description></description>
+ <property-name>switchType</property-name>
+ <property-class>org.richfaces.component.SwitchType</property-class>
+ </property>
+ <property>
+ <description></description>
+ <property-name>expanded</property-name>
+ <property-class>boolean</property-class>
+ </property>
+ <property>
+ <description></description>
+ <property-name>header</property-name>
+ <property-class>java.lang.String</property-class>
+ </property>
+ <property>
+ <description></description>
+ <property-name>bypassUpdates</property-name>
+ <property-class>boolean</property-class>
+ </property>
+ <property>
+ <description></description>
+ <property-name>limitToList</property-name>
+ <property-class>boolean</property-class>
+ </property>
+ <property>
+ <description></description>
+ <property-name>data</property-name>
+ <property-class>java.lang.Object</property-class>
+ </property>
+ <property>
+ <description></description>
+ <property-name>status</property-name>
+ <property-class>java.lang.String</property-class>
+ </property>
+ <property>
+ <description></description>
+ <property-name>execute</property-name>
+ <property-class>java.lang.Object</property-class>
+ </property>
+ <property>
+ <description></description>
+ <property-name>render</property-name>
+ <property-class>java.lang.Object</property-class>
+ </property>
+ <property>
+ <description></description>
+ <property-name>changeExpandListener</property-name>
+ <property-class>javax.el.MethodExpression</property-class>
+ </property>
+
+ </component>
+ <component>
<component-type>org.richfaces.TogglePanel</component-type>
<component-class>org.richfaces.component.html.HtmlTogglePanel</component-class>
<property>
@@ -604,6 +659,11 @@
<render-kit>
<render-kit-id>HTML_BASIC</render-kit-id>
<renderer>
+ <component-family>org.richfaces.CollapsiblePanel</component-family>
+ <renderer-type>org.richfaces.CollapsiblePanel</renderer-type>
+ <renderer-class>org.richfaces.renderkit.html.CollapsiblePanelRenderer</renderer-class>
+ </renderer>
+ <renderer>
<component-family>org.richfaces.TogglePanel</component-family>
<renderer-type>org.richfaces.TogglePanel</renderer-type>
<renderer-class>org.richfaces.renderkit.html.TogglePanelRenderer</renderer-class>
Modified: branches/RF-7944/ui/output/ui/src/main/resources/META-INF/pn.taglib.xml
===================================================================
--- branches/RF-7944/ui/output/ui/src/main/resources/META-INF/pn.taglib.xml 2010-09-03 12:00:31 UTC (rev 19109)
+++ branches/RF-7944/ui/output/ui/src/main/resources/META-INF/pn.taglib.xml 2010-09-03 12:51:59 UTC (rev 19110)
@@ -29,6 +29,217 @@
</tag>
<tag>
+ <tag-name>collapsiblePanel</tag-name>
+ <component>
+ <component-type>org.richfaces.CollapsiblePanel</component-type>
+ <renderer-type>org.richfaces.CollapsiblePanel</renderer-type>
+ <handler-class>org.richfaces.view.facelets.html.CollapsiblePanelTagHandler</handler-class>
+ </component>
+ <attribute>
+ <description></description>
+ <name>switchType</name>
+ <type>org.richfaces.component.SwitchType</type>
+ </attribute>
+ <attribute>
+ <description></description>
+ <name>expanded</name>
+ <type>boolean</type>
+ </attribute>
+ <attribute>
+ <description></description>
+ <name>header</name>
+ <type>java.lang.String</type>
+ </attribute>
+ <attribute>
+ <description></description>
+ <name>bypassUpdates</name>
+ <type>boolean</type>
+ </attribute>
+ <attribute>
+ <description></description>
+ <name>limitToList</name>
+ <type>boolean</type>
+ </attribute>
+ <attribute>
+ <description></description>
+ <name>data</name>
+ <type>java.lang.Object</type>
+ </attribute>
+ <attribute>
+ <description></description>
+ <name>status</name>
+ <type>java.lang.String</type>
+ </attribute>
+ <attribute>
+ <description></description>
+ <name>execute</name>
+ <type>java.lang.Object</type>
+ </attribute>
+ <attribute>
+ <description></description>
+ <name>render</name>
+ <type>java.lang.Object</type>
+ </attribute>
+ <attribute>
+ <description></description>
+ <name>id</name>
+ <type>java.lang.String</type>
+ </attribute>
+ <attribute>
+ <description></description>
+ <name>binding</name>
+ <type>javax.faces.component.UIComponent</type>
+ </attribute>
+ <attribute>
+ <description></description>
+ <name>rendered</name>
+ <type>boolean</type>
+ </attribute>
+ <attribute>
+ <description></description>
+ <name>immediate</name>
+ <type>boolean</type>
+ </attribute>
+ <attribute>
+ <description></description>
+ <name>changeExpandListener</name>
+ <type>javax.el.MethodExpression</type>
+ </attribute>
+ <attribute>
+ <description></description>
+ <name>bodyClass</name>
+ <type>java.lang.String</type>
+ </attribute>
+ <attribute>
+ <description></description>
+ <name>headerClass</name>
+ <type>java.lang.String</type>
+ </attribute>
+ <attribute>
+ <description></description>
+ <name>headerControlClass</name>
+ <type>java.lang.String</type>
+ </attribute>
+ <attribute>
+ <description></description>
+ <name>oncomplete</name>
+ <type>java.lang.String</type>
+ </attribute>
+ <attribute>
+ <description></description>
+ <name>onbeforedomupdate</name>
+ <type>java.lang.String</type>
+ </attribute>
+ <attribute>
+ <description></description>
+ <name>onswitch</name>
+ <type>java.lang.String</type>
+ </attribute>
+ <attribute>
+ <description></description>
+ <name>onbeforeswitch</name>
+ <type>java.lang.String</type>
+ </attribute>
+ <attribute>
+ <description></description>
+ <name>lang</name>
+ <type>java.lang.String</type>
+ </attribute>
+ <attribute>
+ <description></description>
+ <name>title</name>
+ <type>java.lang.String</type>
+ </attribute>
+ <attribute>
+ <description></description>
+ <name>style</name>
+ <type>java.lang.String</type>
+ </attribute>
+ <attribute>
+ <description></description>
+ <name>styleClass</name>
+ <type>java.lang.String</type>
+ </attribute>
+ <attribute>
+ <description></description>
+ <name>dir</name>
+ <type>java.lang.String</type>
+ </attribute>
+ <attribute>
+ <description></description>
+ <name>onclick</name>
+ <type>java.lang.String</type>
+ </attribute>
+ <attribute>
+ <description></description>
+ <name>ondblclick</name>
+ <type>java.lang.String</type>
+ </attribute>
+ <attribute>
+ <description></description>
+ <name>onmousedown</name>
+ <type>java.lang.String</type>
+ </attribute>
+ <attribute>
+ <description></description>
+ <name>onmousemove</name>
+ <type>java.lang.String</type>
+ </attribute>
+ <attribute>
+ <description></description>
+ <name>onmouseout</name>
+ <type>java.lang.String</type>
+ </attribute>
+ <attribute>
+ <description></description>
+ <name>onmouseover</name>
+ <type>java.lang.String</type>
+ </attribute>
+ <attribute>
+ <description></description>
+ <name>onmouseup</name>
+ <type>java.lang.String</type>
+ </attribute>
+
+ </tag>
+ <tag>
+ <description>
+ Register a ChangeExpandListener instance on the UIComponent
+ associated with the closest parent UIComponent custom
+ action.
+ </description>
+ <tag-name>changeExpandListener</tag-name>
+ <handler-class>org.richfaces.view.facelets.html.ChangeExpandListenerHandler</handler-class>
+ <attribute>
+ <description>
+ Fully qualified Java class name of a
+ ChangeExpandListener to be created and registered.
+ </description>
+ <name>type</name>
+ <type>java.lang.String</type>
+ </attribute>
+ <attribute>
+ <description>
+ Value binding expression that evaluates to an object that
+ implements org.richfaces.event.ChangeExpandListener.
+ </description>
+ <name>binding</name>
+ <required>false</required>
+ <type>org.richfaces.event.ChangeExpandListener</type>
+ </attribute>
+ <attribute>
+ <description>
+ <p class="changed_added_2_0">If present, this attribute refers
+ to the value of one of the exposed attached objects within the
+ composite component inside of which this tag is nested.</p>
+ </description>
+ <name>for</name>
+ <required>false</required>
+ <type>java.lang.String</type>
+ </attribute>
+ </tag>
+
+ <tag>
<tag-name>togglePanel</tag-name>
<component>
<component-type>org.richfaces.TogglePanel</component-type>
@@ -37,6 +248,11 @@
</component>
<attribute>
<description></description>
+ <name>cycledSwitching</name>
+ <type>boolean</type>
+ </attribute>
+ <attribute>
+ <description></description>
<name>switchType</name>
<type>org.richfaces.component.SwitchType</type>
</attribute>
@@ -57,11 +273,6 @@
</attribute>
<attribute>
<description></description>
- <name>cycledSwitching</name>
- <type>boolean</type>
- </attribute>
- <attribute>
- <description></description>
<name>data</name>
<type>java.lang.Object</type>
</attribute>
@@ -219,7 +430,7 @@
<component>
<component-type>org.richfaces.TogglePanelItem</component-type>
<renderer-type>org.richfaces.TogglePanelItem</renderer-type>
-
+
</component>
<attribute>
<description></description>
@@ -324,10 +535,15 @@
<component>
<component-type>org.richfaces.Accordion</component-type>
<renderer-type>org.richfaces.Accordion</renderer-type>
-
+
</component>
<attribute>
<description></description>
+ <name>cycledSwitching</name>
+ <type>boolean</type>
+ </attribute>
+ <attribute>
+ <description></description>
<name>switchType</name>
<type>org.richfaces.component.SwitchType</type>
</attribute>
@@ -338,16 +554,6 @@
</attribute>
<attribute>
<description></description>
- <name>height</name>
- <type>java.lang.String</type>
- </attribute>
- <attribute>
- <description></description>
- <name>width</name>
- <type>java.lang.String</type>
- </attribute>
- <attribute>
- <description></description>
<name>bypassUpdates</name>
<type>boolean</type>
</attribute>
@@ -358,11 +564,6 @@
</attribute>
<attribute>
<description></description>
- <name>cycledSwitching</name>
- <type>boolean</type>
- </attribute>
- <attribute>
- <description></description>
<name>data</name>
<type>java.lang.Object</type>
</attribute>
@@ -408,6 +609,16 @@
</attribute>
<attribute>
<description></description>
+ <name>width</name>
+ <type>java.lang.String</type>
+ </attribute>
+ <attribute>
+ <description></description>
+ <name>height</name>
+ <type>java.lang.String</type>
+ </attribute>
+ <attribute>
+ <description></description>
<name>itemHeaderClassActive</name>
<type>java.lang.String</type>
</attribute>
@@ -509,7 +720,7 @@
<component>
<component-type>org.richfaces.TogglePanelTitledItem</component-type>
<renderer-type>org.richfaces.AccordionItem</renderer-type>
-
+
</component>
<attribute>
<description></description>
@@ -673,8 +884,4 @@
</attribute>
</tag>
-
-
-
-
</facelet-taglib>
Modified: branches/RF-7944/ui/output/ui/src/main/resources/META-INF/resources/org.richfaces/AccordionItem.js
===================================================================
--- branches/RF-7944/ui/output/ui/src/main/resources/META-INF/resources/org.richfaces/AccordionItem.js 2010-09-03 12:00:31 UTC (rev 19109)
+++ branches/RF-7944/ui/output/ui/src/main/resources/META-INF/resources/org.richfaces/AccordionItem.js 2010-09-03 12:51:59 UTC (rev 19110)
@@ -41,7 +41,16 @@
this.index = options["index"];
this.getTogglePanel().getItems()[this.index] = this;
- rf.Event.bindById(this.id + ":header", "click", this.__onHeaderClick, this)
+ if (!this.disabled) {
+ rf.Event.bindById(this.id + ":header", "click", this.__onHeaderClick, this);
+ }
+
+ if (this.isSelected()) {
+ var item = this;
+ $(this.togglePanelId).ready(function () {
+ item.__fitToHeight(item.getTogglePanel());
+ });
+ }
},
/***************************** Public Methods ****************************************************************/
@@ -59,7 +68,7 @@
__header : function (state) {
var res = $(rf.getDomElement(this.id + ":header"));
if (state) {
- return res.find(".rf-aci-h-" + state);
+ return res.find(".rf-ac-itm-hdr-" + state);
}
return res;
@@ -83,24 +92,28 @@
__enter : function () {
var parentPanel = this.getTogglePanel();
if (parentPanel.isKeepHeight) {
- this.__content().hide();
- var h = parentPanel.getInnerHeight();
-
- var items = parentPanel.getItems();
- for (var i = 0; i < items.length; i++) {
- h -= items[i].__header().outerHeight();
- }
-
- this.__content().height(h - 20); // 20 it is padding top and bottom
+ this.__content().hide(); // TODO ?
+ this.__fitToHeight(parentPanel);
}
this.__content().show();
- this.__header("inactive").hide();
- this.__header("active").show();
+ this.__header("inact").hide();
+ this.__header("act").show();
return this.__fireEnter();
},
+ __fitToHeight : function (parentPanel) {
+ var h = parentPanel.getInnerHeight();
+
+ var items = parentPanel.getItems();
+ for (var i in items) {
+ h -= items[i].__header().outerHeight();
+ }
+
+ this.__content().height(h - 20); // 20 it is padding top and bottom
+ },
+
getHeight : function (recalculate) {
if (recalculate || !this.__height) {
this.__height = $(rf.getDomElement(this.id)).outerHeight(true)
@@ -121,8 +134,8 @@
}
this.__content().hide();
- this.__header("active").hide();
- this.__header("inactive").show();
+ this.__header("act").hide();
+ this.__header("inact").show();
return true;
},
Copied: branches/RF-7944/ui/output/ui/src/main/resources/META-INF/resources/org.richfaces/CollapsiblePanel.js (from rev 19108, trunk/ui/output/ui/src/main/resources/META-INF/resources/org.richfaces/CollapsiblePanel.js)
===================================================================
--- branches/RF-7944/ui/output/ui/src/main/resources/META-INF/resources/org.richfaces/CollapsiblePanel.js (rev 0)
+++ branches/RF-7944/ui/output/ui/src/main/resources/META-INF/resources/org.richfaces/CollapsiblePanel.js 2010-09-03 12:51:59 UTC (rev 19110)
@@ -0,0 +1,87 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright ${year}, Red Hat, Inc. and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+
+(function ($, rf) {
+
+ rf.ui = rf.ui || {};
+
+ rf.ui.CollapsiblePanel = rf.ui.TogglePanel.extendClass({
+
+ name:"CollapsiblePanel",
+
+ /**
+ * @class CollapsiblePanel
+ * @name CollapsiblePanel
+ *
+ * @constructor
+ * @param {String} componentId - component id
+ * @param {Hash} options - params
+ * */
+ init : function (componentId, options) {
+ rf.ui.TogglePanel.call(this, componentId, options);
+ this.switchMode = options.switchMode;
+
+ this.__addUserEventHandler("beforeswitch");
+ this.__addUserEventHandler("switch");
+
+ this.items = [
+ new RichFaces.ui.CollapsiblePanelItem(
+ this.id + ":content", {"index":0, "togglePanelId":this.id, "switchMode":this.switchMode, "name":"true"}),
+
+ new RichFaces.ui.CollapsiblePanelItem(
+ this.id + ":empty", {"index":1, "togglePanelId":this.id, "switchMode":this.switchMode, "name":"false"})
+ ];
+ this.options.cycledSwitching = true;
+
+ rf.Event.bindById(this.id + ":header", "click", this.__onHeaderClick, this)
+ },
+
+ switchPanel : function (to) {
+ this.switchToItem(to || "@next");
+ },
+
+ /***************************** Private Methods ********************************************************/
+
+ __onHeaderClick : function () {
+ this.switchToItem("@next");
+ },
+
+ __fireItemChange : function (oldItem, newItem) {
+ return new rf.Event.fireById(this.id, "switch", {
+ id: this.id,
+ isExpanded : newItem.getName()
+ });
+ },
+
+ __fireBeforeItemChange : function (oldItem, newItem) {
+ return rf.Event.fireById(this.id, "beforeswitch", {
+ id: this.id,
+ isExpanded : newItem.getName()
+ });
+ },
+
+
+ destroy: function () {
+ rf.ui.TogglePanel.destroy.call(this);
+ }
+ });
+})(jQuery, RichFaces);
Copied: branches/RF-7944/ui/output/ui/src/main/resources/META-INF/resources/org.richfaces/CollapsiblePanelItem.js (from rev 19108, trunk/ui/output/ui/src/main/resources/META-INF/resources/org.richfaces/CollapsiblePanelItem.js)
===================================================================
--- branches/RF-7944/ui/output/ui/src/main/resources/META-INF/resources/org.richfaces/CollapsiblePanelItem.js (rev 0)
+++ branches/RF-7944/ui/output/ui/src/main/resources/META-INF/resources/org.richfaces/CollapsiblePanelItem.js 2010-09-03 12:51:59 UTC (rev 19110)
@@ -0,0 +1,60 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright ${year}, Red Hat, Inc. and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+
+(function ($, rf) {
+
+ rf.ui = rf.ui || {};
+
+ rf.ui.CollapsiblePanelItem = rf.ui.TogglePanelItem.extendClass({
+
+ init : function (componentId, options) {
+ rf.ui.TogglePanelItem.call(this, componentId, options);
+ },
+
+ __enter : function () {
+ rf.getDomElement(this.id).style.display = "block";
+ this.__header(this.__state()).show();
+
+ return true;
+ },
+
+ __leave : function () {
+ rf.getDomElement(this.id).style.display = "none";
+ this.__header(this.__state()).hide();
+
+ return true;
+ },
+
+ __state : function () {
+ return this.getName() === "true" ? "expanded" : "collapsed";
+ },
+
+ __header : function (state) {
+ var res = $(rf.getDomElement(this.togglePanelId + ":header"));
+ if (state) {
+ return res.find(".rf-cp-hdr-" + state);
+ }
+
+ return res;
+ }
+ });
+})(jQuery, RichFaces);
Modified: branches/RF-7944/ui/output/ui/src/main/resources/META-INF/resources/org.richfaces/TogglePanel.js
===================================================================
--- branches/RF-7944/ui/output/ui/src/main/resources/META-INF/resources/org.richfaces/TogglePanel.js 2010-09-03 12:00:31 UTC (rev 19109)
+++ branches/RF-7944/ui/output/ui/src/main/resources/META-INF/resources/org.richfaces/TogglePanel.js 2010-09-03 12:51:59 UTC (rev 19110)
@@ -66,7 +66,7 @@
this.__setActiveItem(newPanel.getName());
- rf.submitForm(this.__getParentForm(), null, {});
+ rf.submitForm(this.__getParentForm());
return false;
},
@@ -111,7 +111,7 @@
this.__setActiveItem(newPanel.getName());
newPanel.__enter();
- this.__fireItemChange(oldPanel, newPanel);
+ this.comp.__fireItemChange(oldPanel, newPanel);
return true;
},
@@ -136,16 +136,6 @@
* */
__getValueInputId: function () {
return this.comp.id + "-value"
- },
-
- /********************* Events *************************/
-
- __fireItemChange : function (oldItem, newItem) {
- return new rf.Event.fireById(this.comp.id, "itemchange", {
- id: this.comp.id,
- oldItem : oldItem,
- newItem : newItem
- });
}
};
@@ -163,19 +153,22 @@
name:"TogglePanel",
init : function (componentId, options) {
- // call constructor of parent class
rf.BaseComponent.call(this, componentId);
this.attachToDom(componentId);
this.options = options;
this.activeItem = this.options.activeItem;
this.items = this.options.items;
+
+ this.__addUserEventHandler("itemchange");
+ this.__addUserEventHandler("beforeitemchange");
},
- /***************************** Public Methods ********************************************************************/
+ /***************************** Public Methods ****************************************************************/
/**
* @methodOf
+ *
* @name TogglePanel#getSelectItem
*
* @return {String} name of current selected panel item
@@ -326,20 +319,42 @@
/********************* Methods *************************/
- __ITEMS_META_NAMES : {
- "@first" : function (comp) { return 0; },
- "@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; }
- },
+ __ITEMS_META_NAMES : (function () {
+ function goFrom (comp, ind, step) {
+ var res = ind;
+ while ((!comp.items[res] || comp.items[res].disabled) && res < comp.items.length && res > 0) {
+ res += step;
+ }
+ return res;
+ }
+
+ return {
+ "@first" : function (comp) {
+ return goFrom(comp, 0, 1);
+ },
+
+ "@prev" : function (comp) {
+ return goFrom(comp, parseInt(comp.__getItemIndex(comp.activeItem)) - 1 , -1);
+ },
+
+ "@next" : function (comp) {
+ return goFrom(comp, parseInt(comp.__getItemIndex(comp.activeItem)) + 1 , 1);
+ },
+
+ "@last" : function (comp) {
+ return goFrom(comp, comp.items.length - 1, -1);
+ }
+ }
+ })(),
+
/**
* @private
* */
__getItemIndex : function (itemName) {
- for (var i = 0; i < this.items.length; i++) {
- if (this.items[i].getName() === itemName) {
- return i;
+ for (var i in this.items) {
+ if (!this.items[i].disabled && this.items[i].getName() === itemName) {
+ return parseInt(i);
}
}
@@ -349,6 +364,16 @@
/**
* @private
+ * */
+ __addUserEventHandler : function (name) {
+ var handler = this.options["on" + name];
+ if (handler) {
+ rf.Event.bindById(this.id, name, handler);
+ }
+ },
+
+ /**
+ * @private
* @param {Number} index - array index
*
* @return {TogglePanelItem}
@@ -381,6 +406,15 @@
/**
* Fire Concealable Event
* */
+
+ __fireItemChange : function (oldItem, newItem) {
+ return new rf.Event.fireById(this.id, "itemchange", {
+ id: this.id,
+ oldItem : oldItem,
+ newItem : newItem
+ });
+ },
+
__fireBeforeItemChange : function (oldItem, newItem) {
return rf.Event.fireById(this.id, "beforeitemchange", {
id: this.id,
@@ -389,11 +423,8 @@
});
},
- // class stuff
destroy: function () {
- // rf.Event.unbindById(this.options.buttonId, "."+this.namespace);
- // rf.Event.unbindById(this.componentId, "."+this.namespace);
- // $super.destroy.call(this);
+ rf.BaseComponent.destroy.call(this);
}
});
})(jQuery, RichFaces);
Modified: branches/RF-7944/ui/output/ui/src/main/resources/META-INF/resources/org.richfaces/TogglePanelItem.js
===================================================================
--- branches/RF-7944/ui/output/ui/src/main/resources/META-INF/resources/org.richfaces/TogglePanelItem.js 2010-09-03 12:00:31 UTC (rev 19109)
+++ branches/RF-7944/ui/output/ui/src/main/resources/META-INF/resources/org.richfaces/TogglePanelItem.js 2010-09-03 12:51:59 UTC (rev 19110)
@@ -38,6 +38,7 @@
this.name = this.options.name;
this.togglePanelId = this.options.togglePanelId;
this.switchMode = this.options.switchMode;
+ this.disabled = this.options.disabled || false;
},
/***************************** Public Methods *****************************************************************/
Modified: branches/RF-7944/ui/output/ui/src/main/resources/META-INF/resources/org.richfaces/accordion.ecss
===================================================================
--- branches/RF-7944/ui/output/ui/src/main/resources/META-INF/resources/org.richfaces/accordion.ecss 2010-09-03 12:00:31 UTC (rev 19109)
+++ branches/RF-7944/ui/output/ui/src/main/resources/META-INF/resources/org.richfaces/accordion.ecss 2010-09-03 12:51:59 UTC (rev 19110)
@@ -1,5 +1,4 @@
.rf-ac {
- /*width: 300px;*/ /*visible width*/
border-width: 1px;
border-style: solid;
border-color: '#{richSkin.panelBorderColor}';
@@ -7,7 +6,7 @@
background: '#{richSkin.generalBackgroundColor}';
}
-.rf-aci-h {
+.rf-ac-itm-hdr {
border-bottom-width: 1px;
border-bottom-style: solid;
border-bottom-color: '#{richSkin.panelBorderColor}';
@@ -24,13 +23,17 @@
cursor: pointer;
}
-.rf-aci-c {
+.rf-ac-itm-hdr-act {}
+.rf-ac-itm-hdr-inact {}
+.rf-ac-itm-hdr-dis {}
+
+.rf-ac-itm-cnt {
border-bottom-width: 1px;
border-bottom-style: solid;
border-bottom-color: '#{richSkin.panelBorderColor}';
- /*height: 100px*/ /*visible modal panel height minus header height*/;
position: relative;
overflow: auto;
overflow-x: hidden;
padding: 10px;
-}
\ No newline at end of file
+}
+
Copied: branches/RF-7944/ui/output/ui/src/main/resources/META-INF/resources/org.richfaces/collapsiblePanel.ecss (from rev 19108, trunk/ui/output/ui/src/main/resources/META-INF/resources/org.richfaces/collapsiblePanel.ecss)
===================================================================
--- branches/RF-7944/ui/output/ui/src/main/resources/META-INF/resources/org.richfaces/collapsiblePanel.ecss (rev 0)
+++ branches/RF-7944/ui/output/ui/src/main/resources/META-INF/resources/org.richfaces/collapsiblePanel.ecss 2010-09-03 12:51:59 UTC (rev 19110)
@@ -0,0 +1,32 @@
+.rf-cp{
+ background-color:'#{richSkin.generalBackgroundColor}';
+ color:'#{richSkin.panelBorderColor}';
+ border-width:1px;
+ border-style:solid;
+ padding:1px;
+}
+
+.rf-cp-hdr{
+ background-color:'#{richSkin.headerBackgroundColor}';
+ border-color:'#{richSkin.headerBackgroundColor}';
+ font-size:'#{richSkin.headerSizeFont}';
+ color:'#{richSkin.headerTextColor}';
+ font-weight:'#{richSkin.headerWeightFont}';
+ font-family:'#{richSkin.headerFamilyFont}';
+ padding:2px;
+ border-width:1px;
+ border-style:solid;
+ background-position:top left;
+ background-repeat:repeat-x;
+ background-image:"url(#{resource['org.richfaces.renderkit.html.GradientA']})";
+}
+
+.rf-cp-hdr-exp {}
+.rf-cp-hdr-colps {}
+
+.rf-cp-b{
+ font-size:'#{richSkin.generalSizeFont}';
+ color:'#{richSkin.generalTextColor}';
+ font-family:'#{richSkin.generalFamilyFont}';
+ padding:10px;
+}
\ No newline at end of file
Copied: branches/RF-7944/ui/output/ui/src/test/java/org/richfaces/component/UITogglePanelItemTest.java (from rev 19108, trunk/ui/output/ui/src/test/java/org/richfaces/component/UITogglePanelItemTest.java)
===================================================================
--- branches/RF-7944/ui/output/ui/src/test/java/org/richfaces/component/UITogglePanelItemTest.java (rev 0)
+++ branches/RF-7944/ui/output/ui/src/test/java/org/richfaces/component/UITogglePanelItemTest.java 2010-09-03 12:51:59 UTC (rev 19110)
@@ -0,0 +1,59 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright ${year}, Red Hat, Inc. and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+
+package org.richfaces.component;
+
+import org.junit.Assert;
+import org.junit.Before;
+import org.junit.Test;
+
+import javax.faces.component.UIComponent;
+import java.util.List;
+
+/**
+ * @author akolonitsky
+ * @since 2010-08-24
+ */
+public class UITogglePanelItemTest {
+
+ private UITogglePanelItem togglePanelItem;
+
+ @Before
+ public void setUp () {
+ togglePanelItem = new UITogglePanelItem();
+ }
+
+ @Test
+ public void testGetName() {
+ Assert.assertNull(togglePanelItem.getName());
+
+ String id = "id";
+ togglePanelItem.setId(id);
+ Assert.assertEquals(togglePanelItem.getId(), id);
+ Assert.assertEquals(togglePanelItem.getName(), id);
+
+ String name = "name";
+ togglePanelItem.setName(name);
+ Assert.assertEquals(togglePanelItem.getName(), name);
+ }
+}
+
Modified: branches/RF-7944/ui/parent/pom.xml
===================================================================
--- branches/RF-7944/ui/parent/pom.xml 2010-09-03 12:00:31 UTC (rev 19109)
+++ branches/RF-7944/ui/parent/pom.xml 2010-09-03 12:51:59 UTC (rev 19110)
@@ -129,12 +129,6 @@
<!-- tests -->
<dependency>
- <!-- todo api? -->
- <groupId>org.slf4j</groupId>
- <artifactId>slf4j-log4j12</artifactId>
- <scope>test</scope>
- </dependency>
- <dependency>
<groupId>org.jboss.test-jsf</groupId>
<artifactId>jsf-test-stage</artifactId>
<scope>test</scope>
14 years, 3 months
JBoss Rich Faces SVN: r19109 - in branches/RF-7944: archetypes/richfaces-archetype-simpleapp/src/main/resources/archetype-resources/src/main/java/org/richfaces and 59 other directories.
by richfaces-svn-commits@lists.jboss.org
Author: Alex.Kolonitsky
Date: 2010-09-03 08:00:31 -0400 (Fri, 03 Sep 2010)
New Revision: 19109
Added:
branches/RF-7944/core/api/src/main/java/org/richfaces/application/MessageFactory.java
branches/RF-7944/core/commons/src/main/java/org/richfaces/application/
branches/RF-7944/core/commons/src/main/java/org/richfaces/application/CoreMessages.java
branches/RF-7944/core/commons/src/main/java/org/richfaces/application/FacesMessages.java
branches/RF-7944/core/commons/src/main/java/org/richfaces/l10n/
branches/RF-7944/core/commons/src/main/java/org/richfaces/l10n/BundleLoader.java
branches/RF-7944/core/commons/src/main/java/org/richfaces/l10n/InterpolationException.java
branches/RF-7944/core/commons/src/main/java/org/richfaces/l10n/MessageBundle.java
branches/RF-7944/core/commons/src/main/java/org/richfaces/l10n/MessageInterpolator.java
branches/RF-7944/core/commons/src/main/java/org/richfaces/log/
branches/RF-7944/core/commons/src/main/java/org/richfaces/log/JavaLogger.java
branches/RF-7944/core/commons/src/main/java/org/richfaces/log/LogFactory.java
branches/RF-7944/core/commons/src/main/java/org/richfaces/log/Logger.java
branches/RF-7944/core/commons/src/test/java/org/richfaces/l10n/
branches/RF-7944/core/commons/src/test/java/org/richfaces/l10n/BundleLoaderCoreMessages.java
branches/RF-7944/core/commons/src/test/java/org/richfaces/l10n/BundleLoaderTest.java
branches/RF-7944/core/commons/src/test/java/org/richfaces/log/
branches/RF-7944/core/commons/src/test/java/org/richfaces/log/JavaLoggerTest.java
branches/RF-7944/core/commons/src/test/java/org/richfaces/log/LoggerTestMessages.java
branches/RF-7944/core/commons/src/test/resources/
branches/RF-7944/core/commons/src/test/resources/org/
branches/RF-7944/core/commons/src/test/resources/org/richfaces/
branches/RF-7944/core/commons/src/test/resources/org/richfaces/l10n/
branches/RF-7944/core/commons/src/test/resources/org/richfaces/l10n/AppMessages_by_BY.properties
branches/RF-7944/core/commons/src/test/resources/org/richfaces/l10n/AppMessages_en_US.properties
branches/RF-7944/core/commons/src/test/resources/org/richfaces/l10n/BundleLoaderMessages_en_US.properties
branches/RF-7944/core/commons/src/test/resources/org/richfaces/l10n/BundleLoaderMessages_ru_RU.properties
branches/RF-7944/core/commons/src/test/resources/org/richfaces/log/
branches/RF-7944/core/commons/src/test/resources/org/richfaces/log/Resources.properties
branches/RF-7944/core/impl/src/main/java/org/richfaces/application/MessageFactoryImpl.java
branches/RF-7944/core/impl/src/test/java/org/richfaces/application/
branches/RF-7944/core/impl/src/test/java/org/richfaces/application/MessageFactoryImplTest.java
branches/RF-7944/core/impl/src/test/resources/org/richfaces/application/
branches/RF-7944/core/impl/src/test/resources/org/richfaces/application/MessageFactoryImplTest_ru_RU.properties
Removed:
branches/RF-7944/core/commons/src/main/java/org/richfaces/JavaLogger.java
branches/RF-7944/core/commons/src/main/java/org/richfaces/LogFactory.java
branches/RF-7944/core/commons/src/main/java/org/richfaces/Logger.java
branches/RF-7944/core/commons/src/main/java/org/richfaces/application/CoreMessages.java
branches/RF-7944/core/commons/src/main/java/org/richfaces/application/FacesMessages.java
branches/RF-7944/core/commons/src/main/java/org/richfaces/l10n/BundleLoader.java
branches/RF-7944/core/commons/src/main/java/org/richfaces/l10n/InterpolationException.java
branches/RF-7944/core/commons/src/main/java/org/richfaces/l10n/MessageBundle.java
branches/RF-7944/core/commons/src/main/java/org/richfaces/l10n/MessageInterpolator.java
branches/RF-7944/core/commons/src/main/java/org/richfaces/log/JavaLogger.java
branches/RF-7944/core/commons/src/main/java/org/richfaces/log/LogFactory.java
branches/RF-7944/core/commons/src/main/java/org/richfaces/log/Logger.java
branches/RF-7944/core/commons/src/test/java/org/richfaces/l10n/BundleLoaderCoreMessages.java
branches/RF-7944/core/commons/src/test/java/org/richfaces/l10n/BundleLoaderTest.java
branches/RF-7944/core/commons/src/test/java/org/richfaces/log/JavaLoggerTest.java
branches/RF-7944/core/commons/src/test/java/org/richfaces/log/LoggerTestMessages.java
branches/RF-7944/core/commons/src/test/resources/org/
branches/RF-7944/core/commons/src/test/resources/org/richfaces/
branches/RF-7944/core/commons/src/test/resources/org/richfaces/l10n/
branches/RF-7944/core/commons/src/test/resources/org/richfaces/l10n/AppMessages_by_BY.properties
branches/RF-7944/core/commons/src/test/resources/org/richfaces/l10n/AppMessages_en_US.properties
branches/RF-7944/core/commons/src/test/resources/org/richfaces/l10n/BundleLoaderMessages_en_US.properties
branches/RF-7944/core/commons/src/test/resources/org/richfaces/l10n/BundleLoaderMessages_ru_RU.properties
branches/RF-7944/core/commons/src/test/resources/org/richfaces/log/
branches/RF-7944/core/commons/src/test/resources/org/richfaces/log/Resources.properties
branches/RF-7944/core/impl/src/main/java/org/richfaces/resource/ResourceLogger.java
branches/RF-7944/core/impl/src/test/java/org/richfaces/application/MessageFactoryImplTest.java
branches/RF-7944/core/impl/src/test/resources/log4j.xml
branches/RF-7944/core/impl/src/test/resources/org/richfaces/application/MessageFactoryImplTest_ru_RU.properties
branches/RF-7944/core/legacy-tests/src/test/resources/log4j.xml
Modified:
branches/RF-7944/archetypes/richfaces-archetype-simpleapp/src/main/resources/archetype-resources/pom.xml
branches/RF-7944/archetypes/richfaces-archetype-simpleapp/src/main/resources/archetype-resources/src/main/java/org/richfaces/RichBean.java
branches/RF-7944/archetypes/richfaces-component-short/src/main/resources/archetype-resources/pom.xml
branches/RF-7944/archetypes/richfaces-component/src/main/resources/archetype-resources/api/pom.xml
branches/RF-7944/archetypes/richfaces-component/src/main/resources/archetype-resources/impl/pom.xml
branches/RF-7944/archetypes/richfaces-component/src/main/resources/archetype-resources/ui/pom.xml
branches/RF-7944/bom/pom.xml
branches/RF-7944/cdk/commons/src/main/java/org/richfaces/cdk/JavaLogger.java
branches/RF-7944/cdk/generator/src/main/java/org/richfaces/cdk/generate/taglib/TaglibGeneratorVisitor.java
branches/RF-7944/cdk/generator/src/main/script/SchemaProcessorNamespaceContext.groovy
branches/RF-7944/cdk/maven-resources-plugin/pom.xml
branches/RF-7944/cdk/parent/pom.xml
branches/RF-7944/core/api/pom.xml
branches/RF-7944/core/api/src/main/java/org/ajax4jsf/application/ViewHandlerWrapper.java
branches/RF-7944/core/api/src/main/java/org/ajax4jsf/javascript/JSEncoder.java
branches/RF-7944/core/api/src/main/java/org/ajax4jsf/javascript/PropertyUtils.java
branches/RF-7944/core/api/src/main/java/org/ajax4jsf/javascript/ScriptUtils.java
branches/RF-7944/core/api/src/main/java/org/ajax4jsf/resource/util/URLToStreamHelper.java
branches/RF-7944/core/api/src/main/java/org/richfaces/log/RichfacesLogger.java
branches/RF-7944/core/api/src/test/java/org/ajax4jsf/javascript/ScriptUtilsTest.java
branches/RF-7944/core/commons/pom.xml
branches/RF-7944/core/impl/pom.xml
branches/RF-7944/core/impl/src/main/java/org/ajax4jsf/application/AjaxViewHandler.java
branches/RF-7944/core/impl/src/main/java/org/ajax4jsf/application/DebugLifecycle.java
branches/RF-7944/core/impl/src/main/java/org/ajax4jsf/application/DebugLifecycleFactory.java
branches/RF-7944/core/impl/src/main/java/org/ajax4jsf/cache/CacheManager.java
branches/RF-7944/core/impl/src/main/java/org/ajax4jsf/cache/EhCacheCacheFactory.java
branches/RF-7944/core/impl/src/main/java/org/ajax4jsf/cache/JBossCacheCacheFactory.java
branches/RF-7944/core/impl/src/main/java/org/ajax4jsf/cache/OSCacheCacheFactory.java
branches/RF-7944/core/impl/src/main/java/org/ajax4jsf/cache/lru/LRUMapCacheFactory.java
branches/RF-7944/core/impl/src/main/java/org/ajax4jsf/component/AjaxRegionBrige.java
branches/RF-7944/core/impl/src/main/java/org/ajax4jsf/component/AjaxViewRoot.java
branches/RF-7944/core/impl/src/main/java/org/ajax4jsf/config/FrameworkConfiguration.java
branches/RF-7944/core/impl/src/main/java/org/ajax4jsf/context/AjaxContextImpl.java
branches/RF-7944/core/impl/src/main/java/org/ajax4jsf/event/AjaxPhaseListener.java
branches/RF-7944/core/impl/src/main/java/org/ajax4jsf/event/InitPhaseListener.java
branches/RF-7944/core/impl/src/main/java/org/ajax4jsf/renderkit/AjaxChildrenRenderer.java
branches/RF-7944/core/impl/src/main/java/org/ajax4jsf/renderkit/AjaxContainerRenderer.java
branches/RF-7944/core/impl/src/main/java/org/ajax4jsf/renderkit/AjaxRendererUtils.java
branches/RF-7944/core/impl/src/main/java/org/ajax4jsf/renderkit/ChameleonRenderKitFactory.java
branches/RF-7944/core/impl/src/main/java/org/ajax4jsf/renderkit/RendererBase.java
branches/RF-7944/core/impl/src/main/java/org/ajax4jsf/resource/InternetResourceBase.java
branches/RF-7944/core/impl/src/main/java/org/ajax4jsf/resource/InternetResourceService.java
branches/RF-7944/core/impl/src/main/java/org/ajax4jsf/resource/OneTimeRenderer.java
branches/RF-7944/core/impl/src/main/java/org/ajax4jsf/resource/ResourceLifecycle.java
branches/RF-7944/core/impl/src/main/java/org/ajax4jsf/resource/ScriptRenderer.java
branches/RF-7944/core/impl/src/main/java/org/ajax4jsf/util/SelectUtils.java
branches/RF-7944/core/impl/src/main/java/org/ajax4jsf/util/ServicesUtils.java
branches/RF-7944/core/impl/src/main/java/org/ajax4jsf/webapp/BaseFilter.java
branches/RF-7944/core/impl/src/main/java/org/ajax4jsf/webapp/BaseXMLFilter.java
branches/RF-7944/core/impl/src/main/java/org/ajax4jsf/webapp/CacheContent.java
branches/RF-7944/core/impl/src/main/java/org/ajax4jsf/webapp/FilterServletResponseWrapper.java
branches/RF-7944/core/impl/src/main/java/org/ajax4jsf/webapp/HtmlParser.java
branches/RF-7944/core/impl/src/main/java/org/ajax4jsf/webapp/PollEventsManager.java
branches/RF-7944/core/impl/src/main/java/org/ajax4jsf/webapp/PushEventsCounter.java
branches/RF-7944/core/impl/src/main/java/org/ajax4jsf/webapp/ServletStreamWriter.java
branches/RF-7944/core/impl/src/main/java/org/ajax4jsf/webapp/WebXml.java
branches/RF-7944/core/impl/src/main/java/org/ajax4jsf/webapp/XMLResponseWriterState.java
branches/RF-7944/core/impl/src/main/java/org/richfaces/VersionBean.java
branches/RF-7944/core/impl/src/main/java/org/richfaces/application/DefaultModule.java
branches/RF-7944/core/impl/src/main/java/org/richfaces/application/DependencyInjectionServiceImpl.java
branches/RF-7944/core/impl/src/main/java/org/richfaces/application/InitializationListener.java
branches/RF-7944/core/impl/src/main/java/org/richfaces/component/UIDataAdaptor.java
branches/RF-7944/core/impl/src/main/java/org/richfaces/component/UISequence.java
branches/RF-7944/core/impl/src/main/java/org/richfaces/context/PartialViewContextImpl.java
branches/RF-7944/core/impl/src/main/java/org/richfaces/resource/AbstractBaseResource.java
branches/RF-7944/core/impl/src/main/java/org/richfaces/resource/AbstractCacheableResource.java
branches/RF-7944/core/impl/src/main/java/org/richfaces/resource/CachedResourceImpl.java
branches/RF-7944/core/impl/src/main/java/org/richfaces/resource/CompiledCSSResource.java
branches/RF-7944/core/impl/src/main/java/org/richfaces/resource/ResourceFactoryImpl.java
branches/RF-7944/core/impl/src/main/java/org/richfaces/resource/ResourceHandlerImpl.java
branches/RF-7944/core/impl/src/main/java/org/richfaces/resource/css/CSSVisitorImpl.java
branches/RF-7944/core/impl/src/main/java/org/richfaces/util/PropertiesUtil.java
branches/RF-7944/core/impl/src/main/java/org/richfaces/util/Util.java
branches/RF-7944/core/impl/src/main/resources/META-INF/resources/richfaces-queue.js
branches/RF-7944/core/impl/src/main/resources/META-INF/resources/richfaces.js
branches/RF-7944/core/impl/src/test/java/org/richfaces/resource/ResourceHandlerImplTest.java
branches/RF-7944/dist/readme-ui.txt
Log:
merge from trunk
Modified: branches/RF-7944/archetypes/richfaces-archetype-simpleapp/src/main/resources/archetype-resources/pom.xml
===================================================================
--- branches/RF-7944/archetypes/richfaces-archetype-simpleapp/src/main/resources/archetype-resources/pom.xml 2010-09-03 08:56:24 UTC (rev 19108)
+++ branches/RF-7944/archetypes/richfaces-archetype-simpleapp/src/main/resources/archetype-resources/pom.xml 2010-09-03 12:00:31 UTC (rev 19109)
@@ -107,8 +107,8 @@
<configuration>
<webappDirectory>${symbol_dollar}{project.build.directory}/${symbol_dollar}{project.build.finalName}-jee6</webappDirectory>
<classifier>jee6</classifier>
- <packagingExcludes>WEB-INF/lib/jsf-api*,WEB-INF/lib/jsf-impl*,WEB-INF/lib/slf4j-*</packagingExcludes>
- <warSourceExcludes>WEB-INF/lib/jsf-api*,WEB-INF/lib/jsf-impl*,WEB-INF/lib/slf4j-*</warSourceExcludes>
+ <packagingExcludes>WEB-INF/lib/jsf-api*,WEB-INF/lib/jsf-impl*</packagingExcludes>
+ <warSourceExcludes>WEB-INF/lib/jsf-api*,WEB-INF/lib/jsf-impl*</warSourceExcludes>
</configuration>
</execution>
</executions>
@@ -171,33 +171,12 @@
<groupId>javax.servlet</groupId>
<artifactId>jstl</artifactId>
</dependency>
- <dependency>
- <groupId>org.slf4j</groupId>
- <artifactId>slf4j-api</artifactId>
- </dependency>
<dependency>
<groupId>net.sf.ehcache</groupId>
<artifactId>ehcache</artifactId>
</dependency>
- <!--
- simple logger binding: only messages of level INFO and
- higher are printed
- -->
- <dependency>
- <groupId>org.slf4j</groupId>
- <artifactId>slf4j-log4j12</artifactId>
- <version>1.5.8</version>
- </dependency>
-
- <!-- Log4J dependency used in examples -->
- <dependency>
- <groupId>log4j</groupId>
- <artifactId>log4j</artifactId>
- <version>1.2.14</version>
- </dependency>
-
<!-- Tests -->
<dependency>
<groupId>org.testng</groupId>
Modified: branches/RF-7944/archetypes/richfaces-archetype-simpleapp/src/main/resources/archetype-resources/src/main/java/org/richfaces/RichBean.java
===================================================================
--- branches/RF-7944/archetypes/richfaces-archetype-simpleapp/src/main/resources/archetype-resources/src/main/java/org/richfaces/RichBean.java 2010-09-03 08:56:24 UTC (rev 19108)
+++ branches/RF-7944/archetypes/richfaces-archetype-simpleapp/src/main/resources/archetype-resources/src/main/java/org/richfaces/RichBean.java 2010-09-03 12:00:31 UTC (rev 19109)
@@ -1,7 +1,7 @@
package org.richfaces;
-import org.slf4j.LoggerFactory;
-import org.slf4j.Logger;
+import org.richfaces.log.LogFactory;
+import org.richfaces.log.Logger;
import java.io.Serializable;
@@ -12,7 +12,7 @@
private String name;
public RichBean() {
- logger = LoggerFactory.getLogger(RichBean.class);
+ logger = LogFactory.getLogger(RichBean.class);
logger.info("post construct: initialize");
name = "John";
}
Modified: branches/RF-7944/archetypes/richfaces-component/src/main/resources/archetype-resources/api/pom.xml
===================================================================
--- branches/RF-7944/archetypes/richfaces-component/src/main/resources/archetype-resources/api/pom.xml 2010-09-03 08:56:24 UTC (rev 19108)
+++ branches/RF-7944/archetypes/richfaces-component/src/main/resources/archetype-resources/api/pom.xml 2010-09-03 12:00:31 UTC (rev 19109)
@@ -75,12 +75,6 @@
<scope>test</scope>
</dependency>
<dependency>
- <!-- todo api? -->
- <groupId>org.slf4j</groupId>
- <artifactId>slf4j-log4j12</artifactId>
- <scope>test</scope>
- </dependency>
- <dependency>
<groupId>org.jboss.test-jsf</groupId>
<artifactId>jsf-test-stage</artifactId>
<scope>test</scope>
Modified: branches/RF-7944/archetypes/richfaces-component/src/main/resources/archetype-resources/impl/pom.xml
===================================================================
--- branches/RF-7944/archetypes/richfaces-component/src/main/resources/archetype-resources/impl/pom.xml 2010-09-03 08:56:24 UTC (rev 19108)
+++ branches/RF-7944/archetypes/richfaces-component/src/main/resources/archetype-resources/impl/pom.xml 2010-09-03 12:00:31 UTC (rev 19109)
@@ -91,12 +91,6 @@
<scope>test</scope>
</dependency>
<dependency>
- <!-- todo api? -->
- <groupId>org.slf4j</groupId>
- <artifactId>slf4j-log4j12</artifactId>
- <scope>test</scope>
- </dependency>
- <dependency>
<groupId>org.jboss.test-jsf</groupId>
<artifactId>jsf-test-stage</artifactId>
<scope>test</scope>
Modified: branches/RF-7944/archetypes/richfaces-component/src/main/resources/archetype-resources/ui/pom.xml
===================================================================
--- branches/RF-7944/archetypes/richfaces-component/src/main/resources/archetype-resources/ui/pom.xml 2010-09-03 08:56:24 UTC (rev 19108)
+++ branches/RF-7944/archetypes/richfaces-component/src/main/resources/archetype-resources/ui/pom.xml 2010-09-03 12:00:31 UTC (rev 19109)
@@ -90,12 +90,6 @@
<scope>test</scope>
</dependency>
<dependency>
- <!-- todo api? -->
- <groupId>org.slf4j</groupId>
- <artifactId>slf4j-log4j12</artifactId>
- <scope>test</scope>
- </dependency>
- <dependency>
<groupId>org.jboss.test-jsf</groupId>
<artifactId>jsf-test-stage</artifactId>
<scope>test</scope>
Modified: branches/RF-7944/archetypes/richfaces-component-short/src/main/resources/archetype-resources/pom.xml
===================================================================
--- branches/RF-7944/archetypes/richfaces-component-short/src/main/resources/archetype-resources/pom.xml 2010-09-03 08:56:24 UTC (rev 19108)
+++ branches/RF-7944/archetypes/richfaces-component-short/src/main/resources/archetype-resources/pom.xml 2010-09-03 12:00:31 UTC (rev 19109)
@@ -85,12 +85,6 @@
<scope>test</scope>
</dependency>
<dependency>
- <!-- todo api? -->
- <groupId>org.slf4j</groupId>
- <artifactId>slf4j-log4j12</artifactId>
- <scope>test</scope>
- </dependency>
- <dependency>
<groupId>org.jboss.test-jsf</groupId>
<artifactId>jsf-test-stage</artifactId>
<scope>test</scope>
Modified: branches/RF-7944/bom/pom.xml
===================================================================
--- branches/RF-7944/bom/pom.xml 2010-09-03 08:56:24 UTC (rev 19108)
+++ branches/RF-7944/bom/pom.xml 2010-09-03 12:00:31 UTC (rev 19109)
@@ -185,18 +185,6 @@
<version>0.9.5</version>
</dependency>
- <!-- Logging -->
- <dependency>
- <groupId>org.slf4j</groupId>
- <artifactId>slf4j-api</artifactId>
- <version>1.5.8</version>
- </dependency>
- <dependency>
- <groupId>org.slf4j</groupId>
- <artifactId>slf4j-log4j12</artifactId>
- <version>1.5.8</version>
- </dependency>
-
<!-- Optional cache dependencies -->
<dependency>
<groupId>opensymphony</groupId>
Modified: branches/RF-7944/cdk/commons/src/main/java/org/richfaces/cdk/JavaLogger.java
===================================================================
--- branches/RF-7944/cdk/commons/src/main/java/org/richfaces/cdk/JavaLogger.java 2010-09-03 08:56:24 UTC (rev 19108)
+++ branches/RF-7944/cdk/commons/src/main/java/org/richfaces/cdk/JavaLogger.java 2010-09-03 12:00:31 UTC (rev 19109)
@@ -24,75 +24,138 @@
package org.richfaces.cdk;
import java.util.logging.Level;
+import java.util.logging.LogRecord;
/**
- * <p class="changed_added_4_0">That logger delegates all calls to the JDK {@link java.util.logging.Logger}</p>
- *
+ * <p class="changed_added_4_0">
+ * That logger delegates all calls to the JDK {@link java.util.logging.Logger}
+ * </p>
+ *
* @author asmirnov(a)exadel.com
*/
public class JavaLogger implements Logger {
-
+
public static final String CDK_LOG = "org.richfaces.cdk";
+ private static final String CLASS_NAME = JavaLogger.class.getName();
+
private int errorCount = 0;
-
+
private java.util.logging.Logger jdkLogger = java.util.logging.Logger.getLogger(CDK_LOG);
+ private void fillCallerData(String fqn, LogRecord record) {
+ StackTraceElement[] stackTrace = new Exception().getStackTrace();
+
+ int i = 0;
+
+ for (; i < stackTrace.length; i++) {
+ if (fqn.equals(stackTrace[i].getClassName())) {
+ break;
+ }
+ }
+
+ int idx = i + 1;
+
+ for (; idx < stackTrace.length; idx++) {
+ if (!fqn.equals(stackTrace[idx].getClassName())) {
+ break;
+ }
+ }
+
+ if (idx < stackTrace.length) {
+ record.setSourceMethodName(stackTrace[idx].getMethodName());
+ record.setSourceClassName(stackTrace[idx].getClassName());
+ }
+ }
+
+ private LogRecord createRecord(Level level, CharSequence message, Throwable thrown) {
+ // millis and thread are filled by the constructor
+ LogRecord record = new LogRecord(level, message != null ? message.toString() : null);
+
+ // TODO resource bundle?
+ record.setLoggerName(jdkLogger.getName());
+ record.setThrown(thrown);
+ fillCallerData(CLASS_NAME, record);
+
+ return record;
+ }
+
/*
- * (non-Javadoc)
+ * (non-Javadoc)
+ *
* @see org.richfaces.cdk.Logger#debug(java.lang.CharSequence)
*/
@Override
public void debug(CharSequence content) {
- jdkLogger.fine(String.valueOf(content));
+ if (jdkLogger.isLoggable(Level.FINE)) {
+ jdkLogger.log(createRecord(Level.FINE, content, null));
+ }
}
/*
- * (non-Javadoc)
+ * (non-Javadoc)
+ *
* @see org.richfaces.cdk.Logger#debug(java.lang.CharSequence, java.lang.Throwable)
*/
@Override
public void debug(CharSequence content, Throwable error) {
- jdkLogger.log(Level.FINE, String.valueOf(content), error);
+ if (jdkLogger.isLoggable(Level.FINE)) {
+ jdkLogger.log(createRecord(Level.FINE, content, error));
+ }
}
/*
- * (non-Javadoc)
+ * (non-Javadoc)
+ *
* @see org.richfaces.cdk.Logger#debug(java.lang.Throwable)
*/
@Override
public void debug(Throwable error) {
- jdkLogger.log(Level.FINE, "", error);
+ if (jdkLogger.isLoggable(Level.FINE)) {
+ jdkLogger.log(createRecord(Level.FINE, "", error));
+ }
}
/*
- * (non-Javadoc)
+ * (non-Javadoc)
+ *
* @see org.richfaces.cdk.Logger#error(java.lang.CharSequence)
*/
@Override
public void error(CharSequence content) {
errorCount++;
- jdkLogger.severe(String.valueOf(content));
+
+ if (jdkLogger.isLoggable(Level.SEVERE)) {
+ jdkLogger.log(createRecord(Level.SEVERE, content, null));
+ }
}
/*
- * (non-Javadoc)
+ * (non-Javadoc)
+ *
* @see org.richfaces.cdk.Logger#error(java.lang.CharSequence, java.lang.Throwable)
*/
@Override
public void error(CharSequence content, Throwable error) {
errorCount++;
- jdkLogger.log(Level.SEVERE, String.valueOf(content), error);
+
+ if (jdkLogger.isLoggable(Level.SEVERE)) {
+ jdkLogger.log(createRecord(Level.SEVERE, content, error));
+ }
}
/*
- * (non-Javadoc)
+ * (non-Javadoc)
+ *
* @see org.richfaces.cdk.Logger#error(java.lang.Throwable)
*/
@Override
public void error(Throwable error) {
errorCount++;
- jdkLogger.log(Level.SEVERE, "", error);
+
+ if (jdkLogger.isLoggable(Level.SEVERE)) {
+ jdkLogger.log(createRecord(Level.SEVERE, "", error));
+ }
}
@Override
@@ -101,34 +164,44 @@
}
/*
- * (non-Javadoc)
+ * (non-Javadoc)
+ *
* @see org.richfaces.cdk.Logger#info(java.lang.CharSequence)
*/
@Override
public void info(CharSequence content) {
- jdkLogger.info(String.valueOf(content));
+ if (jdkLogger.isLoggable(Level.INFO)) {
+ jdkLogger.log(createRecord(Level.INFO, content, null));
+ }
}
/*
- * (non-Javadoc)
+ * (non-Javadoc)
+ *
* @see org.richfaces.cdk.Logger#info(java.lang.CharSequence, java.lang.Throwable)
*/
@Override
public void info(CharSequence content, Throwable error) {
- jdkLogger.log(Level.INFO, String.valueOf(content), error);
+ if (jdkLogger.isLoggable(Level.INFO)) {
+ jdkLogger.log(createRecord(Level.INFO, content, error));
+ }
}
/*
- * (non-Javadoc)
+ * (non-Javadoc)
+ *
* @see org.richfaces.cdk.Logger#info(java.lang.Throwable)
*/
@Override
public void info(Throwable error) {
- jdkLogger.log(Level.INFO, "", error);
+ if (jdkLogger.isLoggable(Level.INFO)) {
+ jdkLogger.log(createRecord(Level.INFO, "", error));
+ }
}
/*
- * (non-Javadoc)
+ * (non-Javadoc)
+ *
* @see org.richfaces.cdk.Logger#isDebugEnabled()
*/
@Override
@@ -137,7 +210,8 @@
}
/*
- * (non-Javadoc)
+ * (non-Javadoc)
+ *
* @see org.richfaces.cdk.Logger#isErrorEnabled()
*/
@Override
@@ -146,7 +220,8 @@
}
/*
- * (non-Javadoc)
+ * (non-Javadoc)
+ *
* @see org.richfaces.cdk.Logger#isInfoEnabled()
*/
@Override
@@ -155,7 +230,8 @@
}
/*
- * (non-Javadoc)
+ * (non-Javadoc)
+ *
* @see org.richfaces.cdk.Logger#isWarnEnabled()
*/
@Override
@@ -164,29 +240,38 @@
}
/*
- * (non-Javadoc)
+ * (non-Javadoc)
+ *
* @see org.richfaces.cdk.Logger#warn(java.lang.CharSequence)
*/
@Override
public void warn(CharSequence content) {
- jdkLogger.warning(String.valueOf(content));
+ if (jdkLogger.isLoggable(Level.WARNING)) {
+ jdkLogger.log(createRecord(Level.WARNING, content, null));
+ }
}
/*
- * (non-Javadoc)
+ * (non-Javadoc)
+ *
* @see org.richfaces.cdk.Logger#warn(java.lang.CharSequence, java.lang.Throwable)
*/
@Override
public void warn(CharSequence content, Throwable error) {
- jdkLogger.log(Level.WARNING, String.valueOf(content), error);
+ if (jdkLogger.isLoggable(Level.WARNING)) {
+ jdkLogger.log(createRecord(Level.WARNING, content, error));
+ }
}
/*
- * (non-Javadoc)
+ * (non-Javadoc)
+ *
* @see org.richfaces.cdk.Logger#warn(java.lang.Throwable)
*/
@Override
public void warn(Throwable error) {
- jdkLogger.log(Level.WARNING, "", error);
+ if (jdkLogger.isLoggable(Level.WARNING)) {
+ jdkLogger.log(createRecord(Level.WARNING, "", error));
+ }
}
}
Modified: branches/RF-7944/cdk/generator/src/main/java/org/richfaces/cdk/generate/taglib/TaglibGeneratorVisitor.java
===================================================================
--- branches/RF-7944/cdk/generator/src/main/java/org/richfaces/cdk/generate/taglib/TaglibGeneratorVisitor.java 2010-09-03 08:56:24 UTC (rev 19108)
+++ branches/RF-7944/cdk/generator/src/main/java/org/richfaces/cdk/generate/taglib/TaglibGeneratorVisitor.java 2010-09-03 12:00:31 UTC (rev 19109)
@@ -214,10 +214,10 @@
Element attr = tag.addElement("attribute");
addDescription(attr, attribute);
attr.addElement("name").addText(name);
- attr.addElement("type").addText(attribute.getType().getName());
if (attribute.isRequired()) {
attr.addElement("required").addText("true");
}
+ attr.addElement("type").addText(attribute.getType().getName());
return attr;
}
Modified: branches/RF-7944/cdk/generator/src/main/script/SchemaProcessorNamespaceContext.groovy
===================================================================
--- branches/RF-7944/cdk/generator/src/main/script/SchemaProcessorNamespaceContext.groovy 2010-09-03 08:56:24 UTC (rev 19108)
+++ branches/RF-7944/cdk/generator/src/main/script/SchemaProcessorNamespaceContext.groovy 2010-09-03 12:00:31 UTC (rev 19109)
@@ -37,7 +37,7 @@
SchemaProcessorNamespaceContext() {
biMap = HashBiMap.create();
biMap.put("http://www.w3.org/2001/XMLSchema", "xs");
- biMap.put("http://richfaces.org/cdk/additional-attributes-info", "cdk-schema-info");
+ biMap.put("http://jboss.org/schema/richfaces/cdk/additional-attributes-info", "cdk-schema-info");
}
@Override
Modified: branches/RF-7944/cdk/maven-resources-plugin/pom.xml
===================================================================
--- branches/RF-7944/cdk/maven-resources-plugin/pom.xml 2010-09-03 08:56:24 UTC (rev 19108)
+++ branches/RF-7944/cdk/maven-resources-plugin/pom.xml 2010-09-03 12:00:31 UTC (rev 19109)
@@ -78,10 +78,6 @@
<groupId>org.richfaces.core</groupId>
<artifactId>richfaces-core-impl</artifactId>
</dependency>
- <dependency>
- <groupId>org.slf4j</groupId>
- <artifactId>slf4j-simple</artifactId>
- </dependency>
<dependency>
<groupId>com.yahoo.platform.yui</groupId>
Modified: branches/RF-7944/cdk/parent/pom.xml
===================================================================
--- branches/RF-7944/cdk/parent/pom.xml 2010-09-03 08:56:24 UTC (rev 19108)
+++ branches/RF-7944/cdk/parent/pom.xml 2010-09-03 12:00:31 UTC (rev 19109)
@@ -227,11 +227,6 @@
<version>1.0</version>
</dependency>
<dependency>
- <groupId>org.slf4j</groupId>
- <artifactId>slf4j-simple</artifactId>
- <version>1.5.8</version>
- </dependency>
- <dependency>
<groupId>com.yahoo.platform.yui</groupId>
<artifactId>yuicompressor</artifactId>
<version>2.3.6</version>
Modified: branches/RF-7944/core/api/pom.xml
===================================================================
--- branches/RF-7944/core/api/pom.xml 2010-09-03 08:56:24 UTC (rev 19108)
+++ branches/RF-7944/core/api/pom.xml 2010-09-03 12:00:31 UTC (rev 19109)
@@ -41,10 +41,6 @@
<groupId>org.richfaces.commons</groupId>
<artifactId>richfaces-commons-api</artifactId>
</dependency>
- <dependency>
- <groupId>org.slf4j</groupId>
- <artifactId>slf4j-api</artifactId>
- </dependency>
<!-- Provided dependencies -->
<dependency>
@@ -65,11 +61,6 @@
<scope>test</scope>
</dependency>
<dependency>
- <groupId>org.slf4j</groupId>
- <artifactId>slf4j-log4j12</artifactId>
- <scope>test</scope>
- </dependency>
- <dependency>
<groupId>org.easymock</groupId>
<artifactId>easymock</artifactId>
<scope>test</scope>
Modified: branches/RF-7944/core/api/src/main/java/org/ajax4jsf/application/ViewHandlerWrapper.java
===================================================================
--- branches/RF-7944/core/api/src/main/java/org/ajax4jsf/application/ViewHandlerWrapper.java 2010-09-03 08:56:24 UTC (rev 19108)
+++ branches/RF-7944/core/api/src/main/java/org/ajax4jsf/application/ViewHandlerWrapper.java 2010-09-03 12:00:31 UTC (rev 19109)
@@ -24,9 +24,7 @@
package org.ajax4jsf.application;
import java.io.IOException;
-
import java.lang.reflect.Constructor;
-
import java.util.Locale;
import javax.faces.FacesException;
@@ -35,11 +33,9 @@
import javax.faces.context.FacesContext;
import org.ajax4jsf.Messages;
-
+import org.richfaces.log.Logger;
import org.richfaces.log.RichfacesLogger;
-import org.slf4j.Logger;
-
/**
* Base wrapper for {@link javax.faces.application.ViewHandler} . By default, delegate all
* method calls to wrapped handler.
Modified: branches/RF-7944/core/api/src/main/java/org/ajax4jsf/javascript/JSEncoder.java
===================================================================
--- branches/RF-7944/core/api/src/main/java/org/ajax4jsf/javascript/JSEncoder.java 2010-09-03 08:56:24 UTC (rev 19108)
+++ branches/RF-7944/core/api/src/main/java/org/ajax4jsf/javascript/JSEncoder.java 2010-09-03 12:00:31 UTC (rev 19109)
@@ -31,13 +31,14 @@
// private char APOSTROPHE[] = { '\\', '\'' };
private static final char[] ENCODE_HEX = "0123456789ABCDEF".toCharArray();
- private static final char[] ENCODE_APOS = "\\'".toCharArray();
private static final char[] ENCODE_QUOT = "\\\"".toCharArray();
private static final char[] ENCODE_LF = "\\n".toCharArray();
+ private static final char[] ENCODE_BC = "\\b".toCharArray();
private static final char[] ENCODE_FF = "\\f".toCharArray();
private static final char[] ENCODE_CR = "\\r".toCharArray();
private static final char[] ENCODE_TAB = "\\t".toCharArray();
private static final char[] ENCODE_BS = "\\\\".toCharArray();
+ private static final char[] ENCODE_FS = "\\/".toCharArray();
// private static final char ENCODE_ESC[] = "\\e".toCharArray();
@@ -47,32 +48,34 @@
public JSEncoder() {}
/**
- * Return true or false wether this encoding can encode the specified
+ * Return true or false whether this encoding/format can encode the specified
* character or not.
* <p>
* This method will return true for the following character range: <br />
* <code>
- * <nobr>#x9 | #xA | #xD | [#x20-#xD7FF] | [#xE000-#xFFFD]</nobr>
+ * <nobr>\b | \f | \t | \r | \n | " | \ | / | [#x20-#xD7FF] | [#xE000-#xFFFD]</nobr>
* </code>
* </p>
*
* @see <a href="http://www.w3.org/TR/REC-xml#charsets">W3C XML 1.0 </a>
+ * @see <a href="http://json.org/">JSON.org</a>
*/
public boolean compile(char c) {
- if ((c == 0x09) || // [\t]
- (c == 0x0a) || // [\n]
- (c == 0x0d) || // [\r](c == 0x22) || // ["]
- (c == 0x22) || // ["]
- (c == 0x27) || // [']
- (c == 0x5c) || // [\]
- (c == 0x03) || // [esc]
- (c == ']') || // ] - to avoid conflicts in CDATA
- (c == '<') || // - escape HTML markup characters
- (c == '>') || // - HTML
- (c == '&') || // - HTML
- (c == '-') || // - HTML comments
- (c < 0x20) || // See <http://www.w3.org/TR/REC-xml#charsets>
- ((c > 0xd7ff) && (c < 0xe000)) || (c > 0xfffd) || (c > 0xff)) {
+ if ((c == '\b') ||
+ (c == '\f') |
+ (c == '\t') ||
+ (c == '\n') ||
+ (c == '\r') ||
+ (c == '"') ||
+ (c == '\\') ||
+ (c == '/') ||
+ (c == ']') || // ] - to avoid conflicts in CDATA
+ (c == '<') || // - escape HTML markup characters
+ (c == '>') || // - HTML
+ (c == '&') || // - HTML
+ (c == '-') || // - HTML comments
+ (c < 0x20) || // See <http://www.w3.org/TR/REC-xml#charsets>
+ ((c > 0xd7ff) && (c < 0xe000)) || (c > 0xfffd) || (c > 0xff)) {
return false;
}
@@ -85,39 +88,36 @@
*/
public char[] encode(char c) {
switch (c) {
- case 0x03 :
- return ENCODE_FF; // (>) [>]
+ case '\b' :
+ return ENCODE_BC;
+
+ case '\f' :
+ return ENCODE_FF;
- case 0x09 :
- return ENCODE_TAB; // (>) [>]
+ case '\t' :
+ return ENCODE_TAB;
- case 0x0a :
- return ENCODE_LF; // (>) [>]
+ case '\n' :
+ return ENCODE_LF;
- case 0x0d :
- return ENCODE_CR; // (>) [>]
+ case '\r' :
+ return ENCODE_CR;
- case 0x22 :
- return ENCODE_QUOT; // (") ["]
+ case '"' :
+ return ENCODE_QUOT;
- case 0x27 :
- return ENCODE_APOS; // (') [']
+ case '\\' :
+ return ENCODE_BS;
- case 0x5c :
- return ENCODE_BS; // (<) [<]
-
+ case '/' :
+ return ENCODE_FS;
+
default : {
- if (c > 0xff) {
- char[] ret = {
- '\\', 'u', ENCODE_HEX[c >> 0xc & 0xf], ENCODE_HEX[c >> 0x8 & 0xf], ENCODE_HEX[c >> 0x4 & 0xf],
- ENCODE_HEX[c & 0xf]
- };
+ char[] ret = {
+ '\\', 'u', ENCODE_HEX[c >> 0xc & 0xf], ENCODE_HEX[c >> 0x8 & 0xf], ENCODE_HEX[c >> 0x4 & 0xf],
+ ENCODE_HEX[c & 0xf]
+ };
- return ret;
- }
-
- char[] ret = {'\\', 'x', ENCODE_HEX[c >> 0x4 & 0xf], ENCODE_HEX[c & 0xf]};
-
return ret;
}
}
Modified: branches/RF-7944/core/api/src/main/java/org/ajax4jsf/javascript/PropertyUtils.java
===================================================================
--- branches/RF-7944/core/api/src/main/java/org/ajax4jsf/javascript/PropertyUtils.java 2010-09-03 08:56:24 UTC (rev 19108)
+++ branches/RF-7944/core/api/src/main/java/org/ajax4jsf/javascript/PropertyUtils.java 2010-09-03 12:00:31 UTC (rev 19109)
@@ -28,16 +28,13 @@
import java.beans.IntrospectionException;
import java.beans.Introspector;
import java.beans.PropertyDescriptor;
-
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
-
import java.text.MessageFormat;
+import org.richfaces.log.Logger;
import org.richfaces.log.RichfacesLogger;
-import org.slf4j.Logger;
-
/**
* @author Nick Belaevski
* @since 4.0
Modified: branches/RF-7944/core/api/src/main/java/org/ajax4jsf/javascript/ScriptUtils.java
===================================================================
--- branches/RF-7944/core/api/src/main/java/org/ajax4jsf/javascript/ScriptUtils.java 2010-09-03 08:56:24 UTC (rev 19108)
+++ branches/RF-7944/core/api/src/main/java/org/ajax4jsf/javascript/ScriptUtils.java 2010-09-03 12:00:31 UTC (rev 19109)
@@ -40,8 +40,8 @@
import javax.faces.context.ResponseWriter;
import org.ajax4jsf.Messages;
+import org.richfaces.log.Logger;
import org.richfaces.log.RichfacesLogger;
-import org.slf4j.Logger;
/**
* @author shura (latest modification by $Author: alexsmirnov $)
Modified: branches/RF-7944/core/api/src/main/java/org/ajax4jsf/resource/util/URLToStreamHelper.java
===================================================================
--- branches/RF-7944/core/api/src/main/java/org/ajax4jsf/resource/util/URLToStreamHelper.java 2010-09-03 08:56:24 UTC (rev 19108)
+++ branches/RF-7944/core/api/src/main/java/org/ajax4jsf/resource/util/URLToStreamHelper.java 2010-09-03 12:00:31 UTC (rev 19109)
@@ -25,14 +25,12 @@
import java.io.IOException;
import java.io.InputStream;
-
import java.net.URL;
import java.net.URLConnection;
+import org.richfaces.log.Logger;
import org.richfaces.log.RichfacesLogger;
-import org.slf4j.Logger;
-
/**
* Utility class to solve JAR locking issue using {@link URLConnection#setUseCaches(boolean)} method.
* Contains one utility method that gets {@link InputStream} from {@link URL} with caching disabled.
Copied: branches/RF-7944/core/api/src/main/java/org/richfaces/application/MessageFactory.java (from rev 19108, trunk/core/api/src/main/java/org/richfaces/application/MessageFactory.java)
===================================================================
--- branches/RF-7944/core/api/src/main/java/org/richfaces/application/MessageFactory.java (rev 0)
+++ branches/RF-7944/core/api/src/main/java/org/richfaces/application/MessageFactory.java 2010-09-03 12:00:31 UTC (rev 19109)
@@ -0,0 +1,40 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc. and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.richfaces.application;
+
+import javax.faces.application.FacesMessage;
+import javax.faces.application.FacesMessage.Severity;
+import javax.faces.context.FacesContext;
+
+/**
+ * @author Nick Belaevski
+ *
+ */
+public interface MessageFactory {
+
+ public FacesMessage createMessage(FacesContext facesContext, Enum<?> messageKey, Object... args);
+
+ public FacesMessage createMessage(FacesContext facesContext, Severity severity, Enum<?> messageKey, Object... args);
+
+ public String getMessageText(FacesContext facesContext, Enum<?> messageKey, Object... args);
+
+}
Modified: branches/RF-7944/core/api/src/main/java/org/richfaces/log/RichfacesLogger.java
===================================================================
--- branches/RF-7944/core/api/src/main/java/org/richfaces/log/RichfacesLogger.java 2010-09-03 08:56:24 UTC (rev 19108)
+++ branches/RF-7944/core/api/src/main/java/org/richfaces/log/RichfacesLogger.java 2010-09-03 12:00:31 UTC (rev 19109)
@@ -3,9 +3,6 @@
import javax.faces.component.UIComponent;
import javax.faces.component.UIViewRoot;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
/**
* @author Anton Belevich
*
@@ -27,7 +24,7 @@
}
public Logger getLogger() {
- return LoggerFactory.getLogger(loggerName);
+ return LogFactory.getLogger(loggerName);
}
/**
Modified: branches/RF-7944/core/api/src/test/java/org/ajax4jsf/javascript/ScriptUtilsTest.java
===================================================================
--- branches/RF-7944/core/api/src/test/java/org/ajax4jsf/javascript/ScriptUtilsTest.java 2010-09-03 08:56:24 UTC (rev 19108)
+++ branches/RF-7944/core/api/src/test/java/org/ajax4jsf/javascript/ScriptUtilsTest.java 2010-09-03 12:00:31 UTC (rev 19109)
@@ -123,9 +123,9 @@
* Test method for {@link org.ajax4jsf.javascript.ScriptUtils#toScript(java.lang.Object)}.
*/
public void testStringToScript() {
- Object obj = "foo";
+ Object obj = "f \b\r\t\f\n\"'\\/ oo";
- assertEquals("\"foo\"", ScriptUtils.toScript(obj));
+ assertEquals("\"f \\b\\r\\t\\f\\n\\\"'\\\\\\/ oo\"", ScriptUtils.toScript(obj));
}
/**
@@ -260,8 +260,8 @@
public void testAddEncoded() {
StringBuilder buff = new StringBuilder();
- ScriptUtils.addEncoded(buff, "foo\"\'");
- assertEquals("foo\\\"\\\'", buff.toString());
+ ScriptUtils.addEncoded(buff, "foo");
+ assertEquals("foo", buff.toString());
}
/**
Modified: branches/RF-7944/core/commons/pom.xml
===================================================================
--- branches/RF-7944/core/commons/pom.xml 2010-09-03 08:56:24 UTC (rev 19108)
+++ branches/RF-7944/core/commons/pom.xml 2010-09-03 12:00:31 UTC (rev 19109)
@@ -54,6 +54,10 @@
<artifactId>jsf-mock</artifactId>
<scope>test</scope>
</dependency>
+ <dependency>
+ <groupId>com.google.guava</groupId>
+ <artifactId>guava</artifactId>
+ </dependency>
</dependencies>
<scm>
Deleted: branches/RF-7944/core/commons/src/main/java/org/richfaces/JavaLogger.java
===================================================================
--- branches/RF-7944/core/commons/src/main/java/org/richfaces/JavaLogger.java 2010-09-03 08:56:24 UTC (rev 19108)
+++ branches/RF-7944/core/commons/src/main/java/org/richfaces/JavaLogger.java 2010-09-03 12:00:31 UTC (rev 19109)
@@ -1,214 +0,0 @@
-/*
- * $Id: JavaLogger.java 16812 2010-04-26 20:43:19Z alexsmirnov $
- *
- * License Agreement.
- *
- * Rich Faces - Natural Ajax for Java Server Faces (JSF)
- *
- * Copyright (C) 2007 Exadel, Inc.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License version 2.1 as published by the Free Software Foundation.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-package org.richfaces;
-
-
-
-/**
- * <p class="changed_added_4_0">That logger delegates all calls to the JDK {@link java.util.logging.Logger}</p>
- *
- * @author asmirnov(a)exadel.com
- */
-public class JavaLogger implements Logger {
-
- public static final String RICHFACES_LOG = "org.richfaces.cdk";
-
-
- private static final String DEFAULT_MESSAGE = "Exception";
-
-
- private final java.util.logging.Logger jdkLogger;
-
- JavaLogger(String category) {
- jdkLogger = java.util.logging.Logger.getLogger(category);
- }
-
- JavaLogger() {
- this(RICHFACES_LOG);
- }
- /*
- * (non-Javadoc)
- * @see org.richfaces.cdk.Logger#debug(java.lang.CharSequence)
- */
- public void debug(CharSequence content) {
- jdkLogger.fine(String.valueOf(content));
- }
-
- /*
- * (non-Javadoc)
- * @see org.richfaces.cdk.Logger#debug(java.lang.CharSequence, java.lang.Throwable)
- */
- public void debug(CharSequence content, Throwable error) {
- jdkLogger.log(java.util.logging.Level.FINE, String.valueOf(content), error);
- }
-
- /*
- * (non-Javadoc)
- * @see org.richfaces.cdk.Logger#debug(java.lang.Throwable)
- */
- public void debug(Throwable error) {
- jdkLogger.log(java.util.logging.Level.FINE, "", error);
- }
-
- /*
- * (non-Javadoc)
- * @see org.richfaces.cdk.Logger#error(java.lang.CharSequence)
- */
- public void error(CharSequence content) {
- jdkLogger.severe(String.valueOf(content));
- }
-
- /*
- * (non-Javadoc)
- * @see org.richfaces.cdk.Logger#error(java.lang.CharSequence, java.lang.Throwable)
- */
- public void error(CharSequence content, Throwable error) {
-
- jdkLogger.log(java.util.logging.Level.SEVERE, String.valueOf(content), error);
- }
-
- /*
- * (non-Javadoc)
- * @see org.richfaces.cdk.Logger#error(java.lang.Throwable)
- */
- public void error(Throwable error) {
-
- jdkLogger.log(java.util.logging.Level.SEVERE, "", error);
- }
-
-
- /*
- * (non-Javadoc)
- * @see org.richfaces.cdk.Logger#info(java.lang.CharSequence)
- */
- public void info(CharSequence content) {
- jdkLogger.info(String.valueOf(content));
- }
-
- /*
- * (non-Javadoc)
- * @see org.richfaces.cdk.Logger#info(java.lang.CharSequence, java.lang.Throwable)
- */
- public void info(CharSequence content, Throwable error) {
- jdkLogger.log(java.util.logging.Level.INFO, String.valueOf(content), error);
- }
-
- /*
- * (non-Javadoc)
- * @see org.richfaces.cdk.Logger#info(java.lang.Throwable)
- */
- public void info(Throwable error) {
- jdkLogger.log(java.util.logging.Level.INFO, "", error);
- }
-
- /*
- * (non-Javadoc)
- * @see org.richfaces.cdk.Logger#isDebugEnabled()
- */
- public boolean isDebugEnabled() {
- return jdkLogger.isLoggable(java.util.logging.Level.FINE);
- }
-
- /*
- * (non-Javadoc)
- * @see org.richfaces.cdk.Logger#isErrorEnabled()
- */
- public boolean isErrorEnabled() {
- return jdkLogger.isLoggable(java.util.logging.Level.SEVERE);
- }
-
- /*
- * (non-Javadoc)
- * @see org.richfaces.cdk.Logger#isInfoEnabled()
- */
- public boolean isInfoEnabled() {
- return jdkLogger.isLoggable(java.util.logging.Level.INFO);
- }
-
- /*
- * (non-Javadoc)
- * @see org.richfaces.cdk.Logger#isWarnEnabled()
- */
- public boolean isWarnEnabled() {
- return jdkLogger.isLoggable(java.util.logging.Level.WARNING);
- }
-
- /*
- * (non-Javadoc)
- * @see org.richfaces.cdk.Logger#warn(java.lang.CharSequence)
- */
- public void warn(CharSequence content) {
- jdkLogger.warning(String.valueOf(content));
- }
-
- /*
- * (non-Javadoc)
- * @see org.richfaces.cdk.Logger#warn(java.lang.CharSequence, java.lang.Throwable)
- */
- public void warn(CharSequence content, Throwable error) {
- jdkLogger.log(java.util.logging.Level.WARNING, String.valueOf(content), error);
- }
-
- /*
- * (non-Javadoc)
- * @see org.richfaces.cdk.Logger#warn(java.lang.Throwable)
- */
- public void warn(Throwable error) {
- jdkLogger.log(java.util.logging.Level.WARNING, "", error);
- }
-
- public boolean isLogEnabled(Logger.Level level) {
- return jdkLogger.isLoggable(toJavaLevel(level));
- }
-
- public void log(org.richfaces.Logger.Level level, CharSequence content) {
- jdkLogger.log(toJavaLevel(level), String.valueOf(content));
-
- }
-
- public void log(org.richfaces.Logger.Level level, CharSequence content, Throwable error) {
- jdkLogger.log(toJavaLevel(level), String.valueOf(content),error);
- }
-
- public void log(org.richfaces.Logger.Level level, Throwable error) {
- jdkLogger.log(toJavaLevel(level),DEFAULT_MESSAGE, error);
- }
-
- private java.util.logging.Level toJavaLevel(Logger.Level level){
- switch (level) {
- case ERROR:
- return java.util.logging.Level.SEVERE;
- case INFO:
- return java.util.logging.Level.INFO;
- case WARNING:
- return java.util.logging.Level.WARNING;
- case DEBUG:
- return java.util.logging.Level.FINE;
- default :{
- //No level set
- throw new IllegalArgumentException("Logging level must be set to obtain a logger");
- }
- }
- }
-}
Deleted: branches/RF-7944/core/commons/src/main/java/org/richfaces/LogFactory.java
===================================================================
--- branches/RF-7944/core/commons/src/main/java/org/richfaces/LogFactory.java 2010-09-03 08:56:24 UTC (rev 19108)
+++ branches/RF-7944/core/commons/src/main/java/org/richfaces/LogFactory.java 2010-09-03 12:00:31 UTC (rev 19109)
@@ -1,61 +0,0 @@
-/*
- * $Id$
- *
- * License Agreement.
- *
- * Rich Faces - Natural Ajax for Java Server Faces (JSF)
- *
- * Copyright (C) 2007 Exadel, Inc.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License version 2.1 as published by the Free Software Foundation.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-package org.richfaces;
-
-/**
- * <p class="changed_added_4_0">This class produces loggers used by whole RichFaces library.</p>
- * @author asmirnov(a)exadel.com
- *
- */
-public final class LogFactory {
-
- private static final Logger DEFAULT_LOGGER = new JavaLogger();
-
- private LogFactory(){
- // This class is not instantiable.
- }
-
-
- /**
- * <p class="changed_added_4_0">This method creates default logger.</p>
- * @return
- */
- public static Logger getLogger(){
- return DEFAULT_LOGGER;
- }
-
- /**
- * <p class="changed_added_4_0">This method produces logger instance for given category.</p>
- * @param category
- * @return
- */
- public static Logger getLogger(String category){
- return new JavaLogger(category);
- }
-
- public static Logger getLogger(Class<?> clazz){
- return getLogger(clazz.getName());
- }
-
-}
Deleted: branches/RF-7944/core/commons/src/main/java/org/richfaces/Logger.java
===================================================================
--- branches/RF-7944/core/commons/src/main/java/org/richfaces/Logger.java 2010-09-03 08:56:24 UTC (rev 19108)
+++ branches/RF-7944/core/commons/src/main/java/org/richfaces/Logger.java 2010-09-03 12:00:31 UTC (rev 19109)
@@ -1,174 +0,0 @@
-/**
- * License Agreement.
- *
- * Rich Faces - Natural Ajax for Java Server Faces (JSF)
- *
- * Copyright (C) 2007 Exadel, Inc.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License version 2.1 as published by the Free Software Foundation.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-package org.richfaces;
-
-
-/**
- * That interface hides current logging system from classes.
- * Concrete implementation should provide appropriate logger instance that delegates
- * messages to the current log system.
- *
- * @author shura
- */
-public interface Logger {
-
- public enum Level {
- ERROR,
- INFO,
- WARNING,
- DEBUG
- }
-
- /**
- * <p class="changed_added_4_0"></p>
- * @return
- */
- public boolean isDebugEnabled();
-
- /**
- * <p class="changed_added_4_0"></p>
- * @param content
- */
- public void debug(CharSequence content);
-
- /**
- * <p class="changed_added_4_0"></p>
- * @param content
- * @param error
- */
- public void debug(CharSequence content, Throwable error);
-
- /**
- * <p class="changed_added_4_0"></p>
- * @param error
- */
- /**
- * <p class="changed_added_4_0"></p>
- * @param error
- */
- public void debug(Throwable error);
-
- /**
- * <p class="changed_added_4_0"></p>
- * @return
- */
- public boolean isInfoEnabled();
-
- /**
- * <p class="changed_added_4_0"></p>
- * @param content
- */
- public void info(CharSequence content);
-
- /**
- * <p class="changed_added_4_0"></p>
- * @param content
- * @param error
- */
- public void info(CharSequence content, Throwable error);
-
- /**
- * <p class="changed_added_4_0"></p>
- * @param error
- */
- public void info(Throwable error);
-
- /**
- * <p class="changed_added_4_0"></p>
- * @return
- */
- public boolean isWarnEnabled();
-
- /**
- * <p class="changed_added_4_0"></p>
- * @param content
- */
- public void warn(CharSequence content);
-
- /**
- * <p class="changed_added_4_0"></p>
- * @param content
- * @param error
- */
- public void warn(CharSequence content, Throwable error);
-
- /**
- * <p class="changed_added_4_0"></p>
- * @param error
- */
- public void warn(Throwable error);
-
- /**
- * <p class="changed_added_4_0"></p>
- * @return
- */
- public boolean isErrorEnabled();
-
- /**
- * <p class="changed_added_4_0"></p>
- * @param content
- */
- public void error(CharSequence content);
-
- /**
- * <p class="changed_added_4_0"></p>
- * @param content
- * @param error
- */
- public void error(CharSequence content, Throwable error);
-
- /**
- * <p class="changed_added_4_0"></p>
- * @param error
- */
- public void error(Throwable error);
-
- /**
- * <p class="changed_added_4_0"></p>
- * @param level
- * @return
- */
- public boolean isLogEnabled(Level level);
-
- /**
- * <p class="changed_added_4_0"></p>
- * @param level
- * @param content
- */
- public void log(Level level,CharSequence content);
-
- /**
- * <p class="changed_added_4_0"></p>
- * @param level
- * @param content
- * @param error
- */
- public void log(Level level,CharSequence content, Throwable error);
-
- /**
- * <p class="changed_added_4_0"></p>
- * @param level
- * @param error
- */
- public void log(Level level, Throwable error);
-
-}
Copied: branches/RF-7944/core/commons/src/main/java/org/richfaces/application (from rev 19108, trunk/core/commons/src/main/java/org/richfaces/application)
Deleted: branches/RF-7944/core/commons/src/main/java/org/richfaces/application/CoreMessages.java
===================================================================
--- trunk/core/commons/src/main/java/org/richfaces/application/CoreMessages.java 2010-09-03 08:56:24 UTC (rev 19108)
+++ branches/RF-7944/core/commons/src/main/java/org/richfaces/application/CoreMessages.java 2010-09-03 12:00:31 UTC (rev 19109)
@@ -1,36 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2010, Red Hat, Inc. and individual contributors
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.richfaces.application;
-
-import org.richfaces.l10n.MessageBundle;
-
-
-/**
- * @author Nick Belaevski
- *
- */
-@MessageBundle(baseName = "org.richfaces.Messages")
-public final class CoreMessages {
-
- private CoreMessages() {}
-
-}
Copied: branches/RF-7944/core/commons/src/main/java/org/richfaces/application/CoreMessages.java (from rev 19108, trunk/core/commons/src/main/java/org/richfaces/application/CoreMessages.java)
===================================================================
--- branches/RF-7944/core/commons/src/main/java/org/richfaces/application/CoreMessages.java (rev 0)
+++ branches/RF-7944/core/commons/src/main/java/org/richfaces/application/CoreMessages.java 2010-09-03 12:00:31 UTC (rev 19109)
@@ -0,0 +1,36 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc. and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.richfaces.application;
+
+import org.richfaces.l10n.MessageBundle;
+
+
+/**
+ * @author Nick Belaevski
+ *
+ */
+@MessageBundle(baseName = "org.richfaces.Messages")
+public final class CoreMessages {
+
+ private CoreMessages() {}
+
+}
Deleted: branches/RF-7944/core/commons/src/main/java/org/richfaces/application/FacesMessages.java
===================================================================
--- trunk/core/commons/src/main/java/org/richfaces/application/FacesMessages.java 2010-09-03 08:56:24 UTC (rev 19108)
+++ branches/RF-7944/core/commons/src/main/java/org/richfaces/application/FacesMessages.java 2010-09-03 12:00:31 UTC (rev 19109)
@@ -1,109 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2010, Red Hat, Inc. and individual contributors
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.richfaces.application;
-
-import javax.faces.application.FacesMessage;
-
-import org.richfaces.l10n.MessageBundle;
-
-/**
- * @author Nick Belaevski
- *
- */
-@MessageBundle(baseName = FacesMessage.FACES_MESSAGES)
-public enum FacesMessages {
-
- UIINPUT_CONVERSION("javax.faces.component.UIInput.CONVERSION"),
- UIINPUT_REQUIRED("javax.faces.component.UIInput.REQUIRED"),
- UIINPUT_UPDATE("javax.faces.component.UIInput.UPDATE"),
- UISELECTONE_INVALID("javax.faces.component.UISelectOne.INVALID"),
- UISELECTMANY_INVALID("javax.faces.component.UISelectMany.INVALID"),
- BIG_DECIMAL_CONVERTER_DECIMAL("javax.faces.converter.BigDecimalConverter.DECIMAL"),
- BIG_DECIMAL_CONVERTER_DECIMAL_DETAIL("javax.faces.converter.BigDecimalConverter.DECIMAL_detail"),
- BIG_INTEGER_CONVERTER_BIGINTEGER("javax.faces.converter.BigIntegerConverter.BIGINTEGER"),
- BIG_INTEGER_CONVERTER_BIGINTEGER_DETAIL("javax.faces.converter.BigIntegerConverter.BIGINTEGER_detail"),
- BOOLEAN_CONVERTER_BOOLEAN("javax.faces.converter.BooleanConverter.BOOLEAN"),
- BOOLEAN_CONVERTER_BOOLEAN_DETAIL("javax.faces.converter.BooleanConverter.BOOLEAN_detail"),
- BYTE_CONVERTER_BYTE("javax.faces.converter.ByteConverter.BYTE"),
- BYTE_CONVERTER_BYTE_DETAIL("javax.faces.converter.ByteConverter.BYTE_detail"),
- CHARACTER_CONVERTER_CHARACTER("javax.faces.converter.CharacterConverter.CHARACTER"),
- CHARACTER_CONVERTER_CHARACTER_DETAIL("javax.faces.converter.CharacterConverter.CHARACTER_detail"),
- DATE_TIME_CONVERTER_DATE("javax.faces.converter.DateTimeConverter.DATE"),
- DATE_TIME_CONVERTER_DATE_DETAIL("javax.faces.converter.DateTimeConverter.DATE_detail"),
- DATE_TIME_CONVERTER_TIME("javax.faces.converter.DateTimeConverter.TIME"),
- DATE_TIME_CONVERTER_TIME_DETAIL("javax.faces.converter.DateTimeConverter.TIME_detail"),
- DATE_TIME_CONVERTER_DATETIME("javax.faces.converter.DateTimeConverter.DATETIME"),
- DATE_TIME_CONVERTER_DATETIME_DETAIL("javax.faces.converter.DateTimeConverter.DATETIME_detail"),
- DATE_TIME_CONVERTER_PATTERN_TYPE("javax.faces.converter.DateTimeConverter.PATTERN_TYPE"),
- DOUBLE_CONVERTER_DOUBLE("javax.faces.converter.DoubleConverter.DOUBLE"),
- DOUBLE_CONVERTER_DOUBLE_DETAIL("javax.faces.converter.DoubleConverter.DOUBLE_detail"),
- ENUM_CONVERTER_ENUM("javax.faces.converter.EnumConverter.ENUM"),
- ENUM_CONVERTER_ENUM_DETAIL("javax.faces.converter.EnumConverter.ENUM_detail"),
- ENUM_CONVERTER_ENUM_NO_CLASS("javax.faces.converter.EnumConverter.ENUM_NO_CLASS"),
- ENUM_CONVERTER_ENUM_NO_CLASS_DETAIL("javax.faces.converter.EnumConverter.ENUM_NO_CLASS_detail"),
- FLOAT_CONVERTER_FLOAT("javax.faces.converter.FloatConverter.FLOAT"),
- FLOAT_CONVERTER_FLOAT_DETAIL("javax.faces.converter.FloatConverter.FLOAT_detail"),
- INTEGER_CONVERTER_INTEGER("javax.faces.converter.IntegerConverter.INTEGER"),
- INTEGER_CONVERTER_INTEGER_DETAIL("javax.faces.converter.IntegerConverter.INTEGER_detail"),
- LONG_CONVERTER_LONG("javax.faces.converter.LongConverter.LONG"),
- LONG_CONVERTER_LONG_DETAIL("javax.faces.converter.LongConverter.LONG_detail"),
- NUMBER_CONVERTER_CURRENCY("javax.faces.converter.NumberConverter.CURRENCY"),
- NUMBER_CONVERTER_CURRENCY_DETAIL("javax.faces.converter.NumberConverter.CURRENCY_detail"),
- NUMBER_CONVERTER_PERCENT("javax.faces.converter.NumberConverter.PERCENT"),
- NUMBER_CONVERTER_PERCENT_DETAIL("javax.faces.converter.NumberConverter.PERCENT_detail"),
- NUMBER_CONVERTER_NUMBER("javax.faces.converter.NumberConverter.NUMBER"),
- NUMBER_CONVERTER_NUMBER_DETAIL("javax.faces.converter.NumberConverter.NUMBER_detail"),
- NUMBER_CONVERTER_PATTERN("javax.faces.converter.NumberConverter.PATTERN"),
- NUMBER_CONVERTER_PATTERN_DETAIL("javax.faces.converter.NumberConverter.PATTERN_detail"),
- SHORT_CONVERTER_SHORT("javax.faces.converter.ShortConverter.SHORT"),
- SHORT_CONVERTER_SHORT_DETAIL("javax.faces.converter.ShortConverter.SHORT_detail"),
- CONVERTER_STRING("javax.faces.converter.STRING"),
- DOUBLE_RANGE_VALIDATOR_MAXIMUM("javax.faces.validator.DoubleRangeValidator.MAXIMUM"),
- DOUBLE_RANGE_VALIDATOR_MINIMUM("javax.faces.validator.DoubleRangeValidator.MINIMUM"),
- DOUBLE_RANGE_VALIDATOR_NOT_IN_RANGE("javax.faces.validator.DoubleRangeValidator.NOT_IN_RANGE"),
- DOUBLE_RANGE_VALIDATOR_TYPE("javax.faces.validator.DoubleRangeValidator.TYPE"),
- LENGTH_VALIDATOR_MAXIMUM("javax.faces.validator.LengthValidator.MAXIMUM"),
- LENGTH_VALIDATOR_MINIMUM("javax.faces.validator.LengthValidator.MINIMUM"),
- LONG_RANGE_VALIDATOR_MAXIMUM("javax.faces.validator.LongRangeValidator.MAXIMUM"),
- LONG_RANGE_VALIDATOR_MINIMUM("javax.faces.validator.LongRangeValidator.MINIMUM"),
- LONG_RANGE_VALIDATOR_NOT_IN_RANGE("javax.faces.validator.LongRangeValidator.NOT_IN_RANGE"),
- LONG_RANGE_VALIDATOR_TYPE("javax.faces.validator.LongRangeValidator.TYPE"),
- VALIDATOR_NOT_IN_RANGE("javax.faces.validator.NOT_IN_RANGE"),
- REGEX_VALIDATOR_PATTERN_NOT_SET("javax.faces.validator.RegexValidator.PATTERN_NOT_SET"),
- REGEX_VALIDATOR_PATTERN_NOT_SET_DETAIL("javax.faces.validator.RegexValidator.PATTERN_NOT_SET_detail"),
- REGEX_VALIDATOR_NOT_MATCHED("javax.faces.validator.RegexValidator.NOT_MATCHED"),
- REGEX_VALIDATOR_NOT_MATCHED_DETAIL("javax.faces.validator.RegexValidator.NOT_MATCHED_detail"),
- REGEX_VALIDATOR_MATCH_EXCEPTION("javax.faces.validator.RegexValidator.MATCH_EXCEPTION"),
- REGEX_VALIDATOR_MATCH_EXCEPTION_DETAIL("javax.faces.validator.RegexValidator.MATCH_EXCEPTION_detail"),
- BEAN_VALIDATOR_MESSAGE("javax.faces.validator.BeanValidator.MESSAGE");
-
- private String key;
-
- private FacesMessages(String key) {
- this.key = key;
- }
-
- @Override
- public String toString() {
- return key;
- }
-}
Copied: branches/RF-7944/core/commons/src/main/java/org/richfaces/application/FacesMessages.java (from rev 19108, trunk/core/commons/src/main/java/org/richfaces/application/FacesMessages.java)
===================================================================
--- branches/RF-7944/core/commons/src/main/java/org/richfaces/application/FacesMessages.java (rev 0)
+++ branches/RF-7944/core/commons/src/main/java/org/richfaces/application/FacesMessages.java 2010-09-03 12:00:31 UTC (rev 19109)
@@ -0,0 +1,109 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc. and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.richfaces.application;
+
+import javax.faces.application.FacesMessage;
+
+import org.richfaces.l10n.MessageBundle;
+
+/**
+ * @author Nick Belaevski
+ *
+ */
+@MessageBundle(baseName = FacesMessage.FACES_MESSAGES)
+public enum FacesMessages {
+
+ UIINPUT_CONVERSION("javax.faces.component.UIInput.CONVERSION"),
+ UIINPUT_REQUIRED("javax.faces.component.UIInput.REQUIRED"),
+ UIINPUT_UPDATE("javax.faces.component.UIInput.UPDATE"),
+ UISELECTONE_INVALID("javax.faces.component.UISelectOne.INVALID"),
+ UISELECTMANY_INVALID("javax.faces.component.UISelectMany.INVALID"),
+ BIG_DECIMAL_CONVERTER_DECIMAL("javax.faces.converter.BigDecimalConverter.DECIMAL"),
+ BIG_DECIMAL_CONVERTER_DECIMAL_DETAIL("javax.faces.converter.BigDecimalConverter.DECIMAL_detail"),
+ BIG_INTEGER_CONVERTER_BIGINTEGER("javax.faces.converter.BigIntegerConverter.BIGINTEGER"),
+ BIG_INTEGER_CONVERTER_BIGINTEGER_DETAIL("javax.faces.converter.BigIntegerConverter.BIGINTEGER_detail"),
+ BOOLEAN_CONVERTER_BOOLEAN("javax.faces.converter.BooleanConverter.BOOLEAN"),
+ BOOLEAN_CONVERTER_BOOLEAN_DETAIL("javax.faces.converter.BooleanConverter.BOOLEAN_detail"),
+ BYTE_CONVERTER_BYTE("javax.faces.converter.ByteConverter.BYTE"),
+ BYTE_CONVERTER_BYTE_DETAIL("javax.faces.converter.ByteConverter.BYTE_detail"),
+ CHARACTER_CONVERTER_CHARACTER("javax.faces.converter.CharacterConverter.CHARACTER"),
+ CHARACTER_CONVERTER_CHARACTER_DETAIL("javax.faces.converter.CharacterConverter.CHARACTER_detail"),
+ DATE_TIME_CONVERTER_DATE("javax.faces.converter.DateTimeConverter.DATE"),
+ DATE_TIME_CONVERTER_DATE_DETAIL("javax.faces.converter.DateTimeConverter.DATE_detail"),
+ DATE_TIME_CONVERTER_TIME("javax.faces.converter.DateTimeConverter.TIME"),
+ DATE_TIME_CONVERTER_TIME_DETAIL("javax.faces.converter.DateTimeConverter.TIME_detail"),
+ DATE_TIME_CONVERTER_DATETIME("javax.faces.converter.DateTimeConverter.DATETIME"),
+ DATE_TIME_CONVERTER_DATETIME_DETAIL("javax.faces.converter.DateTimeConverter.DATETIME_detail"),
+ DATE_TIME_CONVERTER_PATTERN_TYPE("javax.faces.converter.DateTimeConverter.PATTERN_TYPE"),
+ DOUBLE_CONVERTER_DOUBLE("javax.faces.converter.DoubleConverter.DOUBLE"),
+ DOUBLE_CONVERTER_DOUBLE_DETAIL("javax.faces.converter.DoubleConverter.DOUBLE_detail"),
+ ENUM_CONVERTER_ENUM("javax.faces.converter.EnumConverter.ENUM"),
+ ENUM_CONVERTER_ENUM_DETAIL("javax.faces.converter.EnumConverter.ENUM_detail"),
+ ENUM_CONVERTER_ENUM_NO_CLASS("javax.faces.converter.EnumConverter.ENUM_NO_CLASS"),
+ ENUM_CONVERTER_ENUM_NO_CLASS_DETAIL("javax.faces.converter.EnumConverter.ENUM_NO_CLASS_detail"),
+ FLOAT_CONVERTER_FLOAT("javax.faces.converter.FloatConverter.FLOAT"),
+ FLOAT_CONVERTER_FLOAT_DETAIL("javax.faces.converter.FloatConverter.FLOAT_detail"),
+ INTEGER_CONVERTER_INTEGER("javax.faces.converter.IntegerConverter.INTEGER"),
+ INTEGER_CONVERTER_INTEGER_DETAIL("javax.faces.converter.IntegerConverter.INTEGER_detail"),
+ LONG_CONVERTER_LONG("javax.faces.converter.LongConverter.LONG"),
+ LONG_CONVERTER_LONG_DETAIL("javax.faces.converter.LongConverter.LONG_detail"),
+ NUMBER_CONVERTER_CURRENCY("javax.faces.converter.NumberConverter.CURRENCY"),
+ NUMBER_CONVERTER_CURRENCY_DETAIL("javax.faces.converter.NumberConverter.CURRENCY_detail"),
+ NUMBER_CONVERTER_PERCENT("javax.faces.converter.NumberConverter.PERCENT"),
+ NUMBER_CONVERTER_PERCENT_DETAIL("javax.faces.converter.NumberConverter.PERCENT_detail"),
+ NUMBER_CONVERTER_NUMBER("javax.faces.converter.NumberConverter.NUMBER"),
+ NUMBER_CONVERTER_NUMBER_DETAIL("javax.faces.converter.NumberConverter.NUMBER_detail"),
+ NUMBER_CONVERTER_PATTERN("javax.faces.converter.NumberConverter.PATTERN"),
+ NUMBER_CONVERTER_PATTERN_DETAIL("javax.faces.converter.NumberConverter.PATTERN_detail"),
+ SHORT_CONVERTER_SHORT("javax.faces.converter.ShortConverter.SHORT"),
+ SHORT_CONVERTER_SHORT_DETAIL("javax.faces.converter.ShortConverter.SHORT_detail"),
+ CONVERTER_STRING("javax.faces.converter.STRING"),
+ DOUBLE_RANGE_VALIDATOR_MAXIMUM("javax.faces.validator.DoubleRangeValidator.MAXIMUM"),
+ DOUBLE_RANGE_VALIDATOR_MINIMUM("javax.faces.validator.DoubleRangeValidator.MINIMUM"),
+ DOUBLE_RANGE_VALIDATOR_NOT_IN_RANGE("javax.faces.validator.DoubleRangeValidator.NOT_IN_RANGE"),
+ DOUBLE_RANGE_VALIDATOR_TYPE("javax.faces.validator.DoubleRangeValidator.TYPE"),
+ LENGTH_VALIDATOR_MAXIMUM("javax.faces.validator.LengthValidator.MAXIMUM"),
+ LENGTH_VALIDATOR_MINIMUM("javax.faces.validator.LengthValidator.MINIMUM"),
+ LONG_RANGE_VALIDATOR_MAXIMUM("javax.faces.validator.LongRangeValidator.MAXIMUM"),
+ LONG_RANGE_VALIDATOR_MINIMUM("javax.faces.validator.LongRangeValidator.MINIMUM"),
+ LONG_RANGE_VALIDATOR_NOT_IN_RANGE("javax.faces.validator.LongRangeValidator.NOT_IN_RANGE"),
+ LONG_RANGE_VALIDATOR_TYPE("javax.faces.validator.LongRangeValidator.TYPE"),
+ VALIDATOR_NOT_IN_RANGE("javax.faces.validator.NOT_IN_RANGE"),
+ REGEX_VALIDATOR_PATTERN_NOT_SET("javax.faces.validator.RegexValidator.PATTERN_NOT_SET"),
+ REGEX_VALIDATOR_PATTERN_NOT_SET_DETAIL("javax.faces.validator.RegexValidator.PATTERN_NOT_SET_detail"),
+ REGEX_VALIDATOR_NOT_MATCHED("javax.faces.validator.RegexValidator.NOT_MATCHED"),
+ REGEX_VALIDATOR_NOT_MATCHED_DETAIL("javax.faces.validator.RegexValidator.NOT_MATCHED_detail"),
+ REGEX_VALIDATOR_MATCH_EXCEPTION("javax.faces.validator.RegexValidator.MATCH_EXCEPTION"),
+ REGEX_VALIDATOR_MATCH_EXCEPTION_DETAIL("javax.faces.validator.RegexValidator.MATCH_EXCEPTION_detail"),
+ BEAN_VALIDATOR_MESSAGE("javax.faces.validator.BeanValidator.MESSAGE");
+
+ private String key;
+
+ private FacesMessages(String key) {
+ this.key = key;
+ }
+
+ @Override
+ public String toString() {
+ return key;
+ }
+}
Copied: branches/RF-7944/core/commons/src/main/java/org/richfaces/l10n (from rev 19108, trunk/core/commons/src/main/java/org/richfaces/l10n)
Deleted: branches/RF-7944/core/commons/src/main/java/org/richfaces/l10n/BundleLoader.java
===================================================================
--- trunk/core/commons/src/main/java/org/richfaces/l10n/BundleLoader.java 2010-09-03 08:56:24 UTC (rev 19108)
+++ branches/RF-7944/core/commons/src/main/java/org/richfaces/l10n/BundleLoader.java 2010-09-03 12:00:31 UTC (rev 19109)
@@ -1,77 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2010, Red Hat, Inc. and individual contributors
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.richfaces.l10n;
-
-import java.text.MessageFormat;
-import java.util.Locale;
-import java.util.MissingResourceException;
-import java.util.ResourceBundle;
-
-import javax.faces.application.Application;
-import javax.faces.context.FacesContext;
-
-/**
- * @author Nick Belaevski
- *
- */
-public class BundleLoader {
-
- private ClassLoader getClassLoader() {
- return Thread.currentThread().getContextClassLoader();
- }
-
- private MessageBundle asMessageBundle(Enum<?> messageKey) throws IllegalArgumentException {
- MessageBundle bundleAnnotation = messageKey.getClass().getAnnotation(MessageBundle.class);
-
- if (bundleAnnotation == null) {
- throw new IllegalArgumentException(MessageFormat.format(
- "Cannot detect baseName for enumeration {0} in class {1}", messageKey.toString(), messageKey.getClass()
- .getName()));
- }
-
- return bundleAnnotation;
- }
-
- public ResourceBundle getBundle(Enum<?> messageKey, Locale locale) throws MissingResourceException,
- IllegalArgumentException {
- MessageBundle bundleAnnotation = asMessageBundle(messageKey);
-
- return ResourceBundle.getBundle(bundleAnnotation.baseName(), locale, getClassLoader());
- }
-
- public ResourceBundle getApplicationBundle(FacesContext facesContext, Enum<?> messageKey, Locale locale)
- throws MissingResourceException {
-
- if (facesContext == null) {
- throw new MissingResourceException("FacesContext is null", getClass().getName(), messageKey.toString());
- }
-
- Application application = facesContext.getApplication();
-
- if (application == null || application.getMessageBundle() == null) {
- throw new MissingResourceException("Cannot read message bundle name from application",
- getClass().getName(), messageKey.toString());
- }
-
- return ResourceBundle.getBundle(application.getMessageBundle(), locale, getClassLoader());
- }
-}
Copied: branches/RF-7944/core/commons/src/main/java/org/richfaces/l10n/BundleLoader.java (from rev 19108, trunk/core/commons/src/main/java/org/richfaces/l10n/BundleLoader.java)
===================================================================
--- branches/RF-7944/core/commons/src/main/java/org/richfaces/l10n/BundleLoader.java (rev 0)
+++ branches/RF-7944/core/commons/src/main/java/org/richfaces/l10n/BundleLoader.java 2010-09-03 12:00:31 UTC (rev 19109)
@@ -0,0 +1,77 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc. and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.richfaces.l10n;
+
+import java.text.MessageFormat;
+import java.util.Locale;
+import java.util.MissingResourceException;
+import java.util.ResourceBundle;
+
+import javax.faces.application.Application;
+import javax.faces.context.FacesContext;
+
+/**
+ * @author Nick Belaevski
+ *
+ */
+public class BundleLoader {
+
+ private ClassLoader getClassLoader() {
+ return Thread.currentThread().getContextClassLoader();
+ }
+
+ private MessageBundle asMessageBundle(Enum<?> messageKey) throws IllegalArgumentException {
+ MessageBundle bundleAnnotation = messageKey.getClass().getAnnotation(MessageBundle.class);
+
+ if (bundleAnnotation == null) {
+ throw new IllegalArgumentException(MessageFormat.format(
+ "Cannot detect baseName for enumeration {0} in class {1}", messageKey.toString(), messageKey.getClass()
+ .getName()));
+ }
+
+ return bundleAnnotation;
+ }
+
+ public ResourceBundle getBundle(Enum<?> messageKey, Locale locale) throws MissingResourceException,
+ IllegalArgumentException {
+ MessageBundle bundleAnnotation = asMessageBundle(messageKey);
+
+ return ResourceBundle.getBundle(bundleAnnotation.baseName(), locale, getClassLoader());
+ }
+
+ public ResourceBundle getApplicationBundle(FacesContext facesContext, Enum<?> messageKey, Locale locale)
+ throws MissingResourceException {
+
+ if (facesContext == null) {
+ throw new MissingResourceException("FacesContext is null", getClass().getName(), messageKey.toString());
+ }
+
+ Application application = facesContext.getApplication();
+
+ if (application == null || application.getMessageBundle() == null) {
+ throw new MissingResourceException("Cannot read message bundle name from application",
+ getClass().getName(), messageKey.toString());
+ }
+
+ return ResourceBundle.getBundle(application.getMessageBundle(), locale, getClassLoader());
+ }
+}
Deleted: branches/RF-7944/core/commons/src/main/java/org/richfaces/l10n/InterpolationException.java
===================================================================
--- trunk/core/commons/src/main/java/org/richfaces/l10n/InterpolationException.java 2010-09-03 08:56:24 UTC (rev 19108)
+++ branches/RF-7944/core/commons/src/main/java/org/richfaces/l10n/InterpolationException.java 2010-09-03 12:00:31 UTC (rev 19109)
@@ -1,74 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2010, Red Hat, Inc. and individual contributors
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.richfaces.l10n;
-
-/**
- * @author Nick Belaevski
- *
- */
-public class InterpolationException extends Exception {
-
- /**
- *
- */
- private static final long serialVersionUID = 218954633540769880L;
-
- private String messageKey;
-
- /**
- *
- */
- public InterpolationException() {
- super();
- }
-
- /**
- * @param message
- * @param cause
- */
- public InterpolationException(String message, Throwable cause) {
- super(message, cause);
- }
-
- /**
- * @param message
- */
- public InterpolationException(String message) {
- super(message);
- }
-
- /**
- * @param cause
- */
- public InterpolationException(Throwable cause) {
- super(cause);
- }
-
- public InterpolationException initMessageKey(String messageKey) {
- this.messageKey = messageKey;
- return this;
- }
-
- public String getMessageKey() {
- return messageKey;
- }
-}
Copied: branches/RF-7944/core/commons/src/main/java/org/richfaces/l10n/InterpolationException.java (from rev 19108, trunk/core/commons/src/main/java/org/richfaces/l10n/InterpolationException.java)
===================================================================
--- branches/RF-7944/core/commons/src/main/java/org/richfaces/l10n/InterpolationException.java (rev 0)
+++ branches/RF-7944/core/commons/src/main/java/org/richfaces/l10n/InterpolationException.java 2010-09-03 12:00:31 UTC (rev 19109)
@@ -0,0 +1,74 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc. and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.richfaces.l10n;
+
+/**
+ * @author Nick Belaevski
+ *
+ */
+public class InterpolationException extends Exception {
+
+ /**
+ *
+ */
+ private static final long serialVersionUID = 218954633540769880L;
+
+ private String messageKey;
+
+ /**
+ *
+ */
+ public InterpolationException() {
+ super();
+ }
+
+ /**
+ * @param message
+ * @param cause
+ */
+ public InterpolationException(String message, Throwable cause) {
+ super(message, cause);
+ }
+
+ /**
+ * @param message
+ */
+ public InterpolationException(String message) {
+ super(message);
+ }
+
+ /**
+ * @param cause
+ */
+ public InterpolationException(Throwable cause) {
+ super(cause);
+ }
+
+ public InterpolationException initMessageKey(String messageKey) {
+ this.messageKey = messageKey;
+ return this;
+ }
+
+ public String getMessageKey() {
+ return messageKey;
+ }
+}
Deleted: branches/RF-7944/core/commons/src/main/java/org/richfaces/l10n/MessageBundle.java
===================================================================
--- trunk/core/commons/src/main/java/org/richfaces/l10n/MessageBundle.java 2010-09-03 08:56:24 UTC (rev 19108)
+++ branches/RF-7944/core/commons/src/main/java/org/richfaces/l10n/MessageBundle.java 2010-09-03 12:00:31 UTC (rev 19109)
@@ -1,39 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2010, Red Hat, Inc. and individual contributors
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.richfaces.l10n;
-
-import java.lang.annotation.ElementType;
-import java.lang.annotation.Retention;
-import java.lang.annotation.RetentionPolicy;
-import java.lang.annotation.Target;
-
-/**
- * @author Nick Belaevski
- *
- */
-(a)Retention(RetentionPolicy.RUNTIME)
-(a)Target(ElementType.TYPE)
-public @interface MessageBundle {
-
- public String baseName();
-
-}
Copied: branches/RF-7944/core/commons/src/main/java/org/richfaces/l10n/MessageBundle.java (from rev 19108, trunk/core/commons/src/main/java/org/richfaces/l10n/MessageBundle.java)
===================================================================
--- branches/RF-7944/core/commons/src/main/java/org/richfaces/l10n/MessageBundle.java (rev 0)
+++ branches/RF-7944/core/commons/src/main/java/org/richfaces/l10n/MessageBundle.java 2010-09-03 12:00:31 UTC (rev 19109)
@@ -0,0 +1,39 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc. and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.richfaces.l10n;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+/**
+ * @author Nick Belaevski
+ *
+ */
+(a)Retention(RetentionPolicy.RUNTIME)
+(a)Target(ElementType.TYPE)
+public @interface MessageBundle {
+
+ public String baseName();
+
+}
Deleted: branches/RF-7944/core/commons/src/main/java/org/richfaces/l10n/MessageInterpolator.java
===================================================================
--- trunk/core/commons/src/main/java/org/richfaces/l10n/MessageInterpolator.java 2010-09-03 08:56:24 UTC (rev 19108)
+++ branches/RF-7944/core/commons/src/main/java/org/richfaces/l10n/MessageInterpolator.java 2010-09-03 12:00:31 UTC (rev 19109)
@@ -1,76 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2010, Red Hat, Inc. and individual contributors
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.richfaces.l10n;
-
-import java.text.MessageFormat;
-import java.util.Locale;
-import java.util.MissingResourceException;
-import java.util.ResourceBundle;
-
-/**
- * @author Nick Belaevski
- *
- */
-public class MessageInterpolator {
-
- private BundleLoader bundleLoader;
-
- public MessageInterpolator(BundleLoader bundleLoader) {
- super();
- this.bundleLoader = bundleLoader;
- }
-
- protected String getMessageKey(Enum<?> key) {
- return key.toString();
- }
-
- protected String getPattern(Locale locale, Enum<?> key) {
- String messageKey = getMessageKey(key);
-
- try {
- ResourceBundle bundle = bundleLoader.getBundle(key, locale);
- return bundle.getString(messageKey);
- } catch (MissingResourceException e) {
- //do nothing
- }
-
- return null;
- }
-
- public String interpolate(Locale locale, Enum<?> key, Object... args) throws InterpolationException {
- String messagePattern = getPattern(locale, key);
-
- if (messagePattern == null) {
- Locale defaultLocale = Locale.getDefault();
- if (!defaultLocale.equals(locale)) {
- messagePattern = getPattern(defaultLocale, key);
- }
- }
-
- if (messagePattern != null) {
- return MessageFormat.format(messagePattern, args);
- } else {
- throw new InterpolationException().initMessageKey(key.toString());
- }
- }
-
-}
Copied: branches/RF-7944/core/commons/src/main/java/org/richfaces/l10n/MessageInterpolator.java (from rev 19108, trunk/core/commons/src/main/java/org/richfaces/l10n/MessageInterpolator.java)
===================================================================
--- branches/RF-7944/core/commons/src/main/java/org/richfaces/l10n/MessageInterpolator.java (rev 0)
+++ branches/RF-7944/core/commons/src/main/java/org/richfaces/l10n/MessageInterpolator.java 2010-09-03 12:00:31 UTC (rev 19109)
@@ -0,0 +1,76 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc. and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.richfaces.l10n;
+
+import java.text.MessageFormat;
+import java.util.Locale;
+import java.util.MissingResourceException;
+import java.util.ResourceBundle;
+
+/**
+ * @author Nick Belaevski
+ *
+ */
+public class MessageInterpolator {
+
+ private BundleLoader bundleLoader;
+
+ public MessageInterpolator(BundleLoader bundleLoader) {
+ super();
+ this.bundleLoader = bundleLoader;
+ }
+
+ protected String getMessageKey(Enum<?> key) {
+ return key.toString();
+ }
+
+ protected String getPattern(Locale locale, Enum<?> key) {
+ String messageKey = getMessageKey(key);
+
+ try {
+ ResourceBundle bundle = bundleLoader.getBundle(key, locale);
+ return bundle.getString(messageKey);
+ } catch (MissingResourceException e) {
+ //do nothing
+ }
+
+ return null;
+ }
+
+ public String interpolate(Locale locale, Enum<?> key, Object... args) throws InterpolationException {
+ String messagePattern = getPattern(locale, key);
+
+ if (messagePattern == null) {
+ Locale defaultLocale = Locale.getDefault();
+ if (!defaultLocale.equals(locale)) {
+ messagePattern = getPattern(defaultLocale, key);
+ }
+ }
+
+ if (messagePattern != null) {
+ return MessageFormat.format(messagePattern, args);
+ } else {
+ throw new InterpolationException().initMessageKey(key.toString());
+ }
+ }
+
+}
Copied: branches/RF-7944/core/commons/src/main/java/org/richfaces/log (from rev 19108, trunk/core/commons/src/main/java/org/richfaces/log)
Deleted: branches/RF-7944/core/commons/src/main/java/org/richfaces/log/JavaLogger.java
===================================================================
--- trunk/core/commons/src/main/java/org/richfaces/log/JavaLogger.java 2010-09-03 08:56:24 UTC (rev 19108)
+++ branches/RF-7944/core/commons/src/main/java/org/richfaces/log/JavaLogger.java 2010-09-03 12:00:31 UTC (rev 19109)
@@ -1,253 +0,0 @@
-/*
- * $Id: JavaLogger.java 16812 2010-04-26 20:43:19Z alexsmirnov $
- *
- * License Agreement.
- *
- * Rich Faces - Natural Ajax for Java Server Faces (JSF)
- *
- * Copyright (C) 2007 Exadel, Inc.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License version 2.1 as published by the Free Software Foundation.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-package org.richfaces.log;
-
-import java.util.EnumMap;
-import java.util.Locale;
-import java.util.Map;
-import java.util.logging.LogRecord;
-
-import org.richfaces.l10n.BundleLoader;
-import org.richfaces.l10n.InterpolationException;
-import org.richfaces.l10n.MessageInterpolator;
-
-
-
-
-/**
- * <p class="changed_added_4_0">That logger delegates all calls to the JDK {@link java.util.logging.Logger}</p>
- *
- * @author asmirnov(a)exadel.com
- * @author nick
- */
-public class JavaLogger implements Logger {
-
- public static final String RICHFACES_LOG = "org.richfaces";
-
- static final Map<Level, java.util.logging.Level> LEVELS_MAP =
- new EnumMap<Level, java.util.logging.Level>(Level.class);
-
- static {
- LEVELS_MAP.put(Level.ERROR, java.util.logging.Level.SEVERE);
- LEVELS_MAP.put(Level.INFO, java.util.logging.Level.INFO);
- LEVELS_MAP.put(Level.WARNING, java.util.logging.Level.WARNING);
- LEVELS_MAP.put(Level.DEBUG, java.util.logging.Level.FINE);
- }
-
- private static final String CLASS_NAME = JavaLogger.class.getName();
-
- private final java.util.logging.Logger jdkLogger;
-
- private MessageInterpolator messageInterpolator;
-
- JavaLogger(String category) {
- jdkLogger = java.util.logging.Logger.getLogger(category);
- messageInterpolator = new MessageInterpolator(new BundleLoader());
- }
-
- JavaLogger() {
- this(RICHFACES_LOG);
- }
-
- private void fillCallerData(String fqn, LogRecord record) {
- StackTraceElement[] stackTrace = new Exception().getStackTrace();
-
- int i = 0;
-
- for (; i < stackTrace.length; i++) {
- if (fqn.equals(stackTrace[i].getClassName())) {
- break;
- }
- }
-
- int idx = i + 1;
-
- for (; idx < stackTrace.length; idx++) {
- if (!fqn.equals(stackTrace[idx].getClassName())) {
- break;
- }
- }
-
- if (idx < stackTrace.length) {
- record.setSourceMethodName(stackTrace[idx].getMethodName());
- record.setSourceClassName(stackTrace[idx].getClassName());
- }
- }
-
- private String interpolate(Enum<?> messageKey, Object... args) {
- try {
- return messageInterpolator.interpolate(Locale.getDefault(), messageKey, args);
- } catch (InterpolationException e) {
- return "???" + e.getMessageKey() + "???";
- }
- }
-
- private LogRecord createRecord(java.util.logging.Level level, CharSequence message, Throwable thrown) {
- // millis and thread are filled by the constructor
- LogRecord record = new LogRecord(level, message != null ? message.toString() : null);
-
- //TODO resource bundle?
- record.setLoggerName(jdkLogger.getName());
- record.setThrown(thrown);
- fillCallerData(CLASS_NAME, record);
-
- return record;
- }
-
- public boolean isDebugEnabled() {
- return isLogEnabled(Level.DEBUG);
- }
-
- public void debug(CharSequence content) {
- log(Level.DEBUG, content);
- }
-
- public void debug(Enum<?> messageKey, Object... args) {
- log(Level.DEBUG, messageKey, args);
- }
-
- public void debug(CharSequence content, Throwable thrown) {
- log(Level.DEBUG, content, thrown);
- }
-
- public void debug(Throwable error, Enum<?> messageKey, Object... args) {
- log(Level.DEBUG, error, messageKey, args);
- }
-
- public void debug(Throwable thrown) {
- log(Level.DEBUG, thrown);
- }
-
- public boolean isInfoEnabled() {
- return isLogEnabled(Level.INFO);
- }
-
- public void info(CharSequence content) {
- log(Level.INFO, content);
- }
-
- public void info(Enum<?> messageKey, Object... args) {
- log(Level.INFO, messageKey, args);
- }
-
- public void info(CharSequence content, Throwable thrown) {
- log(Level.INFO, content, thrown);
- }
-
- public void info(Throwable error, Enum<?> messageKey, Object... args) {
- log(Level.INFO, error, messageKey, args);
- }
-
- public void info(Throwable thrown) {
- log(Level.INFO, thrown);
- }
-
- public boolean isWarnEnabled() {
- return isLogEnabled(Level.WARNING);
- }
-
- public void warn(CharSequence content) {
- log(Level.WARNING, content);
- }
-
- public void warn(Enum<?> messageKey, Object... args) {
- log(Level.WARNING, messageKey, args);
- }
-
- public void warn(CharSequence content, Throwable thrown) {
- log(Level.WARNING, content, thrown);
- }
-
- public void warn(Throwable error, Enum<?> messageKey, Object... args) {
- log(Level.WARNING, error, messageKey, args);
- }
-
- public void warn(Throwable thrown) {
- log(Level.WARNING, thrown);
- }
-
- public boolean isErrorEnabled() {
- return isLogEnabled(Level.ERROR);
- }
-
- public void error(CharSequence content) {
- log(Level.ERROR, content);
- }
-
- public void error(Enum<?> messageKey, Object... args) {
- log(Level.ERROR, messageKey, args);
- }
-
- public void error(CharSequence content, Throwable thrown) {
- log(Level.ERROR, content, thrown);
- }
-
- public void error(Throwable error, Enum<?> messageKey, Object... args) {
- log(Level.ERROR, error, messageKey, args);
- }
-
- public void error(Throwable thrown) {
- log(Level.ERROR, thrown);
- }
-
- public boolean isLogEnabled(Level level) {
- return jdkLogger.isLoggable(LEVELS_MAP.get(level));
- }
-
- public void log(Level level, CharSequence content) {
- java.util.logging.Level julLevel = LEVELS_MAP.get(level);
- if (jdkLogger.isLoggable(julLevel)) {
- jdkLogger.log(createRecord(julLevel, content, null));
- }
- }
-
- public void log(Level level, Enum<?> messageKey, Object... args) {
- java.util.logging.Level julLevel = LEVELS_MAP.get(level);
- if (jdkLogger.isLoggable(julLevel)) {
- jdkLogger.log(createRecord(julLevel, interpolate(messageKey, args), null));
- }
- }
-
- public void log(Level level, CharSequence content, Throwable thrown) {
- java.util.logging.Level julLevel = LEVELS_MAP.get(level);
- if (jdkLogger.isLoggable(julLevel)) {
- jdkLogger.log(createRecord(julLevel, content, thrown));
- }
- }
-
- public void log(Level level, Throwable thrown, Enum<?> messageKey, Object... args) {
- java.util.logging.Level julLevel = LEVELS_MAP.get(level);
- if (jdkLogger.isLoggable(julLevel)) {
- jdkLogger.log(createRecord(julLevel, interpolate(messageKey, args), thrown));
- }
- }
-
- public void log(Level level, Throwable thrown) {
- java.util.logging.Level julLevel = LEVELS_MAP.get(level);
- if (jdkLogger.isLoggable(julLevel)) {
- jdkLogger.log(createRecord(julLevel, null, thrown));
- }
- }
-
-}
Copied: branches/RF-7944/core/commons/src/main/java/org/richfaces/log/JavaLogger.java (from rev 19108, trunk/core/commons/src/main/java/org/richfaces/log/JavaLogger.java)
===================================================================
--- branches/RF-7944/core/commons/src/main/java/org/richfaces/log/JavaLogger.java (rev 0)
+++ branches/RF-7944/core/commons/src/main/java/org/richfaces/log/JavaLogger.java 2010-09-03 12:00:31 UTC (rev 19109)
@@ -0,0 +1,253 @@
+/*
+ * $Id: JavaLogger.java 16812 2010-04-26 20:43:19Z alexsmirnov $
+ *
+ * License Agreement.
+ *
+ * Rich Faces - Natural Ajax for Java Server Faces (JSF)
+ *
+ * Copyright (C) 2007 Exadel, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1 as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+package org.richfaces.log;
+
+import java.util.EnumMap;
+import java.util.Locale;
+import java.util.Map;
+import java.util.logging.LogRecord;
+
+import org.richfaces.l10n.BundleLoader;
+import org.richfaces.l10n.InterpolationException;
+import org.richfaces.l10n.MessageInterpolator;
+
+
+
+
+/**
+ * <p class="changed_added_4_0">That logger delegates all calls to the JDK {@link java.util.logging.Logger}</p>
+ *
+ * @author asmirnov(a)exadel.com
+ * @author nick
+ */
+public class JavaLogger implements Logger {
+
+ public static final String RICHFACES_LOG = "org.richfaces";
+
+ static final Map<Level, java.util.logging.Level> LEVELS_MAP =
+ new EnumMap<Level, java.util.logging.Level>(Level.class);
+
+ static {
+ LEVELS_MAP.put(Level.ERROR, java.util.logging.Level.SEVERE);
+ LEVELS_MAP.put(Level.INFO, java.util.logging.Level.INFO);
+ LEVELS_MAP.put(Level.WARNING, java.util.logging.Level.WARNING);
+ LEVELS_MAP.put(Level.DEBUG, java.util.logging.Level.FINE);
+ }
+
+ private static final String CLASS_NAME = JavaLogger.class.getName();
+
+ private final java.util.logging.Logger jdkLogger;
+
+ private MessageInterpolator messageInterpolator;
+
+ JavaLogger(String category) {
+ jdkLogger = java.util.logging.Logger.getLogger(category);
+ messageInterpolator = new MessageInterpolator(new BundleLoader());
+ }
+
+ JavaLogger() {
+ this(RICHFACES_LOG);
+ }
+
+ private void fillCallerData(String fqn, LogRecord record) {
+ StackTraceElement[] stackTrace = new Exception().getStackTrace();
+
+ int i = 0;
+
+ for (; i < stackTrace.length; i++) {
+ if (fqn.equals(stackTrace[i].getClassName())) {
+ break;
+ }
+ }
+
+ int idx = i + 1;
+
+ for (; idx < stackTrace.length; idx++) {
+ if (!fqn.equals(stackTrace[idx].getClassName())) {
+ break;
+ }
+ }
+
+ if (idx < stackTrace.length) {
+ record.setSourceMethodName(stackTrace[idx].getMethodName());
+ record.setSourceClassName(stackTrace[idx].getClassName());
+ }
+ }
+
+ private String interpolate(Enum<?> messageKey, Object... args) {
+ try {
+ return messageInterpolator.interpolate(Locale.getDefault(), messageKey, args);
+ } catch (InterpolationException e) {
+ return "???" + e.getMessageKey() + "???";
+ }
+ }
+
+ private LogRecord createRecord(java.util.logging.Level level, CharSequence message, Throwable thrown) {
+ // millis and thread are filled by the constructor
+ LogRecord record = new LogRecord(level, message != null ? message.toString() : null);
+
+ //TODO resource bundle?
+ record.setLoggerName(jdkLogger.getName());
+ record.setThrown(thrown);
+ fillCallerData(CLASS_NAME, record);
+
+ return record;
+ }
+
+ public boolean isDebugEnabled() {
+ return isLogEnabled(Level.DEBUG);
+ }
+
+ public void debug(CharSequence content) {
+ log(Level.DEBUG, content);
+ }
+
+ public void debug(Enum<?> messageKey, Object... args) {
+ log(Level.DEBUG, messageKey, args);
+ }
+
+ public void debug(CharSequence content, Throwable thrown) {
+ log(Level.DEBUG, content, thrown);
+ }
+
+ public void debug(Throwable error, Enum<?> messageKey, Object... args) {
+ log(Level.DEBUG, error, messageKey, args);
+ }
+
+ public void debug(Throwable thrown) {
+ log(Level.DEBUG, thrown);
+ }
+
+ public boolean isInfoEnabled() {
+ return isLogEnabled(Level.INFO);
+ }
+
+ public void info(CharSequence content) {
+ log(Level.INFO, content);
+ }
+
+ public void info(Enum<?> messageKey, Object... args) {
+ log(Level.INFO, messageKey, args);
+ }
+
+ public void info(CharSequence content, Throwable thrown) {
+ log(Level.INFO, content, thrown);
+ }
+
+ public void info(Throwable error, Enum<?> messageKey, Object... args) {
+ log(Level.INFO, error, messageKey, args);
+ }
+
+ public void info(Throwable thrown) {
+ log(Level.INFO, thrown);
+ }
+
+ public boolean isWarnEnabled() {
+ return isLogEnabled(Level.WARNING);
+ }
+
+ public void warn(CharSequence content) {
+ log(Level.WARNING, content);
+ }
+
+ public void warn(Enum<?> messageKey, Object... args) {
+ log(Level.WARNING, messageKey, args);
+ }
+
+ public void warn(CharSequence content, Throwable thrown) {
+ log(Level.WARNING, content, thrown);
+ }
+
+ public void warn(Throwable error, Enum<?> messageKey, Object... args) {
+ log(Level.WARNING, error, messageKey, args);
+ }
+
+ public void warn(Throwable thrown) {
+ log(Level.WARNING, thrown);
+ }
+
+ public boolean isErrorEnabled() {
+ return isLogEnabled(Level.ERROR);
+ }
+
+ public void error(CharSequence content) {
+ log(Level.ERROR, content);
+ }
+
+ public void error(Enum<?> messageKey, Object... args) {
+ log(Level.ERROR, messageKey, args);
+ }
+
+ public void error(CharSequence content, Throwable thrown) {
+ log(Level.ERROR, content, thrown);
+ }
+
+ public void error(Throwable error, Enum<?> messageKey, Object... args) {
+ log(Level.ERROR, error, messageKey, args);
+ }
+
+ public void error(Throwable thrown) {
+ log(Level.ERROR, thrown);
+ }
+
+ public boolean isLogEnabled(Level level) {
+ return jdkLogger.isLoggable(LEVELS_MAP.get(level));
+ }
+
+ public void log(Level level, CharSequence content) {
+ java.util.logging.Level julLevel = LEVELS_MAP.get(level);
+ if (jdkLogger.isLoggable(julLevel)) {
+ jdkLogger.log(createRecord(julLevel, content, null));
+ }
+ }
+
+ public void log(Level level, Enum<?> messageKey, Object... args) {
+ java.util.logging.Level julLevel = LEVELS_MAP.get(level);
+ if (jdkLogger.isLoggable(julLevel)) {
+ jdkLogger.log(createRecord(julLevel, interpolate(messageKey, args), null));
+ }
+ }
+
+ public void log(Level level, CharSequence content, Throwable thrown) {
+ java.util.logging.Level julLevel = LEVELS_MAP.get(level);
+ if (jdkLogger.isLoggable(julLevel)) {
+ jdkLogger.log(createRecord(julLevel, content, thrown));
+ }
+ }
+
+ public void log(Level level, Throwable thrown, Enum<?> messageKey, Object... args) {
+ java.util.logging.Level julLevel = LEVELS_MAP.get(level);
+ if (jdkLogger.isLoggable(julLevel)) {
+ jdkLogger.log(createRecord(julLevel, interpolate(messageKey, args), thrown));
+ }
+ }
+
+ public void log(Level level, Throwable thrown) {
+ java.util.logging.Level julLevel = LEVELS_MAP.get(level);
+ if (jdkLogger.isLoggable(julLevel)) {
+ jdkLogger.log(createRecord(julLevel, null, thrown));
+ }
+ }
+
+}
Deleted: branches/RF-7944/core/commons/src/main/java/org/richfaces/log/LogFactory.java
===================================================================
--- trunk/core/commons/src/main/java/org/richfaces/log/LogFactory.java 2010-09-03 08:56:24 UTC (rev 19108)
+++ branches/RF-7944/core/commons/src/main/java/org/richfaces/log/LogFactory.java 2010-09-03 12:00:31 UTC (rev 19109)
@@ -1,62 +0,0 @@
-/*
- * $Id$
- *
- * License Agreement.
- *
- * Rich Faces - Natural Ajax for Java Server Faces (JSF)
- *
- * Copyright (C) 2007 Exadel, Inc.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License version 2.1 as published by the Free Software Foundation.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-package org.richfaces.log;
-
-
-/**
- * <p class="changed_added_4_0">This class produces loggers used by whole RichFaces library.</p>
- * @author asmirnov(a)exadel.com
- *
- */
-public final class LogFactory {
-
- private static final Logger DEFAULT_LOGGER = new JavaLogger();
-
- private LogFactory(){
- // This class is not instantiable.
- }
-
-
- /**
- * <p class="changed_added_4_0">This method creates default logger.</p>
- * @return
- */
- public static Logger getLogger(){
- return DEFAULT_LOGGER;
- }
-
- /**
- * <p class="changed_added_4_0">This method produces logger instance for given category.</p>
- * @param category
- * @return
- */
- public static Logger getLogger(String category){
- return new JavaLogger(category);
- }
-
- public static Logger getLogger(Class<?> clazz){
- return getLogger(clazz.getName());
- }
-
-}
Copied: branches/RF-7944/core/commons/src/main/java/org/richfaces/log/LogFactory.java (from rev 19108, trunk/core/commons/src/main/java/org/richfaces/log/LogFactory.java)
===================================================================
--- branches/RF-7944/core/commons/src/main/java/org/richfaces/log/LogFactory.java (rev 0)
+++ branches/RF-7944/core/commons/src/main/java/org/richfaces/log/LogFactory.java 2010-09-03 12:00:31 UTC (rev 19109)
@@ -0,0 +1,62 @@
+/*
+ * $Id$
+ *
+ * License Agreement.
+ *
+ * Rich Faces - Natural Ajax for Java Server Faces (JSF)
+ *
+ * Copyright (C) 2007 Exadel, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1 as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+package org.richfaces.log;
+
+
+/**
+ * <p class="changed_added_4_0">This class produces loggers used by whole RichFaces library.</p>
+ * @author asmirnov(a)exadel.com
+ *
+ */
+public final class LogFactory {
+
+ private static final Logger DEFAULT_LOGGER = new JavaLogger();
+
+ private LogFactory(){
+ // This class is not instantiable.
+ }
+
+
+ /**
+ * <p class="changed_added_4_0">This method creates default logger.</p>
+ * @return
+ */
+ public static Logger getLogger(){
+ return DEFAULT_LOGGER;
+ }
+
+ /**
+ * <p class="changed_added_4_0">This method produces logger instance for given category.</p>
+ * @param category
+ * @return
+ */
+ public static Logger getLogger(String category){
+ return new JavaLogger(category);
+ }
+
+ public static Logger getLogger(Class<?> clazz){
+ return getLogger(clazz.getName());
+ }
+
+}
Deleted: branches/RF-7944/core/commons/src/main/java/org/richfaces/log/Logger.java
===================================================================
--- trunk/core/commons/src/main/java/org/richfaces/log/Logger.java 2010-09-03 08:56:24 UTC (rev 19108)
+++ branches/RF-7944/core/commons/src/main/java/org/richfaces/log/Logger.java 2010-09-03 12:00:31 UTC (rev 19109)
@@ -1,311 +0,0 @@
-/**
- * License Agreement.
- *
- * Rich Faces - Natural Ajax for Java Server Faces (JSF)
- *
- * Copyright (C) 2007 Exadel, Inc.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License version 2.1 as published by the Free Software Foundation.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-package org.richfaces.log;
-
-/**
- * That interface hides current logging system from classes. Concrete implementation should provide appropriate logger
- * instance that delegates messages to the current log system.
- *
- * @author shura
- */
-public interface Logger {
-
- public enum Level {
- DEBUG,
- INFO,
- WARNING,
- ERROR
- }
-
- /**
- * <p class="changed_added_4_0">
- * </p>
- *
- * @return
- */
- public boolean isDebugEnabled();
-
- /**
- * <p class="changed_added_4_0">
- * </p>
- *
- * @param content
- */
- public void debug(CharSequence content);
-
- /**
- * <p class="changed_added_4_0">
- * </p>
- *
- * @param messageKey
- * @param args
- */
- public void debug(Enum<?> messageKey, Object... args);
-
- /**
- * <p class="changed_added_4_0">
- * </p>
- *
- * @param content
- * @param error
- */
- public void debug(CharSequence content, Throwable error);
-
- /**
- * <p class="changed_added_4_0">
- * </p>
- *
- * @param error
- * @param messageKey
- * @param args
- */
- public void debug(Throwable error, Enum<?> messageKey, Object... args);
-
- /**
- * <p class="changed_added_4_0">
- * </p>
- *
- * @param error
- */
- /**
- * <p class="changed_added_4_0">
- * </p>
- *
- * @param error
- */
- public void debug(Throwable error);
-
- /**
- * <p class="changed_added_4_0">
- * </p>
- *
- * @return
- */
- public boolean isInfoEnabled();
-
- /**
- * <p class="changed_added_4_0">
- * </p>
- *
- * @param content
- */
- public void info(CharSequence content);
-
- /**
- * <p class="changed_added_4_0">
- * </p>
- *
- * @param messageKey
- * @param args
- */
- public void info(Enum<?> messageKey, Object... args);
-
- /**
- * <p class="changed_added_4_0">
- * </p>
- *
- * @param content
- * @param error
- */
- public void info(CharSequence content, Throwable error);
-
- /**
- * <p class="changed_added_4_0">
- * </p>
- *
- * @param error
- * @param messageKey
- * @param args
- */
- public void info(Throwable error, Enum<?> messageKey, Object... args);
-
- /**
- * <p class="changed_added_4_0">
- * </p>
- *
- * @param error
- */
- public void info(Throwable error);
-
- /**
- * <p class="changed_added_4_0">
- * </p>
- *
- * @return
- */
- public boolean isWarnEnabled();
-
- /**
- * <p class="changed_added_4_0">
- * </p>
- *
- * @param content
- */
- public void warn(CharSequence content);
-
- /**
- * <p class="changed_added_4_0">
- * </p>
- *
- * @param messageKey
- * @param args
- */
- public void warn(Enum<?> messageKey, Object... args);
-
- /**
- * <p class="changed_added_4_0">
- * </p>
- *
- * @param content
- * @param error
- */
- public void warn(CharSequence content, Throwable error);
-
- /**
- * <p class="changed_added_4_0">
- * </p>
- *
- * @param error
- * @param messageKey
- * @param args
- */
- public void warn(Throwable error, Enum<?> messageKey, Object... args);
-
- /**
- * <p class="changed_added_4_0">
- * </p>
- *
- * @param error
- */
- public void warn(Throwable error);
-
- /**
- * <p class="changed_added_4_0">
- * </p>
- *
- * @return
- */
- public boolean isErrorEnabled();
-
- /**
- * <p class="changed_added_4_0">
- * </p>
- *
- * @param content
- */
- public void error(CharSequence content);
-
- /**
- * <p class="changed_added_4_0">
- * </p>
- *
- * @param messageKey
- * @param args
- */
- public void error(Enum<?> messageKey, Object... args);
-
- /**
- * <p class="changed_added_4_0">
- * </p>
- *
- * @param content
- * @param error
- */
- public void error(CharSequence content, Throwable error);
-
- /**
- * <p class="changed_added_4_0">
- * </p>
- *
- * @param error
- * @param messageKey
- * @param args
- */
- public void error(Throwable error, Enum<?> messageKey, Object... args);
-
- /**
- * <p class="changed_added_4_0">
- * </p>
- *
- * @param error
- */
- public void error(Throwable error);
-
- /**
- * <p class="changed_added_4_0">
- * </p>
- *
- * @param level
- * @return
- */
- public boolean isLogEnabled(Level level);
-
- /**
- * <p class="changed_added_4_0">
- * </p>
- *
- * @param level
- * @param content
- */
- public void log(Level level, CharSequence content);
-
- /**
- * <p class="changed_added_4_0">
- * </p>
- *
- * @param level
- * @param content
- * @param error
- */
- public void log(Level level, CharSequence content, Throwable error);
-
- /**
- * <p class="changed_added_4_0">
- * </p>
- *
- * @param level
- * @param error
- */
- public void log(Level level, Throwable error);
-
- /**
- * <p class="changed_added_4_0">
- * </p>
- *
- * @param level
- * @param messageKey
- * @param args
- */
- public void log(Level level, Enum<?> messageKey, Object... args);
-
- /**
- * <p class="changed_added_4_0">
- * </p>
- *
- * @param level
- * @param error
- * @param messageKey
- * @param args
- */
- public void log(Level level, Throwable error, Enum<?> messageKey, Object... args);
-
-}
Copied: branches/RF-7944/core/commons/src/main/java/org/richfaces/log/Logger.java (from rev 19108, trunk/core/commons/src/main/java/org/richfaces/log/Logger.java)
===================================================================
--- branches/RF-7944/core/commons/src/main/java/org/richfaces/log/Logger.java (rev 0)
+++ branches/RF-7944/core/commons/src/main/java/org/richfaces/log/Logger.java 2010-09-03 12:00:31 UTC (rev 19109)
@@ -0,0 +1,311 @@
+/**
+ * License Agreement.
+ *
+ * Rich Faces - Natural Ajax for Java Server Faces (JSF)
+ *
+ * Copyright (C) 2007 Exadel, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1 as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+package org.richfaces.log;
+
+/**
+ * That interface hides current logging system from classes. Concrete implementation should provide appropriate logger
+ * instance that delegates messages to the current log system.
+ *
+ * @author shura
+ */
+public interface Logger {
+
+ public enum Level {
+ DEBUG,
+ INFO,
+ WARNING,
+ ERROR
+ }
+
+ /**
+ * <p class="changed_added_4_0">
+ * </p>
+ *
+ * @return
+ */
+ public boolean isDebugEnabled();
+
+ /**
+ * <p class="changed_added_4_0">
+ * </p>
+ *
+ * @param content
+ */
+ public void debug(CharSequence content);
+
+ /**
+ * <p class="changed_added_4_0">
+ * </p>
+ *
+ * @param messageKey
+ * @param args
+ */
+ public void debug(Enum<?> messageKey, Object... args);
+
+ /**
+ * <p class="changed_added_4_0">
+ * </p>
+ *
+ * @param content
+ * @param error
+ */
+ public void debug(CharSequence content, Throwable error);
+
+ /**
+ * <p class="changed_added_4_0">
+ * </p>
+ *
+ * @param error
+ * @param messageKey
+ * @param args
+ */
+ public void debug(Throwable error, Enum<?> messageKey, Object... args);
+
+ /**
+ * <p class="changed_added_4_0">
+ * </p>
+ *
+ * @param error
+ */
+ /**
+ * <p class="changed_added_4_0">
+ * </p>
+ *
+ * @param error
+ */
+ public void debug(Throwable error);
+
+ /**
+ * <p class="changed_added_4_0">
+ * </p>
+ *
+ * @return
+ */
+ public boolean isInfoEnabled();
+
+ /**
+ * <p class="changed_added_4_0">
+ * </p>
+ *
+ * @param content
+ */
+ public void info(CharSequence content);
+
+ /**
+ * <p class="changed_added_4_0">
+ * </p>
+ *
+ * @param messageKey
+ * @param args
+ */
+ public void info(Enum<?> messageKey, Object... args);
+
+ /**
+ * <p class="changed_added_4_0">
+ * </p>
+ *
+ * @param content
+ * @param error
+ */
+ public void info(CharSequence content, Throwable error);
+
+ /**
+ * <p class="changed_added_4_0">
+ * </p>
+ *
+ * @param error
+ * @param messageKey
+ * @param args
+ */
+ public void info(Throwable error, Enum<?> messageKey, Object... args);
+
+ /**
+ * <p class="changed_added_4_0">
+ * </p>
+ *
+ * @param error
+ */
+ public void info(Throwable error);
+
+ /**
+ * <p class="changed_added_4_0">
+ * </p>
+ *
+ * @return
+ */
+ public boolean isWarnEnabled();
+
+ /**
+ * <p class="changed_added_4_0">
+ * </p>
+ *
+ * @param content
+ */
+ public void warn(CharSequence content);
+
+ /**
+ * <p class="changed_added_4_0">
+ * </p>
+ *
+ * @param messageKey
+ * @param args
+ */
+ public void warn(Enum<?> messageKey, Object... args);
+
+ /**
+ * <p class="changed_added_4_0">
+ * </p>
+ *
+ * @param content
+ * @param error
+ */
+ public void warn(CharSequence content, Throwable error);
+
+ /**
+ * <p class="changed_added_4_0">
+ * </p>
+ *
+ * @param error
+ * @param messageKey
+ * @param args
+ */
+ public void warn(Throwable error, Enum<?> messageKey, Object... args);
+
+ /**
+ * <p class="changed_added_4_0">
+ * </p>
+ *
+ * @param error
+ */
+ public void warn(Throwable error);
+
+ /**
+ * <p class="changed_added_4_0">
+ * </p>
+ *
+ * @return
+ */
+ public boolean isErrorEnabled();
+
+ /**
+ * <p class="changed_added_4_0">
+ * </p>
+ *
+ * @param content
+ */
+ public void error(CharSequence content);
+
+ /**
+ * <p class="changed_added_4_0">
+ * </p>
+ *
+ * @param messageKey
+ * @param args
+ */
+ public void error(Enum<?> messageKey, Object... args);
+
+ /**
+ * <p class="changed_added_4_0">
+ * </p>
+ *
+ * @param content
+ * @param error
+ */
+ public void error(CharSequence content, Throwable error);
+
+ /**
+ * <p class="changed_added_4_0">
+ * </p>
+ *
+ * @param error
+ * @param messageKey
+ * @param args
+ */
+ public void error(Throwable error, Enum<?> messageKey, Object... args);
+
+ /**
+ * <p class="changed_added_4_0">
+ * </p>
+ *
+ * @param error
+ */
+ public void error(Throwable error);
+
+ /**
+ * <p class="changed_added_4_0">
+ * </p>
+ *
+ * @param level
+ * @return
+ */
+ public boolean isLogEnabled(Level level);
+
+ /**
+ * <p class="changed_added_4_0">
+ * </p>
+ *
+ * @param level
+ * @param content
+ */
+ public void log(Level level, CharSequence content);
+
+ /**
+ * <p class="changed_added_4_0">
+ * </p>
+ *
+ * @param level
+ * @param content
+ * @param error
+ */
+ public void log(Level level, CharSequence content, Throwable error);
+
+ /**
+ * <p class="changed_added_4_0">
+ * </p>
+ *
+ * @param level
+ * @param error
+ */
+ public void log(Level level, Throwable error);
+
+ /**
+ * <p class="changed_added_4_0">
+ * </p>
+ *
+ * @param level
+ * @param messageKey
+ * @param args
+ */
+ public void log(Level level, Enum<?> messageKey, Object... args);
+
+ /**
+ * <p class="changed_added_4_0">
+ * </p>
+ *
+ * @param level
+ * @param error
+ * @param messageKey
+ * @param args
+ */
+ public void log(Level level, Throwable error, Enum<?> messageKey, Object... args);
+
+}
Copied: branches/RF-7944/core/commons/src/test/java/org/richfaces/l10n (from rev 19108, trunk/core/commons/src/test/java/org/richfaces/l10n)
Deleted: branches/RF-7944/core/commons/src/test/java/org/richfaces/l10n/BundleLoaderCoreMessages.java
===================================================================
--- trunk/core/commons/src/test/java/org/richfaces/l10n/BundleLoaderCoreMessages.java 2010-09-03 08:56:24 UTC (rev 19108)
+++ branches/RF-7944/core/commons/src/test/java/org/richfaces/l10n/BundleLoaderCoreMessages.java 2010-09-03 12:00:31 UTC (rev 19109)
@@ -1,33 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2010, Red Hat, Inc. and individual contributors
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.richfaces.l10n;
-
-/**
- * @author Nick Belaevski
- *
- */
-@MessageBundle(baseName = "org.richfaces.l10n.BundleLoaderMessages")
-public enum BundleLoaderCoreMessages {
-
- message
-
-}
Copied: branches/RF-7944/core/commons/src/test/java/org/richfaces/l10n/BundleLoaderCoreMessages.java (from rev 19108, trunk/core/commons/src/test/java/org/richfaces/l10n/BundleLoaderCoreMessages.java)
===================================================================
--- branches/RF-7944/core/commons/src/test/java/org/richfaces/l10n/BundleLoaderCoreMessages.java (rev 0)
+++ branches/RF-7944/core/commons/src/test/java/org/richfaces/l10n/BundleLoaderCoreMessages.java 2010-09-03 12:00:31 UTC (rev 19109)
@@ -0,0 +1,33 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc. and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.richfaces.l10n;
+
+/**
+ * @author Nick Belaevski
+ *
+ */
+@MessageBundle(baseName = "org.richfaces.l10n.BundleLoaderMessages")
+public enum BundleLoaderCoreMessages {
+
+ message
+
+}
Deleted: branches/RF-7944/core/commons/src/test/java/org/richfaces/l10n/BundleLoaderTest.java
===================================================================
--- trunk/core/commons/src/test/java/org/richfaces/l10n/BundleLoaderTest.java 2010-09-03 08:56:24 UTC (rev 19108)
+++ branches/RF-7944/core/commons/src/test/java/org/richfaces/l10n/BundleLoaderTest.java 2010-09-03 12:00:31 UTC (rev 19109)
@@ -1,105 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2010, Red Hat, Inc. and individual contributors
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.richfaces.l10n;
-
-import static org.easymock.EasyMock.expect;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.fail;
-
-import java.util.Locale;
-import java.util.MissingResourceException;
-
-import org.jboss.test.faces.mock.MockFacesEnvironment;
-import org.junit.After;
-import org.junit.Before;
-import org.junit.Test;
-
-/**
- * @author Nick Belaevski
- *
- */
-public class BundleLoaderTest {
-
- private MockFacesEnvironment facesEnvironment;
-
- private BundleLoader bundleLoader;
-
- @Before
- public void setUp() throws Exception {
- Locale.setDefault(Locale.ENGLISH);
-
- bundleLoader = new BundleLoader();
-
- facesEnvironment = MockFacesEnvironment.createEnvironment().withApplication();
- }
-
- @After
- public void tearDown() throws Exception {
- bundleLoader = null;
-
- facesEnvironment.verify();
- facesEnvironment.release();
-
- facesEnvironment = null;
- }
-
- @Test
- public void testGetMessageBundle() throws Exception {
- facesEnvironment.replay();
-
- assertEquals("Hello", bundleLoader.getBundle(BundleLoaderCoreMessages.message, Locale.US).getString("message"));
- assertEquals("Zdravstvujte", bundleLoader.getBundle(BundleLoaderCoreMessages.message, new Locale("ru", "RU"))
- .getString("message"));
-
- try {
- bundleLoader.getBundle(BundleLoaderCoreMessages.message, new Locale("by", "BY"));
- fail();
- } catch (MissingResourceException e) {
- // ok
- }
-
- }
-
- @Test
- public void testGetApplicationBundle() throws Exception {
- expect(facesEnvironment.getApplication().getMessageBundle()).andStubReturn("org.richfaces.l10n.AppMessages");
-
- facesEnvironment.replay();
-
- assertEquals(
- "Welcome to app",
- bundleLoader.getApplicationBundle(facesEnvironment.getFacesContext(), BundleLoaderCoreMessages.message,
- Locale.US).getString("message"));
- assertEquals(
- "Dobro pozhalovat'",
- bundleLoader.getApplicationBundle(facesEnvironment.getFacesContext(), BundleLoaderCoreMessages.message,
- new Locale("by", "BY")).getString("message"));
-
- try {
- bundleLoader.getApplicationBundle(facesEnvironment.getFacesContext(), BundleLoaderCoreMessages.message,
- new Locale("ru", "RU"));
- fail();
- } catch (MissingResourceException e) {
- // ok
- }
- }
-}
Copied: branches/RF-7944/core/commons/src/test/java/org/richfaces/l10n/BundleLoaderTest.java (from rev 19108, trunk/core/commons/src/test/java/org/richfaces/l10n/BundleLoaderTest.java)
===================================================================
--- branches/RF-7944/core/commons/src/test/java/org/richfaces/l10n/BundleLoaderTest.java (rev 0)
+++ branches/RF-7944/core/commons/src/test/java/org/richfaces/l10n/BundleLoaderTest.java 2010-09-03 12:00:31 UTC (rev 19109)
@@ -0,0 +1,105 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc. and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.richfaces.l10n;
+
+import static org.easymock.EasyMock.expect;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.fail;
+
+import java.util.Locale;
+import java.util.MissingResourceException;
+
+import org.jboss.test.faces.mock.MockFacesEnvironment;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+
+/**
+ * @author Nick Belaevski
+ *
+ */
+public class BundleLoaderTest {
+
+ private MockFacesEnvironment facesEnvironment;
+
+ private BundleLoader bundleLoader;
+
+ @Before
+ public void setUp() throws Exception {
+ Locale.setDefault(Locale.ENGLISH);
+
+ bundleLoader = new BundleLoader();
+
+ facesEnvironment = MockFacesEnvironment.createEnvironment().withApplication();
+ }
+
+ @After
+ public void tearDown() throws Exception {
+ bundleLoader = null;
+
+ facesEnvironment.verify();
+ facesEnvironment.release();
+
+ facesEnvironment = null;
+ }
+
+ @Test
+ public void testGetMessageBundle() throws Exception {
+ facesEnvironment.replay();
+
+ assertEquals("Hello", bundleLoader.getBundle(BundleLoaderCoreMessages.message, Locale.US).getString("message"));
+ assertEquals("Zdravstvujte", bundleLoader.getBundle(BundleLoaderCoreMessages.message, new Locale("ru", "RU"))
+ .getString("message"));
+
+ try {
+ bundleLoader.getBundle(BundleLoaderCoreMessages.message, new Locale("by", "BY"));
+ fail();
+ } catch (MissingResourceException e) {
+ // ok
+ }
+
+ }
+
+ @Test
+ public void testGetApplicationBundle() throws Exception {
+ expect(facesEnvironment.getApplication().getMessageBundle()).andStubReturn("org.richfaces.l10n.AppMessages");
+
+ facesEnvironment.replay();
+
+ assertEquals(
+ "Welcome to app",
+ bundleLoader.getApplicationBundle(facesEnvironment.getFacesContext(), BundleLoaderCoreMessages.message,
+ Locale.US).getString("message"));
+ assertEquals(
+ "Dobro pozhalovat'",
+ bundleLoader.getApplicationBundle(facesEnvironment.getFacesContext(), BundleLoaderCoreMessages.message,
+ new Locale("by", "BY")).getString("message"));
+
+ try {
+ bundleLoader.getApplicationBundle(facesEnvironment.getFacesContext(), BundleLoaderCoreMessages.message,
+ new Locale("ru", "RU"));
+ fail();
+ } catch (MissingResourceException e) {
+ // ok
+ }
+ }
+}
Copied: branches/RF-7944/core/commons/src/test/java/org/richfaces/log (from rev 19108, trunk/core/commons/src/test/java/org/richfaces/log)
Deleted: branches/RF-7944/core/commons/src/test/java/org/richfaces/log/JavaLoggerTest.java
===================================================================
--- trunk/core/commons/src/test/java/org/richfaces/log/JavaLoggerTest.java 2010-09-03 08:56:24 UTC (rev 19108)
+++ branches/RF-7944/core/commons/src/test/java/org/richfaces/log/JavaLoggerTest.java 2010-09-03 12:00:31 UTC (rev 19109)
@@ -1,194 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2010, Red Hat, Inc. and individual contributors
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.richfaces.log;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertNull;
-import static org.junit.Assert.assertTrue;
-
-import java.text.MessageFormat;
-import java.util.ArrayList;
-import java.util.Iterator;
-import java.util.List;
-import java.util.logging.Handler;
-import java.util.logging.LogManager;
-import java.util.logging.LogRecord;
-
-import org.junit.After;
-import org.junit.Before;
-import org.junit.Test;
-import org.richfaces.log.Logger.Level;
-
-
-/**
- * @author Nick Belaevski
- *
- */
-public class JavaLoggerTest {
-
- private static final String ANOTHER_DUMMY_MESSAGE = "another message";
-
- private static final String DUMMY_MESSAGE = "message";
-
- private static final String TEST_MESSAGE_PATTERN = "RF-000000 Test message with arguments: {0} and {1}";
-
- private static final String CHAR_SEQUENCE_THROWABLE_PATTERN = "(CharSequence, Throwable)({0})";
-
- private static final String CHAR_SEQUENCE_PATTERN = "(CharSequence)({0})";
-
- /**
- * @author Nick Belaevski
- *
- */
- private final class TrackingHandler extends Handler {
- @Override
- public void publish(LogRecord record) {
- publishedRecords.add(record);
- }
-
- @Override
- public void flush() {
- }
-
- @Override
- public void close() throws SecurityException {
- }
- }
-
- private java.util.logging.Logger wrappedLogger;
-
- private JavaLogger logger;
-
- private List<LogRecord> publishedRecords;
-
- @Before
- public void setUp() throws Exception {
- LogManager.getLogManager().reset();
- publishedRecords = new ArrayList<LogRecord>();
-
- wrappedLogger = java.util.logging.Logger.getLogger("org.richfaces.JavaLoggerTest");
- wrappedLogger.addHandler(new TrackingHandler());
-
- logger = new JavaLogger(wrappedLogger.getName());
- }
-
- @After
- public void tearDown() throws Exception {
- publishedRecords = null;
-
- wrappedLogger = null;
- logger = null;
- }
-
- private void verifyLogRecord(LogRecord logRecord, Level level, String message, Class<? extends Throwable> thrownClass, String thrownMessage) {
- assertEquals(JavaLogger.LEVELS_MAP.get(level), logRecord.getLevel());
- assertEquals(message, logRecord.getMessage());
-
- if (thrownClass != null && thrownMessage != null) {
- assertTrue(thrownClass.isInstance(logRecord.getThrown()));
- assertEquals(thrownMessage, logRecord.getThrown().getMessage());
- } else {
- assertNull(logRecord.getThrown());
- }
- }
-
- private void verifyEnabledMethods(Level loggerLevel) throws Exception {
- String[] levels = {"Debug", "Info", "Warn", "Error"};
-
- for (Level level : Level.values()) {
- boolean enabledValue = (Boolean) Logger.class.getMethod(MessageFormat.format("is{0}Enabled", levels[level.ordinal()])).
- invoke(logger);
-
- if (level.compareTo(loggerLevel) < 0) {
- assertFalse(loggerLevel.toString(), enabledValue);
- } else {
- assertTrue(loggerLevel.toString(), enabledValue);
- }
- }
- }
-
- private void verifyLoggingLevels(Level loggerLevel) {
- for (Level messageLevel : Level.values()) {
- logger.log(messageLevel, "test");
-
- if (messageLevel.compareTo(loggerLevel) < 0) {
- assertTrue(publishedRecords.isEmpty());
- } else {
- assertTrue(publishedRecords.size() == 1);
- publishedRecords.clear();
- }
- }
- }
-
- @Test
- public void testLogging() throws Exception {
- wrappedLogger.setLevel(java.util.logging.Level.ALL);
-
- String[] levels = {"debug", "info", "warn", "error"};
-
- for (String levelName : levels) {
- Logger.class.getMethod(levelName, CharSequence.class).invoke(logger, MessageFormat.format(CHAR_SEQUENCE_PATTERN, levelName));
- Logger.class.getMethod(levelName, CharSequence.class, Throwable.class).invoke(logger,
- MessageFormat.format(CHAR_SEQUENCE_THROWABLE_PATTERN, levelName), new NullPointerException(levelName));
-
- Logger.class.getMethod(levelName, Enum.class, Object[].class).invoke(logger,
- LoggerTestMessages.TEST_MESSAGE, new Object[] {levelName, DUMMY_MESSAGE});
-
- Logger.class.getMethod(levelName, Throwable.class).invoke(logger, new IllegalArgumentException(levelName));
-
- Logger.class.getMethod(levelName, Throwable.class, Enum.class, Object[].class).invoke(logger,
- new UnsupportedOperationException(levelName), LoggerTestMessages.TEST_MESSAGE, new Object[] {levelName,
- ANOTHER_DUMMY_MESSAGE});
- }
-
- Iterator<LogRecord> iterator = publishedRecords.iterator();
-
- for (Level level: Level.values()) {
- String levelName = levels[level.ordinal()];
-
- verifyLogRecord(iterator.next(), level, MessageFormat.format(CHAR_SEQUENCE_PATTERN, levelName), null, null);
- verifyLogRecord(iterator.next(), level, MessageFormat.format(CHAR_SEQUENCE_THROWABLE_PATTERN, levelName),
- NullPointerException.class, levelName);
-
- verifyLogRecord(iterator.next(), level, MessageFormat.format(TEST_MESSAGE_PATTERN,
- levelName, DUMMY_MESSAGE), null, null);
-
- verifyLogRecord(iterator.next(), level, null, IllegalArgumentException.class, levelName);
-
- verifyLogRecord(iterator.next(), level, MessageFormat.format(TEST_MESSAGE_PATTERN,
- levelName, ANOTHER_DUMMY_MESSAGE), UnsupportedOperationException.class, levelName);
-
- }
- }
-
- @Test
- public void testLevels() throws Exception {
- for (Level loggerLevel : Level.values()) {
- wrappedLogger.setLevel(JavaLogger.LEVELS_MAP.get(loggerLevel));
-
- verifyEnabledMethods(loggerLevel);
- verifyLoggingLevels(loggerLevel);
- }
- }
-
-}
Copied: branches/RF-7944/core/commons/src/test/java/org/richfaces/log/JavaLoggerTest.java (from rev 19108, trunk/core/commons/src/test/java/org/richfaces/log/JavaLoggerTest.java)
===================================================================
--- branches/RF-7944/core/commons/src/test/java/org/richfaces/log/JavaLoggerTest.java (rev 0)
+++ branches/RF-7944/core/commons/src/test/java/org/richfaces/log/JavaLoggerTest.java 2010-09-03 12:00:31 UTC (rev 19109)
@@ -0,0 +1,194 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc. and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.richfaces.log;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNull;
+import static org.junit.Assert.assertTrue;
+
+import java.text.MessageFormat;
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+import java.util.logging.Handler;
+import java.util.logging.LogManager;
+import java.util.logging.LogRecord;
+
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+import org.richfaces.log.Logger.Level;
+
+
+/**
+ * @author Nick Belaevski
+ *
+ */
+public class JavaLoggerTest {
+
+ private static final String ANOTHER_DUMMY_MESSAGE = "another message";
+
+ private static final String DUMMY_MESSAGE = "message";
+
+ private static final String TEST_MESSAGE_PATTERN = "RF-000000 Test message with arguments: {0} and {1}";
+
+ private static final String CHAR_SEQUENCE_THROWABLE_PATTERN = "(CharSequence, Throwable)({0})";
+
+ private static final String CHAR_SEQUENCE_PATTERN = "(CharSequence)({0})";
+
+ /**
+ * @author Nick Belaevski
+ *
+ */
+ private final class TrackingHandler extends Handler {
+ @Override
+ public void publish(LogRecord record) {
+ publishedRecords.add(record);
+ }
+
+ @Override
+ public void flush() {
+ }
+
+ @Override
+ public void close() throws SecurityException {
+ }
+ }
+
+ private java.util.logging.Logger wrappedLogger;
+
+ private JavaLogger logger;
+
+ private List<LogRecord> publishedRecords;
+
+ @Before
+ public void setUp() throws Exception {
+ LogManager.getLogManager().reset();
+ publishedRecords = new ArrayList<LogRecord>();
+
+ wrappedLogger = java.util.logging.Logger.getLogger("org.richfaces.JavaLoggerTest");
+ wrappedLogger.addHandler(new TrackingHandler());
+
+ logger = new JavaLogger(wrappedLogger.getName());
+ }
+
+ @After
+ public void tearDown() throws Exception {
+ publishedRecords = null;
+
+ wrappedLogger = null;
+ logger = null;
+ }
+
+ private void verifyLogRecord(LogRecord logRecord, Level level, String message, Class<? extends Throwable> thrownClass, String thrownMessage) {
+ assertEquals(JavaLogger.LEVELS_MAP.get(level), logRecord.getLevel());
+ assertEquals(message, logRecord.getMessage());
+
+ if (thrownClass != null && thrownMessage != null) {
+ assertTrue(thrownClass.isInstance(logRecord.getThrown()));
+ assertEquals(thrownMessage, logRecord.getThrown().getMessage());
+ } else {
+ assertNull(logRecord.getThrown());
+ }
+ }
+
+ private void verifyEnabledMethods(Level loggerLevel) throws Exception {
+ String[] levels = {"Debug", "Info", "Warn", "Error"};
+
+ for (Level level : Level.values()) {
+ boolean enabledValue = (Boolean) Logger.class.getMethod(MessageFormat.format("is{0}Enabled", levels[level.ordinal()])).
+ invoke(logger);
+
+ if (level.compareTo(loggerLevel) < 0) {
+ assertFalse(loggerLevel.toString(), enabledValue);
+ } else {
+ assertTrue(loggerLevel.toString(), enabledValue);
+ }
+ }
+ }
+
+ private void verifyLoggingLevels(Level loggerLevel) {
+ for (Level messageLevel : Level.values()) {
+ logger.log(messageLevel, "test");
+
+ if (messageLevel.compareTo(loggerLevel) < 0) {
+ assertTrue(publishedRecords.isEmpty());
+ } else {
+ assertTrue(publishedRecords.size() == 1);
+ publishedRecords.clear();
+ }
+ }
+ }
+
+ @Test
+ public void testLogging() throws Exception {
+ wrappedLogger.setLevel(java.util.logging.Level.ALL);
+
+ String[] levels = {"debug", "info", "warn", "error"};
+
+ for (String levelName : levels) {
+ Logger.class.getMethod(levelName, CharSequence.class).invoke(logger, MessageFormat.format(CHAR_SEQUENCE_PATTERN, levelName));
+ Logger.class.getMethod(levelName, CharSequence.class, Throwable.class).invoke(logger,
+ MessageFormat.format(CHAR_SEQUENCE_THROWABLE_PATTERN, levelName), new NullPointerException(levelName));
+
+ Logger.class.getMethod(levelName, Enum.class, Object[].class).invoke(logger,
+ LoggerTestMessages.TEST_MESSAGE, new Object[] {levelName, DUMMY_MESSAGE});
+
+ Logger.class.getMethod(levelName, Throwable.class).invoke(logger, new IllegalArgumentException(levelName));
+
+ Logger.class.getMethod(levelName, Throwable.class, Enum.class, Object[].class).invoke(logger,
+ new UnsupportedOperationException(levelName), LoggerTestMessages.TEST_MESSAGE, new Object[] {levelName,
+ ANOTHER_DUMMY_MESSAGE});
+ }
+
+ Iterator<LogRecord> iterator = publishedRecords.iterator();
+
+ for (Level level: Level.values()) {
+ String levelName = levels[level.ordinal()];
+
+ verifyLogRecord(iterator.next(), level, MessageFormat.format(CHAR_SEQUENCE_PATTERN, levelName), null, null);
+ verifyLogRecord(iterator.next(), level, MessageFormat.format(CHAR_SEQUENCE_THROWABLE_PATTERN, levelName),
+ NullPointerException.class, levelName);
+
+ verifyLogRecord(iterator.next(), level, MessageFormat.format(TEST_MESSAGE_PATTERN,
+ levelName, DUMMY_MESSAGE), null, null);
+
+ verifyLogRecord(iterator.next(), level, null, IllegalArgumentException.class, levelName);
+
+ verifyLogRecord(iterator.next(), level, MessageFormat.format(TEST_MESSAGE_PATTERN,
+ levelName, ANOTHER_DUMMY_MESSAGE), UnsupportedOperationException.class, levelName);
+
+ }
+ }
+
+ @Test
+ public void testLevels() throws Exception {
+ for (Level loggerLevel : Level.values()) {
+ wrappedLogger.setLevel(JavaLogger.LEVELS_MAP.get(loggerLevel));
+
+ verifyEnabledMethods(loggerLevel);
+ verifyLoggingLevels(loggerLevel);
+ }
+ }
+
+}
Deleted: branches/RF-7944/core/commons/src/test/java/org/richfaces/log/LoggerTestMessages.java
===================================================================
--- trunk/core/commons/src/test/java/org/richfaces/log/LoggerTestMessages.java 2010-09-03 08:56:24 UTC (rev 19108)
+++ branches/RF-7944/core/commons/src/test/java/org/richfaces/log/LoggerTestMessages.java 2010-09-03 12:00:31 UTC (rev 19109)
@@ -1,46 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2010, Red Hat, Inc. and individual contributors
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.richfaces.log;
-
-import org.richfaces.l10n.MessageBundle;
-
-/**
- * @author Nick Belaevski
- *
- */
-@MessageBundle(baseName = "org.richfaces.log.Resources")
-public enum LoggerTestMessages {
-
- TEST_MESSAGE("org.richfaces.TestMessage");
-
-
- private String s;
-
- private LoggerTestMessages(String s) {
- this.s = s;
- }
-
- @Override
- public String toString() {
- return s;
- }
-}
Copied: branches/RF-7944/core/commons/src/test/java/org/richfaces/log/LoggerTestMessages.java (from rev 19108, trunk/core/commons/src/test/java/org/richfaces/log/LoggerTestMessages.java)
===================================================================
--- branches/RF-7944/core/commons/src/test/java/org/richfaces/log/LoggerTestMessages.java (rev 0)
+++ branches/RF-7944/core/commons/src/test/java/org/richfaces/log/LoggerTestMessages.java 2010-09-03 12:00:31 UTC (rev 19109)
@@ -0,0 +1,46 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc. and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.richfaces.log;
+
+import org.richfaces.l10n.MessageBundle;
+
+/**
+ * @author Nick Belaevski
+ *
+ */
+@MessageBundle(baseName = "org.richfaces.log.Resources")
+public enum LoggerTestMessages {
+
+ TEST_MESSAGE("org.richfaces.TestMessage");
+
+
+ private String s;
+
+ private LoggerTestMessages(String s) {
+ this.s = s;
+ }
+
+ @Override
+ public String toString() {
+ return s;
+ }
+}
Copied: branches/RF-7944/core/commons/src/test/resources (from rev 19108, trunk/core/commons/src/test/resources)
Copied: branches/RF-7944/core/commons/src/test/resources/org (from rev 19108, trunk/core/commons/src/test/resources/org)
Copied: branches/RF-7944/core/commons/src/test/resources/org/richfaces (from rev 19108, trunk/core/commons/src/test/resources/org/richfaces)
Copied: branches/RF-7944/core/commons/src/test/resources/org/richfaces/l10n (from rev 19108, trunk/core/commons/src/test/resources/org/richfaces/l10n)
Deleted: branches/RF-7944/core/commons/src/test/resources/org/richfaces/l10n/AppMessages_by_BY.properties
===================================================================
--- trunk/core/commons/src/test/resources/org/richfaces/l10n/AppMessages_by_BY.properties 2010-09-03 08:56:24 UTC (rev 19108)
+++ branches/RF-7944/core/commons/src/test/resources/org/richfaces/l10n/AppMessages_by_BY.properties 2010-09-03 12:00:31 UTC (rev 19109)
@@ -1 +0,0 @@
-message=Dobro pozhalovat'
\ No newline at end of file
Copied: branches/RF-7944/core/commons/src/test/resources/org/richfaces/l10n/AppMessages_by_BY.properties (from rev 19108, trunk/core/commons/src/test/resources/org/richfaces/l10n/AppMessages_by_BY.properties)
===================================================================
--- branches/RF-7944/core/commons/src/test/resources/org/richfaces/l10n/AppMessages_by_BY.properties (rev 0)
+++ branches/RF-7944/core/commons/src/test/resources/org/richfaces/l10n/AppMessages_by_BY.properties 2010-09-03 12:00:31 UTC (rev 19109)
@@ -0,0 +1 @@
+message=Dobro pozhalovat'
\ No newline at end of file
Deleted: branches/RF-7944/core/commons/src/test/resources/org/richfaces/l10n/AppMessages_en_US.properties
===================================================================
--- trunk/core/commons/src/test/resources/org/richfaces/l10n/AppMessages_en_US.properties 2010-09-03 08:56:24 UTC (rev 19108)
+++ branches/RF-7944/core/commons/src/test/resources/org/richfaces/l10n/AppMessages_en_US.properties 2010-09-03 12:00:31 UTC (rev 19109)
@@ -1 +0,0 @@
-message=Welcome to app
\ No newline at end of file
Copied: branches/RF-7944/core/commons/src/test/resources/org/richfaces/l10n/AppMessages_en_US.properties (from rev 19108, trunk/core/commons/src/test/resources/org/richfaces/l10n/AppMessages_en_US.properties)
===================================================================
--- branches/RF-7944/core/commons/src/test/resources/org/richfaces/l10n/AppMessages_en_US.properties (rev 0)
+++ branches/RF-7944/core/commons/src/test/resources/org/richfaces/l10n/AppMessages_en_US.properties 2010-09-03 12:00:31 UTC (rev 19109)
@@ -0,0 +1 @@
+message=Welcome to app
\ No newline at end of file
Deleted: branches/RF-7944/core/commons/src/test/resources/org/richfaces/l10n/BundleLoaderMessages_en_US.properties
===================================================================
--- trunk/core/commons/src/test/resources/org/richfaces/l10n/BundleLoaderMessages_en_US.properties 2010-09-03 08:56:24 UTC (rev 19108)
+++ branches/RF-7944/core/commons/src/test/resources/org/richfaces/l10n/BundleLoaderMessages_en_US.properties 2010-09-03 12:00:31 UTC (rev 19109)
@@ -1 +0,0 @@
-message=Hello
\ No newline at end of file
Copied: branches/RF-7944/core/commons/src/test/resources/org/richfaces/l10n/BundleLoaderMessages_en_US.properties (from rev 19108, trunk/core/commons/src/test/resources/org/richfaces/l10n/BundleLoaderMessages_en_US.properties)
===================================================================
--- branches/RF-7944/core/commons/src/test/resources/org/richfaces/l10n/BundleLoaderMessages_en_US.properties (rev 0)
+++ branches/RF-7944/core/commons/src/test/resources/org/richfaces/l10n/BundleLoaderMessages_en_US.properties 2010-09-03 12:00:31 UTC (rev 19109)
@@ -0,0 +1 @@
+message=Hello
\ No newline at end of file
Deleted: branches/RF-7944/core/commons/src/test/resources/org/richfaces/l10n/BundleLoaderMessages_ru_RU.properties
===================================================================
--- trunk/core/commons/src/test/resources/org/richfaces/l10n/BundleLoaderMessages_ru_RU.properties 2010-09-03 08:56:24 UTC (rev 19108)
+++ branches/RF-7944/core/commons/src/test/resources/org/richfaces/l10n/BundleLoaderMessages_ru_RU.properties 2010-09-03 12:00:31 UTC (rev 19109)
@@ -1 +0,0 @@
-message=Zdravstvujte
\ No newline at end of file
Copied: branches/RF-7944/core/commons/src/test/resources/org/richfaces/l10n/BundleLoaderMessages_ru_RU.properties (from rev 19108, trunk/core/commons/src/test/resources/org/richfaces/l10n/BundleLoaderMessages_ru_RU.properties)
===================================================================
--- branches/RF-7944/core/commons/src/test/resources/org/richfaces/l10n/BundleLoaderMessages_ru_RU.properties (rev 0)
+++ branches/RF-7944/core/commons/src/test/resources/org/richfaces/l10n/BundleLoaderMessages_ru_RU.properties 2010-09-03 12:00:31 UTC (rev 19109)
@@ -0,0 +1 @@
+message=Zdravstvujte
\ No newline at end of file
Copied: branches/RF-7944/core/commons/src/test/resources/org/richfaces/log (from rev 19108, trunk/core/commons/src/test/resources/org/richfaces/log)
Deleted: branches/RF-7944/core/commons/src/test/resources/org/richfaces/log/Resources.properties
===================================================================
--- trunk/core/commons/src/test/resources/org/richfaces/log/Resources.properties 2010-09-03 08:56:24 UTC (rev 19108)
+++ branches/RF-7944/core/commons/src/test/resources/org/richfaces/log/Resources.properties 2010-09-03 12:00:31 UTC (rev 19109)
@@ -1 +0,0 @@
-org.richfaces.TestMessage=RF-000000 Test message with arguments: {0} and {1}
\ No newline at end of file
Copied: branches/RF-7944/core/commons/src/test/resources/org/richfaces/log/Resources.properties (from rev 19108, trunk/core/commons/src/test/resources/org/richfaces/log/Resources.properties)
===================================================================
--- branches/RF-7944/core/commons/src/test/resources/org/richfaces/log/Resources.properties (rev 0)
+++ branches/RF-7944/core/commons/src/test/resources/org/richfaces/log/Resources.properties 2010-09-03 12:00:31 UTC (rev 19109)
@@ -0,0 +1 @@
+org.richfaces.TestMessage=RF-000000 Test message with arguments: {0} and {1}
\ No newline at end of file
Modified: branches/RF-7944/core/impl/pom.xml
===================================================================
--- branches/RF-7944/core/impl/pom.xml 2010-09-03 08:56:24 UTC (rev 19108)
+++ branches/RF-7944/core/impl/pom.xml 2010-09-03 12:00:31 UTC (rev 19109)
@@ -47,10 +47,6 @@
<groupId>net.sourceforge.cssparser</groupId>
<artifactId>cssparser</artifactId>
</dependency>
- <dependency>
- <groupId>org.slf4j</groupId>
- <artifactId>slf4j-api</artifactId>
- </dependency>
<dependency>
<groupId>com.google.guava</groupId>
<artifactId>guava</artifactId>
@@ -116,11 +112,6 @@
<artifactId>easymockclassextension</artifactId>
<scope>test</scope>
</dependency>
- <dependency>
- <groupId>org.slf4j</groupId>
- <artifactId>slf4j-log4j12</artifactId>
- <scope>test</scope>
- </dependency>
</dependencies>
<build>
Modified: branches/RF-7944/core/impl/src/main/java/org/ajax4jsf/application/AjaxViewHandler.java
===================================================================
--- branches/RF-7944/core/impl/src/main/java/org/ajax4jsf/application/AjaxViewHandler.java 2010-09-03 08:56:24 UTC (rev 19108)
+++ branches/RF-7944/core/impl/src/main/java/org/ajax4jsf/application/AjaxViewHandler.java 2010-09-03 12:00:31 UTC (rev 19109)
@@ -30,7 +30,7 @@
import org.ajax4jsf.webapp.BaseFilter;
import org.ajax4jsf.webapp.FilterServletResponseWrapper;
import org.richfaces.log.RichfacesLogger;
-import org.slf4j.Logger;
+import org.richfaces.log.Logger;
import javax.faces.FacesException;
import javax.faces.application.Resource;
Modified: branches/RF-7944/core/impl/src/main/java/org/ajax4jsf/application/DebugLifecycle.java
===================================================================
--- branches/RF-7944/core/impl/src/main/java/org/ajax4jsf/application/DebugLifecycle.java 2010-09-03 08:56:24 UTC (rev 19108)
+++ branches/RF-7944/core/impl/src/main/java/org/ajax4jsf/application/DebugLifecycle.java 2010-09-03 12:00:31 UTC (rev 19109)
@@ -22,7 +22,7 @@
package org.ajax4jsf.application;
import org.richfaces.log.RichfacesLogger;
-import org.slf4j.Logger;
+import org.richfaces.log.Logger;
import javax.faces.FacesException;
import javax.faces.context.FacesContext;
Modified: branches/RF-7944/core/impl/src/main/java/org/ajax4jsf/application/DebugLifecycleFactory.java
===================================================================
--- branches/RF-7944/core/impl/src/main/java/org/ajax4jsf/application/DebugLifecycleFactory.java 2010-09-03 08:56:24 UTC (rev 19108)
+++ branches/RF-7944/core/impl/src/main/java/org/ajax4jsf/application/DebugLifecycleFactory.java 2010-09-03 12:00:31 UTC (rev 19109)
@@ -22,7 +22,7 @@
package org.ajax4jsf.application;
import org.richfaces.log.RichfacesLogger;
-import org.slf4j.Logger;
+import org.richfaces.log.Logger;
import javax.faces.lifecycle.Lifecycle;
import javax.faces.lifecycle.LifecycleFactory;
Modified: branches/RF-7944/core/impl/src/main/java/org/ajax4jsf/cache/CacheManager.java
===================================================================
--- branches/RF-7944/core/impl/src/main/java/org/ajax4jsf/cache/CacheManager.java 2010-09-03 08:56:24 UTC (rev 19108)
+++ branches/RF-7944/core/impl/src/main/java/org/ajax4jsf/cache/CacheManager.java 2010-09-03 12:00:31 UTC (rev 19109)
@@ -32,7 +32,7 @@
import org.ajax4jsf.cache.lru.LRUMapCacheFactory;
import org.ajax4jsf.resource.util.URLToStreamHelper;
import org.richfaces.log.RichfacesLogger;
-import org.slf4j.Logger;
+import org.richfaces.log.Logger;
/**
* TODO stop caches on application stop
Modified: branches/RF-7944/core/impl/src/main/java/org/ajax4jsf/cache/EhCacheCacheFactory.java
===================================================================
--- branches/RF-7944/core/impl/src/main/java/org/ajax4jsf/cache/EhCacheCacheFactory.java 2010-09-03 08:56:24 UTC (rev 19108)
+++ branches/RF-7944/core/impl/src/main/java/org/ajax4jsf/cache/EhCacheCacheFactory.java 2010-09-03 12:00:31 UTC (rev 19109)
@@ -14,7 +14,7 @@
import org.ajax4jsf.context.ContextInitParameters;
import org.richfaces.log.RichfacesLogger;
-import org.slf4j.Logger;
+import org.richfaces.log.Logger;
/**
* @author Nick Belaevski
Modified: branches/RF-7944/core/impl/src/main/java/org/ajax4jsf/cache/JBossCacheCacheFactory.java
===================================================================
--- branches/RF-7944/core/impl/src/main/java/org/ajax4jsf/cache/JBossCacheCacheFactory.java 2010-09-03 08:56:24 UTC (rev 19108)
+++ branches/RF-7944/core/impl/src/main/java/org/ajax4jsf/cache/JBossCacheCacheFactory.java 2010-09-03 12:00:31 UTC (rev 19109)
@@ -24,7 +24,7 @@
import org.jboss.cache.eviction.EvictionAlgorithmConfigBase;
import org.jboss.cache.eviction.ExpirationAlgorithmConfig;
import org.richfaces.log.RichfacesLogger;
-import org.slf4j.Logger;
+import org.richfaces.log.Logger;
/**
* @author Nick Belaevski
Modified: branches/RF-7944/core/impl/src/main/java/org/ajax4jsf/cache/OSCacheCacheFactory.java
===================================================================
--- branches/RF-7944/core/impl/src/main/java/org/ajax4jsf/cache/OSCacheCacheFactory.java 2010-09-03 08:56:24 UTC (rev 19108)
+++ branches/RF-7944/core/impl/src/main/java/org/ajax4jsf/cache/OSCacheCacheFactory.java 2010-09-03 12:00:31 UTC (rev 19109)
@@ -35,7 +35,7 @@
import org.ajax4jsf.context.ContextInitParameters;
import org.ajax4jsf.resource.util.URLToStreamHelper;
import org.richfaces.log.RichfacesLogger;
-import org.slf4j.Logger;
+import org.richfaces.log.Logger;
import com.opensymphony.oscache.base.AbstractCacheAdministrator;
import com.opensymphony.oscache.general.GeneralCacheAdministrator;
Modified: branches/RF-7944/core/impl/src/main/java/org/ajax4jsf/cache/lru/LRUMapCacheFactory.java
===================================================================
--- branches/RF-7944/core/impl/src/main/java/org/ajax4jsf/cache/lru/LRUMapCacheFactory.java 2010-09-03 08:56:24 UTC (rev 19108)
+++ branches/RF-7944/core/impl/src/main/java/org/ajax4jsf/cache/lru/LRUMapCacheFactory.java 2010-09-03 12:00:31 UTC (rev 19109)
@@ -29,7 +29,7 @@
import org.ajax4jsf.cache.CacheFactory;
import org.ajax4jsf.context.ContextInitParameters;
import org.richfaces.log.RichfacesLogger;
-import org.slf4j.Logger;
+import org.richfaces.log.Logger;
/**
* @author Nick - mailto:nbelaevski@exadel.com
Modified: branches/RF-7944/core/impl/src/main/java/org/ajax4jsf/component/AjaxRegionBrige.java
===================================================================
--- branches/RF-7944/core/impl/src/main/java/org/ajax4jsf/component/AjaxRegionBrige.java 2010-09-03 08:56:24 UTC (rev 19108)
+++ branches/RF-7944/core/impl/src/main/java/org/ajax4jsf/component/AjaxRegionBrige.java 2010-09-03 12:00:31 UTC (rev 19109)
@@ -24,7 +24,7 @@
import org.ajax4jsf.Messages;
import org.ajax4jsf.event.AjaxEvent;
import org.richfaces.log.RichfacesLogger;
-import org.slf4j.Logger;
+import org.richfaces.log.Logger;
import javax.el.ELContext;
import javax.el.MethodExpression;
Modified: branches/RF-7944/core/impl/src/main/java/org/ajax4jsf/component/AjaxViewRoot.java
===================================================================
--- branches/RF-7944/core/impl/src/main/java/org/ajax4jsf/component/AjaxViewRoot.java 2010-09-03 08:56:24 UTC (rev 19108)
+++ branches/RF-7944/core/impl/src/main/java/org/ajax4jsf/component/AjaxViewRoot.java 2010-09-03 12:00:31 UTC (rev 19109)
@@ -29,7 +29,7 @@
import org.ajax4jsf.event.EventsQueue;
import org.ajax4jsf.renderkit.AjaxContainerRenderer;
import org.richfaces.log.RichfacesLogger;
-import org.slf4j.Logger;
+import org.richfaces.log.Logger;
import javax.el.MethodExpression;
import javax.faces.FacesException;
Modified: branches/RF-7944/core/impl/src/main/java/org/ajax4jsf/config/FrameworkConfiguration.java
===================================================================
--- branches/RF-7944/core/impl/src/main/java/org/ajax4jsf/config/FrameworkConfiguration.java 2010-09-03 08:56:24 UTC (rev 19108)
+++ branches/RF-7944/core/impl/src/main/java/org/ajax4jsf/config/FrameworkConfiguration.java 2010-09-03 12:00:31 UTC (rev 19109)
@@ -2,7 +2,7 @@
import org.ajax4jsf.util.ELUtils;
import org.richfaces.log.RichfacesLogger;
-import org.slf4j.Logger;
+import org.richfaces.log.Logger;
import javax.el.ExpressionFactory;
import javax.el.ValueExpression;
Modified: branches/RF-7944/core/impl/src/main/java/org/ajax4jsf/context/AjaxContextImpl.java
===================================================================
--- branches/RF-7944/core/impl/src/main/java/org/ajax4jsf/context/AjaxContextImpl.java 2010-09-03 08:56:24 UTC (rev 19108)
+++ branches/RF-7944/core/impl/src/main/java/org/ajax4jsf/context/AjaxContextImpl.java 2010-09-03 12:00:31 UTC (rev 19109)
@@ -55,7 +55,7 @@
import org.ajax4jsf.renderkit.RendererUtils;
import org.ajax4jsf.renderkit.RendererUtils.HTML;
import org.richfaces.log.RichfacesLogger;
-import org.slf4j.Logger;
+import org.richfaces.log.Logger;
/**
* This class incapsulated
Modified: branches/RF-7944/core/impl/src/main/java/org/ajax4jsf/event/AjaxPhaseListener.java
===================================================================
--- branches/RF-7944/core/impl/src/main/java/org/ajax4jsf/event/AjaxPhaseListener.java 2010-09-03 08:56:24 UTC (rev 19108)
+++ branches/RF-7944/core/impl/src/main/java/org/ajax4jsf/event/AjaxPhaseListener.java 2010-09-03 12:00:31 UTC (rev 19109)
@@ -30,8 +30,8 @@
import javax.faces.event.PhaseListener;
import org.ajax4jsf.context.AjaxContext;
+import org.richfaces.log.Logger;
import org.richfaces.log.RichfacesLogger;
-import org.slf4j.Logger;
/**
* Listener for act before Render phase to set RenderKit Id for current skin.
Modified: branches/RF-7944/core/impl/src/main/java/org/ajax4jsf/event/InitPhaseListener.java
===================================================================
--- branches/RF-7944/core/impl/src/main/java/org/ajax4jsf/event/InitPhaseListener.java 2010-09-03 08:56:24 UTC (rev 19108)
+++ branches/RF-7944/core/impl/src/main/java/org/ajax4jsf/event/InitPhaseListener.java 2010-09-03 12:00:31 UTC (rev 19109)
@@ -23,7 +23,7 @@
import org.ajax4jsf.application.AjaxViewHandler;
import org.richfaces.log.RichfacesLogger;
-import org.slf4j.Logger;
+import org.richfaces.log.Logger;
import javax.faces.FactoryFinder;
import javax.faces.application.Application;
Modified: branches/RF-7944/core/impl/src/main/java/org/ajax4jsf/renderkit/AjaxChildrenRenderer.java
===================================================================
--- branches/RF-7944/core/impl/src/main/java/org/ajax4jsf/renderkit/AjaxChildrenRenderer.java 2010-09-03 08:56:24 UTC (rev 19108)
+++ branches/RF-7944/core/impl/src/main/java/org/ajax4jsf/renderkit/AjaxChildrenRenderer.java 2010-09-03 12:00:31 UTC (rev 19109)
@@ -21,21 +21,22 @@
package org.ajax4jsf.renderkit;
+import java.io.IOException;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.Set;
+
+import javax.faces.component.NamingContainer;
+import javax.faces.component.UIComponent;
+import javax.faces.context.FacesContext;
+
import org.ajax4jsf.Messages;
import org.ajax4jsf.component.AjaxChildrenEncoder;
import org.ajax4jsf.component.AjaxOutput;
import org.ajax4jsf.context.AjaxContext;
+import org.richfaces.log.Logger;
import org.richfaces.log.RichfacesLogger;
-import org.slf4j.Logger;
-import javax.faces.component.NamingContainer;
-import javax.faces.component.UIComponent;
-import javax.faces.context.FacesContext;
-import java.io.IOException;
-import java.util.HashSet;
-import java.util.Iterator;
-import java.util.Set;
-
/**
* @author shura
*/
Modified: branches/RF-7944/core/impl/src/main/java/org/ajax4jsf/renderkit/AjaxContainerRenderer.java
===================================================================
--- branches/RF-7944/core/impl/src/main/java/org/ajax4jsf/renderkit/AjaxContainerRenderer.java 2010-09-03 08:56:24 UTC (rev 19108)
+++ branches/RF-7944/core/impl/src/main/java/org/ajax4jsf/renderkit/AjaxContainerRenderer.java 2010-09-03 12:00:31 UTC (rev 19109)
@@ -21,20 +21,21 @@
package org.ajax4jsf.renderkit;
+import java.io.IOException;
+import java.util.Map;
+import java.util.Set;
+
+import javax.faces.component.NamingContainer;
+import javax.faces.component.UIComponent;
+import javax.faces.context.FacesContext;
+
import org.ajax4jsf.Messages;
import org.ajax4jsf.component.AjaxContainer;
import org.ajax4jsf.context.AjaxContext;
import org.ajax4jsf.event.AjaxEvent;
+import org.richfaces.log.Logger;
import org.richfaces.log.RichfacesLogger;
-import org.slf4j.Logger;
-import javax.faces.component.NamingContainer;
-import javax.faces.component.UIComponent;
-import javax.faces.context.FacesContext;
-import java.io.IOException;
-import java.util.Map;
-import java.util.Set;
-
/**
* Base renderer for all AJAX - subview components.
*
Modified: branches/RF-7944/core/impl/src/main/java/org/ajax4jsf/renderkit/AjaxRendererUtils.java
===================================================================
--- branches/RF-7944/core/impl/src/main/java/org/ajax4jsf/renderkit/AjaxRendererUtils.java 2010-09-03 08:56:24 UTC (rev 19108)
+++ branches/RF-7944/core/impl/src/main/java/org/ajax4jsf/renderkit/AjaxRendererUtils.java 2010-09-03 12:00:31 UTC (rev 19109)
@@ -54,9 +54,11 @@
import org.ajax4jsf.javascript.JSReference;
import org.ajax4jsf.renderkit.RendererUtils.HTML;
import org.richfaces.application.ServiceTracker;
+import org.richfaces.log.Logger;
import org.richfaces.log.RichfacesLogger;
-import org.slf4j.Logger;
+import com.google.common.base.Strings;
+
/**
* @author shura
* <p/>
@@ -680,6 +682,10 @@
String[] values = asArray(areasString);
Set<String> result = new LinkedHashSet<String>(values.length);
for (String value : values) {
+ if (Strings.isNullOrEmpty(value)) {
+ continue;
+ }
+
result.add(value);
}
@@ -687,7 +693,9 @@
} else {
Set<String> areasSet = new LinkedHashSet<String>(5);
- areasSet.add(areasString);
+ if (!Strings.isNullOrEmpty(areasString)) {
+ areasSet.add(areasString);
+ }
return areasSet;
}
Modified: branches/RF-7944/core/impl/src/main/java/org/ajax4jsf/renderkit/ChameleonRenderKitFactory.java
===================================================================
--- branches/RF-7944/core/impl/src/main/java/org/ajax4jsf/renderkit/ChameleonRenderKitFactory.java 2010-09-03 08:56:24 UTC (rev 19108)
+++ branches/RF-7944/core/impl/src/main/java/org/ajax4jsf/renderkit/ChameleonRenderKitFactory.java 2010-09-03 12:00:31 UTC (rev 19109)
@@ -21,17 +21,18 @@
package org.ajax4jsf.renderkit;
-import org.ajax4jsf.Messages;
-import org.richfaces.log.RichfacesLogger;
-import org.slf4j.Logger;
+import java.util.Iterator;
import javax.faces.FactoryFinder;
import javax.faces.application.ApplicationFactory;
import javax.faces.context.FacesContext;
import javax.faces.render.RenderKit;
import javax.faces.render.RenderKitFactory;
-import java.util.Iterator;
+import org.ajax4jsf.Messages;
+import org.richfaces.log.Logger;
+import org.richfaces.log.RichfacesLogger;
+
/**
* @author shura (latest modification by $Author: alexsmirnov $)
* @version $Revision: 1.1.2.1 $ $Date: 2007/01/09 18:58:50 $
Modified: branches/RF-7944/core/impl/src/main/java/org/ajax4jsf/renderkit/RendererBase.java
===================================================================
--- branches/RF-7944/core/impl/src/main/java/org/ajax4jsf/renderkit/RendererBase.java 2010-09-03 08:56:24 UTC (rev 19108)
+++ branches/RF-7944/core/impl/src/main/java/org/ajax4jsf/renderkit/RendererBase.java 2010-09-03 12:00:31 UTC (rev 19109)
@@ -30,11 +30,11 @@
import org.ajax4jsf.Messages;
import org.ajax4jsf.resource.InternetResource;
+import org.richfaces.log.Logger;
import org.richfaces.log.RichfacesLogger;
import org.richfaces.renderkit.RenderKitUtils;
import org.richfaces.skin.Skin;
import org.richfaces.skin.SkinFactory;
-import org.slf4j.Logger;
/**
* Base Renderer for all chameleon Skin's and components.
Modified: branches/RF-7944/core/impl/src/main/java/org/ajax4jsf/resource/InternetResourceBase.java
===================================================================
--- branches/RF-7944/core/impl/src/main/java/org/ajax4jsf/resource/InternetResourceBase.java 2010-09-03 08:56:24 UTC (rev 19108)
+++ branches/RF-7944/core/impl/src/main/java/org/ajax4jsf/resource/InternetResourceBase.java 2010-09-03 12:00:31 UTC (rev 19109)
@@ -21,18 +21,19 @@
package org.ajax4jsf.resource;
-import org.ajax4jsf.Messages;
-import org.richfaces.log.RichfacesLogger;
-import org.richfaces.util.Util;
-import org.slf4j.Logger;
-
-import javax.faces.context.FacesContext;
import java.io.IOException;
import java.io.InputStream;
import java.util.Date;
import java.util.HashMap;
import java.util.Map;
+import javax.faces.context.FacesContext;
+
+import org.ajax4jsf.Messages;
+import org.richfaces.log.Logger;
+import org.richfaces.log.RichfacesLogger;
+import org.richfaces.util.Util;
+
/**
* Base class for all Html page resources - images, scripts, styles etc. Realise
* as "brige" pattern - different subclasses for different resource source
Modified: branches/RF-7944/core/impl/src/main/java/org/ajax4jsf/resource/InternetResourceService.java
===================================================================
--- branches/RF-7944/core/impl/src/main/java/org/ajax4jsf/resource/InternetResourceService.java 2010-09-03 08:56:24 UTC (rev 19108)
+++ branches/RF-7944/core/impl/src/main/java/org/ajax4jsf/resource/InternetResourceService.java 2010-09-03 12:00:31 UTC (rev 19109)
@@ -45,8 +45,8 @@
import org.ajax4jsf.resource.util.URLToStreamHelper;
import org.ajax4jsf.webapp.BaseFilter;
import org.ajax4jsf.webapp.WebXml;
+import org.richfaces.log.Logger;
import org.richfaces.log.RichfacesLogger;
-import org.slf4j.Logger;
public class InternetResourceService {
static final String ENABLE_CACHING_PARAMETER = "enable-cache";
Modified: branches/RF-7944/core/impl/src/main/java/org/ajax4jsf/resource/OneTimeRenderer.java
===================================================================
--- branches/RF-7944/core/impl/src/main/java/org/ajax4jsf/resource/OneTimeRenderer.java 2010-09-03 08:56:24 UTC (rev 19108)
+++ branches/RF-7944/core/impl/src/main/java/org/ajax4jsf/resource/OneTimeRenderer.java 2010-09-03 12:00:31 UTC (rev 19109)
@@ -21,14 +21,15 @@
package org.ajax4jsf.resource;
+import java.io.IOException;
+import java.util.Map;
+
+import javax.faces.context.FacesContext;
+
import org.ajax4jsf.Messages;
+import org.richfaces.log.Logger;
import org.richfaces.log.RichfacesLogger;
-import org.slf4j.Logger;
-import javax.faces.context.FacesContext;
-import java.io.IOException;
-import java.util.Map;
-
/**
* Base class for resources, rendered only one time in page ( JavaScript, CSS )
*
Modified: branches/RF-7944/core/impl/src/main/java/org/ajax4jsf/resource/ResourceLifecycle.java
===================================================================
--- branches/RF-7944/core/impl/src/main/java/org/ajax4jsf/resource/ResourceLifecycle.java 2010-09-03 08:56:24 UTC (rev 19108)
+++ branches/RF-7944/core/impl/src/main/java/org/ajax4jsf/resource/ResourceLifecycle.java 2010-09-03 12:00:31 UTC (rev 19109)
@@ -21,8 +21,8 @@
package org.ajax4jsf.resource;
-import org.richfaces.log.RichfacesLogger;
-import org.slf4j.Logger;
+import java.io.IOException;
+import java.util.Locale;
import javax.faces.FacesException;
import javax.faces.FactoryFinder;
@@ -34,9 +34,10 @@
import javax.faces.lifecycle.Lifecycle;
import javax.faces.lifecycle.LifecycleFactory;
import javax.faces.render.RenderKitFactory;
-import java.io.IOException;
-import java.util.Locale;
+import org.richfaces.log.Logger;
+import org.richfaces.log.RichfacesLogger;
+
/**
* Lifecycle for simulate faces request processing for resource.
*
Modified: branches/RF-7944/core/impl/src/main/java/org/ajax4jsf/resource/ScriptRenderer.java
===================================================================
--- branches/RF-7944/core/impl/src/main/java/org/ajax4jsf/resource/ScriptRenderer.java 2010-09-03 08:56:24 UTC (rev 19108)
+++ branches/RF-7944/core/impl/src/main/java/org/ajax4jsf/resource/ScriptRenderer.java 2010-09-03 12:00:31 UTC (rev 19109)
@@ -21,15 +21,15 @@
package org.ajax4jsf.resource;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.OutputStream;
+
import org.ajax4jsf.Messages;
import org.ajax4jsf.javascript.JSMin;
+import org.richfaces.log.Logger;
import org.richfaces.log.RichfacesLogger;
-import org.slf4j.Logger;
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.OutputStream;
-
class CountingOutputStream extends OutputStream {
private int written = 0;
private OutputStream outputStream;
Modified: branches/RF-7944/core/impl/src/main/java/org/ajax4jsf/util/SelectUtils.java
===================================================================
--- branches/RF-7944/core/impl/src/main/java/org/ajax4jsf/util/SelectUtils.java 2010-09-03 08:56:24 UTC (rev 19108)
+++ branches/RF-7944/core/impl/src/main/java/org/ajax4jsf/util/SelectUtils.java 2010-09-03 12:00:31 UTC (rev 19109)
@@ -21,9 +21,15 @@
package org.ajax4jsf.util;
-import org.ajax4jsf.Messages;
-import org.richfaces.log.RichfacesLogger;
-import org.slf4j.Logger;
+import java.lang.reflect.Array;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collection;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+import java.util.Map.Entry;
+import java.util.Set;
import javax.el.ELContext;
import javax.el.ValueExpression;
@@ -38,16 +44,11 @@
import javax.faces.convert.Converter;
import javax.faces.convert.ConverterException;
import javax.faces.model.SelectItem;
-import java.lang.reflect.Array;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Collection;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
-import java.util.Map.Entry;
-import java.util.Set;
+import org.ajax4jsf.Messages;
+import org.richfaces.log.Logger;
+import org.richfaces.log.RichfacesLogger;
+
/**
* @author Maksim Kaszynski
*/
Modified: branches/RF-7944/core/impl/src/main/java/org/ajax4jsf/util/ServicesUtils.java
===================================================================
--- branches/RF-7944/core/impl/src/main/java/org/ajax4jsf/util/ServicesUtils.java 2010-09-03 08:56:24 UTC (rev 19108)
+++ branches/RF-7944/core/impl/src/main/java/org/ajax4jsf/util/ServicesUtils.java 2010-09-03 12:00:31 UTC (rev 19109)
@@ -21,11 +21,6 @@
package org.ajax4jsf.util;
-import org.ajax4jsf.resource.util.URLToStreamHelper;
-import org.richfaces.log.RichfacesLogger;
-import org.slf4j.Logger;
-
-import javax.faces.FacesException;
import java.io.BufferedReader;
import java.io.InputStream;
import java.io.InputStreamReader;
@@ -33,6 +28,12 @@
import java.util.HashMap;
import java.util.Map;
+import javax.faces.FacesException;
+
+import org.ajax4jsf.resource.util.URLToStreamHelper;
+import org.richfaces.log.Logger;
+import org.richfaces.log.RichfacesLogger;
+
/**
* @author shura
*/
Modified: branches/RF-7944/core/impl/src/main/java/org/ajax4jsf/webapp/BaseFilter.java
===================================================================
--- branches/RF-7944/core/impl/src/main/java/org/ajax4jsf/webapp/BaseFilter.java 2010-09-03 08:56:24 UTC (rev 19108)
+++ branches/RF-7944/core/impl/src/main/java/org/ajax4jsf/webapp/BaseFilter.java 2010-09-03 12:00:31 UTC (rev 19109)
@@ -21,14 +21,16 @@
package org.ajax4jsf.webapp;
-import org.ajax4jsf.Messages;
-import org.ajax4jsf.context.AjaxContext;
-import org.ajax4jsf.renderkit.AjaxContainerRenderer;
-import org.ajax4jsf.request.MultipartRequest;
-import org.ajax4jsf.resource.InternetResourceService;
-import org.richfaces.component.FileUploadConstants;
-import org.richfaces.log.RichfacesLogger;
-import org.slf4j.Logger;
+import java.io.IOException;
+import java.io.PrintWriter;
+import java.io.UnsupportedEncodingException;
+import java.net.URLDecoder;
+import java.util.Collections;
+import java.util.Date;
+import java.util.Enumeration;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.regex.Pattern;
import javax.faces.application.ViewHandler;
import javax.servlet.Filter;
@@ -42,17 +44,16 @@
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpServletResponseWrapper;
import javax.servlet.http.HttpSession;
-import java.io.IOException;
-import java.io.PrintWriter;
-import java.io.UnsupportedEncodingException;
-import java.net.URLDecoder;
-import java.util.Collections;
-import java.util.Date;
-import java.util.Enumeration;
-import java.util.HashMap;
-import java.util.Map;
-import java.util.regex.Pattern;
+import org.ajax4jsf.Messages;
+import org.ajax4jsf.context.AjaxContext;
+import org.ajax4jsf.renderkit.AjaxContainerRenderer;
+import org.ajax4jsf.request.MultipartRequest;
+import org.ajax4jsf.resource.InternetResourceService;
+import org.richfaces.component.FileUploadConstants;
+import org.richfaces.log.Logger;
+import org.richfaces.log.RichfacesLogger;
+
/**
* Base class for request processing filters, with convert Htmp content to XML
* for ajax requests, and serve request to application off-page resources
Modified: branches/RF-7944/core/impl/src/main/java/org/ajax4jsf/webapp/BaseXMLFilter.java
===================================================================
--- branches/RF-7944/core/impl/src/main/java/org/ajax4jsf/webapp/BaseXMLFilter.java 2010-09-03 08:56:24 UTC (rev 19108)
+++ branches/RF-7944/core/impl/src/main/java/org/ajax4jsf/webapp/BaseXMLFilter.java 2010-09-03 12:00:31 UTC (rev 19109)
@@ -21,12 +21,11 @@
package org.ajax4jsf.webapp;
-import org.ajax4jsf.Messages;
-import org.ajax4jsf.application.AjaxViewHandler;
-import org.ajax4jsf.context.ContextInitParameters;
-import org.ajax4jsf.renderkit.AjaxContainerRenderer;
-import org.richfaces.log.RichfacesLogger;
-import org.slf4j.Logger;
+import java.io.IOException;
+import java.io.OutputStreamWriter;
+import java.io.UnsupportedEncodingException;
+import java.io.Writer;
+import java.util.Map;
import javax.faces.application.ViewExpiredException;
import javax.servlet.FilterChain;
@@ -37,12 +36,14 @@
import javax.servlet.http.Cookie;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
-import java.io.IOException;
-import java.io.OutputStreamWriter;
-import java.io.UnsupportedEncodingException;
-import java.io.Writer;
-import java.util.Map;
+import org.ajax4jsf.Messages;
+import org.ajax4jsf.application.AjaxViewHandler;
+import org.ajax4jsf.context.ContextInitParameters;
+import org.ajax4jsf.renderkit.AjaxContainerRenderer;
+import org.richfaces.log.Logger;
+import org.richfaces.log.RichfacesLogger;
+
public abstract class BaseXMLFilter {
public static final String AJAX_EXPIRED = "Ajax-Expired";
public static final String APPLICATION_XHTML_XML = "application/xhtml+xml";
Modified: branches/RF-7944/core/impl/src/main/java/org/ajax4jsf/webapp/CacheContent.java
===================================================================
--- branches/RF-7944/core/impl/src/main/java/org/ajax4jsf/webapp/CacheContent.java 2010-09-03 08:56:24 UTC (rev 19108)
+++ branches/RF-7944/core/impl/src/main/java/org/ajax4jsf/webapp/CacheContent.java 2010-09-03 12:00:31 UTC (rev 19109)
@@ -21,15 +21,6 @@
package org.ajax4jsf.webapp;
-import org.ajax4jsf.io.FastBufferOutputStream;
-import org.ajax4jsf.io.FastBufferWriter;
-import org.richfaces.log.RichfacesLogger;
-import org.richfaces.util.Util;
-import org.slf4j.Logger;
-
-import javax.faces.context.ExternalContext;
-import javax.servlet.ServletOutputStream;
-import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.io.OutputStream;
import java.io.PrintWriter;
@@ -40,6 +31,16 @@
import java.util.Map;
import java.util.Map.Entry;
+import javax.faces.context.ExternalContext;
+import javax.servlet.ServletOutputStream;
+import javax.servlet.http.HttpServletResponse;
+
+import org.ajax4jsf.io.FastBufferOutputStream;
+import org.ajax4jsf.io.FastBufferWriter;
+import org.richfaces.log.Logger;
+import org.richfaces.log.RichfacesLogger;
+import org.richfaces.util.Util;
+
/**
* @author shura (latest modification by $Author: alexsmirnov $)
* @version $Revision: 1.1.2.1 $ $Date: 2007/01/09 18:58:20 $
Modified: branches/RF-7944/core/impl/src/main/java/org/ajax4jsf/webapp/FilterServletResponseWrapper.java
===================================================================
--- branches/RF-7944/core/impl/src/main/java/org/ajax4jsf/webapp/FilterServletResponseWrapper.java 2010-09-03 08:56:24 UTC (rev 19108)
+++ branches/RF-7944/core/impl/src/main/java/org/ajax4jsf/webapp/FilterServletResponseWrapper.java 2010-09-03 12:00:31 UTC (rev 19109)
@@ -35,19 +35,6 @@
package org.ajax4jsf.webapp;
-import org.ajax4jsf.Messages;
-import org.ajax4jsf.io.FastBufferInputStream;
-import org.ajax4jsf.io.FastBufferOutputStream;
-import org.ajax4jsf.io.FastBufferReader;
-import org.ajax4jsf.io.FastBufferWriter;
-import org.richfaces.log.RichfacesLogger;
-import org.slf4j.Logger;
-import org.xml.sax.InputSource;
-
-import javax.servlet.ServletOutputStream;
-import javax.servlet.http.Cookie;
-import javax.servlet.http.HttpServletResponse;
-import javax.servlet.http.HttpServletResponseWrapper;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
@@ -61,6 +48,20 @@
import java.util.Locale;
import java.util.Map;
+import javax.servlet.ServletOutputStream;
+import javax.servlet.http.Cookie;
+import javax.servlet.http.HttpServletResponse;
+import javax.servlet.http.HttpServletResponseWrapper;
+
+import org.ajax4jsf.Messages;
+import org.ajax4jsf.io.FastBufferInputStream;
+import org.ajax4jsf.io.FastBufferOutputStream;
+import org.ajax4jsf.io.FastBufferReader;
+import org.ajax4jsf.io.FastBufferWriter;
+import org.richfaces.log.Logger;
+import org.richfaces.log.RichfacesLogger;
+import org.xml.sax.InputSource;
+
/**
* Base wrapper save JSF page response, for parse to XML with different parsers
*
Modified: branches/RF-7944/core/impl/src/main/java/org/ajax4jsf/webapp/HtmlParser.java
===================================================================
--- branches/RF-7944/core/impl/src/main/java/org/ajax4jsf/webapp/HtmlParser.java 2010-09-03 08:56:24 UTC (rev 19108)
+++ branches/RF-7944/core/impl/src/main/java/org/ajax4jsf/webapp/HtmlParser.java 2010-09-03 12:00:31 UTC (rev 19109)
@@ -21,13 +21,13 @@
package org.ajax4jsf.webapp;
-import org.w3c.dom.Node;
-
import java.io.IOException;
import java.io.InputStream;
import java.io.Reader;
import java.io.Writer;
+import org.w3c.dom.Node;
+
public interface HtmlParser {
public abstract void parseHtml(InputStream input, Writer output) throws IOException;
Modified: branches/RF-7944/core/impl/src/main/java/org/ajax4jsf/webapp/PollEventsManager.java
===================================================================
--- branches/RF-7944/core/impl/src/main/java/org/ajax4jsf/webapp/PollEventsManager.java 2010-09-03 08:56:24 UTC (rev 19108)
+++ branches/RF-7944/core/impl/src/main/java/org/ajax4jsf/webapp/PollEventsManager.java 2010-09-03 12:00:31 UTC (rev 19109)
@@ -21,11 +21,12 @@
package org.ajax4jsf.webapp;
-import javax.servlet.ServletContext;
import java.io.Serializable;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.ConcurrentMap;
+import javax.servlet.ServletContext;
+
/**
* @author asmirnov
*/
Modified: branches/RF-7944/core/impl/src/main/java/org/ajax4jsf/webapp/PushEventsCounter.java
===================================================================
--- branches/RF-7944/core/impl/src/main/java/org/ajax4jsf/webapp/PushEventsCounter.java 2010-09-03 08:56:24 UTC (rev 19108)
+++ branches/RF-7944/core/impl/src/main/java/org/ajax4jsf/webapp/PushEventsCounter.java 2010-09-03 12:00:31 UTC (rev 19109)
@@ -21,11 +21,11 @@
package org.ajax4jsf.webapp;
-import org.ajax4jsf.event.PushEventListener;
-
import java.io.Serializable;
import java.util.EventObject;
+import org.ajax4jsf.event.PushEventListener;
+
public class PushEventsCounter implements PushEventListener, Serializable {
/**
Modified: branches/RF-7944/core/impl/src/main/java/org/ajax4jsf/webapp/ServletStreamWriter.java
===================================================================
--- branches/RF-7944/core/impl/src/main/java/org/ajax4jsf/webapp/ServletStreamWriter.java 2010-09-03 08:56:24 UTC (rev 19108)
+++ branches/RF-7944/core/impl/src/main/java/org/ajax4jsf/webapp/ServletStreamWriter.java 2010-09-03 12:00:31 UTC (rev 19109)
@@ -21,10 +21,11 @@
package org.ajax4jsf.webapp;
-import javax.servlet.ServletOutputStream;
import java.io.IOException;
import java.io.PrintWriter;
+import javax.servlet.ServletOutputStream;
+
/**
* HACK - for case if servlet response already use Writer, create wrapper to stream -
* since most of serializers use outputStream. In future, must be replaced by Dual serialization
Modified: branches/RF-7944/core/impl/src/main/java/org/ajax4jsf/webapp/WebXml.java
===================================================================
--- branches/RF-7944/core/impl/src/main/java/org/ajax4jsf/webapp/WebXml.java 2010-09-03 08:56:24 UTC (rev 19108)
+++ branches/RF-7944/core/impl/src/main/java/org/ajax4jsf/webapp/WebXml.java 2010-09-03 12:00:31 UTC (rev 19109)
@@ -31,8 +31,8 @@
import org.ajax4jsf.config.WebXMLParser;
import org.richfaces.VersionBean;
import org.richfaces.VersionBean.Version;
+import org.richfaces.log.Logger;
import org.richfaces.log.RichfacesLogger;
-import org.slf4j.Logger;
/**
* Parse at startup application web.xml and store servlet and filter mappings.
Modified: branches/RF-7944/core/impl/src/main/java/org/ajax4jsf/webapp/XMLResponseWriterState.java
===================================================================
--- branches/RF-7944/core/impl/src/main/java/org/ajax4jsf/webapp/XMLResponseWriterState.java 2010-09-03 08:56:24 UTC (rev 19108)
+++ branches/RF-7944/core/impl/src/main/java/org/ajax4jsf/webapp/XMLResponseWriterState.java 2010-09-03 12:00:31 UTC (rev 19109)
@@ -21,11 +21,12 @@
package org.ajax4jsf.webapp;
-import org.ajax4jsf.Messages;
+import java.io.IOException;
import javax.faces.component.UIComponent;
-import java.io.IOException;
+import org.ajax4jsf.Messages;
+
/**
* @author shura Class to implement state pattern for
* <code>ResponceWriter</code> Real states must extend this. By
Modified: branches/RF-7944/core/impl/src/main/java/org/richfaces/VersionBean.java
===================================================================
--- branches/RF-7944/core/impl/src/main/java/org/richfaces/VersionBean.java 2010-09-03 08:56:24 UTC (rev 19108)
+++ branches/RF-7944/core/impl/src/main/java/org/richfaces/VersionBean.java 2010-09-03 12:00:31 UTC (rev 19109)
@@ -22,16 +22,21 @@
package org.richfaces;
import java.io.IOException;
+import java.io.InputStream;
import java.net.JarURLConnection;
+import java.net.MalformedURLException;
import java.net.URL;
import java.net.URLConnection;
import java.security.CodeSource;
import java.security.ProtectionDomain;
import java.text.MessageFormat;
import java.util.jar.Attributes;
+import java.util.jar.JarFile;
import java.util.jar.JarInputStream;
import java.util.jar.Manifest;
+import org.ajax4jsf.resource.util.URLToStreamHelper;
+import org.richfaces.log.Logger;
import org.richfaces.log.RichfacesLogger;
/**
@@ -44,9 +49,6 @@
public static final Version VERSION = new Version();
- private static final org.slf4j.Logger LOGGER = RichfacesLogger.APPLICATION.getLogger();
-
-
/**
* Class for incapsulate version info.
*
@@ -55,6 +57,8 @@
*/
public static class Version {
+ private static final Logger LOGGER = RichfacesLogger.APPLICATION.getLogger();
+
private static final String UNKNOWN = "";
private String implementationVendor = UNKNOWN;
@@ -124,6 +128,30 @@
if (codeSource != null) {
URL url = codeSource.getLocation();
if (url != null) {
+ InputStream manifestStream = null;
+ try {
+ manifestStream = URLToStreamHelper.urlToStream(new URL(url, JarFile.MANIFEST_NAME));
+ return new Manifest(manifestStream);
+ } catch (MalformedURLException e1) {
+ //that's ok - just log in debug
+ if (LOGGER.isDebugEnabled()) {
+ LOGGER.debug(e1.getMessage(), e1);
+ }
+ } catch (IOException e) {
+ //that's ok - just log in debug
+ if (LOGGER.isDebugEnabled()) {
+ LOGGER.debug(e.getMessage(), e);
+ }
+ } finally {
+ if (manifestStream != null) {
+ try {
+ manifestStream.close();
+ } catch (IOException e) {
+ LOGGER.error(MessageFormat.format("Error closing stream: {0}", e.getMessage()), e);
+ }
+ }
+ }
+
JarInputStream jis = null;
try {
URLConnection urlConnection = url.openConnection();
Modified: branches/RF-7944/core/impl/src/main/java/org/richfaces/application/DefaultModule.java
===================================================================
--- branches/RF-7944/core/impl/src/main/java/org/richfaces/application/DefaultModule.java 2010-09-03 08:56:24 UTC (rev 19108)
+++ branches/RF-7944/core/impl/src/main/java/org/richfaces/application/DefaultModule.java 2010-09-03 12:00:31 UTC (rev 19109)
@@ -3,6 +3,7 @@
import org.ajax4jsf.cache.Cache;
import org.ajax4jsf.context.InitParametersStorage;
import org.ajax4jsf.renderkit.AJAXDataSerializer;
+import org.richfaces.l10n.BundleLoader;
import org.richfaces.resource.DefaultResourceCodec;
import org.richfaces.resource.ResourceCodec;
import org.richfaces.skin.SkinFactory;
@@ -18,6 +19,7 @@
factory.setInstance(Uptime.class, new Uptime());
factory.setInstance(DependencyInjector.class, new DependencyInjectionServiceImpl());
factory.setInstance(InitParametersStorage.class, new InitParametersStorage());
+ factory.setInstance(MessageFactory.class, new MessageFactoryImpl(new BundleLoader()));
}
}
Modified: branches/RF-7944/core/impl/src/main/java/org/richfaces/application/DependencyInjectionServiceImpl.java
===================================================================
--- branches/RF-7944/core/impl/src/main/java/org/richfaces/application/DependencyInjectionServiceImpl.java 2010-09-03 08:56:24 UTC (rev 19108)
+++ branches/RF-7944/core/impl/src/main/java/org/richfaces/application/DependencyInjectionServiceImpl.java 2010-09-03 12:00:31 UTC (rev 19109)
@@ -42,11 +42,11 @@
import javax.faces.FacesException;
import javax.faces.context.FacesContext;
+import org.richfaces.log.Logger;
import org.richfaces.log.RichfacesLogger;
import org.richfaces.resource.PostConstructResource;
import org.richfaces.resource.ResourceParameter;
import org.richfaces.resource.ResourceParameterELResolver;
-import org.slf4j.Logger;
/**
* @author Nick Belaevski
Modified: branches/RF-7944/core/impl/src/main/java/org/richfaces/application/InitializationListener.java
===================================================================
--- branches/RF-7944/core/impl/src/main/java/org/richfaces/application/InitializationListener.java 2010-09-03 08:56:24 UTC (rev 19108)
+++ branches/RF-7944/core/impl/src/main/java/org/richfaces/application/InitializationListener.java 2010-09-03 12:00:31 UTC (rev 19109)
@@ -39,8 +39,8 @@
import org.ajax4jsf.context.ContextInitParameters;
import org.richfaces.VersionBean;
+import org.richfaces.log.Logger;
import org.richfaces.log.RichfacesLogger;
-import org.slf4j.Logger;
/**
* @author Nick Belaevski
Copied: branches/RF-7944/core/impl/src/main/java/org/richfaces/application/MessageFactoryImpl.java (from rev 19108, trunk/core/impl/src/main/java/org/richfaces/application/MessageFactoryImpl.java)
===================================================================
--- branches/RF-7944/core/impl/src/main/java/org/richfaces/application/MessageFactoryImpl.java (rev 0)
+++ branches/RF-7944/core/impl/src/main/java/org/richfaces/application/MessageFactoryImpl.java 2010-09-03 12:00:31 UTC (rev 19109)
@@ -0,0 +1,192 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc. and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.richfaces.application;
+
+import java.text.MessageFormat;
+import java.util.Locale;
+import java.util.MissingResourceException;
+import java.util.ResourceBundle;
+
+import javax.faces.application.FacesMessage;
+import javax.faces.application.FacesMessage.Severity;
+import javax.faces.component.UIViewRoot;
+import javax.faces.context.FacesContext;
+
+import org.richfaces.l10n.BundleLoader;
+import org.richfaces.l10n.MessageBundle;
+
+/**
+ * @author Nick Belaevski
+ *
+ */
+public class MessageFactoryImpl implements MessageFactory {
+
+ protected static interface Factory<T> {
+
+ public T create(ResourceBundle bundle, Enum<?> messageKey, Object... args) throws MissingResourceException;
+
+ }
+
+ private static final Factory<FacesMessage> MESSAGE_FACTORY = new Factory<FacesMessage>() {
+
+ public FacesMessage create(ResourceBundle bundle, Enum<?> messageKey, Object... args)
+ throws MissingResourceException {
+
+ String messageId = messageKey.toString();
+
+ String summary = null;
+ String detail = null;
+
+ try {
+ summary = bundle.getString(messageId);
+ detail = bundle.getString(messageId + "_detail");
+ } catch (MissingResourceException e) {
+ // do nothing
+ }
+
+ if (summary != null) {
+ String formattedSummary = MessageFormat.format(summary, args);
+ String formattedDetail = null;
+
+ if (detail != null) {
+ formattedDetail = MessageFormat.format(detail, args);
+ }
+
+ return new FacesMessage(formattedSummary, formattedDetail);
+ }
+
+ return null;
+ }
+ };
+
+ private static final Factory<String> LABEL_FACTORY = new Factory<String>() {
+
+ public String create(ResourceBundle bundle, Enum<?> messageKey, Object... args) throws MissingResourceException {
+ String pattern = bundle.getString(messageKey.toString());
+ return MessageFormat.format(pattern, args);
+ }
+
+ };
+
+ private BundleLoader bundleLoader;
+
+ public MessageFactoryImpl(BundleLoader bundleLoader) {
+ super();
+ this.bundleLoader = bundleLoader;
+ }
+
+ private Locale detectLocale(FacesContext context) {
+ UIViewRoot viewRoot = context.getViewRoot();
+ if (viewRoot != null && viewRoot.getLocale() != null) {
+ return viewRoot.getLocale();
+ }
+
+ return null;
+ }
+
+ public FacesMessage createMessage(FacesContext facesContext, Enum<?> messageKey, Object... args) {
+ return createMessage(facesContext, FacesMessage.SEVERITY_INFO, messageKey, args);
+ }
+
+ public FacesMessage createMessage(FacesContext facesContext, Severity severity, Enum<?> messageKey, Object... args) {
+ if (facesContext == null) {
+ throw new NullPointerException("context");
+ }
+
+ if (severity == null) {
+ throw new NullPointerException("severity");
+ }
+
+ if (messageKey == null) {
+ throw new NullPointerException("messageKey");
+ }
+
+ FacesMessage result = detectLocalesAndCreate(facesContext, MESSAGE_FACTORY, messageKey, args);
+
+ if (result != null) {
+ result.setSeverity(severity);
+ }
+
+ return result;
+ }
+
+ public String getMessageText(FacesContext facesContext, Enum<?> messageKey, Object... args) {
+ String text = detectLocalesAndCreate(facesContext, LABEL_FACTORY, messageKey, args);
+ if (text == null) {
+ text = "???" + messageKey + "???";
+ }
+
+ return text;
+ }
+
+ protected <T> T detectLocalesAndCreate(FacesContext context, Factory<T> factory, Enum<?> messageKey, Object... args) {
+
+ T result = null;
+
+ Locale locale = detectLocale(context);
+ if (locale != null) {
+ result = create(context, factory, locale, messageKey, args);
+ }
+
+ if (result == null) {
+ Locale defaultLocale = Locale.getDefault();
+
+ if (!defaultLocale.equals(locale)) {
+ result = create(context, factory, defaultLocale, messageKey, args);
+ }
+
+ }
+
+ return result;
+ }
+
+ protected <T> T create(FacesContext context, Factory<T> factory, Locale locale, Enum<?> messageKey,
+ Object... args) {
+
+ MessageBundle messageBundle = messageKey.getClass().getAnnotation(MessageBundle.class);
+
+ if (messageBundle == null) {
+ return null;
+ }
+
+ T result = null;
+
+ try {
+ ResourceBundle bundle = bundleLoader.getApplicationBundle(context, messageKey, locale);
+ result = factory.create(bundle, messageKey, args);
+ } catch (MissingResourceException e) {
+ // do nothing
+ }
+
+ if (result == null) {
+ try {
+ ResourceBundle bundle = bundleLoader.getBundle(messageKey, locale);
+ result = factory.create(bundle, messageKey, args);
+ } catch (MissingResourceException e) {
+ // do nothing
+ }
+ }
+
+ return result;
+ }
+
+}
Modified: branches/RF-7944/core/impl/src/main/java/org/richfaces/component/UIDataAdaptor.java
===================================================================
--- branches/RF-7944/core/impl/src/main/java/org/richfaces/component/UIDataAdaptor.java 2010-09-03 08:56:24 UTC (rev 19108)
+++ branches/RF-7944/core/impl/src/main/java/org/richfaces/component/UIDataAdaptor.java 2010-09-03 12:00:31 UTC (rev 19109)
@@ -72,8 +72,8 @@
import org.ajax4jsf.model.Range;
import org.ajax4jsf.model.SerializableDataModel;
import org.richfaces.context.ExtendedVisitContext;
+import org.richfaces.log.Logger;
import org.richfaces.log.RichfacesLogger;
-import org.slf4j.Logger;
/**
* Base class for iterable components, like dataTable, Tomahawk dataList, Facelets repeat, tree etc., with support for
Modified: branches/RF-7944/core/impl/src/main/java/org/richfaces/component/UISequence.java
===================================================================
--- branches/RF-7944/core/impl/src/main/java/org/richfaces/component/UISequence.java 2010-09-03 08:56:24 UTC (rev 19108)
+++ branches/RF-7944/core/impl/src/main/java/org/richfaces/component/UISequence.java 2010-09-03 12:00:31 UTC (rev 19109)
@@ -277,7 +277,7 @@
int rowIndex = getRowIndex();
int rows = getRows();
- if (rows > 0) {
+ if (rows > 1) {
return rowIndex % rows;
}
Modified: branches/RF-7944/core/impl/src/main/java/org/richfaces/context/PartialViewContextImpl.java
===================================================================
--- branches/RF-7944/core/impl/src/main/java/org/richfaces/context/PartialViewContextImpl.java 2010-09-03 08:56:24 UTC (rev 19108)
+++ branches/RF-7944/core/impl/src/main/java/org/richfaces/context/PartialViewContextImpl.java 2010-09-03 12:00:31 UTC (rev 19109)
@@ -45,8 +45,8 @@
import org.ajax4jsf.context.AjaxContext;
import org.ajax4jsf.renderkit.AjaxRendererUtils;
import org.richfaces.component.MetaComponentEncoder;
+import org.richfaces.log.Logger;
import org.richfaces.log.RichfacesLogger;
-import org.slf4j.Logger;
/**
* @author Nick Belaevski
Modified: branches/RF-7944/core/impl/src/main/java/org/richfaces/resource/AbstractBaseResource.java
===================================================================
--- branches/RF-7944/core/impl/src/main/java/org/richfaces/resource/AbstractBaseResource.java 2010-09-03 08:56:24 UTC (rev 19108)
+++ branches/RF-7944/core/impl/src/main/java/org/richfaces/resource/AbstractBaseResource.java 2010-09-03 12:00:31 UTC (rev 19109)
@@ -39,9 +39,9 @@
import org.richfaces.application.ServiceTracker;
import org.richfaces.application.Uptime;
+import org.richfaces.log.Logger;
import org.richfaces.log.RichfacesLogger;
import org.richfaces.util.Util;
-import org.slf4j.Logger;
/**
* @author Nick Belaevski
Modified: branches/RF-7944/core/impl/src/main/java/org/richfaces/resource/AbstractCacheableResource.java
===================================================================
--- branches/RF-7944/core/impl/src/main/java/org/richfaces/resource/AbstractCacheableResource.java 2010-09-03 08:56:24 UTC (rev 19108)
+++ branches/RF-7944/core/impl/src/main/java/org/richfaces/resource/AbstractCacheableResource.java 2010-09-03 12:00:31 UTC (rev 19109)
@@ -31,9 +31,9 @@
import javax.faces.context.FacesContext;
import org.ajax4jsf.context.ContextInitParameters;
+import org.richfaces.log.Logger;
import org.richfaces.log.RichfacesLogger;
import org.richfaces.util.Util;
-import org.slf4j.Logger;
/**
* @author Nick Belaevski
Modified: branches/RF-7944/core/impl/src/main/java/org/richfaces/resource/CachedResourceImpl.java
===================================================================
--- branches/RF-7944/core/impl/src/main/java/org/richfaces/resource/CachedResourceImpl.java 2010-09-03 08:56:24 UTC (rev 19108)
+++ branches/RF-7944/core/impl/src/main/java/org/richfaces/resource/CachedResourceImpl.java 2010-09-03 12:00:31 UTC (rev 19109)
@@ -41,9 +41,9 @@
import org.ajax4jsf.io.ByteBuffer;
import org.ajax4jsf.io.FastBufferInputStream;
import org.ajax4jsf.io.FastBufferOutputStream;
+import org.richfaces.log.Logger;
import org.richfaces.log.RichfacesLogger;
import org.richfaces.util.Util;
-import org.slf4j.Logger;
/**
* @author Nick Belaevski
Modified: branches/RF-7944/core/impl/src/main/java/org/richfaces/resource/CompiledCSSResource.java
===================================================================
--- branches/RF-7944/core/impl/src/main/java/org/richfaces/resource/CompiledCSSResource.java 2010-09-03 08:56:24 UTC (rev 19108)
+++ branches/RF-7944/core/impl/src/main/java/org/richfaces/resource/CompiledCSSResource.java 2010-09-03 12:00:31 UTC (rev 19109)
@@ -33,11 +33,11 @@
import javax.faces.application.Resource;
import javax.faces.context.FacesContext;
+import org.richfaces.log.Logger;
import org.richfaces.log.RichfacesLogger;
import org.richfaces.resource.css.CSSVisitorImpl;
import org.richfaces.skin.Skin;
import org.richfaces.skin.SkinFactory;
-import org.slf4j.Logger;
import org.w3c.css.sac.CSSException;
import org.w3c.css.sac.CSSParseException;
import org.w3c.css.sac.ErrorHandler;
Modified: branches/RF-7944/core/impl/src/main/java/org/richfaces/resource/ResourceFactoryImpl.java
===================================================================
--- branches/RF-7944/core/impl/src/main/java/org/richfaces/resource/ResourceFactoryImpl.java 2010-09-03 08:56:24 UTC (rev 19108)
+++ branches/RF-7944/core/impl/src/main/java/org/richfaces/resource/ResourceFactoryImpl.java 2010-09-03 12:00:31 UTC (rev 19109)
@@ -29,12 +29,15 @@
import java.util.Properties;
import java.util.Set;
+import javax.faces.application.ProjectStage;
import javax.faces.application.Resource;
import javax.faces.application.ResourceHandler;
import javax.faces.context.FacesContext;
import org.richfaces.application.DependencyInjector;
import org.richfaces.application.ServiceTracker;
+import org.richfaces.log.Logger;
+import org.richfaces.log.RichfacesLogger;
import org.richfaces.util.PropertiesUtil;
import org.richfaces.util.Util;
@@ -49,7 +52,7 @@
private static final Joiner RESOURCE_QUALIFIER_JOINER = Joiner.on(':').skipNulls();
- private static final ResourceLogger LOGGER = ResourceLogger.INSTANCE;
+ private static final Logger LOGGER = RichfacesLogger.RESOURCE.getLogger();
private static class ExternalStaticResourceFactory {
@@ -100,6 +103,28 @@
initializeExternalResourcesMap();
}
+ private void logResourceProblem(FacesContext context, Throwable throwable, String messagePattern,
+ Object... arguments) {
+ boolean isProductionStage = context.isProjectStage(ProjectStage.Production);
+
+ if (LOGGER.isWarnEnabled() || (!isProductionStage && LOGGER.isInfoEnabled())) {
+ String formattedMessage = MessageFormat.format(messagePattern, arguments);
+
+ if (throwable != null) {
+ LOGGER.warn(formattedMessage, throwable);
+ } else {
+ if (isProductionStage) {
+ LOGGER.info(formattedMessage);
+ } else {
+ LOGGER.warn(formattedMessage);
+ }
+ }
+ }
+ }
+
+ private void logMissingResource(FacesContext context, String resourceData) {
+ logResourceProblem(context, null, "Resource {0} was not found", resourceData);
+ }
private String getResourceNameFromQualifier(String qualifier) {
int idx = qualifier.lastIndexOf(':');
if (idx < 0) {
@@ -252,10 +277,10 @@
} catch (ClassNotFoundException e) {
// do nothing
} catch (Exception e) {
- LOGGER.logResourceProblem(FacesContext.getCurrentInstance(), e, "Error creating resource {0}",
+ logResourceProblem(FacesContext.getCurrentInstance(), e, "Error creating resource {0}",
resourceName);
} catch (LinkageError e) {
- LOGGER.logResourceProblem(FacesContext.getCurrentInstance(), e, "Error creating resource {0}",
+ logResourceProblem(FacesContext.getCurrentInstance(), e, "Error creating resource {0}",
resourceName);
}
}
@@ -274,7 +299,7 @@
Resource resource = createResource(resourceName, libraryName, null);
if (resource == null) {
- LOGGER.logMissingResource(context, resourceData.getResourceKey());
+ logMissingResource(context, resourceData.getResourceKey());
return null;
}
@@ -289,7 +314,7 @@
}
if ((existingVersion != null) && (requestedVersion != null) && !existingVersion.equals(requestedVersion)) {
- LOGGER.logResourceProblem(context, null, "Resource {0} of version {1} was not found", resourceName,
+ logResourceProblem(context, null, "Resource {0} of version {1} was not found", resourceName,
requestedVersion);
return null;
}
Modified: branches/RF-7944/core/impl/src/main/java/org/richfaces/resource/ResourceHandlerImpl.java
===================================================================
--- branches/RF-7944/core/impl/src/main/java/org/richfaces/resource/ResourceHandlerImpl.java 2010-09-03 08:56:24 UTC (rev 19108)
+++ branches/RF-7944/core/impl/src/main/java/org/richfaces/resource/ResourceHandlerImpl.java 2010-09-03 12:00:31 UTC (rev 19109)
@@ -40,6 +40,8 @@
import org.ajax4jsf.cache.Cache;
import org.richfaces.application.ServiceTracker;
+import org.richfaces.log.Logger;
+import org.richfaces.log.RichfacesLogger;
import org.richfaces.util.RequestStateManager.BooleanRequestStateVariable;
import org.richfaces.util.Util;
@@ -53,7 +55,7 @@
public static final String RESOURCE_CACHE_NAME = "org.richfaces.ResourcesCache";
public static final String HANDLER_START_TIME_ATTRIBUTE = ResourceHandlerImpl.class.getName() + ":StartTime";
- private static final ResourceLogger LOGGER = ResourceLogger.INSTANCE;
+ private static final Logger LOGGER = RichfacesLogger.RESOURCE.getLogger();
private ResourceFactory resourceFactory;
Deleted: branches/RF-7944/core/impl/src/main/java/org/richfaces/resource/ResourceLogger.java
===================================================================
--- branches/RF-7944/core/impl/src/main/java/org/richfaces/resource/ResourceLogger.java 2010-09-03 08:56:24 UTC (rev 19108)
+++ branches/RF-7944/core/impl/src/main/java/org/richfaces/resource/ResourceLogger.java 2010-09-03 12:00:31 UTC (rev 19109)
@@ -1,313 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2010, Red Hat, Inc. and individual contributors
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.richfaces.resource;
-
-import java.text.MessageFormat;
-
-import javax.faces.application.ProjectStage;
-import javax.faces.context.FacesContext;
-
-import org.richfaces.log.RichfacesLogger;
-import org.slf4j.Logger;
-import org.slf4j.Marker;
-
-/**
- * @author Nick Belaevski
- *
- */
-final class ResourceLogger implements Logger {
-
- static final ResourceLogger INSTANCE = new ResourceLogger();
-
- private static final Logger LOGGER = RichfacesLogger.RESOURCE.getLogger();
-
- private ResourceLogger() {}
-
- void logResourceProblem(FacesContext context, Throwable throwable, String messagePattern,
- Object... arguments) {
- boolean isProductionStage = context.isProjectStage(ProjectStage.Production);
-
- if (LOGGER.isWarnEnabled() || (!isProductionStage && LOGGER.isInfoEnabled())) {
- String formattedMessage = MessageFormat.format(messagePattern, arguments);
-
- if (throwable != null) {
- LOGGER.warn(formattedMessage, throwable);
- } else {
- if (isProductionStage) {
- LOGGER.info(formattedMessage);
- } else {
- LOGGER.warn(formattedMessage);
- }
- }
- }
- }
-
- void logMissingResource(FacesContext context, String resourceData) {
- logResourceProblem(context, null, "Resource {0} was not found", resourceData);
- }
-
- public String getName() {
- return LOGGER.getName();
- }
-
- public boolean isTraceEnabled() {
- return LOGGER.isTraceEnabled();
- }
-
- public void trace(String msg) {
- LOGGER.trace(msg);
- }
-
- public void trace(String format, Object arg) {
- LOGGER.trace(format, arg);
- }
-
- public void trace(String format, Object arg1, Object arg2) {
- LOGGER.trace(format, arg1, arg2);
- }
-
- public void trace(String format, Object[] argArray) {
- LOGGER.trace(format, argArray);
- }
-
- public void trace(String msg, Throwable t) {
- LOGGER.trace(msg, t);
- }
-
- public boolean isTraceEnabled(Marker marker) {
- return LOGGER.isTraceEnabled(marker);
- }
-
- public void trace(Marker marker, String msg) {
- LOGGER.trace(marker, msg);
- }
-
- public void trace(Marker marker, String format, Object arg) {
- LOGGER.trace(marker, format, arg);
- }
-
- public void trace(Marker marker, String format, Object arg1, Object arg2) {
- LOGGER.trace(marker, format, arg1, arg2);
- }
-
- public void trace(Marker marker, String format, Object[] argArray) {
- LOGGER.trace(marker, format, argArray);
- }
-
- public void trace(Marker marker, String msg, Throwable t) {
- LOGGER.trace(marker, msg, t);
- }
-
- public boolean isDebugEnabled() {
- return LOGGER.isDebugEnabled();
- }
-
- public void debug(String msg) {
- LOGGER.debug(msg);
- }
-
- public void debug(String format, Object arg) {
- LOGGER.debug(format, arg);
- }
-
- public void debug(String format, Object arg1, Object arg2) {
- LOGGER.debug(format, arg1, arg2);
- }
-
- public void debug(String format, Object[] argArray) {
- LOGGER.debug(format, argArray);
- }
-
- public void debug(String msg, Throwable t) {
- LOGGER.debug(msg, t);
- }
-
- public boolean isDebugEnabled(Marker marker) {
- return LOGGER.isDebugEnabled(marker);
- }
-
- public void debug(Marker marker, String msg) {
- LOGGER.debug(marker, msg);
- }
-
- public void debug(Marker marker, String format, Object arg) {
- LOGGER.debug(marker, format, arg);
- }
-
- public void debug(Marker marker, String format, Object arg1, Object arg2) {
- LOGGER.debug(marker, format, arg1, arg2);
- }
-
- public void debug(Marker marker, String format, Object[] argArray) {
- LOGGER.debug(marker, format, argArray);
- }
-
- public void debug(Marker marker, String msg, Throwable t) {
- LOGGER.debug(marker, msg, t);
- }
-
- public boolean isInfoEnabled() {
- return LOGGER.isInfoEnabled();
- }
-
- public void info(String msg) {
- LOGGER.info(msg);
- }
-
- public void info(String format, Object arg) {
- LOGGER.info(format, arg);
- }
-
- public void info(String format, Object arg1, Object arg2) {
- LOGGER.info(format, arg1, arg2);
- }
-
- public void info(String format, Object[] argArray) {
- LOGGER.info(format, argArray);
- }
-
- public void info(String msg, Throwable t) {
- LOGGER.info(msg, t);
- }
-
- public boolean isInfoEnabled(Marker marker) {
- return LOGGER.isInfoEnabled(marker);
- }
-
- public void info(Marker marker, String msg) {
- LOGGER.info(marker, msg);
- }
-
- public void info(Marker marker, String format, Object arg) {
- LOGGER.info(marker, format, arg);
- }
-
- public void info(Marker marker, String format, Object arg1, Object arg2) {
- LOGGER.info(marker, format, arg1, arg2);
- }
-
- public void info(Marker marker, String format, Object[] argArray) {
- LOGGER.info(marker, format, argArray);
- }
-
- public void info(Marker marker, String msg, Throwable t) {
- LOGGER.info(marker, msg, t);
- }
-
- public boolean isWarnEnabled() {
- return LOGGER.isWarnEnabled();
- }
-
- public void warn(String msg) {
- LOGGER.warn(msg);
- }
-
- public void warn(String format, Object arg) {
- LOGGER.warn(format, arg);
- }
-
- public void warn(String format, Object[] argArray) {
- LOGGER.warn(format, argArray);
- }
-
- public void warn(String format, Object arg1, Object arg2) {
- LOGGER.warn(format, arg1, arg2);
- }
-
- public void warn(String msg, Throwable t) {
- LOGGER.warn(msg, t);
- }
-
- public boolean isWarnEnabled(Marker marker) {
- return LOGGER.isWarnEnabled(marker);
- }
-
- public void warn(Marker marker, String msg) {
- LOGGER.warn(marker, msg);
- }
-
- public void warn(Marker marker, String format, Object arg) {
- LOGGER.warn(marker, format, arg);
- }
-
- public void warn(Marker marker, String format, Object arg1, Object arg2) {
- LOGGER.warn(marker, format, arg1, arg2);
- }
-
- public void warn(Marker marker, String format, Object[] argArray) {
- LOGGER.warn(marker, format, argArray);
- }
-
- public void warn(Marker marker, String msg, Throwable t) {
- LOGGER.warn(marker, msg, t);
- }
-
- public boolean isErrorEnabled() {
- return LOGGER.isErrorEnabled();
- }
-
- public void error(String msg) {
- LOGGER.error(msg);
- }
-
- public void error(String format, Object arg) {
- LOGGER.error(format, arg);
- }
-
- public void error(String format, Object arg1, Object arg2) {
- LOGGER.error(format, arg1, arg2);
- }
-
- public void error(String format, Object[] argArray) {
- LOGGER.error(format, argArray);
- }
-
- public void error(String msg, Throwable t) {
- LOGGER.error(msg, t);
- }
-
- public boolean isErrorEnabled(Marker marker) {
- return LOGGER.isErrorEnabled(marker);
- }
-
- public void error(Marker marker, String msg) {
- LOGGER.error(marker, msg);
- }
-
- public void error(Marker marker, String format, Object arg) {
- LOGGER.error(marker, format, arg);
- }
-
- public void error(Marker marker, String format, Object arg1, Object arg2) {
- LOGGER.error(marker, format, arg1, arg2);
- }
-
- public void error(Marker marker, String format, Object[] argArray) {
- LOGGER.error(marker, format, argArray);
- }
-
- public void error(Marker marker, String msg, Throwable t) {
- LOGGER.error(marker, msg, t);
- }
-
-
-}
Modified: branches/RF-7944/core/impl/src/main/java/org/richfaces/resource/css/CSSVisitorImpl.java
===================================================================
--- branches/RF-7944/core/impl/src/main/java/org/richfaces/resource/css/CSSVisitorImpl.java 2010-09-03 08:56:24 UTC (rev 19108)
+++ branches/RF-7944/core/impl/src/main/java/org/richfaces/resource/css/CSSVisitorImpl.java 2010-09-03 12:00:31 UTC (rev 19109)
@@ -32,8 +32,8 @@
import javax.faces.context.FacesContext;
import org.ajax4jsf.util.ELUtils;
+import org.richfaces.log.Logger;
import org.richfaces.log.RichfacesLogger;
-import org.slf4j.Logger;
import org.w3c.dom.css.CSSCharsetRule;
import org.w3c.dom.css.CSSFontFaceRule;
import org.w3c.dom.css.CSSImportRule;
Modified: branches/RF-7944/core/impl/src/main/java/org/richfaces/util/PropertiesUtil.java
===================================================================
--- branches/RF-7944/core/impl/src/main/java/org/richfaces/util/PropertiesUtil.java 2010-09-03 08:56:24 UTC (rev 19108)
+++ branches/RF-7944/core/impl/src/main/java/org/richfaces/util/PropertiesUtil.java 2010-09-03 12:00:31 UTC (rev 19109)
@@ -29,8 +29,8 @@
import java.util.Properties;
import org.ajax4jsf.resource.util.URLToStreamHelper;
+import org.richfaces.log.Logger;
import org.richfaces.log.RichfacesLogger;
-import org.slf4j.Logger;
/**
* @author Nick Belaevski
Modified: branches/RF-7944/core/impl/src/main/java/org/richfaces/util/Util.java
===================================================================
--- branches/RF-7944/core/impl/src/main/java/org/richfaces/util/Util.java 2010-09-03 08:56:24 UTC (rev 19108)
+++ branches/RF-7944/core/impl/src/main/java/org/richfaces/util/Util.java 2010-09-03 12:00:31 UTC (rev 19109)
@@ -82,9 +82,9 @@
import org.ajax4jsf.Messages;
import org.ajax4jsf.util.base64.Codec;
+import org.richfaces.log.Logger;
import org.richfaces.log.RichfacesLogger;
import org.richfaces.resource.StateHolderResource;
-import org.slf4j.Logger;
/**
* @author Nick Belaevski
Modified: branches/RF-7944/core/impl/src/main/resources/META-INF/resources/richfaces-queue.js
===================================================================
--- branches/RF-7944/core/impl/src/main/resources/META-INF/resources/richfaces-queue.js 2010-09-03 08:56:24 UTC (rev 19108)
+++ branches/RF-7944/core/impl/src/main/resources/META-INF/resources/richfaces-queue.js 2010-09-03 12:00:31 UTC (rev 19109)
@@ -105,6 +105,10 @@
}
}
}
+
+ if (typeof this.queueOptions.requestGroupId == "undefined") {
+ this.queueOptions.requestGroupId = typeof this.source == "string" ? this.source : this.source.id;
+ }
// copy of event should be created otherwise IE will fail
this.event = $.extend({}, event);
Modified: branches/RF-7944/core/impl/src/main/resources/META-INF/resources/richfaces.js
===================================================================
--- branches/RF-7944/core/impl/src/main/resources/META-INF/resources/richfaces.js 2010-09-03 08:56:24 UTC (rev 19108)
+++ branches/RF-7944/core/impl/src/main/resources/META-INF/resources/richfaces.js 2010-09-03 12:00:31 UTC (rev 19109)
@@ -128,7 +128,7 @@
//there is the same pattern in server-side code:
//org.ajax4jsf.javascript.ScriptUtils.escapeCSSMetachars(String)
- var CSS_METACHARS_PATTERN = /([#;&,.+*~':"!^$[\]()=>|\/])/g;
+ var CSS_METACHARS_PATTERN = /([#;&,.+*~':"!^$\[\]()=>|\/])/g;
/**
* Escapes CSS meta-characters in string according to
Copied: branches/RF-7944/core/impl/src/test/java/org/richfaces/application (from rev 19108, trunk/core/impl/src/test/java/org/richfaces/application)
Deleted: branches/RF-7944/core/impl/src/test/java/org/richfaces/application/MessageFactoryImplTest.java
===================================================================
--- trunk/core/impl/src/test/java/org/richfaces/application/MessageFactoryImplTest.java 2010-09-03 08:56:24 UTC (rev 19108)
+++ branches/RF-7944/core/impl/src/test/java/org/richfaces/application/MessageFactoryImplTest.java 2010-09-03 12:00:31 UTC (rev 19109)
@@ -1,162 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2010, Red Hat, Inc. and individual contributors
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.richfaces.application;
-
-import static org.easymock.EasyMock.expect;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotNull;
-
-import java.util.Locale;
-
-import javax.faces.application.FacesMessage;
-import javax.faces.component.UIViewRoot;
-
-import org.jboss.test.faces.mock.MockFacesEnvironment;
-import org.junit.After;
-import org.junit.Before;
-import org.junit.Test;
-import org.richfaces.l10n.BundleLoader;
-
-/**
- * @author Nick Belaevski
- *
- */
-public class MessageFactoryImplTest {
-
- private MockFacesEnvironment facesEnvironment;
-
- private MessageFactory messageFactory;
-
- @Before
- public void setUp() throws Exception {
- Locale.setDefault(Locale.US);
-
- facesEnvironment = MockFacesEnvironment.createEnvironment().withApplication();
-
- messageFactory = new MessageFactoryImpl(new BundleLoader());
- }
-
- @After
- public void tearDown() throws Exception {
- facesEnvironment.verify();
- facesEnvironment.release();
- facesEnvironment = null;
-
- messageFactory = null;
- }
-
- @Test
- public void testCreateMessageFromFacesBundle() throws Exception {
- expect(facesEnvironment.getFacesContext().getViewRoot()).andStubReturn(null);
- expect(facesEnvironment.getApplication().getMessageBundle()).andStubReturn(null);
- facesEnvironment.replay();
-
- // {1}: Could not convert ''{0}'' to a string.
- FacesMessage stringConverterMessage = messageFactory.createMessage(facesEnvironment.getFacesContext(),
- FacesMessages.CONVERTER_STRING, "something", "Message");
-
- assertNotNull(stringConverterMessage);
- assertEquals(FacesMessage.SEVERITY_INFO, stringConverterMessage.getSeverity());
- assertEquals("Message: Could not convert 'something' to a string.", stringConverterMessage.getSummary());
- assertEquals(stringConverterMessage.getSummary(), stringConverterMessage.getDetail());
-
- // javax.faces.converter.EnumConverter.ENUM={2}: ''{0}'' must be convertible to an enum.
- // javax.faces.converter.EnumConverter.ENUM_detail={2}: ''{0}'' must be convertible to an enum from the enum that contains the constant ''{1}''.
- FacesMessage longConverterMessage = messageFactory.createMessage(facesEnvironment.getFacesContext(),
- FacesMessage.SEVERITY_ERROR, FacesMessages.ENUM_CONVERTER_ENUM, "field", "anotherField", "Failed");
- assertNotNull(longConverterMessage);
- assertEquals(FacesMessage.SEVERITY_ERROR, longConverterMessage.getSeverity());
- assertEquals("Failed: 'field' must be convertible to an enum.", longConverterMessage.getSummary());
- assertEquals(
- "Failed: 'field' must be convertible to an enum from the enum that contains the constant 'anotherField'.",
- longConverterMessage.getDetail());
- }
-
- @Test
- public void testGetMessageTextFromFacesBundle() throws Exception {
- expect(facesEnvironment.getFacesContext().getViewRoot()).andStubReturn(null);
- expect(facesEnvironment.getApplication().getMessageBundle()).andStubReturn(null);
- facesEnvironment.replay();
-
- // {1}: Could not convert ''{0}'' to a string.
- String message = messageFactory.getMessageText(facesEnvironment.getFacesContext(),
- FacesMessages.CONVERTER_STRING, "something", "Message");
-
- assertEquals("Message: Could not convert 'something' to a string.", message);
- }
-
- @Test
- public void testCreateMessageFromApplicationBundle() throws Exception {
- UIViewRoot mockViewRoot = facesEnvironment.createMock(UIViewRoot.class);
- expect(mockViewRoot.getLocale()).andStubReturn(new Locale("ru", "RU"));
- expect(facesEnvironment.getFacesContext().getViewRoot()).andStubReturn(mockViewRoot);
- expect(facesEnvironment.getApplication().getMessageBundle()).andStubReturn("org.richfaces.application.MessageFactoryImplTest");
- facesEnvironment.replay();
-
- // {1}: ''{0}'' ne konvertiruyetsia v stroku.
- FacesMessage stringConverterMessage = messageFactory.createMessage(facesEnvironment.getFacesContext(),
- FacesMessages.CONVERTER_STRING, "something", "Message");
-
- assertNotNull(stringConverterMessage);
- assertEquals(FacesMessage.SEVERITY_INFO, stringConverterMessage.getSeverity());
- assertEquals("Message: 'something' ne konvertiruyetsia v stroku.", stringConverterMessage.getSummary());
- assertEquals(stringConverterMessage.getSummary(), stringConverterMessage.getDetail());
-
- // javax.faces.converter.EnumConverter.ENUM={2}: ''{0}'' dolzhno konvertirovat''sia v enum.
- // javax.faces.converter.EnumConverter.ENUM_detail={2}: ''{0}'' dolzhno konvertirovat''sia v enum iz enum s konstantoj ''{1}''.
- FacesMessage longConverterMessage = messageFactory.createMessage(facesEnvironment.getFacesContext(),
- FacesMessage.SEVERITY_ERROR, FacesMessages.ENUM_CONVERTER_ENUM, "field", "anotherField", "Failed");
- assertNotNull(longConverterMessage);
- assertEquals(FacesMessage.SEVERITY_ERROR, longConverterMessage.getSeverity());
- assertEquals("Failed: 'field' dolzhno konvertirovat'sia v enum.", longConverterMessage.getSummary());
- assertEquals(
- "Failed: 'field' dolzhno konvertirovat'sia v enum iz enum s konstantoj 'anotherField'.",
- longConverterMessage.getDetail());
-
- // javax.faces.component.UIInput.CONVERSION={0}: Conversion error occurred.
- FacesMessage inputConversionMessage = messageFactory.createMessage(facesEnvironment.getFacesContext(),
- FacesMessages.UIINPUT_CONVERSION, "Failure message");
- assertNotNull(inputConversionMessage);
- assertEquals(FacesMessage.SEVERITY_INFO, inputConversionMessage.getSeverity());
- assertEquals("Failure message: Conversion error occurred.", inputConversionMessage.getSummary());
- }
-
- @Test
- public void testGetMessageTextFromApplicationBundle() throws Exception {
- UIViewRoot mockViewRoot = facesEnvironment.createMock(UIViewRoot.class);
- expect(mockViewRoot.getLocale()).andStubReturn(new Locale("ru", "RU"));
- expect(facesEnvironment.getFacesContext().getViewRoot()).andStubReturn(mockViewRoot);
- expect(facesEnvironment.getApplication().getMessageBundle()).andStubReturn("org.richfaces.application.MessageFactoryImplTest");
- facesEnvironment.replay();
-
- // {1}: ''{0}'' ne konvertiruyetsia v stroku.
- String message = messageFactory.getMessageText(facesEnvironment.getFacesContext(),
- FacesMessages.CONVERTER_STRING, "something", "Message");
-
- assertEquals("Message: 'something' ne konvertiruyetsia v stroku.", message);
-
- // javax.faces.component.UIInput.CONVERSION={0}: Conversion error occurred.
- String otherMessage = messageFactory.getMessageText(facesEnvironment.getFacesContext(),
- FacesMessages.UIINPUT_CONVERSION, "Failure message");
- assertEquals("Failure message: Conversion error occurred.", otherMessage);
- }
-}
Copied: branches/RF-7944/core/impl/src/test/java/org/richfaces/application/MessageFactoryImplTest.java (from rev 19108, trunk/core/impl/src/test/java/org/richfaces/application/MessageFactoryImplTest.java)
===================================================================
--- branches/RF-7944/core/impl/src/test/java/org/richfaces/application/MessageFactoryImplTest.java (rev 0)
+++ branches/RF-7944/core/impl/src/test/java/org/richfaces/application/MessageFactoryImplTest.java 2010-09-03 12:00:31 UTC (rev 19109)
@@ -0,0 +1,162 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc. and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.richfaces.application;
+
+import static org.easymock.EasyMock.expect;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+
+import java.util.Locale;
+
+import javax.faces.application.FacesMessage;
+import javax.faces.component.UIViewRoot;
+
+import org.jboss.test.faces.mock.MockFacesEnvironment;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+import org.richfaces.l10n.BundleLoader;
+
+/**
+ * @author Nick Belaevski
+ *
+ */
+public class MessageFactoryImplTest {
+
+ private MockFacesEnvironment facesEnvironment;
+
+ private MessageFactory messageFactory;
+
+ @Before
+ public void setUp() throws Exception {
+ Locale.setDefault(Locale.US);
+
+ facesEnvironment = MockFacesEnvironment.createEnvironment().withApplication();
+
+ messageFactory = new MessageFactoryImpl(new BundleLoader());
+ }
+
+ @After
+ public void tearDown() throws Exception {
+ facesEnvironment.verify();
+ facesEnvironment.release();
+ facesEnvironment = null;
+
+ messageFactory = null;
+ }
+
+ @Test
+ public void testCreateMessageFromFacesBundle() throws Exception {
+ expect(facesEnvironment.getFacesContext().getViewRoot()).andStubReturn(null);
+ expect(facesEnvironment.getApplication().getMessageBundle()).andStubReturn(null);
+ facesEnvironment.replay();
+
+ // {1}: Could not convert ''{0}'' to a string.
+ FacesMessage stringConverterMessage = messageFactory.createMessage(facesEnvironment.getFacesContext(),
+ FacesMessages.CONVERTER_STRING, "something", "Message");
+
+ assertNotNull(stringConverterMessage);
+ assertEquals(FacesMessage.SEVERITY_INFO, stringConverterMessage.getSeverity());
+ assertEquals("Message: Could not convert 'something' to a string.", stringConverterMessage.getSummary());
+ assertEquals(stringConverterMessage.getSummary(), stringConverterMessage.getDetail());
+
+ // javax.faces.converter.EnumConverter.ENUM={2}: ''{0}'' must be convertible to an enum.
+ // javax.faces.converter.EnumConverter.ENUM_detail={2}: ''{0}'' must be convertible to an enum from the enum that contains the constant ''{1}''.
+ FacesMessage longConverterMessage = messageFactory.createMessage(facesEnvironment.getFacesContext(),
+ FacesMessage.SEVERITY_ERROR, FacesMessages.ENUM_CONVERTER_ENUM, "field", "anotherField", "Failed");
+ assertNotNull(longConverterMessage);
+ assertEquals(FacesMessage.SEVERITY_ERROR, longConverterMessage.getSeverity());
+ assertEquals("Failed: 'field' must be convertible to an enum.", longConverterMessage.getSummary());
+ assertEquals(
+ "Failed: 'field' must be convertible to an enum from the enum that contains the constant 'anotherField'.",
+ longConverterMessage.getDetail());
+ }
+
+ @Test
+ public void testGetMessageTextFromFacesBundle() throws Exception {
+ expect(facesEnvironment.getFacesContext().getViewRoot()).andStubReturn(null);
+ expect(facesEnvironment.getApplication().getMessageBundle()).andStubReturn(null);
+ facesEnvironment.replay();
+
+ // {1}: Could not convert ''{0}'' to a string.
+ String message = messageFactory.getMessageText(facesEnvironment.getFacesContext(),
+ FacesMessages.CONVERTER_STRING, "something", "Message");
+
+ assertEquals("Message: Could not convert 'something' to a string.", message);
+ }
+
+ @Test
+ public void testCreateMessageFromApplicationBundle() throws Exception {
+ UIViewRoot mockViewRoot = facesEnvironment.createMock(UIViewRoot.class);
+ expect(mockViewRoot.getLocale()).andStubReturn(new Locale("ru", "RU"));
+ expect(facesEnvironment.getFacesContext().getViewRoot()).andStubReturn(mockViewRoot);
+ expect(facesEnvironment.getApplication().getMessageBundle()).andStubReturn("org.richfaces.application.MessageFactoryImplTest");
+ facesEnvironment.replay();
+
+ // {1}: ''{0}'' ne konvertiruyetsia v stroku.
+ FacesMessage stringConverterMessage = messageFactory.createMessage(facesEnvironment.getFacesContext(),
+ FacesMessages.CONVERTER_STRING, "something", "Message");
+
+ assertNotNull(stringConverterMessage);
+ assertEquals(FacesMessage.SEVERITY_INFO, stringConverterMessage.getSeverity());
+ assertEquals("Message: 'something' ne konvertiruyetsia v stroku.", stringConverterMessage.getSummary());
+ assertEquals(stringConverterMessage.getSummary(), stringConverterMessage.getDetail());
+
+ // javax.faces.converter.EnumConverter.ENUM={2}: ''{0}'' dolzhno konvertirovat''sia v enum.
+ // javax.faces.converter.EnumConverter.ENUM_detail={2}: ''{0}'' dolzhno konvertirovat''sia v enum iz enum s konstantoj ''{1}''.
+ FacesMessage longConverterMessage = messageFactory.createMessage(facesEnvironment.getFacesContext(),
+ FacesMessage.SEVERITY_ERROR, FacesMessages.ENUM_CONVERTER_ENUM, "field", "anotherField", "Failed");
+ assertNotNull(longConverterMessage);
+ assertEquals(FacesMessage.SEVERITY_ERROR, longConverterMessage.getSeverity());
+ assertEquals("Failed: 'field' dolzhno konvertirovat'sia v enum.", longConverterMessage.getSummary());
+ assertEquals(
+ "Failed: 'field' dolzhno konvertirovat'sia v enum iz enum s konstantoj 'anotherField'.",
+ longConverterMessage.getDetail());
+
+ // javax.faces.component.UIInput.CONVERSION={0}: Conversion error occurred.
+ FacesMessage inputConversionMessage = messageFactory.createMessage(facesEnvironment.getFacesContext(),
+ FacesMessages.UIINPUT_CONVERSION, "Failure message");
+ assertNotNull(inputConversionMessage);
+ assertEquals(FacesMessage.SEVERITY_INFO, inputConversionMessage.getSeverity());
+ assertEquals("Failure message: Conversion error occurred.", inputConversionMessage.getSummary());
+ }
+
+ @Test
+ public void testGetMessageTextFromApplicationBundle() throws Exception {
+ UIViewRoot mockViewRoot = facesEnvironment.createMock(UIViewRoot.class);
+ expect(mockViewRoot.getLocale()).andStubReturn(new Locale("ru", "RU"));
+ expect(facesEnvironment.getFacesContext().getViewRoot()).andStubReturn(mockViewRoot);
+ expect(facesEnvironment.getApplication().getMessageBundle()).andStubReturn("org.richfaces.application.MessageFactoryImplTest");
+ facesEnvironment.replay();
+
+ // {1}: ''{0}'' ne konvertiruyetsia v stroku.
+ String message = messageFactory.getMessageText(facesEnvironment.getFacesContext(),
+ FacesMessages.CONVERTER_STRING, "something", "Message");
+
+ assertEquals("Message: 'something' ne konvertiruyetsia v stroku.", message);
+
+ // javax.faces.component.UIInput.CONVERSION={0}: Conversion error occurred.
+ String otherMessage = messageFactory.getMessageText(facesEnvironment.getFacesContext(),
+ FacesMessages.UIINPUT_CONVERSION, "Failure message");
+ assertEquals("Failure message: Conversion error occurred.", otherMessage);
+ }
+}
Modified: branches/RF-7944/core/impl/src/test/java/org/richfaces/resource/ResourceHandlerImplTest.java
===================================================================
--- branches/RF-7944/core/impl/src/test/java/org/richfaces/resource/ResourceHandlerImplTest.java 2010-09-03 08:56:24 UTC (rev 19108)
+++ branches/RF-7944/core/impl/src/test/java/org/richfaces/resource/ResourceHandlerImplTest.java 2010-09-03 12:00:31 UTC (rev 19109)
@@ -43,6 +43,8 @@
import org.easymock.classextension.EasyMock;
import org.jboss.test.faces.AbstractFacesTest;
import org.jboss.test.faces.htmlunit.LocalWebClient;
+import org.richfaces.application.DependencyInjectionServiceImpl;
+import org.richfaces.application.DependencyInjector;
import org.richfaces.application.Module;
import org.richfaces.application.ServiceTracker;
import org.richfaces.application.ServicesFactory;
@@ -247,6 +249,7 @@
injector.setInstance(ResourceCodec.class,mockedCodec);
injector.setInstance(org.ajax4jsf.cache.Cache.class,mockCache);
injector.setInstance(Uptime.class, new Uptime());
+ injector.setInstance(DependencyInjector.class, new DependencyInjectionServiceImpl());
}
}));
Deleted: branches/RF-7944/core/impl/src/test/resources/log4j.xml
===================================================================
--- branches/RF-7944/core/impl/src/test/resources/log4j.xml 2010-09-03 08:56:24 UTC (rev 19108)
+++ branches/RF-7944/core/impl/src/test/resources/log4j.xml 2010-09-03 12:00:31 UTC (rev 19109)
@@ -1,82 +0,0 @@
-<?xml version="1.0" encoding="UTF-8" ?>
-<!--
- Copyright 1999-2004 The Apache Software Foundation
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
--->
-<!DOCTYPE log4j:configuration SYSTEM "file:///eclipse/dtdcache/log4j.dtd">
-
-<log4j:configuration xmlns:log4j="http://jakarta.apache.org/log4j/">
-
- <!-- This is a sample configuration for log4j.
- It simply just logs everything into a single
- log file.
- Note, that you can use properties for value substitution.
- -->
- <appender name="DEFAULT" class="org.apache.log4j.ConsoleAppender">
- <layout class="org.apache.log4j.PatternLayout">
- <param name="ConversionPattern" value="%d{dd.MM.yyyy HH:mm:ss} [%c] %C %M %n%-5p: %m%n" />
- </layout>
- </appender>
-
-<!--
- <appender name="FACES" class="org.apache.log4j.ConsoleAppender">
- <layout class="org.apache.log4j.PatternLayout">
- <param name="ConversionPattern" value="%t %-5p %c{2} - %m:%n"/>
- </layout>
- </appender>
-
- <appender name="CHAMELEON" class="org.apache.log4j.ConsoleAppender">
- <layout class="org.apache.log4j.PatternLayout">
- <param name="ConversionPattern" value="%t %-5p %c{2} - %m:%n"/>
- </layout>
- </appender>
- -->
- <category name="com.sun.faces">
- <priority value="DEBUG" />
- <appender-ref ref="DEFAULT"/>
- </category>
-
- <category name="org.apache.myfaces">
- <priority value="DEBUG" />
- <appender-ref ref="DEFAULT"/>
- </category>
-
- <category name="javax.faces">
- <priority value="INFO" />
- <appender-ref ref="DEFAULT"/>
- </category>
-
- <category name="faces">
- <priority value="INFO" />
- <appender-ref ref="DEFAULT"/>
- </category>
-
- <category name="org.richfaces">
- <priority value="DEBUG" />
- <appender-ref ref="DEFAULT"/>
- </category>
-
-
- <category name="org.ajax4jsf">
- <priority value="DEBUG" />
- <appender-ref ref="DEFAULT"/>
- </category>
-
- <!--
- <root>
- <priority value ="info" />
- <appender-ref ref="DEFAULT" />
- </root>
- -->
-</log4j:configuration>
Copied: branches/RF-7944/core/impl/src/test/resources/org/richfaces/application (from rev 19108, trunk/core/impl/src/test/resources/org/richfaces/application)
Deleted: branches/RF-7944/core/impl/src/test/resources/org/richfaces/application/MessageFactoryImplTest_ru_RU.properties
===================================================================
--- trunk/core/impl/src/test/resources/org/richfaces/application/MessageFactoryImplTest_ru_RU.properties 2010-09-03 08:56:24 UTC (rev 19108)
+++ branches/RF-7944/core/impl/src/test/resources/org/richfaces/application/MessageFactoryImplTest_ru_RU.properties 2010-09-03 12:00:31 UTC (rev 19109)
@@ -1,3 +0,0 @@
-javax.faces.converter.STRING={1}: ''{0}'' ne konvertiruyetsia v stroku.
-javax.faces.converter.EnumConverter.ENUM={2}: ''{0}'' dolzhno konvertirovat''sia v enum.
-javax.faces.converter.EnumConverter.ENUM_detail={2}: ''{0}'' dolzhno konvertirovat''sia v enum iz enum s konstantoj ''{1}''.
\ No newline at end of file
Copied: branches/RF-7944/core/impl/src/test/resources/org/richfaces/application/MessageFactoryImplTest_ru_RU.properties (from rev 19108, trunk/core/impl/src/test/resources/org/richfaces/application/MessageFactoryImplTest_ru_RU.properties)
===================================================================
--- branches/RF-7944/core/impl/src/test/resources/org/richfaces/application/MessageFactoryImplTest_ru_RU.properties (rev 0)
+++ branches/RF-7944/core/impl/src/test/resources/org/richfaces/application/MessageFactoryImplTest_ru_RU.properties 2010-09-03 12:00:31 UTC (rev 19109)
@@ -0,0 +1,3 @@
+javax.faces.converter.STRING={1}: ''{0}'' ne konvertiruyetsia v stroku.
+javax.faces.converter.EnumConverter.ENUM={2}: ''{0}'' dolzhno konvertirovat''sia v enum.
+javax.faces.converter.EnumConverter.ENUM_detail={2}: ''{0}'' dolzhno konvertirovat''sia v enum iz enum s konstantoj ''{1}''.
\ No newline at end of file
Deleted: branches/RF-7944/core/legacy-tests/src/test/resources/log4j.xml
===================================================================
--- branches/RF-7944/core/legacy-tests/src/test/resources/log4j.xml 2010-09-03 08:56:24 UTC (rev 19108)
+++ branches/RF-7944/core/legacy-tests/src/test/resources/log4j.xml 2010-09-03 12:00:31 UTC (rev 19109)
@@ -1,82 +0,0 @@
-<?xml version="1.0" encoding="UTF-8" ?>
-<!--
- Copyright 1999-2004 The Apache Software Foundation
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
--->
-<!DOCTYPE log4j:configuration SYSTEM "file:///eclipse/dtdcache/log4j.dtd">
-
-<log4j:configuration xmlns:log4j="http://jakarta.apache.org/log4j/">
-
- <!-- This is a sample configuration for log4j.
- It simply just logs everything into a single
- log file.
- Note, that you can use properties for value substitution.
- -->
- <appender name="DEFAULT" class="org.apache.log4j.ConsoleAppender">
- <layout class="org.apache.log4j.PatternLayout">
- <param name="ConversionPattern" value="%t %-5p %c{2} - %m:%n"/>
- </layout>
- </appender>
-
-<!--
- <appender name="FACES" class="org.apache.log4j.ConsoleAppender">
- <layout class="org.apache.log4j.PatternLayout">
- <param name="ConversionPattern" value="%t %-5p %c{2} - %m:%n"/>
- </layout>
- </appender>
-
- <appender name="CHAMELEON" class="org.apache.log4j.ConsoleAppender">
- <layout class="org.apache.log4j.PatternLayout">
- <param name="ConversionPattern" value="%t %-5p %c{2} - %m:%n"/>
- </layout>
- </appender>
- -->
- <category name="com.sun.faces">
- <priority value="WARN" />
- <appender-ref ref="DEFAULT"/>
- </category>
-
- <category name="org.apache.myfaces">
- <priority value="WARN" />
- <appender-ref ref="DEFAULT"/>
- </category>
-
- <category name="javax.faces">
- <priority value="WARN" />
- <appender-ref ref="DEFAULT"/>
- </category>
-
- <category name="faces">
- <priority value="WARN" />
- <appender-ref ref="DEFAULT"/>
- </category>
-
- <category name="com.exadel.vcp">
- <priority value="WARN" />
- <appender-ref ref="DEFAULT"/>
- </category>
-
-
- <category name="org.ajax4jsf">
- <priority value="WARN" />
- <appender-ref ref="DEFAULT"/>
- </category>
-
- <!--
- <root>
- <priority value ="WARN" />
- <appender-ref ref="DEFAULT" />
- </root>
- -->
-</log4j:configuration>
Modified: branches/RF-7944/dist/readme-ui.txt
===================================================================
--- branches/RF-7944/dist/readme-ui.txt 2010-09-03 08:56:24 UTC (rev 19108)
+++ branches/RF-7944/dist/readme-ui.txt 2010-09-03 12:00:31 UTC (rev 19109)
@@ -13,11 +13,9 @@
1.3) richfaces-core-impl-4.0.0.20100824-M2.jar
1.4) richfaces-components-api-4.0.0.20100824-M2.jar
1.5) richfaces-components-ui-4.0.0.20100824-M2.jar
- 1.6) slf4j-api
- 1.7) slf4j-log4j12 (or whatever else - select the implementation according to logging framework that you use)
- 1.8) sac-1.3, cssparser-0.9.5 - required for components CSS work
- 1.9) google-guava-r06 - core runtime dependency.
- 1.10) annotations.jar from org.richfaces.cdk . It's optional and should be added only if some RichFaces components will be
+ 1.6) sac-1.3, cssparser-0.9.5 - required for components CSS work
+ 1.7) google-guava-r06 - core runtime dependency.
+ 1.8) annotations.jar from org.richfaces.cdk . It's optional and should be added only if some RichFaces components will be
created/accessed dynamically from some appication actions/listeners.
For optimal performance it's recommended to add one of these caching frameworks to application classpath: EhCache, JBoss Cache, OsCache.
14 years, 3 months
JBoss Rich Faces SVN: r19108 - in trunk/ui: common/ui/src/main/java/org/richfaces/event and 4 other directories.
by richfaces-svn-commits@lists.jboss.org
Author: Alex.Kolonitsky
Date: 2010-09-03 04:56:24 -0400 (Fri, 03 Sep 2010)
New Revision: 19108
Added:
trunk/ui/common/ui/src/main/java/org/richfaces/event/
trunk/ui/common/ui/src/main/java/org/richfaces/event/MethodExpressionEventListener.java
trunk/ui/common/ui/src/main/java/org/richfaces/view/facelets/html/EventListenerHandler.java
trunk/ui/common/ui/src/main/java/org/richfaces/view/facelets/html/TagHandlerUtils.java
Removed:
trunk/ui/core/ui/src/main/java/org/richfaces/view/facelets/html/TagHandlerUtils.java
trunk/ui/output/ui/src/main/java/org/richfaces/event/MethodExpressionEventListener.java
trunk/ui/output/ui/src/main/java/org/richfaces/view/facelets/html/EventListenerHandler.java
Modified:
trunk/ui/output/ui/src/main/java/org/richfaces/view/facelets/html/ChangeExpandListenerHandler.java
trunk/ui/output/ui/src/main/java/org/richfaces/view/facelets/html/ItemChangeListenerHandler.java
Log:
Share general implimentation of ListenerHandler and MethodExpressionEventListener
Copied: trunk/ui/common/ui/src/main/java/org/richfaces/event/MethodExpressionEventListener.java (from rev 19094, trunk/ui/output/ui/src/main/java/org/richfaces/event/MethodExpressionEventListener.java)
===================================================================
--- trunk/ui/common/ui/src/main/java/org/richfaces/event/MethodExpressionEventListener.java (rev 0)
+++ trunk/ui/common/ui/src/main/java/org/richfaces/event/MethodExpressionEventListener.java 2010-09-03 08:56:24 UTC (rev 19108)
@@ -0,0 +1,197 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright ${year}, Red Hat, Inc. and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+
+package org.richfaces.event;
+
+import javax.el.ELContext;
+import javax.el.ELException;
+import javax.el.MethodExpression;
+import javax.el.MethodNotFoundException;
+import javax.faces.component.StateHolder;
+import javax.faces.component.UIComponentBase;
+import javax.faces.context.FacesContext;
+import javax.faces.event.AbortProcessingException;
+import javax.faces.event.FacesEvent;
+import javax.faces.event.FacesListener;
+
+/**
+ * <p><strong><span
+ * class="changed_modified_2_0">MethodExpressionEventListener</span></strong>
+ * is a {@link FacesListener} that wraps a {@link
+ * MethodExpression}. When it receives a {@link FacesEvent}, it
+ * executes a method on an object identified by the {@link
+ * MethodExpression}.</p>
+ *
+ * @author akolonitsky
+ * @version 1.0
+ *
+ */
+public abstract class MethodExpressionEventListener implements FacesListener, StateHolder {
+
+ private static final Class<?>[] EVENT_LISTENER_ZERO_ARG_SIG = new Class[] { };
+
+ private static final Object[] NO_PARAMS = new Object[0];
+
+ // ------------------------------------------------------ Instance Variables
+
+ private MethodExpression methodExpressionOneArg = null;
+ private MethodExpression methodExpressionZeroArg = null;
+
+ private boolean isTransient;
+
+ protected MethodExpressionEventListener() {
+ }
+
+ /**
+ * <p><span class="changed_modified_2_0">Construct</span> a {@link
+ * FacesListener} that contains a {@link
+ * MethodExpression}.<span
+ * class="changed_added_2_0">To accomodate method expression targets
+ * that take no arguments instead of taking a {@link
+ * FacesEvent} argument</span>, the implementation of this
+ * class must take the argument <code>methodExpressionOneArg</code>,
+ * extract its expression string, and create another
+ * <code>MethodExpression</code> whose expected param types match
+ * those of a zero argument method. The usage requirements for both
+ * of these <code>MethodExpression</code> instances are described in
+ * {@link #processEvent}.</span></p>
+ *
+ * @param methodExpressionOneArg a <code>MethodExpression</code>
+ * that points to a method that returns <code>void</code> and takes
+ * a single argument of type {@link FacesEvent}.
+ */
+ protected MethodExpressionEventListener(MethodExpression methodExpressionOneArg) {
+
+ super();
+ this.methodExpressionOneArg = methodExpressionOneArg;
+ FacesContext context = FacesContext.getCurrentInstance();
+ ELContext elContext = context.getELContext();
+ this.methodExpressionZeroArg = context.getApplication().getExpressionFactory().createMethodExpression(
+ elContext, methodExpressionOneArg.getExpressionString(), Void.class, EVENT_LISTENER_ZERO_ARG_SIG);
+ }
+
+ /**
+ * <p>Construct a {@link FacesListener} that contains a {@link MethodExpression}.</p>
+ *
+ * @param methodExprOneArg
+ * @param methodExprZeroArg
+ */
+ protected MethodExpressionEventListener(MethodExpression methodExprOneArg, MethodExpression methodExprZeroArg) {
+
+ super();
+ this.methodExpressionOneArg = methodExprOneArg;
+ this.methodExpressionZeroArg = methodExprZeroArg;
+ }
+
+ // ------------------------------------------------------- Event Method
+
+ /**
+ * <p><span class="changed_modified_2_0">Call</span> through to the
+ * {@link MethodExpression} passed in our constructor. <span
+ * class="changed_added_2_0">First, try to invoke the
+ * <code>MethodExpression</code> passed to the constructor of this
+ * instance, passing the argument {@link FacesEvent} as the
+ * argument. If a {@link MethodNotFoundException} is thrown, call
+ * to the zero argument <code>MethodExpression</code> derived from
+ * the <code>MethodExpression</code> passed to the constructor of
+ * this instance. If that fails for any reason, throw an {@link
+ * AbortProcessingException}, including the cause of the
+ * failure.</span></p>
+ *
+ * @throws NullPointerException {@inheritDoc}
+ * @throws AbortProcessingException {@inheritDoc}
+ */
+ public void processEvent(FacesEvent event) throws AbortProcessingException {
+
+ if (event == null) {
+ throw new NullPointerException();
+ }
+ FacesContext context = FacesContext.getCurrentInstance();
+ ELContext elContext = context.getELContext();
+ // PENDING: The corresponding code in MethodExpressionActionListener
+ // has an elaborate message capture, logging, and rethrowing block.
+ // Why not here?
+ try {
+ methodExpressionOneArg.invoke(elContext, new Object[] {event});
+ } catch (MethodNotFoundException mnf) {
+ if (null != methodExpressionZeroArg) {
+
+ try {
+ // try to invoke a no-arg version
+ methodExpressionZeroArg.invoke(elContext, NO_PARAMS);
+ } catch (ELException e) {
+ throw new AbortProcessingException(e.getMessage(), e.getCause());
+ }
+ }
+ } catch (ELException e) {
+ throw new AbortProcessingException(e.getMessage(), e.getCause());
+ }
+ }
+
+
+ // ------------------------------------------------ Methods from StateHolder
+
+
+ /**
+ * <p class="changed_modified_2_0">Both {@link MethodExpression}
+ * instances described in the constructor must be saved.</p>
+ */
+ public Object saveState(FacesContext context) {
+ if (context == null) {
+ throw new NullPointerException();
+ }
+
+ return new Object[] {
+ UIComponentBase.saveAttachedState(context, methodExpressionOneArg),
+ UIComponentBase.saveAttachedState(context, methodExpressionZeroArg)
+ };
+ }
+
+
+ /**
+ * <p class="changed_modified_2_0">Both {@link MethodExpression}
+ * instances described in the constructor must be restored.</p>
+ */
+ public void restoreState(FacesContext context, Object state) {
+
+ if (context == null) {
+ throw new NullPointerException();
+ }
+ if (state == null) {
+ return;
+ }
+
+ methodExpressionOneArg = (MethodExpression) UIComponentBase
+ .restoreAttachedState(context, ((Object[]) state)[0]);
+ methodExpressionZeroArg = (MethodExpression) UIComponentBase
+ .restoreAttachedState(context, ((Object[]) state)[1]);
+ }
+
+
+ public boolean isTransient() {
+ return isTransient;
+ }
+
+ public void setTransient(boolean newTransientValue) {
+ isTransient = newTransientValue;
+ }
+}
Copied: trunk/ui/common/ui/src/main/java/org/richfaces/view/facelets/html/EventListenerHandler.java (from rev 19094, trunk/ui/output/ui/src/main/java/org/richfaces/view/facelets/html/EventListenerHandler.java)
===================================================================
--- trunk/ui/common/ui/src/main/java/org/richfaces/view/facelets/html/EventListenerHandler.java (rev 0)
+++ trunk/ui/common/ui/src/main/java/org/richfaces/view/facelets/html/EventListenerHandler.java 2010-09-03 08:56:24 UTC (rev 19108)
@@ -0,0 +1,145 @@
+/**
+ * License Agreement.
+ *
+ * Rich Faces - Natural Ajax for Java Server Faces (JSF)
+ *
+ * Copyright (C) 2007 Exadel, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1 as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+package org.richfaces.view.facelets.html;
+
+import javax.el.ValueExpression;
+import javax.faces.component.UIComponent;
+import javax.faces.context.FacesContext;
+import javax.faces.event.AbortProcessingException;
+import javax.faces.event.FacesEvent;
+import javax.faces.event.FacesListener;
+import javax.faces.view.EditableValueHolderAttachedObjectHandler;
+import javax.faces.view.facelets.ComponentHandler;
+import javax.faces.view.facelets.FaceletContext;
+import javax.faces.view.facelets.TagAttribute;
+import javax.faces.view.facelets.TagAttributeException;
+import javax.faces.view.facelets.TagConfig;
+import javax.faces.view.facelets.TagException;
+import javax.faces.view.facelets.TagHandler;
+import java.io.IOException;
+import java.io.Serializable;
+
+/**
+ * @author akolonitsky
+ * @since Aug 31, 2010
+ */
+public abstract class EventListenerHandler extends TagHandler implements EditableValueHolderAttachedObjectHandler {
+
+ protected final TagAttribute binding;
+
+ protected final String listenerType;
+
+ public abstract static class LazyEventListener<L extends FacesListener> implements FacesListener, Serializable {
+
+ private static final long serialVersionUID = 1L;
+
+ protected final String type;
+
+ protected final ValueExpression binding;
+
+ protected LazyEventListener(String type, ValueExpression binding) {
+ this.type = type;
+ this.binding = binding;
+ }
+
+ public void processEvent(FacesEvent event) throws AbortProcessingException {
+
+ FacesContext faces = FacesContext.getCurrentInstance();
+ if (faces == null) {
+ return;
+ }
+
+ L instance = null;
+ if (this.binding != null) {
+ instance = (L) binding.getValue(faces.getELContext());
+ }
+ if (instance == null && this.type != null) {
+ try {
+ instance = (L) forName(this.type).newInstance();
+ } catch (Exception e) {
+ throw new AbortProcessingException("Couldn't Lazily instantiate EventListener", e);
+ }
+ if (this.binding != null) {
+ binding.setValue(faces.getELContext(), instance);
+ }
+ }
+
+ if (instance != null) {
+ event.processListener(instance);
+ }
+ }
+ }
+
+ public EventListenerHandler(TagConfig config) {
+ super(config);
+ this.binding = this.getAttribute("binding");
+ TagAttribute type = this.getAttribute("type");
+ if (type != null) {
+ if (type.isLiteral()) {
+ try {
+ forName(type.getValue());
+ } catch (ClassNotFoundException e) {
+ throw new TagAttributeException(type, "Couldn't qualify EventListener", e);
+ }
+ } else {
+ throw new TagAttributeException(type, "Must be a literal class name of type EventListener");
+ }
+ this.listenerType = type.getValue();
+ } else {
+ this.listenerType = null;
+ }
+ }
+
+ public void apply(FaceletContext ctx, UIComponent parent) throws IOException {
+
+ // only process if it's been created
+ if (parent == null || !ComponentHandler.isNew(parent)) {
+ return;
+ }
+
+ if (isEventSource(parent)) {
+ applyAttachedObject(ctx.getFacesContext(), parent);
+ } else if (UIComponent.isCompositeComponent(parent)) {
+ // Allow the composite component to know about the target component.
+ TagHandlerUtils.getOrCreateRetargetableHandlersList(parent).add(this);
+ } else {
+ throw new TagException(this.tag, "Parent is not of type EditableValueHolder, type is: " + parent);
+ }
+ }
+
+ public String getFor() {
+ TagAttribute attr = this.getAttribute("for");
+ return attr == null ? null : attr.getValue();
+ }
+
+ public static Class<?> forName(String name) throws ClassNotFoundException {
+ if (null == name || "".equals(name)) {
+ return null;
+ }
+
+ return Class.forName(name, false, Thread.currentThread().getContextClassLoader());
+ }
+
+ public abstract boolean isEventSource(UIComponent comp);
+}
+
+
Copied: trunk/ui/common/ui/src/main/java/org/richfaces/view/facelets/html/TagHandlerUtils.java (from rev 19094, trunk/ui/core/ui/src/main/java/org/richfaces/view/facelets/html/TagHandlerUtils.java)
===================================================================
--- trunk/ui/common/ui/src/main/java/org/richfaces/view/facelets/html/TagHandlerUtils.java (rev 0)
+++ trunk/ui/common/ui/src/main/java/org/richfaces/view/facelets/html/TagHandlerUtils.java 2010-09-03 08:56:24 UTC (rev 19108)
@@ -0,0 +1,67 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc. and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.richfaces.view.facelets.html;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Map;
+
+import javax.faces.component.UIComponent;
+import javax.faces.view.AttachedObjectHandler;
+
+/**
+ * @author Nick Belaevski
+ *
+ */
+final class TagHandlerUtils {
+
+ // TODO - is that implementation dependency?
+ private static final String JAVAX_FACES_RETARGETABLE_HANDLERS = "javax.faces.RetargetableHandlers";
+
+ private TagHandlerUtils() {
+ //utility class constructor
+ }
+
+ static List<AttachedObjectHandler> getOrCreateRetargetableHandlersList(UIComponent component) {
+ Map<String, Object> attrs = component.getAttributes();
+ @SuppressWarnings({
+ "unchecked"}) List<AttachedObjectHandler> list =
+ (List<AttachedObjectHandler>) attrs.get(JAVAX_FACES_RETARGETABLE_HANDLERS);
+
+ if (list == null) {
+ list = new ArrayList<AttachedObjectHandler>();
+ attrs.put(JAVAX_FACES_RETARGETABLE_HANDLERS, list);
+ }
+
+ return list;
+ }
+
+ static <T> Class<? extends T> loadClass(String className, Class<T> type)
+ throws ClassNotFoundException, ClassCastException {
+
+ ClassLoader ccl = Thread.currentThread().getContextClassLoader();
+ Class<?> loadedClass = Class.forName(className, false, ccl);
+
+ return loadedClass.asSubclass(type);
+ }
+
+}
Deleted: trunk/ui/core/ui/src/main/java/org/richfaces/view/facelets/html/TagHandlerUtils.java
===================================================================
--- trunk/ui/core/ui/src/main/java/org/richfaces/view/facelets/html/TagHandlerUtils.java 2010-09-03 08:39:33 UTC (rev 19107)
+++ trunk/ui/core/ui/src/main/java/org/richfaces/view/facelets/html/TagHandlerUtils.java 2010-09-03 08:56:24 UTC (rev 19108)
@@ -1,67 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2010, Red Hat, Inc. and individual contributors
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.richfaces.view.facelets.html;
-
-import java.util.ArrayList;
-import java.util.List;
-import java.util.Map;
-
-import javax.faces.component.UIComponent;
-import javax.faces.view.AttachedObjectHandler;
-
-/**
- * @author Nick Belaevski
- *
- */
-final class TagHandlerUtils {
-
- // TODO - is that implementation dependency?
- private static final String JAVAX_FACES_RETARGETABLE_HANDLERS = "javax.faces.RetargetableHandlers";
-
- private TagHandlerUtils() {
- //utility class constructor
- }
-
- static List<AttachedObjectHandler> getOrCreateRetargetableHandlersList(UIComponent component) {
- Map<String, Object> attrs = component.getAttributes();
- @SuppressWarnings({
- "unchecked"}) List<AttachedObjectHandler> list =
- (List<AttachedObjectHandler>) attrs.get(JAVAX_FACES_RETARGETABLE_HANDLERS);
-
- if (list == null) {
- list = new ArrayList<AttachedObjectHandler>();
- attrs.put(JAVAX_FACES_RETARGETABLE_HANDLERS, list);
- }
-
- return list;
- }
-
- static <T> Class<? extends T> loadClass(String className, Class<T> type)
- throws ClassNotFoundException, ClassCastException {
-
- ClassLoader ccl = Thread.currentThread().getContextClassLoader();
- Class<?> loadedClass = Class.forName(className, false, ccl);
-
- return loadedClass.asSubclass(type);
- }
-
-}
Deleted: trunk/ui/output/ui/src/main/java/org/richfaces/event/MethodExpressionEventListener.java
===================================================================
--- trunk/ui/output/ui/src/main/java/org/richfaces/event/MethodExpressionEventListener.java 2010-09-03 08:39:33 UTC (rev 19107)
+++ trunk/ui/output/ui/src/main/java/org/richfaces/event/MethodExpressionEventListener.java 2010-09-03 08:56:24 UTC (rev 19108)
@@ -1,197 +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.component.UIComponentBase;
-import javax.faces.context.FacesContext;
-import javax.faces.event.AbortProcessingException;
-import javax.faces.event.FacesEvent;
-import javax.faces.event.FacesListener;
-
-/**
- * <p><strong><span
- * class="changed_modified_2_0">MethodExpressionEventListener</span></strong>
- * is a {@link FacesListener} that wraps a {@link
- * MethodExpression}. When it receives a {@link FacesEvent}, it
- * executes a method on an object identified by the {@link
- * MethodExpression}.</p>
- *
- * @author akolonitsky
- * @version 1.0
- *
- */
-public abstract class MethodExpressionEventListener implements FacesListener, StateHolder {
-
- private static final Class<?>[] EVENT_LISTENER_ZERO_ARG_SIG = new Class[] { };
-
- private static final Object[] NO_PARAMS = new Object[0];
-
- // ------------------------------------------------------ Instance Variables
-
- private MethodExpression methodExpressionOneArg = null;
- private MethodExpression methodExpressionZeroArg = null;
-
- private boolean isTransient;
-
- protected MethodExpressionEventListener() {
- }
-
- /**
- * <p><span class="changed_modified_2_0">Construct</span> a {@link
- * FacesListener} that contains a {@link
- * MethodExpression}.<span
- * class="changed_added_2_0">To accomodate method expression targets
- * that take no arguments instead of taking a {@link
- * FacesEvent} argument</span>, the implementation of this
- * class must take the argument <code>methodExpressionOneArg</code>,
- * extract its expression string, and create another
- * <code>MethodExpression</code> whose expected param types match
- * those of a zero argument method. The usage requirements for both
- * of these <code>MethodExpression</code> instances are described in
- * {@link #processEvent}.</span></p>
- *
- * @param methodExpressionOneArg a <code>MethodExpression</code>
- * that points to a method that returns <code>void</code> and takes
- * a single argument of type {@link FacesEvent}.
- */
- protected MethodExpressionEventListener(MethodExpression methodExpressionOneArg) {
-
- super();
- this.methodExpressionOneArg = methodExpressionOneArg;
- FacesContext context = FacesContext.getCurrentInstance();
- ELContext elContext = context.getELContext();
- this.methodExpressionZeroArg = context.getApplication().getExpressionFactory().createMethodExpression(
- elContext, methodExpressionOneArg.getExpressionString(), Void.class, EVENT_LISTENER_ZERO_ARG_SIG);
- }
-
- /**
- * <p>Construct a {@link FacesListener} that contains a {@link MethodExpression}.</p>
- *
- * @param methodExprOneArg
- * @param methodExprZeroArg
- */
- protected MethodExpressionEventListener(MethodExpression methodExprOneArg, MethodExpression methodExprZeroArg) {
-
- super();
- this.methodExpressionOneArg = methodExprOneArg;
- this.methodExpressionZeroArg = methodExprZeroArg;
- }
-
- // ------------------------------------------------------- Event Method
-
- /**
- * <p><span class="changed_modified_2_0">Call</span> through to the
- * {@link MethodExpression} passed in our constructor. <span
- * class="changed_added_2_0">First, try to invoke the
- * <code>MethodExpression</code> passed to the constructor of this
- * instance, passing the argument {@link FacesEvent} as the
- * argument. If a {@link MethodNotFoundException} is thrown, call
- * to the zero argument <code>MethodExpression</code> derived from
- * the <code>MethodExpression</code> passed to the constructor of
- * this instance. If that fails for any reason, throw an {@link
- * AbortProcessingException}, including the cause of the
- * failure.</span></p>
- *
- * @throws NullPointerException {@inheritDoc}
- * @throws AbortProcessingException {@inheritDoc}
- */
- public void processEvent(FacesEvent event) throws AbortProcessingException {
-
- if (event == null) {
- throw new NullPointerException();
- }
- FacesContext context = FacesContext.getCurrentInstance();
- ELContext elContext = context.getELContext();
- // PENDING: The corresponding code in MethodExpressionActionListener
- // has an elaborate message capture, logging, and rethrowing block.
- // Why not here?
- try {
- methodExpressionOneArg.invoke(elContext, new Object[] {event});
- } catch (MethodNotFoundException mnf) {
- if (null != methodExpressionZeroArg) {
-
- try {
- // try to invoke a no-arg version
- methodExpressionZeroArg.invoke(elContext, NO_PARAMS);
- } catch (ELException e) {
- throw new AbortProcessingException(e.getMessage(), e.getCause());
- }
- }
- } catch (ELException e) {
- throw new AbortProcessingException(e.getMessage(), e.getCause());
- }
- }
-
-
- // ------------------------------------------------ Methods from StateHolder
-
-
- /**
- * <p class="changed_modified_2_0">Both {@link MethodExpression}
- * instances described in the constructor must be saved.</p>
- */
- public Object saveState(FacesContext context) {
- if (context == null) {
- throw new NullPointerException();
- }
-
- return new Object[] {
- UIComponentBase.saveAttachedState(context, methodExpressionOneArg),
- UIComponentBase.saveAttachedState(context, methodExpressionZeroArg)
- };
- }
-
-
- /**
- * <p class="changed_modified_2_0">Both {@link MethodExpression}
- * instances described in the constructor must be restored.</p>
- */
- public void restoreState(FacesContext context, Object state) {
-
- if (context == null) {
- throw new NullPointerException();
- }
- if (state == null) {
- return;
- }
-
- methodExpressionOneArg = (MethodExpression) UIComponentBase
- .restoreAttachedState(context, ((Object[]) state)[0]);
- methodExpressionZeroArg = (MethodExpression) UIComponentBase
- .restoreAttachedState(context, ((Object[]) state)[1]);
- }
-
-
- public boolean isTransient() {
- return isTransient;
- }
-
- public void setTransient(boolean newTransientValue) {
- isTransient = newTransientValue;
- }
-}
Modified: trunk/ui/output/ui/src/main/java/org/richfaces/view/facelets/html/ChangeExpandListenerHandler.java
===================================================================
--- trunk/ui/output/ui/src/main/java/org/richfaces/view/facelets/html/ChangeExpandListenerHandler.java 2010-09-03 08:39:33 UTC (rev 19107)
+++ trunk/ui/output/ui/src/main/java/org/richfaces/view/facelets/html/ChangeExpandListenerHandler.java 2010-09-03 08:56:24 UTC (rev 19108)
@@ -66,5 +66,10 @@
ChangeExpandSource source = (ChangeExpandSource) parent;
source.addChangeExpandListener(new LazyChangeExpandListener(this.listenerType, expression));
}
+
+ @Override
+ public boolean isEventSource(UIComponent comp) {
+ return comp instanceof ChangeExpandSource;
+ }
}
Deleted: trunk/ui/output/ui/src/main/java/org/richfaces/view/facelets/html/EventListenerHandler.java
===================================================================
--- trunk/ui/output/ui/src/main/java/org/richfaces/view/facelets/html/EventListenerHandler.java 2010-09-03 08:39:33 UTC (rev 19107)
+++ trunk/ui/output/ui/src/main/java/org/richfaces/view/facelets/html/EventListenerHandler.java 2010-09-03 08:56:24 UTC (rev 19108)
@@ -1,145 +0,0 @@
-/**
- * License Agreement.
- *
- * Rich Faces - Natural Ajax for Java Server Faces (JSF)
- *
- * Copyright (C) 2007 Exadel, Inc.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License version 2.1 as published by the Free Software Foundation.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-package org.richfaces.view.facelets.html;
-
-import org.richfaces.component.AbstractCollapsiblePanel;
-
-import javax.el.ValueExpression;
-import javax.faces.component.UIComponent;
-import javax.faces.context.FacesContext;
-import javax.faces.event.AbortProcessingException;
-import javax.faces.event.FacesEvent;
-import javax.faces.event.FacesListener;
-import javax.faces.view.EditableValueHolderAttachedObjectHandler;
-import javax.faces.view.facelets.ComponentHandler;
-import javax.faces.view.facelets.FaceletContext;
-import javax.faces.view.facelets.TagAttribute;
-import javax.faces.view.facelets.TagAttributeException;
-import javax.faces.view.facelets.TagConfig;
-import javax.faces.view.facelets.TagException;
-import javax.faces.view.facelets.TagHandler;
-import java.io.IOException;
-import java.io.Serializable;
-
-/**
- * @author akolonitsky
- * @since Aug 31, 2010
- */
-public abstract class EventListenerHandler extends TagHandler implements EditableValueHolderAttachedObjectHandler {
-
- protected final TagAttribute binding;
-
- protected final String listenerType;
-
- public abstract static class LazyEventListener<L extends FacesListener> implements FacesListener, Serializable {
-
- private static final long serialVersionUID = 1L;
-
- protected final String type;
-
- protected final ValueExpression binding;
-
- protected LazyEventListener(String type, ValueExpression binding) {
- this.type = type;
- this.binding = binding;
- }
-
- public void processEvent(FacesEvent event) throws AbortProcessingException {
-
- FacesContext faces = FacesContext.getCurrentInstance();
- if (faces == null) {
- return;
- }
-
- L instance = null;
- if (this.binding != null) {
- instance = (L) binding.getValue(faces.getELContext());
- }
- if (instance == null && this.type != null) {
- try {
- instance = (L) forName(this.type).newInstance();
- } catch (Exception e) {
- throw new AbortProcessingException("Couldn't Lazily instantiate EventListener", e);
- }
- if (this.binding != null) {
- binding.setValue(faces.getELContext(), instance);
- }
- }
-
- if (instance != null) {
- event.processListener(instance);
- }
- }
- }
-
- public EventListenerHandler(TagConfig config) {
- super(config);
- this.binding = this.getAttribute("binding");
- TagAttribute type = this.getAttribute("type");
- if (type != null) {
- if (type.isLiteral()) {
- try {
- forName(type.getValue());
- } catch (ClassNotFoundException e) {
- throw new TagAttributeException(type, "Couldn't qualify EventListener", e);
- }
- } else {
- throw new TagAttributeException(type, "Must be a literal class name of type EventListener");
- }
- this.listenerType = type.getValue();
- } else {
- this.listenerType = null;
- }
- }
-
- public void apply(FaceletContext ctx, UIComponent parent) throws IOException {
-
- // only process if it's been created
- if (parent == null || !ComponentHandler.isNew(parent)) {
- return;
- }
-
- if (parent instanceof AbstractCollapsiblePanel) {
- applyAttachedObject(ctx.getFacesContext(), parent);
- } else if (UIComponent.isCompositeComponent(parent)) {
- // Allow the composite component to know about the target component.
- TagHandlerUtils.getOrCreateRetargetableHandlersList(parent).add(this);
- } else {
- throw new TagException(this.tag, "Parent is not of type EditableValueHolder, type is: " + parent);
- }
- }
-
- public String getFor() {
- TagAttribute attr = this.getAttribute("for");
- return attr == null ? null : attr.getValue();
- }
-
- public static Class<?> forName(String name) throws ClassNotFoundException {
- if (null == name || "".equals(name)) {
- return null;
- }
-
- return Class.forName(name, false, Thread.currentThread().getContextClassLoader());
- }
-}
-
-
Modified: trunk/ui/output/ui/src/main/java/org/richfaces/view/facelets/html/ItemChangeListenerHandler.java
===================================================================
--- trunk/ui/output/ui/src/main/java/org/richfaces/view/facelets/html/ItemChangeListenerHandler.java 2010-09-03 08:39:33 UTC (rev 19107)
+++ trunk/ui/output/ui/src/main/java/org/richfaces/view/facelets/html/ItemChangeListenerHandler.java 2010-09-03 08:56:24 UTC (rev 19108)
@@ -67,5 +67,10 @@
ItemChangeSource evh = (ItemChangeSource) parent;
evh.addItemChangeListener(new LazyItemChangeListener(this.listenerType, valueExpr));
}
+
+ @Override
+ public boolean isEventSource(UIComponent comp) {
+ return comp instanceof ItemChangeSource;
+ }
}
14 years, 3 months
JBoss Rich Faces SVN: r19106 - in trunk: examples/richfaces-showcase/src/main/webapp/richfaces/accordion/samples and 4 other directories.
by richfaces-svn-commits@lists.jboss.org
Author: Alex.Kolonitsky
Date: 2010-09-03 04:21:44 -0400 (Fri, 03 Sep 2010)
New Revision: 19106
Modified:
trunk/examples/output-demo/src/main/webapp/resources/tests/richfaces-accordion-headers-qunit.js
trunk/examples/richfaces-showcase/src/main/webapp/richfaces/accordion/samples/simple-sample.xhtml
trunk/examples/richfaces-showcase/src/main/webapp/richfaces/togglePanel/samples/simple-sample.xhtml
trunk/ui/output/ui/src/main/java/org/richfaces/component/AbstractCollapsiblePanel.java
trunk/ui/output/ui/src/main/java/org/richfaces/component/AbstractTogglePanelTitledItem.java
trunk/ui/output/ui/src/main/java/org/richfaces/renderkit/html/AccordionItemRenderer.java
trunk/ui/output/ui/src/main/java/org/richfaces/renderkit/html/AccordionRenderer.java
trunk/ui/output/ui/src/main/java/org/richfaces/renderkit/html/CollapsiblePanelRenderer.java
trunk/ui/output/ui/src/main/java/org/richfaces/renderkit/html/TogglePanelItemRenderer.java
trunk/ui/output/ui/src/main/resources/META-INF/resources/org.richfaces/AccordionItem.js
trunk/ui/output/ui/src/main/resources/META-INF/resources/org.richfaces/CollapsiblePanelItem.js
trunk/ui/output/ui/src/main/resources/META-INF/resources/org.richfaces/TogglePanel.js
trunk/ui/output/ui/src/main/resources/META-INF/resources/org.richfaces/TogglePanelItem.js
trunk/ui/output/ui/src/main/resources/META-INF/resources/org.richfaces/accordion.ecss
trunk/ui/output/ui/src/main/resources/META-INF/resources/org.richfaces/collapsiblePanel.ecss
Log:
RF-9299 css: accordion review and updates
RF-9298 css: togglePanel review and updates
Modified: trunk/examples/output-demo/src/main/webapp/resources/tests/richfaces-accordion-headers-qunit.js
===================================================================
--- trunk/examples/output-demo/src/main/webapp/resources/tests/richfaces-accordion-headers-qunit.js 2010-09-03 05:11:33 UTC (rev 19105)
+++ trunk/examples/output-demo/src/main/webapp/resources/tests/richfaces-accordion-headers-qunit.js 2010-09-03 08:21:44 UTC (rev 19106)
@@ -25,6 +25,34 @@
var ACCORDION_ID = "f:panel";
+ function testFirst(items) {
+ ok(items[0].__header("act").is(":visible"), "1 item: active visible");
+ ok(!items[0].__header("inact").is(":visible"), "1 item: inactive unvisible");
+ ok(!items[0].__header("dis").is(":visible"), "1 item: disabled unvisible");
+
+ ok(!items[1].__header("act").is(":visible"), "2 item: active visible");
+ ok(!items[1].__header("inact").is(":visible"), "2 item: inactive unvisible");
+ ok(items[1].__header("dis").is(":visible"), "2 item: disabled unvisible");
+
+ ok(!items[2].__header("act").is(":visible"), "3 item: active unvisible");
+ ok(items[2].__header("inact").is(":visible"), "3 item: inactive visible");
+ ok(!items[2].__header("dis").is(":visible"), "3 item: disabled unvisible");
+ }
+
+ function testLast(items) {
+ ok(!items[0].__header("act").is(":visible"), "1 item: active unvisible");
+ ok(items[0].__header("inact").is(":visible"), "1 item: inactive visible");
+ ok(!items[0].__header("dis").is(":visible"), "1 item: disabled unvisible");
+
+ ok(!items[1].__header("act").is(":visible"), "2 item: active visible");
+ ok(!items[1].__header("inact").is(":visible"), "2 item: inactive unvisible");
+ ok(items[1].__header("dis").is(":visible"), "2 item: disabled unvisible");
+
+ ok(items[2].__header("act").is(":visible"), "3 item: active visible");
+ ok(!items[2].__header("inact").is(":visible"), "3 item: inactive unvisible");
+ ok(!items[2].__header("dis").is(":visible"), "3 item: disabled unvisible");
+ }
+
test("RichFaces.ui.Accordion change headers", function () {
var c = RichFaces.$(ACCORDION_ID);
@@ -34,31 +62,38 @@
equals(c.getItems().length, 3, "getItems().length");
var items = c.getItems();
- ok( items[0].__header("active" ).is(":visible"), "1 item: active visible");
- ok(!items[0].__header("inactive").is(":visible"), "1 item: inactive unvisible");
- ok(!items[0].__header("disable" ).is(":visible"), "1 item: disabled unvisible");
+ testFirst(items);
-// ok(!items[1].__header("active" ).is(":visible"), "2 item: active unvisible");
-// ok(!items[1].__header("inactive").is(":visible"), "2 item: inactive unvisible");
-// ok( items[1].__header("disable" ).is(":visible"), "2 item: disabled visible");
+ c.switchToItem(items[2].getName());
+ testLast(items);
- ok(!items[2].__header("active" ).is(":visible"), "3 item: active unvisible");
- ok( items[2].__header("inactive").is(":visible"), "3 item: inactive visible");
- ok(!items[2].__header("disable" ).is(":visible"), "3 item: disabled unvisible");
+ c.switchToItem("@first");
+ testFirst(items);
- c.switchToItem(items[2].getName());
- ok(!items[0].__header("active" ).is(":visible"), "1 item: active unvisible");
- ok( items[0].__header("inactive").is(":visible"), "1 item: inactive visible");
- ok(!items[0].__header("disable" ).is(":visible"), "1 item: disabled unvisible");
+ c.switchToItem("@last");
+ testLast(items);
-// ok(!items[1].__header("active" ).is(":visible"), "2 item: active unvisible");
-// ok(!items[1].__header("inactive").is(":visible"), "2 item: inactive unvisible");
-// ok( items[1].__header("disable" ).is(":visible"), "2 item: disabled visible");
+ c.switchToItem("@prev");
+ testFirst(items);
- ok( items[2].__header("active" ).is(":visible"), "3 item: active visible");
- ok(!items[2].__header("inactive").is(":visible"), "3 item: inactive unvisible");
- ok(!items[2].__header("disable" ).is(":visible"), "3 item: disabled unvisible");
+ c.switchToItem("@next");
+ testLast(items);
+ });
+ test("RichFaces.ui.Accordion change disabled headers", function () {
+ var c = RichFaces.$(ACCORDION_ID);
+
+ ok(c instanceof RichFaces.ui.Accordion, "inctance of RichFaces.ui.Accordion");
+ equals(c.id, ACCORDION_ID, "id");
+
+ equals(c.getItems().length, 3, "getItems().length");
+
+ var items = c.getItems();
+
c.switchToItem(items[0].getName());
+ testFirst(items);
+
+ c.switchToItem(items[1].getName());
+ testFirst(items);
});
});
Modified: trunk/examples/richfaces-showcase/src/main/webapp/richfaces/accordion/samples/simple-sample.xhtml
===================================================================
--- trunk/examples/richfaces-showcase/src/main/webapp/richfaces/accordion/samples/simple-sample.xhtml 2010-09-03 05:11:33 UTC (rev 19105)
+++ trunk/examples/richfaces-showcase/src/main/webapp/richfaces/accordion/samples/simple-sample.xhtml 2010-09-03 08:21:44 UTC (rev 19106)
@@ -9,7 +9,7 @@
.rf-ac{
width: 500px;
}
-.rf-aci-c {
+.rf-ac-itm-c {
height: 220px;
}
</style>
Modified: trunk/examples/richfaces-showcase/src/main/webapp/richfaces/togglePanel/samples/simple-sample.xhtml
===================================================================
--- trunk/examples/richfaces-showcase/src/main/webapp/richfaces/togglePanel/samples/simple-sample.xhtml 2010-09-03 05:11:33 UTC (rev 19105)
+++ trunk/examples/richfaces-showcase/src/main/webapp/richfaces/togglePanel/samples/simple-sample.xhtml 2010-09-03 08:21:44 UTC (rev 19106)
@@ -6,7 +6,7 @@
xmlns:a4j="http://richfaces.org/a4j"
xmlns:rich="http://richfaces.org/rich">
<style>
-.rf-tgp-i {
+.rf-tgp-itm {
border: 1px solid #{richSkin.panelBorderColor};
padding:5px;
}
Modified: trunk/ui/output/ui/src/main/java/org/richfaces/component/AbstractCollapsiblePanel.java
===================================================================
--- trunk/ui/output/ui/src/main/java/org/richfaces/component/AbstractCollapsiblePanel.java 2010-09-03 05:11:33 UTC (rev 19105)
+++ trunk/ui/output/ui/src/main/java/org/richfaces/component/AbstractCollapsiblePanel.java 2010-09-03 08:21:44 UTC (rev 19106)
@@ -42,8 +42,18 @@
public static final String COMPONENT_FAMILY = "org.richfaces.CollapsiblePanel";
public enum States {
- expanded,
- collapsed
+ expanded("exp"),
+ collapsed("colps");
+
+ private final String abbreviation;
+
+ States(String abbreviation) {
+ this.abbreviation = abbreviation;
+ }
+
+ public String abbreviation() {
+ return abbreviation;
+ }
}
protected AbstractCollapsiblePanel() {
Modified: trunk/ui/output/ui/src/main/java/org/richfaces/component/AbstractTogglePanelTitledItem.java
===================================================================
--- trunk/ui/output/ui/src/main/java/org/richfaces/component/AbstractTogglePanelTitledItem.java 2010-09-03 05:11:33 UTC (rev 19105)
+++ trunk/ui/output/ui/src/main/java/org/richfaces/component/AbstractTogglePanelTitledItem.java 2010-09-03 08:21:44 UTC (rev 19106)
@@ -39,9 +39,19 @@
public static final String COMPONENT_FAMILY = "org.richfaces.TogglePanelTitledItem";
public enum HeaderStates {
- active,
- inactive,
- disable
+ active("act"),
+ inactive("inact"),
+ disable("dis");
+
+ private final String abbreviation;
+
+ HeaderStates(String abbreviation) {
+ this.abbreviation = abbreviation;
+ }
+
+ public String abbreviation() {
+ return abbreviation;
+ }
}
protected AbstractTogglePanelTitledItem() {
Modified: trunk/ui/output/ui/src/main/java/org/richfaces/renderkit/html/AccordionItemRenderer.java
===================================================================
--- trunk/ui/output/ui/src/main/java/org/richfaces/renderkit/html/AccordionItemRenderer.java 2010-09-03 05:11:33 UTC (rev 19105)
+++ trunk/ui/output/ui/src/main/java/org/richfaces/renderkit/html/AccordionItemRenderer.java 2010-09-03 08:21:44 UTC (rev 19106)
@@ -33,6 +33,7 @@
import javax.faces.context.FacesContext;
import javax.faces.context.ResponseWriter;
import java.io.IOException;
+import java.util.Map;
import static org.richfaces.component.AbstractTogglePanelTitledItem.HeaderStates;
import static org.richfaces.component.html.HtmlAccordionItem.PropertyKeys;
@@ -41,13 +42,13 @@
/**
*
- * <div id="clientId" class="rf-aci">
- * <div id="clientId:header" class="rf-aci-h">
- * <div class="rf-aci-h-inactive">Level 1</div>
- * <div class="rf-aci-h-active" >Level 1</div>
- * <div class="rf-aci-h-disabled">Level 1</div>
+ * <div id="clientId" class="rf-ac-itm">
+ * <div id="clientId:header" class="rf-ac-itm-hdr">
+ * <div class="rf-ac-itm-hdr-inact">Level 1</div>
+ * <div class="rf-ac-itm-hdr-act" >Level 1</div>
+ * <div class="rf-ac-itm-hdr-dis">Level 1</div>
* </div>
- * <div id="clientId:content" class="rf-aci-c">
+ * <div id="clientId:content" class="rf-ac-itm-cnt">
* Content will be here.
* </div>
* </div>
@@ -85,7 +86,7 @@
@Override
protected String getStyleClass(UIComponent component) {
- return concatClasses("rf-aci", attributeAsString(component, "styleClass"));
+ return concatClasses("rf-ac-itm", attributeAsString(component, "styleClass"));
}
@Override
@@ -98,7 +99,7 @@
@Override
protected void writeJavaScript(ResponseWriter writer, FacesContext context, UIComponent component) throws IOException {
Object script = getScriptObject(context, component);
- if (script == null || ((AbstractTogglePanelTitledItem) component).isDisabled()) {
+ if (script == null) {
return;
}
@@ -110,7 +111,7 @@
private void encodeContentBegin(UIComponent component, ResponseWriter writer) throws IOException {
writer.startElement("div", component);
- writer.writeAttribute("class", concatClasses("rf-aci-c", attributeAsString(component, "contentClass")), null);
+ writer.writeAttribute("class", concatClasses("rf-ac-itm-cnt", attributeAsString(component, "contentClass")), null);
writer.writeAttribute("id", component.getClientId() + ":content", null);
AbstractTogglePanelTitledItem item = (AbstractTogglePanelTitledItem) component;
@@ -126,7 +127,7 @@
private void encodeHeader(FacesContext context, UIComponent component, ResponseWriter writer) throws IOException {
writer.startElement("div", component);
- writer.writeAttribute("class", concatClasses("rf-aci-h", attributeAsString(component, PropertyKeys.headerClass)), null);
+ writer.writeAttribute("class", concatClasses("rf-ac-itm-hdr", attributeAsString(component, PropertyKeys.headerClass)), null);
writer.writeAttribute("id", component.getClientId() + ":header", null);
renderPassThroughAttributes(context, component, HEADER_ATTRIBUTES);
@@ -150,7 +151,7 @@
}
String name = "headerClass" + capitalize(state.toString());
- writer.writeAttribute("class", concatClasses("rf-aci-h-" + state, attributeAsString(component, name)), null);
+ writer.writeAttribute("class", concatClasses("rf-ac-itm-hdr-" + state.abbreviation(), attributeAsString(component, name)), null);
UIComponent headerFacet = component.getHeaderFacet(state);
if (headerFacet != null && headerFacet.isRendered()) {
@@ -172,6 +173,14 @@
}
@Override
+ protected Map<String, Object> getScriptObjectOptions(FacesContext context, UIComponent component) {
+ Map<String, Object> res = super.getScriptObjectOptions(context, component);
+ res.put("disabled", ((AbstractTogglePanelTitledItem) component).isDisabled());
+
+ return res;
+ }
+
+ @Override
protected Class<? extends UIComponent> getComponentClass() {
return AbstractTogglePanelTitledItem.class;
}
Modified: trunk/ui/output/ui/src/main/java/org/richfaces/renderkit/html/AccordionRenderer.java
===================================================================
--- trunk/ui/output/ui/src/main/java/org/richfaces/renderkit/html/AccordionRenderer.java 2010-09-03 05:11:33 UTC (rev 19105)
+++ trunk/ui/output/ui/src/main/java/org/richfaces/renderkit/html/AccordionRenderer.java 2010-09-03 08:21:44 UTC (rev 19106)
@@ -68,7 +68,7 @@
@Override
protected String getStyleClass(UIComponent component) {
- return "rf-ac " + attributeAsString(component, "styleClass");
+ return HtmlUtil.concatClasses("rf-ac", attributeAsString(component, "styleClass"));
}
@Override
Modified: trunk/ui/output/ui/src/main/java/org/richfaces/renderkit/html/CollapsiblePanelRenderer.java
===================================================================
--- trunk/ui/output/ui/src/main/java/org/richfaces/renderkit/html/CollapsiblePanelRenderer.java 2010-09-03 05:11:33 UTC (rev 19105)
+++ trunk/ui/output/ui/src/main/java/org/richfaces/renderkit/html/CollapsiblePanelRenderer.java 2010-09-03 08:21:44 UTC (rev 19106)
@@ -121,7 +121,7 @@
private void encodeHeader(FacesContext context, UIComponent component, ResponseWriter writer) throws IOException {
writer.startElement("div", component);
writer.writeAttribute("id", component.getClientId(context) + ":header", null);
- writer.writeAttribute("class", concatClasses("rf-cp-hr", attributeAsString(component, "headerClass")), null);
+ writer.writeAttribute("class", concatClasses("rf-cp-hdr", attributeAsString(component, "headerClass")), null);
AbstractCollapsiblePanel panel = (AbstractCollapsiblePanel) component;
encodeHeader(context, component, writer, expanded, panel.isExpanded());
@@ -132,7 +132,7 @@
private void encodeHeader(FacesContext context, UIComponent component, ResponseWriter responseWriter, AbstractCollapsiblePanel.States state, boolean isVisible) throws IOException {
responseWriter.startElement("div", component);
- responseWriter.writeAttribute("class", "rf-cp-hr-" + state, null);
+ responseWriter.writeAttribute("class", "rf-cp-hdr-" + state.abbreviation(), null);
responseWriter.writeAttribute("style", concatStyles(styleElement("display", isVisible ? "" : "none"), attributeAsString(component, "headerClass")), null);
UIComponent header = AbstractTogglePanelTitledItem.getHeaderFacet(component, state);
Modified: trunk/ui/output/ui/src/main/java/org/richfaces/renderkit/html/TogglePanelItemRenderer.java
===================================================================
--- trunk/ui/output/ui/src/main/java/org/richfaces/renderkit/html/TogglePanelItemRenderer.java 2010-09-03 05:11:33 UTC (rev 19105)
+++ trunk/ui/output/ui/src/main/java/org/richfaces/renderkit/html/TogglePanelItemRenderer.java 2010-09-03 08:21:44 UTC (rev 19106)
@@ -54,7 +54,7 @@
@Override
protected String getStyleClass(UIComponent component) {
- return HtmlUtil.concatClasses("rf-tgp-i", attributeAsString(component, "styleClass"));
+ return HtmlUtil.concatClasses("rf-tgp-itm", attributeAsString(component, "styleClass"));
}
@Override
Modified: trunk/ui/output/ui/src/main/resources/META-INF/resources/org.richfaces/AccordionItem.js
===================================================================
--- trunk/ui/output/ui/src/main/resources/META-INF/resources/org.richfaces/AccordionItem.js 2010-09-03 05:11:33 UTC (rev 19105)
+++ trunk/ui/output/ui/src/main/resources/META-INF/resources/org.richfaces/AccordionItem.js 2010-09-03 08:21:44 UTC (rev 19106)
@@ -41,7 +41,9 @@
this.index = options["index"];
this.getTogglePanel().getItems()[this.index] = this;
- rf.Event.bindById(this.id + ":header", "click", this.__onHeaderClick, this);
+ if (!this.disabled) {
+ rf.Event.bindById(this.id + ":header", "click", this.__onHeaderClick, this);
+ }
if (this.isSelected()) {
var item = this;
@@ -66,7 +68,7 @@
__header : function (state) {
var res = $(rf.getDomElement(this.id + ":header"));
if (state) {
- return res.find(".rf-aci-h-" + state);
+ return res.find(".rf-ac-itm-hdr-" + state);
}
return res;
@@ -95,8 +97,8 @@
}
this.__content().show();
- this.__header("inactive").hide();
- this.__header("active").show();
+ this.__header("inact").hide();
+ this.__header("act").show();
return this.__fireEnter();
},
@@ -105,7 +107,7 @@
var h = parentPanel.getInnerHeight();
var items = parentPanel.getItems();
- for (var i = 0; i < items.length; i++) {
+ for (var i in items) {
h -= items[i].__header().outerHeight();
}
@@ -132,8 +134,8 @@
}
this.__content().hide();
- this.__header("active").hide();
- this.__header("inactive").show();
+ this.__header("act").hide();
+ this.__header("inact").show();
return true;
},
Modified: trunk/ui/output/ui/src/main/resources/META-INF/resources/org.richfaces/CollapsiblePanelItem.js
===================================================================
--- trunk/ui/output/ui/src/main/resources/META-INF/resources/org.richfaces/CollapsiblePanelItem.js 2010-09-03 05:11:33 UTC (rev 19105)
+++ trunk/ui/output/ui/src/main/resources/META-INF/resources/org.richfaces/CollapsiblePanelItem.js 2010-09-03 08:21:44 UTC (rev 19106)
@@ -51,7 +51,7 @@
__header : function (state) {
var res = $(rf.getDomElement(this.togglePanelId + ":header"));
if (state) {
- return res.find(".rf-cp-hr-" + state);
+ return res.find(".rf-cp-hdr-" + state);
}
return res;
Modified: trunk/ui/output/ui/src/main/resources/META-INF/resources/org.richfaces/TogglePanel.js
===================================================================
--- trunk/ui/output/ui/src/main/resources/META-INF/resources/org.richfaces/TogglePanel.js 2010-09-03 05:11:33 UTC (rev 19105)
+++ trunk/ui/output/ui/src/main/resources/META-INF/resources/org.richfaces/TogglePanel.js 2010-09-03 08:21:44 UTC (rev 19106)
@@ -322,7 +322,7 @@
__ITEMS_META_NAMES : (function () {
function goFrom (comp, ind, step) {
var res = ind;
- while (!comp.items[res] && res < comp.items.length && res > 0) {
+ while ((!comp.items[res] || comp.items[res].disabled) && res < comp.items.length && res > 0) {
res += step;
}
return res;
@@ -353,8 +353,8 @@
* */
__getItemIndex : function (itemName) {
for (var i in this.items) {
- if (this.items[i].getName() === itemName) {
- return i;
+ if (!this.items[i].disabled && this.items[i].getName() === itemName) {
+ return parseInt(i);
}
}
Modified: trunk/ui/output/ui/src/main/resources/META-INF/resources/org.richfaces/TogglePanelItem.js
===================================================================
--- trunk/ui/output/ui/src/main/resources/META-INF/resources/org.richfaces/TogglePanelItem.js 2010-09-03 05:11:33 UTC (rev 19105)
+++ trunk/ui/output/ui/src/main/resources/META-INF/resources/org.richfaces/TogglePanelItem.js 2010-09-03 08:21:44 UTC (rev 19106)
@@ -38,6 +38,7 @@
this.name = this.options.name;
this.togglePanelId = this.options.togglePanelId;
this.switchMode = this.options.switchMode;
+ this.disabled = this.options.disabled || false;
},
/***************************** Public Methods *****************************************************************/
Modified: trunk/ui/output/ui/src/main/resources/META-INF/resources/org.richfaces/accordion.ecss
===================================================================
--- trunk/ui/output/ui/src/main/resources/META-INF/resources/org.richfaces/accordion.ecss 2010-09-03 05:11:33 UTC (rev 19105)
+++ trunk/ui/output/ui/src/main/resources/META-INF/resources/org.richfaces/accordion.ecss 2010-09-03 08:21:44 UTC (rev 19106)
@@ -1,5 +1,4 @@
.rf-ac {
- /*width: 300px;*/ /*visible width*/
border-width: 1px;
border-style: solid;
border-color: '#{richSkin.panelBorderColor}';
@@ -7,7 +6,7 @@
background: '#{richSkin.generalBackgroundColor}';
}
-.rf-aci-h {
+.rf-ac-itm-hdr {
border-bottom-width: 1px;
border-bottom-style: solid;
border-bottom-color: '#{richSkin.panelBorderColor}';
@@ -24,13 +23,17 @@
cursor: pointer;
}
-.rf-aci-c {
+.rf-ac-itm-hdr-act {}
+.rf-ac-itm-hdr-inact {}
+.rf-ac-itm-hdr-dis {}
+
+.rf-ac-itm-cnt {
border-bottom-width: 1px;
border-bottom-style: solid;
border-bottom-color: '#{richSkin.panelBorderColor}';
- /*height: 100px*/ /*visible modal panel height minus header height*/;
position: relative;
overflow: auto;
overflow-x: hidden;
padding: 10px;
-}
\ No newline at end of file
+}
+
Modified: trunk/ui/output/ui/src/main/resources/META-INF/resources/org.richfaces/collapsiblePanel.ecss
===================================================================
--- trunk/ui/output/ui/src/main/resources/META-INF/resources/org.richfaces/collapsiblePanel.ecss 2010-09-03 05:11:33 UTC (rev 19105)
+++ trunk/ui/output/ui/src/main/resources/META-INF/resources/org.richfaces/collapsiblePanel.ecss 2010-09-03 08:21:44 UTC (rev 19106)
@@ -6,7 +6,7 @@
padding:1px;
}
-.rf-cp-hr{
+.rf-cp-hdr{
background-color:'#{richSkin.headerBackgroundColor}';
border-color:'#{richSkin.headerBackgroundColor}';
font-size:'#{richSkin.headerSizeFont}';
@@ -21,6 +21,9 @@
background-image:"url(#{resource['org.richfaces.renderkit.html.GradientA']})";
}
+.rf-cp-hdr-exp {}
+.rf-cp-hdr-colps {}
+
.rf-cp-b{
font-size:'#{richSkin.generalSizeFont}';
color:'#{richSkin.generalTextColor}';
14 years, 3 months
JBoss Rich Faces SVN: r19105 - in modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest: a4jCommandLink and 1 other directory.
by richfaces-svn-commits@lists.jboss.org
Author: lfryc(a)redhat.com
Date: 2010-09-03 01:11:33 -0400 (Fri, 03 Sep 2010)
New Revision: 19105
Modified:
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/a4jCommandButton/TestA4JCommandButton.java
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/a4jCommandLink/TestA4JCommandLink.java
Log:
issue tracking for RF-9307
Modified: modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/a4jCommandButton/TestA4JCommandButton.java
===================================================================
--- modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/a4jCommandButton/TestA4JCommandButton.java 2010-09-03 04:41:04 UTC (rev 19104)
+++ modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/a4jCommandButton/TestA4JCommandButton.java 2010-09-03 05:11:33 UTC (rev 19105)
@@ -34,6 +34,7 @@
import org.jboss.test.selenium.locator.AttributeLocator;
import org.jboss.test.selenium.locator.JQueryLocator;
import org.richfaces.tests.metamer.ftest.AbstractMetamerTest;
+import org.richfaces.tests.metamer.ftest.annotations.IssueTracking;
import org.testng.annotations.Test;
/**
@@ -266,6 +267,7 @@
}
@Test
+ @IssueTracking("https://jira.jboss.org/browse/RF-9307")
public void testStyleClass() {
JQueryLocator wide = pjq("input[name$=styleClassInput][value=wide]");
JQueryLocator big = pjq("input[name$=styleClassInput][value=big]");
Modified: modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/a4jCommandLink/TestA4JCommandLink.java
===================================================================
--- modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/a4jCommandLink/TestA4JCommandLink.java 2010-09-03 04:41:04 UTC (rev 19104)
+++ modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/a4jCommandLink/TestA4JCommandLink.java 2010-09-03 05:11:33 UTC (rev 19105)
@@ -34,6 +34,7 @@
import org.jboss.test.selenium.locator.AttributeLocator;
import org.jboss.test.selenium.locator.JQueryLocator;
import org.richfaces.tests.metamer.ftest.AbstractMetamerTest;
+import org.richfaces.tests.metamer.ftest.annotations.IssueTracking;
import org.testng.annotations.Test;
/**
@@ -269,6 +270,7 @@
}
@Test
+ @IssueTracking("https://jira.jboss.org/browse/RF-9307")
public void testStyleClass() {
JQueryLocator bold = pjq("input[name$=styleClassInput][value=bold]");
JQueryLocator strike = pjq("input[name$=styleClassInput][value=strike]");
14 years, 3 months
JBoss Rich Faces SVN: r19104 - modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/a4jStatus.
by richfaces-svn-commits@lists.jboss.org
Author: lfryc(a)redhat.com
Date: 2010-09-03 00:41:04 -0400 (Fri, 03 Sep 2010)
New Revision: 19104
Modified:
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/a4jStatus/TestReferencedUsage.java
Log:
a4j:status - fixed testDoubleClick; disabling testClickFirstButtonThenSecondButtonThenAgainFirstButtonImmediately (see comment)
Modified: modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/a4jStatus/TestReferencedUsage.java
===================================================================
--- modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/a4jStatus/TestReferencedUsage.java 2010-09-03 03:53:33 UTC (rev 19103)
+++ modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/a4jStatus/TestReferencedUsage.java 2010-09-03 04:41:04 UTC (rev 19104)
@@ -92,9 +92,12 @@
disableHalt();
}
- @Test
+ /**
+ * @Test
+ * TODO: selenium is causing 3 requests, but manually we triggers 2 requests (use Firebug to reproduce)
+ */
public void testClickFirstButtonThenSecondButtonThenAgainFirstButtonImmediately() {
- enableHalt();
+ enableHalt();
selenium.click(button1);
selenium.click(button2);
selenium.click(button1);
@@ -116,12 +119,11 @@
public void testDoubleClick() {
enableHalt();
selenium.click(button1);
- selenium.click(button2);
- selenium.click(button1);
waitForHalt();
assertEquals(retrieveStatus1.retrieve(), "START");
assertEquals(retrieveStatus2.retrieve(), "STOP");
unhalt();
+ selenium.click(button1);
waitForHalt();
assertEquals(retrieveStatus1.retrieve(), "START");
assertEquals(retrieveStatus2.retrieve(), "STOP");
14 years, 3 months