Author: alexsmirnov
Date: 2010-12-27 13:59:46 -0500 (Mon, 27 Dec 2010)
New Revision: 20814
Added:
branches/RF-9323/core/api/src/main/java/org/richfaces/el/GenericsIntrospectionService.java
branches/RF-9323/core/impl/src/main/java/org/richfaces/el/CapturingELResolver.java
branches/RF-9323/core/impl/src/main/java/org/richfaces/el/GenericsIntrospectionServiceImpl.java
branches/RF-9323/examples/iteration-demo/src/main/java/org/richfaces/demo/model/tree/TreeModelDataBean.java
branches/RF-9323/examples/iteration-demo/src/main/java/org/richfaces/demo/model/tree/adaptors/PackageKey.java
branches/RF-9323/examples/iteration-demo/src/main/java/org/richfaces/demo/model/tree/adaptors/PackageKeyConverter.java
branches/RF-9323/ui/iteration/ui/src/main/java/org/richfaces/component/UITreeModelAdaptor.java
branches/RF-9323/ui/iteration/ui/src/main/java/org/richfaces/component/UITreeModelRecursiveAdaptor.java
branches/RF-9323/ui/iteration/ui/src/main/java/org/richfaces/view/facelets/TreeAdaptorRowKeyConverterRule.java
branches/RF-9323/ui/iteration/ui/src/main/java/org/richfaces/view/facelets/TreeModelAdaptorHandler.java
branches/RF-9323/ui/iteration/ui/src/main/java/org/richfaces/view/facelets/TreeModelRecursiveAdaptorHandler.java
Removed:
branches/RF-9323/core/api/src/main/java/org/ajax4jsf/component/AjaxChildrenEncoder.java
branches/RF-9323/core/api/src/main/java/org/ajax4jsf/component/AjaxComponent.java
branches/RF-9323/core/api/src/main/java/org/ajax4jsf/component/AjaxContainerBase.java
branches/RF-9323/core/api/src/main/java/org/ajax4jsf/component/AjaxDataEncoder.java
branches/RF-9323/core/api/src/main/java/org/ajax4jsf/component/AjaxSupport.java
branches/RF-9323/core/api/src/main/java/org/ajax4jsf/context/ViewIdHolder.java
branches/RF-9323/core/api/src/main/java/org/ajax4jsf/event/
branches/RF-9323/core/api/src/main/java/org/ajax4jsf/model/KeepAlive.java
branches/RF-9323/core/api/src/main/java/org/ajax4jsf/renderkit/
branches/RF-9323/core/api/src/main/java/org/richfaces/el/util/CapturingELResolver.java
branches/RF-9323/core/api/src/main/java/org/richfaces/el/util/GenericsIntrospectionCache.java
branches/RF-9323/core/api/src/main/java/org/richfaces/el/util/ReferenceMap.java
branches/RF-9323/core/impl/src/main/java/org/ajax4jsf/el/
branches/RF-9323/examples/iteration-demo/src/main/java/org/richfaces/demo/model/tree/adaptors/SimpleRecursiveNode.java
branches/RF-9323/ui/common/ui/src/main/java/org/richfaces/renderkit/AjaxChildrenRenderer.java
branches/RF-9323/ui/common/ui/src/main/java/org/richfaces/renderkit/AjaxComponentRendererBase.java
branches/RF-9323/ui/iteration/ui/src/main/java/org/richfaces/component/AbstractTreeModelRecursiveAdaptor.java
Modified:
branches/RF-9323/
branches/RF-9323/core/api/src/main/java/org/ajax4jsf/context/AjaxContext.java
branches/RF-9323/core/api/src/main/java/org/richfaces/el/util/ELUtils.java
branches/RF-9323/core/api/src/main/java/org/richfaces/renderkit/util/CoreAjaxRendererUtils.java
branches/RF-9323/core/impl/src/main/java/org/ajax4jsf/context/AjaxContextImpl.java
branches/RF-9323/core/impl/src/main/java/org/richfaces/application/DefaultModule.java
branches/RF-9323/examples/iteration-demo/src/main/java/org/richfaces/demo/model/tree/TreeModelBean.java
branches/RF-9323/examples/iteration-demo/src/main/java/org/richfaces/demo/model/tree/adaptors/SourceDirectory.java
branches/RF-9323/examples/iteration-demo/src/main/webapp/WEB-INF/faces-config.xml
branches/RF-9323/examples/iteration-demo/src/main/webapp/treeModel.xhtml
branches/RF-9323/examples/richfaces-showcase/src/main/java/org/richfaces/demo/panelmenu/PanelMenuBean.java
branches/RF-9323/examples/richfaces-showcase/src/main/java/org/richfaces/demo/tables/model/slides/Picture.java
branches/RF-9323/examples/richfaces-showcase/src/main/webapp/richfaces/dragDrop/dragDrop.xhtml
branches/RF-9323/examples/richfaces-showcase/src/main/webapp/richfaces/dragDrop/samples/dragDrop-sample.xhtml
branches/RF-9323/ui/common/ui/src/main/java/org/richfaces/component/UIDataAdaptor.java
branches/RF-9323/ui/common/ui/src/main/java/org/richfaces/component/UISequence.java
branches/RF-9323/ui/common/ui/src/main/java/org/richfaces/convert/ConverterUtil.java
branches/RF-9323/ui/common/ui/src/main/java/org/richfaces/renderkit/util/AjaxRendererUtils.java
branches/RF-9323/ui/common/ui/src/main/java/org/richfaces/view/facelets/RowKeyConverterRule.java
branches/RF-9323/ui/input/ui/src/main/java/org/richfaces/component/AbstractAutocomplete.java
branches/RF-9323/ui/input/ui/src/main/java/org/richfaces/renderkit/InputRendererBase.java
branches/RF-9323/ui/input/ui/src/main/resources/META-INF/resources/org.richfaces/inputNumberSlider.js
branches/RF-9323/ui/input/ui/src/main/resources/META-INF/resources/org.richfaces/select.js
branches/RF-9323/ui/input/ui/src/main/templates/inputnumberslider.template.xml
branches/RF-9323/ui/iteration/ui/src/main/java/org/richfaces/DataScrollerUtils.java
branches/RF-9323/ui/iteration/ui/src/main/java/org/richfaces/component/AbstractCollapsibleSubTable.java
branches/RF-9323/ui/iteration/ui/src/main/java/org/richfaces/component/AbstractCollapsibleSubTableToggler.java
branches/RF-9323/ui/iteration/ui/src/main/java/org/richfaces/component/AbstractDataScroller.java
branches/RF-9323/ui/iteration/ui/src/main/java/org/richfaces/component/AbstractTree.java
branches/RF-9323/ui/iteration/ui/src/main/java/org/richfaces/component/AbstractTreeModelAdaptor.java
branches/RF-9323/ui/iteration/ui/src/main/java/org/richfaces/component/DeclarativeTreeDataModelWalker.java
branches/RF-9323/ui/iteration/ui/src/main/java/org/richfaces/component/TreeModelAdaptor.java
branches/RF-9323/ui/iteration/ui/src/main/java/org/richfaces/component/TreeModelRecursiveAdaptor.java
branches/RF-9323/ui/iteration/ui/src/main/java/org/richfaces/convert/DeclarativeModelSequenceKeyConverter.java
branches/RF-9323/ui/iteration/ui/src/main/java/org/richfaces/convert/IntegerSequenceRowKeyConverter.java
branches/RF-9323/ui/iteration/ui/src/main/java/org/richfaces/convert/SequenceRowKeyConverter.java
branches/RF-9323/ui/iteration/ui/src/main/java/org/richfaces/model/DeclarativeTreeDataModelImpl.java
branches/RF-9323/ui/iteration/ui/src/main/java/org/richfaces/renderkit/SortingFilteringRowsRenderer.java
branches/RF-9323/ui/iteration/ui/src/main/java/org/richfaces/taglib/DataScrollerHandler.java
branches/RF-9323/ui/iteration/ui/src/main/resources/META-INF/resources/org.richfaces/datatable.js
branches/RF-9323/ui/iteration/ui/src/test/java/org/richfaces/renderkit/ExtendedDataTableRendererTest.java
branches/RF-9323/ui/output/ui/src/main/java/org/richfaces/component/AbstractToolbar.java
branches/RF-9323/ui/output/ui/src/main/java/org/richfaces/component/AbstractTooltip.java
branches/RF-9323/ui/output/ui/src/main/java/org/richfaces/component/UITooltip.java
branches/RF-9323/ui/output/ui/src/main/java/org/richfaces/renderkit/html/PopupPanelBaseRenderer.java
branches/RF-9323/ui/output/ui/src/main/resources/META-INF/pn.faces-config.xml
branches/RF-9323/ui/output/ui/src/main/resources/META-INF/pn.taglib.xml
branches/RF-9323/ui/output/ui/src/main/resources/META-INF/resources/org.richfaces/collapsiblePanel.ecss
branches/RF-9323/ui/output/ui/src/main/resources/META-INF/resources/org.richfaces/collapsiblePanel.js
branches/RF-9323/ui/output/ui/src/main/resources/META-INF/resources/org.richfaces/menu.js
branches/RF-9323/ui/output/ui/src/main/resources/META-INF/resources/org.richfaces/popupPanel.ecss
branches/RF-9323/ui/validator/ui/src/main/java/org/richfaces/component/UIAjaxValidator.java
branches/RF-9323/ui/validator/ui/src/main/java/org/richfaces/component/UIGraphValidator.java
Log:
Merged revisions 20786,20788,20790-20796,20801-20813 via svnmerge from
https://svn.jboss.org/repos/richfaces/trunk
.......
r20786 | nbelaevski | 2010-12-23 09:16:54 -0800 (Thu, 23 Dec 2010) | 1 line
Legacy 3.x code removal
.......
r20788 | nbelaevski | 2010-12-23 11:24:00 -0800 (Thu, 23 Dec 2010) | 2 lines
Legacy 3.x code removal
ELUtils refactoring
.......
r20790 | amarkhel | 2010-12-24 06:26:38 -0800 (Fri, 24 Dec 2010) | 1 line
RF-9560 collapsiblePanel: use 'pointer' cursor over the switch control
.......
r20791 | nbelaevski | 2010-12-24 08:16:11 -0800 (Fri, 24 Dec 2010) | 1 line
Legacy 3.x code removal
.......
r20792 | abelevich | 2010-12-24 08:20:03 -0800 (Fri, 24 Dec 2010) | 1 line
RF-9967
.......
r20793 | nbelaevski | 2010-12-24 08:57:48 -0800 (Fri, 24 Dec 2010) | 1 line
Failing test ignored
.......
r20794 | abelevich | 2010-12-24 10:15:26 -0800 (Fri, 24 Dec 2010) | 1 line
re-fix RF-9931
.......
r20795 | nbelaevski | 2010-12-24 11:12:09 -0800 (Fri, 24 Dec 2010) | 1 line
Small performance optimization in declarative tree model impl.
.......
r20796 | konstantin.mishin | 2010-12-24 12:10:20 -0800 (Fri, 24 Dec 2010) | 1 line
RF-4464
.......
r20801 | amarkhel | 2010-12-26 15:24:08 -0800 (Sun, 26 Dec 2010) | 1 line
https://issues.jboss.org/browse/RF-9966 Dropdown menu component: close open menu when
select another one
.......
r20802 | ilya_shaikovsky | 2010-12-27 01:31:58 -0800 (Mon, 27 Dec 2010) | 1 line
https://issues.jboss.org/browse/RF-10074
.......
r20803 | ilya_shaikovsky | 2010-12-27 02:00:18 -0800 (Mon, 27 Dec 2010) | 1 line
https://issues.jboss.org/browse/RF-10068
.......
r20804 | ilya_shaikovsky | 2010-12-27 02:13:24 -0800 (Mon, 27 Dec 2010) | 1 line
sysout removed
.......
r20805 | amarkhel | 2010-12-27 02:21:43 -0800 (Mon, 27 Dec 2010) | 1 line
https://issues.jboss.org/browse/RF-9653 popupPanel: trimOverlayedElements not working
.......
r20806 | Alex.Kolonitsky | 2010-12-27 04:32:01 -0800 (Mon, 27 Dec 2010) | 1 line
move TooltipDirection to commons-ui
.......
r20807 | amarkhel | 2010-12-27 04:48:01 -0800 (Mon, 27 Dec 2010) | 1 line
https://issues.jboss.org/browse/RF-9653 popupPanel: trimOverlayedElements not working
.......
r20808 | abelevich | 2010-12-27 05:36:30 -0800 (Mon, 27 Dec 2010) | 1 line
https://jira.jboss.org/browse/RF-9734
.......
r20809 | nbelaevski | 2010-12-27 05:37:38 -0800 (Mon, 27 Dec 2010) | 4 lines
https://issues.jboss.org/browse/RF-10047
https://issues.jboss.org/browse/RF-10038
https://issues.jboss.org/browse/RF-9995
.......
r20810 | abelevich | 2010-12-27 06:48:05 -0800 (Mon, 27 Dec 2010) | 1 line
https://jira.jboss.org/browse/RF-9937
.......
r20811 | abelevich | 2010-12-27 07:41:34 -0800 (Mon, 27 Dec 2010) | 1 line
RF-9939, RF-9944
.......
r20812 | nbelaevski | 2010-12-27 07:50:27 -0800 (Mon, 27 Dec 2010) | 4 lines
https://issues.jboss.org/browse/RF-10047
https://issues.jboss.org/browse/RF-10038
https://issues.jboss.org/browse/RF-9995
https://issues.jboss.org/browse/RF-10007
.......
r20813 | nbelaevski | 2010-12-27 08:10:14 -0800 (Mon, 27 Dec 2010) | 1 line
https://issues.jboss.org/browse/RF-9987
.......
Property changes on: branches/RF-9323
___________________________________________________________________
Name: svnmerge-integrated
- /trunk:1-20785
+ /trunk:1-20813
Deleted:
branches/RF-9323/core/api/src/main/java/org/ajax4jsf/component/AjaxChildrenEncoder.java
===================================================================
---
branches/RF-9323/core/api/src/main/java/org/ajax4jsf/component/AjaxChildrenEncoder.java 2010-12-27
16:10:14 UTC (rev 20813)
+++
branches/RF-9323/core/api/src/main/java/org/ajax4jsf/component/AjaxChildrenEncoder.java 2010-12-27
18:59:46 UTC (rev 20814)
@@ -1,56 +0,0 @@
-/**
- * License Agreement.
- *
- * Rich Faces - Natural Ajax for Java Server Faces (JSF)
- *
- * Copyright (C) 2007 Exadel, Inc.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License version 2.1 as published by the Free Software Foundation.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-
-
-package org.ajax4jsf.component;
-
-import java.io.IOException;
-
-import java.util.Set;
-
-import javax.faces.context.FacesContext;
-
-/**
- * Marker interface for components, have ability to manipulate rendering in case of Ajax
responses.
- * Such as ajax-enabled iterator, menus etc
- * @author shura
- *
- */
-public interface AjaxChildrenEncoder {
-
- /**
- * Iterate over all childs of components. If component id contains in list ,
- * or, if list is empty, compotents is submitted form - render it.
- * TODO - Instead of calculate full path for every component, build current Path
- * for componet and send as parameter.
- *
- * @param context -
- * current context
- * @param component -
- * curent faces component.
- * @param ids -
- * list of Id to render.
- * @throws IOException
- */
- public void encodeAjaxChild(FacesContext context, String path, Set<String> ids,
Set<String> renderedAreas)
- throws IOException;
-}
Deleted:
branches/RF-9323/core/api/src/main/java/org/ajax4jsf/component/AjaxComponent.java
===================================================================
---
branches/RF-9323/core/api/src/main/java/org/ajax4jsf/component/AjaxComponent.java 2010-12-27
16:10:14 UTC (rev 20813)
+++
branches/RF-9323/core/api/src/main/java/org/ajax4jsf/component/AjaxComponent.java 2010-12-27
18:59:46 UTC (rev 20814)
@@ -1,228 +0,0 @@
-/**
- * License Agreement.
- *
- * Rich Faces - Natural Ajax for Java Server Faces (JSF)
- *
- * Copyright (C) 2007 Exadel, Inc.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License version 2.1 as published by the Free Software Foundation.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-
-
-package org.ajax4jsf.component;
-
-/**
- * Base Interface for Ajax-enabled acting components.
- * TODO - extend <code>ActionSource</code>???
- * @author shura (latest modification by $Author: alexsmirnov $)
- * @version $Revision: 1.1.2.2 $ $Date: 2007/01/23 20:01:01 $
- *
- */
-public interface AjaxComponent {
- public static final String AJAX_COMPONETT_PARAMETER = AjaxComponent.class.getName() +
".parameter";
-
- /**
- * setter method for property
- * @param new value of String, <code>Collection</code> or array of
component's Id , updated in case of Ajax request by parent component. to set
- */
- public abstract void setReRender(Object targetId);
-
- /**
- * @return value or result of valueBinding of String,
<code>Collection</code> or array of component's Id , updated in case of
Ajax request by parent component.
- */
- public abstract Object getReRender();
-
- /**
- * setter method for property
- * @param new value of String, <code>Collection</code> or array of
component's Id , processed at the phases 2-5
- * in the case of Ajax request by parent component. to set
- */
- public abstract void setProcess(Object targetId);
-
- /**
- * @return value or result of valueBinding of String,
<code>Collection</code> or array of component's Id , processed at the
phases 2-5 in case of Ajax request by parent component.
- */
- public abstract Object getProcess();
-
- /**
- * setter method for property
- * @param new value of ajaxType of control component - link or input to set
- */
-
-// public abstract void setAjaxType(String ajaxType);
-
- /**
- * @return value or result of valueBinding of ajaxType of control component - link or
input
- */
-// public abstract String getAjaxType();
-
- /**
- * setter method for property
- * @param new value of Id ( in format of UIComponent.findComponent() call ) of
request status indicator to set
- */
- public abstract void setStatus(String status);
-
- /**
- * @return value or result of valueBinding of Id ( in format of
UIComponent.findComponent() call ) of request status indicator
- */
- public abstract String getStatus();
-
- /**
- * setter method for property
- * @param new value of Name of JavaScript function, called on complete Ajax request
to set
- */
- public abstract void setOncomplete(String oncomplete);
-
- /**
- * @return value or result of valueBinding of Name of JavaScript function, called on
complete Ajax request
- */
- public abstract String getOncomplete();
-
- /**
- * @return value or result of valueBinding of Name of JavaScript function, called
before updating DOM
- */
- public abstract String getOnbeforedomupdate();
-
- /**
- * setter method for property
- * @param new value of Name of JavaScript function, called before updating DOM to
set
- */
- public abstract void setOnbeforedomupdate(String beforeUpdate);
-
- public abstract String getOnbegin();
-
- public abstract void setOnbegin(String onbegin);
-
- /**
- * setter method for property
- * @param new value of custom data translated to oncomplete function by AJAX
- */
- public abstract void setData(Object data);
-
- /**
- * @return value of custom data for translate to oncomplete function by AJAX
- */
- public abstract Object getData();
-
- /**
- * setter method for property
- * @param new value of Submit ( or not ) full form on Ajax action. to set
- */
- public abstract void setLimitRender(boolean submitForm);
-
- /**
- * @return value or result of valueBinding of Submit ( or not ) full form on Ajax
action.
- */
- public abstract boolean isLimitRender();
-
- /**
- * setter method for property
- * @param new value of Submit ( or not ) full form on Ajax action. to set
- */
- public abstract void setAjaxSingle(boolean single);
-
- /**
- * @return value or result of valueBinding of Submit ( or not ) full form on Ajax
action.
- */
- public abstract boolean isAjaxSingle();
-
- /**
- * Getter for bypassUpdates bean property. Indicate that component must invoke
listeners after Process Validators phase
- * and force render response after it - since no values of components will be
updated. Can be used to perform validation of client input
- * using server-side validators.
- * @return true if component must force render after validation phase.
- */
- public abstract boolean isBypassUpdates();
-
- /**
- * Setter for bypassUpdates bean property.
- * @param bypass true if component must force render after validation phase.
- */
- public abstract void setBypassUpdates(boolean bypass);
-
- /**
- * Getter for property name of events queue on client side - for avoid to send
requests too frequnly ( on key events, for example ), implementation will be generated by
- * componnents-generator
- * @return property value
- */
- public abstract String getEventsQueue();
-
- /**
- * Setter for flag indicated aborting unfinished ajax requests in queue.
- * @param newvalue - new property value. If true, unfinished request in queue will be
aborted on new events.
- */
- public abstract void setIgnoreDupResponses(boolean newvalue);
-
- /**
- * Getter for property flag indicated aborting unfinished ajax requests in queue.
- * componnents-generator
- * @return property value
- */
- public abstract boolean isIgnoreDupResponses();
-
- /**
- * Setter for property name of events queue on client side - for avoid to send
requests too frequnly ( on key events, for example ), implementation will be generated by
- * componnents-generator
- * @param newvalue - new property value
- */
- public abstract void setEventsQueue(String newvalue);
-
- /**
- * Getter for property Delay ( in ms. ) for send ajax request on JavaScript event. In
conjunction with events queue can reduce number of requests on keyboard or mouse move
events., implementation will be generated by
- * componnents-generator
- * @return property value
- */
- public abstract int getRequestDelay();
-
- /**
- * Setter for property Delay ( in ms. ) for send ajax request on JavaScript event. In
conjunction with events queue can reduce number of requests on keyboard or mouse move
events., implementation will be generated by
- * componnents-generator
- * @param newvalue - new property value
- */
- public abstract void setRequestDelay(int newvalue);
-
- /**
- * Getter for request timeout
- * @return timeout in ms.
- */
- public abstract int getTimeout();
-
- /**
- * Setter for request timeout
- * @param timeout new value in ms.
- */
- public abstract void setTimeout(int timeout);
-
- /**
- * Setter for a 'focus' bean property - id of component( or of DOM element ),
to set focus after AJAX request.
- * @param focus
- */
- public abstract void setFocus(String focus);
-
- /**
- * @return
- */
- public abstract String getFocus();
-
- /**
- *
- */
- public abstract void setSimilarityGroupingId(String similarityGroupingId);
-
- /**
- *
- */
- public abstract String getSimilarityGroupingId();
-}
Deleted:
branches/RF-9323/core/api/src/main/java/org/ajax4jsf/component/AjaxContainerBase.java
===================================================================
---
branches/RF-9323/core/api/src/main/java/org/ajax4jsf/component/AjaxContainerBase.java 2010-12-27
16:10:14 UTC (rev 20813)
+++
branches/RF-9323/core/api/src/main/java/org/ajax4jsf/component/AjaxContainerBase.java 2010-12-27
18:59:46 UTC (rev 20814)
@@ -1,87 +0,0 @@
-/**
- * License Agreement.
- *
- * Rich Faces - Natural Ajax for Java Server Faces (JSF)
- *
- * Copyright (C) 2007 Exadel, Inc.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License version 2.1 as published by the Free Software Foundation.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-
-
-package org.ajax4jsf.component;
-
-import javax.el.MethodExpression;
-
-/**
- * Base interface for controller component, managed AJAX Requests.
- * Component, implemented this interface, must always return
<code>true</code> for
- * <code>javax.faces.component.UIComponent#getRendersChildren()</code>
method.
- * in common, set of components, rendered of current request, maintain by it.
- * TODO - add capabilites for components, rendered in
<code>PhaseListener</code>
- * @author shura (latest modification by $Author: alexsmirnov $)
- * @version $Revision: 1.1.2.2 $ $Date: 2007/02/06 16:23:20 $
- *
- */
-public interface AjaxContainerBase {
-
- /**
- * getter for AjaxListener method. Same as for <code>ActionSource</code>
- *
- * @see javax.faces.component.ActionSource#getActionListener()
- */
- public MethodExpression getAjaxListener();
-
- /**
- * setter for AjaxListener <code>MethodBinding</code>
- * in case on AjaxRequest, component must call this method in
- * <code>PhaseId.APPLY_REQUEST_VALUES</code> or
- * <code>PhaseId.INVOKE_APPLICATION</code> phases, depend on immediate
flag.
- *
- * @see
javax.faces.component.ActionSource#setActionListener(javax.faces.el.MethodBinding)
- */
- public void setAjaxListener(MethodExpression ajaxListener);
-
- /**
- * getter for flag immediate call Listener's on PhaseId.APPLY_REQUEST_VALUES
phase.
- *
- * @see javax.faces.component.ActionSource#isImmediate()
- */
- public boolean isImmediate();
-
- /**
- * getter for render method flag of subview. If true, on AJAX-request component
render it children
- * after {@link com.sun.faces.lifecycle.Phase.INVOKE_APPLICATION }
- * @return value of selfRendered flag
- */
- public boolean isSelfRendered();
-
- /**
- * setter for self-render flag.
- * @param selfRendered
- */
- public void setSelfRendered(boolean selfRendered);
-
- /**
- * setter for immediate flag.
- *
- * @see javax.faces.component.ActionSource#setImmediate(boolean)
- */
- public void setImmediate(boolean immediate);
-
- public boolean isSubmitted();
-
- public void setSubmitted(boolean submitted);
-}
Deleted:
branches/RF-9323/core/api/src/main/java/org/ajax4jsf/component/AjaxDataEncoder.java
===================================================================
---
branches/RF-9323/core/api/src/main/java/org/ajax4jsf/component/AjaxDataEncoder.java 2010-12-27
16:10:14 UTC (rev 20813)
+++
branches/RF-9323/core/api/src/main/java/org/ajax4jsf/component/AjaxDataEncoder.java 2010-12-27
18:59:46 UTC (rev 20814)
@@ -1,42 +0,0 @@
-/**
- * License Agreement.
- *
- * Rich Faces - Natural Ajax for Java Server Faces (JSF)
- *
- * Copyright (C) 2007 Exadel, Inc.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License version 2.1 as published by the Free Software Foundation.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-
-
-package org.ajax4jsf.component;
-
-import java.util.Set;
-
-/**
- * Interface for iterable component, allowed for render given set of rows in ajax
response.
- * @author shura
- *
- */
-public interface AjaxDataEncoder extends AjaxChildrenEncoder {
-
- /**
- * @return Set for values of {@link org.ajax4jsf.model.ExtendedDataModel} keys,
encoded in ajax response by
- * this component.
- */
- public Set<Object> getAjaxKeys();
-
- public void setAjaxKeys(Set<Object> ajaxKeys);
-}
Deleted: branches/RF-9323/core/api/src/main/java/org/ajax4jsf/component/AjaxSupport.java
===================================================================
---
branches/RF-9323/core/api/src/main/java/org/ajax4jsf/component/AjaxSupport.java 2010-12-27
16:10:14 UTC (rev 20813)
+++
branches/RF-9323/core/api/src/main/java/org/ajax4jsf/component/AjaxSupport.java 2010-12-27
18:59:46 UTC (rev 20814)
@@ -1,88 +0,0 @@
-/**
- * License Agreement.
- *
- * Rich Faces - Natural Ajax for Java Server Faces (JSF)
- *
- * Copyright (C) 2007 Exadel, Inc.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License version 2.1 as published by the Free Software Foundation.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-
-
-package org.ajax4jsf.component;
-
-import javax.faces.component.UIComponent;
-
-/**
- * Version of {@link org.ajax4jsf.component.AjaxComponent} for append
- * Ajax functions for non-ajax components
- * @author asmirnov(a)exadel.com (latest modification by $Author: alexsmirnov $)
- * @version $Revision: 1.1.2.1 $ $Date: 2007/01/09 18:57:34 $
- *
- */
-public interface AjaxSupport {
-
- /**
- * @return JavaScript eventString. Rebuild on every call, since
- * can be in loop ( as in dataTable ) with different parameters.
- */
- public String getEventString();
-
- /**
- * setter method for property
- * @param new value of Name of event property of parent component for build
JavaScript AJAX.Submit call to set
- */
- public abstract void setEvent(String event);
-
- /**
- * @return value or result of valueBinding of Name of event property of parent
component for build JavaScript AJAX.Submit call
- */
- public abstract String getEvent();
-
- /**
- * Name of JavaScript function, called before submit Ajax request
- * description
- *
- * @parameter
- * @return the acceptClass
- */
- public abstract String getOnsubmit();
-
- /**
- * @param newOnsubmit
- * the value to set
- */
- public abstract void setOnsubmit(String newOnsubmit);
-
- /**
- * Getter for property If true, disable default action for target event ( encode
'return false' to JavaScript ), implementation will be generated by
- * componnents-generator
- * @return property value
- */
- public abstract boolean isDisableDefault();
-
- /**
- * Setter for property If true, disable default action for target event ( encode
'return false' to JavaScript ), implementation will be generated by
- * componnents-generator
- * @param newvalue - new property value
- */
- public abstract void setDisableDefault(boolean newvalue);
-
- /**
- * Set property for JavaScrept event generated by this component.
- * @param parent
- */
- public void setParentProperties(UIComponent parent);
-}
Modified: branches/RF-9323/core/api/src/main/java/org/ajax4jsf/context/AjaxContext.java
===================================================================
---
branches/RF-9323/core/api/src/main/java/org/ajax4jsf/context/AjaxContext.java 2010-12-27
16:10:14 UTC (rev 20813)
+++
branches/RF-9323/core/api/src/main/java/org/ajax4jsf/context/AjaxContext.java 2010-12-27
18:59:46 UTC (rev 20814)
@@ -69,10 +69,6 @@
public abstract Object getOnbeforedomupdate();
- public abstract void setViewIdHolder(ViewIdHolder viewIdHolder);
-
- public abstract ViewIdHolder getViewIdHolder();
-
public abstract boolean removeRenderedArea(String id);
public abstract void addRenderedArea(String id);
Deleted: branches/RF-9323/core/api/src/main/java/org/ajax4jsf/context/ViewIdHolder.java
===================================================================
---
branches/RF-9323/core/api/src/main/java/org/ajax4jsf/context/ViewIdHolder.java 2010-12-27
16:10:14 UTC (rev 20813)
+++
branches/RF-9323/core/api/src/main/java/org/ajax4jsf/context/ViewIdHolder.java 2010-12-27
18:59:46 UTC (rev 20814)
@@ -1,37 +0,0 @@
-/**
- * License Agreement.
- *
- * Rich Faces - Natural Ajax for Java Server Faces (JSF)
- *
- * Copyright (C) 2007 Exadel, Inc.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License version 2.1 as published by the Free Software Foundation.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-
-
-package org.ajax4jsf.context;
-
-/**
- * Interface to skip navigation cases in ViewHandler and , instead, store new ViewId.
- * @author shura
- *
- */
-public interface ViewIdHolder {
- public boolean skipNavigation(String viewId);
-
- public String getViewId();
-
- public void setViewId(String newViewId);
-}
Deleted: branches/RF-9323/core/api/src/main/java/org/ajax4jsf/model/KeepAlive.java
===================================================================
--- branches/RF-9323/core/api/src/main/java/org/ajax4jsf/model/KeepAlive.java 2010-12-27
16:10:14 UTC (rev 20813)
+++ branches/RF-9323/core/api/src/main/java/org/ajax4jsf/model/KeepAlive.java 2010-12-27
18:59:46 UTC (rev 20814)
@@ -1,49 +0,0 @@
-/**
- * License Agreement.
- *
- * Rich Faces - Natural Ajax for Java Server Faces (JSF)
- *
- * Copyright (C) 2007 Exadel, Inc.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License version 2.1 as published by the Free Software Foundation.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-
-
-package org.ajax4jsf.model;
-
-import java.lang.annotation.Documented;
-import java.lang.annotation.ElementType;
-import java.lang.annotation.Retention;
-import java.lang.annotation.RetentionPolicy;
-import java.lang.annotation.Target;
-
-/**
- * Marker annotation, to keep request-scope beans between requests in the view state.
- * @author asmirnov
- *
- */
-(a)Target(ElementType.TYPE)
-(a)Retention(RetentionPolicy.RUNTIME)
-@Documented
-public @interface KeepAlive {
-
- /**
- * Boolean attribute indicating whether kept beans are accessible for all requests or
AJAX-only.
- *
- * @return
- * @since 3.2.2
- */
- boolean ajaxOnly() default false;
-}
Copied:
branches/RF-9323/core/api/src/main/java/org/richfaces/el/GenericsIntrospectionService.java
(from rev 20813,
trunk/core/api/src/main/java/org/richfaces/el/GenericsIntrospectionService.java)
===================================================================
---
branches/RF-9323/core/api/src/main/java/org/richfaces/el/GenericsIntrospectionService.java
(rev 0)
+++
branches/RF-9323/core/api/src/main/java/org/richfaces/el/GenericsIntrospectionService.java 2010-12-27
18:59:46 UTC (rev 20814)
@@ -0,0 +1,35 @@
+/*
+ * 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.el;
+
+import javax.el.ValueExpression;
+import javax.faces.context.FacesContext;
+
+/**
+ * @author Nick Belaevski
+ *
+ */
+public interface GenericsIntrospectionService {
+
+ public Class<?> getContainerClass(FacesContext facesContext, ValueExpression
expression);
+
+}
Deleted:
branches/RF-9323/core/api/src/main/java/org/richfaces/el/util/CapturingELResolver.java
===================================================================
---
branches/RF-9323/core/api/src/main/java/org/richfaces/el/util/CapturingELResolver.java 2010-12-27
16:10:14 UTC (rev 20813)
+++
branches/RF-9323/core/api/src/main/java/org/richfaces/el/util/CapturingELResolver.java 2010-12-27
18:59:46 UTC (rev 20814)
@@ -1,68 +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.el.util;
-
-import javax.el.ELContext;
-import javax.el.ELResolver;
-
-import org.richfaces.el.ELResolverWrapper;
-
-/**
- * @author Nick Belaevski
- * @since 3.3.0
- */
-public class CapturingELResolver extends ELResolverWrapper {
- private Object base;
- private Object property;
-
- public CapturingELResolver(ELResolver resolver) {
- super(resolver);
- }
-
- @Override
- public Object getValue(ELContext context, Object base, Object property) {
- if ((base != null) && (property != null)) {
- this.base = base;
- this.property = property;
- }
-
- return super.getValue(context, base, property);
- }
-
- @Override
- public Class<?> getType(ELContext context, Object base, Object property) {
- if ((base != null) && (property != null)) {
- this.base = base;
- this.property = property;
- }
-
- return super.getType(context, base, property);
- }
-
- public Object getBase() {
- return base;
- }
-
- public Object getProperty() {
- return property;
- }
-}
Modified: branches/RF-9323/core/api/src/main/java/org/richfaces/el/util/ELUtils.java
===================================================================
--- branches/RF-9323/core/api/src/main/java/org/richfaces/el/util/ELUtils.java 2010-12-27
16:10:14 UTC (rev 20813)
+++ branches/RF-9323/core/api/src/main/java/org/richfaces/el/util/ELUtils.java 2010-12-27
18:59:46 UTC (rev 20814)
@@ -21,27 +21,7 @@
package org.richfaces.el.util;
-import java.beans.BeanInfo;
-import java.beans.IntrospectionException;
-import java.beans.Introspector;
-import java.beans.PropertyDescriptor;
-import java.lang.ref.SoftReference;
-import java.lang.reflect.Method;
-import java.lang.reflect.ParameterizedType;
-import java.lang.reflect.Type;
-import java.util.Collection;
-import java.util.HashMap;
-import java.util.Map;
-import java.util.ResourceBundle;
-import javax.el.ELContext;
-import javax.el.ValueExpression;
-import javax.faces.FacesException;
-import javax.faces.context.FacesContext;
-
-import org.richfaces.el.ELContextWrapper;
-import org.richfaces.el.util.GenericsIntrospectionCache.GenericsCacheEntry;
-
/**
* @author asmirnov
*/
@@ -79,130 +59,4 @@
return false;
}
- public static Object evaluateValueExpression(ValueExpression expression, ELContext
elContext) {
-
- if (expression.isLiteralText()) {
- return expression.getExpressionString();
- } else {
- return expression.getValue(elContext);
- }
-
- }
-
- public static ValueExpression createValueExpression(String expression) {
-
- return createValueExpression(expression, Object.class);
-
- }
-
- public static ValueExpression createValueExpression(String expression, Class<?>
expectedType) {
- FacesContext context = FacesContext.getCurrentInstance();
- return
context.getApplication().getExpressionFactory().createValueExpression(context.getELContext(),
expression, expectedType);
- }
-
- private static Class<?> resolveType(Type type) {
- Class<?> result = Object.class;
-
- if (type instanceof ParameterizedType) {
- ParameterizedType parameterizedType = (ParameterizedType) type;
- Type[] types = parameterizedType.getActualTypeArguments();
-
- if ((types != null) && (types.length != 0)) {
- Type actualType = types[0];
-
- if (actualType instanceof Class) {
- result = (Class<?>) actualType;
- }
- }
- }
-
- return result;
- }
-
- private static BeanInfo getBeanInfo(Class<?> beanClass, GenericsCacheEntry
entry) {
- BeanInfo beanInfo = null;
- SoftReference<BeanInfo> beanInfoReference = entry.beanInfoReference;
-
- if (beanInfoReference != null) {
- beanInfo = beanInfoReference.get();
- }
-
- if (beanInfo == null) {
- try {
- beanInfo = Introspector.getBeanInfo(beanClass);
- entry.beanInfoReference = new SoftReference<BeanInfo>(beanInfo);
- } catch (IntrospectionException e) {
- throw new FacesException(e.getMessage(), e);
- }
- }
-
- return beanInfo;
- }
-
- private static Class<?> getGenericCollectionType(FacesContext context, Object
base, String propertyName) {
- Class<?> genericPropertyClass = null;
-
- if ((base != null) && (propertyName != null)) {
- Class<? extends Object> beanClass = base.getClass();
-
- // Map and ResourceBundle have special resolvers that we doesn't support
- if (!Map.class.isAssignableFrom(beanClass) &&
!ResourceBundle.class.isAssignableFrom(beanClass)) {
- GenericsIntrospectionCache introspectionCache =
GenericsIntrospectionCache.getInstance(context);
-
- synchronized (introspectionCache) {
- GenericsCacheEntry cacheEntry =
introspectionCache.getGenericCacheEntry(beanClass);
-
- if (cacheEntry.genericPropertiesClasses == null) {
- cacheEntry.genericPropertiesClasses = new HashMap<String,
Class<?>>();
- } else {
- genericPropertyClass =
cacheEntry.genericPropertiesClasses.get(propertyName);
- }
-
- if (genericPropertyClass == null) {
- if
(!cacheEntry.genericPropertiesClasses.containsKey(propertyName)) {
- BeanInfo beanInfo = getBeanInfo(beanClass, cacheEntry);
- PropertyDescriptor[] descriptors =
beanInfo.getPropertyDescriptors();
-
- for (PropertyDescriptor pd : descriptors) {
- if (propertyName.equals(pd.getName())) {
- Method readMethod = pd.getReadMethod();
-
- genericPropertyClass =
resolveType(readMethod.getGenericReturnType());
-
- break;
- }
- }
-
- cacheEntry.genericPropertiesClasses.put(propertyName,
genericPropertyClass);
- } else {
-
- // property Class has been already resolved as null
- }
- }
- }
- }
- }
-
- return genericPropertyClass;
- }
-
- public static Class<?> getContainerClass(FacesContext facesContext,
ValueExpression expression) {
- ELContext initialELContext = facesContext.getELContext();
- CapturingELResolver capturingELResolver = new
CapturingELResolver(initialELContext.getELResolver());
- Class<?> type = expression.getType(new ELContextWrapper(initialELContext,
capturingELResolver));
- Class<?> containerType = type.getComponentType();
-
- if ((containerType == null) && (type != null)) {
- if (Collection.class.isAssignableFrom(type)) {
- Object base = capturingELResolver.getBase();
- Object property = capturingELResolver.getProperty();
-
- if ((base != null) && (property != null)) {
- containerType = getGenericCollectionType(facesContext, base,
property.toString());
- }
- }
- }
-
- return containerType;
- }
}
Deleted:
branches/RF-9323/core/api/src/main/java/org/richfaces/el/util/GenericsIntrospectionCache.java
===================================================================
---
branches/RF-9323/core/api/src/main/java/org/richfaces/el/util/GenericsIntrospectionCache.java 2010-12-27
16:10:14 UTC (rev 20813)
+++
branches/RF-9323/core/api/src/main/java/org/richfaces/el/util/GenericsIntrospectionCache.java 2010-12-27
18:59:46 UTC (rev 20814)
@@ -1,99 +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.el.util;
-
-import java.beans.BeanInfo;
-import java.lang.ref.Reference;
-import java.lang.ref.SoftReference;
-import java.util.Collections;
-import java.util.Map;
-
-import javax.faces.context.ExternalContext;
-import javax.faces.context.FacesContext;
-
-import org.richfaces.util.LRUMap;
-
-/**
- * @author Nick Belaevski
- * @since 3.3.0
- */
-final class GenericsIntrospectionCache {
- private static final String CACHE_SIZE_PARAMETER =
"org.richfaces.GenericsIntrospectionCacheSize";
- private static final int DEFAULT_CACHE_SIZE = 256;
- private static final String INSTANCE_ATTRIBUTE_NAME =
GenericsIntrospectionCache.class.getName();
- private Map<Class<?>, GenericsCacheEntry> genericsCache;
-
- private GenericsIntrospectionCache(int cacheSize) {
- genericsCache = new ReferenceMap<Class<?>,
- GenericsCacheEntry>(Collections.synchronizedMap(new
LRUMap<Class<?>,
- Reference<GenericsCacheEntry>>(cacheSize)));
- }
-
- private static int getSize(ExternalContext externalContext) {
- int cacheSize = DEFAULT_CACHE_SIZE;
- String cacheSizeParameter =
externalContext.getInitParameter(CACHE_SIZE_PARAMETER);
-
- if (cacheSizeParameter != null && cacheSizeParameter.length() != 0) {
- try {
- cacheSize = Integer.valueOf(cacheSizeParameter);
- } catch (NumberFormatException e) {
- externalContext.log("Error converting " + CACHE_SIZE_PARAMETER
+ " init parameter to int: "
- + e.getMessage(), e);
- }
- }
-
- return cacheSize;
- }
-
- public GenericsCacheEntry getGenericCacheEntry(Class<?> beanClass) {
- GenericsCacheEntry cacheEntry = genericsCache.get(beanClass);
-
- if (cacheEntry == null) {
- cacheEntry = new GenericsCacheEntry();
- genericsCache.put(beanClass, cacheEntry);
- }
-
- return cacheEntry;
- }
-
- static GenericsIntrospectionCache getInstance(FacesContext facesContext) {
- ExternalContext externalContext = facesContext.getExternalContext();
- Map<String, Object> applicationMap = externalContext.getApplicationMap();
- GenericsIntrospectionCache instance;
-
- synchronized (applicationMap) {
- instance = (GenericsIntrospectionCache)
applicationMap.get(INSTANCE_ATTRIBUTE_NAME);
-
- if (instance == null) {
- instance = new GenericsIntrospectionCache(getSize(externalContext));
- applicationMap.put(INSTANCE_ATTRIBUTE_NAME, instance);
- }
- }
-
- return instance;
- }
-
- static final class GenericsCacheEntry {
- SoftReference<BeanInfo> beanInfoReference;
- Map<String, Class<?>> genericPropertiesClasses;
- }
-}
Deleted: branches/RF-9323/core/api/src/main/java/org/richfaces/el/util/ReferenceMap.java
===================================================================
---
branches/RF-9323/core/api/src/main/java/org/richfaces/el/util/ReferenceMap.java 2010-12-27
16:10:14 UTC (rev 20813)
+++
branches/RF-9323/core/api/src/main/java/org/richfaces/el/util/ReferenceMap.java 2010-12-27
18:59:46 UTC (rev 20814)
@@ -1,177 +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.el.util;
-
-import java.lang.ref.Reference;
-import java.lang.ref.ReferenceQueue;
-import java.lang.ref.SoftReference;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.Map;
-import java.util.Set;
-
-/**
- * Created 17.03.2008
- *
- * @author Nick Belaevski
- * @since 3.2
- */
-public class ReferenceMap<K, V> implements Map<K, V> {
- private ReferenceQueue<V> queue = new ReferenceQueue<V>();
- private Map<K, Reference<V>> map;
-
- public ReferenceMap() {
- this(Collections.synchronizedMap(new HashMap<K, Reference<V>>()));
- }
-
- public ReferenceMap(Map<K, Reference<V>> map) {
- super();
- this.map = map;
- }
-
- private void purge() {
- Reference<? extends V> reference = null;
-
- while ((reference = queue.poll()) != null) {
- ReferenceMapSoftReference<?, ?> entry =
(ReferenceMapSoftReference<?, ?>) reference;
-
- entry.clear();
- map.remove(entry.getKey());
- }
- }
-
- public void clear() {
- map.clear();
-
- Reference<? extends V> reference = null;
-
- while ((reference = queue.poll()) != null) {
-
- // release queue entries
- reference.clear();
- }
- }
-
- public boolean containsKey(Object key) {
- purge();
-
- return map.containsKey(key);
- }
-
- public boolean containsValue(Object value) {
- throw new UnsupportedOperationException();
- }
-
- public Set<java.util.Map.Entry<K, V>> entrySet() {
- throw new UnsupportedOperationException();
- }
-
- public V get(Object key) {
- purge();
-
- Reference<V> reference = map.get(key);
-
- if (reference != null) {
- return reference.get();
- }
-
- return null;
- }
-
- public boolean isEmpty() {
- purge();
-
- return map.isEmpty();
- }
-
- public Set<K> keySet() {
- purge();
-
- return map.keySet();
- }
-
- private V doPut(K key, V value) {
- Reference<V> reference = map.put(key, new ReferenceMapSoftReference<K,
V>(key, value, queue));
-
- if (reference != null) {
- return reference.get();
- }
-
- return null;
- }
-
- public V put(K key, V value) {
- purge();
-
- V v = doPut(key, value);
-
- purge();
-
- return v;
- }
-
- public void putAll(Map<? extends K, ? extends V> t) {
- purge();
-
- for (Map.Entry<? extends K, ? extends V> entry : t.entrySet()) {
- doPut(entry.getKey(), entry.getValue());
- }
-
- purge();
- }
-
- public V remove(Object key) {
- purge();
-
- Reference<V> reference = map.remove(key);
-
- if (reference != null) {
- return reference.get();
- }
-
- return null;
- }
-
- public int size() {
- purge();
-
- return map.size();
- }
-
- public Collection<V> values() {
- throw new UnsupportedOperationException();
- }
-
- protected static class ReferenceMapSoftReference<K, V> extends
SoftReference<V> {
- private K key;
-
- public ReferenceMapSoftReference(K key, V value, ReferenceQueue<? super V>
queue) {
- super(value, queue);
- this.key = key;
- }
-
- public K getKey() {
- return key;
- }
- }
-}
Modified:
branches/RF-9323/core/api/src/main/java/org/richfaces/renderkit/util/CoreAjaxRendererUtils.java
===================================================================
---
branches/RF-9323/core/api/src/main/java/org/richfaces/renderkit/util/CoreAjaxRendererUtils.java 2010-12-27
16:10:14 UTC (rev 20813)
+++
branches/RF-9323/core/api/src/main/java/org/richfaces/renderkit/util/CoreAjaxRendererUtils.java 2010-12-27
18:59:46 UTC (rev 20814)
@@ -34,7 +34,6 @@
import javax.faces.context.FacesContext;
import javax.faces.context.PartialResponseWriter;
-import org.ajax4jsf.component.AjaxComponent;
import org.ajax4jsf.context.AjaxContext;
import org.richfaces.application.ServiceTracker;
import org.richfaces.renderkit.AjaxDataSerializer;
@@ -181,14 +180,7 @@
* @return List of areas Id's , updated by this component.
*/
public static Set<String> getAjaxAreas(UIComponent uiComponent) {
- Object areas;
-
- if (uiComponent instanceof AjaxComponent) {
- areas = ((AjaxComponent) uiComponent).getReRender();
- } else {
- areas = uiComponent.getAttributes().get(AJAX_REGIONS_ATTRIBUTE);
- }
-
+ Object areas = uiComponent.getAttributes().get(AJAX_REGIONS_ATTRIBUTE);
return asIdsSet(areas);
}
@@ -200,14 +192,8 @@
* @since 3.3.0
*/
public static Set<String> getAjaxAreasToProcess(UIComponent component) {
- Object areas;
+ Object areas = component.getAttributes().get(AJAX_PROCESS_ATTRIBUTE);
- if (component instanceof AjaxComponent) {
- areas = ((AjaxComponent) component).getProcess();
- } else {
- areas = component.getAttributes().get(AJAX_PROCESS_ATTRIBUTE);
- }
-
return asIdsSet(areas);
}
@@ -277,15 +263,11 @@
public static boolean isAjaxLimitRender(UIComponent component) {
boolean result = false;
- if (component instanceof AjaxComponent) {
- result = ((AjaxComponent) component).isLimitRender();
+ Object limitRenderObject = component.getAttributes().get(LIMITRENDER_ATTR_NAME);
+ if (limitRenderObject instanceof Boolean) {
+ result = ((Boolean) limitRenderObject).booleanValue();
} else {
- Object limitRenderObject =
component.getAttributes().get(LIMITRENDER_ATTR_NAME);
- if (limitRenderObject instanceof Boolean) {
- result = ((Boolean) limitRenderObject).booleanValue();
- } else {
- result = Boolean.valueOf(String.valueOf(limitRenderObject));
- }
+ result = Boolean.valueOf(String.valueOf(limitRenderObject));
}
return result;
@@ -300,10 +282,6 @@
*/
//TODO nick - refactor - remove this method?
public static String getAjaxOncomplete(UIComponent component) {
- if (component instanceof AjaxComponent) {
- return ((AjaxComponent) component).getOncomplete();
- }
-
return (String) component.getAttributes().get(ONCOMPLETE_ATTR_NAME);
}
@@ -315,10 +293,6 @@
*/
//TODO nick - refactor - remove this method?
public static String getAjaxOnBeforeDomUpdate(UIComponent component) {
- if (component instanceof AjaxComponent) {
- return ((AjaxComponent) component).getOnbeforedomupdate();
- }
-
return (String) component.getAttributes().get(ONBEFOREDOMUPDATE_ATTR_NAME);
}
@@ -328,10 +302,6 @@
* @since 4.0
*/
public static Object getAjaxData(UIComponent component) {
- if (component instanceof AjaxComponent) {
- return ((AjaxComponent) component).getData();
- }
-
return component.getAttributes().get(DATA_ATTR_NAME);
}
Modified:
branches/RF-9323/core/impl/src/main/java/org/ajax4jsf/context/AjaxContextImpl.java
===================================================================
---
branches/RF-9323/core/impl/src/main/java/org/ajax4jsf/context/AjaxContextImpl.java 2010-12-27
16:10:14 UTC (rev 20813)
+++
branches/RF-9323/core/impl/src/main/java/org/ajax4jsf/context/AjaxContextImpl.java 2010-12-27
18:59:46 UTC (rev 20814)
@@ -76,7 +76,6 @@
Object onbeforedomupdate = null;
boolean selfRender = false;
String submittedRegionClientId = null;
- ViewIdHolder viewIdHolder = null;
Integer viewSequence = new Integer(1);
Map<String, Object> responseComponentDataMap = new HashMap<String,
Object>();
Map<String, Object> commonAjaxParameters = new HashMap<String,
Object>();
@@ -90,7 +89,6 @@
selfRender = false;
viewSequence = new Integer(1);
submittedRegionClientId = null;
- viewIdHolder = null;
responseComponentDataMap = new HashMap<String, Object>();
commonAjaxParameters = new HashMap<String, Object>();
responseData = null;
@@ -388,20 +386,6 @@
}
/**
- * @return the vievIdHolder
- */
- public ViewIdHolder getViewIdHolder() {
- return viewIdHolder;
- }
-
- /**
- * @param viewIdHolder the vievIdHolder to set
- */
- public void setViewIdHolder(ViewIdHolder viewIdHolder) {
- this.viewIdHolder = viewIdHolder;
- }
-
- /**
* @return the responseData
*/
public Object getResponseData() {
Modified:
branches/RF-9323/core/impl/src/main/java/org/richfaces/application/DefaultModule.java
===================================================================
---
branches/RF-9323/core/impl/src/main/java/org/richfaces/application/DefaultModule.java 2010-12-27
16:10:14 UTC (rev 20813)
+++
branches/RF-9323/core/impl/src/main/java/org/richfaces/application/DefaultModule.java 2010-12-27
18:59:46 UTC (rev 20814)
@@ -5,6 +5,8 @@
import org.richfaces.application.push.PushContextFactory;
import org.richfaces.application.push.impl.jms.PushContextFactoryImpl;
import org.richfaces.cache.Cache;
+import org.richfaces.el.GenericsIntrospectionService;
+import org.richfaces.el.GenericsIntrospectionServiceImpl;
import org.richfaces.javascript.JavaScriptService;
import org.richfaces.javascript.JavaScriptServiceImpl;
import org.richfaces.l10n.BundleLoader;
@@ -31,7 +33,7 @@
factory.setInstance(ResourceLibraryFactory.class, new
ResourceLibraryFactoryImpl());
factory.setInstance(PushContextFactory.class,
ServiceLoader.loadService(PushContextFactory.class, PushContextFactoryImpl.class));
factory.setInstance(JavaScriptService.class, new JavaScriptServiceImpl());
-
+ factory.setInstance(GenericsIntrospectionService.class, new
GenericsIntrospectionServiceImpl());
}
}
Copied: branches/RF-9323/core/impl/src/main/java/org/richfaces/el/CapturingELResolver.java
(from rev 20813, trunk/core/impl/src/main/java/org/richfaces/el/CapturingELResolver.java)
===================================================================
--- branches/RF-9323/core/impl/src/main/java/org/richfaces/el/CapturingELResolver.java
(rev 0)
+++
branches/RF-9323/core/impl/src/main/java/org/richfaces/el/CapturingELResolver.java 2010-12-27
18:59:46 UTC (rev 20814)
@@ -0,0 +1,66 @@
+/**
+ * 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.el;
+
+import javax.el.ELContext;
+import javax.el.ELResolver;
+
+/**
+ * @author Nick Belaevski
+ * @since 3.3.0
+ */
+public class CapturingELResolver extends ELResolverWrapper {
+ private Object base;
+ private Object property;
+
+ public CapturingELResolver(ELResolver resolver) {
+ super(resolver);
+ }
+
+ @Override
+ public Object getValue(ELContext context, Object base, Object property) {
+ if ((base != null) && (property != null)) {
+ this.base = base;
+ this.property = property;
+ }
+
+ return super.getValue(context, base, property);
+ }
+
+ @Override
+ public Class<?> getType(ELContext context, Object base, Object property) {
+ if ((base != null) && (property != null)) {
+ this.base = base;
+ this.property = property;
+ }
+
+ return super.getType(context, base, property);
+ }
+
+ public Object getBase() {
+ return base;
+ }
+
+ public Object getProperty() {
+ return property;
+ }
+}
Copied:
branches/RF-9323/core/impl/src/main/java/org/richfaces/el/GenericsIntrospectionServiceImpl.java
(from rev 20813,
trunk/core/impl/src/main/java/org/richfaces/el/GenericsIntrospectionServiceImpl.java)
===================================================================
---
branches/RF-9323/core/impl/src/main/java/org/richfaces/el/GenericsIntrospectionServiceImpl.java
(rev 0)
+++
branches/RF-9323/core/impl/src/main/java/org/richfaces/el/GenericsIntrospectionServiceImpl.java 2010-12-27
18:59:46 UTC (rev 20814)
@@ -0,0 +1,170 @@
+/*
+ * 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.el;
+
+import java.beans.BeanInfo;
+import java.beans.IntrospectionException;
+import java.beans.Introspector;
+import java.beans.PropertyDescriptor;
+import java.lang.reflect.Method;
+import java.lang.reflect.ParameterizedType;
+import java.lang.reflect.Type;
+import java.util.Collection;
+import java.util.Map;
+import java.util.ResourceBundle;
+
+import javax.el.ELContext;
+import javax.el.ValueExpression;
+import javax.faces.FacesException;
+import javax.faces.context.FacesContext;
+
+import com.google.common.base.Function;
+import com.google.common.collect.MapMaker;
+
+
+/**
+ * @author Nick Belaevski
+ *
+ */
+public class GenericsIntrospectionServiceImpl implements GenericsIntrospectionService {
+
+ private static final class GenericsCacheEntry {
+
+ private Class<?> beanClass;
+
+ private Map<String, Class<?>> containerClassesMap = new
MapMaker().initialCapacity(2).makeComputingMap(new Function<String,
Class<?>>() {
+
+ public Class<?> apply(String input) {
+ PropertyDescriptor propertyDescriptor = getPropertyDescriptor(input);
+ return getGenericContainerClass(propertyDescriptor);
+ }
+
+ });
+
+ public GenericsCacheEntry(Class<?> beanClass) {
+ this.beanClass = beanClass;
+ }
+
+ private Class<?> resolveType(Type type) {
+ Class<?> result = Object.class;
+
+ if (type instanceof ParameterizedType) {
+ ParameterizedType parameterizedType = (ParameterizedType) type;
+ Type[] types = parameterizedType.getActualTypeArguments();
+
+ if (types != null && types.length != 0) {
+ Type actualType = types[0];
+
+ if (actualType instanceof Class) {
+ result = (Class<?>) actualType;
+ }
+ }
+ }
+
+ return result;
+ }
+
+ private Class<?> getGenericContainerClass(PropertyDescriptor pd) {
+ if (pd == null) {
+ return null;
+ }
+
+ Method readMethod = pd.getReadMethod();
+ if (readMethod == null) {
+ return null;
+ }
+
+ return resolveType(readMethod.getGenericReturnType());
+ }
+
+ private PropertyDescriptor getPropertyDescriptor(String propertyName) {
+ BeanInfo beanInfo = null;
+ try {
+ beanInfo = Introspector.getBeanInfo(beanClass);
+ } catch (IntrospectionException e) {
+ throw new FacesException(e.getMessage(), e);
+ } finally {
+ Introspector.flushFromCaches(beanClass);
+ }
+
+ if (beanInfo == null) {
+ return null;
+ }
+
+ PropertyDescriptor[] propertyDescriptorsArray =
beanInfo.getPropertyDescriptors();
+ for (PropertyDescriptor pd : propertyDescriptorsArray) {
+ if (propertyName.equals(pd.getName())) {
+ return pd;
+ }
+ }
+
+ return null;
+ }
+
+ public Class<?> getContainerClass(String propertyName) {
+ return containerClassesMap.get(propertyName);
+ }
+
+ }
+
+ private final Map<Class<?>, GenericsCacheEntry> cache = new
MapMaker().weakKeys().softValues().makeComputingMap(new Function<Class<?>,
GenericsCacheEntry>() {
+ public GenericsCacheEntry apply(java.lang.Class<?> input) {
+ return new GenericsCacheEntry(input);
+ };
+ });
+
+ private Class<?> getGenericCollectionType(FacesContext context, Object base,
String propertyName) {
+ Class<?> genericPropertyClass = null;
+
+ if ((base != null) && (propertyName != null)) {
+ Class<? extends Object> beanClass = base.getClass();
+
+ // Map and ResourceBundle have special resolvers that we doesn't support
+ if (!Map.class.isAssignableFrom(beanClass) &&
!ResourceBundle.class.isAssignableFrom(beanClass)) {
+ return cache.get(beanClass).getContainerClass(propertyName);
+ }
+ }
+
+ return genericPropertyClass;
+ }
+
+ public Class<?> getContainerClass(FacesContext facesContext, ValueExpression
expression) {
+ ELContext initialELContext = facesContext.getELContext();
+ CapturingELResolver capturingELResolver = new
CapturingELResolver(initialELContext.getELResolver());
+ Class<?> type = expression.getType(new ELContextWrapper(initialELContext,
capturingELResolver));
+ Class<?> containerType = type.getComponentType();
+
+ if ((containerType == null) && (type != null)) {
+ if (Collection.class.isAssignableFrom(type)) {
+ Object base = capturingELResolver.getBase();
+ Object property = capturingELResolver.getProperty();
+
+ if ((base != null) && (property != null)) {
+ containerType = getGenericCollectionType(facesContext, base,
property.toString());
+ }
+ }
+ }
+
+ return containerType;
+ }
+
+}
Modified:
branches/RF-9323/examples/iteration-demo/src/main/java/org/richfaces/demo/model/tree/TreeModelBean.java
===================================================================
---
branches/RF-9323/examples/iteration-demo/src/main/java/org/richfaces/demo/model/tree/TreeModelBean.java 2010-12-27
16:10:14 UTC (rev 20813)
+++
branches/RF-9323/examples/iteration-demo/src/main/java/org/richfaces/demo/model/tree/TreeModelBean.java 2010-12-27
18:59:46 UTC (rev 20814)
@@ -1,61 +1,45 @@
-/**
- *
+/*
+ * 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.demo.model.tree;
-import javax.faces.FacesException;
-import javax.faces.bean.ApplicationScoped;
import javax.faces.bean.ManagedBean;
-import javax.xml.bind.JAXBContext;
-import javax.xml.bind.JAXBException;
-import javax.xml.bind.Unmarshaller;
-import javax.xml.bind.Unmarshaller.Listener;
+import javax.faces.bean.ViewScoped;
-import org.richfaces.demo.model.tree.adaptors.Entry;
-import org.richfaces.demo.model.tree.adaptors.Root;
-
/**
* @author Nick Belaevski
- * mailto:nbelaevski@exadel.com
- * created 25.07.2007
- *
+ *
*/
@ManagedBean
-@ApplicationScoped
+@ViewScoped
public class TreeModelBean {
-
- private Root root;
-
- private void initializeRoot() {
-
- try {
- JAXBContext context = JAXBContext.newInstance(Root.class);
- Unmarshaller unmarshaller = context.createUnmarshaller();
- unmarshaller.setListener(new Listener() {
- @Override
- public void afterUnmarshal(Object target, Object parent) {
- super.afterUnmarshal(target, parent);
-
- if (parent instanceof Entry) {
- ((Entry) target).setParent((Entry) parent);
- }
-
- }
- });
-
-
- root = (Root)
unmarshaller.unmarshal(TreeModelBean.class.getResource("tree-model-data.xml"));
- } catch (JAXBException e) {
- throw new FacesException(e.getMessage(), e);
- }
+
+ private boolean projectIsLeaf = false;
+
+ public boolean isProjectIsLeaf() {
+ return projectIsLeaf;
}
-
- public Root getRoot() {
- if (root == null) {
- initializeRoot();
- }
-
- return root;
- }
+ public void setProjectIsLeaf(boolean projectIsLeaf) {
+ this.projectIsLeaf = projectIsLeaf;
+ }
+
}
Copied:
branches/RF-9323/examples/iteration-demo/src/main/java/org/richfaces/demo/model/tree/TreeModelDataBean.java
(from rev 20813,
trunk/examples/iteration-demo/src/main/java/org/richfaces/demo/model/tree/TreeModelDataBean.java)
===================================================================
---
branches/RF-9323/examples/iteration-demo/src/main/java/org/richfaces/demo/model/tree/TreeModelDataBean.java
(rev 0)
+++
branches/RF-9323/examples/iteration-demo/src/main/java/org/richfaces/demo/model/tree/TreeModelDataBean.java 2010-12-27
18:59:46 UTC (rev 20814)
@@ -0,0 +1,61 @@
+/**
+ *
+ */
+package org.richfaces.demo.model.tree;
+
+import javax.faces.FacesException;
+import javax.faces.bean.ApplicationScoped;
+import javax.faces.bean.ManagedBean;
+import javax.xml.bind.JAXBContext;
+import javax.xml.bind.JAXBException;
+import javax.xml.bind.Unmarshaller;
+import javax.xml.bind.Unmarshaller.Listener;
+
+import org.richfaces.demo.model.tree.adaptors.Entry;
+import org.richfaces.demo.model.tree.adaptors.Root;
+
+/**
+ * @author Nick Belaevski
+ * mailto:nbelaevski@exadel.com
+ * created 25.07.2007
+ *
+ */
+@ManagedBean
+@ApplicationScoped
+public class TreeModelDataBean {
+
+ private Root root;
+
+ private void initializeRoot() {
+
+ try {
+ JAXBContext context = JAXBContext.newInstance(Root.class);
+ Unmarshaller unmarshaller = context.createUnmarshaller();
+ unmarshaller.setListener(new Listener() {
+ @Override
+ public void afterUnmarshal(Object target, Object parent) {
+ super.afterUnmarshal(target, parent);
+
+ if (parent instanceof Entry) {
+ ((Entry) target).setParent((Entry) parent);
+ }
+
+ }
+ });
+
+
+ root = (Root)
unmarshaller.unmarshal(TreeModelDataBean.class.getResource("tree-model-data.xml"));
+ } catch (JAXBException e) {
+ throw new FacesException(e.getMessage(), e);
+ }
+ }
+
+ public Root getRoot() {
+ if (root == null) {
+ initializeRoot();
+ }
+
+ return root;
+ }
+
+}
Copied:
branches/RF-9323/examples/iteration-demo/src/main/java/org/richfaces/demo/model/tree/adaptors/PackageKey.java
(from rev 20813,
trunk/examples/iteration-demo/src/main/java/org/richfaces/demo/model/tree/adaptors/PackageKey.java)
===================================================================
---
branches/RF-9323/examples/iteration-demo/src/main/java/org/richfaces/demo/model/tree/adaptors/PackageKey.java
(rev 0)
+++
branches/RF-9323/examples/iteration-demo/src/main/java/org/richfaces/demo/model/tree/adaptors/PackageKey.java 2010-12-27
18:59:46 UTC (rev 20814)
@@ -0,0 +1,72 @@
+/*
+ * 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.demo.model.tree.adaptors;
+
+/**
+ * @author Nick Belaevski
+ *
+ */
+public class PackageKey {
+
+ private String packageName;
+
+ public PackageKey(String packageName) {
+ super();
+ this.packageName = packageName;
+ }
+
+ public String getPackageName() {
+ return packageName;
+ }
+
+ @Override
+ public int hashCode() {
+ final int prime = 31;
+ int result = 1;
+ result = prime * result + ((packageName == null) ? 0 : packageName.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;
+ }
+ PackageKey other = (PackageKey) obj;
+ if (packageName == null) {
+ if (other.packageName != null) {
+ return false;
+ }
+ } else if (!packageName.equals(other.packageName)) {
+ return false;
+ }
+ return true;
+ }
+
+
+}
Copied:
branches/RF-9323/examples/iteration-demo/src/main/java/org/richfaces/demo/model/tree/adaptors/PackageKeyConverter.java
(from rev 20813,
trunk/examples/iteration-demo/src/main/java/org/richfaces/demo/model/tree/adaptors/PackageKeyConverter.java)
===================================================================
---
branches/RF-9323/examples/iteration-demo/src/main/java/org/richfaces/demo/model/tree/adaptors/PackageKeyConverter.java
(rev 0)
+++
branches/RF-9323/examples/iteration-demo/src/main/java/org/richfaces/demo/model/tree/adaptors/PackageKeyConverter.java 2010-12-27
18:59:46 UTC (rev 20814)
@@ -0,0 +1,52 @@
+/*
+ * 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.demo.model.tree.adaptors;
+
+import javax.faces.component.UIComponent;
+import javax.faces.context.FacesContext;
+import javax.faces.convert.Converter;
+
+import com.google.common.base.Strings;
+
+/**
+ * @author Nick Belaevski
+ *
+ */
+public class PackageKeyConverter implements Converter {
+
+ public Object getAsObject(FacesContext context, UIComponent component, String value)
{
+ if (Strings.isNullOrEmpty(value)) {
+ return null;
+ }
+
+ return new PackageKey(value);
+ }
+
+ public String getAsString(FacesContext context, UIComponent component, Object value)
{
+ if (value == null) {
+ return "";
+ }
+
+ return ((PackageKey) value).getPackageName();
+ }
+
+}
Deleted:
branches/RF-9323/examples/iteration-demo/src/main/java/org/richfaces/demo/model/tree/adaptors/SimpleRecursiveNode.java
===================================================================
---
branches/RF-9323/examples/iteration-demo/src/main/java/org/richfaces/demo/model/tree/adaptors/SimpleRecursiveNode.java 2010-12-27
16:10:14 UTC (rev 20813)
+++
branches/RF-9323/examples/iteration-demo/src/main/java/org/richfaces/demo/model/tree/adaptors/SimpleRecursiveNode.java 2010-12-27
18:59:46 UTC (rev 20814)
@@ -1,76 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright ${year}, Red Hat, Inc. and individual contributors
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
- */
-
-package org.richfaces.demo.model.tree.adaptors;
-
-import java.util.List;
-
-import com.google.common.collect.Lists;
-
-/**
- * @author Nick Belaevski
- * @since 3.2
- */
-
-public class SimpleRecursiveNode {
-
- private SimpleRecursiveNode parent;
-
- private List<SimpleRecursiveNode> children = Lists.newArrayList();
-
- private String text;
-
- public SimpleRecursiveNode(SimpleRecursiveNode parent, String text) {
- super();
- this.parent = parent;
- if (parent != null) {
- parent.addChild(this);
- }
- this.text = text;
- }
-
- public void addChild(SimpleRecursiveNode node) {
- children.add(node);
- }
-
- public void removeChild(SimpleRecursiveNode node) {
- children.remove(node);
- }
-
- public void remove() {
- if (parent != null) {
- parent.removeChild(this);
- }
- }
-
- public SimpleRecursiveNode getParent() {
- return parent;
- }
-
- public List<SimpleRecursiveNode> getChildren() {
- return children;
- }
-
- public String getText() {
- return text;
- }
-}
Modified:
branches/RF-9323/examples/iteration-demo/src/main/java/org/richfaces/demo/model/tree/adaptors/SourceDirectory.java
===================================================================
---
branches/RF-9323/examples/iteration-demo/src/main/java/org/richfaces/demo/model/tree/adaptors/SourceDirectory.java 2010-12-27
16:10:14 UTC (rev 20813)
+++
branches/RF-9323/examples/iteration-demo/src/main/java/org/richfaces/demo/model/tree/adaptors/SourceDirectory.java 2010-12-27
18:59:46 UTC (rev 20814)
@@ -23,9 +23,13 @@
package org.richfaces.demo.model.tree.adaptors;
import java.util.List;
+import java.util.Map;
import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlTransient;
+import com.google.common.collect.Maps;
+
/**
* @author Nick Belaevski
* mailto:nbelaevski@exadel.com
@@ -37,8 +41,19 @@
@XmlElement(name = "package")
private List<Package> packages;
- public List<Package> getPackages() {
- return packages;
+ @XmlTransient
+ private Map<PackageKey, Package> packagesMap;
+
+ public Map<PackageKey, Package> getPackages() {
+ if (packagesMap == null && packages != null) {
+ packagesMap = Maps.newLinkedHashMap();
+
+ for (Package pkg: packages) {
+ packagesMap.put(new PackageKey(pkg.getName()), pkg);
+ }
+ }
+
+ return packagesMap;
}
}
Modified:
branches/RF-9323/examples/iteration-demo/src/main/webapp/WEB-INF/faces-config.xml
===================================================================
---
branches/RF-9323/examples/iteration-demo/src/main/webapp/WEB-INF/faces-config.xml 2010-12-27
16:10:14 UTC (rev 20813)
+++
branches/RF-9323/examples/iteration-demo/src/main/webapp/WEB-INF/faces-config.xml 2010-12-27
18:59:46 UTC (rev 20814)
@@ -1,7 +1,13 @@
<?xml version="1.0" encoding="UTF-8"?>
<faces-config
xmlns="http://java.sun.com/xml/ns/javaee"
-
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-facesconfig_2_0.xsd"
- version="2.0">
+
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-facesconfig_2_0.xsd"
+ version="2.0">
+
+
+ <converter>
+ <converter-id>org.richfaces.demo.PackageKeyConverter</converter-id>
+
<converter-class>org.richfaces.demo.model.tree.adaptors.PackageKeyConverter</converter-class>
+ </converter>
</faces-config>
Modified: branches/RF-9323/examples/iteration-demo/src/main/webapp/treeModel.xhtml
===================================================================
--- branches/RF-9323/examples/iteration-demo/src/main/webapp/treeModel.xhtml 2010-12-27
16:10:14 UTC (rev 20813)
+++ branches/RF-9323/examples/iteration-demo/src/main/webapp/treeModel.xhtml 2010-12-27
18:59:46 UTC (rev 20814)
@@ -16,13 +16,18 @@
<h:messages id="messages" />
</a4j:outputPanel>
+ <h:form>
+ Project is leaf:
+ <h:selectBooleanCheckbox value="#{treeModelBean.projectIsLeaf}"
onclick="submit()" />
+ </h:form>
+
<h:form id="form">
<it:tree id="tree" var="node" toggleType="ajax">
<it:treeNode>
<a4j:commandLink value="#{node}" action="#{node.processClick}"
/>
</it:treeNode>
- <it:treeModelAdaptor nodes="#{treeModelBean.root.projects}">
+ <it:treeModelAdaptor nodes="#{treeModelDataBean.root.projects}"
leaf="#{treeModelBean.projectIsLeaf}">
<it:treeNode iconExpanded="/images/folder_key.png"
iconCollapsed="/images/folder_key.png">
<a4j:commandLink value="#{node}"
action="#{node.processClick}" />
</it:treeNode>
@@ -32,7 +37,7 @@
<a4j:commandLink value="#{node}"
action="#{node.processClick}" />
</it:treeNode>
- <it:treeModelAdaptor nodes="#{node.packages}">
+ <it:treeModelAdaptor nodes="#{node.packages}"
rowKeyConverter="org.richfaces.demo.PackageKeyConverter">
<it:treeModelAdaptor nodes="#{node.classes}" />
</it:treeModelAdaptor>
</it:treeModelAdaptor>
Modified:
branches/RF-9323/examples/richfaces-showcase/src/main/java/org/richfaces/demo/panelmenu/PanelMenuBean.java
===================================================================
---
branches/RF-9323/examples/richfaces-showcase/src/main/java/org/richfaces/demo/panelmenu/PanelMenuBean.java 2010-12-27
16:10:14 UTC (rev 20813)
+++
branches/RF-9323/examples/richfaces-showcase/src/main/java/org/richfaces/demo/panelmenu/PanelMenuBean.java 2010-12-27
18:59:46 UTC (rev 20814)
@@ -29,6 +29,5 @@
public void updateCurrent(ItemChangeEvent event) {
setCurrent(event.getNewItem());
- System.out.println(event.getNewItem());
}
}
Modified:
branches/RF-9323/examples/richfaces-showcase/src/main/java/org/richfaces/demo/tables/model/slides/Picture.java
===================================================================
---
branches/RF-9323/examples/richfaces-showcase/src/main/java/org/richfaces/demo/tables/model/slides/Picture.java 2010-12-27
16:10:14 UTC (rev 20813)
+++
branches/RF-9323/examples/richfaces-showcase/src/main/java/org/richfaces/demo/tables/model/slides/Picture.java 2010-12-27
18:59:46 UTC (rev 20814)
@@ -1,6 +1,8 @@
package org.richfaces.demo.tables.model.slides;
-public class Picture {
+import java.io.Serializable;
+
+public class Picture implements Serializable{
private String name;
private String uri;
Modified:
branches/RF-9323/examples/richfaces-showcase/src/main/webapp/richfaces/dragDrop/dragDrop.xhtml
===================================================================
---
branches/RF-9323/examples/richfaces-showcase/src/main/webapp/richfaces/dragDrop/dragDrop.xhtml 2010-12-27
16:10:14 UTC (rev 20813)
+++
branches/RF-9323/examples/richfaces-showcase/src/main/webapp/richfaces/dragDrop/dragDrop.xhtml 2010-12-27
18:59:46 UTC (rev 20814)
@@ -5,6 +5,39 @@
xmlns:ui="http://java.sun.com/jsf/facelets">
<ui:composition>
+ <p>The Richfaces Drag-n-Drop component suite includes three
+ components: <b>dragSource</b>, <b>dropTarget </b>and
<b>dragIndicator</b>.</p>
+
+ <p><b>rich:dragSource </b>is used to point to the JSF component
+ that becomes draggable. If you want to add a draggable feature to the
+ existing component, attach dragSupport as a child component to it.</p>
+
+ <p><b>rich:dropSupport </b>is similar to the dragSupport, but
it's
+ used to define the drog zone. dropSupport has a built-in Ajax support.
+ I.e. it allows to send an Ajax request and re-render the specified area
+ on a page when the Ajax response is returned back. With the <b>dropListener
+ </b>attribute you can point to a method of the backing bean that accepts
<b>
+ DropEvent </b>as a parameter. This event contains information provided by
<b>
+ dropValue </b>and <b>dragValue </b>attributes of dropSupport and
+ dragSupport.</p>
+
+ <p><b>rich:dragIndicator</b> is a special visual representation of
+ a dragged object. By default it creates a copy of dragged elements. But
+ the markup could be redefined(<u>not implemented in first
release</u>).</p>
+
+ <p>Note: The parent component for dragSupport and dropSupport
+ should be designed to render its children and has two attribute
+ "onmouseover" and "onmouseout". You can use
<a4j:outputPanel> as
+ a container if the component is not satisfy this requirements. Use
+ <a4j:outputPanel> layout="block" to wrap the component with a
+ block type layout.</p>
+
+ <p>The following example demonstrates the drag-n-drop functionality
+ on practice. The left list contains the examples of Ajax frameworks. Do
+ you know them? The demo helps you to sort them out. Drag one and drag
+ over the headers of three panels. If the draggable framework is
+ suitable for a certain framework family, it will be accepted and moved
+ from source panel to the target list.</p>
<ui:include src="#{demoNavigator.sampleIncludeURI}" />
<ui:include src="/templates/includes/source-view.xhtml">
<ui:param name="src" value="#{demoNavigator.sampleIncludeURI}"
/>
@@ -12,5 +45,11 @@
<ui:param name="openLabel" value="View Source" />
<ui:param name="hideLabel" value="Hide Source" />
</ui:include>
+ <p>That demo shows most important feature of the RichFaces drag and
+ drop mechanism. You could mark several different components as
+ 'draggable' and define different drag <b>type</b>'s for them
via
+ attribute. Then you could add corresponding drop zones and use
<b>acceptType</b>'s
+ attributes to define which drop zone will process corresponding dragged
+ elements.</p>
</ui:composition>
</html>
\ No newline at end of file
Modified:
branches/RF-9323/examples/richfaces-showcase/src/main/webapp/richfaces/dragDrop/samples/dragDrop-sample.xhtml
===================================================================
---
branches/RF-9323/examples/richfaces-showcase/src/main/webapp/richfaces/dragDrop/samples/dragDrop-sample.xhtml 2010-12-27
16:10:14 UTC (rev 20813)
+++
branches/RF-9323/examples/richfaces-showcase/src/main/webapp/richfaces/dragDrop/samples/dragDrop-sample.xhtml 2010-12-27
18:59:46 UTC (rev 20814)
@@ -7,24 +7,17 @@
xmlns:rich="http://richfaces.org/rich">
<h:outputStylesheet>
- .panelc {
- width:25%;
- vertical-align:top;
- }
-
- .dropTargetPanel {
- width: 90%;
- }
-
+ .panelc { width:25%; }
+ .valign { 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%">
+ <h:panelGrid columnClasses="panelc valign, valign, valign, valign"
columns="4" width="100%">
<rich:panel style="width:133px">
<f:facet name="header">
@@ -37,14 +30,14 @@
<a4j:outputPanel
style="width:100px;border:1px solid gray;padding:2px"
layout="block">
- <rich:dragBehavior event="mouseover"
- type="#{fm.family}" dragValue="#{fm}" />
+ <rich:dragSource 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" />
+ <a4j:commandButton action="#{dragDropBean.reset}"
+ value="Start Over" render="src,phptable,cftable,dnettable"
/>
</f:facet>
</h:dataTable>
</rich:panel>
@@ -53,8 +46,9 @@
<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" />
+ <rich:dropTarget acceptedTypes="php" dropValue="PHP"
+ dropListener="#{dragDropEventBean.processDrop}"
+ render="phptable, src" />
<h:dataTable id="phptable" columns="1"
value="#{dragDropBean.targetPHP}" var="fm">
@@ -70,8 +64,9 @@
<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" />
+ <rich:dropTarget acceptedTypes="dotNet" dropValue="DNET"
+ dropListener="#{dragDropEventBean.processDrop}"
+ render="dnettable, src" />
<h:dataTable id="dnettable" columns="1"
value="#{dragDropBean.targetDotNet}" var="fm">
@@ -87,11 +82,12 @@
<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" />
+ <rich:dropTarget acceptedTypes="cf" dropValue="CF"
+ dropListener="#{dragDropEventBean.processDrop}"
+ render="cftable, src" />
- <h:dataTable id="cftable" columns="1"
value="#{dragDropBean.targetCF}"
- var="fm">
+ <h:dataTable id="cftable" columns="1"
+ value="#{dragDropBean.targetCF}" var="fm">
<h:column>
<h:outputText value="#{fm.name}"></h:outputText>
</h:column>
Modified:
branches/RF-9323/ui/common/ui/src/main/java/org/richfaces/component/UIDataAdaptor.java
===================================================================
---
branches/RF-9323/ui/common/ui/src/main/java/org/richfaces/component/UIDataAdaptor.java 2010-12-27
16:10:14 UTC (rev 20813)
+++
branches/RF-9323/ui/common/ui/src/main/java/org/richfaces/component/UIDataAdaptor.java 2010-12-27
18:59:46 UTC (rev 20814)
@@ -69,6 +69,7 @@
import org.ajax4jsf.model.DataVisitor;
import org.ajax4jsf.model.ExtendedDataModel;
import org.ajax4jsf.model.Range;
+import org.richfaces.cdk.annotations.Attribute;
import org.richfaces.context.ExtendedVisitContext;
import org.richfaces.log.Logger;
import org.richfaces.log.RichfacesLogger;
@@ -574,6 +575,7 @@
this.extendedDataModel = extendedDataModel;
}
+ @Attribute
public String getVar() {
return (String) getStateHelper().get(PropertyKeys.var);
}
@@ -582,6 +584,7 @@
getStateHelper().put(PropertyKeys.var, var);
}
+ @Attribute
public String getRowKeyVar() {
return (String) getStateHelper().get(PropertyKeys.rowKeyVar);
}
@@ -590,6 +593,7 @@
getStateHelper().put(PropertyKeys.rowKeyVar, rowKeyVar);
}
+ @Attribute
public String getStateVar() {
return (String) getStateHelper().get(PropertyKeys.stateVar);
}
@@ -616,6 +620,8 @@
* before rendering. By default state is reset if there are no faces messages with
severity error or higher.
* @return
*/
+
+ @Attribute
public boolean isKeepSaved() {
Object value = getStateHelper().eval(PropertyKeys.keepSaved);
@@ -1298,7 +1304,7 @@
return dataVisitor.getVisitResult();
} else {
- return visitComponents(dataChildren(), visitContext, callback);
+ return visitComponents(getFacetsAndChildren(), visitContext, callback);
}
}
Modified:
branches/RF-9323/ui/common/ui/src/main/java/org/richfaces/component/UISequence.java
===================================================================
---
branches/RF-9323/ui/common/ui/src/main/java/org/richfaces/component/UISequence.java 2010-12-27
16:10:14 UTC (rev 20813)
+++
branches/RF-9323/ui/common/ui/src/main/java/org/richfaces/component/UISequence.java 2010-12-27
18:59:46 UTC (rev 20814)
@@ -45,6 +45,7 @@
import org.ajax4jsf.model.SequenceDataModel;
import org.ajax4jsf.model.SequenceRange;
import org.ajax4jsf.model.SequenceState;
+import org.richfaces.cdk.annotations.Attribute;
/**
* @author Nick Belaevski
@@ -139,6 +140,7 @@
return getFacesContext().getApplication().createConverter(Integer.class);
}
+ @Attribute
public int getFirst() {
return (Integer) getStateHelper().eval(PropertyKeys.first, 0);
}
@@ -148,6 +150,7 @@
updateState();
}
+ @Attribute
public int getRows() {
return (Integer) getStateHelper().eval(PropertyKeys.rows, 0);
}
@@ -157,6 +160,7 @@
updateState();
}
+ @Attribute
public Object getValue() {
return getStateHelper().eval(PropertyKeys.value);
}
@@ -166,6 +170,7 @@
getStateHelper().put(PropertyKeys.value, value);
}
+ @Attribute
public String getIterationStatusVar() {
return (String) getStateHelper().get(PropertyKeys.iterationStatusVar);
}
Modified:
branches/RF-9323/ui/common/ui/src/main/java/org/richfaces/convert/ConverterUtil.java
===================================================================
---
branches/RF-9323/ui/common/ui/src/main/java/org/richfaces/convert/ConverterUtil.java 2010-12-27
16:10:14 UTC (rev 20813)
+++
branches/RF-9323/ui/common/ui/src/main/java/org/richfaces/convert/ConverterUtil.java 2010-12-27
18:59:46 UTC (rev 20814)
@@ -24,6 +24,7 @@
import javax.faces.component.UIComponent;
import javax.faces.context.FacesContext;
import javax.faces.convert.Converter;
+import javax.faces.convert.IntegerConverter;
import com.google.common.base.Strings;
@@ -33,8 +34,7 @@
*/
public final class ConverterUtil {
- private static final Converter STRING_CONVERTER = new Converter() {
-
+ public static final class StringConverter implements Converter {
public String getAsString(FacesContext context, UIComponent component, Object
value) {
if (value == null) {
return "";
@@ -42,7 +42,7 @@
return value.toString();
}
-
+
public Object getAsObject(FacesContext context, UIComponent component, String
value) {
if (Strings.isNullOrEmpty(value)) {
return null;
@@ -50,12 +50,20 @@
return value;
}
- };
+ }
+
+ private static final Converter STRING_CONVERTER = new StringConverter();
+ private static final Converter INTEGER_CONVERTER = new IntegerConverter();
+
private ConverterUtil() {}
public static Converter stringConverter() {
return STRING_CONVERTER;
}
+
+ public static Converter integerConverter() {
+ return INTEGER_CONVERTER;
+ }
}
Deleted:
branches/RF-9323/ui/common/ui/src/main/java/org/richfaces/renderkit/AjaxChildrenRenderer.java
===================================================================
---
branches/RF-9323/ui/common/ui/src/main/java/org/richfaces/renderkit/AjaxChildrenRenderer.java 2010-12-27
16:10:14 UTC (rev 20813)
+++
branches/RF-9323/ui/common/ui/src/main/java/org/richfaces/renderkit/AjaxChildrenRenderer.java 2010-12-27
18:59:46 UTC (rev 20814)
@@ -1,222 +0,0 @@
-/**
- * License Agreement.
- *
- * Rich Faces - Natural Ajax for Java Server Faces (JSF)
- *
- * Copyright (C) 2007 Exadel, Inc.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License version 2.1 as published by the Free Software Foundation.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-package org.richfaces.renderkit;
-
-import java.io.IOException;
-import java.util.HashSet;
-import java.util.Iterator;
-import java.util.Set;
-
-import javax.faces.component.NamingContainer;
-import javax.faces.component.UIComponent;
-import javax.faces.context.FacesContext;
-
-import org.ajax4jsf.Messages;
-import org.ajax4jsf.component.AjaxChildrenEncoder;
-import org.ajax4jsf.component.AjaxOutput;
-import org.ajax4jsf.context.AjaxContext;
-import org.ajax4jsf.renderkit.AjaxRenderer;
-import org.richfaces.log.Logger;
-import org.richfaces.log.RichfacesLogger;
-
-/**
- * @author shura
- */
-public abstract class AjaxChildrenRenderer extends AjaxComponentRendererBase implements
AjaxRenderer {
- public static final String[] SPECIAL_COMPONENTS_TYPES =
{"org.ajax4jsf.Bundle" /* UILoadBundle.COMPONENT_TYPE */,
- "org.apache.myfaces.AliasBean",
"org.apache.myfaces.AliasBeansScope"};
-
- private static final String SPECIAL_TYPES_PARAMETER =
"org.ajax4jsf.CONTROL_COMPONENTS";
- private static final Logger LOG = RichfacesLogger.RENDERKIT.getLogger();
-
- private Set<String> specialComponentTypes = null;
-
- /*
- * (non-Javadoc)
- *
- * @see
- * org.ajax4jsf.renderkit.AjaxRenderer#encodeAjaxChildren(javax.faces.context
- * .FacesContext, javax.faces.component.UIComponent, java.lang.String,
- * java.util.Set, java.util.Set)
- */
- public void encodeAjaxChildren(FacesContext context, UIComponent component, String
path, Set<String> ids,
- Set<String> renderedAreas) throws IOException {
-
- if (LOG.isDebugEnabled()) {
- LOG.debug(Messages.getMessage(Messages.ENCODE_CHILD_AJAX_INFO, path,
component.getId()));
- }
-
- String currentPath = path;
-
- if (component instanceof NamingContainer) {
- currentPath += component.getId() + NamingContainer.SEPARATOR_CHAR;
-
- // Do not check children if we have no id to render under naming
- // container.
- if (AjaxContext.getCurrentInstance(context).isLimitRender() &&
noIdUnderPath(path, ids)) {
- return;
- }
- }
-
- for (Iterator<UIComponent> it = component.getFacetsAndChildren();
it.hasNext();) {
- UIComponent element = (UIComponent) it.next();
-
- encodeAjaxComponent(context, element, currentPath, ids, renderedAreas);
- }
- }
-
- private boolean noIdUnderPath(String path, Set<String> ids) {
-
- // Do we have an any component for the rendering under that container ?
- boolean noSuchId = true;
-
- for (String id : ids) {
- if ((null != id) && id.startsWith(path)) {
- noSuchId = false;
-
- break;
- }
- }
-
- return noSuchId;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see
- * org.ajax4jsf.renderkit.AjaxRenderer#encodeAjaxComponent(javax.faces.context
- * .FacesContext, javax.faces.component.UIComponent, java.lang.String,
- * java.util.Set, java.util.Set)
- */
- public void encodeAjaxComponent(FacesContext context, UIComponent component, String
currentPath, Set<String> ids,
- Set<String> renderedAreas) throws IOException
{
-
- if (component.isRendered()) { // skip not-rendered components.
- boolean found = false;
- boolean limitRender =
AjaxContext.getCurrentInstance(context).isLimitRender();
- String elementId = component.getId();
- String absoluteId = currentPath + elementId;
-
- if (!ids.isEmpty()) {
-
- // list for rendering may contains absolute id ( best ),
- // component Id or client ID
- // String clientId = element.getClientId(context);
- if (ids.contains(absoluteId) || ids.contains(elementId)) {
- if (LOG.isDebugEnabled()) {
- LOG.debug(Messages.getMessage(Messages.RENDER_AJAX_AREA_INFO,
absoluteId));
- }
-
- // renderChild(context, element);
- found = true;
- }
- }
-
- //
- if (!found && limitRender && (component instanceof
NamingContainer)
- && noIdUnderPath(absoluteId + NamingContainer.SEPARATOR_CHAR,
ids)) {
- return;
- }
-
- if (!found && !limitRender && (component instanceof
AjaxOutput)) {
- if (((AjaxOutput) component).isAjaxRendered()) {
-
- // renderChild(context, element);
- found = true;
- }
- }
-
- if (!found) {
- if (component instanceof AjaxChildrenEncoder) {
- ((AjaxChildrenEncoder) component).encodeAjaxChild(context,
currentPath, ids, renderedAreas);
- } else {
-
- // Special case - for control components, not produced
- // html code - such as message bundles loaders,
- // MyFaces aliases etc. we call encodeBegin/end methods
- // even if components not in rendered areas.
- boolean special = isSpecialElement(context, component);
-
- if (special) {
- component.encodeBegin(context);
- }
-
- encodeAjaxChildren(context, component, currentPath, ids,
renderedAreas);
-
- if (special) {
- component.encodeEnd(context);
- }
- }
- } else {
- renderedAreas.add(component.getClientId(context));
- component.encodeAll(context);
- }
- }
- }
-
- /**
- * Detect component as special control case - such as messages bundle
- * loader, alias bean components etc. Type of component get by reflection
- * from static field COMPONENT_TYPE
- *
- * @param context
- * @param component
- * @return true if encode methods must be called for this component even in
- * not-rendered parts.
- */
- private boolean isSpecialElement(FacesContext context, UIComponent component) {
- if (specialComponentTypes == null) {
- specialComponentTypes = new HashSet<String>(10);
-
- for (int i = 0; i < SPECIAL_COMPONENTS_TYPES.length; i++) {
- specialComponentTypes.add(SPECIAL_COMPONENTS_TYPES[i]);
- }
-
- String special =
context.getExternalContext().getInitParameter(SPECIAL_TYPES_PARAMETER);
-
- if (null != special) {
- String[] split = special.split(",");
-
- for (int i = 0; i < split.length; i++) {
- specialComponentTypes.add(split[i]);
- }
- }
- }
-
- boolean result;
-
- try {
- String componentType = (String)
component.getClass().getField("COMPONENT_TYPE").get(null);
-
- result = specialComponentTypes.contains(componentType);
- } catch (Exception e) {
-
- // exception occurs if component not have accesible COMPONENT_TYPE
- // constant
- // we assume that component not in special types.
- result = false;
- }
-
- return result;
- }
-}
Deleted:
branches/RF-9323/ui/common/ui/src/main/java/org/richfaces/renderkit/AjaxComponentRendererBase.java
===================================================================
---
branches/RF-9323/ui/common/ui/src/main/java/org/richfaces/renderkit/AjaxComponentRendererBase.java 2010-12-27
16:10:14 UTC (rev 20813)
+++
branches/RF-9323/ui/common/ui/src/main/java/org/richfaces/renderkit/AjaxComponentRendererBase.java 2010-12-27
18:59:46 UTC (rev 20814)
@@ -1,33 +0,0 @@
-/**
- * License Agreement.
- *
- * Rich Faces - Natural Ajax for Java Server Faces (JSF)
- *
- * Copyright (C) 2007 Exadel, Inc.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License version 2.1 as published by the Free Software Foundation.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-package org.richfaces.renderkit;
-
-
-/**
- * Base class for all Ajax enabled components. Perform common task -
- * output javasript for component.
- *
- * @author shura (latest modification by $Author: alexsmirnov $)
- * @version $Revision: 1.1.2.1 $ $Date: 2007/01/09 18:58:49 $
- */
-public abstract class AjaxComponentRendererBase extends RendererBase {
-}
Modified:
branches/RF-9323/ui/common/ui/src/main/java/org/richfaces/renderkit/util/AjaxRendererUtils.java
===================================================================
---
branches/RF-9323/ui/common/ui/src/main/java/org/richfaces/renderkit/util/AjaxRendererUtils.java 2010-12-27
16:10:14 UTC (rev 20813)
+++
branches/RF-9323/ui/common/ui/src/main/java/org/richfaces/renderkit/util/AjaxRendererUtils.java 2010-12-27
18:59:46 UTC (rev 20814)
@@ -28,7 +28,6 @@
import javax.faces.context.FacesContext;
import org.ajax4jsf.component.AjaxClientBehavior;
-import org.ajax4jsf.component.AjaxComponent;
import org.ajax4jsf.context.AjaxContext;
import org.ajax4jsf.javascript.JSFunctionDefinition;
import org.ajax4jsf.javascript.JSReference;
@@ -564,30 +563,7 @@
* @return clientId of status area, or <code>null</code>
*/
public static String getAjaxStatus(UIComponent component) {
- String statusId;
-
- if (component instanceof AjaxComponent) {
- statusId = ((AjaxComponent) component).getStatus();
- } else {
- statusId = (String) component.getAttributes().get(STATUS_ATTR_NAME);
- }
-
- return statusId;
-
-// if (null != statusId) {
-// UIComponent status = RendererUtils.getInstance().
-// findComponentFor(component, statusId);
-//
-// if (null != status) {
-// statusId = status
-// .getClientId(FacesContext.getCurrentInstance());
-// } else {
-// LOG.warn(Messages.getMessage(
-// Messages.AJAX_STATUS_COMPONENT_NOT_FOWND_WARNING,
-// component.getId()));
-// }
-// }
-// return statusId;
+ return (String) component.getAttributes().get(STATUS_ATTR_NAME);
}
public static String getQueueId(UIComponent component) {
@@ -612,10 +588,6 @@
//TODO nick - refactor - remove this method?
public static String getAjaxOnBegin(UIComponent component) {
- if (component instanceof AjaxComponent) {
- return ((AjaxComponent) component).getOnbegin();
- }
-
return (String) component.getAttributes().get(ONBEGIN_ATTR_NAME);
}
Modified:
branches/RF-9323/ui/common/ui/src/main/java/org/richfaces/view/facelets/RowKeyConverterRule.java
===================================================================
---
branches/RF-9323/ui/common/ui/src/main/java/org/richfaces/view/facelets/RowKeyConverterRule.java 2010-12-27
16:10:14 UTC (rev 20813)
+++
branches/RF-9323/ui/common/ui/src/main/java/org/richfaces/view/facelets/RowKeyConverterRule.java 2010-12-27
18:59:46 UTC (rev 20814)
@@ -21,8 +21,6 @@
package org.richfaces.view.facelets;
-import org.richfaces.component.UIDataAdaptor;
-
import javax.faces.convert.Converter;
import javax.faces.view.facelets.FaceletContext;
import javax.faces.view.facelets.MetaRule;
@@ -30,6 +28,8 @@
import javax.faces.view.facelets.MetadataTarget;
import javax.faces.view.facelets.TagAttribute;
+import org.richfaces.component.UIDataAdaptor;
+
/**
* Apply rowKeyConverter to component
*
@@ -39,13 +39,6 @@
public class RowKeyConverterRule extends MetaRule {
public static final RowKeyConverterRule INSTANCE = new RowKeyConverterRule();
- /*
- * (non-Javadoc)
- *
- * @see com.sun.facelets.tag.MetaRule#applyRule(java.lang.String,
- * com.sun.facelets.tag.TagAttribute,
- * com.sun.facelets.tag.MetadataTarget)
- */
@Override
public Metadata applyRule(String name, TagAttribute attribute, MetadataTarget meta)
{
if (meta.isTargetInstanceOf(UIDataAdaptor.class)) {
Modified:
branches/RF-9323/ui/input/ui/src/main/java/org/richfaces/component/AbstractAutocomplete.java
===================================================================
---
branches/RF-9323/ui/input/ui/src/main/java/org/richfaces/component/AbstractAutocomplete.java 2010-12-27
16:10:14 UTC (rev 20813)
+++
branches/RF-9323/ui/input/ui/src/main/java/org/richfaces/component/AbstractAutocomplete.java 2010-12-27
18:59:46 UTC (rev 20814)
@@ -34,6 +34,7 @@
import javax.faces.context.FacesContext;
import javax.faces.convert.Converter;
+import org.richfaces.application.ServiceTracker;
import org.richfaces.cdk.annotations.Attribute;
import org.richfaces.cdk.annotations.EventName;
import org.richfaces.cdk.annotations.JsfComponent;
@@ -43,7 +44,7 @@
import org.richfaces.cdk.annotations.TagType;
import org.richfaces.context.ExtendedVisitContext;
import org.richfaces.context.ExtendedVisitContextMode;
-import org.richfaces.el.util.ELUtils;
+import org.richfaces.el.GenericsIntrospectionService;
import org.richfaces.renderkit.MetaComponentRenderer;
/**
@@ -221,7 +222,7 @@
ValueExpression expression = this.getValueExpression("value");
if (expression != null) {
- Class<?> containerClass = ELUtils.getContainerClass(context,
expression);
+ Class<?> containerClass = ServiceTracker.getService(context,
GenericsIntrospectionService.class).getContainerClass(context, expression);
converter = getConverterForType(context, containerClass);
}
Modified:
branches/RF-9323/ui/input/ui/src/main/java/org/richfaces/renderkit/InputRendererBase.java
===================================================================
---
branches/RF-9323/ui/input/ui/src/main/java/org/richfaces/renderkit/InputRendererBase.java 2010-12-27
16:10:14 UTC (rev 20813)
+++
branches/RF-9323/ui/input/ui/src/main/java/org/richfaces/renderkit/InputRendererBase.java 2010-12-27
18:59:46 UTC (rev 20814)
@@ -22,20 +22,21 @@
package org.richfaces.renderkit;
-import org.richfaces.component.util.SelectUtils;
+import java.util.Map;
import javax.faces.component.UIComponent;
import javax.faces.component.UIInput;
import javax.faces.context.FacesContext;
import javax.faces.convert.Converter;
import javax.faces.convert.ConverterException;
-import java.util.Map;
+import org.richfaces.component.util.SelectUtils;
+
/**
* @author Nick Belaevski - nbelaevski(a)exadel.com
* created 23.01.2007
*/
-public class InputRendererBase extends AjaxComponentRendererBase {
+public class InputRendererBase extends RendererBase {
protected void doDecode(FacesContext context, UIComponent component) {
String clientId = component.getClientId(context);
Modified:
branches/RF-9323/ui/input/ui/src/main/resources/META-INF/resources/org.richfaces/inputNumberSlider.js
===================================================================
---
branches/RF-9323/ui/input/ui/src/main/resources/META-INF/resources/org.richfaces/inputNumberSlider.js 2010-12-27
16:10:14 UTC (rev 20813)
+++
branches/RF-9323/ui/input/ui/src/main/resources/META-INF/resources/org.richfaces/inputNumberSlider.js 2010-12-27
18:59:46 UTC (rev 20814)
@@ -44,13 +44,16 @@
this.element = jQuery(this.attachToDom());
this.input =
this.element.children(".rf-insl-inp-cntr").children(".rf-insl-inp");
this.track =
this.element.children(".rf-insl-trc-cntr").children(".rf-insl-trc");
- this.handle = this.track.children(".rf-insl-hnd, .rf-insl-hnd-dis");
+ var handleContainer = this.track.children("span");
+ this.handle = handleContainer.children(".rf-insl-hnd,
.rf-insl-hnd-dis");
this.tooltip = this.element.children(".rf-insl-tt");
var value = Number(this.input.val());
if (isNaN(value)) {
value = this.minValue;
}
+ handleContainer.css("display", "block");
+ this.track.css("padding-right", this.handle.width() + "px");
this.__setValue(value, null, true);
if (!this.disabled) {
@@ -95,8 +98,8 @@
}
if (value != this.value) {
this.input.val(value);
- var left = (value - this.minValue) * (this.track.width() -
this.handle.width()) / this.range;
- this.handle.css("margin-left", left + "px");
+ var left = 100 * (value - this.minValue) / this.range;
+ this.handle.css("margin-left", left + "%");
this.tooltip.text(value);
this.tooltip.setPosition(this.handle,{from: 'LT', offset: [0, 5]});
//TODO Seems offset doesn't work now.
this.value = value;
@@ -168,7 +171,7 @@
},
__mousemoveHandler: function (event) {
- var value = this.range * (event.pageX - this.track.position().left) /
(this.track.width()
+ var value = this.range * (event.pageX - this.track.position().left -
this.handle.width() / 2) / (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);
Modified:
branches/RF-9323/ui/input/ui/src/main/resources/META-INF/resources/org.richfaces/select.js
===================================================================
---
branches/RF-9323/ui/input/ui/src/main/resources/META-INF/resources/org.richfaces/select.js 2010-12-27
16:10:14 UTC (rev 20813)
+++
branches/RF-9323/ui/input/ui/src/main/resources/META-INF/resources/org.richfaces/select.js 2010-12-27
18:59:46 UTC (rev 20814)
@@ -366,16 +366,18 @@
this.setValue(label);
this.hidePopup();
this.__setInputFocus();
-
- this.invokeEvent.call(this,"selectitem",
document.getElementById(this.id + 'Input'));
+ this.__save();
+
+ if(this.focusValue != this.selValueInput.val() ) {
+ this.invokeEvent.call(this,"selectitem", document.getElementById(this.id
+ 'Input'));
+ }
},
- onblur: function(e) {
- this.hidePopup();
+ __save: function() {
var value = "";
- var label = this.defaultLabel;
- var clientItem;
+ var label = "";
var inputLabel = this.getValue();
+
if(inputLabel && inputLabel != "") {
if(this.enableManualInput) {
clientItem = this.__getClientItemFromCache(inputLabel);
@@ -387,10 +389,21 @@
label = clientItem.label;
value = clientItem.value;
}
- }
-
+ }
+
this.setValue(label);
this.selValueInput.val(value);
+ },
+
+ onblur: function(e) {
+ this.hidePopup();
+ var inputLabel = this.getValue();
+
+ if(!inputLabel || inputLabel == "") {
+ this.setValue(this.defaultLabel);
+ this.selValueInput.val("");
+ }
+
this.focused = false;
this.invokeEvent.call(this,"blur", document.getElementById(this.id +
'Input'), e);
if(this.focusValue != this.selValueInput.val() ) {
Modified: branches/RF-9323/ui/input/ui/src/main/templates/inputnumberslider.template.xml
===================================================================
---
branches/RF-9323/ui/input/ui/src/main/templates/inputnumberslider.template.xml 2010-12-27
16:10:14 UTC (rev 20813)
+++
branches/RF-9323/ui/input/ui/src/main/templates/inputnumberslider.template.xml 2010-12-27
18:59:46 UTC (rev 20814)
@@ -53,7 +53,9 @@
<span
class="rf-insl-mx">#{component.attributes['maxValue']}</span>
</c:if>
<span class="rf-insl-trc
#{component.attributes['trackClass']}">
- <span class="rf-insl-hnd#{component.attributes['disabled'] ?
'-dis' : ''} #{component.attributes['handleClass']}" />
+ <span>
+ <span class="rf-insl-hnd#{component.attributes['disabled'] ?
'-dis' : ''} #{component.attributes['handleClass']}" />
+ </span>
</span>
</span>
<c:if test="#{component.attributes['showArrows']}">
Modified:
branches/RF-9323/ui/iteration/ui/src/main/java/org/richfaces/DataScrollerUtils.java
===================================================================
---
branches/RF-9323/ui/iteration/ui/src/main/java/org/richfaces/DataScrollerUtils.java 2010-12-27
16:10:14 UTC (rev 20813)
+++
branches/RF-9323/ui/iteration/ui/src/main/java/org/richfaces/DataScrollerUtils.java 2010-12-27
18:59:46 UTC (rev 20814)
@@ -99,7 +99,7 @@
public static UIComponent findDataTable(AbstractDataScroller dataScroller) {
- String forAttribute = dataScroller.getForComponent();
+ String forAttribute = dataScroller.getFor();
UIComponent forComp;
if (forAttribute == null) {
forComp = dataScroller;
Modified:
branches/RF-9323/ui/iteration/ui/src/main/java/org/richfaces/component/AbstractCollapsibleSubTable.java
===================================================================
---
branches/RF-9323/ui/iteration/ui/src/main/java/org/richfaces/component/AbstractCollapsibleSubTable.java 2010-12-27
16:10:14 UTC (rev 20813)
+++
branches/RF-9323/ui/iteration/ui/src/main/java/org/richfaces/component/AbstractCollapsibleSubTable.java 2010-12-27
18:59:46 UTC (rev 20814)
@@ -68,7 +68,8 @@
enum PropertyKeys {
expanded
}
-
+
+ @Attribute
public boolean isExpanded() {
return (Boolean)getStateHelper().eval(PropertyKeys.expanded, true);
}
Modified:
branches/RF-9323/ui/iteration/ui/src/main/java/org/richfaces/component/AbstractCollapsibleSubTableToggler.java
===================================================================
---
branches/RF-9323/ui/iteration/ui/src/main/java/org/richfaces/component/AbstractCollapsibleSubTableToggler.java 2010-12-27
16:10:14 UTC (rev 20813)
+++
branches/RF-9323/ui/iteration/ui/src/main/java/org/richfaces/component/AbstractCollapsibleSubTableToggler.java 2010-12-27
18:59:46 UTC (rev 20814)
@@ -48,10 +48,6 @@
public static final String DEFAULT_EVENT = "onclick";
- enum PropertyKeys {
- forId
- }
-
@Attribute
public abstract String getExpandLabel();
@@ -66,12 +62,13 @@
@Attribute(defaultValue = DEFAULT_EVENT)
public abstract String getEvent();
-
+
+ @Attribute
public String getFor() {
- return (String)getStateHelper().eval(PropertyKeys.forId);
+ return (String)getStateHelper().eval("for");
}
public void setFor(String forId) {
- getStateHelper().put(PropertyKeys.forId, forId);
+ getStateHelper().put("for", forId);
}
}
Modified:
branches/RF-9323/ui/iteration/ui/src/main/java/org/richfaces/component/AbstractDataScroller.java
===================================================================
---
branches/RF-9323/ui/iteration/ui/src/main/java/org/richfaces/component/AbstractDataScroller.java 2010-12-27
16:10:14 UTC (rev 20813)
+++
branches/RF-9323/ui/iteration/ui/src/main/java/org/richfaces/component/AbstractDataScroller.java 2010-12-27
18:59:46 UTC (rev 20814)
@@ -91,9 +91,6 @@
@Attribute
public abstract String getLastPageMode();
- @Attribute
- public abstract String getForComponent();
-
@Attribute(defaultValue="10")
public abstract int getMaxPages();
@@ -108,7 +105,16 @@
@Attribute(defaultValue="1")
public abstract int getFastStep();
+
+ @Attribute
+ public String getFor() {
+ return (String)getStateHelper().eval("for");
+ }
+ public void setFor(String forId) {
+ getStateHelper().put("for", forId);
+ }
+
public void addScrollerListener(DataScrollerListener listener) {
addFacesListener(listener);
}
Modified:
branches/RF-9323/ui/iteration/ui/src/main/java/org/richfaces/component/AbstractTree.java
===================================================================
---
branches/RF-9323/ui/iteration/ui/src/main/java/org/richfaces/component/AbstractTree.java 2010-12-27
16:10:14 UTC (rev 20813)
+++
branches/RF-9323/ui/iteration/ui/src/main/java/org/richfaces/component/AbstractTree.java 2010-12-27
18:59:46 UTC (rev 20814)
@@ -22,9 +22,11 @@
package org.richfaces.component;
import java.io.IOException;
+import java.text.MessageFormat;
import java.util.Collection;
import java.util.HashSet;
import java.util.Iterator;
+import java.util.Map;
import javax.el.ELContext;
import javax.el.ELException;
@@ -38,6 +40,7 @@
import javax.faces.component.visit.VisitResult;
import javax.faces.context.FacesContext;
import javax.faces.convert.Converter;
+import javax.faces.convert.ConverterException;
import javax.faces.event.AbortProcessingException;
import javax.faces.event.ExceptionQueuedEvent;
import javax.faces.event.ExceptionQueuedEventContext;
@@ -65,6 +68,7 @@
import org.richfaces.event.TreeToggleEvent;
import org.richfaces.event.TreeToggleListener;
import org.richfaces.event.TreeToggleSource;
+import org.richfaces.model.DeclarativeModelKey;
import org.richfaces.model.DeclarativeTreeDataModelImpl;
import org.richfaces.model.DeclarativeTreeModel;
import org.richfaces.model.SwingTreeNodeDataModelImpl;
@@ -77,6 +81,7 @@
import com.google.common.base.Strings;
import com.google.common.collect.Iterables;
import com.google.common.collect.Iterators;
+import com.google.common.collect.Maps;
/**
* @author Nick Belaevski
@@ -102,6 +107,10 @@
public static final String DEFAULT_TREE_NODE_FACET_NAME = DEFAULT_TREE_NODE_ID;
+ private static final String COMPONENT_FOR_MODEL_UNAVAILABLE = "Component is not
available for model {0}";
+
+ private static final String CONVERTER_FOR_MODEL_UNAVAILABLE = "Row key converter
is not available for model {0}";
+
private static final class MatchingTreeNodePredicate implements
Predicate<UIComponent> {
private String type;
@@ -141,6 +150,8 @@
private transient UIComponent currentComponent = this;
+ private transient Map<String, UIComponent> declatariveModelsMap = null;
+
public AbstractTree() {
setKeepSaved(true);
setRendererType("org.richfaces.TreeRenderer");
@@ -552,7 +563,9 @@
@Override
protected void resetDataModel() {
super.resetDataModel();
+
treeRange = null;
+ declatariveModelsMap = null;
}
public TreeDataModelTuple createSnapshot() {
@@ -570,4 +583,65 @@
super.restoreChildState(facesContext);
}
+ protected UIComponent findDeclarativeModel(String modelId) {
+ if (declatariveModelsMap == null) {
+ declatariveModelsMap = Maps.newHashMap();
+ }
+
+ UIComponent adaptor = declatariveModelsMap.get(modelId);
+ if (adaptor == null) {
+ adaptor = findComponent(modelId);
+ if (adaptor != null) {
+ declatariveModelsMap.put(modelId, adaptor);
+ }
+ }
+
+ if (adaptor == null) {
+ throw new
IllegalStateException(MessageFormat.format(COMPONENT_FOR_MODEL_UNAVAILABLE, modelId));
+ }
+
+ return adaptor;
+ }
+
+ public String convertDeclarativeKeyToString(FacesContext context, DeclarativeModelKey
declarativeKey) throws ConverterException {
+ try {
+ UIComponent component = findDeclarativeModel(declarativeKey.getModelId());
+
+ TreeModelAdaptor adaptor = (TreeModelAdaptor) component;
+
+ Converter rowKeyConverter = adaptor.getRowKeyConverter();
+ if (rowKeyConverter == null) {
+ throw new
ConverterException(MessageFormat.format(CONVERTER_FOR_MODEL_UNAVAILABLE,
declarativeKey.getModelId()));
+ }
+
+ return rowKeyConverter.getAsString(context, (UIComponent) adaptor,
declarativeKey.getModelKey());
+ } catch (ConverterException e) {
+ throw e;
+ } catch (Exception e) {
+ throw new ConverterException(e.getMessage(), e);
+ }
+ }
+
+ public DeclarativeModelKey convertDeclarativeKeyFromString(FacesContext context,
String modelId,
+ String modelKeyAsString) throws ConverterException {
+
+ try {
+ UIComponent component = findDeclarativeModel(modelId);
+
+ TreeModelAdaptor adaptor = (TreeModelAdaptor) component;
+
+ Converter rowKeyConverter = adaptor.getRowKeyConverter();
+ if (rowKeyConverter == null) {
+ throw new
ConverterException(MessageFormat.format(CONVERTER_FOR_MODEL_UNAVAILABLE, modelId));
+ }
+
+ Object modelKey = rowKeyConverter.getAsObject(context, (UIComponent) adaptor,
modelKeyAsString);
+ return new DeclarativeModelKey(modelId, modelKey);
+ } catch (ConverterException e) {
+ throw e;
+ } catch (Exception e) {
+ throw new ConverterException(e.getMessage(), e);
+ }
+ }
+
}
Modified:
branches/RF-9323/ui/iteration/ui/src/main/java/org/richfaces/component/AbstractTreeModelAdaptor.java
===================================================================
---
branches/RF-9323/ui/iteration/ui/src/main/java/org/richfaces/component/AbstractTreeModelAdaptor.java 2010-12-27
16:10:14 UTC (rev 20813)
+++
branches/RF-9323/ui/iteration/ui/src/main/java/org/richfaces/component/AbstractTreeModelAdaptor.java 2010-12-27
18:59:46 UTC (rev 20814)
@@ -21,19 +21,147 @@
*/
package org.richfaces.component;
+import java.util.Map;
+
+import javax.el.ValueExpression;
+import javax.faces.component.PartialStateHolder;
+import javax.faces.component.StateHelper;
+import javax.faces.component.StateHolder;
import javax.faces.component.UIComponentBase;
+import javax.faces.context.FacesContext;
+import javax.faces.convert.Converter;
-import org.richfaces.cdk.annotations.JsfComponent;
-import org.richfaces.cdk.annotations.Tag;
+import org.richfaces.convert.ConverterUtil;
/**
* @author Nick Belaevski
*
*/
-@JsfComponent(type = AbstractTreeModelAdaptor.COMPONENT_TYPE,
- tag = @Tag(name = "treeModelAdaptor"))
-public abstract class AbstractTreeModelAdaptor extends UIComponentBase implements
TreeModelAdaptor {
+public abstract class AbstractTreeModelAdaptor extends UIComponentBase {
- public static final String COMPONENT_TYPE =
"org.richfaces.TreeModelAdaptor";
+ private enum PropertyKeys {
+ rowKeyConverter, rowKeyConverterSet
+ }
+ private Converter rowKeyConverter;
+
+ public Converter getRowKeyConverter() {
+ if (this.rowKeyConverter != null) {
+ return this.rowKeyConverter;
+ }
+
+ ValueExpression converterExpression =
getValueExpression(PropertyKeys.rowKeyConverter.toString());
+ if (converterExpression != null) {
+ return (Converter)
converterExpression.getValue(getFacesContext().getELContext());
+ } else {
+ return null;
+ }
+ }
+
+ public void setRowKeyConverter(Converter converter) {
+ StateHelper stateHelper = getStateHelper();
+ stateHelper.put(PropertyKeys.rowKeyConverterSet, Boolean.TRUE);
+
+ this.rowKeyConverter = converter;
+ }
+
+ protected void memoizeDefaultRowKeyConverter(Object value) {
+ if (isSetRowKeyConverter()) {
+ return;
+ }
+
+ if (value instanceof Iterable<?>) {
+ setRowKeyConverter(ConverterUtil.integerConverter());
+ } else if (value instanceof Map<?, ?>) {
+ setRowKeyConverter(ConverterUtil.stringConverter());
+ }
+ }
+
+ private boolean isSetRowKeyConverter() {
+ return isLocalRowKeyConverterSet() ||
getValueExpression(PropertyKeys.rowKeyConverter.toString()) != null;
+ }
+
+ private boolean isLocalRowKeyConverterSet() {
+ Boolean value = (Boolean) getStateHelper().get(PropertyKeys.rowKeyConverterSet);
+ return Boolean.TRUE.equals(value);
+ }
+
+ @Override
+ public void markInitialState() {
+ super.markInitialState();
+
+ if (rowKeyConverter instanceof PartialStateHolder) {
+ ((PartialStateHolder) rowKeyConverter).markInitialState();
+ }
+ }
+
+ @Override
+ public void clearInitialState() {
+ super.clearInitialState();
+
+ if (rowKeyConverter instanceof PartialStateHolder) {
+ ((PartialStateHolder) rowKeyConverter).clearInitialState();
+ }
+ }
+
+ @Override
+ public void restoreState(FacesContext context, Object stateObject) {
+ Object[] state = (Object[]) stateObject;
+
+ super.restoreState(context, state[0]);
+
+ boolean converterHasPartialState = Boolean.TRUE.equals(state[1]);
+ Object savedConverterState = state[2];
+
+ if (converterHasPartialState) {
+ ((StateHolder) rowKeyConverter).restoreState(context, savedConverterState);
+ } else {
+ rowKeyConverter = (Converter) UIComponentBase.restoreAttachedState(context,
savedConverterState);
+ }
+ }
+
+ @Override
+ public Object saveState(FacesContext context) {
+ Object parentState = super.saveState(context);
+
+ Object converterState = null;
+ boolean nullDelta = true;
+
+ boolean converterHasPartialState = false;
+
+ if (initialStateMarked()) {
+ if (!isLocalRowKeyConverterSet() && rowKeyConverter != null
&& rowKeyConverter instanceof PartialStateHolder) {
+ // Delta
+ StateHolder holder = (StateHolder) rowKeyConverter;
+ if (!holder.isTransient()) {
+ Object attachedState = holder.saveState(context);
+ if (attachedState != null) {
+ nullDelta = false;
+ converterState = attachedState;
+ }
+ converterHasPartialState = true;
+ } else {
+ converterState = null;
+ }
+ } else if (isLocalRowKeyConverterSet() || rowKeyConverter != null) {
+ // Full
+ converterState = saveAttachedState(context, rowKeyConverter);
+ nullDelta = false;
+ }
+
+ if (parentState == null && nullDelta) {
+ // No values
+ return null;
+ }
+ } else {
+ converterState = saveAttachedState(context, rowKeyConverter);
+ }
+
+ return new Object[] {
+ parentState,
+ converterHasPartialState,
+ converterState
+ };
+ }
+
}
Deleted:
branches/RF-9323/ui/iteration/ui/src/main/java/org/richfaces/component/AbstractTreeModelRecursiveAdaptor.java
===================================================================
---
branches/RF-9323/ui/iteration/ui/src/main/java/org/richfaces/component/AbstractTreeModelRecursiveAdaptor.java 2010-12-27
16:10:14 UTC (rev 20813)
+++
branches/RF-9323/ui/iteration/ui/src/main/java/org/richfaces/component/AbstractTreeModelRecursiveAdaptor.java 2010-12-27
18:59:46 UTC (rev 20814)
@@ -1,43 +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.component;
-
-import javax.faces.component.UIComponentBase;
-
-import org.richfaces.cdk.annotations.Attribute;
-import org.richfaces.cdk.annotations.JsfComponent;
-import org.richfaces.cdk.annotations.Tag;
-
-/**
- * @author Nick Belaevski
- *
- */
-@JsfComponent(type = AbstractTreeModelRecursiveAdaptor.COMPONENT_TYPE,
- tag = @Tag(name = "treeModelRecursiveAdaptor"))
-public abstract class AbstractTreeModelRecursiveAdaptor extends UIComponentBase
implements TreeModelRecursiveAdaptor {
-
- public static final String COMPONENT_TYPE =
"org.richfaces.TreeModelRecursiveAdaptor";
-
- @Attribute(defaultValue = "first")
- public abstract String getRecursionOrder();
-
-}
Modified:
branches/RF-9323/ui/iteration/ui/src/main/java/org/richfaces/component/DeclarativeTreeDataModelWalker.java
===================================================================
---
branches/RF-9323/ui/iteration/ui/src/main/java/org/richfaces/component/DeclarativeTreeDataModelWalker.java 2010-12-27
16:10:14 UTC (rev 20813)
+++
branches/RF-9323/ui/iteration/ui/src/main/java/org/richfaces/component/DeclarativeTreeDataModelWalker.java 2010-12-27
18:59:46 UTC (rev 20814)
@@ -66,7 +66,7 @@
}
- private void setupChildModelContext(String modelId) {
+ private void setupModelComponentContext(String modelId) {
if (currentComponent instanceof TreeModelRecursiveAdaptor &&
modelId.equals(currentComponent.getId())) {
//currentComponent already set
modelData = ((TreeModelRecursiveAdaptor) currentComponent).getNodes();
@@ -80,6 +80,15 @@
}
}
+ private void setupDataModelContext(Object key) {
+ if (modelData instanceof Iterable<?>) {
+ Iterable<?> iterable = (Iterable<?>) modelData;
+ data = Iterables.get(iterable, (Integer) key);
+ } else {
+ data = ((Map<?, ?>) modelData).get(key);
+ }
+ }
+
protected FacesContext getFacesContext() {
return facesContext;
}
@@ -104,7 +113,15 @@
}
try {
- walkSimpleKeys(key.getSimpleKeys());
+ for (Object simpleKey : key.getSimpleKeys()) {
+ DeclarativeModelKey declarativeKey = (DeclarativeModelKey) simpleKey;
+ if (var != null) {
+ contextMap.put(var, data);
+ }
+
+ setupModelComponentContext(declarativeKey.getModelId());
+ setupDataModelContext(declarativeKey.getModelKey());
+ }
} finally {
if (var != null) {
try {
@@ -116,35 +133,4 @@
}
}
- protected DeclarativeModelKey convertKey(Object nodes, DeclarativeModelKey
declarativeModelKey) {
- return declarativeModelKey;
- }
-
- protected Object getData(Object nodes, Object key) {
- if (nodes instanceof Iterable<?>) {
- Iterable<?> iterable = (Iterable<?>) nodes;
- return Iterables.get(iterable, (Integer) key);
- } else {
- return ((Map<?, ?>) nodes).get(key);
- }
- }
-
- protected void walkSimpleKey(DeclarativeModelKey segment) {
- if (var != null) {
- contextMap.put(var, data);
- }
-
- setupChildModelContext(segment.getModelId());
-
- DeclarativeModelKey convertedKey = convertKey(modelData, segment);
- data = getData(modelData, convertedKey.getModelKey());
- }
-
- protected void walkSimpleKeys(Object[] simpleKeys) {
- for (Object simpleKey : simpleKeys) {
- DeclarativeModelKey declarativeKey = (DeclarativeModelKey) simpleKey;
- walkSimpleKey(declarativeKey);
- }
- }
-
}
Modified:
branches/RF-9323/ui/iteration/ui/src/main/java/org/richfaces/component/TreeModelAdaptor.java
===================================================================
---
branches/RF-9323/ui/iteration/ui/src/main/java/org/richfaces/component/TreeModelAdaptor.java 2010-12-27
16:10:14 UTC (rev 20813)
+++
branches/RF-9323/ui/iteration/ui/src/main/java/org/richfaces/component/TreeModelAdaptor.java 2010-12-27
18:59:46 UTC (rev 20814)
@@ -21,12 +21,24 @@
*/
package org.richfaces.component;
+import javax.faces.convert.Converter;
+
+import org.richfaces.cdk.annotations.Attribute;
+
/**
* @author Nick Belaevski
*
*/
public interface TreeModelAdaptor {
+ @Attribute
public Object getNodes();
+ @Attribute
+ public Converter getRowKeyConverter();
+
+ public void setRowKeyConverter(Converter converter);
+
+ public boolean isLeaf();
+
}
Modified:
branches/RF-9323/ui/iteration/ui/src/main/java/org/richfaces/component/TreeModelRecursiveAdaptor.java
===================================================================
---
branches/RF-9323/ui/iteration/ui/src/main/java/org/richfaces/component/TreeModelRecursiveAdaptor.java 2010-12-27
16:10:14 UTC (rev 20813)
+++
branches/RF-9323/ui/iteration/ui/src/main/java/org/richfaces/component/TreeModelRecursiveAdaptor.java 2010-12-27
18:59:46 UTC (rev 20814)
@@ -21,12 +21,15 @@
*/
package org.richfaces.component;
+import org.richfaces.cdk.annotations.Attribute;
+
/**
* @author Nick Belaevski
*
*/
public interface TreeModelRecursiveAdaptor extends TreeModelAdaptor {
+ @Attribute
public Object getRoots();
public String getRecursionOrder();
Copied:
branches/RF-9323/ui/iteration/ui/src/main/java/org/richfaces/component/UITreeModelAdaptor.java
(from rev 20813,
trunk/ui/iteration/ui/src/main/java/org/richfaces/component/UITreeModelAdaptor.java)
===================================================================
---
branches/RF-9323/ui/iteration/ui/src/main/java/org/richfaces/component/UITreeModelAdaptor.java
(rev 0)
+++
branches/RF-9323/ui/iteration/ui/src/main/java/org/richfaces/component/UITreeModelAdaptor.java 2010-12-27
18:59:46 UTC (rev 20814)
@@ -0,0 +1,69 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc. and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
+ */
+package org.richfaces.component;
+
+import org.richfaces.cdk.annotations.JsfComponent;
+import org.richfaces.cdk.annotations.Tag;
+
+/**
+ * @author Nick Belaevski
+ *
+ */
+@JsfComponent(type = UITreeModelAdaptor.COMPONENT_TYPE,
+ family = UITreeModelAdaptor.COMPONENT_FAMILY,
+ tag = @Tag(name = "treeModelAdaptor", handler =
"org.richfaces.view.facelets.TreeModelAdaptorHandler"))
+public class UITreeModelAdaptor extends AbstractTreeModelAdaptor implements
TreeModelAdaptor {
+
+ public static final String COMPONENT_TYPE =
"org.richfaces.TreeModelAdaptor";
+
+ public static final String COMPONENT_FAMILY =
"org.richfaces.TreeModelAdaptor";
+
+ private enum PropertyKeys {
+ nodes, leaf
+ }
+
+ @Override
+ public String getFamily() {
+ return COMPONENT_FAMILY;
+ }
+
+ public Object getNodes() {
+ Object nodes = getStateHelper().eval(PropertyKeys.nodes);
+
+ memoizeDefaultRowKeyConverter(nodes);
+
+ return nodes;
+ }
+
+ public void setNodes(Object nodes) {
+ getStateHelper().put(PropertyKeys.nodes, nodes);
+ }
+
+ public boolean isLeaf() {
+ return (Boolean) getStateHelper().eval(PropertyKeys.leaf, false);
+ }
+
+ public void setLeaf(boolean leaf) {
+ getStateHelper().put(PropertyKeys.leaf, leaf);
+ }
+
+}
\ No newline at end of file
Copied:
branches/RF-9323/ui/iteration/ui/src/main/java/org/richfaces/component/UITreeModelRecursiveAdaptor.java
(from rev 20813,
trunk/ui/iteration/ui/src/main/java/org/richfaces/component/UITreeModelRecursiveAdaptor.java)
===================================================================
---
branches/RF-9323/ui/iteration/ui/src/main/java/org/richfaces/component/UITreeModelRecursiveAdaptor.java
(rev 0)
+++
branches/RF-9323/ui/iteration/ui/src/main/java/org/richfaces/component/UITreeModelRecursiveAdaptor.java 2010-12-27
18:59:46 UTC (rev 20814)
@@ -0,0 +1,81 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc. and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
+ */
+package org.richfaces.component;
+
+import org.richfaces.cdk.annotations.JsfComponent;
+import org.richfaces.cdk.annotations.Tag;
+
+/**
+ * @author Nick Belaevski
+ *
+ */
+@JsfComponent(type = UITreeModelRecursiveAdaptor.COMPONENT_TYPE,
+ family = UITreeModelRecursiveAdaptor.COMPONENT_FAMILY,
+ tag = @Tag(name = "treeModelRecursiveAdaptor", handler =
"org.richfaces.view.facelets.TreeModelRecursiveAdaptorHandler"))
+public class UITreeModelRecursiveAdaptor extends AbstractTreeModelAdaptor implements
TreeModelRecursiveAdaptor {
+
+ public static final String COMPONENT_TYPE =
"org.richfaces.TreeModelRecursiveAdaptor";
+
+ public static final String COMPONENT_FAMILY =
"org.richfaces.TreeModelRecursiveAdaptor";
+
+ private enum PropertyKeys {
+ roots, nodes, leaf
+ }
+
+ @Override
+ public String getFamily() {
+ return COMPONENT_FAMILY;
+ }
+
+ public Object getRoots() {
+ Object roots = getStateHelper().eval(PropertyKeys.roots);
+
+ memoizeDefaultRowKeyConverter(roots);
+
+ return roots;
+ }
+
+ public void setRoots(Object roots) {
+ getStateHelper().put(PropertyKeys.roots, roots);
+ }
+
+ public Object getNodes() {
+ return getStateHelper().eval(PropertyKeys.nodes);
+ }
+
+ public void setNodes(Object nodes) {
+ getStateHelper().put(PropertyKeys.nodes, nodes);
+ }
+
+ public String getRecursionOrder() {
+ return null;
+ }
+
+ public boolean isLeaf() {
+ return (Boolean) getStateHelper().eval(PropertyKeys.leaf, false);
+ }
+
+ public void setLeaf(boolean leaf) {
+ getStateHelper().put(PropertyKeys.leaf, leaf);
+ }
+
+}
Modified:
branches/RF-9323/ui/iteration/ui/src/main/java/org/richfaces/convert/DeclarativeModelSequenceKeyConverter.java
===================================================================
---
branches/RF-9323/ui/iteration/ui/src/main/java/org/richfaces/convert/DeclarativeModelSequenceKeyConverter.java 2010-12-27
16:10:14 UTC (rev 20813)
+++
branches/RF-9323/ui/iteration/ui/src/main/java/org/richfaces/convert/DeclarativeModelSequenceKeyConverter.java 2010-12-27
18:59:46 UTC (rev 20814)
@@ -21,85 +21,85 @@
*/
package org.richfaces.convert;
+import static org.richfaces.convert.SequenceRowKeyConverter.SEPARATOR_SPLITTER;
+import static org.richfaces.convert.TreeConverterUtil.escape;
+import static org.richfaces.convert.TreeConverterUtil.unescape;
+import static org.richfaces.model.TreeDataModel.SEPARATOR_CHAR;
+
+import java.util.Iterator;
+import java.util.List;
+
import javax.faces.component.UIComponent;
import javax.faces.context.FacesContext;
import javax.faces.convert.Converter;
import javax.faces.convert.ConverterException;
-import javax.faces.convert.IntegerConverter;
import org.richfaces.component.AbstractTree;
-import org.richfaces.component.DeclarativeTreeDataModelWalker;
import org.richfaces.model.DeclarativeModelKey;
import org.richfaces.model.SequenceRowKey;
+
+import com.google.common.base.Strings;
+import com.google.common.collect.Lists;
/**
* @author Nick Belaevski
*
*/
-public class DeclarativeModelSequenceKeyConverter extends
SequenceRowKeyConverter<DeclarativeModelKey> {
+public class DeclarativeModelSequenceKeyConverter implements Converter {
- private final class KeyConvertingWalker extends DeclarativeTreeDataModelWalker {
+ public static final String CONVERTER_ID =
"org.richfaces.DeclarativeModelSequenceKeyConverter";
+
+ public Object getAsObject(FacesContext context, UIComponent component, String value)
throws ConverterException {
+ if (Strings.isNullOrEmpty(value)) {
+ return null;
+ }
+
+ Iterator<String> split = SEPARATOR_SPLITTER.split(value).iterator();
- private final FacesContext context;
-
- private DeclarativeModelKey[] convertedSimpleKeys;
-
- private int keysIdx;
+ AbstractTree tree = (AbstractTree) component;
- private KeyConvertingWalker(FacesContext context, AbstractTree rootComponent) {
- super(context, rootComponent);
- this.context = context;
- }
-
- @Override
- protected DeclarativeModelKey convertKey(Object nodes, DeclarativeModelKey
declarativeModelKey) {
- DeclarativeModelKey convertedKey;
+ List<DeclarativeModelKey> declarativeKeys = Lists.newArrayList();
+
+ while (split.hasNext()) {
+ String modelId = unescape(split.next());
+ String modelKeyAsString = unescape(split.next());
- if (nodes instanceof Iterable<?>) {
- String modelKeyAsString = (String) declarativeModelKey.getModelKey();
- Object modelKey = INTEGER_CONVERTER.getAsObject(context,
getRootComponent(), modelKeyAsString);
- convertedKey = new DeclarativeModelKey(declarativeModelKey.getModelId(),
modelKey);
- } else {
- convertedKey = declarativeModelKey;
- }
-
- convertedSimpleKeys[keysIdx++] = convertedKey;
+ DeclarativeModelKey declarativeKey =
tree.convertDeclarativeKeyFromString(context, modelId, modelKeyAsString);
- return super.convertKey(nodes, convertedKey);
+ declarativeKeys.add(declarativeKey);
}
- @Override
- public void walk(SequenceRowKey key) {
- convertedSimpleKeys = new DeclarativeModelKey[key.getSimpleKeys().length];
- keysIdx = 0;
- super.walk(key);
- }
+ return new SequenceRowKey((Object[]) declarativeKeys.toArray(new
DeclarativeModelKey[declarativeKeys.size()]));
+ }
- public DeclarativeModelKey[] getConvertedSimpleKeys() {
- return convertedSimpleKeys;
+ public String getAsString(FacesContext context, UIComponent component, Object value)
{
+ if (value == null) {
+ return "";
}
- }
-
- public static final String CONVERTER_ID =
"org.richfaces.DeclarativeModelSequenceKeyConverter";
-
- private static final Converter INTEGER_CONVERTER = new IntegerConverter();
-
- public DeclarativeModelSequenceKeyConverter() {
- super(DeclarativeModelKey.class, new
DeclarativeModelKeyConverter(ConverterUtil.stringConverter()));
- }
-
- @Override
- public Object getAsObject(FacesContext context, UIComponent component, String value)
throws ConverterException {
- SequenceRowKey key = (SequenceRowKey) super.getAsObject(context, component,
value);
- if (key != null) {
+ SequenceRowKey sequenceRowKey = (SequenceRowKey) value;
+
+ Object[] declarativeKeys = sequenceRowKey.getSimpleKeys();
+ AbstractTree tree = (AbstractTree) component;
+
+ StringBuilder result = new StringBuilder();
+
+ for (Object declarativeKeyObject : declarativeKeys) {
+ DeclarativeModelKey declarativeKey = (DeclarativeModelKey)
declarativeKeyObject;
+ String modelId = escape(declarativeKey.getModelId());
- KeyConvertingWalker walker = new KeyConvertingWalker(context, (AbstractTree)
component);
- walker.walk(key);
+ String modelKeyAsString = escape(tree.convertDeclarativeKeyToString(context,
declarativeKey));
- key = new SequenceRowKey((Object[]) walker.getConvertedSimpleKeys());
+ if (result.length() != 0) {
+ result.append(SEPARATOR_CHAR);
+ }
+
+ result.append(modelId);
+
+ result.append(SEPARATOR_CHAR);
+ result.append(modelKeyAsString);
}
- return key;
+ return result.toString();
}
}
Modified:
branches/RF-9323/ui/iteration/ui/src/main/java/org/richfaces/convert/IntegerSequenceRowKeyConverter.java
===================================================================
---
branches/RF-9323/ui/iteration/ui/src/main/java/org/richfaces/convert/IntegerSequenceRowKeyConverter.java 2010-12-27
16:10:14 UTC (rev 20813)
+++
branches/RF-9323/ui/iteration/ui/src/main/java/org/richfaces/convert/IntegerSequenceRowKeyConverter.java 2010-12-27
18:59:46 UTC (rev 20814)
@@ -21,7 +21,6 @@
*/
package org.richfaces.convert;
-import javax.faces.convert.IntegerConverter;
/**
* @author Nick Belaevski
@@ -32,7 +31,7 @@
public static final String CONVERTER_ID =
"org.richfaces.IntegerSequenceRowKeyConverter";
public IntegerSequenceRowKeyConverter() {
- super(Integer.class, new IntegerConverter());
+ super(Integer.class, ConverterUtil.integerConverter());
}
}
Modified:
branches/RF-9323/ui/iteration/ui/src/main/java/org/richfaces/convert/SequenceRowKeyConverter.java
===================================================================
---
branches/RF-9323/ui/iteration/ui/src/main/java/org/richfaces/convert/SequenceRowKeyConverter.java 2010-12-27
16:10:14 UTC (rev 20813)
+++
branches/RF-9323/ui/iteration/ui/src/main/java/org/richfaces/convert/SequenceRowKeyConverter.java 2010-12-27
18:59:46 UTC (rev 20814)
@@ -1,12 +1,14 @@
package org.richfaces.convert;
+import static org.richfaces.model.TreeDataModel.SEPARATOR_CHAR;
+
import java.util.List;
import javax.faces.component.UIComponent;
import javax.faces.context.FacesContext;
import javax.faces.convert.Converter;
import javax.faces.convert.ConverterException;
-import static org.richfaces.model.TreeDataModel.*;
+
import org.richfaces.model.SequenceRowKey;
import com.google.common.base.Splitter;
@@ -21,7 +23,7 @@
public class SequenceRowKeyConverter<T> implements Converter {
- private static final Splitter DOT_SPLITTER = Splitter.on(SEPARATOR_CHAR);
+ static final Splitter SEPARATOR_SPLITTER = Splitter.on(SEPARATOR_CHAR);
private Class<T> clazz;
@@ -38,7 +40,7 @@
return null;
}
- Iterable<String> split = DOT_SPLITTER.split(value);
+ Iterable<String> split = SEPARATOR_SPLITTER.split(value);
List<T> keysList = Lists.<T>newArrayList();
for (String s: split) {
Modified:
branches/RF-9323/ui/iteration/ui/src/main/java/org/richfaces/model/DeclarativeTreeDataModelImpl.java
===================================================================
---
branches/RF-9323/ui/iteration/ui/src/main/java/org/richfaces/model/DeclarativeTreeDataModelImpl.java 2010-12-27
16:10:14 UTC (rev 20813)
+++
branches/RF-9323/ui/iteration/ui/src/main/java/org/richfaces/model/DeclarativeTreeDataModelImpl.java 2010-12-27
18:59:46 UTC (rev 20814)
@@ -34,6 +34,7 @@
import org.richfaces.convert.DeclarativeModelSequenceKeyConverter;
import org.richfaces.model.iterators.DeclarativeTreeDataModelCompositeTuplesIterator;
+import com.google.common.base.Predicate;
import com.google.common.base.Predicates;
import com.google.common.collect.Iterables;
@@ -45,6 +46,8 @@
private static final Converter DEFAULT_CONVERTER = new
DeclarativeModelSequenceKeyConverter();
+ private static final Predicate<Object> TREE_MODEL_ADAPTOR_INSTANCE_PREDICATE =
Predicates.instanceOf(TreeModelAdaptor.class);
+
private AbstractTree tree;
private UIComponent currentComponent;
@@ -60,7 +63,14 @@
public boolean isLeaf() {
UIComponent currentComponent = getCurrentComponent();
- if (currentComponent instanceof TreeModelRecursiveAdaptor) {
+
+ TreeModelAdaptor adaptor = (TreeModelAdaptor) currentComponent;
+
+ if (adaptor.isLeaf()) {
+ return true;
+ }
+
+ if (adaptor instanceof TreeModelRecursiveAdaptor) {
return false;
}
@@ -68,7 +78,7 @@
return true;
}
- return !Iterables.any(currentComponent.getChildren(),
Predicates.instanceOf(TreeModelAdaptor.class));
+ return !Iterables.any(currentComponent.getChildren(),
TREE_MODEL_ADAPTOR_INSTANCE_PREDICATE);
}
public Iterator<TreeDataModelTuple> children() {
Modified:
branches/RF-9323/ui/iteration/ui/src/main/java/org/richfaces/renderkit/SortingFilteringRowsRenderer.java
===================================================================
---
branches/RF-9323/ui/iteration/ui/src/main/java/org/richfaces/renderkit/SortingFilteringRowsRenderer.java 2010-12-27
16:10:14 UTC (rev 20813)
+++
branches/RF-9323/ui/iteration/ui/src/main/java/org/richfaces/renderkit/SortingFilteringRowsRenderer.java 2010-12-27
18:59:46 UTC (rev 20814)
@@ -26,6 +26,7 @@
import java.util.Iterator;
import java.util.LinkedHashSet;
import java.util.Map;
+import java.util.Set;
import javax.el.ELContext;
import javax.el.ELException;
@@ -94,37 +95,35 @@
}
protected void decodeSorting(FacesContext context, UIDataTableBase dataTableBase,
String value) {
-
- Collection<Object> sortPriority = dataTableBase.getSortPriority();
-
- if(sortPriority == null) {
- sortPriority = new LinkedHashSet<Object>();
- }
-
+ Set<Object> sortPriority = new LinkedHashSet<Object>();
+
String[] values = value.split(SEPARATOR);
- if (Boolean.parseBoolean(values[2]) ||
SortMode.single.equals(dataTableBase.getSortMode())) {
+ String columnId = values[0];
+ String sortOrder = values[1];
+ boolean isClear = Boolean.parseBoolean(values[2]);
+
+ if (isClear || SortMode.single.equals(dataTableBase.getSortMode())) {
for (Iterator<UIComponent> iterator = dataTableBase.columns();
iterator.hasNext();) {
UIComponent column = iterator.next();
- if (values[0].equals(column.getId())) {
- updateSortOrder(context, column, values[1]);
- sortPriority.add(values[0]);
+ if (columnId.equals(column.getId())) {
+ updateSortOrder(context, column, sortOrder);
+ sortPriority.add(columnId);
} else {
updateAttribute(context, column, SORT_ORDER_STRING,
SortOrder.unsorted);
}
}
} else {
- updateSortOrder(context, dataTableBase.findComponent(values[0]), values[1]);
- sortPriority = dataTableBase.getSortPriority();
- if (sortPriority != null) {
- sortPriority.remove(values[0]);
- sortPriority.addAll(sortPriority);
+ updateSortOrder(context, dataTableBase.findComponent(columnId), sortOrder);
+ Collection<?> priority = dataTableBase.getSortPriority();
+ if (priority != null) {
+ priority.remove(columnId);
+ sortPriority.addAll(priority);
}
- sortPriority.add(values[0]);
+ sortPriority.add(columnId);
}
-
updateAttribute(context, dataTableBase, SORT_PRIORITY_STRING, sortPriority);
-
context.getPartialViewContext().getRenderIds().add(dataTableBase.getClientId(context)); //
TODO Use partial re-rendering here.
- }
+
context.getPartialViewContext().getRenderIds().add(dataTableBase.getClientId(context));
+ }
private void updateSortOrder(FacesContext context, UIComponent component, String
value) {
SortOrder sortOrder = SortOrder.ascending;
Modified:
branches/RF-9323/ui/iteration/ui/src/main/java/org/richfaces/taglib/DataScrollerHandler.java
===================================================================
---
branches/RF-9323/ui/iteration/ui/src/main/java/org/richfaces/taglib/DataScrollerHandler.java 2010-12-27
16:10:14 UTC (rev 20813)
+++
branches/RF-9323/ui/iteration/ui/src/main/java/org/richfaces/taglib/DataScrollerHandler.java 2010-12-27
18:59:46 UTC (rev 20814)
@@ -116,7 +116,6 @@
MetaRuleset ruleset = super.createMetaRuleset(type);
ruleset.addRule(PAGERULE);
ruleset.addRule(SCROLL_LISTENER_RULE);
- ruleset.alias("for", "forComponent");
return ruleset;
}
}
Copied:
branches/RF-9323/ui/iteration/ui/src/main/java/org/richfaces/view/facelets/TreeAdaptorRowKeyConverterRule.java
(from rev 20813,
trunk/ui/iteration/ui/src/main/java/org/richfaces/view/facelets/TreeAdaptorRowKeyConverterRule.java)
===================================================================
---
branches/RF-9323/ui/iteration/ui/src/main/java/org/richfaces/view/facelets/TreeAdaptorRowKeyConverterRule.java
(rev 0)
+++
branches/RF-9323/ui/iteration/ui/src/main/java/org/richfaces/view/facelets/TreeAdaptorRowKeyConverterRule.java 2010-12-27
18:59:46 UTC (rev 20814)
@@ -0,0 +1,86 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc. and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
+ */
+
+package org.richfaces.view.facelets;
+
+import javax.faces.component.UIComponent;
+import javax.faces.convert.Converter;
+import javax.faces.view.facelets.FaceletContext;
+import javax.faces.view.facelets.MetaRule;
+import javax.faces.view.facelets.Metadata;
+import javax.faces.view.facelets.MetadataTarget;
+import javax.faces.view.facelets.TagAttribute;
+
+import org.richfaces.component.TreeModelAdaptor;
+
+/**
+ */
+public class TreeAdaptorRowKeyConverterRule extends MetaRule {
+
+ public static final TreeAdaptorRowKeyConverterRule INSTANCE = new
TreeAdaptorRowKeyConverterRule();
+
+ @Override
+ public Metadata applyRule(String name, TagAttribute attribute, MetadataTarget meta)
{
+ if (meta.isTargetInstanceOf(TreeModelAdaptor.class)) {
+ if ("rowKeyConverter".equals(name)) {
+ if (attribute.isLiteral()) {
+ return new StaticConverterMetadata(attribute.getValue());
+ } else {
+ return new DynamicConverterMetaData(attribute);
+ }
+ }
+ }
+
+ return null;
+ }
+
+ static final class DynamicConverterMetaData extends Metadata {
+ private final TagAttribute attribute;
+
+ public DynamicConverterMetaData(TagAttribute attribute) {
+ super();
+ this.attribute = attribute;
+ }
+
+ @Override
+ public void applyMetadata(FaceletContext ctx, Object instance) {
+ ((UIComponent) instance).setValueExpression("rowKeyConverter",
+ attribute.getValueExpression(ctx, Converter.class));
+ }
+ }
+
+ static final class StaticConverterMetadata extends Metadata {
+ private final String converterId;
+
+ public StaticConverterMetadata(String converterId) {
+ super();
+ this.converterId = converterId;
+ }
+
+ @Override
+ public void applyMetadata(FaceletContext ctx, Object instance) {
+ Converter converter =
ctx.getFacesContext().getApplication().createConverter(converterId);
+
+ ((TreeModelAdaptor) instance).setRowKeyConverter(converter);
+ }
+ }
+}
Copied:
branches/RF-9323/ui/iteration/ui/src/main/java/org/richfaces/view/facelets/TreeModelAdaptorHandler.java
(from rev 20813,
trunk/ui/iteration/ui/src/main/java/org/richfaces/view/facelets/TreeModelAdaptorHandler.java)
===================================================================
---
branches/RF-9323/ui/iteration/ui/src/main/java/org/richfaces/view/facelets/TreeModelAdaptorHandler.java
(rev 0)
+++
branches/RF-9323/ui/iteration/ui/src/main/java/org/richfaces/view/facelets/TreeModelAdaptorHandler.java 2010-12-27
18:59:46 UTC (rev 20814)
@@ -0,0 +1,44 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc. and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
+ */
+package org.richfaces.view.facelets;
+
+import javax.faces.view.facelets.ComponentConfig;
+import javax.faces.view.facelets.ComponentHandler;
+import javax.faces.view.facelets.MetaRuleset;
+
+/**
+ * @author Nick Belaevski
+ *
+ */
+public class TreeModelAdaptorHandler extends ComponentHandler {
+
+ public TreeModelAdaptorHandler(ComponentConfig config) {
+ super(config);
+ }
+
+ @Override
+ protected MetaRuleset createMetaRuleset(Class type) {
+ MetaRuleset metaRuleset = super.createMetaRuleset(type);
+ metaRuleset.addRule(TreeAdaptorRowKeyConverterRule.INSTANCE);
+ return metaRuleset;
+ }
+}
Copied:
branches/RF-9323/ui/iteration/ui/src/main/java/org/richfaces/view/facelets/TreeModelRecursiveAdaptorHandler.java
(from rev 20813,
trunk/ui/iteration/ui/src/main/java/org/richfaces/view/facelets/TreeModelRecursiveAdaptorHandler.java)
===================================================================
---
branches/RF-9323/ui/iteration/ui/src/main/java/org/richfaces/view/facelets/TreeModelRecursiveAdaptorHandler.java
(rev 0)
+++
branches/RF-9323/ui/iteration/ui/src/main/java/org/richfaces/view/facelets/TreeModelRecursiveAdaptorHandler.java 2010-12-27
18:59:46 UTC (rev 20814)
@@ -0,0 +1,44 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc. and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
+ */
+package org.richfaces.view.facelets;
+
+import javax.faces.view.facelets.ComponentConfig;
+import javax.faces.view.facelets.ComponentHandler;
+import javax.faces.view.facelets.MetaRuleset;
+
+/**
+ * @author Nick Belaevski
+ *
+ */
+public class TreeModelRecursiveAdaptorHandler extends ComponentHandler {
+
+ public TreeModelRecursiveAdaptorHandler(ComponentConfig config) {
+ super(config);
+ }
+
+ @Override
+ protected MetaRuleset createMetaRuleset(Class type) {
+ MetaRuleset metaRuleset = super.createMetaRuleset(type);
+ metaRuleset.addRule(TreeAdaptorRowKeyConverterRule.INSTANCE);
+ return metaRuleset;
+ }
+}
Modified:
branches/RF-9323/ui/iteration/ui/src/main/resources/META-INF/resources/org.richfaces/datatable.js
===================================================================
---
branches/RF-9323/ui/iteration/ui/src/main/resources/META-INF/resources/org.richfaces/datatable.js 2010-12-27
16:10:14 UTC (rev 20813)
+++
branches/RF-9323/ui/iteration/ui/src/main/resources/META-INF/resources/org.richfaces/datatable.js 2010-12-27
18:59:46 UTC (rev 20814)
@@ -27,7 +27,7 @@
var createParameters = function(type, id, arg1, arg2) {
var parameters = {};
var key = this.id + type;
- parameters[key] = ((id || "") + ":" + (arg1 ||
"") + ":" + (arg2 || true));
+ parameters[key] = (id + ":" + (arg1 || "") + ":"
+ arg2);
var eventOptions = this.options.ajaxEventOption;
for (key in eventOptions) {
Modified:
branches/RF-9323/ui/iteration/ui/src/test/java/org/richfaces/renderkit/ExtendedDataTableRendererTest.java
===================================================================
---
branches/RF-9323/ui/iteration/ui/src/test/java/org/richfaces/renderkit/ExtendedDataTableRendererTest.java 2010-12-27
16:10:14 UTC (rev 20813)
+++
branches/RF-9323/ui/iteration/ui/src/test/java/org/richfaces/renderkit/ExtendedDataTableRendererTest.java 2010-12-27
18:59:46 UTC (rev 20814)
@@ -39,7 +39,6 @@
import org.jboss.test.faces.htmlunit.HtmlUnitEnvironment;
import org.junit.After;
import org.junit.Before;
-import org.junit.Ignore;
import org.junit.Test;
import org.richfaces.component.AbstractExtendedDataTable;
import org.richfaces.component.SortOrder;
Modified:
branches/RF-9323/ui/output/ui/src/main/java/org/richfaces/component/AbstractToolbar.java
===================================================================
---
branches/RF-9323/ui/output/ui/src/main/java/org/richfaces/component/AbstractToolbar.java 2010-12-27
16:10:14 UTC (rev 20813)
+++
branches/RF-9323/ui/output/ui/src/main/java/org/richfaces/component/AbstractToolbar.java 2010-12-27
18:59:46 UTC (rev 20814)
@@ -32,7 +32,8 @@
import org.richfaces.renderkit.html.ToolbarRendererBase;
@JsfComponent(family = AbstractToolbar.COMPONENT_FAMILY, type =
AbstractToolbar.COMPONENT_TYPE,
- renderer=@JsfRenderer(type = ToolbarRendererBase.RENDERER_TYPE), tag =
@Tag(name="toolbar")
+ renderer=@JsfRenderer(type = ToolbarRendererBase.RENDERER_TYPE), tag =
@Tag(name="toolbar"),
+ attributes = {"core-props.xml"}
)
public abstract class AbstractToolbar extends UIComponentBase {
Modified:
branches/RF-9323/ui/output/ui/src/main/java/org/richfaces/component/AbstractTooltip.java
===================================================================
---
branches/RF-9323/ui/output/ui/src/main/java/org/richfaces/component/AbstractTooltip.java 2010-12-27
16:10:14 UTC (rev 20813)
+++
branches/RF-9323/ui/output/ui/src/main/java/org/richfaces/component/AbstractTooltip.java 2010-12-27
18:59:46 UTC (rev 20814)
@@ -30,7 +30,6 @@
import javax.faces.component.visit.VisitResult;
import javax.faces.context.FacesContext;
-import org.richfaces.TooltipDirection;
import org.richfaces.TooltipLayout;
import org.richfaces.TooltipMode;
import org.richfaces.context.ExtendedVisitContext;
Modified:
branches/RF-9323/ui/output/ui/src/main/java/org/richfaces/component/UITooltip.java
===================================================================
---
branches/RF-9323/ui/output/ui/src/main/java/org/richfaces/component/UITooltip.java 2010-12-27
16:10:14 UTC (rev 20813)
+++
branches/RF-9323/ui/output/ui/src/main/java/org/richfaces/component/UITooltip.java 2010-12-27
18:59:46 UTC (rev 20814)
@@ -24,7 +24,6 @@
package org.richfaces.component;
import org.richfaces.TooltipLayout;
-import org.richfaces.TooltipDirection;
import org.richfaces.TooltipMode;
/**
Modified:
branches/RF-9323/ui/output/ui/src/main/java/org/richfaces/renderkit/html/PopupPanelBaseRenderer.java
===================================================================
---
branches/RF-9323/ui/output/ui/src/main/java/org/richfaces/renderkit/html/PopupPanelBaseRenderer.java 2010-12-27
16:10:14 UTC (rev 20813)
+++
branches/RF-9323/ui/output/ui/src/main/java/org/richfaces/renderkit/html/PopupPanelBaseRenderer.java 2010-12-27
18:59:46 UTC (rev 20814)
@@ -164,7 +164,7 @@
public String getStyleIfTrimmed(UIComponent panel){
if
(panel.getAttributes().get("trimOverlayedElements").equals(Boolean.TRUE)) {
- return "position: relative, z-index : 0";
+ return "position: relative; z-index : 0;";
}
return "";
}
Modified: branches/RF-9323/ui/output/ui/src/main/resources/META-INF/pn.faces-config.xml
===================================================================
---
branches/RF-9323/ui/output/ui/src/main/resources/META-INF/pn.faces-config.xml 2010-12-27
16:10:14 UTC (rev 20813)
+++
branches/RF-9323/ui/output/ui/src/main/resources/META-INF/pn.faces-config.xml 2010-12-27
18:59:46 UTC (rev 20814)
@@ -855,7 +855,7 @@
<property>
<description></description>
<property-name>direction</property-name>
- <property-class>org.richfaces.TooltipDirection</property-class>
+
<property-class>org.richfaces.component.TooltipDirection</property-class>
</property>
<property>
<description></description>
Modified: branches/RF-9323/ui/output/ui/src/main/resources/META-INF/pn.taglib.xml
===================================================================
--- branches/RF-9323/ui/output/ui/src/main/resources/META-INF/pn.taglib.xml 2010-12-27
16:10:14 UTC (rev 20813)
+++ branches/RF-9323/ui/output/ui/src/main/resources/META-INF/pn.taglib.xml 2010-12-27
18:59:46 UTC (rev 20814)
@@ -909,7 +909,7 @@
</attribute>
<attribute>
<name>direction</name>
- <type>org.richfaces.TooltipDirection</type>
+ <type>org.richfaces.component.TooltipDirection</type>
</attribute>
<attribute>
<name>disabled</name>
Modified:
branches/RF-9323/ui/output/ui/src/main/resources/META-INF/resources/org.richfaces/collapsiblePanel.ecss
===================================================================
---
branches/RF-9323/ui/output/ui/src/main/resources/META-INF/resources/org.richfaces/collapsiblePanel.ecss 2010-12-27
16:10:14 UTC (rev 20813)
+++
branches/RF-9323/ui/output/ui/src/main/resources/META-INF/resources/org.richfaces/collapsiblePanel.ecss 2010-12-27
18:59:46 UTC (rev 20814)
@@ -7,6 +7,7 @@
}
.rf-cp-hdr{
+ cursor: pointer;
background-color:'#{richSkin.headerBackgroundColor}';
border-color:'#{richSkin.headerBackgroundColor}';
font-size:'#{richSkin.headerSizeFont}';
Modified:
branches/RF-9323/ui/output/ui/src/main/resources/META-INF/resources/org.richfaces/collapsiblePanel.js
===================================================================
---
branches/RF-9323/ui/output/ui/src/main/resources/META-INF/resources/org.richfaces/collapsiblePanel.js 2010-12-27
16:10:14 UTC (rev 20813)
+++
branches/RF-9323/ui/output/ui/src/main/resources/META-INF/resources/org.richfaces/collapsiblePanel.js 2010-12-27
18:59:46 UTC (rev 20814)
@@ -52,7 +52,7 @@
];
this.options.cycledSwitching = true;
- rf.Event.bindById(this.id + ":header", "click",
this.__onHeaderClick, this)
+ rf.Event.bindById(this.id + ":header", "click",
this.__onHeaderClick, this);
},
switchPanel : function (to) {
Modified:
branches/RF-9323/ui/output/ui/src/main/resources/META-INF/resources/org.richfaces/menu.js
===================================================================
---
branches/RF-9323/ui/output/ui/src/main/resources/META-INF/resources/org.richfaces/menu.js 2010-12-27
16:10:14 UTC (rev 20813)
+++
branches/RF-9323/ui/output/ui/src/main/resources/META-INF/resources/org.richfaces/menu.js 2010-12-27
18:59:46 UTC (rev 20814)
@@ -47,6 +47,9 @@
this), this);
rf.Event.bindById(this.id, "mouseleave", $.proxy(this.__leaveHandler,
this), this);
+ if (!rf.ui.MenuManager)
+ rf.ui.MenuManager = {};
+ this.menuManager=rf.ui.MenuManager;
};
@@ -96,7 +99,7 @@
&& !this.__isGroup(item)) {
this.invokeEvent("itemclick", rf.getDomElement(this.id),
null);
- this.hidePopup();
+ this.hide();
}
},
@@ -119,8 +122,19 @@
// }
},
+
+ show: function() {
+ this.menuManager.shutdownMenu();
+ this.__showPopup();
+ this.menuManager.addMenuId(this.id);
+ },
+
+ hide: function() {
+ this.menuManager.deletedMenuId();
+ this.__hidePopup();
+ },
- showPopup : function() {
+ __showPopup : function() {
if (!this.__isShown()) {
this.invokeEvent("show", rf.getDomElement(this.id), null);
this.popupList.show();
@@ -128,7 +142,7 @@
}
},
- hidePopup : function() {
+ __hidePopup : function() {
/*
* for (var i in this.groupList) { this.groupList[i].hide(); }
*/
@@ -155,7 +169,7 @@
___showHandler : function() {
this.showTimeoutId = window.setTimeout($.proxy(function() {
- this.showPopup();
+ this.show();
}, this), this.options.showDelay);
},
@@ -166,7 +180,7 @@
__leaveHandler : function(e) {
window.clearTimeout(this.showTimeoutId);
this.hideTimeoutId = window.setTimeout($.proxy(function() {
- this.hidePopup();
+ this.hide();
}, this), this.options.hideDelay);
},
@@ -183,4 +197,25 @@
}
};
})());
+
+ rf.ui.MenuManager = {
+ openedMenu: null,
+
+ addMenuId: function(menuId) {
+ this.openedMenu = menuId;
+
+ },
+
+ deletedMenuId: function () {
+ this.openedMenu = null;
+ },
+
+ shutdownMenu: function () {
+ if (this.openedMenu != null){
+ rf.$(rf.getDomElement(this.openedMenu)).hide();
+ }
+ this.deletedMenuId();
+ }
+
+ }
})(jQuery, RichFaces)
\ No newline at end of file
Modified:
branches/RF-9323/ui/output/ui/src/main/resources/META-INF/resources/org.richfaces/popupPanel.ecss
===================================================================
---
branches/RF-9323/ui/output/ui/src/main/resources/META-INF/resources/org.richfaces/popupPanel.ecss 2010-12-27
16:10:14 UTC (rev 20813)
+++
branches/RF-9323/ui/output/ui/src/main/resources/META-INF/resources/org.richfaces/popupPanel.ecss 2010-12-27
18:59:46 UTC (rev 20814)
@@ -65,14 +65,12 @@
z-index:100;
}
-.rf-pp-cnt-scrlr {
- position : relative;
+.rf-pp-cnt-scrlr {
top : 0px;
left : 0px;
overflow : auto;
}
-.rf-pp-cnt {
- position : relative;
+.rf-pp-cnt {
padding : 10px;
color : '#{richSkin.generalTextColor}';
font-family : '#{richSkin.generalFamilyFont}';
Modified:
branches/RF-9323/ui/validator/ui/src/main/java/org/richfaces/component/UIAjaxValidator.java
===================================================================
---
branches/RF-9323/ui/validator/ui/src/main/java/org/richfaces/component/UIAjaxValidator.java 2010-12-27
16:10:14 UTC (rev 20813)
+++
branches/RF-9323/ui/validator/ui/src/main/java/org/richfaces/component/UIAjaxValidator.java 2010-12-27
18:59:46 UTC (rev 20814)
@@ -39,8 +39,6 @@
import javax.faces.event.FacesEvent;
import javax.faces.event.PhaseId;
-import org.ajax4jsf.component.AjaxComponent;
-import org.ajax4jsf.component.AjaxSupport;
import org.ajax4jsf.context.AjaxContext;
import org.richfaces.event.ValidatorEvent;
@@ -48,7 +46,7 @@
* JSF component class
*
*/
-public abstract class UIAjaxValidator extends UIComponentBase implements AjaxComponent,
AjaxSupport, AjaxContainer {
+public abstract class UIAjaxValidator extends UIComponentBase implements AjaxContainer {
public static final String COMPONENT_TYPE = "org.richfaces.AjaxValidator";
@@ -65,6 +63,8 @@
}
}
+ public abstract String getOnsubmit();
+
/**
* @param parent
* @throws FacesException
Modified:
branches/RF-9323/ui/validator/ui/src/main/java/org/richfaces/component/UIGraphValidator.java
===================================================================
---
branches/RF-9323/ui/validator/ui/src/main/java/org/richfaces/component/UIGraphValidator.java 2010-12-27
16:10:14 UTC (rev 20813)
+++
branches/RF-9323/ui/validator/ui/src/main/java/org/richfaces/component/UIGraphValidator.java 2010-12-27
18:59:46 UTC (rev 20814)
@@ -38,8 +38,8 @@
import javax.faces.context.FacesContext;
import javax.faces.validator.Validator;
+import org.richfaces.el.CapturingELResolver;
import org.richfaces.el.ELContextWrapper;
-import org.richfaces.el.util.CapturingELResolver;
import org.richfaces.validator.FacesBeanValidator;
import org.richfaces.validator.GraphValidator;
import org.richfaces.validator.GraphValidatorState;