JBoss Rich Faces SVN: r20667 - trunk/core/impl/src/main/java/org/richfaces/application/push/impl.
by richfaces-svn-commits@lists.jboss.org
Author: nbelaevski
Date: 2010-12-17 13:54:05 -0500 (Fri, 17 Dec 2010)
New Revision: 20667
Modified:
trunk/core/impl/src/main/java/org/richfaces/application/push/impl/SessionManagerImpl.java
Log:
https://issues.jboss.org/browse/RF-9157
Modified: trunk/core/impl/src/main/java/org/richfaces/application/push/impl/SessionManagerImpl.java
===================================================================
--- trunk/core/impl/src/main/java/org/richfaces/application/push/impl/SessionManagerImpl.java 2010-12-17 17:57:24 UTC (rev 20666)
+++ trunk/core/impl/src/main/java/org/richfaces/application/push/impl/SessionManagerImpl.java 2010-12-17 18:54:05 UTC (rev 20667)
@@ -77,7 +77,6 @@
public void destroy() {
//TODO notify all session
- // TODO - synchronize clear/remove/clear. Other thread can insert new value during destroy.
sessionQueue.clear();
while (!sessionMap.isEmpty()) {
14 years
JBoss Rich Faces SVN: r20666 - in branches/RF-7654: core/api/src/main/java/org/richfaces/component and 22 other directories.
by richfaces-svn-commits@lists.jboss.org
Author: alexsmirnov
Date: 2010-12-17 12:57:24 -0500 (Fri, 17 Dec 2010)
New Revision: 20666
Added:
branches/RF-7654/ui/common/api/src/main/java/org/richfaces/component/Mode.java
branches/RF-7654/ui/iteration/ui/src/main/java/org/richfaces/convert/StringSequenceRowKeyConverter.java
branches/RF-7654/ui/output/ui/src/main/java/org/richfaces/renderkit/html/PanelMenuIcons.java
Removed:
branches/RF-7654/ui/iteration/ui/src/main/java/org/richfaces/convert/ObjectSequenceRowKeyConverter.java
branches/RF-7654/ui/output/ui/src/main/java/org/richfaces/component/MenuComponent.java
Modified:
branches/RF-7654/
branches/RF-7654/core/api/src/main/java/org/richfaces/component/ComponentIterators.java
branches/RF-7654/core/api/src/test/java/org/richfaces/renderkit/util/HtmlDimensionsTest.java
branches/RF-7654/examples/iteration-demo/src/main/webapp/tree.xhtml
branches/RF-7654/examples/output-demo/src/main/webapp/examples/tabPanel.xhtml
branches/RF-7654/ui/core/ui/src/main/java/org/richfaces/component/AbstractActionComponent.java
branches/RF-7654/ui/input/ui/src/main/java/org/richfaces/context/FileUploadPartialViewContextFactory.java
branches/RF-7654/ui/input/ui/src/main/resources/META-INF/resources/org.richfaces/fileupload.js
branches/RF-7654/ui/input/ui/src/main/resources/META-INF/resources/org.richfaces/inputNumberSlider.js
branches/RF-7654/ui/input/ui/src/main/resources/META-INF/resources/org.richfaces/inputNumberSpinner.js
branches/RF-7654/ui/iteration/ui/src/main/config/faces-config.xml
branches/RF-7654/ui/iteration/ui/src/main/java/org/richfaces/component/DeclarativeTreeDataModelWalker.java
branches/RF-7654/ui/iteration/ui/src/main/java/org/richfaces/convert/DeclarativeModelSequenceKeyConverter.java
branches/RF-7654/ui/iteration/ui/src/main/java/org/richfaces/model/ClassicTreeNodeDataModelImpl.java
branches/RF-7654/ui/iteration/ui/src/main/java/org/richfaces/model/DeclarativeTreeDataModelImpl.java
branches/RF-7654/ui/iteration/ui/src/main/java/org/richfaces/renderkit/TreeNodeRendererBase.java
branches/RF-7654/ui/iteration/ui/src/main/resources/META-INF/resources/org.richfaces/extendedDataTable.js
branches/RF-7654/ui/iteration/ui/src/main/resources/META-INF/resources/org.richfaces/tree.ecss
branches/RF-7654/ui/iteration/ui/src/main/resources/META-INF/resources/org.richfaces/tree.js
branches/RF-7654/ui/iteration/ui/src/main/templates/treeNode.template.xml
branches/RF-7654/ui/iteration/ui/src/test/java/org/richfaces/renderkit/ExtendedDataTableRendererTest.java
branches/RF-7654/ui/output/ui/src/main/java/org/richfaces/component/AbstractDropDownMenu.java
branches/RF-7654/ui/output/ui/src/main/java/org/richfaces/component/AbstractMenuGroup.java
branches/RF-7654/ui/output/ui/src/main/java/org/richfaces/component/AbstractMenuItem.java
branches/RF-7654/ui/output/ui/src/main/java/org/richfaces/component/AbstractPanelMenu.java
branches/RF-7654/ui/output/ui/src/main/java/org/richfaces/component/AbstractPanelMenuGroup.java
branches/RF-7654/ui/output/ui/src/main/java/org/richfaces/component/AbstractPanelMenuItem.java
branches/RF-7654/ui/output/ui/src/main/java/org/richfaces/component/AbstractTogglePanel.java
branches/RF-7654/ui/output/ui/src/main/java/org/richfaces/component/UIPanelMenu.java
branches/RF-7654/ui/output/ui/src/main/java/org/richfaces/component/UIPanelMenuGroup.java
branches/RF-7654/ui/output/ui/src/main/java/org/richfaces/component/UIPanelMenuItem.java
branches/RF-7654/ui/output/ui/src/main/java/org/richfaces/component/html/HtmlPanelMenu.java
branches/RF-7654/ui/output/ui/src/main/java/org/richfaces/renderkit/html/AccordionItemRenderer.java
branches/RF-7654/ui/output/ui/src/main/java/org/richfaces/renderkit/html/CollapsiblePanelRenderer.java
branches/RF-7654/ui/output/ui/src/main/java/org/richfaces/renderkit/html/DivPanelRenderer.java
branches/RF-7654/ui/output/ui/src/main/java/org/richfaces/renderkit/html/DropDownMenuRendererBase.java
branches/RF-7654/ui/output/ui/src/main/java/org/richfaces/renderkit/html/MenuGroupRendererBase.java
branches/RF-7654/ui/output/ui/src/main/java/org/richfaces/renderkit/html/MenuItemRendererBase.java
branches/RF-7654/ui/output/ui/src/main/java/org/richfaces/renderkit/html/PanelMenuGroupRenderer.java
branches/RF-7654/ui/output/ui/src/main/java/org/richfaces/renderkit/html/PanelMenuItemRenderer.java
branches/RF-7654/ui/output/ui/src/main/java/org/richfaces/renderkit/html/PanelMenuRenderer.java
branches/RF-7654/ui/output/ui/src/main/java/org/richfaces/renderkit/html/TabPanelRenderer.java
branches/RF-7654/ui/output/ui/src/main/java/org/richfaces/renderkit/html/TabRenderer.java
branches/RF-7654/ui/output/ui/src/main/java/org/richfaces/renderkit/html/TogglePanelRenderer.java
branches/RF-7654/ui/output/ui/src/main/java/org/richfaces/renderkit/html/ToolbarGroupRenderer.java
branches/RF-7654/ui/output/ui/src/main/java/org/richfaces/renderkit/html/ToolbarRendererBase.java
branches/RF-7654/ui/output/ui/src/main/java/org/richfaces/renderkit/html/TooltipRenderer.java
branches/RF-7654/ui/output/ui/src/main/resources/META-INF/pn.faces-config.xml
branches/RF-7654/ui/output/ui/src/main/resources/META-INF/pn.taglib.xml
branches/RF-7654/ui/output/ui/src/main/resources/META-INF/resources/org.richfaces/panelMenu.js
branches/RF-7654/ui/output/ui/src/main/resources/META-INF/resources/org.richfaces/panelMenuItem.js
branches/RF-7654/ui/output/ui/src/main/resources/META-INF/resources/org.richfaces/tab.js
branches/RF-7654/ui/output/ui/src/main/templates/toolbar.template.xml
branches/RF-7654/ui/output/ui/src/test/resources/org/richfaces/renderkit/html/panelMenu-icons-inheritance-group.xmlunit.xml
branches/RF-7654/ui/output/ui/src/test/resources/org/richfaces/renderkit/html/panelMenu-icons-inheritance-groupDis.xmlunit.xml
branches/RF-7654/ui/output/ui/src/test/resources/org/richfaces/renderkit/html/panelMenu-icons-inheritance-topGroup.xmlunit.xml
branches/RF-7654/ui/output/ui/src/test/resources/org/richfaces/renderkit/html/panelMenu-icons-inheritance-topGroupDis.xmlunit.xml
branches/RF-7654/ui/output/ui/src/test/resources/org/richfaces/renderkit/html/panelMenuGroup.xmlunit.xml
Log:
Merged revisions 20625-20627,20629,20633,20642,20645,20647,20649-20650,20652-20654,20658,20663 via svnmerge from
https://svn.jboss.org/repos/richfaces/trunk
.......
r20625 | konstantin.mishin | 2010-12-16 11:19:06 -0800 (Thu, 16 Dec 2010) | 1 line
RF-9913
.......
r20626 | konstantin.mishin | 2010-12-16 11:43:06 -0800 (Thu, 16 Dec 2010) | 1 line
RF-6590
.......
r20627 | nbelaevski | 2010-12-16 12:23:35 -0800 (Thu, 16 Dec 2010) | 2 lines
Tree converter names refactoring
Added TODO for ComponentIterators class
.......
r20629 | nbelaevski | 2010-12-16 14:32:17 -0800 (Thu, 16 Dec 2010) | 1 line
DeclarativeTreeDataModelWalker refactoring
.......
r20633 | amarkhel | 2010-12-16 23:18:43 -0800 (Thu, 16 Dec 2010) | 2 lines
RF-9789 Dropdown menu component: pre-promotion code review
- HtmlDimensionsTest was updated.
.......
r20642 | Alex.Kolonitsky | 2010-12-17 03:39:38 -0800 (Fri, 17 Dec 2010) | 1 line
RF-10003 PanelMenu: apply results of pre-promotion code review
.......
r20645 | Alex.Kolonitsky | 2010-12-17 05:59:20 -0800 (Fri, 17 Dec 2010) | 1 line
RF-9537 Tab: onenter and onleave don't work
.......
r20647 | nbelaevski | 2010-12-17 06:33:46 -0800 (Fri, 17 Dec 2010) | 1 line
https://issues.jboss.org/browse/RF-10012
.......
r20649 | Alex.Kolonitsky | 2010-12-17 06:36:40 -0800 (Fri, 17 Dec 2010) | 1 line
unignore test
.......
r20650 | nbelaevski | 2010-12-17 07:01:11 -0800 (Fri, 17 Dec 2010) | 1 line
https://issues.jboss.org/browse/RF-10034
.......
r20652 | nbelaevski | 2010-12-17 07:07:49 -0800 (Fri, 17 Dec 2010) | 1 line
https://issues.jboss.org/browse/RF-10034
.......
r20653 | nbelaevski | 2010-12-17 07:10:07 -0800 (Fri, 17 Dec 2010) | 1 line
https://issues.jboss.org/browse/RF-10034
.......
r20654 | amarkhel | 2010-12-17 07:11:12 -0800 (Fri, 17 Dec 2010) | 1 line
RF-9969 Toolbar: attributes for event handlers ignored
.......
r20658 | konstantin.mishin | 2010-12-17 08:17:57 -0800 (Fri, 17 Dec 2010) | 1 line
RF-9971
.......
r20663 | nbelaevski | 2010-12-17 09:22:05 -0800 (Fri, 17 Dec 2010) | 1 line
https://issues.jboss.org/browse/RF-10043
.......
Property changes on: branches/RF-7654
___________________________________________________________________
Name: svnmerge-integrated
- /branches/RF-7817:1-19154 /branches/RF-8742:1-19867 /branches/RF-9309:1-19112,19378 /trunk:1-20623
+ /branches/RF-7817:1-19154 /branches/RF-8742:1-19867 /branches/RF-9309:1-19112,19378 /trunk:1-20663
Modified: branches/RF-7654/core/api/src/main/java/org/richfaces/component/ComponentIterators.java
===================================================================
--- branches/RF-7654/core/api/src/main/java/org/richfaces/component/ComponentIterators.java 2010-12-17 17:48:19 UTC (rev 20665)
+++ branches/RF-7654/core/api/src/main/java/org/richfaces/component/ComponentIterators.java 2010-12-17 17:57:24 UTC (rev 20666)
@@ -36,6 +36,7 @@
private ComponentIterators() {}
+ //TODO nick - convert to filter/find functions
public static Iterator<UIComponent> parents(final UIComponent component) {
if (component == null) {
return Iterators.<UIComponent>emptyIterator();
Modified: branches/RF-7654/core/api/src/test/java/org/richfaces/renderkit/util/HtmlDimensionsTest.java
===================================================================
--- branches/RF-7654/core/api/src/test/java/org/richfaces/renderkit/util/HtmlDimensionsTest.java 2010-12-17 17:48:19 UTC (rev 20665)
+++ branches/RF-7654/core/api/src/test/java/org/richfaces/renderkit/util/HtmlDimensionsTest.java 2010-12-17 17:57:24 UTC (rev 20666)
@@ -21,7 +21,8 @@
*/
package org.richfaces.renderkit.util;
-import org.junit.Assert;
+import static org.junit.Assert.*;
+
import org.junit.Test;
/**
@@ -32,22 +33,23 @@
@Test
public void testFormatSize() {
- Assert.assertEquals("100px", HtmlDimensions.formatSize("100"));
- Assert.assertEquals("100px", HtmlDimensions.formatSize("100 "));
- Assert.assertEquals("100px", HtmlDimensions.formatSize(" 100"));
- Assert.assertEquals("100px", HtmlDimensions.formatSize(" 100 "));
- Assert.assertEquals("t100px", HtmlDimensions.formatSize("t100"));
- Assert.assertEquals("r100px", HtmlDimensions.formatSize("r100 "));
- Assert.assertEquals("100px ", HtmlDimensions.formatSize("100px "));
- Assert.assertEquals(" 100px", HtmlDimensions.formatSize(" 100px"));
- Assert.assertEquals(" 100px ", HtmlDimensions.formatSize(" 100px "));
- Assert.assertEquals("100px", HtmlDimensions.formatSize("100px"));
- Assert.assertEquals("100 px", HtmlDimensions.formatSize("100 px"));
- Assert.assertEquals("99%", HtmlDimensions.formatSize("99%"));
- Assert.assertEquals("99 %", HtmlDimensions.formatSize("99 %"));
- Assert.assertEquals("100em", HtmlDimensions.formatSize("100em"));
- Assert.assertEquals("size", HtmlDimensions.formatSize("size"));
- Assert.assertEquals("", HtmlDimensions.formatSize(""));
- Assert.assertEquals(" ", HtmlDimensions.formatSize(" "));
+ assertEquals("100px", HtmlDimensions.formatSize("100"));
+ assertEquals("100px", HtmlDimensions.formatSize("100 "));
+ assertEquals("100px", HtmlDimensions.formatSize(" 100"));
+ assertEquals("100px", HtmlDimensions.formatSize(" 100 "));
+ assertEquals("t100px", HtmlDimensions.formatSize("t100"));
+ assertEquals("r100px", HtmlDimensions.formatSize("r100 "));
+ assertEquals("100px ", HtmlDimensions.formatSize("100px "));
+ assertEquals(" 100px", HtmlDimensions.formatSize(" 100px"));
+ assertEquals(" 100px ", HtmlDimensions.formatSize(" 100px "));
+ assertEquals("100px", HtmlDimensions.formatSize("100px"));
+ assertEquals("100 px", HtmlDimensions.formatSize("100 px"));
+ assertEquals("99%", HtmlDimensions.formatSize("99%"));
+ assertEquals("99 %", HtmlDimensions.formatSize("99 %"));
+ assertEquals("100em", HtmlDimensions.formatSize("100em"));
+ assertEquals("size", HtmlDimensions.formatSize("size"));
+ assertEquals("", HtmlDimensions.formatSize(""));
+ assertEquals(" ", HtmlDimensions.formatSize(" "));
+ assertEquals(null, HtmlDimensions.formatSize(null));
}
}
Modified: branches/RF-7654/examples/iteration-demo/src/main/webapp/tree.xhtml
===================================================================
--- branches/RF-7654/examples/iteration-demo/src/main/webapp/tree.xhtml 2010-12-17 17:48:19 UTC (rev 20665)
+++ branches/RF-7654/examples/iteration-demo/src/main/webapp/tree.xhtml 2010-12-17 17:57:24 UTC (rev 20666)
@@ -249,10 +249,10 @@
</h:panelGroup>
</h:panelGrid>
- 'loading' facet:
+ 'handleLoading' facet:
<it:tree value="#{treeBean.rootNodes}" toggleType="ajax" var="node">
<it:treeNode>
- <f:facet name="loading">
+ <f:facet name="handleLoading">
<h:graphicImage value="/images/loading.gif" />
</f:facet>
@@ -260,7 +260,7 @@
</it:treeNode>
</it:tree>
- 'loading' without facet:
+ 'handleLoading' without facet:
<it:tree value="#{treeBean.rootNodes}" toggleType="ajax" var="node" styleClass="loadingWithoutFacet" />
<a4j:queue />
Modified: branches/RF-7654/examples/output-demo/src/main/webapp/examples/tabPanel.xhtml
===================================================================
--- branches/RF-7654/examples/output-demo/src/main/webapp/examples/tabPanel.xhtml 2010-12-17 17:48:19 UTC (rev 20665)
+++ branches/RF-7654/examples/output-demo/src/main/webapp/examples/tabPanel.xhtml 2010-12-17 17:57:24 UTC (rev 20666)
@@ -16,10 +16,10 @@
<h:form id="f">
<pn:tabPanel id="panel" switchType="ajax" tabHeaderClassDisabled="myClass_01" itemChangeListener="#{togglePanelBean.itemChangeActionListener}">
- <pn:tab header="tab1 header" headerClassDisabled="myClass_02">
+ <pn:tab header="tab1 header" headerClassDisabled="myClass_02" onenter="alert('onenter 01')">
Content will be here. Content will be here. Content will be here. Content will be here. Content will be here. Content will be here. Content will be here. Content will be here. Content will be here. Content will be here. Content will be here. Content will be here. Content will be here. Content will be here.
</pn:tab>
- <pn:tab header="tab2 header">
+ <pn:tab header="tab2 header" onenter="alert('onenter 02')">
He he
</pn:tab>
</pn:tabPanel>
Copied: branches/RF-7654/ui/common/api/src/main/java/org/richfaces/component/Mode.java (from rev 20663, trunk/ui/common/api/src/main/java/org/richfaces/component/Mode.java)
===================================================================
--- branches/RF-7654/ui/common/api/src/main/java/org/richfaces/component/Mode.java (rev 0)
+++ branches/RF-7654/ui/common/api/src/main/java/org/richfaces/component/Mode.java 2010-12-17 17:57:24 UTC (rev 20666)
@@ -0,0 +1,28 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc. and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.richfaces.component;
+
+public enum Mode {
+ ajax,
+ client,
+ server;
+}
Modified: branches/RF-7654/ui/core/ui/src/main/java/org/richfaces/component/AbstractActionComponent.java
===================================================================
--- branches/RF-7654/ui/core/ui/src/main/java/org/richfaces/component/AbstractActionComponent.java 2010-12-17 17:48:19 UTC (rev 20665)
+++ branches/RF-7654/ui/core/ui/src/main/java/org/richfaces/component/AbstractActionComponent.java 2010-12-17 17:57:24 UTC (rev 20666)
@@ -26,13 +26,17 @@
import javax.faces.event.FacesEvent;
import javax.faces.event.PhaseId;
+import org.richfaces.cdk.annotations.Attribute;
+
/**
* @author Nick Belaevski
*
*/
public abstract class AbstractActionComponent extends UICommand {
+ @Attribute
public abstract boolean isBypassUpdates();
+
public abstract void setBypassUpdates(boolean bypassUpdates);
@Override
Modified: branches/RF-7654/ui/input/ui/src/main/java/org/richfaces/context/FileUploadPartialViewContextFactory.java
===================================================================
--- branches/RF-7654/ui/input/ui/src/main/java/org/richfaces/context/FileUploadPartialViewContextFactory.java 2010-12-17 17:48:19 UTC (rev 20665)
+++ branches/RF-7654/ui/input/ui/src/main/java/org/richfaces/context/FileUploadPartialViewContextFactory.java 2010-12-17 17:57:24 UTC (rev 20666)
@@ -70,7 +70,7 @@
private String tempFilesDirectory;
/** The maximum size of a file upload request. 0 means no limit. */
- private int maxRequestSize = 0;
+ private long maxRequestSize = 0;
public FileUploadPartialViewContextFactory(PartialViewContextFactory parentFactory) {
this.parentFactory = parentFactory;
@@ -83,7 +83,7 @@
this.tempFilesDirectory = context.getInitParameter("org.richfaces.fileUpload.tempFilesDirectory");
param = context.getInitParameter("org.richfaces.fileUpload.maxRequestSize");
if (param != null) {
- this.maxRequestSize = Integer.parseInt(param);
+ this.maxRequestSize = Long.parseLong(param);
}
}
@@ -95,7 +95,8 @@
Map<String, String> queryParamMap = parseQueryString(request.getQueryString());
String uid = queryParamMap.get(UID_KEY);
if (uid != null) {
- if (maxRequestSize != 0 && externalContext.getRequestContentLength() > maxRequestSize) {
+ long contentLength = Long.parseLong(externalContext.getRequestHeaderMap().get("Content-Length"));
+ if (maxRequestSize != 0 && contentLength > maxRequestSize) {
printResponse(facesContext, uid, ResponseState.sizeExceeded);
} else {
final MultipartRequest multipartRequest = new MultipartRequest(request, createTempFiles,
Modified: branches/RF-7654/ui/input/ui/src/main/resources/META-INF/resources/org.richfaces/fileupload.js
===================================================================
--- branches/RF-7654/ui/input/ui/src/main/resources/META-INF/resources/org.richfaces/fileupload.js 2010-12-17 17:48:19 UTC (rev 20665)
+++ branches/RF-7654/ui/input/ui/src/main/resources/META-INF/resources/org.richfaces/fileupload.js 2010-12-17 17:57:24 UTC (rev 20666)
@@ -173,7 +173,8 @@
var documentElement = contentDocument.documentElement;
var responseStatus, id;
if (documentElement.tagName.toUpperCase() == "PARTIAL-RESPONSE") {
- responseStatus = ITEM_STATE.DONE;
+ var errors = jQuery(documentElement).children("error");
+ responseStatus = errors.length > 0 ? ITEM_STATE.SERVER_ERROR: ITEM_STATE.DONE;
} else if ((id = documentElement.id) && id.indexOf(UID + this.loadableItem.uid + ":") == 0) {
responseStatus = id.split(":")[1];
}
Modified: branches/RF-7654/ui/input/ui/src/main/resources/META-INF/resources/org.richfaces/inputNumberSlider.js
===================================================================
--- branches/RF-7654/ui/input/ui/src/main/resources/META-INF/resources/org.richfaces/inputNumberSlider.js 2010-12-17 17:48:19 UTC (rev 20665)
+++ branches/RF-7654/ui/input/ui/src/main/resources/META-INF/resources/org.richfaces/inputNumberSlider.js 2010-12-17 17:57:24 UTC (rev 20666)
@@ -87,7 +87,6 @@
__setValue: function (value, event, skipOnchange) {
if (!isNaN(value)) {
- value = Math.round(value / this.step) * this.step; //TODO Add normal support of float values. E.g. '0.3' should be instead of '0.30000000000000004'.
if (value > this.maxValue) {
value = this.maxValue;
} else if (value < this.minValue) {
@@ -170,6 +169,7 @@
__mousemoveHandler: function (event) {
var value = this.range * (event.pageX - this.track.position().left) / (this.track.width()
- this.handle.width()) + this.minValue;
+ value = Math.round(value / this.step) * this.step; //TODO Add normal support of float values. E.g. '0.3' should be instead of '0.30000000000000004'.
this.__setValue(value, event);
event.preventDefault();
},
Modified: branches/RF-7654/ui/input/ui/src/main/resources/META-INF/resources/org.richfaces/inputNumberSpinner.js
===================================================================
--- branches/RF-7654/ui/input/ui/src/main/resources/META-INF/resources/org.richfaces/inputNumberSpinner.js 2010-12-17 17:48:19 UTC (rev 20665)
+++ branches/RF-7654/ui/input/ui/src/main/resources/META-INF/resources/org.richfaces/inputNumberSpinner.js 2010-12-17 17:57:24 UTC (rev 20666)
@@ -99,7 +99,6 @@
__setValue: function (value, event, skipOnchange) {
if (!isNaN(value)) {
- value = Math.round(value / this.step) * this.step; //TODO Add normal support of float values. E.g. '0.3' should be instead of '0.30000000000000004'.
if (value > this.maxValue) {
value = this.maxValue;
} else if (value < this.minValue) {
Modified: branches/RF-7654/ui/iteration/ui/src/main/config/faces-config.xml
===================================================================
--- branches/RF-7654/ui/iteration/ui/src/main/config/faces-config.xml 2010-12-17 17:48:19 UTC (rev 20665)
+++ branches/RF-7654/ui/iteration/ui/src/main/config/faces-config.xml 2010-12-17 17:57:24 UTC (rev 20666)
@@ -17,8 +17,8 @@
</converter>
<converter>
- <converter-id>org.richfaces.ObjectSequenceRowKeyConverter</converter-id>
- <converter-class>org.richfaces.convert.ObjectSequenceRowKeyConverter</converter-class>
+ <converter-id>org.richfaces.StringSequenceRowKeyConverter</converter-id>
+ <converter-class>org.richfaces.convert.StringSequenceRowKeyConverter</converter-class>
</converter>
<faces-config-extension>
Modified: branches/RF-7654/ui/iteration/ui/src/main/java/org/richfaces/component/DeclarativeTreeDataModelWalker.java
===================================================================
--- branches/RF-7654/ui/iteration/ui/src/main/java/org/richfaces/component/DeclarativeTreeDataModelWalker.java 2010-12-17 17:48:19 UTC (rev 20665)
+++ branches/RF-7654/ui/iteration/ui/src/main/java/org/richfaces/component/DeclarativeTreeDataModelWalker.java 2010-12-17 17:57:24 UTC (rev 20666)
@@ -51,47 +51,33 @@
private Map<String, Object> contextMap;
+ private Object modelData;
+
private Object data;
- public DeclarativeTreeDataModelWalker(AbstractTree rootComponent) {
+ public DeclarativeTreeDataModelWalker(FacesContext facesContext, AbstractTree rootComponent) {
super();
this.rootComponent = rootComponent;
- this.facesContext = FacesContext.getCurrentInstance();
+ this.facesContext = facesContext;
this.contextMap = rootComponent.getVariablesMap(facesContext);
this.var = rootComponent.getVar();
this.currentComponent = rootComponent;
}
- protected UIComponent getChildModelComponent(String modelId) {
- UIComponent modelComponent;
-
+ private void setupChildModelContext(String modelId) {
if (currentComponent instanceof TreeModelRecursiveAdaptor && modelId.equals(currentComponent.getId())) {
- modelComponent = currentComponent;
+ //currentComponent already set
+ modelData = ((TreeModelRecursiveAdaptor) currentComponent).getNodes();
} else {
- modelComponent = Iterables.find(currentComponent.getChildren(), ComponentPredicates.withId(modelId));
- }
-
- return modelComponent;
- }
-
- protected Object getNodes(UIComponent modelComponent) {
- Object nodes = null;
-
- if (modelComponent instanceof TreeModelRecursiveAdaptor) {
- TreeModelRecursiveAdaptor recursiveAdaptor = (TreeModelRecursiveAdaptor) modelComponent;
-
- if (currentComponent.equals(modelComponent)) {
- nodes = recursiveAdaptor.getNodes();
+ currentComponent = Iterables.find(currentComponent.getChildren(), ComponentPredicates.withId(modelId));
+ if (currentComponent instanceof TreeModelRecursiveAdaptor) {
+ modelData = ((TreeModelRecursiveAdaptor) currentComponent).getRoots();
} else {
- nodes = recursiveAdaptor.getRoots();
+ modelData = ((TreeModelAdaptor) currentComponent).getNodes();
}
- } else {
- nodes = ((TreeModelAdaptor) modelComponent).getNodes();
}
-
- return nodes;
}
protected FacesContext getFacesContext() {
@@ -143,24 +129,21 @@
}
}
- protected void walkSimpleKeys(Object simpleKey) {
- DeclarativeModelKey segment = (DeclarativeModelKey) simpleKey;
-
+ protected void walkSimpleKey(DeclarativeModelKey segment) {
if (var != null) {
- contextMap.put(var, this.data);
+ contextMap.put(var, data);
}
- UIComponent modelComponent = getChildModelComponent(segment.getModelId());
- Object nodes = getNodes(modelComponent);
-
- this.currentComponent = modelComponent;
- DeclarativeModelKey convertedKey = convertKey(nodes, segment);
- this.data = getData(nodes, convertedKey.getModelKey());
+ setupChildModelContext(segment.getModelId());
+
+ DeclarativeModelKey convertedKey = convertKey(modelData, segment);
+ data = getData(modelData, convertedKey.getModelKey());
}
protected void walkSimpleKeys(Object[] simpleKeys) {
for (Object simpleKey : simpleKeys) {
- walkSimpleKeys(simpleKey);
+ DeclarativeModelKey declarativeKey = (DeclarativeModelKey) simpleKey;
+ walkSimpleKey(declarativeKey);
}
}
Modified: branches/RF-7654/ui/iteration/ui/src/main/java/org/richfaces/convert/DeclarativeModelSequenceKeyConverter.java
===================================================================
--- branches/RF-7654/ui/iteration/ui/src/main/java/org/richfaces/convert/DeclarativeModelSequenceKeyConverter.java 2010-12-17 17:48:19 UTC (rev 20665)
+++ branches/RF-7654/ui/iteration/ui/src/main/java/org/richfaces/convert/DeclarativeModelSequenceKeyConverter.java 2010-12-17 17:57:24 UTC (rev 20666)
@@ -45,8 +45,8 @@
private int keysIdx;
- private KeyConvertingWalker(AbstractTree rootComponent, FacesContext context) {
- super(rootComponent);
+ private KeyConvertingWalker(FacesContext context, AbstractTree rootComponent) {
+ super(context, rootComponent);
this.context = context;
}
@@ -93,7 +93,7 @@
if (key != null) {
- KeyConvertingWalker walker = new KeyConvertingWalker((AbstractTree) component, context);
+ KeyConvertingWalker walker = new KeyConvertingWalker(context, (AbstractTree) component);
walker.walk(key);
key = new SequenceRowKey((Object[]) walker.getConvertedSimpleKeys());
Deleted: branches/RF-7654/ui/iteration/ui/src/main/java/org/richfaces/convert/ObjectSequenceRowKeyConverter.java
===================================================================
--- branches/RF-7654/ui/iteration/ui/src/main/java/org/richfaces/convert/ObjectSequenceRowKeyConverter.java 2010-12-17 17:48:19 UTC (rev 20665)
+++ branches/RF-7654/ui/iteration/ui/src/main/java/org/richfaces/convert/ObjectSequenceRowKeyConverter.java 2010-12-17 17:57:24 UTC (rev 20666)
@@ -1,51 +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.convert;
-
-import javax.faces.component.UIComponent;
-import javax.faces.context.FacesContext;
-import javax.faces.convert.Converter;
-
-/**
- * @author Nick Belaevski
- *
- */
-public class ObjectSequenceRowKeyConverter extends SequenceRowKeyConverter<Object> {
-
- public static final String CONVERTER_ID = "org.richfaces.ObjectSequenceRowKeyConverter";
-
- private static final Converter NO_OP_CONVERTER = new Converter() {
-
- public String getAsString(FacesContext context, UIComponent component, Object value) {
- return (String) value;
- }
-
- public Object getAsObject(FacesContext context, UIComponent component, String value) {
- return value;
- }
- };
-
- public ObjectSequenceRowKeyConverter() {
- super(Object.class, NO_OP_CONVERTER);
- }
-
-}
Copied: branches/RF-7654/ui/iteration/ui/src/main/java/org/richfaces/convert/StringSequenceRowKeyConverter.java (from rev 20663, trunk/ui/iteration/ui/src/main/java/org/richfaces/convert/StringSequenceRowKeyConverter.java)
===================================================================
--- branches/RF-7654/ui/iteration/ui/src/main/java/org/richfaces/convert/StringSequenceRowKeyConverter.java (rev 0)
+++ branches/RF-7654/ui/iteration/ui/src/main/java/org/richfaces/convert/StringSequenceRowKeyConverter.java 2010-12-17 17:57:24 UTC (rev 20666)
@@ -0,0 +1,37 @@
+/*
+ * 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.convert;
+
+
+/**
+ * @author Nick Belaevski
+ *
+ */
+public class StringSequenceRowKeyConverter extends SequenceRowKeyConverter<Object> {
+
+ public static final String CONVERTER_ID = "org.richfaces.StringSequenceRowKeyConverter";
+
+ public StringSequenceRowKeyConverter() {
+ super(Object.class, ConverterUtil.stringConverter());
+ }
+
+}
Modified: branches/RF-7654/ui/iteration/ui/src/main/java/org/richfaces/model/ClassicTreeNodeDataModelImpl.java
===================================================================
--- branches/RF-7654/ui/iteration/ui/src/main/java/org/richfaces/model/ClassicTreeNodeDataModelImpl.java 2010-12-17 17:48:19 UTC (rev 20665)
+++ branches/RF-7654/ui/iteration/ui/src/main/java/org/richfaces/model/ClassicTreeNodeDataModelImpl.java 2010-12-17 17:57:24 UTC (rev 20666)
@@ -25,7 +25,7 @@
import javax.faces.convert.Converter;
-import org.richfaces.convert.ObjectSequenceRowKeyConverter;
+import org.richfaces.convert.StringSequenceRowKeyConverter;
import org.richfaces.model.iterators.ClassicTreeNodeTuplesIterator;
/**
@@ -34,7 +34,7 @@
*/
public class ClassicTreeNodeDataModelImpl extends NodesTreeSequenceKeyModel<TreeNode> {
- private static final Converter DEFAULT_CONVERTER = new ObjectSequenceRowKeyConverter();
+ private static final Converter DEFAULT_CONVERTER = new StringSequenceRowKeyConverter();
private TreeNode rootNode;
Modified: branches/RF-7654/ui/iteration/ui/src/main/java/org/richfaces/model/DeclarativeTreeDataModelImpl.java
===================================================================
--- branches/RF-7654/ui/iteration/ui/src/main/java/org/richfaces/model/DeclarativeTreeDataModelImpl.java 2010-12-17 17:48:19 UTC (rev 20665)
+++ branches/RF-7654/ui/iteration/ui/src/main/java/org/richfaces/model/DeclarativeTreeDataModelImpl.java 2010-12-17 17:57:24 UTC (rev 20666)
@@ -24,6 +24,7 @@
import java.util.Iterator;
import javax.faces.component.UIComponent;
+import javax.faces.context.FacesContext;
import javax.faces.convert.Converter;
import org.richfaces.component.AbstractTree;
@@ -90,7 +91,7 @@
this.currentComponent = tree;
if (key != null) {
- DeclarativeTreeDataModelWalker walker = new DeclarativeTreeDataModelWalker(tree);
+ DeclarativeTreeDataModelWalker walker = new DeclarativeTreeDataModelWalker(FacesContext.getCurrentInstance(), tree);
walker.walk(key);
setRowKeyAndData(key, walker.getData());
Modified: branches/RF-7654/ui/iteration/ui/src/main/java/org/richfaces/renderkit/TreeNodeRendererBase.java
===================================================================
--- branches/RF-7654/ui/iteration/ui/src/main/java/org/richfaces/renderkit/TreeNodeRendererBase.java 2010-12-17 17:48:19 UTC (rev 20665)
+++ branches/RF-7654/ui/iteration/ui/src/main/java/org/richfaces/renderkit/TreeNodeRendererBase.java 2010-12-17 17:57:24 UTC (rev 20666)
@@ -53,7 +53,7 @@
private static final String TRIGGER_NODE_AJAX_UPDATE = "__TRIGGER_NODE_AJAX_UPDATE";
- private static final String LOADING_FACET_NAME = "loading";
+ private static final String HANDLE_LOADING_FACET_NAME = "handleLoading";
@Override
public void decode(FacesContext context, UIComponent component) {
@@ -171,7 +171,7 @@
renderingContext.addHandlers(treeNode);
}
- protected UIComponent getLoadingFacetIfApplicable(UIComponent component) {
+ protected UIComponent getHandleLoadingFacetIfApplicable(UIComponent component) {
AbstractTreeNode treeNode = (AbstractTreeNode) component;
AbstractTree tree = treeNode.findTreeComponent();
@@ -180,11 +180,15 @@
return null;
}
- UIComponent facet = treeNode.getFacet(LOADING_FACET_NAME);
+ UIComponent facet = treeNode.getFacet(HANDLE_LOADING_FACET_NAME);
if (facet == null) {
- facet = tree.getFacet(LOADING_FACET_NAME);
+ facet = tree.getFacet(HANDLE_LOADING_FACET_NAME);
}
- return facet;
+ if (facet != null && facet.isRendered()) {
+ return facet;
+ }
+
+ return null;
}
}
Modified: branches/RF-7654/ui/iteration/ui/src/main/resources/META-INF/resources/org.richfaces/extendedDataTable.js
===================================================================
--- branches/RF-7654/ui/iteration/ui/src/main/resources/META-INF/resources/org.richfaces/extendedDataTable.js 2010-12-17 17:48:19 UTC (rev 20665)
+++ branches/RF-7654/ui/iteration/ui/src/main/resources/META-INF/resources/org.richfaces/extendedDataTable.js 2010-12-17 17:57:24 UTC (rev 20666)
@@ -636,6 +636,10 @@
jQuery(window).unbind("resize", updateLayout);
jQuery(richfaces.getDomElement(id + ':st')).remove();
}
+
+ this.detach = function () {
+ // TODO see implementation in richfaces-base-component.js
+ };
this.getColumnPosition = function(id) {
var position;
Modified: branches/RF-7654/ui/iteration/ui/src/main/resources/META-INF/resources/org.richfaces/tree.ecss
===================================================================
--- branches/RF-7654/ui/iteration/ui/src/main/resources/META-INF/resources/org.richfaces/tree.ecss 2010-12-17 17:48:19 UTC (rev 20665)
+++ branches/RF-7654/ui/iteration/ui/src/main/resources/META-INF/resources/org.richfaces/tree.ecss 2010-12-17 17:57:24 UTC (rev 20666)
@@ -38,7 +38,7 @@
margin-left: 16px;
}
-.rf-trn-ico, .rf-trn-hnd, .rf-trn-ldn-fct {
+.rf-trn-ico, .rf-trn-hnd, .rf-trn-hnd-ldn-fct {
vertical-align: middle;
margin: 0px;
cursor: pointer;
@@ -80,15 +80,15 @@
display: none;
}
-.rf-trn-ldn-fct {
+.rf-trn-hnd-ldn-fct {
cursor: default;
display: none;
}
-.rf-trn-ldn > .rf-trn-ldn-fct {
+.rf-trn-ldn > .rf-trn-hnd-ldn-fct {
display: inline-block;
}
-.rf-trn-ldn > .rf-trn-ldn-fct + .rf-trn-hnd {
+.rf-trn-ldn > .rf-trn-hnd-ldn-fct + .rf-trn-hnd {
display: none;
}
\ No newline at end of file
Modified: branches/RF-7654/ui/iteration/ui/src/main/resources/META-INF/resources/org.richfaces/tree.js
===================================================================
--- branches/RF-7654/ui/iteration/ui/src/main/resources/META-INF/resources/org.richfaces/tree.js 2010-12-17 17:48:19 UTC (rev 20665)
+++ branches/RF-7654/ui/iteration/ui/src/main/resources/META-INF/resources/org.richfaces/tree.js 2010-12-17 17:57:24 UTC (rev 20666)
@@ -287,7 +287,12 @@
var newChild = new richfaces.ui.TreeNode(node[0], opts);
parentNode.addChild(newChild, idx);
- parentNode.getTree().__updateSelectionFromInput();
+
+ var tree = parentNode.getTree();
+
+ if (tree.getSelection().contains(newChild.getId())) {
+ newChild.__setSelected(true);
+ }
};
richfaces.ui.TreeNode.emitToggleEvent = function(nodeId) {
@@ -433,13 +438,9 @@
return this;
},
- __isSelected: function(node) {
- return this.__selection.contains(node);
- },
-
__handleSelectionChange: function(newSelection) {
var eventData = {
- oldSelection: this.__selection.getNodes(),
+ oldSelection: this.getSelection().getNodes(),
newSelection: newSelection.getNodes()
};
@@ -457,12 +458,12 @@
},
__toggleSelection: function(node) {
- var newSelection = this.__selection.cloneAndToggle(node);
+ var newSelection = this.getSelection().cloneAndToggle(node);
this.__handleSelectionChange(newSelection);
},
__addToSelection: function(node) {
- var newSelection = this.__selection.cloneAndAdd(node);
+ var newSelection = this.getSelection().cloneAndAdd(node);
this.__handleSelectionChange(newSelection);
},
@@ -472,7 +473,7 @@
__updateSelection: function(newSelection) {
- var oldSelection = this.__selection;
+ var oldSelection = this.getSelection();
oldSelection.each(function() {this.__setSelected(false)});
newSelection.each(function() {this.__setSelected(true)});
@@ -485,7 +486,12 @@
}
this.__selection = newSelection;
+ },
+
+ getSelection: function() {
+ return this.__selection;
}
+
});
// define super class link for Tree
Modified: branches/RF-7654/ui/iteration/ui/src/main/templates/treeNode.template.xml
===================================================================
--- branches/RF-7654/ui/iteration/ui/src/main/templates/treeNode.template.xml 2010-12-17 17:48:19 UTC (rev 20665)
+++ branches/RF-7654/ui/iteration/ui/src/main/templates/treeNode.template.xml 2010-12-17 17:57:24 UTC (rev 20666)
@@ -27,10 +27,10 @@
<div class="#{concatClasses('rf-trn', component.attributes['styleClass'], tree.attributes['nodeClass'])}"
cdk:passThroughWithExclusions="">
- <cdk:object name="loadingFacet" type="UIComponent" value="#{getLoadingFacetIfApplicable(component)}" />
+ <cdk:object name="loadingFacet" type="UIComponent" value="#{getHandleLoadingFacetIfApplicable(component)}" />
<c:if test="#{not empty loadingFacet and loadingFacet.isRendered()}">
- <span class="rf-trn-ldn-fct">
+ <span class="rf-trn-hnd-ldn-fct">
<cdk:call>
loadingFacet.encodeAll(facesContext);
</cdk:call>
Modified: branches/RF-7654/ui/iteration/ui/src/test/java/org/richfaces/renderkit/ExtendedDataTableRendererTest.java
===================================================================
--- branches/RF-7654/ui/iteration/ui/src/test/java/org/richfaces/renderkit/ExtendedDataTableRendererTest.java 2010-12-17 17:48:19 UTC (rev 20665)
+++ branches/RF-7654/ui/iteration/ui/src/test/java/org/richfaces/renderkit/ExtendedDataTableRendererTest.java 2010-12-17 17:57:24 UTC (rev 20666)
@@ -39,6 +39,7 @@
import org.jboss.test.faces.htmlunit.HtmlUnitEnvironment;
import org.junit.After;
import org.junit.Before;
+import org.junit.Ignore;
import org.junit.Test;
import org.richfaces.component.AbstractExtendedDataTable;
import org.richfaces.component.SortOrder;
Modified: branches/RF-7654/ui/output/ui/src/main/java/org/richfaces/component/AbstractDropDownMenu.java
===================================================================
--- branches/RF-7654/ui/output/ui/src/main/java/org/richfaces/component/AbstractDropDownMenu.java 2010-12-17 17:48:19 UTC (rev 20665)
+++ branches/RF-7654/ui/output/ui/src/main/java/org/richfaces/component/AbstractDropDownMenu.java 2010-12-17 17:57:24 UTC (rev 20666)
@@ -13,8 +13,7 @@
renderer=@JsfRenderer(type = DropDownMenuRendererBase.RENDERER_TYPE),
tag = @Tag(name="dropDownMenu"),
attributes = {"events-props.xml", "core-props.xml", "i18n-props.xml"})
-public abstract class AbstractDropDownMenu extends UIComponentBase
- implements MenuComponent {
+public abstract class AbstractDropDownMenu extends UIComponentBase {
public static final String COMPONENT_TYPE = "org.richfaces.DropDownMenu";
@@ -23,7 +22,7 @@
@Attribute
public abstract String getShowEvent();
- @Attribute(defaultValue = MenuComponent.MODE_SERVER)
+ @Attribute(defaultValue = "server")
public abstract String getMode();
@Attribute
@@ -60,16 +59,7 @@
public abstract String getOnitemclick();
public enum Facets {
- LABEL("label"), LABEL_DISABLED("labelDisabled");
-
- private String facetName;
- private Facets(String name) {
- this.facetName = name;
- }
-
- @Override
- public String toString() {
- return facetName;
- }
+ label,
+ labelDisabled
}
}
Modified: branches/RF-7654/ui/output/ui/src/main/java/org/richfaces/component/AbstractMenuGroup.java
===================================================================
--- branches/RF-7654/ui/output/ui/src/main/java/org/richfaces/component/AbstractMenuGroup.java 2010-12-17 17:48:19 UTC (rev 20665)
+++ branches/RF-7654/ui/output/ui/src/main/java/org/richfaces/component/AbstractMenuGroup.java 2010-12-17 17:57:24 UTC (rev 20666)
@@ -54,16 +54,7 @@
public abstract String getOnhide();
public enum Facets {
- ICON("icon"), ICON_DISABLED("iconDisabled");
-
- private String facetName;
- private Facets(String name) {
- this.facetName = name;
- }
-
- @Override
- public String toString() {
- return facetName;
- }
+ icon,
+ iconDisabled
}
}
Modified: branches/RF-7654/ui/output/ui/src/main/java/org/richfaces/component/AbstractMenuItem.java
===================================================================
--- branches/RF-7654/ui/output/ui/src/main/java/org/richfaces/component/AbstractMenuItem.java 2010-12-17 17:48:19 UTC (rev 20665)
+++ branches/RF-7654/ui/output/ui/src/main/java/org/richfaces/component/AbstractMenuItem.java 2010-12-17 17:57:24 UTC (rev 20666)
@@ -12,8 +12,7 @@
renderer=@JsfRenderer(type = MenuItemRendererBase.RENDERER_TYPE),
tag = @Tag(name="menuItem"),
attributes = {"events-props.xml", "core-props.xml", "i18n-props.xml", "ajax-props.xml"})
-public abstract class AbstractMenuItem extends AbstractActionComponent
- implements MenuComponent {
+public abstract class AbstractMenuItem extends AbstractActionComponent {
public static final String COMPONENT_TYPE = "org.richfaces.MenuItem";
@@ -33,16 +32,7 @@
public abstract boolean isDisabled();
public enum Facets {
- ICON("icon"), ICON_DISABLED("iconDisabled");
-
- private String facetName;
- private Facets(String name) {
- this.facetName = name;
- }
-
- @Override
- public String toString() {
- return facetName;
- }
+ icon,
+ iconDisabled
}
}
Modified: branches/RF-7654/ui/output/ui/src/main/java/org/richfaces/component/AbstractPanelMenu.java
===================================================================
--- branches/RF-7654/ui/output/ui/src/main/java/org/richfaces/component/AbstractPanelMenu.java 2010-12-17 17:48:19 UTC (rev 20665)
+++ branches/RF-7654/ui/output/ui/src/main/java/org/richfaces/component/AbstractPanelMenu.java 2010-12-17 17:57:24 UTC (rev 20666)
@@ -49,7 +49,6 @@
private String submittedActiveItem;
private enum PropertyKeys {
- valid,
immediate
}
@@ -62,43 +61,34 @@
super.processDecodes(context);
//TODO nick - is component immediate = true only?
- //TODO nick - validate should be executed in context of component, i.e. when 'component' EL variable is set
- executeValidate(context);
+ //TODO nick - processValue should be executed in context of component, i.e. when 'component' EL variable is set
+
+ processValue(context);
}
- public void validate(FacesContext context) {
- if (context == null) {
- throw new NullPointerException();
- }
+ private void processValue(FacesContext context) {
+ try {
+ if (context == null) {
+ throw new NullPointerException();
+ }
- // Submitted value == null means "the component was not submitted at all".
- String activeItem = getSubmittedActiveItem();
- if (activeItem == null) {
- return;
- }
+ // Submitted value == null means "the component was not submitted at all".
+ String activeItem = getSubmittedActiveItem();
+ if (activeItem == null) {
+ return;
+ }
- String previous = (String) getValue();
- setActiveItem(activeItem);
- setSubmittedActiveItem(null);
-
- if (previous == null || !previous.equalsIgnoreCase(activeItem)) {
- queueEvent(new ItemChangeEvent(this, previous, activeItem));
- }
- }
+ String previous = (String) getValue();
+ setActiveItem(activeItem);
+ setSubmittedActiveItem(null);
- private void executeValidate(FacesContext context) {
- try {
- validate(context);
+ if (previous == null || !previous.equalsIgnoreCase(activeItem)) {
+ queueEvent(new ItemChangeEvent(this, previous, activeItem));
+ }
} catch (RuntimeException e) {
context.renderResponse();
throw e;
}
-
- //TODO nick - where is 'valid' attribute set?
- if (!isValid()) {
- context.validationFailed();
- context.renderResponse();
- }
}
@Override
@@ -125,10 +115,8 @@
super.broadcast(event);
//TODO nick - check for (isBypassUpdates() || isImmediate()) can be removed
- if (event instanceof ItemChangeEvent
- && (isBypassUpdates() || isImmediate())) {
- //TODO nick - use getFacesContext() instead
- FacesContext.getCurrentInstance().renderResponse();
+ if (event instanceof ItemChangeEvent && (isBypassUpdates() || isImmediate())) {
+ getFacesContext().renderResponse();
}
}
@@ -138,19 +126,10 @@
return this.submittedActiveItem;
}
- //TODO nick - change argument to String
- public void setSubmittedActiveItem(Object submittedValue) {
+ public void setSubmittedActiveItem(String submittedValue) {
this.submittedActiveItem = String.valueOf(submittedValue);
}
- public boolean isValid() {
- return (Boolean) getStateHelper().eval(PropertyKeys.valid, true);
- }
-
- public void setValid(boolean valid) {
- getStateHelper().put(PropertyKeys.valid, valid);
- }
-
public String getActiveItem() {
return (String) getValue();
}
@@ -219,12 +198,15 @@
}
private static AbstractPanelMenuItem getItem(String itemName, UIComponent comp) {
+ if (comp instanceof AbstractPanelMenu) {
+ return null;
+ }
+
if (comp instanceof AbstractPanelMenuItem
&& itemName.equals(((AbstractPanelMenuItem) comp).getName())) {
return (AbstractPanelMenuItem) comp;
}
- //TODO nick - what if panel menu is nested?
for (UIComponent item : comp.getChildren()) {
AbstractPanelMenuItem resItem = getItem(itemName, item);
if (resItem != null) {
Modified: branches/RF-7654/ui/output/ui/src/main/java/org/richfaces/component/AbstractPanelMenuGroup.java
===================================================================
--- branches/RF-7654/ui/output/ui/src/main/java/org/richfaces/component/AbstractPanelMenuGroup.java 2010-12-17 17:48:19 UTC (rev 20665)
+++ branches/RF-7654/ui/output/ui/src/main/java/org/richfaces/component/AbstractPanelMenuGroup.java 2010-12-17 17:57:24 UTC (rev 20666)
@@ -23,6 +23,7 @@
package org.richfaces.component;
+import javax.el.MethodExpression;
import javax.el.ValueExpression;
import javax.faces.context.FacesContext;
import javax.faces.event.FacesEvent;
@@ -43,7 +44,6 @@
private Boolean submittedExpanded;
private enum PropertyKeys {
- valid,
immediate
}
@@ -91,11 +91,6 @@
throw e;
}
- //TODO nick - isValid()/setValid() is not called anywhere
- if (!isValid()) {
- context.validationFailed();
- context.renderResponse();
- }
}
@Override
@@ -127,14 +122,6 @@
this.submittedExpanded = Boolean.parseBoolean(String.valueOf(submittedValue));
}
- public boolean isValid() {
- return (Boolean) getStateHelper().eval(PropertyKeys.valid, true);
- }
-
- public void setValid(boolean valid) {
- getStateHelper().put(PropertyKeys.valid, valid);
- }
-
public boolean isExpanded() {
return getValue() == null ? false : (Boolean) getValue();
}
@@ -160,9 +147,6 @@
getStateHelper().put(PropertyKeys.immediate, immediate);
}
-
-
-
public abstract boolean isExpandSingle();
public abstract String getCollapseEvent();
@@ -171,6 +155,5 @@
public abstract boolean isBubbleSelection();
- //TODO nick - this should be MethodExpression
- public abstract String getChangeExpandListener();
+ public abstract MethodExpression getChangeExpandListener();
}
Modified: branches/RF-7654/ui/output/ui/src/main/java/org/richfaces/component/AbstractPanelMenuItem.java
===================================================================
--- branches/RF-7654/ui/output/ui/src/main/java/org/richfaces/component/AbstractPanelMenuItem.java 2010-12-17 17:48:19 UTC (rev 20665)
+++ branches/RF-7654/ui/output/ui/src/main/java/org/richfaces/component/AbstractPanelMenuItem.java 2010-12-17 17:57:24 UTC (rev 20666)
@@ -23,50 +23,20 @@
package org.richfaces.component;
-import javax.faces.component.UICommand;
-import javax.faces.component.UIComponent;
-
import org.richfaces.PanelMenuMode;
-import org.richfaces.event.ItemChangeListener;
-import org.richfaces.event.ItemChangeSource;
+import javax.faces.component.UIComponent;
+
/**
* @author akolonitsky
* @since 2010-10-25
*/
-//TODO nick - use org.richfaces.component.AbstractActionComponent as super class
-public abstract class AbstractPanelMenuItem extends UICommand implements ItemChangeSource{
+public abstract class AbstractPanelMenuItem extends AbstractActionComponent {
public static final String COMPONENT_TYPE = "org.richfaces.PanelMenuItem";
public static final String COMPONENT_FAMILY = "org.richfaces.PanelMenuItem";
- //TODO nick - move this enum to renderkit package
- public enum Icons {
- none("rf-pm-none"),
- disc("rf-pm-disc"),
- grid("rf-pm-grid"),
- chevron("rf-pm-chevron"),
- chevronUp("rf-pm-chevron-up"),
- chevronDown("rf-pm-chevron-down"),
- triangle("rf-pm-triangle"),
- triangleUp("rf-pm-triangle-up"),
- triangleDown("rf-pm-triangle-down");
-
- public static final Icons DEFAULT = none;
-
- private final String cssClass;
-
- Icons(String cssClass) {
- this.cssClass = cssClass;
- }
-
- //TODO nick - should this become getCssClass()?
- public String cssClass() {
- return cssClass;
- }
- }
-
protected AbstractPanelMenuItem() {
setRendererType("org.richfaces.PanelMenuItem");
}
@@ -117,8 +87,6 @@
public abstract boolean isDisabled();
- public abstract boolean isBypassUpdates();
-
public abstract boolean isLimitRender();
public abstract Object getData();
@@ -128,20 +96,4 @@
public abstract Object getExecute();
public abstract Object getRender();
-
- // ------------------------------------------------ Event Processing Methods
-
- //TODO nick - it seems these listeners are never triggered
- public void addItemChangeListener(ItemChangeListener listener) {
- addFacesListener(listener);
- }
-
- public ItemChangeListener[] getItemChangeListeners() {
- return (ItemChangeListener[]) getFacesListeners(ItemChangeListener.class);
- }
-
- public void removeItemChangeListener(ItemChangeListener listener) {
- removeFacesListener(listener);
- }
-
}
Modified: branches/RF-7654/ui/output/ui/src/main/java/org/richfaces/component/AbstractTogglePanel.java
===================================================================
--- branches/RF-7654/ui/output/ui/src/main/java/org/richfaces/component/AbstractTogglePanel.java 2010-12-17 17:48:19 UTC (rev 20665)
+++ branches/RF-7654/ui/output/ui/src/main/java/org/richfaces/component/AbstractTogglePanel.java 2010-12-17 17:57:24 UTC (rev 20666)
@@ -142,7 +142,7 @@
* <p>Specialized decode behavior on top of that provided by the
* superclass. In addition to the standard
* <code>processDecodes</code> behavior inherited from {@link
- * javax.faces.component.UIComponentBase}, calls <code>validate()</code> if the the
+ * javax.faces.component.UIComponentBase}, calls <code>processValue()</code> if the the
* <code>immediate</code> property is true; if the component is
* invalid afterwards or a <code>RuntimeException</code> is thrown,
* calls {@link FacesContext#renderResponse}. </p>
@@ -185,7 +185,7 @@
/**
* <p>In addition to the standard <code>processValidators</code> behavior
- * inherited from {@link javax.faces.component.UIComponentBase}, calls <code>validate()</code>
+ * inherited from {@link javax.faces.component.UIComponentBase}, calls <code>processValue()</code>
* if the <code>immediate</code> property is false (which is the
* default); if the component is invalid afterwards, calls
* {@link FacesContext#renderResponse}.
Deleted: branches/RF-7654/ui/output/ui/src/main/java/org/richfaces/component/MenuComponent.java
===================================================================
--- branches/RF-7654/ui/output/ui/src/main/java/org/richfaces/component/MenuComponent.java 2010-12-17 17:48:19 UTC (rev 20665)
+++ branches/RF-7654/ui/output/ui/src/main/java/org/richfaces/component/MenuComponent.java 2010-12-17 17:57:24 UTC (rev 20666)
@@ -1,44 +0,0 @@
-/**
- * License Agreement.
- *
- * JBoss RichFaces - Ajax4jsf Component Library
- *
- * Copyright (C) 2007 Exadel, Inc.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License version 2.1 as published by the Free Software Foundation.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-package org.richfaces.component;
-
-
-/**
- * Interface which main menu must implements in order to menu components could works correctly.
- * @author F. Antonov
- *
- */
-public interface MenuComponent {
-
- /**
- * Possible values for submit mode property.
- */
- public static final String MODE_AJAX = "ajax";
- public static final String MODE_SERVER = "server";
- public static final String MODE_CLIENT = "client";
-
- /**
- * Getter for submit mode property.
- */
- public String getMode();
- public void setMode(String mode);
-}
Modified: branches/RF-7654/ui/output/ui/src/main/java/org/richfaces/component/UIPanelMenu.java
===================================================================
--- branches/RF-7654/ui/output/ui/src/main/java/org/richfaces/component/UIPanelMenu.java 2010-12-17 17:48:19 UTC (rev 20665)
+++ branches/RF-7654/ui/output/ui/src/main/java/org/richfaces/component/UIPanelMenu.java 2010-12-17 17:57:24 UTC (rev 20666)
@@ -29,7 +29,6 @@
* @author akolonitsky
* @since 2010-11-29
*/
-//TODO nick - this class should be generated by CDK
public class UIPanelMenu extends AbstractPanelMenu {
public enum PropertyKeys {
Modified: branches/RF-7654/ui/output/ui/src/main/java/org/richfaces/component/UIPanelMenuGroup.java
===================================================================
--- branches/RF-7654/ui/output/ui/src/main/java/org/richfaces/component/UIPanelMenuGroup.java 2010-12-17 17:48:19 UTC (rev 20665)
+++ branches/RF-7654/ui/output/ui/src/main/java/org/richfaces/component/UIPanelMenuGroup.java 2010-12-17 17:57:24 UTC (rev 20666)
@@ -25,11 +25,12 @@
import org.richfaces.PanelMenuMode;
+import javax.el.MethodExpression;
+
/**
* @author akolonitsky
* @since 2010-10-25
*/
-//TODO nick - this class should be generated by CDK
public class UIPanelMenuGroup extends AbstractPanelMenuGroup {
public enum PropertyKeys {
@@ -48,7 +49,7 @@
@Override
public void setMode(PanelMenuMode mode) {
- super.setMode(mode); //To change body of overridden methods use File | Settings | File Templates.
+ super.setMode(mode);
}
public boolean isExpandSingle() {
@@ -83,11 +84,11 @@
getStateHelper().put(PropertyKeys.bubbleSelection, bubbleSelection);
}
- public String getChangeExpandListener() {
- return (String) getStateHelper().eval(PropertyKeys.changeExpandListener);
+ public MethodExpression getChangeExpandListener() {
+ return (MethodExpression) getStateHelper().get(PropertyKeys.changeExpandListener);
}
- public void setChangeExpandListener(String changeExpandListener) {
+ public void setChangeExpandListener(MethodExpression changeExpandListener) {
getStateHelper().put(PropertyKeys.changeExpandListener, changeExpandListener);
}
Modified: branches/RF-7654/ui/output/ui/src/main/java/org/richfaces/component/UIPanelMenuItem.java
===================================================================
--- branches/RF-7654/ui/output/ui/src/main/java/org/richfaces/component/UIPanelMenuItem.java 2010-12-17 17:48:19 UTC (rev 20665)
+++ branches/RF-7654/ui/output/ui/src/main/java/org/richfaces/component/UIPanelMenuItem.java 2010-12-17 17:57:24 UTC (rev 20666)
@@ -29,7 +29,6 @@
* @author akolonitsky
* @since 2010-11-29
*/
-//TODO nick - this class should be generated by CDK
public class UIPanelMenuItem extends AbstractPanelMenuItem {
public enum PropertyKeys {
Modified: branches/RF-7654/ui/output/ui/src/main/java/org/richfaces/component/html/HtmlPanelMenu.java
===================================================================
--- branches/RF-7654/ui/output/ui/src/main/java/org/richfaces/component/html/HtmlPanelMenu.java 2010-12-17 17:48:19 UTC (rev 20665)
+++ branches/RF-7654/ui/output/ui/src/main/java/org/richfaces/component/html/HtmlPanelMenu.java 2010-12-17 17:57:24 UTC (rev 20666)
@@ -24,14 +24,13 @@
package org.richfaces.component.html;
import org.richfaces.component.UIPanelMenu;
+import org.richfaces.renderkit.html.PanelMenuIcons;
import javax.faces.component.behavior.ClientBehaviorHolder;
import java.util.Arrays;
import java.util.Collection;
import java.util.Collections;
-import static org.richfaces.component.AbstractPanelMenuItem.Icons;
-
/**
* @author akolonitsky
* @since 2010-11-29
@@ -144,7 +143,7 @@
}
public String getItemIconLeft() {
- return (String) getStateHelper().eval(PropertyKeys.itemIconLeft, Icons.DEFAULT.toString());
+ return (String) getStateHelper().eval(PropertyKeys.itemIconLeft, PanelMenuIcons.DEFAULT.toString());
}
public void setItemIconLeft(String itemIconLeft) {
@@ -152,7 +151,7 @@
}
public String getItemIconRight() {
- return (String) getStateHelper().eval(PropertyKeys.itemIconRight, Icons.DEFAULT.toString());
+ return (String) getStateHelper().eval(PropertyKeys.itemIconRight, PanelMenuIcons.DEFAULT.toString());
}
public void setItemIconRight(String itemIconRight) {
@@ -160,7 +159,7 @@
}
public String getItemDisableIconLeft() {
- return (String) getStateHelper().eval(PropertyKeys.itemDisableIconLeft, Icons.DEFAULT.toString());
+ return (String) getStateHelper().eval(PropertyKeys.itemDisableIconLeft, PanelMenuIcons.DEFAULT.toString());
}
public void setItemDisableIconLeft(String itemDisableIconLeft) {
@@ -168,7 +167,7 @@
}
public String getItemDisableIconRight() {
- return (String) getStateHelper().eval(PropertyKeys.itemDisableIconRight, Icons.DEFAULT.toString());
+ return (String) getStateHelper().eval(PropertyKeys.itemDisableIconRight, PanelMenuIcons.DEFAULT.toString());
}
public void setItemDisableIconRight(String itemDisableIconRight) {
@@ -192,7 +191,7 @@
}
public String getTopItemIconLeft() {
- return (String) getStateHelper().eval(PropertyKeys.topItemIconLeft, Icons.DEFAULT.toString());
+ return (String) getStateHelper().eval(PropertyKeys.topItemIconLeft, PanelMenuIcons.DEFAULT.toString());
}
public void setTopItemIconLeft(String topItemIconLeft) {
@@ -200,7 +199,7 @@
}
public String getTopItemIconRight() {
- return (String) getStateHelper().eval(PropertyKeys.topItemIconRight, Icons.DEFAULT.toString());
+ return (String) getStateHelper().eval(PropertyKeys.topItemIconRight, PanelMenuIcons.DEFAULT.toString());
}
public void setTopItemIconRight(String topItemIconRight) {
@@ -208,7 +207,7 @@
}
public String getTopItemDisableIconLeft() {
- return (String) getStateHelper().eval(PropertyKeys.topItemDisableIconLeft, Icons.DEFAULT.toString());
+ return (String) getStateHelper().eval(PropertyKeys.topItemDisableIconLeft, PanelMenuIcons.DEFAULT.toString());
}
public void setTopItemDisableIconLeft(String topItemDisableIconLeft) {
@@ -216,7 +215,7 @@
}
public String getTopItemDisableIconRight() {
- return (String) getStateHelper().eval(PropertyKeys.topItemDisableIconRight, Icons.DEFAULT.toString());
+ return (String) getStateHelper().eval(PropertyKeys.topItemDisableIconRight, PanelMenuIcons.DEFAULT.toString());
}
public void setTopItemDisableIconRight(String topItemDisableIconRight) {
@@ -240,7 +239,7 @@
}
public String getGroupExpandIconLeft() {
- return (String) getStateHelper().eval(PropertyKeys.groupExpandIconLeft, Icons.DEFAULT.toString());
+ return (String) getStateHelper().eval(PropertyKeys.groupExpandIconLeft, PanelMenuIcons.DEFAULT.toString());
}
public void setGroupExpandIconLeft(String groupExpandIconLeft) {
@@ -248,7 +247,7 @@
}
public String getGroupExpandIconRight() {
- return (String) getStateHelper().eval(PropertyKeys.groupExpandIconRight, Icons.DEFAULT.toString());
+ return (String) getStateHelper().eval(PropertyKeys.groupExpandIconRight, PanelMenuIcons.DEFAULT.toString());
}
public void setGroupExpandIconRight(String groupExpandIconRight) {
@@ -256,7 +255,7 @@
}
public String getGroupCollapseIconLeft() {
- return (String) getStateHelper().eval(PropertyKeys.groupCollapseIconLeft, Icons.DEFAULT.toString());
+ return (String) getStateHelper().eval(PropertyKeys.groupCollapseIconLeft, PanelMenuIcons.DEFAULT.toString());
}
public void setGroupCollapseIconLeft(String groupCollapseIconLeft) {
@@ -264,7 +263,7 @@
}
public String getGroupCollapseIconRight() {
- return (String) getStateHelper().eval(PropertyKeys.groupCollapseIconRight, Icons.DEFAULT.toString());
+ return (String) getStateHelper().eval(PropertyKeys.groupCollapseIconRight, PanelMenuIcons.DEFAULT.toString());
}
public void setGroupCollapseIconRight(String groupCollapseIconRight) {
@@ -272,7 +271,7 @@
}
public String getGroupDisableIconLeft() {
- return (String) getStateHelper().eval(PropertyKeys.groupDisableIconLeft, Icons.DEFAULT.toString());
+ return (String) getStateHelper().eval(PropertyKeys.groupDisableIconLeft, PanelMenuIcons.DEFAULT.toString());
}
public void setGroupDisableIconLeft(String groupDisableIconLeft) {
@@ -280,7 +279,7 @@
}
public String getGroupDisableIconRight() {
- return (String) getStateHelper().eval(PropertyKeys.groupDisableIconRight, Icons.DEFAULT.toString());
+ return (String) getStateHelper().eval(PropertyKeys.groupDisableIconRight, PanelMenuIcons.DEFAULT.toString());
}
public void setGroupDisableIconRight(String groupDisableIconRight) {
@@ -304,7 +303,7 @@
}
public String getTopGroupExpandIconLeft() {
- return (String) getStateHelper().eval(PropertyKeys.topGroupExpandIconLeft, Icons.DEFAULT.toString());
+ return (String) getStateHelper().eval(PropertyKeys.topGroupExpandIconLeft, PanelMenuIcons.DEFAULT.toString());
}
public void setTopGroupExpandIconLeft(String topGroupExpandIconLeft) {
@@ -312,7 +311,7 @@
}
public String getTopGroupExpandIconRight() {
- return (String) getStateHelper().eval(PropertyKeys.topGroupExpandIconRight, Icons.DEFAULT.toString());
+ return (String) getStateHelper().eval(PropertyKeys.topGroupExpandIconRight, PanelMenuIcons.DEFAULT.toString());
}
public void setTopGroupExpandIconRight(String topGroupExpandIconRight) {
@@ -320,7 +319,7 @@
}
public String getTopGroupCollapseIconLeft() {
- return (String) getStateHelper().eval(PropertyKeys.topGroupCollapseIconLeft, Icons.DEFAULT.toString());
+ return (String) getStateHelper().eval(PropertyKeys.topGroupCollapseIconLeft, PanelMenuIcons.DEFAULT.toString());
}
public void setTopGroupCollapseIconLeft(String topGroupCollapseIconLeft) {
@@ -328,7 +327,7 @@
}
public String getTopGroupCollapseIconRight() {
- return (String) getStateHelper().eval(PropertyKeys.topGroupCollapseIconRight, Icons.DEFAULT.toString());
+ return (String) getStateHelper().eval(PropertyKeys.topGroupCollapseIconRight, PanelMenuIcons.DEFAULT.toString());
}
public void setTopGroupCollapseIconRight(String topGroupCollapseIconRight) {
@@ -336,7 +335,7 @@
}
public String getTopGroupDisableIconLeft() {
- return (String) getStateHelper().eval(PropertyKeys.topGroupDisableIconLeft, Icons.DEFAULT.toString());
+ return (String) getStateHelper().eval(PropertyKeys.topGroupDisableIconLeft, PanelMenuIcons.DEFAULT.toString());
}
public void setTopGroupDisableIconLeft(String topGroupDisableIconLeft) {
@@ -344,7 +343,7 @@
}
public String getTopGroupDisableIconRight() {
- return (String) getStateHelper().eval(PropertyKeys.topGroupDisableIconRight, Icons.DEFAULT.toString());
+ return (String) getStateHelper().eval(PropertyKeys.topGroupDisableIconRight, PanelMenuIcons.DEFAULT.toString());
}
public void setTopGroupDisableIconRight(String topGroupDisableIconRight) {
Modified: branches/RF-7654/ui/output/ui/src/main/java/org/richfaces/renderkit/html/AccordionItemRenderer.java
===================================================================
--- branches/RF-7654/ui/output/ui/src/main/java/org/richfaces/renderkit/html/AccordionItemRenderer.java 2010-12-17 17:48:19 UTC (rev 20665)
+++ branches/RF-7654/ui/output/ui/src/main/java/org/richfaces/renderkit/html/AccordionItemRenderer.java 2010-12-17 17:57:24 UTC (rev 20666)
@@ -22,6 +22,7 @@
package org.richfaces.renderkit.html;
+import static org.richfaces.renderkit.HtmlConstants.*;
import static org.richfaces.renderkit.RenderKitUtils.renderPassThroughAttributes;
import java.io.IOException;
@@ -110,25 +111,25 @@
}
private void encodeContentBegin(UIComponent component, ResponseWriter writer) throws IOException {
- writer.startElement("div", component);
- writer.writeAttribute("class", concatClasses("rf-ac-itm-cnt", attributeAsString(component, "contentClass")), null);
+ writer.startElement(DIV_ELEM, component);
+ writer.writeAttribute(CLASS_ATTRIBUTE, concatClasses("rf-ac-itm-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);
+ writer.writeAttribute(STYLE_ATTRIBUTE, "display: none", null);
}
}
private void encodeContentEnd(UIComponent component, ResponseWriter responseWriter) throws IOException {
- responseWriter.endElement("div");
+ responseWriter.endElement(DIV_ELEM);
}
private void encodeHeader(FacesContext context, UIComponent component, ResponseWriter writer) throws IOException {
- writer.startElement("div", component);
- writer.writeAttribute("class", concatClasses("rf-ac-itm-hdr", attributeAsString(component, PropertyKeys.headerClass)), null);
- writer.writeAttribute("id", component.getClientId() + ":header", null);
+ writer.startElement(DIV_ELEM, component);
+ writer.writeAttribute(CLASS_ATTRIBUTE, concatClasses("rf-ac-itm-hdr", attributeAsString(component, PropertyKeys.headerClass)), null);
+ writer.writeAttribute(ID_ATTRIBUTE, component.getClientId() + ":header", null);
renderPassThroughAttributes(context, component, HEADER_ATTRIBUTES);
AbstractTogglePanelTitledItem titledItem = (AbstractTogglePanelTitledItem) component;
@@ -138,20 +139,20 @@
encodeHeader(context, titledItem, writer, HeaderStates.active, isActive && !isDisabled);
encodeHeader(context, titledItem, writer, HeaderStates.disabled, isDisabled);
- writer.endElement("div");
+ writer.endElement(DIV_ELEM);
}
private void encodeHeader(FacesContext facesContext, AbstractTogglePanelTitledItem component, ResponseWriter writer,
HeaderStates state, Boolean isDisplay) throws IOException {
- writer.startElement("div", component);
+ writer.startElement(DIV_ELEM, component);
if (!isDisplay) {
- writer.writeAttribute("style", "display : none", null);
+ writer.writeAttribute(STYLE_ATTRIBUTE, "display : none", null);
}
String name = "headerClass" + capitalize(state.toString());
- writer.writeAttribute("class", concatClasses("rf-ac-itm-hdr-" + state.abbreviation(), attributeAsString(component, name)), null);
+ writer.writeAttribute(CLASS_ATTRIBUTE, concatClasses("rf-ac-itm-hdr-" + state.abbreviation(), attributeAsString(component, name)), null);
UIComponent headerFacet = component.getHeaderFacet(state);
if (headerFacet != null && headerFacet.isRendered()) {
@@ -163,7 +164,7 @@
}
}
- writer.endElement("div");
+ writer.endElement(DIV_ELEM);
}
@Override
Modified: branches/RF-7654/ui/output/ui/src/main/java/org/richfaces/renderkit/html/CollapsiblePanelRenderer.java
===================================================================
--- branches/RF-7654/ui/output/ui/src/main/java/org/richfaces/renderkit/html/CollapsiblePanelRenderer.java 2010-12-17 17:48:19 UTC (rev 20665)
+++ branches/RF-7654/ui/output/ui/src/main/java/org/richfaces/renderkit/html/CollapsiblePanelRenderer.java 2010-12-17 17:57:24 UTC (rev 20666)
@@ -22,6 +22,8 @@
package org.richfaces.renderkit.html;
+import static org.richfaces.renderkit.HtmlConstants.*;
+
import org.ajax4jsf.javascript.JSObject;
import org.richfaces.component.AbstractCollapsiblePanel;
import org.richfaces.component.AbstractTogglePanel;
@@ -116,21 +118,21 @@
}
private void encodeHeader(FacesContext context, UIComponent component, ResponseWriter writer) throws IOException {
- writer.startElement("div", component);
- writer.writeAttribute("id", component.getClientId(context) + ":header", null);
- writer.writeAttribute("class", concatClasses("rf-cp-hdr", attributeAsString(component, "headerClass")), null);
+ writer.startElement(DIV_ELEM, component);
+ writer.writeAttribute(ID_ATTRIBUTE, component.getClientId(context) + ":header", null);
+ writer.writeAttribute(CLASS_ATTRIBUTE, concatClasses("rf-cp-hdr", attributeAsString(component, "headerClass")), null);
AbstractCollapsiblePanel panel = (AbstractCollapsiblePanel) component;
encodeHeader(context, component, writer, expanded, panel.isExpanded());
encodeHeader(context, component, writer, collapsed, !panel.isExpanded());
- writer.endElement("div");
+ writer.endElement(DIV_ELEM);
}
private void encodeHeader(FacesContext context, UIComponent component, ResponseWriter responseWriter, AbstractCollapsiblePanel.States state, boolean isVisible) throws IOException {
- responseWriter.startElement("div", component);
- responseWriter.writeAttribute("class", "rf-cp-hdr-" + state.abbreviation(), null);
- responseWriter.writeAttribute("style", concatStyles(styleElement("display", isVisible ? "" : "none"), attributeAsString(component, "headerClass")), null);
+ responseWriter.startElement(DIV_ELEM, component);
+ responseWriter.writeAttribute(CLASS_ATTRIBUTE, "rf-cp-hdr-" + state.abbreviation(), null);
+ responseWriter.writeAttribute(STYLE_ATTRIBUTE, concatStyles(styleElement("display", isVisible ? "" : "none"), attributeAsString(component, "headerClass")), null);
UIComponent header = AbstractTogglePanelTitledItem.getHeaderFacet(component, state);
if (header != null && header.isRendered()) {
@@ -142,7 +144,7 @@
}
}
- responseWriter.endElement("div");
+ responseWriter.endElement(DIV_ELEM);
}
@Override
@@ -206,23 +208,23 @@
}
private void encodeContent(ResponseWriter writer, FacesContext context, UIComponent component, boolean visible) throws IOException {
- writer.startElement("div", component);
- writer.writeAttribute("id", component.getClientId() + ":content", null);
- writer.writeAttribute("class", concatClasses("rf-cp-b", attributeAsString(component, "bodyClass")), null);
- writer.writeAttribute("style", concatStyles(styleElement("display", visible ? "block" : "none"),
+ writer.startElement(DIV_ELEM, component);
+ writer.writeAttribute(ID_ATTRIBUTE, component.getClientId() + ":content", null);
+ writer.writeAttribute(CLASS_ATTRIBUTE, concatClasses("rf-cp-b", attributeAsString(component, "bodyClass")), null);
+ writer.writeAttribute(STYLE_ATTRIBUTE, concatStyles(styleElement("display", visible ? "block" : "none"),
attributeAsString(component, "style")), null);
renderChildren(context, component);
- writer.endElement("div");
+ writer.endElement(DIV_ELEM);
}
private void encodeEmptyDiv(ResponseWriter writer, FacesContext context, UIComponent component, boolean visible) throws IOException {
- writer.startElement("div", component);
- writer.writeAttribute("id", component.getClientId() + ":empty", null);
- writer.writeAttribute("class", "rf-cp-empty", null);
- writer.writeAttribute("style", styleElement("display", visible ? "block" : "none"), null);
- writer.endElement("div");
+ writer.startElement(DIV_ELEM, component);
+ writer.writeAttribute(ID_ATTRIBUTE, component.getClientId() + ":empty", null);
+ writer.writeAttribute(CLASS_ATTRIBUTE, "rf-cp-empty", null);
+ writer.writeAttribute(STYLE_ATTRIBUTE, styleElement("display", visible ? "block" : "none"), null);
+ writer.endElement(DIV_ELEM);
}
@Override
Modified: branches/RF-7654/ui/output/ui/src/main/java/org/richfaces/renderkit/html/DivPanelRenderer.java
===================================================================
--- branches/RF-7654/ui/output/ui/src/main/java/org/richfaces/renderkit/html/DivPanelRenderer.java 2010-12-17 17:48:19 UTC (rev 20665)
+++ branches/RF-7654/ui/output/ui/src/main/java/org/richfaces/renderkit/html/DivPanelRenderer.java 2010-12-17 17:57:24 UTC (rev 20666)
@@ -22,6 +22,8 @@
package org.richfaces.renderkit.html;
+import static org.richfaces.renderkit.HtmlConstants.*;
+
import org.richfaces.component.AbstractDivPanel;
import org.richfaces.renderkit.HtmlConstants;
import org.richfaces.renderkit.RenderKitUtils;
@@ -95,8 +97,8 @@
super.doEncodeBegin(writer, context, component);
writer.startElement(HtmlConstants.DIV_ELEM, component);
- writer.writeAttribute("id", component.getClientId(context), "clientId");
- writer.writeAttribute("class", getStyleClass(component), null);
+ writer.writeAttribute(ID_ATTRIBUTE, component.getClientId(context), "clientId");
+ writer.writeAttribute(CLASS_ATTRIBUTE, getStyleClass(component), null);
String style = getStyle(component);
if (style != null && style.length() > 0) {
writer.writeAttribute(HtmlConstants.STYLE_ATTRIBUTE, style, null);
Modified: branches/RF-7654/ui/output/ui/src/main/java/org/richfaces/renderkit/html/DropDownMenuRendererBase.java
===================================================================
--- branches/RF-7654/ui/output/ui/src/main/java/org/richfaces/renderkit/html/DropDownMenuRendererBase.java 2010-12-17 17:48:19 UTC (rev 20665)
+++ branches/RF-7654/ui/output/ui/src/main/java/org/richfaces/renderkit/html/DropDownMenuRendererBase.java 2010-12-17 17:57:24 UTC (rev 20666)
@@ -64,9 +64,9 @@
if (ddmenu != null) {
if (ddmenu.isDisabled()) {
- facet = ddmenu.getFacet(AbstractDropDownMenu.Facets.LABEL_DISABLED.toString());
+ facet = ddmenu.getFacet(AbstractDropDownMenu.Facets.labelDisabled.toString());
} else {
- facet = ddmenu.getFacet(AbstractDropDownMenu.Facets.LABEL.toString());
+ facet = ddmenu.getFacet(AbstractDropDownMenu.Facets.label.toString());
}
}
return facet;
Modified: branches/RF-7654/ui/output/ui/src/main/java/org/richfaces/renderkit/html/MenuGroupRendererBase.java
===================================================================
--- branches/RF-7654/ui/output/ui/src/main/java/org/richfaces/renderkit/html/MenuGroupRendererBase.java 2010-12-17 17:48:19 UTC (rev 20665)
+++ branches/RF-7654/ui/output/ui/src/main/java/org/richfaces/renderkit/html/MenuGroupRendererBase.java 2010-12-17 17:57:24 UTC (rev 20666)
@@ -39,9 +39,9 @@
if (menuGroup != null) {
if (menuGroup.isDisabled()) {
- facet = menuGroup.getFacet(AbstractMenuGroup.Facets.ICON_DISABLED.toString());
+ facet = menuGroup.getFacet(AbstractMenuGroup.Facets.iconDisabled.toString());
} else {
- facet = menuGroup.getFacet(AbstractMenuGroup.Facets.ICON.toString());
+ facet = menuGroup.getFacet(AbstractMenuGroup.Facets.icon.toString());
}
}
return facet;
Modified: branches/RF-7654/ui/output/ui/src/main/java/org/richfaces/renderkit/html/MenuItemRendererBase.java
===================================================================
--- branches/RF-7654/ui/output/ui/src/main/java/org/richfaces/renderkit/html/MenuItemRendererBase.java 2010-12-17 17:48:19 UTC (rev 20665)
+++ branches/RF-7654/ui/output/ui/src/main/java/org/richfaces/renderkit/html/MenuItemRendererBase.java 2010-12-17 17:57:24 UTC (rev 20666)
@@ -11,7 +11,7 @@
import org.richfaces.component.AbstractDropDownMenu;
import org.richfaces.component.AbstractMenuGroup;
import org.richfaces.component.AbstractMenuItem;
-import org.richfaces.component.MenuComponent;
+import org.richfaces.component.Mode;
import org.richfaces.renderkit.AjaxCommandRendererBase;
public class MenuItemRendererBase extends AjaxCommandRendererBase {
@@ -31,9 +31,9 @@
if (menuItem != null) {
if (menuItem.isDisabled()) {
- facet = menuItem.getFacet(AbstractMenuItem.Facets.ICON_DISABLED.toString());
+ facet = menuItem.getFacet(AbstractMenuItem.Facets.iconDisabled.toString());
} else {
- facet = menuItem.getFacet(AbstractMenuItem.Facets.ICON.toString());
+ facet = menuItem.getFacet(AbstractMenuItem.Facets.icon.toString());
}
}
return facet;
@@ -58,8 +58,8 @@
AbstractMenuItem menuItem = (AbstractMenuItem) component;
if (menuItem != null) {
- String mode = resolveSubmitMode(menuItem);
- if (!MenuComponent.MODE_CLIENT.equalsIgnoreCase(mode)) {
+ Mode mode = resolveSubmitMode(menuItem);
+ if (!Mode.client.equals(mode)) {
super.doDecode(context, component);
}
}
@@ -96,39 +96,35 @@
protected String getOnClickFunction(FacesContext facesContext, UIComponent component) {
AbstractMenuItem menuItem = (AbstractMenuItem) component;
- String subminMode = resolveSubmitMode(menuItem);
+ Mode subminMode = resolveSubmitMode(menuItem);
if (menuItem.isDisabled()) {
return "";
- } else if (subminMode == null || MenuComponent.MODE_SERVER.equalsIgnoreCase(subminMode)) {
+ } else if (subminMode == null || Mode.server.equals(subminMode)) {
return getServerSubmitFunction(menuItem);
- } else if (MenuComponent.MODE_AJAX.equalsIgnoreCase(subminMode)) {
+ } else if (Mode.ajax.equals(subminMode)) {
return getOnClick(facesContext, menuItem);
- } else if (MenuComponent.MODE_CLIENT.equalsIgnoreCase(subminMode)) {
+ } else if (Mode.client.equals(subminMode)) {
return "";
}
return "";
}
- protected String resolveSubmitMode(AbstractMenuItem menuItem) {
+ protected Mode resolveSubmitMode(AbstractMenuItem menuItem) {
String submitMode = menuItem.getMode();
if (null != submitMode) {
- return submitMode;
+ return Mode.valueOf(submitMode);
}
- UIComponent parent = menuItem.getParent();
- while (null != parent) {
- if (parent instanceof MenuComponent) {
- return ((MenuComponent) parent).getMode();
- }
- parent = parent.getParent();
+ AbstractDropDownMenu parent = getDDMenu(menuItem);
+ if (parent != null) {
+ return Mode.valueOf(parent.getMode());
}
-
- return MenuComponent.MODE_SERVER;
+ return Mode.server;
}
protected String getStyleClass(FacesContext facesContext, UIComponent component, String ddMenuStyle, String menuGroupStyle, String menuItemStyle) {
- UIComponent ddMenu = getDDMenu(facesContext, component);
- UIComponent menuGroup = getMenuGroup(facesContext, component);
+ UIComponent ddMenu = getDDMenu(component);
+ UIComponent menuGroup = getMenuGroup(component);
Object styleClass = null;
if (ddMenu != null && ddMenuStyle != null && ddMenuStyle.length() > 0) {
styleClass = ddMenu.getAttributes().get(ddMenuStyle);
@@ -140,38 +136,35 @@
return concatClasses(styleClass, component.getAttributes().get(menuItemStyle));
}
+ private UIComponent getParent(UIComponent component, Class<?> parentClass) {
+ if (component != null && parentClass != null) {
+ UIComponent parent = component.getParent();
+ while (parent != null) {
+ if (parentClass.isInstance(parent)) {
+ return parent;
+ }
+ parent = parent.getParent();
+ }
+ }
+ return null;
+ }
+
/**
* Returns a parent <code>AbstractDropDownMenu</code> object of the given component.
- * @param facesContext
* @param component
- * @return <code>UIComponent</code>
+ * @return <code>AbstractDropDownMenu</code>
*/
- protected UIComponent getDDMenu(FacesContext facesContext, UIComponent component) {
- UIComponent parent = component.getParent();
- while (parent != null) {
- if (parent instanceof AbstractDropDownMenu) {
- return parent;
- }
- parent = parent.getParent();
- }
- return null;
+ protected AbstractDropDownMenu getDDMenu(UIComponent component) {
+ return (AbstractDropDownMenu) getParent(component, AbstractDropDownMenu.class);
}
/**
* Returns a parent <code>AbstractMenuGroup</code> object of the given component.
- * @param facesContext
* @param component
- * @return <code>UIComponent</code>
+ * @return <code>AbstractMenuGroup</code>
*/
- protected UIComponent getMenuGroup(FacesContext facesContext, UIComponent component) {
- UIComponent parent = component.getParent();
- while (parent != null) {
- if (parent instanceof AbstractMenuGroup) {
- return parent;
- }
- parent = parent.getParent();
- }
- return null;
+ protected AbstractMenuGroup getMenuGroup(UIComponent component) {
+ return (AbstractMenuGroup) getParent(component, AbstractMenuGroup.class);
}
/**
Modified: branches/RF-7654/ui/output/ui/src/main/java/org/richfaces/renderkit/html/PanelMenuGroupRenderer.java
===================================================================
--- branches/RF-7654/ui/output/ui/src/main/java/org/richfaces/renderkit/html/PanelMenuGroupRenderer.java 2010-12-17 17:48:19 UTC (rev 20665)
+++ branches/RF-7654/ui/output/ui/src/main/java/org/richfaces/renderkit/html/PanelMenuGroupRenderer.java 2010-12-17 17:57:24 UTC (rev 20666)
@@ -23,25 +23,23 @@
package org.richfaces.renderkit.html;
-import static org.richfaces.renderkit.html.TogglePanelRenderer.addEventOption;
-import static org.richfaces.renderkit.html.TogglePanelRenderer.getAjaxOptions;
+import org.ajax4jsf.javascript.JSObject;
+import org.richfaces.component.AbstractPanelMenuGroup;
+import org.richfaces.component.AbstractPanelMenuItem;
+import org.richfaces.component.html.HtmlPanelMenuGroup;
+import org.richfaces.renderkit.RenderKitUtils;
+import javax.faces.component.UIComponent;
+import javax.faces.context.FacesContext;
+import javax.faces.context.ResponseWriter;
import java.io.IOException;
import java.util.HashMap;
import java.util.Map;
-import javax.faces.component.UIComponent;
-import javax.faces.context.FacesContext;
-import javax.faces.context.ResponseWriter;
+import static org.richfaces.renderkit.HtmlConstants.*;
+import static org.richfaces.renderkit.html.TogglePanelRenderer.addEventOption;
+import static org.richfaces.renderkit.html.TogglePanelRenderer.getAjaxOptions;
-import org.ajax4jsf.context.AjaxContext;
-import org.ajax4jsf.javascript.JSObject;
-import org.richfaces.component.AbstractPanelMenuGroup;
-import org.richfaces.component.AbstractPanelMenuItem;
-import org.richfaces.component.html.HtmlPanelMenuGroup;
-import org.richfaces.renderkit.HtmlConstants;
-import org.richfaces.renderkit.RenderKitUtils;
-
/**
* @author akolonitsky
* @since 2010-10-25
@@ -55,6 +53,7 @@
public static final String BEFORE_EXPAND = "beforeexpand";
public static final String BEFORE_SWITCH = "beforeswitch";
private static final String CSS_CLASS_PREFIX = "rf-pm-gr";
+
//TODO nick - shouldn't this be rf-pm-gr-top?
private static final String TOP_CSS_CLASS_PREFIX = "rf-pm-top-gr";
@@ -66,79 +65,77 @@
context.getExternalContext().getRequestParameterMap();
// Don't overwrite the value unless you have to!
- //TODO nick - ":expanded" suffix is not necessary
+ //TODO! nick - ":expanded" suffix is not necessary
String newValue = requestMap.get(component.getClientId() + ":expanded");
if (newValue != null) {
menuGroup.setSubmittedExpanded(newValue);
}
- String compClientId = component.getClientId(context);
- //TODO nick - rename clientId to smth.
- String clientId = requestMap.get(compClientId);
- if (clientId != null && clientId.equals(compClientId)) {
+ String clientId = component.getClientId(context);
+ if (requestMap.get(clientId) != null) {
context.getPartialViewContext().getRenderIds().add(clientId);
//TODO nick - this should be done on encode, not on decode
- addOnCompleteParam(clientId);
+ PanelMenuRenderer.addOnCompleteParam(clientId);
}
}
- //TODO nick - copy of org.richfaces.renderkit.html.PanelMenuRenderer.addOnCompleteParam(String)
- protected static void addOnCompleteParam(String itemId) {
- AjaxContext.getCurrentInstance().appendOncomplete(new StringBuilder()
- .append("RichFaces.$('").append(itemId).append("').onCompleteHandler();").toString());
- }
-
-
-
@Override
protected void doEncodeBegin(ResponseWriter writer, FacesContext context, UIComponent component) throws IOException {
super.doEncodeBegin(writer, context, component);
HtmlPanelMenuGroup menuGroup = (HtmlPanelMenuGroup) component;
- writer.startElement(HtmlConstants.INPUT_ELEM, component);
+ writer.startElement(INPUT_ELEM, component);
//TODO nick - there is no need to encode this input - group state can be extracted from class
final String expanded = component.getClientId(context) + ":expanded";
- writer.writeAttribute(HtmlConstants.ID_ATTRIBUTE, expanded, null);
- writer.writeAttribute(HtmlConstants.NAME_ATTRIBUTE, expanded, null);
- writer.writeAttribute(HtmlConstants.TYPE_ATTR, HtmlConstants.INPUT_TYPE_HIDDEN, null);
- writer.writeAttribute(HtmlConstants.VALUE_ATTRIBUTE, String.valueOf(menuGroup.isExpanded()), null);
- writer.endElement(HtmlConstants.INPUT_ELEM);
+ writer.writeAttribute(ID_ATTRIBUTE, expanded, null);
+ writer.writeAttribute(NAME_ATTRIBUTE, expanded, null);
+ writer.writeAttribute(TYPE_ATTR, INPUT_TYPE_HIDDEN, null);
+ writer.writeAttribute(VALUE_ATTRIBUTE, String.valueOf(menuGroup.isExpanded()), null);
+ writer.endElement(INPUT_ELEM);
encodeHeader(writer, context, menuGroup);
encodeContentBegin(writer, context, menuGroup);
}
private void encodeHeader(ResponseWriter writer, FacesContext context, HtmlPanelMenuGroup menuGroup) throws IOException {
- //TODO nick - HtmlConstants.* should be used
- writer.startElement("div", null);
- writer.writeAttribute("id", menuGroup.getClientId(context) + ":hdr", null);
- writer.writeAttribute("class", getCssClass(menuGroup, "-hdr"), null);
+ writer.startElement(DIV_ELEM, null);
+ writer.writeAttribute(ID_ATTRIBUTE, menuGroup.getClientId(context) + ":hdr", null);
+ writer.writeAttribute(CLASS_ATTRIBUTE, getCssClass(menuGroup, "-hdr"), null);
encodeHeaderGroup(writer, context, menuGroup, getCssClass(menuGroup, ""));
- writer.endElement("div");
+ writer.endElement(DIV_ELEM);
}
private void encodeHeaderGroup(ResponseWriter writer, FacesContext context, HtmlPanelMenuGroup menuItem, String classPrefix) throws IOException {
- writer.startElement("table", null);
- writer.writeAttribute("class", classPrefix + "-gr", null);
- //TODO nick - TBODY is missing
- writer.startElement("tr", null);
+ writer.startElement(TABLE_ELEMENT, null);
+ writer.writeAttribute(CLASS_ATTRIBUTE, classPrefix + "-gr", null);
+ writer.startElement(TBODY_ELEMENT, null);
+ writer.startElement(TR_ELEMENT, null);
encodeHeaderGroupIconLeft(writer, context, menuItem, classPrefix);
- writer.startElement("td", null);
- writer.writeAttribute("class", classPrefix + "-lbl", null);
- //TODO nick - this will render 'null' if label is null
- //TODO nick - should there be 'label' facet also?
- writer.writeText(String.valueOf(menuItem.getLabel()), null);
- writer.endElement("td");
+ writer.startElement(TD_ELEM, null);
+ writer.writeAttribute(CLASS_ATTRIBUTE, classPrefix + "-lbl", null);
+ UIComponent headerFacet = menuItem.getFacet("label");
+ if (headerFacet != null && headerFacet.isRendered()) {
+ headerFacet.encodeAll(context);
+ } else {
+ Object label = menuItem.getLabel();
+ if (label != null && !label.equals("")) {
+ writer.writeText(label, null);
+ }
+ }
+
+ writer.endElement(TD_ELEM);
+
encodeHeaderGroupIconRight(writer, context, menuItem, classPrefix);
- writer.endElement("tr");
- writer.endElement("table");
+ writer.endElement(TR_ELEMENT);
+ writer.endElement(TBODY_ELEMENT);
+ writer.endElement(TABLE_ELEMENT);
}
private void encodeHeaderGroupIconLeft(ResponseWriter writer, FacesContext context, HtmlPanelMenuGroup menuGroup, String classPrefix) throws IOException {
@@ -157,58 +154,69 @@
}
private void encodeTdIcon(ResponseWriter writer, FacesContext context, String cssClass, boolean isExpanded, String attrIconCollapsedValue, String attrIconExpandedValue) throws IOException {
- writer.startElement("td", null);
- writer.writeAttribute("class", cssClass, null);
- try {
- //TODO nick - attrIconCollapsedValue == null?
- AbstractPanelMenuItem.Icons iconCollapsed = AbstractPanelMenuItem.Icons.valueOf(attrIconCollapsedValue);
- writer.startElement("div", null);
- writer.writeAttribute("class", concatClasses("rf-pm-ico-colps", iconCollapsed.cssClass()), null);
- writer.writeAttribute("style", styleElement("display", isExpanded ? "none" : "block"), null);
- writer.endElement("div");
- //TODO nick - I suggest to wrap only Enum.valueOf(...) into try/catch
- } catch (IllegalArgumentException e) {
- if(attrIconCollapsedValue != null && attrIconCollapsedValue.trim().length() != 0) {
- writer.startElement(HtmlConstants.IMG_ELEMENT, null);
- writer.writeAttribute(HtmlConstants.ALT_ATTRIBUTE, "", null);
- writer.writeURIAttribute(HtmlConstants.SRC_ATTRIBUTE, RenderKitUtils.getResourceURL(attrIconCollapsedValue, context), null);
- writer.endElement(HtmlConstants.IMG_ELEMENT);
+ writer.startElement(TD_ELEM, null);
+ writer.writeAttribute(CLASS_ATTRIBUTE, cssClass, null);
+
+ encodeIdIcon(writer, context, isExpanded, attrIconCollapsedValue, "rf-pm-ico-colps");
+ encodeIdIcon(writer, context, !isExpanded, attrIconExpandedValue, "rf-pm-ico-exp");
+
+ writer.endElement(TD_ELEM);
+ }
+
+ private void encodeIdIcon(ResponseWriter writer, FacesContext context, boolean isExpanded, String attrIconValue, String styleClass) throws IOException {
+ if (attrIconValue == null || attrIconValue.trim().length() <= 0) {
+ encodeDivIcon(writer, isExpanded, PanelMenuIcons.none, styleClass);
+ } else {
+ PanelMenuIcons icon = getIcon(attrIconValue);
+ if (icon != null) {
+ encodeDivIcon(writer, isExpanded, icon, styleClass);
+ } else {
+ encodeImage(writer, context, attrIconValue);
}
}
+ }
+ private PanelMenuIcons getIcon(String attrIconCollapsedValue) {
+ if (attrIconCollapsedValue == null) {
+ return null;
+ }
+
try {
- AbstractPanelMenuItem.Icons iconExpanded = AbstractPanelMenuItem.Icons.valueOf(attrIconExpandedValue);
- writer.startElement("div", null);
- writer.writeAttribute("class", concatClasses("rf-pm-ico-exp", iconExpanded.cssClass()), null);
- writer.writeAttribute("style", styleElement("display", isExpanded ? "block" : "none"), null);
- writer.endElement("div");
+ return PanelMenuIcons.valueOf(attrIconCollapsedValue);
} catch (IllegalArgumentException e) {
- if(attrIconExpandedValue != null && attrIconExpandedValue.trim().length() != 0) {
- writer.startElement(HtmlConstants.IMG_ELEMENT, null);
- writer.writeAttribute(HtmlConstants.ALT_ATTRIBUTE, "", null);
- writer.writeURIAttribute(HtmlConstants.SRC_ATTRIBUTE, RenderKitUtils.getResourceURL(attrIconExpandedValue, context), null);
- writer.endElement(HtmlConstants.IMG_ELEMENT);
- }
+ return null;
}
+ }
- writer.endElement("td");
+ private void encodeDivIcon(ResponseWriter writer, boolean isDisplay, PanelMenuIcons icon, String styleClass) throws IOException {
+ writer.startElement(DIV_ELEM, null);
+ writer.writeAttribute(CLASS_ATTRIBUTE, concatClasses(styleClass, icon.cssClass()), null);
+ writer.writeAttribute(STYLE_ATTRIBUTE, styleElement("display", isDisplay ? "none" : "block"), null);
+ writer.endElement(DIV_ELEM);
}
+ private void encodeImage(ResponseWriter writer, FacesContext context, String attrIconValue) throws IOException {
+ writer.startElement(IMG_ELEMENT, null);
+ writer.writeAttribute(ALT_ATTRIBUTE, "", null);
+ writer.writeURIAttribute(SRC_ATTRIBUTE, RenderKitUtils.getResourceURL(attrIconValue, context), null);
+ writer.endElement(IMG_ELEMENT);
+ }
+
public String getCssClass(AbstractPanelMenuItem item, String postfix) {
return (item.isTopItem() ? TOP_CSS_CLASS_PREFIX : CSS_CLASS_PREFIX) + postfix;
}
private void encodeContentBegin(ResponseWriter writer, FacesContext context, HtmlPanelMenuGroup menuGroup) throws IOException {
- writer.startElement("div", null);
- writer.writeAttribute("id", menuGroup.getClientId(context) + ":cnt", null);
- writer.writeAttribute("class", concatClasses(getCssClass(menuGroup, "-cnt"), menuGroup.isExpanded() ? "rf-pm-exp" : "rf-pm-colps"), null);
+ writer.startElement(DIV_ELEM, null);
+ writer.writeAttribute(ID_ATTRIBUTE, menuGroup.getClientId(context) + ":cnt", null);
+ writer.writeAttribute(CLASS_ATTRIBUTE, concatClasses(getCssClass(menuGroup, "-cnt"), menuGroup.isExpanded() ? "rf-pm-exp" : "rf-pm-colps"), null);
writeJavaScript(writer, context, menuGroup);
}
private void encodeContentEnd(ResponseWriter writer, FacesContext context, UIComponent component) throws IOException {
- writer.endElement("div");
+ writer.endElement(DIV_ELEM);
}
@Override
@@ -257,8 +265,7 @@
protected void doEncodeEnd(ResponseWriter writer, FacesContext context, UIComponent component) throws IOException {
encodeContentEnd(writer, context, component);
- writer.endElement(HtmlConstants.DIV_ELEM);
- //TODO nick - call super.doEncodeEnd(...)?
+ writer.endElement(DIV_ELEM);
}
@Override
Copied: branches/RF-7654/ui/output/ui/src/main/java/org/richfaces/renderkit/html/PanelMenuIcons.java (from rev 20663, trunk/ui/output/ui/src/main/java/org/richfaces/renderkit/html/PanelMenuIcons.java)
===================================================================
--- branches/RF-7654/ui/output/ui/src/main/java/org/richfaces/renderkit/html/PanelMenuIcons.java (rev 0)
+++ branches/RF-7654/ui/output/ui/src/main/java/org/richfaces/renderkit/html/PanelMenuIcons.java 2010-12-17 17:57:24 UTC (rev 20666)
@@ -0,0 +1,25 @@
+package org.richfaces.renderkit.html;
+
+public enum PanelMenuIcons {
+ none("rf-pm-none"),
+ disc("rf-pm-disc"),
+ grid("rf-pm-grid"),
+ chevron("rf-pm-chevron"),
+ chevronUp("rf-pm-chevron-up"),
+ chevronDown("rf-pm-chevron-down"),
+ triangle("rf-pm-triangle"),
+ triangleUp("rf-pm-triangle-up"),
+ triangleDown("rf-pm-triangle-down");
+
+ public static final PanelMenuIcons DEFAULT = none;
+
+ private final String cssClass;
+
+ private PanelMenuIcons(String cssClass) {
+ this.cssClass = cssClass;
+ }
+
+ public String cssClass() {
+ return cssClass;
+ }
+}
Modified: branches/RF-7654/ui/output/ui/src/main/java/org/richfaces/renderkit/html/PanelMenuItemRenderer.java
===================================================================
--- branches/RF-7654/ui/output/ui/src/main/java/org/richfaces/renderkit/html/PanelMenuItemRenderer.java 2010-12-17 17:48:19 UTC (rev 20665)
+++ branches/RF-7654/ui/output/ui/src/main/java/org/richfaces/renderkit/html/PanelMenuItemRenderer.java 2010-12-17 17:57:24 UTC (rev 20666)
@@ -23,6 +23,7 @@
package org.richfaces.renderkit.html;
+import static org.richfaces.renderkit.HtmlConstants.*;
import static org.richfaces.renderkit.html.TogglePanelRenderer.addEventOption;
import static org.richfaces.renderkit.html.TogglePanelRenderer.getAjaxOptions;
@@ -63,14 +64,14 @@
private void encodeHeaderGroupBegin(ResponseWriter writer, FacesContext context, HtmlPanelMenuItem menuItem, String classPrefix) throws IOException {
writer.startElement("table", null);
- writer.writeAttribute("class", classPrefix + "-gr", null);
- //TODO nick - TBODY element is missing
- writer.startElement("tr", null);
+ writer.writeAttribute(CLASS_ATTRIBUTE, classPrefix + "-gr", null);
+ writer.startElement(TBODY_ELEMENT, null);
+ writer.startElement(TR_ELEMENT, null);
encodeHeaderGroupLeftIcon(writer, context, menuItem, classPrefix);
- writer.startElement("td", null);
- writer.writeAttribute("class", classPrefix + "-lbl", null);
+ writer.startElement(TD_ELEM, null);
+ writer.writeAttribute(CLASS_ATTRIBUTE, classPrefix + "-lbl", null);
String label = menuItem.getLabel();
if (label != null) {
@@ -79,11 +80,12 @@
}
private void encodeHeaderGroupEnd(ResponseWriter writer, FacesContext context, HtmlPanelMenuItem menuItem, String classPrefix) throws IOException {
- writer.endElement("td");
+ writer.endElement(TD_ELEM);
encodeHeaderGroupRightIcon(writer, context, menuItem, classPrefix);
- writer.endElement("tr");
+ writer.endElement(TR_ELEMENT);
+ writer.endElement(TBODY_ELEMENT);
writer.endElement("table");
}
@@ -103,12 +105,12 @@
//TODO nick - the same as in PanelMenuGroupRenderer
public void encodeTdIcon(ResponseWriter writer, FacesContext context, String classPrefix, String attrIconValue) throws IOException {
- writer.startElement("td", null);
+ writer.startElement(TD_ELEM, null);
try {
- AbstractPanelMenuItem.Icons icon = AbstractPanelMenuItem.Icons.valueOf(attrIconValue);
- writer.writeAttribute("class", concatClasses(classPrefix, icon.cssClass()), null);
+ PanelMenuIcons icon = PanelMenuIcons.valueOf(attrIconValue);
+ writer.writeAttribute(CLASS_ATTRIBUTE, concatClasses(classPrefix, icon.cssClass()), null);
} catch (IllegalArgumentException e) {
- writer.writeAttribute("class", classPrefix, null);
+ writer.writeAttribute(CLASS_ATTRIBUTE, classPrefix, null);
if(attrIconValue != null && attrIconValue.trim().length() != 0) {
writer.startElement(HtmlConstants.IMG_ELEMENT, null);
writer.writeAttribute(HtmlConstants.ALT_ATTRIBUTE, "", null);
@@ -117,7 +119,7 @@
}
}
- writer.endElement("td");
+ writer.endElement(TD_ELEM);
}
@Override
Modified: branches/RF-7654/ui/output/ui/src/main/java/org/richfaces/renderkit/html/PanelMenuRenderer.java
===================================================================
--- branches/RF-7654/ui/output/ui/src/main/java/org/richfaces/renderkit/html/PanelMenuRenderer.java 2010-12-17 17:48:19 UTC (rev 20665)
+++ branches/RF-7654/ui/output/ui/src/main/java/org/richfaces/renderkit/html/PanelMenuRenderer.java 2010-12-17 17:57:24 UTC (rev 20666)
@@ -23,36 +23,32 @@
package org.richfaces.renderkit.html;
-import static org.richfaces.renderkit.html.TogglePanelRenderer.getAjaxOptions;
-import static org.richfaces.renderkit.html.TogglePanelRenderer.getValueRequestParamName;
+import org.ajax4jsf.context.AjaxContext;
+import org.ajax4jsf.javascript.JSObject;
+import org.richfaces.component.AbstractPanelMenu;
+import org.richfaces.component.AbstractPanelMenuItem;
+import org.richfaces.component.html.HtmlPanelMenu;
+import org.richfaces.renderkit.HtmlConstants;
-import java.io.IOException;
-import java.util.HashMap;
-import java.util.Map;
-
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 javax.faces.event.ActionEvent;
+import java.io.IOException;
+import java.util.HashMap;
+import java.util.Map;
-import org.ajax4jsf.context.AjaxContext;
-import org.ajax4jsf.javascript.JSObject;
-import org.richfaces.component.AbstractPanelMenu;
-import org.richfaces.component.AbstractPanelMenuItem;
-import org.richfaces.component.html.HtmlPanelMenu;
-import org.richfaces.renderkit.HtmlConstants;
+import static org.richfaces.renderkit.html.TogglePanelRenderer.getAjaxOptions;
+import static org.richfaces.renderkit.html.TogglePanelRenderer.getValueRequestParamName;
/**
* @author akolonitsky
* @since 2010-10-25
*/
@ResourceDependencies( { // TODO review
- //TODO nick - use org.richfaces:ajax.reslib
- @ResourceDependency(library = "javax.faces", name = "jsf.js"),
- @ResourceDependency(name = "jquery.js"),
- @ResourceDependency(name = "richfaces.js"),
+ @ResourceDependency(library = "org.richfaces", name = "ajax.reslib"),
@ResourceDependency(name = "richfaces-event.js"),
@ResourceDependency(name = "richfaces-base-component.js"),
@ResourceDependency(library = "org.richfaces", name = "panelMenu.js"),
@@ -69,7 +65,6 @@
context.getExternalContext().getRequestParameterMap();
// Don't overwrite the value unless you have to!
- //TODO nick - getValueRequestParamName(...) is method of TogglePanelRenderer - how are these components connected?
String newValue = requestMap.get(getValueRequestParamName(context, component));
if (newValue != null) {
panelMenu.setSubmittedActiveItem(newValue);
@@ -77,9 +72,7 @@
//TODO nick - I suggest to get this code moved to item renderer
String compClientId = component.getClientId(context);
- String clientId = requestMap.get(compClientId);
- if (clientId != null && clientId.equals(compClientId)) {
-
+ if (requestMap.get(compClientId) != null) {
AbstractPanelMenuItem panelItem = panelMenu.getItem(newValue);
if (panelItem != null) {
new ActionEvent(panelItem).queue();
Modified: branches/RF-7654/ui/output/ui/src/main/java/org/richfaces/renderkit/html/TabPanelRenderer.java
===================================================================
--- branches/RF-7654/ui/output/ui/src/main/java/org/richfaces/renderkit/html/TabPanelRenderer.java 2010-12-17 17:48:19 UTC (rev 20665)
+++ branches/RF-7654/ui/output/ui/src/main/java/org/richfaces/renderkit/html/TabPanelRenderer.java 2010-12-17 17:57:24 UTC (rev 20666)
@@ -22,6 +22,7 @@
package org.richfaces.renderkit.html;
+import static org.richfaces.renderkit.HtmlConstants.*;
import static org.richfaces.component.AbstractTogglePanelTitledItem.HeaderStates.active;
import static org.richfaces.component.AbstractTogglePanelTitledItem.HeaderStates.disabled;
import static org.richfaces.component.AbstractTogglePanelTitledItem.HeaderStates.inactive;
@@ -70,9 +71,9 @@
.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";
+ private static final String DIV = DIV_ELEM;
+ private static final String STYLE = STYLE_ATTRIBUTE;
+ private static final String CLASS = CLASS_ATTRIBUTE;
@Override
protected void doEncodeBegin(ResponseWriter w, FacesContext context, UIComponent comp) throws IOException {
@@ -92,10 +93,10 @@
w.writeAttribute(CLASS, "rf-tb-hdr-tabline-vis", null);
w.startElement("table", comp);
- w.writeAttribute("class", "rf-tb-hdr-tabs", null);
+ w.writeAttribute(CLASS_ATTRIBUTE, "rf-tb-hdr-tabs", null);
w.writeAttribute("cellspacing", "0", null);
- w.startElement("tbody", comp);
- w.startElement("tr", comp);
+ w.startElement(TBODY_ELEMENT, comp);
+ w.startElement(TR_ELEMENT, comp);
writeTopTabFirstSpacer(w, comp);
@@ -107,15 +108,15 @@
writeTopTabLastSpacer(w, comp);
- w.endElement("tr");
- w.endElement("tbody");
+ w.endElement(TR_ELEMENT);
+ w.endElement(TBODY_ELEMENT);
w.endElement("table");
writeTopTabsControl(w, comp, "rf-tb-hdr-scrl_l rf-tb-hdn", "\u00AB");
writeTopTabsControl(w, comp, "rf-tb-hdr-tablst rf-tb-hdn", "\u2193");
writeTopTabsControl(w, comp, "rf-tb-hdr-scrl_r rf-tb-hdn", "\u00BB");
- w.endElement("div");
+ w.endElement(DIV_ELEM);
}
@Override
@@ -142,16 +143,16 @@
AbstractTogglePanelTitledItem.HeaderStates state, Boolean isDisplay) throws IOException {
- writer.startElement("td", tab);
- writer.writeAttribute("id", tab.getClientId() + ":header:" + state.toString(), null);
+ writer.startElement(TD_ELEM, tab);
+ writer.writeAttribute(ID_ATTRIBUTE, tab.getClientId() + ":header:" + state.toString(), null);
renderPassThroughAttributes(context, tab, HEADER_ATTRIBUTES);
String name = "headerClass" + capitalize(state.toString());
- writer.writeAttribute("class", concatClasses("rf-tb-hdr rf-tb-hdr-" + state.abbreviation(),
+ writer.writeAttribute(CLASS_ATTRIBUTE, concatClasses("rf-tb-hdr rf-tb-hdr-" + state.abbreviation(),
attributeAsString(tab, HtmlTab.PropertyKeys.headerClass), attributeAsString(tab, name)), null);
- writer.writeAttribute("style", concatStyles(isDisplay ? "" : "display : none", attributeAsString(tab, HtmlTab.PropertyKeys.headerStyle.toString())), null);
+ writer.writeAttribute(STYLE_ATTRIBUTE, concatStyles(isDisplay ? "" : "display : none", attributeAsString(tab, HtmlTab.PropertyKeys.headerStyle.toString())), null);
writer.startElement("span", tab);
- writer.writeAttribute("class", "rf-tb-lbl", null);
+ writer.writeAttribute(CLASS_ATTRIBUTE, "rf-tb-lbl", null);
UIComponent headerFacet = tab.getHeaderFacet(state);
if (headerFacet != null && headerFacet.isRendered()) {
@@ -165,16 +166,16 @@
writer.endElement("span");
- writer.endElement("td");
+ writer.endElement(TD_ELEM);
}
private void writeTopTabsControl(ResponseWriter w, UIComponent comp, String styles, String text) throws IOException {
- w.startElement("div", comp);
- w.writeAttribute("class", styles, null);
+ w.startElement(DIV_ELEM, comp);
+ w.writeAttribute(CLASS_ATTRIBUTE, styles, null);
w.writeText(text, null);
- w.endElement("div");
+ w.endElement(DIV_ELEM);
}
private void writeTopTabFirstSpacer(ResponseWriter w, UIComponent comp) throws IOException {
@@ -190,11 +191,11 @@
}
private void writeTopTabSpacer(ResponseWriter w, UIComponent comp, String style, String classStyle) throws IOException {
- w.startElement("td", comp);
+ w.startElement(TD_ELEM, comp);
w.writeAttribute(STYLE, style, null);
w.writeAttribute(CLASS, classStyle, null);
w.write("<br />");
- w.endElement("td");
+ w.endElement(TD_ELEM);
}
@Override
Modified: branches/RF-7654/ui/output/ui/src/main/java/org/richfaces/renderkit/html/TabRenderer.java
===================================================================
--- branches/RF-7654/ui/output/ui/src/main/java/org/richfaces/renderkit/html/TabRenderer.java 2010-12-17 17:48:19 UTC (rev 20665)
+++ branches/RF-7654/ui/output/ui/src/main/java/org/richfaces/renderkit/html/TabRenderer.java 2010-12-17 17:57:24 UTC (rev 20666)
@@ -22,18 +22,20 @@
package org.richfaces.renderkit.html;
-import java.io.IOException;
-import java.util.Map;
+import org.ajax4jsf.javascript.JSObject;
+import org.richfaces.component.AbstractTogglePanelTitledItem;
+import org.richfaces.component.html.HtmlTab;
+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 org.ajax4jsf.javascript.JSObject;
-import org.richfaces.component.AbstractTogglePanelTitledItem;
-import org.richfaces.renderkit.HtmlConstants;
+import static org.richfaces.renderkit.HtmlConstants.*;
/**
* @author akolonitsky
@@ -83,18 +85,18 @@
}
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);
+ writer.startElement(DIV_ELEM, component);
+ writer.writeAttribute(CLASS_ATTRIBUTE, concatClasses("rf-tb-cnt", attributeAsString(component, "contentClass")), null);
+ writer.writeAttribute(ID_ATTRIBUTE, component.getClientId() + ":content", null);
AbstractTogglePanelTitledItem item = (AbstractTogglePanelTitledItem) component;
if (!item.isActive() || item.isDisabled()) {
- writer.writeAttribute("style", "display: none", null);
+ writer.writeAttribute(STYLE_ATTRIBUTE, "display: none", null);
}
}
private void encodeContentEnd(UIComponent component, ResponseWriter responseWriter) throws IOException {
- responseWriter.endElement("div");
+ responseWriter.endElement(DIV_ELEM);
}
@Override
@@ -106,7 +108,9 @@
@Override
protected Map<String, Object> getScriptObjectOptions(FacesContext context, UIComponent component) {
Map<String, Object> res = super.getScriptObjectOptions(context, component);
- res.put("disabled", ((AbstractTogglePanelTitledItem) component).isDisabled());
+ res.put("disabled", ((HtmlTab) component).isDisabled());
+ res.put("enter", ((HtmlTab) component).getOnenter());
+ res.put("leave", ((HtmlTab) component).getOnleave());
return res;
}
Modified: branches/RF-7654/ui/output/ui/src/main/java/org/richfaces/renderkit/html/TogglePanelRenderer.java
===================================================================
--- branches/RF-7654/ui/output/ui/src/main/java/org/richfaces/renderkit/html/TogglePanelRenderer.java 2010-12-17 17:48:19 UTC (rev 20665)
+++ branches/RF-7654/ui/output/ui/src/main/java/org/richfaces/renderkit/html/TogglePanelRenderer.java 2010-12-17 17:57:24 UTC (rev 20666)
@@ -100,7 +100,7 @@
AjaxContext.getCurrentInstance().appendOncomplete(onComplete.toString());
}
- public static String getValueRequestParamName(FacesContext context, UIComponent component) {
+ static String getValueRequestParamName(FacesContext context, UIComponent component) {
return component.getClientId(context) + VALUE_POSTFIX;
}
Modified: branches/RF-7654/ui/output/ui/src/main/java/org/richfaces/renderkit/html/ToolbarGroupRenderer.java
===================================================================
--- branches/RF-7654/ui/output/ui/src/main/java/org/richfaces/renderkit/html/ToolbarGroupRenderer.java 2010-12-17 17:48:19 UTC (rev 20665)
+++ branches/RF-7654/ui/output/ui/src/main/java/org/richfaces/renderkit/html/ToolbarGroupRenderer.java 2010-12-17 17:57:24 UTC (rev 20666)
@@ -65,9 +65,9 @@
private void renderChild(FacesContext facesContext, AbstractToolbarGroup toolbarGroup, ResponseWriter writer,
UIComponent child) throws IOException {
writer.startElement(HtmlConstants.TD_ELEM, toolbarGroup);
+ writer.writeAttribute(HtmlConstants.ID_ATTRIBUTE, encodeClientItemID(child), null);
writeClassValue(toolbarGroup, writer);
writeStyleValue(toolbarGroup, writer);
- encodeEventsAttributes(facesContext, toolbarGroup);
child.encodeAll(facesContext);
writer.endElement(HtmlConstants.TD_ELEM);
}
Modified: branches/RF-7654/ui/output/ui/src/main/java/org/richfaces/renderkit/html/ToolbarRendererBase.java
===================================================================
--- branches/RF-7654/ui/output/ui/src/main/java/org/richfaces/renderkit/html/ToolbarRendererBase.java 2010-12-17 17:48:19 UTC (rev 20665)
+++ branches/RF-7654/ui/output/ui/src/main/java/org/richfaces/renderkit/html/ToolbarRendererBase.java 2010-12-17 17:57:24 UTC (rev 20666)
@@ -24,11 +24,13 @@
import java.io.IOException;
import java.util.Collections;
+import java.util.HashMap;
import java.util.Iterator;
import java.util.LinkedList;
import java.util.List;
import java.util.Map;
+import javax.faces.application.ResourceDependencies;
import javax.faces.application.ResourceDependency;
import javax.faces.component.UIComponent;
import javax.faces.context.FacesContext;
@@ -40,10 +42,15 @@
import org.richfaces.renderkit.HtmlConstants;
import org.richfaces.renderkit.RenderKitUtils;
import org.richfaces.renderkit.RendererBase;
+import org.richfaces.renderkit.RenderKitUtils.ScriptHashVariableWrapper;
import org.richfaces.renderkit.util.HtmlDimensions;
-@ResourceDependency(library = "org.richfaces", name = "toolbar.ecss")
+
+@ResourceDependencies({
+ @ResourceDependency(name = "jquery.js"),
+ @ResourceDependency(library = "org.richfaces", name = "toolbar.ecss")
+ })
public abstract class ToolbarRendererBase extends RendererBase {
public static final String RENDERER_TYPE = "org.richfaces.ToolbarRenderer";
@@ -215,11 +222,11 @@
if (!(child instanceof AbstractToolbarGroup)) {
writer.startElement(HtmlConstants.TD_ELEM, component);
+ writer.writeAttribute(HtmlConstants.ID_ATTRIBUTE, encodeClientItemID(child), null);
writer.writeAttribute(HtmlConstants.CLASS_ATTRIBUTE, concatClasses("rf-tb-itm", itemClass), null);
if (isPropertyRendered(itemStyle)) {
writer.writeAttribute(HtmlConstants.STYLE_ATTRIBUTE, itemStyle, null);
}
- encodeEventsAttributes(context, toolbar);
}
child.encodeAll(context);
@@ -339,11 +346,6 @@
return true;
}
- protected void encodeEventsAttributes(FacesContext facesContext, UIComponent component)
- throws IOException {
- RenderKitUtils.renderPassThroughAttributesOptimized(facesContext, component, ITEMS_HANDLER_ATTRIBUTES);
- }
-
protected boolean isPropertyRendered(String property) {
return (null != property && !"".equals(property));
}
@@ -363,4 +365,69 @@
return "";
}
}
+
+ protected Map<String, Object> getOptions(UIComponent component) {
+ if (component == null) {
+ return null;
+ }
+ HashMap<String, Object> results = new HashMap<String, Object>();
+ if (component instanceof AbstractToolbar) {
+ Map<String, Object> tbEvents = new HashMap<String, Object>();
+ for (ComponentAttribute componentAttribute :ITEMS_HANDLER_ATTRIBUTES.values()) {
+ Object attr = component.getAttributes().get(componentAttribute.getComponentAttributeName());
+ if (attr != null) {
+ RenderKitUtils.addToScriptHash(tbEvents, componentAttribute.getHtmlAttributeName(),
+ attr, null, ScriptHashVariableWrapper.eventHandler);
+ }
+ }
+ results.put("id", component.getClientId());
+ results.put("events", tbEvents);
+
+ List<AbstractToolbarGroup> groups = getToolBarGroups((AbstractToolbar) component);
+ List<Map<String, Object>> tbgListOptions = new LinkedList<Map<String, Object>>();
+
+ for (AbstractToolbarGroup tbg : groups) {
+
+ Map<String, Object> tbgOptions = new HashMap<String, Object>();
+ Map<String, Object> tbgEvents = new HashMap<String, Object>();
+ List<String> tbgIDs = new LinkedList<String>();
+
+ for (UIComponent comp : tbg.getChildren()) {
+ tbgIDs.add(encodeClientItemID(comp));
+ }
+
+ for (ComponentAttribute componentAttribute :ITEMS_HANDLER_ATTRIBUTES.values()) {
+ Object attr = tbg.getAttributes().get(componentAttribute.getComponentAttributeName());
+ if (attr != null) {
+ RenderKitUtils.addToScriptHash(tbgEvents, componentAttribute.getHtmlAttributeName(),
+ attr, null, ScriptHashVariableWrapper.eventHandler);
+ }
+ }
+ if (!tbgEvents.isEmpty()) {
+ tbgOptions.put("events", tbgEvents);
+ tbgOptions.put("ids", tbgIDs);
+ tbgListOptions.add(tbgOptions);
+ }
+ }
+
+ results.put("groups", tbgListOptions);
+ }
+ return results;
+ }
+
+ protected String encodeClientItemID(UIComponent component) {
+ return component != null ? component.getClientId() + "_itm":"";
+ }
+
+ private List<AbstractToolbarGroup> getToolBarGroups(AbstractToolbar toolBar) {
+ List<AbstractToolbarGroup> list = new LinkedList<AbstractToolbarGroup>();
+ if (toolBar != null) {
+ for (UIComponent comp : toolBar.getChildren()) {
+ if (comp instanceof AbstractToolbarGroup) {
+ list.add((AbstractToolbarGroup) comp);
+ }
+ }
+ }
+ return list;
+ }
}
Modified: branches/RF-7654/ui/output/ui/src/main/java/org/richfaces/renderkit/html/TooltipRenderer.java
===================================================================
--- branches/RF-7654/ui/output/ui/src/main/java/org/richfaces/renderkit/html/TooltipRenderer.java 2010-12-17 17:48:19 UTC (rev 20665)
+++ branches/RF-7654/ui/output/ui/src/main/java/org/richfaces/renderkit/html/TooltipRenderer.java 2010-12-17 17:57:24 UTC (rev 20666)
@@ -23,6 +23,7 @@
package org.richfaces.renderkit.html;
+import static org.richfaces.renderkit.HtmlConstants.*;
import static org.richfaces.renderkit.RenderKitUtils.renderPassThroughAttributes;
import static org.richfaces.renderkit.html.TogglePanelRenderer.addEventOption;
import static org.richfaces.renderkit.html.TogglePanelRenderer.getAjaxOptions;
@@ -94,8 +95,8 @@
AbstractTooltip tooltip = (AbstractTooltip) component;
writer.startElement(getMarkupElement(tooltip), component);
- writer.writeAttribute("id", component.getClientId(context), "clientId");
- writer.writeAttribute("class", getStyleClass(component), null);
+ writer.writeAttribute(ID_ATTRIBUTE, component.getClientId(context), "clientId");
+ writer.writeAttribute(CLASS_ATTRIBUTE, getStyleClass(component), null);
String style = getStyle(component);
if (style != null && style.trim().length() > 0) {
writer.writeAttribute(HtmlConstants.STYLE_ATTRIBUTE, style, null);
@@ -104,8 +105,8 @@
renderPassThroughAttributes(context, component, getPassThroughAttributes());
writer.startElement(getMarkupElement(tooltip), component);
- writer.writeAttribute("id", component.getClientId(context) + ":cntr", null);
- writer.writeAttribute("class", "rf-tt-cntr", null);
+ writer.writeAttribute(ID_ATTRIBUTE, component.getClientId(context) + ":cntr", null);
+ writer.writeAttribute(CLASS_ATTRIBUTE, "rf-tt-cntr", null);
if (tooltip.getMode() == TooltipMode.ajax) {
encodeLoading(writer, context, tooltip);
@@ -116,14 +117,14 @@
private void encodeContentBegin(ResponseWriter writer, FacesContext context, AbstractTooltip tooltip) throws IOException {
writer.startElement(getMarkupElement(tooltip), tooltip);
- writer.writeAttribute("id", tooltip.getClientId(context) + "@content", null);
- writer.writeAttribute("class", "rf-tt-cnt", null);
+ writer.writeAttribute(ID_ATTRIBUTE, tooltip.getClientId(context) + "@content", null);
+ writer.writeAttribute(CLASS_ATTRIBUTE, "rf-tt-cnt", null);
}
private void encodeLoading(ResponseWriter writer, FacesContext context, AbstractTooltip tooltip) throws IOException {
writer.startElement(getMarkupElement(tooltip), tooltip);
- writer.writeAttribute("id", tooltip.getClientId(context) + ":loading", null);
- writer.writeAttribute("class", "rf-tt-loading", null);
+ writer.writeAttribute(ID_ATTRIBUTE, tooltip.getClientId(context) + ":loading", null);
+ writer.writeAttribute(CLASS_ATTRIBUTE, "rf-tt-loading", null);
writer.writeText("Loading...", null);
writer.endElement(getMarkupElement(tooltip));
}
Modified: branches/RF-7654/ui/output/ui/src/main/resources/META-INF/pn.faces-config.xml
===================================================================
--- branches/RF-7654/ui/output/ui/src/main/resources/META-INF/pn.faces-config.xml 2010-12-17 17:48:19 UTC (rev 20665)
+++ branches/RF-7654/ui/output/ui/src/main/resources/META-INF/pn.faces-config.xml 2010-12-17 17:57:24 UTC (rev 20666)
@@ -2044,12 +2044,6 @@
<property-name>iconRightExpanded</property-name>
<property-class>java.lang.String</property-class>
</property>
- <property>
- <description></description>
- <property-name>changeExpandListener</property-name>
- <property-class>java.lang.String</property-class>
- </property>
-
</component>
<component>
<component-type>org.richfaces.PanelMenu</component-type>
Modified: branches/RF-7654/ui/output/ui/src/main/resources/META-INF/pn.taglib.xml
===================================================================
--- branches/RF-7654/ui/output/ui/src/main/resources/META-INF/pn.taglib.xml 2010-12-17 17:48:19 UTC (rev 20665)
+++ branches/RF-7654/ui/output/ui/src/main/resources/META-INF/pn.taglib.xml 2010-12-17 17:57:24 UTC (rev 20666)
@@ -556,10 +556,6 @@
<type>java.lang.String</type>
</attribute>
<attribute>
- <name>changeExpandListener</name>
- <type>java.lang.String</type>
- </attribute>
- <attribute>
<name>icon</name>
<type>java.lang.String</type>
</attribute>
Modified: branches/RF-7654/ui/output/ui/src/main/resources/META-INF/resources/org.richfaces/panelMenu.js
===================================================================
--- branches/RF-7654/ui/output/ui/src/main/resources/META-INF/resources/org.richfaces/panelMenu.js 2010-12-17 17:48:19 UTC (rev 20665)
+++ branches/RF-7654/ui/output/ui/src/main/resources/META-INF/resources/org.richfaces/panelMenu.js 2010-12-17 17:57:24 UTC (rev 20666)
@@ -123,10 +123,6 @@
return document.getElementById(this.id + "-value");
},
- selectItem: function (itemName) {
- // TODO
- },
-
/**
* @methodOf
* @name PanelMenu#expandAll
Modified: branches/RF-7654/ui/output/ui/src/main/resources/META-INF/resources/org.richfaces/panelMenuItem.js
===================================================================
--- branches/RF-7654/ui/output/ui/src/main/resources/META-INF/resources/org.richfaces/panelMenuItem.js 2010-12-17 17:48:19 UTC (rev 20665)
+++ branches/RF-7654/ui/output/ui/src/main/resources/META-INF/resources/org.richfaces/panelMenuItem.js 2010-12-17 17:57:24 UTC (rev 20666)
@@ -126,8 +126,8 @@
this.options = $.extend(this.options, __DEFAULT_OPTIONS, options || {});
- this.mode = this.options.mode
- this.itemName = this.options.name
+ this.mode = this.options.mode;
+ this.itemName = this.options.name;
this.__rfPanelMenu().getItems()[this.itemName] = this;
// todo move it
@@ -211,8 +211,7 @@
if (panelMenu.selectedItem() == this.itemName) {
panelMenu.selectedItem(null);
} else {
- //TODO nick - should be rf.log.warn
- rf.warn("You tried to unselect item (name=" + this.itemName + ") that isn't seleted")
+ rf.log.warn("You tried to unselect item (name=" + this.itemName + ") that isn't seleted")
}
this.__unselect();
@@ -256,8 +255,7 @@
},
__rfPanelMenu : function () {
- //TODO nick - return rf.$(this.__panelMenu())
- return rf.$(this.__item().parents(".rf-pm")[0]);
+ return rf.$(this.__panelMenu());
},
__changeState : function () {
@@ -274,7 +272,6 @@
return $(rf.getDomElement(this.id));
},
- //TODO nick - __item() vs __header()?
__header : function () {
return this.__item();
},
@@ -288,22 +285,20 @@
},
__fireBeforeSelect : function () {
- //TODO nick - 'new' is not necessary here
- return new rf.Event.fireById(this.id, "beforeselect", {
- //TODO nick - pass item here
- id: this.id
+ return rf.Event.fireById(this.id, "beforeselect", {
+ item: this
});
},
__fireSelect : function () {
- return new rf.Event.fireById(this.id, "select", {
- id: this.id
+ return rf.Event.fireById(this.id, "select", {
+ item: this
});
},
__fireUnselect : function () {
- return new rf.Event.fireById(this.id, "unselect", {
- id: this.id
+ return rf.Event.fireById(this.id, "unselect", {
+ item: this
});
},
Modified: branches/RF-7654/ui/output/ui/src/main/resources/META-INF/resources/org.richfaces/tab.js
===================================================================
--- branches/RF-7654/ui/output/ui/src/main/resources/META-INF/resources/org.richfaces/tab.js 2010-12-17 17:48:19 UTC (rev 20665)
+++ branches/RF-7654/ui/output/ui/src/main/resources/META-INF/resources/org.richfaces/tab.js 2010-12-17 17:57:24 UTC (rev 20666)
@@ -91,6 +91,21 @@
return this.__fireEnter();
},
+ __fireLeave : function () {
+ return rf.Event.fireById(this.id + ":content", "leave");
+ },
+
+ __fireEnter : function () {
+ return rf.Event.fireById(this.id + ":content", "enter");
+ },
+
+ __addUserEventHandler : function (name) {
+ var handler = this.options["on" + name];
+ if (handler) {
+ var userHandler = rf.Event.bindById(this.id + ":content", name, handler);
+ }
+ },
+
getHeight : function (recalculate) {
if (recalculate || !this.__height) {
this.__height = $(rf.getDomElement(this.id)).outerHeight(true)
Modified: branches/RF-7654/ui/output/ui/src/main/templates/toolbar.template.xml
===================================================================
--- branches/RF-7654/ui/output/ui/src/main/templates/toolbar.template.xml 2010-12-17 17:48:19 UTC (rev 20665)
+++ branches/RF-7654/ui/output/ui/src/main/templates/toolbar.template.xml 2010-12-17 17:57:24 UTC (rev 20666)
@@ -20,11 +20,13 @@
class="rf-tb #{component.attributes['styleClass']}"
style="#{ component.attributes['style']}"
cdk:passThroughWithExclusions="">
- <cdk:call expression="encodeEventsAttributes(facesContext, component)" />
<cdk:call expression="renderColElements(facesContext, component)" />
<tr class="rf-tb-cntr">
<cdk:body />
</tr>
</table>
+ <script type="text/javascript">
+ #{toScriptArgs(getOptions(component))}
+ </script>
</cc:implementation>
</cdk:root>
Modified: branches/RF-7654/ui/output/ui/src/test/resources/org/richfaces/renderkit/html/panelMenu-icons-inheritance-group.xmlunit.xml
===================================================================
--- branches/RF-7654/ui/output/ui/src/test/resources/org/richfaces/renderkit/html/panelMenu-icons-inheritance-group.xmlunit.xml 2010-12-17 17:48:19 UTC (rev 20665)
+++ branches/RF-7654/ui/output/ui/src/test/resources/org/richfaces/renderkit/html/panelMenu-icons-inheritance-group.xmlunit.xml 2010-12-17 17:57:24 UTC (rev 20666)
@@ -8,7 +8,7 @@
<div class="rf-pm-ico-colps rf-pm-triangle-down" style="display:block"></div>
<div class="rf-pm-ico-exp rf-pm-disc" style="display:none"></div>
</td>
- <td class="rf-pm-gr-lbl">panelMenuGroup-top</td>
+ <td class="rf-pm-gr-lbl"></td>
<td class="rf-pm-gr-exp-ico">
<div class="rf-pm-ico-colps rf-pm-triangle-up" style="display:block"></div>
<div class="rf-pm-ico-exp rf-pm-disc" style="display:none"></div>
Modified: branches/RF-7654/ui/output/ui/src/test/resources/org/richfaces/renderkit/html/panelMenu-icons-inheritance-groupDis.xmlunit.xml
===================================================================
--- branches/RF-7654/ui/output/ui/src/test/resources/org/richfaces/renderkit/html/panelMenu-icons-inheritance-groupDis.xmlunit.xml 2010-12-17 17:48:19 UTC (rev 20665)
+++ branches/RF-7654/ui/output/ui/src/test/resources/org/richfaces/renderkit/html/panelMenu-icons-inheritance-groupDis.xmlunit.xml 2010-12-17 17:57:24 UTC (rev 20666)
@@ -8,7 +8,7 @@
<div class="rf-pm-ico-colps rf-pm-chevron-down" style="display:block"></div>
<div class="rf-pm-ico-exp rf-pm-chevron-down" style="display:none"></div>
</td>
- <td class="rf-pm-gr-lbl">panelMenuGroup-top</td>
+ <td class="rf-pm-gr-lbl"></td>
<td class="rf-pm-gr-exp-ico">
<div class="rf-pm-ico-colps rf-pm-chevron-up" style="display:block"></div>
<div class="rf-pm-ico-exp rf-pm-chevron-up" style="display:none"></div>
Modified: branches/RF-7654/ui/output/ui/src/test/resources/org/richfaces/renderkit/html/panelMenu-icons-inheritance-topGroup.xmlunit.xml
===================================================================
--- branches/RF-7654/ui/output/ui/src/test/resources/org/richfaces/renderkit/html/panelMenu-icons-inheritance-topGroup.xmlunit.xml 2010-12-17 17:48:19 UTC (rev 20665)
+++ branches/RF-7654/ui/output/ui/src/test/resources/org/richfaces/renderkit/html/panelMenu-icons-inheritance-topGroup.xmlunit.xml 2010-12-17 17:57:24 UTC (rev 20666)
@@ -8,7 +8,7 @@
<div class="rf-pm-ico-colps rf-pm-triangle" style="display:block"></div>
<div class="rf-pm-ico-exp rf-pm-disc" style="display:none"></div>
</td>
- <td class="rf-pm-top-gr-lbl">panelMenuGroup-top</td>
+ <td class="rf-pm-top-gr-lbl"></td>
<td class="rf-pm-top-gr-exp-ico">
<div class="rf-pm-ico-colps rf-pm-triangle" style="display:block"></div>
<div class="rf-pm-ico-exp rf-pm-disc" style="display:none"></div>
Modified: branches/RF-7654/ui/output/ui/src/test/resources/org/richfaces/renderkit/html/panelMenu-icons-inheritance-topGroupDis.xmlunit.xml
===================================================================
--- branches/RF-7654/ui/output/ui/src/test/resources/org/richfaces/renderkit/html/panelMenu-icons-inheritance-topGroupDis.xmlunit.xml 2010-12-17 17:48:19 UTC (rev 20665)
+++ branches/RF-7654/ui/output/ui/src/test/resources/org/richfaces/renderkit/html/panelMenu-icons-inheritance-topGroupDis.xmlunit.xml 2010-12-17 17:57:24 UTC (rev 20666)
@@ -8,7 +8,7 @@
<div class="rf-pm-ico-colps rf-pm-chevron" style="display:block"></div>
<div class="rf-pm-ico-exp rf-pm-chevron" style="display:none"></div>
</td>
- <td class="rf-pm-top-gr-lbl">panelMenuGroup-top</td>
+ <td class="rf-pm-top-gr-lbl"></td>
<td class="rf-pm-top-gr-exp-ico">
<div class="rf-pm-ico-colps rf-pm-chevron" style="display:block"></div>
<div class="rf-pm-ico-exp rf-pm-chevron" style="display:none"></div>
Modified: branches/RF-7654/ui/output/ui/src/test/resources/org/richfaces/renderkit/html/panelMenuGroup.xmlunit.xml
===================================================================
--- branches/RF-7654/ui/output/ui/src/test/resources/org/richfaces/renderkit/html/panelMenuGroup.xmlunit.xml 2010-12-17 17:48:19 UTC (rev 20665)
+++ branches/RF-7654/ui/output/ui/src/test/resources/org/richfaces/renderkit/html/panelMenuGroup.xmlunit.xml 2010-12-17 17:57:24 UTC (rev 20666)
@@ -8,7 +8,7 @@
<div class="rf-pm-ico-colps rf-pm-none" style="display:block"></div>
<div class="rf-pm-ico-exp rf-pm-none" style="display:none"></div>
</td>
- <td class="rf-pm-gr-lbl">panelMenuGroup</td>
+ <td class="rf-pm-gr-lbl"></td>
<td class="rf-pm-gr-exp-ico">
<div class="rf-pm-ico-colps rf-pm-none" style="display:block"></div>
<div class="rf-pm-ico-exp rf-pm-none" style="display:none"></div>
14 years
JBoss Rich Faces SVN: r20665 - trunk/ui/output/ui/src/main/resources/META-INF/resources/org.richfaces.
by richfaces-svn-commits@lists.jboss.org
Author: amarkhel
Date: 2010-12-17 12:48:19 -0500 (Fri, 17 Dec 2010)
New Revision: 20665
Modified:
trunk/ui/output/ui/src/main/resources/META-INF/resources/org.richfaces/menu.js
Log:
RF-9789 Dropdown menu component: pre-promotion code review. Applied formatting for js
Modified: trunk/ui/output/ui/src/main/resources/META-INF/resources/org.richfaces/menu.js
===================================================================
--- trunk/ui/output/ui/src/main/resources/META-INF/resources/org.richfaces/menu.js 2010-12-17 17:34:18 UTC (rev 20664)
+++ trunk/ui/output/ui/src/main/resources/META-INF/resources/org.richfaces/menu.js 2010-12-17 17:48:19 UTC (rev 20665)
@@ -1,174 +1,186 @@
(function($, rf) {
- rf.ui = rf.ui || {};
-
- var defaultOptions = {
- mode: 'server',
- attachToBody: false,
- positionOffset: [0, 0],
- showDelay: 50,
- hideDelay: 300,
- verticalOffset: 0,
- horisantalOffset: 0,
- showEvent: 'mouseover',
- direction: "AA",
- jointPoint: "AA",
- itemCss: "rf-ddm-itm",
- selectItemCss: "rf-ddm-itm-sel",
- unselectItemCss: "rf-ddm-itm-unsel",
- disabledItemCss: "rf-ddm-itm-dis",
- listCss: "rf-ddm-lst"
- };
+ rf.ui = rf.ui || {};
- //constructor definition
- rf.ui.Menu = function(componentId, options) {
- $super.constructor.call(this, componentId);
- this.id = componentId;
- this.groupList = new Array();
- this.options = {};
- $.extend(this.options, defaultOptions, options || {});
- this.attachToDom(componentId);
+ var defaultOptions = {
+ mode : 'server',
+ attachToBody : false,
+ positionOffset : [ 0, 0 ],
+ showDelay : 50,
+ hideDelay : 300,
+ verticalOffset : 0,
+ horisantalOffset : 0,
+ showEvent : 'mouseover',
+ direction : "AA",
+ jointPoint : "AA",
+ itemCss : "rf-ddm-itm",
+ selectItemCss : "rf-ddm-itm-sel",
+ unselectItemCss : "rf-ddm-itm-unsel",
+ disabledItemCss : "rf-ddm-itm-dis",
+ listCss : "rf-ddm-lst"
+ };
- this.element = rf.getDomElement(this.id);
-
- this.selectItemCss = this.options.selectItemCss;
- this.unselectItemCss = this.options.unselectItemCss;
-
- this.displayed = false;
-
- this.options.attachTo = this.id;
- this.options.positionOffset=[this.options.horisantalOffset, this.options.verticalOffset];
- this.popupList = new RichFaces.ui.PopupList(this.id + "_list", this, this.options);
- this.selectedGroup = null;
- rf.Event.bindById(this.id, this.options.showEvent, $.proxy(this.___showHandler, this), this);
- rf.Event.bindById(this.id, "mouseover", $.proxy(this.__overHandler, this), this);
- rf.Event.bindById(this.id, "mouseleave", $.proxy(this.__leaveHandler, this), this);
+ // constructor definition
+ rf.ui.Menu = function(componentId, options) {
+ $super.constructor.call(this, componentId);
+ this.id = componentId;
+ this.groupList = new Array();
+ this.options = {};
+ $.extend(this.options, defaultOptions, options || {});
+ this.attachToDom(componentId);
- };
+ this.element = rf.getDomElement(this.id);
- rf.BaseComponent.extend(rf.ui.Menu);
+ this.selectItemCss = this.options.selectItemCss;
+ this.unselectItemCss = this.options.unselectItemCss;
- // define super class link
- var $super = rf.ui.Menu.$super;
- $.extend(rf.ui.Menu.prototype, (function() {
- return {
- name: "Menu",
- initiateGroups: function(groupOptions) {
-
- for (var i in groupOptions) {
- var groupId = groupOptions[i].id;
- var positionOffset = [groupOptions[i].horizontalOffset, groupOptions[i].verticalOffset]
- var onshow = groupOptions[i].onshow;
- var onhide = groupOptions[i].onhide;
-
- var eventType = "mouseover";
-
- if (null != groupId) {
- //var popup = new RichFaces.ui.Popup(groupId + '_list', options);
- var group= new RichFaces.ui.MenuGroup(groupId,{parentMenuId: this.id, onshow: onshow, onhide: onhide});
- this.groupList[groupId] = group;
- }
- }
- },
-
- submitForm: function(item) {
- var form = this.__getParentForm(item);
- if (this.options.mode == "server") {
- //rf.submitForm(form, {selectedMenuItem: item.id});
- }
- if (this.options.mode == "ajax") {
- //rf.ajax(item.id);
- }
- },
+ this.displayed = false;
- processItem: function(item) {
- if (item && item.attr('id') && !this.__isDisabled(item) && !this.__isGroup(item)) {
- this.invokeEvent("itemclick", rf.getDomElement(this.id), null);
- this.hidePopup();
- }
- },
-
- selectItem: function(item) {
-// if(item.attr('id') && !this.isDisabled(item)){
-// item.addClass(this.selectItemCss);
-// if(item.attr('id').search('group') != -1){
-// this.selectedGroup=item.attr('id');
-// } else {
-// this.selectedGroup = null;
-// }
-// }
- },
- unselectItem: function(item) {
-// var nextItem = this.popupList.nextSelectItem();
-// if (item.attr('id') && (nextItem.attr('id') != this.selectedGroup) && !this.isWithin(nextItem) ){
-// item.removeClass(this.selectItemCss);
-// item.addClass(this.unselectItemCss);
-// }
-
- },
-
- showPopup: function() {
- if (!this.__isShown()){
- this.invokeEvent("show", rf.getDomElement(this.id), null);
- this.popupList.show();
- this.displayed=true;
- }
- },
-
- hidePopup: function() {
- /* for (var i in this.groupList) {
- this.groupList[i].hide();
- }*/
- if (this.__isShown()){
- this.invokeEvent("hide", rf.getDomElement(this.id), null);
- this.popupList.hide();
- this.displayed=false;
- }
-
- },
-
- __isGroup: function(item) {
- return 'object' == typeof this.groupList[item.attr('id')];
- },
-
- __isDisabled: function(item) {
- return item.hasClass(this.options.disabledItemCss);
- },
-
- __isShown: function() {
- return this.displayed;
-
- },
-
- ___showHandler: function() {
- this.showTimeoutId = window.setTimeout($.proxy(function(){
- this.showPopup();
- }, this), this.options.showDelay);
- },
-
- __getParentForm: function(item) {
- return item.parents("form")[0];
- },
-
+ this.options.attachTo = this.id;
+ this.options.positionOffset = [ this.options.horisantalOffset,
+ this.options.verticalOffset ];
+ this.popupList = new RichFaces.ui.PopupList(this.id + "_list", this,
+ this.options);
+ this.selectedGroup = null;
+ rf.Event.bindById(this.id, this.options.showEvent, $.proxy(
+ this.___showHandler, this), this);
+ rf.Event.bindById(this.id, "mouseover", $.proxy(this.__overHandler,
+ this), this);
+ rf.Event.bindById(this.id, "mouseleave", $.proxy(this.__leaveHandler,
+ this), this);
-
- __leaveHandler: function(e) {
- window.clearTimeout(this.showTimeoutId);
- this.hideTimeoutId = window.setTimeout($.proxy(function(){
- this.hidePopup();
- }, this), this.options.hideDelay);
- },
-
- __overHandler: function(e) {
- window.clearTimeout(this.hideTimeoutId);
- },
-
- destroy: function() {
- // clean up code here
+ };
+
+ rf.BaseComponent.extend(rf.ui.Menu);
+
+ // define super class link
+ var $super = rf.ui.Menu.$super;
+ $.extend(rf.ui.Menu.prototype, (function() {
+ return {
+ name : "Menu",
+ initiateGroups : function(groupOptions) {
+
+ for ( var i in groupOptions) {
+ var groupId = groupOptions[i].id;
+ var positionOffset = [ groupOptions[i].horizontalOffset,
+ groupOptions[i].verticalOffset ]
+ var onshow = groupOptions[i].onshow;
+ var onhide = groupOptions[i].onhide;
+
+ var eventType = "mouseover";
+
+ if (null != groupId) {
+ // var popup = new RichFaces.ui.Popup(groupId +
+ // '_list', options);
+ var group = new RichFaces.ui.MenuGroup(groupId, {
+ parentMenuId : this.id,
+ onshow : onshow,
+ onhide : onhide
+ });
+ this.groupList[groupId] = group;
+ }
+ }
+ },
+
+ submitForm : function(item) {
+ var form = this.__getParentForm(item);
+ if (this.options.mode == "server") {
+ // rf.submitForm(form, {selectedMenuItem: item.id});
+ }
+ if (this.options.mode == "ajax") {
+ // rf.ajax(item.id);
+ }
+ },
+
+ processItem : function(item) {
+ if (item && item.attr('id') && !this.__isDisabled(item)
+ && !this.__isGroup(item)) {
+ this.invokeEvent("itemclick", rf.getDomElement(this.id),
+ null);
+ this.hidePopup();
+ }
+ },
+
+ selectItem : function(item) {
+ // if(item.attr('id') && !this.isDisabled(item)){
+ // item.addClass(this.selectItemCss);
+ // if(item.attr('id').search('group') != -1){
+ // this.selectedGroup=item.attr('id');
+ // } else {
+ // this.selectedGroup = null;
+ // }
+ // }
+ },
+ unselectItem : function(item) {
+ // var nextItem = this.popupList.nextSelectItem();
+ // if (item.attr('id') && (nextItem.attr('id') !=
+ // this.selectedGroup) && !this.isWithin(nextItem) ){
+ // item.removeClass(this.selectItemCss);
+ // item.addClass(this.unselectItemCss);
+ // }
+
+ },
+
+ showPopup : function() {
+ if (!this.__isShown()) {
+ this.invokeEvent("show", rf.getDomElement(this.id), null);
+ this.popupList.show();
+ this.displayed = true;
+ }
+ },
+
+ hidePopup : function() {
+ /*
+ * for (var i in this.groupList) { this.groupList[i].hide(); }
+ */
+ if (this.__isShown()) {
+ this.invokeEvent("hide", rf.getDomElement(this.id), null);
+ this.popupList.hide();
+ this.displayed = false;
+ }
+
+ },
+
+ __isGroup : function(item) {
+ return 'object' == typeof this.groupList[item.attr('id')];
+ },
+
+ __isDisabled : function(item) {
+ return item.hasClass(this.options.disabledItemCss);
+ },
+
+ __isShown : function() {
+ return this.displayed;
+
+ },
+
+ ___showHandler : function() {
+ this.showTimeoutId = window.setTimeout($.proxy(function() {
+ this.showPopup();
+ }, this), this.options.showDelay);
+ },
+
+ __getParentForm : function(item) {
+ return item.parents("form")[0];
+ },
+
+ __leaveHandler : function(e) {
+ window.clearTimeout(this.showTimeoutId);
+ this.hideTimeoutId = window.setTimeout($.proxy(function() {
+ this.hidePopup();
+ }, this), this.options.hideDelay);
+ },
+
+ __overHandler : function(e) {
+ window.clearTimeout(this.hideTimeoutId);
+ },
+
+ destroy : function() {
+ // clean up code here
this.detach(this.id);
-
+
// call parent's destroy method
- $super.destroy.call(this);
- }
- };
- })());
+ $super.destroy.call(this);
+ }
+ };
+ })());
})(jQuery, RichFaces)
\ No newline at end of file
14 years
JBoss Rich Faces SVN: r20664 - modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richInputNumberSlider.
by richfaces-svn-commits@lists.jboss.org
Author: ppitonak(a)redhat.com
Date: 2010-12-17 12:34:18 -0500 (Fri, 17 Dec 2010)
New Revision: 20664
Modified:
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richInputNumberSlider/TestRichSlider.java
Log:
* fixed testTypeIntoInputDecimal
Modified: modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richInputNumberSlider/TestRichSlider.java
===================================================================
--- modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richInputNumberSlider/TestRichSlider.java 2010-12-17 17:22:05 UTC (rev 20663)
+++ modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richInputNumberSlider/TestRichSlider.java 2010-12-17 17:34:18 UTC (rev 20664)
@@ -144,10 +144,10 @@
guardXhr(selenium).type(input, number);
waitGui.failWith("Page was not updated").waitForChange(reqTime, retrieveText.locator(time));
- int roundedNumber = (int) Math.round(Double.parseDouble(number));
+ Double newNumber = new Double(number);
- assertEquals(selenium.getText(output), Integer.toString(roundedNumber), "Output was not updated.");
- assertEquals(selenium.getValue(input), Integer.toString(roundedNumber), "Input was not updated.");
+ assertEquals(selenium.getText(output), newNumber == 0 ? "0" : newNumber.toString(), "Output was not updated.");
+ assertEquals(selenium.getValue(input), newNumber == 0 ? "0" : newNumber.toString(), "Input was not updated.");
}
@Test
14 years
JBoss Rich Faces SVN: r20663 - trunk/ui/iteration/ui/src/main/resources/META-INF/resources/org.richfaces.
by richfaces-svn-commits@lists.jboss.org
Author: nbelaevski
Date: 2010-12-17 12:22:05 -0500 (Fri, 17 Dec 2010)
New Revision: 20663
Modified:
trunk/ui/iteration/ui/src/main/resources/META-INF/resources/org.richfaces/tree.js
Log:
https://issues.jboss.org/browse/RF-10043
Modified: trunk/ui/iteration/ui/src/main/resources/META-INF/resources/org.richfaces/tree.js
===================================================================
--- trunk/ui/iteration/ui/src/main/resources/META-INF/resources/org.richfaces/tree.js 2010-12-17 16:53:56 UTC (rev 20662)
+++ trunk/ui/iteration/ui/src/main/resources/META-INF/resources/org.richfaces/tree.js 2010-12-17 17:22:05 UTC (rev 20663)
@@ -287,7 +287,12 @@
var newChild = new richfaces.ui.TreeNode(node[0], opts);
parentNode.addChild(newChild, idx);
- parentNode.getTree().__updateSelectionFromInput();
+
+ var tree = parentNode.getTree();
+
+ if (tree.getSelection().contains(newChild.getId())) {
+ newChild.__setSelected(true);
+ }
};
richfaces.ui.TreeNode.emitToggleEvent = function(nodeId) {
@@ -433,13 +438,9 @@
return this;
},
- __isSelected: function(node) {
- return this.__selection.contains(node);
- },
-
__handleSelectionChange: function(newSelection) {
var eventData = {
- oldSelection: this.__selection.getNodes(),
+ oldSelection: this.getSelection().getNodes(),
newSelection: newSelection.getNodes()
};
@@ -457,12 +458,12 @@
},
__toggleSelection: function(node) {
- var newSelection = this.__selection.cloneAndToggle(node);
+ var newSelection = this.getSelection().cloneAndToggle(node);
this.__handleSelectionChange(newSelection);
},
__addToSelection: function(node) {
- var newSelection = this.__selection.cloneAndAdd(node);
+ var newSelection = this.getSelection().cloneAndAdd(node);
this.__handleSelectionChange(newSelection);
},
@@ -472,7 +473,7 @@
__updateSelection: function(newSelection) {
- var oldSelection = this.__selection;
+ var oldSelection = this.getSelection();
oldSelection.each(function() {this.__setSelected(false)});
newSelection.each(function() {this.__setSelected(true)});
@@ -485,7 +486,12 @@
}
this.__selection = newSelection;
+ },
+
+ getSelection: function() {
+ return this.__selection;
}
+
});
// define super class link for Tree
14 years
JBoss Rich Faces SVN: r20662 - modules/tests/metamer/trunk/application/src/main/java/org/richfaces/tests/metamer/bean.
by richfaces-svn-commits@lists.jboss.org
Author: ppitonak(a)redhat.com
Date: 2010-12-17 11:53:56 -0500 (Fri, 17 Dec 2010)
New Revision: 20662
Modified:
modules/tests/metamer/trunk/application/src/main/java/org/richfaces/tests/metamer/bean/RichInplaceInputBean.java
modules/tests/metamer/trunk/application/src/main/java/org/richfaces/tests/metamer/bean/RichPanelBean.java
modules/tests/metamer/trunk/application/src/main/java/org/richfaces/tests/metamer/bean/RichPanelMenuBean.java
modules/tests/metamer/trunk/application/src/main/java/org/richfaces/tests/metamer/bean/RichPopupPanelBean.java
modules/tests/metamer/trunk/application/src/main/java/org/richfaces/tests/metamer/bean/RichProgressBarBean.java
modules/tests/metamer/trunk/application/src/main/java/org/richfaces/tests/metamer/bean/RichSelectBean.java
modules/tests/metamer/trunk/application/src/main/java/org/richfaces/tests/metamer/bean/RichTabBean.java
modules/tests/metamer/trunk/application/src/main/java/org/richfaces/tests/metamer/bean/RichTabPanelBean.java
Log:
* scope of bean changed to view
Modified: modules/tests/metamer/trunk/application/src/main/java/org/richfaces/tests/metamer/bean/RichInplaceInputBean.java
===================================================================
--- modules/tests/metamer/trunk/application/src/main/java/org/richfaces/tests/metamer/bean/RichInplaceInputBean.java 2010-12-17 16:48:59 UTC (rev 20661)
+++ modules/tests/metamer/trunk/application/src/main/java/org/richfaces/tests/metamer/bean/RichInplaceInputBean.java 2010-12-17 16:53:56 UTC (rev 20662)
@@ -25,9 +25,9 @@
import javax.annotation.PostConstruct;
import javax.faces.bean.ManagedBean;
-import javax.faces.bean.SessionScoped;
+import javax.faces.bean.ViewScoped;
+
import org.richfaces.component.UIInplaceInput;
-
import org.richfaces.tests.metamer.Attributes;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -39,7 +39,7 @@
* @version $Revision$
*/
@ManagedBean(name = "richInplaceInputBean")
-@SessionScoped
+@ViewScoped
public class RichInplaceInputBean implements Serializable {
private static final long serialVersionUID = -1L;
Modified: modules/tests/metamer/trunk/application/src/main/java/org/richfaces/tests/metamer/bean/RichPanelBean.java
===================================================================
--- modules/tests/metamer/trunk/application/src/main/java/org/richfaces/tests/metamer/bean/RichPanelBean.java 2010-12-17 16:48:59 UTC (rev 20661)
+++ modules/tests/metamer/trunk/application/src/main/java/org/richfaces/tests/metamer/bean/RichPanelBean.java 2010-12-17 16:53:56 UTC (rev 20662)
@@ -25,9 +25,9 @@
import javax.annotation.PostConstruct;
import javax.faces.bean.ManagedBean;
-import javax.faces.bean.SessionScoped;
+import javax.faces.bean.ViewScoped;
+
import org.richfaces.component.UIPanel;
-
import org.richfaces.tests.metamer.Attributes;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -39,7 +39,7 @@
* @version $Revision$
*/
@ManagedBean(name = "richPanelBean")
-@SessionScoped
+@ViewScoped
public class RichPanelBean implements Serializable {
private static final long serialVersionUID = 48122475400649801L;
Modified: modules/tests/metamer/trunk/application/src/main/java/org/richfaces/tests/metamer/bean/RichPanelMenuBean.java
===================================================================
--- modules/tests/metamer/trunk/application/src/main/java/org/richfaces/tests/metamer/bean/RichPanelMenuBean.java 2010-12-17 16:48:59 UTC (rev 20661)
+++ modules/tests/metamer/trunk/application/src/main/java/org/richfaces/tests/metamer/bean/RichPanelMenuBean.java 2010-12-17 16:53:56 UTC (rev 20662)
@@ -25,10 +25,10 @@
import javax.annotation.PostConstruct;
import javax.faces.bean.ManagedBean;
-import javax.faces.bean.SessionScoped;
+import javax.faces.bean.ViewScoped;
+
import org.richfaces.component.UIPanelMenu;
import org.richfaces.event.ItemChangeEvent;
-
import org.richfaces.tests.metamer.Attributes;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -40,7 +40,7 @@
* @version $Revision$
*/
@ManagedBean(name = "richPanelMenuBean")
-@SessionScoped
+@ViewScoped
public class RichPanelMenuBean implements Serializable {
private static final long serialVersionUID = -1L;
Modified: modules/tests/metamer/trunk/application/src/main/java/org/richfaces/tests/metamer/bean/RichPopupPanelBean.java
===================================================================
--- modules/tests/metamer/trunk/application/src/main/java/org/richfaces/tests/metamer/bean/RichPopupPanelBean.java 2010-12-17 16:48:59 UTC (rev 20661)
+++ modules/tests/metamer/trunk/application/src/main/java/org/richfaces/tests/metamer/bean/RichPopupPanelBean.java 2010-12-17 16:53:56 UTC (rev 20662)
@@ -25,9 +25,9 @@
import javax.annotation.PostConstruct;
import javax.faces.bean.ManagedBean;
-import javax.faces.bean.SessionScoped;
+import javax.faces.bean.ViewScoped;
+
import org.richfaces.component.UIPopupPanel;
-
import org.richfaces.tests.metamer.Attributes;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -39,7 +39,7 @@
* @version $Revision$
*/
@ManagedBean(name = "richPopupPanelBean")
-@SessionScoped
+@ViewScoped
public class RichPopupPanelBean implements Serializable {
private static final long serialVersionUID = -1L;
Modified: modules/tests/metamer/trunk/application/src/main/java/org/richfaces/tests/metamer/bean/RichProgressBarBean.java
===================================================================
--- modules/tests/metamer/trunk/application/src/main/java/org/richfaces/tests/metamer/bean/RichProgressBarBean.java 2010-12-17 16:48:59 UTC (rev 20661)
+++ modules/tests/metamer/trunk/application/src/main/java/org/richfaces/tests/metamer/bean/RichProgressBarBean.java 2010-12-17 16:53:56 UTC (rev 20662)
@@ -26,9 +26,9 @@
import javax.annotation.PostConstruct;
import javax.faces.bean.ManagedBean;
-import javax.faces.bean.SessionScoped;
+import javax.faces.bean.ViewScoped;
+
import org.richfaces.component.UIProgressBar;
-
import org.richfaces.tests.metamer.Attributes;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -40,7 +40,7 @@
* @version $Revision$
*/
@ManagedBean(name = "richProgressBarBean")
-@SessionScoped
+@ViewScoped
public class RichProgressBarBean implements Serializable {
private static final long serialVersionUID = -1L;
Modified: modules/tests/metamer/trunk/application/src/main/java/org/richfaces/tests/metamer/bean/RichSelectBean.java
===================================================================
--- modules/tests/metamer/trunk/application/src/main/java/org/richfaces/tests/metamer/bean/RichSelectBean.java 2010-12-17 16:48:59 UTC (rev 20661)
+++ modules/tests/metamer/trunk/application/src/main/java/org/richfaces/tests/metamer/bean/RichSelectBean.java 2010-12-17 16:53:56 UTC (rev 20662)
@@ -28,11 +28,11 @@
import javax.annotation.PostConstruct;
import javax.faces.bean.ManagedBean;
import javax.faces.bean.ManagedProperty;
-import javax.faces.bean.SessionScoped;
+import javax.faces.bean.ViewScoped;
import javax.faces.event.ValueChangeEvent;
import javax.faces.model.SelectItem;
+
import org.richfaces.component.UISelect;
-
import org.richfaces.tests.metamer.Attributes;
import org.richfaces.tests.metamer.model.Capital;
import org.slf4j.Logger;
@@ -45,7 +45,7 @@
* @version $Revision$
*/
@ManagedBean(name = "richSelectBean")
-@SessionScoped
+@ViewScoped
public class RichSelectBean implements Serializable {
private static final long serialVersionUID = -1L;
Modified: modules/tests/metamer/trunk/application/src/main/java/org/richfaces/tests/metamer/bean/RichTabBean.java
===================================================================
--- modules/tests/metamer/trunk/application/src/main/java/org/richfaces/tests/metamer/bean/RichTabBean.java 2010-12-17 16:48:59 UTC (rev 20661)
+++ modules/tests/metamer/trunk/application/src/main/java/org/richfaces/tests/metamer/bean/RichTabBean.java 2010-12-17 16:53:56 UTC (rev 20662)
@@ -25,9 +25,9 @@
import javax.annotation.PostConstruct;
import javax.faces.bean.ManagedBean;
-import javax.faces.bean.SessionScoped;
+import javax.faces.bean.ViewScoped;
+
import org.richfaces.component.html.HtmlTab;
-
import org.richfaces.tests.metamer.Attributes;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -39,7 +39,7 @@
* @version $Revision$
*/
@ManagedBean(name = "richTabBean")
-@SessionScoped
+@ViewScoped
public class RichTabBean implements Serializable {
private static final long serialVersionUID = -1L;
Modified: modules/tests/metamer/trunk/application/src/main/java/org/richfaces/tests/metamer/bean/RichTabPanelBean.java
===================================================================
--- modules/tests/metamer/trunk/application/src/main/java/org/richfaces/tests/metamer/bean/RichTabPanelBean.java 2010-12-17 16:48:59 UTC (rev 20661)
+++ modules/tests/metamer/trunk/application/src/main/java/org/richfaces/tests/metamer/bean/RichTabPanelBean.java 2010-12-17 16:53:56 UTC (rev 20662)
@@ -25,9 +25,9 @@
import javax.annotation.PostConstruct;
import javax.faces.bean.ManagedBean;
-import javax.faces.bean.SessionScoped;
+import javax.faces.bean.ViewScoped;
+
import org.richfaces.component.html.HtmlTabPanel;
-
import org.richfaces.tests.metamer.Attributes;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -39,7 +39,7 @@
* @version $Revision$
*/
@ManagedBean(name = "richTabPanelBean")
-@SessionScoped
+@ViewScoped
public class RichTabPanelBean implements Serializable {
private static final long serialVersionUID = -1L;
14 years
JBoss Rich Faces SVN: r20661 - in modules/tests/metamer/trunk: application/src/main/webapp/components/richInputNumberSlider and 1 other directories.
by richfaces-svn-commits@lists.jboss.org
Author: ppitonak(a)redhat.com
Date: 2010-12-17 11:48:59 -0500 (Fri, 17 Dec 2010)
New Revision: 20661
Modified:
modules/tests/metamer/trunk/application/src/main/java/org/richfaces/tests/metamer/bean/RichInputNumberSliderBean.java
modules/tests/metamer/trunk/application/src/main/webapp/components/richInputNumberSlider/simple.xhtml
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richInputNumberSlider/TestRichSlider.java
Log:
* fixed tests for slider
Modified: modules/tests/metamer/trunk/application/src/main/java/org/richfaces/tests/metamer/bean/RichInputNumberSliderBean.java
===================================================================
--- modules/tests/metamer/trunk/application/src/main/java/org/richfaces/tests/metamer/bean/RichInputNumberSliderBean.java 2010-12-17 16:47:39 UTC (rev 20660)
+++ modules/tests/metamer/trunk/application/src/main/java/org/richfaces/tests/metamer/bean/RichInputNumberSliderBean.java 2010-12-17 16:48:59 UTC (rev 20661)
@@ -58,6 +58,7 @@
attributes.setAttribute("enableManualInput", true);
attributes.setAttribute("inputSize", 3);
+ attributes.setAttribute("maxlength", 10);
attributes.setAttribute("maxValue", 10);
attributes.setAttribute("minValue", -10);
attributes.setAttribute("rendered", true);
Modified: modules/tests/metamer/trunk/application/src/main/webapp/components/richInputNumberSlider/simple.xhtml
===================================================================
--- modules/tests/metamer/trunk/application/src/main/webapp/components/richInputNumberSlider/simple.xhtml 2010-12-17 16:47:39 UTC (rev 20660)
+++ modules/tests/metamer/trunk/application/src/main/webapp/components/richInputNumberSlider/simple.xhtml 2010-12-17 16:48:59 UTC (rev 20661)
@@ -75,9 +75,10 @@
trackClass="#{richInputNumberSliderBean.attributes['trackClass'].value}"
validatorMessage="#{richInputNumberSliderBean.attributes['validatorMessage'].value}"
value="#{richInputNumberSliderBean.attributes['value'].value}"
+ valueChangeListener="#{richBean.valueChangeListener}"
>
- <a4j:ajax render="output"/>
+ <a4j:ajax event="change" render="output"/>
</rich:inputNumberSlider>
Modified: modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richInputNumberSlider/TestRichSlider.java
===================================================================
--- modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richInputNumberSlider/TestRichSlider.java 2010-12-17 16:47:39 UTC (rev 20660)
+++ modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richInputNumberSlider/TestRichSlider.java 2010-12-17 16:48:59 UTC (rev 20661)
@@ -233,7 +233,7 @@
}
@Test
- @Use(field = "delay", ints = {200, 500, 3700})
+ @Use(field = "delay", ints = {300, 500, 3700})
public void testDelay() {
selenium.type(pjq("input[type=text][id$=delayInput]"), delay.toString());
selenium.waitForPageToLoad();
@@ -293,17 +293,17 @@
@Test
public void testImmediate() {
- JQueryLocator immediateInput = pjq("input[type=radio][name$=immediateInput][value=true]");
- selenium.click(immediateInput);
+ selenium.click(pjq("input[type=radio][name$=immediateInput][value=true]"));
selenium.waitForPageToLoad();
String reqTime = selenium.getText(time);
- guardXhr(selenium).type(input, "4");
+ guardXhr(selenium).mouseDownAt(track, new Point(0, 0));
waitGui.failWith("Page was not updated").waitForChange(reqTime, retrieveText.locator(time));
- assertEquals(selenium.getText(output), "4", "Output was not updated.");
- assertPhases(PhaseId.RESTORE_VIEW, PhaseId.APPLY_REQUEST_VALUES, PhaseId.PROCESS_VALIDATIONS, PhaseId.UPDATE_MODEL_VALUES,
- PhaseId.INVOKE_APPLICATION, PhaseId.RENDER_RESPONSE);
+ assertPhases(PhaseId.RESTORE_VIEW, PhaseId.APPLY_REQUEST_VALUES, PhaseId.PROCESS_VALIDATIONS,
+ PhaseId.UPDATE_MODEL_VALUES, PhaseId.INVOKE_APPLICATION, PhaseId.RENDER_RESPONSE);
+ String listenerText = selenium.getText(jq("div#phasesPanel li:eq(2)"));
+ assertEquals(listenerText, "* value changed: 2 -> -10", "Value change listener was not invoked.");
}
@Test
@@ -564,8 +564,8 @@
}
@Test
- public void testShowToolTip() {
- selenium.click(pjq("input[type=radio][name$=showToolTipInput][value=true]"));
+ public void testShowTooltip() {
+ selenium.click(pjq("input[type=radio][name$=showTooltipInput][value=true]"));
selenium.waitForPageToLoad();
assertTrue(selenium.isElementPresent(tooltip), "Tooltip should be present on the page.");
@@ -604,11 +604,11 @@
}
@Test
- public void testToolTipClass() {
- selenium.click(pjq("input[type=radio][name$=showToolTipInput][value=true]"));
+ public void testTooltipClass() {
+ selenium.click(pjq("input[type=radio][name$=showTooltipInput][value=true]"));
selenium.waitForPageToLoad();
- testStyleClass(tooltip, "toolTipClass");
+ testStyleClass(tooltip, "tooltipClass");
}
@Test
@@ -688,7 +688,7 @@
timesArray[i] = sdf.parse(timesList.get(i));
}
- delta = (long) (delay * 0.2);
+ delta = (long) (delay * 0.5);
for (int i = 1; i < timesArray.length - 1; i++) {
long diff = timesArray[i + 1].getTime() - timesArray[i].getTime();
assertTrue(Math.abs(diff - delay) < delta, "Delay " + diff + " is too far from set value (" + delay + ")");
14 years
JBoss Rich Faces SVN: r20660 - branches/enterprise/3.3.1.SP2_RFPL-967/framework/impl/src/main/java/org/ajax4jsf/util.
by richfaces-svn-commits@lists.jboss.org
Author: jbalunas(a)redhat.com
Date: 2010-12-17 11:47:39 -0500 (Fri, 17 Dec 2010)
New Revision: 20660
Modified:
branches/enterprise/3.3.1.SP2_RFPL-967/framework/impl/src/main/java/org/ajax4jsf/util/DocumentBuilderPool.java
Log:
RFPL-967, RF-10035 Switched from ArrayStack to LinkedList
Modified: branches/enterprise/3.3.1.SP2_RFPL-967/framework/impl/src/main/java/org/ajax4jsf/util/DocumentBuilderPool.java
===================================================================
--- branches/enterprise/3.3.1.SP2_RFPL-967/framework/impl/src/main/java/org/ajax4jsf/util/DocumentBuilderPool.java 2010-12-17 16:26:12 UTC (rev 20659)
+++ branches/enterprise/3.3.1.SP2_RFPL-967/framework/impl/src/main/java/org/ajax4jsf/util/DocumentBuilderPool.java 2010-12-17 16:47:39 UTC (rev 20660)
@@ -21,14 +21,13 @@
*/
package org.ajax4jsf.util;
-import java.util.EmptyStackException;
+import java.util.LinkedList;
+import java.util.NoSuchElementException;
import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;
import javax.xml.parsers.ParserConfigurationException;
-import org.apache.commons.collections.ArrayStack;
-
/**
* Manages a shared pool of DocumentBuilders so that there is not a performance
* hit for every request to create.
@@ -47,7 +46,7 @@
* Creates and holds the pool using the Initialization On Demand Holder idiom.
*/
private static class DocumentBuilderPoolHolder {
- static ArrayStack _documentBuilderPool = new ArrayStack(DOC_BUILDER_POOL_SIZE);
+ static LinkedList<DocumentBuilder> _documentBuilderPool = new LinkedList<DocumentBuilder>();
}
/**
@@ -69,7 +68,7 @@
//pop the top builder - if empty it will through EmptyStackException
builder = (DocumentBuilder) DocumentBuilderPoolHolder._documentBuilderPool.pop();
}
- } catch (EmptyStackException e) {
+ } catch (NoSuchElementException e) {
//Stack is empty, create a new builder
builder = DocumentBuilderFactory.newInstance().newDocumentBuilder();
}
14 years
JBoss Rich Faces SVN: r20659 - branches/enterprise/3.3.1.SP2_RFPL-967/framework/impl/src/main/java/org/ajax4jsf/util.
by richfaces-svn-commits@lists.jboss.org
Author: jbalunas(a)redhat.com
Date: 2010-12-17 11:26:12 -0500 (Fri, 17 Dec 2010)
New Revision: 20659
Modified:
branches/enterprise/3.3.1.SP2_RFPL-967/framework/impl/src/main/java/org/ajax4jsf/util/DocumentBuilderPool.java
Log:
RFPL-967, RF-10035 Updated based on review
Modified: branches/enterprise/3.3.1.SP2_RFPL-967/framework/impl/src/main/java/org/ajax4jsf/util/DocumentBuilderPool.java
===================================================================
--- branches/enterprise/3.3.1.SP2_RFPL-967/framework/impl/src/main/java/org/ajax4jsf/util/DocumentBuilderPool.java 2010-12-17 16:17:57 UTC (rev 20658)
+++ branches/enterprise/3.3.1.SP2_RFPL-967/framework/impl/src/main/java/org/ajax4jsf/util/DocumentBuilderPool.java 2010-12-17 16:26:12 UTC (rev 20659)
@@ -36,15 +36,26 @@
* @author balunasj(a)redhat.com
*
*/
-public class DocumentBuilderPool {
+public final class DocumentBuilderPool {
- // How big the pool is
- private static final int POOL_SIZE = 100;
-
- // status array for pool storage
- private static ArrayStack _documentBuilderPool;
+ /**
+ * How big the pool is
+ */
+ private static final int DOC_BUILDER_POOL_SIZE = 100;
/**
+ * Creates and holds the pool using the Initialization On Demand Holder idiom.
+ */
+ private static class DocumentBuilderPoolHolder {
+ static ArrayStack _documentBuilderPool = new ArrayStack(DOC_BUILDER_POOL_SIZE);
+ }
+
+ /**
+ * Private constructor
+ */
+ private DocumentBuilderPool (){}
+
+ /**
* Get a pooled instance of DocumentBuilder
* @return Pooled DocumentBulder
* @throws ParserConfigurationException
@@ -52,22 +63,11 @@
public static DocumentBuilder getDocumentBuilder() throws ParserConfigurationException{
DocumentBuilder builder = null;
- //Check if pool needs to be initialized
- if (_documentBuilderPool == null){
- //Sync to avoid conflicts
- synchronized (DocumentBuilderPool.class) {
- //Second level check
- if (_documentBuilderPool == null){
- _documentBuilderPool = new ArrayStack(POOL_SIZE);
- }
- }
- }
-
try {
//freeze the pool
- synchronized (_documentBuilderPool) {
+ synchronized (DocumentBuilderPoolHolder._documentBuilderPool) {
//pop the top builder - if empty it will through EmptyStackException
- builder = (DocumentBuilder) _documentBuilderPool.pop();
+ builder = (DocumentBuilder) DocumentBuilderPoolHolder._documentBuilderPool.pop();
}
} catch (EmptyStackException e) {
//Stack is empty, create a new builder
@@ -84,14 +84,14 @@
public static void returnDocumentBuilder(DocumentBuilder builder) {
//validate the builder
if (null != builder) {
- synchronized (_documentBuilderPool) {
+ synchronized (DocumentBuilderPoolHolder._documentBuilderPool) {
//only add if the pool is full
- if (_documentBuilderPool.size() < POOL_SIZE) {
+ if (DocumentBuilderPoolHolder._documentBuilderPool.size() < DOC_BUILDER_POOL_SIZE) {
//reset the builder to initial state
builder.reset();
//push the builder back
- _documentBuilderPool.push(builder);
+ DocumentBuilderPoolHolder._documentBuilderPool.push(builder);
}
}
}
14 years
JBoss Rich Faces SVN: r20658 - trunk/ui/input/ui/src/main/resources/META-INF/resources/org.richfaces.
by richfaces-svn-commits@lists.jboss.org
Author: konstantin.mishin
Date: 2010-12-17 11:17:57 -0500 (Fri, 17 Dec 2010)
New Revision: 20658
Modified:
trunk/ui/input/ui/src/main/resources/META-INF/resources/org.richfaces/fileupload.js
Log:
RF-9971
Modified: trunk/ui/input/ui/src/main/resources/META-INF/resources/org.richfaces/fileupload.js
===================================================================
--- trunk/ui/input/ui/src/main/resources/META-INF/resources/org.richfaces/fileupload.js 2010-12-17 15:59:45 UTC (rev 20657)
+++ trunk/ui/input/ui/src/main/resources/META-INF/resources/org.richfaces/fileupload.js 2010-12-17 16:17:57 UTC (rev 20658)
@@ -173,7 +173,8 @@
var documentElement = contentDocument.documentElement;
var responseStatus, id;
if (documentElement.tagName.toUpperCase() == "PARTIAL-RESPONSE") {
- responseStatus = ITEM_STATE.DONE;
+ var errors = jQuery(documentElement).children("error");
+ responseStatus = errors.length > 0 ? ITEM_STATE.SERVER_ERROR: ITEM_STATE.DONE;
} else if ((id = documentElement.id) && id.indexOf(UID + this.loadableItem.uid + ":") == 0) {
responseStatus = id.split(":")[1];
}
14 years