JBoss Rich Faces SVN: r20627 - in trunk: ui/iteration/ui/src/main/config and 2 other directories.
by richfaces-svn-commits@lists.jboss.org
Author: nbelaevski
Date: 2010-12-16 15:23:35 -0500 (Thu, 16 Dec 2010)
New Revision: 20627
Added:
trunk/ui/iteration/ui/src/main/java/org/richfaces/convert/StringSequenceRowKeyConverter.java
Removed:
trunk/ui/iteration/ui/src/main/java/org/richfaces/convert/ObjectSequenceRowKeyConverter.java
Modified:
trunk/core/api/src/main/java/org/richfaces/component/ComponentIterators.java
trunk/ui/iteration/ui/src/main/config/faces-config.xml
trunk/ui/iteration/ui/src/main/java/org/richfaces/model/ClassicTreeNodeDataModelImpl.java
Log:
Tree converter names refactoring
Added TODO for ComponentIterators class
Modified: trunk/core/api/src/main/java/org/richfaces/component/ComponentIterators.java
===================================================================
--- trunk/core/api/src/main/java/org/richfaces/component/ComponentIterators.java 2010-12-16 19:43:06 UTC (rev 20626)
+++ trunk/core/api/src/main/java/org/richfaces/component/ComponentIterators.java 2010-12-16 20:23:35 UTC (rev 20627)
@@ -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: trunk/ui/iteration/ui/src/main/config/faces-config.xml
===================================================================
--- trunk/ui/iteration/ui/src/main/config/faces-config.xml 2010-12-16 19:43:06 UTC (rev 20626)
+++ trunk/ui/iteration/ui/src/main/config/faces-config.xml 2010-12-16 20:23:35 UTC (rev 20627)
@@ -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>
Deleted: trunk/ui/iteration/ui/src/main/java/org/richfaces/convert/ObjectSequenceRowKeyConverter.java
===================================================================
--- trunk/ui/iteration/ui/src/main/java/org/richfaces/convert/ObjectSequenceRowKeyConverter.java 2010-12-16 19:43:06 UTC (rev 20626)
+++ trunk/ui/iteration/ui/src/main/java/org/richfaces/convert/ObjectSequenceRowKeyConverter.java 2010-12-16 20:23:35 UTC (rev 20627)
@@ -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: trunk/ui/iteration/ui/src/main/java/org/richfaces/convert/StringSequenceRowKeyConverter.java (from rev 20604, trunk/ui/iteration/ui/src/main/java/org/richfaces/convert/ObjectSequenceRowKeyConverter.java)
===================================================================
--- trunk/ui/iteration/ui/src/main/java/org/richfaces/convert/StringSequenceRowKeyConverter.java (rev 0)
+++ trunk/ui/iteration/ui/src/main/java/org/richfaces/convert/StringSequenceRowKeyConverter.java 2010-12-16 20:23:35 UTC (rev 20627)
@@ -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: trunk/ui/iteration/ui/src/main/java/org/richfaces/model/ClassicTreeNodeDataModelImpl.java
===================================================================
--- trunk/ui/iteration/ui/src/main/java/org/richfaces/model/ClassicTreeNodeDataModelImpl.java 2010-12-16 19:43:06 UTC (rev 20626)
+++ trunk/ui/iteration/ui/src/main/java/org/richfaces/model/ClassicTreeNodeDataModelImpl.java 2010-12-16 20:23:35 UTC (rev 20627)
@@ -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;
14 years
JBoss Rich Faces SVN: r20626 - trunk/ui/input/ui/src/main/java/org/richfaces/context.
by richfaces-svn-commits@lists.jboss.org
Author: konstantin.mishin
Date: 2010-12-16 14:43:06 -0500 (Thu, 16 Dec 2010)
New Revision: 20626
Modified:
trunk/ui/input/ui/src/main/java/org/richfaces/context/FileUploadPartialViewContextFactory.java
Log:
RF-6590
Modified: trunk/ui/input/ui/src/main/java/org/richfaces/context/FileUploadPartialViewContextFactory.java
===================================================================
--- trunk/ui/input/ui/src/main/java/org/richfaces/context/FileUploadPartialViewContextFactory.java 2010-12-16 19:19:06 UTC (rev 20625)
+++ trunk/ui/input/ui/src/main/java/org/richfaces/context/FileUploadPartialViewContextFactory.java 2010-12-16 19:43:06 UTC (rev 20626)
@@ -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,
14 years
JBoss Rich Faces SVN: r20625 - 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-16 14:19:06 -0500 (Thu, 16 Dec 2010)
New Revision: 20625
Modified:
trunk/ui/input/ui/src/main/resources/META-INF/resources/org.richfaces/inputNumberSlider.js
trunk/ui/input/ui/src/main/resources/META-INF/resources/org.richfaces/inputNumberSpinner.js
Log:
RF-9913
Modified: trunk/ui/input/ui/src/main/resources/META-INF/resources/org.richfaces/inputNumberSlider.js
===================================================================
--- trunk/ui/input/ui/src/main/resources/META-INF/resources/org.richfaces/inputNumberSlider.js 2010-12-16 18:10:56 UTC (rev 20624)
+++ trunk/ui/input/ui/src/main/resources/META-INF/resources/org.richfaces/inputNumberSlider.js 2010-12-16 19:19:06 UTC (rev 20625)
@@ -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: trunk/ui/input/ui/src/main/resources/META-INF/resources/org.richfaces/inputNumberSpinner.js
===================================================================
--- trunk/ui/input/ui/src/main/resources/META-INF/resources/org.richfaces/inputNumberSpinner.js 2010-12-16 18:10:56 UTC (rev 20624)
+++ trunk/ui/input/ui/src/main/resources/META-INF/resources/org.richfaces/inputNumberSpinner.js 2010-12-16 19:19:06 UTC (rev 20625)
@@ -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) {
14 years
JBoss Rich Faces SVN: r20624 - in branches/RF-7654: core/api/src/main/java/org/ajax4jsf/component and 41 other directories.
by richfaces-svn-commits@lists.jboss.org
Author: alexsmirnov
Date: 2010-12-16 13:10:56 -0500 (Thu, 16 Dec 2010)
New Revision: 20624
Added:
branches/RF-7654/core/api/src/test/java/org/richfaces/renderkit/util/HtmlDimensionsTest.java
branches/RF-7654/examples/richfaces-showcase/src/main/java/org/richfaces/demo/dragdrop/
branches/RF-7654/examples/richfaces-showcase/src/main/java/org/richfaces/demo/dragdrop/DragDropBean.java
branches/RF-7654/examples/richfaces-showcase/src/main/java/org/richfaces/demo/dragdrop/DragDropEventBean.java
branches/RF-7654/examples/richfaces-showcase/src/main/java/org/richfaces/demo/dragdrop/Framework.java
branches/RF-7654/examples/richfaces-showcase/src/main/webapp/images/icons/new.gif
branches/RF-7654/examples/richfaces-showcase/src/main/webapp/images/icons/palette_edit.gif
branches/RF-7654/examples/richfaces-showcase/src/main/webapp/images/icons/print.gif
branches/RF-7654/examples/richfaces-showcase/src/main/webapp/images/icons/print_edit.gif
branches/RF-7654/examples/richfaces-showcase/src/main/webapp/images/icons/print_preview.gif
branches/RF-7654/examples/richfaces-showcase/src/main/webapp/images/icons/search_item.gif
branches/RF-7654/examples/richfaces-showcase/src/main/webapp/images/icons/timer_task.gif
branches/RF-7654/examples/richfaces-showcase/src/main/webapp/images/icons/webapp_session_config.gif
branches/RF-7654/examples/richfaces-showcase/src/main/webapp/images/icons/webapp_welcome.gif
branches/RF-7654/examples/richfaces-showcase/src/main/webapp/images/icons/yellow_lamp.gif
branches/RF-7654/examples/richfaces-showcase/src/main/webapp/richfaces/dragDrop/
branches/RF-7654/examples/richfaces-showcase/src/main/webapp/richfaces/dragDrop/dragDrop.xhtml
branches/RF-7654/examples/richfaces-showcase/src/main/webapp/richfaces/dragDrop/samples/
branches/RF-7654/examples/richfaces-showcase/src/main/webapp/richfaces/dragDrop/samples/dragDrop-sample.xhtml
branches/RF-7654/ui/output/ui/src/main/java/org/richfaces/component/AbstractPanel.java
Removed:
branches/RF-7654/examples/richfaces-showcase/src/main/java/org/richfaces/demo/dragdrop/DragDropBean.java
branches/RF-7654/examples/richfaces-showcase/src/main/java/org/richfaces/demo/dragdrop/DragDropEventBean.java
branches/RF-7654/examples/richfaces-showcase/src/main/java/org/richfaces/demo/dragdrop/Framework.java
branches/RF-7654/examples/richfaces-showcase/src/main/webapp/richfaces/dragDrop/dragDrop.xhtml
branches/RF-7654/examples/richfaces-showcase/src/main/webapp/richfaces/dragDrop/samples/
branches/RF-7654/examples/richfaces-showcase/src/main/webapp/richfaces/dragDrop/samples/dragDrop-sample.xhtml
branches/RF-7654/ui/output/ui/src/main/java/org/richfaces/component/UIPanel.java
Modified:
branches/RF-7654/
branches/RF-7654/core/api/src/main/java/org/ajax4jsf/component/AjaxClientBehavior.java
branches/RF-7654/core/api/src/main/java/org/ajax4jsf/context/AjaxContext.java
branches/RF-7654/core/api/src/main/java/org/richfaces/renderkit/util/CoreAjaxRendererUtils.java
branches/RF-7654/core/api/src/main/java/org/richfaces/renderkit/util/HtmlDimensions.java
branches/RF-7654/core/api/src/main/java/org/richfaces/resource/ResourceFactory.java
branches/RF-7654/core/impl/src/main/java/org/ajax4jsf/context/AjaxContextImpl.java
branches/RF-7654/core/impl/src/main/java/org/richfaces/resource/ResourceFactoryImpl.java
branches/RF-7654/core/impl/src/main/resources/META-INF/resources/richfaces.js
branches/RF-7654/dist/readme-ui.txt
branches/RF-7654/examples/dnd-demo/src/main/java/org/demo/DataBean.java
branches/RF-7654/examples/richfaces-showcase/pom.xml
branches/RF-7654/examples/richfaces-showcase/src/main/java/org/richfaces/demo/calendar/CalendarBean.java
branches/RF-7654/examples/richfaces-showcase/src/main/resources/org/richfaces/demo/data/common/navigation.xml
branches/RF-7654/examples/richfaces-showcase/src/main/webapp-gae/WEB-INF/appengine-web.xml
branches/RF-7654/examples/richfaces-showcase/src/main/webapp-gae/WEB-INF/web.xml
branches/RF-7654/examples/richfaces-showcase/src/main/webapp/WEB-INF/web.xml
branches/RF-7654/examples/richfaces-showcase/src/main/webapp/richfaces/dropDownMenu/samples/sideMenu-sample.xhtml
branches/RF-7654/examples/richfaces-showcase/src/main/webapp/richfaces/toolBar/samples/toolBar-sample.xhtml
branches/RF-7654/examples/richfaces-showcase/src/main/webapp/richfaces/toolBar/samples/toolBarIcons-sample.xhtml
branches/RF-7654/ui/common/ui/src/main/java/org/richfaces/renderkit/AjaxChildrenRenderer.java
branches/RF-7654/ui/common/ui/src/main/java/org/richfaces/renderkit/util/AjaxRendererUtils.java
branches/RF-7654/ui/core/ui/src/main/java/org/ajax4jsf/component/behavior/AjaxBehavior.java
branches/RF-7654/ui/core/ui/src/main/java/org/richfaces/component/AbstractMediaOutput.java
branches/RF-7654/ui/core/ui/src/main/java/org/richfaces/resource/MediaOutputResource.java
branches/RF-7654/ui/dnd/api/src/main/java/org/richfaces/event/DropEvent.java
branches/RF-7654/ui/dnd/ui/src/main/java/org/richfaces/renderkit/DropBehaviorRendererBase.java
branches/RF-7654/ui/dnd/ui/src/main/resources/META-INF/resources/org.richfaces/dnd-draggable.js
branches/RF-7654/ui/dnd/ui/src/main/resources/META-INF/resources/org.richfaces/dnd-droppable.js
branches/RF-7654/ui/dnd/ui/src/main/resources/META-INF/resources/org.richfaces/dnd-indicator.js
branches/RF-7654/ui/dnd/ui/src/main/resources/META-INF/resources/org.richfaces/dnd-manager.js
branches/RF-7654/ui/input/ui/src/main/java/org/richfaces/renderkit/InplaceSelectRendererBase.java
branches/RF-7654/ui/input/ui/src/main/resources/META-INF/resources/org.richfaces/calendar.js
branches/RF-7654/ui/input/ui/src/main/resources/META-INF/resources/org.richfaces/inputNumberSlider.ecss
branches/RF-7654/ui/input/ui/src/main/resources/META-INF/resources/org.richfaces/inputNumberSlider.js
branches/RF-7654/ui/input/ui/src/main/templates/inplaceSelect.template.xml
branches/RF-7654/ui/iteration/ui/src/main/java/org/richfaces/component/UIDataTableBase.java
branches/RF-7654/ui/iteration/ui/src/main/java/org/richfaces/renderkit/AbstractTableBaseRenderer.java
branches/RF-7654/ui/iteration/ui/src/main/java/org/richfaces/renderkit/AbstractTableRenderer.java
branches/RF-7654/ui/iteration/ui/src/main/java/org/richfaces/renderkit/CollapsibleSubTableRenderer.java
branches/RF-7654/ui/iteration/ui/src/main/java/org/richfaces/renderkit/DataTableRenderer.java
branches/RF-7654/ui/iteration/ui/src/main/resources/META-INF/resources/org.richfaces/datatable.ecss
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/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/AbstractTooltip.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/UIPanelMenuItem.java
branches/RF-7654/ui/output/ui/src/main/java/org/richfaces/component/UITogglePanel.java
branches/RF-7654/ui/output/ui/src/main/java/org/richfaces/component/UITooltip.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/PanelBaseRenderer.java
branches/RF-7654/ui/output/ui/src/main/java/org/richfaces/renderkit/html/ToolbarRendererBase.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/templates/menugroup.template.xml
branches/RF-7654/ui/output/ui/src/main/templates/menuitem.template.xml
branches/RF-7654/ui/output/ui/src/main/templates/toolbar.template.xml
branches/RF-7654/ui/output/ui/src/test/java/org/richfaces/renderkit/html/PanelRendererTest.java
Log:
Merged revisions 20572-20573,20578-20581,20591-20599,20602-20605,20611-20617,20622 via svnmerge from
https://svn.jboss.org/repos/richfaces/trunk
.......
r20572 | pyaschenko | 2010-12-15 01:58:08 -0800 (Wed, 15 Dec 2010) | 2 lines
https://issues.jboss.org/browse/RF-9766
client side code review
.......
r20573 | Alex.Kolonitsky | 2010-12-15 02:37:50 -0800 (Wed, 15 Dec 2010) | 1 line
RF-10002: Rename attribute disableImplicitRender to limitRender
.......
r20578 | pyaschenko | 2010-12-15 05:04:17 -0800 (Wed, 15 Dec 2010) | 1 line
https://issues.jboss.org/browse/RF-9981
.......
r20579 | nbelaevski | 2010-12-15 05:32:31 -0800 (Wed, 15 Dec 2010) | 1 line
https://issues.jboss.org/browse/RF-10008
.......
r20580 | Alex.Kolonitsky | 2010-12-15 05:59:15 -0800 (Wed, 15 Dec 2010) | 1 line
RF-9945: Taglib: toggleControl has no attributes
.......
r20581 | nbelaevski | 2010-12-15 06:49:18 -0800 (Wed, 15 Dec 2010) | 1 line
https://issues.jboss.org/browse/RF-9822
.......
r20591 | abelevich | 2010-12-15 09:32:52 -0800 (Wed, 15 Dec 2010) | 1 line
RF-9930, RF-9826
.......
r20592 | konstantin.mishin | 2010-12-15 09:57:11 -0800 (Wed, 15 Dec 2010) | 1 line
RF-9900
.......
r20593 | abelevich | 2010-12-15 11:06:55 -0800 (Wed, 15 Dec 2010) | 1 line
fix possible issue with drag drop columns in the dataTable
.......
r20594 | konstantin.mishin | 2010-12-15 11:30:32 -0800 (Wed, 15 Dec 2010) | 1 line
small fix
.......
r20595 | nbelaevski | 2010-12-15 14:07:06 -0800 (Wed, 15 Dec 2010) | 1 line
Removed unnecessary calls to jQuery.end() in richfaces.js
.......
r20596 | nbelaevski | 2010-12-15 15:02:43 -0800 (Wed, 15 Dec 2010) | 1 line
Fixed compilation error in dnd-demo
.......
r20597 | nbelaevski | 2010-12-15 15:03:53 -0800 (Wed, 15 Dec 2010) | 1 line
UIPanel refactoring & added missing attributes
.......
r20598 | nbelaevski | 2010-12-15 15:05:47 -0800 (Wed, 15 Dec 2010) | 1 line
DnD showcase demo initial check-in
.......
r20599 | nbelaevski | 2010-12-15 16:49:47 -0800 (Wed, 15 Dec 2010) | 3 lines
Added maven-gae-plugin configuration
Updated resource mappings
Switched state saving to client
.......
r20602 | abelevich | 2010-12-16 02:22:22 -0800 (Thu, 16 Dec 2010) | 1 line
RF-9846
.......
r20603 | amarkhel | 2010-12-16 02:27:39 -0800 (Thu, 16 Dec 2010) | 3 lines
RF-9976 Toolbar group: attributes itemStyle and itemClass ignored
- formatSize method was added into HtmlDimensions.
- Markup of Toolbar was changed in order to support particular width for column through style attribute.
.......
r20604 | abelevich | 2010-12-16 02:43:45 -0800 (Thu, 16 Dec 2010) | 1 line
RF-9980
.......
r20605 | pyaschenko | 2010-12-16 03:26:15 -0800 (Thu, 16 Dec 2010) | 1 line
cleanup fix: call destroy method correctly
.......
r20611 | ilya_shaikovsky | 2010-12-16 06:24:25 -0800 (Thu, 16 Dec 2010) | 1 line
https://issues.jboss.org/browse/RF-10027
.......
r20612 | ilya_shaikovsky | 2010-12-16 06:33:55 -0800 (Thu, 16 Dec 2010) | 1 line
https://issues.jboss.org/browse/RF-10028
.......
r20613 | ilya_shaikovsky | 2010-12-16 06:51:35 -0800 (Thu, 16 Dec 2010) | 1 line
https://issues.jboss.org/browse/RF-10029
.......
r20614 | ilya_shaikovsky | 2010-12-16 07:21:24 -0800 (Thu, 16 Dec 2010) | 1 line
https://issues.jboss.org/browse/RF-9825
.......
r20615 | ilya_shaikovsky | 2010-12-16 07:25:30 -0800 (Thu, 16 Dec 2010) | 1 line
https://issues.jboss.org/browse/RF-9825
.......
r20616 | amarkhel | 2010-12-16 07:32:54 -0800 (Thu, 16 Dec 2010) | 2 lines
RF-9989 Menu group: StringIndexOutOfBoundsException for attribute icon
- isStringEmpty method was implemented instead of CDK isEmpty method.
.......
r20617 | ilya_shaikovsky | 2010-12-16 07:33:15 -0800 (Thu, 16 Dec 2010) | 1 line
navigation.xml corrections
.......
r20622 | nbelaevski | 2010-12-16 09:34:36 -0800 (Thu, 16 Dec 2010) | 1 line
https://issues.jboss.org/browse/RF-10011
.......
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-20570
+ /branches/RF-7817:1-19154 /branches/RF-8742:1-19867 /branches/RF-9309:1-19112,19378 /trunk:1-20623
Modified: branches/RF-7654/core/api/src/main/java/org/ajax4jsf/component/AjaxClientBehavior.java
===================================================================
--- branches/RF-7654/core/api/src/main/java/org/ajax4jsf/component/AjaxClientBehavior.java 2010-12-16 17:43:00 UTC (rev 20623)
+++ branches/RF-7654/core/api/src/main/java/org/ajax4jsf/component/AjaxClientBehavior.java 2010-12-16 18:10:56 UTC (rev 20624)
@@ -35,10 +35,6 @@
public String getStatus();
- public String getOnevent();
-
- public void setOnevent(String onevent);
-
public String getOnerror();
public void setOnerror(String onerror);
Modified: branches/RF-7654/core/api/src/main/java/org/ajax4jsf/context/AjaxContext.java
===================================================================
--- branches/RF-7654/core/api/src/main/java/org/ajax4jsf/context/AjaxContext.java 2010-12-16 17:43:00 UTC (rev 20623)
+++ branches/RF-7654/core/api/src/main/java/org/ajax4jsf/context/AjaxContext.java 2010-12-16 18:10:56 UTC (rev 20624)
@@ -47,7 +47,7 @@
private static final String DEFAULT_CONTEXT_CLASS = "org.ajax4jsf.context.AjaxContextImpl";
private static Map<ClassLoader, Class<? extends AjaxContext>> ajaxContextClasses =
new HashMap<ClassLoader, Class<? extends AjaxContext>>();
- private boolean disableImplicitRender;
+ private boolean limitRender;
protected AjaxContext() { }
@@ -125,12 +125,12 @@
public abstract void setSubmittedRegionClientId(String submittedClientId);
- public boolean isDisableImplicitRender() {
- return disableImplicitRender;
+ public boolean isLimitRender() {
+ return limitRender;
}
- public void setDisableImplicitRender(boolean disableImplicitRender) {
- this.disableImplicitRender = disableImplicitRender;
+ public void setLimitRender(boolean limitRender) {
+ this.limitRender = limitRender;
}
/**
Modified: branches/RF-7654/core/api/src/main/java/org/richfaces/renderkit/util/CoreAjaxRendererUtils.java
===================================================================
--- branches/RF-7654/core/api/src/main/java/org/richfaces/renderkit/util/CoreAjaxRendererUtils.java 2010-12-16 17:43:00 UTC (rev 20623)
+++ branches/RF-7654/core/api/src/main/java/org/richfaces/renderkit/util/CoreAjaxRendererUtils.java 2010-12-16 18:10:56 UTC (rev 20624)
@@ -280,14 +280,11 @@
if (component instanceof AjaxComponent) {
result = ((AjaxComponent) component).isLimitRender();
} else {
- try {
- result = ((Boolean) component.getAttributes().get(LIMITRENDER_ATTR_NAME)).booleanValue();
- } catch (NullPointerException e) {
-
- // NullPointer - ignore ...
- } catch (ClassCastException e1) {
-
- // not Boolean - false ...
+ Object limitRenderObject = component.getAttributes().get(LIMITRENDER_ATTR_NAME);
+ if (limitRenderObject instanceof Boolean) {
+ result = ((Boolean) limitRenderObject).booleanValue();
+ } else {
+ result = Boolean.valueOf(String.valueOf(limitRenderObject));
}
}
Modified: branches/RF-7654/core/api/src/main/java/org/richfaces/renderkit/util/HtmlDimensions.java
===================================================================
--- branches/RF-7654/core/api/src/main/java/org/richfaces/renderkit/util/HtmlDimensions.java 2010-12-16 17:43:00 UTC (rev 20623)
+++ branches/RF-7654/core/api/src/main/java/org/richfaces/renderkit/util/HtmlDimensions.java 2010-12-16 18:10:56 UTC (rev 20624)
@@ -87,4 +87,17 @@
return v;
}
+
+ public static String formatSize(String size) {
+ if (size != null) {
+ String incomingSize = size.trim();
+ if (!incomingSize.isEmpty()) {
+ char lastChar = incomingSize.charAt(incomingSize.length() - 1);
+ if (Character.isDigit(lastChar)) {
+ return incomingSize + "px";
+ }
+ }
+ }
+ return size;
+ }
}
Modified: branches/RF-7654/core/api/src/main/java/org/richfaces/resource/ResourceFactory.java
===================================================================
--- branches/RF-7654/core/api/src/main/java/org/richfaces/resource/ResourceFactory.java 2010-12-16 17:43:00 UTC (rev 20623)
+++ branches/RF-7654/core/api/src/main/java/org/richfaces/resource/ResourceFactory.java 2010-12-16 18:10:56 UTC (rev 20624)
@@ -44,8 +44,4 @@
public abstract Resource createResource(FacesContext context, ResourceRequestData resourceData);
- public abstract Resource createResource(UserResource resource);
-
- public abstract Resource createResource(Java2DUserResource resource);
-
}
Copied: branches/RF-7654/core/api/src/test/java/org/richfaces/renderkit/util/HtmlDimensionsTest.java (from rev 20622, trunk/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 (rev 0)
+++ branches/RF-7654/core/api/src/test/java/org/richfaces/renderkit/util/HtmlDimensionsTest.java 2010-12-16 18:10:56 UTC (rev 20624)
@@ -0,0 +1,53 @@
+/*
+ * 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.renderkit.util;
+
+import org.junit.Assert;
+import org.junit.Test;
+
+/**
+ * @author amarkhel
+ *
+ */
+public class HtmlDimensionsTest {
+
+ @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(" "));
+ }
+}
Modified: branches/RF-7654/core/impl/src/main/java/org/ajax4jsf/context/AjaxContextImpl.java
===================================================================
--- branches/RF-7654/core/impl/src/main/java/org/ajax4jsf/context/AjaxContextImpl.java 2010-12-16 17:43:00 UTC (rev 20623)
+++ branches/RF-7654/core/impl/src/main/java/org/ajax4jsf/context/AjaxContextImpl.java 2010-12-16 18:10:56 UTC (rev 20624)
@@ -302,8 +302,8 @@
}
// Is that component limit to list ?
- if (Boolean.TRUE.equals(component.getAttributes().get("disableImplicitRender"))) {
- setDisableImplicitRender(true);
+ if (Boolean.TRUE.equals(component.getAttributes().get("limitRender"))) {
+ setLimitRender(true);
}
}
Modified: branches/RF-7654/core/impl/src/main/java/org/richfaces/resource/ResourceFactoryImpl.java
===================================================================
--- branches/RF-7654/core/impl/src/main/java/org/richfaces/resource/ResourceFactoryImpl.java 2010-12-16 17:43:00 UTC (rev 20623)
+++ branches/RF-7654/core/impl/src/main/java/org/richfaces/resource/ResourceFactoryImpl.java 2010-12-16 18:10:56 UTC (rev 20624)
@@ -476,7 +476,7 @@
return Collections.unmodifiableSet(mappedResourceDataMap.keySet());
}
- public Resource createResource(Java2DUserResource resource) {
+ protected Resource createResource(Java2DUserResource resource) {
boolean cacheable = isCacheableSet(resource.getClass());
boolean versioned = isVersionedSet(resource.getClass());
@@ -488,7 +488,7 @@
}
}
- public Resource createResource(UserResource resource) {
+ protected Resource createResource(UserResource resource) {
boolean cacheable = isCacheableSet(resource.getClass());
boolean versioned = isVersionedSet(resource.getClass());
Modified: branches/RF-7654/core/impl/src/main/resources/META-INF/resources/richfaces.js
===================================================================
--- branches/RF-7654/core/impl/src/main/resources/META-INF/resources/richfaces.js 2010-12-16 17:43:00 UTC (rev 20623)
+++ branches/RF-7654/core/impl/src/main/resources/META-INF/resources/richfaces.js 2010-12-16 18:10:56 UTC (rev 20624)
@@ -33,7 +33,7 @@
}
}
return element;
- }
+ };
// get RichFaces component object by component id or DOM element or jQuery object
richfaces.$ = function (source) {
@@ -42,7 +42,7 @@
if (element) {
return (element[richfaces.RICH_CONTAINER] || {})["component"];
}
- }
+ };
richfaces.$$ = function(componentName, element)
{
@@ -53,25 +53,23 @@
else
element = element.parentNode;
}
- }
+ };
// find component and call his method
richfaces.invokeMethod = function(source, method) {
- var c = richfaces.$(source);
- if (c) {
- var f = c[method];
- if (typeof f == "function") {
- return f.apply(c, Array.prototype.slice.call(arguments, 2));
- }
+ var c = richfaces.$(source);
+ var f;
+ if (c && typeof (f=c[method]) == "function") {
+ return f.apply(c, Array.prototype.slice.call(arguments, 2));
}
- }
+ };
//dom cleaner
richfaces.cleanComponent = function (source) {
var component = richfaces.$(source);
if (component) {
- richfaces.invokeMethod(component, "destroy");
- richfaces.invokeMethod(component, "detach", source);
+ component.destroy();
+ component.detach(source);
}
};
@@ -88,7 +86,7 @@
richfaces.cleanComponent(e);
}
}
- }
+ };
//form.js
richfaces.submitForm = function(form, parameters, target) {
@@ -350,7 +348,6 @@
var getJSONData = function(extensionElement, elementName) {
var dataString = jQuery.trim(extensionElement.children(elementName).text());
- extensionElement.end();
return richfaces.parseJSON(dataString);
};
@@ -463,7 +460,6 @@
var xml = getExtensionResponseElement(event.responseXML);
var serverHandler = createEventHandler(xml.children(event.type).text());
- xml.end();
if (clientHandler) {
clientHandler.call(window, event);
Modified: branches/RF-7654/dist/readme-ui.txt
===================================================================
--- branches/RF-7654/dist/readme-ui.txt 2010-12-16 17:43:00 UTC (rev 20623)
+++ branches/RF-7654/dist/readme-ui.txt 2010-12-16 18:10:56 UTC (rev 20624)
@@ -85,6 +85,7 @@
rich:panel
rich:popupPanel
rich:tabPanel
+rich:tab
rich:togglePanel
rich:toggleControl
rich:togglePanelItem
@@ -92,15 +93,51 @@
rich:accordion
rich:accordionItem
rich:progressBar
+rich:tooltip
+rich:message
+rich:messages
---------------------------------
+Menus:
+---------------------------------
+rich:toolbar
+rich:dropDownMenu
+rich:menuGroup
+rich:menuItem
+rich:menuSeparator
+rich:panelMenu
+rich:panelMenuGroup
+rich:panelMenuItem
+
+---------------------------------
Input:
---------------------------------
rich:autocomplete
rich:inplaceInput
+rich:inplaceSelect
rich:inputNumberSlider
rich:inputNumberSpinner
+rich:select
+rich:calendar
+rich:fileUpload
+---------------------------------
+Trees:
+---------------------------------
+rich:tree
+rich:treeNode
+rich:treeModelAdaptor
+rich:treeModelRecursiveAdaptor
+
+---------------------------------
+Drag'n'Drop:
+---------------------------------
+NOTE: that names really could be renaimed. so refer to jira's and docs for more info if having problems with name
+rich:dragSource
+rich:dropTarget
+rich:dragIndicator
+
+
Learn more
----------
RichFaces Project - http://www.jboss.org/richfaces
Modified: branches/RF-7654/examples/dnd-demo/src/main/java/org/demo/DataBean.java
===================================================================
--- branches/RF-7654/examples/dnd-demo/src/main/java/org/demo/DataBean.java 2010-12-16 17:43:00 UTC (rev 20623)
+++ branches/RF-7654/examples/dnd-demo/src/main/java/org/demo/DataBean.java 2010-12-16 18:10:56 UTC (rev 20624)
@@ -54,7 +54,7 @@
}
public void processEvent(DropEvent event) {
- String value = (String)event.getDragSource().getDragValue();
+ String value = (String)event.getDragValue();
dropValues.add(value);
System.out.println("DataBean.processEvent()");
}
Modified: branches/RF-7654/examples/richfaces-showcase/pom.xml
===================================================================
--- branches/RF-7654/examples/richfaces-showcase/pom.xml 2010-12-16 17:43:00 UTC (rev 20623)
+++ branches/RF-7654/examples/richfaces-showcase/pom.xml 2010-12-16 18:10:56 UTC (rev 20624)
@@ -18,6 +18,7 @@
<name>Richfaces Examples: Richfaces Showcase Application</name>
<properties>
+ <gae.version>1.4.0</gae.version>
</properties>
<dependencies>
@@ -97,6 +98,25 @@
</webResources>
</configuration>
</plugin>
+ <plugin>
+ <groupId>net.kindleit</groupId>
+ <artifactId>maven-gae-plugin</artifactId>
+ <version>0.7.3</version>
+ <dependencies>
+ <dependency>
+ <groupId>net.kindleit</groupId>
+ <artifactId>gae-runtime</artifactId>
+ <version>${gae.version}</version>
+ <type>pom</type>
+ <exclusions>
+ <exclusion>
+ <groupId>com.google.appengine.orm</groupId>
+ <artifactId>jdo2-api</artifactId>
+ </exclusion>
+ </exclusions>
+ </dependency>
+ </dependencies>
+ </plugin>
</plugins>
</build>
@@ -223,16 +243,16 @@
</includedContentTypes>
<fileNameMappings>
<property>
- <name>^\Qorg.richfaces.renderkit.html\E</name>
- <value>org.richfaces/images</value>
+ <name>^.*showcase.*/([^/]+\.css)$</name>
+ <value>org.richfaces.showcase.css/$1</value>
</property>
<property>
- <name>^\Qorg.richfaces.renderkit.html.images\E</name>
- <value>org.richfaces/images</value>
+ <name>^.+/([^/]+\.(png|gif|jpg))$</name>
+ <value>org.richfaces.images/$1</value>
</property>
<property>
- <name>^css/</name>
- <value>org.richfaces/css/</value>
+ <name>^.+/([^/]+\.css)$</name>
+ <value>org.richfaces.css/$1</value>
</property>
</fileNameMappings>
</configuration>
@@ -370,6 +390,30 @@
</dependency>
</dependencies>
</profile>
+ <profile>
+ <id>unpack-gae-sdk</id>
+ <activation>
+ <property>
+ <name>!gae.home</name>
+ </property>
+ </activation>
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>net.kindleit</groupId>
+ <artifactId>maven-gae-plugin</artifactId>
+ <executions>
+ <execution>
+ <phase>package</phase>
+ <goals>
+ <goal>unpack</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+ </profile>
</profiles>
<scm>
Modified: branches/RF-7654/examples/richfaces-showcase/src/main/java/org/richfaces/demo/calendar/CalendarBean.java
===================================================================
--- branches/RF-7654/examples/richfaces-showcase/src/main/java/org/richfaces/demo/calendar/CalendarBean.java 2010-12-16 17:43:00 UTC (rev 20623)
+++ branches/RF-7654/examples/richfaces-showcase/src/main/java/org/richfaces/demo/calendar/CalendarBean.java 2010-12-16 18:10:56 UTC (rev 20624)
@@ -1,15 +1,16 @@
package org.richfaces.demo.calendar;
+import java.io.Serializable;
import java.util.Date;
import java.util.Locale;
import javax.faces.bean.ManagedBean;
-import javax.faces.bean.RequestScoped;
+import javax.faces.bean.ViewScoped;
import javax.faces.event.ValueChangeEvent;
@ManagedBean
-@RequestScoped
-public class CalendarBean {
+@ViewScoped
+public class CalendarBean implements Serializable{
private Locale locale;
private boolean popup;
Copied: branches/RF-7654/examples/richfaces-showcase/src/main/java/org/richfaces/demo/dragdrop (from rev 20622, trunk/examples/richfaces-showcase/src/main/java/org/richfaces/demo/dragdrop)
Deleted: branches/RF-7654/examples/richfaces-showcase/src/main/java/org/richfaces/demo/dragdrop/DragDropBean.java
===================================================================
--- trunk/examples/richfaces-showcase/src/main/java/org/richfaces/demo/dragdrop/DragDropBean.java 2010-12-16 17:34:36 UTC (rev 20622)
+++ branches/RF-7654/examples/richfaces-showcase/src/main/java/org/richfaces/demo/dragdrop/DragDropBean.java 2010-12-16 18:10:56 UTC (rev 20624)
@@ -1,102 +0,0 @@
-package org.richfaces.demo.dragdrop;
-
-import static org.richfaces.demo.dragdrop.Framework.Family.cf;
-import static org.richfaces.demo.dragdrop.Framework.Family.dotNet;
-import static org.richfaces.demo.dragdrop.Framework.Family.php;
-
-import java.io.Serializable;
-import java.util.Collection;
-import java.util.List;
-
-import javax.faces.bean.ManagedBean;
-import javax.faces.bean.ViewScoped;
-
-import org.richfaces.demo.dragdrop.Framework.Family;
-
-import com.google.common.base.Predicate;
-import com.google.common.collect.Collections2;
-import com.google.common.collect.Lists;
-
-@ManagedBean
-@ViewScoped
-public class DragDropBean implements Serializable {
-
- private static final long serialVersionUID = 1416925735640720492L;
-
- private static final FrameworkFamilyPredicate CF_PREDICATE = new FrameworkFamilyPredicate(cf);
-
- private static final FrameworkFamilyPredicate DOT_NET_PREDICATE = new FrameworkFamilyPredicate(dotNet);
-
- private static final FrameworkFamilyPredicate PHP_PREDICATE = new FrameworkFamilyPredicate(php);
-
- private static final class FrameworkFamilyPredicate implements Predicate<Framework> {
-
- private Framework.Family family;
-
- public FrameworkFamilyPredicate(Family family) {
- super();
- this.family = family;
- }
-
- public boolean apply(Framework input) {
- return family.equals(input.getFamily());
- }
-
- }
-
- private List<Framework> source;
-
- private List<Framework> target;
-
- public DragDropBean() {
- initList();
- }
-
- public Collection<Framework> getSource() {
- return source;
- }
-
- public Collection<Framework> getTarget() {
- return target;
- }
-
- public List<Framework> getTargetPHP() {
- return Lists.newLinkedList(Collections2.filter(target, PHP_PREDICATE));
- }
-
- public List<Framework> getTargetDotNet() {
- return Lists.newLinkedList(Collections2.filter(target, DOT_NET_PREDICATE));
- }
-
- public List<Framework> getTargetCF() {
- return Lists.newLinkedList(Collections2.filter(target, CF_PREDICATE));
- }
-
- public void moveFramework(Framework framework) {
- source.remove(framework);
- target.add(framework);
- }
-
- public void reset() {
- initList();
- }
-
- private void initList() {
- source = Lists.newArrayList();
- target = Lists.newArrayList();
-
- source.add(new Framework("Flexible Ajax", php));
- source.add(new Framework("ajaxCFC", cf));
- source.add(new Framework("AJAXEngine", dotNet));
- source.add(new Framework("AjaxAC", php));
- source.add(new Framework("MonoRail", dotNet));
- source.add(new Framework("wddxAjax", cf));
- source.add(new Framework("AJAX AGENT", php));
- source.add(new Framework("FastPage", dotNet));
- source.add(new Framework("JSMX", cf));
- source.add(new Framework("PAJAJ", php));
- source.add(new Framework("Symfony", php));
- source.add(new Framework("PowerWEB", dotNet));
- }
-
-}
Copied: branches/RF-7654/examples/richfaces-showcase/src/main/java/org/richfaces/demo/dragdrop/DragDropBean.java (from rev 20622, trunk/examples/richfaces-showcase/src/main/java/org/richfaces/demo/dragdrop/DragDropBean.java)
===================================================================
--- branches/RF-7654/examples/richfaces-showcase/src/main/java/org/richfaces/demo/dragdrop/DragDropBean.java (rev 0)
+++ branches/RF-7654/examples/richfaces-showcase/src/main/java/org/richfaces/demo/dragdrop/DragDropBean.java 2010-12-16 18:10:56 UTC (rev 20624)
@@ -0,0 +1,102 @@
+package org.richfaces.demo.dragdrop;
+
+import static org.richfaces.demo.dragdrop.Framework.Family.cf;
+import static org.richfaces.demo.dragdrop.Framework.Family.dotNet;
+import static org.richfaces.demo.dragdrop.Framework.Family.php;
+
+import java.io.Serializable;
+import java.util.Collection;
+import java.util.List;
+
+import javax.faces.bean.ManagedBean;
+import javax.faces.bean.ViewScoped;
+
+import org.richfaces.demo.dragdrop.Framework.Family;
+
+import com.google.common.base.Predicate;
+import com.google.common.collect.Collections2;
+import com.google.common.collect.Lists;
+
+@ManagedBean
+@ViewScoped
+public class DragDropBean implements Serializable {
+
+ private static final long serialVersionUID = 1416925735640720492L;
+
+ private static final FrameworkFamilyPredicate CF_PREDICATE = new FrameworkFamilyPredicate(cf);
+
+ private static final FrameworkFamilyPredicate DOT_NET_PREDICATE = new FrameworkFamilyPredicate(dotNet);
+
+ private static final FrameworkFamilyPredicate PHP_PREDICATE = new FrameworkFamilyPredicate(php);
+
+ private static final class FrameworkFamilyPredicate implements Predicate<Framework> {
+
+ private Framework.Family family;
+
+ public FrameworkFamilyPredicate(Family family) {
+ super();
+ this.family = family;
+ }
+
+ public boolean apply(Framework input) {
+ return family.equals(input.getFamily());
+ }
+
+ }
+
+ private List<Framework> source;
+
+ private List<Framework> target;
+
+ public DragDropBean() {
+ initList();
+ }
+
+ public Collection<Framework> getSource() {
+ return source;
+ }
+
+ public Collection<Framework> getTarget() {
+ return target;
+ }
+
+ public List<Framework> getTargetPHP() {
+ return Lists.newLinkedList(Collections2.filter(target, PHP_PREDICATE));
+ }
+
+ public List<Framework> getTargetDotNet() {
+ return Lists.newLinkedList(Collections2.filter(target, DOT_NET_PREDICATE));
+ }
+
+ public List<Framework> getTargetCF() {
+ return Lists.newLinkedList(Collections2.filter(target, CF_PREDICATE));
+ }
+
+ public void moveFramework(Framework framework) {
+ source.remove(framework);
+ target.add(framework);
+ }
+
+ public void reset() {
+ initList();
+ }
+
+ private void initList() {
+ source = Lists.newArrayList();
+ target = Lists.newArrayList();
+
+ source.add(new Framework("Flexible Ajax", php));
+ source.add(new Framework("ajaxCFC", cf));
+ source.add(new Framework("AJAXEngine", dotNet));
+ source.add(new Framework("AjaxAC", php));
+ source.add(new Framework("MonoRail", dotNet));
+ source.add(new Framework("wddxAjax", cf));
+ source.add(new Framework("AJAX AGENT", php));
+ source.add(new Framework("FastPage", dotNet));
+ source.add(new Framework("JSMX", cf));
+ source.add(new Framework("PAJAJ", php));
+ source.add(new Framework("Symfony", php));
+ source.add(new Framework("PowerWEB", dotNet));
+ }
+
+}
Deleted: branches/RF-7654/examples/richfaces-showcase/src/main/java/org/richfaces/demo/dragdrop/DragDropEventBean.java
===================================================================
--- trunk/examples/richfaces-showcase/src/main/java/org/richfaces/demo/dragdrop/DragDropEventBean.java 2010-12-16 17:34:36 UTC (rev 20622)
+++ branches/RF-7654/examples/richfaces-showcase/src/main/java/org/richfaces/demo/dragdrop/DragDropEventBean.java 2010-12-16 18:10:56 UTC (rev 20624)
@@ -1,24 +0,0 @@
-package org.richfaces.demo.dragdrop;
-
-import javax.faces.bean.ManagedBean;
-import javax.faces.bean.ManagedProperty;
-import javax.faces.bean.RequestScoped;
-
-import org.richfaces.event.DropEvent;
-import org.richfaces.event.DropListener;
-
-@ManagedBean
-@RequestScoped
-public class DragDropEventBean implements DropListener {
-
- @ManagedProperty(value = "#{dragDropBean}")
- private DragDropBean dragDropBean;
-
- public void setDragDropBean(DragDropBean dragDropBean) {
- this.dragDropBean = dragDropBean;
- }
-
- public void processDrop(DropEvent event) {
- dragDropBean.moveFramework((Framework) event.getDragValue());
- }
-}
\ No newline at end of file
Copied: branches/RF-7654/examples/richfaces-showcase/src/main/java/org/richfaces/demo/dragdrop/DragDropEventBean.java (from rev 20622, trunk/examples/richfaces-showcase/src/main/java/org/richfaces/demo/dragdrop/DragDropEventBean.java)
===================================================================
--- branches/RF-7654/examples/richfaces-showcase/src/main/java/org/richfaces/demo/dragdrop/DragDropEventBean.java (rev 0)
+++ branches/RF-7654/examples/richfaces-showcase/src/main/java/org/richfaces/demo/dragdrop/DragDropEventBean.java 2010-12-16 18:10:56 UTC (rev 20624)
@@ -0,0 +1,24 @@
+package org.richfaces.demo.dragdrop;
+
+import javax.faces.bean.ManagedBean;
+import javax.faces.bean.ManagedProperty;
+import javax.faces.bean.RequestScoped;
+
+import org.richfaces.event.DropEvent;
+import org.richfaces.event.DropListener;
+
+@ManagedBean
+@RequestScoped
+public class DragDropEventBean implements DropListener {
+
+ @ManagedProperty(value = "#{dragDropBean}")
+ private DragDropBean dragDropBean;
+
+ public void setDragDropBean(DragDropBean dragDropBean) {
+ this.dragDropBean = dragDropBean;
+ }
+
+ public void processDrop(DropEvent event) {
+ dragDropBean.moveFramework((Framework) event.getDragValue());
+ }
+}
\ No newline at end of file
Deleted: branches/RF-7654/examples/richfaces-showcase/src/main/java/org/richfaces/demo/dragdrop/Framework.java
===================================================================
--- trunk/examples/richfaces-showcase/src/main/java/org/richfaces/demo/dragdrop/Framework.java 2010-12-16 17:34:36 UTC (rev 20622)
+++ branches/RF-7654/examples/richfaces-showcase/src/main/java/org/richfaces/demo/dragdrop/Framework.java 2010-12-16 18:10:56 UTC (rev 20624)
@@ -1,64 +0,0 @@
-package org.richfaces.demo.dragdrop;
-
-import java.io.Serializable;
-
-public class Framework implements Serializable {
-
- private static final long serialVersionUID = -2316100725668694225L;
-
- public enum Family {
- php, cf, dotNet
- }
-
- private String name;
-
- private Family family;
-
- public Framework(String name, Family family) {
- this.name = name;
- this.family = family;
- }
-
- public Family getFamily() {
- return family;
- }
-
- public String getName() {
- return name;
- }
-
- @Override
- public int hashCode() {
- final int prime = 31;
- int result = 1;
- result = prime * result + ((family == null) ? 0 : family.hashCode());
- result = prime * result + ((name == null) ? 0 : name.hashCode());
- return result;
- }
-
- @Override
- public boolean equals(Object obj) {
- if (this == obj) {
- return true;
- }
- if (obj == null) {
- return false;
- }
- if (getClass() != obj.getClass()) {
- return false;
- }
- Framework other = (Framework) obj;
- if (family != other.family) {
- return false;
- }
- if (name == null) {
- if (other.name != null) {
- return false;
- }
- } else if (!name.equals(other.name)) {
- return false;
- }
- return true;
- }
-
-}
Copied: branches/RF-7654/examples/richfaces-showcase/src/main/java/org/richfaces/demo/dragdrop/Framework.java (from rev 20622, trunk/examples/richfaces-showcase/src/main/java/org/richfaces/demo/dragdrop/Framework.java)
===================================================================
--- branches/RF-7654/examples/richfaces-showcase/src/main/java/org/richfaces/demo/dragdrop/Framework.java (rev 0)
+++ branches/RF-7654/examples/richfaces-showcase/src/main/java/org/richfaces/demo/dragdrop/Framework.java 2010-12-16 18:10:56 UTC (rev 20624)
@@ -0,0 +1,64 @@
+package org.richfaces.demo.dragdrop;
+
+import java.io.Serializable;
+
+public class Framework implements Serializable {
+
+ private static final long serialVersionUID = -2316100725668694225L;
+
+ public enum Family {
+ php, cf, dotNet
+ }
+
+ private String name;
+
+ private Family family;
+
+ public Framework(String name, Family family) {
+ this.name = name;
+ this.family = family;
+ }
+
+ public Family getFamily() {
+ return family;
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ @Override
+ public int hashCode() {
+ final int prime = 31;
+ int result = 1;
+ result = prime * result + ((family == null) ? 0 : family.hashCode());
+ result = prime * result + ((name == null) ? 0 : name.hashCode());
+ return result;
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ if (this == obj) {
+ return true;
+ }
+ if (obj == null) {
+ return false;
+ }
+ if (getClass() != obj.getClass()) {
+ return false;
+ }
+ Framework other = (Framework) obj;
+ if (family != other.family) {
+ return false;
+ }
+ if (name == null) {
+ if (other.name != null) {
+ return false;
+ }
+ } else if (!name.equals(other.name)) {
+ return false;
+ }
+ return true;
+ }
+
+}
Modified: branches/RF-7654/examples/richfaces-showcase/src/main/resources/org/richfaces/demo/data/common/navigation.xml
===================================================================
--- branches/RF-7654/examples/richfaces-showcase/src/main/resources/org/richfaces/demo/data/common/navigation.xml 2010-12-16 17:43:00 UTC (rev 20623)
+++ branches/RF-7654/examples/richfaces-showcase/src/main/resources/org/richfaces/demo/data/common/navigation.xml 2010-12-16 18:10:56 UTC (rev 20624)
@@ -548,6 +548,21 @@
</demo>
</demos>
</group>
+ <group>
+ <name>Drag and Drop</name>
+ <demos>
+ <demo new="true">
+ <id>dragDrop</id>
+ <name>Drag and Drop</name>
+ <samples>
+ <sample>
+ <id>dragDrop</id>
+ <name>Drag and Drop usage example</name>
+ </sample>
+ </samples>
+ </demo>
+ </demos>
+ </group>
<group>
<name>Misc Components/Features</name>
<demos>
Modified: branches/RF-7654/examples/richfaces-showcase/src/main/webapp/WEB-INF/web.xml
===================================================================
--- branches/RF-7654/examples/richfaces-showcase/src/main/webapp/WEB-INF/web.xml 2010-12-16 17:43:00 UTC (rev 20623)
+++ branches/RF-7654/examples/richfaces-showcase/src/main/webapp/WEB-INF/web.xml 2010-12-16 18:10:56 UTC (rev 20624)
@@ -25,7 +25,7 @@
</context-param>
<context-param>
<param-name>javax.faces.STATE_SAVING_METHOD</param-name>
- <param-value>server</param-value>
+ <param-value>client</param-value>
</context-param>
<servlet>
<servlet-name>Faces Servlet</servlet-name>
Copied: branches/RF-7654/examples/richfaces-showcase/src/main/webapp/images/icons/new.gif (from rev 20622, trunk/examples/richfaces-showcase/src/main/webapp/images/icons/new.gif)
===================================================================
(Binary files differ)
Copied: branches/RF-7654/examples/richfaces-showcase/src/main/webapp/images/icons/palette_edit.gif (from rev 20622, trunk/examples/richfaces-showcase/src/main/webapp/images/icons/palette_edit.gif)
===================================================================
(Binary files differ)
Copied: branches/RF-7654/examples/richfaces-showcase/src/main/webapp/images/icons/print.gif (from rev 20622, trunk/examples/richfaces-showcase/src/main/webapp/images/icons/print.gif)
===================================================================
(Binary files differ)
Copied: branches/RF-7654/examples/richfaces-showcase/src/main/webapp/images/icons/print_edit.gif (from rev 20622, trunk/examples/richfaces-showcase/src/main/webapp/images/icons/print_edit.gif)
===================================================================
(Binary files differ)
Copied: branches/RF-7654/examples/richfaces-showcase/src/main/webapp/images/icons/print_preview.gif (from rev 20622, trunk/examples/richfaces-showcase/src/main/webapp/images/icons/print_preview.gif)
===================================================================
(Binary files differ)
Copied: branches/RF-7654/examples/richfaces-showcase/src/main/webapp/images/icons/search_item.gif (from rev 20622, trunk/examples/richfaces-showcase/src/main/webapp/images/icons/search_item.gif)
===================================================================
(Binary files differ)
Copied: branches/RF-7654/examples/richfaces-showcase/src/main/webapp/images/icons/timer_task.gif (from rev 20622, trunk/examples/richfaces-showcase/src/main/webapp/images/icons/timer_task.gif)
===================================================================
(Binary files differ)
Copied: branches/RF-7654/examples/richfaces-showcase/src/main/webapp/images/icons/webapp_session_config.gif (from rev 20622, trunk/examples/richfaces-showcase/src/main/webapp/images/icons/webapp_session_config.gif)
===================================================================
(Binary files differ)
Copied: branches/RF-7654/examples/richfaces-showcase/src/main/webapp/images/icons/webapp_welcome.gif (from rev 20622, trunk/examples/richfaces-showcase/src/main/webapp/images/icons/webapp_welcome.gif)
===================================================================
(Binary files differ)
Copied: branches/RF-7654/examples/richfaces-showcase/src/main/webapp/images/icons/yellow_lamp.gif (from rev 20622, trunk/examples/richfaces-showcase/src/main/webapp/images/icons/yellow_lamp.gif)
===================================================================
(Binary files differ)
Copied: branches/RF-7654/examples/richfaces-showcase/src/main/webapp/richfaces/dragDrop (from rev 20622, trunk/examples/richfaces-showcase/src/main/webapp/richfaces/dragDrop)
Deleted: branches/RF-7654/examples/richfaces-showcase/src/main/webapp/richfaces/dragDrop/dragDrop.xhtml
===================================================================
--- trunk/examples/richfaces-showcase/src/main/webapp/richfaces/dragDrop/dragDrop.xhtml 2010-12-16 17:34:36 UTC (rev 20622)
+++ branches/RF-7654/examples/richfaces-showcase/src/main/webapp/richfaces/dragDrop/dragDrop.xhtml 2010-12-16 18:10:56 UTC (rev 20624)
@@ -1,16 +0,0 @@
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
-<html xmlns="http://www.w3.org/1999/xhtml"
- xmlns:h="http://java.sun.com/jsf/html"
- xmlns:f="http://java.sun.com/jsf/core"
- xmlns:ui="http://java.sun.com/jsf/facelets">
-
-<ui:composition>
- <ui:include src="#{demoNavigator.sampleIncludeURI}" />
- <ui:include src="/templates/includes/source-view.xhtml">
- <ui:param name="src" value="#{demoNavigator.sampleIncludeURI}" />
- <ui:param name="sourceType" value="xhtml" />
- <ui:param name="openLabel" value="View Source" />
- <ui:param name="hideLabel" value="Hide Source" />
- </ui:include>
-</ui:composition>
-</html>
\ No newline at end of file
Copied: branches/RF-7654/examples/richfaces-showcase/src/main/webapp/richfaces/dragDrop/dragDrop.xhtml (from rev 20622, trunk/examples/richfaces-showcase/src/main/webapp/richfaces/dragDrop/dragDrop.xhtml)
===================================================================
--- branches/RF-7654/examples/richfaces-showcase/src/main/webapp/richfaces/dragDrop/dragDrop.xhtml (rev 0)
+++ branches/RF-7654/examples/richfaces-showcase/src/main/webapp/richfaces/dragDrop/dragDrop.xhtml 2010-12-16 18:10:56 UTC (rev 20624)
@@ -0,0 +1,16 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml"
+ xmlns:h="http://java.sun.com/jsf/html"
+ xmlns:f="http://java.sun.com/jsf/core"
+ xmlns:ui="http://java.sun.com/jsf/facelets">
+
+<ui:composition>
+ <ui:include src="#{demoNavigator.sampleIncludeURI}" />
+ <ui:include src="/templates/includes/source-view.xhtml">
+ <ui:param name="src" value="#{demoNavigator.sampleIncludeURI}" />
+ <ui:param name="sourceType" value="xhtml" />
+ <ui:param name="openLabel" value="View Source" />
+ <ui:param name="hideLabel" value="Hide Source" />
+ </ui:include>
+</ui:composition>
+</html>
\ No newline at end of file
Copied: branches/RF-7654/examples/richfaces-showcase/src/main/webapp/richfaces/dragDrop/samples (from rev 20622, trunk/examples/richfaces-showcase/src/main/webapp/richfaces/dragDrop/samples)
Deleted: branches/RF-7654/examples/richfaces-showcase/src/main/webapp/richfaces/dragDrop/samples/dragDrop-sample.xhtml
===================================================================
--- trunk/examples/richfaces-showcase/src/main/webapp/richfaces/dragDrop/samples/dragDrop-sample.xhtml 2010-12-16 17:34:36 UTC (rev 20622)
+++ branches/RF-7654/examples/richfaces-showcase/src/main/webapp/richfaces/dragDrop/samples/dragDrop-sample.xhtml 2010-12-16 18:10:56 UTC (rev 20624)
@@ -1,106 +0,0 @@
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
-<ui:composition xmlns="http://www.w3.org/1999/xhtml"
- xmlns:h="http://java.sun.com/jsf/html"
- xmlns:f="http://java.sun.com/jsf/core"
- xmlns:ui="http://java.sun.com/jsf/facelets"
- xmlns:a4j="http://richfaces.org/a4j"
- xmlns:rich="http://richfaces.org/rich">
-
- <h:outputStylesheet>
- .panelc {
- width:25%;
- vertical-align:top;
- }
-
- .dropTargetPanel {
- width: 90%;
- }
-
- .footerClass {
- text-align: center;
- padding-top: 5px;
- }
- </h:outputStylesheet>
-
- <h:form id="form">
-
- <h:panelGrid columnClasses="panelc" columns="4" width="100%">
-
- <rich:panel style="width:133px">
- <f:facet name="header">
- <h:outputText value="Source List" />
- </f:facet>
- <h:dataTable id="src" columns="1" value="#{dragDropBean.source}"
- var="fm" footerClass="footerClass">
-
- <h:column>
- <a4j:outputPanel
- style="width:100px;border:1px solid gray;padding:2px"
- layout="block">
- <rich:dragBehavior event="mouseover"
- type="#{fm.family}" dragValue="#{fm}" />
- <h:outputText value="#{fm.name}"></h:outputText>
- </a4j:outputPanel>
- </h:column>
- <f:facet name="footer">
- <a4j:commandButton action="#{dragDropBean.reset}" value="Start Over"
- render="src,phptable,cftable,dnettable" />
- </f:facet>
- </h:dataTable>
- </rich:panel>
-
- <rich:panel styleClass="dropTargetPanel">
- <f:facet name="header">
- <h:outputText value="PHP Frameworks" />
- </f:facet>
- <rich:dropBehavior event="mouseover" acceptedTypes="php" dropValue="PHP"
- listener="#{dragDropEventBean.processDrop}" render="phptable, src" />
-
- <h:dataTable id="phptable" columns="1"
- value="#{dragDropBean.targetPHP}" var="fm">
- <h:column>
- <h:outputText value="#{fm.name}"></h:outputText>
- </h:column>
- </h:dataTable>
-
-
- </rich:panel>
-
- <rich:panel styleClass="dropTargetPanel">
- <f:facet name="header">
- <h:outputText value=".NET Frameworks" />
- </f:facet>
- <rich:dropBehavior event="mouseover" acceptedTypes="dotNet" dropValue="DNET"
- listener="#{dragDropEventBean.processDrop}" render="dnettable, src" />
-
- <h:dataTable id="dnettable" columns="1"
- value="#{dragDropBean.targetDotNet}" var="fm">
- <h:column>
- <h:outputText value="#{fm.name}"></h:outputText>
- </h:column>
- </h:dataTable>
-
-
- </rich:panel>
-
- <rich:panel styleClass="dropTargetPanel">
- <f:facet name="header">
- <h:outputText value="ColdFusion Frameworks" />
- </f:facet>
- <rich:dropBehavior event="mouseover" acceptedTypes="cf" dropValue="CF"
- listener="#{dragDropEventBean.processDrop}" render="cftable, src" />
-
- <h:dataTable id="cftable" columns="1" value="#{dragDropBean.targetCF}"
- var="fm">
- <h:column>
- <h:outputText value="#{fm.name}"></h:outputText>
- </h:column>
- </h:dataTable>
- </rich:panel>
- </h:panelGrid>
-
- </h:form>
- <a4j:outputPanel ajaxRendered="true">
- <h:messages></h:messages>
- </a4j:outputPanel>
-</ui:composition>
\ No newline at end of file
Copied: branches/RF-7654/examples/richfaces-showcase/src/main/webapp/richfaces/dragDrop/samples/dragDrop-sample.xhtml (from rev 20622, trunk/examples/richfaces-showcase/src/main/webapp/richfaces/dragDrop/samples/dragDrop-sample.xhtml)
===================================================================
--- branches/RF-7654/examples/richfaces-showcase/src/main/webapp/richfaces/dragDrop/samples/dragDrop-sample.xhtml (rev 0)
+++ branches/RF-7654/examples/richfaces-showcase/src/main/webapp/richfaces/dragDrop/samples/dragDrop-sample.xhtml 2010-12-16 18:10:56 UTC (rev 20624)
@@ -0,0 +1,106 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<ui:composition xmlns="http://www.w3.org/1999/xhtml"
+ xmlns:h="http://java.sun.com/jsf/html"
+ xmlns:f="http://java.sun.com/jsf/core"
+ xmlns:ui="http://java.sun.com/jsf/facelets"
+ xmlns:a4j="http://richfaces.org/a4j"
+ xmlns:rich="http://richfaces.org/rich">
+
+ <h:outputStylesheet>
+ .panelc {
+ width:25%;
+ vertical-align:top;
+ }
+
+ .dropTargetPanel {
+ width: 90%;
+ }
+
+ .footerClass {
+ text-align: center;
+ padding-top: 5px;
+ }
+ </h:outputStylesheet>
+
+ <h:form id="form">
+
+ <h:panelGrid columnClasses="panelc" columns="4" width="100%">
+
+ <rich:panel style="width:133px">
+ <f:facet name="header">
+ <h:outputText value="Source List" />
+ </f:facet>
+ <h:dataTable id="src" columns="1" value="#{dragDropBean.source}"
+ var="fm" footerClass="footerClass">
+
+ <h:column>
+ <a4j:outputPanel
+ style="width:100px;border:1px solid gray;padding:2px"
+ layout="block">
+ <rich:dragBehavior event="mouseover"
+ type="#{fm.family}" dragValue="#{fm}" />
+ <h:outputText value="#{fm.name}"></h:outputText>
+ </a4j:outputPanel>
+ </h:column>
+ <f:facet name="footer">
+ <a4j:commandButton action="#{dragDropBean.reset}" value="Start Over"
+ render="src,phptable,cftable,dnettable" />
+ </f:facet>
+ </h:dataTable>
+ </rich:panel>
+
+ <rich:panel styleClass="dropTargetPanel">
+ <f:facet name="header">
+ <h:outputText value="PHP Frameworks" />
+ </f:facet>
+ <rich:dropBehavior event="mouseover" acceptedTypes="php" dropValue="PHP"
+ listener="#{dragDropEventBean.processDrop}" render="phptable, src" />
+
+ <h:dataTable id="phptable" columns="1"
+ value="#{dragDropBean.targetPHP}" var="fm">
+ <h:column>
+ <h:outputText value="#{fm.name}"></h:outputText>
+ </h:column>
+ </h:dataTable>
+
+
+ </rich:panel>
+
+ <rich:panel styleClass="dropTargetPanel">
+ <f:facet name="header">
+ <h:outputText value=".NET Frameworks" />
+ </f:facet>
+ <rich:dropBehavior event="mouseover" acceptedTypes="dotNet" dropValue="DNET"
+ listener="#{dragDropEventBean.processDrop}" render="dnettable, src" />
+
+ <h:dataTable id="dnettable" columns="1"
+ value="#{dragDropBean.targetDotNet}" var="fm">
+ <h:column>
+ <h:outputText value="#{fm.name}"></h:outputText>
+ </h:column>
+ </h:dataTable>
+
+
+ </rich:panel>
+
+ <rich:panel styleClass="dropTargetPanel">
+ <f:facet name="header">
+ <h:outputText value="ColdFusion Frameworks" />
+ </f:facet>
+ <rich:dropBehavior event="mouseover" acceptedTypes="cf" dropValue="CF"
+ listener="#{dragDropEventBean.processDrop}" render="cftable, src" />
+
+ <h:dataTable id="cftable" columns="1" value="#{dragDropBean.targetCF}"
+ var="fm">
+ <h:column>
+ <h:outputText value="#{fm.name}"></h:outputText>
+ </h:column>
+ </h:dataTable>
+ </rich:panel>
+ </h:panelGrid>
+
+ </h:form>
+ <a4j:outputPanel ajaxRendered="true">
+ <h:messages></h:messages>
+ </a4j:outputPanel>
+</ui:composition>
\ No newline at end of file
Modified: branches/RF-7654/examples/richfaces-showcase/src/main/webapp/richfaces/dropDownMenu/samples/sideMenu-sample.xhtml
===================================================================
--- branches/RF-7654/examples/richfaces-showcase/src/main/webapp/richfaces/dropDownMenu/samples/sideMenu-sample.xhtml 2010-12-16 17:43:00 UTC (rev 20623)
+++ branches/RF-7654/examples/richfaces-showcase/src/main/webapp/richfaces/dropDownMenu/samples/sideMenu-sample.xhtml 2010-12-16 18:10:56 UTC (rev 20624)
@@ -25,7 +25,7 @@
<rich:menuItem label="Suboption 1-1" />
<rich:menuItem label="Suboption 1-2">
<f:facet name="icon">
- <h:graphicImage value="/richfaces/toolBar/images/print.gif" />
+ <h:graphicImage value="/images/icons/print.gif" />
</f:facet>
</rich:menuItem>
<rich:menuItem label="Suboption 1-3" />
Modified: branches/RF-7654/examples/richfaces-showcase/src/main/webapp/richfaces/toolBar/samples/toolBar-sample.xhtml
===================================================================
--- branches/RF-7654/examples/richfaces-showcase/src/main/webapp/richfaces/toolBar/samples/toolBar-sample.xhtml 2010-12-16 17:43:00 UTC (rev 20623)
+++ branches/RF-7654/examples/richfaces-showcase/src/main/webapp/richfaces/toolBar/samples/toolBar-sample.xhtml 2010-12-16 18:10:56 UTC (rev 20624)
@@ -23,24 +23,24 @@
}
</style>
- <rich:toolBar height="26" itemSeparator="grid">
- <rich:toolBarGroup>
+ <rich:toolbar height="26" itemSeparator="grid">
+ <rich:toolbarGroup>
<h:graphicImage value="/images/icons/create_doc.gif" styleClass="pic" />
<h:graphicImage value="/images/icons/create_folder.gif"
styleClass="pic" />
<h:graphicImage value="/images/icons/copy.gif" styleClass="pic" />
- </rich:toolBarGroup>
- <rich:toolBarGroup>
+ </rich:toolbarGroup>
+ <rich:toolbarGroup>
<h:graphicImage value="/images/icons/save.gif" styleClass="pic" />
<h:graphicImage value="/images/icons/save_as.gif" styleClass="pic" />
<h:graphicImage value="/images/icons/save_all.gif" styleClass="pic" />
- </rich:toolBarGroup>
- <rich:toolBarGroup location="right">
+ </rich:toolbarGroup>
+ <rich:toolbarGroup location="right">
<h:inputText styleClass="barsearch" />
<h:commandButton styleClass="barsearchbutton" onclick="return false;"
value="Search" />
- </rich:toolBarGroup>
- </rich:toolBar>
+ </rich:toolbarGroup>
+ </rich:toolbar>
</ui:composition>
\ No newline at end of file
Modified: branches/RF-7654/examples/richfaces-showcase/src/main/webapp/richfaces/toolBar/samples/toolBarIcons-sample.xhtml
===================================================================
--- branches/RF-7654/examples/richfaces-showcase/src/main/webapp/richfaces/toolBar/samples/toolBarIcons-sample.xhtml 2010-12-16 17:43:00 UTC (rev 20623)
+++ branches/RF-7654/examples/richfaces-showcase/src/main/webapp/richfaces/toolBar/samples/toolBarIcons-sample.xhtml 2010-12-16 18:10:56 UTC (rev 20624)
@@ -73,23 +73,23 @@
</h:panelGrid>
</h:form>
<a4j:outputPanel ajaxRendered="true">
- <rich:toolBar id="bar" height="30"
+ <rich:toolbar id="bar" height="30"
itemSeparator="#{toolBarBean.groupSeparator}">
- <rich:toolBarGroup itemSeparator="#{toolBarBean.groupItemSeparator}">
+ <rich:toolbarGroup itemSeparator="#{toolBarBean.groupItemSeparator}">
<h:outputText value="Group1.1"></h:outputText>
<h:outputText value="Group1.2"></h:outputText>
<h:outputText value="Group1.3"></h:outputText>
- </rich:toolBarGroup>
- <rich:toolBarGroup itemSeparator="#{toolBarBean.groupItemSeparator}">
+ </rich:toolbarGroup>
+ <rich:toolbarGroup itemSeparator="#{toolBarBean.groupItemSeparator}">
<h:outputText value="Group2.1"></h:outputText>
<h:outputText value="Group2.2"></h:outputText>
- </rich:toolBarGroup>
- <rich:toolBarGroup location="right"
+ </rich:toolbarGroup>
+ <rich:toolbarGroup location="right"
itemSeparator="#{toolBarBean.groupItemSeparator}">
<h:outputText value="Group3.1"></h:outputText>
<h:outputText value="Group3.2"></h:outputText>
- </rich:toolBarGroup>
- </rich:toolBar>
+ </rich:toolbarGroup>
+ </rich:toolbar>
</a4j:outputPanel>
</ui:composition>
\ No newline at end of file
Modified: branches/RF-7654/examples/richfaces-showcase/src/main/webapp-gae/WEB-INF/appengine-web.xml
===================================================================
--- branches/RF-7654/examples/richfaces-showcase/src/main/webapp-gae/WEB-INF/appengine-web.xml 2010-12-16 17:43:00 UTC (rev 20623)
+++ branches/RF-7654/examples/richfaces-showcase/src/main/webapp-gae/WEB-INF/appengine-web.xml 2010-12-16 18:10:56 UTC (rev 20624)
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<appengine-web-app xmlns="http://appengine.google.com/ns/1.0">
<application>richfaces-showcase</application>
- <version>11</version>
+ <version>21</version>
<sessions-enabled>true</sessions-enabled>
<system-properties>
Modified: branches/RF-7654/examples/richfaces-showcase/src/main/webapp-gae/WEB-INF/web.xml
===================================================================
--- branches/RF-7654/examples/richfaces-showcase/src/main/webapp-gae/WEB-INF/web.xml 2010-12-16 17:43:00 UTC (rev 20623)
+++ branches/RF-7654/examples/richfaces-showcase/src/main/webapp-gae/WEB-INF/web.xml 2010-12-16 18:10:56 UTC (rev 20624)
@@ -42,7 +42,7 @@
</context-param>
<context-param>
<param-name>javax.faces.STATE_SAVING_METHOD</param-name>
- <param-value>server</param-value>
+ <param-value>client</param-value>
</context-param>
<context-param>
<param-name>org.richfaces.staticResourceLocation</param-name>
Modified: branches/RF-7654/ui/common/ui/src/main/java/org/richfaces/renderkit/AjaxChildrenRenderer.java
===================================================================
--- branches/RF-7654/ui/common/ui/src/main/java/org/richfaces/renderkit/AjaxChildrenRenderer.java 2010-12-16 17:43:00 UTC (rev 20623)
+++ branches/RF-7654/ui/common/ui/src/main/java/org/richfaces/renderkit/AjaxChildrenRenderer.java 2010-12-16 18:10:56 UTC (rev 20624)
@@ -72,7 +72,7 @@
// Do not check children if we have no id to render under naming
// container.
- if (AjaxContext.getCurrentInstance(context).isDisableImplicitRender() && noIdUnderPath(path, ids)) {
+ if (AjaxContext.getCurrentInstance(context).isLimitRender() && noIdUnderPath(path, ids)) {
return;
}
}
@@ -113,7 +113,7 @@
if (component.isRendered()) { // skip not-rendered components.
boolean found = false;
- boolean disableImplicitRender = AjaxContext.getCurrentInstance(context).isDisableImplicitRender();
+ boolean limitRender = AjaxContext.getCurrentInstance(context).isLimitRender();
String elementId = component.getId();
String absoluteId = currentPath + elementId;
@@ -133,12 +133,12 @@
}
//
- if (!found && disableImplicitRender && (component instanceof NamingContainer)
+ if (!found && limitRender && (component instanceof NamingContainer)
&& noIdUnderPath(absoluteId + NamingContainer.SEPARATOR_CHAR, ids)) {
return;
}
- if (!found && !disableImplicitRender && (component instanceof AjaxOutput)) {
+ if (!found && !limitRender && (component instanceof AjaxOutput)) {
if (((AjaxOutput) component).isAjaxRendered()) {
// renderChild(context, element);
Modified: branches/RF-7654/ui/common/ui/src/main/java/org/richfaces/renderkit/util/AjaxRendererUtils.java
===================================================================
--- branches/RF-7654/ui/common/ui/src/main/java/org/richfaces/renderkit/util/AjaxRendererUtils.java 2010-12-16 17:43:00 UTC (rev 20623)
+++ branches/RF-7654/ui/common/ui/src/main/java/org/richfaces/renderkit/util/AjaxRendererUtils.java 2010-12-16 18:10:56 UTC (rev 20624)
@@ -97,12 +97,6 @@
public String getAttributeValue(AjaxClientBehavior behavior) {
return behavior.getQueueId();
}
- },
- event {
- @Override
- public String getAttributeValue(AjaxClientBehavior behavior) {
- return behavior.getOnevent();
- }
};
public abstract String getAttributeValue(AjaxClientBehavior behavior);
@@ -359,7 +353,7 @@
// options.put("parameters", parameters);
// }
// // parameter to render only current list of areas.
-//// if (isAjaxDisableImplicitRender(uiComponent)) {
+//// if (isAjaxLimitRender(uiComponent)) {
//// Set<? extends Object> ajaxAreas = getAjaxAreas(uiComponent);
//// Set<String> areasIds = new HashSet<String>();
//// if (null != ajaxAreas) {
@@ -507,7 +501,7 @@
// Set ajaxAreas = getAjaxAreas(uiComponent);
// onClick.append(',');
// // parameter to render only current list of areas.
- // if (isAjaxDisableImplicitRender(uiComponent) && ajaxAreas != null &&
+ // if (isAjaxLimitRender(uiComponent) && ajaxAreas != null &&
// ajaxAreas.size() > 0)
// {
// onClick.append('[');
Modified: branches/RF-7654/ui/core/ui/src/main/java/org/ajax4jsf/component/behavior/AjaxBehavior.java
===================================================================
--- branches/RF-7654/ui/core/ui/src/main/java/org/ajax4jsf/component/behavior/AjaxBehavior.java 2010-12-16 17:43:00 UTC (rev 20623)
+++ branches/RF-7654/ui/core/ui/src/main/java/org/ajax4jsf/component/behavior/AjaxBehavior.java 2010-12-16 18:10:56 UTC (rev 20624)
@@ -74,7 +74,7 @@
private static final Set<String> NONE_SINGLETON_SET = Collections.singleton(NONE);
enum PropertyKeys {
- data, execute, onbeforedomupdate, onbegin, oncomplete, onerror, onevent, queueId, render,
+ data, execute, onbeforedomupdate, onbegin, oncomplete, onerror, queueId, render,
status, disabled, limitRender, immediate, bypassUpdates
}
@@ -105,8 +105,6 @@
setOncomplete((String) value);
} else if (compare(PropertyKeys.onerror, name)) {
setOnerror((String) value);
- } else if (compare(PropertyKeys.onevent, name)) {
- setOnevent((String) value);
} else if (compare(PropertyKeys.queueId, name)) {
setQueueId((String) value);
} else if (compare(PropertyKeys.status, name)) {
@@ -233,15 +231,6 @@
}
@Attribute
- public String getOnevent() {
- return (String) getStateHelper().eval(PropertyKeys.onevent);
- }
-
- public void setOnevent(String onevent) {
- getStateHelper().put(PropertyKeys.onevent, onevent);
- }
-
- @Attribute
public String getQueueId() {
return (String) getStateHelper().eval(PropertyKeys.queueId);
}
@@ -420,4 +409,5 @@
return state;
}
+
}
Modified: branches/RF-7654/ui/core/ui/src/main/java/org/richfaces/component/AbstractMediaOutput.java
===================================================================
--- branches/RF-7654/ui/core/ui/src/main/java/org/richfaces/component/AbstractMediaOutput.java 2010-12-16 17:43:00 UTC (rev 20623)
+++ branches/RF-7654/ui/core/ui/src/main/java/org/richfaces/component/AbstractMediaOutput.java 2010-12-16 18:10:56 UTC (rev 20624)
@@ -28,11 +28,11 @@
import javax.el.MethodExpression;
import javax.faces.application.Resource;
+import javax.faces.application.ResourceHandler;
import javax.faces.component.UIOutput;
import javax.faces.el.MethodBinding;
import org.ajax4jsf.resource.ResourceComponent2;
-import org.richfaces.application.ServiceTracker;
import org.richfaces.cdk.annotations.Attribute;
import org.richfaces.cdk.annotations.EventName;
import org.richfaces.cdk.annotations.JsfComponent;
@@ -41,7 +41,6 @@
import org.richfaces.cdk.annotations.Tag;
import org.richfaces.cdk.annotations.TagType;
import org.richfaces.resource.MediaOutputResource;
-import org.richfaces.resource.ResourceFactory;
/**
* @author shura
@@ -119,12 +118,8 @@
}
public Resource getResource() {
- ResourceFactory factory = ServiceTracker.getService(ResourceFactory.class);
-
- MediaOutputResource mediaOutputResource = new MediaOutputResource();
- mediaOutputResource.initialize(this);
-
- return factory.createResource(mediaOutputResource);
+ ResourceHandler resourceHandler = getFacesContext().getApplication().getResourceHandler();
+ return resourceHandler.createResource(MediaOutputResource.class.getName());
}
@Attribute
Modified: branches/RF-7654/ui/core/ui/src/main/java/org/richfaces/resource/MediaOutputResource.java
===================================================================
--- branches/RF-7654/ui/core/ui/src/main/java/org/richfaces/resource/MediaOutputResource.java 2010-12-16 17:43:00 UTC (rev 20623)
+++ branches/RF-7654/ui/core/ui/src/main/java/org/richfaces/resource/MediaOutputResource.java 2010-12-16 18:10:56 UTC (rev 20624)
@@ -30,6 +30,7 @@
import javax.el.MethodExpression;
import javax.el.ValueExpression;
import javax.faces.component.StateHolder;
+import javax.faces.component.UIComponent;
import javax.faces.component.UIComponentBase;
import javax.faces.context.FacesContext;
@@ -98,7 +99,9 @@
*/
// TODO use ResourceComponent or exchange object as argument?
- public void initialize(AbstractMediaOutput uiMediaOutput) {
+ @PostConstructResource
+ public void initialize() {
+ AbstractMediaOutput uiMediaOutput = (AbstractMediaOutput) UIComponent.getCurrentComponent(FacesContext.getCurrentInstance());
this.setCacheable(uiMediaOutput.isCacheable());
this.setContentType(uiMediaOutput.getMimeType());
this.userData = uiMediaOutput.getValue();
Modified: branches/RF-7654/ui/dnd/api/src/main/java/org/richfaces/event/DropEvent.java
===================================================================
--- branches/RF-7654/ui/dnd/api/src/main/java/org/richfaces/event/DropEvent.java 2010-12-16 17:43:00 UTC (rev 20623)
+++ branches/RF-7654/ui/dnd/api/src/main/java/org/richfaces/event/DropEvent.java 2010-12-16 18:10:56 UTC (rev 20624)
@@ -37,23 +37,65 @@
private static final long serialVersionUID = 3717071628237886288L;
- private ClientDragBehavior dragSource;
+ private ClientDragBehavior dragBehavior;
private UIComponent dragComponent;
+ private ClientDropBehavior dropBehavior;
+
+ private UIComponent dropComponent;
+
+ private Object dropValue;
+
+ private Object dragValue;
+
public DropEvent(UIComponent component, ClientDropBehavior behavior) {
super(component, behavior);
+ this.dropComponent = component;
+ this.dropBehavior = behavior;
}
- public ClientDragBehavior getDragSource() {
- return dragSource;
+
+ public void setDropBehavior(ClientDropBehavior dropBehavior) {
+ this.dropBehavior = dropBehavior;
}
+
+ public ClientDropBehavior getDropBehavior() {
+ return this.dropBehavior;
+ }
+
+ public void setDropComponent(UIComponent dropComponent) {
+ this.dropComponent = dropComponent;
+ }
+
+ public UIComponent getDropComponent() {
+ return this.dropComponent;
+ }
+ public Object getDropValue() {
+ return dropValue;
+ }
- public void setDragSource(ClientDragBehavior dragSource) {
- this.dragSource = dragSource;
+ public void setDropValue(Object dropValue) {
+ this.dropValue = dropValue;
}
+ public Object getDragValue() {
+ return dragValue;
+ }
+
+ public void setDragValue(Object dragValue) {
+ this.dragValue = dragValue;
+ }
+
+ public ClientDragBehavior getDragBehavior() {
+ return dragBehavior;
+ }
+
+ public void setDragBehavior(ClientDragBehavior dragBehavior) {
+ this.dragBehavior = dragBehavior;
+ }
+
public UIComponent getDragComponent() {
return dragComponent;
}
@@ -61,16 +103,7 @@
public void setDragComponent(UIComponent dragComponent) {
this.dragComponent = dragComponent;
}
-
- public ClientDropBehavior getDropSource() {
- return (ClientDropBehavior)getBehavior();
- }
- public UIComponent getDropComponent() {
- return getComponent();
- }
-
-
@Override
public boolean isAppropriateListener(FacesListener listener) {
return (listener instanceof DropListener);
@@ -80,5 +113,4 @@
public void processListener(FacesListener listener) {
((DropListener) listener).processDrop(this);
}
-
}
\ No newline at end of file
Modified: branches/RF-7654/ui/dnd/ui/src/main/java/org/richfaces/renderkit/DropBehaviorRendererBase.java
===================================================================
--- branches/RF-7654/ui/dnd/ui/src/main/java/org/richfaces/renderkit/DropBehaviorRendererBase.java 2010-12-16 17:43:00 UTC (rev 20623)
+++ branches/RF-7654/ui/dnd/ui/src/main/java/org/richfaces/renderkit/DropBehaviorRendererBase.java 2010-12-16 18:10:56 UTC (rev 20624)
@@ -76,7 +76,19 @@
Map<String, String> requestParamMap = facesContext.getExternalContext().getRequestParameterMap();
String dragSource = (String) requestParamMap.get("dragSource");
- facesContext.getViewRoot().invokeOnComponent(facesContext, dragSource, new DropBehaviorContextCallBack(component, (ClientDropBehavior)behavior));
+
+ DragBehaviorContextCallBack dragBehaviorContextCallBack = new DragBehaviorContextCallBack();
+ facesContext.getViewRoot().invokeOnComponent(facesContext, dragSource, dragBehaviorContextCallBack);
+
+ if(behavior instanceof ClientDropBehavior) {
+ ClientDropBehavior dropBehavior = (ClientDropBehavior)behavior;
+ DropEvent dropEvent = new DropEvent(component, dropBehavior);
+ dropEvent.setDropValue(dropBehavior.getDropValue());
+ dropEvent.setDragComponent(dragBehaviorContextCallBack.getDragComponent());
+ dropEvent.setDragBehavior(dragBehaviorContextCallBack.getDragBehavior());
+ dropEvent.setDragValue(dragBehaviorContextCallBack.getDragValue());
+ queueEvent(dropEvent);
+ }
}
@Override
@@ -91,67 +103,36 @@
ClientDropBehavior dropBehavior = (ClientDropBehavior)behavior;
options.put("acceptedTypes", dropBehavior.getAcceptedTypes());
}
-
return options;
}
- private final class DropBehaviorContextCallBack implements ContextCallback {
+ private final class DragBehaviorContextCallBack implements ContextCallback {
- private ClientDropBehavior dropBehavior;
+ private Object dragValue;
- private UIComponent dropSource;
+ private ClientDragBehavior dragBehavior;
- public DropBehaviorContextCallBack(UIComponent dropSource, ClientDropBehavior dropBehavior) {
- this.dropSource = dropSource;
- this.dropBehavior = dropBehavior;
- }
+ private UIComponent dragComponent;
public void invokeContextCallback(FacesContext context, UIComponent target) {
ClientDragBehavior dragBehavior = getDragBehavior(target, "mouseover");
- if(dragBehavior != null) {
- DropEvent dropEvent = new DropEvent(dropSource, dropBehavior);
- dropEvent.setDragSource(dragBehavior);
- dropEvent.setDragComponent(target);
- queueDropEvent(dropEvent);
- } else {
- //TODO: log
- }
+ this.dragValue = dragBehavior.getDragValue();
+ this.dragBehavior = dragBehavior;
+ this.dragComponent = target;
}
- private void queueDropEvent(DropEvent event) {
- PhaseId phaseId = PhaseId.INVOKE_APPLICATION;
-
- if (isImmediate()) {
- phaseId = PhaseId.APPLY_REQUEST_VALUES;
- } else if (isBypassUpdates()) {
- phaseId = PhaseId.PROCESS_VALIDATIONS;
- }
+ public Object getDragValue() {
+ return dragValue;
+ }
- event.setPhaseId(phaseId);
- this.dropSource.queueEvent(event);
+ public ClientDragBehavior getDragBehavior() {
+ return dragBehavior;
}
-
- private boolean isImmediate(){
- boolean immediate = this.dropBehavior.isImmediate();
- if(!immediate) {
- if (dropSource instanceof EditableValueHolder) {
- immediate = ((EditableValueHolder) dropSource).isImmediate();
- } else if (dropSource instanceof ActionSource) {
- immediate = ((ActionSource) dropSource).isImmediate();
- }
- }
-
- return immediate;
+
+ public UIComponent getDragComponent() {
+ return dragComponent;
}
- private boolean isBypassUpdates(){
- boolean bypassUpdates = this.dropBehavior.isBypassUpdates();
- if (!bypassUpdates) {
- bypassUpdates = getUtils().isBooleanAttribute(this.dropSource, "bypassUpdates");
- }
- return bypassUpdates;
- }
-
private ClientDragBehavior getDragBehavior(UIComponent parent, String event) {
if(parent instanceof ClientBehaviorHolder) {
Map<String, List<ClientBehavior>> behaviorsMap = ((ClientBehaviorHolder)parent).getClientBehaviors();
@@ -173,5 +154,43 @@
}
}
+
+ protected void queueEvent(DropEvent dropEvent){
+ UIComponent component = dropEvent.getComponent();
+ ClientDropBehavior dropBehavior = dropEvent.getDropBehavior();
+
+ if(component != null && dropBehavior != null) {
+ PhaseId phaseId = PhaseId.INVOKE_APPLICATION;
+ if (isImmediate(component, dropBehavior)) {
+ phaseId = PhaseId.APPLY_REQUEST_VALUES;
+ } else if (isBypassUpdates(component, dropBehavior)) {
+ phaseId = PhaseId.PROCESS_VALIDATIONS;
+ }
+
+ dropEvent.setPhaseId(phaseId);
+ component.queueEvent(dropEvent);
+ }
+ }
+
+ private boolean isImmediate(UIComponent component, ClientDropBehavior dropBehavior){
+ boolean immediate = dropBehavior.isImmediate();
+ if(!immediate) {
+ if (component instanceof EditableValueHolder) {
+ immediate = ((EditableValueHolder) component).isImmediate();
+ } else if (component instanceof ActionSource) {
+ immediate = ((ActionSource) component).isImmediate();
+ }
+ }
+ return immediate;
+ }
+
+ private boolean isBypassUpdates(UIComponent component, ClientDropBehavior dropBehavior){
+ boolean bypassUpdates = dropBehavior.isBypassUpdates();
+ if (!bypassUpdates) {
+ bypassUpdates = getUtils().isBooleanAttribute(component, "bypassUpdates");
+ }
+ return bypassUpdates;
+ }
+
}
Modified: branches/RF-7654/ui/dnd/ui/src/main/resources/META-INF/resources/org.richfaces/dnd-draggable.js
===================================================================
--- branches/RF-7654/ui/dnd/ui/src/main/resources/META-INF/resources/org.richfaces/dnd-draggable.js 2010-12-16 17:43:00 UTC (rev 20623)
+++ branches/RF-7654/ui/dnd/ui/src/main/resources/META-INF/resources/org.richfaces/dnd-draggable.js 2010-12-16 18:10:56 UTC (rev 20624)
@@ -1,3 +1,11 @@
+/*
+ * code review by Pavel Yaschenko
+ *
+ * No event's unbindings when component would be destroyed
+ * Hint: easy way to unbind - use namespaces when bind event handlers
+ *
+ */
+
(function ($, rf) {
rf.ui = rf.ui || {};
Modified: branches/RF-7654/ui/dnd/ui/src/main/resources/META-INF/resources/org.richfaces/dnd-droppable.js
===================================================================
--- branches/RF-7654/ui/dnd/ui/src/main/resources/META-INF/resources/org.richfaces/dnd-droppable.js 2010-12-16 17:43:00 UTC (rev 20623)
+++ branches/RF-7654/ui/dnd/ui/src/main/resources/META-INF/resources/org.richfaces/dnd-droppable.js 2010-12-16 18:10:56 UTC (rev 20624)
@@ -1,3 +1,11 @@
+/*
+ * code review by Pavel Yaschenko
+ *
+ * No event's unbindings when component would be destroyed
+ * Hint: easy way to unbind - use namespaces when bind event handlers
+ *
+ */
+
(function ($, rf) {
rf.ui = rf.ui || {};
Modified: branches/RF-7654/ui/dnd/ui/src/main/resources/META-INF/resources/org.richfaces/dnd-indicator.js
===================================================================
--- branches/RF-7654/ui/dnd/ui/src/main/resources/META-INF/resources/org.richfaces/dnd-indicator.js 2010-12-16 17:43:00 UTC (rev 20623)
+++ branches/RF-7654/ui/dnd/ui/src/main/resources/META-INF/resources/org.richfaces/dnd-indicator.js 2010-12-16 18:10:56 UTC (rev 20624)
@@ -1,3 +1,13 @@
+/*
+ * code review by Pavel Yaschenko
+ *
+ * 1. No need to save DOM element (this.indicator). We can use id to get dom element. It helps to avoid memory leaks :)
+ *
+ * 2. Name refactoring: change names acceptClass, rejectClass, draggingClass
+ * to more readable names: getAcceptClass, getRejectClass, getDragClass
+ *
+ */
+
(function ($, rf) {
rf.ui = rf.ui || {};
Modified: branches/RF-7654/ui/dnd/ui/src/main/resources/META-INF/resources/org.richfaces/dnd-manager.js
===================================================================
--- branches/RF-7654/ui/dnd/ui/src/main/resources/META-INF/resources/org.richfaces/dnd-manager.js 2010-12-16 17:43:00 UTC (rev 20623)
+++ branches/RF-7654/ui/dnd/ui/src/main/resources/META-INF/resources/org.richfaces/dnd-manager.js 2010-12-16 18:10:56 UTC (rev 20624)
@@ -1,3 +1,25 @@
+/*
+ * code review by Pavel Yaschenko
+ *
+ * records in draggables and droppables should be cleaned up when remove component from DOM
+ *
+ * draft code: something like this
+ *
+ *
+ rf.ui.Draggable = function (id, options) {
+ var c = rf.$(id);
+ if (c) {
+ var baseDestroy = c.destroy;
+ c. destroy = f ()
+ {
+ rf.ui.DnDManager.removeDraggable(id)
+ baseDestroy.call(this);
+ }
+ }
+ // other code ...
+ }
+ */
+
(function ($, rf) {
rf.ui = rf.ui || {};
Modified: branches/RF-7654/ui/input/ui/src/main/java/org/richfaces/renderkit/InplaceSelectRendererBase.java
===================================================================
--- branches/RF-7654/ui/input/ui/src/main/java/org/richfaces/renderkit/InplaceSelectRendererBase.java 2010-12-16 17:43:00 UTC (rev 20623)
+++ branches/RF-7654/ui/input/ui/src/main/java/org/richfaces/renderkit/InplaceSelectRendererBase.java 2010-12-16 18:10:56 UTC (rev 20624)
@@ -86,6 +86,18 @@
return SelectHelper.getSelectInputLabel(facesContext, component);
}
+ public String getListWidth(UIComponent component) {
+ AbstractInplaceSelect select = (AbstractInplaceSelect)component;
+ String width = select.getListWidth();
+ return (width != null && width.trim().length() != 0) ? ("width: " + width) : "";
+ }
+
+ public String getListHeight(UIComponent component) {
+ AbstractInplaceSelect select = (AbstractInplaceSelect)component;
+ String height = select.getListHeight();
+ return (height != null && height.trim().length() != 0) ? ("height: " + height) : "";
+ }
+
public String getSelectLabel(FacesContext facesContext, UIComponent component) {
AbstractInplaceSelect select = (AbstractInplaceSelect) component;
String label = getSelectInputLabel(facesContext, select);
Modified: branches/RF-7654/ui/input/ui/src/main/resources/META-INF/resources/org.richfaces/calendar.js
===================================================================
--- branches/RF-7654/ui/input/ui/src/main/resources/META-INF/resources/org.richfaces/calendar.js 2010-12-16 17:43:00 UTC (rev 20623)
+++ branches/RF-7654/ui/input/ui/src/main/resources/META-INF/resources/org.richfaces/calendar.js 2010-12-16 18:10:56 UTC (rev 20624)
@@ -19,11 +19,11 @@
getSelectedDateControl: function(calendar) {
- if (!calendar.selectedDate || calendar.params.showApplyButton) return "";
+ if (!calendar.selectedDate || calendar.options.showApplyButton) return "";
- var text = rf.calendarUtils.formatDate(calendar.selectedDate,(calendar.timeType ? calendar.datePattern : calendar.params.datePattern), calendar.params.monthLabels, calendar.params.monthLabelsShort);
+ var text = rf.calendarUtils.formatDate(calendar.selectedDate,(calendar.timeType ? calendar.datePattern : calendar.options.datePattern), calendar.options.monthLabels, calendar.options.monthLabelsShort);
var onclick = "RichFaces.$$('Calendar',this).showSelectedDate(); return true;"
- var markup = ( calendar.params.disabled ?
+ var markup = ( calendar.options.disabled ?
new E('div', {'class': 'rf-ca-tl-btn-dis'}, [new ET(text)]) :
new E('div', {'class': 'rf-ca-tl-btn', 'onclick': onclick}, [new ET(text)]) );
@@ -34,12 +34,12 @@
if (!calendar.selectedDate || !calendar.timeType) return "";
- var text = rf.calendarUtils.formatDate(calendar.selectedDate, calendar.timePattern, calendar.params.monthLabels, calendar.params.monthLabelsShort);
+ var text = rf.calendarUtils.formatDate(calendar.selectedDate, calendar.timePattern, calendar.options.monthLabels, calendar.options.monthLabelsShort);
var onmouseover = "jQuery(this).removeClass('rf-ca-tl-btn-press');";
var onmouseout = "jQuery(this).addClass('rf-ca-tl-btn-press');";
var onclick = "RichFaces.$$('Calendar',this).showTimeEditor();return true;";
- var markup = calendar.params.disabled || calendar.params.readonly ?
+ var markup = calendar.options.disabled || calendar.options.readonly ?
new E('div', {'class': 'rf-ca-tl-btn-btn-dis'}, [new ET(text)]) :
new E('div', {'class': 'rf-ca-tl-btn rf-ca-tl-btn-hov rf-ca-tl-btn-press', 'onclick': onclick,
'onmouseover': + onmouseover ,
@@ -50,35 +50,35 @@
toolButtonAttributes: {className: "rf-ca-tl-btn", onmouseover:"this.className='rf-ca-tl-btn rf-ca-tl-btn-hov'", onmouseout:"this.className='rf-ca-tl-btn'", onmousedown:"this.className='rf-ca-tl-btn rf-ca-tl-btn-hov rf-ca-tl-btn-btn-press'", onmouseup:"this.className='rf-ca-tl-btn rf-ca-tl-btn-hov'"},
nextYearControl: function (context) {
- return (!context.calendar.params.disabled ? CalendarView.getControl(">>", CalendarView.toolButtonAttributes, "nextYear") : "");
+ return (!context.calendar.options.disabled ? CalendarView.getControl(">>", CalendarView.toolButtonAttributes, "nextYear") : "");
},
previousYearControl: function (context) {
- return (!context.calendar.params.disabled ? CalendarView.getControl("<<", CalendarView.toolButtonAttributes, "prevYear") : "");
+ return (!context.calendar.options.disabled ? CalendarView.getControl("<<", CalendarView.toolButtonAttributes, "prevYear") : "");
},
nextMonthControl: function (context) {
- return (!context.calendar.params.disabled ? CalendarView.getControl(">", CalendarView.toolButtonAttributes, "nextMonth") : "");
+ return (!context.calendar.options.disabled ? CalendarView.getControl(">", CalendarView.toolButtonAttributes, "nextMonth") : "");
},
previousMonthControl: function (context) {
- return (!context.calendar.params.disabled ? CalendarView.getControl("<", CalendarView.toolButtonAttributes, "prevMonth") : "");
+ return (!context.calendar.options.disabled ? CalendarView.getControl("<", CalendarView.toolButtonAttributes, "prevMonth") : "");
},
currentMonthControl: function (context) {
var text = rf.calendarUtils.formatDate(context.calendar.getCurrentDate(), "MMMM, yyyy", context.monthLabels, context.monthLabelsShort);
- var markup = context.calendar.params.disabled ?
+ var markup = context.calendar.options.disabled ?
new E('div',{className: "rf-ca-tl-btn-dis"},[new T(text)]) :
CalendarView.getControl(text, CalendarView.toolButtonAttributes, "showDateEditor");
return markup;
},
todayControl: function (context) {
- return (!context.calendar.params.disabled && context.calendar.params.todayControlMode!='hidden' ? CalendarView.getControl(context.controlLabels.today, CalendarView.toolButtonAttributes, "today") : "");
+ return (!context.calendar.options.disabled && context.calendar.options.todayControlMode!='hidden' ? CalendarView.getControl(context.controlLabels.today, CalendarView.toolButtonAttributes, "today") : "");
},
closeControl: function (context) {
- return (context.calendar.params.popup ? CalendarView.getControl(context.controlLabels.close, CalendarView.toolButtonAttributes, "close", "false") : "");
+ return (context.calendar.options.popup ? CalendarView.getControl(context.controlLabels.close, CalendarView.toolButtonAttributes, "close", "false") : "");
},
applyControl: function (context) {
- return (!context.calendar.params.disabled && !context.calendar.params.readonly && context.calendar.params.showApplyButton ? CalendarView.getControl(context.controlLabels.apply, CalendarView.toolButtonAttributes, "close", "true") : "");
+ return (!context.calendar.options.disabled && !context.calendar.options.readonly && context.calendar.options.showApplyButton ? CalendarView.getControl(context.controlLabels.apply, CalendarView.toolButtonAttributes, "close", "true") : "");
},
cleanControl: function (context) {
- return (!context.calendar.params.disabled && !context.calendar.params.readonly && context.calendar.selectedDate ? CalendarView.getControl(context.controlLabels.clean, CalendarView.toolButtonAttributes, "resetSelectedDate") : "");
+ return (!context.calendar.options.disabled && !context.calendar.options.readonly && context.calendar.selectedDate ? CalendarView.getControl(context.controlLabels.clean, CalendarView.toolButtonAttributes, "resetSelectedDate") : "");
},
selectedDateControl: function (context) { return CalendarView.getSelectedDateControl(context.calendar);},
@@ -141,7 +141,7 @@
new ET(function (context) { return rf.calendarTemplates.evalMacro("timeControl", context)})
]),
new E('td',{'class': 'rf-ca-tl-ftr', 'style': 'background-image:none;', 'width': '100%'}, []),
- new E('td',{'class': 'rf-ca-tl-ftr', 'style':function(context){return (this.isEmpty ? 'display:none;' : '')+(context.calendar.params.disabled || context.calendar.params.readonly || !context.calendar.params.showApplyButton ? 'background-image:none;' : '');}},
+ new E('td',{'class': 'rf-ca-tl-ftr', 'style':function(context){return (this.isEmpty ? 'display:none;' : '')+(context.calendar.options.disabled || context.calendar.options.readonly || !context.calendar.options.showApplyButton ? 'background-image:none;' : '');}},
[
new ET(function (context) { return rf.calendarTemplates.evalMacro("todayControl", context)})
]),
@@ -204,11 +204,11 @@
// calendar context
var CalendarContext = function(calendar) {
this.calendar=calendar;
- this.monthLabels=calendar.params.monthLabels;
- this.monthLabelsShort=calendar.params.monthLabelsShort;
- this.weekDayLabels=calendar.params.weekDayLabels;
- this.weekDayLabelsShort=calendar.params.weekDayLabelsShort;
- this.controlLabels=calendar.params.labels;
+ this.monthLabels=calendar.options.monthLabels;
+ this.monthLabelsShort=calendar.options.monthLabelsShort;
+ this.weekDayLabels=calendar.options.weekDayLabels;
+ this.weekDayLabelsShort=calendar.options.weekDayLabelsShort;
+ this.controlLabels=calendar.options.labels;
};
$.extend(CalendarContext.prototype, {
@@ -333,37 +333,37 @@
//create parameters
//this.options = $.extend(this.options, defaultOptions, options);
- this.params = $.extend({}, defaultOptions, locales[locale], options, markups);
+ this.options = $.extend(this.options, defaultOptions, locales[locale], options, markups);
// labels
var value = options.labels || {};
for (var name in defaultLabels) {
if (!value[name]) value[name] = defaultLabels[name];
}
- this.params.labels = value;
+ this.options.labels = value;
- this.popupOffset = [this.params.horizontalOffset, this.params.verticalOffset];
+ this.popupOffset = [this.options.horizontalOffset, this.options.verticalOffset];
//
- if (!this.params.popup) this.params.showApplyButton = false;
+ if (!this.options.popup) this.options.showApplyButton = false;
//
- this.params.boundaryDatesMode = this.params.boundaryDatesMode.toLowerCase();
- this.params.todayControlMode = this.params.todayControlMode.toLowerCase();
+ this.options.boundaryDatesMode = this.options.boundaryDatesMode.toLowerCase();
+ this.options.todayControlMode = this.options.todayControlMode.toLowerCase();
// time
this.setTimeProperties();
- this.customDayListMarkup = (this.params.dayListMarkup!=CalendarView.dayList);
+ this.customDayListMarkup = (this.options.dayListMarkup!=CalendarView.dayList);
- this.currentDate = this.params.currentDate ? this.params.currentDate : (this.params.selectedDate ? this.params.selectedDate : new Date());
+ this.currentDate = this.options.currentDate ? this.options.currentDate : (this.options.selectedDate ? this.options.selectedDate : new Date());
this.currentDate.setDate(1);
- this.selectedDate = this.params.selectedDate;
+ this.selectedDate = this.options.selectedDate;
this.todayDate = new Date();
- this.firstWeekendDayNumber = 6-this.params.firstWeekDay;
- this.secondWeekendDayNumber = (this.params.firstWeekDay>0 ? 7-this.params.firstWeekDay : 0);
+ this.firstWeekendDayNumber = 6-this.options.firstWeekDay;
+ this.secondWeekendDayNumber = (this.options.firstWeekDay>0 ? 7-this.options.firstWeekDay : 0);
this.calendarContext = new CalendarContext(this);
@@ -400,7 +400,7 @@
var popupStyles = "";
this.isVisible = true;
- if (this.params.popup==true)
+ if (this.options.popup==true)
{
// popup mode initialisation
popupStyles = "display:none; position:absolute;"
@@ -409,12 +409,12 @@
var tempStr = "RichFaces.$('"+this.id+"').";
- var htmlTextHeader = '<table id="'+this.CALENDAR_CONTENT+'" border="0" cellpadding="0" cellspacing="0" class="rf-ca-extr rf-ca-popup '+this.params.styleClass+'" style="'+popupStyles+this.params.style+'" onclick="'+tempStr+'skipEventOnCollapse=true;"><tbody>';
- var colspan = (this.params.showWeeksBar ? "8" : "7");
- var htmlHeaderOptional = (this.params.optionalHeaderMarkup) ? '<tr><td class="rf-ca-hdr-optnl" colspan="'+colspan+'" id="'+this.id+'HeaderOptional"></td></tr>' : '';
- var htmlFooterOptional = (this.params.optionalFooterMarkup) ? '<tr><td class="rf-ca-ftr-optl" colspan="'+colspan+'" id="'+this.id+'FooterOptional"></td></tr>' : '';
- var htmlControlsHeader = (this.params.showHeader ? '<tr><td class="rf-ca-hdr" colspan="'+colspan+'" id="'+this.id+'Header"></td></tr>' : '');
- var htmlControlsFooter = (this.params.showFooter ? '<tr><td class="rf-ca-ftr" colspan="'+colspan+'" id="'+this.id+'Footer"></td></tr>' : '');
+ var htmlTextHeader = '<table id="'+this.CALENDAR_CONTENT+'" border="0" cellpadding="0" cellspacing="0" class="rf-ca-extr rf-ca-popup '+this.options.styleClass+'" style="'+popupStyles+this.options.style+'" onclick="'+tempStr+'skipEventOnCollapse=true;"><tbody>';
+ var colspan = (this.options.showWeeksBar ? "8" : "7");
+ var htmlHeaderOptional = (this.options.optionalHeaderMarkup) ? '<tr><td class="rf-ca-hdr-optnl" colspan="'+colspan+'" id="'+this.id+'HeaderOptional"></td></tr>' : '';
+ var htmlFooterOptional = (this.options.optionalFooterMarkup) ? '<tr><td class="rf-ca-ftr-optl" colspan="'+colspan+'" id="'+this.id+'FooterOptional"></td></tr>' : '';
+ var htmlControlsHeader = (this.options.showHeader ? '<tr><td class="rf-ca-hdr" colspan="'+colspan+'" id="'+this.id+'Header"></td></tr>' : '');
+ var htmlControlsFooter = (this.options.showFooter ? '<tr><td class="rf-ca-ftr" colspan="'+colspan+'" id="'+this.id+'Footer"></td></tr>' : '');
var htmlTextFooter = '</tbody></table>'
// days bar creation
@@ -423,16 +423,16 @@
var htmlTextWeekDayBar=[];
var context;
- var eventsStr = this.params.disabled || this.params.readonly ? '' : 'onclick="'+tempStr+'eventCellOnClick(event, this);" onmouseover="'+tempStr+'eventCellOnMouseOver(event, this);" onmouseout="'+tempStr+'eventCellOnMouseOut(event, this);"';
- if (this.params.showWeekDaysBar)
+ var eventsStr = this.options.disabled || this.options.readonly ? '' : 'onclick="'+tempStr+'eventCellOnClick(event, this);" onmouseover="'+tempStr+'eventCellOnMouseOver(event, this);" onmouseout="'+tempStr+'eventCellOnMouseOut(event, this);"';
+ if (this.options.showWeekDaysBar)
{
htmlTextWeekDayBar.push('<tr id="'+this.WEEKDAY_BAR_ID+'">');
- if (this.params.showWeeksBar) htmlTextWeekDayBar.push('<td class="rf-ca-days"><br/></td>');
- var weekDayCounter = this.params.firstWeekDay;
+ if (this.options.showWeeksBar) htmlTextWeekDayBar.push('<td class="rf-ca-days"><br/></td>');
+ var weekDayCounter = this.options.firstWeekDay;
for (var i=0;i<7;i++)
{
- context = {weekDayLabel: this.params.weekDayLabels[weekDayCounter], weekDayLabelShort: this.params.weekDayLabelsShort[weekDayCounter], weekDayNumber:weekDayCounter, isWeekend:this.isWeekend(i), elementId:this.WEEKDAY_ELEMENT_ID+i, component:this};
- var weekDayHtml = this.evaluateMarkup(this.params.weekDayMarkup, context );
+ context = {weekDayLabel: this.options.weekDayLabels[weekDayCounter], weekDayLabelShort: this.options.weekDayLabelsShort[weekDayCounter], weekDayNumber:weekDayCounter, isWeekend:this.isWeekend(i), elementId:this.WEEKDAY_ELEMENT_ID+i, component:this};
+ var weekDayHtml = this.evaluateMarkup(this.options.weekDayMarkup, context );
if (weekDayCounter==6) weekDayCounter=0; else weekDayCounter++;
styleClass = "rf-ca-days";
@@ -455,24 +455,24 @@
{
bottomStyleClass = (k==6 ? "rf-btm-c " : "");
htmlTextWeek.push('<tr id="'+this.WEEKNUMBER_BAR_ID+k+'">');
- if (this.params.showWeeksBar)
+ if (this.options.showWeeksBar)
{
context = {weekNumber: k, elementId:this.WEEKNUMBER_ELEMENT_ID+k, component:this};
- var weekNumberHtml = this.evaluateMarkup(this.params.weekNumberMarkup, context );
+ var weekNumberHtml = this.evaluateMarkup(this.options.weekNumberMarkup, context );
htmlTextWeek.push('<td class="rf-ca-week '+bottomStyleClass+'" id="'+context.elementId+'">'+weekNumberHtml+'</td>');
}
// day cells creation
for (var i=0;i<7;i++)
{
- styleClass = bottomStyleClass+(!this.params.dayCellClass ? "rf-ca-c-size" : (!this.customDayListMarkup ? this.params.dayCellClass : ""))+" rf-ca-c";
+ styleClass = bottomStyleClass+(!this.options.dayCellClass ? "rf-ca-c-size" : (!this.customDayListMarkup ? this.options.dayCellClass : ""))+" rf-ca-c";
if (i==this.firstWeekendDayNumber || i==this.secondWeekendDayNumber) styleClass+=" rf-ca-holly";
if (i==6) styleClass+=" rf-rgh-c";
this.dayCellClassName.push(styleClass);
htmlTextWeek.push('<td class="'+styleClass+'" id="'+this.DATE_ELEMENT_ID+p+'" '+
eventsStr+
- '>'+(this.customDayListMarkup ? '<div class="rf-ca-c-div'+(this.params.dayCellClass ? ' '+this.params.dayCellClass : '')+'"></div>' : '')+'</td>');
+ '>'+(this.customDayListMarkup ? '<div class="rf-ca-c-div'+(this.options.dayCellClass ? ' '+this.options.dayCellClass : '')+'"></div>' : '')+'</td>');
p++;
}
htmlTextWeek.push('</tr>');
@@ -486,11 +486,11 @@
div = null;
// add onclick event handlers to input field and popup button
- if (this.params.popup && !this.params.disabled)
+ if (this.options.popup && !this.options.disabled)
{
var handler = new Function ('event', "RichFaces.$('"+this.id+"').doSwitch();");
rf.Event.bindById(this.POPUP_BUTTON_ID, "click"+this.namespace, handler, this);
- if (!this.params.enableManualInput)
+ if (!this.options.enableManualInput)
{
rf.Event.bindById(this.INPUT_DATE_ID, "click"+this.namespace, handler, this);
}
@@ -501,13 +501,15 @@
//alert(new Date().getTime()-_d.getTime());
//define isAjaxMode variable
- "ajax" == this.params.mode ? this.isAjaxMode = true : this.isAjaxMode = false;
+ "ajax" == this.options.mode ? this.isAjaxMode = true : this.isAjaxMode = false;
+ /*
//events handler binding
for (var i in eventHandlerNames) {
- var handler = this.params["on"+eventHandlerNames[i]];
+ var handler = this.options["on"+eventHandlerNames[i]];
if (handler) rf.Event.bindById(this.id, eventHandlerNames[i], handler, this);
- }
+ }
+ */
};
// Extend component class and add protected methods from parent class to our container
@@ -532,7 +534,7 @@
name: "Calendar",
destroy: function()
{
- if (this.params.popup && this.isVisible)
+ if (this.options.popup && this.isVisible)
{
this.scrollElements && rf.Event.unbindScrollEventHandlers(this.scrollElements, this);
this.scrollElements = null;
@@ -723,16 +725,16 @@
var month = 0;
this.dateEditorYear = this.getCurrentYear();
var year = this.dateEditorStartYear = this.dateEditorYear-4;
- var htmlContent = '<td align="center">'+this.createDECell(this.DATE_EDITOR_LAYOUT_ID+'M'+month, this.params.monthLabelsShort[month], 1, month)+'</td>'
- +'<td align="center" class="rf-ca-date-layout-split">'+this.createDECell(this.DATE_EDITOR_LAYOUT_ID+'M'+(month+6), this.params.monthLabelsShort[month+6], 1, month+6)+'</td>'
+ var htmlContent = '<td align="center">'+this.createDECell(this.DATE_EDITOR_LAYOUT_ID+'M'+month, this.options.monthLabelsShort[month], 1, month)+'</td>'
+ +'<td align="center" class="rf-ca-date-layout-split">'+this.createDECell(this.DATE_EDITOR_LAYOUT_ID+'M'+(month+6), this.options.monthLabelsShort[month+6], 1, month+6)+'</td>'
+'<td align="center">'+this.createDECell('','<', 0, -1)+'</td>'
+'<td align="center">'+this.createDECell('','>', 0, 1)+'</td>';
month++;
for (var i=0;i<5;i++)
{
- htmlContent+='</tr><tr><td align="center">'+this.createDECell(this.DATE_EDITOR_LAYOUT_ID+'M'+month, this.params.monthLabelsShort[month], 1, month)+'</td>'
- +'<td align="center" class="rf-ca-date-layout-split">'+this.createDECell(this.DATE_EDITOR_LAYOUT_ID+'M'+(month+6), this.params.monthLabelsShort[month+6], 1, month+6)+'</td>'
+ htmlContent+='</tr><tr><td align="center">'+this.createDECell(this.DATE_EDITOR_LAYOUT_ID+'M'+month, this.options.monthLabelsShort[month], 1, month)+'</td>'
+ +'<td align="center" class="rf-ca-date-layout-split">'+this.createDECell(this.DATE_EDITOR_LAYOUT_ID+'M'+(month+6), this.options.monthLabelsShort[month+6], 1, month+6)+'</td>'
+'<td align="center">'+this.createDECell(this.DATE_EDITOR_LAYOUT_ID+'Y'+i, year, 2, i, (i==4 ? 'rf-ca-edtr-btn-sel' : ''))+'</td>'
+'<td align="center">'+this.createDECell(this.DATE_EDITOR_LAYOUT_ID+'Y'+(i+5), year+5, 2, i+5)+'</td>';
month++;
@@ -743,9 +745,9 @@
this.dateEditorMonthID = this.DATE_EDITOR_LAYOUT_ID+'M'+this.dateEditorMonth;
htmlContent+='</tr><tr><td colspan="2" class="rf-ca-date-layout-ok">'+
- '<div id="'+this.DATE_EDITOR_BUTTON_OK+'" class="rf-ca-time-btn" style="float:right;" onmousedown="jQuery(this).addClass(\'rf-ca-time-btn-press\');" onmouseout="$(this).removeClass(\'rf-ca-time-btn-press\');" onmouseup="$(this).removeClass(\'rf-ca-time-btn-press\');" onclick="RichFaces.$(\''+this.id+'\').hideDateEditor(true);"><span>'+this.params.labels.ok+'</span></div>'+
+ '<div id="'+this.DATE_EDITOR_BUTTON_OK+'" class="rf-ca-time-btn" style="float:right;" onmousedown="jQuery(this).addClass(\'rf-ca-time-btn-press\');" onmouseout="$(this).removeClass(\'rf-ca-time-btn-press\');" onmouseup="$(this).removeClass(\'rf-ca-time-btn-press\');" onclick="RichFaces.$(\''+this.id+'\').hideDateEditor(true);"><span>'+this.options.labels.ok+'</span></div>'+
'</td><td colspan="2" class="rf-ca-date-layout-cancel">'+
- '<div id="'+this.DATE_EDITOR_BUTTON_CANCEL+'" class="rf-ca-time-btn" style="float:left;" onmousedown="jQuery(this).addClass(\'rf-ca-time-btn-press\');" onmouseout="$(this).removeClass(\'rf-ca-time-btn-press\');" onmouseup="$(this).removeClass(\'rf-ca-time-btn-press\');" onclick="RichFaces.$(\''+this.id+'\').hideDateEditor(false);"><span>'+this.params.labels.cancel+'</span></div>'+
+ '<div id="'+this.DATE_EDITOR_BUTTON_CANCEL+'" class="rf-ca-time-btn" style="float:left;" onmousedown="jQuery(this).addClass(\'rf-ca-time-btn-press\');" onmouseout="$(this).removeClass(\'rf-ca-time-btn-press\');" onmouseup="$(this).removeClass(\'rf-ca-time-btn-press\');" onclick="RichFaces.$(\''+this.id+'\').hideDateEditor(false);"><span>'+this.options.labels.cancel+'</span></div>'+
'</td>';
@@ -785,7 +787,7 @@
setTimeProperties: function() {
this.timeType = 0;
- var dateTimePattern = this.params.datePattern;
+ var dateTimePattern = this.options.datePattern;
var pattern = [];
var re = /(\\\\|\\[yMdaHhms])|(y+|M+|d+|a|H{1,2}|h{1,2}|m{2}|s{2})/g;
var r;
@@ -877,7 +879,7 @@
doCollapse: function() {
- if (!this.params.popup || !this.isVisible) return;
+ if (!this.options.popup || !this.isVisible) return;
if (this.invokeEvent("hide", rf.getDomElement(this.id)))
{
@@ -903,7 +905,7 @@
}
this.skipEventOnCollapse = false;
if (e && e.type=='click') this.skipEventOnCollapse = true;
- if (!this.params.popup || this.isVisible) return;
+ if (!this.options.popup || this.isVisible) return;
var element = rf.getDomElement(this.id);
@@ -920,14 +922,14 @@
//rect calculation
- if (this.params.showInput)
+ if (this.options.showInput)
{
base = base.children;
} else {
base = baseButton;
};
- $(rf.getDomElement(this.CALENDAR_CONTENT)).setPosition(base, {type:"DROPDOWN", from: this.params.jointPoint, to:this.params.direction, offset: this.popupOffset}).show();
+ $(rf.getDomElement(this.CALENDAR_CONTENT)).setPosition(base, {type:"DROPDOWN", from: this.options.jointPoint, to:this.options.direction, offset: this.popupOffset}).show();
this.isVisible = true;
@@ -935,7 +937,7 @@
this.scrollElements && rf.Event.unbindScrollEventHandlers(this.scrollElements, this);
this.scrollElements = null;
- if (this.params.hidePopupOnScroll) {
+ if (this.options.hidePopupOnScroll) {
this.scrollElements = rf.Event.bindScrollEventHandlers(element, this.eventOnScroll, this);
}
}
@@ -960,7 +962,7 @@
return true;
}
- if (e.target.id == this.POPUP_BUTTON_ID || (!this.params.enableManualInput && e.target.id == this.INPUT_DATE_ID) ) return true;
+ if (e.target.id == this.POPUP_BUTTON_ID || (!this.options.enableManualInput && e.target.id == this.INPUT_DATE_ID) ) return true;
this.doCollapse();
@@ -985,8 +987,8 @@
},
getSelectedDateString: function(pattern) {
if (!this.selectedDate) return "";
- if (!pattern) pattern = this.params.datePattern;
- return rf.calendarUtils.formatDate(this.selectedDate, pattern, this.params.monthLabels, this.params.monthLabelsShort);
+ if (!pattern) pattern = this.options.datePattern;
+ return rf.calendarUtils.formatDate(this.selectedDate, pattern, this.options.monthLabels, this.options.monthLabelsShort);
},
getPrevYear: function() {
@@ -999,7 +1001,7 @@
if (value < 0 ) value = 11;
if (asMonthLabel)
{
- return this.params.monthLabels[value];
+ return this.options.monthLabels[value];
} else return value;
},
getCurrentYear: function() {
@@ -1009,7 +1011,7 @@
var value = this.currentDate.getMonth();
if (asMonthLabel)
{
- return this.params.monthLabels[value];
+ return this.options.monthLabels[value];
} else return value;
},
getNextYear: function() {
@@ -1020,7 +1022,7 @@
if (value > 11 ) value = 0;
if (asMonthLabel)
{
- return this.params.monthLabels[value];
+ return this.options.monthLabels[value];
} else return value;
},
@@ -1029,7 +1031,7 @@
},
setupTimeForDate: function (date) {
- if (this.selectedDate && (!this.params.resetTimeOnDateSelect ||
+ if (this.selectedDate && (!this.options.resetTimeOnDateSelect ||
(this.selectedDate.getFullYear() == date.getFullYear() &&
this.selectedDate.getMonth() == date.getMonth() &&
this.selectedDate.getDate() == date.getDate())))
@@ -1039,9 +1041,9 @@
date.setSeconds(this.selectedDate.getSeconds());
} else
{
- date.setHours(this.params.defaultTime.hours);
- date.setMinutes(this.params.defaultTime.minutes);
- date.setSeconds(this.params.defaultTime.seconds);
+ date.setHours(this.options.defaultTime.hours);
+ date.setMinutes(this.options.defaultTime.minutes);
+ date.setSeconds(this.options.defaultTime.seconds);
}
},
@@ -1056,15 +1058,15 @@
this.setupTimeForDate(date);
}
- if (this.selectDate(date,true, {event:e, element:obj}) && !this.params.showApplyButton)
+ if (this.selectDate(date,true, {event:e, element:obj}) && !this.options.showApplyButton)
{
this.doCollapse();
}
} else if (daydata._month!=0){
- if (this.params.boundaryDatesMode == "scroll")
+ if (this.options.boundaryDatesMode == "scroll")
if (daydata._month==-1) this.prevMonth(); else this.nextMonth();
- else if (this.params.boundaryDatesMode == "select")
+ else if (this.options.boundaryDatesMode == "select")
{
var date = new Date(daydata.date);
if (this.timeType)
@@ -1072,7 +1074,7 @@
this.setupTimeForDate(date);
}
- if (this.selectDate(date, false, {event:e, element:obj}) && !this.params.showApplyButton)
+ if (this.selectDate(date, false, {event:e, element:obj}) && !this.options.showApplyButton)
{
this.doCollapse();
}
@@ -1187,7 +1189,7 @@
var selectedflag = this.selectedDate && (currentYear == this.selectedDate.getFullYear() && currentMonth == this.selectedDate.getMonth())
var selecteddate = this.selectedDate && this.selectedDate.getDate();
- var wd = rf.calendarUtils.getDay(this.currentDate, this.params.firstWeekDay);
+ var wd = rf.calendarUtils.getDay(this.currentDate, this.options.firstWeekDay);
var currentMonthDays = rf.calendarUtils.daysInMonthByDate(this.currentDate);
var previousMonthDays = rf.calendarUtils.daysInMonth(currentYear, currentMonth-1);
@@ -1255,13 +1257,13 @@
var element;
var dataobj;
var wn;
- if (this.params.showWeeksBar) wn = rf.calendarUtils.weekNumber(currentYear, currentMonth, this.params.minDaysInFirstWeek, this.params.firstWeekDay); /// fix it
+ if (this.options.showWeeksBar) wn = rf.calendarUtils.weekNumber(currentYear, currentMonth, this.options.minDaysInFirstWeek, this.options.firstWeekDay); /// fix it
this.selectedDayElement=null;
var weekflag=true;
var e;
- var boundaryDatesModeFlag = (this.params.boundaryDatesMode == "scroll" || this.params.boundaryDatesMode == "select");
+ var boundaryDatesModeFlag = (this.options.boundaryDatesMode == "scroll" || this.options.boundaryDatesMode == "select");
this.todayCellId = this.clearEffect(this.todayCellId);
this.selectedDateCellId = this.clearEffect(this.selectedDateCellId);
@@ -1277,23 +1279,23 @@
var weeknumber;
// week number update
- if (this.params.showWeeksBar)
+ if (this.options.showWeeksBar)
{
// TODO: fix: there is no weekNumber in dataobj if showWeeksBar == false;
if (weekflag && currentMonth==11 &&
(k==5||k==6) &&
- (dataobj._month==1 || (7 - (currentMonthDays - dataobj.day + 1)) >= this.params.minDaysInFirstWeek) )
+ (dataobj._month==1 || (7 - (currentMonthDays - dataobj.day + 1)) >= this.options.minDaysInFirstWeek) )
{
wn=1;
weekflag=false;
}
weeknumber = wn;
- element.innerHTML = this.evaluateMarkup(this.params.weekNumberMarkup, {weekNumber: wn++, elementId:element.id, component:this} );
+ element.innerHTML = this.evaluateMarkup(this.options.weekNumberMarkup, {weekNumber: wn++, elementId:element.id, component:this} );
if (k==1&&wn>52) wn=1;
element = element.nextSibling;
}
- var weekdaycounter = this.params.firstWeekDay;
+ var weekdaycounter = this.options.firstWeekDay;
var contentElement = null;
while (element)
@@ -1306,18 +1308,18 @@
dataobj.weekDayNumber = weekdaycounter;
// call user function to get day state
- if (dataobj.enabled != false) dataobj.enabled = this.params.isDayEnabled(dataobj);
+ if (dataobj.enabled != false) dataobj.enabled = this.options.isDayEnabled(dataobj);
// call user function to custom class style
- if (!dataobj.styleClass) dataobj.customStyleClass = this.params.dayStyleClass(dataobj);
+ if (!dataobj.styleClass) dataobj.customStyleClass = this.options.dayStyleClass(dataobj);
else
{
- var styleclass = this.params.dayStyleClass(dataobj);
+ var styleclass = this.options.dayStyleClass(dataobj);
dataobj.customStyleClass = dataobj.styleClass;
if (styleclass) dataobj.customStyleClass += " " + styleclass;
}
contentElement = (this.customDayListMarkup ? element.firstChild : element);
- contentElement.innerHTML = this.evaluateMarkup(this.params.dayListMarkup, dataobj );
+ contentElement.innerHTML = this.evaluateMarkup(this.options.dayListMarkup, dataobj );
if (weekdaycounter==6) weekdaycounter=0; else weekdaycounter++;
@@ -1327,7 +1329,7 @@
if (dataobj._month!=0)
{
classNames+=' rf-ca-boundary-dates';
- if (!this.params.disabled && !this.params.readonly && boundaryDatesModeFlag)
+ if (!this.options.disabled && !this.options.readonly && boundaryDatesModeFlag)
{
classNames+=' rf-ca-btn';
}
@@ -1347,7 +1349,7 @@
this.selectedDateCellColor = this.getCellBackgroundColor(element);
classNames+=" rf-ca-sel";
}
- else if (!this.params.disabled && !this.params.readonly && dataobj.enabled) classNames+=' rf-ca-btn';
+ else if (!this.options.disabled && !this.options.readonly && dataobj.enabled) classNames+=' rf-ca-btn';
// add custom style class
if (dataobj.customStyleClass)
@@ -1371,8 +1373,8 @@
renderHF: function()
{
- if (this.params.showHeader) this.renderMarkup(this.params.headerMarkup, this.id+"Header", this.calendarContext);
- if (this.params.showFooter) this.renderMarkup(this.params.footerMarkup, this.id+"Footer", this.calendarContext);
+ if (this.options.showHeader) this.renderMarkup(this.options.headerMarkup, this.id+"Header", this.calendarContext);
+ if (this.options.showFooter) this.renderMarkup(this.options.footerMarkup, this.id+"Footer", this.calendarContext);
this.renderHeaderOptional();
this.renderFooterOptional();
@@ -1380,12 +1382,12 @@
renderHeaderOptional: function()
{
- this.renderMarkup(this.params.optionalHeaderMarkup, this.id+"HeaderOptional", this.calendarContext);
+ this.renderMarkup(this.options.optionalHeaderMarkup, this.id+"HeaderOptional", this.calendarContext);
},
renderFooterOptional: function()
{
- this.renderMarkup(this.params.optionalFooterMarkup, this.id+"FooterOptional", this.calendarContext);
+ this.renderMarkup(this.options.optionalFooterMarkup, this.id+"FooterOptional", this.calendarContext);
},
renderMarkup: function (markup, elementId, context)
@@ -1510,7 +1512,7 @@
this.currentDate = new Date(nowyear, nowmonth, 1);
}
- if (this.params.todayControlMode=='select')
+ if (this.options.todayControlMode=='select')
{
noHighlight=true;
}
@@ -1534,7 +1536,7 @@
}
// todayControl select mode
- if (this.params.todayControlMode=='select' && !this.params.disabled && !this.params.readonly)
+ if (this.options.todayControlMode=='select' && !this.options.disabled && !this.options.readonly)
if (updateflag && !noUpdate && this.submitFunction)
{
this.afterLoad = this.selectToday;
@@ -1554,7 +1556,7 @@
{
this.setupTimeForDate(date);
}
- if (daydata.enabled && this.selectDate(date,true) && !this.params.showApplyButton)
+ if (daydata.enabled && this.selectDate(date,true) && !this.options.showApplyButton)
{
this.doCollapse();
}
@@ -1574,7 +1576,7 @@
{
if (typeof date=='string')
{
- date = rf.calendarUtils.parseDate(date,this.params.datePattern, this.params.monthLabels, this.params.monthLabelsShort);
+ date = rf.calendarUtils.parseDate(date,this.options.datePattern, this.options.monthLabels, this.options.monthLabelsShort);
}
newSelectedDate = date;
}
@@ -1604,7 +1606,7 @@
// find cell and change style class
var e = $(rf.getDomElement(this.DATE_ELEMENT_ID+(this.firstDateIndex + this.selectedDate.getDate()-1)));
- this.clearEffect(this.selectedDateCellId, "rf-ca-sel", (this.params.disabled || this.params.readonly ? null : "rf-ca-btn"));
+ this.clearEffect(this.selectedDateCellId, "rf-ca-sel", (this.options.disabled || this.options.readonly ? null : "rf-ca-btn"));
this.selectedDateCellId = e.attr('id');
this.selectedDateCellColor = this.getCellBackgroundColor(e);
@@ -1635,7 +1637,7 @@
{
this.selectedDate = null;
- this.clearEffect(this.selectedDateCellId, "rf-ca-sel", (this.params.disabled || this.params.readonly ? null : "rf-ca-btn"));
+ this.clearEffect(this.selectedDateCellId, "rf-ca-sel", (this.options.disabled || this.options.readonly ? null : "rf-ca-btn"));
if (this.selectedDateCellId)
{
@@ -1649,19 +1651,19 @@
this.renderHF();
}
- var todayControlMode = this.params.todayControlMode;
- this.params.todayControlMode = '';
+ var todayControlMode = this.options.todayControlMode;
+ this.options.todayControlMode = '';
this.today(noUpdate, true);
- this.params.todayControlMode = todayControlMode;
+ this.options.todayControlMode = todayControlMode;
}
// call user event
if (isDateChange)
{
this.invokeEvent("dateselect", eventData.element, eventData.event, this.selectedDate);
- if (!this.params.showApplyButton)
+ if (!this.options.showApplyButton)
{
- this.setInputField(this.selectedDate!=null ? this.getSelectedDateString(this.params.datePattern) : "", eventData.event);
+ this.setInputField(this.selectedDate!=null ? this.getSelectedDateString(this.options.datePattern) : "", eventData.event);
}
}
}
@@ -1677,10 +1679,10 @@
this.selectedDate = null;
this.invokeEvent("dateselect", null, null, null);
- this.selectedDateCellId = this.clearEffect(this.selectedDateCellId, "rf-ca-sel", (this.params.disabled || this.params.readonly ? null : "rf-ca-btn"));
+ this.selectedDateCellId = this.clearEffect(this.selectedDateCellId, "rf-ca-sel", (this.options.disabled || this.options.readonly ? null : "rf-ca-btn"));
this.invokeEvent("clean", null, null, null);
this.renderHF();
- if (!this.params.showApplyButton)
+ if (!this.options.showApplyButton)
{
this.setInputField("", null);
this.doCollapse();
@@ -1716,7 +1718,7 @@
{
if (updateDate)
{
- this.setInputField(this.getSelectedDateString(this.params.datePattern), null);
+ this.setInputField(this.getSelectedDateString(this.options.datePattern), null);
}
this.doCollapse();
},
@@ -1777,7 +1779,7 @@
this.hideEditor();
if (updateTime && this.selectedDate)
{
- var s = this.showSeconds ? parseInt(rf.getDomElement(this.id+'TimeSeconds').value,10) : this.params.defaultTime.seconds;
+ var s = this.showSeconds ? parseInt(rf.getDomElement(this.id+'TimeSeconds').value,10) : this.options.defaultTime.seconds;
var m = parseInt(rf.getDomElement(this.id+'TimeMinutes').value,10);
var h = parseInt(rf.getDomElement(this.id+'TimeHours').value,10);
if (this.timeType==2)
@@ -1796,11 +1798,11 @@
{
this.selectedDate = date;
this.renderHF();
- if (!this.params.popup || !this.params.showApplyButton) this.setInputField(this.getSelectedDateString(this.params.datePattern), null);
+ if (!this.options.popup || !this.options.showApplyButton) this.setInputField(this.getSelectedDateString(this.options.datePattern), null);
this.invokeEvent("timeselect",null, null, this.selectedDate);
}
}
- if (this.params.popup && !this.params.showApplyButton) this.close(false);
+ if (this.options.popup && !this.options.showApplyButton) this.close(false);
},
showDateEditor: function()
Modified: branches/RF-7654/ui/input/ui/src/main/resources/META-INF/resources/org.richfaces/inputNumberSlider.ecss
===================================================================
--- branches/RF-7654/ui/input/ui/src/main/resources/META-INF/resources/org.richfaces/inputNumberSlider.ecss 2010-12-16 17:43:00 UTC (rev 20623)
+++ branches/RF-7654/ui/input/ui/src/main/resources/META-INF/resources/org.richfaces/inputNumberSlider.ecss 2010-12-16 18:10:56 UTC (rev 20624)
@@ -78,9 +78,9 @@
.rf-insl-tt {
position: absolute;
display: none;
- /* TODO padding: 2px;
+ padding: 2px;
border: 1px solid '#{richSkin.tipBorderColor}';
- background-color: '#{richSkin.tipBackgroundColor}';*/
+ background-color: '#{richSkin.tipBackgroundColor}';
}
.rf-insl-trc {
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-16 17:43:00 UTC (rev 20623)
+++ branches/RF-7654/ui/input/ui/src/main/resources/META-INF/resources/org.richfaces/inputNumberSlider.js 2010-12-16 18:10:56 UTC (rev 20624)
@@ -46,8 +46,11 @@
this.handle = this.track.children(".rf-insl-hnd, .rf-insl-hnd-dis");
this.tooltip = this.element.children(".rf-insl-tt");
- var proxy = jQuery.proxy(this.__inputHandler, this);
- jQuery(document).ready(proxy);
+ var value = Number(this.input.val());
+ if (isNaN(value)) {
+ value = this.minValue;
+ }
+ this.__setValue(value, null, true);
if (!this.disabled) {
this.decreaseButton = this.element.children(".rf-insl-dec");
@@ -58,6 +61,7 @@
for (var i in selectedClasses) {
this[i] += " " + selectedClasses[i];
}
+ var proxy = jQuery.proxy(this.__inputHandler, this);
this.input.change(proxy);
this.input.submit(proxy);
this.track.keydown(jQuery.proxy(this.__keydownHandler, this));
@@ -81,7 +85,7 @@
}
},
- __setValue: function (value, event) {
+ __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) {
@@ -94,9 +98,9 @@
var left = (value - this.minValue) * (this.track.width() - this.handle.width()) / this.range;
this.handle.css("margin-left", left + "px");
this.tooltip.text(value);
- this.tooltip.setPosition(this.handle,{from: 'LT', offset: [0, -3]}); //TODO Seems offset doesn't work now.
+ this.tooltip.setPosition(this.handle,{from: 'LT', offset: [0, 5]}); //TODO Seems offset doesn't work now.
this.value = value;
- if (this.onchange && (!event || event.type)) {
+ if (this.onchange && !skipOnchange) {
this.onchange.call(this.element[0], event);
}
}
@@ -174,6 +178,11 @@
this.handle.removeClass(this.handleSelectedClass);
this.tooltip.hide();
jQuery(document).unbind("mousemove", this.__mousemoveHandler);
+ },
+
+ destroy: function (event) {
+ jQuery(document).unbind("mousemove", this.__mousemoveHandler);
+ $super.destroy.call(this);
}
});
}(window.RichFaces, jQuery));
\ No newline at end of file
Modified: branches/RF-7654/ui/input/ui/src/main/templates/inplaceSelect.template.xml
===================================================================
--- branches/RF-7654/ui/input/ui/src/main/templates/inplaceSelect.template.xml 2010-12-16 17:43:00 UTC (rev 20623)
+++ branches/RF-7654/ui/input/ui/src/main/templates/inplaceSelect.template.xml 2010-12-16 18:10:56 UTC (rev 20624)
@@ -80,14 +80,14 @@
</c:if>
<span id="#{clientId}List" style="display: none" class="#{getListCss(component)}">
<cdk:call expression="renderListHandlers(facesContext, component);"/>
- <span class="rf-is-lst-pos" style="width: #{component.attributes['listWidth']}">
+ <span class="rf-is-lst-pos" style="#{getListWidth(component)}">
<span class="rf-is-shdw">
<span class="rf-is-shdw-t"></span>
<span class="rf-is-shdw-l"></span>
<span class="rf-is-shdw-r"></span>
<span class="rf-is-shdw-b"></span>
<span class="rf-is-lst-dec">
- <span class="rf-is-lst-scrl" style="height: #{component.attributes['listHeight']}">
+ <span class="rf-is-lst-scrl" style="#{getListHeight(component)}">
<span id="#{clientId}Items">
<cdk:call expression="encodeItems(facesContext, component, clientSelectItems);"/>
</span>
Modified: branches/RF-7654/ui/iteration/ui/src/main/java/org/richfaces/component/UIDataTableBase.java
===================================================================
--- branches/RF-7654/ui/iteration/ui/src/main/java/org/richfaces/component/UIDataTableBase.java 2010-12-16 17:43:00 UTC (rev 20623)
+++ branches/RF-7654/ui/iteration/ui/src/main/java/org/richfaces/component/UIDataTableBase.java 2010-12-16 18:10:56 UTC (rev 20624)
@@ -103,6 +103,9 @@
public UIComponent getNoData() {
return getFacet(NODATA_FACET_NAME);
}
+
+ @Attribute(defaultValue="Integer.MIN_VALUE")
+ public abstract int getColumns();
@Attribute
public abstract String getNoDataLabel();
Modified: branches/RF-7654/ui/iteration/ui/src/main/java/org/richfaces/renderkit/AbstractTableBaseRenderer.java
===================================================================
--- branches/RF-7654/ui/iteration/ui/src/main/java/org/richfaces/renderkit/AbstractTableBaseRenderer.java 2010-12-16 17:43:00 UTC (rev 20623)
+++ branches/RF-7654/ui/iteration/ui/src/main/java/org/richfaces/renderkit/AbstractTableBaseRenderer.java 2010-12-16 18:10:56 UTC (rev 20624)
@@ -109,7 +109,7 @@
public void encodeFirstRowStart(ResponseWriter writer, FacesContext context, String parentId, int currentRow, UIComponent component) throws IOException {
writer.startElement(HtmlConstants.TR_ELEMENT, component);
- String styleClass = getFirstRowClass(context, parentId);
+ String styleClass = concatClasses(getRowClass(context, parentId), getFirstRowClass(context, parentId));
encodeStyleClass(writer, context, component, HtmlConstants.STYLE_CLASS_ATTR, styleClass);
}
Modified: branches/RF-7654/ui/iteration/ui/src/main/java/org/richfaces/renderkit/AbstractTableRenderer.java
===================================================================
--- branches/RF-7654/ui/iteration/ui/src/main/java/org/richfaces/renderkit/AbstractTableRenderer.java 2010-12-16 17:43:00 UTC (rev 20623)
+++ branches/RF-7654/ui/iteration/ui/src/main/java/org/richfaces/renderkit/AbstractTableRenderer.java 2010-12-16 18:10:56 UTC (rev 20624)
@@ -109,11 +109,8 @@
}
protected int getColumnsCount(UIDataTableBase table) {
- // check for exact value in component
- Integer span = (Integer) table.getAttributes().get("columns");
- int count = (null != span && span.intValue() != Integer.MIN_VALUE) ? span.intValue()
- : getColumnsCount(table.columns());
- return count;
+ int columns = table.getColumns();
+ return (columns != Integer.MIN_VALUE) ? columns : getColumnsCount(table.columns());
}
public void encodeTableStructure(ResponseWriter writer, FacesContext context, UIDataTableBase dataTable) throws IOException {
@@ -164,14 +161,17 @@
int columns = getColumnsCount(dataTableBase.columns());
writer.startElement(HtmlConstants.TR_ELEMENT, dataTableBase);
+ String styleClass = (String) dataTableBase.getAttributes().get("noDataStyleClass");
+ styleClass = concatClasses(getNoDataClass(), styleClass);
+ writer.writeAttribute(HtmlConstants.CLASS_ATTRIBUTE, styleClass, null);
+
writer.startElement(HtmlConstants.TD_ELEM, dataTableBase);
writer.writeAttribute(HtmlConstants.COLSPAN_ATTRIBUTE, columns, null);
- String styleClass = (String) dataTableBase.getAttributes().get("noDataStyleClass");
- styleClass = styleClass != null ? getNoDataClass() + " " + styleClass : getNoDataClass();
+ String cellStyleClass = (String) dataTableBase.getAttributes().get("noDataCellStyleClass");
+ cellStyleClass = concatClasses( getNoDataCellClass(), cellStyleClass);
+ writer.writeAttribute(HtmlConstants.CLASS_ATTRIBUTE, cellStyleClass, null);
- writer.writeAttribute(HtmlConstants.CLASS_ATTRIBUTE, styleClass, null);
-
UIComponent noDataFacet = dataTableBase.getNoData();
if (noDataFacet != null && noDataFacet.isRendered()) {
noDataFacet.encodeAll(facesContext);
@@ -244,7 +244,7 @@
String clientId = (dataTableBase.getRelativeRowIndex() < 0) ? dataTableBase.getClientId(facesContext) : dataTableBase.getRelativeClientId(facesContext);
writer.writeAttribute(HtmlConstants.ID_ATTRIBUTE, clientId + ":tb", null);
- writer.writeAttribute(HtmlConstants.CLASS_ATTRIBUTE, getTableSkinClass(), null);
+ writer.writeAttribute(HtmlConstants.CLASS_ATTRIBUTE, getTableBodySkinClass(), null);
encodeStyle(writer, facesContext, dataTableBase, null);
}
@@ -272,7 +272,7 @@
writer.startElement(HtmlConstants.TFOOT_ELEMENT, dataTable);
writer.writeAttribute(HtmlConstants.ID_ATTRIBUTE, footerClientId, null);
- writer.writeAttribute(HtmlConstants.CLASS_ATTRIBUTE, "rd-dt-tfoot", null);
+ writer.writeAttribute(HtmlConstants.CLASS_ATTRIBUTE, "rf-dt-tft", null);
}
int columns = getColumnsCount(dataTable);
@@ -369,7 +369,7 @@
writer.startElement(HtmlConstants.THEAD_ELEMENT, dataTable);
writer.writeAttribute(HtmlConstants.ID_ATTRIBUTE, headerClientId, null);
- writer.writeAttribute(HtmlConstants.CLASS_ATTRIBUTE, "rf-dt-thead", null);
+ writer.writeAttribute(HtmlConstants.CLASS_ATTRIBUTE, "rf-dt-thd", null);
}
int columns = getColumnsCount(dataTable);
@@ -538,6 +538,8 @@
public abstract String getTableSkinClass();
+ public abstract String getTableBodySkinClass();
+
public abstract String getFirstRowSkinClass();
public abstract String getRowSkinClass();
@@ -569,6 +571,8 @@
public abstract String getCellSkinClass();
public abstract String getNoDataClass();
+
+ public abstract String getNoDataCellClass();
protected abstract void setupTableStartElement(FacesContext context, UIComponent component);
Modified: branches/RF-7654/ui/iteration/ui/src/main/java/org/richfaces/renderkit/CollapsibleSubTableRenderer.java
===================================================================
--- branches/RF-7654/ui/iteration/ui/src/main/java/org/richfaces/renderkit/CollapsibleSubTableRenderer.java 2010-12-16 17:43:00 UTC (rev 20623)
+++ branches/RF-7654/ui/iteration/ui/src/main/java/org/richfaces/renderkit/CollapsibleSubTableRenderer.java 2010-12-16 18:10:56 UTC (rev 20624)
@@ -367,10 +367,21 @@
}
public String getNoDataClass() {
+ return "rf-cst-nd";
+ }
+
+ @Override
+ public String getNoDataCellClass() {
return "rf-cst-nd-c";
}
@Override
+ public String getTableBodySkinClass() {
+ // AbstractSubTable doesn't have tbody
+ return null;
+ }
+
+ @Override
public void encodeMetaComponent(FacesContext facesContext, UIComponent component, String metaComponentId)
throws IOException {
AbstractCollapsibleSubTable subTable = (AbstractCollapsibleSubTable)component;
Modified: branches/RF-7654/ui/iteration/ui/src/main/java/org/richfaces/renderkit/DataTableRenderer.java
===================================================================
--- branches/RF-7654/ui/iteration/ui/src/main/java/org/richfaces/renderkit/DataTableRenderer.java 2010-12-16 17:43:00 UTC (rev 20623)
+++ branches/RF-7654/ui/iteration/ui/src/main/java/org/richfaces/renderkit/DataTableRenderer.java 2010-12-16 18:10:56 UTC (rev 20624)
@@ -378,8 +378,18 @@
}
public String getNoDataClass() {
- return "rf-dt-ndt";
+ return "rf-dt-nd";
}
+
+ @Override
+ public String getNoDataCellClass() {
+ return "rf-dt-nd-c";
+ }
+
+ @Override
+ public String getTableBodySkinClass() {
+ return "rf-dt-b";
+ }
protected void setupTableStartElement(FacesContext context, UIComponent component) {
setupTableStartElement(context, component, HtmlConstants.TH_ELEM);
Modified: branches/RF-7654/ui/iteration/ui/src/main/resources/META-INF/resources/org.richfaces/datatable.ecss
===================================================================
--- branches/RF-7654/ui/iteration/ui/src/main/resources/META-INF/resources/org.richfaces/datatable.ecss 2010-12-16 17:43:00 UTC (rev 20623)
+++ branches/RF-7654/ui/iteration/ui/src/main/resources/META-INF/resources/org.richfaces/datatable.ecss 2010-12-16 18:10:56 UTC (rev 20624)
@@ -32,7 +32,7 @@
padding:4px;
}
-.rf-dt-ndt{
+.rf-dt-nd{
border-bottom-width:'#{richSkin.tableBorderWidth}';
border-bottom-style:solid;
border-bottom-color:'#{richSkin.tableBorderColor}';
Copied: branches/RF-7654/ui/output/ui/src/main/java/org/richfaces/component/AbstractPanel.java (from rev 20622, trunk/ui/output/ui/src/main/java/org/richfaces/component/AbstractPanel.java)
===================================================================
--- branches/RF-7654/ui/output/ui/src/main/java/org/richfaces/component/AbstractPanel.java (rev 0)
+++ branches/RF-7654/ui/output/ui/src/main/java/org/richfaces/component/AbstractPanel.java 2010-12-16 18:10:56 UTC (rev 20624)
@@ -0,0 +1,51 @@
+/**
+ * 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;
+
+import javax.faces.component.UIComponentBase;
+
+import org.richfaces.cdk.annotations.JsfComponent;
+import org.richfaces.cdk.annotations.JsfRenderer;
+import org.richfaces.cdk.annotations.Tag;
+import org.richfaces.cdk.annotations.TagType;
+
+/**
+ * JSF component class
+ *
+ */
+@JsfComponent(tag = @Tag(type = TagType.Facelets),
+ renderer = @JsfRenderer(type = "org.richfaces.PanelRenderer"),
+ attributes = {"core-props.xml", "events-props.xml"}
+)
+public abstract class AbstractPanel extends UIComponentBase {
+
+ private static final String COMPONENT_FAMILY = "org.richfaces.Panel";
+
+ public boolean getRendersChildren() {
+ return true;
+ }
+
+ @Override
+ public String getFamily() {
+ return COMPONENT_FAMILY;
+ }
+}
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-16 17:43:00 UTC (rev 20623)
+++ branches/RF-7654/ui/output/ui/src/main/java/org/richfaces/component/AbstractPanelMenu.java 2010-12-16 18:10:56 UTC (rev 20624)
@@ -200,7 +200,7 @@
public abstract boolean isBypassUpdates();
- public abstract boolean isDisableImplicitRender();
+ public abstract boolean isLimitRender();
public abstract Object getData();
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-16 17:43:00 UTC (rev 20623)
+++ branches/RF-7654/ui/output/ui/src/main/java/org/richfaces/component/AbstractPanelMenuItem.java 2010-12-16 18:10:56 UTC (rev 20624)
@@ -119,7 +119,7 @@
public abstract boolean isBypassUpdates();
- public abstract boolean isDisableImplicitRender();
+ public abstract boolean isLimitRender();
public abstract Object getData();
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-16 17:43:00 UTC (rev 20623)
+++ branches/RF-7654/ui/output/ui/src/main/java/org/richfaces/component/AbstractTogglePanel.java 2010-12-16 18:10:56 UTC (rev 20624)
@@ -572,7 +572,7 @@
public abstract boolean isBypassUpdates();
- public abstract boolean isDisableImplicitRender();
+ public abstract boolean isLimitRender();
public abstract boolean isCycledSwitching();
Modified: branches/RF-7654/ui/output/ui/src/main/java/org/richfaces/component/AbstractTooltip.java
===================================================================
--- branches/RF-7654/ui/output/ui/src/main/java/org/richfaces/component/AbstractTooltip.java 2010-12-16 17:43:00 UTC (rev 20623)
+++ branches/RF-7654/ui/output/ui/src/main/java/org/richfaces/component/AbstractTooltip.java 2010-12-16 18:10:56 UTC (rev 20624)
@@ -88,7 +88,7 @@
public abstract boolean isBypassUpdates();
- public abstract boolean isDisableImplicitRender();
+ public abstract boolean isLimitRender();
public abstract Object getData();
Deleted: branches/RF-7654/ui/output/ui/src/main/java/org/richfaces/component/UIPanel.java
===================================================================
--- branches/RF-7654/ui/output/ui/src/main/java/org/richfaces/component/UIPanel.java 2010-12-16 17:43:00 UTC (rev 20623)
+++ branches/RF-7654/ui/output/ui/src/main/java/org/richfaces/component/UIPanel.java 2010-12-16 18:10:56 UTC (rev 20624)
@@ -1,49 +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;
-
-import javax.faces.component.UIComponentBase;
-
-import org.richfaces.cdk.annotations.JsfComponent;
-import org.richfaces.cdk.annotations.JsfRenderer;
-import org.richfaces.cdk.annotations.Tag;
-import org.richfaces.cdk.annotations.TagType;
-
-/**
- * JSF component class
- *
- */
-@JsfComponent(tag = @Tag(type = TagType.Facelets),
- renderer = @JsfRenderer(type = "org.richfaces.PanelRenderer")
- )
-public class UIPanel extends UIComponentBase {
- private static final String COMPONENT_FAMILY = "org.richfaces.Panel";
-
- public boolean getRendersChildren() {
- return true;
- }
-
- @Override
- public String getFamily() {
- return COMPONENT_FAMILY;
- }
-}
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-16 17:43:00 UTC (rev 20623)
+++ branches/RF-7654/ui/output/ui/src/main/java/org/richfaces/component/UIPanelMenu.java 2010-12-16 18:10:56 UTC (rev 20624)
@@ -43,7 +43,7 @@
activeItem,
itemChangeListener,
bypassUpdates,
- disableImplicitRender,
+ limitRender,
data,
status,
execute,
@@ -122,12 +122,12 @@
getStateHelper().put(PropertyKeys.bypassUpdates, bypassUpdates);
}
- public boolean isDisableImplicitRender() {
- return Boolean.valueOf(String.valueOf(getStateHelper().eval(PropertyKeys.disableImplicitRender)));
+ public boolean isLimitRender() {
+ return Boolean.valueOf(String.valueOf(getStateHelper().eval(PropertyKeys.limitRender)));
}
- public void setDisableImplicitRender(boolean disableImplicitRender) {
- getStateHelper().put(PropertyKeys.disableImplicitRender, disableImplicitRender);
+ public void setLimitRender(boolean limitRender) {
+ getStateHelper().put(PropertyKeys.limitRender, limitRender);
}
public Object getData() {
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-16 17:43:00 UTC (rev 20623)
+++ branches/RF-7654/ui/output/ui/src/main/java/org/richfaces/component/UIPanelMenuItem.java 2010-12-16 18:10:56 UTC (rev 20624)
@@ -38,7 +38,7 @@
name,
disabled,
bypassUpdates,
- disableImplicitRender,
+ limitRender,
data,
status,
execute,
@@ -85,12 +85,12 @@
getStateHelper().put(PropertyKeys.bypassUpdates, bypassUpdates);
}
- public boolean isDisableImplicitRender() {
- return Boolean.valueOf(String.valueOf(getStateHelper().eval(PropertyKeys.disableImplicitRender)));
+ public boolean isLimitRender() {
+ return Boolean.valueOf(String.valueOf(getStateHelper().eval(PropertyKeys.limitRender)));
}
- public void setDisableImplicitRender(boolean disableImplicitRender) {
- getStateHelper().put(PropertyKeys.disableImplicitRender, disableImplicitRender);
+ public void setLimitRender(boolean limitRender) {
+ getStateHelper().put(PropertyKeys.limitRender, limitRender);
}
public Object getData() {
Modified: branches/RF-7654/ui/output/ui/src/main/java/org/richfaces/component/UITogglePanel.java
===================================================================
--- branches/RF-7654/ui/output/ui/src/main/java/org/richfaces/component/UITogglePanel.java 2010-12-16 17:43:00 UTC (rev 20623)
+++ branches/RF-7654/ui/output/ui/src/main/java/org/richfaces/component/UITogglePanel.java 2010-12-16 18:10:56 UTC (rev 20624)
@@ -33,7 +33,7 @@
public enum PropertyKeys {
switchType,
bypassUpdates,
- disableImplicitRender,
+ limitRender,
cycledSwitching,
data,
status,
@@ -59,12 +59,12 @@
getStateHelper().put(PropertyKeys.bypassUpdates, bypassUpdates);
}
- public boolean isDisableImplicitRender() {
- return Boolean.valueOf(String.valueOf(getStateHelper().eval(PropertyKeys.disableImplicitRender)));
+ public boolean isLimitRender() {
+ return Boolean.valueOf(String.valueOf(getStateHelper().eval(PropertyKeys.limitRender)));
}
- public void setDisableImplicitRender(boolean disableImplicitRender) {
- getStateHelper().put(PropertyKeys.disableImplicitRender, disableImplicitRender);
+ public void setLimitRender(boolean limitRender) {
+ getStateHelper().put(PropertyKeys.limitRender, limitRender);
}
public boolean isCycledSwitching() {
Modified: branches/RF-7654/ui/output/ui/src/main/java/org/richfaces/component/UITooltip.java
===================================================================
--- branches/RF-7654/ui/output/ui/src/main/java/org/richfaces/component/UITooltip.java 2010-12-16 17:43:00 UTC (rev 20623)
+++ branches/RF-7654/ui/output/ui/src/main/java/org/richfaces/component/UITooltip.java 2010-12-16 18:10:56 UTC (rev 20624)
@@ -49,7 +49,7 @@
showEvent,
verticalOffset,
bypassUpdates,
- disableImplicitRender,
+ limitRender,
data,
status,
execute,
@@ -176,12 +176,12 @@
getStateHelper().put(PropertyKeys.bypassUpdates, bypassUpdates);
}
- public boolean isDisableImplicitRender() {
- return Boolean.valueOf(String.valueOf(getStateHelper().eval(PropertyKeys.disableImplicitRender)));
+ public boolean isLimitRender() {
+ return Boolean.valueOf(String.valueOf(getStateHelper().eval(PropertyKeys.limitRender)));
}
- public void setDisableImplicitRender(boolean disableImplicitRender) {
- getStateHelper().put(PropertyKeys.disableImplicitRender, disableImplicitRender);
+ public void setLimitRender(boolean limitRender) {
+ getStateHelper().put(PropertyKeys.limitRender, limitRender);
}
public Object getData() {
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-16 17:43:00 UTC (rev 20623)
+++ branches/RF-7654/ui/output/ui/src/main/java/org/richfaces/renderkit/html/MenuGroupRendererBase.java 2010-12-16 18:10:56 UTC (rev 20624)
@@ -91,4 +91,16 @@
}
return DEFAULT_MIN_POPUP_WIDTH;
}
+
+ /**
+ * It is introduced due to RF-10004 CDK: isEmpty method is generated incorrectly
+ * @param str
+ * @return
+ */
+ protected boolean isStringEmpty(String str) {
+ if (str != null && str.trim().length() > 0) {
+ return false;
+ }
+ return true;
+ }
}
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-16 17:43:00 UTC (rev 20623)
+++ branches/RF-7654/ui/output/ui/src/main/java/org/richfaces/renderkit/html/MenuItemRendererBase.java 2010-12-16 18:10:56 UTC (rev 20624)
@@ -97,14 +97,14 @@
protected String getOnClickFunction(FacesContext facesContext, UIComponent component) {
AbstractMenuItem menuItem = (AbstractMenuItem) component;
String subminMode = resolveSubmitMode(menuItem);
- if (subminMode == null || MenuComponent.MODE_SERVER.equalsIgnoreCase(subminMode)) {
+ if (menuItem.isDisabled()) {
+ return "";
+ } else if (subminMode == null || MenuComponent.MODE_SERVER.equalsIgnoreCase(subminMode)) {
return getServerSubmitFunction(menuItem);
} else if (MenuComponent.MODE_AJAX.equalsIgnoreCase(subminMode)) {
return getOnClick(facesContext, menuItem);
- } else if (menuItem.isDisabled()) {
+ } else if (MenuComponent.MODE_CLIENT.equalsIgnoreCase(subminMode)) {
return "";
- } else if (MenuComponent.MODE_CLIENT.equalsIgnoreCase(subminMode)) {
- return "";
}
return "";
@@ -173,4 +173,16 @@
}
return null;
}
+
+ /**
+ * It is introduced due to RF-10004 CDK: isEmpty method is generated incorrectly
+ * @param str
+ * @return
+ */
+ protected boolean isStringEmpty(String str) {
+ if (str != null && str.trim().length() > 0) {
+ return false;
+ }
+ return true;
+ }
}
Modified: branches/RF-7654/ui/output/ui/src/main/java/org/richfaces/renderkit/html/PanelBaseRenderer.java
===================================================================
--- branches/RF-7654/ui/output/ui/src/main/java/org/richfaces/renderkit/html/PanelBaseRenderer.java 2010-12-16 17:43:00 UTC (rev 20623)
+++ branches/RF-7654/ui/output/ui/src/main/java/org/richfaces/renderkit/html/PanelBaseRenderer.java 2010-12-16 18:10:56 UTC (rev 20624)
@@ -21,7 +21,7 @@
package org.richfaces.renderkit.html;
-import org.richfaces.component.UIPanel;
+import org.richfaces.component.AbstractPanel;
import org.richfaces.renderkit.RendererBase;
import javax.faces.application.ResourceDependency;
@@ -46,6 +46,6 @@
@Override
protected Class<? extends UIComponent> getComponentClass() {
- return UIPanel.class;
+ return AbstractPanel.class;
}
}
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-16 17:43:00 UTC (rev 20623)
+++ branches/RF-7654/ui/output/ui/src/main/java/org/richfaces/renderkit/html/ToolbarRendererBase.java 2010-12-16 18:10:56 UTC (rev 20624)
@@ -40,6 +40,7 @@
import org.richfaces.renderkit.HtmlConstants;
import org.richfaces.renderkit.RenderKitUtils;
import org.richfaces.renderkit.RendererBase;
+import org.richfaces.renderkit.util.HtmlDimensions;
@ResourceDependency(library = "org.richfaces", name = "toolbar.ecss")
@@ -88,18 +89,93 @@
public enum Locations {
RIGHT, LEFT
}
+
+ private void writeColElement(ResponseWriter writer, UIComponent component) throws IOException {
+ writer.startElement(HtmlConstants.COL_ELEMENT, component);
+ writer.writeAttribute(HtmlConstants.WIDTH_ATTRIBUTE, "1px", null);
+ writer.endElement(HtmlConstants.COL_ELEMENT);
+ }
+
+ private boolean isSeparatorFacetRendered(UIComponent component) {
+ UIComponent separatorFacet = component.getFacet("itemSeparator");
+ return (separatorFacet != null) ? separatorFacet.isRendered() : false;
+ }
+
+ private boolean isSeparatorAttributeRendered(UIComponent component) {
+ String itemSeparator = (String) component.getAttributes().get("itemSeparator");
+
+ if (itemSeparator != null && itemSeparator.trim().length() != 0
+ && !itemSeparator.equalsIgnoreCase(ItemSeparators.NONE.toString())) {
+ return true;
+ }
+ return false;
+ }
+
+
+ private int getColumnCount(List<UIComponent> components) {
+ int result = 0;
+ for (UIComponent component : components) {
+ if (component instanceof AbstractToolbarGroup) {
+ result += component.getChildren().size();
+ } else {
+ result++;
+ }
+ }
+
+ return result;
+ }
+
+ private int getCountSeparators(AbstractToolbar toolBar, List<UIComponent> components) {
+ int result = 0;
+ if (components != null && (isSeparatorFacetRendered(toolBar) || isSeparatorAttributeRendered(toolBar))) {
+ result += components.size() - 1;
+ }
+
+ for (UIComponent component : components) {
+ if (component instanceof AbstractToolbarGroup) {
+ result += getCountSeparators((AbstractToolbarGroup) component, component.getChildren());
+ }
+ }
+
+ return result;
+ }
+
+ private int getCountSeparators(AbstractToolbarGroup toolBarGroup, List<UIComponent> components) {
+ if (components != null && (isSeparatorFacetRendered(toolBarGroup) || isSeparatorAttributeRendered(toolBarGroup))) {
+ return components.size() - 1;
+ }
+ return 0;
+ }
+
+ protected void renderColElements(FacesContext context, UIComponent component) throws IOException {
+ ResponseWriter writer = context.getResponseWriter();
+ List<UIComponent> childrenToTheLeft = new LinkedList<UIComponent>();
+ List<UIComponent> childrenToTheRight = new LinkedList<UIComponent>();
+
+ getChildrenToLeftAndRight(context, component, childrenToTheLeft, childrenToTheRight);
+ int columnAmount = getCountSeparators((AbstractToolbar) component, childrenToTheLeft) +
+ getColumnCount(childrenToTheLeft);
+ for (int i = 0; i < columnAmount; i++) {
+ writeColElement(writer, component);
+ }
+
+ writer.startElement(HtmlConstants.COL_ELEMENT, component);
+ writer.writeAttribute(HtmlConstants.WIDTH_ATTRIBUTE, "*", null);
+ writer.endElement(HtmlConstants.COL_ELEMENT);
+
+ columnAmount = getCountSeparators((AbstractToolbar) component, childrenToTheRight) +
+ getColumnCount(childrenToTheRight);
+ for (int i = 0; i < columnAmount; i++) {
+ writeColElement(writer, component);
+ }
+ }
- @Override
- public void encodeChildren(FacesContext context, UIComponent component) throws IOException {
+ private void getChildrenToLeftAndRight(FacesContext context, UIComponent component,
+ final List<UIComponent> childrenToTheLeft, final List<UIComponent> childrenToTheRight) {
+
AbstractToolbar toolbar = (AbstractToolbar) component;
- String itemClass = (String) toolbar.getAttributes().get("itemClass");
- String itemStyle = (String) toolbar.getAttributes().get("itemStyle");
-
List<UIComponent> children = toolbar.getChildren();
-
if (children != null) {
- List<UIComponent> childrenToTheLeft = new LinkedList<UIComponent>();
- List<UIComponent> childrenToTheRight = new LinkedList<UIComponent>();
for (UIComponent child : children) {
if (child.isRendered()) {
if (child instanceof AbstractToolbarGroup) {
@@ -115,7 +191,23 @@
}
}
}
+ }
+ }
+
+ @Override
+ public void encodeChildren(FacesContext context, UIComponent component) throws IOException {
+ AbstractToolbar toolbar = (AbstractToolbar) component;
+ String itemClass = (String) toolbar.getAttributes().get("itemClass");
+ String itemStyle = (String) toolbar.getAttributes().get("itemStyle");
+ List<UIComponent> children = toolbar.getChildren();
+
+ if (children != null) {
+ List<UIComponent> childrenToTheLeft = new LinkedList<UIComponent>();
+ List<UIComponent> childrenToTheRight = new LinkedList<UIComponent>();
+
+ getChildrenToLeftAndRight(context, component, childrenToTheLeft, childrenToTheRight);
+
ResponseWriter writer = context.getResponseWriter();
for (Iterator<UIComponent> it = childrenToTheLeft.iterator(); it.hasNext();) {
@@ -135,16 +227,14 @@
if (!(child instanceof AbstractToolbarGroup)) {
writer.endElement(HtmlConstants.TD_ELEM);
}
-
-
-
+
if (it.hasNext()) {
insertSeparatorIfNeed(context, toolbar, writer);
}
}
writer.startElement(HtmlConstants.TD_ELEM, component);
- writer.writeAttribute(HtmlConstants.STYLE_ATTRIBUTE, "width:100%", null);
+ writer.write(" ");
writer.endElement(HtmlConstants.TD_ELEM);
for (Iterator<UIComponent> it = childrenToTheRight.iterator(); it.hasNext();) {
@@ -257,4 +347,20 @@
protected boolean isPropertyRendered(String property) {
return (null != property && !"".equals(property));
}
+
+ protected String getWidthToolbar(UIComponent component) {
+ if (component instanceof AbstractToolbar) {
+ return HtmlDimensions.formatSize(((AbstractToolbar)component).getWidth());
+ } else {
+ return "";
+ }
+ }
+
+ protected String getHeightToolbar(UIComponent component) {
+ if (component instanceof AbstractToolbar) {
+ return HtmlDimensions.formatSize(((AbstractToolbar)component).getHeight());
+ } else {
+ return "";
+ }
+ }
}
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-16 17:43:00 UTC (rev 20623)
+++ branches/RF-7654/ui/output/ui/src/main/resources/META-INF/pn.faces-config.xml 2010-12-16 18:10:56 UTC (rev 20624)
@@ -8,6 +8,26 @@
<behavior>
<behavior-id>org.richfaces.component.behavior.ToggleControl</behavior-id>
<behavior-class>org.richfaces.component.behavior.ToggleControl</behavior-class>
+ <property>
+ <property-name>targetPanel</property-name>
+ <property-class>java.lang.String</property-class>
+ </property>
+ <property>
+ <property-name>targetItem</property-name>
+ <property-class>java.lang.String</property-class>
+ </property>
+ <property>
+ <property-name>event</property-name>
+ <property-class>java.lang.String</property-class>
+ </property>
+ <property>
+ <property-name>disableDefault</property-name>
+ <property-class>java.lang.Boolean</property-class>
+ </property>
+ <property>
+ <property-name>for</property-name>
+ <property-class>java.lang.String</property-class>
+ </property>
</behavior>
<component>
@@ -889,7 +909,7 @@
</property>
<property>
<description></description>
- <property-name>disableImplicitRender</property-name>
+ <property-name>limitRender</property-name>
<property-class>boolean</property-class>
</property>
<property>
@@ -940,7 +960,7 @@
</property>
<property>
<description></description>
- <property-name>disableImplicitRender</property-name>
+ <property-name>limitRender</property-name>
<property-class>boolean</property-class>
</property>
<property>
@@ -990,7 +1010,7 @@
</property>
<property>
<description></description>
- <property-name>disableImplicitRender</property-name>
+ <property-name>limitRender</property-name>
<property-class>boolean</property-class>
</property>
<property>
@@ -1235,7 +1255,7 @@
</property>
<property>
<description></description>
- <property-name>disableImplicitRender</property-name>
+ <property-name>limitRender</property-name>
<property-class>boolean</property-class>
</property>
<property>
@@ -1579,7 +1599,7 @@
<property-class>boolean</property-class>
</property>
<property>
- <property-name>disableImplicitRender</property-name>
+ <property-name>limitRender</property-name>
<property-class>boolean</property-class>
</property>
<property>
@@ -1943,7 +1963,7 @@
</property>
<property>
<description></description>
- <property-name>disableImplicitRender</property-name>
+ <property-name>limitRender</property-name>
<property-class>boolean</property-class>
</property>
<property>
@@ -2087,7 +2107,7 @@
</property>
<property>
<description></description>
- <property-name>disableImplicitRender</property-name>
+ <property-name>limitRender</property-name>
<property-class>boolean</property-class>
</property>
<property>
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-16 17:43:00 UTC (rev 20623)
+++ branches/RF-7654/ui/output/ui/src/main/resources/META-INF/pn.taglib.xml 2010-12-16 18:10:56 UTC (rev 20624)
@@ -3,6 +3,33 @@
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-facelettaglibrary_2_0.xsd">
<namespace>http://richfaces.org/pn</namespace>
<tag>
+ <tag-name>toggleControl</tag-name>
+ <behavior>
+ <behavior-id>org.richfaces.component.behavior.ToggleControl</behavior-id>
+ <handler-class>org.richfaces.view.facelets.html.CustomBehaviorHandler</handler-class>
+ </behavior>
+ <attribute>
+ <name>targetPanel</name>
+ <type>java.lang.String</type>
+ </attribute>
+ <attribute>
+ <name>targetItem</name>
+ <type>java.lang.String</type>
+ </attribute>
+ <attribute>
+ <name>event</name>
+ <type>java.lang.String</type>
+ </attribute>
+ <attribute>
+ <name>disableDefault</name>
+ <type>java.lang.Boolean</type>
+ </attribute>
+ <attribute>
+ <name>for</name>
+ <type>java.lang.String</type>
+ </attribute>
+ </tag>
+ <tag>
<tag-name>tabPanel</tag-name>
<component>
<component-type>org.richfaces.TabPanel</component-type>
@@ -26,7 +53,7 @@
<type>boolean</type>
</attribute>
<attribute>
- <name>disableImplicitRender</name>
+ <name>limitRender</name>
<type>boolean</type>
</attribute>
<attribute>
@@ -362,7 +389,7 @@
<type>boolean</type>
</attribute>
<attribute>
- <name>disableImplicitRender</name>
+ <name>limitRender</name>
<type>boolean</type>
</attribute>
<attribute>
@@ -557,7 +584,7 @@
<type>boolean</type>
</attribute>
<attribute>
- <name>disableImplicitRender</name>
+ <name>limitRender</name>
<type>boolean</type>
</attribute>
<attribute>
@@ -627,12 +654,6 @@
<type>javax.faces.el.MethodBinding</type>
</attribute>
<attribute>
- <description>MethodExpression representing the application action to invoke when this component is activated by the user. The expression must evaluate to a public method that takes no parameters, and returns an Object (the toString() of which is called to derive the logical outcome) which is passed to the NavigationHandler for this application.</description>
- <display-name>Application Action</display-name>
- <name>actionExpression</name>
- <type>javax.el.MethodExpression</type>
- </attribute>
- <attribute>
<description><p> MethodExpression representing an action listener method that will be notified when this component is activated by the user. The expression must evaluate to a public method that takes an ActionEvent parameter, with a return type of void, <span class="changed_added_2_0">or to a public method that takes no arguments with a return type of void. In the latter case, the method has no way of easily knowing where the event came from, but this can be useful in cases where a notification is needed that "some action happened".</span> </p></description>
<display-name>Action Listener</display-name>
<name>actionListener</name>
@@ -679,7 +700,7 @@
<type>boolean</type>
</attribute>
<attribute>
- <name>disableImplicitRender</name>
+ <name>limitRender</name>
<type>boolean</type>
</attribute>
<attribute>
@@ -947,7 +968,7 @@
<type>boolean</type>
</attribute>
<attribute>
- <name>disableImplicitRender</name>
+ <name>limitRender</name>
<type>boolean</type>
</attribute>
<attribute>
@@ -1047,7 +1068,7 @@
<type>boolean</type>
</attribute>
<attribute>
- <name>disableImplicitRender</name>
+ <name>limitRender</name>
<type>boolean</type>
</attribute>
<attribute>
@@ -1223,7 +1244,7 @@
<type>boolean</type>
</attribute>
<attribute>
- <name>disableImplicitRender</name>
+ <name>limitRender</name>
<type>boolean</type>
</attribute>
<attribute>
@@ -1468,7 +1489,7 @@
<type>boolean</type>
</attribute>
<attribute>
- <name>disableImplicitRender</name>
+ <name>limitRender</name>
<type>boolean</type>
</attribute>
<attribute>
Modified: branches/RF-7654/ui/output/ui/src/main/templates/menugroup.template.xml
===================================================================
--- branches/RF-7654/ui/output/ui/src/main/templates/menugroup.template.xml 2010-12-16 17:43:00 UTC (rev 20623)
+++ branches/RF-7654/ui/output/ui/src/main/templates/menugroup.template.xml 2010-12-16 18:10:56 UTC (rev 20624)
@@ -40,7 +40,7 @@
<c:when test="iconFacet != null and iconFacet.isRendered()">
<cdk:call expression="iconFacet.encodeAll(facesContext)" />
</c:when>
- <c:when test="#{not empty iconAttribute}">
+ <c:when test="#{not isStringEmpty(iconAttribute)}">
<img width="16" height="16" src="#{RenderKitUtils.getResourceURL(iconAttribute, facesContext)}" alt="" />
</c:when>
<c:otherwise>
Modified: branches/RF-7654/ui/output/ui/src/main/templates/menuitem.template.xml
===================================================================
--- branches/RF-7654/ui/output/ui/src/main/templates/menuitem.template.xml 2010-12-16 17:43:00 UTC (rev 20623)
+++ branches/RF-7654/ui/output/ui/src/main/templates/menuitem.template.xml 2010-12-16 18:10:56 UTC (rev 20624)
@@ -43,7 +43,7 @@
<c:when test="#{iconFacet != null and iconFacet.isRendered()}">
<cdk:call expression="iconFacet.encodeAll(facesContext)" />
</c:when>
- <c:when test="#{not empty iconAttribute}">
+ <c:when test="#{not isStringEmpty(iconAttribute)}">
<img width="16" height="16" src="#{RenderKitUtils.getResourceURL(iconAttribute, facesContext)}" alt="" />
</c:when>
<c:otherwise>
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-16 17:43:00 UTC (rev 20623)
+++ branches/RF-7654/ui/output/ui/src/main/templates/toolbar.template.xml 2010-12-16 18:10:56 UTC (rev 20624)
@@ -14,11 +14,14 @@
</cc:interface>
<cc:implementation>
- <table border="0" cellpadding="0" cellspacing="0" id="#{clientId}" width="#{component.attributes['width']}"
- height="#{component.attributes['height']}" class="rf-tb #{component.attributes['styleClass']}"
- style="#{component.attributes['style']}"
+ <table border="0" cellpadding="0" cellspacing="0" id="#{clientId}"
+ width="#{getWidthToolbar(component)}"
+ height="#{getHeightToolbar(component)}"
+ class="rf-tb #{component.attributes['styleClass']}"
+ style="#{ component.attributes['style']}"
cdk:passThroughWithExclusions="">
- <cdk:call expression="encodeEventsAttributes(facesContext, component)" />
+ <cdk:call expression="encodeEventsAttributes(facesContext, component)" />
+ <cdk:call expression="renderColElements(facesContext, component)" />
<tr class="rf-tb-cntr">
<cdk:body />
</tr>
Modified: branches/RF-7654/ui/output/ui/src/test/java/org/richfaces/renderkit/html/PanelRendererTest.java
===================================================================
--- branches/RF-7654/ui/output/ui/src/test/java/org/richfaces/renderkit/html/PanelRendererTest.java 2010-12-16 17:43:00 UTC (rev 20623)
+++ branches/RF-7654/ui/output/ui/src/test/java/org/richfaces/renderkit/html/PanelRendererTest.java 2010-12-16 18:10:56 UTC (rev 20624)
@@ -37,7 +37,7 @@
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
-import org.richfaces.component.UIPanel;
+import org.richfaces.component.AbstractPanel;
import com.gargoylesoftware.htmlunit.html.HtmlElement;
import com.gargoylesoftware.htmlunit.html.HtmlPage;
@@ -83,10 +83,10 @@
public final void testGetComponentClass() throws IOException {
FacesRequest facesRequest = startFacesRequest();
FacesContext facesContext = FacesContext.getCurrentInstance();
- UIPanel component = (UIPanel) facesContext.getViewRoot().findComponent("panelWithFacet");
+ AbstractPanel component = (AbstractPanel) facesContext.getViewRoot().findComponent("panelWithFacet");
PanelRenderer renderer = (PanelRenderer) FacesContext.getCurrentInstance()
.getRenderKit().getRenderer(component.getFamily(), component.getRendererType());
- assertEquals(UIPanel.class, renderer.getComponentClass());
+ assertEquals(AbstractPanel.class, renderer.getComponentClass());
facesRequest.release();
}
14 years
JBoss Rich Faces SVN: r20623 - branches/RF-7654.
by richfaces-svn-commits@lists.jboss.org
Author: alexsmirnov
Date: 2010-12-16 12:43:00 -0500 (Thu, 16 Dec 2010)
New Revision: 20623
Modified:
branches/RF-7654/
Log:
Initialized merge tracking via "svnmerge" with revisions "1-20570" from
https://svn.jboss.org/repos/richfaces/trunk
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
+ /branches/RF-7817:1-19154 /branches/RF-8742:1-19867 /branches/RF-9309:1-19112,19378 /trunk:1-20570
14 years
JBoss Rich Faces SVN: r20622 - trunk/core/api/src/main/java/org/richfaces/renderkit/util.
by richfaces-svn-commits@lists.jboss.org
Author: nbelaevski
Date: 2010-12-16 12:34:36 -0500 (Thu, 16 Dec 2010)
New Revision: 20622
Modified:
trunk/core/api/src/main/java/org/richfaces/renderkit/util/CoreAjaxRendererUtils.java
Log:
https://issues.jboss.org/browse/RF-10011
Modified: trunk/core/api/src/main/java/org/richfaces/renderkit/util/CoreAjaxRendererUtils.java
===================================================================
--- trunk/core/api/src/main/java/org/richfaces/renderkit/util/CoreAjaxRendererUtils.java 2010-12-16 16:53:49 UTC (rev 20621)
+++ trunk/core/api/src/main/java/org/richfaces/renderkit/util/CoreAjaxRendererUtils.java 2010-12-16 17:34:36 UTC (rev 20622)
@@ -280,14 +280,11 @@
if (component instanceof AjaxComponent) {
result = ((AjaxComponent) component).isLimitRender();
} else {
- try {
- result = ((Boolean) component.getAttributes().get(LIMITRENDER_ATTR_NAME)).booleanValue();
- } catch (NullPointerException e) {
-
- // NullPointer - ignore ...
- } catch (ClassCastException e1) {
-
- // not Boolean - false ...
+ Object limitRenderObject = component.getAttributes().get(LIMITRENDER_ATTR_NAME);
+ if (limitRenderObject instanceof Boolean) {
+ result = ((Boolean) limitRenderObject).booleanValue();
+ } else {
+ result = Boolean.valueOf(String.valueOf(limitRenderObject));
}
}
14 years
JBoss Rich Faces SVN: r20621 - in branches: RF-9323/cdk/generator/src/main/java/org/richfaces/cdk/apt and 12 other directories.
by richfaces-svn-commits@lists.jboss.org
Author: alexsmirnov
Date: 2010-12-16 11:53:49 -0500 (Thu, 16 Dec 2010)
New Revision: 20621
Added:
branches/RF-9323/
branches/RF-9323/cdk/generator/src/main/java/org/richfaces/cdk/apt/ElementKindScanner.java
branches/RF-9323/cdk/generator/src/test/java/org/richfaces/cdk/apt/AptSourceUtilsPropertiesTest.java
branches/RF-9323/cdk/generator/src/test/resources/org/richfaces/cdk/apt/PropertyTestClass.java
branches/RF-9323/cdk/generator/src/test/resources/org/richfaces/cdk/apt/PropertyTestInterface.java
Modified:
branches/RF-9323/cdk/generator/src/main/java/org/richfaces/cdk/apt/AptSourceUtils.java
branches/RF-9323/cdk/generator/src/main/java/org/richfaces/cdk/apt/ReflectionUtils.java
branches/RF-9323/cdk/generator/src/main/java/org/richfaces/cdk/apt/SourceUtils.java
branches/RF-9323/cdk/generator/src/main/java/org/richfaces/cdk/generate/freemarker/ModelElementBaseTemplateModel.java
branches/RF-9323/cdk/generator/src/main/java/org/richfaces/cdk/generate/java/BehaviorClassGenerator.java
branches/RF-9323/cdk/generator/src/main/java/org/richfaces/cdk/generate/java/ComponentClassGenerator.java
branches/RF-9323/cdk/generator/src/main/java/org/richfaces/cdk/generate/java/ConverterClassGenerator.java
branches/RF-9323/cdk/generator/src/main/java/org/richfaces/cdk/generate/java/ValidatorClassGenerator.java
branches/RF-9323/cdk/generator/src/main/java/org/richfaces/cdk/model/BehaviorRendererModel.java
branches/RF-9323/cdk/generator/src/main/java/org/richfaces/cdk/model/ComponentModel.java
branches/RF-9323/cdk/generator/src/main/java/org/richfaces/cdk/model/DescriptionGroupBase.java
branches/RF-9323/cdk/generator/src/main/java/org/richfaces/cdk/model/FacesComponent.java
branches/RF-9323/cdk/generator/src/main/java/org/richfaces/cdk/model/PropertyBase.java
branches/RF-9323/cdk/generator/src/main/java/org/richfaces/cdk/model/RenderKitModel.java
branches/RF-9323/cdk/generator/src/main/java/org/richfaces/cdk/model/validator/ValidatorImpl.java
branches/RF-9323/cdk/generator/src/main/java/org/richfaces/cdk/templatecompiler/builder/model/JavaClass.java
branches/RF-9323/cdk/generator/src/main/java/org/richfaces/cdk/templatecompiler/builder/model/JavaImportImpl.java
branches/RF-9323/cdk/generator/src/main/java/org/richfaces/cdk/templatecompiler/model/ClassImport.java
branches/RF-9323/cdk/generator/src/main/java/org/richfaces/cdk/templatecompiler/statements/HelperMethod.java
branches/RF-9323/cdk/generator/src/main/java/org/richfaces/cdk/templatecompiler/statements/ScriptOptionStatement.java
branches/RF-9323/cdk/generator/src/main/java/org/richfaces/cdk/templatecompiler/statements/WriteAttributesSetStatement.java
branches/RF-9323/cdk/generator/src/test/java/org/richfaces/cdk/apt/AptSourceUtilsAnnotationsTest.java
branches/RF-9323/cdk/generator/src/test/java/org/richfaces/cdk/apt/SourceUtilsTestBase.java
branches/RF-9323/cdk/generator/src/test/java/org/richfaces/cdk/apt/processors/ComponentProcessorTest.java
branches/RF-9323/cdk/generator/src/test/java/org/richfaces/cdk/xmlconfig/FacesConfigTest.java
branches/RF-9323/cdk/generator/src/test/java/org/richfaces/cdk/xmlconfig/FragmentParserTest.java
branches/RF-9323/cdk/generator/src/test/resources/org/richfaces/cdk/apt/TestClass.java
branches/RF-9323/cdk/generator/src/test/resources/org/richfaces/cdk/xmlconfig/testmodel/BehaviorBeanTest.xml
branches/RF-9323/cdk/generator/src/test/resources/org/richfaces/cdk/xmlconfig/testmodel/ConverterBeanTest.xml
branches/RF-9323/cdk/generator/src/test/resources/org/richfaces/cdk/xmlconfig/testmodel/ValidatorBeanTest.xml
Log:
working branch for CDK attributes
Copied: branches/RF-9323 (from rev 20592, trunk)
Modified: branches/RF-9323/cdk/generator/src/main/java/org/richfaces/cdk/apt/AptSourceUtils.java
===================================================================
--- trunk/cdk/generator/src/main/java/org/richfaces/cdk/apt/AptSourceUtils.java 2010-12-15 17:57:11 UTC (rev 20592)
+++ branches/RF-9323/cdk/generator/src/main/java/org/richfaces/cdk/apt/AptSourceUtils.java 2010-12-16 16:53:49 UTC (rev 20621)
@@ -24,6 +24,7 @@
import javax.lang.model.type.TypeKind;
import javax.lang.model.type.TypeMirror;
import javax.lang.model.util.ElementFilter;
+import javax.lang.model.util.ElementKindVisitor6;
import org.richfaces.cdk.CdkException;
import org.richfaces.cdk.Logger;
@@ -34,12 +35,14 @@
import com.google.common.base.Predicate;
import com.google.common.collect.Iterables;
import com.google.common.collect.Lists;
+import com.google.common.collect.Maps;
import com.google.inject.Inject;
public class AptSourceUtils implements SourceUtils {
private static final Set<String> PROPERTIES =
new HashSet<String>(Arrays.asList("getEventNames", "getDefaultEventName", "getClientBehaviors", "getFamily"));
+ private static final Predicate<Element> BEAN_PROPERTY_PREDICATE = new BeanPropertyMethodPredicate();
private final ProcessingEnvironment processingEnv;
@Inject
@@ -111,6 +114,55 @@
return properties;
}
+ @Override
+ public BeanProperty getBeanProperty(TypeElement type, String name) {
+ List<? extends Element> members = this.processingEnv.getElementUtils().getAllMembers(type);
+ return null;
+ }
+
+ /**
+ * <p class="changed_added_4_0">Utility method to get all bean properties, similar to Introspector</p>
+ * @param type
+ * @return
+ */
+ Map<String,BeanProperty> getBeanProperties(TypeElement type){
+ List<? extends Element> members = this.processingEnv.getElementUtils().getAllMembers(type);
+ // extract all getters/setters.
+ Iterable<? extends ExecutableElement> gettersAndSetters = Iterables.filter(Iterables.filter(members, BEAN_PROPERTY_PREDICATE),ExecutableElement.class);
+ Map<String,BeanProperty> result = Maps.newHashMap();
+ for (Element element : members) {
+ if (ElementKind.METHOD.equals(element.getKind())){
+ ExecutableElement method = (ExecutableElement) element;
+ if(isPublicNonStatic(method)){
+ if(isGetter(method)){
+ String propertyName = PropertyUtils.methodToName(method.getSimpleName().toString());
+ if(result.containsKey(propertyName)){
+ // Merge property with existed one.
+ BeanProperty beanProperty = result.get(propertyName);
+ processingEnv.getElementUtils().
+ } else {
+
+ }
+ } else if (isBooleanGetter(method)) {
+
+ } else if (isSetter(method)) {
+
+ }
+ }
+ }
+ }
+ // Merge all getter/setter methods.
+ for (ExecutableElement accestor : gettersAndSetters) {
+ String name = PropertyUtils.methodToName(accestor.getSimpleName().toString());
+ if(result.containsKey(name)){
+
+ } else {
+
+ }
+ }
+ return result;
+ }
+
private void removeNotAbstractGroups(Map<String, List<ExecutableElement>> props) {
List<String> removeKeys = new ArrayList<String>();
for (Map.Entry<String, List<ExecutableElement>> entry : props.entrySet()) {
@@ -163,7 +215,7 @@
AptBeanProperty property = new AptBeanProperty(childElement.getSimpleName().toString());
property.type = asClassDescription(childElement.asType());
- property.element = childElement;
+ property.getter = childElement;
// TODO - find getter/setter, check them for abstract.
property.exists = true;
@@ -197,7 +249,7 @@
AptBeanProperty property = new AptBeanProperty(name);
property.type = asClassDescription(propertyType);
- property.element = childElement;
+ property.getter = childElement;
property.exists = exists;
properties.add(property);
@@ -215,6 +267,26 @@
return method.getModifiers().contains(Modifier.ABSTRACT);
}
+ private boolean isPublicNonStatic(ExecutableElement method){
+ Set<Modifier> modifiers = method.getModifiers();
+ return modifiers.contains(Modifier.PUBLIC) && !modifiers.contains(Modifier.STATIC);
+ }
+
+ private boolean isGetter(ExecutableElement e) {
+ String methodName = e.getSimpleName().toString();
+ return methodName.startsWith("get") && methodName.length()>3 && Character.isUpperCase(methodName.charAt(3)) && 0 == e.getParameters().size();
+ }
+
+ private boolean isBooleanGetter(ExecutableElement e) {
+ String methodName = e.getSimpleName().toString();
+ return methodName.startsWith("is") && methodName.length()>2 && Character.isUpperCase(methodName.charAt(2)) && 0 == e.getParameters().size() && TypeKind.BOOLEAN.equals(e.getReturnType().getKind());
+ }
+
+ private boolean isSetter(ExecutableElement e) {
+ String methodName = e.getSimpleName().toString();
+ return methodName.startsWith("set") && methodName.length()>3 && Character.isUpperCase(methodName.charAt(3)) && 1 == e.getParameters().size() && !e.isVarArgs() && TypeKind.VOID.equals(e.getReturnType().getKind());
+ }
+
private ClassName asClassDescription(TypeMirror type) {
return new ClassName(type.toString());
}
@@ -378,6 +450,45 @@
}
}
+ private static final class BeanPropertyMethodPredicate extends ElementKindVisitor6<Boolean, Boolean> implements Predicate<Element> {
+
+ public BeanPropertyMethodPredicate() {
+ super(Boolean.FALSE);
+ }
+
+ @Override
+ public Boolean visitExecutableAsMethod(ExecutableElement e, Boolean p) {
+ Set<Modifier> modifiers = e.getModifiers();
+ // bean accessors have to be publis, non-static.
+ if(modifiers.contains(Modifier.PUBLIC) && !modifiers.contains(Modifier.STATIC)){
+ if(isGetter(e)||isBooleanGetter(e)||isSetter(e)){
+ return Boolean.TRUE;
+ }
+ }
+ return DEFAULT_VALUE;
+ }
+
+ private boolean isGetter(ExecutableElement e) {
+ String methodName = e.getSimpleName().toString();
+ return methodName.startsWith("get") && methodName.length()>3 && Character.isUpperCase(methodName.charAt(3)) && 0 == e.getParameters().size();
+ }
+
+ private boolean isBooleanGetter(ExecutableElement e) {
+ String methodName = e.getSimpleName().toString();
+ return methodName.startsWith("is") && methodName.length()>2 && Character.isUpperCase(methodName.charAt(2)) && 0 == e.getParameters().size() && TypeKind.BOOLEAN.equals(e.getReturnType().getKind());
+ }
+
+ private boolean isSetter(ExecutableElement e) {
+ String methodName = e.getSimpleName().toString();
+ return methodName.startsWith("set") && methodName.length()>3 && Character.isUpperCase(methodName.charAt(3)) && 1 == e.getParameters().size() && !e.isVarArgs() && TypeKind.VOID.equals(e.getReturnType().getKind());
+ }
+
+ @Override
+ public boolean apply(Element input) {
+ return visit(input);
+ }
+ }
+
private static final class AnnotationAttributePredicate implements
Predicate<Map.Entry<? extends ExecutableElement, ? extends AnnotationValue>> {
private final String propertyName;
@@ -401,7 +512,10 @@
*
*/
protected final class AptBeanProperty implements BeanProperty {
- private Element element;
+ private ExecutableElement getter;
+ private ExecutableElement setter;
+ private String docComment;
+ private Map<Class<? extends Annotation>,AnnotationMirror> annotations = Maps.newHashMap();
private boolean exists;
private final String name;
private ClassName type;
@@ -481,7 +595,7 @@
* @return
*/
public String getDocComment() {
- return processingEnv.getElementUtils().getDocComment(element);
+ return processingEnv.getElementUtils().getDocComment(getter);
}
public ClassName getType() {
@@ -499,12 +613,9 @@
}
public AnnotationMirror getAnnotationMirror(Class<? extends Annotation> annotationType) {
- return AptSourceUtils.this.getAnnotationMirror(element, annotationType);
+ return AptSourceUtils.this.getAnnotationMirror(getter, annotationType);
}
- public <T extends Annotation> T getAnnotation(Class<T> annotationType) {
- return element.getAnnotation(annotationType);
- }
}
}
Added: branches/RF-9323/cdk/generator/src/main/java/org/richfaces/cdk/apt/ElementKindScanner.java
===================================================================
--- branches/RF-9323/cdk/generator/src/main/java/org/richfaces/cdk/apt/ElementKindScanner.java (rev 0)
+++ branches/RF-9323/cdk/generator/src/main/java/org/richfaces/cdk/apt/ElementKindScanner.java 2010-12-16 16:53:49 UTC (rev 20621)
@@ -0,0 +1,138 @@
+/*
+ * $Id$
+ * 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.cdk.apt;
+
+import javax.lang.model.element.Element;
+import javax.lang.model.element.ExecutableElement;
+import javax.lang.model.element.PackageElement;
+import javax.lang.model.element.TypeElement;
+import javax.lang.model.element.TypeParameterElement;
+import javax.lang.model.element.VariableElement;
+import javax.lang.model.util.ElementKindVisitor6;
+
+/**
+ * <p class="changed_added_4_0">
+ * </p>
+ *
+ * @author asmirnov(a)exadel.com
+ *
+ */
+public class ElementKindScanner<R, P> extends ElementKindVisitor6<R, P> {
+
+ /**
+ * <p class="changed_added_4_0">
+ * </p>
+ */
+ public ElementKindScanner() {
+ super();
+ }
+
+ /**
+ * <p class="changed_added_4_0">
+ * </p>
+ *
+ * @param defaultValue
+ */
+ public ElementKindScanner(R defaultValue) {
+ super(defaultValue);
+ }
+
+ public final R scan(Iterable<? extends Element> iterable, P p) {
+ R result = DEFAULT_VALUE;
+ for (Element e : iterable){
+ result = visit(e, p);
+ }
+ return result;
+ }
+
+ /**
+ * {@inheritDoc} This implementation scans the enclosed elements.
+ *
+ * @param e
+ * the element to visit
+ * @param p
+ * a visitor-specified parameter
+ * @return the result of scanning
+ */
+ public R visitPackage(PackageElement e, P p) {
+ scan(e.getEnclosedElements(), p);
+ return super.visitPackage(e, p);
+ }
+
+ /**
+ * {@inheritDoc} This implementation scans the enclosed elements.
+ *
+ * @param e
+ * the element to visit
+ * @param p
+ * a visitor-specified parameter
+ * @return the result of scanning
+ */
+ public R visitType(TypeElement e, P p) {
+ scan(e.getEnclosedElements(), p);
+ return super.visitType(e, p);
+ }
+
+ /**
+ * {@inheritDoc} This implementation scans the enclosed elements.
+ *
+ * @param e
+ * the element to visit
+ * @param p
+ * a visitor-specified parameter
+ * @return the result of scanning
+ */
+ public R visitVariable(VariableElement e, P p) {
+ scan(e.getEnclosedElements(), p);
+ return super.visitVariable(e, p);
+ }
+
+ /**
+ * {@inheritDoc} This implementation scans the parameters.
+ *
+ * @param e
+ * the element to visit
+ * @param p
+ * a visitor-specified parameter
+ * @return the result of scanning
+ */
+ public R visitExecutable(ExecutableElement e, P p) {
+ scan(e.getParameters(), p);
+ return super.visitExecutable(e, p);
+ }
+
+ /**
+ * {@inheritDoc} This implementation scans the enclosed elements.
+ *
+ * @param e
+ * the element to visit
+ * @param p
+ * a visitor-specified parameter
+ * @return the result of scanning
+ */
+ public R visitTypeParameter(TypeParameterElement e, P p) {
+ scan(e.getEnclosedElements(), p);
+ return super.visitTypeParameter(e, p);
+ }
+}
Modified: branches/RF-9323/cdk/generator/src/main/java/org/richfaces/cdk/apt/ReflectionUtils.java
===================================================================
--- trunk/cdk/generator/src/main/java/org/richfaces/cdk/apt/ReflectionUtils.java 2010-12-15 17:57:11 UTC (rev 20592)
+++ branches/RF-9323/cdk/generator/src/main/java/org/richfaces/cdk/apt/ReflectionUtils.java 2010-12-16 16:53:49 UTC (rev 20621)
@@ -67,6 +67,12 @@
}
@Override
+ public BeanProperty getBeanProperty(TypeElement type, String name) {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
public Object getConstant(TypeElement element, String name) {
// TODO Auto-generated method stub
return null;
Modified: branches/RF-9323/cdk/generator/src/main/java/org/richfaces/cdk/apt/SourceUtils.java
===================================================================
--- trunk/cdk/generator/src/main/java/org/richfaces/cdk/apt/SourceUtils.java 2010-12-15 17:57:11 UTC (rev 20592)
+++ branches/RF-9323/cdk/generator/src/main/java/org/richfaces/cdk/apt/SourceUtils.java 2010-12-16 16:53:49 UTC (rev 20621)
@@ -97,7 +97,6 @@
AnnotationMirror getAnnotationMirror(Class<? extends Annotation> annotationType);
- <T extends Annotation> T getAnnotation(Class<T> annotationType);
}
/**
@@ -119,6 +118,15 @@
* @return
*/
Set<BeanProperty> getAbstractBeanProperties(TypeElement type);
+
+
+ /**
+ * <p class="changed_added_4_0">Get bean property descriptor for particular type.</p>
+ * @param type
+ * @param name
+ * @return
+ */
+ BeanProperty getBeanProperty(TypeElement type, String name);
/**
* <p class="changed_added_4_0">
@@ -172,6 +180,14 @@
<T> List<T> getAnnotationValues(AnnotationMirror annotation, String propertyName, Class<T> expectedType);
/**
+ * <p class="changed_added_4_0"></p>
+ * @param annotation
+ * @param propertyName
+ * @return
+ */
+ public abstract boolean isAnnotationPropertyPresent(AnnotationMirror annotation, final String propertyName);
+
+ /**
* <p class="changed_added_4_0">Check annotation proprrty for default value.</p>
* @param annotation
* @param propertyName
@@ -179,6 +195,23 @@
*/
boolean isDefaultValue(AnnotationMirror annotation, String propertyName);
/**
+ * <p class="changed_added_4_0"></p>
+ * @param model
+ * @param annotation
+ * @param modelProperty
+ * @param annotationAttribute
+ */
+ public abstract void setModelProperty(Object model, AnnotationMirror annotation, String modelProperty, String annotationAttribute);
+
+ /**
+ * <p class="changed_added_4_0"></p>
+ * @param model
+ * @param annotation
+ * @param modelProperty
+ */
+ public abstract void setModelProperty(Object model, AnnotationMirror annotation, String modelProperty);
+
+ /**
* <p class="changed_added_4_0">
* </p>
*
@@ -203,7 +236,7 @@
* </p>
*
* @param mirror
- * @return
+ * @return The Element for given type
*/
TypeElement asTypeElement(TypeMirror mirror);
@@ -212,14 +245,8 @@
* </p>
*
* @param type
- * @return
+ * @return TypeElement for given type, or null if corresponding name does not exist.
*/
TypeElement asTypeElement(ClassName type);
- public abstract boolean isAnnotationPropertyPresent(AnnotationMirror annotation, final String propertyName);
-
- public abstract void setModelProperty(Object model, AnnotationMirror annotation, String modelProperty, String annotationAttribute);
-
- public abstract void setModelProperty(Object model, AnnotationMirror annotation, String modelProperty);
-
}
Modified: branches/RF-9323/cdk/generator/src/main/java/org/richfaces/cdk/generate/freemarker/ModelElementBaseTemplateModel.java
===================================================================
--- trunk/cdk/generator/src/main/java/org/richfaces/cdk/generate/freemarker/ModelElementBaseTemplateModel.java 2010-12-15 17:57:11 UTC (rev 20592)
+++ branches/RF-9323/cdk/generator/src/main/java/org/richfaces/cdk/generate/freemarker/ModelElementBaseTemplateModel.java 2010-12-16 16:53:49 UTC (rev 20621)
@@ -124,7 +124,7 @@
Set<ClassName> result = Sets.newTreeSet();
for (PropertyBase entry : model.getAttributes()) {
- if (entry.isGenerate() && !isPredefined(entry)) {
+ if (entry.getGenerate() && !isPredefined(entry)) {
result.add(entry.getType());
}
}
@@ -244,7 +244,7 @@
@Override
public boolean apply(PropertyBase input) {
- return input.isGenerate();
+ return input.getGenerate();
}
}));
}
Modified: branches/RF-9323/cdk/generator/src/main/java/org/richfaces/cdk/generate/java/BehaviorClassGenerator.java
===================================================================
--- trunk/cdk/generator/src/main/java/org/richfaces/cdk/generate/java/BehaviorClassGenerator.java 2010-12-15 17:57:11 UTC (rev 20592)
+++ branches/RF-9323/cdk/generator/src/main/java/org/richfaces/cdk/generate/java/BehaviorClassGenerator.java 2010-12-16 16:53:49 UTC (rev 20621)
@@ -52,7 +52,7 @@
public void render(ComponentLibrary library) throws CdkException {
Collection<BehaviorModel> models = library.getBehaviors();
for (BehaviorModel model : models) {
- if (model.isGenerate()) {
+ if (model.getGenerate()) {
this.generate(library, model);
}
}
Modified: branches/RF-9323/cdk/generator/src/main/java/org/richfaces/cdk/generate/java/ComponentClassGenerator.java
===================================================================
--- trunk/cdk/generator/src/main/java/org/richfaces/cdk/generate/java/ComponentClassGenerator.java 2010-12-15 17:57:11 UTC (rev 20592)
+++ branches/RF-9323/cdk/generator/src/main/java/org/richfaces/cdk/generate/java/ComponentClassGenerator.java 2010-12-16 16:53:49 UTC (rev 20621)
@@ -55,7 +55,7 @@
public void render(ComponentLibrary library) throws CdkException {
Collection<ComponentModel> models = library.getComponents();
for (ComponentModel model : models) {
- if (model.isGenerate()) {
+ if (model.getGenerate()) {
this.generate(library, model);
}
}
Modified: branches/RF-9323/cdk/generator/src/main/java/org/richfaces/cdk/generate/java/ConverterClassGenerator.java
===================================================================
--- trunk/cdk/generator/src/main/java/org/richfaces/cdk/generate/java/ConverterClassGenerator.java 2010-12-15 17:57:11 UTC (rev 20592)
+++ branches/RF-9323/cdk/generator/src/main/java/org/richfaces/cdk/generate/java/ConverterClassGenerator.java 2010-12-16 16:53:49 UTC (rev 20621)
@@ -52,7 +52,7 @@
public void render(ComponentLibrary library) throws CdkException {
Collection<ConverterModel> models = library.getConverters();
for (ConverterModel model : models) {
- if (model.isGenerate()) {
+ if (model.getGenerate()) {
this.generate(library, model);
}
}
Modified: branches/RF-9323/cdk/generator/src/main/java/org/richfaces/cdk/generate/java/ValidatorClassGenerator.java
===================================================================
--- trunk/cdk/generator/src/main/java/org/richfaces/cdk/generate/java/ValidatorClassGenerator.java 2010-12-15 17:57:11 UTC (rev 20592)
+++ branches/RF-9323/cdk/generator/src/main/java/org/richfaces/cdk/generate/java/ValidatorClassGenerator.java 2010-12-16 16:53:49 UTC (rev 20621)
@@ -51,7 +51,7 @@
public void render(ComponentLibrary library) throws CdkException {
Collection<ValidatorModel> models = library.getValidators();
for (ValidatorModel model : models) {
- if (model.isGenerate()) {
+ if (model.getGenerate()) {
this.generate(library, model);
}
}
Modified: branches/RF-9323/cdk/generator/src/main/java/org/richfaces/cdk/model/BehaviorRendererModel.java
===================================================================
--- trunk/cdk/generator/src/main/java/org/richfaces/cdk/model/BehaviorRendererModel.java 2010-12-15 17:57:11 UTC (rev 20592)
+++ branches/RF-9323/cdk/generator/src/main/java/org/richfaces/cdk/model/BehaviorRendererModel.java 2010-12-16 16:53:49 UTC (rev 20621)
@@ -99,7 +99,7 @@
* <p class="changed_added_4_0"></p>
* @return the generate
*/
- public boolean isGenerate() {
+ public Boolean getGenerate() {
return this.generate;
}
@@ -107,7 +107,7 @@
* <p class="changed_added_4_0"></p>
* @param generate the generate to set
*/
- public void setGenerate(boolean generate) {
+ public void setGenerate(Boolean generate) {
this.generate = generate;
}
Modified: branches/RF-9323/cdk/generator/src/main/java/org/richfaces/cdk/model/ComponentModel.java
===================================================================
--- trunk/cdk/generator/src/main/java/org/richfaces/cdk/model/ComponentModel.java 2010-12-15 17:57:11 UTC (rev 20592)
+++ branches/RF-9323/cdk/generator/src/main/java/org/richfaces/cdk/model/ComponentModel.java 2010-12-16 16:53:49 UTC (rev 20621)
@@ -61,7 +61,7 @@
ComponentLibrary.merge(getFacets(), otherComponent.getFacets());
ComponentLibrary.merge(getEvents(), otherComponent.getEvents());
ComponentLibrary.merge(this, otherComponent);
- this.setGenerate(this.isGenerate() || otherComponent.isGenerate());
+ this.setGenerate(this.getGenerate() || otherComponent.getGenerate());
}
@Override
Modified: branches/RF-9323/cdk/generator/src/main/java/org/richfaces/cdk/model/DescriptionGroupBase.java
===================================================================
--- trunk/cdk/generator/src/main/java/org/richfaces/cdk/model/DescriptionGroupBase.java 2010-12-15 17:57:11 UTC (rev 20592)
+++ branches/RF-9323/cdk/generator/src/main/java/org/richfaces/cdk/model/DescriptionGroupBase.java 2010-12-16 16:53:49 UTC (rev 20621)
@@ -31,7 +31,7 @@
/**
* <p class="changed_added_4_0">Is that bean property generate in the class or should be generated ?</p>
*/
- private boolean generate = false;
+ private Boolean generate ;
/**
* <p class="changed_added_4_0">
@@ -83,11 +83,11 @@
}
@Merge
- public boolean isGenerate() {
+ public Boolean getGenerate() {
return generate;
}
- public void setGenerate(boolean generate) {
+ public void setGenerate(Boolean generate) {
this.generate = generate;
}
Modified: branches/RF-9323/cdk/generator/src/main/java/org/richfaces/cdk/model/FacesComponent.java
===================================================================
--- trunk/cdk/generator/src/main/java/org/richfaces/cdk/model/FacesComponent.java 2010-12-15 17:57:11 UTC (rev 20592)
+++ branches/RF-9323/cdk/generator/src/main/java/org/richfaces/cdk/model/FacesComponent.java 2010-12-16 16:53:49 UTC (rev 20621)
@@ -91,12 +91,12 @@
* <p class="changed_added_4_0"></p>
* @return
*/
- public boolean isGenerate();
+ public Boolean getGenerate();
/**
* <p class="changed_added_4_0"></p>
* @param generate
*/
- public void setGenerate(boolean generate);
+ public void setGenerate(Boolean generate);
}
\ No newline at end of file
Modified: branches/RF-9323/cdk/generator/src/main/java/org/richfaces/cdk/model/PropertyBase.java
===================================================================
--- trunk/cdk/generator/src/main/java/org/richfaces/cdk/model/PropertyBase.java 2010-12-15 17:57:11 UTC (rev 20592)
+++ branches/RF-9323/cdk/generator/src/main/java/org/richfaces/cdk/model/PropertyBase.java 2010-12-16 16:53:49 UTC (rev 20621)
@@ -293,9 +293,9 @@
@Override
public void merge(PropertyBase other) {
- boolean generate = isGenerate();
+ boolean generate = getGenerate();
ComponentLibrary.merge(this, other);
- setGenerate(generate || other.isGenerate());
+ setGenerate(generate || other.getGenerate());
}
public <R,D> R accept(Visitor<R,D> visitor, D data) {
Modified: branches/RF-9323/cdk/generator/src/main/java/org/richfaces/cdk/model/RenderKitModel.java
===================================================================
--- trunk/cdk/generator/src/main/java/org/richfaces/cdk/model/RenderKitModel.java 2010-12-15 17:57:11 UTC (rev 20592)
+++ branches/RF-9323/cdk/generator/src/main/java/org/richfaces/cdk/model/RenderKitModel.java 2010-12-16 16:53:49 UTC (rev 20621)
@@ -44,8 +44,6 @@
private FacesId id;
- private boolean generate;
-
public RenderKitModel() {
}
@@ -100,22 +98,6 @@
/**
* <p class="changed_added_4_0"></p>
- * @return the generate
- */
- public boolean isGenerate() {
- return this.generate;
- }
-
- /**
- * <p class="changed_added_4_0"></p>
- * @param generate the generate to set
- */
- public void setGenerate(boolean generate) {
- this.generate = generate;
- }
-
- /**
- * <p class="changed_added_4_0"></p>
* @return the renderers
*/
public ModelCollection<RendererModel> getRenderers() {
Modified: branches/RF-9323/cdk/generator/src/main/java/org/richfaces/cdk/model/validator/ValidatorImpl.java
===================================================================
--- trunk/cdk/generator/src/main/java/org/richfaces/cdk/model/validator/ValidatorImpl.java 2010-12-15 17:57:11 UTC (rev 20592)
+++ branches/RF-9323/cdk/generator/src/main/java/org/richfaces/cdk/model/validator/ValidatorImpl.java 2010-12-16 16:53:49 UTC (rev 20621)
@@ -361,13 +361,7 @@
try {
// Step one, lookup for parent.
ComponentModel parentComponent =
- Iterables.find(library.getComponents(), new Predicate<ComponentModel>() {
-
- @Override
- public boolean apply(ComponentModel input) {
- return component.getBaseClass().equals(input.getTargetClass());
- }
- });
+ findParent(library.getComponents(), component);
// To be sure what all properties for parent component were propagated.
verifyComponentAttributes(library, parentComponent, verified);
for (PropertyBase parentAttribute : parentComponent.getAttributes()) {
@@ -382,7 +376,7 @@
} // Check attributes.
for (PropertyBase attribute : component.getAttributes()) {
- verifyAttribute(attribute, component.isGenerate());
+ verifyAttribute(attribute, component.getGenerate());
}
// compact(component.getAttributes());
// Check renderers.
@@ -397,6 +391,16 @@
}
}
+ private <T extends FacesComponent> T findParent(Iterable<T> components, final T component) throws NoSuchElementException {
+ return Iterables.find(components, new Predicate<T>() {
+
+ @Override
+ public boolean apply(T input) {
+ return component.getBaseClass().equals(input.getTargetClass());
+ }
+ });
+ }
+
protected void verifyTag(TagModel tag, FacesId id, ClassName handler) {
if (Strings.isEmpty(tag.getName())) {
String defaultTagName = namingConventions.inferTagName(id);
@@ -457,7 +461,7 @@
}
}
// Check classes.
- if (component.isGenerate()) {
+ if (component.getGenerate()) {
if (null == component.getBaseClass()) {
component.setBaseClass(callback.getDefaultBaseClass());
// return;
Modified: branches/RF-9323/cdk/generator/src/main/java/org/richfaces/cdk/templatecompiler/builder/model/JavaClass.java
===================================================================
--- trunk/cdk/generator/src/main/java/org/richfaces/cdk/templatecompiler/builder/model/JavaClass.java 2010-12-15 17:57:11 UTC (rev 20592)
+++ branches/RF-9323/cdk/generator/src/main/java/org/richfaces/cdk/templatecompiler/builder/model/JavaClass.java 2010-12-16 16:53:49 UTC (rev 20621)
@@ -74,8 +74,8 @@
addImport(new JavaImportImpl(name));
}
- public void addImport(String name, boolean _static) {
- addImport(new JavaImportImpl(name, _static));
+ public void addImport(String name, boolean staticImport) {
+ addImport(new JavaImportImpl(name, staticImport));
}
public void addImport(Class<?> claz) {
Modified: branches/RF-9323/cdk/generator/src/main/java/org/richfaces/cdk/templatecompiler/builder/model/JavaImportImpl.java
===================================================================
--- trunk/cdk/generator/src/main/java/org/richfaces/cdk/templatecompiler/builder/model/JavaImportImpl.java 2010-12-15 17:57:11 UTC (rev 20592)
+++ branches/RF-9323/cdk/generator/src/main/java/org/richfaces/cdk/templatecompiler/builder/model/JavaImportImpl.java 2010-12-16 16:53:49 UTC (rev 20621)
@@ -33,7 +33,7 @@
private String name;
- private boolean _static;
+ private boolean staticImport;
public JavaImportImpl(String name) {
this(name, false);
@@ -43,14 +43,14 @@
this(clazz.getName());
}
- public JavaImportImpl(String name, boolean _static) {
+ public JavaImportImpl(String name, boolean staticImport) {
super();
this.name = name;
- this._static = _static;
+ this.staticImport = staticImport;
}
- public JavaImportImpl(Class<?> clazz, boolean _static) {
- this(clazz.getName(), _static);
+ public JavaImportImpl(Class<?> clazz, boolean staticImport) {
+ this(clazz.getName(), staticImport);
}
public String getName() {
@@ -58,7 +58,7 @@
}
public boolean isStatic() {
- return _static;
+ return staticImport;
}
public boolean isDefault() {
Modified: branches/RF-9323/cdk/generator/src/main/java/org/richfaces/cdk/templatecompiler/model/ClassImport.java
===================================================================
--- trunk/cdk/generator/src/main/java/org/richfaces/cdk/templatecompiler/model/ClassImport.java 2010-12-15 17:57:11 UTC (rev 20592)
+++ branches/RF-9323/cdk/generator/src/main/java/org/richfaces/cdk/templatecompiler/model/ClassImport.java 2010-12-16 16:53:49 UTC (rev 20621)
@@ -32,47 +32,47 @@
*/
public class ClassImport {
- @XmlAttribute(required = true)
- @XmlJavaTypeAdapter(NormalizedStringAdapter.class)
- private String _package;
+ private String packageName;
- @XmlAttribute
- private boolean _static;
+ private boolean staticImport;
- @XmlAttribute
private List<String> names;
/**
* @return the package_
*/
+ @XmlAttribute(required = true)
+ @XmlJavaTypeAdapter(NormalizedStringAdapter.class)
public String getPackage() {
- return _package;
+ return packageName;
}
/**
- * @param _package the package_ to set
+ * @param packageName the package_ to set
*/
- public void setPackage(String _package) {
- this._package = _package;
+ public void setPackage(String packageName) {
+ this.packageName = packageName;
}
/**
* @return the static_
*/
+ @XmlAttribute
public boolean isStatic() {
- return _static;
+ return staticImport;
}
/**
* @param static_ the static_ to set
*/
- public void setStatic(boolean _static) {
- this._static = _static;
+ public void setStatic(boolean staticImport) {
+ this.staticImport = staticImport;
}
/**
* @return the classes
*/
+ @XmlAttribute
public List<String> getNames() {
return names;
}
Modified: branches/RF-9323/cdk/generator/src/main/java/org/richfaces/cdk/templatecompiler/statements/HelperMethod.java
===================================================================
--- trunk/cdk/generator/src/main/java/org/richfaces/cdk/templatecompiler/statements/HelperMethod.java 2010-12-15 17:57:11 UTC (rev 20592)
+++ branches/RF-9323/cdk/generator/src/main/java/org/richfaces/cdk/templatecompiler/statements/HelperMethod.java 2010-12-16 16:53:49 UTC (rev 20621)
@@ -80,11 +80,6 @@
}
}
- private static String[] transformClassesToClassNames(Class<?>[] s) {
- Iterator<String> transformed = transform(forArray(s), CLASS_TO_CLASS_NAME);
- return toArray(transformed, String.class);
- }
-
private HelperMethod(String name, String returnType, String... argumentTypes) {
this.name = name;
this.returnType = returnType;
@@ -95,6 +90,11 @@
this(name, CLASS_TO_CLASS_NAME.apply(returnType), transformClassesToClassNames(argumentTypes));
}
+ private static String[] transformClassesToClassNames(Class<?>[] s) {
+ Iterator<String> transformed = transform(forArray(s), CLASS_TO_CLASS_NAME);
+ return toArray(transformed, String.class);
+ }
+
public String getName() {
return name;
}
Modified: branches/RF-9323/cdk/generator/src/main/java/org/richfaces/cdk/templatecompiler/statements/ScriptOptionStatement.java
===================================================================
--- trunk/cdk/generator/src/main/java/org/richfaces/cdk/templatecompiler/statements/ScriptOptionStatement.java 2010-12-15 17:57:11 UTC (rev 20592)
+++ branches/RF-9323/cdk/generator/src/main/java/org/richfaces/cdk/templatecompiler/statements/ScriptOptionStatement.java 2010-12-16 16:53:49 UTC (rev 20621)
@@ -79,11 +79,12 @@
}
/**
- * @param value the value to set
+ * @param value
+ * the value to set
*/
public void setValueExpression(String valueExpression) {
try {
- this.value = parser.parse(valueExpression, this, TypesFactory.OBJECT_TYPE);
+ this.value = parser.parse(valueExpression, this, TypesFactory.OBJECT_TYPE);
} catch (ParsingException e) {
logger.error("Error parse scriptOption value expression: " + valueExpression, e);
}
Modified: branches/RF-9323/cdk/generator/src/main/java/org/richfaces/cdk/templatecompiler/statements/WriteAttributesSetStatement.java
===================================================================
--- trunk/cdk/generator/src/main/java/org/richfaces/cdk/templatecompiler/statements/WriteAttributesSetStatement.java 2010-12-15 17:57:11 UTC (rev 20592)
+++ branches/RF-9323/cdk/generator/src/main/java/org/richfaces/cdk/templatecompiler/statements/WriteAttributesSetStatement.java 2010-12-16 16:53:49 UTC (rev 20621)
@@ -27,7 +27,6 @@
import org.richfaces.cdk.generate.freemarker.FreeMarkerRenderer;
import org.richfaces.cdk.templatecompiler.TemplateModel;
-import com.google.common.collect.Sets;
import com.google.inject.Inject;
/**
Modified: branches/RF-9323/cdk/generator/src/test/java/org/richfaces/cdk/apt/AptSourceUtilsAnnotationsTest.java
===================================================================
--- trunk/cdk/generator/src/test/java/org/richfaces/cdk/apt/AptSourceUtilsAnnotationsTest.java 2010-12-15 17:57:11 UTC (rev 20592)
+++ branches/RF-9323/cdk/generator/src/test/java/org/richfaces/cdk/apt/AptSourceUtilsAnnotationsTest.java 2010-12-16 16:53:49 UTC (rev 20621)
@@ -3,7 +3,6 @@
import static org.junit.Assert.*;
import java.util.List;
-import java.util.Set;
import javax.annotation.processing.RoundEnvironment;
import javax.lang.model.element.AnnotationMirror;
@@ -13,9 +12,7 @@
import org.richfaces.cdk.apt.TestAnnotation.TestEnum;
import org.richfaces.cdk.model.ClassName;
-import com.google.common.base.Predicate;
import com.google.common.collect.ImmutableList;
-import com.google.common.collect.Iterables;
public class AptSourceUtilsAnnotationsTest extends SourceUtilsTestBase {
@@ -163,15 +160,4 @@
protected Iterable<String> sources() {
return ImmutableList.of(CLASS_JAVA, SUB_CLASS_JAVA);
}
-
- private Element findElement(RoundEnvironment roundEnvironment, final String name){
- Set<? extends Element> elements = roundEnvironment.getRootElements();
- return Iterables.find(elements, new Predicate<Element>() {
-
- @Override
- public boolean apply(Element input) {
- return name.equals(input.getSimpleName().toString());
- }
- });
- }
}
Added: branches/RF-9323/cdk/generator/src/test/java/org/richfaces/cdk/apt/AptSourceUtilsPropertiesTest.java
===================================================================
--- branches/RF-9323/cdk/generator/src/test/java/org/richfaces/cdk/apt/AptSourceUtilsPropertiesTest.java (rev 0)
+++ branches/RF-9323/cdk/generator/src/test/java/org/richfaces/cdk/apt/AptSourceUtilsPropertiesTest.java 2010-12-16 16:53:49 UTC (rev 20621)
@@ -0,0 +1,178 @@
+/*
+ * $Id$
+ * 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.cdk.apt;
+
+import static org.junit.Assert.*;
+
+import javax.annotation.processing.RoundEnvironment;
+import javax.lang.model.element.Element;
+import javax.lang.model.element.ElementVisitor;
+import javax.lang.model.element.ExecutableElement;
+import javax.lang.model.element.PackageElement;
+import javax.lang.model.element.TypeElement;
+import javax.lang.model.element.TypeParameterElement;
+import javax.lang.model.element.VariableElement;
+import javax.lang.model.util.AbstractElementVisitor6;
+import javax.lang.model.util.ElementKindVisitor6;
+import javax.lang.model.util.ElementScanner6;
+
+import org.junit.Test;
+import org.richfaces.cdk.apt.SourceUtils.BeanProperty;
+
+import com.google.common.collect.ImmutableList;
+
+/**
+ * <p class="changed_added_4_0">
+ * </p>
+ *
+ * @author asmirnov(a)exadel.com
+ *
+ */
+public class AptSourceUtilsPropertiesTest extends SourceUtilsTestBase {
+
+ private static final String TEST_SUB_CLASS = "PropertyTestClass";
+ private static final String TEST_CLASS = "TestClass";
+ private static final String TEST_INTERFACE = "TestInterface";
+ private static final String PROPERTY_TEST_INTERFACE = "TestInterface";
+ private static final String PACKAGE_PATH = "org/richfaces/cdk/apt/";
+ private static final String CLASS_JAVA = PACKAGE_PATH + TEST_CLASS + ".java";
+ private static final String SUB_CLASS_JAVA = PACKAGE_PATH + TEST_SUB_CLASS + ".java";
+ private static final String INTERFACE_JAVA = PACKAGE_PATH + TEST_INTERFACE + ".java";
+ private static final String PROPERTY_INTERFACE_JAVA = PACKAGE_PATH + PROPERTY_TEST_INTERFACE + ".java";
+
+ @Test
+ public void testGetConcreteProperty() throws Exception {
+ execute(new SourceUtilsCallback() {
+
+ @Override
+ public void process(SourceUtils utils, RoundEnvironment roundEnv) {
+ TypeElement subClassType = (TypeElement) findElement(roundEnv, TEST_SUB_CLASS);
+ BeanProperty beanProperty = utils.getBeanProperty(subClassType, "concreteValue");
+ assertTrue(beanProperty.isExists());
+ }
+ });
+ }
+
+ @Test
+ public void testGetAbstractProperty() throws Exception {
+ execute(new SourceUtilsCallback() {
+
+ @Override
+ public void process(SourceUtils utils, RoundEnvironment roundEnv) {
+ TypeElement subClassType = (TypeElement) findElement(roundEnv, TEST_SUB_CLASS);
+ BeanProperty beanProperty = utils.getBeanProperty(subClassType, "value");
+ assertFalse(beanProperty.isExists());
+ }
+ });
+ }
+
+ @Test
+ public void testGetNotExistedProperty() throws Exception {
+ execute(new SourceUtilsCallback() {
+
+ @Override
+ public void process(SourceUtils utils, RoundEnvironment roundEnv) {
+ TypeElement subClassType = (TypeElement) findElement(roundEnv, TEST_SUB_CLASS);
+ BeanProperty beanProperty = utils.getBeanProperty(subClassType, "notExistedValue");
+ assertFalse(beanProperty.isExists());
+ }
+ });
+ }
+
+ @Test
+ public void testGetInheritedProperty() throws Exception {
+ execute(new SourceUtilsCallback() {
+
+ @Override
+ public void process(SourceUtils utils, RoundEnvironment roundEnv) {
+ TypeElement subClassType = (TypeElement) findElement(roundEnv, TEST_SUB_CLASS);
+ BeanProperty beanProperty = utils.getBeanProperty(subClassType, "inheritedValue");
+ assertTrue(beanProperty.isExists());
+ }
+ });
+ }
+
+ @Test
+ public void testGetReadOnlyProperty() throws Exception {
+ execute(new SourceUtilsCallback() {
+
+ @Override
+ public void process(SourceUtils utils, RoundEnvironment roundEnv) {
+ TypeElement subClassType = (TypeElement) findElement(roundEnv, TEST_SUB_CLASS);
+ BeanProperty beanProperty = utils.getBeanProperty(subClassType, "readOnly");
+ assertTrue(beanProperty.isExists());
+ }
+ });
+ }
+
+ @Test
+ public void testGetWriteOnlyProperty() throws Exception {
+ execute(new SourceUtilsCallback() {
+
+ @Override
+ public void process(SourceUtils utils, RoundEnvironment roundEnv) {
+ TypeElement subClassType = (TypeElement) findElement(roundEnv, TEST_SUB_CLASS);
+ BeanProperty beanProperty = utils.getBeanProperty(subClassType, "writeOnly");
+ assertTrue(beanProperty.isExists());
+ }
+ });
+ }
+
+ @Test
+ public void testGetWrongProperty() throws Exception {
+ execute(new SourceUtilsCallback() {
+
+ @Override
+ public void process(SourceUtils utils, RoundEnvironment roundEnv) {
+ TypeElement subClassType = (TypeElement) findElement(roundEnv, TEST_SUB_CLASS);
+ BeanProperty beanProperty = utils.getBeanProperty(subClassType, "wrongValue");
+ assertTrue(beanProperty.isExists());
+ }
+ });
+ }
+
+ @Test
+ public void testGetBeanProperties() throws Exception {
+ execute(new SourceUtilsCallback() {
+
+ @Override
+ public void process(SourceUtils utils, RoundEnvironment roundEnv) {
+ AptSourceUtils aptUtils = (AptSourceUtils) utils;
+ TypeElement subClassType = (TypeElement) findElement(roundEnv, TEST_SUB_CLASS);
+ assertEquals(5, aptUtils.getBeanProperties(subClassType).size());
+ }
+ });
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.richfaces.cdk.apt.AnnotationProcessorTestBase#sources()
+ */
+ @Override
+ protected Iterable<String> sources() {
+ return ImmutableList.of(CLASS_JAVA, SUB_CLASS_JAVA, INTERFACE_JAVA,PROPERTY_INTERFACE_JAVA);
+ }
+
+}
Modified: branches/RF-9323/cdk/generator/src/test/java/org/richfaces/cdk/apt/SourceUtilsTestBase.java
===================================================================
--- trunk/cdk/generator/src/test/java/org/richfaces/cdk/apt/SourceUtilsTestBase.java 2010-12-15 17:57:11 UTC (rev 20592)
+++ branches/RF-9323/cdk/generator/src/test/java/org/richfaces/cdk/apt/SourceUtilsTestBase.java 2010-12-16 16:53:49 UTC (rev 20621)
@@ -33,6 +33,7 @@
import javax.annotation.processing.SupportedAnnotationTypes;
import javax.annotation.processing.SupportedSourceVersion;
import javax.lang.model.SourceVersion;
+import javax.lang.model.element.Element;
import javax.lang.model.element.TypeElement;
import org.junit.runner.RunWith;
@@ -42,6 +43,8 @@
import org.richfaces.cdk.Outputs;
import org.richfaces.cdk.Stub;
+import com.google.common.base.Predicate;
+import com.google.common.collect.Iterables;
import com.google.inject.Binder;
import com.google.inject.Inject;
import com.google.inject.Singleton;
@@ -77,6 +80,17 @@
assertTrue("Compilation error",factory.get().call());
}
+ protected Element findElement(RoundEnvironment roundEnvironment, final String name) {
+ Set<? extends Element> elements = roundEnvironment.getRootElements();
+ return Iterables.find(elements, new Predicate<Element>() {
+
+ @Override
+ public boolean apply(Element input) {
+ return name.equals(input.getSimpleName().toString());
+ }
+ });
+ }
+
/**
* <p class="changed_added_4_0">Interface to call back test method from APT</p>
* @author asmirnov(a)exadel.com
Modified: branches/RF-9323/cdk/generator/src/test/java/org/richfaces/cdk/apt/processors/ComponentProcessorTest.java
===================================================================
--- trunk/cdk/generator/src/test/java/org/richfaces/cdk/apt/processors/ComponentProcessorTest.java 2010-12-15 17:57:11 UTC (rev 20592)
+++ branches/RF-9323/cdk/generator/src/test/java/org/richfaces/cdk/apt/processors/ComponentProcessorTest.java 2010-12-16 16:53:49 UTC (rev 20621)
@@ -130,7 +130,7 @@
verify(utils, componentElement, jaxb, annotation, property, facet, description);
assertEquals(1, model.getFacets().size());
FacetModel facetModel = Iterables.getOnlyElement(model.getFacets());
- assertTrue(facetModel.isGenerate());
+ assertTrue(facetModel.getGenerate());
assertEquals("foo", facetModel.getName());
// assertEquals("my comment", facetModel.getDescription());
// assertEquals("fooFacet", facetModel.getDisplayname());
@@ -160,7 +160,7 @@
verify(utils, componentElement, jaxb, annotation, property, facet, description);
assertEquals(1, model.getFacets().size());
FacetModel facetModel = Iterables.getOnlyElement(model.getFacets());
- assertTrue(facetModel.isGenerate());
+ assertTrue(facetModel.getGenerate());
assertEquals("foo", facetModel.getName());
// assertEquals("my comment", facetModel.getDescription());
// assertEquals("fooFacet", facetModel.getDisplayname());
@@ -180,7 +180,7 @@
replay(utils, componentElement, jaxb, annotation);
processor.setClassNames(componentElement, model, "");
verify(utils, componentElement, jaxb, annotation);
- assertFalse(model.isGenerate());
+ assertFalse(model.getGenerate());
assertEquals(FOO_BAR, model.getBaseClass().toString());
assertNull(model.getTargetClass());
}
@@ -200,7 +200,7 @@
processor.setClassNames(componentElement, model, "");
verify(utils, componentElement, jaxb, annotation);
- assertTrue(model.isGenerate());
+ assertTrue(model.getGenerate());
assertEquals(FOO_BAR, model.getBaseClass().toString());
assertNull(model.getTargetClass());
}
@@ -220,7 +220,7 @@
processor.setClassNames(componentElement, model, FOO_HTML_BAR);
verify(utils, componentElement, jaxb, annotation);
- assertTrue(model.isGenerate());
+ assertTrue(model.getGenerate());
assertEquals(FOO_BAR, model.getBaseClass().toString());
assertEquals(FOO_HTML_BAR, model.getTargetClass().toString());
}
Modified: branches/RF-9323/cdk/generator/src/test/java/org/richfaces/cdk/xmlconfig/FacesConfigTest.java
===================================================================
--- trunk/cdk/generator/src/test/java/org/richfaces/cdk/xmlconfig/FacesConfigTest.java 2010-12-15 17:57:11 UTC (rev 20592)
+++ branches/RF-9323/cdk/generator/src/test/java/org/richfaces/cdk/xmlconfig/FacesConfigTest.java 2010-12-16 16:53:49 UTC (rev 20621)
@@ -104,12 +104,12 @@
assertEquals("panel-large.gif", component.getIcon().getLargeIcon());
assertEquals("Panel component", component.getDescription());
assertEquals("Panel", component.getDisplayname());
- assertTrue(component.isGenerate());
+ assertTrue(component.getGenerate());
FacetModel facet = Iterables.getOnlyElement(component.getFacets());
assertEquals("header", facet.getName());
assertEquals("Header facet", facet.getDescription());
- assertTrue(facet.isGenerate());
+ assertTrue(facet.getGenerate());
Collection<PropertyBase> attributes = component.getAttributes();
Modified: branches/RF-9323/cdk/generator/src/test/java/org/richfaces/cdk/xmlconfig/FragmentParserTest.java
===================================================================
--- trunk/cdk/generator/src/test/java/org/richfaces/cdk/xmlconfig/FragmentParserTest.java 2010-12-15 17:57:11 UTC (rev 20592)
+++ branches/RF-9323/cdk/generator/src/test/java/org/richfaces/cdk/xmlconfig/FragmentParserTest.java 2010-12-16 16:53:49 UTC (rev 20621)
@@ -118,7 +118,7 @@
assertEquals("15", property.getSuggestedValue());
// CDK extensions.
- assertTrue(property.isGenerate());
+ assertTrue(property.getGenerate());
assertTrue(property.isHidden());
assertTrue(property.isLiteral());
assertTrue(property.isPassThrough());
Added: branches/RF-9323/cdk/generator/src/test/resources/org/richfaces/cdk/apt/PropertyTestClass.java
===================================================================
--- branches/RF-9323/cdk/generator/src/test/resources/org/richfaces/cdk/apt/PropertyTestClass.java (rev 0)
+++ branches/RF-9323/cdk/generator/src/test/resources/org/richfaces/cdk/apt/PropertyTestClass.java 2010-12-16 16:53:49 UTC (rev 20621)
@@ -0,0 +1,66 @@
+/*
+ * $Id: TestSubClass.java 18741 2010-08-18 03:07:27Z alexsmirnov $
+ *
+ * License Agreement.
+ *
+ * Rich Faces - Natural Ajax for Java Server Faces (JSF)
+ *
+ * Copyright (C) 2007 Exadel, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1 as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+
+
+package org.richfaces.cdk.apt;
+
+/**
+ * <p class="changed_added_4_0"></p>
+ * @author asmirnov(a)exadel.com
+ *
+ */
+public class PropertyTestClass extends TestClass implements TestInterface, PropertyTestInterface {
+ private String concreteValue;
+
+ /**
+ * <p class="changed_added_4_0"></p>
+ * @param value the value to set
+ */
+ @TestMethodAnnotation("setter")
+ public void setConcreteValue(String value) {
+ this.value = concreteValue;
+ }
+
+ /**
+ * <p class="changed_added_4_0"></p>
+ * @return the value
+ */
+ public String getConcreteValue() {
+ return concreteValue;
+ }
+
+
+ public void setInheritedValue(String value) {
+ this.value = concreteValue;
+ }
+
+ public String getInheritedValue() {
+ return concreteValue;
+ }
+
+ public void setWrongValue(Integer value) {
+
+ }
+
+}
Added: branches/RF-9323/cdk/generator/src/test/resources/org/richfaces/cdk/apt/PropertyTestInterface.java
===================================================================
--- branches/RF-9323/cdk/generator/src/test/resources/org/richfaces/cdk/apt/PropertyTestInterface.java (rev 0)
+++ branches/RF-9323/cdk/generator/src/test/resources/org/richfaces/cdk/apt/PropertyTestInterface.java 2010-12-16 16:53:49 UTC (rev 20621)
@@ -0,0 +1,41 @@
+/*
+ * $Id: TestInterface.java 18741 2010-08-18 03:07:27Z alexsmirnov $
+ *
+ * License Agreement.
+ *
+ * Rich Faces - Natural Ajax for Java Server Faces (JSF)
+ *
+ * Copyright (C) 2007 Exadel, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1 as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+
+
+package org.richfaces.cdk.apt;
+
+/**
+ * <p class="changed_added_4_0"></p>
+ * @author asmirnov(a)exadel.com
+ *
+ */
+public interface PropertyTestInterface {
+
+ public String getInheritedValue();
+
+ public void setInheritedValue(String value);
+
+ public void setWrongValue(String value);
+
+}
Modified: branches/RF-9323/cdk/generator/src/test/resources/org/richfaces/cdk/apt/TestClass.java
===================================================================
--- trunk/cdk/generator/src/test/resources/org/richfaces/cdk/apt/TestClass.java 2010-12-15 17:57:11 UTC (rev 20592)
+++ branches/RF-9323/cdk/generator/src/test/resources/org/richfaces/cdk/apt/TestClass.java 2010-12-16 16:53:49 UTC (rev 20621)
@@ -31,4 +31,13 @@
*
*/
//@TestAnnotation("foo")
-public class TestClass {}
+public class TestClass {
+
+ public Integer getReadOnly(){
+ return null;
+ }
+
+ public void setWriteOnly(){
+
+ }
+}
Modified: branches/RF-9323/cdk/generator/src/test/resources/org/richfaces/cdk/xmlconfig/testmodel/BehaviorBeanTest.xml
===================================================================
--- trunk/cdk/generator/src/test/resources/org/richfaces/cdk/xmlconfig/testmodel/BehaviorBeanTest.xml 2010-12-15 17:57:11 UTC (rev 20592)
+++ branches/RF-9323/cdk/generator/src/test/resources/org/richfaces/cdk/xmlconfig/testmodel/BehaviorBeanTest.xml 2010-12-16 16:53:49 UTC (rev 20621)
@@ -7,7 +7,6 @@
<attribute-name>attr2</attribute-name>
<attribute-class>java.lang.String</attribute-class>
<attribute-extension>
- <cdk:generate>false</cdk:generate>
<cdk:hidden>false</cdk:hidden>
<cdk:literal>false</cdk:literal>
<cdk:pass-through>false</cdk:pass-through>
@@ -19,7 +18,6 @@
<property-name>attr1</property-name>
<property-class>java.lang.String</property-class>
<property-extension>
- <cdk:generate>false</cdk:generate>
<cdk:hidden>false</cdk:hidden>
<cdk:literal>false</cdk:literal>
<cdk:pass-through>false</cdk:pass-through>
@@ -27,9 +25,7 @@
<cdk:required>false</cdk:required>
</property-extension>
</property>
- <behavior-extension>
- <cdk:generate>false</cdk:generate>
- </behavior-extension>
+ <behavior-extension/>
</behavior>
<faces-config-extension/>
</faces-config>
\ No newline at end of file
Modified: branches/RF-9323/cdk/generator/src/test/resources/org/richfaces/cdk/xmlconfig/testmodel/ConverterBeanTest.xml
===================================================================
--- trunk/cdk/generator/src/test/resources/org/richfaces/cdk/xmlconfig/testmodel/ConverterBeanTest.xml 2010-12-15 17:57:11 UTC (rev 20592)
+++ branches/RF-9323/cdk/generator/src/test/resources/org/richfaces/cdk/xmlconfig/testmodel/ConverterBeanTest.xml 2010-12-16 16:53:49 UTC (rev 20621)
@@ -3,9 +3,7 @@
<converter>
<converter-id>my_converter</converter-id>
<converter-class>java.lang.Object</converter-class>
- <converter-extension>
- <cdk:generate>false</cdk:generate>
- </converter-extension>
+ <converter-extension/>
</converter>
<faces-config-extension/>
</faces-config>
\ No newline at end of file
Modified: branches/RF-9323/cdk/generator/src/test/resources/org/richfaces/cdk/xmlconfig/testmodel/ValidatorBeanTest.xml
===================================================================
--- trunk/cdk/generator/src/test/resources/org/richfaces/cdk/xmlconfig/testmodel/ValidatorBeanTest.xml 2010-12-15 17:57:11 UTC (rev 20592)
+++ branches/RF-9323/cdk/generator/src/test/resources/org/richfaces/cdk/xmlconfig/testmodel/ValidatorBeanTest.xml 2010-12-16 16:53:49 UTC (rev 20621)
@@ -3,9 +3,7 @@
<validator>
<validator-id>my_validator</validator-id>
<validator-class>java.lang.Object</validator-class>
- <validator-extension>
- <cdk:generate>false</cdk:generate>
- </validator-extension>
+ <validator-extension/>
</validator>
<faces-config-extension/>
</faces-config>
\ No newline at end of file
14 years
JBoss Rich Faces SVN: r20620 - branches.
by richfaces-svn-commits@lists.jboss.org
Author: alexsmirnov
Date: 2010-12-16 11:50:47 -0500 (Thu, 16 Dec 2010)
New Revision: 20620
Removed:
branches/RF-9323/
Log:
remove wrong branch
14 years
JBoss Rich Faces SVN: r20619 - in branches: RF-9323/cdk/generator/src/main/java/org/richfaces/cdk/apt and 12 other directories.
by richfaces-svn-commits@lists.jboss.org
Author: alexsmirnov
Date: 2010-12-16 11:49:29 -0500 (Thu, 16 Dec 2010)
New Revision: 20619
Added:
branches/RF-9323/
Modified:
branches/RF-9323/cdk/generator/src/main/java/org/richfaces/cdk/apt/AptSourceUtils.java
branches/RF-9323/cdk/generator/src/main/java/org/richfaces/cdk/apt/ReflectionUtils.java
branches/RF-9323/cdk/generator/src/main/java/org/richfaces/cdk/apt/SourceUtils.java
branches/RF-9323/cdk/generator/src/main/java/org/richfaces/cdk/generate/freemarker/ModelElementBaseTemplateModel.java
branches/RF-9323/cdk/generator/src/main/java/org/richfaces/cdk/generate/java/BehaviorClassGenerator.java
branches/RF-9323/cdk/generator/src/main/java/org/richfaces/cdk/generate/java/ComponentClassGenerator.java
branches/RF-9323/cdk/generator/src/main/java/org/richfaces/cdk/generate/java/ConverterClassGenerator.java
branches/RF-9323/cdk/generator/src/main/java/org/richfaces/cdk/generate/java/ValidatorClassGenerator.java
branches/RF-9323/cdk/generator/src/main/java/org/richfaces/cdk/model/BehaviorRendererModel.java
branches/RF-9323/cdk/generator/src/main/java/org/richfaces/cdk/model/ComponentModel.java
branches/RF-9323/cdk/generator/src/main/java/org/richfaces/cdk/model/DescriptionGroupBase.java
branches/RF-9323/cdk/generator/src/main/java/org/richfaces/cdk/model/FacesComponent.java
branches/RF-9323/cdk/generator/src/main/java/org/richfaces/cdk/model/PropertyBase.java
branches/RF-9323/cdk/generator/src/main/java/org/richfaces/cdk/model/RenderKitModel.java
branches/RF-9323/cdk/generator/src/main/java/org/richfaces/cdk/model/validator/ValidatorImpl.java
branches/RF-9323/cdk/generator/src/main/java/org/richfaces/cdk/templatecompiler/builder/model/JavaClass.java
branches/RF-9323/cdk/generator/src/main/java/org/richfaces/cdk/templatecompiler/builder/model/JavaImportImpl.java
branches/RF-9323/cdk/generator/src/main/java/org/richfaces/cdk/templatecompiler/model/ClassImport.java
branches/RF-9323/cdk/generator/src/main/java/org/richfaces/cdk/templatecompiler/statements/HelperMethod.java
branches/RF-9323/cdk/generator/src/main/java/org/richfaces/cdk/templatecompiler/statements/ScriptOptionStatement.java
branches/RF-9323/cdk/generator/src/main/java/org/richfaces/cdk/templatecompiler/statements/WriteAttributesSetStatement.java
branches/RF-9323/cdk/generator/src/test/java/org/richfaces/cdk/apt/AptSourceUtilsAnnotationsTest.java
branches/RF-9323/cdk/generator/src/test/java/org/richfaces/cdk/apt/SourceUtilsTestBase.java
branches/RF-9323/cdk/generator/src/test/java/org/richfaces/cdk/apt/processors/ComponentProcessorTest.java
branches/RF-9323/cdk/generator/src/test/java/org/richfaces/cdk/xmlconfig/FacesConfigTest.java
branches/RF-9323/cdk/generator/src/test/java/org/richfaces/cdk/xmlconfig/FragmentParserTest.java
branches/RF-9323/cdk/generator/src/test/resources/org/richfaces/cdk/apt/TestClass.java
branches/RF-9323/cdk/generator/src/test/resources/org/richfaces/cdk/xmlconfig/testmodel/BehaviorBeanTest.xml
branches/RF-9323/cdk/generator/src/test/resources/org/richfaces/cdk/xmlconfig/testmodel/ConverterBeanTest.xml
branches/RF-9323/cdk/generator/src/test/resources/org/richfaces/cdk/xmlconfig/testmodel/ValidatorBeanTest.xml
Log:
create CDK development branch
Copied: branches/RF-9323 (from rev 20592, trunk)
Modified: branches/RF-9323/cdk/generator/src/main/java/org/richfaces/cdk/apt/AptSourceUtils.java
===================================================================
--- trunk/cdk/generator/src/main/java/org/richfaces/cdk/apt/AptSourceUtils.java 2010-12-15 17:57:11 UTC (rev 20592)
+++ branches/RF-9323/cdk/generator/src/main/java/org/richfaces/cdk/apt/AptSourceUtils.java 2010-12-16 16:49:29 UTC (rev 20619)
@@ -24,6 +24,7 @@
import javax.lang.model.type.TypeKind;
import javax.lang.model.type.TypeMirror;
import javax.lang.model.util.ElementFilter;
+import javax.lang.model.util.ElementKindVisitor6;
import org.richfaces.cdk.CdkException;
import org.richfaces.cdk.Logger;
@@ -34,12 +35,14 @@
import com.google.common.base.Predicate;
import com.google.common.collect.Iterables;
import com.google.common.collect.Lists;
+import com.google.common.collect.Maps;
import com.google.inject.Inject;
public class AptSourceUtils implements SourceUtils {
private static final Set<String> PROPERTIES =
new HashSet<String>(Arrays.asList("getEventNames", "getDefaultEventName", "getClientBehaviors", "getFamily"));
+ private static final Predicate<Element> BEAN_PROPERTY_PREDICATE = new BeanPropertyMethodPredicate();
private final ProcessingEnvironment processingEnv;
@Inject
@@ -111,6 +114,55 @@
return properties;
}
+ @Override
+ public BeanProperty getBeanProperty(TypeElement type, String name) {
+ List<? extends Element> members = this.processingEnv.getElementUtils().getAllMembers(type);
+ return null;
+ }
+
+ /**
+ * <p class="changed_added_4_0">Utility method to get all bean properties, similar to Introspector</p>
+ * @param type
+ * @return
+ */
+ Map<String,BeanProperty> getBeanProperties(TypeElement type){
+ List<? extends Element> members = this.processingEnv.getElementUtils().getAllMembers(type);
+ // extract all getters/setters.
+ Iterable<? extends ExecutableElement> gettersAndSetters = Iterables.filter(Iterables.filter(members, BEAN_PROPERTY_PREDICATE),ExecutableElement.class);
+ Map<String,BeanProperty> result = Maps.newHashMap();
+ for (Element element : members) {
+ if (ElementKind.METHOD.equals(element.getKind())){
+ ExecutableElement method = (ExecutableElement) element;
+ if(isPublicNonStatic(method)){
+ if(isGetter(method)){
+ String propertyName = PropertyUtils.methodToName(method.getSimpleName().toString());
+ if(result.containsKey(propertyName)){
+ // Merge property with existed one.
+ BeanProperty beanProperty = result.get(propertyName);
+ processingEnv.getElementUtils().
+ } else {
+
+ }
+ } else if (isBooleanGetter(method)) {
+
+ } else if (isSetter(method)) {
+
+ }
+ }
+ }
+ }
+ // Merge all getter/setter methods.
+ for (ExecutableElement accestor : gettersAndSetters) {
+ String name = PropertyUtils.methodToName(accestor.getSimpleName().toString());
+ if(result.containsKey(name)){
+
+ } else {
+
+ }
+ }
+ return result;
+ }
+
private void removeNotAbstractGroups(Map<String, List<ExecutableElement>> props) {
List<String> removeKeys = new ArrayList<String>();
for (Map.Entry<String, List<ExecutableElement>> entry : props.entrySet()) {
@@ -163,7 +215,7 @@
AptBeanProperty property = new AptBeanProperty(childElement.getSimpleName().toString());
property.type = asClassDescription(childElement.asType());
- property.element = childElement;
+ property.getter = childElement;
// TODO - find getter/setter, check them for abstract.
property.exists = true;
@@ -197,7 +249,7 @@
AptBeanProperty property = new AptBeanProperty(name);
property.type = asClassDescription(propertyType);
- property.element = childElement;
+ property.getter = childElement;
property.exists = exists;
properties.add(property);
@@ -215,6 +267,26 @@
return method.getModifiers().contains(Modifier.ABSTRACT);
}
+ private boolean isPublicNonStatic(ExecutableElement method){
+ Set<Modifier> modifiers = method.getModifiers();
+ return modifiers.contains(Modifier.PUBLIC) && !modifiers.contains(Modifier.STATIC);
+ }
+
+ private boolean isGetter(ExecutableElement e) {
+ String methodName = e.getSimpleName().toString();
+ return methodName.startsWith("get") && methodName.length()>3 && Character.isUpperCase(methodName.charAt(3)) && 0 == e.getParameters().size();
+ }
+
+ private boolean isBooleanGetter(ExecutableElement e) {
+ String methodName = e.getSimpleName().toString();
+ return methodName.startsWith("is") && methodName.length()>2 && Character.isUpperCase(methodName.charAt(2)) && 0 == e.getParameters().size() && TypeKind.BOOLEAN.equals(e.getReturnType().getKind());
+ }
+
+ private boolean isSetter(ExecutableElement e) {
+ String methodName = e.getSimpleName().toString();
+ return methodName.startsWith("set") && methodName.length()>3 && Character.isUpperCase(methodName.charAt(3)) && 1 == e.getParameters().size() && !e.isVarArgs() && TypeKind.VOID.equals(e.getReturnType().getKind());
+ }
+
private ClassName asClassDescription(TypeMirror type) {
return new ClassName(type.toString());
}
@@ -378,6 +450,45 @@
}
}
+ private static final class BeanPropertyMethodPredicate extends ElementKindVisitor6<Boolean, Boolean> implements Predicate<Element> {
+
+ public BeanPropertyMethodPredicate() {
+ super(Boolean.FALSE);
+ }
+
+ @Override
+ public Boolean visitExecutableAsMethod(ExecutableElement e, Boolean p) {
+ Set<Modifier> modifiers = e.getModifiers();
+ // bean accessors have to be publis, non-static.
+ if(modifiers.contains(Modifier.PUBLIC) && !modifiers.contains(Modifier.STATIC)){
+ if(isGetter(e)||isBooleanGetter(e)||isSetter(e)){
+ return Boolean.TRUE;
+ }
+ }
+ return DEFAULT_VALUE;
+ }
+
+ private boolean isGetter(ExecutableElement e) {
+ String methodName = e.getSimpleName().toString();
+ return methodName.startsWith("get") && methodName.length()>3 && Character.isUpperCase(methodName.charAt(3)) && 0 == e.getParameters().size();
+ }
+
+ private boolean isBooleanGetter(ExecutableElement e) {
+ String methodName = e.getSimpleName().toString();
+ return methodName.startsWith("is") && methodName.length()>2 && Character.isUpperCase(methodName.charAt(2)) && 0 == e.getParameters().size() && TypeKind.BOOLEAN.equals(e.getReturnType().getKind());
+ }
+
+ private boolean isSetter(ExecutableElement e) {
+ String methodName = e.getSimpleName().toString();
+ return methodName.startsWith("set") && methodName.length()>3 && Character.isUpperCase(methodName.charAt(3)) && 1 == e.getParameters().size() && !e.isVarArgs() && TypeKind.VOID.equals(e.getReturnType().getKind());
+ }
+
+ @Override
+ public boolean apply(Element input) {
+ return visit(input);
+ }
+ }
+
private static final class AnnotationAttributePredicate implements
Predicate<Map.Entry<? extends ExecutableElement, ? extends AnnotationValue>> {
private final String propertyName;
@@ -401,7 +512,10 @@
*
*/
protected final class AptBeanProperty implements BeanProperty {
- private Element element;
+ private ExecutableElement getter;
+ private ExecutableElement setter;
+ private String docComment;
+ private Map<Class<? extends Annotation>,AnnotationMirror> annotations = Maps.newHashMap();
private boolean exists;
private final String name;
private ClassName type;
@@ -481,7 +595,7 @@
* @return
*/
public String getDocComment() {
- return processingEnv.getElementUtils().getDocComment(element);
+ return processingEnv.getElementUtils().getDocComment(getter);
}
public ClassName getType() {
@@ -499,12 +613,9 @@
}
public AnnotationMirror getAnnotationMirror(Class<? extends Annotation> annotationType) {
- return AptSourceUtils.this.getAnnotationMirror(element, annotationType);
+ return AptSourceUtils.this.getAnnotationMirror(getter, annotationType);
}
- public <T extends Annotation> T getAnnotation(Class<T> annotationType) {
- return element.getAnnotation(annotationType);
- }
}
}
Modified: branches/RF-9323/cdk/generator/src/main/java/org/richfaces/cdk/apt/ReflectionUtils.java
===================================================================
--- trunk/cdk/generator/src/main/java/org/richfaces/cdk/apt/ReflectionUtils.java 2010-12-15 17:57:11 UTC (rev 20592)
+++ branches/RF-9323/cdk/generator/src/main/java/org/richfaces/cdk/apt/ReflectionUtils.java 2010-12-16 16:49:29 UTC (rev 20619)
@@ -67,6 +67,12 @@
}
@Override
+ public BeanProperty getBeanProperty(TypeElement type, String name) {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
public Object getConstant(TypeElement element, String name) {
// TODO Auto-generated method stub
return null;
Modified: branches/RF-9323/cdk/generator/src/main/java/org/richfaces/cdk/apt/SourceUtils.java
===================================================================
--- trunk/cdk/generator/src/main/java/org/richfaces/cdk/apt/SourceUtils.java 2010-12-15 17:57:11 UTC (rev 20592)
+++ branches/RF-9323/cdk/generator/src/main/java/org/richfaces/cdk/apt/SourceUtils.java 2010-12-16 16:49:29 UTC (rev 20619)
@@ -97,7 +97,6 @@
AnnotationMirror getAnnotationMirror(Class<? extends Annotation> annotationType);
- <T extends Annotation> T getAnnotation(Class<T> annotationType);
}
/**
@@ -119,6 +118,15 @@
* @return
*/
Set<BeanProperty> getAbstractBeanProperties(TypeElement type);
+
+
+ /**
+ * <p class="changed_added_4_0">Get bean property descriptor for particular type.</p>
+ * @param type
+ * @param name
+ * @return
+ */
+ BeanProperty getBeanProperty(TypeElement type, String name);
/**
* <p class="changed_added_4_0">
@@ -172,6 +180,14 @@
<T> List<T> getAnnotationValues(AnnotationMirror annotation, String propertyName, Class<T> expectedType);
/**
+ * <p class="changed_added_4_0"></p>
+ * @param annotation
+ * @param propertyName
+ * @return
+ */
+ public abstract boolean isAnnotationPropertyPresent(AnnotationMirror annotation, final String propertyName);
+
+ /**
* <p class="changed_added_4_0">Check annotation proprrty for default value.</p>
* @param annotation
* @param propertyName
@@ -179,6 +195,23 @@
*/
boolean isDefaultValue(AnnotationMirror annotation, String propertyName);
/**
+ * <p class="changed_added_4_0"></p>
+ * @param model
+ * @param annotation
+ * @param modelProperty
+ * @param annotationAttribute
+ */
+ public abstract void setModelProperty(Object model, AnnotationMirror annotation, String modelProperty, String annotationAttribute);
+
+ /**
+ * <p class="changed_added_4_0"></p>
+ * @param model
+ * @param annotation
+ * @param modelProperty
+ */
+ public abstract void setModelProperty(Object model, AnnotationMirror annotation, String modelProperty);
+
+ /**
* <p class="changed_added_4_0">
* </p>
*
@@ -203,7 +236,7 @@
* </p>
*
* @param mirror
- * @return
+ * @return The Element for given type
*/
TypeElement asTypeElement(TypeMirror mirror);
@@ -212,14 +245,8 @@
* </p>
*
* @param type
- * @return
+ * @return TypeElement for given type, or null if corresponding name does not exist.
*/
TypeElement asTypeElement(ClassName type);
- public abstract boolean isAnnotationPropertyPresent(AnnotationMirror annotation, final String propertyName);
-
- public abstract void setModelProperty(Object model, AnnotationMirror annotation, String modelProperty, String annotationAttribute);
-
- public abstract void setModelProperty(Object model, AnnotationMirror annotation, String modelProperty);
-
}
Modified: branches/RF-9323/cdk/generator/src/main/java/org/richfaces/cdk/generate/freemarker/ModelElementBaseTemplateModel.java
===================================================================
--- trunk/cdk/generator/src/main/java/org/richfaces/cdk/generate/freemarker/ModelElementBaseTemplateModel.java 2010-12-15 17:57:11 UTC (rev 20592)
+++ branches/RF-9323/cdk/generator/src/main/java/org/richfaces/cdk/generate/freemarker/ModelElementBaseTemplateModel.java 2010-12-16 16:49:29 UTC (rev 20619)
@@ -124,7 +124,7 @@
Set<ClassName> result = Sets.newTreeSet();
for (PropertyBase entry : model.getAttributes()) {
- if (entry.isGenerate() && !isPredefined(entry)) {
+ if (entry.getGenerate() && !isPredefined(entry)) {
result.add(entry.getType());
}
}
@@ -244,7 +244,7 @@
@Override
public boolean apply(PropertyBase input) {
- return input.isGenerate();
+ return input.getGenerate();
}
}));
}
Modified: branches/RF-9323/cdk/generator/src/main/java/org/richfaces/cdk/generate/java/BehaviorClassGenerator.java
===================================================================
--- trunk/cdk/generator/src/main/java/org/richfaces/cdk/generate/java/BehaviorClassGenerator.java 2010-12-15 17:57:11 UTC (rev 20592)
+++ branches/RF-9323/cdk/generator/src/main/java/org/richfaces/cdk/generate/java/BehaviorClassGenerator.java 2010-12-16 16:49:29 UTC (rev 20619)
@@ -52,7 +52,7 @@
public void render(ComponentLibrary library) throws CdkException {
Collection<BehaviorModel> models = library.getBehaviors();
for (BehaviorModel model : models) {
- if (model.isGenerate()) {
+ if (model.getGenerate()) {
this.generate(library, model);
}
}
Modified: branches/RF-9323/cdk/generator/src/main/java/org/richfaces/cdk/generate/java/ComponentClassGenerator.java
===================================================================
--- trunk/cdk/generator/src/main/java/org/richfaces/cdk/generate/java/ComponentClassGenerator.java 2010-12-15 17:57:11 UTC (rev 20592)
+++ branches/RF-9323/cdk/generator/src/main/java/org/richfaces/cdk/generate/java/ComponentClassGenerator.java 2010-12-16 16:49:29 UTC (rev 20619)
@@ -55,7 +55,7 @@
public void render(ComponentLibrary library) throws CdkException {
Collection<ComponentModel> models = library.getComponents();
for (ComponentModel model : models) {
- if (model.isGenerate()) {
+ if (model.getGenerate()) {
this.generate(library, model);
}
}
Modified: branches/RF-9323/cdk/generator/src/main/java/org/richfaces/cdk/generate/java/ConverterClassGenerator.java
===================================================================
--- trunk/cdk/generator/src/main/java/org/richfaces/cdk/generate/java/ConverterClassGenerator.java 2010-12-15 17:57:11 UTC (rev 20592)
+++ branches/RF-9323/cdk/generator/src/main/java/org/richfaces/cdk/generate/java/ConverterClassGenerator.java 2010-12-16 16:49:29 UTC (rev 20619)
@@ -52,7 +52,7 @@
public void render(ComponentLibrary library) throws CdkException {
Collection<ConverterModel> models = library.getConverters();
for (ConverterModel model : models) {
- if (model.isGenerate()) {
+ if (model.getGenerate()) {
this.generate(library, model);
}
}
Modified: branches/RF-9323/cdk/generator/src/main/java/org/richfaces/cdk/generate/java/ValidatorClassGenerator.java
===================================================================
--- trunk/cdk/generator/src/main/java/org/richfaces/cdk/generate/java/ValidatorClassGenerator.java 2010-12-15 17:57:11 UTC (rev 20592)
+++ branches/RF-9323/cdk/generator/src/main/java/org/richfaces/cdk/generate/java/ValidatorClassGenerator.java 2010-12-16 16:49:29 UTC (rev 20619)
@@ -51,7 +51,7 @@
public void render(ComponentLibrary library) throws CdkException {
Collection<ValidatorModel> models = library.getValidators();
for (ValidatorModel model : models) {
- if (model.isGenerate()) {
+ if (model.getGenerate()) {
this.generate(library, model);
}
}
Modified: branches/RF-9323/cdk/generator/src/main/java/org/richfaces/cdk/model/BehaviorRendererModel.java
===================================================================
--- trunk/cdk/generator/src/main/java/org/richfaces/cdk/model/BehaviorRendererModel.java 2010-12-15 17:57:11 UTC (rev 20592)
+++ branches/RF-9323/cdk/generator/src/main/java/org/richfaces/cdk/model/BehaviorRendererModel.java 2010-12-16 16:49:29 UTC (rev 20619)
@@ -99,7 +99,7 @@
* <p class="changed_added_4_0"></p>
* @return the generate
*/
- public boolean isGenerate() {
+ public Boolean getGenerate() {
return this.generate;
}
@@ -107,7 +107,7 @@
* <p class="changed_added_4_0"></p>
* @param generate the generate to set
*/
- public void setGenerate(boolean generate) {
+ public void setGenerate(Boolean generate) {
this.generate = generate;
}
Modified: branches/RF-9323/cdk/generator/src/main/java/org/richfaces/cdk/model/ComponentModel.java
===================================================================
--- trunk/cdk/generator/src/main/java/org/richfaces/cdk/model/ComponentModel.java 2010-12-15 17:57:11 UTC (rev 20592)
+++ branches/RF-9323/cdk/generator/src/main/java/org/richfaces/cdk/model/ComponentModel.java 2010-12-16 16:49:29 UTC (rev 20619)
@@ -61,7 +61,7 @@
ComponentLibrary.merge(getFacets(), otherComponent.getFacets());
ComponentLibrary.merge(getEvents(), otherComponent.getEvents());
ComponentLibrary.merge(this, otherComponent);
- this.setGenerate(this.isGenerate() || otherComponent.isGenerate());
+ this.setGenerate(this.getGenerate() || otherComponent.getGenerate());
}
@Override
Modified: branches/RF-9323/cdk/generator/src/main/java/org/richfaces/cdk/model/DescriptionGroupBase.java
===================================================================
--- trunk/cdk/generator/src/main/java/org/richfaces/cdk/model/DescriptionGroupBase.java 2010-12-15 17:57:11 UTC (rev 20592)
+++ branches/RF-9323/cdk/generator/src/main/java/org/richfaces/cdk/model/DescriptionGroupBase.java 2010-12-16 16:49:29 UTC (rev 20619)
@@ -31,7 +31,7 @@
/**
* <p class="changed_added_4_0">Is that bean property generate in the class or should be generated ?</p>
*/
- private boolean generate = false;
+ private Boolean generate ;
/**
* <p class="changed_added_4_0">
@@ -83,11 +83,11 @@
}
@Merge
- public boolean isGenerate() {
+ public Boolean getGenerate() {
return generate;
}
- public void setGenerate(boolean generate) {
+ public void setGenerate(Boolean generate) {
this.generate = generate;
}
Modified: branches/RF-9323/cdk/generator/src/main/java/org/richfaces/cdk/model/FacesComponent.java
===================================================================
--- trunk/cdk/generator/src/main/java/org/richfaces/cdk/model/FacesComponent.java 2010-12-15 17:57:11 UTC (rev 20592)
+++ branches/RF-9323/cdk/generator/src/main/java/org/richfaces/cdk/model/FacesComponent.java 2010-12-16 16:49:29 UTC (rev 20619)
@@ -91,12 +91,12 @@
* <p class="changed_added_4_0"></p>
* @return
*/
- public boolean isGenerate();
+ public Boolean getGenerate();
/**
* <p class="changed_added_4_0"></p>
* @param generate
*/
- public void setGenerate(boolean generate);
+ public void setGenerate(Boolean generate);
}
\ No newline at end of file
Modified: branches/RF-9323/cdk/generator/src/main/java/org/richfaces/cdk/model/PropertyBase.java
===================================================================
--- trunk/cdk/generator/src/main/java/org/richfaces/cdk/model/PropertyBase.java 2010-12-15 17:57:11 UTC (rev 20592)
+++ branches/RF-9323/cdk/generator/src/main/java/org/richfaces/cdk/model/PropertyBase.java 2010-12-16 16:49:29 UTC (rev 20619)
@@ -293,9 +293,9 @@
@Override
public void merge(PropertyBase other) {
- boolean generate = isGenerate();
+ boolean generate = getGenerate();
ComponentLibrary.merge(this, other);
- setGenerate(generate || other.isGenerate());
+ setGenerate(generate || other.getGenerate());
}
public <R,D> R accept(Visitor<R,D> visitor, D data) {
Modified: branches/RF-9323/cdk/generator/src/main/java/org/richfaces/cdk/model/RenderKitModel.java
===================================================================
--- trunk/cdk/generator/src/main/java/org/richfaces/cdk/model/RenderKitModel.java 2010-12-15 17:57:11 UTC (rev 20592)
+++ branches/RF-9323/cdk/generator/src/main/java/org/richfaces/cdk/model/RenderKitModel.java 2010-12-16 16:49:29 UTC (rev 20619)
@@ -44,8 +44,6 @@
private FacesId id;
- private boolean generate;
-
public RenderKitModel() {
}
@@ -100,22 +98,6 @@
/**
* <p class="changed_added_4_0"></p>
- * @return the generate
- */
- public boolean isGenerate() {
- return this.generate;
- }
-
- /**
- * <p class="changed_added_4_0"></p>
- * @param generate the generate to set
- */
- public void setGenerate(boolean generate) {
- this.generate = generate;
- }
-
- /**
- * <p class="changed_added_4_0"></p>
* @return the renderers
*/
public ModelCollection<RendererModel> getRenderers() {
Modified: branches/RF-9323/cdk/generator/src/main/java/org/richfaces/cdk/model/validator/ValidatorImpl.java
===================================================================
--- trunk/cdk/generator/src/main/java/org/richfaces/cdk/model/validator/ValidatorImpl.java 2010-12-15 17:57:11 UTC (rev 20592)
+++ branches/RF-9323/cdk/generator/src/main/java/org/richfaces/cdk/model/validator/ValidatorImpl.java 2010-12-16 16:49:29 UTC (rev 20619)
@@ -361,13 +361,7 @@
try {
// Step one, lookup for parent.
ComponentModel parentComponent =
- Iterables.find(library.getComponents(), new Predicate<ComponentModel>() {
-
- @Override
- public boolean apply(ComponentModel input) {
- return component.getBaseClass().equals(input.getTargetClass());
- }
- });
+ findParent(library.getComponents(), component);
// To be sure what all properties for parent component were propagated.
verifyComponentAttributes(library, parentComponent, verified);
for (PropertyBase parentAttribute : parentComponent.getAttributes()) {
@@ -382,7 +376,7 @@
} // Check attributes.
for (PropertyBase attribute : component.getAttributes()) {
- verifyAttribute(attribute, component.isGenerate());
+ verifyAttribute(attribute, component.getGenerate());
}
// compact(component.getAttributes());
// Check renderers.
@@ -397,6 +391,16 @@
}
}
+ private <T extends FacesComponent> T findParent(Iterable<T> components, final T component) throws NoSuchElementException {
+ return Iterables.find(components, new Predicate<T>() {
+
+ @Override
+ public boolean apply(T input) {
+ return component.getBaseClass().equals(input.getTargetClass());
+ }
+ });
+ }
+
protected void verifyTag(TagModel tag, FacesId id, ClassName handler) {
if (Strings.isEmpty(tag.getName())) {
String defaultTagName = namingConventions.inferTagName(id);
@@ -457,7 +461,7 @@
}
}
// Check classes.
- if (component.isGenerate()) {
+ if (component.getGenerate()) {
if (null == component.getBaseClass()) {
component.setBaseClass(callback.getDefaultBaseClass());
// return;
Modified: branches/RF-9323/cdk/generator/src/main/java/org/richfaces/cdk/templatecompiler/builder/model/JavaClass.java
===================================================================
--- trunk/cdk/generator/src/main/java/org/richfaces/cdk/templatecompiler/builder/model/JavaClass.java 2010-12-15 17:57:11 UTC (rev 20592)
+++ branches/RF-9323/cdk/generator/src/main/java/org/richfaces/cdk/templatecompiler/builder/model/JavaClass.java 2010-12-16 16:49:29 UTC (rev 20619)
@@ -74,8 +74,8 @@
addImport(new JavaImportImpl(name));
}
- public void addImport(String name, boolean _static) {
- addImport(new JavaImportImpl(name, _static));
+ public void addImport(String name, boolean staticImport) {
+ addImport(new JavaImportImpl(name, staticImport));
}
public void addImport(Class<?> claz) {
Modified: branches/RF-9323/cdk/generator/src/main/java/org/richfaces/cdk/templatecompiler/builder/model/JavaImportImpl.java
===================================================================
--- trunk/cdk/generator/src/main/java/org/richfaces/cdk/templatecompiler/builder/model/JavaImportImpl.java 2010-12-15 17:57:11 UTC (rev 20592)
+++ branches/RF-9323/cdk/generator/src/main/java/org/richfaces/cdk/templatecompiler/builder/model/JavaImportImpl.java 2010-12-16 16:49:29 UTC (rev 20619)
@@ -33,7 +33,7 @@
private String name;
- private boolean _static;
+ private boolean staticImport;
public JavaImportImpl(String name) {
this(name, false);
@@ -43,14 +43,14 @@
this(clazz.getName());
}
- public JavaImportImpl(String name, boolean _static) {
+ public JavaImportImpl(String name, boolean staticImport) {
super();
this.name = name;
- this._static = _static;
+ this.staticImport = staticImport;
}
- public JavaImportImpl(Class<?> clazz, boolean _static) {
- this(clazz.getName(), _static);
+ public JavaImportImpl(Class<?> clazz, boolean staticImport) {
+ this(clazz.getName(), staticImport);
}
public String getName() {
@@ -58,7 +58,7 @@
}
public boolean isStatic() {
- return _static;
+ return staticImport;
}
public boolean isDefault() {
Modified: branches/RF-9323/cdk/generator/src/main/java/org/richfaces/cdk/templatecompiler/model/ClassImport.java
===================================================================
--- trunk/cdk/generator/src/main/java/org/richfaces/cdk/templatecompiler/model/ClassImport.java 2010-12-15 17:57:11 UTC (rev 20592)
+++ branches/RF-9323/cdk/generator/src/main/java/org/richfaces/cdk/templatecompiler/model/ClassImport.java 2010-12-16 16:49:29 UTC (rev 20619)
@@ -32,47 +32,47 @@
*/
public class ClassImport {
- @XmlAttribute(required = true)
- @XmlJavaTypeAdapter(NormalizedStringAdapter.class)
- private String _package;
+ private String packageName;
- @XmlAttribute
- private boolean _static;
+ private boolean staticImport;
- @XmlAttribute
private List<String> names;
/**
* @return the package_
*/
+ @XmlAttribute(required = true)
+ @XmlJavaTypeAdapter(NormalizedStringAdapter.class)
public String getPackage() {
- return _package;
+ return packageName;
}
/**
- * @param _package the package_ to set
+ * @param packageName the package_ to set
*/
- public void setPackage(String _package) {
- this._package = _package;
+ public void setPackage(String packageName) {
+ this.packageName = packageName;
}
/**
* @return the static_
*/
+ @XmlAttribute
public boolean isStatic() {
- return _static;
+ return staticImport;
}
/**
* @param static_ the static_ to set
*/
- public void setStatic(boolean _static) {
- this._static = _static;
+ public void setStatic(boolean staticImport) {
+ this.staticImport = staticImport;
}
/**
* @return the classes
*/
+ @XmlAttribute
public List<String> getNames() {
return names;
}
Modified: branches/RF-9323/cdk/generator/src/main/java/org/richfaces/cdk/templatecompiler/statements/HelperMethod.java
===================================================================
--- trunk/cdk/generator/src/main/java/org/richfaces/cdk/templatecompiler/statements/HelperMethod.java 2010-12-15 17:57:11 UTC (rev 20592)
+++ branches/RF-9323/cdk/generator/src/main/java/org/richfaces/cdk/templatecompiler/statements/HelperMethod.java 2010-12-16 16:49:29 UTC (rev 20619)
@@ -80,11 +80,6 @@
}
}
- private static String[] transformClassesToClassNames(Class<?>[] s) {
- Iterator<String> transformed = transform(forArray(s), CLASS_TO_CLASS_NAME);
- return toArray(transformed, String.class);
- }
-
private HelperMethod(String name, String returnType, String... argumentTypes) {
this.name = name;
this.returnType = returnType;
@@ -95,6 +90,11 @@
this(name, CLASS_TO_CLASS_NAME.apply(returnType), transformClassesToClassNames(argumentTypes));
}
+ private static String[] transformClassesToClassNames(Class<?>[] s) {
+ Iterator<String> transformed = transform(forArray(s), CLASS_TO_CLASS_NAME);
+ return toArray(transformed, String.class);
+ }
+
public String getName() {
return name;
}
Modified: branches/RF-9323/cdk/generator/src/main/java/org/richfaces/cdk/templatecompiler/statements/ScriptOptionStatement.java
===================================================================
--- trunk/cdk/generator/src/main/java/org/richfaces/cdk/templatecompiler/statements/ScriptOptionStatement.java 2010-12-15 17:57:11 UTC (rev 20592)
+++ branches/RF-9323/cdk/generator/src/main/java/org/richfaces/cdk/templatecompiler/statements/ScriptOptionStatement.java 2010-12-16 16:49:29 UTC (rev 20619)
@@ -79,11 +79,12 @@
}
/**
- * @param value the value to set
+ * @param value
+ * the value to set
*/
public void setValueExpression(String valueExpression) {
try {
- this.value = parser.parse(valueExpression, this, TypesFactory.OBJECT_TYPE);
+ this.value = parser.parse(valueExpression, this, TypesFactory.OBJECT_TYPE);
} catch (ParsingException e) {
logger.error("Error parse scriptOption value expression: " + valueExpression, e);
}
Modified: branches/RF-9323/cdk/generator/src/main/java/org/richfaces/cdk/templatecompiler/statements/WriteAttributesSetStatement.java
===================================================================
--- trunk/cdk/generator/src/main/java/org/richfaces/cdk/templatecompiler/statements/WriteAttributesSetStatement.java 2010-12-15 17:57:11 UTC (rev 20592)
+++ branches/RF-9323/cdk/generator/src/main/java/org/richfaces/cdk/templatecompiler/statements/WriteAttributesSetStatement.java 2010-12-16 16:49:29 UTC (rev 20619)
@@ -27,7 +27,6 @@
import org.richfaces.cdk.generate.freemarker.FreeMarkerRenderer;
import org.richfaces.cdk.templatecompiler.TemplateModel;
-import com.google.common.collect.Sets;
import com.google.inject.Inject;
/**
Modified: branches/RF-9323/cdk/generator/src/test/java/org/richfaces/cdk/apt/AptSourceUtilsAnnotationsTest.java
===================================================================
--- trunk/cdk/generator/src/test/java/org/richfaces/cdk/apt/AptSourceUtilsAnnotationsTest.java 2010-12-15 17:57:11 UTC (rev 20592)
+++ branches/RF-9323/cdk/generator/src/test/java/org/richfaces/cdk/apt/AptSourceUtilsAnnotationsTest.java 2010-12-16 16:49:29 UTC (rev 20619)
@@ -3,7 +3,6 @@
import static org.junit.Assert.*;
import java.util.List;
-import java.util.Set;
import javax.annotation.processing.RoundEnvironment;
import javax.lang.model.element.AnnotationMirror;
@@ -13,9 +12,7 @@
import org.richfaces.cdk.apt.TestAnnotation.TestEnum;
import org.richfaces.cdk.model.ClassName;
-import com.google.common.base.Predicate;
import com.google.common.collect.ImmutableList;
-import com.google.common.collect.Iterables;
public class AptSourceUtilsAnnotationsTest extends SourceUtilsTestBase {
@@ -163,15 +160,4 @@
protected Iterable<String> sources() {
return ImmutableList.of(CLASS_JAVA, SUB_CLASS_JAVA);
}
-
- private Element findElement(RoundEnvironment roundEnvironment, final String name){
- Set<? extends Element> elements = roundEnvironment.getRootElements();
- return Iterables.find(elements, new Predicate<Element>() {
-
- @Override
- public boolean apply(Element input) {
- return name.equals(input.getSimpleName().toString());
- }
- });
- }
}
Modified: branches/RF-9323/cdk/generator/src/test/java/org/richfaces/cdk/apt/SourceUtilsTestBase.java
===================================================================
--- trunk/cdk/generator/src/test/java/org/richfaces/cdk/apt/SourceUtilsTestBase.java 2010-12-15 17:57:11 UTC (rev 20592)
+++ branches/RF-9323/cdk/generator/src/test/java/org/richfaces/cdk/apt/SourceUtilsTestBase.java 2010-12-16 16:49:29 UTC (rev 20619)
@@ -33,6 +33,7 @@
import javax.annotation.processing.SupportedAnnotationTypes;
import javax.annotation.processing.SupportedSourceVersion;
import javax.lang.model.SourceVersion;
+import javax.lang.model.element.Element;
import javax.lang.model.element.TypeElement;
import org.junit.runner.RunWith;
@@ -42,6 +43,8 @@
import org.richfaces.cdk.Outputs;
import org.richfaces.cdk.Stub;
+import com.google.common.base.Predicate;
+import com.google.common.collect.Iterables;
import com.google.inject.Binder;
import com.google.inject.Inject;
import com.google.inject.Singleton;
@@ -77,6 +80,17 @@
assertTrue("Compilation error",factory.get().call());
}
+ protected Element findElement(RoundEnvironment roundEnvironment, final String name) {
+ Set<? extends Element> elements = roundEnvironment.getRootElements();
+ return Iterables.find(elements, new Predicate<Element>() {
+
+ @Override
+ public boolean apply(Element input) {
+ return name.equals(input.getSimpleName().toString());
+ }
+ });
+ }
+
/**
* <p class="changed_added_4_0">Interface to call back test method from APT</p>
* @author asmirnov(a)exadel.com
Modified: branches/RF-9323/cdk/generator/src/test/java/org/richfaces/cdk/apt/processors/ComponentProcessorTest.java
===================================================================
--- trunk/cdk/generator/src/test/java/org/richfaces/cdk/apt/processors/ComponentProcessorTest.java 2010-12-15 17:57:11 UTC (rev 20592)
+++ branches/RF-9323/cdk/generator/src/test/java/org/richfaces/cdk/apt/processors/ComponentProcessorTest.java 2010-12-16 16:49:29 UTC (rev 20619)
@@ -130,7 +130,7 @@
verify(utils, componentElement, jaxb, annotation, property, facet, description);
assertEquals(1, model.getFacets().size());
FacetModel facetModel = Iterables.getOnlyElement(model.getFacets());
- assertTrue(facetModel.isGenerate());
+ assertTrue(facetModel.getGenerate());
assertEquals("foo", facetModel.getName());
// assertEquals("my comment", facetModel.getDescription());
// assertEquals("fooFacet", facetModel.getDisplayname());
@@ -160,7 +160,7 @@
verify(utils, componentElement, jaxb, annotation, property, facet, description);
assertEquals(1, model.getFacets().size());
FacetModel facetModel = Iterables.getOnlyElement(model.getFacets());
- assertTrue(facetModel.isGenerate());
+ assertTrue(facetModel.getGenerate());
assertEquals("foo", facetModel.getName());
// assertEquals("my comment", facetModel.getDescription());
// assertEquals("fooFacet", facetModel.getDisplayname());
@@ -180,7 +180,7 @@
replay(utils, componentElement, jaxb, annotation);
processor.setClassNames(componentElement, model, "");
verify(utils, componentElement, jaxb, annotation);
- assertFalse(model.isGenerate());
+ assertFalse(model.getGenerate());
assertEquals(FOO_BAR, model.getBaseClass().toString());
assertNull(model.getTargetClass());
}
@@ -200,7 +200,7 @@
processor.setClassNames(componentElement, model, "");
verify(utils, componentElement, jaxb, annotation);
- assertTrue(model.isGenerate());
+ assertTrue(model.getGenerate());
assertEquals(FOO_BAR, model.getBaseClass().toString());
assertNull(model.getTargetClass());
}
@@ -220,7 +220,7 @@
processor.setClassNames(componentElement, model, FOO_HTML_BAR);
verify(utils, componentElement, jaxb, annotation);
- assertTrue(model.isGenerate());
+ assertTrue(model.getGenerate());
assertEquals(FOO_BAR, model.getBaseClass().toString());
assertEquals(FOO_HTML_BAR, model.getTargetClass().toString());
}
Modified: branches/RF-9323/cdk/generator/src/test/java/org/richfaces/cdk/xmlconfig/FacesConfigTest.java
===================================================================
--- trunk/cdk/generator/src/test/java/org/richfaces/cdk/xmlconfig/FacesConfigTest.java 2010-12-15 17:57:11 UTC (rev 20592)
+++ branches/RF-9323/cdk/generator/src/test/java/org/richfaces/cdk/xmlconfig/FacesConfigTest.java 2010-12-16 16:49:29 UTC (rev 20619)
@@ -104,12 +104,12 @@
assertEquals("panel-large.gif", component.getIcon().getLargeIcon());
assertEquals("Panel component", component.getDescription());
assertEquals("Panel", component.getDisplayname());
- assertTrue(component.isGenerate());
+ assertTrue(component.getGenerate());
FacetModel facet = Iterables.getOnlyElement(component.getFacets());
assertEquals("header", facet.getName());
assertEquals("Header facet", facet.getDescription());
- assertTrue(facet.isGenerate());
+ assertTrue(facet.getGenerate());
Collection<PropertyBase> attributes = component.getAttributes();
Modified: branches/RF-9323/cdk/generator/src/test/java/org/richfaces/cdk/xmlconfig/FragmentParserTest.java
===================================================================
--- trunk/cdk/generator/src/test/java/org/richfaces/cdk/xmlconfig/FragmentParserTest.java 2010-12-15 17:57:11 UTC (rev 20592)
+++ branches/RF-9323/cdk/generator/src/test/java/org/richfaces/cdk/xmlconfig/FragmentParserTest.java 2010-12-16 16:49:29 UTC (rev 20619)
@@ -118,7 +118,7 @@
assertEquals("15", property.getSuggestedValue());
// CDK extensions.
- assertTrue(property.isGenerate());
+ assertTrue(property.getGenerate());
assertTrue(property.isHidden());
assertTrue(property.isLiteral());
assertTrue(property.isPassThrough());
Modified: branches/RF-9323/cdk/generator/src/test/resources/org/richfaces/cdk/apt/TestClass.java
===================================================================
--- trunk/cdk/generator/src/test/resources/org/richfaces/cdk/apt/TestClass.java 2010-12-15 17:57:11 UTC (rev 20592)
+++ branches/RF-9323/cdk/generator/src/test/resources/org/richfaces/cdk/apt/TestClass.java 2010-12-16 16:49:29 UTC (rev 20619)
@@ -31,4 +31,13 @@
*
*/
//@TestAnnotation("foo")
-public class TestClass {}
+public class TestClass {
+
+ public Integer getReadOnly(){
+ return null;
+ }
+
+ public void setWriteOnly(){
+
+ }
+}
Modified: branches/RF-9323/cdk/generator/src/test/resources/org/richfaces/cdk/xmlconfig/testmodel/BehaviorBeanTest.xml
===================================================================
--- trunk/cdk/generator/src/test/resources/org/richfaces/cdk/xmlconfig/testmodel/BehaviorBeanTest.xml 2010-12-15 17:57:11 UTC (rev 20592)
+++ branches/RF-9323/cdk/generator/src/test/resources/org/richfaces/cdk/xmlconfig/testmodel/BehaviorBeanTest.xml 2010-12-16 16:49:29 UTC (rev 20619)
@@ -7,7 +7,6 @@
<attribute-name>attr2</attribute-name>
<attribute-class>java.lang.String</attribute-class>
<attribute-extension>
- <cdk:generate>false</cdk:generate>
<cdk:hidden>false</cdk:hidden>
<cdk:literal>false</cdk:literal>
<cdk:pass-through>false</cdk:pass-through>
@@ -19,7 +18,6 @@
<property-name>attr1</property-name>
<property-class>java.lang.String</property-class>
<property-extension>
- <cdk:generate>false</cdk:generate>
<cdk:hidden>false</cdk:hidden>
<cdk:literal>false</cdk:literal>
<cdk:pass-through>false</cdk:pass-through>
@@ -27,9 +25,7 @@
<cdk:required>false</cdk:required>
</property-extension>
</property>
- <behavior-extension>
- <cdk:generate>false</cdk:generate>
- </behavior-extension>
+ <behavior-extension/>
</behavior>
<faces-config-extension/>
</faces-config>
\ No newline at end of file
Modified: branches/RF-9323/cdk/generator/src/test/resources/org/richfaces/cdk/xmlconfig/testmodel/ConverterBeanTest.xml
===================================================================
--- trunk/cdk/generator/src/test/resources/org/richfaces/cdk/xmlconfig/testmodel/ConverterBeanTest.xml 2010-12-15 17:57:11 UTC (rev 20592)
+++ branches/RF-9323/cdk/generator/src/test/resources/org/richfaces/cdk/xmlconfig/testmodel/ConverterBeanTest.xml 2010-12-16 16:49:29 UTC (rev 20619)
@@ -3,9 +3,7 @@
<converter>
<converter-id>my_converter</converter-id>
<converter-class>java.lang.Object</converter-class>
- <converter-extension>
- <cdk:generate>false</cdk:generate>
- </converter-extension>
+ <converter-extension/>
</converter>
<faces-config-extension/>
</faces-config>
\ No newline at end of file
Modified: branches/RF-9323/cdk/generator/src/test/resources/org/richfaces/cdk/xmlconfig/testmodel/ValidatorBeanTest.xml
===================================================================
--- trunk/cdk/generator/src/test/resources/org/richfaces/cdk/xmlconfig/testmodel/ValidatorBeanTest.xml 2010-12-15 17:57:11 UTC (rev 20592)
+++ branches/RF-9323/cdk/generator/src/test/resources/org/richfaces/cdk/xmlconfig/testmodel/ValidatorBeanTest.xml 2010-12-16 16:49:29 UTC (rev 20619)
@@ -3,9 +3,7 @@
<validator>
<validator-id>my_validator</validator-id>
<validator-class>java.lang.Object</validator-class>
- <validator-extension>
- <cdk:generate>false</cdk:generate>
- </validator-extension>
+ <validator-extension/>
</validator>
<faces-config-extension/>
</faces-config>
\ No newline at end of file
14 years
JBoss Rich Faces SVN: r20618 - modules/tests/metamer/trunk/application/src/main/java/org/richfaces/tests/metamer.
by richfaces-svn-commits@lists.jboss.org
Author: ppitonak(a)redhat.com
Date: 2010-12-16 10:52:08 -0500 (Thu, 16 Dec 2010)
New Revision: 20618
Modified:
modules/tests/metamer/trunk/application/src/main/java/org/richfaces/tests/metamer/Attributes.java
Log:
* change level of logging
Modified: modules/tests/metamer/trunk/application/src/main/java/org/richfaces/tests/metamer/Attributes.java
===================================================================
--- modules/tests/metamer/trunk/application/src/main/java/org/richfaces/tests/metamer/Attributes.java 2010-12-16 15:33:15 UTC (rev 20617)
+++ modules/tests/metamer/trunk/application/src/main/java/org/richfaces/tests/metamer/Attributes.java 2010-12-16 15:52:08 UTC (rev 20618)
@@ -95,7 +95,7 @@
}
if (!loadFromClass && richfacesAttributes.containsKey(componentClass)) {
- logger.info("retrieving attributes of " + componentClass.getName() + " from faces-config.xml");
+ logger.debug("retrieving attributes of " + componentClass.getName() + " from faces-config.xml");
if (attributes == null) {
attributes = new TreeMap<String, Attribute>();
}
@@ -104,7 +104,7 @@
attributes.put(newAttr.getName(), newAttr);
}
} else {
- logger.info("retrieving attributes of " + componentClass.getName() + " from class descriptor");
+ logger.debug("retrieving attributes of " + componentClass.getName() + " from class descriptor");
loadAttributesFromClass(componentClass);
}
14 years