JBoss Rich Faces SVN: r19255 - in trunk: examples/output-demo/src/main/webapp/qunit and 5 other directories.
by richfaces-svn-commits@lists.jboss.org
Author: nbelaevski
Date: 2010-09-18 19:11:09 -0400 (Sat, 18 Sep 2010)
New Revision: 19255
Added:
trunk/examples/output-demo/src/main/webapp/qunit/tab.xhtml
trunk/examples/output-demo/src/main/webapp/resources/tests/richfaces-accordion-item-qunit.js
trunk/examples/output-demo/src/main/webapp/resources/tests/richfaces-tab-qunit.js
trunk/ui/output/ui/src/main/java/org/richfaces/component/AbstractTabPanel.java
trunk/ui/output/ui/src/main/java/org/richfaces/component/html/HtmlTab.java
trunk/ui/output/ui/src/main/java/org/richfaces/component/html/HtmlTabPanel.java
trunk/ui/output/ui/src/main/java/org/richfaces/renderkit/html/TabPanelRenderer.java
trunk/ui/output/ui/src/main/java/org/richfaces/renderkit/html/TabRenderer.java
trunk/ui/output/ui/src/test/java/org/richfaces/component/UICollapsiblePanelTest.java
trunk/ui/output/ui/src/test/java/org/richfaces/component/UITogglePanelTitledItemTest.java
Modified:
trunk/
Log:
Merged revisions 19109-19110,19113,19160,19199 via svnmerge from
https://svn.jboss.org/repos/richfaces/branches/RF-7944
Property changes on: trunk
___________________________________________________________________
Name: svnmerge-integrated
- /branches/RF-7944:1-18996
+ /branches/RF-7944:1-19249
Copied: trunk/examples/output-demo/src/main/webapp/qunit/tab.xhtml (from rev 19199, branches/RF-7944/examples/output-demo/src/main/webapp/qunit/tab.xhtml)
===================================================================
--- trunk/examples/output-demo/src/main/webapp/qunit/tab.xhtml (rev 0)
+++ trunk/examples/output-demo/src/main/webapp/qunit/tab.xhtml 2010-09-18 23:11:09 UTC (rev 19255)
@@ -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>
+
Copied: trunk/examples/output-demo/src/main/webapp/resources/tests/richfaces-accordion-item-qunit.js (from rev 19199, branches/RF-7944/examples/output-demo/src/main/webapp/resources/tests/richfaces-accordion-item-qunit.js)
===================================================================
--- trunk/examples/output-demo/src/main/webapp/resources/tests/richfaces-accordion-item-qunit.js (rev 0)
+++ trunk/examples/output-demo/src/main/webapp/resources/tests/richfaces-accordion-item-qunit.js 2010-09-18 23:11:09 UTC (rev 19255)
@@ -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: trunk/examples/output-demo/src/main/webapp/resources/tests/richfaces-tab-qunit.js
===================================================================
--- trunk/examples/output-demo/src/main/webapp/resources/tests/richfaces-tab-qunit.js (rev 0)
+++ trunk/examples/output-demo/src/main/webapp/resources/tests/richfaces-tab-qunit.js 2010-09-18 23:11:09 UTC (rev 19255)
@@ -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: trunk/ui/output/ui/src/main/java/org/richfaces/component/AbstractTabPanel.java
===================================================================
--- trunk/ui/output/ui/src/main/java/org/richfaces/component/AbstractTabPanel.java (rev 0)
+++ trunk/ui/output/ui/src/main/java/org/richfaces/component/AbstractTabPanel.java 2010-09-18 23:11:09 UTC (rev 19255)
@@ -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: trunk/ui/output/ui/src/main/java/org/richfaces/component/html/HtmlTab.java
===================================================================
--- trunk/ui/output/ui/src/main/java/org/richfaces/component/html/HtmlTab.java (rev 0)
+++ trunk/ui/output/ui/src/main/java/org/richfaces/component/html/HtmlTab.java 2010-09-18 23:11:09 UTC (rev 19255)
@@ -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: trunk/ui/output/ui/src/main/java/org/richfaces/component/html/HtmlTabPanel.java
===================================================================
--- trunk/ui/output/ui/src/main/java/org/richfaces/component/html/HtmlTabPanel.java (rev 0)
+++ trunk/ui/output/ui/src/main/java/org/richfaces/component/html/HtmlTabPanel.java 2010-09-18 23:11:09 UTC (rev 19255)
@@ -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: trunk/ui/output/ui/src/main/java/org/richfaces/renderkit/html/TabPanelRenderer.java
===================================================================
--- trunk/ui/output/ui/src/main/java/org/richfaces/renderkit/html/TabPanelRenderer.java (rev 0)
+++ trunk/ui/output/ui/src/main/java/org/richfaces/renderkit/html/TabPanelRenderer.java 2010-09-18 23:11:09 UTC (rev 19255)
@@ -0,0 +1,244 @@
+/*
+ * 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.AbstractTabPanel;
+import org.richfaces.component.AbstractTogglePanel;
+import org.richfaces.component.AbstractTogglePanelItem;
+import org.richfaces.component.AbstractTogglePanelTitledItem;
+import org.richfaces.component.html.HtmlTab;
+import org.richfaces.component.util.HtmlUtil;
+import org.richfaces.renderkit.HtmlConstants;
+import org.richfaces.renderkit.RenderKitUtils;
+
+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.Map;
+
+import static org.richfaces.component.AbstractTogglePanelTitledItem.HeaderStates.*;
+import static org.richfaces.component.AbstractTogglePanelTitledItem.HeaderStates.active;
+import static org.richfaces.component.html.HtmlAccordion.PropertyKeys.height;
+import static org.richfaces.component.util.HtmlUtil.concatClasses;
+import static org.richfaces.component.util.HtmlUtil.concatStyles;
+import static org.richfaces.renderkit.RenderKitUtils.renderPassThroughAttributes;
+
+/**
+ * @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-event.js"),
+ @ResourceDependency(name = "richfaces-base-component.js"),
+ @ResourceDependency(library = "org.richfaces", name = "tabPanel.ecss"),
+ @ResourceDependency(library = "org.richfaces", name = "TogglePanel.js"),
+ @ResourceDependency(library = "org.richfaces", name = "TabPanel.js")
+})
+public class TabPanelRenderer extends TogglePanelRenderer {
+
+ private static final RenderKitUtils.Attributes HEADER_ATTRIBUTES = RenderKitUtils.attributes()
+ .generic("style", HtmlTab.PropertyKeys.headerStyle.toString())
+ .generic("onclick", HtmlTab.PropertyKeys.onheaderclick.toString(), "headerclick")
+ .generic("ondblclick", HtmlTab.PropertyKeys.onheaderdblclick.toString(), "headerdblclick")
+ .generic("onmousedown", HtmlTab.PropertyKeys.onheadermousedown.toString(), "headermousedown")
+ .generic("onmousemove", HtmlTab.PropertyKeys.onheadermousemove.toString(), "headermousemove")
+ .generic("onmouseup", HtmlTab.PropertyKeys.onheadermouseup.toString(), "headermouseup");
+
+ private static final String DIV = "div";
+ private static final String STYLE = "style";
+ private static final String CLASS = "class";
+
+ @Override
+ protected void doEncodeBegin(ResponseWriter w, FacesContext context, UIComponent comp) throws IOException {
+ super.doEncodeBegin(w, context, comp);
+ writeJavaScript(w, context, comp);
+
+ writeTabsLine(w, context, comp);
+ writeTabsLineSeparator(w);
+ }
+
+ private void writeTabsLineSeparator(ResponseWriter writer) throws IOException {
+ writer.write("<div class='rf-tb-hdr_border'></div>");
+ }
+
+ private void writeTabsLine(ResponseWriter w, FacesContext context, UIComponent comp) throws IOException {
+ w.startElement(DIV, comp);
+ w.writeAttribute(CLASS, "rf-tb-hdr_tabline_vis", null);
+
+ w.startElement("table", comp);
+ w.writeAttribute("class", "rf-tb-hdr_tabs", null);
+ w.writeAttribute("cellspacing", "0", null);
+ w.startElement("tbody", comp);
+ w.startElement("tr", comp);
+
+ writeTopTabFirstSpacer(w, comp);
+
+ for (AbstractTogglePanelItem item : ((AbstractTogglePanel) comp).getRenderedItems()) {
+ AbstractTogglePanelTitledItem tab = (AbstractTogglePanelTitledItem) item;
+ writeTopTabHeader(context, w, tab);
+ writeTopTabSpacer(w, comp);
+ }
+
+ writeTopTabLastSpacer(w, comp);
+
+ w.endElement("tr");
+ w.endElement("tbody");
+ w.endElement("table");
+
+ writeTopTabsControl(w, comp, "rf-tb-hdr_scroll_left rftp_hidden", "«");
+ writeTopTabsControl(w, comp, "rf-tb-hdr_tabslist rftp_hidden", "↓");
+ writeTopTabsControl(w, comp, "rf-tb-hdr_scroll_right rftp_hidden", "»");
+
+ w.endElement("div");
+ }
+
+ @Override
+ protected String getStyle(UIComponent component) {
+ return concatStyles(attributeAsString(component, "style"), "width: 100%;");
+ }
+
+ @Override
+ protected String getStyleClass(UIComponent component) {
+ return HtmlUtil.concatClasses("rf-tbp", attributeAsString(component, "styleClass"));
+ }
+
+
+ private void writeTopTabHeader(FacesContext context, ResponseWriter writer, AbstractTogglePanelTitledItem tab) throws IOException {
+ writer.startElement("td", tab);
+ writer.writeAttribute("id", tab.getClientId() + ":header", null);
+ writer.writeAttribute("class", concatClasses("rf-tb-hdr", attributeAsString(tab, HtmlTab.PropertyKeys.headerClass)), null);
+ renderPassThroughAttributes(context, tab, HEADER_ATTRIBUTES);
+
+ boolean isActive = tab.isActive();
+ boolean isDisabled = tab.isDisabled();
+ encodeTabHeader(context, tab, writer, inactive, !isActive && !isDisabled);
+ encodeTabHeader(context, tab, writer, active, isActive && !isDisabled);
+ encodeTabHeader(context, tab, writer, disable, isDisabled);
+
+ writer.endElement("td");
+ }
+
+ private void encodeTabHeader(FacesContext context, AbstractTogglePanelTitledItem tab, ResponseWriter writer,
+ AbstractTogglePanelTitledItem.HeaderStates state, Boolean isDisplay) throws IOException {
+
+ writer.startElement("div", tab);
+ writer.writeAttribute("id", tab.getClientId() + ":header:" + state, null);
+ writer.writeAttribute("style", concatStyles("white-space: nowrap", isDisplay ? "" : "display : none"), null);
+
+ String name = "headerClass" + capitalize(state.toString());
+ writer.writeAttribute("class", concatClasses("rf-tb-hdr-" + state.abbreviation(), attributeAsString(tab, name)), null);
+
+ writeTopTabIcon(context, tab, writer, "rftp_icon", "ico.gif");
+
+ writer.startElement("span", tab);
+ writer.writeAttribute("class", "rftp_label", null);
+
+ UIComponent headerFacet = tab.getHeaderFacet(state);
+ if (headerFacet != null && headerFacet.isRendered()) {
+ headerFacet.encodeAll(context);
+ } else {
+ Object headerText = tab.getAttributes().get("header");
+ if (headerText != null && !headerText.equals("")) {
+ writer.writeText(headerText, null);
+ }
+ }
+
+ writer.endElement("span");
+
+ writeTopTabIcon(context, tab, writer, "rftp_close", "close_act.gif");
+
+ writer.endElement("div");
+ }
+
+
+
+ private void writeTopTabsControl(ResponseWriter w, UIComponent comp, String styles, String text) throws IOException {
+ w.startElement("div", comp);
+ w.writeAttribute("class", styles, null);
+ w.writeText(text, null);
+ w.endElement("div");
+ }
+
+ private void writeTopTabIcon(FacesContext context, UIComponent comp, ResponseWriter writer, String styleClass, String image) throws IOException {
+ writer.startElement("img", comp);
+ writer.writeAttribute("width", 16, null);
+ writer.writeAttribute("height", 16, null);
+ writer.writeAttribute("class", styleClass, null);
+
+ String imagePath = context.getApplication().getResourceHandler().createResource("org.richfaces/" + image).getRequestPath();
+ writer.writeAttribute("src", imagePath, null);
+ }
+
+ private void writeTopTabFirstSpacer(ResponseWriter w, UIComponent comp) throws IOException {
+ writeTopTabSpacer(w, comp, "padding-left: 5px;", "rf-tb-hdr_spacer");
+ }
+
+ private void writeTopTabSpacer(ResponseWriter w, UIComponent comp) throws IOException {
+ writeTopTabSpacer(w, comp, "", "rf-tb-hdr_spacer rftp_horizonttab_tabspacer_width");
+ }
+
+ private void writeTopTabLastSpacer(ResponseWriter w, UIComponent comp) throws IOException {
+ writeTopTabSpacer(w, comp, "padding-right: 5px; width: 100%;", "rf-tb-hdr_spacer");
+ }
+
+ private void writeTopTabSpacer(ResponseWriter w, UIComponent comp, String style, String classStyle) throws IOException {
+ w.startElement("td", comp);
+ w.writeAttribute(STYLE, style, null);
+ w.writeAttribute(CLASS, classStyle, null);
+ w.startElement("br", comp);
+ w.endElement("td");
+ }
+
+ @Override
+ protected void doEncodeEnd(ResponseWriter writer, FacesContext context, UIComponent component) throws IOException {
+ writer.endElement(HtmlConstants.DIV_ELEM);
+ }
+
+ @Override
+ protected JSObject getScriptObject(FacesContext context, UIComponent component) {
+ return new JSObject("RichFaces.ui.TabPanel",
+ component.getClientId(), getScriptObjectOptions(context, component));
+ }
+
+ @Override
+ protected Map<String, Object> getScriptObjectOptions(FacesContext context, UIComponent component) {
+ Map<String, Object> options = super.getScriptObjectOptions(context, component);
+ options.put("isKeepHeight", !attributeAsString(component, height).isEmpty());
+ options.remove("items");
+
+ return options;
+ }
+
+ @Override
+ protected Class<? extends UIComponent> getComponentClass() {
+ return AbstractTabPanel.class;
+ }
+}
+
Added: trunk/ui/output/ui/src/main/java/org/richfaces/renderkit/html/TabRenderer.java
===================================================================
--- trunk/ui/output/ui/src/main/java/org/richfaces/renderkit/html/TabRenderer.java (rev 0)
+++ trunk/ui/output/ui/src/main/java/org/richfaces/renderkit/html/TabRenderer.java 2010-09-18 23:11:09 UTC (rev 19255)
@@ -0,0 +1,120 @@
+/*
+ * 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.AbstractTogglePanelTitledItem;
+import org.richfaces.renderkit.HtmlConstants;
+
+import javax.faces.application.ResourceDependencies;
+import javax.faces.application.ResourceDependency;
+import javax.faces.component.UIComponent;
+import javax.faces.context.FacesContext;
+import javax.faces.context.ResponseWriter;
+import java.io.IOException;
+import java.util.Map;
+
+import static org.richfaces.component.util.HtmlUtil.concatClasses;
+
+/**
+ * @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-event.js"),
+ @ResourceDependency(name = "richfaces-base-component.js"),
+ @ResourceDependency(library = "org.richfaces", name = "TogglePanelItem.js"),
+ @ResourceDependency(library = "org.richfaces", name = "Tab.js")
+})
+public class TabRenderer extends TogglePanelItemRenderer {
+
+ @Override
+ protected void doEncodeBegin(ResponseWriter writer, FacesContext context, UIComponent component) throws IOException {
+ super.doEncodeBegin(writer, context, component);
+
+ encodeContentBegin(component, writer);
+ }
+
+ @Override
+ protected String getStyleClass(UIComponent component) {
+ return concatClasses("rf-tb", attributeAsString(component, "styleClass"));
+ }
+
+ @Override
+ protected void doEncodeEnd(ResponseWriter writer, FacesContext context, UIComponent component) throws IOException {
+ encodeContentEnd(component, writer);
+
+ super.doEncodeEnd(writer, context, component);
+ }
+
+ @Override
+ protected void writeJavaScript(ResponseWriter writer, FacesContext context, UIComponent component) throws IOException {
+ Object script = getScriptObject(context, component);
+ if (script == null) {
+ return;
+ }
+
+ writer.startElement(HtmlConstants.SCRIPT_ELEM, component);
+ writer.writeAttribute(HtmlConstants.TYPE_ATTR, "text/javascript", "type");
+ writer.writeText(script, null);
+ writer.endElement(HtmlConstants.SCRIPT_ELEM);
+ }
+
+ private void encodeContentBegin(UIComponent component, ResponseWriter writer) throws IOException {
+ writer.startElement("div", component);
+ writer.writeAttribute("class", concatClasses("rf-tb-cnt", attributeAsString(component, "contentClass")), null);
+ writer.writeAttribute("id", component.getClientId() + ":content", null);
+
+ AbstractTogglePanelTitledItem item = (AbstractTogglePanelTitledItem) component;
+ if (!item.isActive() || item.isDisabled()) {
+ writer.writeAttribute("style", "display: none", null);
+ }
+ }
+
+ private void encodeContentEnd(UIComponent component, ResponseWriter responseWriter) throws IOException {
+ responseWriter.endElement("div");
+ }
+
+ @Override
+ protected JSObject getScriptObject(FacesContext context, UIComponent component) {
+ return new JSObject("RichFaces.ui.Tab", component.getClientId(),
+ getScriptObjectOptions(context, component));
+ }
+
+ @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;
+ }
+}
+
Added: trunk/ui/output/ui/src/test/java/org/richfaces/component/UICollapsiblePanelTest.java
===================================================================
--- trunk/ui/output/ui/src/test/java/org/richfaces/component/UICollapsiblePanelTest.java (rev 0)
+++ trunk/ui/output/ui/src/test/java/org/richfaces/component/UICollapsiblePanelTest.java 2010-09-18 23:11:09 UTC (rev 19255)
@@ -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: trunk/ui/output/ui/src/test/java/org/richfaces/component/UITogglePanelTitledItemTest.java
===================================================================
--- trunk/ui/output/ui/src/test/java/org/richfaces/component/UITogglePanelTitledItemTest.java (rev 0)
+++ trunk/ui/output/ui/src/test/java/org/richfaces/component/UITogglePanelTitledItemTest.java 2010-09-18 23:11:09 UTC (rev 19255)
@@ -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);
+ }
+}
+
13 years, 8 months
JBoss Rich Faces SVN: r19254 - modules/tests/metamer/trunk.
by richfaces-svn-commits@lists.jboss.org
Author: lfryc(a)redhat.com
Date: 2010-09-18 05:19:59 -0400 (Sat, 18 Sep 2010)
New Revision: 19254
Modified:
modules/tests/metamer/trunk/pom.xml
Log:
reverting testng version to 5.12.1
Modified: modules/tests/metamer/trunk/pom.xml
===================================================================
--- modules/tests/metamer/trunk/pom.xml 2010-09-18 08:42:31 UTC (rev 19253)
+++ modules/tests/metamer/trunk/pom.xml 2010-09-18 09:19:59 UTC (rev 19254)
@@ -141,7 +141,7 @@
<dependency>
<groupId>org.testng</groupId>
<artifactId>testng</artifactId>
- <version>5.14</version>
+ <version>5.12.1</version>
</dependency>
</dependencies>
</dependencyManagement>
13 years, 8 months
JBoss Rich Faces SVN: r19253 - modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richJQuery.
by richfaces-svn-commits@lists.jboss.org
Author: lfryc(a)redhat.com
Date: 2010-09-18 04:42:31 -0400 (Sat, 18 Sep 2010)
New Revision: 19253
Modified:
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richJQuery/RichJQueryAttributes.java
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richJQuery/TestSimple.java
Log:
use string constants instead of item from JQueryTiming enumeration to avoid additional dependencies
Modified: modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richJQuery/RichJQueryAttributes.java
===================================================================
--- modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richJQuery/RichJQueryAttributes.java 2010-09-18 08:01:56 UTC (rev 19252)
+++ modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richJQuery/RichJQueryAttributes.java 2010-09-18 08:42:31 UTC (rev 19253)
@@ -23,7 +23,6 @@
import org.jboss.test.selenium.encapsulated.JavaScript;
import org.jboss.test.selenium.locator.JQueryLocator;
-import org.richfaces.component.JQueryTiming;
import org.richfaces.tests.metamer.ftest.AbstractComponentAttributes;
/**
@@ -52,8 +51,7 @@
setProperty("selector", rawLocator);
}
- public void setTiming(JQueryTiming timing) {
- String timingString = timing == null ? null : timing.toString();
- setProperty("timing", timingString);
+ public void setTiming(String timing) {
+ setProperty("timing", timing);
}
}
Modified: modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richJQuery/TestSimple.java
===================================================================
--- modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richJQuery/TestSimple.java 2010-09-18 08:01:56 UTC (rev 19252)
+++ modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richJQuery/TestSimple.java 2010-09-18 08:42:31 UTC (rev 19253)
@@ -30,7 +30,6 @@
import org.jboss.test.selenium.css.CssProperty;
import org.jboss.test.selenium.locator.JQueryLocator;
-import org.richfaces.component.JQueryTiming;
import org.richfaces.tests.metamer.ftest.AbstractMetamerTest;
import org.testng.annotations.Test;
@@ -113,14 +112,14 @@
attributes.setEvent("click");
attributes.setQuery(js("$(this).css('color', 'red')"));
attributes.setSelector(button);
- attributes.setTiming(JQueryTiming.immediate);
+ attributes.setTiming("immediate");
}
private void setupDomReadyTypeAttributes() {
attributes.setEvent(null);
attributes.setQuery(js("css('color', 'red')"));
attributes.setSelector(button);
- attributes.setTiming(JQueryTiming.domready);
+ attributes.setTiming("domready");
}
}
\ No newline at end of file
13 years, 8 months
JBoss Rich Faces SVN: r19252 - modules/tests/metamer/trunk/ftest-source/src/main/java/org/testng.
by richfaces-svn-commits@lists.jboss.org
Author: lfryc(a)redhat.com
Date: 2010-09-18 04:01:56 -0400 (Sat, 18 Sep 2010)
New Revision: 19252
Removed:
modules/tests/metamer/trunk/ftest-source/src/main/java/org/testng/Assert.java
Log:
removing the workaround for org.testng.Assert runtime collision (causing collisions on hudson, needs to be modified locally only)
Deleted: modules/tests/metamer/trunk/ftest-source/src/main/java/org/testng/Assert.java
===================================================================
--- modules/tests/metamer/trunk/ftest-source/src/main/java/org/testng/Assert.java 2010-09-18 05:00:39 UTC (rev 19251)
+++ modules/tests/metamer/trunk/ftest-source/src/main/java/org/testng/Assert.java 2010-09-18 08:01:56 UTC (rev 19252)
@@ -1,676 +0,0 @@
-package org.testng;
-
-import org.testng.collections.Lists;
-
-import java.lang.reflect.Array;
-import java.util.Arrays;
-import java.util.Collection;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-
-
-/**
- * Assertion tool class. Presents assertion methods with a more natural parameter order.
- * The order is always <B>actualValue</B>, <B>expectedValue</B> [, message].
- *
- * @author <a href='mailto:the_mindstorm@evolva.ro'>Alexandru Popescu</a>
- */
-public class Assert {
-
- /**
- * Protect constructor since it is a static only class
- */
- protected Assert() {
- // hide constructor
- }
-
- /**
- * Asserts that a condition is true. If it isn't,
- * an AssertionError, with the given message, is thrown.
- * @param condition the condition to evaluate
- * @param message the assertion error message
- */
- static public void assertTrue(boolean condition, CharSequence message) {
- if(!condition) {
- failNotEquals( Boolean.valueOf(condition), Boolean.TRUE, message);
- }
- }
-
- /**
- * Asserts that a condition is true. If it isn't,
- * an AssertionError is thrown.
- * @param condition the condition to evaluate
- */
- static public void assertTrue(boolean condition) {
- assertTrue(condition, null);
- }
-
- /**
- * Asserts that a condition is false. If it isn't,
- * an AssertionError, with the given message, is thrown.
- * @param condition the condition to evaluate
- * @param message the assertion error message
- */
- static public void assertFalse(boolean condition, CharSequence message) {
- if(condition) {
- failNotEquals( Boolean.valueOf(condition), Boolean.FALSE, message); // TESTNG-81
- }
- }
-
- /**
- * Asserts that a condition is false. If it isn't,
- * an AssertionError is thrown.
- * @param condition the condition to evaluate
- */
- static public void assertFalse(boolean condition) {
- assertFalse(condition, null);
- }
-
- /**
- * Fails a test with the given message and wrapping the original exception.
- *
- * @param message the assertion error message
- * @param realCause the original exception
- */
- static public void fail(CharSequence message, Throwable realCause) {
- AssertionError ae = new AssertionError(message);
- ae.initCause(realCause);
-
- throw ae;
- }
-
- /**
- * Fails a test with the given message.
- * @param message the assertion error message
- */
- static public void fail(CharSequence message) {
- throw new AssertionError(message);
- }
-
- /**
- * Fails a test with no message.
- */
- static public void fail() {
- fail(null);
- }
-
- /**
- * Asserts that two objects are equal. If they are not,
- * an AssertionError, with the given message, is thrown.
- * @param actual the actual value
- * @param expected the expected value
- * @param message the assertion error message
- */
- static public void assertEquals(Object actual, Object expected, CharSequence message) {
- if((expected == null) && (actual == null)) {
- return;
- }
- if(expected != null) {
- if (expected.getClass().isArray()) {
- assertArrayEquals(actual, expected, message);
- return;
- } else if (expected.equals(actual)) {
- return;
- }
- }
- failNotEquals(actual, expected, message);
- }
-
- /**
- * Asserts that two objects are equal. It they are not, an AssertionError,
- * with given message, is thrown.
- * @param actual the actual value
- * @param expected the expected value (should be an non-null array value)
- * @param message the assertion error message
- */
- private static void assertArrayEquals(Object actual, Object expected, CharSequence message) {
- //is called only when expected is an array
- if (actual.getClass().isArray()) {
- int expectedLength = Array.getLength(expected);
- if (expectedLength == Array.getLength(actual)) {
- for (int i = 0 ; i < expectedLength ; i++) {
- Object _actual = Array.get(actual, i);
- Object _expected = Array.get(expected, i);
- try {
- assertEquals(_actual, _expected);
- } catch (AssertionError ae) {
- failNotEquals(actual, expected, message == null ? "" : message
- + " (values as index " + i + " are not the same)");
- }
- }
- //array values matched
- return;
- } else {
- failNotEquals(Array.getLength(actual), expectedLength, message == null ? "" : message
- + " (Array lengths are not the same)");
- }
- }
- failNotEquals(actual, expected, message);
- }
-
-/**
- * Asserts that two objects are equal. If they are not,
- * an AssertionError is thrown.
- * @param actual the actual value
- * @param expected the expected value
- */
- static public void assertEquals(Object actual, Object expected) {
- assertEquals(actual, expected, null);
- }
-
- /**
- * Asserts that two Strings are equal. If they are not,
- * an AssertionError, with the given message, is thrown.
- * @param actual the actual value
- * @param expected the expected value
- * @param message the assertion error message
- */
- static public void assertEquals(String actual, String expected, CharSequence message) {
- assertEquals((Object) actual, (Object) expected, message);
- }
-
- /**
- * Asserts that two Strings are equal. If they are not,
- * an AssertionError is thrown.
- * @param actual the actual value
- * @param expected the expected value
- */
- static public void assertEquals(String actual, String expected) {
- assertEquals(actual, expected, null);
- }
-
- /**
- * Asserts that two doubles are equal concerning a delta. If they are not,
- * an AssertionError, with the given message, is thrown. If the expected
- * value is infinity then the delta value is ignored.
- * @param actual the actual value
- * @param expected the expected value
- * @param delta the absolute tolerate value value between the actual and expected value
- * @param message the assertion error message
- */
- static public void assertEquals(double actual, double expected, double delta, CharSequence message) {
- // handle infinity specially since subtracting to infinite values gives NaN and the
- // the following test fails
- if(Double.isInfinite(expected)) {
- if(!(expected == actual)) {
- failNotEquals(new Double(actual), new Double(expected), message);
- }
- }
- else if(!(Math.abs(expected - actual) <= delta)) { // Because comparison with NaN always returns false
- failNotEquals(new Double(actual), new Double(expected), message);
- }
- }
-
- /**
- * Asserts that two doubles are equal concerning a delta. If they are not,
- * an AssertionError is thrown. If the expected value is infinity then the
- * delta value is ignored.
- * @param actual the actual value
- * @param expected the expected value
- * @param delta the absolute tolerate value value between the actual and expected value
- */
- static public void assertEquals(double actual, double expected, double delta) {
- assertEquals(actual, expected, delta, null);
- }
-
- /**
- * Asserts that two floats are equal concerning a delta. If they are not,
- * an AssertionError, with the given message, is thrown. If the expected
- * value is infinity then the delta value is ignored.
- * @param actual the actual value
- * @param expected the expected value
- * @param delta the absolute tolerate value value between the actual and expected value
- * @param message the assertion error message
- */
- static public void assertEquals(float actual, float expected, float delta, CharSequence message) {
- // handle infinity specially since subtracting to infinite values gives NaN and the
- // the following test fails
- if(Float.isInfinite(expected)) {
- if(!(expected == actual)) {
- failNotEquals(new Float(actual), new Float(expected), message);
- }
- }
- else if(!(Math.abs(expected - actual) <= delta)) {
- failNotEquals(new Float(actual), new Float(expected), message);
- }
- }
-
- /**
- * Asserts that two floats are equal concerning a delta. If they are not,
- * an AssertionError is thrown. If the expected
- * value is infinity then the delta value is ignored.
- * @param actual the actual value
- * @param expected the expected value
- * @param delta the absolute tolerate value value between the actual and expected value
- */
- static public void assertEquals(float actual, float expected, float delta) {
- assertEquals(actual, expected, delta, null);
- }
-
- /**
- * Asserts that two longs are equal. If they are not,
- * an AssertionError, with the given message, is thrown.
- * @param actual the actual value
- * @param expected the expected value
- * @param message the assertion error message
- */
- static public void assertEquals(long actual, long expected, CharSequence message) {
- assertEquals(new Long(actual), new Long(expected), message);
- }
-
- /**
- * Asserts that two longs are equal. If they are not,
- * an AssertionError is thrown.
- * @param actual the actual value
- * @param expected the expected value
- */
- static public void assertEquals(long actual, long expected) {
- assertEquals(actual, expected, null);
- }
-
- /**
- * Asserts that two booleans are equal. If they are not,
- * an AssertionError, with the given message, is thrown.
- * @param actual the actual value
- * @param expected the expected value
- * @param message the assertion error message
- */
- static public void assertEquals(boolean actual, boolean expected, CharSequence message) {
- assertEquals( Boolean.valueOf(actual), Boolean.valueOf(expected), message);
- }
-
- /**
- * Asserts that two booleans are equal. If they are not,
- * an AssertionError is thrown.
- * @param actual the actual value
- * @param expected the expected value
- */
- static public void assertEquals(boolean actual, boolean expected) {
- assertEquals(actual, expected, null);
- }
-
- /**
- * Asserts that two bytes are equal. If they are not,
- * an AssertionError, with the given message, is thrown.
- * @param actual the actual value
- * @param expected the expected value
- * @param message the assertion error message
- */
- static public void assertEquals(byte actual, byte expected, CharSequence message) {
- assertEquals(new Byte(actual), new Byte(expected), message);
- }
-
- /**
- * Asserts that two bytes are equal. If they are not,
- * an AssertionError is thrown.
- * @param actual the actual value
- * @param expected the expected value
- */
- static public void assertEquals(byte actual, byte expected) {
- assertEquals(actual, expected, null);
- }
-
- /**
- * Asserts that two chars are equal. If they are not,
- * an AssertionFailedError, with the given message, is thrown.
- * @param actual the actual value
- * @param expected the expected value
- * @param message the assertion error message
- */
- static public void assertEquals(char actual, char expected, CharSequence message) {
- assertEquals(new Character(actual), new Character(expected), message);
- }
-
- /**
- * Asserts that two chars are equal. If they are not,
- * an AssertionError is thrown.
- * @param actual the actual value
- * @param expected the expected value
- */
- static public void assertEquals(char actual, char expected) {
- assertEquals(actual, expected, null);
- }
-
- /**
- * Asserts that two shorts are equal. If they are not,
- * an AssertionFailedError, with the given message, is thrown.
- * @param actual the actual value
- * @param expected the expected value
- * @param message the assertion error message
- */
- static public void assertEquals(short actual, short expected, CharSequence message) {
- assertEquals(new Short(actual), new Short(expected), message);
- }
-
- /**
- * Asserts that two shorts are equal. If they are not,
- * an AssertionError is thrown.
- * @param actual the actual value
- * @param expected the expected value
- */
- static public void assertEquals(short actual, short expected) {
- assertEquals(actual, expected, null);
- }
-
- /**
- * Asserts that two ints are equal. If they are not,
- * an AssertionFailedError, with the given message, is thrown.
- * @param actual the actual value
- * @param expected the expected value
- * @param message the assertion error message
- */
- static public void assertEquals(int actual, int expected, CharSequence message) {
- assertEquals(new Integer(actual), new Integer(expected), message);
- }
-
- /**
- * Asserts that two ints are equal. If they are not,
- * an AssertionError is thrown.
- * @param actual the actual value
- * @param expected the expected value
- */
- static public void assertEquals(int actual, int expected) {
- assertEquals(actual, expected, null);
- }
-
- /**
- * Asserts that an object isn't null. If it is,
- * an AssertionError is thrown.
- * @param object the assertion object
- */
- static public void assertNotNull(Object object) {
- assertNotNull(object, null);
- }
-
- /**
- * Asserts that an object isn't null. If it is,
- * an AssertionFailedError, with the given message, is thrown.
- * @param object the assertion object
- * @param message the assertion error message
- */
- static public void assertNotNull(Object object, CharSequence message) {
- assertTrue(object != null, message);
- }
-
- /**
- * Asserts that an object is null. If it is not,
- * an AssertionError, with the given message, is thrown.
- * @param object the assertion object
- */
- static public void assertNull(Object object) {
- assertNull(object, null);
- }
-
- /**
- * Asserts that an object is null. If it is not,
- * an AssertionFailedError, with the given message, is thrown.
- * @param object the assertion object
- * @param message the assertion error message
- */
- static public void assertNull(Object object, CharSequence message) {
- assertTrue(object == null, message);
- }
-
- /**
- * Asserts that two objects refer to the same object. If they do not,
- * an AssertionFailedError, with the given message, is thrown.
- * @param actual the actual value
- * @param expected the expected value
- * @param message the assertion error message
- */
- static public void assertSame(Object actual, Object expected, CharSequence message) {
- if(expected == actual) {
- return;
- }
- failNotSame(actual, expected, message);
- }
-
- /**
- * Asserts that two objects refer to the same object. If they do not,
- * an AssertionError is thrown.
- * @param actual the actual value
- * @param expected the expected value
- */
- static public void assertSame(Object actual, Object expected) {
- assertSame(actual, expected, null);
- }
-
- /**
- * Asserts that two objects do not refer to the same objects. If they do,
- * an AssertionError, with the given message, is thrown.
- * @param actual the actual value
- * @param expected the expected value
- * @param message the assertion error message
- */
- static public void assertNotSame(Object actual, Object expected, CharSequence message) {
- if(expected == actual) {
- failSame(actual, expected, message);
- }
- }
-
- /**
- * Asserts that two objects do not refer to the same object. If they do,
- * an AssertionError is thrown.
- * @param actual the actual value
- * @param expected the expected value
- */
- static public void assertNotSame(Object actual, Object expected) {
- assertNotSame(actual, expected, null);
- }
-
- static private void failSame(Object actual, Object expected, CharSequence message) {
- String formatted = "";
- if(message != null) {
- formatted = message + " ";
- }
- fail(formatted + "expected not same with:<" + expected +"> but was same:<" + actual + ">");
- }
-
- static private void failNotSame(Object actual, Object expected, CharSequence message) {
- String formatted = "";
- if(message != null) {
- formatted = message + " ";
- }
- fail(formatted + "expected same with:<" + expected + "> but was:<" + actual + ">");
- }
-
- static private void failNotEquals(Object actual , Object expected, CharSequence message ) {
- fail(format(actual, expected, message));
- }
-
- static String format(Object actual, Object expected, CharSequence message) {
- String formatted = "";
- if (null != message) {
- formatted = message + " ";
- }
-
- return formatted + "expected:<" + expected + "> but was:<" + actual + ">";
- }
-
- /**
- * Asserts that two collections contain the same elements in the same order. If they do not,
- * an AssertionError is thrown.
- *
- * @param actual the actual value
- * @param expected the expected value
- */
- static public void assertEquals(Collection actual, Collection expected) {
- assertEquals(actual, expected, null);
- }
-
- /**
- * Asserts that two collections contain the same elements in the same order. If they do not,
- * an AssertionError, with the given message, is thrown.
- * @param actual the actual value
- * @param expected the expected value
- * @param message the assertion error message
- */
- static public void assertEquals(Collection actual, Collection expected, CharSequence message) {
- if(actual == expected) return;
-
- if ((actual == null && expected != null) || (actual != null && expected == null)) {
- if (message != null) fail(message);
- else fail("Arrays not equal: " + expected + " and " + actual);
- }
-
- assertEquals(actual.size(), expected.size(), message + ": lists don't have the same size");
-
- Iterator actIt = actual.iterator();
- Iterator expIt = expected.iterator();
- int i = -1;
- while(actIt.hasNext() && expIt.hasNext()) {
- i++;
- Object e = expIt.next();
- Object a = actIt.next();
- String errorMessage = message == null
- ? "Lists differ at element [" + i + "]: " + e + " != " + a
- : message + ": Lists differ at element [" + i + "]: " + e + " != " + a;
-
- assertEquals(a, e, errorMessage);
- }
- }
-
- /**
- * Asserts that two arrays contain the same elements in the same order. If they do not,
- * an AssertionError, with the given message, is thrown.
- * @param actual the actual value
- * @param expected the expected value
- * @param message the assertion error message
- */
- static public void assertEquals(Object[] actual, Object[] expected, CharSequence message) {
- if(actual == expected) return;
-
- if ((actual == null && expected != null) || (actual != null && expected == null)) {
- if (message != null) fail(message);
- else fail("Arrays not equal: " + expected + " and " + actual);
- }
- assertEquals(Arrays.asList(actual), Arrays.asList(expected), message);
- }
-
- /**
- * Asserts that two arrays contain the same elements in no particular order. If they do not,
- * an AssertionError, with the given message, is thrown.
- * @param actual the actual value
- * @param expected the expected value
- * @param message the assertion error message
- */
- static public void assertEqualsNoOrder(Object[] actual, Object[] expected, CharSequence message) {
- if(actual == expected) return;
-
- if ((actual == null && expected != null) || (actual != null && expected == null)) {
- failAssertNoEqual(actual, expected,
- "Arrays not equal: " + expected + " and " + actual,
- message);
- }
-
- if (actual.length != expected.length) {
- failAssertNoEqual(actual, expected,
- "Arrays do not have the same size:" + actual.length + " != " + expected.length,
- message);
- }
-
- List actualCollection = Lists.newArrayList();
- for (Object a : actual) {
- actualCollection.add(a);
- }
- for (Object o : expected) {
- actualCollection.remove(o);
- }
- if (actualCollection.size() != 0) {
- failAssertNoEqual(actual, expected,
- "Arrays not equal: " + expected + " and " + actual,
- message);
- }
- }
-
- private static void failAssertNoEqual(Object[] actual, Object[] expected,
- CharSequence message, CharSequence defaultMessage)
- {
- if (message != null) fail(message);
- else fail(defaultMessage);
- }
-
- /**
- * Asserts that two arrays contain the same elements in the same order. If they do not,
- * an AssertionError is thrown.
- *
- * @param actual the actual value
- * @param expected the expected value
- */
- static public void assertEquals(Object[] actual, Object[] expected) {
- assertEquals(actual, expected, null);
- }
-
- /**
- * Asserts that two arrays contain the same elements in no particular order. If they do not,
- * an AssertionError is thrown.
- * @param actual the actual value
- * @param expected the expected value
- */
- static public void assertEqualsNoOrder(Object[] actual, Object[] expected) {
- assertEqualsNoOrder(actual, expected, null);
- }
-
- /**
- * Asserts that two arrays contain the same elements in the same order. If they do not,
- * an AssertionError is thrown.
- *
- * @param actual the actual value
- * @param expected the expected value
- */
- static public void assertEquals(final byte[] actual, final byte[] expected) {
- assertEquals(actual, expected, "");
- }
-
- /**
- * Asserts that two arrays contain the same elements in the same order. If they do not,
- * an AssertionError, with the given message, is thrown.
- *
- * @param actual the actual value
- * @param expected the expected value
- * @param message the assertion error message
- */
- static public void assertEquals(final byte[] actual, final byte[] expected, final CharSequence message) {
- if(expected == actual) {
- return;
- }
- if(null == expected) {
- fail("expected a null array, but not null found. " + message);
- }
- if(null == actual) {
- fail("expected not null array, but null found. " + message);
- }
-
- assertEquals(actual.length, expected.length, "arrays don't have the same size. " + message);
-
- for(int i= 0; i < expected.length; i++) {
- if(expected[i] != actual[i]) {
- fail("arrays differ firstly at element [" + i +"]; "
- + "expected value is <" + expected[i] +"> but was <"
- + actual[i] + ">. "
- + message);
- }
- }
- }
-
- /**
- * Asserts that two sets are equal.
- */
- static public void assertEquals(Set actual, Set expected) {
- if (!actual.equals(expected)) {
- fail("Sets differ: expected " + expected + " but got " + actual);
- }
- }
-
- /**
- * Asserts that two maps are equal.
- */
- static public void assertEquals(Map actual, Map expected) {
- if (!actual.equals(expected)) {
- fail("Maps differ: expected " + expected + " but got " + actual);
- }
- }
-
-}
13 years, 8 months
JBoss Rich Faces SVN: r19251 - branches/RF-7944.
by richfaces-svn-commits@lists.jboss.org
Author: nbelaevski
Date: 2010-09-18 01:00:39 -0400 (Sat, 18 Sep 2010)
New Revision: 19251
Modified:
branches/RF-7944/
Log:
Initialized merge tracking via "svnmerge" with revisions "1-18995" from
https://svn.jboss.org/repos/richfaces/trunk
Property changes on: branches/RF-7944
___________________________________________________________________
Name: svnmerge-integrated
- /branches/RFPL-754:1-18909
+ /trunk:1-18995 /branches/RFPL-754:1-18909
13 years, 8 months
JBoss Rich Faces SVN: r19250 - modules/tests/metamer/branches.
by richfaces-svn-commits@lists.jboss.org
Author: lfryc(a)redhat.com
Date: 2010-09-17 17:56:47 -0400 (Fri, 17 Sep 2010)
New Revision: 19250
Added:
modules/tests/metamer/branches/waitHttp/
Log:
Create branch waitHttp
Copied: modules/tests/metamer/branches/waitHttp (from rev 19238, modules/tests/metamer/trunk)
13 years, 8 months
JBoss Rich Faces SVN: r19249 - trunk.
by richfaces-svn-commits@lists.jboss.org
Author: nbelaevski
Date: 2010-09-17 15:05:01 -0400 (Fri, 17 Sep 2010)
New Revision: 19249
Modified:
trunk/
Log:
Initialized merge tracking via "svnmerge" with revisions "1-18996" from
https://svn.jboss.org/repos/richfaces/branches/RF-7944
Property changes on: trunk
___________________________________________________________________
Name: svnmerge-integrated
+ /branches/RF-7944:1-18996
13 years, 8 months
JBoss Rich Faces SVN: r19248 - in trunk/core/impl/src/main: java/org/richfaces/context and 1 other directories.
by richfaces-svn-commits@lists.jboss.org
Author: nbelaevski
Date: 2010-09-17 14:15:10 -0400 (Fri, 17 Sep 2010)
New Revision: 19248
Added:
trunk/core/impl/src/main/java/org/richfaces/application/GlobalResourcesViewHandler.java
trunk/core/impl/src/main/resources/META-INF/global-resources.faces-config.xml
Removed:
trunk/core/impl/src/main/java/org/richfaces/context/SkinningResourcesPhaseListener.java
trunk/core/impl/src/main/resources/META-INF/skinning-resources-listener.faces-config.xml
Log:
https://jira.jboss.org/browse/RF-8937
Added: trunk/core/impl/src/main/java/org/richfaces/application/GlobalResourcesViewHandler.java
===================================================================
--- trunk/core/impl/src/main/java/org/richfaces/application/GlobalResourcesViewHandler.java (rev 0)
+++ trunk/core/impl/src/main/java/org/richfaces/application/GlobalResourcesViewHandler.java 2010-09-17 18:15:10 UTC (rev 19248)
@@ -0,0 +1,187 @@
+/*
+ * 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.io.ObjectStreamException;
+import java.util.List;
+
+import javax.el.ELContext;
+import javax.el.ValueExpression;
+import javax.faces.application.Application;
+import javax.faces.application.ViewHandler;
+import javax.faces.application.ViewHandlerWrapper;
+import javax.faces.component.UIComponent;
+import javax.faces.component.UIOutput;
+import javax.faces.component.UIViewRoot;
+import javax.faces.context.FacesContext;
+
+import org.richfaces.application.configuration.ConfigurationService;
+import org.richfaces.el.BaseReadOnlyValueExpression;
+
+/**
+ * @author Nick Belaevski
+ *
+ */
+public class GlobalResourcesViewHandler extends ViewHandlerWrapper {
+
+ private static final String SKINNING_RESOURCE_ID = "__rf_skinning_resource";
+
+ private static final String CLASSES_ECSS = "_classes.ecss";
+
+ private static final String ECSS = ".ecss";
+
+ private static final String BOTH_ECSS = "_both.ecss";
+
+ private static final String CONTROLS_SKINNING;
+
+ private static final String BOTH_SKINNING;
+
+ private static final String CLASSES_SKINNING;
+
+ private static final String HEAD = "head";
+
+ static {
+ String skinningName = "skinning";
+
+ CONTROLS_SKINNING = skinningName + ECSS;
+ BOTH_SKINNING = skinningName + BOTH_ECSS;
+ CLASSES_SKINNING = skinningName + CLASSES_ECSS;
+
+ }
+
+ private ViewHandler viewHandler;
+
+ public GlobalResourcesViewHandler(ViewHandler viewHandler) {
+ super();
+ this.viewHandler = viewHandler;
+ }
+
+ @Override
+ public ViewHandler getWrapped() {
+ return viewHandler;
+ }
+
+ private static final class SkinningResourceNameExpression extends BaseReadOnlyValueExpression {
+
+ public static final ValueExpression INSTANCE = new SkinningResourceNameExpression();
+
+ private static final long serialVersionUID = 7520575496522682120L;
+
+ private SkinningResourceNameExpression() {
+ super(String.class);
+ }
+
+ @Override
+ public Object getValue(ELContext context) {
+ FacesContext facesContext = getFacesContext(context);
+
+ ConfigurationService configurationService = ServiceTracker.getService(ConfigurationService.class);
+
+ boolean controls = configurationService.getBooleanValue(facesContext, CoreConfiguration.Items.standardControlsSkinning);
+ boolean classes = configurationService.getBooleanValue(facesContext, CoreConfiguration.Items.standardControlsSkinningClasses);
+
+ if (controls && classes) {
+ return BOTH_SKINNING;
+ }
+
+ if (classes) {
+ return CLASSES_SKINNING;
+ }
+
+ return CONTROLS_SKINNING;
+ }
+
+ private Object readResolve() throws ObjectStreamException {
+ return INSTANCE;
+ }
+
+ }
+
+ private static final class SkinningResourceRenderedExpression extends BaseReadOnlyValueExpression {
+
+ public static final ValueExpression INSTANCE = new SkinningResourceRenderedExpression();
+
+ private static final long serialVersionUID = -1579256471133808739L;
+
+ private SkinningResourceRenderedExpression() {
+ super(Boolean.TYPE);
+ }
+
+ @Override
+ public Object getValue(ELContext context) {
+ FacesContext facesContext = getFacesContext(context);
+
+ ConfigurationService configurationService = ServiceTracker.getService(ConfigurationService.class);
+
+ return configurationService.getBooleanValue(facesContext, CoreConfiguration.Items.standardControlsSkinning) ||
+ configurationService.getBooleanValue(facesContext, CoreConfiguration.Items.standardControlsSkinningClasses);
+ }
+
+ private Object readResolve() throws ObjectStreamException {
+ return INSTANCE;
+ }
+ }
+
+ private UIComponent createComponentResource(FacesContext context) {
+ Application application = context.getApplication();
+
+ //renderkit id is not set on FacesContext at this point, so calling
+ //application.createComponent(context, componentType, rendererType) causes NPE
+ UIComponent resourceComponent = application.createComponent(UIOutput.COMPONENT_TYPE);
+
+ String rendererType = application.getResourceHandler().getRendererTypeForResourceName(BOTH_SKINNING);
+ resourceComponent.setRendererType(rendererType);
+
+ return resourceComponent;
+ }
+
+ @Override
+ public UIViewRoot createView(FacesContext context, String viewId) {
+ UIViewRoot viewRoot = super.createView(context, viewId);
+
+ boolean skinningResourceFound = false;
+ List<UIComponent> resources = viewRoot.getComponentResources(context, HEAD);
+ for (UIComponent resource : resources) {
+ if (SKINNING_RESOURCE_ID.equals(resource.getId())) {
+ skinningResourceFound = true;
+ break;
+ }
+ }
+
+ if (!skinningResourceFound) {
+ //it's important for skinning resources to come *before* any users/components stylesheet,
+ //that's why they are *always* added here
+ UIComponent basic = createComponentResource(context);
+ basic.setValueExpression("name", SkinningResourceNameExpression.INSTANCE);
+ basic.setValueExpression("rendered", SkinningResourceRenderedExpression.INSTANCE);
+ basic.setId(SKINNING_RESOURCE_ID);
+
+ //workaround for Mojarra: RF-8937
+ boolean initialProcessingEvents = context.isProcessingEvents();
+ context.setProcessingEvents(false);
+ viewRoot.addComponentResource(context, basic);
+ context.setProcessingEvents(initialProcessingEvents);
+ }
+
+ return viewRoot;
+ }
+}
Deleted: trunk/core/impl/src/main/java/org/richfaces/context/SkinningResourcesPhaseListener.java
===================================================================
--- trunk/core/impl/src/main/java/org/richfaces/context/SkinningResourcesPhaseListener.java 2010-09-17 18:10:07 UTC (rev 19247)
+++ trunk/core/impl/src/main/java/org/richfaces/context/SkinningResourcesPhaseListener.java 2010-09-17 18:15:10 UTC (rev 19248)
@@ -1,167 +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.context;
-
-import java.util.List;
-
-import javax.el.ELContext;
-import javax.faces.application.Application;
-import javax.faces.component.UIComponent;
-import javax.faces.component.UIOutput;
-import javax.faces.component.UIViewRoot;
-import javax.faces.context.FacesContext;
-import javax.faces.event.PhaseEvent;
-import javax.faces.event.PhaseId;
-import javax.faces.event.PhaseListener;
-
-import org.richfaces.application.CoreConfiguration;
-import org.richfaces.application.ServiceTracker;
-import org.richfaces.application.configuration.ConfigurationService;
-import org.richfaces.el.BaseReadOnlyValueExpression;
-
-/**
- * @author Nick Belaevski
- *
- */
-public class SkinningResourcesPhaseListener implements PhaseListener {
-
- private static final long serialVersionUID = 7430448731396547419L;
-
- private static final String SKINNING_RESOURCE_MARKER = SkinningResourcesPhaseListener.class.getName();
-
- private static final String CLASSES_ECSS = "_classes.ecss";
-
- private static final String ECSS = ".ecss";
-
- private static final String BOTH_ECSS = "_both.ecss";
-
- private static final String CONTROLS_SKINNING;
-
- private static final String BOTH_SKINNING;
-
- private static final String CLASSES_SKINNING;
-
- private static final String HEAD = "head";
-
- static {
- String skinningName = "skinning";
-
- CONTROLS_SKINNING = skinningName + ECSS;
- BOTH_SKINNING = skinningName + BOTH_ECSS;
- CLASSES_SKINNING = skinningName + CLASSES_ECSS;
-
- }
-
- private static final class SkinningResourceNameExpression extends BaseReadOnlyValueExpression {
-
- private static final long serialVersionUID = 7520575496522682120L;
-
- public SkinningResourceNameExpression() {
- super(String.class);
- }
-
- @Override
- public Object getValue(ELContext context) {
- FacesContext facesContext = getFacesContext(context);
-
- ConfigurationService configurationService = ServiceTracker.getService(ConfigurationService.class);
-
- boolean controls = configurationService.getBooleanValue(facesContext, CoreConfiguration.Items.standardControlsSkinning);
- boolean classes = configurationService.getBooleanValue(facesContext, CoreConfiguration.Items.standardControlsSkinningClasses);
-
- if (controls && classes) {
- return BOTH_SKINNING;
- }
-
- if (classes) {
- return CLASSES_SKINNING;
- }
-
- return CONTROLS_SKINNING;
- }
-
- }
-
- private static final class SkinningResourceRenderedExpression extends BaseReadOnlyValueExpression {
-
- private static final long serialVersionUID = -1579256471133808739L;
-
- public SkinningResourceRenderedExpression() {
- super(Boolean.TYPE);
- }
-
- @Override
- public Object getValue(ELContext context) {
- FacesContext facesContext = getFacesContext(context);
-
- ConfigurationService configurationService = ServiceTracker.getService(ConfigurationService.class);
-
- return configurationService.getBooleanValue(facesContext, CoreConfiguration.Items.standardControlsSkinning) ||
- configurationService.getBooleanValue(facesContext, CoreConfiguration.Items.standardControlsSkinningClasses);
- }
-
- }
-
- private UIComponent createComponentResource(FacesContext context) {
- Application application = context.getApplication();
- String rendererType = application.getResourceHandler().getRendererTypeForResourceName(BOTH_SKINNING);
- UIComponent resourceComponent = application.createComponent(context, UIOutput.COMPONENT_TYPE, rendererType);
-
- return resourceComponent;
- }
-
- public void afterPhase(PhaseEvent event) {
- //not used
- }
-
- public void beforePhase(PhaseEvent event) {
- //it's important for skinning resources to come *before* any users/components stylesheet,
- //that's why they are added via phase listener
-
- FacesContext context = event.getFacesContext();
- UIViewRoot viewRoot = context.getViewRoot();
-
- assert viewRoot != null;
-
- boolean skinnigResourceFound = false;
- List<UIComponent> resources = viewRoot.getComponentResources(context, HEAD);
- for (UIComponent resource : resources) {
- if (resource.getAttributes().get(SKINNING_RESOURCE_MARKER) != null) {
- skinnigResourceFound = true;
- break;
- }
- }
-
- if (!skinnigResourceFound) {
- UIComponent basic = createComponentResource(context);
- basic.setValueExpression("name", new SkinningResourceNameExpression());
- basic.setValueExpression("rendered", new SkinningResourceRenderedExpression());
- basic.getAttributes().put(SKINNING_RESOURCE_MARKER, Boolean.TRUE);
-
- viewRoot.addComponentResource(context, basic);
- }
- }
-
- public PhaseId getPhaseId() {
- return PhaseId.RENDER_RESPONSE;
- }
-}
Copied: trunk/core/impl/src/main/resources/META-INF/global-resources.faces-config.xml (from rev 19202, trunk/core/impl/src/main/resources/META-INF/skinning-resources-listener.faces-config.xml)
===================================================================
--- trunk/core/impl/src/main/resources/META-INF/global-resources.faces-config.xml (rev 0)
+++ trunk/core/impl/src/main/resources/META-INF/global-resources.faces-config.xml 2010-09-17 18:15:10 UTC (rev 19248)
@@ -0,0 +1,10 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<faces-config xmlns="http://java.sun.com/xml/ns/javaee" version="2.0">
+ <name>richfaces</name>
+
+ <application>
+ <view-handler>org.richfaces.application.GlobalResourcesViewHandler</view-handler>
+ </application>
+
+</faces-config>
\ No newline at end of file
Deleted: trunk/core/impl/src/main/resources/META-INF/skinning-resources-listener.faces-config.xml
===================================================================
--- trunk/core/impl/src/main/resources/META-INF/skinning-resources-listener.faces-config.xml 2010-09-17 18:10:07 UTC (rev 19247)
+++ trunk/core/impl/src/main/resources/META-INF/skinning-resources-listener.faces-config.xml 2010-09-17 18:15:10 UTC (rev 19248)
@@ -1,8 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-
-<faces-config xmlns="http://java.sun.com/xml/ns/javaee" version="2.0">
- <name>richfaces</name>
- <lifecycle>
- <phase-listener>org.richfaces.context.SkinningResourcesPhaseListener</phase-listener>
- </lifecycle>
-</faces-config>
\ No newline at end of file
13 years, 8 months
JBoss Rich Faces SVN: r19247 - branches/RF-9151/examples/input-demo/src/main/webapp.
by richfaces-svn-commits@lists.jboss.org
Author: konstantin.mishin
Date: 2010-09-17 14:10:07 -0400 (Fri, 17 Sep 2010)
New Revision: 19247
Modified:
branches/RF-9151/examples/input-demo/src/main/webapp/inputNumberSpinner.xhtml
Log:
RF-9200
Modified: branches/RF-9151/examples/input-demo/src/main/webapp/inputNumberSpinner.xhtml
===================================================================
--- branches/RF-9151/examples/input-demo/src/main/webapp/inputNumberSpinner.xhtml 2010-09-17 17:53:39 UTC (rev 19246)
+++ branches/RF-9151/examples/input-demo/src/main/webapp/inputNumberSpinner.xhtml 2010-09-17 18:10:07 UTC (rev 19247)
@@ -39,11 +39,9 @@
<f:selectItems value="#{skinBean.skins}"/>
</h:selectOneMenu>
<br />
- <ins:inputNumberSpinner id="ins" value="#{inputNumberSliderBean.value}" accesskey="#{inputNumberSliderBean.accesskey}" delay="#{inputNumberSliderBean.delay}"
+ <ins:inputNumberSpinner id="ins" value="#{inputNumberSliderBean.value}" accesskey="#{inputNumberSliderBean.accesskey}" cycled="#{inputNumberSliderBean.showInput}"
disabled="#{inputNumberSliderBean.disabled}" enableManualInput="#{inputNumberSliderBean.enableManualInput}"
- inputPosition="#{inputNumberSliderBean.inputPosition}" inputSize="#{inputNumberSliderBean.inputSize}" showArrows="#{inputNumberSliderBean.showArrows}"
- showBoundaryValues="#{inputNumberSliderBean.showBoundaryValues}" showInput="#{inputNumberSliderBean.showInput}"
- showToolTip="#{inputNumberSliderBean.showToolTip}" maxValue="#{inputNumberSliderBean.maxValue}" minValue="#{inputNumberSliderBean.minValue}"
+ inputSize="#{inputNumberSliderBean.inputSize}" maxValue="#{inputNumberSliderBean.maxValue}" minValue="#{inputNumberSliderBean.minValue}"
step="#{inputNumberSliderBean.step}" />
<br />
<h:outputText value="Accesskey: "/>
@@ -51,8 +49,8 @@
<f:ajax render="ins"/>
</h:inputText>
<br />
- <h:outputText value="EnableManualInput: "/>
- <h:selectBooleanCheckbox value="#{inputNumberSliderBean.enableManualInput}">
+ <h:outputText value="Cycled: "/>
+ <h:selectBooleanCheckbox value="#{inputNumberSliderBean.showInput}">
<f:ajax render="ins"/>
</h:selectBooleanCheckbox>
<br />
@@ -61,6 +59,11 @@
<f:ajax render="ins"/>
</h:selectBooleanCheckbox>
<br />
+ <h:outputText value="EnableManualInput: "/>
+ <h:selectBooleanCheckbox value="#{inputNumberSliderBean.enableManualInput}">
+ <f:ajax render="ins"/>
+ </h:selectBooleanCheckbox>
+ <br />
<h:outputText value="InputSize: "/>
<h:inputText value="#{inputNumberSliderBean.inputSize}">
<f:ajax render="ins"/>
13 years, 8 months
JBoss Rich Faces SVN: r19246 - in branches/RF-9151/ui/input/ui/src/main: templates and 1 other directory.
by richfaces-svn-commits@lists.jboss.org
Author: konstantin.mishin
Date: 2010-09-17 13:53:39 -0400 (Fri, 17 Sep 2010)
New Revision: 19246
Modified:
branches/RF-9151/ui/input/ui/src/main/resources/META-INF/resources/org.richfaces/inputNumberSpinner.ecss
branches/RF-9151/ui/input/ui/src/main/resources/META-INF/resources/org.richfaces/inputNumberSpinner.js
branches/RF-9151/ui/input/ui/src/main/templates/inputnumberspinner.template.xml
Log:
RF-9195
Modified: branches/RF-9151/ui/input/ui/src/main/resources/META-INF/resources/org.richfaces/inputNumberSpinner.ecss
===================================================================
--- branches/RF-9151/ui/input/ui/src/main/resources/META-INF/resources/org.richfaces/inputNumberSpinner.ecss 2010-09-17 17:52:10 UTC (rev 19245)
+++ branches/RF-9151/ui/input/ui/src/main/resources/META-INF/resources/org.richfaces/inputNumberSpinner.ecss 2010-09-17 17:53:39 UTC (rev 19246)
@@ -20,43 +20,61 @@
* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
*/
.rf-insp {
- border: 1px solid #A6A6A6/*panelBorderColor*/;
+ border-width: 1px;
+ border-style: solid;
+ border-color: '#{richSkin.panelBorderColor}';
display: inline-block;
- background: url("#{resource['bg_field.png']}") top left repeat-x;/*gradient - from additionalBackgroundColor to controlBackgroundColor, background-color - controlBackgroundColor*/;
+ font-size: 1px;
white-space: nowrap;
- font-size: 1px;
}
-input[type="text"].rf-insp-inp {
- vertical-align: top;
- color: #000000;/*generalTextColor*/
+input.rf-insp-inp[type="text"] {
+ background-color: '#{richSkin.controlBackgroundColor}';
+ background-imaage: url("#{resource['org.richfaces.renderkit.html.images.InputBackgroundImage']}");
+ background-position:1px 1px;
+ background-repeat:no-repeat;
border: 0px;
- background: none;
+ color: '#{richSkin.generalTextColor}';
+ font-family : '#{richSkin.generalFamilyFont}';
+ font-size : '#{richSkin.generalSizeFont}';
margin: 0px;
padding: 0px;
+ vertical-align: top;
}
.rf-insp-btna {
+ background-color: '#{richSkin.headerBackgroundColor}';
+ background-image: "url(#{resource['org.richfaces.renderkit.html.images.ButtonBackgroundImage']})";
+ background-position: top left;
+ background-repeat: repeat-x;
+ border-left-width: 1px;
+ border-left-style: solid;
+ border-left-color: '#{richSkin.panelBorderColor}';
+ display: inline-block;
vertical-align: top;
- background: url("#{resource['bg_btn.png']}") top left repeat-x #C0D1E7/*gradient - from headerGradientColor to headerBackgroundColor, background-color - headerBackgroundColor*/;
- border-left: 1px solid #A6A6A6/*panelBorderColor*/;
- width: 16px;
- height: 15px;
- display: inline-block;
}
-.rf-insp-dbtn {
+
+.rf-insp-dbtn, .rf-insp-ibtn, .rf-insp-dbtn-dis, .rf-insp-ibtn-dis {
+ background-position: 50% 40%;
+ background-repeat: no-repeat;
display: block;
- height: 7px;
- background-image: url("#{resource['button_down.gif']}");
+ height: 8px;
width: 15px;
- padding-top: 1px;
}
+.rf-insp-dbtn {
+ background-image: url("#{resource['org.richfaces.renderkit.html.images.SpinnerArrowBottom']}");
+}
+
.rf-insp-ibtn {
- display: block;
- height: 7px;
- background-image: url("#{resource['button_up.gif']}");
- width: 15px;
- padding-top: 1px;
+ background-image: url("#{resource['org.richfaces.renderkit.html.images.SpinnerArrowTop']}");
+}
+
+.rf-insp-dbtn-dis {
+ background-image: url("#{resource['org.richfaces.renderkit.html.images.SpinnerDisabledArrowBottom']}");
+}
+
+.rf-insp-ibtn-dis {
+ background-image: url("#{resource['org.richfaces.renderkit.html.images.SpinnerDisabledArrowTop']}");
}
\ No newline at end of file
Modified: branches/RF-9151/ui/input/ui/src/main/resources/META-INF/resources/org.richfaces/inputNumberSpinner.js
===================================================================
--- branches/RF-9151/ui/input/ui/src/main/resources/META-INF/resources/org.richfaces/inputNumberSpinner.js 2010-09-17 17:52:10 UTC (rev 19245)
+++ branches/RF-9151/ui/input/ui/src/main/resources/META-INF/resources/org.richfaces/inputNumberSpinner.js 2010-09-17 17:53:39 UTC (rev 19246)
@@ -26,6 +26,7 @@
name: "InputNumberSpinner",
+ cycled: true,
delay: 200,
maxValue: 100,
minValue: 0,
@@ -55,11 +56,19 @@
},
decrease: function (event) {
- this.setValue(this.value - this.step);
+ var value = this.value - this.step;
+ if (value < this.minValue && this.cycled) {
+ value = this.maxValue;
+ }
+ this.setValue(value);
},
increase: function (event) {
- this.setValue(this.value + this.step);
+ var value = this.value + this.step;
+ if (value > this.maxValue && this.cycled) {
+ value = this.minValue;
+ }
+ this.setValue(value);
},
getValue: function () {
@@ -113,7 +122,7 @@
component.decrease();
}, this.delay);
jQuery(document).one("mouseup", true, jQuery.proxy(this.__clearInterval, this));
- this.decreaseButton.css("backgroundPosition", "60% 55%");
+ this.decreaseButton.css("backgroundPosition", "60% 60%");
event.preventDefault();
},
@@ -124,7 +133,7 @@
component.increase();
}, this.delay);
jQuery(document).one("mouseup",jQuery.proxy(this.__clearInterval, this));
- this.increaseButton.css("backgroundPosition", "60% 55%");
+ this.increaseButton.css("backgroundPosition", "60% 60%");
event.preventDefault();
},
Modified: branches/RF-9151/ui/input/ui/src/main/templates/inputnumberspinner.template.xml
===================================================================
--- branches/RF-9151/ui/input/ui/src/main/templates/inputnumberspinner.template.xml 2010-09-17 17:52:10 UTC (rev 19245)
+++ branches/RF-9151/ui/input/ui/src/main/templates/inputnumberspinner.template.xml 2010-09-17 17:53:39 UTC (rev 19246)
@@ -42,10 +42,11 @@
class="rf-insp-inp #{component.attributes['inputClass']}" value="#{getInputValue(facesContext, component)}"
cdk:passThrough="accesskey disabled maxlength size:inputSize tabindex" readonly="#{!component.attributes['enableManualInput']}" />
<span class="rf-insp-btna">
- <span class="rf-insp-ibtn" />
- <span class="rf-insp-dbtn" />
+ <span class="rf-insp-ibtn#{component.attributes['disabled'] ? '-dis' : ''}" />
+ <span class="rf-insp-dbtn#{component.attributes['disabled'] ? '-dis' : ''}" />
</span>
<script type="text/javascript">new RichFaces.ui.InputNumberSpinner('#{clientId}', {
+ cycled: #{component.attributes['cycled']},
maxValue: #{component.attributes['maxValue']},
minValue: #{component.attributes['minValue']},
step: #{component.attributes['step']}
13 years, 8 months