JBoss Rich Faces SVN: r15076 - branches/community/3.3.X/ui/beanValidator/src/test/java/org/richfaces/validator.
by richfaces-svn-commits@lists.jboss.org
Author: nbelaevski
Date: 2009-07-31 09:50:57 -0400 (Fri, 31 Jul 2009)
New Revision: 15076
Modified:
branches/community/3.3.X/ui/beanValidator/src/test/java/org/richfaces/validator/HibernateValidatorTest.java
Log:
HibernateValidatorTest fixed
Modified: branches/community/3.3.X/ui/beanValidator/src/test/java/org/richfaces/validator/HibernateValidatorTest.java
===================================================================
--- branches/community/3.3.X/ui/beanValidator/src/test/java/org/richfaces/validator/HibernateValidatorTest.java 2009-07-31 12:24:53 UTC (rev 15075)
+++ branches/community/3.3.X/ui/beanValidator/src/test/java/org/richfaces/validator/HibernateValidatorTest.java 2009-07-31 13:50:57 UTC (rev 15076)
@@ -43,6 +43,8 @@
public void setUp() throws Exception {
super.setUp();
+
+ Locale.setDefault(Locale.US);
}
public void tearDown() throws Exception {
15 years, 5 months
JBoss Rich Faces SVN: r15075 - in branches/community/3.3.X/examples/photoalbum/source/web/src/main/webapp: layout and 1 other directory.
by richfaces-svn-commits@lists.jboss.org
Author: amarkhel
Date: 2009-07-31 08:24:53 -0400 (Fri, 31 Jul 2009)
New Revision: 15075
Modified:
branches/community/3.3.X/examples/photoalbum/source/web/src/main/webapp/includes/index/footer.xhtml
branches/community/3.3.X/examples/photoalbum/source/web/src/main/webapp/includes/index/header.xhtml
branches/community/3.3.X/examples/photoalbum/source/web/src/main/webapp/layout/template.xhtml
Log:
Modified: branches/community/3.3.X/examples/photoalbum/source/web/src/main/webapp/includes/index/footer.xhtml
===================================================================
(Binary files differ)
Modified: branches/community/3.3.X/examples/photoalbum/source/web/src/main/webapp/includes/index/header.xhtml
===================================================================
(Binary files differ)
Modified: branches/community/3.3.X/examples/photoalbum/source/web/src/main/webapp/layout/template.xhtml
===================================================================
(Binary files differ)
15 years, 5 months
JBoss Rich Faces SVN: r15074 - in root/ui/trunk: components/core/src/main/java/org/ajax4jsf/component and 19 other directories.
by richfaces-svn-commits@lists.jboss.org
Author: nbelaevski
Date: 2009-07-31 07:34:48 -0400 (Fri, 31 Jul 2009)
New Revision: 15074
Added:
root/ui/trunk/components/core/src/main/java/org/ajax4jsf/renderkit/html/AjaxFunctionRenderer.java
root/ui/trunk/components/core/src/main/java/org/richfaces/component/PushEventTracker.java
root/ui/trunk/components/core/src/main/java/org/richfaces/component/PushListenersManager.java
root/ui/trunk/components/core/src/main/java/org/richfaces/resource/
root/ui/trunk/components/core/src/main/java/org/richfaces/resource/MediaOutputResource.java
root/ui/trunk/components/core/src/main/java/org/richfaces/resource/PushResource.java
root/ui/trunk/components/core/src/main/resources/META-INF/
root/ui/trunk/components/core/src/main/resources/META-INF/a4j.taglib.xml
root/ui/trunk/components/core/src/main/resources/META-INF/faces-config.xml
root/ui/trunk/components/core/src/main/resources/META-INF/org.richfaces.resource.MediaOutputResource.resource.properties
root/ui/trunk/components/core/src/main/resources/META-INF/org.richfaces.resource.PushResource.resource.properties
Removed:
root/ui/trunk/components/core/src/main/java/org/ajax4jsf/component/KeepAlive.java
root/ui/trunk/components/core/src/main/java/org/ajax4jsf/component/ResourceBundleMap.java
root/ui/trunk/components/core/src/main/java/org/ajax4jsf/component/UIAjaxCommandButton.java
root/ui/trunk/components/core/src/main/java/org/ajax4jsf/component/UIAjaxCommandLink.java
root/ui/trunk/components/core/src/main/java/org/ajax4jsf/component/UIAjaxForm.java
root/ui/trunk/components/core/src/main/java/org/ajax4jsf/component/UIAjaxRegion.java
root/ui/trunk/components/core/src/main/java/org/ajax4jsf/component/UIAjaxStatus.java
root/ui/trunk/components/core/src/main/java/org/ajax4jsf/component/UIAjaxSupport.java
root/ui/trunk/components/core/src/main/java/org/ajax4jsf/component/UIInclude.java
root/ui/trunk/components/core/src/main/java/org/ajax4jsf/component/UILoadBundle.java
root/ui/trunk/components/core/src/main/java/org/ajax4jsf/component/UIPortlet.java
root/ui/trunk/components/core/src/main/java/org/ajax4jsf/component/UIQueue.java
root/ui/trunk/components/core/src/main/java/org/ajax4jsf/component/UIRepeat.java
root/ui/trunk/components/core/src/main/java/org/ajax4jsf/component/UIResource.java
root/ui/trunk/components/core/src/main/java/org/ajax4jsf/component/html/
root/ui/trunk/components/core/src/main/java/org/ajax4jsf/renderkit/html/AjaxFormRenderer.java
root/ui/trunk/components/core/src/main/java/org/ajax4jsf/renderkit/html/AjaxIncludeRenderer.java
root/ui/trunk/components/core/src/main/java/org/ajax4jsf/renderkit/html/AjaxPageRenderer.java
root/ui/trunk/components/core/src/main/java/org/ajax4jsf/renderkit/html/AjaxPollRenderer.java
root/ui/trunk/components/core/src/main/java/org/ajax4jsf/renderkit/html/AjaxRegionRenderer.java
root/ui/trunk/components/core/src/main/java/org/ajax4jsf/renderkit/html/AjaxStatusRenderer.java
root/ui/trunk/components/core/src/main/java/org/ajax4jsf/renderkit/html/AjaxSupportRenderer.java
root/ui/trunk/components/core/src/main/java/org/ajax4jsf/renderkit/html/HtmlCommandLinkRenderer.java
root/ui/trunk/components/core/src/main/java/org/ajax4jsf/renderkit/html/QueueRenderer.java
root/ui/trunk/components/core/src/main/java/org/ajax4jsf/renderkit/html/QueueRendererData.java
root/ui/trunk/components/core/src/main/java/org/ajax4jsf/renderkit/html/RepeatRenderer.java
root/ui/trunk/components/core/src/main/java/org/ajax4jsf/renderkit/html/scripts/QueueScript.java
root/ui/trunk/components/core/src/main/java/org/ajax4jsf/renderkit/html/scripts/QueueScriptResourceRenderer.java
root/ui/trunk/components/core/src/main/java/org/ajax4jsf/taglib/html/facelets/ActionParamHandler.java
root/ui/trunk/components/core/src/main/java/org/ajax4jsf/taglib/html/facelets/AjaxListenerHandler.java
root/ui/trunk/components/core/src/main/java/org/ajax4jsf/taglib/html/facelets/AjaxSupportHandler.java
root/ui/trunk/components/core/src/main/java/org/ajax4jsf/taglib/html/facelets/FacetHandler.java
root/ui/trunk/components/core/src/main/java/org/ajax4jsf/taglib/html/facelets/IncludeFaceletContext.java
root/ui/trunk/components/core/src/main/java/org/ajax4jsf/taglib/html/facelets/IncludeHandler.java
root/ui/trunk/components/core/src/main/java/org/ajax4jsf/taglib/html/facelets/KeepAliveHandler.java
root/ui/trunk/components/core/src/main/java/org/ajax4jsf/taglib/html/facelets/MediaOutputHandler.java
root/ui/trunk/components/core/src/main/java/org/ajax4jsf/taglib/html/facelets/RowKeyConverterRule.java
root/ui/trunk/components/core/src/main/java/org/ajax4jsf/taglib/html/facelets/VariableMapperWrapper.java
root/ui/trunk/components/core/src/main/java/org/ajax4jsf/taglib/html/facelets/package-info.java
root/ui/trunk/components/core/src/main/java/org/ajax4jsf/taglib/html/jsp/ActionParamTag.java
root/ui/trunk/components/core/src/main/java/org/ajax4jsf/taglib/html/jsp/AjaxFormTag.java
root/ui/trunk/components/core/src/main/java/org/ajax4jsf/taglib/html/jsp/AjaxListenerTag.java
root/ui/trunk/components/core/src/main/java/org/ajax4jsf/taglib/html/jsp/AjaxPageTag.java
root/ui/trunk/components/core/src/main/java/org/ajax4jsf/taglib/html/jsp/AjaxRegionTag.java
root/ui/trunk/components/core/src/main/java/org/ajax4jsf/taglib/html/jsp/AjaxStatusTag.java
root/ui/trunk/components/core/src/main/java/org/ajax4jsf/taglib/html/jsp/AjaxSupportTag.java
root/ui/trunk/components/core/src/main/java/org/ajax4jsf/taglib/html/jsp/IncludeTag.java
root/ui/trunk/components/core/src/main/java/org/ajax4jsf/taglib/html/jsp/KeepAliveTag.java
root/ui/trunk/components/core/src/main/java/org/ajax4jsf/taglib/html/jsp/ServletResponseWrapperInclude.java
root/ui/trunk/components/core/src/main/java/org/ajax4jsf/taglib/html/jsp/package-info.java
root/ui/trunk/components/core/src/main/java/org/richfaces/component/html/
root/ui/trunk/components/core/src/main/java/org/richfaces/convert/
root/ui/trunk/components/core/src/main/java/org/richfaces/event/package-info.java
root/ui/trunk/components/core/src/main/java/org/richfaces/event/sort/
root/ui/trunk/components/core/src/main/java/org/richfaces/renderkit/html/gradientimages/ButtonGradientImage.java
root/ui/trunk/components/core/src/main/java/org/richfaces/renderkit/html/gradientimages/ButtonInverseGradientImage.java
root/ui/trunk/components/core/src/main/java/org/richfaces/renderkit/html/gradientimages/HeaderGradientImage.java
root/ui/trunk/components/core/src/main/java/org/richfaces/renderkit/html/gradientimages/HeaderInverseGradientImage.java
root/ui/trunk/components/core/src/main/java/org/richfaces/renderkit/html/gradientimages/InputGradientImage.java
root/ui/trunk/components/core/src/main/java/org/richfaces/renderkit/html/gradientimages/MenuGradientImage.java
root/ui/trunk/components/core/src/main/java/org/richfaces/renderkit/html/gradientimages/MenuInverseGradientImage.java
root/ui/trunk/components/core/src/main/java/org/richfaces/renderkit/html/gradientimages/TabGradientImage.java
root/ui/trunk/components/core/src/main/java/org/richfaces/renderkit/html/gradientimages/TabInverseGradientImage.java
root/ui/trunk/components/core/src/main/java/org/richfaces/renderkit/html/gradientimages/package-info.java
root/ui/trunk/components/core/src/main/java/org/richfaces/renderkit/html/iconimages/
root/ui/trunk/components/core/src/main/java/org/richfaces/renderkit/html/images/background/
root/ui/trunk/components/core/src/main/java/org/richfaces/renderkit/html/images/buttons/
root/ui/trunk/components/core/src/main/java/org/richfaces/renderkit/html/images/package-info.java
root/ui/trunk/components/core/src/main/java/org/richfaces/renderkit/html/package-info.java
root/ui/trunk/components/core/src/main/java/org/richfaces/renderkit/images/
root/ui/trunk/components/core/src/main/java/org/richfaces/renderkit/package-info.java
root/ui/trunk/components/core/src/main/java/org/richfaces/taglib/
root/ui/trunk/components/core/src/main/java/org/richfaces/ui/component/html/
root/ui/trunk/components/core/src/main/java/org/richfaces/ui/component/package-info.java
root/ui/trunk/components/core/src/main/java/org/richfaces/ui/renderkit/html/
root/ui/trunk/components/core/src/main/java/org/richfaces/ui/taglib/
root/ui/trunk/components/core/src/main/java/org/richfaces/utils/
Modified:
root/ui/trunk/components/core/src/main/java/org/ajax4jsf/component/UIPush.java
root/ui/trunk/components/core/src/main/java/org/ajax4jsf/renderkit/AjaxFunctionRendererBase.java
root/ui/trunk/components/core/src/main/java/org/ajax4jsf/renderkit/LoadResourceRendererBase.java
root/ui/trunk/components/core/src/main/java/org/ajax4jsf/renderkit/html/AjaxPushRenderer.java
root/ui/trunk/components/core/src/main/java/org/ajax4jsf/renderkit/html/MediaOutputRenderer.java
root/ui/trunk/components/core/src/main/java/org/ajax4jsf/taglib/html/facelets/AjaxPushHandler.java
root/ui/trunk/pom.xml
root/ui/trunk/version-matrix/pom.xml
Log:
Preparation for ALPHA1
Deleted: root/ui/trunk/components/core/src/main/java/org/ajax4jsf/component/KeepAlive.java
===================================================================
--- root/ui/trunk/components/core/src/main/java/org/ajax4jsf/component/KeepAlive.java 2009-07-31 11:19:57 UTC (rev 15073)
+++ root/ui/trunk/components/core/src/main/java/org/ajax4jsf/component/KeepAlive.java 2009-07-31 11:34:48 UTC (rev 15074)
@@ -1,43 +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.UIComponentBase;
-
-/**
- * @author asmirnov
- *
- */
-public class KeepAlive extends UIComponentBase {
-
- public static final String COMPONENT_TYPE = "org.ajax4jsf.KeepAlive";
- public static final String COMPONENT_FAMILY = "org.ajax4jsf.KeepAlive";
-
- /* (non-Javadoc)
- * @see javax.faces.component.UIComponent#getFamily()
- */
- @Override
- public String getFamily() {
- return COMPONENT_FAMILY;
- }
-
-}
Deleted: root/ui/trunk/components/core/src/main/java/org/ajax4jsf/component/ResourceBundleMap.java
===================================================================
--- root/ui/trunk/components/core/src/main/java/org/ajax4jsf/component/ResourceBundleMap.java 2009-07-31 11:19:57 UTC (rev 15073)
+++ root/ui/trunk/components/core/src/main/java/org/ajax4jsf/component/ResourceBundleMap.java 2009-07-31 11:34:48 UTC (rev 15074)
@@ -1,142 +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.Collection;
-import java.util.Map;
-import java.util.MissingResourceException;
-import java.util.ResourceBundle;
-import java.util.Set;
-
-import org.ajax4jsf.Messages;
-
-/**
- * Very limited Map decorator to ResourceBundle.
- * @author shura
- *
- */
-public class ResourceBundleMap implements Map<String, Object> {
-
- private ResourceBundle _bundle;
-
- /**
- * @param bundle
- */
- public ResourceBundleMap(ResourceBundle bundle) {
- super();
- _bundle = bundle;
- }
-
- /* (non-Javadoc)
- * @see java.util.Map#size()
- */
- public int size() {
- return 0;
- }
-
- /* (non-Javadoc)
- * @see java.util.Map#isEmpty()
- */
- public boolean isEmpty() {
- return false;
- }
-
- /* (non-Javadoc)
- * @see java.util.Map#containsKey(java.lang.Object)
- */
- public boolean containsKey(Object key) {
-
- try {
- _bundle.getObject(key.toString());
- return true;
- } catch (MissingResourceException e) {
- return false;
- }
- }
-
- /* (non-Javadoc)
- * @see java.util.Map#containsValue(java.lang.Object)
- */
- public boolean containsValue(Object value) {
- // TODO Auto-generated method stub
- return false;
- }
-
- /* (non-Javadoc)
- * @see java.util.Map#get(java.lang.Object)
- */
- public Object get(Object key) {
- try {
- return _bundle.getObject(key.toString());
- } catch (MissingResourceException e) {
- return key;
- }
- }
-
- /* (non-Javadoc)
- * @see java.util.Map#put(java.lang.Object, java.lang.Object)
- */
- public Object put(String arg0, Object arg1) {
- throw new UnsupportedOperationException(Messages.getMessage(Messages.BUNDLE_MAP_NO_PUT_VALUE));
- }
-
- /* (non-Javadoc)
- * @see java.util.Map#remove(java.lang.Object)
- */
- public Object remove(Object key) {
- throw new UnsupportedOperationException(Messages.getMessage(Messages.BUNDLE_MAP_NO_REMOVE_VALUE));
- }
-
-
- /* (non-Javadoc)
- * @see java.util.Map#clear()
- */
- public void clear() {
- throw new UnsupportedOperationException(Messages.getMessage(Messages.BUNDLE_MAP_NO_REMOVE_VALUE));
- }
-
- /* (non-Javadoc)
- * @see java.util.Map#keySet()
- */
- public Set<String> keySet() {
- // TODO Auto-generated method stub
- return null;
- }
-
- /* (non-Javadoc)
- * @see java.util.Map#values()
- */
- public Collection<Object> values() {
- // TODO Auto-generated method stub
- return null;
- }
-
- public Set<java.util.Map.Entry<String, Object>> entrySet() {
- // TODO Auto-generated method stub
- return null;
- }
-
- public void putAll(Map<? extends String, ? extends Object> t) {
- throw new UnsupportedOperationException(Messages.getMessage(Messages.BUNDLE_MAP_NO_PUT_VALUE));
- }
-
-}
Deleted: root/ui/trunk/components/core/src/main/java/org/ajax4jsf/component/UIAjaxCommandButton.java
===================================================================
--- root/ui/trunk/components/core/src/main/java/org/ajax4jsf/component/UIAjaxCommandButton.java 2009-07-31 11:19:57 UTC (rev 15073)
+++ root/ui/trunk/components/core/src/main/java/org/ajax4jsf/component/UIAjaxCommandButton.java 2009-07-31 11:34:48 UTC (rev 15074)
@@ -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.ajax4jsf.component;
-
-
-/**
- * @author asmirnov(a)exadel.com (latest modification by $Author: alexsmirnov $)
- * @version $Revision: 1.1.2.1 $ $Date: 2007/01/09 18:58:28 $
- *
- */
-public abstract class UIAjaxCommandButton extends AjaxActionComponent {
- public static final String COMPONENT_TYPE="org.ajax4jsf.CommandButton";
-
-}
Deleted: root/ui/trunk/components/core/src/main/java/org/ajax4jsf/component/UIAjaxCommandLink.java
===================================================================
--- root/ui/trunk/components/core/src/main/java/org/ajax4jsf/component/UIAjaxCommandLink.java 2009-07-31 11:19:57 UTC (rev 15073)
+++ root/ui/trunk/components/core/src/main/java/org/ajax4jsf/component/UIAjaxCommandLink.java 2009-07-31 11:34:48 UTC (rev 15074)
@@ -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.ajax4jsf.component;
-
-
-/**
- * @author asmirnov(a)exadel.com (latest modification by $Author: alexsmirnov $)
- * @version $Revision: 1.1.2.1 $ $Date: 2007/01/09 18:58:26 $
- *
- */
-public abstract class UIAjaxCommandLink extends AjaxActionComponent {
-
- public static final String COMPONENT_TYPE="org.ajax4jsf.CommandLink";
-}
Deleted: root/ui/trunk/components/core/src/main/java/org/ajax4jsf/component/UIAjaxForm.java
===================================================================
--- root/ui/trunk/components/core/src/main/java/org/ajax4jsf/component/UIAjaxForm.java 2009-07-31 11:19:57 UTC (rev 15073)
+++ root/ui/trunk/components/core/src/main/java/org/ajax4jsf/component/UIAjaxForm.java 2009-07-31 11:34:48 UTC (rev 15074)
@@ -1,181 +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.Iterator;
-
-import javax.faces.component.UIComponent;
-import javax.faces.component.UIForm;
-import javax.faces.context.FacesContext;
-import javax.faces.event.AbortProcessingException;
-import javax.faces.event.FacesEvent;
-
-import org.ajax4jsf.context.AjaxContext;
-import org.ajax4jsf.event.AjaxEvent;
-import org.ajax4jsf.event.AjaxListener;
-import org.ajax4jsf.event.AjaxSource;
-
-
-/**
- * Quite different from default <code>HtmlForm</code> - process child components
- * not only for submitted form, but if submitted parent <code>AjaxContainer</code>
- * @author shura (latest modification by $Author: alexsmirnov $)
- * @version $Revision: 1.1.2.3 $ $Date: 2007/02/06 16:23:22 $
- *
- */
-public abstract class UIAjaxForm extends UIForm implements AjaxComponent, AjaxSource, IterationStateHolder
-{
- public static final String COMPONENT_TYPE = "org.ajax4jsf.Form";
-
- /* (non-Javadoc)
- * @see javax.faces.component.UIComponent#processDecodes(javax.faces.context.FacesContext)
- */
- public void processDecodes(javax.faces.context.FacesContext context)
- {
- if (context == null) {
- throw new NullPointerException("context");
- }
- decode(context);
- if (mustProcessed(context))
- {
- for (Iterator<UIComponent> it = getFacetsAndChildren(); it.hasNext();)
- {
- UIComponent childOrFacet = (UIComponent) it.next();
- childOrFacet.processDecodes(context);
- }
- }
- }
-
-
- /* (non-Javadoc)
- * @see javax.faces.component.UIComponent#processValidators(javax.faces.context.FacesContext)
- */
- public void processValidators(javax.faces.context.FacesContext context)
- {
- if (context == null) throw new NullPointerException("context");
- if (mustProcessed(context))
- {
- for (Iterator<UIComponent> it = getFacetsAndChildren(); it.hasNext();)
- {
- UIComponent childOrFacet = (UIComponent) it.next();
- childOrFacet.processValidators(context);
- }
- }
- }
-
-
-
- /* (non-Javadoc)
- * @see javax.faces.component.UIComponent#processUpdates(javax.faces.context.FacesContext)
- */
- public void processUpdates(javax.faces.context.FacesContext context)
- {
- if (context == null) throw new NullPointerException("context");
- if (mustProcessed(context))
- {
- for (Iterator<UIComponent> it = getFacetsAndChildren(); it.hasNext();)
- {
- UIComponent childOrFacet = (UIComponent) it.next();
- childOrFacet.processUpdates(context);
- }
- }
- }
-
- /**
- * Test for condition processing decoders/validators/updates
- * @param context current <code>FacesContext</code>
- * @return true if submitted parent AjaxContainer or current form.
- */
- private boolean mustProcessed(FacesContext context)
- {
-// if ( !AjaxContext.getCurrentInstance(context).isAjaxRequest(context)) {
- if (!isSubmitted() ) {
- return false;
- }
-// }
- return true;
- }
-
-
- /* (non-Javadoc)
- * @see javax.faces.component.UIComponentBase#broadcast(javax.faces.event.FacesEvent)
- */
- public void broadcast(FacesEvent event) throws AbortProcessingException {
- // perform default
- super.broadcast(event);
- if (event instanceof AjaxEvent) {
- // complete re-Render fields. AjaxEvent deliver before render response.
- setupReRender();
- }
- }
-
-
- /**
- * Template methods for fill set of resions to render in subclasses.
- */
- protected void setupReRender() {
- FacesContext context = getFacesContext();
- AjaxContext.getCurrentInstance(context).addRegionsFromComponent(this);
- }
-
-
-
-
- /* (non-Javadoc)
- * @see org.ajax4jsf.framework.ajax.AjaxSource#addAjaxListener(org.ajax4jsf.framework.ajax.AjaxListener)
- */
- public void addAjaxListener(AjaxListener listener) {
- addFacesListener(listener);
- }
-
-
- /* (non-Javadoc)
- * @see org.ajax4jsf.framework.ajax.AjaxSource#getAjaxListeners()
- */
- public AjaxListener[] getAjaxListeners() {
- AjaxListener al[] = (AjaxListener [])
- getFacesListeners(AjaxListener.class);
- return (al);
-
- }
-
-
- /* (non-Javadoc)
- * @see org.ajax4jsf.framework.ajax.AjaxSource#removeAjaxListener(org.ajax4jsf.framework.ajax.AjaxListener)
- */
- public void removeAjaxListener(AjaxListener listener) {
- removeFacesListener(listener);
-
- }
-
- public abstract boolean isAjaxSubmit();
-
- public abstract void setAjaxSubmit(boolean ajax);
-
- public Object getIterationState() {
- return isSubmitted() ? Boolean.TRUE : Boolean.FALSE;
- }
-
- public void setIterationState(Object state) {
- setSubmitted(Boolean.TRUE.equals(state));
- }
-}
Deleted: root/ui/trunk/components/core/src/main/java/org/ajax4jsf/component/UIAjaxRegion.java
===================================================================
--- root/ui/trunk/components/core/src/main/java/org/ajax4jsf/component/UIAjaxRegion.java 2009-07-31 11:19:57 UTC (rev 15073)
+++ root/ui/trunk/components/core/src/main/java/org/ajax4jsf/component/UIAjaxRegion.java 2009-07-31 11:34:48 UTC (rev 15074)
@@ -1,289 +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.Iterator;
-import java.util.Set;
-
-import javax.el.MethodExpression;
-import javax.faces.component.ContextCallback;
-import javax.faces.component.UIComponent;
-import javax.faces.component.UIPanel;
-import javax.faces.context.FacesContext;
-import javax.faces.event.AbortProcessingException;
-import javax.faces.event.FacesEvent;
-
-import org.ajax4jsf.context.AjaxContext;
-import org.ajax4jsf.event.AjaxListener;
-import org.ajax4jsf.renderkit.AjaxContainerRenderer;
-
-/**
- * @author asmirnov(a)exadel.com (latest modification by $Author: alexsmirnov $)
- * @version $Revision: 1.1.2.3 $ $Date: 2007/02/08 15:02:06 $
- *
- */
-public abstract class UIAjaxRegion extends UIPanel implements AjaxContainer {
-
- private AjaxRegionBrige brige;
-
- private static final ContextCallback decodeCallback= new ContextCallback(){
- public void invokeContextCallback(FacesContext context,
- UIComponent target) {
- target.processDecodes(context);
- }
- };
-
- private static final ContextCallback validateCallback= new ContextCallback(){
- public void invokeContextCallback(FacesContext context,
- UIComponent target) {
- target.processValidators(context);
- }
- };
-
- private static final ContextCallback updateCallback= new ContextCallback(){
- public void invokeContextCallback(FacesContext context,
- UIComponent target) {
- target.processUpdates(context);
- }
- };
-
- public static final String COMPONENT_TYPE = "org.ajax4jsf.AjaxRegion";
-
- /**
- *
- */
- public UIAjaxRegion() {
- brige = new AjaxRegionBrige(this);
- }
-
- @Override
- public void processDecodes(FacesContext context) {
- AjaxContext ajaxContext = AjaxContext.getCurrentInstance(context);
- String ajaxSingleClientId = ajaxContext.getAjaxSingleClientId();
- // Process this component itself
- try {
- decode(context);
- } catch (RuntimeException e) {
- context.renderResponse();
- throw e;
- }
- if (ajaxContext.isAjaxRequest() && null != ajaxSingleClientId) {
- invokeOnComponent(context, ajaxSingleClientId, new ContextCallbackWrapper(decodeCallback));
- Set<String> areasToProcess = ajaxContext.getAjaxAreasToProcess();
- if(null != areasToProcess){
- for (String areaId : areasToProcess) {
- invokeOnComponent(context, areaId, new ContextCallbackWrapper(decodeCallback));
- }
- }
- } else {
- // Process all facets and children of this component
- Iterator<UIComponent> kids = getFacetsAndChildren();
- while (kids.hasNext()) {
- UIComponent kid = kids.next();
- kid.processDecodes(context);
- }
- }
- }
-
- @Override
- public void processValidators(FacesContext context) {
- AjaxContext ajaxContext = AjaxContext.getCurrentInstance(context);
- String ajaxSingleClientId = ajaxContext.getAjaxSingleClientId();
- if (ajaxContext.isAjaxRequest() && null != ajaxSingleClientId) {
- invokeOnComponent(context, ajaxSingleClientId, new ContextCallbackWrapper(validateCallback));
- Set<String> areasToProcess = ajaxContext.getAjaxAreasToProcess();
- if(null != areasToProcess){
- for (String areaId : areasToProcess) {
- invokeOnComponent(context, areaId, new ContextCallbackWrapper(validateCallback));
- }
- }
- } else {
- super.processValidators(context);
- }
- }
-
- @Override
- public void processUpdates(FacesContext context) {
- AjaxContext ajaxContext = AjaxContext.getCurrentInstance(context);
- String ajaxSingleClientId = ajaxContext.getAjaxSingleClientId();
- if (ajaxContext.isAjaxRequest() && null != ajaxSingleClientId) {
- invokeOnComponent(context, ajaxSingleClientId, new ContextCallbackWrapper(updateCallback));
- Set<String> areasToProcess = ajaxContext.getAjaxAreasToProcess();
- if(null != areasToProcess){
- for (String areaId : areasToProcess) {
- invokeOnComponent(context, areaId, new ContextCallbackWrapper(updateCallback));
- }
- }
- } else {
- super.processUpdates(context);
- }
- }
- /*
- * (non-Javadoc)
- *
- * @see org.ajax4jsf.framework.ajax.AjaxViewBrige#broadcast(javax.faces.event.FacesEvent)
- */
- public void broadcast(FacesEvent event) throws AbortProcessingException {
- super.broadcast(event);
- brige.broadcast(event);
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.ajax4jsf.framework.ajax.AjaxViewBrige#getAjaxListener()
- */
- public MethodExpression getAjaxListener() {
- return brige.getAjaxListener();
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.ajax4jsf.framework.ajax.AjaxViewBrige#isImmediate()
- */
- public boolean isImmediate() {
- return brige.isImmediate();
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.ajax4jsf.framework.ajax.AjaxViewBrige#isSubmitted()
- */
- public boolean isSubmitted() {
- return brige.isSubmitted();
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.ajax4jsf.framework.ajax.AjaxViewBrige#restoreState(javax.faces.context.FacesContext,
- * java.lang.Object)
- */
- public void restoreState(FacesContext context, Object state) {
- Object[] mystate = (Object[]) state;
- super.restoreState(context, mystate[0]);
- brige.restoreState(context, mystate[1]);
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.ajax4jsf.framework.ajax.AjaxViewBrige#saveState(javax.faces.context.FacesContext)
- */
- public Object saveState(FacesContext context) {
- Object[] state = new Object[2];
- state[0] = super.saveState(context);
- state[1] = brige.saveState(context);
- return state;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.ajax4jsf.framework.ajax.AjaxViewBrige#setAjaxListener(javax.faces.el.MethodBinding)
- */
- public void setAjaxListener(MethodExpression ajaxListener) {
- brige.setAjaxListener(ajaxListener);
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.ajax4jsf.framework.ajax.AjaxViewBrige#setImmediate(boolean)
- */
- public void setImmediate(boolean immediate) {
- brige.setImmediate(immediate);
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.ajax4jsf.framework.ajax.AjaxViewBrige#setSubmitted(boolean)
- */
- public void setSubmitted(boolean submitted) {
- brige.setSubmitted(submitted);
- }
-
- public void addAjaxListener(AjaxListener listener) {
- addFacesListener(listener);
- }
-
- public AjaxListener[] getAjaxListeners() {
- return (AjaxListener[]) getFacesListeners(AjaxListener.class);
- }
-
- public void removeAjaxListener(AjaxListener listener) {
- removeFacesListener(listener);
-
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.ajax4jsf.framework.ajax.AjaxViewBrige#isSelfRendered()
- */
- public boolean isSelfRendered() {
- return brige.isSelfRendered();
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.ajax4jsf.framework.ajax.AjaxViewBrige#setSelfRendered(boolean)
- */
- public void setSelfRendered(boolean selfRendered) {
- brige.setSelfRendered(selfRendered);
- }
-
- public void encodeAjax(FacesContext context) throws IOException {
- String rendererType = getRendererType();
- if (rendererType != null) {
- ((AjaxContainerRenderer) getRenderer(context)).encodeAjax(context,
- this);
- }
-
- }
-
-
- /**
- * @return
- * @see org.ajax4jsf.component.AjaxRegionBrige#isTransient()
- */
- public boolean isTransient() {
- return brige.isTransient();
- }
-
-
- /**
- * @param transientFlag
- * @see org.ajax4jsf.component.AjaxRegionBrige#setTransient(boolean)
- */
- public void setTransient(boolean transientFlag) {
- brige.setTransient(transientFlag);
- }
-
-
-
-}
Deleted: root/ui/trunk/components/core/src/main/java/org/ajax4jsf/component/UIAjaxStatus.java
===================================================================
--- root/ui/trunk/components/core/src/main/java/org/ajax4jsf/component/UIAjaxStatus.java 2009-07-31 11:19:57 UTC (rev 15073)
+++ root/ui/trunk/components/core/src/main/java/org/ajax4jsf/component/UIAjaxStatus.java 2009-07-31 11:34:48 UTC (rev 15074)
@@ -1,383 +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.Serializable;
-
-import javax.el.ELContext;
-import javax.el.ValueExpression;
-import javax.faces.FacesException;
-import javax.faces.component.UIComponent;
-import javax.faces.component.UIComponentBase;
-import javax.faces.context.FacesContext;
-
-import org.ajax4jsf.Messages;
-import org.ajax4jsf.renderkit.AjaxRendererUtils;
-import org.ajax4jsf.renderkit.RendererUtils;
-
-
-/**
- *
- * Component for create request state status area.
- * can create 2 output text areas ( <span> ) with different text and styles.
- * if defined "start" or/and "stop" facets, it's use as conttent
- * for different state.
- * By default, "start" text/facet rendered with display = none style.
- * On client side, display style changed for elements on
- * start-stop request.
- * @author shura (latest modification by $Author: alexsmirnov $)
- * @version $Revision: 1.1.2.1 $ $Date: 2007/01/09 18:58:25 $
- *
- */
-public class UIAjaxStatus extends UIComponentBase
-{
-
- private static final String COMPONENT_FAMILY = "javax.faces.Output";
- public static final String COMPONENT_TYPE = "org.ajax4jsf.AjaxStatus";
-
-
- /* (non-Javadoc)
- * @see javax.faces.component.UIComponent#getFamily()
- */
- public String getFamily()
- {
- return COMPONENT_FAMILY;
- }
-
- /**
- * id of form for wich status will displayed
- */
- private String _for = null;
-
- /**
- *
- * @param new value of id of form for wich status will displayed to set
- */
- public void setFor(String _for)
- {
- this._for = _for;
- }
-
- /**
- * @return value or result of valueBinding of id of form for wich status will displayed
- *
- */
- public String getFor()
- {
- return (String) getValueOrBinding(_for, "for");
- }
-
- /**
- * Text to output on start request
- */
- private String _startText = null;
-
- /**
- * setter method for property
- * @param new value of Text to output on start request to set
- */
- public void setStartText(String startText)
- {
- this._startText = startText;
- }
-
- /**
- * @return value or result of valueBinding of Text to output on start request
- */
- public String getStartText()
- {
- return (String) getValueOrBinding(_startText, "startText");
- }
-
- /**
- * Text to display on complete request
- */
- private String _stopText = null;
-
- /**
- * setter method for property
- * @param new value of Text to display on complete request to set
- */
- public void setStopText(String stopText)
- {
- this._stopText = stopText;
- }
-
- /**
- * @return value or result of valueBinding of Text to display on complete request
- */
- public String getStopText()
- {
- return (String) getValueOrBinding(_stopText, "stopText");
- }
- /**
- * Style for display on start request
- */
- private String _startStyle = null;
-
- /**
- * setter method for property
- * @param new value of Style for display on start request to set
- */
- public void setStartStyle(String startStyle)
- {
- this._startStyle = startStyle;
- }
-
- /**
- * @return value or result of valueBinding of Style for display on start request
- */
- public String getStartStyle()
- {
- return (String) getValueOrBinding(_startStyle, "startStyle");
- }
- /**
- * Style for displaying on complete
- */
- private String _stopStyle = null;
-
- /**
- * setter method for property
- * @param new value of Style for displaying on complete to set
- */
- public void setStopStyle(String stopStyle)
- {
- this._stopStyle = stopStyle;
- }
-
- /**
- * @return value or result of valueBinding of Style for displaying on complete
- */
- public String getStopStyle()
- {
- return (String) getValueOrBinding(_stopStyle, "stopStyle");
- }
- /**
- * Style class for display on request
- */
- private String _startStyleClass = null;
-
- /**
- * setter method for property
- * @param new value of Style class for display on request to set
- */
- public void setStartStyleClass(String startStyleClass)
- {
- this._startStyleClass = startStyleClass;
- }
-
- /**
- * @return value or result of valueBinding of Style class for display on request
- */
- public String getStartStyleClass()
- {
- return (String) getValueOrBinding(_startStyleClass, "startStyleClass");
- }
- /**
- * Style class for display on complete request
- */
- private String _stopStyleClass = null;
-
- /**
- * setter method for property
- * @param new value of Style class for display on complete request to set
- */
- public void setStopStyleClass(String stopStyleClass)
- {
- this._stopStyleClass = stopStyleClass;
- }
-
-
- /**
- * Force id to render in Html as is
- */
- private boolean _forceId = false;
- private boolean _forceIdSet = false;
-
- /**
- * setter method for property
- * @param new value of Force id to render in Html as is to set
- */
- public void setForceId(boolean forceId)
- {
- this._forceId = forceId;
- this._forceIdSet = true;
- }
-
- /**
- * @return value or result of valueBinding of Force id to render in Html as is
- */
- public boolean isForceId()
- {
- return isValueOrBinding(_forceId, _forceIdSet, "forceId");
- }
-
-
-
-
- private String _clientId = null;
-
- /* (non-Javadoc)
- * @see javax.faces.component.UIComponentBase#getClientId(javax.faces.context.FacesContext)
- */
- public String getClientId(FacesContext context) {
- if (null == _clientId) {
- String forValue = getFor();
- UIComponent container;
- if (null != forValue) {
- container = RendererUtils.getInstance().findComponentFor(this, forValue);
- // 'for' attribute must be pointed to real container in view tree
- if (null == container || !(container instanceof AjaxContainer)) {
- throw new FacesException(
- Messages.getMessage(Messages.FOR_TARGETS_NO_AJAX_CONTAINER, getId()));
- }
- _clientId = container.getClientId(context) + ":status";
-
- } else if (isForceId()) {
- _clientId = getRenderer(context).convertClientId(context,
- this.getId());
- } else if (null !=(container = (UIComponent) AjaxRendererUtils.findAjaxContainer(context,this))) {
- _clientId = container.getClientId(context) + ":status";
- } else {
- _clientId = super.getClientId(context);
- }
- }
- return _clientId;
- }
-
-
- /* (non-Javadoc)
- * reset clientId for calculate
- * @see javax.faces.component.UIComponentBase#setId(java.lang.String)
- */
- public void setId(String arg0) {
- super.setId(arg0);
- _clientId = null;
- }
-
- /* (non-Javadoc)
- * @see javax.faces.component.UIComponentBase#restoreState(javax.faces.context.FacesContext, java.lang.Object)
- */
- public void restoreState(FacesContext context, Object state)
- {
- State myState = (State) state;
- _for = myState._for;
- _startText = myState._startText;
- _stopText = myState._stopText;
- _startStyle = myState._startStyle;
- _stopStyle = myState._stopStyle;
- _startStyleClass = myState._startStyleClass;
- _stopStyleClass = myState._stopStyleClass;
- _forceId = myState._forceId;
- _forceIdSet = myState._forceIdSet;
- super.restoreState(context, myState.superState);
- }
-
- /* (non-Javadoc)
- * @see javax.faces.component.UIComponentBase#saveState(javax.faces.context.FacesContext)
- */
- public Object saveState(FacesContext context)
- {
- State state = new State();
- state._for = _for;
- state._startText = _startText;
- state._stopText = _stopText;
- state._startStyle = _startStyle;
- state._stopStyle = _stopStyle;
- state._startStyleClass = _startStyleClass;
- state._stopStyleClass = _stopStyleClass;
- state._forceId = _forceId;
- state._forceIdSet = _forceIdSet;
- state.superState = super.saveState(context);
- return state;
- }
-
- /**
- * @author shura (latest modification by $Author: alexsmirnov $)
- * @version $Revision: 1.1.2.1 $ $Date: 2007/01/09 18:58:25 $
- * Memento pattern state class for save-restore component.
- */
- public static class State implements Serializable {
- /**
- *
- */
- private static final long serialVersionUID = 317266574102385358L;
- Object superState;
- String _for;
- String _startText;
- String _stopText;
- String _startStyle;
- String _stopStyle;
- String _startStyleClass;
- String _stopStyleClass;
- boolean _forceIdSet;
- boolean _forceId;
- }
-
- /**
- * @return value or result of valueBinding of Style class for display on complete request
- */
- public String getStopStyleClass()
- {
- return (String) getValueOrBinding(_stopStyleClass, "stopStyleClass");
- }
-
- /**
- * @param field - value of field to get.
- * @param name - name of field, to get from ValueBinding
- * @return field or value of binding expression.
- */
- private Object getValueOrBinding(Object field, String name){
- if( null != field){
- return field;
- }
- ValueExpression vb = getValueExpression(name);
- if (null != vb) {
- return vb.getValue(getELContext());
- } else {
- return null;
- }
-
- }
-
- /**
- * @param field - value of field to get.
- * @param name - name of field, to get from ValueBinding
- * @return boolean value, based on field or valuebinding.
- */
- private boolean isValueOrBinding(boolean field, boolean fieldSet, String name){
- if( fieldSet ){
- return field;
- }
- ValueExpression vb = getValueExpression(name);
- if (null != vb) {
- return ((Boolean)vb.getValue(getELContext())).booleanValue();
- } else {
- return false;
- }
-
- }
-
- private ELContext getELContext() {
- return getFacesContext().getELContext();
- }
-}
Deleted: root/ui/trunk/components/core/src/main/java/org/ajax4jsf/component/UIAjaxSupport.java
===================================================================
--- root/ui/trunk/components/core/src/main/java/org/ajax4jsf/component/UIAjaxSupport.java 2009-07-31 11:19:57 UTC (rev 15073)
+++ root/ui/trunk/components/core/src/main/java/org/ajax4jsf/component/UIAjaxSupport.java 2009-07-31 11:34:48 UTC (rev 15074)
@@ -1,164 +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.ValueExpression;
-import javax.faces.FacesException;
-import javax.faces.component.UIComponent;
-import javax.faces.context.FacesContext;
-
-import org.ajax4jsf.Messages;
-import org.ajax4jsf.renderkit.AjaxRendererUtils;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-
-/**
- * Component for append ajax functions to any control component. Append action
- * functionality to non-action control, setup javascript events for parent
- * component,
- *
- * @author shura (latest modification by $Author: alexsmirnov $)
- * @version $Revision: 1.1.2.3 $ $Date: 2007/02/12 17:46:52 $
- *
- */
-public abstract class UIAjaxSupport extends AjaxActionComponent implements
- AjaxSupport {
-
- // ~ Static fields/initializers
- // ---------------------------------------------
-
- public static final String COMPONENT_TYPE = "org.ajax4jsf.Support";
- public static final String COMPONENT_FAMILY = "org.ajax4jsf.AjaxSupport";
- public static final String DEFAULT_RENDERER_TYPE = "org.ajax4jsf.components.AjaxSupportRenderer";
- public static final String AJAX_SUPPORT_SET = "com.exadel.components.ajax.support.";
- private static final Log log = LogFactory.getLog(UIAjaxSupport.class);
-
- @Override
- public void setValueExpression(String name, ValueExpression binding) {
- // var - not allowed name. must be literal.
- if ("var".equals(name)) {
- throw new FacesException(Messages.getMessage(
- Messages.VAR_MUST_BE_LITERAL,
- getClientId(getFacesContext())));
- }
- if ("event".equals(name)) {
- throw new FacesException(Messages.getMessage(
- Messages.EVENT_MUST_BE_LITERAL,
- getClientId(getFacesContext())));
- }
- super.setValueExpression(name, binding);
- }
-
- /**
- * Create Special <code>ValueBinding</code> for build JavaScrept event
- * code in parent component from this.
- *
- * @return <code>EventValueBinding</code> based on properties of current
- * component
- */
- private ValueExpression getEventValueBinding() {
- if (log.isDebugEnabled()) {
- log.debug(Messages.getMessage(Messages.CREATE_JAVASCRIPT_EVENT,
- getId()));
- }
- return new EventValueExpression(this);
- }
-
- /**
- * @return JavaScript eventString. Rebuild on every call, since can be in
- * loop ( as in dataTable ) with different parameters.
- */
- public String getEventString() {
- StringBuffer buildOnEvent = new StringBuffer();
- String onsubmit = getOnsubmit();
- // Insert script to call before submit ajax request.
- if (null != onsubmit) {
- buildOnEvent.append(onsubmit).append(";");
- }
- buildOnEvent.append(AjaxRendererUtils.buildOnEvent(this,
- getFacesContext(), getEvent(), true));
- String script = buildOnEvent.toString();
- return script;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see javax.faces.component.UIComponentBase#decode(javax.faces.context.FacesContext)
- */
- public void decode(FacesContext context) {
- // Due to JSF RI 1.1 bug, clear cached clientId
- setId(getId());
- super.decode(context);
- }
-
- /**
- * After nornal setting <code>parent</code> property in case of created
- * component set Ajax properties for parent.
- *
- * @see javax.faces.component.UIComponentBase#setParent(javax.faces.component.UIComponent)
- */
- public void setParent(UIComponent parent) {
- super.setParent(parent);
- if (null != parent && parent.getFamily() != null) {
- if (log.isDebugEnabled()) {
- log.debug(Messages.getMessage(Messages.CALLED_SET_PARENT,
- parent.getClass().getName()));
- }
- // TODO If this comopnent configured, set properties for parent
- // component.
- // NEW created component have parent, restored view - null in My
- // faces.
- // and SUN RI not call at restore saved view.
- // In other case - set in restoreState method.
- // if (parent.getParent() != null)
- {
- if (log.isDebugEnabled()) {
- log.debug(Messages
- .getMessage(Messages.DETECT_NEW_COMPONENT));
- }
- setParentProperties(parent);
-
- }
- }
- }
-
- public void setParentProperties(UIComponent parent) {
- ValueExpression valueBinding;
- if (null != getEvent()) {
- if (log.isDebugEnabled()) {
- log.debug(Messages.getMessage(
- Messages.SET_VALUE_BINDING_FOR_EVENT, getEvent()));
- }
- // for non action/data components, or for non-default events - build
- // listener for this instance.
- valueBinding = getEventValueBinding();
- parent.setValueExpression(getEvent(), valueBinding);
-
- }
- }
-
- protected UIComponent getSingleComponent() {
- return getParent();
- }
-
-}
Deleted: root/ui/trunk/components/core/src/main/java/org/ajax4jsf/component/UIInclude.java
===================================================================
--- root/ui/trunk/components/core/src/main/java/org/ajax4jsf/component/UIInclude.java 2009-07-31 11:19:57 UTC (rev 15073)
+++ root/ui/trunk/components/core/src/main/java/org/ajax4jsf/component/UIInclude.java 2009-07-31 11:34:48 UTC (rev 15074)
@@ -1,342 +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 javax.el.ELContext;
-import javax.el.ELException;
-import javax.el.ValueExpression;
-import javax.faces.FacesException;
-import javax.faces.component.NamingContainer;
-import javax.faces.component.UIComponent;
-import javax.faces.component.UIComponentBase;
-import javax.faces.context.FacesContext;
-import javax.faces.event.AbortProcessingException;
-import javax.faces.event.FacesEvent;
-import javax.faces.event.FacesListener;
-import javax.faces.event.PhaseId;
-
-import org.ajax4jsf.context.AjaxContext;
-import org.ajax4jsf.context.ViewIdHolder;
-
-/**
- * @author shura
- *
- */
-public abstract class UIInclude extends UIComponentBase implements
- ViewIdHolder, NamingContainer, AjaxOutput {
-
- public static final String COMPONENT_TYPE = "org.ajax4jsf.Include";
-
- public static final String LAYOUT_NONE ="none";
-
- public static final String LAYOUT_BLOCK ="block";
- public static final String LAYOUT_INLINE ="inline";
-
- private boolean _ajaxRendered = false;
- private boolean _ajaxRenderedSet = false;
-
- private boolean wasNavigation = false;
-
-
- /*
- * (non-Javadoc)
- *
- * @see org.ajax4jsf.framework.ajax.ViewIdHolder#skipNavigation(java.lang.String)
- */
- public boolean skipNavigation(String ViewId) {
- wasNavigation = true;
- return true;
- }
-
- private String _viewId = null;
-
- /*
- * viewId for included page. Setter for viewId @param viewId - new value
- */
- public void setViewId(String __viewId) {
- ValueExpression vb = getValueExpression("viewId");
- ELContext elContext = getELContext();
- if (null != vb && (!vb.isReadOnly(elContext))) {
- // Change value of viewId in backed bean, if possible.
- vb.setValue(elContext, __viewId);
- } else {
- this._viewId = __viewId;
- }
- }
-
- /*
- * viewId for included page. Getter for viewId @return viewId value from
- * local variable or value bindings
- */
- public String getViewId() {
- if (null != this._viewId) {
- return this._viewId;
- }
- ValueExpression vb = getValueExpression("viewId");
- if (null != vb) {
- return (String) vb.getValue(getELContext());
- } else {
- return null;
- }
- }
-
- private String _layout = null;
-
- /**
- * @return the layout
- */
- public String getLayout() {
- if (null != this._layout) {
- return this._layout;
- }
- ValueExpression vb = getValueExpression("layout");
- if (null != vb) {
- return (String) vb.getValue(getELContext());
- } else {
- return null;
- }
- }
-
- /**
- * @param layout the layout to set
- */
- public void setLayout(String layout) {
- _layout = layout;
- }
-
-
- public boolean isAjaxRendered() {
- Boolean value = null;
-
- if(this._ajaxRenderedSet) {
- return this._ajaxRendered;
- }
-
- ValueExpression ve = getValueExpression("ajaxRendered");
- if (ve != null) {
- try {
- value = (Boolean) ve.getValue(getFacesContext().getELContext());
- } catch (ELException e) {
- throw new FacesException(e);
- }
- }
-
-
- if (null == value) {
-// value = this._ajaxRendered;
- value = isWasNavigation();
- }
-
- return (!LAYOUT_NONE.equals(getLayout())) && value;
- }
-
- public void setAjaxRendered(boolean ajaxRendered) {
- this._ajaxRendered = ajaxRendered;
- this._ajaxRenderedSet = true;
- }
-
-
- /*
- * (non-Javadoc)
- *
- * @see javax.faces.component.UIComponentBase#broadcast(javax.faces.event.FacesEvent)
- */
- public void broadcast(FacesEvent event) throws AbortProcessingException {
- if (event instanceof EventWrapper) {
- FacesEvent wrapped = ((EventWrapper) event).getWrapped();
- FacesContext context = getFacesContext();
- ViewIdHolder holder = setupNavigation(context);
- wrapped.getComponent().broadcast(wrapped);
- restoreNavigation(context, holder);
- } else {
- super.broadcast(event);
- }
- }
-
- /*
- * (non-Javadoc)
- *
- * @see javax.faces.component.UIComponentBase#processDecodes(javax.faces.context.FacesContext)
- */
- public void processDecodes(FacesContext context) {
- wasNavigation = false;
- ViewIdHolder holder = setupNavigation(context);
- super.processDecodes(context);
- restoreNavigation(context, holder);
- }
-
- /*
- * (non-Javadoc)
- *
- * @see javax.faces.component.UIComponentBase#processUpdates(javax.faces.context.FacesContext)
- */
- public void processUpdates(FacesContext context) {
- ViewIdHolder holder = setupNavigation(context);
- super.processUpdates(context);
- restoreNavigation(context, holder);
- }
-
- /*
- * (non-Javadoc)
- *
- * @see javax.faces.component.UIComponentBase#processValidators(javax.faces.context.FacesContext)
- */
- public void processValidators(FacesContext context) {
- ViewIdHolder holder = setupNavigation(context);
- super.processValidators(context);
- restoreNavigation(context, holder);
- }
-
- /*
- * (non-Javadoc)
- *
- * @see javax.faces.component.UIComponentBase#queueEvent(javax.faces.event.FacesEvent)
- */
- public void queueEvent(FacesEvent event) {
- EventWrapper wrapper = new EventWrapper(this, event);
- super.queueEvent(wrapper);
- }
-
-
- /* (non-Javadoc)
- * @see javax.faces.component.UIComponentBase#restoreState(javax.faces.context.FacesContext, java.lang.Object)
- */
- public void restoreState(FacesContext context, Object state) {
- Object[] componentState = (Object[]) state;
- super.restoreState(context, componentState[0]);
- this._viewId = (String) componentState[1];
- this._layout = (String) componentState[2];
- this._ajaxRendered = ((Boolean) componentState[3]).booleanValue();
- this._ajaxRenderedSet = ((Boolean) componentState[4]).booleanValue();
- }
-
- /* (non-Javadoc)
- * @see javax.faces.component.UIComponentBase#saveState(javax.faces.context.FacesContext)
- */
- public Object saveState(FacesContext context) {
- Object[] componentState = new Object[5];
- componentState[0] = super.saveState(context);
- componentState[1] = _viewId;
- componentState[2] = _layout;
- componentState[3] = Boolean.valueOf(_ajaxRendered);
- componentState[4] = Boolean.valueOf(_ajaxRenderedSet);
- return componentState;
- }
-
- /* (non-Javadoc)
- * @see javax.faces.component.UIComponent#getFamily()
- */
- public String getFamily() {
- // TODO Auto-generated method stub
- return null;
- }
-
- private ViewIdHolder setupNavigation(FacesContext context) {
- AjaxContext ajaxContext = AjaxContext.getCurrentInstance(context);
- ViewIdHolder viewIdHolder = ajaxContext.getViewIdHolder();
- ajaxContext.setViewIdHolder(this);
- return viewIdHolder;
- }
-
- private void restoreNavigation(FacesContext context, ViewIdHolder viewIdHolder) {
- AjaxContext ajaxContext = AjaxContext.getCurrentInstance(context);
- ajaxContext.setViewIdHolder(viewIdHolder);
-// if (wasNavigation) {
-// // Clear children to avoid have different components with same id
-// getChildren().clear();
-// }
- }
-
- private ELContext getELContext() {
- return getFacesContext().getELContext();
- }
-
- @SuppressWarnings("serial")
- private static class EventWrapper extends FacesEvent {
-
- private FacesEvent wrapped;
-
- public EventWrapper(UIComponent component, FacesEvent wrapped) {
- super(component);
- this.wrapped = wrapped;
- }
-
- /**
- * @return
- * @see javax.faces.event.FacesEvent#getPhaseId()
- */
- public PhaseId getPhaseId() {
- return wrapped.getPhaseId();
- }
-
- /**
- * @param listener
- * @return
- * @see javax.faces.event.FacesEvent#isAppropriateListener(javax.faces.event.FacesListener)
- */
- public boolean isAppropriateListener(FacesListener listener) {
- return wrapped.isAppropriateListener(listener);
- }
-
- /**
- * @param listener
- * @see javax.faces.event.FacesEvent#processListener(javax.faces.event.FacesListener)
- */
- public void processListener(FacesListener listener) {
- wrapped.processListener(listener);
- }
-
- /**
- *
- * @see javax.faces.event.FacesEvent#queue()
- */
- public void queue() {
- wrapped.queue();
- }
-
- /**
- * @param phaseId
- * @see javax.faces.event.FacesEvent#setPhaseId(javax.faces.event.PhaseId)
- */
- public void setPhaseId(PhaseId phaseId) {
- wrapped.setPhaseId(phaseId);
- }
-
- /**
- * @return the wrapped
- */
- public FacesEvent getWrapped() {
- return wrapped;
- }
- }
-
- /**
- * @return the wasNavigation
- */
- public boolean isWasNavigation() {
- return wasNavigation;
- }
-
-
-}
Deleted: root/ui/trunk/components/core/src/main/java/org/ajax4jsf/component/UILoadBundle.java
===================================================================
--- root/ui/trunk/components/core/src/main/java/org/ajax4jsf/component/UILoadBundle.java 2009-07-31 11:19:57 UTC (rev 15073)
+++ root/ui/trunk/components/core/src/main/java/org/ajax4jsf/component/UILoadBundle.java 2009-07-31 11:34:48 UTC (rev 15074)
@@ -1,127 +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.Locale;
-import java.util.MissingResourceException;
-import java.util.ResourceBundle;
-
-import javax.faces.component.UIComponentBase;
-import javax.faces.component.UIViewRoot;
-import javax.faces.context.FacesContext;
-
-import org.ajax4jsf.Messages;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-
-/**
- * @author shura
- *
- */
-public abstract class UILoadBundle extends UIComponentBase implements AjaxLoadBundleComponent {
-
- public static final String COMPONENT_FAMILY = "org.ajax4jsf.Bundle";
-
- public static final String COMPONENT_TYPE = "org.ajax4jsf.Bundle";
-
- private static final Log _log = LogFactory.getLog(UILoadBundle.class);
-
- /*
- * (non-Javadoc)
- *
- * @see javax.faces.component.UIComponent#getFamily()
- */
- public String getFamily() {
- // TODO Auto-generated method stub
- return COMPONENT_FAMILY;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see javax.faces.component.UIComponentBase#encodeBegin(javax.faces.context.FacesContext)
- */
- public void encodeBegin(FacesContext context) throws IOException {
- loadBundle(context);
-
- }
-
- public void decode(FacesContext context) {
- loadBundle(context);
- }
- /**
- * @param context
- */
- public void loadBundle(FacesContext context) {
- UIViewRoot viewRoot = context.getViewRoot();
- Locale locale = viewRoot.getLocale();
- if (locale == null) {
- locale = context.getApplication().getDefaultLocale();
- }
-
- ResourceBundle bundle;
- try {
- bundle = ResourceBundle.getBundle(getBasename(), locale, Thread
- .currentThread().getContextClassLoader());
- } catch (MissingResourceException e) {
- _log.error(Messages.getMessage(Messages.COULD_NOT_LOAD_RESOURCE_BUNDLE, getBasename()));
- return;
- }
-
- context.getExternalContext().getRequestMap().put(getVar(),
- new ResourceBundleMap(bundle));
- }
-
- /*
- * (non-Javadoc)
- *
- * @see javax.faces.component.UIComponentBase#getRendererType()
- */
- public String getRendererType() {
- // TODO Auto-generated method stub
- return null;
- }
-
- /**
- * @return Returns the basename.
- */
- public abstract String getBasename();
-
- /**
- * @param basename
- * The basename to set.
- */
- public abstract void setBasename(String basename);
-
- /**
- * @return Returns the var.
- */
- public abstract String getVar();
-
- /**
- * @param var
- * The var to set.
- */
- public abstract void setVar(String var);
-
-}
Deleted: root/ui/trunk/components/core/src/main/java/org/ajax4jsf/component/UIPortlet.java
===================================================================
--- root/ui/trunk/components/core/src/main/java/org/ajax4jsf/component/UIPortlet.java 2009-07-31 11:19:57 UTC (rev 15073)
+++ root/ui/trunk/components/core/src/main/java/org/ajax4jsf/component/UIPortlet.java 2009-07-31 11:34:48 UTC (rev 15074)
@@ -1,73 +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.NamingContainer;
-import javax.faces.component.UIComponentBase;
-import javax.faces.context.FacesContext;
-
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-
-/**
- * @author asmirnov
- *
- */
-public class UIPortlet extends UIComponentBase implements NamingContainer {
-
-
- private static final Log _log = LogFactory.getLog(UIPortlet.class);
- /**
- * <p>The standard component type for this component.</p>
- */
- public static final String COMPONENT_TYPE = "org.ajax4jsf.Portlet";
-
-
- /**
- * <p>The standard component family for this component.</p>
- */
- public static final String COMPONENT_FAMILY = "org.ajax4jsf.Portlet";
-
- /* (non-Javadoc)
- * @see javax.faces.component.UIComponent#getFamily()
- */
- public String getFamily() {
- // TODO Auto-generated method stub
- return COMPONENT_FAMILY;
- }
-
- private String portletId = null;
-
- @Override
- public void setId(String id) {
- portletId = null;
- super.setId(id);
- }
-
- // ----------------------------------------------------- UIComponent Methods
- public String getClientId(FacesContext context) {
- if (portletId == null) {
- portletId = context.getExternalContext().encodeNamespace(super.getClientId(context));
- }
- return portletId;
- }
-
-}
Modified: root/ui/trunk/components/core/src/main/java/org/ajax4jsf/component/UIPush.java
===================================================================
--- root/ui/trunk/components/core/src/main/java/org/ajax4jsf/component/UIPush.java 2009-07-31 11:19:57 UTC (rev 15073)
+++ root/ui/trunk/components/core/src/main/java/org/ajax4jsf/component/UIPush.java 2009-07-31 11:34:48 UTC (rev 15074)
@@ -39,6 +39,9 @@
public abstract class UIPush extends AjaxActionComponent {
public static final String COMPONENT_TYPE="org.ajax4jsf.Push";
+
+
+ public static final String ON_DATA_AVAILABLE = "ondataavailable";
private transient boolean _submitted = false;
Deleted: root/ui/trunk/components/core/src/main/java/org/ajax4jsf/component/UIQueue.java
===================================================================
--- root/ui/trunk/components/core/src/main/java/org/ajax4jsf/component/UIQueue.java 2009-07-31 11:19:57 UTC (rev 15073)
+++ root/ui/trunk/components/core/src/main/java/org/ajax4jsf/component/UIQueue.java 2009-07-31 11:34:48 UTC (rev 15074)
@@ -1,124 +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.NamingContainer;
-import javax.faces.component.UIComponent;
-import javax.faces.component.UIComponentBase;
-import javax.faces.component.UIForm;
-import javax.faces.context.FacesContext;
-
-/**
- * @author Nick Belaevski
- * @since 3.3.0
- */
-public abstract class UIQueue extends UIComponentBase {
-
- public static final String GLOBAL_QUEUE_NAME = "org.richfaces.queue.global";
-
- public static final String COMPONENT_TYPE = "org.ajax4jsf.Queue";
-
- public static final String COMPONENT_FAMILY = "org.ajax4jsf.Queue";
-
- public abstract String getName();
- public abstract void setName(String name);
-
- public abstract String getOnsubmit();
- public abstract void setOnsubmit(String onsubmit);
-
- public abstract String getOncomplete();
- public abstract void setOncomplete(String oncomplete);
-
- public abstract String getOnbeforedomupdate();
- public abstract void setOnbeforedomupdate(String onbeforedomupdate);
-
- public abstract String getOnerror();
- public abstract void setOnerror(String onerror);
-
- public abstract String getOnsizeexceeded();
- public abstract void setOnsizeexceeded(String onsizeexceeded);
-
- public abstract boolean isDisabled();
- public abstract void setDisabled(boolean disabled);
-
- public abstract int getSize();
- public abstract void setSize(int size);
-
- public abstract String getSizeExceededBehavior();
- public abstract void setSizeExceededBehavior(String behavior);
-
- public abstract int getTimeout();
- public abstract void setTimeout(int timeout);
-
- public abstract int getRequestDelay();
- public abstract void setRequestDelay(int requestDelay);
-
- public abstract boolean isIgnoreDupResponses();
- public abstract void setIgnoreDupResponses(boolean ignoreDupResponses);
-
- public abstract String getOnrequestqueue();
- public abstract void setOnrequestqueue(String onrequestqueue);
-
- public abstract String getOnrequestdequeue();
- public abstract void setOnrequestdequeue(String onrequestdequeue);
-
- public abstract String getStatus();
- public abstract void setStatus(String status);
-
- @Override
- public String getFamily() {
- return COMPONENT_FAMILY;
- }
-
- private UIComponent findParentForm() {
- UIComponent component = getParent();
- while (component != null && !(component instanceof UIForm)) {
- component = component.getParent();
- }
-
- return component;
- }
-
- public String getClientName(FacesContext context) {
- UIComponent form = findParentForm();
- String name = getName();
- String clientName;
-
- if (form != null) {
- String formClientId = form.getClientId(context);
-
- if (name != null && name.length() != 0) {
- clientName = formClientId + NamingContainer.SEPARATOR_CHAR + name;
- } else {
- clientName = formClientId;
- }
- } else {
- if (name == null || name.length() == 0) {
- name = GLOBAL_QUEUE_NAME;
- }
-
- clientName = context.getExternalContext().encodeNamespace(name);
- }
-
- return clientName;
- }
-}
Deleted: root/ui/trunk/components/core/src/main/java/org/ajax4jsf/component/UIRepeat.java
===================================================================
--- root/ui/trunk/components/core/src/main/java/org/ajax4jsf/component/UIRepeat.java 2009-07-31 11:19:57 UTC (rev 15073)
+++ root/ui/trunk/components/core/src/main/java/org/ajax4jsf/component/UIRepeat.java 2009-07-31 11:34:48 UTC (rev 15074)
@@ -1,51 +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.Iterator;
-
-import javax.faces.component.UIComponent;
-
-
-/**
- * @author shura
- *
- */
-public class UIRepeat extends SequenceDataAdaptor {
-
- /* (non-Javadoc)
- * @see org.ajax4jsf.ajax.repeat.UIDataAdaptor#dataChildren()
- */
- protected Iterator<UIComponent> dataChildren() {
- // TODO Auto-generated method stub
- return getChildren().iterator();
- }
-
- /* (non-Javadoc)
- * @see org.ajax4jsf.ajax.repeat.UIDataAdaptor#fixedChildren()
- */
- protected Iterator<UIComponent> fixedChildren() {
- // TODO Auto-generated method stub
- return getFacets().values().iterator();
- }
-
-}
Deleted: root/ui/trunk/components/core/src/main/java/org/ajax4jsf/component/UIResource.java
===================================================================
--- root/ui/trunk/components/core/src/main/java/org/ajax4jsf/component/UIResource.java 2009-07-31 11:19:57 UTC (rev 15073)
+++ root/ui/trunk/components/core/src/main/java/org/ajax4jsf/component/UIResource.java 2009-07-31 11:34:48 UTC (rev 15074)
@@ -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.component;
-
-import javax.faces.component.UIComponentBase;
-
-/**
- * JSF component class
- *
- */
-public abstract class UIResource extends UIComponentBase {
-
- public static final String COMPONENT_TYPE = "org.ajax4jsf.Resource";
-
- public static final String COMPONENT_FAMILY = "org.ajax4jsf.Resource";
-
- /**
- * Get name of script to load
- * @parameter
- * @return the acceptClass
- */
- public abstract Object getSrc();
-
- /**
- * @param newSrc the value to set
- */
- public abstract void setSrc(Object newSrc);
-
-
-}
Modified: root/ui/trunk/components/core/src/main/java/org/ajax4jsf/renderkit/AjaxFunctionRendererBase.java
===================================================================
--- root/ui/trunk/components/core/src/main/java/org/ajax4jsf/renderkit/AjaxFunctionRendererBase.java 2009-07-31 11:19:57 UTC (rev 15073)
+++ root/ui/trunk/components/core/src/main/java/org/ajax4jsf/renderkit/AjaxFunctionRendererBase.java 2009-07-31 11:34:48 UTC (rev 15074)
@@ -21,25 +21,28 @@
package org.ajax4jsf.renderkit;
-import java.util.HashMap;
-import java.util.Iterator;
import java.util.Map;
import javax.faces.FacesException;
+import javax.faces.application.ResourceDependencies;
+import javax.faces.application.ResourceDependency;
import javax.faces.component.UIComponent;
-import javax.faces.component.UIParameter;
import javax.faces.context.FacesContext;
+import javax.faces.event.ActionEvent;
import org.ajax4jsf.component.UIAjaxFunction;
import org.ajax4jsf.javascript.JSFunction;
import org.ajax4jsf.javascript.JSFunctionDefinition;
-import org.ajax4jsf.javascript.JSReference;
-import org.ajax4jsf.javascript.ScriptUtils;
/**
* @author shura
*
*/
+@ResourceDependencies(value = {
+ @ResourceDependency(library = "javax.faces", name = "jsf.js"),
+ @ResourceDependency(name = "jquery.js"),
+ @ResourceDependency(name = "richfaces.js")
+ })
public class AjaxFunctionRendererBase extends AjaxCommandRendererBase {
/*
@@ -48,7 +51,7 @@
* @see org.ajax4jsf.renderkit.RendererBase#getComponentClass()
*/
protected Class<? extends UIComponent> getComponentClass() {
- return null;
+ return UIAjaxFunction.class;
}
public String getFunction(FacesContext context, UIAjaxFunction component) {
@@ -62,35 +65,47 @@
//func.setName(component.getName());
// Create AJAX Submit function.
JSFunction ajaxFunction = AjaxRendererUtils.buildAjaxFunction(
- component, context,AjaxRendererUtils.AJAX_FUNCTION_NAME);
- Map<String, Object> options = AjaxRendererUtils.buildEventOptions(context, component, true);
- Map<String, Object> parameters = (Map<String, Object>) options.get("parameters");
- if (null == parameters) {
- parameters = new HashMap<String, Object>();
- options.put("parameters", parameters);
- }
- ajaxFunction.addParameter(JSReference.NULL);
+ component, context, "RichFaces.ajax");
+ Map<String, Object> options = AjaxRendererUtils.buildEventOptions(context, component);
ajaxFunction.addParameter(options);
- // Fill parameters.
- for (Iterator<UIComponent> it = component.getChildren().iterator(); it.hasNext();) {
- UIComponent child = it.next();
- if (child instanceof UIParameter) {
- UIParameter parameter = ((UIParameter) child);
- String name = parameter.getName();
- func.addParameter(name);
- // Put parameter name to AJAX.Submit parameter, with default value.
- JSReference reference = new JSReference(name);
- if (null != parameter.getValue()) {
- reference = new JSReference(name + "||"
- + ScriptUtils.toScript(parameters.get(name)));
- }
- // Replace parameter value to reference.
- parameters.put(name, reference);
- }
- }
+// Map<String, Object> parameters = (Map<String, Object>) options.get("parameters");
+// if (null == parameters) {
+// parameters = new HashMap<String, Object>();
+// options.put("parameters", parameters);
+// }
+// ajaxFunction.addParameter(JSReference.NULL);
+// ajaxFunction.addParameter(options);
+// // Fill parameters.
+// for (Iterator<UIComponent> it = component.getChildren().iterator(); it.hasNext();) {
+// UIComponent child = it.next();
+// if (child instanceof UIParameter) {
+// UIParameter parameter = ((UIParameter) child);
+// String name = parameter.getName();
+// func.addParameter(name);
+// // Put parameter name to AJAX.Submit parameter, with default value.
+// JSReference reference = new JSReference(name);
+// if (null != parameter.getValue()) {
+// reference = new JSReference(name + "||"
+// + ScriptUtils.toScript(parameters.get(name)));
+//
+// }
+// // Replace parameter value to reference.
+// parameters.put(name, reference);
+// }
+// }
func.addToBody(ajaxFunction.toScript());
func.appendScript(script);
return script.toString();
}
+
+ @Override
+ protected void doDecode(FacesContext facesContext, UIComponent uiComponent) {
+ Map<String, String> requestParameterMap = facesContext.getExternalContext().getRequestParameterMap();
+ String clientId = uiComponent.getClientId(facesContext);
+
+ if (requestParameterMap.get(clientId) != null) {
+ new ActionEvent(uiComponent).queue();
+ }
+ }
}
Modified: root/ui/trunk/components/core/src/main/java/org/ajax4jsf/renderkit/LoadResourceRendererBase.java
===================================================================
--- root/ui/trunk/components/core/src/main/java/org/ajax4jsf/renderkit/LoadResourceRendererBase.java 2009-07-31 11:19:57 UTC (rev 15073)
+++ root/ui/trunk/components/core/src/main/java/org/ajax4jsf/renderkit/LoadResourceRendererBase.java 2009-07-31 11:34:48 UTC (rev 15074)
@@ -27,21 +27,22 @@
import java.util.Map;
import javax.faces.FacesException;
+import javax.faces.application.Resource;
import javax.faces.component.UIComponent;
+import javax.faces.component.UIOutput;
import javax.faces.context.FacesContext;
+import javax.faces.render.Renderer;
import org.ajax4jsf.component.UIResource;
import org.ajax4jsf.renderkit.RendererUtils.HTML;
import org.ajax4jsf.resource.InternetResource;
-import org.ajax4jsf.resource.InternetResourceBuilder;
-import org.ajax4jsf.resource.ResourceRenderer;
import org.ajax4jsf.resource.URIInternetResource;
/**
* @author shura
*
*/
-public class LoadResourceRendererBase extends RendererBase implements UserResourceRenderer2 {
+public class LoadResourceRendererBase extends RendererBase {
private static final String SCRIPT_COMPONENT_FAMILY="org.ajax4jsf.LoadScript";
private static final String STYLE_COMPONENT_FAMILY="org.ajax4jsf.LoadStyle";
@@ -54,42 +55,43 @@
}
public void encodeToHead(FacesContext context, UIComponent component) throws IOException {
- UIResource resource = (UIResource) component;
- Object src = resource.getSrc();
- if(null == src) {
- throw new FacesException("Source for resource is null for component "+resource.getClientId(context));
- }
-
- String family = resource.getFamily();
- ResourceRenderer renderer = null;
- InternetResource internetResource = null;
- Map<String, Object> attributes = Collections.emptyMap();
-
- if (SCRIPT_COMPONENT_FAMILY.equals(family)) {
- renderer = InternetResourceBuilder.getInstance().getScriptRenderer();
- } else if (STYLE_COMPONENT_FAMILY.equals(family)) {
- renderer = InternetResourceBuilder.getInstance().getStyleRenderer();
- String media = (String) resource.getAttributes().get(HTML.media_ATTRIBUTE);
- if (media != null && media.length() != 0) {
- attributes = new HashMap<String, Object>();
- attributes.put(HTML.media_ATTRIBUTE, media);
- }
- }
-
- if (src instanceof InternetResource) {
- internetResource = (InternetResource) src;
- } else {
- if(resource.isRendered()){
- String uri = context.getApplication().getViewHandler().
- getResourceURL(context, src.toString());
- uri = context.getExternalContext().encodeResourceURL(uri);
- internetResource = new URIInternetResource(uri);
- }
- }
-
- if (internetResource != null) {
- renderer.encode(internetResource, context, null, attributes);
- }
+// UIResource resource = (UIResource) component;
+// Object src = resource.getSrc();
+// if(null == src) {
+// throw new FacesException("Source for resource is null for component "+resource.getClientId(context));
+// }
+//
+// String family = resource.getFamily();
+// Renderer renderer = null;
+// InternetResource internetResource = null;
+// Map<String, Object> attributes = Collections.emptyMap();
+//
+// if (SCRIPT_COMPONENT_FAMILY.equals(family)) {
+// renderer = context.getRenderKit().getRenderer(UIOutput.COMPONENT_FAMILY, "javax.faces.resource.Script");
+// } else if (STYLE_COMPONENT_FAMILY.equals(family)) {
+// renderer = context.getRenderKit().getRenderer(UIOutput.COMPONENT_FAMILY, "javax.faces.resource.Stylesheet");
+//
+// String media = (String) resource.getAttributes().get(HTML.media_ATTRIBUTE);
+// if (media != null && media.length() != 0) {
+// attributes = new HashMap<String, Object>();
+// attributes.put(HTML.media_ATTRIBUTE, media);
+// }
+// }
+//
+// if (src instanceof Resource) {
+// internetResource = (InternetResource) src;
+// } else {
+// if(resource.isRendered()){
+// String uri = context.getApplication().getViewHandler().
+// getResourceURL(context, src.toString());
+// uri = context.getExternalContext().encodeResourceURL(uri);
+// internetResource = new URIInternetResource(uri);
+// }
+// }
+//
+// if (internetResource != null) {
+// renderer.encode(internetResource, context, null, attributes);
+// }
}
}
Deleted: root/ui/trunk/components/core/src/main/java/org/ajax4jsf/renderkit/html/AjaxFormRenderer.java
===================================================================
--- root/ui/trunk/components/core/src/main/java/org/ajax4jsf/renderkit/html/AjaxFormRenderer.java 2009-07-31 11:19:57 UTC (rev 15073)
+++ root/ui/trunk/components/core/src/main/java/org/ajax4jsf/renderkit/html/AjaxFormRenderer.java 2009-07-31 11:34:48 UTC (rev 15074)
@@ -1,342 +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.renderkit.html;
-
-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.component.UIForm;
-import javax.faces.component.UIViewRoot;
-import javax.faces.component.html.HtmlForm;
-import javax.faces.context.FacesContext;
-import javax.faces.context.ResponseWriter;
-
-import org.ajax4jsf.component.UIAjaxForm;
-import org.ajax4jsf.event.AjaxEvent;
-import org.ajax4jsf.javascript.JSFunction;
-import org.ajax4jsf.javascript.ScriptUtils;
-import org.ajax4jsf.renderkit.AjaxComponentRendererBase;
-import org.ajax4jsf.renderkit.AjaxRendererUtils;
-import org.ajax4jsf.renderkit.RendererUtils.HTML;
-import org.ajax4jsf.resource.InternetResource;
-
-/**
- * @author shura
- *
- */
-public class AjaxFormRenderer extends AjaxComponentRendererBase {
-
- public static final String FORM_SUBMIT_FUNCTION_NAME = "_JSFFormSubmit";
-
- public static final String FORM_CLEAR_FUNCTION_NAME = "_clearJSFFormParameters";
-
- private static final String FORM_HAS_COMMAND_LINK_ATTR = "com.sun.faces.FORM_HAS_COMMAND_LINK_ATTR";
-
- private static final String NO_COMMAND_LINK_FOUND_VALUE = "com.sun.faces.NO_COMMAND_LINK_FOUND";
-
- public static final String CONTENT_TYPE_IS_XHTML = "com.sun.faces"
- + "ContentTypeIsXHTML";
-
- public static final String HIDDEN_FIELD_SUFFIX = NamingContainer.SEPARATOR_CHAR
- + UIViewRoot.UNIQUE_ID_PREFIX + "cl";
-
- private static final String HIDDEN_COMMAND_INPUTS_SET_ATTR = UIForm.class
- .getName()
- + ".org.apache.myfaces.HIDDEN_COMMAND_INPUTS_SET";
-
- private static final String MYFACES_HIDDEN_FIELD_SUFFIX = NamingContainer.SEPARATOR_CHAR
- + "_link_hidden_";
-
- private InternetResource[] _scripts = { getResource("/org/ajax4jsf/javascript/scripts/form.js") };
-
- private static final String[] exclusions = { "onsubmit" };
-
- public static final String AJAX_FORM_FUNCTION_NAME = "A4J.AJAX.SubmitForm";
-
- /*
- * (non-Javadoc)
- *
- * @see org.ajax4jsf.renderkit.RendererBase#doDecode(javax.faces.context.FacesContext,
- * javax.faces.component.UIComponent)
- */
- protected void doDecode(FacesContext context, UIComponent component) {
- UIForm form = (UIForm) component;
- boolean submitted = context.getExternalContext()
- .getRequestParameterMap().containsKey(
- component.getClientId(context));
- form.setSubmitted(submitted);
- if (component instanceof UIAjaxForm) {
- UIAjaxForm ajaxForm = (UIAjaxForm) component;
- if (submitted && ajaxForm.isAjaxSubmit()) {
- component.queueEvent(new AjaxEvent(component));
- }
- }
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.ajax4jsf.renderkit.HeaderResourcesRendererBase#getScripts()
- */
- protected InternetResource[] getAdditionalScripts() {
- // TODO Auto-generated method stub
- return _scripts;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.ajax4jsf.renderkit.RendererBase#doEncodeBegin(javax.faces.context.ResponseWriter,
- * javax.faces.context.FacesContext, javax.faces.component.UIComponent)
- */
- protected void doEncodeBegin(ResponseWriter writer, FacesContext context,
- UIComponent component) throws IOException {
- String clientId = component.getClientId(context);
- writer.startElement(HTML.FORM_ELEMENT, component);
- writer.writeAttribute(HTML.id_ATTRIBUTE, clientId, null);
- writer.writeAttribute(HTML.NAME_ATTRIBUTE, clientId, null);
- writer.writeAttribute(HTML.METHOD_ATTRIBUTE, "post", null);
- getUtils().encodeAttribute(context, component, "style");
- getUtils().encodeAttribute(context, component, "class");
- getUtils().encodePassThru(context, component);
- context.getExternalContext().getRequestMap().put(
- FORM_HAS_COMMAND_LINK_ATTR, clientId);
- if (component instanceof UIAjaxForm) {
- UIAjaxForm form = (UIAjaxForm) component;
- if (form.isAjaxSubmit()) {
- StringBuffer onSubmit = new StringBuffer("javascript:");
- JSFunction ajaxFunction = AjaxRendererUtils.buildAjaxFunction(
- component, context,
- AJAX_FORM_FUNCTION_NAME);
- ajaxFunction.addParameter(AjaxRendererUtils.buildEventOptions(
- context, component, false));
- ajaxFunction.appendScript(onSubmit);
- writer.writeURIAttribute("action", onSubmit, "action");
- } else {
- encodeSubmitAction(writer, context);
- }
- } else {
- encodeSubmitAction(writer, context);
- }
- }
-
- /**
- * @param writer
- * @param context
- * @throws IOException
- */
- private void encodeSubmitAction(ResponseWriter writer, FacesContext context)
- throws IOException {
- String actionURL = getUtils().getActionUrl(context);
- String encodedActionURL = context.getExternalContext().encodeActionURL(
- actionURL);
- writer.writeURIAttribute("action", encodedActionURL, "action");
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.ajax4jsf.renderkit.RendererBase#doEncodeEnd(javax.faces.context.ResponseWriter,
- * javax.faces.context.FacesContext, javax.faces.component.UIComponent)
- */
- protected void doEncodeEnd(ResponseWriter writer, FacesContext context,
- UIComponent component) throws IOException {
- // Encode form submitting flag hidden field.
- String clientId = component.getClientId(context);
- renderHiddenInputField(writer, clientId, clientId);
- renderHiddenInputField(writer, "autoScroll", null);
- // MyFaces compability - render hidden field and Script.
- // render hidden command inputs
- Set hiddenFields = new HashSet();
- hiddenFields.add(clientId + HIDDEN_FIELD_SUFFIX);
- hiddenFields.add(clientId + MYFACES_HIDDEN_FIELD_SUFFIX);
- Set set = (Set) component.getAttributes().get(
- HIDDEN_COMMAND_INPUTS_SET_ATTR);
- if (set != null) {
- hiddenFields.addAll(set);
- }
- set = (Set) context.getExternalContext().getRequestMap().get(
- getHiddenCommandInputsSetName(context, component));
- if (set != null) {
- hiddenFields.addAll(set);
- }
- renderHiddenCommandFormParams(writer, hiddenFields);
- String target;
- if (component instanceof HtmlForm) {
- target = ((HtmlForm) component).getTarget();
- } else {
- target = (String) component.getAttributes().get(
- HTML.target_ATTRIBUTE);
- }
- renderClearHiddenCommandFormParamsFunction(writer, clientId, hiddenFields, target);
- // Script
- if (component instanceof UIAjaxForm) {
- UIAjaxForm form = (UIAjaxForm) component;
- if (form.isAjaxSubmit()) {
- renderAjaxFormSetupScript(writer, clientId);
- }
- }
- // writeFormSubmitScript(context, writer);
- getUtils().encodeEndForm(context, writer);
- context.getExternalContext().getRequestMap().put(
- FORM_HAS_COMMAND_LINK_ATTR, NO_COMMAND_LINK_FOUND_VALUE);
- }
-
- private static String getHiddenCommandInputsSetName(
- FacesContext facesContext, UIComponent form) {
- StringBuffer buf = new StringBuffer();
- buf.append(HIDDEN_COMMAND_INPUTS_SET_ATTR);
- buf.append("_");
- buf.append(form.getClientId(facesContext));
- return buf.toString();
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.ajax4jsf.renderkit.RendererBase#getComponentClass()
- */
- protected Class getComponentClass() {
- // TODO Auto-generated method stub
- return UIForm.class;
- }
-
- // For MyFaces compability - create hidden firlds and script. Code got from
- // project to simulate same functionality.
- public void renderHiddenCommandFormParams(ResponseWriter writer,
- Set formParams) throws IOException {
- for (Iterator it = formParams.iterator(); it.hasNext();) {
- Object name = it.next();
- renderHiddenInputField(writer, name, "");
- }
- }
-
- public void renderHiddenInputField(ResponseWriter writer, Object name,
- Object value) throws IOException {
- writer.startElement(HTML.INPUT_ELEM, null);
- writer.writeAttribute(HTML.TYPE_ATTR, HTML.INPUT_TYPE_HIDDEN, null);
- writer.writeAttribute(HTML.autocomplete_ATTRIBUTE, "off", null);
- writer.writeAttribute(HTML.NAME_ATTRIBUTE, name, null);
- writer.writeAttribute(HTML.value_ATTRIBUTE, value != null?value:"", null);
- writer.endElement(HTML.INPUT_ELEM);
- }
-
-
- public void renderAjaxFormSetupScript(ResponseWriter writer, String formName) throws IOException {
- writer.startElement(HTML.SCRIPT_ELEM, null);
- writer.writeAttribute(HTML.TYPE_ATTR, "text/javascript", null);
- writer.writeText("A4J.setupForm('"+formName+"');", null);
- writer.endElement(HTML.SCRIPT_ELEM);
- }
-
- /**
- * Render the javascript function that is called on a click on a commandLink
- * to clear the hidden inputs. This is necessary because on a browser back,
- * each hidden input still has it's old value (browser cache!) and therefore
- * a new submit would cause the according action once more!
- *
- * @param writer
- * @param formName
- * @param dummyFormParams
- * @param formTarget
- * @throws IOException
- */
- public void renderClearHiddenCommandFormParamsFunction(
- ResponseWriter writer, String formName, Set dummyFormParams,
- String formTarget) throws IOException {
- // render the clear hidden inputs javascript function
- String functionName = getClearHiddenCommandFormParamsFunctionName(formName);
- writer.startElement(HTML.SCRIPT_ELEM, null);
- writer.writeAttribute(HTML.TYPE_ATTR, "text/javascript", null);
-
- // Using writeComment instead of write with <!-- tag
- StringBuffer script = new StringBuffer();
- script.append("function ");
- script.append(functionName);
- script.append("() {\n");
- script.append(FORM_CLEAR_FUNCTION_NAME);
- script.append("('");
- script.append(formName);
- script.append("','");
- if (formTarget != null && formTarget.length() > 0) {
- script.append(formTarget);
- }
- script.append("'");
- if (dummyFormParams != null) {
- script.append(",[");
- for (Iterator it = dummyFormParams.iterator(); it.hasNext();) {
- script.append('\'');
- script.append((String) it.next());
- script.append('\'');
- if (it.hasNext()) {
- script.append(',');
- }
- }
- script.append("]");
- }
- script.append(");");
- script.append("\n}");
- script.append("\n");
- script.append("function ").append("clearFormHiddenParams_").append(
- ScriptUtils.getValidJavascriptName(formName));
- script.append("(){").append(functionName).append("();}\n");
- // MyFaces 1.1.5 clear form function name
-
- //equivalent for formName.replace("-", "$_")
- StringBuffer formNameReplaceBuffer = new StringBuffer(formName.length());
- int idx = -1;
- int idxA = 0;
- while ((idx = formName.indexOf('-', idxA)) != -1) {
- formNameReplaceBuffer.append(formName.substring(idxA, idx));
- formNameReplaceBuffer.append("$_");
- idxA = idx + 1;
- }
- formNameReplaceBuffer.append(formName.substring(idxA));
-
- script.append("function ").append("clearFormHiddenParams_").append(formNameReplaceBuffer.toString().
- replace(':', '_'));
- script.append("(){").append(functionName).append("();}\n");
- // Just to be sure we call this clear method on each load.
- // Otherwise in the case, that someone submits a form by pressing Enter
- // within a text input, the hidden inputs won't be cleared!
- script.append(functionName);
- script.append("();");
-
- writer.writeText(script.toString(), null);
- writer.endElement(HTML.SCRIPT_ELEM);
- }
-
- /**
- * Prefixes the given String with "clear_" and removes special characters
- *
- * @param formName
- * @return String
- */
- public String getClearHiddenCommandFormParamsFunctionName(String formName) {
- return "clear_" + ScriptUtils.getValidJavascriptName(formName);
- }
-
-}
Added: root/ui/trunk/components/core/src/main/java/org/ajax4jsf/renderkit/html/AjaxFunctionRenderer.java
===================================================================
--- root/ui/trunk/components/core/src/main/java/org/ajax4jsf/renderkit/html/AjaxFunctionRenderer.java (rev 0)
+++ root/ui/trunk/components/core/src/main/java/org/ajax4jsf/renderkit/html/AjaxFunctionRenderer.java 2009-07-31 11:34:48 UTC (rev 15074)
@@ -0,0 +1,53 @@
+/**
+ * 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.renderkit.html;
+
+import java.io.IOException;
+
+import javax.faces.component.UIComponent;
+import javax.faces.context.FacesContext;
+import javax.faces.context.ResponseWriter;
+
+import org.ajax4jsf.component.UIAjaxFunction;
+import org.ajax4jsf.renderkit.AjaxFunctionRendererBase;
+import org.ajax4jsf.renderkit.RendererUtils.HTML;
+
+/**
+ * @author Nick Belaevski
+ *
+ */
+public class AjaxFunctionRenderer extends AjaxFunctionRendererBase {
+
+ /* (non-Javadoc)
+ * @see org.ajax4jsf.renderkit.RendererBase#encodeEnd(javax.faces.context.FacesContext, javax.faces.component.UIComponent)
+ */
+ @Override
+ public void encodeEnd(FacesContext context, UIComponent component)
+ throws IOException {
+ super.encodeEnd(context, component);
+ ResponseWriter writer = context.getResponseWriter();
+ writer.startElement(HTML.SCRIPT_ELEM, component);
+ writer.writeAttribute(HTML.id_ATTRIBUTE, component.getClientId(context), "id");
+ writer.writeText(getFunction(context, (UIAjaxFunction) component), null);
+ writer.endElement(HTML.SCRIPT_ELEM);
+ }
+}
Deleted: root/ui/trunk/components/core/src/main/java/org/ajax4jsf/renderkit/html/AjaxIncludeRenderer.java
===================================================================
--- root/ui/trunk/components/core/src/main/java/org/ajax4jsf/renderkit/html/AjaxIncludeRenderer.java 2009-07-31 11:19:57 UTC (rev 15073)
+++ root/ui/trunk/components/core/src/main/java/org/ajax4jsf/renderkit/html/AjaxIncludeRenderer.java 2009-07-31 11:34:48 UTC (rev 15074)
@@ -1,97 +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.renderkit.html;
-
-import java.io.IOException;
-
-import javax.faces.component.UIComponent;
-import javax.faces.context.FacesContext;
-import javax.faces.context.ResponseWriter;
-
-import org.ajax4jsf.component.UIInclude;
-import org.ajax4jsf.renderkit.RendererBase;
-import org.ajax4jsf.renderkit.RendererUtils.HTML;
-
-/**
- * @author asmirnov(a)exadel.com (latest modification by $Author: alexsmirnov $)
- * @version $Revision: 1.1.2.1 $ $Date: 2007/02/01 15:31:25 $
- *
- */
-public class AjaxIncludeRenderer extends RendererBase {
-
- private final String[] STYLE_ATTRIBUTES = new String[] { "style", "class" };
-
- /*
- * (non-Javadoc)
- *
- * @see org.ajax4jsf.renderkit.RendererBase#getComponentClass()
- */
- protected Class getComponentClass() {
- // TODO Auto-generated method stub
- return UIInclude.class;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.ajax4jsf.renderkit.RendererBase#doEncodeBegin(javax.faces.context.ResponseWriter,
- * javax.faces.context.FacesContext, javax.faces.component.UIComponent)
- */
- protected void doEncodeBegin(ResponseWriter writer, FacesContext context,
- UIComponent component) throws IOException {
- UIInclude panel = (UIInclude) component;
- if (!UIInclude.LAYOUT_NONE.equals(panel.getLayout())) {
- writer.startElement(getTag(panel), panel);
- getUtils().encodeId(context, component);
- getUtils().encodePassThru(context, component);
- getUtils().encodeAttributesFromArray(context, component,
- STYLE_ATTRIBUTES);
-
- }
- }
-
- /**
- * @param panel
- * @return
- */
- private String getTag(UIInclude panel) {
- // TODO Auto-generated method stub
- return UIInclude.LAYOUT_BLOCK.equals(panel.getLayout()) ? HTML.DIV_ELEM
- : HTML.SPAN_ELEM;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.ajax4jsf.renderkit.RendererBase#doEncodeEnd(javax.faces.context.ResponseWriter,
- * javax.faces.context.FacesContext, javax.faces.component.UIComponent)
- */
- protected void doEncodeEnd(ResponseWriter writer, FacesContext context,
- UIComponent component) throws IOException {
- UIInclude panel = (UIInclude) component;
- if (!UIInclude.LAYOUT_NONE.equals(panel.getLayout())) {
- writer.endElement(getTag(panel));
-
- }
- }
-
-}
Deleted: root/ui/trunk/components/core/src/main/java/org/ajax4jsf/renderkit/html/AjaxPageRenderer.java
===================================================================
--- root/ui/trunk/components/core/src/main/java/org/ajax4jsf/renderkit/html/AjaxPageRenderer.java 2009-07-31 11:19:57 UTC (rev 15073)
+++ root/ui/trunk/components/core/src/main/java/org/ajax4jsf/renderkit/html/AjaxPageRenderer.java 2009-07-31 11:34:48 UTC (rev 15074)
@@ -1,237 +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.renderkit.html;
-
-import java.io.IOException;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.Locale;
-import java.util.Map;
-
-import javax.faces.component.UIComponent;
-import javax.faces.context.FacesContext;
-import javax.faces.context.ResponseWriter;
-
-import org.ajax4jsf.component.AjaxContainer;
-import org.ajax4jsf.context.AjaxContext;
-import org.ajax4jsf.renderkit.AjaxContainerRenderer;
-import org.ajax4jsf.renderkit.RendererUtils.HTML;
-import org.ajax4jsf.webapp.BaseFilter;
-
-/**
- * @author shura
- *
- * Render full Html page for AJAX view. Facet "head" rendered in <head> of
- * page.
- */
-public class AjaxPageRenderer extends AjaxContainerRenderer {
-
- public static final String RENDERER_TYPE = "org.ajax4jsf.components.AjaxPageRenderer";
-
- private static final Map doctypes ;
-
- static {
- // Fill doctype, content-type and namespace map for different formats.
- doctypes = new HashMap();
- doctypes
- .put(
- "html-transitional",
- new String[] {
- "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\">\n",
- "text/html", null });
- doctypes.put("html", new String[] {
- "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01//EN\"\n"
- + "\"http://www.w3.org/TR/html4/strict.dtd\">\n",
- "text/html", null });
- doctypes.put("html-frameset", new String[] {
- "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 Frameset//EN\"\n"
- + "\"http://www.w3.org/TR/html4/frameset.dtd\">\n",
- "text/html", null });
- doctypes
- .put(
- "xhtml",
- new String[] {
- "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Strict//EN\"\n"
- + "\"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd\">\n",
- "application/xhtml+xml",
- "http://www.w3.org/1999/xhtml" });
- doctypes
- .put(
- "xhtml-transitional",
- new String[] {
- "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\"\n"
- + "\"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\">\n",
- "application/xhtml+xml",
- "http://www.w3.org/1999/xhtml" });
- doctypes
- .put(
- "xhtml-frameset",
- new String[] {
- "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Frameset//EN\"\n"
- + "\"http://www.w3.org/TR/xhtml1/DTD/xhtml1-frameset.dtd\">\n",
- "application/xhtml+xml",
- "http://www.w3.org/1999/xhtml" });
- doctypes.put("html-3.2", new String[] {
- "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 3.2 Final//EN\">\n",
- "text/html", null });
- }
-
- // private PreparedTemplate pageStyles =
- // HtmlCompiler.compileResource("com/exadel/vcp/renderers/templates/ajax/page-styles.xml");
- protected void preEncodeBegin(FacesContext context, UIComponent component)
- throws IOException {
- // Scripts must be encoded in component, not before html element
- }
-
- /*
- * (non-Javadoc)
- *
- * @see javax.faces.render.Renderer#encodeBegin(javax.faces.context.FacesContext,
- * javax.faces.component.UIComponent)
- */
- public void doEncodeBegin(ResponseWriter out, FacesContext context,
- UIComponent component) throws IOException {
- AjaxContainer ajax = (AjaxContainer) component;
- // ServletResponse response = (ServletResponse)
- // context.getExternalContext().getResponse();
- Map attributes = component.getAttributes();
- String format = (String) attributes.get("format");
- String contentType = null;
- String namespace = null;
- // String characterEncoding = out.getCharacterEncoding();
- String[] docType = null;
- if (null != format) {
- docType = (String[]) doctypes.get(format);
- } else {
- contentType = out.getContentType();
- for (Iterator iterator = doctypes.values().iterator(); iterator.hasNext();) {
- String[] types = (String[]) iterator.next();
- if(types[1].equals(contentType)){
- docType = types;
- break;
- }
- }
- }
- if (null != docType) {
- contentType = docType[1];
- namespace = docType[2];
- out.write(docType[0]);
- }
- if (null == contentType) {
- contentType = (String) attributes.get("contentType");
- }
- if (null != contentType) {
- // response.setContentType(contentType /*+ ";charset=" +
- // characterEncoding*/);
- }
- // TODO - create "format" attribute and insert properly DOCTYPE
- // declaratiom
- out.startElement("html", component);
- if (null == namespace) {
- namespace = (String) attributes.get("namespace");
- }
- if (null != namespace) {
- out.writeAttribute("xmlns", namespace, "namespace");
- }
- // TODO - html attributes. lang - from current locale ?
- Locale locale = context.getViewRoot().getLocale();
- out.writeAttribute(HTML.lang_ATTRIBUTE, locale.toString(), "lang");
- if (!AjaxContext.getCurrentInstance(context).isAjaxRequest()) {
- out.startElement("head", component);
- // Out title - requied html element.
- Object title = attributes.get("pageTitle");
- String viewId = context.getViewRoot().getViewId();
- if (null == title) {
- title = viewId;// use viewId for empty title
- }
- out.startElement(HTML.title_ELEM, component);
- out.writeText(title, "pageTitle");
- out.endElement(HTML.title_ELEM);
- // Page base - set to current view action url.
- // String pageBase =
- // context.getApplication().getViewHandler().getActionURL(context,
- // viewId);
- // out.startElement("base", component);
- // out.writeURIAttribute("href", pageBase, "pageBase");
- // out.endElement("base");
- // pageStyles.encode(this, context, component);
- UIComponent headFacet = component.getFacet("head");
- if (headFacet != null) {
- // context.getExternalContext().log("Render head facet in AJAX
- // Page");
- renderChild(context, headFacet);
- }
- if (null != contentType) {
- out.startElement("meta", component);
- out.writeAttribute("http-equiv", "Content-Type", null);
- out.writeAttribute("content",
- contentType /* + ";charset=" + characterEncoding */,
- null);
- out.endElement("meta");
- }
- if ((null == context.getExternalContext().getRequestMap().get(
- BaseFilter.RESPONSE_WRAPPER_ATTRIBUTE))) {
- // Filter not used - encode scripts and CSS before component.
- encodeResourcesArray(context, component, getScripts());
- encodeResourcesArray(context, component, getStyles());
- }
- out.endElement("head");
- }
- out.startElement("body", component);
- getUtils().encodePassThru(context, component);
- getUtils().encodeAttributesFromArray(context, component,
- HTML.PASS_THRU_STYLES);
- // TODO - special body attributes :
- getUtils().encodeAttribute(context, component, "onload");
- getUtils().encodeAttribute(context, component, "onunload");
- // onload, onunload
- }
-
- /*
- * (non-Javadoc)
- *
- * @see javax.faces.render.Renderer#encodeEnd(javax.faces.context.FacesContext,
- * javax.faces.component.UIComponent)
- */
- public void doEncodeEnd(ResponseWriter out, FacesContext context,
- UIComponent component) throws IOException {
- out.endElement("body");
- out.endElement("html");
- // DebugUtils.traceView("ViewRoot in AJAX Page encode end");
- }
-
- /*
- * (non-Javadoc) For ajax requests, ViewRoot render childrens directly.
- *
- * @see org.ajax4jsf.renderkit.AjaxContainerRenderer#getRendersChildren()
- */
- public boolean getRendersChildren() {
- FacesContext context = FacesContext.getCurrentInstance();
- if (AjaxContext.getCurrentInstance(context).isAjaxRequest()) {
- // Ajax Request. Control all output.
- return true;
- }
- // For non Ajax request, view root not render children
- return false;
- }
-
-}
Deleted: root/ui/trunk/components/core/src/main/java/org/ajax4jsf/renderkit/html/AjaxPollRenderer.java
===================================================================
--- root/ui/trunk/components/core/src/main/java/org/ajax4jsf/renderkit/html/AjaxPollRenderer.java 2009-07-31 11:19:57 UTC (rev 15073)
+++ root/ui/trunk/components/core/src/main/java/org/ajax4jsf/renderkit/html/AjaxPollRenderer.java 2009-07-31 11:34:48 UTC (rev 15074)
@@ -1,100 +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.renderkit.html;
-
-import java.io.IOException;
-import java.util.Map;
-
-import javax.faces.component.UIComponent;
-import javax.faces.context.FacesContext;
-import javax.faces.context.ResponseWriter;
-
-import org.ajax4jsf.component.UIPoll;
-import org.ajax4jsf.javascript.JSFunction;
-import org.ajax4jsf.javascript.JSFunctionDefinition;
-import org.ajax4jsf.renderkit.AjaxCommandRendererBase;
-import org.ajax4jsf.renderkit.AjaxRendererUtils;
-import org.ajax4jsf.renderkit.RendererUtils.HTML;
-
-/**
- * @author shura
- *
- */
-public class AjaxPollRenderer extends AjaxCommandRendererBase {
-
-
-
- private static final String AJAX_POLL_FUNCTION = "A4J.AJAX.Poll";
-
- /* (non-Javadoc)
- * @see org.ajax4jsf.renderkit.RendererBase#doEncodeEnd(javax.faces.context.ResponseWriter, javax.faces.context.FacesContext, javax.faces.component.UIComponent)
- */
- protected void doEncodeEnd(ResponseWriter writer, FacesContext context, UIComponent component) throws IOException {
- UIPoll poll = (UIPoll) component;
- writer.startElement(HTML.SPAN_ELEM, component);
- writer.writeAttribute(HTML.style_ATTRIBUTE, "display:none;", null);
- getUtils().encodeId(context, component);
- // polling script.
- writer.startElement(HTML.SCRIPT_ELEM, component);
- writer.writeAttribute(HTML.TYPE_ATTR, "text/javascript", null);
- StringBuffer script = new StringBuffer("\n");
- if(poll.isEnabled()){
- JSFunction function = AjaxRendererUtils.buildAjaxFunction(component, context, AJAX_POLL_FUNCTION);
- Map options = AjaxRendererUtils.buildEventOptions(context, component, true);
- Integer interval = new Integer(poll.getInterval());
- options.put("pollinterval", interval);
- options.put("pollId", component.getClientId(context));
- Object onsubmit = component.getAttributes().get("onsubmit");
- if (null != onsubmit) {
- JSFunctionDefinition onsubmitFunction = new JSFunctionDefinition();
- onsubmitFunction.addToBody(onsubmit);
- options.put("onsubmit", onsubmitFunction);
- }
-
-// options.put("timeout", interval);
- function.addParameter(options);
- function.appendScript(script);
- } else {
- script.append("A4J.AJAX.StopPoll('").append(component.getClientId(context)).append("')");
- }
- script.append(";\n");
- writer.writeText(script.toString(),null);
- writer.endElement(HTML.SCRIPT_ELEM);
- writer.endElement(HTML.SPAN_ELEM);
- }
-
- /* (non-Javadoc)
- * @see org.ajax4jsf.renderkit.RendererBase#getComponentClass()
- */
- protected Class getComponentClass() {
- // only poll component is allowed.
- return UIPoll.class;
- }
-
- protected boolean isSubmitted(FacesContext facesContext, UIComponent uiComponent) {
- boolean submitted = super.isSubmitted(facesContext, uiComponent);
- UIPoll poll = (UIPoll) uiComponent;
- poll.setSubmitted(submitted);
- return submitted;
- }
-
-}
Modified: root/ui/trunk/components/core/src/main/java/org/ajax4jsf/renderkit/html/AjaxPushRenderer.java
===================================================================
--- root/ui/trunk/components/core/src/main/java/org/ajax4jsf/renderkit/html/AjaxPushRenderer.java 2009-07-31 11:19:57 UTC (rev 15073)
+++ root/ui/trunk/components/core/src/main/java/org/ajax4jsf/renderkit/html/AjaxPushRenderer.java 2009-07-31 11:34:48 UTC (rev 15074)
@@ -22,35 +22,45 @@
package org.ajax4jsf.renderkit.html;
import java.io.IOException;
+import java.util.HashMap;
import java.util.Map;
+import javax.faces.application.ResourceDependencies;
+import javax.faces.application.ResourceDependency;
import javax.faces.component.UIComponent;
+import javax.faces.component.behavior.ClientBehavior;
+import javax.faces.component.behavior.ClientBehaviorContext;
import javax.faces.context.FacesContext;
import javax.faces.context.ResponseWriter;
import org.ajax4jsf.component.UIPush;
import org.ajax4jsf.javascript.JSFunction;
-import org.ajax4jsf.renderkit.AjaxCommandRendererBase;
-import org.ajax4jsf.renderkit.AjaxRendererUtils;
-import org.ajax4jsf.renderkit.RendererUtils;
+import org.ajax4jsf.javascript.JSFunctionDefinition;
+import org.ajax4jsf.renderkit.RendererBase;
import org.ajax4jsf.renderkit.RendererUtils.HTML;
/**
* @author shura
*
*/
-public class AjaxPushRenderer extends AjaxCommandRendererBase {
-
+@ResourceDependencies(value = {
+ @ResourceDependency(library = "javax.faces", name = "jsf.js"),
+ @ResourceDependency(name = "jquery.js"),
+ @ResourceDependency(name = "richfaces.js")
+})
+public class AjaxPushRenderer extends RendererBase {
+
public static final String PUSH_INTERVAL_PARAMETER = "A4J.AJAX.Push.INTERVAL";
public static final String PUSH_WAIT_PARAMETER = "A4J.AJAX.Push.WAIT";
+ @Deprecated
public static final String PUSH_URL_PARAMETER = "A4J.AJAX.Push.URL";
public static final int DEFAULT_PUSH_INTERVAL = 1000;
public static final int DEFAULT_PUSH_WAIT = Integer.MIN_VALUE;
-
+
private static final String AJAX_PUSH_FUNCTION = "A4J.AJAX.Push";
/* (non-Javadoc)
@@ -61,40 +71,41 @@
writer.startElement(HTML.SPAN_ELEM, component);
writer.writeAttribute(HTML.style_ATTRIBUTE, "display:none;", null);
getUtils().encodeId(context, component);
+
+ //TODO - ?
getUtils().encodeBeginFormIfNessesary(context, component);
- // pushing script.
- writer.startElement(HTML.SCRIPT_ELEM, component);
- writer.writeAttribute(HTML.TYPE_ATTR, "text/javascript", null);
- StringBuffer script = new StringBuffer("\n");
- if(push.isEnabled()){
- JSFunction function = AjaxRendererUtils.buildAjaxFunction(component, context, AJAX_PUSH_FUNCTION);
- // Set dummy form id, if nessesary.
- Map<String, Object> options = AjaxRendererUtils.buildEventOptions(context, component, false);
- options.put("dummyForm", component.getClientId(context)+RendererUtils.DUMMY_FORM_ID);
- int interval = push.getInterval();
- if(interval == Integer.MIN_VALUE){
- String intervalInitParameter = context.getExternalContext().getInitParameter(PUSH_INTERVAL_PARAMETER);
- if(null != intervalInitParameter){
+ // pushing script.
+ writer.startElement(HTML.SCRIPT_ELEM, component);
+ writer.writeAttribute(HTML.TYPE_ATTR, "text/javascript", null);
+ StringBuffer script = new StringBuffer("\n");
+ if (push.isEnabled()) {
+ JSFunction function = new JSFunction("RichFaces.startPush");
+ // Set dummy form id, if nessesary.
+ Map<String, Object> options = new HashMap<String, Object>();
+
+ int interval = push.getInterval();
+ if (!getUtils().shouldRenderAttribute(interval)) {
+ String intervalInitParameter = context.getExternalContext().getInitParameter(PUSH_INTERVAL_PARAMETER);
+ if(null != intervalInitParameter){
interval = Integer.parseInt(intervalInitParameter);
- } else {
+ } else {
interval = DEFAULT_PUSH_INTERVAL;
- }
}
- options.put("pushinterval", new Integer(interval));
- options.put("pushId", push.getListenerId(context));
- String pushUrl = context.getExternalContext().getInitParameter(PUSH_URL_PARAMETER);
- if(null != pushUrl){
- options.put("pushUrl", pushUrl);
- }
- // options.put("timeout", interval);
- function.addParameter(options);
- function.appendScript(script);
- } else {
- script.append("A4J.AJAX.StopPush('").append(push.getListenerId(context)).append("')");
- }
- script.append(";\n");
- writer.writeText(script.toString(),null);
- writer.endElement(HTML.SCRIPT_ELEM);
+ }
+
+ options.put("interval", new Integer(interval));
+ options.put("pushId", push.getListenerId(context));
+ ClientBehaviorContext behaviorContext = ClientBehaviorContext.createClientBehaviorContext(context, push, push.getDefaultEventName(), push.getClientId(context), null);
+ ClientBehavior clientBehavior = push.getClientBehaviors().get(push.getDefaultEventName()).get(0);
+ options.put(UIPush.ON_DATA_AVAILABLE, new JSFunctionDefinition("event").addToBody(clientBehavior.getScript(behaviorContext)));
+ function.addParameter(options);
+ script.append(function.toScript());
+ } else {
+ script.append("RichFaces.stopPush('").append(push.getListenerId(context)).append("')");
+ }
+ script.append(";\n");
+ writer.writeText(script.toString(),null);
+ writer.endElement(HTML.SCRIPT_ELEM);
getUtils().encodeEndFormIfNessesary(context, component);
writer.endElement(HTML.SPAN_ELEM);
}
@@ -102,16 +113,16 @@
/* (non-Javadoc)
* @see org.ajax4jsf.renderkit.RendererBase#getComponentClass()
*/
- protected Class getComponentClass() {
+ protected Class<? extends UIComponent> getComponentClass() {
// only push component is allowed.
return UIPush.class;
}
-
- protected boolean isSubmitted(FacesContext facesContext, UIComponent uiComponent) {
- boolean submitted = super.isSubmitted(facesContext, uiComponent);
- UIPush push = (UIPush) uiComponent;
- push.setSubmitted(submitted);
- return submitted;
- }
+// protected boolean isSubmitted(FacesContext facesContext, UIComponent uiComponent) {
+// boolean submitted = super.isSubmitted(facesContext, uiComponent);
+// UIPush push = (UIPush) uiComponent;
+// push.setSubmitted(submitted);
+// return submitted;
+// }
+
}
Deleted: root/ui/trunk/components/core/src/main/java/org/ajax4jsf/renderkit/html/AjaxRegionRenderer.java
===================================================================
--- root/ui/trunk/components/core/src/main/java/org/ajax4jsf/renderkit/html/AjaxRegionRenderer.java 2009-07-31 11:19:57 UTC (rev 15073)
+++ root/ui/trunk/components/core/src/main/java/org/ajax4jsf/renderkit/html/AjaxRegionRenderer.java 2009-07-31 11:34:48 UTC (rev 15074)
@@ -1,58 +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.renderkit.html;
-
-import java.io.IOException;
-
-import javax.faces.component.UIComponent;
-import javax.faces.context.FacesContext;
-import javax.faces.context.ResponseWriter;
-
-import org.ajax4jsf.renderkit.AjaxContainerRenderer;
-
-
-/**
- * @author asmirnov(a)exadel.com (latest modification by $Author: alexsmirnov $)
- * @version $Revision: 1.1.2.1 $ $Date: 2007/02/01 15:31:28 $
- *
- */
-public class AjaxRegionRenderer extends AjaxContainerRenderer {
-
- public static final String RENDERER_TYPE = "org.ajax4jsf.components.AjaxRegionRenderer";
-
- /* (non-Javadoc)
- * @see org.ajax4jsf.renderkit.RendererBase#doEncodeBegin(javax.faces.context.ResponseWriter, javax.faces.context.FacesContext, javax.faces.component.UIComponent)
- */
- protected void doEncodeBegin(ResponseWriter writer, FacesContext context, UIComponent component) throws IOException {
-// AjaxRendererUtils.encodeClientScript(context,component);
- }
-
- /* (non-Javadoc)
- * @see org.ajax4jsf.renderkit.RendererBase#doEncodeEnd(javax.faces.context.ResponseWriter, javax.faces.context.FacesContext, javax.faces.component.UIComponent)
- */
- protected void doEncodeEnd(ResponseWriter writer, FacesContext context, UIComponent component) throws IOException {
-// if (((AjaxContainer) component).isAjaxRequest()) {
-// AjaxRendererUtils.encodeAreas(context,component);
-// }
- }
-
-}
Deleted: root/ui/trunk/components/core/src/main/java/org/ajax4jsf/renderkit/html/AjaxStatusRenderer.java
===================================================================
--- root/ui/trunk/components/core/src/main/java/org/ajax4jsf/renderkit/html/AjaxStatusRenderer.java 2009-07-31 11:19:57 UTC (rev 15073)
+++ root/ui/trunk/components/core/src/main/java/org/ajax4jsf/renderkit/html/AjaxStatusRenderer.java 2009-07-31 11:34:48 UTC (rev 15074)
@@ -1,167 +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.renderkit.html;
-
-import java.io.IOException;
-
-import javax.faces.component.UIComponent;
-import javax.faces.context.FacesContext;
-import javax.faces.context.ResponseWriter;
-
-import org.ajax4jsf.component.UIAjaxStatus;
-import org.ajax4jsf.javascript.JSFunctionDefinition;
-import org.ajax4jsf.renderkit.RendererBase;
-import org.ajax4jsf.renderkit.RendererUtils.HTML;
-
-
-/**
- * @author shura (latest modification by $Author: alexsmirnov $)
- * @version $Revision: 1.1.2.2 $ $Date: 2007/02/19 11:17:10 $
- *
- * Render status component as two span's, one for start request,
- * one for complete.
- */
-public class AjaxStatusRenderer extends RendererBase
-{
- /**
- *
- */
- public static final String RENDERER_TYPE = "org.ajax4jsf.components.AjaxStatusRenderer";
-
- /**
- *
- */
- public static final String START_STYLE = "display: none";
-
- /* (non-Javadoc)
- * @see javax.faces.render.Renderer#encodeEnd(javax.faces.context.FacesContext, javax.faces.component.UIComponent)
- */
- public void doEncodeEnd(ResponseWriter writer, FacesContext context, UIComponent component) throws IOException
- {
- // find form clientId for wich we render status.
- String statusId = component.getClientId(context);
- String tag = getTag(component);
- writer.startElement(tag, component);
- writer.writeAttribute(HTML.id_ATTRIBUTE, statusId , null);
- // render 2 span components for different states
- encodeSpan(writer, context, component,statusId, "start", tag);
- encodeSpan(writer, context, component,statusId, "stop", tag);
- writer.endElement(tag);
- }
-
- /**
- * Encode one span for start or stop status
- * @param context - current context
- * @param component - status component
- * @param state - name of state ( start or stop ) for span.
- * @param tag TODO
- * @throws IOException
- */
- protected void encodeSpan(ResponseWriter writer, FacesContext context, UIComponent component, String id, String state, String tag) throws IOException {
- writer.startElement(tag, component);
- String spanId = id+"."+state;
- writer.writeAttribute(HTML.id_ATTRIBUTE, spanId , null);
- // Styles for concrete state.
- String style = getNamedAttribute(component, "Style", state);
- // for start state rendered style always disable display of status
- // ( since it will enabled by JavaScript on start request )
- if("start".equals(state)) {
- if(null == style) {
- style = START_STYLE;
- } else {
- style += "; "+START_STYLE;
- }
- }
-// HtmlRendererUtils.renderHTMLAttribute(writer, "style", "style", style );
-// HtmlRendererUtils.renderHTMLAttribute(writer, "styleClass", "styleClass", getNamedAttribute(component, "StyleClass", state));
- if (null != style) {
- writer.writeAttribute("style", style, null);
- }
- String styleClass = getNamedAttribute(component, "StyleClass", state);
- if(null != styleClass){
- writer.writeAttribute("class", styleClass, null);
- }
-// getUtils().encodeAttribute(context,component,"class");
- getUtils().encodePassThru(context , component);
- // render facet or text.
- UIComponent facet = component.getFacet(state);
- if(null != facet) {
- renderChild(context, facet);
- } else {
- String namedAttribute = getNamedAttribute(component, "Text", state);
- if (null != namedAttribute) {
- writer.writeText(namedAttribute, "text");
- }
-// else {
-// throw new FacesException("Status component must have one of '"+state+"' facet or '"+state+"Text' atribute");
-// }
- }
- writer.endElement(tag);
- // ENCODE onstart/onstop javaScript.
- Object eventHandler = component.getAttributes().get("on"+state);
- if(null != eventHandler){
- StringBuffer script = new StringBuffer("\n");
- script.append("window.document.getElementById('").append(spanId).append("').on").append(state).append("=");
- JSFunctionDefinition function = new JSFunctionDefinition();
- function.addToBody(eventHandler).addToBody(";").appendScript(script);
- script.append(";\n");
- getUtils().writeScript(context, component, script);
- }
- }
-
- /**
- * @param component
- * @param name name of attribute for current state
- * @param state 'start' or 'stop' . all dublicated attributes foe Ajax state
- * have same syntax : startStyle/stopStyle ...
- * @return value of attribute for name and state
- */
- protected String getNamedAttribute(UIComponent component, String name, String state)
- {
- String fullName = (new StringBuffer(state).append(name)).toString();
- return (String) component.getAttributes().get(fullName);
- }
-
- protected Class getComponentClass() {
- // TODO Auto-generated method stub
- return UIAjaxStatus.class;
- }
-
- /**
- * @param status
- * @return
- */
- private String getTag(UIComponent status) {
- // TODO Auto-generated method stub
- return "block".equals(status.getAttributes().get("layout"))?HTML.DIV_ELEM:HTML.SPAN_ELEM;
- }
-
- /* (non-Javadoc)
- * @see javax.faces.render.Renderer#getRendersChildren()
- */
- public boolean getRendersChildren() {
- // TODO Auto-generated method stub
- return true;
- }
-
-
-}
Deleted: root/ui/trunk/components/core/src/main/java/org/ajax4jsf/renderkit/html/AjaxSupportRenderer.java
===================================================================
--- root/ui/trunk/components/core/src/main/java/org/ajax4jsf/renderkit/html/AjaxSupportRenderer.java 2009-07-31 11:19:57 UTC (rev 15073)
+++ root/ui/trunk/components/core/src/main/java/org/ajax4jsf/renderkit/html/AjaxSupportRenderer.java 2009-07-31 11:34:48 UTC (rev 15074)
@@ -1,57 +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.renderkit.html;
-
-import org.ajax4jsf.renderkit.AjaxCommandRendererBase;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-
-
-
-/**
- * Since <code>UIAjaxRegion</code> dont render itself ( only set apropriate event to parent component )
- * only <code>decode()</code> method implemented.
- * In case of Ajax Request caused by event for a given component
- * send action event.
- * @author shura (latest modification by $Author: alexsmirnov $)
- * @version $Revision: 1.1.2.1 $ $Date: 2007/02/01 15:31:24 $
- *
- */
-public class AjaxSupportRenderer extends AjaxCommandRendererBase
-{
- private static final Log log = LogFactory.getLog(AjaxSupportRenderer.class);
-
- /* (non-Javadoc)
- * @see javax.faces.render.Renderer#getRendersChildren()
- */
- public boolean getRendersChildren()
- {
-
- return false;
- }
-
- protected Class getComponentClass() {
- // TODO Auto-generated method stub
- return org.ajax4jsf.component.UIAjaxSupport.class;
- }
-
-}
Deleted: root/ui/trunk/components/core/src/main/java/org/ajax4jsf/renderkit/html/HtmlCommandLinkRenderer.java
===================================================================
--- root/ui/trunk/components/core/src/main/java/org/ajax4jsf/renderkit/html/HtmlCommandLinkRenderer.java 2009-07-31 11:19:57 UTC (rev 15073)
+++ root/ui/trunk/components/core/src/main/java/org/ajax4jsf/renderkit/html/HtmlCommandLinkRenderer.java 2009-07-31 11:34:48 UTC (rev 15074)
@@ -1,253 +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.renderkit.html;
-
-import java.io.IOException;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.Map;
-
-import javax.faces.component.UICommand;
-import javax.faces.component.UIComponent;
-import javax.faces.component.UIForm;
-import javax.faces.component.UIParameter;
-import javax.faces.component.ValueHolder;
-import javax.faces.context.FacesContext;
-import javax.faces.context.ResponseWriter;
-import javax.faces.event.ActionEvent;
-
-import org.ajax4jsf.Messages;
-import org.ajax4jsf.javascript.AjaxScript;
-import org.ajax4jsf.javascript.JSFunction;
-import org.ajax4jsf.renderkit.HeaderResourcesRendererBase;
-import org.ajax4jsf.renderkit.RendererUtils.HTML;
-import org.ajax4jsf.resource.InternetResource;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-
-/**
- * "Wrapped" standard {@link javax.faces.component.html.HtmlCommandLink} renderer,
- * to avoid common problem - If no commandLink's exist in initial rendered page, {@link javax.faces.component.html.HtmlForm} renderer
- * don't encode nessesary hidden fields for link and it's param. Our form-link renderer can avoid this problem.
- * @author shura
- *
- */
-public class HtmlCommandLinkRenderer extends HeaderResourcesRendererBase {
-
- private static final Log _log = LogFactory.getLog(HtmlCommandLinkRenderer.class);
-
- private static final String[] LINK_EXCLUSIONS = {"onclick","target","href"};
-
- private InternetResource[] scripts = null;
- private static final String FORM_SCRIPT = "/org/ajax4jsf/javascript/scripts/form.js";
-
- /*
- * (non-Javadoc)
- *
- * @see org.ajax4jsf.renderkit.RendererBase#doDecode(javax.faces.context.FacesContext,
- * javax.faces.component.UIComponent)
- */
- protected void doDecode(FacesContext context, UIComponent component) {
- UIForm form = getUtils().getNestingForm(context,component);
- if(null != form){
- String hiddenFieldId = getHiddenFieldId(context, form, component);
- Object hiddenFieldValue;
- if(null != (hiddenFieldValue=context.getExternalContext().getRequestParameterMap().get(hiddenFieldId))){
- if(component.getClientId(context).equals(hiddenFieldValue)){
- // Link submitted !
- if(_log.isDebugEnabled()){
- _log.debug(Messages.getMessage(Messages.COMMAND_LINK_SUBMIT_INFO, component.getClientId(context)));
- }
- ActionEvent actionEvent = new ActionEvent(component);
- component.queueEvent(actionEvent);
- }
- }
- }
- }
-
- /* (non-Javadoc)
- * @see org.ajax4jsf.renderkit.RendererBase#doEncodeBegin(javax.faces.context.ResponseWriter, javax.faces.context.FacesContext, javax.faces.component.UIComponent)
- */
- protected void doEncodeBegin(ResponseWriter writer, FacesContext context, UIComponent component) throws IOException {
- if(isDisabled(context,component)){
- doEncodePassiveBegin(writer, context, component);
- } else {
- doEncodeActiveBegin(writer, context, component);
- }
- }
-
- private String getHiddenFieldId(FacesContext context, UIForm form, UIComponent component) {
- return form.getClientId(context)+AjaxFormRenderer.HIDDEN_FIELD_SUFFIX;
- }
-
- protected void doEncodeActiveBegin(ResponseWriter writer, FacesContext context, UIComponent component) throws IOException{
- writer.startElement(HTML.a_ELEMENT,component);
- getUtils().encodeId(context,component);
- getUtils().encodeAttributesFromArray(context,component,HTML.PASS_THRU_STYLES);
- getUtils().encodePassThruWithExclusionsArray(context,component,LINK_EXCLUSIONS);
- writer.writeAttribute("href","#",null);
- UIForm form = getUtils().getNestingForm(context,component);
- String clientId = component.getClientId(context);
- if(null == form){
- if(_log.isWarnEnabled()){
- _log.warn(Messages.getMessage(Messages.COMMAND_LINK_NOT_IN_FORM_WARNING, clientId));
- }
- return;
- }
- // Encode onclick attribute.
- Object click = component.getAttributes().get("onclick");
- StringBuffer onclick = new StringBuffer(256);
- if(null != click){
- onclick.append(click).append(';');
- }
- JSFunction submit = new JSFunction(AjaxFormRenderer.FORM_SUBMIT_FUNCTION_NAME);
- submit.addParameter(clientId);
- submit.addParameter(form.getClientId(context));
- submit.addParameter(component.getAttributes().get("target"));
- Map parameters = new HashMap();
- for (Iterator iter = component.getChildren().iterator(); iter.hasNext();) {
- Object child = iter.next();
- if (child instanceof UIParameter) {
- UIParameter param = (UIParameter) child;
- String name = ((UIParameter) child).getName();
- Object value = ((UIParameter) child).getValue();
-
- if (name == null) {
- throw new IllegalArgumentException(Messages.getMessage(
- Messages.UNNAMED_PARAMETER_ERROR, component.getClientId(context)));
- }
-
- if (value == null) {
- value = "";
- }
-
- parameters.put(name,value);
- }
- }
-
- parameters.put(getHiddenFieldId(context, form, component), component.getClientId(context));
-
- submit.addParameter(parameters);
- onclick.append("return ");
- submit.appendScript(onclick);
- writer.writeAttribute(HTML.onclick_ATTRIBUTE,onclick,"onclick");
- //
- encodeValue(writer,context,component);
- }
-
- protected void doEncodePassiveBegin(ResponseWriter writer, FacesContext context, UIComponent component) throws IOException{
- writer.startElement(HTML.SPAN_ELEM,component);
- getUtils().encodeId(context,component);
- getUtils().encodeAttributesFromArray(context,component,HTML.PASS_THRU_STYLES);
- getUtils().encodePassThru(context,component);
- encodeValue(writer,context,component);
- }
-
- /* (non-Javadoc)
- * @see javax.faces.render.Renderer#encodeChildren(javax.faces.context.FacesContext, javax.faces.component.UIComponent)
- */
- public void encodeChildren(FacesContext context, UIComponent component) throws IOException {
- // TODO Auto-generated method stub
- renderChildren(context,component);
- }
-
- /* (non-Javadoc)
- * @see org.ajax4jsf.renderkit.RendererBase#doEncodeEnd(javax.faces.context.ResponseWriter, javax.faces.context.FacesContext, javax.faces.component.UIComponent)
- */
- protected void doEncodeEnd(ResponseWriter writer, FacesContext context, UIComponent component) throws IOException {
- if(isDisabled(context,component)){
- doEncodePassiveEnd(writer, context, component);
- } else {
- doEncodeActiveEnd(writer, context, component);
- }
- }
-
- protected void doEncodeActiveEnd(ResponseWriter writer, FacesContext context, UIComponent component) throws IOException{
- writer.endElement(HTML.a_ELEMENT);
- }
-
- protected void doEncodePassiveEnd(ResponseWriter writer, FacesContext context, UIComponent component) throws IOException{
- writer.endElement(HTML.SPAN_ELEM);
- }
-
-/**
- * Check for disabled component
- * @param context
- * @param command
- * @return true if link is disabled.
- */
-private boolean isDisabled(FacesContext context, UIComponent command){
- if (command.getAttributes().get("disabled") != null) {
- if ((command.getAttributes().get("disabled")).equals(Boolean.TRUE)) {
- return true;
- }
- }
- return false;
-}
- /* (non-Javadoc)
- * @see org.ajax4jsf.renderkit.RendererBase#getComponentClass()
- */
- protected Class getComponentClass() {
- // TODO Auto-generated method stub
- return UICommand.class;
- }
-
- /* (non-Javadoc)
- * @see javax.faces.render.Renderer#getRendersChildren()
- */
- public boolean getRendersChildren() {
- return true;
- }
-
- protected void encodeValue(ResponseWriter writer, FacesContext context, UIComponent component) throws IOException{
- String valueString = null;
- if (component instanceof UICommand) {
- Object value = ((UICommand) component).getValue();
- if (value != null) {
- valueString = value.toString();
- }
- } else if (component instanceof ValueHolder) {
- Object value = ((ValueHolder) component).getValue();
- if (value != null) {
- valueString = getUtils().formatValue(context,component,value);
- }
- }
-
- if (null != valueString && valueString.length()>0) {
- writer.writeText(valueString,null);
- }
- }
-
- /* (non-Javadoc)
- * @see org.ajax4jsf.renderkit.HeaderResourcesRendererBase#getScripts()
- */
- protected InternetResource[] getScripts() {
- synchronized (this) {
- if (scripts == null) {
- scripts = new InternetResource[1];
- scripts[0] = getResource(FORM_SCRIPT);
- }
- }
-
- return scripts;
- }
-}
Modified: root/ui/trunk/components/core/src/main/java/org/ajax4jsf/renderkit/html/MediaOutputRenderer.java
===================================================================
--- root/ui/trunk/components/core/src/main/java/org/ajax4jsf/renderkit/html/MediaOutputRenderer.java 2009-07-31 11:19:57 UTC (rev 15073)
+++ root/ui/trunk/components/core/src/main/java/org/ajax4jsf/renderkit/html/MediaOutputRenderer.java 2009-07-31 11:34:48 UTC (rev 15074)
@@ -37,7 +37,7 @@
import org.ajax4jsf.renderkit.RendererBase;
import org.ajax4jsf.renderkit.RendererUtils.HTML;
import org.ajax4jsf.resource.InternetResource;
-import org.ajax4jsf.resource.InternetResourceBuilder;
+import org.richfaces.resource.InternetResourceBuilder;
/**
* @author shura
Deleted: root/ui/trunk/components/core/src/main/java/org/ajax4jsf/renderkit/html/QueueRenderer.java
===================================================================
--- root/ui/trunk/components/core/src/main/java/org/ajax4jsf/renderkit/html/QueueRenderer.java 2009-07-31 11:19:57 UTC (rev 15073)
+++ root/ui/trunk/components/core/src/main/java/org/ajax4jsf/renderkit/html/QueueRenderer.java 2009-07-31 11:34:48 UTC (rev 15074)
@@ -1,190 +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.renderkit.html;
-
-import java.io.IOException;
-import java.util.Map;
-
-import javax.faces.component.UIComponent;
-import javax.faces.context.FacesContext;
-
-import org.ajax4jsf.component.QueueRegistry;
-import org.ajax4jsf.component.UIQueue;
-import org.ajax4jsf.javascript.AjaxScript;
-import org.ajax4jsf.javascript.JSFunctionDefinition;
-import org.ajax4jsf.renderkit.AjaxRendererUtils;
-import org.ajax4jsf.renderkit.HeaderResourcesRendererBase;
-import org.ajax4jsf.renderkit.RendererUtils;
-import org.ajax4jsf.renderkit.html.scripts.QueueScript;
-import org.ajax4jsf.resource.InternetResource;
-import org.richfaces.component.util.MessageUtil;
-
-/**
- * @author Nick Belaevski
- * @since 3.3.0
- */
-public class QueueRenderer extends HeaderResourcesRendererBase {
-
- private static final String SIZE_EXCEEDED_BEHAVIOR = "sizeExceededBehavior";
-
- private static final String SIZE = "size";
-
- private static final String QUEUE_ONSUBMIT_ATTRIBUTE = "queueonsubmit";
-
- private static final String QUEUE_ONBEFOREDOMUPDATE_ATTRIBUTE = "queueonbeforedomupdate";
-
- private static final String QUEUE_ONCOMPLETE_ATTRIBUTE = "queueoncomplete";
-
- private static final String QUEUE_ONERROR_ATTRIBUTE = "queueonerror";
-
- public static final String BEHAVIOR_DROP_NEXT = "dropNext";
-
- public static final String BEHAVIOR_DROP_NEW = "dropNew";
-
- public static final String BEHAVIOR_FIRE_NEXT = "fireNext";
-
- public static final String BEHAVIOR_FIRE_NEW = "fireNew";
-
- private static final String[] REQUEST_ATTRIBUTES = new String[] {
- "ignoreDupResponses",
- "requestDelay",
- "timeout"
- };
-
- private InternetResource[] scripts = new InternetResource[] {
- getResource(AjaxScript.class.getName()),
- getResource(QueueScript.class.getName())
- };
-
- @Override
- protected InternetResource[] getScripts() {
- return scripts;
- }
-
- @Override
- protected Class<? extends UIComponent> getComponentClass() {
- return UIQueue.class;
- }
-
- private static final RendererUtils utils = RendererUtils.getInstance();
-
- private boolean isValidBehaviorValue(String value) {
- return BEHAVIOR_DROP_NEW.equals(value) || BEHAVIOR_DROP_NEXT.equals(value) ||
- BEHAVIOR_FIRE_NEW.equals(value) || BEHAVIOR_FIRE_NEXT.equals(value);
- }
-
- private QueueRendererData createRendererData(FacesContext context, UIQueue queue) {
- Map<String, Object> attributes = queue.getAttributes();
-
- QueueRendererData data = new QueueRendererData();
-
- int size = queue.getSize();
- if (utils.shouldRenderAttribute(size)) {
- data.addQueueAttribute(SIZE, size);
- }
-
- String sizeExceededBehavior = (String) attributes.get(SIZE_EXCEEDED_BEHAVIOR);
- if (utils.shouldRenderAttribute(sizeExceededBehavior)) {
- if (!isValidBehaviorValue(sizeExceededBehavior)) {
- throw new IllegalArgumentException(sizeExceededBehavior + " value of " +
- SIZE_EXCEEDED_BEHAVIOR + " attribute is not a legal one for component: " +
- MessageUtil.getLabel(context, queue));
- }
-
- data.addQueueAttribute(SIZE_EXCEEDED_BEHAVIOR, sizeExceededBehavior);
- }
-
- String onsizeexceeded = queue.getOnsizeexceeded();
- if (utils.shouldRenderAttribute(onsizeexceeded)) {
- data.addQueueAttribute("onsizeexceeded", new JSFunctionDefinition("query", "options", "event").addToBody(onsizeexceeded));
- }
-
- String onrequestqueue = queue.getOnrequestqueue();
- if (utils.shouldRenderAttribute(onrequestqueue)) {
- data.addQueueAttribute("onrequestqueue", new JSFunctionDefinition("query", "options", "event").addToBody(onrequestqueue));
- }
-
- String onrequestdequeue = queue.getOnrequestdequeue();
- if (utils.shouldRenderAttribute(onrequestdequeue)) {
- data.addQueueAttribute("onrequestdequeue", new JSFunctionDefinition("query", "options", "event").addToBody(onrequestdequeue));
- }
-
- for (String attributeName : REQUEST_ATTRIBUTES) {
- Object value = attributes.get(attributeName);
- if (utils.shouldRenderAttribute(value)) {
- data.addRequestAttribute(attributeName, value);
- }
- }
-
- String status = AjaxRendererUtils.getAjaxStatus(queue);
- if (utils.shouldRenderAttribute(status)) {
- data.addRequestAttribute(AjaxRendererUtils.STATUS_ATTR_NAME, status);
- }
-
- String onBeforeDomUpdate = queue.getOnbeforedomupdate();
- if (utils.shouldRenderAttribute(onBeforeDomUpdate)) {
- data.addRequestAttribute(QUEUE_ONBEFOREDOMUPDATE_ATTRIBUTE, AjaxRendererUtils.buildAjaxOnBeforeDomUpdate(onBeforeDomUpdate));
- }
-
- String oncomplete = queue.getOncomplete();
- if (utils.shouldRenderAttribute(oncomplete)) {
- data.addRequestAttribute(QUEUE_ONCOMPLETE_ATTRIBUTE, AjaxRendererUtils.buildAjaxOncomplete(oncomplete));
- }
-
- String onsubmit = queue.getOnsubmit();
- if (utils.shouldRenderAttribute(onsubmit)) {
- JSFunctionDefinition onsubmitFunction = new JSFunctionDefinition("request");
- onsubmitFunction.addToBody(onsubmit);
-
- data.addRequestAttribute(QUEUE_ONSUBMIT_ATTRIBUTE, onsubmitFunction);
- }
-
- String onerror = queue.getOnerror();
- if (utils.shouldRenderAttribute(onerror)) {
- JSFunctionDefinition onerrorFunction = new JSFunctionDefinition("request", "status", "message");
- onerrorFunction.addToBody(onerror);
-
- data.addRequestAttribute(QUEUE_ONERROR_ATTRIBUTE, onerrorFunction);
- }
-
- return data;
- }
-
- @Override
- public void encodeBegin(FacesContext context, UIComponent component)
- throws IOException {
- super.encodeBegin(context, component);
- }
-
- @Override
- public void encodeEnd(FacesContext context, UIComponent component)
- throws IOException {
- super.encodeEnd(context, component);
-
- UIQueue queue = (UIQueue) component;
- if (!queue.isDisabled()) {
- QueueRegistry.getInstance(context).registerQueue(context,
- queue.getClientName(context),
- createRendererData(context, queue));
- }
- }
-}
Deleted: root/ui/trunk/components/core/src/main/java/org/ajax4jsf/renderkit/html/QueueRendererData.java
===================================================================
--- root/ui/trunk/components/core/src/main/java/org/ajax4jsf/renderkit/html/QueueRendererData.java 2009-07-31 11:19:57 UTC (rev 15073)
+++ root/ui/trunk/components/core/src/main/java/org/ajax4jsf/renderkit/html/QueueRendererData.java 2009-07-31 11:34:48 UTC (rev 15074)
@@ -1,61 +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.renderkit.html;
-
-import java.util.LinkedHashMap;
-import java.util.Map;
-
-/**
- * @author Denis Morozov
- * @since 3.3.0
- */
-public class QueueRendererData {
-
- private Map<String, Object> queueAttributes;
-
- private Map<String, Object> requestAttributes;
-
- public void addQueueAttribute(String key, Object value) {
- if (queueAttributes == null) {
- queueAttributes = new LinkedHashMap<String, Object>();
- }
-
- queueAttributes.put(key, value);
- }
-
- public void addRequestAttribute(String key, Object value) {
- if (requestAttributes == null) {
- requestAttributes = new LinkedHashMap<String, Object>();
- }
-
- requestAttributes.put(key, value);
- }
-
- public Map<String, Object> getQueueAttributes() {
- return queueAttributes;
- }
-
- public Map<String, Object> getRequestAttributes() {
- return requestAttributes;
- }
-}
Deleted: root/ui/trunk/components/core/src/main/java/org/ajax4jsf/renderkit/html/RepeatRenderer.java
===================================================================
--- root/ui/trunk/components/core/src/main/java/org/ajax4jsf/renderkit/html/RepeatRenderer.java 2009-07-31 11:19:57 UTC (rev 15073)
+++ root/ui/trunk/components/core/src/main/java/org/ajax4jsf/renderkit/html/RepeatRenderer.java 2009-07-31 11:34:48 UTC (rev 15074)
@@ -1,81 +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.renderkit.html;
-
-import java.io.IOException;
-import java.util.ListIterator;
-
-import javax.faces.component.UIComponent;
-import javax.faces.context.FacesContext;
-
-import org.ajax4jsf.component.UIRepeat;
-import org.ajax4jsf.model.DataVisitor;
-import org.ajax4jsf.renderkit.RendererBase;
-
-/**
- * @author shura
- *
- */
-public class RepeatRenderer extends RendererBase {
-
- public void encodeChildren(FacesContext context, UIComponent component)
- throws IOException {
- final UIRepeat repeater = (UIRepeat) component;
- repeater.captureOrigValue(context);
- try {
- DataVisitor visitor = new DataVisitor() {
-
- public void process(FacesContext context, Object rowKey, Object argument) throws IOException {
- repeater.setRowKey(rowKey);
- ListIterator childIterator = repeater.getChildren()
- .listIterator();
- while (childIterator.hasNext()) {
- UIComponent child = (UIComponent) childIterator.next();
- renderChild(context, child);
- }
-
- }
-
- };
- repeater.walk(context, visitor, null);
-
- } finally {
- repeater.restoreOrigValue(context);
- repeater.setRowKey(null);
- }
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.ajax4jsf.renderkit.RendererBase#getComponentClass()
- */
- protected Class getComponentClass() {
- // TODO Auto-generated method stub
- return UIRepeat.class;
- }
-
- public boolean getRendersChildren() {
- return true;
- }
-
-}
Deleted: root/ui/trunk/components/core/src/main/java/org/ajax4jsf/renderkit/html/scripts/QueueScript.java
===================================================================
--- root/ui/trunk/components/core/src/main/java/org/ajax4jsf/renderkit/html/scripts/QueueScript.java 2009-07-31 11:19:57 UTC (rev 15073)
+++ root/ui/trunk/components/core/src/main/java/org/ajax4jsf/renderkit/html/scripts/QueueScript.java 2009-07-31 11:34:48 UTC (rev 15074)
@@ -1,52 +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.renderkit.html.scripts;
-
-import org.ajax4jsf.resource.InternetResourceBase;
-import org.ajax4jsf.resource.ResourceContext;
-import org.ajax4jsf.resource.ResourceRenderer;
-
-/**
- * @author Nick Belaevski
- * @since 3.3.0
- */
-public class QueueScript extends InternetResourceBase {
-
- private static final ResourceRenderer renderer = new QueueScriptResourceRenderer();
-
- private String key = getClass().getName();
-
- @Override
- public String getKey() {
- return key;
- }
-
- @Override
- public ResourceRenderer getRenderer(ResourceContext resourceContext) {
- return renderer;
- }
-
- @Override
- public boolean isCacheable(ResourceContext resourceContext) {
- return false;
- }
-}
Deleted: root/ui/trunk/components/core/src/main/java/org/ajax4jsf/renderkit/html/scripts/QueueScriptResourceRenderer.java
===================================================================
--- root/ui/trunk/components/core/src/main/java/org/ajax4jsf/renderkit/html/scripts/QueueScriptResourceRenderer.java 2009-07-31 11:19:57 UTC (rev 15073)
+++ root/ui/trunk/components/core/src/main/java/org/ajax4jsf/renderkit/html/scripts/QueueScriptResourceRenderer.java 2009-07-31 11:34:48 UTC (rev 15074)
@@ -1,165 +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.renderkit.html.scripts;
-
-import java.io.IOException;
-import java.util.Collections;
-import java.util.LinkedHashMap;
-import java.util.Map;
-import java.util.Map.Entry;
-
-import javax.faces.context.ExternalContext;
-import javax.faces.context.FacesContext;
-import javax.faces.context.ResponseWriter;
-
-import org.ajax4jsf.component.QueueRegistry;
-import org.ajax4jsf.component.UIQueue;
-import org.ajax4jsf.context.AjaxContext;
-import org.ajax4jsf.javascript.JSObject;
-import org.ajax4jsf.javascript.ScriptUtils;
-import org.ajax4jsf.renderkit.RendererUtils.HTML;
-import org.ajax4jsf.renderkit.html.QueueRendererData;
-import org.ajax4jsf.resource.BaseResourceRenderer;
-import org.ajax4jsf.resource.InternetResource;
-
-/**
- * @author Nick Belaevski
- * @since 3.3.0
- */
-public class QueueScriptResourceRenderer extends BaseResourceRenderer {
-
- public static final String QUEUE_SCRIPT_ID = "org.ajax4jsf.queue_script";
-
- private void encodeQueue(ResponseWriter writer, String queueName, QueueRendererData queueData)
- throws IOException {
-
- Map<String, Object> queueAttributes = null;
- Map<String, Object> requestAttributes = null;
-
- if (queueData != null) {
- queueAttributes = queueData.getQueueAttributes();
- requestAttributes = queueData.getRequestAttributes();
- }
-
- writer.writeText("if (!EventQueue.getQueue(" + ScriptUtils.toScript(queueName) + ")) { EventQueue.addQueue(", null);
- writer.writeText(
- new JSObject("EventQueue",
- queueName,
- queueAttributes,
- requestAttributes
- ).toScript(), null);
- writer.writeText(") };", null);
- }
-
- @Override
- protected void customEncode(InternetResource resource,
- FacesContext context, Object data) throws IOException {
- super.customEncode(resource, context, data);
-
- Map<String, Object> queues = (Map<String, Object>) data;
- ResponseWriter writer = context.getResponseWriter();
-
- writer.writeText("if (typeof A4J != 'undefined') { if (A4J.AJAX) { with (A4J.AJAX) {", null);
- for (Entry<String, Object> entry : queues.entrySet()) {
- encodeQueue(writer, entry.getKey(), (QueueRendererData) entry.getValue());
- }
- writer.writeText("}}};", null);
- }
-
- protected void doEncode(InternetResource resource, FacesContext context,
- Object data, Map<String, Object> attributes) throws IOException {
-
- ExternalContext externalContext = context.getExternalContext();
- Map<String, Object> requestMap = externalContext.getRequestMap();
-
- String resourceKey = resource.getKey();
- if (requestMap.get(resourceKey) == null) {
- requestMap.put(resourceKey, Boolean.TRUE);
-
- QueueRegistry queueRegistry = QueueRegistry.getInstance(context);
- if (queueRegistry.isShouldCreateDefaultGlobalQueue()) {
- String encodedGlobalQueueName = context.getExternalContext().encodeNamespace(
- UIQueue.GLOBAL_QUEUE_NAME);
-
- if (!queueRegistry.containsQueue(encodedGlobalQueueName)) {
- queueRegistry.registerQueue(context, encodedGlobalQueueName, null);
- }
- }
-
- if (queueRegistry.hasQueuesToEncode()) {
- super.encode(resource, context, queueRegistry.getRegisteredQueues(context), attributes);
- }
- }
- }
-
- private String encodeQueueScriptId(FacesContext context) {
- String encodedId = QUEUE_SCRIPT_ID;
-
- AjaxContext ajaxContext = AjaxContext.getCurrentInstance(context);
- if (!ajaxContext.isAjaxRequest()) {
- encodedId = context.getExternalContext().encodeNamespace(encodedId);
- }
-
- return encodedId;
- }
-
- @Override
- public void encode(InternetResource resource, FacesContext context,
- Object data, Map<String, Object> attributes) throws IOException {
-
- Map<String,Object> newAttributes = new LinkedHashMap<String, Object>(attributes);
- newAttributes.put(HTML.id_ATTRIBUTE, encodeQueueScriptId(context));
-
- doEncode(resource, context, data, newAttributes);
- }
-
- @Override
- public void encode(InternetResource resource, FacesContext context,
- Object data) throws IOException {
-
- doEncode(resource, context, data,
- Collections.singletonMap(HTML.id_ATTRIBUTE, (Object) encodeQueueScriptId(context)));
- }
-
- @Override
- protected String[][] getCommonAttrs() {
- return new String[][] {
- {HTML.TYPE_ATTR, getContentType()},
- };
- }
-
- @Override
- protected String getHrefAttr() {
- return null;
- }
-
- @Override
- protected String getTag() {
- return HTML.SCRIPT_ELEM;
- }
-
- public String getContentType() {
- return "text/javascript";
- }
-
-}
Deleted: root/ui/trunk/components/core/src/main/java/org/ajax4jsf/taglib/html/facelets/ActionParamHandler.java
===================================================================
--- root/ui/trunk/components/core/src/main/java/org/ajax4jsf/taglib/html/facelets/ActionParamHandler.java 2009-07-31 11:19:57 UTC (rev 15073)
+++ root/ui/trunk/components/core/src/main/java/org/ajax4jsf/taglib/html/facelets/ActionParamHandler.java 2009-07-31 11:34:48 UTC (rev 15074)
@@ -1,202 +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.taglib.html.facelets;
-
-import javax.faces.application.Application;
-import javax.faces.component.ActionSource;
-import javax.faces.component.UIComponent;
-import javax.faces.context.FacesContext;
-import javax.faces.convert.Converter;
-import javax.faces.event.ActionEvent;
-import javax.faces.view.facelets.ComponentConfig;
-import javax.faces.view.facelets.ComponentHandler;
-import javax.faces.view.facelets.FaceletContext;
-import javax.faces.view.facelets.MetaRule;
-import javax.faces.view.facelets.MetaRuleset;
-import javax.faces.view.facelets.Metadata;
-import javax.faces.view.facelets.MetadataTarget;
-import javax.faces.view.facelets.TagAttribute;
-import javax.faces.view.facelets.TagAttributeException;
-
-import org.ajax4jsf.Messages;
-import org.ajax4jsf.component.UIActionParameter;
-
-/**
- * @author shura (latest modification by $Author: alexsmirnov $)
- * @version $Revision: 1.1.2.1 $ $Date: 2007/02/01 15:31:23 $
- *
- */
-public class ActionParamHandler extends ComponentHandler {
-
- /**
- * @author shura (latest modification by $Author: alexsmirnov $)
- * @version $Revision: 1.1.2.1 $ $Date: 2007/02/01 15:31:23 $
- *
- */
- public static class ActionParamMetaRule extends MetaRule {
-
- /* (non-Javadoc)
- * @see org.ajax4jsf.tag.SuggestionHandler.SuggestionMetaRule#applyRule(java.lang.String, com.sun.facelets.tag.TagAttribute, com.sun.facelets.tag.MetadataTarget)
- */
- public Metadata applyRule(String name, TagAttribute attribute, MetadataTarget meta) {
- if (meta.isTargetInstanceOf(UIActionParameter.class)) {
- if ("assignTo".equals(name)) {
- return new AssignToValueBindingMetadata(attribute);
- } else if ("converter".equals(name)) {
- if (attribute.isLiteral()) {
- return new LiteralConverterMetadata(attribute.getValue());
- } else {
- return new DynamicConverterMetadata(attribute);
- }
-
- } else if ("actionListener".equals(name)) {
- return new ActionListenerMetadata(attribute);
- }
- }
-
- return null;
- }
-
-
- }
-
- final static class LiteralConverterMetadata extends Metadata {
-
- private final String converterId;
-
- public LiteralConverterMetadata(String converterId) {
- this.converterId = converterId;
- }
-
- public void applyMetadata(FaceletContext ctx, Object instance) {
- ((UIActionParameter) instance).setConverter(ctx.getFacesContext()
- .getApplication().createConverter(this.converterId));
- }
- }
-
- final static class DynamicConverterMetadata extends Metadata {
-
- private final TagAttribute attr;
-
- public DynamicConverterMetadata(TagAttribute attr) {
- this.attr = attr;
- }
-
- public void applyMetadata(FaceletContext ctx, Object instance) {
- ((UIActionParameter) instance).setConverter((Converter) this.attr
- .getObject(ctx, Converter.class));
- }
- }
-
- final static class AssignToValueBindingMetadata extends Metadata {
-
- private final TagAttribute attr;
-
- public AssignToValueBindingMetadata(TagAttribute attr) {
- this.attr = attr;
- }
-
- public void applyMetadata(FaceletContext ctx, Object instance) {
- ((UIActionParameter) instance).setAssignToBinding(attr.getValueExpression(ctx,
- Object.class));
- }
- }
-
- final static class ActionListenerMetadata extends Metadata {
-
- private static final Class[] SIGNATURE = new Class[] {ActionEvent.class};
-
- private final TagAttribute attribute;
-
- public ActionListenerMetadata(TagAttribute attribute) {
- super();
- this.attribute = attribute;
- }
-
- public void applyMetadata(FaceletContext ctx, Object instance) {
- ((UIActionParameter) instance).setActionListener(
- attribute.getMethodExpression(ctx, null, SIGNATURE));
- }
- };
-
- private TagAttribute _assignTo;
- private TagAttribute _converter;
- private TagAttribute _actionListener;
-
- /**
- * @param config
- */
- public ActionParamHandler(ComponentConfig config) {
- super(config);
- _assignTo = getAttribute("assignTo");
- _converter = getAttribute("converter");
- _actionListener = getAttribute("actionListener");
-
- if(null != _assignTo) {
- if (_assignTo.isLiteral()) {
- throw new TagAttributeException(this.tag, this._assignTo, Messages.getMessage(Messages.MUST_BE_EXPRESSION_ERROR));
- }
- }
-
- if (null != _actionListener) {
- if (_actionListener.isLiteral()) {
- throw new TagAttributeException(this.tag, this._actionListener, Messages.getMessage(Messages.MUST_BE_EXPRESSION_ERROR));
- }
- }
- // TODO Auto-generated constructor stub
- }
- /*
- * (non-Javadoc)
- *
- * @see com.sun.facelets.FaceletHandler#apply(com.sun.facelets.FaceletContext,
- * javax.faces.component.UIComponent)
- */
- public void onComponentCreated(FaceletContext ctx, UIComponent c, UIComponent parent) {
- if (parent instanceof ActionSource)
- {
- FacesContext facesContext = FacesContext.getCurrentInstance();
- Application application = facesContext.getApplication();
- if (_assignTo != null) {
- UIActionParameter al = (UIActionParameter)c;
- // TODO - in jsf 1.2 use ELValueExpression
-// al.setAssignToBinding(application.createValueBinding(_assignTo.getValue()));
-// if (_converter != null) {
-// Converter converter = application.createConverter(_converter.getValue(ctx));
-// al.setConverter(converter);
-// }
- ((ActionSource)parent).addActionListener(al);
- }
- }
- }
-
- private static final ActionParamMetaRule actionParamMetaRule = new ActionParamMetaRule();
-
- /* (non-Javadoc)
- * @see org.ajax4jsf.tag.AjaxComponentHandler#createMetaRuleset(java.lang.Class)
- */
- protected MetaRuleset createMetaRuleset(Class type) {
- MetaRuleset metaRules = super.createMetaRuleset(type);
- metaRules.addRule(actionParamMetaRule);
- return metaRules;
- }
-
-}
Deleted: root/ui/trunk/components/core/src/main/java/org/ajax4jsf/taglib/html/facelets/AjaxListenerHandler.java
===================================================================
--- root/ui/trunk/components/core/src/main/java/org/ajax4jsf/taglib/html/facelets/AjaxListenerHandler.java 2009-07-31 11:19:57 UTC (rev 15073)
+++ root/ui/trunk/components/core/src/main/java/org/ajax4jsf/taglib/html/facelets/AjaxListenerHandler.java 2009-07-31 11:34:48 UTC (rev 15074)
@@ -1,120 +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.taglib.html.facelets;
-
-import java.io.IOException;
-
-import javax.el.ELException;
-import javax.el.ValueExpression;
-import javax.faces.FacesException;
-import javax.faces.component.UIComponent;
-import javax.faces.view.facelets.FaceletContext;
-import javax.faces.view.facelets.FaceletException;
-import javax.faces.view.facelets.TagAttribute;
-import javax.faces.view.facelets.TagAttributeException;
-import javax.faces.view.facelets.TagConfig;
-import javax.faces.view.facelets.TagException;
-import javax.faces.view.facelets.TagHandler;
-
-import org.ajax4jsf.Messages;
-import org.ajax4jsf.event.AjaxListener;
-import org.ajax4jsf.event.AjaxListenerHelper;
-import org.ajax4jsf.event.AjaxSource;
-
-/**
- * Register an ActionListener instance on the UIComponent associated with the
- * closest parent UIComponent custom action. <p/> See <a target="_new"
- * href="http://java.sun.com/j2ee/javaserverfaces/1.1_01/docs/tlddocs/f/actionList...">tag
- * documentation</a>.
- *
- * @see javax.faces.event.ActionListener
- * @see javax.faces.component.AjaxContainer
- * @author Jacob Hookom
- * @version $Id: AjaxListenerHandler.java,v 1.1.2.1 2007/02/01 15:31:23 alexsmirnov Exp $
- */
-public final class AjaxListenerHandler extends TagHandler {
-
- private Class listenerType;
-
- private final TagAttribute type;
-
- private final TagAttribute binding;
-
- /**
- * @param config
- */
- public AjaxListenerHandler(TagConfig config) {
- super(config);
- this.binding = this.getAttribute("binding");
- this.type = this.getAttribute("type");
- if(binding == null && type == null){
- throw new TagException(this.tag, "One of the attribute 'binding' or type' is required");
- }
- if (binding == null && type != null) {
- if (!type.isLiteral()) {
- throw new TagAttributeException(this.tag, this.type, Messages.getMessage(Messages.MUST_BE_LITERAL_ERROR));
- }
- try {
- this.listenerType = Class.forName(type.getValue());
- } catch (Exception e) {
- throw new TagAttributeException(this.tag, this.type, e);
- }
- }
- }
-
- /*
- * (non-Javadoc)
- *
- * @see com.sun.facelets.FaceletHandler#apply(com.sun.facelets.FaceletContext,
- * javax.faces.component.UIComponent)
- */
- public void apply(FaceletContext ctx, UIComponent parent)
- throws IOException, FacesException, FaceletException, ELException {
- if (parent instanceof AjaxSource) {
- // only process if parent was just created
- if (parent.getParent() == null) {
- AjaxSource src = (AjaxSource) parent;
- AjaxListener listener = null;
- ValueExpression ve = null;
- if (this.binding != null) {
- ve = this.binding.getValueExpression(ctx,
- AjaxListener.class);
- // TODO - handle both JSF 1.2/1.1 cases.
- listener = new AjaxListenerHelper(ve);
- }
- if (listener == null) {
- try {
- listener = (AjaxListener) listenerType.newInstance();
- } catch (Exception e) {
- throw new TagAttributeException(this.tag, this.type, e.getCause());
- }
- if (ve != null) {
- ve.setValue(ctx, ve);
- }
- }
- src.addAjaxListener(listener);
- }
- } else {
- throw new TagException(this.tag, Messages.getMessage(Messages.NOT_PARENT_AJAX_COMPONENT_ERROR, parent));
- }
- }
-}
Modified: root/ui/trunk/components/core/src/main/java/org/ajax4jsf/taglib/html/facelets/AjaxPushHandler.java
===================================================================
--- root/ui/trunk/components/core/src/main/java/org/ajax4jsf/taglib/html/facelets/AjaxPushHandler.java 2009-07-31 11:19:57 UTC (rev 15073)
+++ root/ui/trunk/components/core/src/main/java/org/ajax4jsf/taglib/html/facelets/AjaxPushHandler.java 2009-07-31 11:34:48 UTC (rev 15074)
@@ -42,6 +42,7 @@
public class AjaxPushHandler extends ComponentHandler {
private static final MetaRule ajaxPushMetaRule = new AjaxPushMetaRule();
+
/**
* @param config
*/
Deleted: root/ui/trunk/components/core/src/main/java/org/ajax4jsf/taglib/html/facelets/AjaxSupportHandler.java
===================================================================
--- root/ui/trunk/components/core/src/main/java/org/ajax4jsf/taglib/html/facelets/AjaxSupportHandler.java 2009-07-31 11:19:57 UTC (rev 15073)
+++ root/ui/trunk/components/core/src/main/java/org/ajax4jsf/taglib/html/facelets/AjaxSupportHandler.java 2009-07-31 11:34:48 UTC (rev 15074)
@@ -1,97 +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.taglib.html.facelets;
-
-import java.io.IOException;
-
-import javax.el.ELException;
-import javax.faces.FacesException;
-import javax.faces.component.UIComponent;
-import javax.faces.component.UIComponentBase;
-import javax.faces.view.facelets.ComponentConfig;
-import javax.faces.view.facelets.FaceletContext;
-import javax.faces.view.facelets.FaceletException;
-import javax.faces.view.facelets.TagAttribute;
-import javax.faces.view.facelets.TagHandler;
-
-import org.ajax4jsf.taglib.html.jsp.AjaxSupportTag;
-import org.ajax4jsf.webapp.taglib.AjaxComponentHandler;
-
-/**
- * "proxy" class for creating UIAjaxSupport component as facet for it's parent.
- * @author shura (latest modification by $Author: alexsmirnov $)
- * @version $Revision: 1.1.2.1 $ $Date: 2007/02/01 15:31:22 $
- *
- */
-public class AjaxSupportHandler extends TagHandler {
- /**
- * A UIComponent for capturing a child UIComponent, representative of the
- * desired Facet
- *
- * @author Jacob Hookom
- *
- */
- private final static class UIFacet extends UIComponentBase {
- public String getFamily() {
- return null;
- }
- }
-
- /**
- * Real tag handler for create component.
- */
- private TagHandler _ajaxSupportHandler;
-
- private TagAttribute _event;
- /**
- * @param config
- */
- public AjaxSupportHandler(ComponentConfig config) {
- super(config);
- _event = getRequiredAttribute("event");
- _ajaxSupportHandler = new AjaxComponentHandler(config);
- }
-
- /* (non-Javadoc)
- * @see com.sun.facelets.FaceletHandler#apply(com.sun.facelets.FaceletContext, javax.faces.component.UIComponent)
- */
- public void apply(FaceletContext ctx, UIComponent parent)
- throws IOException, FacesException, FaceletException, ELException {
- UIComponent c;
- // our id
-// String id = ctx.generateUniqueId(this.tagId);
- UIFacet facet = new UIFacet();
- // Find facet for support component
- String facetName = AjaxSupportTag.AJAX_SUPPORT_FACET+_event.getValue();
- c = parent.getFacet(facetName);
- if (null != c) {
- parent.getFacets().remove(facetName);
- facet.getChildren().add(c);
- }
- this._ajaxSupportHandler.apply(ctx, facet);
- c = (UIComponent) facet.getChildren().get(0);
- parent.getFacets().put(facetName, c);
- // Fix for possible incompabilites in different frameworks.
-// c.setParentProperties(parent);
- }
-
-}
Deleted: root/ui/trunk/components/core/src/main/java/org/ajax4jsf/taglib/html/facelets/FacetHandler.java
===================================================================
--- root/ui/trunk/components/core/src/main/java/org/ajax4jsf/taglib/html/facelets/FacetHandler.java 2009-07-31 11:19:57 UTC (rev 15073)
+++ root/ui/trunk/components/core/src/main/java/org/ajax4jsf/taglib/html/facelets/FacetHandler.java 2009-07-31 11:34:48 UTC (rev 15074)
@@ -1,93 +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.taglib.html.facelets;
-
-import java.io.IOException;
-
-import javax.el.ELException;
-import javax.faces.FacesException;
-import javax.faces.component.UIComponent;
-import javax.faces.component.UIComponentBase;
-import javax.faces.view.facelets.FaceletContext;
-import javax.faces.view.facelets.FaceletException;
-import javax.faces.view.facelets.TagAttribute;
-import javax.faces.view.facelets.TagConfig;
-import javax.faces.view.facelets.TagException;
-import javax.faces.view.facelets.TagHandler;
-
-import org.ajax4jsf.Messages;
-
-/**
- * Register a named facet on the UIComponent associated with the closest parent
- * UIComponent custom action. <p/> See <a target="_new"
- * href="http://java.sun.com/j2ee/javaserverfaces/1.1_01/docs/tlddocs/f/facet.html">tag
- * documentation</a>.
- *
- * @author Jacob Hookom
- * @version $Id: FacetHandler.java,v 1.1.2.1 2007/02/01 15:31:21 alexsmirnov Exp $
- */
-public final class FacetHandler extends TagHandler {
-
- /**
- * A UIComponent for capturing a child UIComponent, representative of the
- * desired Facet
- *
- * @author Jacob Hookom
- *
- */
- private final static class UIFacet extends UIComponentBase {
- public String getFamily() {
- return null;
- }
- }
-
- protected final TagAttribute name;
-
- public FacetHandler(TagConfig config) {
- super(config);
- this.name = this.getRequiredAttribute("name");
- }
-
- /* (non-Javadoc)
- * @see com.sun.facelets.FaceletHandler#apply(com.sun.facelets.FaceletContext, javax.faces.component.UIComponent)
- */
- public void apply(FaceletContext ctx, UIComponent parent)
- throws IOException, FacesException, FaceletException, ELException {
- UIFacet facet = new UIFacet();
- UIComponent c;
- // Check for existing facet
- String facetName = this.name.getValue(ctx);
- c = parent.getFacet(facetName);
- if (null != c) {
- parent.getFacets().remove(facetName);
- facet.getChildren().add(c);
- }
- this.nextHandler.apply(ctx, facet);
- int childCount = facet.getChildCount();
- if (childCount == 1) {
- c = (UIComponent) facet.getChildren().get(0);
- parent.getFacets().put(facetName, c);
- } else {
- throw new TagException(this.tag, Messages.getMessage(Messages.FACET_TAG_MANY_CHILDREN_ERROR));
- }
- }
-}
Deleted: root/ui/trunk/components/core/src/main/java/org/ajax4jsf/taglib/html/facelets/IncludeFaceletContext.java
===================================================================
--- root/ui/trunk/components/core/src/main/java/org/ajax4jsf/taglib/html/facelets/IncludeFaceletContext.java 2009-07-31 11:19:57 UTC (rev 15073)
+++ root/ui/trunk/components/core/src/main/java/org/ajax4jsf/taglib/html/facelets/IncludeFaceletContext.java 2009-07-31 11:34:48 UTC (rev 15074)
@@ -1,275 +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.taglib.html.facelets;
-
-import java.io.IOException;
-import java.net.URL;
-import java.util.HashMap;
-import java.util.Locale;
-import java.util.Map;
-
-import javax.el.ELException;
-import javax.el.ELResolver;
-import javax.el.ExpressionFactory;
-import javax.el.FunctionMapper;
-import javax.el.VariableMapper;
-import javax.faces.FacesException;
-import javax.faces.component.UIComponent;
-import javax.faces.context.FacesContext;
-import javax.faces.view.facelets.FaceletContext;
-import javax.faces.view.facelets.FaceletException;
-
-/**
- * @author shura
- *
- */
-public class IncludeFaceletContext extends FaceletContext {
-
- private FaceletContext defaultContext;
-
- private Map ids;
-
- /**
- * @param defaultContext
- */
- public IncludeFaceletContext(FaceletContext defaultContext) {
- this.defaultContext = defaultContext;
- this.ids = new HashMap();
- }
-
- //TODO JSF 2.0 analog?
-// /**
-// * @param client
-// * @see com.sun.facelets.FaceletContext#extendClient(com.sun.facelets.TemplateClient)
-// */
-// public void extendClient(TemplateClient client) {
-// this.defaultContext.extendClient(client);
-// }
-
- /**
- * @param base
- * @return
- * @see com.sun.facelets.FaceletContext#generateUniqueId(java.lang.String)
- */
- public String generateUniqueId(String base) {
- Integer cnt = (Integer) this.ids.get(base);
- if (cnt == null) {
- this.ids.put(base, new Integer(0));
- return base;
- } else {
- int i = cnt.intValue() + 1;
- this.ids.put(base, new Integer(i));
- return base + "_" + i;
- }
- }
-
- /**
- * @param name
- * @return
- * @see com.sun.facelets.FaceletContext#getAttribute(java.lang.String)
- */
- public Object getAttribute(String name) {
- return this.defaultContext.getAttribute(name);
- }
-
- /**
- * @param key
- * @return
- * @see javax.el.ELContext#getContext(java.lang.Class)
- */
- public Object getContext(Class key) {
- return this.defaultContext.getContext(key);
- }
-
- /**
- * @return
- * @see javax.el.ELContext#getELResolver()
- */
- public ELResolver getELResolver() {
- return this.defaultContext.getELResolver();
- }
-
- /**
- * @return
- * @see com.sun.facelets.FaceletContext#getExpressionFactory()
- */
- public ExpressionFactory getExpressionFactory() {
- return this.defaultContext.getExpressionFactory();
- }
-
- /**
- * @return
- * @see com.sun.facelets.FaceletContext#getFacesContext()
- */
- public FacesContext getFacesContext() {
- return this.defaultContext.getFacesContext();
- }
-
- /**
- * @return
- * @see javax.el.ELContext#getFunctionMapper()
- */
- public FunctionMapper getFunctionMapper() {
- return this.defaultContext.getFunctionMapper();
- }
-
- /**
- * @return
- * @see javax.el.ELContext#getLocale()
- */
- public Locale getLocale() {
- return this.defaultContext.getLocale();
- }
-
- /**
- * @return
- * @see javax.el.ELContext#getVariableMapper()
- */
- public VariableMapper getVariableMapper() {
- return this.defaultContext.getVariableMapper();
- }
-
- /**
- * @return
- * @see java.lang.Object#hashCode()
- */
- public int hashCode() {
- return this.defaultContext.hashCode();
- }
-
- //TODO JSF 2.0 analog?
-// /**
-// * @param parent
-// * @param name
-// * @return
-// * @throws IOException
-// * @throws FaceletException
-// * @throws FacesException
-// * @throws ELException
-// * @see com.sun.facelets.FaceletContext#includeDefinition(javax.faces.component.UIComponent, java.lang.String)
-// */
-// public boolean includeDefinition(UIComponent parent, String name) throws IOException, FaceletException, FacesException, ELException {
-// return this.defaultContext.includeDefinition(parent, name);
-// }
-
- /**
- * @param parent
- * @param relativePath
- * @throws IOException
- * @throws FaceletException
- * @throws FacesException
- * @throws ELException
- * @see com.sun.facelets.FaceletContext#includeFacelet(javax.faces.component.UIComponent, java.lang.String)
- */
- public void includeFacelet(UIComponent parent, String relativePath) throws IOException, FaceletException, FacesException, ELException {
- this.defaultContext.includeFacelet(parent, relativePath);
- }
-
- /**
- * @param parent
- * @param absolutePath
- * @throws IOException
- * @throws FaceletException
- * @throws FacesException
- * @throws ELException
- * @see com.sun.facelets.FaceletContext#includeFacelet(javax.faces.component.UIComponent, java.net.URL)
- */
- public void includeFacelet(UIComponent parent, URL absolutePath) throws IOException, FaceletException, FacesException, ELException {
- this.defaultContext.includeFacelet(parent, absolutePath);
- }
-
- /**
- * @return
- * @see javax.el.ELContext#isPropertyResolved()
- */
- public boolean isPropertyResolved() {
- return this.defaultContext.isPropertyResolved();
- }
-
- //TODO JSF 2.0 analog?
-// /**
-// * @param client
-// * @see com.sun.facelets.FaceletContext#popClient(com.sun.facelets.TemplateClient)
-// */
-// public void popClient(TemplateClient client) {
-// this.defaultContext.popClient(client);
-// }
-//
-// /**
-// * @param client
-// * @see com.sun.facelets.FaceletContext#pushClient(com.sun.facelets.TemplateClient)
-// */
-// public void pushClient(TemplateClient client) {
-// this.defaultContext.pushClient(client);
-// }
-
- /**
- * @param key
- * @param contextObject
- * @see javax.el.ELContext#putContext(java.lang.Class, java.lang.Object)
- */
- public void putContext(Class key, Object contextObject) {
- this.defaultContext.putContext(key, contextObject);
- }
-
- /**
- * @param name
- * @param value
- * @see com.sun.facelets.FaceletContext#setAttribute(java.lang.String, java.lang.Object)
- */
- public void setAttribute(String name, Object value) {
- this.defaultContext.setAttribute(name, value);
- }
-
- /**
- * @param fnMapper
- * @see com.sun.facelets.FaceletContext#setFunctionMapper(javax.el.FunctionMapper)
- */
- public void setFunctionMapper(FunctionMapper fnMapper) {
- this.defaultContext.setFunctionMapper(fnMapper);
- }
-
- /**
- * @param locale
- * @see javax.el.ELContext#setLocale(java.util.Locale)
- */
- public void setLocale(Locale locale) {
- this.defaultContext.setLocale(locale);
- }
-
- /**
- * @param resolved
- * @see javax.el.ELContext#setPropertyResolved(boolean)
- */
- public void setPropertyResolved(boolean resolved) {
- this.defaultContext.setPropertyResolved(resolved);
- }
-
- /**
- * @param varMapper
- * @see com.sun.facelets.FaceletContext#setVariableMapper(javax.el.VariableMapper)
- */
- public void setVariableMapper(VariableMapper varMapper) {
- this.defaultContext.setVariableMapper(varMapper);
- }
-
-}
Deleted: root/ui/trunk/components/core/src/main/java/org/ajax4jsf/taglib/html/facelets/IncludeHandler.java
===================================================================
--- root/ui/trunk/components/core/src/main/java/org/ajax4jsf/taglib/html/facelets/IncludeHandler.java 2009-07-31 11:19:57 UTC (rev 15073)
+++ root/ui/trunk/components/core/src/main/java/org/ajax4jsf/taglib/html/facelets/IncludeHandler.java 2009-07-31 11:34:48 UTC (rev 15074)
@@ -1,89 +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.taglib.html.facelets;
-
-import java.io.IOException;
-
-import javax.el.ELException;
-import javax.el.VariableMapper;
-import javax.faces.FacesException;
-import javax.faces.component.UIComponent;
-import javax.faces.view.facelets.ComponentConfig;
-import javax.faces.view.facelets.ComponentHandler;
-import javax.faces.view.facelets.FaceletContext;
-import javax.faces.view.facelets.TagAttribute;
-
-import org.ajax4jsf.component.UIInclude;
-
-/**
- * @author shura
- *
- */
-public class IncludeHandler extends ComponentHandler {
-
- private TagAttribute viewId;
-
- public IncludeHandler(ComponentConfig config) {
- super(config);
- this.viewId = getRequiredAttribute("viewId");
- }
-
- /*
- * (non-Javadoc)
- *
- * @see com.sun.facelets.tag.jsf.ComponentHandler#onComponentCreated(com.sun.facelets.FaceletContext,
- * javax.faces.component.UIComponent,
- * javax.faces.component.UIComponent)
- */
- public void onComponentCreated(FaceletContext ctx, UIComponent c,
- UIComponent parent) {
- // TODO Auto-generated method stub
- super.onComponentCreated(ctx, c, parent);
- }
-
- public void applyNextHandler(FaceletContext ctx, UIComponent component)
- throws IOException, FacesException, ELException {
- String path;
- if (component instanceof UIInclude) {
- UIInclude include = (UIInclude) component;
- path = include.getViewId();
- if(include.isWasNavigation()){
- component.getChildren().clear();
- }
- } else {
- path = (String) component.getAttributes().get("viewId");
- }
- VariableMapper orig = ctx.getVariableMapper();
- ctx.setVariableMapper(new VariableMapperWrapper(orig));
- try {
- this.nextHandler.apply(ctx, component);
- ctx.includeFacelet(component, path);
- } catch (Exception e) {
- throw new FacesException("UIInclude component "
- + component.getClientId(ctx.getFacesContext())
- + " could't include page with path " + path, e);
- } finally {
- ctx.setVariableMapper(orig);
- }
- }
-
-}
Deleted: root/ui/trunk/components/core/src/main/java/org/ajax4jsf/taglib/html/facelets/KeepAliveHandler.java
===================================================================
--- root/ui/trunk/components/core/src/main/java/org/ajax4jsf/taglib/html/facelets/KeepAliveHandler.java 2009-07-31 11:19:57 UTC (rev 15073)
+++ root/ui/trunk/components/core/src/main/java/org/ajax4jsf/taglib/html/facelets/KeepAliveHandler.java 2009-07-31 11:34:48 UTC (rev 15074)
@@ -1,82 +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.taglib.html.facelets;
-
-import java.io.IOException;
-
-import javax.el.ELException;
-import javax.faces.FacesException;
-import javax.faces.component.UIComponent;
-import javax.faces.context.FacesContext;
-import javax.faces.el.ValueBinding;
-import javax.faces.view.facelets.FaceletContext;
-import javax.faces.view.facelets.FaceletException;
-import javax.faces.view.facelets.TagAttribute;
-import javax.faces.view.facelets.TagAttributeException;
-import javax.faces.view.facelets.TagConfig;
-import javax.faces.view.facelets.TagHandler;
-
-import org.ajax4jsf.Messages;
-import org.ajax4jsf.event.AjaxPhaseListener;
-
-/**
- * @author shura
- *
- */
-public class KeepAliveHandler extends TagHandler {
-
- private final TagAttribute beanName;
-
- private final TagAttribute ajaxOnly;
- /**
- * @param config
- */
- public KeepAliveHandler(TagConfig config) {
- super(config);
- this.beanName = this.getRequiredAttribute("beanName");
- if (beanName != null) {
- if (!beanName.isLiteral()) {
- throw new TagAttributeException(this.tag, this.beanName, Messages.getMessage(Messages.MUST_BE_LITERAL_ERROR));
- }
- }
- this.ajaxOnly = getAttribute("ajaxOnly");
- }
-
- /* (non-Javadoc)
- * @see com.sun.facelets.FaceletHandler#apply(com.sun.facelets.FaceletContext, javax.faces.component.UIComponent)
- */
- public void apply(FaceletContext ctx, UIComponent parent)
- throws IOException, FacesException, FaceletException, ELException {
- // Get bean instance from EL expression.
- String name = beanName.getValue();
- boolean isAjaxOnly = ajaxOnly!=null?ajaxOnly.getBoolean(ctx):false;
- FacesContext facesContext = ctx.getFacesContext();
- String beanExpression = "#{"+name+"}";
- ValueBinding valueBinding = facesContext.getApplication().createValueBinding(beanExpression);
- Object bean = valueBinding.getValue(facesContext);
- String beanAttributeName = (isAjaxOnly ? AjaxPhaseListener.AJAX_BEAN_PREFIX : AjaxPhaseListener.VIEW_BEAN_PREFIX)
- + name;
- // Put bean instance to ViewRoot.
- facesContext.getViewRoot().getAttributes().put(beanAttributeName, bean);
- }
-
-}
Deleted: root/ui/trunk/components/core/src/main/java/org/ajax4jsf/taglib/html/facelets/MediaOutputHandler.java
===================================================================
--- root/ui/trunk/components/core/src/main/java/org/ajax4jsf/taglib/html/facelets/MediaOutputHandler.java 2009-07-31 11:19:57 UTC (rev 15073)
+++ root/ui/trunk/components/core/src/main/java/org/ajax4jsf/taglib/html/facelets/MediaOutputHandler.java 2009-07-31 11:34:48 UTC (rev 15074)
@@ -1,118 +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.taglib.html.facelets;
-
-import java.io.OutputStream;
-
-import javax.faces.view.facelets.ComponentConfig;
-import javax.faces.view.facelets.ComponentHandler;
-import javax.faces.view.facelets.FaceletContext;
-import javax.faces.view.facelets.MetaRule;
-import javax.faces.view.facelets.MetaRuleset;
-import javax.faces.view.facelets.Metadata;
-import javax.faces.view.facelets.MetadataTarget;
-import javax.faces.view.facelets.TagAttribute;
-
-import org.ajax4jsf.component.UIMediaOutput;
-
-/**
- * @author shura (latest modification by $Author: alexsmirnov $)
- * @version $Revision: 1.1.2.1 $ $Date: 2007/02/01 15:31:22 $
- *
- */
-public class MediaOutputHandler extends ComponentHandler {
-
- private static final MetaRule mmediaMetaRule = new MMediaMetaRule();
- /**
- * @param config
- */
- public MediaOutputHandler(ComponentConfig config) {
- super(config);
-
- }
-
- /* (non-Javadoc)
- * @see org.ajax4jsf.tag.AjaxComponentHandler#createMetaRuleset(java.lang.Class)
- */
- protected MetaRuleset createMetaRuleset(Class type) {
- MetaRuleset metaRules = super.createMetaRuleset(type);
- metaRules.addRule(mmediaMetaRule);
- return metaRules;
- }
-
- /**
- * @author shura (latest modification by $Author: alexsmirnov $)
- * @version $Revision: 1.1.2.1 $ $Date: 2007/02/01 15:31:22 $
- *
- */
- static class MMediaMetaRule extends MetaRule{
-
- /**
- *
- */
- public MMediaMetaRule() {
- super();
- }
-
- /* (non-Javadoc)
- * @see com.sun.facelets.tag.MetaRule#applyRule(java.lang.String, com.sun.facelets.tag.TagAttribute, com.sun.facelets.tag.MetadataTarget)
- */
- public Metadata applyRule(String name, TagAttribute attribute, MetadataTarget meta) {
- if (meta.isTargetInstanceOf(UIMediaOutput.class)) {
-
-
- if ("createContent".equals(name)) {
- return new MMediaActionMapper(attribute);
- }
- }
- return null;
- }
-
- }
- /**
- * @author shura (latest modification by $Author: alexsmirnov $)
- * @version $Revision: 1.1.2.1 $ $Date: 2007/02/01 15:31:22 $
- *
- */
- static class MMediaActionMapper extends Metadata {
-
- private static final Class<?>[] MMEDIA_ACTION_SIG = new Class[] {OutputStream.class,Object.class};
-
- private final TagAttribute _send;
- /**
- * @param attribute
- */
- public MMediaActionMapper(TagAttribute attribute) {
- _send = attribute;
- }
-
- /* (non-Javadoc)
- * @see com.sun.facelets.tag.Metadata#applyMetadata(com.sun.facelets.FaceletContext, java.lang.Object)
- */
- public void applyMetadata(FaceletContext ctx, Object instance) {
- ((UIMediaOutput) instance).setCreateContentExpression(this._send.getMethodExpression(ctx, null,
- MMEDIA_ACTION_SIG));
- }
-
- }
-
-}
Deleted: root/ui/trunk/components/core/src/main/java/org/ajax4jsf/taglib/html/facelets/RowKeyConverterRule.java
===================================================================
--- root/ui/trunk/components/core/src/main/java/org/ajax4jsf/taglib/html/facelets/RowKeyConverterRule.java 2009-07-31 11:19:57 UTC (rev 15073)
+++ root/ui/trunk/components/core/src/main/java/org/ajax4jsf/taglib/html/facelets/RowKeyConverterRule.java 2009-07-31 11:34:48 UTC (rev 15074)
@@ -1,31 +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.taglib.html.facelets;
-
-
-/**
- * Apply rowKeyConverter to component
- * @author Maksim Kaszynski
- */
-@Deprecated
-public class RowKeyConverterRule extends org.ajax4jsf.webapp.taglib.RowKeyConverterRule {
-
-}
Deleted: root/ui/trunk/components/core/src/main/java/org/ajax4jsf/taglib/html/facelets/VariableMapperWrapper.java
===================================================================
--- root/ui/trunk/components/core/src/main/java/org/ajax4jsf/taglib/html/facelets/VariableMapperWrapper.java 2009-07-31 11:19:57 UTC (rev 15073)
+++ root/ui/trunk/components/core/src/main/java/org/ajax4jsf/taglib/html/facelets/VariableMapperWrapper.java 2009-07-31 11:34:48 UTC (rev 15074)
@@ -1,65 +0,0 @@
-/**
- * Licensed under the Common Development and Distribution License,
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.sun.com/cddl/
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
- * implied. See the License for the specific language governing
- * permissions and limitations under the License.
- */
-package org.ajax4jsf.taglib.html.facelets;
-
-import java.util.HashMap;
-import java.util.Map;
-
-import javax.el.ELException;
-import javax.el.ValueExpression;
-import javax.el.VariableMapper;
-
-class VariableMapperWrapper extends VariableMapper {
-
- private VariableMapper mapper;
-
- private Map<String, ValueExpression> vars = null;
-
- public VariableMapperWrapper(VariableMapper mapper) {
- this.mapper = mapper;
- }
-
- /* (non-Javadoc)
- * @see javax.el.VariableMapper#resolveVariable(java.lang.String)
- */
- @Override
- public ValueExpression resolveVariable(String variable) {
- ValueExpression ve = null;
- try {
- if (this.vars != null) {
- ve = (ValueExpression) this.vars.get(variable);
- }
- if (ve == null) {
- return this.mapper.resolveVariable(variable);
- }
- return ve;
- } catch (StackOverflowError e) {
- throw new ELException("Could not Resolve Variable [Overflow]: " + variable, e);
- }
- }
-
- /* (non-Javadoc)
- * @see javax.el.VariableMapper#setVariable(java.lang.String, javax.el.ValueExpression)
- */
- @Override
- public ValueExpression setVariable(String variable,
- ValueExpression expression) {
-
- if (this.vars == null) {
- this.vars = new HashMap<String, ValueExpression>();
- }
- return (ValueExpression) this.vars.put(variable, expression);
- }
-
-}
Deleted: root/ui/trunk/components/core/src/main/java/org/ajax4jsf/taglib/html/facelets/package-info.java
===================================================================
--- root/ui/trunk/components/core/src/main/java/org/ajax4jsf/taglib/html/facelets/package-info.java 2009-07-31 11:19:57 UTC (rev 15073)
+++ root/ui/trunk/components/core/src/main/java/org/ajax4jsf/taglib/html/facelets/package-info.java 2009-07-31 11:34:48 UTC (rev 15074)
@@ -1,4 +0,0 @@
-/**
- * Classes defining the rendering model for HTML
- */
-package org.ajax4jsf.taglib.html.facelets;
Deleted: root/ui/trunk/components/core/src/main/java/org/ajax4jsf/taglib/html/jsp/ActionParamTag.java
===================================================================
--- root/ui/trunk/components/core/src/main/java/org/ajax4jsf/taglib/html/jsp/ActionParamTag.java 2009-07-31 11:19:57 UTC (rev 15073)
+++ root/ui/trunk/components/core/src/main/java/org/ajax4jsf/taglib/html/jsp/ActionParamTag.java 2009-07-31 11:34:48 UTC (rev 15074)
@@ -1,163 +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.taglib.html.jsp;
-
-import javax.el.MethodExpression;
-import javax.el.ValueExpression;
-import javax.faces.component.ActionSource;
-import javax.faces.component.UIComponent;
-import javax.faces.context.FacesContext;
-import javax.faces.convert.Converter;
-import javax.faces.webapp.UIComponentClassicTagBase;
-
-import org.ajax4jsf.Messages;
-import org.ajax4jsf.component.UIActionParameter;
-import org.ajax4jsf.webapp.taglib.UIComponentTagBase;
-
-
-/**
- * @author shura (latest modification by $Author: alexsmirnov $)
- * @version $Revision: 1.1.2.1 $ $Date: 2007/02/01 15:31:31 $
- *
- */
-public class ActionParamTag extends UIComponentTagBase
-{
-
- /* (non-Javadoc)
- * @see javax.faces.webapp.UIComponentTag#getComponentType()
- */
- public String getComponentType()
- {
- return "org.ajax4jsf.components.ActionParameter";
- }
-
- /* (non-Javadoc)
- * @see javax.faces.webapp.UIComponentTag#getRendererType()
- */
- public String getRendererType()
- {
- return null;
- }
- // UIComponent attributes --> already implemented in UIComponentTagBase
-
- // UIParameter attributes
- // value already implemented in UIComponentTagBase
- private ValueExpression _name;
- private ValueExpression _assignTo;
- private ValueExpression _converter;
- private ValueExpression _noEscape;
- private MethodExpression _actionListener;
-
- protected void setProperties(UIComponent component)
- {
- super.setProperties(component);
- setStringProperty(component, "name", _name);
- setBooleanProperty(component, "noEscape", _noEscape);
- if (_actionListener != null) {
- ((UIActionParameter) component).setActionListener(_actionListener);
- }
-
- //Find parent UIComponentTag
- UIComponentClassicTagBase componentTag =
- UIComponentClassicTagBase.getParentUIComponentClassicTagBase(pageContext);
- if (componentTag == null)
- {
- throw new IllegalArgumentException(Messages.getMessage(Messages.NO_UI_COMPONENT_TAG_ANCESTOR_ERROR, "ActionParameterTag"));
- }
-
- if (componentTag.getCreated())
- {
- //Component was just created, so we add the Listener
- UIComponent parentComponent = componentTag.getComponentInstance();
- if (parentComponent instanceof ActionSource)
- {
-
- if (_assignTo != null) {
- if (_assignTo.isLiteralText()) throw new IllegalArgumentException(Messages.getMessage(Messages.NO_VALUE_REFERENCE_ERROR_2, _assignTo));
- UIActionParameter al = (UIActionParameter)component;
- al.setAssignToBinding(_assignTo);
- if (_converter != null)
- {
- if (!_converter.isLiteralText()) {
- component.setValueExpression("converter", _converter);
- } else {
- Converter conv = FacesContext.getCurrentInstance().getApplication().createConverter(_converter.getExpressionString());
- al.setConverter(conv);
- }
- }
- ((ActionSource)parentComponent).addActionListener(al);
- }
- }
- }
-
- }
-
- public void setName(ValueExpression name)
- {
- _name = name;
- }
-
- /**
- * @param converter The converter to set.
- */
- public void setConverter(ValueExpression converter)
- {
- this._converter = converter;
- }
-
- /**
- * @param noEscape The noEscape to set.
- */
- public void setNoEscape(ValueExpression noEscape)
- {
- this._noEscape = noEscape;
- }
-
- /**
- * @param property The property to set.
- */
- public void setAssignTo(ValueExpression property)
- {
- this._assignTo = property;
- }
-
- /**
- * @param property The property to set.
- */
- public void setActionListener(MethodExpression listener) {
- this._actionListener = listener;
- }
-
- /* (non-Javadoc)
- * @see org.apache.myfaces.taglib.UIComponentTagBase#release()
- */
- public void release()
- {
- _name = null;
- _assignTo = null;
- _converter = null;
- _noEscape = null;
- _actionListener = null;
- super.release();
- }
-
-}
Deleted: root/ui/trunk/components/core/src/main/java/org/ajax4jsf/taglib/html/jsp/AjaxFormTag.java
===================================================================
--- root/ui/trunk/components/core/src/main/java/org/ajax4jsf/taglib/html/jsp/AjaxFormTag.java 2009-07-31 11:19:57 UTC (rev 15073)
+++ root/ui/trunk/components/core/src/main/java/org/ajax4jsf/taglib/html/jsp/AjaxFormTag.java 2009-07-31 11:34:48 UTC (rev 15074)
@@ -1,55 +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.taglib.html.jsp;
-
-import org.ajax4jsf.component.UIAjaxForm;
-import org.ajax4jsf.webapp.taglib.UIComponentTagBase;
-
-
-/**
- * Tag for creating Ajax version of HTML Form.
- * @author shura (latest modification by $Author: alexsmirnov $)
- * @version $Revision: 1.1.2.1 $ $Date: 2007/02/01 15:31:32 $
- *
- */
-public class AjaxFormTag extends UIComponentTagBase
-{
-
- /* (non-Javadoc)
- * @see javax.faces.webapp.UIComponentTag#getComponentType()
- */
- public String getComponentType()
- {
- // TODO Auto-generated method stub
- return UIAjaxForm.COMPONENT_TYPE;
- }
-
- /* (non-Javadoc)
- * @see javax.faces.webapp.UIComponentTag#getRendererType()
- */
- public String getRendererType()
- {
- // TODO Auto-generated method stub
- return "javax.faces.Form";
- }
-
-}
Deleted: root/ui/trunk/components/core/src/main/java/org/ajax4jsf/taglib/html/jsp/AjaxListenerTag.java
===================================================================
--- root/ui/trunk/components/core/src/main/java/org/ajax4jsf/taglib/html/jsp/AjaxListenerTag.java 2009-07-31 11:19:57 UTC (rev 15073)
+++ root/ui/trunk/components/core/src/main/java/org/ajax4jsf/taglib/html/jsp/AjaxListenerTag.java 2009-07-31 11:34:48 UTC (rev 15074)
@@ -1,111 +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.taglib.html.jsp;
-
-import javax.el.ValueExpression;
-import javax.faces.component.UIComponent;
-import javax.faces.context.FacesContext;
-import javax.faces.webapp.UIComponentClassicTagBase;
-import javax.servlet.jsp.JspException;
-import javax.servlet.jsp.tagext.Tag;
-import javax.servlet.jsp.tagext.TagSupport;
-
-import org.ajax4jsf.Messages;
-import org.ajax4jsf.event.AjaxListener;
-import org.ajax4jsf.event.AjaxListenerHelper;
-import org.ajax4jsf.event.AjaxSource;
-
-
-/**
- * @author shura
- *
- * Custom tag for append AJAX request listeners to AjaxContainer.
- *
- */
-public class AjaxListenerTag extends TagSupport {
-
- /**
- *
- */
- private static final long serialVersionUID = 2576519366310474212L;
- /**
- * class name for ajax events listener.
- */
- private ValueExpression type = null;
-
- private ValueExpression binding = null;
-
- /**
- *
- */
- public AjaxListenerTag() {
- }
-
- public void setType(ValueExpression type) {
- this.type = type;
- }
-
- /**
- * @param binding the binding to set
- */
- public void setBinding(ValueExpression binding) {
- this.binding = binding;
- }
-
- public int doStartTag() throws JspException {
- if (type == null) {
- throw new JspException(Messages.getMessage(Messages.NULL_TYPE_ATTRIBUTE_ERROR));
- }
-
- //Find parent UIComponentTag
- UIComponentClassicTagBase componentTag =
- UIComponentClassicTagBase.getParentUIComponentClassicTagBase(pageContext);
- if (componentTag == null) {
- throw new JspException(
- Messages.getMessage(Messages.NO_UI_COMPONENT_TAG_ANCESTOR_ERROR, "AjaxListenerTag"));
- }
-
- if (componentTag.getCreated()) {
- //Component was just created, so we add the Listener
- UIComponent component = componentTag.getComponentInstance();
- if (component instanceof AjaxSource) {
- AjaxListener listener;
- if(null != binding){
- listener = new AjaxListenerHelper(binding);
- } else {
- try {
- String className = (String) type.getValue(FacesContext.getCurrentInstance().getELContext());
- listener = (AjaxListener) Class.forName(className).newInstance();
- } catch (Exception e) {
- throw new JspException(Messages.getMessage(Messages.INSTANTIATE_LISTENER_ERROR, type, component.getId()), e);
- }
- }
- ((AjaxSource) component).addAjaxListener(listener);
- } else {
- throw new JspException(Messages.getMessage(Messages.NOT_PARENT_AJAX_COMPONENT_ERROR, component.getId()));
- }
- }
-
- return Tag.SKIP_BODY;
- }
-
-}
Deleted: root/ui/trunk/components/core/src/main/java/org/ajax4jsf/taglib/html/jsp/AjaxPageTag.java
===================================================================
--- root/ui/trunk/components/core/src/main/java/org/ajax4jsf/taglib/html/jsp/AjaxPageTag.java 2009-07-31 11:19:57 UTC (rev 15073)
+++ root/ui/trunk/components/core/src/main/java/org/ajax4jsf/taglib/html/jsp/AjaxPageTag.java 2009-07-31 11:34:48 UTC (rev 15074)
@@ -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.taglib.html.jsp;
-
-import javax.el.ValueExpression;
-import javax.faces.component.UIComponent;
-
-import org.ajax4jsf.renderkit.html.AjaxPageRenderer;
-
-
-/**
- * @author shura
- *
- * Other variant of AJAX View - render full html page with root <html>,
- * <head> ( filled from "head" facet ) and <body> areas.
- *
- */
-public class AjaxPageTag extends AjaxRegionTag {
-
- private ValueExpression onload;
- private ValueExpression onunload;
-
- /* (non-Javadoc)
- * @see javax.faces.webapp.UIComponentTag#getRendererType()
- */
- public String getRendererType() {
- return AjaxPageRenderer.RENDERER_TYPE;
- }
- /* (non-Javadoc)
- * @see javax.servlet.jsp.tagext.Tag#release()
- */
- public void release() {
- this.onload = null;
- this.onunload = null;
- super.release();
- }
- /* (non-Javadoc)
- * @see javax.faces.webapp.UIComponentTag#setProperties(javax.faces.component.UIComponent)
- */
- protected void setProperties(UIComponent component) {
- super.setProperties(component);
- setStringProperty(component, "onload", this.onload);
- setStringProperty(component, "onunload", this.onunload);
- }
- /**
- * @return Returns the onload.
- */
- public ValueExpression getOnload() {
- return onload;
- }
- /**
- * @return Returns the onunload.
- */
- public ValueExpression getOnunload() {
- return onunload;
- }
- /**
- * @param onload The onload to set.
- */
- public void setOnload(ValueExpression onload) {
- this.onload = onload;
- }
- /**
- * @param onunload The onunload to set.
- */
- public void setOnunload(ValueExpression onunload) {
- this.onunload = onunload;
- }
-}
Deleted: root/ui/trunk/components/core/src/main/java/org/ajax4jsf/taglib/html/jsp/AjaxRegionTag.java
===================================================================
--- root/ui/trunk/components/core/src/main/java/org/ajax4jsf/taglib/html/jsp/AjaxRegionTag.java 2009-07-31 11:19:57 UTC (rev 15073)
+++ root/ui/trunk/components/core/src/main/java/org/ajax4jsf/taglib/html/jsp/AjaxRegionTag.java 2009-07-31 11:34:48 UTC (rev 15074)
@@ -1,158 +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.taglib.html.jsp;
-
-import javax.el.MethodExpression;
-import javax.el.ValueExpression;
-import javax.faces.component.UIComponent;
-
-import org.ajax4jsf.Messages;
-import org.ajax4jsf.component.AjaxContainer;
-import org.ajax4jsf.component.UIAjaxRegion;
-import org.ajax4jsf.renderkit.html.AjaxRegionRenderer;
-import org.ajax4jsf.webapp.taglib.UIComponentTagBase;
-
-
-/**
- * @author shura
- * Tag for create root Ajax component. must be immediate in produced html/body.
- * Example use in jsp:
- *
- * For produce correct html code in any ( ajax and non-ajax requests ),
- * better result with <ajax:page> tag.
- */
-public class AjaxRegionTag extends UIComponentTagBase {
-
- private MethodExpression ajaxListener = null;
-
- private ValueExpression reRender = null;
-
- private ValueExpression immediate = null;
-
- private ValueExpression selfRendered = null;
-
- private ValueExpression javascriptLocation = null;
-
- /**
- *
- */
- public AjaxRegionTag() {
- super();
- }
-
- /*
- * (non-Javadoc)
- *
- * @see javax.faces.webapp.UIComponentTag#getComponentType()
- */
- public String getComponentType() {
- return UIAjaxRegion.COMPONENT_TYPE;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see javax.faces.webapp.UIComponentTag#getRendererType()
- */
- public String getRendererType() {
- return AjaxRegionRenderer.RENDERER_TYPE;
- }
-
- // set component properties
-
- /*
- * (non-Javadoc)
- *
- * @see javax.servlet.jsp.tagext.Tag#release()
- */
- public void release() {
- // release reources properties
- super.release();
- this.reRender = null;
- this.ajaxListener = null;
- this.immediate = null;
- this.selfRendered = null;
- this.javascriptLocation = null;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see javax.faces.webapp.UIComponentTag#setProperties(javax.faces.component.UIComponent)
- */
- protected void setProperties(UIComponent component) {
- super.setProperties(component);
- setBooleanProperty(component, "immediate", this.immediate);
- setStringProperty(component, "ajaxAreas", this.reRender);
- setBooleanProperty(component,"selfRendered",this.selfRendered);
- setStringProperty(component, "javascriptLocation", this.javascriptLocation);
- if (ajaxListener != null) {
- if (!(component instanceof AjaxContainer)) {
- throw new IllegalArgumentException(Messages.getMessage(Messages.NOT_AJAX_CONTAINER_ERROR, component.getClientId(getFacesContext())));
- }
- if (ajaxListener.isLiteralText()) {
- getFacesContext().getExternalContext().log(Messages.getMessage(Messages.INVALID_EXPRESSION, ajaxListener));
- }
- ((AjaxContainer) component).setAjaxListener(ajaxListener);
-
- }
- }
-
- /**
- * @param ajaxAreas
- * The ajaxAreas to set.
- */
- public void setReRender(ValueExpression ajaxAreas) {
- this.reRender = ajaxAreas;
- }
-
- /**
- * @param ajaxListener
- * The ajaxListener to set.
- */
- public void setAjaxListener(MethodExpression ajaxListener) {
- this.ajaxListener = ajaxListener;
- }
-
- /**
- * @param immediate
- * The immediate to set.
- */
- public void setImmediate(ValueExpression immediate) {
- this.immediate = immediate;
- }
-
- /**
- * @param selfRendered The selfRendered to set.
- */
- public void setSelfRendered(ValueExpression selfRendered) {
- this.selfRendered = selfRendered;
- }
-
-// public String getJavascriptLocation() {
-// return javascriptLocation;
-// }
-//
- public void setJavascriptLocation(ValueExpression javascriptLocation) {
- this.javascriptLocation = javascriptLocation;
- }
-}
Deleted: root/ui/trunk/components/core/src/main/java/org/ajax4jsf/taglib/html/jsp/AjaxStatusTag.java
===================================================================
--- root/ui/trunk/components/core/src/main/java/org/ajax4jsf/taglib/html/jsp/AjaxStatusTag.java 2009-07-31 11:19:57 UTC (rev 15073)
+++ root/ui/trunk/components/core/src/main/java/org/ajax4jsf/taglib/html/jsp/AjaxStatusTag.java 2009-07-31 11:34:48 UTC (rev 15074)
@@ -1,190 +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.taglib.html.jsp;
-
-import javax.el.ValueExpression;
-import javax.faces.component.UIComponent;
-
-import org.ajax4jsf.component.UIAjaxStatus;
-import org.ajax4jsf.renderkit.html.AjaxStatusRenderer;
-import org.ajax4jsf.webapp.taglib.HtmlComponentTagBase;
-
-
-/**
- *
- * Jsp Tag for create request state component.
- * @author shura (latest modification by $Author: alexsmirnov $)
- * @version $Revision: 1.1.2.1 $ $Date: 2007/02/01 15:31:30 $
- *
- */
-public class AjaxStatusTag extends HtmlComponentTagBase
-{
-
- private ValueExpression _for = null;
- /**
- * Text to output on start request
- */
- private ValueExpression _startText = null;
- /**
- * Text to display on complete request
- */
- private ValueExpression _stopText = null;
-
- /**
- * Style for display on start request
- */
- private ValueExpression _startStyle = null;
- /**
- * Style for displaying on complete
- */
- private ValueExpression _stopStyle = null;
- /**
- * Style class for display on request
- */
- private ValueExpression _startStyleClass = null;
- /**
- * Style class for display on complete request
- */
- private ValueExpression _stopStyleClass = null;
-
- /**
- * Force id to render in Html as is
- */
- private ValueExpression _forceId = null;
- /* (non-Javadoc)
- * @see javax.faces.webapp.UIComponentTag#getComponentType()
- */
- public String getComponentType()
- {
- // TODO Auto-generated method stub
- return UIAjaxStatus.COMPONENT_TYPE;
- }
-
- /* (non-Javadoc)
- * @see javax.faces.webapp.UIComponentTag#getRendererType()
- */
- public String getRendererType()
- {
- // TODO Auto-generated method stub
- return AjaxStatusRenderer.RENDERER_TYPE;
- }
-
- /* (non-Javadoc)
- * @see org.ajax4jsf.components.taglib.html.HtmlComponentTagBase#release()
- */
- public void release()
- {
- super.release();
- this._for = null;
- this._startStyle = null;
- this._startStyleClass = null;
- this._startText = null;
- this._stopStyle = null;
- this._stopStyleClass = null;
- this._stopText = null;
- this._forceId = null;
-
- }
-
- /* (non-Javadoc)
- * @see org.ajax4jsf.components.taglib.html.HtmlComponentTagBase#setProperties(javax.faces.component.UIComponent)
- */
- protected void setProperties(UIComponent component)
- {
- super.setProperties(component);
- setStringProperty(component, "for", _for);
- setStringProperty(component, "startText", _startText);
- setStringProperty(component, "stopText", _stopText);
- setStringProperty(component, "startStyle", _startStyle);
- setStringProperty(component, "stopStyle", _stopStyle);
- setStringProperty(component, "startStyleClass", _startStyleClass);
- setStringProperty(component, "stopStyleClass", _stopStyleClass);
- setBooleanProperty(component, "forceId", _forceId);
-
- }
-
-
- /**
- * @param _for The _for to set.
- */
- public void setFor(ValueExpression _for)
- {
- this._for = _for;
- }
-
- /**
- * @param style The _startStyle to set.
- */
- public void setStartStyle(ValueExpression style)
- {
- _startStyle = style;
- }
-
- /**
- * @param styleClass The _startStyleClass to set.
- */
- public void setStartStyleClass(ValueExpression styleClass)
- {
- _startStyleClass = styleClass;
- }
-
- /**
- * @param text The _startText to set.
- */
- public void setStartText(ValueExpression text)
- {
- _startText = text;
- }
-
- /**
- * @param stopText The stopText to set.
- */
- public void setStopText(ValueExpression stopText)
- {
- this._stopText = stopText;
- }
-
- /**
- * @param style The _stopStyle to set.
- */
- public void setStopStyle(ValueExpression style)
- {
- _stopStyle = style;
- }
-
- /**
- * @param styleClass The _stopStyleClass to set.
- */
- public void setStopStyleClass(ValueExpression styleClass)
- {
- _stopStyleClass = styleClass;
- }
-
- /**
- * @param forceId The forceId to set.
- */
- public void setForceId(ValueExpression forceId)
- {
- this._forceId = forceId;
- }
-
-}
Deleted: root/ui/trunk/components/core/src/main/java/org/ajax4jsf/taglib/html/jsp/AjaxSupportTag.java
===================================================================
--- root/ui/trunk/components/core/src/main/java/org/ajax4jsf/taglib/html/jsp/AjaxSupportTag.java 2009-07-31 11:19:57 UTC (rev 15073)
+++ root/ui/trunk/components/core/src/main/java/org/ajax4jsf/taglib/html/jsp/AjaxSupportTag.java 2009-07-31 11:34:48 UTC (rev 15074)
@@ -1,288 +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.taglib.html.jsp;
-
-import javax.el.MethodExpression;
-import javax.el.ValueExpression;
-import javax.faces.component.UIComponent;
-import javax.faces.webapp.UIComponentClassicTagBase;
-
-import org.ajax4jsf.Messages;
-import org.ajax4jsf.component.UIAjaxSupport;
-import org.ajax4jsf.renderkit.AjaxRendererUtils;
-import org.ajax4jsf.renderkit.RendererUtils.HTML;
-import org.ajax4jsf.webapp.taglib.UIComponentTagBase;
-
-
-/**
- *
- * @author shura (latest modification by $Author: alexsmirnov $)
- * @version $Revision: 1.1.2.1 $ $Date: 2007/02/01 15:31:32 $
- *
- */
-public class AjaxSupportTag extends UIComponentTagBase {
-
- static final String[] EVENT_HANDLER_ATTRIBUTES =
- {
- HTML.ondblclick_ATTRIBUTE,
- HTML.onmousedown_ATTRIBUTE,
- HTML.onmouseup_ATTRIBUTE,
- HTML.onmouseover_ATTRIBUTE,
- HTML.onmousemove_ATTRIBUTE,
- HTML.onmouseout_ATTRIBUTE,
- HTML.onkeypress_ATTRIBUTE,
- HTML.onkeydown_ATTRIBUTE,
- HTML.onkeyup_ATTRIBUTE,
- HTML.onclick_ATTRIBUTE,
- HTML.onchange_ATTRIBUTE,
- HTML.onblur_ATTRIBUTE,
- HTML.onfocus_ATTRIBUTE,
- HTML.onselect_ATTRIBUTE
- };
-
- public static final String AJAX_SUPPORT_FACET = "org.ajax4jsf.ajax.SUPPORT";
- /**
- * Id ( in form of findComponent method param ) of JSF component,
- * updated by this component ( parnt tag ) action.
- */
- private ValueExpression reRender = null;
-
- /**
- * Generate script for given event ( onclick, onenter ... )
- */
- private String event = null;
-
-
- /**
- * Id of request status component.
- */
- private ValueExpression status = null;
-
- /**
- * JavaScript function for call after request completed.
- */
- private ValueExpression oncomplete = null ;
-
- private MethodExpression action = null;
- private MethodExpression actionListener = null;
- private ValueExpression limitToList = null;
- private ValueExpression disableDefault = null;
- private ValueExpression value = null;
- private ValueExpression immediate = null;
- private ValueExpression ajaxSingle = null;
-
-
-
-
- /**
- * @param type The type to set.
- */
- public void setDisableDefault(ValueExpression ajaxType)
- {
- this.disableDefault = ajaxType;
- }
-
- /**
- * @param reRender
- * The targetId to set.
- */
- public void setReRender(ValueExpression ajaxId) {
- this.reRender = ajaxId;
- }
-
-
- /**
- * @param event The event to set.
- */
- public void setEvent(String event)
- {
- this.event = event;
- }
-
- /**
- * @param oncomplete The oncomplete to set.
- */
- public void setOncomplete(ValueExpression oncomplete)
- {
- this.oncomplete = oncomplete;
- }
-
- /**
- * @param status The status to set.
- */
- public void setStatus(ValueExpression status)
- {
- this.status = status;
- }
-
- /**
- * @param limitToList The submitForm to set.
- */
- public void setLimitToList(ValueExpression limitToList)
- {
- this.limitToList = limitToList;
- }
-
- /**
- * @param action The action to set.
- */
- public void setAction(MethodExpression action)
- {
- this.action = action;
- }
-
- /**
- * @param actionListener The actionListener to set.
- */
- public void setActionListener(MethodExpression actionListener)
- {
- this.actionListener = actionListener;
- }
-
- protected void setParentProperties(UIAjaxSupport uiComponent) {
-
- //Find parent UIComponentTag
- UIComponentClassicTagBase componentTag = null;
- try {
- componentTag = UIComponentClassicTagBase.getParentUIComponentClassicTagBase(pageContext);
- if (componentTag == null) {
- throw new IllegalArgumentException(
- Messages.getMessage(Messages.NO_UI_COMPONENT_TAG_ANCESTOR_ERROR, "AjaxSupportTag"));
- }
-
- if (componentTag.getCreated()) {
- //Component was just created, so we add the Listener
- UIComponent component = componentTag.getComponentInstance();
- uiComponent.setParentProperties(component);
- }
- } catch (ClassCastException e) {
- // JSF 1.2 - tags have other parent.
- }
-
- }
-
- /* (non-Javadoc)
- * @see javax.servlet.jsp.tagext.Tag#release()
- */
- public void release() {
- this.reRender = null;
- this.oncomplete = null;
- this.event = null;
- this.status =null;
- this.action = null;
- this.actionListener = null;
- this.limitToList = null;
- this.disableDefault = null;
- this.value = null;
- this.immediate=null;
- this.ajaxSingle = null;
- super.release();
- }
-
- /* (non-Javadoc)
- * @see javax.faces.webapp.UIComponentTag#getComponentType()
- */
- public String getComponentType()
- {
-
- return UIAjaxSupport.COMPONENT_TYPE;
- }
-
- /* (non-Javadoc)
- * @see javax.faces.webapp.UIComponentTag#getRendererType()
- */
- public String getRendererType()
- {
-
- return UIAjaxSupport.DEFAULT_RENDERER_TYPE;
- }
-
- /**
- * @param value The value to set.
- */
- public void setValue(ValueExpression value) {
- this.value = value;
- }
-
- /**
- * @param immediate The immediate to set.
- */
- public void setImmediate(ValueExpression immediate) {
- this.immediate = immediate;
- }
-
- /**
- * @param ajaxSingle The ajaxSingle to set.
- */
- public void setAjaxSingle(ValueExpression ajaxSingle) {
- this.ajaxSingle = ajaxSingle;
- }
-
- /* (non-Javadoc)
- * @see org.ajax4jsf.components.taglib.UIComponentTagBase#setProperties(javax.faces.component.UIComponent)
- */
- protected void setProperties(UIComponent component)
- {
- super.setProperties(component);
- setStringProperty(component, "event", event);
- setReRenderProperty(component);
- setStringProperty(component, "status", status);
- setStringProperty(component, "oncomplete", oncomplete);
- setBooleanProperty(component, "disableDefault", disableDefault );
- setBooleanProperty(component, "limitToList", limitToList);
- setActionProperty(component, action);
- setActionListenerProperty(component, actionListener);
- setValueProperty(component,value);
- setBooleanProperty(component,"immediate",immediate);
- setBooleanProperty(component,"ajaxSingle",ajaxSingle);
-
- setParentProperties((UIAjaxSupport) component);
- }
-
-
- private void setReRenderProperty(UIComponent component) {
- if (reRender != null) {
- if (reRender.isLiteralText()) {
- setStringProperty(component, "reRender", reRender);
- } else {
- //FIXME: Why do we evaluate reRender right now?
- //Collection can change any time.
- ((UIAjaxSupport) component).setReRender( AjaxRendererUtils.asSet(reRender.getValue(getELContext())));
- }
- }
-
- }
-
- /* (non-Javadoc)
- * @see javax.faces.webapp.UIComponentTag#getFacetName()
- */
- protected String getFacetName() {
- // TODO Auto-generated method stub
- if (null != event) {
- return AJAX_SUPPORT_FACET + event;
- } else {
- return AJAX_SUPPORT_FACET;
- }
- }
-
-
-}
Deleted: root/ui/trunk/components/core/src/main/java/org/ajax4jsf/taglib/html/jsp/IncludeTag.java
===================================================================
--- root/ui/trunk/components/core/src/main/java/org/ajax4jsf/taglib/html/jsp/IncludeTag.java 2009-07-31 11:19:57 UTC (rev 15073)
+++ root/ui/trunk/components/core/src/main/java/org/ajax4jsf/taglib/html/jsp/IncludeTag.java 2009-07-31 11:34:48 UTC (rev 15074)
@@ -1,261 +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.taglib.html.jsp;
-
-import java.io.IOException;
-
-import javax.el.ELException;
-import javax.el.ValueExpression;
-import javax.faces.FacesException;
-import javax.faces.component.UIComponent;
-import javax.faces.context.FacesContext;
-import javax.servlet.RequestDispatcher;
-import javax.servlet.ServletRequest;
-import javax.servlet.ServletResponse;
-import javax.servlet.jsp.JspException;
-import javax.servlet.jsp.JspWriter;
-
-import org.ajax4jsf.component.UIInclude;
-import org.ajax4jsf.webapp.taglib.UIComponentTagBase;
-
-/**
- * @author shura
- *
- */
-public class IncludeTag extends UIComponentTagBase {
-
- /**
- * @author shura
- *
- */
- private static final class NullJspWriter extends JspWriter {
-
-
- /**
- * @param arg0
- * @param arg1
- */
- private NullJspWriter() {
- super(1024, false);
- }
-
- public void clear() throws IOException {
- }
-
- public void clearBuffer() throws IOException {
- }
-
- public void close() throws IOException {
- }
-
- public void flush() throws IOException {
- }
-
- public int getRemaining() {
- return 0;
- }
-
- public void newLine() throws IOException {
- }
-
- public void print(boolean arg0) throws IOException {
- }
-
- public void print(char arg0) throws IOException {
- }
-
- public void print(int arg0) throws IOException {
- }
-
- public void print(long arg0) throws IOException {
- }
-
- public void print(float arg0) throws IOException {
- }
-
- public void print(double arg0) throws IOException {
- }
-
- public void print(char[] arg0) throws IOException {
- }
-
- public void print(String arg0) throws IOException {
- }
-
- public void print(Object arg0) throws IOException {
- }
-
- public void println() throws IOException {
- }
-
- public void println(boolean arg0) throws IOException {
- }
-
- public void println(char arg0) throws IOException {
- }
-
- public void println(int arg0) throws IOException {
- }
-
- public void println(long arg0) throws IOException {
- }
-
- public void println(float arg0) throws IOException {
- }
-
- public void println(double arg0) throws IOException {
- }
-
- public void println(char[] arg0) throws IOException {
- }
-
- public void println(String arg0) throws IOException {
- }
-
- public void println(Object arg0) throws IOException {
- }
-
- public void write(char[] cbuf, int off, int len) throws IOException {
- }
- }
-
- private ValueExpression viewId;
-
- /**
- * @param viewId
- * the viewId to set
- */
- public void setViewId(ValueExpression viewId) {
- this.viewId = viewId;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.ajax4jsf.webapp.taglib.UIComponentTagBase#release()
- */
- public void release() {
- super.release();
- viewId = null;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.ajax4jsf.webapp.taglib.UIComponentTagBase#setProperties(javax.faces.component.UIComponent)
- */
- protected void setProperties(UIComponent component) {
- super.setProperties(component);
- UIInclude include = (UIInclude) component;
- if (this.viewId != null) {
- if (this.viewId.isLiteralText()) {
- try {
-
- String value = (String) getFacesContext().getApplication()
- .getExpressionFactory().coerceToType(
- this.viewId.getExpressionString(),
- String.class);
-
- include.setViewId(value);
- } catch (ELException e) {
- throw new FacesException(e);
- }
- } else {
- component.setValueExpression("viewId", this.viewId);
- }
- }
- }
-
- /*
- * (non-Javadoc)
- *
- * @see javax.faces.webapp.UIComponentTag#doEndTag()
- */
- public int doEndTag() throws JspException {
- int i = super.doEndTag();
- return i;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see javax.faces.webapp.UIComponentTag#doStartTag()
- */
- public int doStartTag() throws JspException {
- int i = super.doStartTag();
- String resourcePath;
- UIComponent component = getComponentInstance();
- UIInclude includeComponent = null;
- if (component instanceof UIInclude) {
- includeComponent = (UIInclude) component;
- resourcePath = includeComponent.getViewId();
- if(includeComponent.isWasNavigation()){
- component.getChildren().clear();
- }
- } else {
- resourcePath = (String) component.getAttributes().get("viewId");
- }
- JspWriter out;
- if (component.isRendered()) {
- out = this.pageContext.getOut();
- } else {
- // All content of response will be skip.
- out = new NullJspWriter();
- }
- ServletRequest request = this.pageContext.getRequest();
- ServletResponse response = this.pageContext.getResponse();
- RequestDispatcher rd = request.getRequestDispatcher(resourcePath);
- FacesContext facesContext = getFacesContext();
- if(null == rd){
- throw new JspException("UIInclude component "+component.getClientId(facesContext)+ " could't include page with path "+resourcePath);
- }
- try {
- ServletResponseWrapperInclude responseWrapper = new ServletResponseWrapperInclude(
- response, out);
- rd.include(request, responseWrapper);
- // Write buffered data, if any;
- responseWrapper.flushBuffer();
- } catch (Exception e) {
- throw new JspException(e);
- }
- return i;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see javax.faces.webapp.UIComponentTag#getComponentType()
- */
- public String getComponentType() {
- return UIInclude.COMPONENT_TYPE;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see javax.faces.webapp.UIComponentTag#getRendererType()
- */
- public String getRendererType() {
- return null;
- }
-
-}
Deleted: root/ui/trunk/components/core/src/main/java/org/ajax4jsf/taglib/html/jsp/KeepAliveTag.java
===================================================================
--- root/ui/trunk/components/core/src/main/java/org/ajax4jsf/taglib/html/jsp/KeepAliveTag.java 2009-07-31 11:19:57 UTC (rev 15073)
+++ root/ui/trunk/components/core/src/main/java/org/ajax4jsf/taglib/html/jsp/KeepAliveTag.java 2009-07-31 11:34:48 UTC (rev 15074)
@@ -1,131 +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.taglib.html.jsp;
-
-import javax.el.ELContext;
-import javax.el.ExpressionFactory;
-import javax.el.ValueExpression;
-import javax.faces.application.Application;
-import javax.faces.context.FacesContext;
-import javax.servlet.jsp.JspException;
-import javax.servlet.jsp.tagext.Tag;
-import javax.servlet.jsp.tagext.TagSupport;
-
-import org.ajax4jsf.Messages;
-import org.ajax4jsf.event.AjaxPhaseListener;
-
-/**
- * @author shura
- *
- */
-public class KeepAliveTag extends TagSupport {
-
- /**
- *
- */
- private static final long serialVersionUID = 4322021112358067548L;
-
- private String beanName = null;
-
- private ValueExpression ajaxOnly = null;
-
- /**
- * @return the ajaxOnly
- */
- public ValueExpression getAjaxOnly() {
- return ajaxOnly;
- }
-
- /**
- * @param ajaxOnly the ajaxOnly to set
- */
- public void setAjaxOnly(ValueExpression ajaxOnly) {
- this.ajaxOnly = ajaxOnly;
- }
-
- /**
- * @return the name
- */
- public String getBeanName() {
- return beanName;
- }
-
- /**
- * @param name the name to set
- */
- public void setBeanName(String name) {
- this.beanName = name;
- }
-
- /* (non-Javadoc)
- * @see javax.servlet.jsp.tagext.TagSupport#doStartTag()
- */
- public int doStartTag() throws JspException {
- if (beanName == null) {
- throw new JspException(Messages.getMessage(Messages.NULL_TYPE_ATTRIBUTE_ERROR));
- }
-
- FacesContext facesContext = FacesContext.getCurrentInstance();
- Application application = facesContext.getApplication();
- ExpressionFactory factory = application.getExpressionFactory();
- ELContext elContext = facesContext.getELContext();
- ValueExpression beanNameEL =
- factory.createValueExpression(elContext, beanName, String.class);
- if(!beanNameEL.isLiteralText()){
- throw new JspException(Messages.getMessage(Messages.NAME_MUST_BE_LITERAL));
- }
- boolean isAjaxOnly = false;
- if (null != ajaxOnly) {
- if (ajaxOnly.isLiteralText())
- {
- //TODO: More sophisticated way to convert boolean value (yes/no, 1/0, on/off, etc.)
- isAjaxOnly = Boolean.parseBoolean(ajaxOnly.getExpressionString());
- }
- else
- {
- isAjaxOnly = Boolean.TRUE.equals(ajaxOnly.getValue(elContext));
- }
-
- }
- // Get bean instance from EL expression.
- String beanExpression = "#{"+beanName+"}";
- ValueExpression valueExpression =
- factory.createValueExpression(elContext, beanExpression, Object.class);
- Object bean = valueExpression.getValue(elContext);
- // Put bean instance to ViewRoot.
- String beanAttributeName = (isAjaxOnly ? AjaxPhaseListener.AJAX_BEAN_PREFIX : AjaxPhaseListener.VIEW_BEAN_PREFIX)
- + beanName;
- facesContext.getViewRoot().getAttributes().put(beanAttributeName, bean);
- return Tag.SKIP_BODY;
- }
-
- /* (non-Javadoc)
- * @see javax.servlet.jsp.tagext.TagSupport#release()
- */
- public void release() {
- beanName = null;
- ajaxOnly = null;
- super.release();
- }
-
-
-}
Deleted: root/ui/trunk/components/core/src/main/java/org/ajax4jsf/taglib/html/jsp/ServletResponseWrapperInclude.java
===================================================================
--- root/ui/trunk/components/core/src/main/java/org/ajax4jsf/taglib/html/jsp/ServletResponseWrapperInclude.java 2009-07-31 11:19:57 UTC (rev 15073)
+++ root/ui/trunk/components/core/src/main/java/org/ajax4jsf/taglib/html/jsp/ServletResponseWrapperInclude.java 2009-07-31 11:34:48 UTC (rev 15074)
@@ -1,168 +0,0 @@
-/*
- * Copyright 1999,2004 The Apache Software Foundation.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.ajax4jsf.taglib.html.jsp;
-
-import java.io.IOException;
-import java.io.PrintWriter;
-import java.util.Locale;
-
-import javax.servlet.ServletOutputStream;
-import javax.servlet.ServletResponse;
-import javax.servlet.http.HttpServletResponse;
-import javax.servlet.http.HttpServletResponseWrapper;
-import javax.servlet.jsp.JspWriter;
-
-import org.ajax4jsf.io.FastBufferOutputStream;
-
-
-
-/**
- * ServletResponseWrapper used by the JSP 'include' action.
- *
- * This wrapper response object is passed to RequestDispatcher.include(), so
- * that the output of the included resource is appended to that of the including
- * page.
- *
- * @author Pierre Delisle
- */
-
-public class ServletResponseWrapperInclude extends HttpServletResponseWrapper {
-
- /**
- * PrintWriter which appends to the JspWriter of the including page.
- */
- private PrintWriter _printWriter;
-
- private FastBufferOutputStream _bytes ;
-
- private ServletOutputStream _servletStream;
-
- private JspWriter _jspWriter;
-
- private boolean useWriter = false;
-
- private boolean useStream = false;
-
- public ServletResponseWrapperInclude(ServletResponse response,
- JspWriter jspWriter) {
- super((HttpServletResponse) response);
- this._printWriter = new PrintWriter(jspWriter);
- this._jspWriter = jspWriter;
- }
-
- /**
- * Returns a wrapper around the JspWriter of the including page.
- */
- public PrintWriter getWriter() throws IOException {
- if (useStream) {
- throw new IllegalStateException();
- }
- useWriter = true;
- return _printWriter;
- }
-
- public ServletOutputStream getOutputStream() throws IOException {
- if(useWriter){
- throw new IllegalStateException();
- }
- if (!useStream) {
- _bytes = new FastBufferOutputStream(getBufferSize());
- _servletStream = new ServletOutputStream(){
-
- /* (non-Javadoc)
- * @see java.io.OutputStream#flush()
- */
- public void flush() throws IOException {
- // TODO Auto-generated method stub
- super.flush();
- }
-
- /* (non-Javadoc)
- * @see java.io.OutputStream#write(byte[], int, int)
- */
- public void write(byte[] b, int off, int len) throws IOException {
- // TODO Auto-generated method stub
- _bytes.write(b, off, len);
- }
-
- /* (non-Javadoc)
- * @see java.io.OutputStream#write(byte[])
- */
- public void write(byte[] b) throws IOException {
- // TODO Auto-generated method stub
- _bytes.write(b);
- }
-
- /* (non-Javadoc)
- * @see java.io.OutputStream#write(int)
- */
- public void write(int b) throws IOException {
- _bytes.write(b);
- }
-
- };
- useStream = true;
- }
- return _servletStream;
- }
-
- /**
- * Clears the output buffer of the JspWriter associated with the including
- * page.
- */
- public void resetBuffer() {
- try {
- _jspWriter.clearBuffer();
- useWriter = false;
- useStream = false;
- _bytes = null;
- } catch (IOException ioe) {
- }
- }
-
- public void reset() {
- // TODO Auto-generated method stub
- resetBuffer();
- }
-
- public void flushBuffer() throws IOException {
- if (useStream) {
- // TODO - detect encoding ?
- _bytes.writeTo(_jspWriter, getCharacterEncoding());
- _bytes = new FastBufferOutputStream(getBufferSize());
- }
- }
-
- // Override ignored methods.
- public void setBufferSize(int arg0) {
- }
-
- public void setContentLength(int arg0) {
- }
- public void setContentType(String arg0) {
- }
- public void setStatus(int arg0) {
- }
- public void setLocale(Locale arg0) {
- }
- public void sendRedirect(String arg0) throws IOException {
- throw new IllegalStateException();
- }
-// public void setStatus(int arg0, String arg1) {
-// }
-
-}
Deleted: root/ui/trunk/components/core/src/main/java/org/ajax4jsf/taglib/html/jsp/package-info.java
===================================================================
--- root/ui/trunk/components/core/src/main/java/org/ajax4jsf/taglib/html/jsp/package-info.java 2009-07-31 11:19:57 UTC (rev 15073)
+++ root/ui/trunk/components/core/src/main/java/org/ajax4jsf/taglib/html/jsp/package-info.java 2009-07-31 11:34:48 UTC (rev 15074)
@@ -1,4 +0,0 @@
-/**
- * Tag library contains JSP tags that are useful in creating dynamic reusable components
- */
-package org.ajax4jsf.taglib.html.jsp;
Added: root/ui/trunk/components/core/src/main/java/org/richfaces/component/PushEventTracker.java
===================================================================
--- root/ui/trunk/components/core/src/main/java/org/richfaces/component/PushEventTracker.java (rev 0)
+++ root/ui/trunk/components/core/src/main/java/org/richfaces/component/PushEventTracker.java 2009-07-31 11:34:48 UTC (rev 15074)
@@ -0,0 +1,51 @@
+/**
+ * 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.component;
+
+import java.io.Serializable;
+import java.util.EventObject;
+import java.util.concurrent.atomic.AtomicBoolean;
+
+import org.ajax4jsf.event.PushEventListener;
+
+/**
+ * @author Nick Belaevski
+ * @since 4.0
+ */
+public class PushEventTracker implements PushEventListener, Serializable {
+
+ /**
+ *
+ */
+ private static final long serialVersionUID = -4362297582678089326L;
+
+ private final AtomicBoolean eventPerformed = new AtomicBoolean(false);
+
+ public void onEvent(EventObject event) {
+ eventPerformed.set(true);
+ }
+
+ public boolean pollStatus() {
+ return eventPerformed.compareAndSet(true, false);
+ }
+
+}
Added: root/ui/trunk/components/core/src/main/java/org/richfaces/component/PushListenersManager.java
===================================================================
--- root/ui/trunk/components/core/src/main/java/org/richfaces/component/PushListenersManager.java (rev 0)
+++ root/ui/trunk/components/core/src/main/java/org/richfaces/component/PushListenersManager.java 2009-07-31 11:34:48 UTC (rev 15074)
@@ -0,0 +1,60 @@
+/**
+ * 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.component;
+
+import javax.faces.context.FacesContext;
+
+import org.ajax4jsf.util.LRUMap;
+
+/**
+ * @author Nick Belaevski
+ * @since 4.0
+ */
+public class PushListenersManager {
+
+ private static final String CONTEXT_ATTRIBUTE_NAME = "richFacesPushListenersManager";
+
+ private LRUMap<String, PushEventTracker> listeners;
+
+ public PushListenersManager() {
+ //TODO configure map size
+ this.listeners = new LRUMap<String, PushEventTracker>();
+ }
+
+ public static PushListenersManager getInstance(FacesContext context) {
+ return (PushListenersManager) context.getExternalContext().
+ getApplicationMap().get(CONTEXT_ATTRIBUTE_NAME);
+ }
+
+ public PushEventTracker getListener(String name) {
+ synchronized (listeners) {
+ //LRUMap involves write for each operation, so RWLock is not acceptable here
+ PushEventTracker listener = listeners.get(name);
+ if (listener == null) {
+ listener = new PushEventTracker();
+ listeners.put(name, listener);
+ }
+
+ return listener;
+ }
+ }
+}
Deleted: root/ui/trunk/components/core/src/main/java/org/richfaces/event/package-info.java
===================================================================
--- root/ui/trunk/components/core/src/main/java/org/richfaces/event/package-info.java 2009-07-31 11:19:57 UTC (rev 15073)
+++ root/ui/trunk/components/core/src/main/java/org/richfaces/event/package-info.java 2009-07-31 11:34:48 UTC (rev 15074)
@@ -1,4 +0,0 @@
-/**
- * Interfaces describing events and event listeners, and concrete event implementation classes
- */
-package org.richfaces.event;
Deleted: root/ui/trunk/components/core/src/main/java/org/richfaces/renderkit/html/gradientimages/ButtonGradientImage.java
===================================================================
--- root/ui/trunk/components/core/src/main/java/org/richfaces/renderkit/html/gradientimages/ButtonGradientImage.java 2009-07-31 11:19:57 UTC (rev 15073)
+++ root/ui/trunk/components/core/src/main/java/org/richfaces/renderkit/html/gradientimages/ButtonGradientImage.java 2009-07-31 11:34:48 UTC (rev 15074)
@@ -1,33 +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.renderkit.html.gradientimages;
-
-import org.richfaces.renderkit.html.images.BaseControlBackgroundImage;
-import org.richfaces.skin.Skin;
-
-public class ButtonGradientImage extends BaseControlBackgroundImage {
-
- public ButtonGradientImage() {
- super(Skin.additionalBackgroundColor, "trimColor", 8);
- }
-
-}
Deleted: root/ui/trunk/components/core/src/main/java/org/richfaces/renderkit/html/gradientimages/ButtonInverseGradientImage.java
===================================================================
--- root/ui/trunk/components/core/src/main/java/org/richfaces/renderkit/html/gradientimages/ButtonInverseGradientImage.java 2009-07-31 11:19:57 UTC (rev 15073)
+++ root/ui/trunk/components/core/src/main/java/org/richfaces/renderkit/html/gradientimages/ButtonInverseGradientImage.java 2009-07-31 11:34:48 UTC (rev 15074)
@@ -1,33 +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.renderkit.html.gradientimages;
-
-import org.richfaces.renderkit.html.images.BaseControlBackgroundImage;
-import org.richfaces.skin.Skin;
-
-public class ButtonInverseGradientImage extends BaseControlBackgroundImage {
-
- public ButtonInverseGradientImage() {
- super("trimColor", Skin.additionalBackgroundColor, 8);
- }
-
-}
Deleted: root/ui/trunk/components/core/src/main/java/org/richfaces/renderkit/html/gradientimages/HeaderGradientImage.java
===================================================================
--- root/ui/trunk/components/core/src/main/java/org/richfaces/renderkit/html/gradientimages/HeaderGradientImage.java 2009-07-31 11:19:57 UTC (rev 15073)
+++ root/ui/trunk/components/core/src/main/java/org/richfaces/renderkit/html/gradientimages/HeaderGradientImage.java 2009-07-31 11:34:48 UTC (rev 15074)
@@ -1,33 +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.renderkit.html.gradientimages;
-
-import org.richfaces.renderkit.html.images.BaseControlBackgroundImage;
-import org.richfaces.skin.Skin;
-
-public class HeaderGradientImage extends BaseControlBackgroundImage {
-
- public HeaderGradientImage() {
- super(Skin.headerGradientColor, Skin.headerBackgroundColor, 8);
- }
-
-}
Deleted: root/ui/trunk/components/core/src/main/java/org/richfaces/renderkit/html/gradientimages/HeaderInverseGradientImage.java
===================================================================
--- root/ui/trunk/components/core/src/main/java/org/richfaces/renderkit/html/gradientimages/HeaderInverseGradientImage.java 2009-07-31 11:19:57 UTC (rev 15073)
+++ root/ui/trunk/components/core/src/main/java/org/richfaces/renderkit/html/gradientimages/HeaderInverseGradientImage.java 2009-07-31 11:34:48 UTC (rev 15074)
@@ -1,33 +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.renderkit.html.gradientimages;
-
-import org.richfaces.renderkit.html.images.BaseControlBackgroundImage;
-import org.richfaces.skin.Skin;
-
-public class HeaderInverseGradientImage extends BaseControlBackgroundImage {
-
- public HeaderInverseGradientImage() {
- super(Skin.headerBackgroundColor, Skin.headerGradientColor, 8);
- }
-
-}
Deleted: root/ui/trunk/components/core/src/main/java/org/richfaces/renderkit/html/gradientimages/InputGradientImage.java
===================================================================
--- root/ui/trunk/components/core/src/main/java/org/richfaces/renderkit/html/gradientimages/InputGradientImage.java 2009-07-31 11:19:57 UTC (rev 15073)
+++ root/ui/trunk/components/core/src/main/java/org/richfaces/renderkit/html/gradientimages/InputGradientImage.java 2009-07-31 11:34:48 UTC (rev 15074)
@@ -1,33 +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.renderkit.html.gradientimages;
-
-import org.richfaces.renderkit.html.images.BaseControlBackgroundImage;
-import org.richfaces.skin.Skin;
-
-public class InputGradientImage extends BaseControlBackgroundImage {
-
- public InputGradientImage() {
- super(Skin.additionalBackgroundColor, Skin.controlBackgroundColor, 8);
- }
-
-}
Deleted: root/ui/trunk/components/core/src/main/java/org/richfaces/renderkit/html/gradientimages/MenuGradientImage.java
===================================================================
--- root/ui/trunk/components/core/src/main/java/org/richfaces/renderkit/html/gradientimages/MenuGradientImage.java 2009-07-31 11:19:57 UTC (rev 15073)
+++ root/ui/trunk/components/core/src/main/java/org/richfaces/renderkit/html/gradientimages/MenuGradientImage.java 2009-07-31 11:34:48 UTC (rev 15074)
@@ -1,33 +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.renderkit.html.gradientimages;
-
-import org.richfaces.renderkit.html.images.BaseControlBackgroundImage;
-import org.richfaces.skin.Skin;
-
-public class MenuGradientImage extends BaseControlBackgroundImage {
-
- public MenuGradientImage() {
- super("tabBackgroundColor", Skin.additionalBackgroundColor, 8);
- }
-
-}
Deleted: root/ui/trunk/components/core/src/main/java/org/richfaces/renderkit/html/gradientimages/MenuInverseGradientImage.java
===================================================================
--- root/ui/trunk/components/core/src/main/java/org/richfaces/renderkit/html/gradientimages/MenuInverseGradientImage.java 2009-07-31 11:19:57 UTC (rev 15073)
+++ root/ui/trunk/components/core/src/main/java/org/richfaces/renderkit/html/gradientimages/MenuInverseGradientImage.java 2009-07-31 11:34:48 UTC (rev 15074)
@@ -1,33 +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.renderkit.html.gradientimages;
-
-import org.richfaces.renderkit.html.images.BaseControlBackgroundImage;
-import org.richfaces.skin.Skin;
-
-public class MenuInverseGradientImage extends BaseControlBackgroundImage {
-
- public MenuInverseGradientImage() {
- super(Skin.additionalBackgroundColor, "tabBackgroundColor", 8);
- }
-
-}
Deleted: root/ui/trunk/components/core/src/main/java/org/richfaces/renderkit/html/gradientimages/TabGradientImage.java
===================================================================
--- root/ui/trunk/components/core/src/main/java/org/richfaces/renderkit/html/gradientimages/TabGradientImage.java 2009-07-31 11:19:57 UTC (rev 15073)
+++ root/ui/trunk/components/core/src/main/java/org/richfaces/renderkit/html/gradientimages/TabGradientImage.java 2009-07-31 11:34:48 UTC (rev 15074)
@@ -1,33 +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.renderkit.html.gradientimages;
-
-import org.richfaces.renderkit.html.images.BaseControlBackgroundImage;
-import org.richfaces.skin.Skin;
-
-public class TabGradientImage extends BaseControlBackgroundImage {
-
- public TabGradientImage() {
- super("tabBackgroundColor", Skin.generalBackgroundColor, 8);
- }
-
-}
Deleted: root/ui/trunk/components/core/src/main/java/org/richfaces/renderkit/html/gradientimages/TabInverseGradientImage.java
===================================================================
--- root/ui/trunk/components/core/src/main/java/org/richfaces/renderkit/html/gradientimages/TabInverseGradientImage.java 2009-07-31 11:19:57 UTC (rev 15073)
+++ root/ui/trunk/components/core/src/main/java/org/richfaces/renderkit/html/gradientimages/TabInverseGradientImage.java 2009-07-31 11:34:48 UTC (rev 15074)
@@ -1,33 +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.renderkit.html.gradientimages;
-
-import org.richfaces.renderkit.html.images.BaseControlBackgroundImage;
-import org.richfaces.skin.Skin;
-
-public class TabInverseGradientImage extends BaseControlBackgroundImage {
-
- public TabInverseGradientImage() {
- super(Skin.generalBackgroundColor, "tabBackgroundColor", 8);
- }
-
-}
Deleted: root/ui/trunk/components/core/src/main/java/org/richfaces/renderkit/html/gradientimages/package-info.java
===================================================================
--- root/ui/trunk/components/core/src/main/java/org/richfaces/renderkit/html/gradientimages/package-info.java 2009-07-31 11:19:57 UTC (rev 15073)
+++ root/ui/trunk/components/core/src/main/java/org/richfaces/renderkit/html/gradientimages/package-info.java 2009-07-31 11:34:48 UTC (rev 15074)
@@ -1,4 +0,0 @@
-/**
- * Provides classes for creating and modifying gradient images
- */
-package org.richfaces.renderkit.html.gradientimages;
Deleted: root/ui/trunk/components/core/src/main/java/org/richfaces/renderkit/html/images/package-info.java
===================================================================
--- root/ui/trunk/components/core/src/main/java/org/richfaces/renderkit/html/images/package-info.java 2009-07-31 11:19:57 UTC (rev 15073)
+++ root/ui/trunk/components/core/src/main/java/org/richfaces/renderkit/html/images/package-info.java 2009-07-31 11:34:48 UTC (rev 15074)
@@ -1,4 +0,0 @@
-/**
- * Provides classes for creating and modifying images
- */
-package org.richfaces.renderkit.html.images;
Deleted: root/ui/trunk/components/core/src/main/java/org/richfaces/renderkit/html/package-info.java
===================================================================
--- root/ui/trunk/components/core/src/main/java/org/richfaces/renderkit/html/package-info.java 2009-07-31 11:19:57 UTC (rev 15073)
+++ root/ui/trunk/components/core/src/main/java/org/richfaces/renderkit/html/package-info.java 2009-07-31 11:34:48 UTC (rev 15074)
@@ -1,4 +0,0 @@
-/**
- * Classes defining the rendering model for HTML
- */
-package org.richfaces.renderkit.html;
Deleted: root/ui/trunk/components/core/src/main/java/org/richfaces/renderkit/package-info.java
===================================================================
--- root/ui/trunk/components/core/src/main/java/org/richfaces/renderkit/package-info.java 2009-07-31 11:19:57 UTC (rev 15073)
+++ root/ui/trunk/components/core/src/main/java/org/richfaces/renderkit/package-info.java 2009-07-31 11:34:48 UTC (rev 15074)
@@ -1,4 +0,0 @@
-/**
- * Fundamental classes and interfaces defining the rendering model
- */
-package org.richfaces.renderkit;
Added: root/ui/trunk/components/core/src/main/java/org/richfaces/resource/MediaOutputResource.java
===================================================================
--- root/ui/trunk/components/core/src/main/java/org/richfaces/resource/MediaOutputResource.java (rev 0)
+++ root/ui/trunk/components/core/src/main/java/org/richfaces/resource/MediaOutputResource.java 2009-07-31 11:34:48 UTC (rev 15074)
@@ -0,0 +1,42 @@
+/**
+ * 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.resource;
+
+import java.io.InputStream;
+
+/**
+ * @author Nick Belaevski
+ * @since 4.0
+ */
+public class MediaOutputResource extends AbstractBaseResource {
+
+ @Override
+ public InputStream getInputStream() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public void setCacheable(boolean cacheable) {
+ super.setCacheable(cacheable);
+ }
+}
Added: root/ui/trunk/components/core/src/main/java/org/richfaces/resource/PushResource.java
===================================================================
--- root/ui/trunk/components/core/src/main/java/org/richfaces/resource/PushResource.java (rev 0)
+++ root/ui/trunk/components/core/src/main/java/org/richfaces/resource/PushResource.java 2009-07-31 11:34:48 UTC (rev 15074)
@@ -0,0 +1,71 @@
+/**
+ * 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.resource;
+
+import java.io.InputStream;
+import java.util.Map;
+
+import javax.faces.context.ExternalContext;
+import javax.faces.context.FacesContext;
+
+import org.richfaces.component.PushEventTracker;
+import org.richfaces.component.PushListenersManager;
+import org.richfaces.resource.AbstractBaseResource;
+
+/**
+ * @author Nick Belaevski
+ * @since 4.0
+ */
+//TODO make this a singleton
+public class PushResource extends AbstractBaseResource {
+
+ @Override
+ public boolean isCacheable(FacesContext context) {
+ return false;
+ }
+
+ @Override
+ public InputStream getInputStream() {
+ return null;
+ }
+
+ @Override
+ public Map<String, String> getResponseHeaders() {
+ Map<String, String> headers = super.getResponseHeaders();
+
+ FacesContext facesContext = FacesContext.getCurrentInstance();
+ ExternalContext externalContext = facesContext.getExternalContext();
+ String pushId = externalContext.getRequestParameterMap().get("id");
+ if (pushId != null && pushId.length() != 0) {
+ PushListenersManager manager = PushListenersManager.getInstance(facesContext);
+
+ PushEventTracker eventTracker = manager.getListener(pushId);
+ if (eventTracker != null) {
+ if (eventTracker.pollStatus()) {
+ headers.put("Ajax-Push-Status", "READY");
+ }
+ }
+ }
+
+ return headers;
+ }
+}
Deleted: root/ui/trunk/components/core/src/main/java/org/richfaces/ui/component/package-info.java
===================================================================
--- root/ui/trunk/components/core/src/main/java/org/richfaces/ui/component/package-info.java 2009-07-31 11:19:57 UTC (rev 15073)
+++ root/ui/trunk/components/core/src/main/java/org/richfaces/ui/component/package-info.java 2009-07-31 11:34:48 UTC (rev 15074)
@@ -1,4 +0,0 @@
-/**
- * Defines classes for insert component
- */
-package org.richfaces.ui.component;
Added: root/ui/trunk/components/core/src/main/resources/META-INF/a4j.taglib.xml
===================================================================
--- root/ui/trunk/components/core/src/main/resources/META-INF/a4j.taglib.xml (rev 0)
+++ root/ui/trunk/components/core/src/main/resources/META-INF/a4j.taglib.xml 2009-07-31 11:34:48 UTC (rev 15074)
@@ -0,0 +1,22 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<facelet-taglib version="2.0" xmlns="http://java.sun.com/xml/ns/javaee" id="a4j">
+ <namespace>http://richfaces.org/a4j</namespace>
+
+ <tag>
+ <tag-name>push</tag-name>
+ <component>
+ <component-type>org.ajax4jsf.Push</component-type>
+ <renderer-type>org.ajax4jsf.PushRenderer</renderer-type>
+ <handler-class>org.ajax4jsf.taglib.html.facelets.AjaxPushHandler</handler-class>
+ </component>
+ </tag>
+ <tag>
+ <tag-name>jsFunction</tag-name>
+ <component>
+ <component-type>org.ajax4jsf.Function</component-type>
+ <renderer-type>org.ajax4jsf.FunctionRenderer</renderer-type>
+ </component>
+ </tag>
+
+</facelet-taglib>
Added: root/ui/trunk/components/core/src/main/resources/META-INF/faces-config.xml
===================================================================
--- root/ui/trunk/components/core/src/main/resources/META-INF/faces-config.xml (rev 0)
+++ root/ui/trunk/components/core/src/main/resources/META-INF/faces-config.xml 2009-07-31 11:34:48 UTC (rev 15074)
@@ -0,0 +1,35 @@
+<?xml version='1.0' encoding='UTF-8'?>
+
+<faces-config xmlns="http://java.sun.com/xml/ns/javaee"
+ version="2.0">
+
+ <managed-bean eager="true">
+ <managed-bean-name>richFacesPushListenersManager</managed-bean-name>
+ <managed-bean-class>org.richfaces.component.PushListenersManager</managed-bean-class>
+ <managed-bean-scope>application</managed-bean-scope>
+ </managed-bean>
+
+ <component>
+ <component-type>org.ajax4jsf.Push</component-type>
+ <component-class>org.ajax4jsf.component.html.HtmlPush</component-class>
+ </component>
+
+ <component>
+ <component-type>org.ajax4jsf.Function</component-type>
+ <component-class>org.ajax4jsf.component.html.HtmlAjaxFunction</component-class>
+ </component>
+
+ <render-kit>
+ <render-kit-id>HTML_BASIC</render-kit-id>
+ <renderer>
+ <component-family>org.ajax4jsf.Push</component-family>
+ <renderer-type>org.ajax4jsf.PushRenderer</renderer-type>
+ <renderer-class>org.ajax4jsf.renderkit.html.AjaxPushRenderer</renderer-class>
+ </renderer>
+ <renderer>
+ <component-family>org.ajax4jsf.Function</component-family>
+ <renderer-type>org.ajax4jsf.FunctionRenderer</renderer-type>
+ <renderer-class>org.ajax4jsf.renderkit.html.AjaxFunctionRenderer</renderer-class>
+ </renderer>
+ </render-kit>
+</faces-config>
\ No newline at end of file
Added: root/ui/trunk/components/core/src/main/resources/META-INF/org.richfaces.resource.MediaOutputResource.resource.properties
===================================================================
Added: root/ui/trunk/components/core/src/main/resources/META-INF/org.richfaces.resource.PushResource.resource.properties
===================================================================
Modified: root/ui/trunk/pom.xml
===================================================================
--- root/ui/trunk/pom.xml 2009-07-31 11:19:57 UTC (rev 15073)
+++ root/ui/trunk/pom.xml 2009-07-31 11:34:48 UTC (rev 15074)
@@ -23,12 +23,12 @@
<groupId>org.richfaces.cdk</groupId>
<artifactId>maven-cdk-plugin</artifactId>
<executions>
- <execution>
+ <!--execution>
<phase>generate-sources</phase>
<goals>
<goal>generate</goal>
</goals>
- </execution>
+ </execution-->
<!--execution>
<id>generate-test-sources</id>
<phase>generate-test-sources</phase>
Modified: root/ui/trunk/version-matrix/pom.xml
===================================================================
--- root/ui/trunk/version-matrix/pom.xml 2009-07-31 11:19:57 UTC (rev 15073)
+++ root/ui/trunk/version-matrix/pom.xml 2009-07-31 11:34:48 UTC (rev 15074)
@@ -157,7 +157,7 @@
<plugin>
<groupId>org.richfaces.cdk</groupId>
<artifactId>maven-cdk-plugin</artifactId>
- <version>3.3.2-SNAPSHOT</version>
+ <version>4.0.0-SNAPSHOT</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
15 years, 5 months
JBoss Rich Faces SVN: r15073 - in root/ui-sandbox/trunk/components: core and 17 other directories.
by richfaces-svn-commits@lists.jboss.org
Author: nbelaevski
Date: 2009-07-31 07:19:57 -0400 (Fri, 31 Jul 2009)
New Revision: 15073
Added:
root/ui-sandbox/trunk/components/core/
root/ui-sandbox/trunk/components/core/src/
root/ui-sandbox/trunk/components/core/src/main/
root/ui-sandbox/trunk/components/core/src/main/java/
root/ui-sandbox/trunk/components/core/src/main/java/org/
root/ui-sandbox/trunk/components/core/src/main/java/org/ajax4jsf/
root/ui-sandbox/trunk/components/core/src/main/java/org/ajax4jsf/component/
root/ui-sandbox/trunk/components/core/src/main/java/org/ajax4jsf/component/ResourceBundleMap.java
root/ui-sandbox/trunk/components/core/src/main/java/org/ajax4jsf/component/UIAjaxCommandButton.java
root/ui-sandbox/trunk/components/core/src/main/java/org/ajax4jsf/component/UIAjaxCommandLink.java
root/ui-sandbox/trunk/components/core/src/main/java/org/ajax4jsf/component/UIAjaxForm.java
root/ui-sandbox/trunk/components/core/src/main/java/org/ajax4jsf/component/UIAjaxRegion.java
root/ui-sandbox/trunk/components/core/src/main/java/org/ajax4jsf/component/UIAjaxStatus.java
root/ui-sandbox/trunk/components/core/src/main/java/org/ajax4jsf/component/UIAjaxSupport.java
root/ui-sandbox/trunk/components/core/src/main/java/org/ajax4jsf/component/UIInclude.java
root/ui-sandbox/trunk/components/core/src/main/java/org/ajax4jsf/component/UILoadBundle.java
root/ui-sandbox/trunk/components/core/src/main/java/org/ajax4jsf/component/UIPortlet.java
root/ui-sandbox/trunk/components/core/src/main/java/org/ajax4jsf/component/UIQueue.java
root/ui-sandbox/trunk/components/core/src/main/java/org/ajax4jsf/component/UIRepeat.java
root/ui-sandbox/trunk/components/core/src/main/java/org/ajax4jsf/component/UIResource.java
root/ui-sandbox/trunk/components/core/src/main/java/org/ajax4jsf/renderkit/
root/ui-sandbox/trunk/components/core/src/main/java/org/ajax4jsf/renderkit/html/
root/ui-sandbox/trunk/components/core/src/main/java/org/ajax4jsf/renderkit/html/AjaxFormRenderer.java
root/ui-sandbox/trunk/components/core/src/main/java/org/ajax4jsf/renderkit/html/AjaxIncludeRenderer.java
root/ui-sandbox/trunk/components/core/src/main/java/org/ajax4jsf/renderkit/html/AjaxPageRenderer.java
root/ui-sandbox/trunk/components/core/src/main/java/org/ajax4jsf/renderkit/html/AjaxPollRenderer.java
root/ui-sandbox/trunk/components/core/src/main/java/org/ajax4jsf/renderkit/html/AjaxRegionRenderer.java
root/ui-sandbox/trunk/components/core/src/main/java/org/ajax4jsf/renderkit/html/AjaxStatusRenderer.java
root/ui-sandbox/trunk/components/core/src/main/java/org/ajax4jsf/renderkit/html/AjaxSupportRenderer.java
root/ui-sandbox/trunk/components/core/src/main/java/org/ajax4jsf/renderkit/html/HtmlCommandLinkRenderer.java
root/ui-sandbox/trunk/components/core/src/main/java/org/ajax4jsf/renderkit/html/QueueRenderer.java
root/ui-sandbox/trunk/components/core/src/main/java/org/ajax4jsf/renderkit/html/QueueRendererData.java
root/ui-sandbox/trunk/components/core/src/main/java/org/ajax4jsf/renderkit/html/RepeatRenderer.java
root/ui-sandbox/trunk/components/core/src/main/java/org/ajax4jsf/renderkit/html/scripts/
root/ui-sandbox/trunk/components/core/src/main/java/org/ajax4jsf/renderkit/html/scripts/QueueScript.java
root/ui-sandbox/trunk/components/core/src/main/java/org/ajax4jsf/renderkit/html/scripts/QueueScriptResourceRenderer.java
root/ui-sandbox/trunk/components/core/src/main/java/org/ajax4jsf/taglib/
root/ui-sandbox/trunk/components/core/src/main/java/org/ajax4jsf/taglib/html/
root/ui-sandbox/trunk/components/core/src/main/java/org/ajax4jsf/taglib/html/facelets/
root/ui-sandbox/trunk/components/core/src/main/java/org/ajax4jsf/taglib/html/facelets/ActionParamHandler.java
root/ui-sandbox/trunk/components/core/src/main/java/org/ajax4jsf/taglib/html/facelets/AjaxListenerHandler.java
root/ui-sandbox/trunk/components/core/src/main/java/org/ajax4jsf/taglib/html/facelets/AjaxSupportHandler.java
root/ui-sandbox/trunk/components/core/src/main/java/org/ajax4jsf/taglib/html/facelets/FacetHandler.java
root/ui-sandbox/trunk/components/core/src/main/java/org/ajax4jsf/taglib/html/facelets/IncludeFaceletContext.java
root/ui-sandbox/trunk/components/core/src/main/java/org/ajax4jsf/taglib/html/facelets/IncludeHandler.java
root/ui-sandbox/trunk/components/core/src/main/java/org/ajax4jsf/taglib/html/facelets/KeepAliveHandler.java
root/ui-sandbox/trunk/components/core/src/main/java/org/ajax4jsf/taglib/html/facelets/MediaOutputHandler.java
root/ui-sandbox/trunk/components/core/src/main/java/org/ajax4jsf/taglib/html/facelets/RowKeyConverterRule.java
root/ui-sandbox/trunk/components/core/src/main/java/org/ajax4jsf/taglib/html/facelets/VariableMapperWrapper.java
root/ui-sandbox/trunk/components/core/src/main/java/org/ajax4jsf/taglib/html/facelets/package-info.java
root/ui-sandbox/trunk/components/core/src/main/java/org/ajax4jsf/taglib/html/jsp/
root/ui-sandbox/trunk/components/core/src/main/java/org/ajax4jsf/taglib/html/jsp/ActionParamTag.java
root/ui-sandbox/trunk/components/core/src/main/java/org/ajax4jsf/taglib/html/jsp/AjaxFormTag.java
root/ui-sandbox/trunk/components/core/src/main/java/org/ajax4jsf/taglib/html/jsp/AjaxListenerTag.java
root/ui-sandbox/trunk/components/core/src/main/java/org/ajax4jsf/taglib/html/jsp/AjaxPageTag.java
root/ui-sandbox/trunk/components/core/src/main/java/org/ajax4jsf/taglib/html/jsp/AjaxRegionTag.java
root/ui-sandbox/trunk/components/core/src/main/java/org/ajax4jsf/taglib/html/jsp/AjaxStatusTag.java
root/ui-sandbox/trunk/components/core/src/main/java/org/ajax4jsf/taglib/html/jsp/AjaxSupportTag.java
root/ui-sandbox/trunk/components/core/src/main/java/org/ajax4jsf/taglib/html/jsp/IncludeTag.java
root/ui-sandbox/trunk/components/core/src/main/java/org/ajax4jsf/taglib/html/jsp/KeepAliveTag.java
root/ui-sandbox/trunk/components/core/src/main/java/org/ajax4jsf/taglib/html/jsp/ServletResponseWrapperInclude.java
root/ui-sandbox/trunk/components/core/src/main/java/org/ajax4jsf/taglib/html/jsp/package-info.java
root/ui-sandbox/trunk/components/core/src/main/java/org/richfaces/
root/ui-sandbox/trunk/components/core/src/main/java/org/richfaces/renderkit/
root/ui-sandbox/trunk/components/core/src/main/java/org/richfaces/renderkit/html/
root/ui-sandbox/trunk/components/core/src/main/java/org/richfaces/renderkit/html/gradientimages/
root/ui-sandbox/trunk/components/core/src/main/java/org/richfaces/renderkit/html/gradientimages/ButtonGradientImage.java
root/ui-sandbox/trunk/components/core/src/main/java/org/richfaces/renderkit/html/gradientimages/ButtonInverseGradientImage.java
root/ui-sandbox/trunk/components/core/src/main/java/org/richfaces/renderkit/html/gradientimages/HeaderGradientImage.java
root/ui-sandbox/trunk/components/core/src/main/java/org/richfaces/renderkit/html/gradientimages/HeaderInverseGradientImage.java
root/ui-sandbox/trunk/components/core/src/main/java/org/richfaces/renderkit/html/gradientimages/InputGradientImage.java
root/ui-sandbox/trunk/components/core/src/main/java/org/richfaces/renderkit/html/gradientimages/MenuGradientImage.java
root/ui-sandbox/trunk/components/core/src/main/java/org/richfaces/renderkit/html/gradientimages/MenuInverseGradientImage.java
root/ui-sandbox/trunk/components/core/src/main/java/org/richfaces/renderkit/html/gradientimages/TabGradientImage.java
root/ui-sandbox/trunk/components/core/src/main/java/org/richfaces/renderkit/html/gradientimages/TabInverseGradientImage.java
Log:
Preparation for ALPHA1
Copied: root/ui-sandbox/trunk/components/core/src/main/java/org/ajax4jsf/component/ResourceBundleMap.java (from rev 15053, root/ui/trunk/components/core/src/main/java/org/ajax4jsf/component/ResourceBundleMap.java)
===================================================================
--- root/ui-sandbox/trunk/components/core/src/main/java/org/ajax4jsf/component/ResourceBundleMap.java (rev 0)
+++ root/ui-sandbox/trunk/components/core/src/main/java/org/ajax4jsf/component/ResourceBundleMap.java 2009-07-31 11:19:57 UTC (rev 15073)
@@ -0,0 +1,142 @@
+/**
+ * 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.Collection;
+import java.util.Map;
+import java.util.MissingResourceException;
+import java.util.ResourceBundle;
+import java.util.Set;
+
+import org.ajax4jsf.Messages;
+
+/**
+ * Very limited Map decorator to ResourceBundle.
+ * @author shura
+ *
+ */
+public class ResourceBundleMap implements Map<String, Object> {
+
+ private ResourceBundle _bundle;
+
+ /**
+ * @param bundle
+ */
+ public ResourceBundleMap(ResourceBundle bundle) {
+ super();
+ _bundle = bundle;
+ }
+
+ /* (non-Javadoc)
+ * @see java.util.Map#size()
+ */
+ public int size() {
+ return 0;
+ }
+
+ /* (non-Javadoc)
+ * @see java.util.Map#isEmpty()
+ */
+ public boolean isEmpty() {
+ return false;
+ }
+
+ /* (non-Javadoc)
+ * @see java.util.Map#containsKey(java.lang.Object)
+ */
+ public boolean containsKey(Object key) {
+
+ try {
+ _bundle.getObject(key.toString());
+ return true;
+ } catch (MissingResourceException e) {
+ return false;
+ }
+ }
+
+ /* (non-Javadoc)
+ * @see java.util.Map#containsValue(java.lang.Object)
+ */
+ public boolean containsValue(Object value) {
+ // TODO Auto-generated method stub
+ return false;
+ }
+
+ /* (non-Javadoc)
+ * @see java.util.Map#get(java.lang.Object)
+ */
+ public Object get(Object key) {
+ try {
+ return _bundle.getObject(key.toString());
+ } catch (MissingResourceException e) {
+ return key;
+ }
+ }
+
+ /* (non-Javadoc)
+ * @see java.util.Map#put(java.lang.Object, java.lang.Object)
+ */
+ public Object put(String arg0, Object arg1) {
+ throw new UnsupportedOperationException(Messages.getMessage(Messages.BUNDLE_MAP_NO_PUT_VALUE));
+ }
+
+ /* (non-Javadoc)
+ * @see java.util.Map#remove(java.lang.Object)
+ */
+ public Object remove(Object key) {
+ throw new UnsupportedOperationException(Messages.getMessage(Messages.BUNDLE_MAP_NO_REMOVE_VALUE));
+ }
+
+
+ /* (non-Javadoc)
+ * @see java.util.Map#clear()
+ */
+ public void clear() {
+ throw new UnsupportedOperationException(Messages.getMessage(Messages.BUNDLE_MAP_NO_REMOVE_VALUE));
+ }
+
+ /* (non-Javadoc)
+ * @see java.util.Map#keySet()
+ */
+ public Set<String> keySet() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ /* (non-Javadoc)
+ * @see java.util.Map#values()
+ */
+ public Collection<Object> values() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ public Set<java.util.Map.Entry<String, Object>> entrySet() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ public void putAll(Map<? extends String, ? extends Object> t) {
+ throw new UnsupportedOperationException(Messages.getMessage(Messages.BUNDLE_MAP_NO_PUT_VALUE));
+ }
+
+}
Copied: root/ui-sandbox/trunk/components/core/src/main/java/org/ajax4jsf/component/UIAjaxCommandButton.java (from rev 15053, root/ui/trunk/components/core/src/main/java/org/ajax4jsf/component/UIAjaxCommandButton.java)
===================================================================
--- root/ui-sandbox/trunk/components/core/src/main/java/org/ajax4jsf/component/UIAjaxCommandButton.java (rev 0)
+++ root/ui-sandbox/trunk/components/core/src/main/java/org/ajax4jsf/component/UIAjaxCommandButton.java 2009-07-31 11:19:57 UTC (rev 15073)
@@ -0,0 +1,33 @@
+/**
+ * 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;
+
+
+/**
+ * @author asmirnov(a)exadel.com (latest modification by $Author: alexsmirnov $)
+ * @version $Revision: 1.1.2.1 $ $Date: 2007/01/09 18:58:28 $
+ *
+ */
+public abstract class UIAjaxCommandButton extends AjaxActionComponent {
+ public static final String COMPONENT_TYPE="org.ajax4jsf.CommandButton";
+
+}
Copied: root/ui-sandbox/trunk/components/core/src/main/java/org/ajax4jsf/component/UIAjaxCommandLink.java (from rev 15053, root/ui/trunk/components/core/src/main/java/org/ajax4jsf/component/UIAjaxCommandLink.java)
===================================================================
--- root/ui-sandbox/trunk/components/core/src/main/java/org/ajax4jsf/component/UIAjaxCommandLink.java (rev 0)
+++ root/ui-sandbox/trunk/components/core/src/main/java/org/ajax4jsf/component/UIAjaxCommandLink.java 2009-07-31 11:19:57 UTC (rev 15073)
@@ -0,0 +1,33 @@
+/**
+ * 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;
+
+
+/**
+ * @author asmirnov(a)exadel.com (latest modification by $Author: alexsmirnov $)
+ * @version $Revision: 1.1.2.1 $ $Date: 2007/01/09 18:58:26 $
+ *
+ */
+public abstract class UIAjaxCommandLink extends AjaxActionComponent {
+
+ public static final String COMPONENT_TYPE="org.ajax4jsf.CommandLink";
+}
Copied: root/ui-sandbox/trunk/components/core/src/main/java/org/ajax4jsf/component/UIAjaxForm.java (from rev 15053, root/ui/trunk/components/core/src/main/java/org/ajax4jsf/component/UIAjaxForm.java)
===================================================================
--- root/ui-sandbox/trunk/components/core/src/main/java/org/ajax4jsf/component/UIAjaxForm.java (rev 0)
+++ root/ui-sandbox/trunk/components/core/src/main/java/org/ajax4jsf/component/UIAjaxForm.java 2009-07-31 11:19:57 UTC (rev 15073)
@@ -0,0 +1,181 @@
+/**
+ * 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.Iterator;
+
+import javax.faces.component.UIComponent;
+import javax.faces.component.UIForm;
+import javax.faces.context.FacesContext;
+import javax.faces.event.AbortProcessingException;
+import javax.faces.event.FacesEvent;
+
+import org.ajax4jsf.context.AjaxContext;
+import org.ajax4jsf.event.AjaxEvent;
+import org.ajax4jsf.event.AjaxListener;
+import org.ajax4jsf.event.AjaxSource;
+
+
+/**
+ * Quite different from default <code>HtmlForm</code> - process child components
+ * not only for submitted form, but if submitted parent <code>AjaxContainer</code>
+ * @author shura (latest modification by $Author: alexsmirnov $)
+ * @version $Revision: 1.1.2.3 $ $Date: 2007/02/06 16:23:22 $
+ *
+ */
+public abstract class UIAjaxForm extends UIForm implements AjaxComponent, AjaxSource, IterationStateHolder
+{
+ public static final String COMPONENT_TYPE = "org.ajax4jsf.Form";
+
+ /* (non-Javadoc)
+ * @see javax.faces.component.UIComponent#processDecodes(javax.faces.context.FacesContext)
+ */
+ public void processDecodes(javax.faces.context.FacesContext context)
+ {
+ if (context == null) {
+ throw new NullPointerException("context");
+ }
+ decode(context);
+ if (mustProcessed(context))
+ {
+ for (Iterator<UIComponent> it = getFacetsAndChildren(); it.hasNext();)
+ {
+ UIComponent childOrFacet = (UIComponent) it.next();
+ childOrFacet.processDecodes(context);
+ }
+ }
+ }
+
+
+ /* (non-Javadoc)
+ * @see javax.faces.component.UIComponent#processValidators(javax.faces.context.FacesContext)
+ */
+ public void processValidators(javax.faces.context.FacesContext context)
+ {
+ if (context == null) throw new NullPointerException("context");
+ if (mustProcessed(context))
+ {
+ for (Iterator<UIComponent> it = getFacetsAndChildren(); it.hasNext();)
+ {
+ UIComponent childOrFacet = (UIComponent) it.next();
+ childOrFacet.processValidators(context);
+ }
+ }
+ }
+
+
+
+ /* (non-Javadoc)
+ * @see javax.faces.component.UIComponent#processUpdates(javax.faces.context.FacesContext)
+ */
+ public void processUpdates(javax.faces.context.FacesContext context)
+ {
+ if (context == null) throw new NullPointerException("context");
+ if (mustProcessed(context))
+ {
+ for (Iterator<UIComponent> it = getFacetsAndChildren(); it.hasNext();)
+ {
+ UIComponent childOrFacet = (UIComponent) it.next();
+ childOrFacet.processUpdates(context);
+ }
+ }
+ }
+
+ /**
+ * Test for condition processing decoders/validators/updates
+ * @param context current <code>FacesContext</code>
+ * @return true if submitted parent AjaxContainer or current form.
+ */
+ private boolean mustProcessed(FacesContext context)
+ {
+// if ( !AjaxContext.getCurrentInstance(context).isAjaxRequest(context)) {
+ if (!isSubmitted() ) {
+ return false;
+ }
+// }
+ return true;
+ }
+
+
+ /* (non-Javadoc)
+ * @see javax.faces.component.UIComponentBase#broadcast(javax.faces.event.FacesEvent)
+ */
+ public void broadcast(FacesEvent event) throws AbortProcessingException {
+ // perform default
+ super.broadcast(event);
+ if (event instanceof AjaxEvent) {
+ // complete re-Render fields. AjaxEvent deliver before render response.
+ setupReRender();
+ }
+ }
+
+
+ /**
+ * Template methods for fill set of resions to render in subclasses.
+ */
+ protected void setupReRender() {
+ FacesContext context = getFacesContext();
+ AjaxContext.getCurrentInstance(context).addRegionsFromComponent(this);
+ }
+
+
+
+
+ /* (non-Javadoc)
+ * @see org.ajax4jsf.framework.ajax.AjaxSource#addAjaxListener(org.ajax4jsf.framework.ajax.AjaxListener)
+ */
+ public void addAjaxListener(AjaxListener listener) {
+ addFacesListener(listener);
+ }
+
+
+ /* (non-Javadoc)
+ * @see org.ajax4jsf.framework.ajax.AjaxSource#getAjaxListeners()
+ */
+ public AjaxListener[] getAjaxListeners() {
+ AjaxListener al[] = (AjaxListener [])
+ getFacesListeners(AjaxListener.class);
+ return (al);
+
+ }
+
+
+ /* (non-Javadoc)
+ * @see org.ajax4jsf.framework.ajax.AjaxSource#removeAjaxListener(org.ajax4jsf.framework.ajax.AjaxListener)
+ */
+ public void removeAjaxListener(AjaxListener listener) {
+ removeFacesListener(listener);
+
+ }
+
+ public abstract boolean isAjaxSubmit();
+
+ public abstract void setAjaxSubmit(boolean ajax);
+
+ public Object getIterationState() {
+ return isSubmitted() ? Boolean.TRUE : Boolean.FALSE;
+ }
+
+ public void setIterationState(Object state) {
+ setSubmitted(Boolean.TRUE.equals(state));
+ }
+}
Copied: root/ui-sandbox/trunk/components/core/src/main/java/org/ajax4jsf/component/UIAjaxRegion.java (from rev 15053, root/ui/trunk/components/core/src/main/java/org/ajax4jsf/component/UIAjaxRegion.java)
===================================================================
--- root/ui-sandbox/trunk/components/core/src/main/java/org/ajax4jsf/component/UIAjaxRegion.java (rev 0)
+++ root/ui-sandbox/trunk/components/core/src/main/java/org/ajax4jsf/component/UIAjaxRegion.java 2009-07-31 11:19:57 UTC (rev 15073)
@@ -0,0 +1,289 @@
+/**
+ * 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.Iterator;
+import java.util.Set;
+
+import javax.el.MethodExpression;
+import javax.faces.component.ContextCallback;
+import javax.faces.component.UIComponent;
+import javax.faces.component.UIPanel;
+import javax.faces.context.FacesContext;
+import javax.faces.event.AbortProcessingException;
+import javax.faces.event.FacesEvent;
+
+import org.ajax4jsf.context.AjaxContext;
+import org.ajax4jsf.event.AjaxListener;
+import org.ajax4jsf.renderkit.AjaxContainerRenderer;
+
+/**
+ * @author asmirnov(a)exadel.com (latest modification by $Author: alexsmirnov $)
+ * @version $Revision: 1.1.2.3 $ $Date: 2007/02/08 15:02:06 $
+ *
+ */
+public abstract class UIAjaxRegion extends UIPanel implements AjaxContainer {
+
+ private AjaxRegionBrige brige;
+
+ private static final ContextCallback decodeCallback= new ContextCallback(){
+ public void invokeContextCallback(FacesContext context,
+ UIComponent target) {
+ target.processDecodes(context);
+ }
+ };
+
+ private static final ContextCallback validateCallback= new ContextCallback(){
+ public void invokeContextCallback(FacesContext context,
+ UIComponent target) {
+ target.processValidators(context);
+ }
+ };
+
+ private static final ContextCallback updateCallback= new ContextCallback(){
+ public void invokeContextCallback(FacesContext context,
+ UIComponent target) {
+ target.processUpdates(context);
+ }
+ };
+
+ public static final String COMPONENT_TYPE = "org.ajax4jsf.AjaxRegion";
+
+ /**
+ *
+ */
+ public UIAjaxRegion() {
+ brige = new AjaxRegionBrige(this);
+ }
+
+ @Override
+ public void processDecodes(FacesContext context) {
+ AjaxContext ajaxContext = AjaxContext.getCurrentInstance(context);
+ String ajaxSingleClientId = ajaxContext.getAjaxSingleClientId();
+ // Process this component itself
+ try {
+ decode(context);
+ } catch (RuntimeException e) {
+ context.renderResponse();
+ throw e;
+ }
+ if (ajaxContext.isAjaxRequest() && null != ajaxSingleClientId) {
+ invokeOnComponent(context, ajaxSingleClientId, new ContextCallbackWrapper(decodeCallback));
+ Set<String> areasToProcess = ajaxContext.getAjaxAreasToProcess();
+ if(null != areasToProcess){
+ for (String areaId : areasToProcess) {
+ invokeOnComponent(context, areaId, new ContextCallbackWrapper(decodeCallback));
+ }
+ }
+ } else {
+ // Process all facets and children of this component
+ Iterator<UIComponent> kids = getFacetsAndChildren();
+ while (kids.hasNext()) {
+ UIComponent kid = kids.next();
+ kid.processDecodes(context);
+ }
+ }
+ }
+
+ @Override
+ public void processValidators(FacesContext context) {
+ AjaxContext ajaxContext = AjaxContext.getCurrentInstance(context);
+ String ajaxSingleClientId = ajaxContext.getAjaxSingleClientId();
+ if (ajaxContext.isAjaxRequest() && null != ajaxSingleClientId) {
+ invokeOnComponent(context, ajaxSingleClientId, new ContextCallbackWrapper(validateCallback));
+ Set<String> areasToProcess = ajaxContext.getAjaxAreasToProcess();
+ if(null != areasToProcess){
+ for (String areaId : areasToProcess) {
+ invokeOnComponent(context, areaId, new ContextCallbackWrapper(validateCallback));
+ }
+ }
+ } else {
+ super.processValidators(context);
+ }
+ }
+
+ @Override
+ public void processUpdates(FacesContext context) {
+ AjaxContext ajaxContext = AjaxContext.getCurrentInstance(context);
+ String ajaxSingleClientId = ajaxContext.getAjaxSingleClientId();
+ if (ajaxContext.isAjaxRequest() && null != ajaxSingleClientId) {
+ invokeOnComponent(context, ajaxSingleClientId, new ContextCallbackWrapper(updateCallback));
+ Set<String> areasToProcess = ajaxContext.getAjaxAreasToProcess();
+ if(null != areasToProcess){
+ for (String areaId : areasToProcess) {
+ invokeOnComponent(context, areaId, new ContextCallbackWrapper(updateCallback));
+ }
+ }
+ } else {
+ super.processUpdates(context);
+ }
+ }
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.ajax4jsf.framework.ajax.AjaxViewBrige#broadcast(javax.faces.event.FacesEvent)
+ */
+ public void broadcast(FacesEvent event) throws AbortProcessingException {
+ super.broadcast(event);
+ brige.broadcast(event);
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.ajax4jsf.framework.ajax.AjaxViewBrige#getAjaxListener()
+ */
+ public MethodExpression getAjaxListener() {
+ return brige.getAjaxListener();
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.ajax4jsf.framework.ajax.AjaxViewBrige#isImmediate()
+ */
+ public boolean isImmediate() {
+ return brige.isImmediate();
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.ajax4jsf.framework.ajax.AjaxViewBrige#isSubmitted()
+ */
+ public boolean isSubmitted() {
+ return brige.isSubmitted();
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.ajax4jsf.framework.ajax.AjaxViewBrige#restoreState(javax.faces.context.FacesContext,
+ * java.lang.Object)
+ */
+ public void restoreState(FacesContext context, Object state) {
+ Object[] mystate = (Object[]) state;
+ super.restoreState(context, mystate[0]);
+ brige.restoreState(context, mystate[1]);
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.ajax4jsf.framework.ajax.AjaxViewBrige#saveState(javax.faces.context.FacesContext)
+ */
+ public Object saveState(FacesContext context) {
+ Object[] state = new Object[2];
+ state[0] = super.saveState(context);
+ state[1] = brige.saveState(context);
+ return state;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.ajax4jsf.framework.ajax.AjaxViewBrige#setAjaxListener(javax.faces.el.MethodBinding)
+ */
+ public void setAjaxListener(MethodExpression ajaxListener) {
+ brige.setAjaxListener(ajaxListener);
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.ajax4jsf.framework.ajax.AjaxViewBrige#setImmediate(boolean)
+ */
+ public void setImmediate(boolean immediate) {
+ brige.setImmediate(immediate);
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.ajax4jsf.framework.ajax.AjaxViewBrige#setSubmitted(boolean)
+ */
+ public void setSubmitted(boolean submitted) {
+ brige.setSubmitted(submitted);
+ }
+
+ public void addAjaxListener(AjaxListener listener) {
+ addFacesListener(listener);
+ }
+
+ public AjaxListener[] getAjaxListeners() {
+ return (AjaxListener[]) getFacesListeners(AjaxListener.class);
+ }
+
+ public void removeAjaxListener(AjaxListener listener) {
+ removeFacesListener(listener);
+
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.ajax4jsf.framework.ajax.AjaxViewBrige#isSelfRendered()
+ */
+ public boolean isSelfRendered() {
+ return brige.isSelfRendered();
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.ajax4jsf.framework.ajax.AjaxViewBrige#setSelfRendered(boolean)
+ */
+ public void setSelfRendered(boolean selfRendered) {
+ brige.setSelfRendered(selfRendered);
+ }
+
+ public void encodeAjax(FacesContext context) throws IOException {
+ String rendererType = getRendererType();
+ if (rendererType != null) {
+ ((AjaxContainerRenderer) getRenderer(context)).encodeAjax(context,
+ this);
+ }
+
+ }
+
+
+ /**
+ * @return
+ * @see org.ajax4jsf.component.AjaxRegionBrige#isTransient()
+ */
+ public boolean isTransient() {
+ return brige.isTransient();
+ }
+
+
+ /**
+ * @param transientFlag
+ * @see org.ajax4jsf.component.AjaxRegionBrige#setTransient(boolean)
+ */
+ public void setTransient(boolean transientFlag) {
+ brige.setTransient(transientFlag);
+ }
+
+
+
+}
Copied: root/ui-sandbox/trunk/components/core/src/main/java/org/ajax4jsf/component/UIAjaxStatus.java (from rev 15053, root/ui/trunk/components/core/src/main/java/org/ajax4jsf/component/UIAjaxStatus.java)
===================================================================
--- root/ui-sandbox/trunk/components/core/src/main/java/org/ajax4jsf/component/UIAjaxStatus.java (rev 0)
+++ root/ui-sandbox/trunk/components/core/src/main/java/org/ajax4jsf/component/UIAjaxStatus.java 2009-07-31 11:19:57 UTC (rev 15073)
@@ -0,0 +1,383 @@
+/**
+ * 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.Serializable;
+
+import javax.el.ELContext;
+import javax.el.ValueExpression;
+import javax.faces.FacesException;
+import javax.faces.component.UIComponent;
+import javax.faces.component.UIComponentBase;
+import javax.faces.context.FacesContext;
+
+import org.ajax4jsf.Messages;
+import org.ajax4jsf.renderkit.AjaxRendererUtils;
+import org.ajax4jsf.renderkit.RendererUtils;
+
+
+/**
+ *
+ * Component for create request state status area.
+ * can create 2 output text areas ( <span> ) with different text and styles.
+ * if defined "start" or/and "stop" facets, it's use as conttent
+ * for different state.
+ * By default, "start" text/facet rendered with display = none style.
+ * On client side, display style changed for elements on
+ * start-stop request.
+ * @author shura (latest modification by $Author: alexsmirnov $)
+ * @version $Revision: 1.1.2.1 $ $Date: 2007/01/09 18:58:25 $
+ *
+ */
+public class UIAjaxStatus extends UIComponentBase
+{
+
+ private static final String COMPONENT_FAMILY = "javax.faces.Output";
+ public static final String COMPONENT_TYPE = "org.ajax4jsf.AjaxStatus";
+
+
+ /* (non-Javadoc)
+ * @see javax.faces.component.UIComponent#getFamily()
+ */
+ public String getFamily()
+ {
+ return COMPONENT_FAMILY;
+ }
+
+ /**
+ * id of form for wich status will displayed
+ */
+ private String _for = null;
+
+ /**
+ *
+ * @param new value of id of form for wich status will displayed to set
+ */
+ public void setFor(String _for)
+ {
+ this._for = _for;
+ }
+
+ /**
+ * @return value or result of valueBinding of id of form for wich status will displayed
+ *
+ */
+ public String getFor()
+ {
+ return (String) getValueOrBinding(_for, "for");
+ }
+
+ /**
+ * Text to output on start request
+ */
+ private String _startText = null;
+
+ /**
+ * setter method for property
+ * @param new value of Text to output on start request to set
+ */
+ public void setStartText(String startText)
+ {
+ this._startText = startText;
+ }
+
+ /**
+ * @return value or result of valueBinding of Text to output on start request
+ */
+ public String getStartText()
+ {
+ return (String) getValueOrBinding(_startText, "startText");
+ }
+
+ /**
+ * Text to display on complete request
+ */
+ private String _stopText = null;
+
+ /**
+ * setter method for property
+ * @param new value of Text to display on complete request to set
+ */
+ public void setStopText(String stopText)
+ {
+ this._stopText = stopText;
+ }
+
+ /**
+ * @return value or result of valueBinding of Text to display on complete request
+ */
+ public String getStopText()
+ {
+ return (String) getValueOrBinding(_stopText, "stopText");
+ }
+ /**
+ * Style for display on start request
+ */
+ private String _startStyle = null;
+
+ /**
+ * setter method for property
+ * @param new value of Style for display on start request to set
+ */
+ public void setStartStyle(String startStyle)
+ {
+ this._startStyle = startStyle;
+ }
+
+ /**
+ * @return value or result of valueBinding of Style for display on start request
+ */
+ public String getStartStyle()
+ {
+ return (String) getValueOrBinding(_startStyle, "startStyle");
+ }
+ /**
+ * Style for displaying on complete
+ */
+ private String _stopStyle = null;
+
+ /**
+ * setter method for property
+ * @param new value of Style for displaying on complete to set
+ */
+ public void setStopStyle(String stopStyle)
+ {
+ this._stopStyle = stopStyle;
+ }
+
+ /**
+ * @return value or result of valueBinding of Style for displaying on complete
+ */
+ public String getStopStyle()
+ {
+ return (String) getValueOrBinding(_stopStyle, "stopStyle");
+ }
+ /**
+ * Style class for display on request
+ */
+ private String _startStyleClass = null;
+
+ /**
+ * setter method for property
+ * @param new value of Style class for display on request to set
+ */
+ public void setStartStyleClass(String startStyleClass)
+ {
+ this._startStyleClass = startStyleClass;
+ }
+
+ /**
+ * @return value or result of valueBinding of Style class for display on request
+ */
+ public String getStartStyleClass()
+ {
+ return (String) getValueOrBinding(_startStyleClass, "startStyleClass");
+ }
+ /**
+ * Style class for display on complete request
+ */
+ private String _stopStyleClass = null;
+
+ /**
+ * setter method for property
+ * @param new value of Style class for display on complete request to set
+ */
+ public void setStopStyleClass(String stopStyleClass)
+ {
+ this._stopStyleClass = stopStyleClass;
+ }
+
+
+ /**
+ * Force id to render in Html as is
+ */
+ private boolean _forceId = false;
+ private boolean _forceIdSet = false;
+
+ /**
+ * setter method for property
+ * @param new value of Force id to render in Html as is to set
+ */
+ public void setForceId(boolean forceId)
+ {
+ this._forceId = forceId;
+ this._forceIdSet = true;
+ }
+
+ /**
+ * @return value or result of valueBinding of Force id to render in Html as is
+ */
+ public boolean isForceId()
+ {
+ return isValueOrBinding(_forceId, _forceIdSet, "forceId");
+ }
+
+
+
+
+ private String _clientId = null;
+
+ /* (non-Javadoc)
+ * @see javax.faces.component.UIComponentBase#getClientId(javax.faces.context.FacesContext)
+ */
+ public String getClientId(FacesContext context) {
+ if (null == _clientId) {
+ String forValue = getFor();
+ UIComponent container;
+ if (null != forValue) {
+ container = RendererUtils.getInstance().findComponentFor(this, forValue);
+ // 'for' attribute must be pointed to real container in view tree
+ if (null == container || !(container instanceof AjaxContainer)) {
+ throw new FacesException(
+ Messages.getMessage(Messages.FOR_TARGETS_NO_AJAX_CONTAINER, getId()));
+ }
+ _clientId = container.getClientId(context) + ":status";
+
+ } else if (isForceId()) {
+ _clientId = getRenderer(context).convertClientId(context,
+ this.getId());
+ } else if (null !=(container = (UIComponent) AjaxRendererUtils.findAjaxContainer(context,this))) {
+ _clientId = container.getClientId(context) + ":status";
+ } else {
+ _clientId = super.getClientId(context);
+ }
+ }
+ return _clientId;
+ }
+
+
+ /* (non-Javadoc)
+ * reset clientId for calculate
+ * @see javax.faces.component.UIComponentBase#setId(java.lang.String)
+ */
+ public void setId(String arg0) {
+ super.setId(arg0);
+ _clientId = null;
+ }
+
+ /* (non-Javadoc)
+ * @see javax.faces.component.UIComponentBase#restoreState(javax.faces.context.FacesContext, java.lang.Object)
+ */
+ public void restoreState(FacesContext context, Object state)
+ {
+ State myState = (State) state;
+ _for = myState._for;
+ _startText = myState._startText;
+ _stopText = myState._stopText;
+ _startStyle = myState._startStyle;
+ _stopStyle = myState._stopStyle;
+ _startStyleClass = myState._startStyleClass;
+ _stopStyleClass = myState._stopStyleClass;
+ _forceId = myState._forceId;
+ _forceIdSet = myState._forceIdSet;
+ super.restoreState(context, myState.superState);
+ }
+
+ /* (non-Javadoc)
+ * @see javax.faces.component.UIComponentBase#saveState(javax.faces.context.FacesContext)
+ */
+ public Object saveState(FacesContext context)
+ {
+ State state = new State();
+ state._for = _for;
+ state._startText = _startText;
+ state._stopText = _stopText;
+ state._startStyle = _startStyle;
+ state._stopStyle = _stopStyle;
+ state._startStyleClass = _startStyleClass;
+ state._stopStyleClass = _stopStyleClass;
+ state._forceId = _forceId;
+ state._forceIdSet = _forceIdSet;
+ state.superState = super.saveState(context);
+ return state;
+ }
+
+ /**
+ * @author shura (latest modification by $Author: alexsmirnov $)
+ * @version $Revision: 1.1.2.1 $ $Date: 2007/01/09 18:58:25 $
+ * Memento pattern state class for save-restore component.
+ */
+ public static class State implements Serializable {
+ /**
+ *
+ */
+ private static final long serialVersionUID = 317266574102385358L;
+ Object superState;
+ String _for;
+ String _startText;
+ String _stopText;
+ String _startStyle;
+ String _stopStyle;
+ String _startStyleClass;
+ String _stopStyleClass;
+ boolean _forceIdSet;
+ boolean _forceId;
+ }
+
+ /**
+ * @return value or result of valueBinding of Style class for display on complete request
+ */
+ public String getStopStyleClass()
+ {
+ return (String) getValueOrBinding(_stopStyleClass, "stopStyleClass");
+ }
+
+ /**
+ * @param field - value of field to get.
+ * @param name - name of field, to get from ValueBinding
+ * @return field or value of binding expression.
+ */
+ private Object getValueOrBinding(Object field, String name){
+ if( null != field){
+ return field;
+ }
+ ValueExpression vb = getValueExpression(name);
+ if (null != vb) {
+ return vb.getValue(getELContext());
+ } else {
+ return null;
+ }
+
+ }
+
+ /**
+ * @param field - value of field to get.
+ * @param name - name of field, to get from ValueBinding
+ * @return boolean value, based on field or valuebinding.
+ */
+ private boolean isValueOrBinding(boolean field, boolean fieldSet, String name){
+ if( fieldSet ){
+ return field;
+ }
+ ValueExpression vb = getValueExpression(name);
+ if (null != vb) {
+ return ((Boolean)vb.getValue(getELContext())).booleanValue();
+ } else {
+ return false;
+ }
+
+ }
+
+ private ELContext getELContext() {
+ return getFacesContext().getELContext();
+ }
+}
Copied: root/ui-sandbox/trunk/components/core/src/main/java/org/ajax4jsf/component/UIAjaxSupport.java (from rev 15053, root/ui/trunk/components/core/src/main/java/org/ajax4jsf/component/UIAjaxSupport.java)
===================================================================
--- root/ui-sandbox/trunk/components/core/src/main/java/org/ajax4jsf/component/UIAjaxSupport.java (rev 0)
+++ root/ui-sandbox/trunk/components/core/src/main/java/org/ajax4jsf/component/UIAjaxSupport.java 2009-07-31 11:19:57 UTC (rev 15073)
@@ -0,0 +1,164 @@
+/**
+ * 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.ValueExpression;
+import javax.faces.FacesException;
+import javax.faces.component.UIComponent;
+import javax.faces.context.FacesContext;
+
+import org.ajax4jsf.Messages;
+import org.ajax4jsf.renderkit.AjaxRendererUtils;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+/**
+ * Component for append ajax functions to any control component. Append action
+ * functionality to non-action control, setup javascript events for parent
+ * component,
+ *
+ * @author shura (latest modification by $Author: alexsmirnov $)
+ * @version $Revision: 1.1.2.3 $ $Date: 2007/02/12 17:46:52 $
+ *
+ */
+public abstract class UIAjaxSupport extends AjaxActionComponent implements
+ AjaxSupport {
+
+ // ~ Static fields/initializers
+ // ---------------------------------------------
+
+ public static final String COMPONENT_TYPE = "org.ajax4jsf.Support";
+ public static final String COMPONENT_FAMILY = "org.ajax4jsf.AjaxSupport";
+ public static final String DEFAULT_RENDERER_TYPE = "org.ajax4jsf.components.AjaxSupportRenderer";
+ public static final String AJAX_SUPPORT_SET = "com.exadel.components.ajax.support.";
+ private static final Log log = LogFactory.getLog(UIAjaxSupport.class);
+
+ @Override
+ public void setValueExpression(String name, ValueExpression binding) {
+ // var - not allowed name. must be literal.
+ if ("var".equals(name)) {
+ throw new FacesException(Messages.getMessage(
+ Messages.VAR_MUST_BE_LITERAL,
+ getClientId(getFacesContext())));
+ }
+ if ("event".equals(name)) {
+ throw new FacesException(Messages.getMessage(
+ Messages.EVENT_MUST_BE_LITERAL,
+ getClientId(getFacesContext())));
+ }
+ super.setValueExpression(name, binding);
+ }
+
+ /**
+ * Create Special <code>ValueBinding</code> for build JavaScrept event
+ * code in parent component from this.
+ *
+ * @return <code>EventValueBinding</code> based on properties of current
+ * component
+ */
+ private ValueExpression getEventValueBinding() {
+ if (log.isDebugEnabled()) {
+ log.debug(Messages.getMessage(Messages.CREATE_JAVASCRIPT_EVENT,
+ getId()));
+ }
+ return new EventValueExpression(this);
+ }
+
+ /**
+ * @return JavaScript eventString. Rebuild on every call, since can be in
+ * loop ( as in dataTable ) with different parameters.
+ */
+ public String getEventString() {
+ StringBuffer buildOnEvent = new StringBuffer();
+ String onsubmit = getOnsubmit();
+ // Insert script to call before submit ajax request.
+ if (null != onsubmit) {
+ buildOnEvent.append(onsubmit).append(";");
+ }
+ buildOnEvent.append(AjaxRendererUtils.buildOnEvent(this,
+ getFacesContext(), getEvent(), true));
+ String script = buildOnEvent.toString();
+ return script;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see javax.faces.component.UIComponentBase#decode(javax.faces.context.FacesContext)
+ */
+ public void decode(FacesContext context) {
+ // Due to JSF RI 1.1 bug, clear cached clientId
+ setId(getId());
+ super.decode(context);
+ }
+
+ /**
+ * After nornal setting <code>parent</code> property in case of created
+ * component set Ajax properties for parent.
+ *
+ * @see javax.faces.component.UIComponentBase#setParent(javax.faces.component.UIComponent)
+ */
+ public void setParent(UIComponent parent) {
+ super.setParent(parent);
+ if (null != parent && parent.getFamily() != null) {
+ if (log.isDebugEnabled()) {
+ log.debug(Messages.getMessage(Messages.CALLED_SET_PARENT,
+ parent.getClass().getName()));
+ }
+ // TODO If this comopnent configured, set properties for parent
+ // component.
+ // NEW created component have parent, restored view - null in My
+ // faces.
+ // and SUN RI not call at restore saved view.
+ // In other case - set in restoreState method.
+ // if (parent.getParent() != null)
+ {
+ if (log.isDebugEnabled()) {
+ log.debug(Messages
+ .getMessage(Messages.DETECT_NEW_COMPONENT));
+ }
+ setParentProperties(parent);
+
+ }
+ }
+ }
+
+ public void setParentProperties(UIComponent parent) {
+ ValueExpression valueBinding;
+ if (null != getEvent()) {
+ if (log.isDebugEnabled()) {
+ log.debug(Messages.getMessage(
+ Messages.SET_VALUE_BINDING_FOR_EVENT, getEvent()));
+ }
+ // for non action/data components, or for non-default events - build
+ // listener for this instance.
+ valueBinding = getEventValueBinding();
+ parent.setValueExpression(getEvent(), valueBinding);
+
+ }
+ }
+
+ protected UIComponent getSingleComponent() {
+ return getParent();
+ }
+
+}
Copied: root/ui-sandbox/trunk/components/core/src/main/java/org/ajax4jsf/component/UIInclude.java (from rev 15053, root/ui/trunk/components/core/src/main/java/org/ajax4jsf/component/UIInclude.java)
===================================================================
--- root/ui-sandbox/trunk/components/core/src/main/java/org/ajax4jsf/component/UIInclude.java (rev 0)
+++ root/ui-sandbox/trunk/components/core/src/main/java/org/ajax4jsf/component/UIInclude.java 2009-07-31 11:19:57 UTC (rev 15073)
@@ -0,0 +1,342 @@
+/**
+ * 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 javax.el.ELContext;
+import javax.el.ELException;
+import javax.el.ValueExpression;
+import javax.faces.FacesException;
+import javax.faces.component.NamingContainer;
+import javax.faces.component.UIComponent;
+import javax.faces.component.UIComponentBase;
+import javax.faces.context.FacesContext;
+import javax.faces.event.AbortProcessingException;
+import javax.faces.event.FacesEvent;
+import javax.faces.event.FacesListener;
+import javax.faces.event.PhaseId;
+
+import org.ajax4jsf.context.AjaxContext;
+import org.ajax4jsf.context.ViewIdHolder;
+
+/**
+ * @author shura
+ *
+ */
+public abstract class UIInclude extends UIComponentBase implements
+ ViewIdHolder, NamingContainer, AjaxOutput {
+
+ public static final String COMPONENT_TYPE = "org.ajax4jsf.Include";
+
+ public static final String LAYOUT_NONE ="none";
+
+ public static final String LAYOUT_BLOCK ="block";
+ public static final String LAYOUT_INLINE ="inline";
+
+ private boolean _ajaxRendered = false;
+ private boolean _ajaxRenderedSet = false;
+
+ private boolean wasNavigation = false;
+
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.ajax4jsf.framework.ajax.ViewIdHolder#skipNavigation(java.lang.String)
+ */
+ public boolean skipNavigation(String ViewId) {
+ wasNavigation = true;
+ return true;
+ }
+
+ private String _viewId = null;
+
+ /*
+ * viewId for included page. Setter for viewId @param viewId - new value
+ */
+ public void setViewId(String __viewId) {
+ ValueExpression vb = getValueExpression("viewId");
+ ELContext elContext = getELContext();
+ if (null != vb && (!vb.isReadOnly(elContext))) {
+ // Change value of viewId in backed bean, if possible.
+ vb.setValue(elContext, __viewId);
+ } else {
+ this._viewId = __viewId;
+ }
+ }
+
+ /*
+ * viewId for included page. Getter for viewId @return viewId value from
+ * local variable or value bindings
+ */
+ public String getViewId() {
+ if (null != this._viewId) {
+ return this._viewId;
+ }
+ ValueExpression vb = getValueExpression("viewId");
+ if (null != vb) {
+ return (String) vb.getValue(getELContext());
+ } else {
+ return null;
+ }
+ }
+
+ private String _layout = null;
+
+ /**
+ * @return the layout
+ */
+ public String getLayout() {
+ if (null != this._layout) {
+ return this._layout;
+ }
+ ValueExpression vb = getValueExpression("layout");
+ if (null != vb) {
+ return (String) vb.getValue(getELContext());
+ } else {
+ return null;
+ }
+ }
+
+ /**
+ * @param layout the layout to set
+ */
+ public void setLayout(String layout) {
+ _layout = layout;
+ }
+
+
+ public boolean isAjaxRendered() {
+ Boolean value = null;
+
+ if(this._ajaxRenderedSet) {
+ return this._ajaxRendered;
+ }
+
+ ValueExpression ve = getValueExpression("ajaxRendered");
+ if (ve != null) {
+ try {
+ value = (Boolean) ve.getValue(getFacesContext().getELContext());
+ } catch (ELException e) {
+ throw new FacesException(e);
+ }
+ }
+
+
+ if (null == value) {
+// value = this._ajaxRendered;
+ value = isWasNavigation();
+ }
+
+ return (!LAYOUT_NONE.equals(getLayout())) && value;
+ }
+
+ public void setAjaxRendered(boolean ajaxRendered) {
+ this._ajaxRendered = ajaxRendered;
+ this._ajaxRenderedSet = true;
+ }
+
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see javax.faces.component.UIComponentBase#broadcast(javax.faces.event.FacesEvent)
+ */
+ public void broadcast(FacesEvent event) throws AbortProcessingException {
+ if (event instanceof EventWrapper) {
+ FacesEvent wrapped = ((EventWrapper) event).getWrapped();
+ FacesContext context = getFacesContext();
+ ViewIdHolder holder = setupNavigation(context);
+ wrapped.getComponent().broadcast(wrapped);
+ restoreNavigation(context, holder);
+ } else {
+ super.broadcast(event);
+ }
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see javax.faces.component.UIComponentBase#processDecodes(javax.faces.context.FacesContext)
+ */
+ public void processDecodes(FacesContext context) {
+ wasNavigation = false;
+ ViewIdHolder holder = setupNavigation(context);
+ super.processDecodes(context);
+ restoreNavigation(context, holder);
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see javax.faces.component.UIComponentBase#processUpdates(javax.faces.context.FacesContext)
+ */
+ public void processUpdates(FacesContext context) {
+ ViewIdHolder holder = setupNavigation(context);
+ super.processUpdates(context);
+ restoreNavigation(context, holder);
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see javax.faces.component.UIComponentBase#processValidators(javax.faces.context.FacesContext)
+ */
+ public void processValidators(FacesContext context) {
+ ViewIdHolder holder = setupNavigation(context);
+ super.processValidators(context);
+ restoreNavigation(context, holder);
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see javax.faces.component.UIComponentBase#queueEvent(javax.faces.event.FacesEvent)
+ */
+ public void queueEvent(FacesEvent event) {
+ EventWrapper wrapper = new EventWrapper(this, event);
+ super.queueEvent(wrapper);
+ }
+
+
+ /* (non-Javadoc)
+ * @see javax.faces.component.UIComponentBase#restoreState(javax.faces.context.FacesContext, java.lang.Object)
+ */
+ public void restoreState(FacesContext context, Object state) {
+ Object[] componentState = (Object[]) state;
+ super.restoreState(context, componentState[0]);
+ this._viewId = (String) componentState[1];
+ this._layout = (String) componentState[2];
+ this._ajaxRendered = ((Boolean) componentState[3]).booleanValue();
+ this._ajaxRenderedSet = ((Boolean) componentState[4]).booleanValue();
+ }
+
+ /* (non-Javadoc)
+ * @see javax.faces.component.UIComponentBase#saveState(javax.faces.context.FacesContext)
+ */
+ public Object saveState(FacesContext context) {
+ Object[] componentState = new Object[5];
+ componentState[0] = super.saveState(context);
+ componentState[1] = _viewId;
+ componentState[2] = _layout;
+ componentState[3] = Boolean.valueOf(_ajaxRendered);
+ componentState[4] = Boolean.valueOf(_ajaxRenderedSet);
+ return componentState;
+ }
+
+ /* (non-Javadoc)
+ * @see javax.faces.component.UIComponent#getFamily()
+ */
+ public String getFamily() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ private ViewIdHolder setupNavigation(FacesContext context) {
+ AjaxContext ajaxContext = AjaxContext.getCurrentInstance(context);
+ ViewIdHolder viewIdHolder = ajaxContext.getViewIdHolder();
+ ajaxContext.setViewIdHolder(this);
+ return viewIdHolder;
+ }
+
+ private void restoreNavigation(FacesContext context, ViewIdHolder viewIdHolder) {
+ AjaxContext ajaxContext = AjaxContext.getCurrentInstance(context);
+ ajaxContext.setViewIdHolder(viewIdHolder);
+// if (wasNavigation) {
+// // Clear children to avoid have different components with same id
+// getChildren().clear();
+// }
+ }
+
+ private ELContext getELContext() {
+ return getFacesContext().getELContext();
+ }
+
+ @SuppressWarnings("serial")
+ private static class EventWrapper extends FacesEvent {
+
+ private FacesEvent wrapped;
+
+ public EventWrapper(UIComponent component, FacesEvent wrapped) {
+ super(component);
+ this.wrapped = wrapped;
+ }
+
+ /**
+ * @return
+ * @see javax.faces.event.FacesEvent#getPhaseId()
+ */
+ public PhaseId getPhaseId() {
+ return wrapped.getPhaseId();
+ }
+
+ /**
+ * @param listener
+ * @return
+ * @see javax.faces.event.FacesEvent#isAppropriateListener(javax.faces.event.FacesListener)
+ */
+ public boolean isAppropriateListener(FacesListener listener) {
+ return wrapped.isAppropriateListener(listener);
+ }
+
+ /**
+ * @param listener
+ * @see javax.faces.event.FacesEvent#processListener(javax.faces.event.FacesListener)
+ */
+ public void processListener(FacesListener listener) {
+ wrapped.processListener(listener);
+ }
+
+ /**
+ *
+ * @see javax.faces.event.FacesEvent#queue()
+ */
+ public void queue() {
+ wrapped.queue();
+ }
+
+ /**
+ * @param phaseId
+ * @see javax.faces.event.FacesEvent#setPhaseId(javax.faces.event.PhaseId)
+ */
+ public void setPhaseId(PhaseId phaseId) {
+ wrapped.setPhaseId(phaseId);
+ }
+
+ /**
+ * @return the wrapped
+ */
+ public FacesEvent getWrapped() {
+ return wrapped;
+ }
+ }
+
+ /**
+ * @return the wasNavigation
+ */
+ public boolean isWasNavigation() {
+ return wasNavigation;
+ }
+
+
+}
Copied: root/ui-sandbox/trunk/components/core/src/main/java/org/ajax4jsf/component/UILoadBundle.java (from rev 15053, root/ui/trunk/components/core/src/main/java/org/ajax4jsf/component/UILoadBundle.java)
===================================================================
--- root/ui-sandbox/trunk/components/core/src/main/java/org/ajax4jsf/component/UILoadBundle.java (rev 0)
+++ root/ui-sandbox/trunk/components/core/src/main/java/org/ajax4jsf/component/UILoadBundle.java 2009-07-31 11:19:57 UTC (rev 15073)
@@ -0,0 +1,127 @@
+/**
+ * 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.Locale;
+import java.util.MissingResourceException;
+import java.util.ResourceBundle;
+
+import javax.faces.component.UIComponentBase;
+import javax.faces.component.UIViewRoot;
+import javax.faces.context.FacesContext;
+
+import org.ajax4jsf.Messages;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+/**
+ * @author shura
+ *
+ */
+public abstract class UILoadBundle extends UIComponentBase implements AjaxLoadBundleComponent {
+
+ public static final String COMPONENT_FAMILY = "org.ajax4jsf.Bundle";
+
+ public static final String COMPONENT_TYPE = "org.ajax4jsf.Bundle";
+
+ private static final Log _log = LogFactory.getLog(UILoadBundle.class);
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see javax.faces.component.UIComponent#getFamily()
+ */
+ public String getFamily() {
+ // TODO Auto-generated method stub
+ return COMPONENT_FAMILY;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see javax.faces.component.UIComponentBase#encodeBegin(javax.faces.context.FacesContext)
+ */
+ public void encodeBegin(FacesContext context) throws IOException {
+ loadBundle(context);
+
+ }
+
+ public void decode(FacesContext context) {
+ loadBundle(context);
+ }
+ /**
+ * @param context
+ */
+ public void loadBundle(FacesContext context) {
+ UIViewRoot viewRoot = context.getViewRoot();
+ Locale locale = viewRoot.getLocale();
+ if (locale == null) {
+ locale = context.getApplication().getDefaultLocale();
+ }
+
+ ResourceBundle bundle;
+ try {
+ bundle = ResourceBundle.getBundle(getBasename(), locale, Thread
+ .currentThread().getContextClassLoader());
+ } catch (MissingResourceException e) {
+ _log.error(Messages.getMessage(Messages.COULD_NOT_LOAD_RESOURCE_BUNDLE, getBasename()));
+ return;
+ }
+
+ context.getExternalContext().getRequestMap().put(getVar(),
+ new ResourceBundleMap(bundle));
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see javax.faces.component.UIComponentBase#getRendererType()
+ */
+ public String getRendererType() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ /**
+ * @return Returns the basename.
+ */
+ public abstract String getBasename();
+
+ /**
+ * @param basename
+ * The basename to set.
+ */
+ public abstract void setBasename(String basename);
+
+ /**
+ * @return Returns the var.
+ */
+ public abstract String getVar();
+
+ /**
+ * @param var
+ * The var to set.
+ */
+ public abstract void setVar(String var);
+
+}
Copied: root/ui-sandbox/trunk/components/core/src/main/java/org/ajax4jsf/component/UIPortlet.java (from rev 15053, root/ui/trunk/components/core/src/main/java/org/ajax4jsf/component/UIPortlet.java)
===================================================================
--- root/ui-sandbox/trunk/components/core/src/main/java/org/ajax4jsf/component/UIPortlet.java (rev 0)
+++ root/ui-sandbox/trunk/components/core/src/main/java/org/ajax4jsf/component/UIPortlet.java 2009-07-31 11:19:57 UTC (rev 15073)
@@ -0,0 +1,73 @@
+/**
+ * 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.NamingContainer;
+import javax.faces.component.UIComponentBase;
+import javax.faces.context.FacesContext;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+/**
+ * @author asmirnov
+ *
+ */
+public class UIPortlet extends UIComponentBase implements NamingContainer {
+
+
+ private static final Log _log = LogFactory.getLog(UIPortlet.class);
+ /**
+ * <p>The standard component type for this component.</p>
+ */
+ public static final String COMPONENT_TYPE = "org.ajax4jsf.Portlet";
+
+
+ /**
+ * <p>The standard component family for this component.</p>
+ */
+ public static final String COMPONENT_FAMILY = "org.ajax4jsf.Portlet";
+
+ /* (non-Javadoc)
+ * @see javax.faces.component.UIComponent#getFamily()
+ */
+ public String getFamily() {
+ // TODO Auto-generated method stub
+ return COMPONENT_FAMILY;
+ }
+
+ private String portletId = null;
+
+ @Override
+ public void setId(String id) {
+ portletId = null;
+ super.setId(id);
+ }
+
+ // ----------------------------------------------------- UIComponent Methods
+ public String getClientId(FacesContext context) {
+ if (portletId == null) {
+ portletId = context.getExternalContext().encodeNamespace(super.getClientId(context));
+ }
+ return portletId;
+ }
+
+}
Copied: root/ui-sandbox/trunk/components/core/src/main/java/org/ajax4jsf/component/UIQueue.java (from rev 15053, root/ui/trunk/components/core/src/main/java/org/ajax4jsf/component/UIQueue.java)
===================================================================
--- root/ui-sandbox/trunk/components/core/src/main/java/org/ajax4jsf/component/UIQueue.java (rev 0)
+++ root/ui-sandbox/trunk/components/core/src/main/java/org/ajax4jsf/component/UIQueue.java 2009-07-31 11:19:57 UTC (rev 15073)
@@ -0,0 +1,124 @@
+/**
+ * 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.NamingContainer;
+import javax.faces.component.UIComponent;
+import javax.faces.component.UIComponentBase;
+import javax.faces.component.UIForm;
+import javax.faces.context.FacesContext;
+
+/**
+ * @author Nick Belaevski
+ * @since 3.3.0
+ */
+public abstract class UIQueue extends UIComponentBase {
+
+ public static final String GLOBAL_QUEUE_NAME = "org.richfaces.queue.global";
+
+ public static final String COMPONENT_TYPE = "org.ajax4jsf.Queue";
+
+ public static final String COMPONENT_FAMILY = "org.ajax4jsf.Queue";
+
+ public abstract String getName();
+ public abstract void setName(String name);
+
+ public abstract String getOnsubmit();
+ public abstract void setOnsubmit(String onsubmit);
+
+ public abstract String getOncomplete();
+ public abstract void setOncomplete(String oncomplete);
+
+ public abstract String getOnbeforedomupdate();
+ public abstract void setOnbeforedomupdate(String onbeforedomupdate);
+
+ public abstract String getOnerror();
+ public abstract void setOnerror(String onerror);
+
+ public abstract String getOnsizeexceeded();
+ public abstract void setOnsizeexceeded(String onsizeexceeded);
+
+ public abstract boolean isDisabled();
+ public abstract void setDisabled(boolean disabled);
+
+ public abstract int getSize();
+ public abstract void setSize(int size);
+
+ public abstract String getSizeExceededBehavior();
+ public abstract void setSizeExceededBehavior(String behavior);
+
+ public abstract int getTimeout();
+ public abstract void setTimeout(int timeout);
+
+ public abstract int getRequestDelay();
+ public abstract void setRequestDelay(int requestDelay);
+
+ public abstract boolean isIgnoreDupResponses();
+ public abstract void setIgnoreDupResponses(boolean ignoreDupResponses);
+
+ public abstract String getOnrequestqueue();
+ public abstract void setOnrequestqueue(String onrequestqueue);
+
+ public abstract String getOnrequestdequeue();
+ public abstract void setOnrequestdequeue(String onrequestdequeue);
+
+ public abstract String getStatus();
+ public abstract void setStatus(String status);
+
+ @Override
+ public String getFamily() {
+ return COMPONENT_FAMILY;
+ }
+
+ private UIComponent findParentForm() {
+ UIComponent component = getParent();
+ while (component != null && !(component instanceof UIForm)) {
+ component = component.getParent();
+ }
+
+ return component;
+ }
+
+ public String getClientName(FacesContext context) {
+ UIComponent form = findParentForm();
+ String name = getName();
+ String clientName;
+
+ if (form != null) {
+ String formClientId = form.getClientId(context);
+
+ if (name != null && name.length() != 0) {
+ clientName = formClientId + NamingContainer.SEPARATOR_CHAR + name;
+ } else {
+ clientName = formClientId;
+ }
+ } else {
+ if (name == null || name.length() == 0) {
+ name = GLOBAL_QUEUE_NAME;
+ }
+
+ clientName = context.getExternalContext().encodeNamespace(name);
+ }
+
+ return clientName;
+ }
+}
Copied: root/ui-sandbox/trunk/components/core/src/main/java/org/ajax4jsf/component/UIRepeat.java (from rev 15053, root/ui/trunk/components/core/src/main/java/org/ajax4jsf/component/UIRepeat.java)
===================================================================
--- root/ui-sandbox/trunk/components/core/src/main/java/org/ajax4jsf/component/UIRepeat.java (rev 0)
+++ root/ui-sandbox/trunk/components/core/src/main/java/org/ajax4jsf/component/UIRepeat.java 2009-07-31 11:19:57 UTC (rev 15073)
@@ -0,0 +1,51 @@
+/**
+ * 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.Iterator;
+
+import javax.faces.component.UIComponent;
+
+
+/**
+ * @author shura
+ *
+ */
+public class UIRepeat extends SequenceDataAdaptor {
+
+ /* (non-Javadoc)
+ * @see org.ajax4jsf.ajax.repeat.UIDataAdaptor#dataChildren()
+ */
+ protected Iterator<UIComponent> dataChildren() {
+ // TODO Auto-generated method stub
+ return getChildren().iterator();
+ }
+
+ /* (non-Javadoc)
+ * @see org.ajax4jsf.ajax.repeat.UIDataAdaptor#fixedChildren()
+ */
+ protected Iterator<UIComponent> fixedChildren() {
+ // TODO Auto-generated method stub
+ return getFacets().values().iterator();
+ }
+
+}
Copied: root/ui-sandbox/trunk/components/core/src/main/java/org/ajax4jsf/component/UIResource.java (from rev 15053, root/ui/trunk/components/core/src/main/java/org/ajax4jsf/component/UIResource.java)
===================================================================
--- root/ui-sandbox/trunk/components/core/src/main/java/org/ajax4jsf/component/UIResource.java (rev 0)
+++ root/ui-sandbox/trunk/components/core/src/main/java/org/ajax4jsf/component/UIResource.java 2009-07-31 11:19:57 UTC (rev 15073)
@@ -0,0 +1,49 @@
+/**
+ * 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.UIComponentBase;
+
+/**
+ * JSF component class
+ *
+ */
+public abstract class UIResource extends UIComponentBase {
+
+ public static final String COMPONENT_TYPE = "org.ajax4jsf.Resource";
+
+ public static final String COMPONENT_FAMILY = "org.ajax4jsf.Resource";
+
+ /**
+ * Get name of script to load
+ * @parameter
+ * @return the acceptClass
+ */
+ public abstract Object getSrc();
+
+ /**
+ * @param newSrc the value to set
+ */
+ public abstract void setSrc(Object newSrc);
+
+
+}
Copied: root/ui-sandbox/trunk/components/core/src/main/java/org/ajax4jsf/renderkit/html/AjaxFormRenderer.java (from rev 15053, root/ui/trunk/components/core/src/main/java/org/ajax4jsf/renderkit/html/AjaxFormRenderer.java)
===================================================================
--- root/ui-sandbox/trunk/components/core/src/main/java/org/ajax4jsf/renderkit/html/AjaxFormRenderer.java (rev 0)
+++ root/ui-sandbox/trunk/components/core/src/main/java/org/ajax4jsf/renderkit/html/AjaxFormRenderer.java 2009-07-31 11:19:57 UTC (rev 15073)
@@ -0,0 +1,342 @@
+/**
+ * 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.renderkit.html;
+
+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.component.UIForm;
+import javax.faces.component.UIViewRoot;
+import javax.faces.component.html.HtmlForm;
+import javax.faces.context.FacesContext;
+import javax.faces.context.ResponseWriter;
+
+import org.ajax4jsf.component.UIAjaxForm;
+import org.ajax4jsf.event.AjaxEvent;
+import org.ajax4jsf.javascript.JSFunction;
+import org.ajax4jsf.javascript.ScriptUtils;
+import org.ajax4jsf.renderkit.AjaxComponentRendererBase;
+import org.ajax4jsf.renderkit.AjaxRendererUtils;
+import org.ajax4jsf.renderkit.RendererUtils.HTML;
+import org.ajax4jsf.resource.InternetResource;
+
+/**
+ * @author shura
+ *
+ */
+public class AjaxFormRenderer extends AjaxComponentRendererBase {
+
+ public static final String FORM_SUBMIT_FUNCTION_NAME = "_JSFFormSubmit";
+
+ public static final String FORM_CLEAR_FUNCTION_NAME = "_clearJSFFormParameters";
+
+ private static final String FORM_HAS_COMMAND_LINK_ATTR = "com.sun.faces.FORM_HAS_COMMAND_LINK_ATTR";
+
+ private static final String NO_COMMAND_LINK_FOUND_VALUE = "com.sun.faces.NO_COMMAND_LINK_FOUND";
+
+ public static final String CONTENT_TYPE_IS_XHTML = "com.sun.faces"
+ + "ContentTypeIsXHTML";
+
+ public static final String HIDDEN_FIELD_SUFFIX = NamingContainer.SEPARATOR_CHAR
+ + UIViewRoot.UNIQUE_ID_PREFIX + "cl";
+
+ private static final String HIDDEN_COMMAND_INPUTS_SET_ATTR = UIForm.class
+ .getName()
+ + ".org.apache.myfaces.HIDDEN_COMMAND_INPUTS_SET";
+
+ private static final String MYFACES_HIDDEN_FIELD_SUFFIX = NamingContainer.SEPARATOR_CHAR
+ + "_link_hidden_";
+
+ private InternetResource[] _scripts = { getResource("/org/ajax4jsf/javascript/scripts/form.js") };
+
+ private static final String[] exclusions = { "onsubmit" };
+
+ public static final String AJAX_FORM_FUNCTION_NAME = "A4J.AJAX.SubmitForm";
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.ajax4jsf.renderkit.RendererBase#doDecode(javax.faces.context.FacesContext,
+ * javax.faces.component.UIComponent)
+ */
+ protected void doDecode(FacesContext context, UIComponent component) {
+ UIForm form = (UIForm) component;
+ boolean submitted = context.getExternalContext()
+ .getRequestParameterMap().containsKey(
+ component.getClientId(context));
+ form.setSubmitted(submitted);
+ if (component instanceof UIAjaxForm) {
+ UIAjaxForm ajaxForm = (UIAjaxForm) component;
+ if (submitted && ajaxForm.isAjaxSubmit()) {
+ component.queueEvent(new AjaxEvent(component));
+ }
+ }
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.ajax4jsf.renderkit.HeaderResourcesRendererBase#getScripts()
+ */
+ protected InternetResource[] getAdditionalScripts() {
+ // TODO Auto-generated method stub
+ return _scripts;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.ajax4jsf.renderkit.RendererBase#doEncodeBegin(javax.faces.context.ResponseWriter,
+ * javax.faces.context.FacesContext, javax.faces.component.UIComponent)
+ */
+ protected void doEncodeBegin(ResponseWriter writer, FacesContext context,
+ UIComponent component) throws IOException {
+ String clientId = component.getClientId(context);
+ writer.startElement(HTML.FORM_ELEMENT, component);
+ writer.writeAttribute(HTML.id_ATTRIBUTE, clientId, null);
+ writer.writeAttribute(HTML.NAME_ATTRIBUTE, clientId, null);
+ writer.writeAttribute(HTML.METHOD_ATTRIBUTE, "post", null);
+ getUtils().encodeAttribute(context, component, "style");
+ getUtils().encodeAttribute(context, component, "class");
+ getUtils().encodePassThru(context, component);
+ context.getExternalContext().getRequestMap().put(
+ FORM_HAS_COMMAND_LINK_ATTR, clientId);
+ if (component instanceof UIAjaxForm) {
+ UIAjaxForm form = (UIAjaxForm) component;
+ if (form.isAjaxSubmit()) {
+ StringBuffer onSubmit = new StringBuffer("javascript:");
+ JSFunction ajaxFunction = AjaxRendererUtils.buildAjaxFunction(
+ component, context,
+ AJAX_FORM_FUNCTION_NAME);
+ ajaxFunction.addParameter(AjaxRendererUtils.buildEventOptions(
+ context, component, false));
+ ajaxFunction.appendScript(onSubmit);
+ writer.writeURIAttribute("action", onSubmit, "action");
+ } else {
+ encodeSubmitAction(writer, context);
+ }
+ } else {
+ encodeSubmitAction(writer, context);
+ }
+ }
+
+ /**
+ * @param writer
+ * @param context
+ * @throws IOException
+ */
+ private void encodeSubmitAction(ResponseWriter writer, FacesContext context)
+ throws IOException {
+ String actionURL = getUtils().getActionUrl(context);
+ String encodedActionURL = context.getExternalContext().encodeActionURL(
+ actionURL);
+ writer.writeURIAttribute("action", encodedActionURL, "action");
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.ajax4jsf.renderkit.RendererBase#doEncodeEnd(javax.faces.context.ResponseWriter,
+ * javax.faces.context.FacesContext, javax.faces.component.UIComponent)
+ */
+ protected void doEncodeEnd(ResponseWriter writer, FacesContext context,
+ UIComponent component) throws IOException {
+ // Encode form submitting flag hidden field.
+ String clientId = component.getClientId(context);
+ renderHiddenInputField(writer, clientId, clientId);
+ renderHiddenInputField(writer, "autoScroll", null);
+ // MyFaces compability - render hidden field and Script.
+ // render hidden command inputs
+ Set hiddenFields = new HashSet();
+ hiddenFields.add(clientId + HIDDEN_FIELD_SUFFIX);
+ hiddenFields.add(clientId + MYFACES_HIDDEN_FIELD_SUFFIX);
+ Set set = (Set) component.getAttributes().get(
+ HIDDEN_COMMAND_INPUTS_SET_ATTR);
+ if (set != null) {
+ hiddenFields.addAll(set);
+ }
+ set = (Set) context.getExternalContext().getRequestMap().get(
+ getHiddenCommandInputsSetName(context, component));
+ if (set != null) {
+ hiddenFields.addAll(set);
+ }
+ renderHiddenCommandFormParams(writer, hiddenFields);
+ String target;
+ if (component instanceof HtmlForm) {
+ target = ((HtmlForm) component).getTarget();
+ } else {
+ target = (String) component.getAttributes().get(
+ HTML.target_ATTRIBUTE);
+ }
+ renderClearHiddenCommandFormParamsFunction(writer, clientId, hiddenFields, target);
+ // Script
+ if (component instanceof UIAjaxForm) {
+ UIAjaxForm form = (UIAjaxForm) component;
+ if (form.isAjaxSubmit()) {
+ renderAjaxFormSetupScript(writer, clientId);
+ }
+ }
+ // writeFormSubmitScript(context, writer);
+ getUtils().encodeEndForm(context, writer);
+ context.getExternalContext().getRequestMap().put(
+ FORM_HAS_COMMAND_LINK_ATTR, NO_COMMAND_LINK_FOUND_VALUE);
+ }
+
+ private static String getHiddenCommandInputsSetName(
+ FacesContext facesContext, UIComponent form) {
+ StringBuffer buf = new StringBuffer();
+ buf.append(HIDDEN_COMMAND_INPUTS_SET_ATTR);
+ buf.append("_");
+ buf.append(form.getClientId(facesContext));
+ return buf.toString();
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.ajax4jsf.renderkit.RendererBase#getComponentClass()
+ */
+ protected Class getComponentClass() {
+ // TODO Auto-generated method stub
+ return UIForm.class;
+ }
+
+ // For MyFaces compability - create hidden firlds and script. Code got from
+ // project to simulate same functionality.
+ public void renderHiddenCommandFormParams(ResponseWriter writer,
+ Set formParams) throws IOException {
+ for (Iterator it = formParams.iterator(); it.hasNext();) {
+ Object name = it.next();
+ renderHiddenInputField(writer, name, "");
+ }
+ }
+
+ public void renderHiddenInputField(ResponseWriter writer, Object name,
+ Object value) throws IOException {
+ writer.startElement(HTML.INPUT_ELEM, null);
+ writer.writeAttribute(HTML.TYPE_ATTR, HTML.INPUT_TYPE_HIDDEN, null);
+ writer.writeAttribute(HTML.autocomplete_ATTRIBUTE, "off", null);
+ writer.writeAttribute(HTML.NAME_ATTRIBUTE, name, null);
+ writer.writeAttribute(HTML.value_ATTRIBUTE, value != null?value:"", null);
+ writer.endElement(HTML.INPUT_ELEM);
+ }
+
+
+ public void renderAjaxFormSetupScript(ResponseWriter writer, String formName) throws IOException {
+ writer.startElement(HTML.SCRIPT_ELEM, null);
+ writer.writeAttribute(HTML.TYPE_ATTR, "text/javascript", null);
+ writer.writeText("A4J.setupForm('"+formName+"');", null);
+ writer.endElement(HTML.SCRIPT_ELEM);
+ }
+
+ /**
+ * Render the javascript function that is called on a click on a commandLink
+ * to clear the hidden inputs. This is necessary because on a browser back,
+ * each hidden input still has it's old value (browser cache!) and therefore
+ * a new submit would cause the according action once more!
+ *
+ * @param writer
+ * @param formName
+ * @param dummyFormParams
+ * @param formTarget
+ * @throws IOException
+ */
+ public void renderClearHiddenCommandFormParamsFunction(
+ ResponseWriter writer, String formName, Set dummyFormParams,
+ String formTarget) throws IOException {
+ // render the clear hidden inputs javascript function
+ String functionName = getClearHiddenCommandFormParamsFunctionName(formName);
+ writer.startElement(HTML.SCRIPT_ELEM, null);
+ writer.writeAttribute(HTML.TYPE_ATTR, "text/javascript", null);
+
+ // Using writeComment instead of write with <!-- tag
+ StringBuffer script = new StringBuffer();
+ script.append("function ");
+ script.append(functionName);
+ script.append("() {\n");
+ script.append(FORM_CLEAR_FUNCTION_NAME);
+ script.append("('");
+ script.append(formName);
+ script.append("','");
+ if (formTarget != null && formTarget.length() > 0) {
+ script.append(formTarget);
+ }
+ script.append("'");
+ if (dummyFormParams != null) {
+ script.append(",[");
+ for (Iterator it = dummyFormParams.iterator(); it.hasNext();) {
+ script.append('\'');
+ script.append((String) it.next());
+ script.append('\'');
+ if (it.hasNext()) {
+ script.append(',');
+ }
+ }
+ script.append("]");
+ }
+ script.append(");");
+ script.append("\n}");
+ script.append("\n");
+ script.append("function ").append("clearFormHiddenParams_").append(
+ ScriptUtils.getValidJavascriptName(formName));
+ script.append("(){").append(functionName).append("();}\n");
+ // MyFaces 1.1.5 clear form function name
+
+ //equivalent for formName.replace("-", "$_")
+ StringBuffer formNameReplaceBuffer = new StringBuffer(formName.length());
+ int idx = -1;
+ int idxA = 0;
+ while ((idx = formName.indexOf('-', idxA)) != -1) {
+ formNameReplaceBuffer.append(formName.substring(idxA, idx));
+ formNameReplaceBuffer.append("$_");
+ idxA = idx + 1;
+ }
+ formNameReplaceBuffer.append(formName.substring(idxA));
+
+ script.append("function ").append("clearFormHiddenParams_").append(formNameReplaceBuffer.toString().
+ replace(':', '_'));
+ script.append("(){").append(functionName).append("();}\n");
+ // Just to be sure we call this clear method on each load.
+ // Otherwise in the case, that someone submits a form by pressing Enter
+ // within a text input, the hidden inputs won't be cleared!
+ script.append(functionName);
+ script.append("();");
+
+ writer.writeText(script.toString(), null);
+ writer.endElement(HTML.SCRIPT_ELEM);
+ }
+
+ /**
+ * Prefixes the given String with "clear_" and removes special characters
+ *
+ * @param formName
+ * @return String
+ */
+ public String getClearHiddenCommandFormParamsFunctionName(String formName) {
+ return "clear_" + ScriptUtils.getValidJavascriptName(formName);
+ }
+
+}
Copied: root/ui-sandbox/trunk/components/core/src/main/java/org/ajax4jsf/renderkit/html/AjaxIncludeRenderer.java (from rev 15053, root/ui/trunk/components/core/src/main/java/org/ajax4jsf/renderkit/html/AjaxIncludeRenderer.java)
===================================================================
--- root/ui-sandbox/trunk/components/core/src/main/java/org/ajax4jsf/renderkit/html/AjaxIncludeRenderer.java (rev 0)
+++ root/ui-sandbox/trunk/components/core/src/main/java/org/ajax4jsf/renderkit/html/AjaxIncludeRenderer.java 2009-07-31 11:19:57 UTC (rev 15073)
@@ -0,0 +1,97 @@
+/**
+ * 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.renderkit.html;
+
+import java.io.IOException;
+
+import javax.faces.component.UIComponent;
+import javax.faces.context.FacesContext;
+import javax.faces.context.ResponseWriter;
+
+import org.ajax4jsf.component.UIInclude;
+import org.ajax4jsf.renderkit.RendererBase;
+import org.ajax4jsf.renderkit.RendererUtils.HTML;
+
+/**
+ * @author asmirnov(a)exadel.com (latest modification by $Author: alexsmirnov $)
+ * @version $Revision: 1.1.2.1 $ $Date: 2007/02/01 15:31:25 $
+ *
+ */
+public class AjaxIncludeRenderer extends RendererBase {
+
+ private final String[] STYLE_ATTRIBUTES = new String[] { "style", "class" };
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.ajax4jsf.renderkit.RendererBase#getComponentClass()
+ */
+ protected Class getComponentClass() {
+ // TODO Auto-generated method stub
+ return UIInclude.class;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.ajax4jsf.renderkit.RendererBase#doEncodeBegin(javax.faces.context.ResponseWriter,
+ * javax.faces.context.FacesContext, javax.faces.component.UIComponent)
+ */
+ protected void doEncodeBegin(ResponseWriter writer, FacesContext context,
+ UIComponent component) throws IOException {
+ UIInclude panel = (UIInclude) component;
+ if (!UIInclude.LAYOUT_NONE.equals(panel.getLayout())) {
+ writer.startElement(getTag(panel), panel);
+ getUtils().encodeId(context, component);
+ getUtils().encodePassThru(context, component);
+ getUtils().encodeAttributesFromArray(context, component,
+ STYLE_ATTRIBUTES);
+
+ }
+ }
+
+ /**
+ * @param panel
+ * @return
+ */
+ private String getTag(UIInclude panel) {
+ // TODO Auto-generated method stub
+ return UIInclude.LAYOUT_BLOCK.equals(panel.getLayout()) ? HTML.DIV_ELEM
+ : HTML.SPAN_ELEM;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.ajax4jsf.renderkit.RendererBase#doEncodeEnd(javax.faces.context.ResponseWriter,
+ * javax.faces.context.FacesContext, javax.faces.component.UIComponent)
+ */
+ protected void doEncodeEnd(ResponseWriter writer, FacesContext context,
+ UIComponent component) throws IOException {
+ UIInclude panel = (UIInclude) component;
+ if (!UIInclude.LAYOUT_NONE.equals(panel.getLayout())) {
+ writer.endElement(getTag(panel));
+
+ }
+ }
+
+}
Copied: root/ui-sandbox/trunk/components/core/src/main/java/org/ajax4jsf/renderkit/html/AjaxPageRenderer.java (from rev 15053, root/ui/trunk/components/core/src/main/java/org/ajax4jsf/renderkit/html/AjaxPageRenderer.java)
===================================================================
--- root/ui-sandbox/trunk/components/core/src/main/java/org/ajax4jsf/renderkit/html/AjaxPageRenderer.java (rev 0)
+++ root/ui-sandbox/trunk/components/core/src/main/java/org/ajax4jsf/renderkit/html/AjaxPageRenderer.java 2009-07-31 11:19:57 UTC (rev 15073)
@@ -0,0 +1,237 @@
+/**
+ * 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.renderkit.html;
+
+import java.io.IOException;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.Locale;
+import java.util.Map;
+
+import javax.faces.component.UIComponent;
+import javax.faces.context.FacesContext;
+import javax.faces.context.ResponseWriter;
+
+import org.ajax4jsf.component.AjaxContainer;
+import org.ajax4jsf.context.AjaxContext;
+import org.ajax4jsf.renderkit.AjaxContainerRenderer;
+import org.ajax4jsf.renderkit.RendererUtils.HTML;
+import org.ajax4jsf.webapp.BaseFilter;
+
+/**
+ * @author shura
+ *
+ * Render full Html page for AJAX view. Facet "head" rendered in <head> of
+ * page.
+ */
+public class AjaxPageRenderer extends AjaxContainerRenderer {
+
+ public static final String RENDERER_TYPE = "org.ajax4jsf.components.AjaxPageRenderer";
+
+ private static final Map doctypes ;
+
+ static {
+ // Fill doctype, content-type and namespace map for different formats.
+ doctypes = new HashMap();
+ doctypes
+ .put(
+ "html-transitional",
+ new String[] {
+ "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\">\n",
+ "text/html", null });
+ doctypes.put("html", new String[] {
+ "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01//EN\"\n"
+ + "\"http://www.w3.org/TR/html4/strict.dtd\">\n",
+ "text/html", null });
+ doctypes.put("html-frameset", new String[] {
+ "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 Frameset//EN\"\n"
+ + "\"http://www.w3.org/TR/html4/frameset.dtd\">\n",
+ "text/html", null });
+ doctypes
+ .put(
+ "xhtml",
+ new String[] {
+ "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Strict//EN\"\n"
+ + "\"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd\">\n",
+ "application/xhtml+xml",
+ "http://www.w3.org/1999/xhtml" });
+ doctypes
+ .put(
+ "xhtml-transitional",
+ new String[] {
+ "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\"\n"
+ + "\"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\">\n",
+ "application/xhtml+xml",
+ "http://www.w3.org/1999/xhtml" });
+ doctypes
+ .put(
+ "xhtml-frameset",
+ new String[] {
+ "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Frameset//EN\"\n"
+ + "\"http://www.w3.org/TR/xhtml1/DTD/xhtml1-frameset.dtd\">\n",
+ "application/xhtml+xml",
+ "http://www.w3.org/1999/xhtml" });
+ doctypes.put("html-3.2", new String[] {
+ "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 3.2 Final//EN\">\n",
+ "text/html", null });
+ }
+
+ // private PreparedTemplate pageStyles =
+ // HtmlCompiler.compileResource("com/exadel/vcp/renderers/templates/ajax/page-styles.xml");
+ protected void preEncodeBegin(FacesContext context, UIComponent component)
+ throws IOException {
+ // Scripts must be encoded in component, not before html element
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see javax.faces.render.Renderer#encodeBegin(javax.faces.context.FacesContext,
+ * javax.faces.component.UIComponent)
+ */
+ public void doEncodeBegin(ResponseWriter out, FacesContext context,
+ UIComponent component) throws IOException {
+ AjaxContainer ajax = (AjaxContainer) component;
+ // ServletResponse response = (ServletResponse)
+ // context.getExternalContext().getResponse();
+ Map attributes = component.getAttributes();
+ String format = (String) attributes.get("format");
+ String contentType = null;
+ String namespace = null;
+ // String characterEncoding = out.getCharacterEncoding();
+ String[] docType = null;
+ if (null != format) {
+ docType = (String[]) doctypes.get(format);
+ } else {
+ contentType = out.getContentType();
+ for (Iterator iterator = doctypes.values().iterator(); iterator.hasNext();) {
+ String[] types = (String[]) iterator.next();
+ if(types[1].equals(contentType)){
+ docType = types;
+ break;
+ }
+ }
+ }
+ if (null != docType) {
+ contentType = docType[1];
+ namespace = docType[2];
+ out.write(docType[0]);
+ }
+ if (null == contentType) {
+ contentType = (String) attributes.get("contentType");
+ }
+ if (null != contentType) {
+ // response.setContentType(contentType /*+ ";charset=" +
+ // characterEncoding*/);
+ }
+ // TODO - create "format" attribute and insert properly DOCTYPE
+ // declaratiom
+ out.startElement("html", component);
+ if (null == namespace) {
+ namespace = (String) attributes.get("namespace");
+ }
+ if (null != namespace) {
+ out.writeAttribute("xmlns", namespace, "namespace");
+ }
+ // TODO - html attributes. lang - from current locale ?
+ Locale locale = context.getViewRoot().getLocale();
+ out.writeAttribute(HTML.lang_ATTRIBUTE, locale.toString(), "lang");
+ if (!AjaxContext.getCurrentInstance(context).isAjaxRequest()) {
+ out.startElement("head", component);
+ // Out title - requied html element.
+ Object title = attributes.get("pageTitle");
+ String viewId = context.getViewRoot().getViewId();
+ if (null == title) {
+ title = viewId;// use viewId for empty title
+ }
+ out.startElement(HTML.title_ELEM, component);
+ out.writeText(title, "pageTitle");
+ out.endElement(HTML.title_ELEM);
+ // Page base - set to current view action url.
+ // String pageBase =
+ // context.getApplication().getViewHandler().getActionURL(context,
+ // viewId);
+ // out.startElement("base", component);
+ // out.writeURIAttribute("href", pageBase, "pageBase");
+ // out.endElement("base");
+ // pageStyles.encode(this, context, component);
+ UIComponent headFacet = component.getFacet("head");
+ if (headFacet != null) {
+ // context.getExternalContext().log("Render head facet in AJAX
+ // Page");
+ renderChild(context, headFacet);
+ }
+ if (null != contentType) {
+ out.startElement("meta", component);
+ out.writeAttribute("http-equiv", "Content-Type", null);
+ out.writeAttribute("content",
+ contentType /* + ";charset=" + characterEncoding */,
+ null);
+ out.endElement("meta");
+ }
+ if ((null == context.getExternalContext().getRequestMap().get(
+ BaseFilter.RESPONSE_WRAPPER_ATTRIBUTE))) {
+ // Filter not used - encode scripts and CSS before component.
+ encodeResourcesArray(context, component, getScripts());
+ encodeResourcesArray(context, component, getStyles());
+ }
+ out.endElement("head");
+ }
+ out.startElement("body", component);
+ getUtils().encodePassThru(context, component);
+ getUtils().encodeAttributesFromArray(context, component,
+ HTML.PASS_THRU_STYLES);
+ // TODO - special body attributes :
+ getUtils().encodeAttribute(context, component, "onload");
+ getUtils().encodeAttribute(context, component, "onunload");
+ // onload, onunload
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see javax.faces.render.Renderer#encodeEnd(javax.faces.context.FacesContext,
+ * javax.faces.component.UIComponent)
+ */
+ public void doEncodeEnd(ResponseWriter out, FacesContext context,
+ UIComponent component) throws IOException {
+ out.endElement("body");
+ out.endElement("html");
+ // DebugUtils.traceView("ViewRoot in AJAX Page encode end");
+ }
+
+ /*
+ * (non-Javadoc) For ajax requests, ViewRoot render childrens directly.
+ *
+ * @see org.ajax4jsf.renderkit.AjaxContainerRenderer#getRendersChildren()
+ */
+ public boolean getRendersChildren() {
+ FacesContext context = FacesContext.getCurrentInstance();
+ if (AjaxContext.getCurrentInstance(context).isAjaxRequest()) {
+ // Ajax Request. Control all output.
+ return true;
+ }
+ // For non Ajax request, view root not render children
+ return false;
+ }
+
+}
Copied: root/ui-sandbox/trunk/components/core/src/main/java/org/ajax4jsf/renderkit/html/AjaxPollRenderer.java (from rev 15053, root/ui/trunk/components/core/src/main/java/org/ajax4jsf/renderkit/html/AjaxPollRenderer.java)
===================================================================
--- root/ui-sandbox/trunk/components/core/src/main/java/org/ajax4jsf/renderkit/html/AjaxPollRenderer.java (rev 0)
+++ root/ui-sandbox/trunk/components/core/src/main/java/org/ajax4jsf/renderkit/html/AjaxPollRenderer.java 2009-07-31 11:19:57 UTC (rev 15073)
@@ -0,0 +1,100 @@
+/**
+ * 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.renderkit.html;
+
+import java.io.IOException;
+import java.util.Map;
+
+import javax.faces.component.UIComponent;
+import javax.faces.context.FacesContext;
+import javax.faces.context.ResponseWriter;
+
+import org.ajax4jsf.component.UIPoll;
+import org.ajax4jsf.javascript.JSFunction;
+import org.ajax4jsf.javascript.JSFunctionDefinition;
+import org.ajax4jsf.renderkit.AjaxCommandRendererBase;
+import org.ajax4jsf.renderkit.AjaxRendererUtils;
+import org.ajax4jsf.renderkit.RendererUtils.HTML;
+
+/**
+ * @author shura
+ *
+ */
+public class AjaxPollRenderer extends AjaxCommandRendererBase {
+
+
+
+ private static final String AJAX_POLL_FUNCTION = "A4J.AJAX.Poll";
+
+ /* (non-Javadoc)
+ * @see org.ajax4jsf.renderkit.RendererBase#doEncodeEnd(javax.faces.context.ResponseWriter, javax.faces.context.FacesContext, javax.faces.component.UIComponent)
+ */
+ protected void doEncodeEnd(ResponseWriter writer, FacesContext context, UIComponent component) throws IOException {
+ UIPoll poll = (UIPoll) component;
+ writer.startElement(HTML.SPAN_ELEM, component);
+ writer.writeAttribute(HTML.style_ATTRIBUTE, "display:none;", null);
+ getUtils().encodeId(context, component);
+ // polling script.
+ writer.startElement(HTML.SCRIPT_ELEM, component);
+ writer.writeAttribute(HTML.TYPE_ATTR, "text/javascript", null);
+ StringBuffer script = new StringBuffer("\n");
+ if(poll.isEnabled()){
+ JSFunction function = AjaxRendererUtils.buildAjaxFunction(component, context, AJAX_POLL_FUNCTION);
+ Map options = AjaxRendererUtils.buildEventOptions(context, component, true);
+ Integer interval = new Integer(poll.getInterval());
+ options.put("pollinterval", interval);
+ options.put("pollId", component.getClientId(context));
+ Object onsubmit = component.getAttributes().get("onsubmit");
+ if (null != onsubmit) {
+ JSFunctionDefinition onsubmitFunction = new JSFunctionDefinition();
+ onsubmitFunction.addToBody(onsubmit);
+ options.put("onsubmit", onsubmitFunction);
+ }
+
+// options.put("timeout", interval);
+ function.addParameter(options);
+ function.appendScript(script);
+ } else {
+ script.append("A4J.AJAX.StopPoll('").append(component.getClientId(context)).append("')");
+ }
+ script.append(";\n");
+ writer.writeText(script.toString(),null);
+ writer.endElement(HTML.SCRIPT_ELEM);
+ writer.endElement(HTML.SPAN_ELEM);
+ }
+
+ /* (non-Javadoc)
+ * @see org.ajax4jsf.renderkit.RendererBase#getComponentClass()
+ */
+ protected Class getComponentClass() {
+ // only poll component is allowed.
+ return UIPoll.class;
+ }
+
+ protected boolean isSubmitted(FacesContext facesContext, UIComponent uiComponent) {
+ boolean submitted = super.isSubmitted(facesContext, uiComponent);
+ UIPoll poll = (UIPoll) uiComponent;
+ poll.setSubmitted(submitted);
+ return submitted;
+ }
+
+}
Copied: root/ui-sandbox/trunk/components/core/src/main/java/org/ajax4jsf/renderkit/html/AjaxRegionRenderer.java (from rev 15053, root/ui/trunk/components/core/src/main/java/org/ajax4jsf/renderkit/html/AjaxRegionRenderer.java)
===================================================================
--- root/ui-sandbox/trunk/components/core/src/main/java/org/ajax4jsf/renderkit/html/AjaxRegionRenderer.java (rev 0)
+++ root/ui-sandbox/trunk/components/core/src/main/java/org/ajax4jsf/renderkit/html/AjaxRegionRenderer.java 2009-07-31 11:19:57 UTC (rev 15073)
@@ -0,0 +1,58 @@
+/**
+ * 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.renderkit.html;
+
+import java.io.IOException;
+
+import javax.faces.component.UIComponent;
+import javax.faces.context.FacesContext;
+import javax.faces.context.ResponseWriter;
+
+import org.ajax4jsf.renderkit.AjaxContainerRenderer;
+
+
+/**
+ * @author asmirnov(a)exadel.com (latest modification by $Author: alexsmirnov $)
+ * @version $Revision: 1.1.2.1 $ $Date: 2007/02/01 15:31:28 $
+ *
+ */
+public class AjaxRegionRenderer extends AjaxContainerRenderer {
+
+ public static final String RENDERER_TYPE = "org.ajax4jsf.components.AjaxRegionRenderer";
+
+ /* (non-Javadoc)
+ * @see org.ajax4jsf.renderkit.RendererBase#doEncodeBegin(javax.faces.context.ResponseWriter, javax.faces.context.FacesContext, javax.faces.component.UIComponent)
+ */
+ protected void doEncodeBegin(ResponseWriter writer, FacesContext context, UIComponent component) throws IOException {
+// AjaxRendererUtils.encodeClientScript(context,component);
+ }
+
+ /* (non-Javadoc)
+ * @see org.ajax4jsf.renderkit.RendererBase#doEncodeEnd(javax.faces.context.ResponseWriter, javax.faces.context.FacesContext, javax.faces.component.UIComponent)
+ */
+ protected void doEncodeEnd(ResponseWriter writer, FacesContext context, UIComponent component) throws IOException {
+// if (((AjaxContainer) component).isAjaxRequest()) {
+// AjaxRendererUtils.encodeAreas(context,component);
+// }
+ }
+
+}
Copied: root/ui-sandbox/trunk/components/core/src/main/java/org/ajax4jsf/renderkit/html/AjaxStatusRenderer.java (from rev 15053, root/ui/trunk/components/core/src/main/java/org/ajax4jsf/renderkit/html/AjaxStatusRenderer.java)
===================================================================
--- root/ui-sandbox/trunk/components/core/src/main/java/org/ajax4jsf/renderkit/html/AjaxStatusRenderer.java (rev 0)
+++ root/ui-sandbox/trunk/components/core/src/main/java/org/ajax4jsf/renderkit/html/AjaxStatusRenderer.java 2009-07-31 11:19:57 UTC (rev 15073)
@@ -0,0 +1,167 @@
+/**
+ * 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.renderkit.html;
+
+import java.io.IOException;
+
+import javax.faces.component.UIComponent;
+import javax.faces.context.FacesContext;
+import javax.faces.context.ResponseWriter;
+
+import org.ajax4jsf.component.UIAjaxStatus;
+import org.ajax4jsf.javascript.JSFunctionDefinition;
+import org.ajax4jsf.renderkit.RendererBase;
+import org.ajax4jsf.renderkit.RendererUtils.HTML;
+
+
+/**
+ * @author shura (latest modification by $Author: alexsmirnov $)
+ * @version $Revision: 1.1.2.2 $ $Date: 2007/02/19 11:17:10 $
+ *
+ * Render status component as two span's, one for start request,
+ * one for complete.
+ */
+public class AjaxStatusRenderer extends RendererBase
+{
+ /**
+ *
+ */
+ public static final String RENDERER_TYPE = "org.ajax4jsf.components.AjaxStatusRenderer";
+
+ /**
+ *
+ */
+ public static final String START_STYLE = "display: none";
+
+ /* (non-Javadoc)
+ * @see javax.faces.render.Renderer#encodeEnd(javax.faces.context.FacesContext, javax.faces.component.UIComponent)
+ */
+ public void doEncodeEnd(ResponseWriter writer, FacesContext context, UIComponent component) throws IOException
+ {
+ // find form clientId for wich we render status.
+ String statusId = component.getClientId(context);
+ String tag = getTag(component);
+ writer.startElement(tag, component);
+ writer.writeAttribute(HTML.id_ATTRIBUTE, statusId , null);
+ // render 2 span components for different states
+ encodeSpan(writer, context, component,statusId, "start", tag);
+ encodeSpan(writer, context, component,statusId, "stop", tag);
+ writer.endElement(tag);
+ }
+
+ /**
+ * Encode one span for start or stop status
+ * @param context - current context
+ * @param component - status component
+ * @param state - name of state ( start or stop ) for span.
+ * @param tag TODO
+ * @throws IOException
+ */
+ protected void encodeSpan(ResponseWriter writer, FacesContext context, UIComponent component, String id, String state, String tag) throws IOException {
+ writer.startElement(tag, component);
+ String spanId = id+"."+state;
+ writer.writeAttribute(HTML.id_ATTRIBUTE, spanId , null);
+ // Styles for concrete state.
+ String style = getNamedAttribute(component, "Style", state);
+ // for start state rendered style always disable display of status
+ // ( since it will enabled by JavaScript on start request )
+ if("start".equals(state)) {
+ if(null == style) {
+ style = START_STYLE;
+ } else {
+ style += "; "+START_STYLE;
+ }
+ }
+// HtmlRendererUtils.renderHTMLAttribute(writer, "style", "style", style );
+// HtmlRendererUtils.renderHTMLAttribute(writer, "styleClass", "styleClass", getNamedAttribute(component, "StyleClass", state));
+ if (null != style) {
+ writer.writeAttribute("style", style, null);
+ }
+ String styleClass = getNamedAttribute(component, "StyleClass", state);
+ if(null != styleClass){
+ writer.writeAttribute("class", styleClass, null);
+ }
+// getUtils().encodeAttribute(context,component,"class");
+ getUtils().encodePassThru(context , component);
+ // render facet or text.
+ UIComponent facet = component.getFacet(state);
+ if(null != facet) {
+ renderChild(context, facet);
+ } else {
+ String namedAttribute = getNamedAttribute(component, "Text", state);
+ if (null != namedAttribute) {
+ writer.writeText(namedAttribute, "text");
+ }
+// else {
+// throw new FacesException("Status component must have one of '"+state+"' facet or '"+state+"Text' atribute");
+// }
+ }
+ writer.endElement(tag);
+ // ENCODE onstart/onstop javaScript.
+ Object eventHandler = component.getAttributes().get("on"+state);
+ if(null != eventHandler){
+ StringBuffer script = new StringBuffer("\n");
+ script.append("window.document.getElementById('").append(spanId).append("').on").append(state).append("=");
+ JSFunctionDefinition function = new JSFunctionDefinition();
+ function.addToBody(eventHandler).addToBody(";").appendScript(script);
+ script.append(";\n");
+ getUtils().writeScript(context, component, script);
+ }
+ }
+
+ /**
+ * @param component
+ * @param name name of attribute for current state
+ * @param state 'start' or 'stop' . all dublicated attributes foe Ajax state
+ * have same syntax : startStyle/stopStyle ...
+ * @return value of attribute for name and state
+ */
+ protected String getNamedAttribute(UIComponent component, String name, String state)
+ {
+ String fullName = (new StringBuffer(state).append(name)).toString();
+ return (String) component.getAttributes().get(fullName);
+ }
+
+ protected Class getComponentClass() {
+ // TODO Auto-generated method stub
+ return UIAjaxStatus.class;
+ }
+
+ /**
+ * @param status
+ * @return
+ */
+ private String getTag(UIComponent status) {
+ // TODO Auto-generated method stub
+ return "block".equals(status.getAttributes().get("layout"))?HTML.DIV_ELEM:HTML.SPAN_ELEM;
+ }
+
+ /* (non-Javadoc)
+ * @see javax.faces.render.Renderer#getRendersChildren()
+ */
+ public boolean getRendersChildren() {
+ // TODO Auto-generated method stub
+ return true;
+ }
+
+
+}
Copied: root/ui-sandbox/trunk/components/core/src/main/java/org/ajax4jsf/renderkit/html/AjaxSupportRenderer.java (from rev 15053, root/ui/trunk/components/core/src/main/java/org/ajax4jsf/renderkit/html/AjaxSupportRenderer.java)
===================================================================
--- root/ui-sandbox/trunk/components/core/src/main/java/org/ajax4jsf/renderkit/html/AjaxSupportRenderer.java (rev 0)
+++ root/ui-sandbox/trunk/components/core/src/main/java/org/ajax4jsf/renderkit/html/AjaxSupportRenderer.java 2009-07-31 11:19:57 UTC (rev 15073)
@@ -0,0 +1,57 @@
+/**
+ * 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.renderkit.html;
+
+import org.ajax4jsf.renderkit.AjaxCommandRendererBase;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+
+
+/**
+ * Since <code>UIAjaxRegion</code> dont render itself ( only set apropriate event to parent component )
+ * only <code>decode()</code> method implemented.
+ * In case of Ajax Request caused by event for a given component
+ * send action event.
+ * @author shura (latest modification by $Author: alexsmirnov $)
+ * @version $Revision: 1.1.2.1 $ $Date: 2007/02/01 15:31:24 $
+ *
+ */
+public class AjaxSupportRenderer extends AjaxCommandRendererBase
+{
+ private static final Log log = LogFactory.getLog(AjaxSupportRenderer.class);
+
+ /* (non-Javadoc)
+ * @see javax.faces.render.Renderer#getRendersChildren()
+ */
+ public boolean getRendersChildren()
+ {
+
+ return false;
+ }
+
+ protected Class getComponentClass() {
+ // TODO Auto-generated method stub
+ return org.ajax4jsf.component.UIAjaxSupport.class;
+ }
+
+}
Copied: root/ui-sandbox/trunk/components/core/src/main/java/org/ajax4jsf/renderkit/html/HtmlCommandLinkRenderer.java (from rev 15053, root/ui/trunk/components/core/src/main/java/org/ajax4jsf/renderkit/html/HtmlCommandLinkRenderer.java)
===================================================================
--- root/ui-sandbox/trunk/components/core/src/main/java/org/ajax4jsf/renderkit/html/HtmlCommandLinkRenderer.java (rev 0)
+++ root/ui-sandbox/trunk/components/core/src/main/java/org/ajax4jsf/renderkit/html/HtmlCommandLinkRenderer.java 2009-07-31 11:19:57 UTC (rev 15073)
@@ -0,0 +1,252 @@
+/**
+ * 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.renderkit.html;
+
+import java.io.IOException;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.Map;
+
+import javax.faces.component.UICommand;
+import javax.faces.component.UIComponent;
+import javax.faces.component.UIForm;
+import javax.faces.component.UIParameter;
+import javax.faces.component.ValueHolder;
+import javax.faces.context.FacesContext;
+import javax.faces.context.ResponseWriter;
+import javax.faces.event.ActionEvent;
+
+import org.ajax4jsf.Messages;
+import org.ajax4jsf.javascript.JSFunction;
+import org.ajax4jsf.renderkit.RendererBase;
+import org.ajax4jsf.renderkit.RendererUtils.HTML;
+import org.ajax4jsf.resource.InternetResource;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+/**
+ * "Wrapped" standard {@link javax.faces.component.html.HtmlCommandLink} renderer,
+ * to avoid common problem - If no commandLink's exist in initial rendered page, {@link javax.faces.component.html.HtmlForm} renderer
+ * don't encode nessesary hidden fields for link and it's param. Our form-link renderer can avoid this problem.
+ * @author shura
+ *
+ */
+public class HtmlCommandLinkRenderer extends RendererBase {
+
+ private static final Log _log = LogFactory.getLog(HtmlCommandLinkRenderer.class);
+
+ private static final String[] LINK_EXCLUSIONS = {"onclick","target","href"};
+
+ private InternetResource[] scripts = null;
+ private static final String FORM_SCRIPT = "/org/ajax4jsf/javascript/scripts/form.js";
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.ajax4jsf.renderkit.RendererBase#doDecode(javax.faces.context.FacesContext,
+ * javax.faces.component.UIComponent)
+ */
+ protected void doDecode(FacesContext context, UIComponent component) {
+ UIForm form = getUtils().getNestingForm(context,component);
+ if(null != form){
+ String hiddenFieldId = getHiddenFieldId(context, form, component);
+ Object hiddenFieldValue;
+ if(null != (hiddenFieldValue=context.getExternalContext().getRequestParameterMap().get(hiddenFieldId))){
+ if(component.getClientId(context).equals(hiddenFieldValue)){
+ // Link submitted !
+ if(_log.isDebugEnabled()){
+ _log.debug(Messages.getMessage(Messages.COMMAND_LINK_SUBMIT_INFO, component.getClientId(context)));
+ }
+ ActionEvent actionEvent = new ActionEvent(component);
+ component.queueEvent(actionEvent);
+ }
+ }
+ }
+ }
+
+ /* (non-Javadoc)
+ * @see org.ajax4jsf.renderkit.RendererBase#doEncodeBegin(javax.faces.context.ResponseWriter, javax.faces.context.FacesContext, javax.faces.component.UIComponent)
+ */
+ protected void doEncodeBegin(ResponseWriter writer, FacesContext context, UIComponent component) throws IOException {
+ if(isDisabled(context,component)){
+ doEncodePassiveBegin(writer, context, component);
+ } else {
+ doEncodeActiveBegin(writer, context, component);
+ }
+ }
+
+ private String getHiddenFieldId(FacesContext context, UIForm form, UIComponent component) {
+ return form.getClientId(context)+AjaxFormRenderer.HIDDEN_FIELD_SUFFIX;
+ }
+
+ protected void doEncodeActiveBegin(ResponseWriter writer, FacesContext context, UIComponent component) throws IOException{
+ writer.startElement(HTML.a_ELEMENT,component);
+ getUtils().encodeId(context,component);
+ getUtils().encodeAttributesFromArray(context,component,HTML.PASS_THRU_STYLES);
+ getUtils().encodePassThruWithExclusionsArray(context,component,LINK_EXCLUSIONS);
+ writer.writeAttribute("href","#",null);
+ UIForm form = getUtils().getNestingForm(context,component);
+ String clientId = component.getClientId(context);
+ if(null == form){
+ if(_log.isWarnEnabled()){
+ _log.warn(Messages.getMessage(Messages.COMMAND_LINK_NOT_IN_FORM_WARNING, clientId));
+ }
+ return;
+ }
+ // Encode onclick attribute.
+ Object click = component.getAttributes().get("onclick");
+ StringBuffer onclick = new StringBuffer(256);
+ if(null != click){
+ onclick.append(click).append(';');
+ }
+ JSFunction submit = new JSFunction(AjaxFormRenderer.FORM_SUBMIT_FUNCTION_NAME);
+ submit.addParameter(clientId);
+ submit.addParameter(form.getClientId(context));
+ submit.addParameter(component.getAttributes().get("target"));
+ Map parameters = new HashMap();
+ for (Iterator iter = component.getChildren().iterator(); iter.hasNext();) {
+ Object child = iter.next();
+ if (child instanceof UIParameter) {
+ UIParameter param = (UIParameter) child;
+ String name = ((UIParameter) child).getName();
+ Object value = ((UIParameter) child).getValue();
+
+ if (name == null) {
+ throw new IllegalArgumentException(Messages.getMessage(
+ Messages.UNNAMED_PARAMETER_ERROR, component.getClientId(context)));
+ }
+
+ if (value == null) {
+ value = "";
+ }
+
+ parameters.put(name,value);
+ }
+ }
+
+ parameters.put(getHiddenFieldId(context, form, component), component.getClientId(context));
+
+ submit.addParameter(parameters);
+ onclick.append("return ");
+ submit.appendScript(onclick);
+ writer.writeAttribute(HTML.onclick_ATTRIBUTE,onclick,"onclick");
+ //
+ encodeValue(writer,context,component);
+ }
+
+ protected void doEncodePassiveBegin(ResponseWriter writer, FacesContext context, UIComponent component) throws IOException{
+ writer.startElement(HTML.SPAN_ELEM,component);
+ getUtils().encodeId(context,component);
+ getUtils().encodeAttributesFromArray(context,component,HTML.PASS_THRU_STYLES);
+ getUtils().encodePassThru(context,component);
+ encodeValue(writer,context,component);
+ }
+
+ /* (non-Javadoc)
+ * @see javax.faces.render.Renderer#encodeChildren(javax.faces.context.FacesContext, javax.faces.component.UIComponent)
+ */
+ public void encodeChildren(FacesContext context, UIComponent component) throws IOException {
+ // TODO Auto-generated method stub
+ renderChildren(context,component);
+ }
+
+ /* (non-Javadoc)
+ * @see org.ajax4jsf.renderkit.RendererBase#doEncodeEnd(javax.faces.context.ResponseWriter, javax.faces.context.FacesContext, javax.faces.component.UIComponent)
+ */
+ protected void doEncodeEnd(ResponseWriter writer, FacesContext context, UIComponent component) throws IOException {
+ if(isDisabled(context,component)){
+ doEncodePassiveEnd(writer, context, component);
+ } else {
+ doEncodeActiveEnd(writer, context, component);
+ }
+ }
+
+ protected void doEncodeActiveEnd(ResponseWriter writer, FacesContext context, UIComponent component) throws IOException{
+ writer.endElement(HTML.a_ELEMENT);
+ }
+
+ protected void doEncodePassiveEnd(ResponseWriter writer, FacesContext context, UIComponent component) throws IOException{
+ writer.endElement(HTML.SPAN_ELEM);
+ }
+
+/**
+ * Check for disabled component
+ * @param context
+ * @param command
+ * @return true if link is disabled.
+ */
+private boolean isDisabled(FacesContext context, UIComponent command){
+ if (command.getAttributes().get("disabled") != null) {
+ if ((command.getAttributes().get("disabled")).equals(Boolean.TRUE)) {
+ return true;
+ }
+ }
+ return false;
+}
+ /* (non-Javadoc)
+ * @see org.ajax4jsf.renderkit.RendererBase#getComponentClass()
+ */
+ protected Class getComponentClass() {
+ // TODO Auto-generated method stub
+ return UICommand.class;
+ }
+
+ /* (non-Javadoc)
+ * @see javax.faces.render.Renderer#getRendersChildren()
+ */
+ public boolean getRendersChildren() {
+ return true;
+ }
+
+ protected void encodeValue(ResponseWriter writer, FacesContext context, UIComponent component) throws IOException{
+ String valueString = null;
+ if (component instanceof UICommand) {
+ Object value = ((UICommand) component).getValue();
+ if (value != null) {
+ valueString = value.toString();
+ }
+ } else if (component instanceof ValueHolder) {
+ Object value = ((ValueHolder) component).getValue();
+ if (value != null) {
+ valueString = getUtils().formatValue(context,component,value);
+ }
+ }
+
+ if (null != valueString && valueString.length()>0) {
+ writer.writeText(valueString,null);
+ }
+ }
+
+ /* (non-Javadoc)
+ * @see org.ajax4jsf.renderkit.HeaderResourcesRendererBase#getScripts()
+ */
+ protected InternetResource[] getScripts() {
+ synchronized (this) {
+ if (scripts == null) {
+ scripts = new InternetResource[1];
+ scripts[0] = getResource(FORM_SCRIPT);
+ }
+ }
+
+ return scripts;
+ }
+}
Copied: root/ui-sandbox/trunk/components/core/src/main/java/org/ajax4jsf/renderkit/html/QueueRenderer.java (from rev 15053, root/ui/trunk/components/core/src/main/java/org/ajax4jsf/renderkit/html/QueueRenderer.java)
===================================================================
--- root/ui-sandbox/trunk/components/core/src/main/java/org/ajax4jsf/renderkit/html/QueueRenderer.java (rev 0)
+++ root/ui-sandbox/trunk/components/core/src/main/java/org/ajax4jsf/renderkit/html/QueueRenderer.java 2009-07-31 11:19:57 UTC (rev 15073)
@@ -0,0 +1,183 @@
+/**
+ * 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.renderkit.html;
+
+import java.io.IOException;
+import java.util.Map;
+
+import javax.faces.component.UIComponent;
+import javax.faces.context.FacesContext;
+
+import org.ajax4jsf.component.QueueRegistry;
+import org.ajax4jsf.component.UIQueue;
+import org.ajax4jsf.javascript.JSFunctionDefinition;
+import org.ajax4jsf.renderkit.AjaxRendererUtils;
+import org.ajax4jsf.renderkit.RendererBase;
+import org.ajax4jsf.renderkit.RendererUtils;
+import org.ajax4jsf.renderkit.html.scripts.QueueScript;
+import org.ajax4jsf.resource.InternetResource;
+import org.richfaces.component.util.MessageUtil;
+
+/**
+ * @author Nick Belaevski
+ * @since 3.3.0
+ */
+public class QueueRenderer extends RendererBase {
+
+ private static final String SIZE_EXCEEDED_BEHAVIOR = "sizeExceededBehavior";
+
+ private static final String SIZE = "size";
+
+ private static final String QUEUE_ONSUBMIT_ATTRIBUTE = "queueonsubmit";
+
+ private static final String QUEUE_ONBEFOREDOMUPDATE_ATTRIBUTE = "queueonbeforedomupdate";
+
+ private static final String QUEUE_ONCOMPLETE_ATTRIBUTE = "queueoncomplete";
+
+ private static final String QUEUE_ONERROR_ATTRIBUTE = "queueonerror";
+
+ public static final String BEHAVIOR_DROP_NEXT = "dropNext";
+
+ public static final String BEHAVIOR_DROP_NEW = "dropNew";
+
+ public static final String BEHAVIOR_FIRE_NEXT = "fireNext";
+
+ public static final String BEHAVIOR_FIRE_NEW = "fireNew";
+
+ private static final String[] REQUEST_ATTRIBUTES = new String[] {
+ "ignoreDupResponses",
+ "requestDelay",
+ "timeout"
+ };
+
+ private InternetResource[] scripts = new InternetResource[] {
+ getResource(QueueScript.class.getName())
+ };
+
+ @Override
+ protected Class<? extends UIComponent> getComponentClass() {
+ return UIQueue.class;
+ }
+
+ private static final RendererUtils utils = RendererUtils.getInstance();
+
+ private boolean isValidBehaviorValue(String value) {
+ return BEHAVIOR_DROP_NEW.equals(value) || BEHAVIOR_DROP_NEXT.equals(value) ||
+ BEHAVIOR_FIRE_NEW.equals(value) || BEHAVIOR_FIRE_NEXT.equals(value);
+ }
+
+ private QueueRendererData createRendererData(FacesContext context, UIQueue queue) {
+ Map<String, Object> attributes = queue.getAttributes();
+
+ QueueRendererData data = new QueueRendererData();
+
+ int size = queue.getSize();
+ if (utils.shouldRenderAttribute(size)) {
+ data.addQueueAttribute(SIZE, size);
+ }
+
+ String sizeExceededBehavior = (String) attributes.get(SIZE_EXCEEDED_BEHAVIOR);
+ if (utils.shouldRenderAttribute(sizeExceededBehavior)) {
+ if (!isValidBehaviorValue(sizeExceededBehavior)) {
+ throw new IllegalArgumentException(sizeExceededBehavior + " value of " +
+ SIZE_EXCEEDED_BEHAVIOR + " attribute is not a legal one for component: " +
+ MessageUtil.getLabel(context, queue));
+ }
+
+ data.addQueueAttribute(SIZE_EXCEEDED_BEHAVIOR, sizeExceededBehavior);
+ }
+
+ String onsizeexceeded = queue.getOnsizeexceeded();
+ if (utils.shouldRenderAttribute(onsizeexceeded)) {
+ data.addQueueAttribute("onsizeexceeded", new JSFunctionDefinition("query", "options", "event").addToBody(onsizeexceeded));
+ }
+
+ String onrequestqueue = queue.getOnrequestqueue();
+ if (utils.shouldRenderAttribute(onrequestqueue)) {
+ data.addQueueAttribute("onrequestqueue", new JSFunctionDefinition("query", "options", "event").addToBody(onrequestqueue));
+ }
+
+ String onrequestdequeue = queue.getOnrequestdequeue();
+ if (utils.shouldRenderAttribute(onrequestdequeue)) {
+ data.addQueueAttribute("onrequestdequeue", new JSFunctionDefinition("query", "options", "event").addToBody(onrequestdequeue));
+ }
+
+ for (String attributeName : REQUEST_ATTRIBUTES) {
+ Object value = attributes.get(attributeName);
+ if (utils.shouldRenderAttribute(value)) {
+ data.addRequestAttribute(attributeName, value);
+ }
+ }
+
+ String status = AjaxRendererUtils.getAjaxStatus(queue);
+ if (utils.shouldRenderAttribute(status)) {
+ data.addRequestAttribute(AjaxRendererUtils.STATUS_ATTR_NAME, status);
+ }
+
+ String onBeforeDomUpdate = queue.getOnbeforedomupdate();
+ if (utils.shouldRenderAttribute(onBeforeDomUpdate)) {
+ data.addRequestAttribute(QUEUE_ONBEFOREDOMUPDATE_ATTRIBUTE, AjaxRendererUtils.buildAjaxOnBeforeDomUpdate(onBeforeDomUpdate));
+ }
+
+ String oncomplete = queue.getOncomplete();
+ if (utils.shouldRenderAttribute(oncomplete)) {
+ data.addRequestAttribute(QUEUE_ONCOMPLETE_ATTRIBUTE, AjaxRendererUtils.buildAjaxOncomplete(oncomplete));
+ }
+
+ String onsubmit = queue.getOnsubmit();
+ if (utils.shouldRenderAttribute(onsubmit)) {
+ JSFunctionDefinition onsubmitFunction = new JSFunctionDefinition("request");
+ onsubmitFunction.addToBody(onsubmit);
+
+ data.addRequestAttribute(QUEUE_ONSUBMIT_ATTRIBUTE, onsubmitFunction);
+ }
+
+ String onerror = queue.getOnerror();
+ if (utils.shouldRenderAttribute(onerror)) {
+ JSFunctionDefinition onerrorFunction = new JSFunctionDefinition("request", "status", "message");
+ onerrorFunction.addToBody(onerror);
+
+ data.addRequestAttribute(QUEUE_ONERROR_ATTRIBUTE, onerrorFunction);
+ }
+
+ return data;
+ }
+
+ @Override
+ public void encodeBegin(FacesContext context, UIComponent component)
+ throws IOException {
+ super.encodeBegin(context, component);
+ }
+
+ @Override
+ public void encodeEnd(FacesContext context, UIComponent component)
+ throws IOException {
+ super.encodeEnd(context, component);
+
+ UIQueue queue = (UIQueue) component;
+ if (!queue.isDisabled()) {
+ QueueRegistry.getInstance(context).registerQueue(context,
+ queue.getClientName(context),
+ createRendererData(context, queue));
+ }
+ }
+}
Copied: root/ui-sandbox/trunk/components/core/src/main/java/org/ajax4jsf/renderkit/html/QueueRendererData.java (from rev 15053, root/ui/trunk/components/core/src/main/java/org/ajax4jsf/renderkit/html/QueueRendererData.java)
===================================================================
--- root/ui-sandbox/trunk/components/core/src/main/java/org/ajax4jsf/renderkit/html/QueueRendererData.java (rev 0)
+++ root/ui-sandbox/trunk/components/core/src/main/java/org/ajax4jsf/renderkit/html/QueueRendererData.java 2009-07-31 11:19:57 UTC (rev 15073)
@@ -0,0 +1,61 @@
+/**
+ * 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.renderkit.html;
+
+import java.util.LinkedHashMap;
+import java.util.Map;
+
+/**
+ * @author Denis Morozov
+ * @since 3.3.0
+ */
+public class QueueRendererData {
+
+ private Map<String, Object> queueAttributes;
+
+ private Map<String, Object> requestAttributes;
+
+ public void addQueueAttribute(String key, Object value) {
+ if (queueAttributes == null) {
+ queueAttributes = new LinkedHashMap<String, Object>();
+ }
+
+ queueAttributes.put(key, value);
+ }
+
+ public void addRequestAttribute(String key, Object value) {
+ if (requestAttributes == null) {
+ requestAttributes = new LinkedHashMap<String, Object>();
+ }
+
+ requestAttributes.put(key, value);
+ }
+
+ public Map<String, Object> getQueueAttributes() {
+ return queueAttributes;
+ }
+
+ public Map<String, Object> getRequestAttributes() {
+ return requestAttributes;
+ }
+}
Copied: root/ui-sandbox/trunk/components/core/src/main/java/org/ajax4jsf/renderkit/html/RepeatRenderer.java (from rev 15053, root/ui/trunk/components/core/src/main/java/org/ajax4jsf/renderkit/html/RepeatRenderer.java)
===================================================================
--- root/ui-sandbox/trunk/components/core/src/main/java/org/ajax4jsf/renderkit/html/RepeatRenderer.java (rev 0)
+++ root/ui-sandbox/trunk/components/core/src/main/java/org/ajax4jsf/renderkit/html/RepeatRenderer.java 2009-07-31 11:19:57 UTC (rev 15073)
@@ -0,0 +1,81 @@
+/**
+ * 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.renderkit.html;
+
+import java.io.IOException;
+import java.util.ListIterator;
+
+import javax.faces.component.UIComponent;
+import javax.faces.context.FacesContext;
+
+import org.ajax4jsf.component.UIRepeat;
+import org.ajax4jsf.model.DataVisitor;
+import org.ajax4jsf.renderkit.RendererBase;
+
+/**
+ * @author shura
+ *
+ */
+public class RepeatRenderer extends RendererBase {
+
+ public void encodeChildren(FacesContext context, UIComponent component)
+ throws IOException {
+ final UIRepeat repeater = (UIRepeat) component;
+ repeater.captureOrigValue(context);
+ try {
+ DataVisitor visitor = new DataVisitor() {
+
+ public void process(FacesContext context, Object rowKey, Object argument) throws IOException {
+ repeater.setRowKey(rowKey);
+ ListIterator childIterator = repeater.getChildren()
+ .listIterator();
+ while (childIterator.hasNext()) {
+ UIComponent child = (UIComponent) childIterator.next();
+ renderChild(context, child);
+ }
+
+ }
+
+ };
+ repeater.walk(context, visitor, null);
+
+ } finally {
+ repeater.restoreOrigValue(context);
+ repeater.setRowKey(null);
+ }
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.ajax4jsf.renderkit.RendererBase#getComponentClass()
+ */
+ protected Class getComponentClass() {
+ // TODO Auto-generated method stub
+ return UIRepeat.class;
+ }
+
+ public boolean getRendersChildren() {
+ return true;
+ }
+
+}
Copied: root/ui-sandbox/trunk/components/core/src/main/java/org/ajax4jsf/renderkit/html/scripts/QueueScript.java (from rev 15053, root/ui/trunk/components/core/src/main/java/org/ajax4jsf/renderkit/html/scripts/QueueScript.java)
===================================================================
--- root/ui-sandbox/trunk/components/core/src/main/java/org/ajax4jsf/renderkit/html/scripts/QueueScript.java (rev 0)
+++ root/ui-sandbox/trunk/components/core/src/main/java/org/ajax4jsf/renderkit/html/scripts/QueueScript.java 2009-07-31 11:19:57 UTC (rev 15073)
@@ -0,0 +1,52 @@
+/**
+ * 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.renderkit.html.scripts;
+
+import org.ajax4jsf.resource.InternetResourceBase;
+import org.ajax4jsf.resource.ResourceContext;
+import org.ajax4jsf.resource.ResourceRenderer;
+
+/**
+ * @author Nick Belaevski
+ * @since 3.3.0
+ */
+public class QueueScript extends InternetResourceBase {
+
+ private static final ResourceRenderer renderer = new QueueScriptResourceRenderer();
+
+ private String key = getClass().getName();
+
+ @Override
+ public String getKey() {
+ return key;
+ }
+
+ @Override
+ public ResourceRenderer getRenderer(ResourceContext resourceContext) {
+ return renderer;
+ }
+
+ @Override
+ public boolean isCacheable(ResourceContext resourceContext) {
+ return false;
+ }
+}
Copied: root/ui-sandbox/trunk/components/core/src/main/java/org/ajax4jsf/renderkit/html/scripts/QueueScriptResourceRenderer.java (from rev 15053, root/ui/trunk/components/core/src/main/java/org/ajax4jsf/renderkit/html/scripts/QueueScriptResourceRenderer.java)
===================================================================
--- root/ui-sandbox/trunk/components/core/src/main/java/org/ajax4jsf/renderkit/html/scripts/QueueScriptResourceRenderer.java (rev 0)
+++ root/ui-sandbox/trunk/components/core/src/main/java/org/ajax4jsf/renderkit/html/scripts/QueueScriptResourceRenderer.java 2009-07-31 11:19:57 UTC (rev 15073)
@@ -0,0 +1,165 @@
+/**
+ * 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.renderkit.html.scripts;
+
+import java.io.IOException;
+import java.util.Collections;
+import java.util.LinkedHashMap;
+import java.util.Map;
+import java.util.Map.Entry;
+
+import javax.faces.context.ExternalContext;
+import javax.faces.context.FacesContext;
+import javax.faces.context.ResponseWriter;
+
+import org.ajax4jsf.component.QueueRegistry;
+import org.ajax4jsf.component.UIQueue;
+import org.ajax4jsf.context.AjaxContext;
+import org.ajax4jsf.javascript.JSObject;
+import org.ajax4jsf.javascript.ScriptUtils;
+import org.ajax4jsf.renderkit.RendererUtils.HTML;
+import org.ajax4jsf.renderkit.html.QueueRendererData;
+import org.ajax4jsf.resource.BaseResourceRenderer;
+import org.ajax4jsf.resource.InternetResource;
+
+/**
+ * @author Nick Belaevski
+ * @since 3.3.0
+ */
+public class QueueScriptResourceRenderer extends BaseResourceRenderer {
+
+ public static final String QUEUE_SCRIPT_ID = "org.ajax4jsf.queue_script";
+
+ private void encodeQueue(ResponseWriter writer, String queueName, QueueRendererData queueData)
+ throws IOException {
+
+ Map<String, Object> queueAttributes = null;
+ Map<String, Object> requestAttributes = null;
+
+ if (queueData != null) {
+ queueAttributes = queueData.getQueueAttributes();
+ requestAttributes = queueData.getRequestAttributes();
+ }
+
+ writer.writeText("if (!EventQueue.getQueue(" + ScriptUtils.toScript(queueName) + ")) { EventQueue.addQueue(", null);
+ writer.writeText(
+ new JSObject("EventQueue",
+ queueName,
+ queueAttributes,
+ requestAttributes
+ ).toScript(), null);
+ writer.writeText(") };", null);
+ }
+
+ @Override
+ protected void customEncode(InternetResource resource,
+ FacesContext context, Object data) throws IOException {
+ super.customEncode(resource, context, data);
+
+ Map<String, Object> queues = (Map<String, Object>) data;
+ ResponseWriter writer = context.getResponseWriter();
+
+ writer.writeText("if (typeof A4J != 'undefined') { if (A4J.AJAX) { with (A4J.AJAX) {", null);
+ for (Entry<String, Object> entry : queues.entrySet()) {
+ encodeQueue(writer, entry.getKey(), (QueueRendererData) entry.getValue());
+ }
+ writer.writeText("}}};", null);
+ }
+
+ protected void doEncode(InternetResource resource, FacesContext context,
+ Object data, Map<String, Object> attributes) throws IOException {
+
+ ExternalContext externalContext = context.getExternalContext();
+ Map<String, Object> requestMap = externalContext.getRequestMap();
+
+ String resourceKey = resource.getKey();
+ if (requestMap.get(resourceKey) == null) {
+ requestMap.put(resourceKey, Boolean.TRUE);
+
+ QueueRegistry queueRegistry = QueueRegistry.getInstance(context);
+ if (queueRegistry.isShouldCreateDefaultGlobalQueue()) {
+ String encodedGlobalQueueName = context.getExternalContext().encodeNamespace(
+ UIQueue.GLOBAL_QUEUE_NAME);
+
+ if (!queueRegistry.containsQueue(encodedGlobalQueueName)) {
+ queueRegistry.registerQueue(context, encodedGlobalQueueName, null);
+ }
+ }
+
+ if (queueRegistry.hasQueuesToEncode()) {
+ super.encode(resource, context, queueRegistry.getRegisteredQueues(context), attributes);
+ }
+ }
+ }
+
+ private String encodeQueueScriptId(FacesContext context) {
+ String encodedId = QUEUE_SCRIPT_ID;
+
+ AjaxContext ajaxContext = AjaxContext.getCurrentInstance(context);
+ if (!ajaxContext.isAjaxRequest()) {
+ encodedId = context.getExternalContext().encodeNamespace(encodedId);
+ }
+
+ return encodedId;
+ }
+
+ @Override
+ public void encode(InternetResource resource, FacesContext context,
+ Object data, Map<String, Object> attributes) throws IOException {
+
+ Map<String,Object> newAttributes = new LinkedHashMap<String, Object>(attributes);
+ newAttributes.put(HTML.id_ATTRIBUTE, encodeQueueScriptId(context));
+
+ doEncode(resource, context, data, newAttributes);
+ }
+
+ @Override
+ public void encode(InternetResource resource, FacesContext context,
+ Object data) throws IOException {
+
+ doEncode(resource, context, data,
+ Collections.singletonMap(HTML.id_ATTRIBUTE, (Object) encodeQueueScriptId(context)));
+ }
+
+ @Override
+ protected String[][] getCommonAttrs() {
+ return new String[][] {
+ {HTML.TYPE_ATTR, getContentType()},
+ };
+ }
+
+ @Override
+ protected String getHrefAttr() {
+ return null;
+ }
+
+ @Override
+ protected String getTag() {
+ return HTML.SCRIPT_ELEM;
+ }
+
+ public String getContentType() {
+ return "text/javascript";
+ }
+
+}
Copied: root/ui-sandbox/trunk/components/core/src/main/java/org/ajax4jsf/taglib/html/facelets/ActionParamHandler.java (from rev 15053, root/ui/trunk/components/core/src/main/java/org/ajax4jsf/taglib/html/facelets/ActionParamHandler.java)
===================================================================
--- root/ui-sandbox/trunk/components/core/src/main/java/org/ajax4jsf/taglib/html/facelets/ActionParamHandler.java (rev 0)
+++ root/ui-sandbox/trunk/components/core/src/main/java/org/ajax4jsf/taglib/html/facelets/ActionParamHandler.java 2009-07-31 11:19:57 UTC (rev 15073)
@@ -0,0 +1,202 @@
+/**
+ * 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.taglib.html.facelets;
+
+import javax.faces.application.Application;
+import javax.faces.component.ActionSource;
+import javax.faces.component.UIComponent;
+import javax.faces.context.FacesContext;
+import javax.faces.convert.Converter;
+import javax.faces.event.ActionEvent;
+import javax.faces.view.facelets.ComponentConfig;
+import javax.faces.view.facelets.ComponentHandler;
+import javax.faces.view.facelets.FaceletContext;
+import javax.faces.view.facelets.MetaRule;
+import javax.faces.view.facelets.MetaRuleset;
+import javax.faces.view.facelets.Metadata;
+import javax.faces.view.facelets.MetadataTarget;
+import javax.faces.view.facelets.TagAttribute;
+import javax.faces.view.facelets.TagAttributeException;
+
+import org.ajax4jsf.Messages;
+import org.ajax4jsf.component.UIActionParameter;
+
+/**
+ * @author shura (latest modification by $Author: alexsmirnov $)
+ * @version $Revision: 1.1.2.1 $ $Date: 2007/02/01 15:31:23 $
+ *
+ */
+public class ActionParamHandler extends ComponentHandler {
+
+ /**
+ * @author shura (latest modification by $Author: alexsmirnov $)
+ * @version $Revision: 1.1.2.1 $ $Date: 2007/02/01 15:31:23 $
+ *
+ */
+ public static class ActionParamMetaRule extends MetaRule {
+
+ /* (non-Javadoc)
+ * @see org.ajax4jsf.tag.SuggestionHandler.SuggestionMetaRule#applyRule(java.lang.String, com.sun.facelets.tag.TagAttribute, com.sun.facelets.tag.MetadataTarget)
+ */
+ public Metadata applyRule(String name, TagAttribute attribute, MetadataTarget meta) {
+ if (meta.isTargetInstanceOf(UIActionParameter.class)) {
+ if ("assignTo".equals(name)) {
+ return new AssignToValueBindingMetadata(attribute);
+ } else if ("converter".equals(name)) {
+ if (attribute.isLiteral()) {
+ return new LiteralConverterMetadata(attribute.getValue());
+ } else {
+ return new DynamicConverterMetadata(attribute);
+ }
+
+ } else if ("actionListener".equals(name)) {
+ return new ActionListenerMetadata(attribute);
+ }
+ }
+
+ return null;
+ }
+
+
+ }
+
+ final static class LiteralConverterMetadata extends Metadata {
+
+ private final String converterId;
+
+ public LiteralConverterMetadata(String converterId) {
+ this.converterId = converterId;
+ }
+
+ public void applyMetadata(FaceletContext ctx, Object instance) {
+ ((UIActionParameter) instance).setConverter(ctx.getFacesContext()
+ .getApplication().createConverter(this.converterId));
+ }
+ }
+
+ final static class DynamicConverterMetadata extends Metadata {
+
+ private final TagAttribute attr;
+
+ public DynamicConverterMetadata(TagAttribute attr) {
+ this.attr = attr;
+ }
+
+ public void applyMetadata(FaceletContext ctx, Object instance) {
+ ((UIActionParameter) instance).setConverter((Converter) this.attr
+ .getObject(ctx, Converter.class));
+ }
+ }
+
+ final static class AssignToValueBindingMetadata extends Metadata {
+
+ private final TagAttribute attr;
+
+ public AssignToValueBindingMetadata(TagAttribute attr) {
+ this.attr = attr;
+ }
+
+ public void applyMetadata(FaceletContext ctx, Object instance) {
+ ((UIActionParameter) instance).setAssignToBinding(attr.getValueExpression(ctx,
+ Object.class));
+ }
+ }
+
+ final static class ActionListenerMetadata extends Metadata {
+
+ private static final Class[] SIGNATURE = new Class[] {ActionEvent.class};
+
+ private final TagAttribute attribute;
+
+ public ActionListenerMetadata(TagAttribute attribute) {
+ super();
+ this.attribute = attribute;
+ }
+
+ public void applyMetadata(FaceletContext ctx, Object instance) {
+ ((UIActionParameter) instance).setActionListener(
+ attribute.getMethodExpression(ctx, null, SIGNATURE));
+ }
+ };
+
+ private TagAttribute _assignTo;
+ private TagAttribute _converter;
+ private TagAttribute _actionListener;
+
+ /**
+ * @param config
+ */
+ public ActionParamHandler(ComponentConfig config) {
+ super(config);
+ _assignTo = getAttribute("assignTo");
+ _converter = getAttribute("converter");
+ _actionListener = getAttribute("actionListener");
+
+ if(null != _assignTo) {
+ if (_assignTo.isLiteral()) {
+ throw new TagAttributeException(this.tag, this._assignTo, Messages.getMessage(Messages.MUST_BE_EXPRESSION_ERROR));
+ }
+ }
+
+ if (null != _actionListener) {
+ if (_actionListener.isLiteral()) {
+ throw new TagAttributeException(this.tag, this._actionListener, Messages.getMessage(Messages.MUST_BE_EXPRESSION_ERROR));
+ }
+ }
+ // TODO Auto-generated constructor stub
+ }
+ /*
+ * (non-Javadoc)
+ *
+ * @see com.sun.facelets.FaceletHandler#apply(com.sun.facelets.FaceletContext,
+ * javax.faces.component.UIComponent)
+ */
+ public void onComponentCreated(FaceletContext ctx, UIComponent c, UIComponent parent) {
+ if (parent instanceof ActionSource)
+ {
+ FacesContext facesContext = FacesContext.getCurrentInstance();
+ Application application = facesContext.getApplication();
+ if (_assignTo != null) {
+ UIActionParameter al = (UIActionParameter)c;
+ // TODO - in jsf 1.2 use ELValueExpression
+// al.setAssignToBinding(application.createValueBinding(_assignTo.getValue()));
+// if (_converter != null) {
+// Converter converter = application.createConverter(_converter.getValue(ctx));
+// al.setConverter(converter);
+// }
+ ((ActionSource)parent).addActionListener(al);
+ }
+ }
+ }
+
+ private static final ActionParamMetaRule actionParamMetaRule = new ActionParamMetaRule();
+
+ /* (non-Javadoc)
+ * @see org.ajax4jsf.tag.AjaxComponentHandler#createMetaRuleset(java.lang.Class)
+ */
+ protected MetaRuleset createMetaRuleset(Class type) {
+ MetaRuleset metaRules = super.createMetaRuleset(type);
+ metaRules.addRule(actionParamMetaRule);
+ return metaRules;
+ }
+
+}
Copied: root/ui-sandbox/trunk/components/core/src/main/java/org/ajax4jsf/taglib/html/facelets/AjaxListenerHandler.java (from rev 15053, root/ui/trunk/components/core/src/main/java/org/ajax4jsf/taglib/html/facelets/AjaxListenerHandler.java)
===================================================================
--- root/ui-sandbox/trunk/components/core/src/main/java/org/ajax4jsf/taglib/html/facelets/AjaxListenerHandler.java (rev 0)
+++ root/ui-sandbox/trunk/components/core/src/main/java/org/ajax4jsf/taglib/html/facelets/AjaxListenerHandler.java 2009-07-31 11:19:57 UTC (rev 15073)
@@ -0,0 +1,120 @@
+/**
+ * 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.taglib.html.facelets;
+
+import java.io.IOException;
+
+import javax.el.ELException;
+import javax.el.ValueExpression;
+import javax.faces.FacesException;
+import javax.faces.component.UIComponent;
+import javax.faces.view.facelets.FaceletContext;
+import javax.faces.view.facelets.FaceletException;
+import javax.faces.view.facelets.TagAttribute;
+import javax.faces.view.facelets.TagAttributeException;
+import javax.faces.view.facelets.TagConfig;
+import javax.faces.view.facelets.TagException;
+import javax.faces.view.facelets.TagHandler;
+
+import org.ajax4jsf.Messages;
+import org.ajax4jsf.event.AjaxListener;
+import org.ajax4jsf.event.AjaxListenerHelper;
+import org.ajax4jsf.event.AjaxSource;
+
+/**
+ * Register an ActionListener instance on the UIComponent associated with the
+ * closest parent UIComponent custom action. <p/> See <a target="_new"
+ * href="http://java.sun.com/j2ee/javaserverfaces/1.1_01/docs/tlddocs/f/actionList...">tag
+ * documentation</a>.
+ *
+ * @see javax.faces.event.ActionListener
+ * @see javax.faces.component.AjaxContainer
+ * @author Jacob Hookom
+ * @version $Id: AjaxListenerHandler.java,v 1.1.2.1 2007/02/01 15:31:23 alexsmirnov Exp $
+ */
+public final class AjaxListenerHandler extends TagHandler {
+
+ private Class listenerType;
+
+ private final TagAttribute type;
+
+ private final TagAttribute binding;
+
+ /**
+ * @param config
+ */
+ public AjaxListenerHandler(TagConfig config) {
+ super(config);
+ this.binding = this.getAttribute("binding");
+ this.type = this.getAttribute("type");
+ if(binding == null && type == null){
+ throw new TagException(this.tag, "One of the attribute 'binding' or type' is required");
+ }
+ if (binding == null && type != null) {
+ if (!type.isLiteral()) {
+ throw new TagAttributeException(this.tag, this.type, Messages.getMessage(Messages.MUST_BE_LITERAL_ERROR));
+ }
+ try {
+ this.listenerType = Class.forName(type.getValue());
+ } catch (Exception e) {
+ throw new TagAttributeException(this.tag, this.type, e);
+ }
+ }
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see com.sun.facelets.FaceletHandler#apply(com.sun.facelets.FaceletContext,
+ * javax.faces.component.UIComponent)
+ */
+ public void apply(FaceletContext ctx, UIComponent parent)
+ throws IOException, FacesException, FaceletException, ELException {
+ if (parent instanceof AjaxSource) {
+ // only process if parent was just created
+ if (parent.getParent() == null) {
+ AjaxSource src = (AjaxSource) parent;
+ AjaxListener listener = null;
+ ValueExpression ve = null;
+ if (this.binding != null) {
+ ve = this.binding.getValueExpression(ctx,
+ AjaxListener.class);
+ // TODO - handle both JSF 1.2/1.1 cases.
+ listener = new AjaxListenerHelper(ve);
+ }
+ if (listener == null) {
+ try {
+ listener = (AjaxListener) listenerType.newInstance();
+ } catch (Exception e) {
+ throw new TagAttributeException(this.tag, this.type, e.getCause());
+ }
+ if (ve != null) {
+ ve.setValue(ctx, ve);
+ }
+ }
+ src.addAjaxListener(listener);
+ }
+ } else {
+ throw new TagException(this.tag, Messages.getMessage(Messages.NOT_PARENT_AJAX_COMPONENT_ERROR, parent));
+ }
+ }
+}
Copied: root/ui-sandbox/trunk/components/core/src/main/java/org/ajax4jsf/taglib/html/facelets/AjaxSupportHandler.java (from rev 15053, root/ui/trunk/components/core/src/main/java/org/ajax4jsf/taglib/html/facelets/AjaxSupportHandler.java)
===================================================================
--- root/ui-sandbox/trunk/components/core/src/main/java/org/ajax4jsf/taglib/html/facelets/AjaxSupportHandler.java (rev 0)
+++ root/ui-sandbox/trunk/components/core/src/main/java/org/ajax4jsf/taglib/html/facelets/AjaxSupportHandler.java 2009-07-31 11:19:57 UTC (rev 15073)
@@ -0,0 +1,97 @@
+/**
+ * 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.taglib.html.facelets;
+
+import java.io.IOException;
+
+import javax.el.ELException;
+import javax.faces.FacesException;
+import javax.faces.component.UIComponent;
+import javax.faces.component.UIComponentBase;
+import javax.faces.view.facelets.ComponentConfig;
+import javax.faces.view.facelets.FaceletContext;
+import javax.faces.view.facelets.FaceletException;
+import javax.faces.view.facelets.TagAttribute;
+import javax.faces.view.facelets.TagHandler;
+
+import org.ajax4jsf.taglib.html.jsp.AjaxSupportTag;
+import org.ajax4jsf.webapp.taglib.AjaxComponentHandler;
+
+/**
+ * "proxy" class for creating UIAjaxSupport component as facet for it's parent.
+ * @author shura (latest modification by $Author: alexsmirnov $)
+ * @version $Revision: 1.1.2.1 $ $Date: 2007/02/01 15:31:22 $
+ *
+ */
+public class AjaxSupportHandler extends TagHandler {
+ /**
+ * A UIComponent for capturing a child UIComponent, representative of the
+ * desired Facet
+ *
+ * @author Jacob Hookom
+ *
+ */
+ private final static class UIFacet extends UIComponentBase {
+ public String getFamily() {
+ return null;
+ }
+ }
+
+ /**
+ * Real tag handler for create component.
+ */
+ private TagHandler _ajaxSupportHandler;
+
+ private TagAttribute _event;
+ /**
+ * @param config
+ */
+ public AjaxSupportHandler(ComponentConfig config) {
+ super(config);
+ _event = getRequiredAttribute("event");
+ _ajaxSupportHandler = new AjaxComponentHandler(config);
+ }
+
+ /* (non-Javadoc)
+ * @see com.sun.facelets.FaceletHandler#apply(com.sun.facelets.FaceletContext, javax.faces.component.UIComponent)
+ */
+ public void apply(FaceletContext ctx, UIComponent parent)
+ throws IOException, FacesException, FaceletException, ELException {
+ UIComponent c;
+ // our id
+// String id = ctx.generateUniqueId(this.tagId);
+ UIFacet facet = new UIFacet();
+ // Find facet for support component
+ String facetName = AjaxSupportTag.AJAX_SUPPORT_FACET+_event.getValue();
+ c = parent.getFacet(facetName);
+ if (null != c) {
+ parent.getFacets().remove(facetName);
+ facet.getChildren().add(c);
+ }
+ this._ajaxSupportHandler.apply(ctx, facet);
+ c = (UIComponent) facet.getChildren().get(0);
+ parent.getFacets().put(facetName, c);
+ // Fix for possible incompabilites in different frameworks.
+// c.setParentProperties(parent);
+ }
+
+}
Copied: root/ui-sandbox/trunk/components/core/src/main/java/org/ajax4jsf/taglib/html/facelets/FacetHandler.java (from rev 15053, root/ui/trunk/components/core/src/main/java/org/ajax4jsf/taglib/html/facelets/FacetHandler.java)
===================================================================
--- root/ui-sandbox/trunk/components/core/src/main/java/org/ajax4jsf/taglib/html/facelets/FacetHandler.java (rev 0)
+++ root/ui-sandbox/trunk/components/core/src/main/java/org/ajax4jsf/taglib/html/facelets/FacetHandler.java 2009-07-31 11:19:57 UTC (rev 15073)
@@ -0,0 +1,93 @@
+/**
+ * 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.taglib.html.facelets;
+
+import java.io.IOException;
+
+import javax.el.ELException;
+import javax.faces.FacesException;
+import javax.faces.component.UIComponent;
+import javax.faces.component.UIComponentBase;
+import javax.faces.view.facelets.FaceletContext;
+import javax.faces.view.facelets.FaceletException;
+import javax.faces.view.facelets.TagAttribute;
+import javax.faces.view.facelets.TagConfig;
+import javax.faces.view.facelets.TagException;
+import javax.faces.view.facelets.TagHandler;
+
+import org.ajax4jsf.Messages;
+
+/**
+ * Register a named facet on the UIComponent associated with the closest parent
+ * UIComponent custom action. <p/> See <a target="_new"
+ * href="http://java.sun.com/j2ee/javaserverfaces/1.1_01/docs/tlddocs/f/facet.html">tag
+ * documentation</a>.
+ *
+ * @author Jacob Hookom
+ * @version $Id: FacetHandler.java,v 1.1.2.1 2007/02/01 15:31:21 alexsmirnov Exp $
+ */
+public final class FacetHandler extends TagHandler {
+
+ /**
+ * A UIComponent for capturing a child UIComponent, representative of the
+ * desired Facet
+ *
+ * @author Jacob Hookom
+ *
+ */
+ private final static class UIFacet extends UIComponentBase {
+ public String getFamily() {
+ return null;
+ }
+ }
+
+ protected final TagAttribute name;
+
+ public FacetHandler(TagConfig config) {
+ super(config);
+ this.name = this.getRequiredAttribute("name");
+ }
+
+ /* (non-Javadoc)
+ * @see com.sun.facelets.FaceletHandler#apply(com.sun.facelets.FaceletContext, javax.faces.component.UIComponent)
+ */
+ public void apply(FaceletContext ctx, UIComponent parent)
+ throws IOException, FacesException, FaceletException, ELException {
+ UIFacet facet = new UIFacet();
+ UIComponent c;
+ // Check for existing facet
+ String facetName = this.name.getValue(ctx);
+ c = parent.getFacet(facetName);
+ if (null != c) {
+ parent.getFacets().remove(facetName);
+ facet.getChildren().add(c);
+ }
+ this.nextHandler.apply(ctx, facet);
+ int childCount = facet.getChildCount();
+ if (childCount == 1) {
+ c = (UIComponent) facet.getChildren().get(0);
+ parent.getFacets().put(facetName, c);
+ } else {
+ throw new TagException(this.tag, Messages.getMessage(Messages.FACET_TAG_MANY_CHILDREN_ERROR));
+ }
+ }
+}
Copied: root/ui-sandbox/trunk/components/core/src/main/java/org/ajax4jsf/taglib/html/facelets/IncludeFaceletContext.java (from rev 15053, root/ui/trunk/components/core/src/main/java/org/ajax4jsf/taglib/html/facelets/IncludeFaceletContext.java)
===================================================================
--- root/ui-sandbox/trunk/components/core/src/main/java/org/ajax4jsf/taglib/html/facelets/IncludeFaceletContext.java (rev 0)
+++ root/ui-sandbox/trunk/components/core/src/main/java/org/ajax4jsf/taglib/html/facelets/IncludeFaceletContext.java 2009-07-31 11:19:57 UTC (rev 15073)
@@ -0,0 +1,275 @@
+/**
+ * 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.taglib.html.facelets;
+
+import java.io.IOException;
+import java.net.URL;
+import java.util.HashMap;
+import java.util.Locale;
+import java.util.Map;
+
+import javax.el.ELException;
+import javax.el.ELResolver;
+import javax.el.ExpressionFactory;
+import javax.el.FunctionMapper;
+import javax.el.VariableMapper;
+import javax.faces.FacesException;
+import javax.faces.component.UIComponent;
+import javax.faces.context.FacesContext;
+import javax.faces.view.facelets.FaceletContext;
+import javax.faces.view.facelets.FaceletException;
+
+/**
+ * @author shura
+ *
+ */
+public class IncludeFaceletContext extends FaceletContext {
+
+ private FaceletContext defaultContext;
+
+ private Map ids;
+
+ /**
+ * @param defaultContext
+ */
+ public IncludeFaceletContext(FaceletContext defaultContext) {
+ this.defaultContext = defaultContext;
+ this.ids = new HashMap();
+ }
+
+ //TODO JSF 2.0 analog?
+// /**
+// * @param client
+// * @see com.sun.facelets.FaceletContext#extendClient(com.sun.facelets.TemplateClient)
+// */
+// public void extendClient(TemplateClient client) {
+// this.defaultContext.extendClient(client);
+// }
+
+ /**
+ * @param base
+ * @return
+ * @see com.sun.facelets.FaceletContext#generateUniqueId(java.lang.String)
+ */
+ public String generateUniqueId(String base) {
+ Integer cnt = (Integer) this.ids.get(base);
+ if (cnt == null) {
+ this.ids.put(base, new Integer(0));
+ return base;
+ } else {
+ int i = cnt.intValue() + 1;
+ this.ids.put(base, new Integer(i));
+ return base + "_" + i;
+ }
+ }
+
+ /**
+ * @param name
+ * @return
+ * @see com.sun.facelets.FaceletContext#getAttribute(java.lang.String)
+ */
+ public Object getAttribute(String name) {
+ return this.defaultContext.getAttribute(name);
+ }
+
+ /**
+ * @param key
+ * @return
+ * @see javax.el.ELContext#getContext(java.lang.Class)
+ */
+ public Object getContext(Class key) {
+ return this.defaultContext.getContext(key);
+ }
+
+ /**
+ * @return
+ * @see javax.el.ELContext#getELResolver()
+ */
+ public ELResolver getELResolver() {
+ return this.defaultContext.getELResolver();
+ }
+
+ /**
+ * @return
+ * @see com.sun.facelets.FaceletContext#getExpressionFactory()
+ */
+ public ExpressionFactory getExpressionFactory() {
+ return this.defaultContext.getExpressionFactory();
+ }
+
+ /**
+ * @return
+ * @see com.sun.facelets.FaceletContext#getFacesContext()
+ */
+ public FacesContext getFacesContext() {
+ return this.defaultContext.getFacesContext();
+ }
+
+ /**
+ * @return
+ * @see javax.el.ELContext#getFunctionMapper()
+ */
+ public FunctionMapper getFunctionMapper() {
+ return this.defaultContext.getFunctionMapper();
+ }
+
+ /**
+ * @return
+ * @see javax.el.ELContext#getLocale()
+ */
+ public Locale getLocale() {
+ return this.defaultContext.getLocale();
+ }
+
+ /**
+ * @return
+ * @see javax.el.ELContext#getVariableMapper()
+ */
+ public VariableMapper getVariableMapper() {
+ return this.defaultContext.getVariableMapper();
+ }
+
+ /**
+ * @return
+ * @see java.lang.Object#hashCode()
+ */
+ public int hashCode() {
+ return this.defaultContext.hashCode();
+ }
+
+ //TODO JSF 2.0 analog?
+// /**
+// * @param parent
+// * @param name
+// * @return
+// * @throws IOException
+// * @throws FaceletException
+// * @throws FacesException
+// * @throws ELException
+// * @see com.sun.facelets.FaceletContext#includeDefinition(javax.faces.component.UIComponent, java.lang.String)
+// */
+// public boolean includeDefinition(UIComponent parent, String name) throws IOException, FaceletException, FacesException, ELException {
+// return this.defaultContext.includeDefinition(parent, name);
+// }
+
+ /**
+ * @param parent
+ * @param relativePath
+ * @throws IOException
+ * @throws FaceletException
+ * @throws FacesException
+ * @throws ELException
+ * @see com.sun.facelets.FaceletContext#includeFacelet(javax.faces.component.UIComponent, java.lang.String)
+ */
+ public void includeFacelet(UIComponent parent, String relativePath) throws IOException, FaceletException, FacesException, ELException {
+ this.defaultContext.includeFacelet(parent, relativePath);
+ }
+
+ /**
+ * @param parent
+ * @param absolutePath
+ * @throws IOException
+ * @throws FaceletException
+ * @throws FacesException
+ * @throws ELException
+ * @see com.sun.facelets.FaceletContext#includeFacelet(javax.faces.component.UIComponent, java.net.URL)
+ */
+ public void includeFacelet(UIComponent parent, URL absolutePath) throws IOException, FaceletException, FacesException, ELException {
+ this.defaultContext.includeFacelet(parent, absolutePath);
+ }
+
+ /**
+ * @return
+ * @see javax.el.ELContext#isPropertyResolved()
+ */
+ public boolean isPropertyResolved() {
+ return this.defaultContext.isPropertyResolved();
+ }
+
+ //TODO JSF 2.0 analog?
+// /**
+// * @param client
+// * @see com.sun.facelets.FaceletContext#popClient(com.sun.facelets.TemplateClient)
+// */
+// public void popClient(TemplateClient client) {
+// this.defaultContext.popClient(client);
+// }
+//
+// /**
+// * @param client
+// * @see com.sun.facelets.FaceletContext#pushClient(com.sun.facelets.TemplateClient)
+// */
+// public void pushClient(TemplateClient client) {
+// this.defaultContext.pushClient(client);
+// }
+
+ /**
+ * @param key
+ * @param contextObject
+ * @see javax.el.ELContext#putContext(java.lang.Class, java.lang.Object)
+ */
+ public void putContext(Class key, Object contextObject) {
+ this.defaultContext.putContext(key, contextObject);
+ }
+
+ /**
+ * @param name
+ * @param value
+ * @see com.sun.facelets.FaceletContext#setAttribute(java.lang.String, java.lang.Object)
+ */
+ public void setAttribute(String name, Object value) {
+ this.defaultContext.setAttribute(name, value);
+ }
+
+ /**
+ * @param fnMapper
+ * @see com.sun.facelets.FaceletContext#setFunctionMapper(javax.el.FunctionMapper)
+ */
+ public void setFunctionMapper(FunctionMapper fnMapper) {
+ this.defaultContext.setFunctionMapper(fnMapper);
+ }
+
+ /**
+ * @param locale
+ * @see javax.el.ELContext#setLocale(java.util.Locale)
+ */
+ public void setLocale(Locale locale) {
+ this.defaultContext.setLocale(locale);
+ }
+
+ /**
+ * @param resolved
+ * @see javax.el.ELContext#setPropertyResolved(boolean)
+ */
+ public void setPropertyResolved(boolean resolved) {
+ this.defaultContext.setPropertyResolved(resolved);
+ }
+
+ /**
+ * @param varMapper
+ * @see com.sun.facelets.FaceletContext#setVariableMapper(javax.el.VariableMapper)
+ */
+ public void setVariableMapper(VariableMapper varMapper) {
+ this.defaultContext.setVariableMapper(varMapper);
+ }
+
+}
Copied: root/ui-sandbox/trunk/components/core/src/main/java/org/ajax4jsf/taglib/html/facelets/IncludeHandler.java (from rev 15053, root/ui/trunk/components/core/src/main/java/org/ajax4jsf/taglib/html/facelets/IncludeHandler.java)
===================================================================
--- root/ui-sandbox/trunk/components/core/src/main/java/org/ajax4jsf/taglib/html/facelets/IncludeHandler.java (rev 0)
+++ root/ui-sandbox/trunk/components/core/src/main/java/org/ajax4jsf/taglib/html/facelets/IncludeHandler.java 2009-07-31 11:19:57 UTC (rev 15073)
@@ -0,0 +1,89 @@
+/**
+ * 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.taglib.html.facelets;
+
+import java.io.IOException;
+
+import javax.el.ELException;
+import javax.el.VariableMapper;
+import javax.faces.FacesException;
+import javax.faces.component.UIComponent;
+import javax.faces.view.facelets.ComponentConfig;
+import javax.faces.view.facelets.ComponentHandler;
+import javax.faces.view.facelets.FaceletContext;
+import javax.faces.view.facelets.TagAttribute;
+
+import org.ajax4jsf.component.UIInclude;
+
+/**
+ * @author shura
+ *
+ */
+public class IncludeHandler extends ComponentHandler {
+
+ private TagAttribute viewId;
+
+ public IncludeHandler(ComponentConfig config) {
+ super(config);
+ this.viewId = getRequiredAttribute("viewId");
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see com.sun.facelets.tag.jsf.ComponentHandler#onComponentCreated(com.sun.facelets.FaceletContext,
+ * javax.faces.component.UIComponent,
+ * javax.faces.component.UIComponent)
+ */
+ public void onComponentCreated(FaceletContext ctx, UIComponent c,
+ UIComponent parent) {
+ // TODO Auto-generated method stub
+ super.onComponentCreated(ctx, c, parent);
+ }
+
+ public void applyNextHandler(FaceletContext ctx, UIComponent component)
+ throws IOException, FacesException, ELException {
+ String path;
+ if (component instanceof UIInclude) {
+ UIInclude include = (UIInclude) component;
+ path = include.getViewId();
+ if(include.isWasNavigation()){
+ component.getChildren().clear();
+ }
+ } else {
+ path = (String) component.getAttributes().get("viewId");
+ }
+ VariableMapper orig = ctx.getVariableMapper();
+ ctx.setVariableMapper(new VariableMapperWrapper(orig));
+ try {
+ this.nextHandler.apply(ctx, component);
+ ctx.includeFacelet(component, path);
+ } catch (Exception e) {
+ throw new FacesException("UIInclude component "
+ + component.getClientId(ctx.getFacesContext())
+ + " could't include page with path " + path, e);
+ } finally {
+ ctx.setVariableMapper(orig);
+ }
+ }
+
+}
Copied: root/ui-sandbox/trunk/components/core/src/main/java/org/ajax4jsf/taglib/html/facelets/KeepAliveHandler.java (from rev 15053, root/ui/trunk/components/core/src/main/java/org/ajax4jsf/taglib/html/facelets/KeepAliveHandler.java)
===================================================================
--- root/ui-sandbox/trunk/components/core/src/main/java/org/ajax4jsf/taglib/html/facelets/KeepAliveHandler.java (rev 0)
+++ root/ui-sandbox/trunk/components/core/src/main/java/org/ajax4jsf/taglib/html/facelets/KeepAliveHandler.java 2009-07-31 11:19:57 UTC (rev 15073)
@@ -0,0 +1,82 @@
+/**
+ * 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.taglib.html.facelets;
+
+import java.io.IOException;
+
+import javax.el.ELException;
+import javax.faces.FacesException;
+import javax.faces.component.UIComponent;
+import javax.faces.context.FacesContext;
+import javax.faces.el.ValueBinding;
+import javax.faces.view.facelets.FaceletContext;
+import javax.faces.view.facelets.FaceletException;
+import javax.faces.view.facelets.TagAttribute;
+import javax.faces.view.facelets.TagAttributeException;
+import javax.faces.view.facelets.TagConfig;
+import javax.faces.view.facelets.TagHandler;
+
+import org.ajax4jsf.Messages;
+import org.ajax4jsf.event.AjaxPhaseListener;
+
+/**
+ * @author shura
+ *
+ */
+public class KeepAliveHandler extends TagHandler {
+
+ private final TagAttribute beanName;
+
+ private final TagAttribute ajaxOnly;
+ /**
+ * @param config
+ */
+ public KeepAliveHandler(TagConfig config) {
+ super(config);
+ this.beanName = this.getRequiredAttribute("beanName");
+ if (beanName != null) {
+ if (!beanName.isLiteral()) {
+ throw new TagAttributeException(this.tag, this.beanName, Messages.getMessage(Messages.MUST_BE_LITERAL_ERROR));
+ }
+ }
+ this.ajaxOnly = getAttribute("ajaxOnly");
+ }
+
+ /* (non-Javadoc)
+ * @see com.sun.facelets.FaceletHandler#apply(com.sun.facelets.FaceletContext, javax.faces.component.UIComponent)
+ */
+ public void apply(FaceletContext ctx, UIComponent parent)
+ throws IOException, FacesException, FaceletException, ELException {
+ // Get bean instance from EL expression.
+ String name = beanName.getValue();
+ boolean isAjaxOnly = ajaxOnly!=null?ajaxOnly.getBoolean(ctx):false;
+ FacesContext facesContext = ctx.getFacesContext();
+ String beanExpression = "#{"+name+"}";
+ ValueBinding valueBinding = facesContext.getApplication().createValueBinding(beanExpression);
+ Object bean = valueBinding.getValue(facesContext);
+ String beanAttributeName = (isAjaxOnly ? AjaxPhaseListener.AJAX_BEAN_PREFIX : AjaxPhaseListener.VIEW_BEAN_PREFIX)
+ + name;
+ // Put bean instance to ViewRoot.
+ facesContext.getViewRoot().getAttributes().put(beanAttributeName, bean);
+ }
+
+}
Copied: root/ui-sandbox/trunk/components/core/src/main/java/org/ajax4jsf/taglib/html/facelets/MediaOutputHandler.java (from rev 15053, root/ui/trunk/components/core/src/main/java/org/ajax4jsf/taglib/html/facelets/MediaOutputHandler.java)
===================================================================
--- root/ui-sandbox/trunk/components/core/src/main/java/org/ajax4jsf/taglib/html/facelets/MediaOutputHandler.java (rev 0)
+++ root/ui-sandbox/trunk/components/core/src/main/java/org/ajax4jsf/taglib/html/facelets/MediaOutputHandler.java 2009-07-31 11:19:57 UTC (rev 15073)
@@ -0,0 +1,118 @@
+/**
+ * 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.taglib.html.facelets;
+
+import java.io.OutputStream;
+
+import javax.faces.view.facelets.ComponentConfig;
+import javax.faces.view.facelets.ComponentHandler;
+import javax.faces.view.facelets.FaceletContext;
+import javax.faces.view.facelets.MetaRule;
+import javax.faces.view.facelets.MetaRuleset;
+import javax.faces.view.facelets.Metadata;
+import javax.faces.view.facelets.MetadataTarget;
+import javax.faces.view.facelets.TagAttribute;
+
+import org.ajax4jsf.component.UIMediaOutput;
+
+/**
+ * @author shura (latest modification by $Author: alexsmirnov $)
+ * @version $Revision: 1.1.2.1 $ $Date: 2007/02/01 15:31:22 $
+ *
+ */
+public class MediaOutputHandler extends ComponentHandler {
+
+ private static final MetaRule mmediaMetaRule = new MMediaMetaRule();
+ /**
+ * @param config
+ */
+ public MediaOutputHandler(ComponentConfig config) {
+ super(config);
+
+ }
+
+ /* (non-Javadoc)
+ * @see org.ajax4jsf.tag.AjaxComponentHandler#createMetaRuleset(java.lang.Class)
+ */
+ protected MetaRuleset createMetaRuleset(Class type) {
+ MetaRuleset metaRules = super.createMetaRuleset(type);
+ metaRules.addRule(mmediaMetaRule);
+ return metaRules;
+ }
+
+ /**
+ * @author shura (latest modification by $Author: alexsmirnov $)
+ * @version $Revision: 1.1.2.1 $ $Date: 2007/02/01 15:31:22 $
+ *
+ */
+ static class MMediaMetaRule extends MetaRule{
+
+ /**
+ *
+ */
+ public MMediaMetaRule() {
+ super();
+ }
+
+ /* (non-Javadoc)
+ * @see com.sun.facelets.tag.MetaRule#applyRule(java.lang.String, com.sun.facelets.tag.TagAttribute, com.sun.facelets.tag.MetadataTarget)
+ */
+ public Metadata applyRule(String name, TagAttribute attribute, MetadataTarget meta) {
+ if (meta.isTargetInstanceOf(UIMediaOutput.class)) {
+
+
+ if ("createContent".equals(name)) {
+ return new MMediaActionMapper(attribute);
+ }
+ }
+ return null;
+ }
+
+ }
+ /**
+ * @author shura (latest modification by $Author: alexsmirnov $)
+ * @version $Revision: 1.1.2.1 $ $Date: 2007/02/01 15:31:22 $
+ *
+ */
+ static class MMediaActionMapper extends Metadata {
+
+ private static final Class<?>[] MMEDIA_ACTION_SIG = new Class[] {OutputStream.class,Object.class};
+
+ private final TagAttribute _send;
+ /**
+ * @param attribute
+ */
+ public MMediaActionMapper(TagAttribute attribute) {
+ _send = attribute;
+ }
+
+ /* (non-Javadoc)
+ * @see com.sun.facelets.tag.Metadata#applyMetadata(com.sun.facelets.FaceletContext, java.lang.Object)
+ */
+ public void applyMetadata(FaceletContext ctx, Object instance) {
+ ((UIMediaOutput) instance).setCreateContentExpression(this._send.getMethodExpression(ctx, null,
+ MMEDIA_ACTION_SIG));
+ }
+
+ }
+
+}
Copied: root/ui-sandbox/trunk/components/core/src/main/java/org/ajax4jsf/taglib/html/facelets/RowKeyConverterRule.java (from rev 15053, root/ui/trunk/components/core/src/main/java/org/ajax4jsf/taglib/html/facelets/RowKeyConverterRule.java)
===================================================================
--- root/ui-sandbox/trunk/components/core/src/main/java/org/ajax4jsf/taglib/html/facelets/RowKeyConverterRule.java (rev 0)
+++ root/ui-sandbox/trunk/components/core/src/main/java/org/ajax4jsf/taglib/html/facelets/RowKeyConverterRule.java 2009-07-31 11:19:57 UTC (rev 15073)
@@ -0,0 +1,31 @@
+/**
+ * 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.taglib.html.facelets;
+
+
+/**
+ * Apply rowKeyConverter to component
+ * @author Maksim Kaszynski
+ */
+@Deprecated
+public class RowKeyConverterRule extends org.ajax4jsf.webapp.taglib.RowKeyConverterRule {
+
+}
Copied: root/ui-sandbox/trunk/components/core/src/main/java/org/ajax4jsf/taglib/html/facelets/VariableMapperWrapper.java (from rev 15053, root/ui/trunk/components/core/src/main/java/org/ajax4jsf/taglib/html/facelets/VariableMapperWrapper.java)
===================================================================
--- root/ui-sandbox/trunk/components/core/src/main/java/org/ajax4jsf/taglib/html/facelets/VariableMapperWrapper.java (rev 0)
+++ root/ui-sandbox/trunk/components/core/src/main/java/org/ajax4jsf/taglib/html/facelets/VariableMapperWrapper.java 2009-07-31 11:19:57 UTC (rev 15073)
@@ -0,0 +1,65 @@
+/**
+ * Licensed under the Common Development and Distribution License,
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.sun.com/cddl/
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * permissions and limitations under the License.
+ */
+package org.ajax4jsf.taglib.html.facelets;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import javax.el.ELException;
+import javax.el.ValueExpression;
+import javax.el.VariableMapper;
+
+class VariableMapperWrapper extends VariableMapper {
+
+ private VariableMapper mapper;
+
+ private Map<String, ValueExpression> vars = null;
+
+ public VariableMapperWrapper(VariableMapper mapper) {
+ this.mapper = mapper;
+ }
+
+ /* (non-Javadoc)
+ * @see javax.el.VariableMapper#resolveVariable(java.lang.String)
+ */
+ @Override
+ public ValueExpression resolveVariable(String variable) {
+ ValueExpression ve = null;
+ try {
+ if (this.vars != null) {
+ ve = (ValueExpression) this.vars.get(variable);
+ }
+ if (ve == null) {
+ return this.mapper.resolveVariable(variable);
+ }
+ return ve;
+ } catch (StackOverflowError e) {
+ throw new ELException("Could not Resolve Variable [Overflow]: " + variable, e);
+ }
+ }
+
+ /* (non-Javadoc)
+ * @see javax.el.VariableMapper#setVariable(java.lang.String, javax.el.ValueExpression)
+ */
+ @Override
+ public ValueExpression setVariable(String variable,
+ ValueExpression expression) {
+
+ if (this.vars == null) {
+ this.vars = new HashMap<String, ValueExpression>();
+ }
+ return (ValueExpression) this.vars.put(variable, expression);
+ }
+
+}
Copied: root/ui-sandbox/trunk/components/core/src/main/java/org/ajax4jsf/taglib/html/facelets/package-info.java (from rev 15053, root/ui/trunk/components/core/src/main/java/org/ajax4jsf/taglib/html/facelets/package-info.java)
===================================================================
--- root/ui-sandbox/trunk/components/core/src/main/java/org/ajax4jsf/taglib/html/facelets/package-info.java (rev 0)
+++ root/ui-sandbox/trunk/components/core/src/main/java/org/ajax4jsf/taglib/html/facelets/package-info.java 2009-07-31 11:19:57 UTC (rev 15073)
@@ -0,0 +1,4 @@
+/**
+ * Classes defining the rendering model for HTML
+ */
+package org.ajax4jsf.taglib.html.facelets;
Copied: root/ui-sandbox/trunk/components/core/src/main/java/org/ajax4jsf/taglib/html/jsp/ActionParamTag.java (from rev 15053, root/ui/trunk/components/core/src/main/java/org/ajax4jsf/taglib/html/jsp/ActionParamTag.java)
===================================================================
--- root/ui-sandbox/trunk/components/core/src/main/java/org/ajax4jsf/taglib/html/jsp/ActionParamTag.java (rev 0)
+++ root/ui-sandbox/trunk/components/core/src/main/java/org/ajax4jsf/taglib/html/jsp/ActionParamTag.java 2009-07-31 11:19:57 UTC (rev 15073)
@@ -0,0 +1,163 @@
+/**
+ * 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.taglib.html.jsp;
+
+import javax.el.MethodExpression;
+import javax.el.ValueExpression;
+import javax.faces.component.ActionSource;
+import javax.faces.component.UIComponent;
+import javax.faces.context.FacesContext;
+import javax.faces.convert.Converter;
+import javax.faces.webapp.UIComponentClassicTagBase;
+
+import org.ajax4jsf.Messages;
+import org.ajax4jsf.component.UIActionParameter;
+import org.ajax4jsf.webapp.taglib.UIComponentTagBase;
+
+
+/**
+ * @author shura (latest modification by $Author: alexsmirnov $)
+ * @version $Revision: 1.1.2.1 $ $Date: 2007/02/01 15:31:31 $
+ *
+ */
+public class ActionParamTag extends UIComponentTagBase
+{
+
+ /* (non-Javadoc)
+ * @see javax.faces.webapp.UIComponentTag#getComponentType()
+ */
+ public String getComponentType()
+ {
+ return "org.ajax4jsf.components.ActionParameter";
+ }
+
+ /* (non-Javadoc)
+ * @see javax.faces.webapp.UIComponentTag#getRendererType()
+ */
+ public String getRendererType()
+ {
+ return null;
+ }
+ // UIComponent attributes --> already implemented in UIComponentTagBase
+
+ // UIParameter attributes
+ // value already implemented in UIComponentTagBase
+ private ValueExpression _name;
+ private ValueExpression _assignTo;
+ private ValueExpression _converter;
+ private ValueExpression _noEscape;
+ private MethodExpression _actionListener;
+
+ protected void setProperties(UIComponent component)
+ {
+ super.setProperties(component);
+ setStringProperty(component, "name", _name);
+ setBooleanProperty(component, "noEscape", _noEscape);
+ if (_actionListener != null) {
+ ((UIActionParameter) component).setActionListener(_actionListener);
+ }
+
+ //Find parent UIComponentTag
+ UIComponentClassicTagBase componentTag =
+ UIComponentClassicTagBase.getParentUIComponentClassicTagBase(pageContext);
+ if (componentTag == null)
+ {
+ throw new IllegalArgumentException(Messages.getMessage(Messages.NO_UI_COMPONENT_TAG_ANCESTOR_ERROR, "ActionParameterTag"));
+ }
+
+ if (componentTag.getCreated())
+ {
+ //Component was just created, so we add the Listener
+ UIComponent parentComponent = componentTag.getComponentInstance();
+ if (parentComponent instanceof ActionSource)
+ {
+
+ if (_assignTo != null) {
+ if (_assignTo.isLiteralText()) throw new IllegalArgumentException(Messages.getMessage(Messages.NO_VALUE_REFERENCE_ERROR_2, _assignTo));
+ UIActionParameter al = (UIActionParameter)component;
+ al.setAssignToBinding(_assignTo);
+ if (_converter != null)
+ {
+ if (!_converter.isLiteralText()) {
+ component.setValueExpression("converter", _converter);
+ } else {
+ Converter conv = FacesContext.getCurrentInstance().getApplication().createConverter(_converter.getExpressionString());
+ al.setConverter(conv);
+ }
+ }
+ ((ActionSource)parentComponent).addActionListener(al);
+ }
+ }
+ }
+
+ }
+
+ public void setName(ValueExpression name)
+ {
+ _name = name;
+ }
+
+ /**
+ * @param converter The converter to set.
+ */
+ public void setConverter(ValueExpression converter)
+ {
+ this._converter = converter;
+ }
+
+ /**
+ * @param noEscape The noEscape to set.
+ */
+ public void setNoEscape(ValueExpression noEscape)
+ {
+ this._noEscape = noEscape;
+ }
+
+ /**
+ * @param property The property to set.
+ */
+ public void setAssignTo(ValueExpression property)
+ {
+ this._assignTo = property;
+ }
+
+ /**
+ * @param property The property to set.
+ */
+ public void setActionListener(MethodExpression listener) {
+ this._actionListener = listener;
+ }
+
+ /* (non-Javadoc)
+ * @see org.apache.myfaces.taglib.UIComponentTagBase#release()
+ */
+ public void release()
+ {
+ _name = null;
+ _assignTo = null;
+ _converter = null;
+ _noEscape = null;
+ _actionListener = null;
+ super.release();
+ }
+
+}
Copied: root/ui-sandbox/trunk/components/core/src/main/java/org/ajax4jsf/taglib/html/jsp/AjaxFormTag.java (from rev 15053, root/ui/trunk/components/core/src/main/java/org/ajax4jsf/taglib/html/jsp/AjaxFormTag.java)
===================================================================
--- root/ui-sandbox/trunk/components/core/src/main/java/org/ajax4jsf/taglib/html/jsp/AjaxFormTag.java (rev 0)
+++ root/ui-sandbox/trunk/components/core/src/main/java/org/ajax4jsf/taglib/html/jsp/AjaxFormTag.java 2009-07-31 11:19:57 UTC (rev 15073)
@@ -0,0 +1,55 @@
+/**
+ * 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.taglib.html.jsp;
+
+import org.ajax4jsf.component.UIAjaxForm;
+import org.ajax4jsf.webapp.taglib.UIComponentTagBase;
+
+
+/**
+ * Tag for creating Ajax version of HTML Form.
+ * @author shura (latest modification by $Author: alexsmirnov $)
+ * @version $Revision: 1.1.2.1 $ $Date: 2007/02/01 15:31:32 $
+ *
+ */
+public class AjaxFormTag extends UIComponentTagBase
+{
+
+ /* (non-Javadoc)
+ * @see javax.faces.webapp.UIComponentTag#getComponentType()
+ */
+ public String getComponentType()
+ {
+ // TODO Auto-generated method stub
+ return UIAjaxForm.COMPONENT_TYPE;
+ }
+
+ /* (non-Javadoc)
+ * @see javax.faces.webapp.UIComponentTag#getRendererType()
+ */
+ public String getRendererType()
+ {
+ // TODO Auto-generated method stub
+ return "javax.faces.Form";
+ }
+
+}
Copied: root/ui-sandbox/trunk/components/core/src/main/java/org/ajax4jsf/taglib/html/jsp/AjaxListenerTag.java (from rev 15053, root/ui/trunk/components/core/src/main/java/org/ajax4jsf/taglib/html/jsp/AjaxListenerTag.java)
===================================================================
--- root/ui-sandbox/trunk/components/core/src/main/java/org/ajax4jsf/taglib/html/jsp/AjaxListenerTag.java (rev 0)
+++ root/ui-sandbox/trunk/components/core/src/main/java/org/ajax4jsf/taglib/html/jsp/AjaxListenerTag.java 2009-07-31 11:19:57 UTC (rev 15073)
@@ -0,0 +1,111 @@
+/**
+ * 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.taglib.html.jsp;
+
+import javax.el.ValueExpression;
+import javax.faces.component.UIComponent;
+import javax.faces.context.FacesContext;
+import javax.faces.webapp.UIComponentClassicTagBase;
+import javax.servlet.jsp.JspException;
+import javax.servlet.jsp.tagext.Tag;
+import javax.servlet.jsp.tagext.TagSupport;
+
+import org.ajax4jsf.Messages;
+import org.ajax4jsf.event.AjaxListener;
+import org.ajax4jsf.event.AjaxListenerHelper;
+import org.ajax4jsf.event.AjaxSource;
+
+
+/**
+ * @author shura
+ *
+ * Custom tag for append AJAX request listeners to AjaxContainer.
+ *
+ */
+public class AjaxListenerTag extends TagSupport {
+
+ /**
+ *
+ */
+ private static final long serialVersionUID = 2576519366310474212L;
+ /**
+ * class name for ajax events listener.
+ */
+ private ValueExpression type = null;
+
+ private ValueExpression binding = null;
+
+ /**
+ *
+ */
+ public AjaxListenerTag() {
+ }
+
+ public void setType(ValueExpression type) {
+ this.type = type;
+ }
+
+ /**
+ * @param binding the binding to set
+ */
+ public void setBinding(ValueExpression binding) {
+ this.binding = binding;
+ }
+
+ public int doStartTag() throws JspException {
+ if (type == null) {
+ throw new JspException(Messages.getMessage(Messages.NULL_TYPE_ATTRIBUTE_ERROR));
+ }
+
+ //Find parent UIComponentTag
+ UIComponentClassicTagBase componentTag =
+ UIComponentClassicTagBase.getParentUIComponentClassicTagBase(pageContext);
+ if (componentTag == null) {
+ throw new JspException(
+ Messages.getMessage(Messages.NO_UI_COMPONENT_TAG_ANCESTOR_ERROR, "AjaxListenerTag"));
+ }
+
+ if (componentTag.getCreated()) {
+ //Component was just created, so we add the Listener
+ UIComponent component = componentTag.getComponentInstance();
+ if (component instanceof AjaxSource) {
+ AjaxListener listener;
+ if(null != binding){
+ listener = new AjaxListenerHelper(binding);
+ } else {
+ try {
+ String className = (String) type.getValue(FacesContext.getCurrentInstance().getELContext());
+ listener = (AjaxListener) Class.forName(className).newInstance();
+ } catch (Exception e) {
+ throw new JspException(Messages.getMessage(Messages.INSTANTIATE_LISTENER_ERROR, type, component.getId()), e);
+ }
+ }
+ ((AjaxSource) component).addAjaxListener(listener);
+ } else {
+ throw new JspException(Messages.getMessage(Messages.NOT_PARENT_AJAX_COMPONENT_ERROR, component.getId()));
+ }
+ }
+
+ return Tag.SKIP_BODY;
+ }
+
+}
Copied: root/ui-sandbox/trunk/components/core/src/main/java/org/ajax4jsf/taglib/html/jsp/AjaxPageTag.java (from rev 15053, root/ui/trunk/components/core/src/main/java/org/ajax4jsf/taglib/html/jsp/AjaxPageTag.java)
===================================================================
--- root/ui-sandbox/trunk/components/core/src/main/java/org/ajax4jsf/taglib/html/jsp/AjaxPageTag.java (rev 0)
+++ root/ui-sandbox/trunk/components/core/src/main/java/org/ajax4jsf/taglib/html/jsp/AjaxPageTag.java 2009-07-31 11:19:57 UTC (rev 15073)
@@ -0,0 +1,88 @@
+/**
+ * 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.taglib.html.jsp;
+
+import javax.el.ValueExpression;
+import javax.faces.component.UIComponent;
+
+import org.ajax4jsf.renderkit.html.AjaxPageRenderer;
+
+
+/**
+ * @author shura
+ *
+ * Other variant of AJAX View - render full html page with root <html>,
+ * <head> ( filled from "head" facet ) and <body> areas.
+ *
+ */
+public class AjaxPageTag extends AjaxRegionTag {
+
+ private ValueExpression onload;
+ private ValueExpression onunload;
+
+ /* (non-Javadoc)
+ * @see javax.faces.webapp.UIComponentTag#getRendererType()
+ */
+ public String getRendererType() {
+ return AjaxPageRenderer.RENDERER_TYPE;
+ }
+ /* (non-Javadoc)
+ * @see javax.servlet.jsp.tagext.Tag#release()
+ */
+ public void release() {
+ this.onload = null;
+ this.onunload = null;
+ super.release();
+ }
+ /* (non-Javadoc)
+ * @see javax.faces.webapp.UIComponentTag#setProperties(javax.faces.component.UIComponent)
+ */
+ protected void setProperties(UIComponent component) {
+ super.setProperties(component);
+ setStringProperty(component, "onload", this.onload);
+ setStringProperty(component, "onunload", this.onunload);
+ }
+ /**
+ * @return Returns the onload.
+ */
+ public ValueExpression getOnload() {
+ return onload;
+ }
+ /**
+ * @return Returns the onunload.
+ */
+ public ValueExpression getOnunload() {
+ return onunload;
+ }
+ /**
+ * @param onload The onload to set.
+ */
+ public void setOnload(ValueExpression onload) {
+ this.onload = onload;
+ }
+ /**
+ * @param onunload The onunload to set.
+ */
+ public void setOnunload(ValueExpression onunload) {
+ this.onunload = onunload;
+ }
+}
Copied: root/ui-sandbox/trunk/components/core/src/main/java/org/ajax4jsf/taglib/html/jsp/AjaxRegionTag.java (from rev 15053, root/ui/trunk/components/core/src/main/java/org/ajax4jsf/taglib/html/jsp/AjaxRegionTag.java)
===================================================================
--- root/ui-sandbox/trunk/components/core/src/main/java/org/ajax4jsf/taglib/html/jsp/AjaxRegionTag.java (rev 0)
+++ root/ui-sandbox/trunk/components/core/src/main/java/org/ajax4jsf/taglib/html/jsp/AjaxRegionTag.java 2009-07-31 11:19:57 UTC (rev 15073)
@@ -0,0 +1,158 @@
+/**
+ * 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.taglib.html.jsp;
+
+import javax.el.MethodExpression;
+import javax.el.ValueExpression;
+import javax.faces.component.UIComponent;
+
+import org.ajax4jsf.Messages;
+import org.ajax4jsf.component.AjaxContainer;
+import org.ajax4jsf.component.UIAjaxRegion;
+import org.ajax4jsf.renderkit.html.AjaxRegionRenderer;
+import org.ajax4jsf.webapp.taglib.UIComponentTagBase;
+
+
+/**
+ * @author shura
+ * Tag for create root Ajax component. must be immediate in produced html/body.
+ * Example use in jsp:
+ *
+ * For produce correct html code in any ( ajax and non-ajax requests ),
+ * better result with <ajax:page> tag.
+ */
+public class AjaxRegionTag extends UIComponentTagBase {
+
+ private MethodExpression ajaxListener = null;
+
+ private ValueExpression reRender = null;
+
+ private ValueExpression immediate = null;
+
+ private ValueExpression selfRendered = null;
+
+ private ValueExpression javascriptLocation = null;
+
+ /**
+ *
+ */
+ public AjaxRegionTag() {
+ super();
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see javax.faces.webapp.UIComponentTag#getComponentType()
+ */
+ public String getComponentType() {
+ return UIAjaxRegion.COMPONENT_TYPE;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see javax.faces.webapp.UIComponentTag#getRendererType()
+ */
+ public String getRendererType() {
+ return AjaxRegionRenderer.RENDERER_TYPE;
+ }
+
+ // set component properties
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see javax.servlet.jsp.tagext.Tag#release()
+ */
+ public void release() {
+ // release reources properties
+ super.release();
+ this.reRender = null;
+ this.ajaxListener = null;
+ this.immediate = null;
+ this.selfRendered = null;
+ this.javascriptLocation = null;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see javax.faces.webapp.UIComponentTag#setProperties(javax.faces.component.UIComponent)
+ */
+ protected void setProperties(UIComponent component) {
+ super.setProperties(component);
+ setBooleanProperty(component, "immediate", this.immediate);
+ setStringProperty(component, "ajaxAreas", this.reRender);
+ setBooleanProperty(component,"selfRendered",this.selfRendered);
+ setStringProperty(component, "javascriptLocation", this.javascriptLocation);
+ if (ajaxListener != null) {
+ if (!(component instanceof AjaxContainer)) {
+ throw new IllegalArgumentException(Messages.getMessage(Messages.NOT_AJAX_CONTAINER_ERROR, component.getClientId(getFacesContext())));
+ }
+ if (ajaxListener.isLiteralText()) {
+ getFacesContext().getExternalContext().log(Messages.getMessage(Messages.INVALID_EXPRESSION, ajaxListener));
+ }
+ ((AjaxContainer) component).setAjaxListener(ajaxListener);
+
+ }
+ }
+
+ /**
+ * @param ajaxAreas
+ * The ajaxAreas to set.
+ */
+ public void setReRender(ValueExpression ajaxAreas) {
+ this.reRender = ajaxAreas;
+ }
+
+ /**
+ * @param ajaxListener
+ * The ajaxListener to set.
+ */
+ public void setAjaxListener(MethodExpression ajaxListener) {
+ this.ajaxListener = ajaxListener;
+ }
+
+ /**
+ * @param immediate
+ * The immediate to set.
+ */
+ public void setImmediate(ValueExpression immediate) {
+ this.immediate = immediate;
+ }
+
+ /**
+ * @param selfRendered The selfRendered to set.
+ */
+ public void setSelfRendered(ValueExpression selfRendered) {
+ this.selfRendered = selfRendered;
+ }
+
+// public String getJavascriptLocation() {
+// return javascriptLocation;
+// }
+//
+ public void setJavascriptLocation(ValueExpression javascriptLocation) {
+ this.javascriptLocation = javascriptLocation;
+ }
+}
Copied: root/ui-sandbox/trunk/components/core/src/main/java/org/ajax4jsf/taglib/html/jsp/AjaxStatusTag.java (from rev 15053, root/ui/trunk/components/core/src/main/java/org/ajax4jsf/taglib/html/jsp/AjaxStatusTag.java)
===================================================================
--- root/ui-sandbox/trunk/components/core/src/main/java/org/ajax4jsf/taglib/html/jsp/AjaxStatusTag.java (rev 0)
+++ root/ui-sandbox/trunk/components/core/src/main/java/org/ajax4jsf/taglib/html/jsp/AjaxStatusTag.java 2009-07-31 11:19:57 UTC (rev 15073)
@@ -0,0 +1,190 @@
+/**
+ * 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.taglib.html.jsp;
+
+import javax.el.ValueExpression;
+import javax.faces.component.UIComponent;
+
+import org.ajax4jsf.component.UIAjaxStatus;
+import org.ajax4jsf.renderkit.html.AjaxStatusRenderer;
+import org.ajax4jsf.webapp.taglib.HtmlComponentTagBase;
+
+
+/**
+ *
+ * Jsp Tag for create request state component.
+ * @author shura (latest modification by $Author: alexsmirnov $)
+ * @version $Revision: 1.1.2.1 $ $Date: 2007/02/01 15:31:30 $
+ *
+ */
+public class AjaxStatusTag extends HtmlComponentTagBase
+{
+
+ private ValueExpression _for = null;
+ /**
+ * Text to output on start request
+ */
+ private ValueExpression _startText = null;
+ /**
+ * Text to display on complete request
+ */
+ private ValueExpression _stopText = null;
+
+ /**
+ * Style for display on start request
+ */
+ private ValueExpression _startStyle = null;
+ /**
+ * Style for displaying on complete
+ */
+ private ValueExpression _stopStyle = null;
+ /**
+ * Style class for display on request
+ */
+ private ValueExpression _startStyleClass = null;
+ /**
+ * Style class for display on complete request
+ */
+ private ValueExpression _stopStyleClass = null;
+
+ /**
+ * Force id to render in Html as is
+ */
+ private ValueExpression _forceId = null;
+ /* (non-Javadoc)
+ * @see javax.faces.webapp.UIComponentTag#getComponentType()
+ */
+ public String getComponentType()
+ {
+ // TODO Auto-generated method stub
+ return UIAjaxStatus.COMPONENT_TYPE;
+ }
+
+ /* (non-Javadoc)
+ * @see javax.faces.webapp.UIComponentTag#getRendererType()
+ */
+ public String getRendererType()
+ {
+ // TODO Auto-generated method stub
+ return AjaxStatusRenderer.RENDERER_TYPE;
+ }
+
+ /* (non-Javadoc)
+ * @see org.ajax4jsf.components.taglib.html.HtmlComponentTagBase#release()
+ */
+ public void release()
+ {
+ super.release();
+ this._for = null;
+ this._startStyle = null;
+ this._startStyleClass = null;
+ this._startText = null;
+ this._stopStyle = null;
+ this._stopStyleClass = null;
+ this._stopText = null;
+ this._forceId = null;
+
+ }
+
+ /* (non-Javadoc)
+ * @see org.ajax4jsf.components.taglib.html.HtmlComponentTagBase#setProperties(javax.faces.component.UIComponent)
+ */
+ protected void setProperties(UIComponent component)
+ {
+ super.setProperties(component);
+ setStringProperty(component, "for", _for);
+ setStringProperty(component, "startText", _startText);
+ setStringProperty(component, "stopText", _stopText);
+ setStringProperty(component, "startStyle", _startStyle);
+ setStringProperty(component, "stopStyle", _stopStyle);
+ setStringProperty(component, "startStyleClass", _startStyleClass);
+ setStringProperty(component, "stopStyleClass", _stopStyleClass);
+ setBooleanProperty(component, "forceId", _forceId);
+
+ }
+
+
+ /**
+ * @param _for The _for to set.
+ */
+ public void setFor(ValueExpression _for)
+ {
+ this._for = _for;
+ }
+
+ /**
+ * @param style The _startStyle to set.
+ */
+ public void setStartStyle(ValueExpression style)
+ {
+ _startStyle = style;
+ }
+
+ /**
+ * @param styleClass The _startStyleClass to set.
+ */
+ public void setStartStyleClass(ValueExpression styleClass)
+ {
+ _startStyleClass = styleClass;
+ }
+
+ /**
+ * @param text The _startText to set.
+ */
+ public void setStartText(ValueExpression text)
+ {
+ _startText = text;
+ }
+
+ /**
+ * @param stopText The stopText to set.
+ */
+ public void setStopText(ValueExpression stopText)
+ {
+ this._stopText = stopText;
+ }
+
+ /**
+ * @param style The _stopStyle to set.
+ */
+ public void setStopStyle(ValueExpression style)
+ {
+ _stopStyle = style;
+ }
+
+ /**
+ * @param styleClass The _stopStyleClass to set.
+ */
+ public void setStopStyleClass(ValueExpression styleClass)
+ {
+ _stopStyleClass = styleClass;
+ }
+
+ /**
+ * @param forceId The forceId to set.
+ */
+ public void setForceId(ValueExpression forceId)
+ {
+ this._forceId = forceId;
+ }
+
+}
Copied: root/ui-sandbox/trunk/components/core/src/main/java/org/ajax4jsf/taglib/html/jsp/AjaxSupportTag.java (from rev 15053, root/ui/trunk/components/core/src/main/java/org/ajax4jsf/taglib/html/jsp/AjaxSupportTag.java)
===================================================================
--- root/ui-sandbox/trunk/components/core/src/main/java/org/ajax4jsf/taglib/html/jsp/AjaxSupportTag.java (rev 0)
+++ root/ui-sandbox/trunk/components/core/src/main/java/org/ajax4jsf/taglib/html/jsp/AjaxSupportTag.java 2009-07-31 11:19:57 UTC (rev 15073)
@@ -0,0 +1,288 @@
+/**
+ * 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.taglib.html.jsp;
+
+import javax.el.MethodExpression;
+import javax.el.ValueExpression;
+import javax.faces.component.UIComponent;
+import javax.faces.webapp.UIComponentClassicTagBase;
+
+import org.ajax4jsf.Messages;
+import org.ajax4jsf.component.UIAjaxSupport;
+import org.ajax4jsf.renderkit.AjaxRendererUtils;
+import org.ajax4jsf.renderkit.RendererUtils.HTML;
+import org.ajax4jsf.webapp.taglib.UIComponentTagBase;
+
+
+/**
+ *
+ * @author shura (latest modification by $Author: alexsmirnov $)
+ * @version $Revision: 1.1.2.1 $ $Date: 2007/02/01 15:31:32 $
+ *
+ */
+public class AjaxSupportTag extends UIComponentTagBase {
+
+ static final String[] EVENT_HANDLER_ATTRIBUTES =
+ {
+ HTML.ondblclick_ATTRIBUTE,
+ HTML.onmousedown_ATTRIBUTE,
+ HTML.onmouseup_ATTRIBUTE,
+ HTML.onmouseover_ATTRIBUTE,
+ HTML.onmousemove_ATTRIBUTE,
+ HTML.onmouseout_ATTRIBUTE,
+ HTML.onkeypress_ATTRIBUTE,
+ HTML.onkeydown_ATTRIBUTE,
+ HTML.onkeyup_ATTRIBUTE,
+ HTML.onclick_ATTRIBUTE,
+ HTML.onchange_ATTRIBUTE,
+ HTML.onblur_ATTRIBUTE,
+ HTML.onfocus_ATTRIBUTE,
+ HTML.onselect_ATTRIBUTE
+ };
+
+ public static final String AJAX_SUPPORT_FACET = "org.ajax4jsf.ajax.SUPPORT";
+ /**
+ * Id ( in form of findComponent method param ) of JSF component,
+ * updated by this component ( parnt tag ) action.
+ */
+ private ValueExpression reRender = null;
+
+ /**
+ * Generate script for given event ( onclick, onenter ... )
+ */
+ private String event = null;
+
+
+ /**
+ * Id of request status component.
+ */
+ private ValueExpression status = null;
+
+ /**
+ * JavaScript function for call after request completed.
+ */
+ private ValueExpression oncomplete = null ;
+
+ private MethodExpression action = null;
+ private MethodExpression actionListener = null;
+ private ValueExpression limitToList = null;
+ private ValueExpression disableDefault = null;
+ private ValueExpression value = null;
+ private ValueExpression immediate = null;
+ private ValueExpression ajaxSingle = null;
+
+
+
+
+ /**
+ * @param type The type to set.
+ */
+ public void setDisableDefault(ValueExpression ajaxType)
+ {
+ this.disableDefault = ajaxType;
+ }
+
+ /**
+ * @param reRender
+ * The targetId to set.
+ */
+ public void setReRender(ValueExpression ajaxId) {
+ this.reRender = ajaxId;
+ }
+
+
+ /**
+ * @param event The event to set.
+ */
+ public void setEvent(String event)
+ {
+ this.event = event;
+ }
+
+ /**
+ * @param oncomplete The oncomplete to set.
+ */
+ public void setOncomplete(ValueExpression oncomplete)
+ {
+ this.oncomplete = oncomplete;
+ }
+
+ /**
+ * @param status The status to set.
+ */
+ public void setStatus(ValueExpression status)
+ {
+ this.status = status;
+ }
+
+ /**
+ * @param limitToList The submitForm to set.
+ */
+ public void setLimitToList(ValueExpression limitToList)
+ {
+ this.limitToList = limitToList;
+ }
+
+ /**
+ * @param action The action to set.
+ */
+ public void setAction(MethodExpression action)
+ {
+ this.action = action;
+ }
+
+ /**
+ * @param actionListener The actionListener to set.
+ */
+ public void setActionListener(MethodExpression actionListener)
+ {
+ this.actionListener = actionListener;
+ }
+
+ protected void setParentProperties(UIAjaxSupport uiComponent) {
+
+ //Find parent UIComponentTag
+ UIComponentClassicTagBase componentTag = null;
+ try {
+ componentTag = UIComponentClassicTagBase.getParentUIComponentClassicTagBase(pageContext);
+ if (componentTag == null) {
+ throw new IllegalArgumentException(
+ Messages.getMessage(Messages.NO_UI_COMPONENT_TAG_ANCESTOR_ERROR, "AjaxSupportTag"));
+ }
+
+ if (componentTag.getCreated()) {
+ //Component was just created, so we add the Listener
+ UIComponent component = componentTag.getComponentInstance();
+ uiComponent.setParentProperties(component);
+ }
+ } catch (ClassCastException e) {
+ // JSF 1.2 - tags have other parent.
+ }
+
+ }
+
+ /* (non-Javadoc)
+ * @see javax.servlet.jsp.tagext.Tag#release()
+ */
+ public void release() {
+ this.reRender = null;
+ this.oncomplete = null;
+ this.event = null;
+ this.status =null;
+ this.action = null;
+ this.actionListener = null;
+ this.limitToList = null;
+ this.disableDefault = null;
+ this.value = null;
+ this.immediate=null;
+ this.ajaxSingle = null;
+ super.release();
+ }
+
+ /* (non-Javadoc)
+ * @see javax.faces.webapp.UIComponentTag#getComponentType()
+ */
+ public String getComponentType()
+ {
+
+ return UIAjaxSupport.COMPONENT_TYPE;
+ }
+
+ /* (non-Javadoc)
+ * @see javax.faces.webapp.UIComponentTag#getRendererType()
+ */
+ public String getRendererType()
+ {
+
+ return UIAjaxSupport.DEFAULT_RENDERER_TYPE;
+ }
+
+ /**
+ * @param value The value to set.
+ */
+ public void setValue(ValueExpression value) {
+ this.value = value;
+ }
+
+ /**
+ * @param immediate The immediate to set.
+ */
+ public void setImmediate(ValueExpression immediate) {
+ this.immediate = immediate;
+ }
+
+ /**
+ * @param ajaxSingle The ajaxSingle to set.
+ */
+ public void setAjaxSingle(ValueExpression ajaxSingle) {
+ this.ajaxSingle = ajaxSingle;
+ }
+
+ /* (non-Javadoc)
+ * @see org.ajax4jsf.components.taglib.UIComponentTagBase#setProperties(javax.faces.component.UIComponent)
+ */
+ protected void setProperties(UIComponent component)
+ {
+ super.setProperties(component);
+ setStringProperty(component, "event", event);
+ setReRenderProperty(component);
+ setStringProperty(component, "status", status);
+ setStringProperty(component, "oncomplete", oncomplete);
+ setBooleanProperty(component, "disableDefault", disableDefault );
+ setBooleanProperty(component, "limitToList", limitToList);
+ setActionProperty(component, action);
+ setActionListenerProperty(component, actionListener);
+ setValueProperty(component,value);
+ setBooleanProperty(component,"immediate",immediate);
+ setBooleanProperty(component,"ajaxSingle",ajaxSingle);
+
+ setParentProperties((UIAjaxSupport) component);
+ }
+
+
+ private void setReRenderProperty(UIComponent component) {
+ if (reRender != null) {
+ if (reRender.isLiteralText()) {
+ setStringProperty(component, "reRender", reRender);
+ } else {
+ //FIXME: Why do we evaluate reRender right now?
+ //Collection can change any time.
+ ((UIAjaxSupport) component).setReRender( AjaxRendererUtils.asSet(reRender.getValue(getELContext())));
+ }
+ }
+
+ }
+
+ /* (non-Javadoc)
+ * @see javax.faces.webapp.UIComponentTag#getFacetName()
+ */
+ protected String getFacetName() {
+ // TODO Auto-generated method stub
+ if (null != event) {
+ return AJAX_SUPPORT_FACET + event;
+ } else {
+ return AJAX_SUPPORT_FACET;
+ }
+ }
+
+
+}
Copied: root/ui-sandbox/trunk/components/core/src/main/java/org/ajax4jsf/taglib/html/jsp/IncludeTag.java (from rev 15053, root/ui/trunk/components/core/src/main/java/org/ajax4jsf/taglib/html/jsp/IncludeTag.java)
===================================================================
--- root/ui-sandbox/trunk/components/core/src/main/java/org/ajax4jsf/taglib/html/jsp/IncludeTag.java (rev 0)
+++ root/ui-sandbox/trunk/components/core/src/main/java/org/ajax4jsf/taglib/html/jsp/IncludeTag.java 2009-07-31 11:19:57 UTC (rev 15073)
@@ -0,0 +1,261 @@
+/**
+ * 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.taglib.html.jsp;
+
+import java.io.IOException;
+
+import javax.el.ELException;
+import javax.el.ValueExpression;
+import javax.faces.FacesException;
+import javax.faces.component.UIComponent;
+import javax.faces.context.FacesContext;
+import javax.servlet.RequestDispatcher;
+import javax.servlet.ServletRequest;
+import javax.servlet.ServletResponse;
+import javax.servlet.jsp.JspException;
+import javax.servlet.jsp.JspWriter;
+
+import org.ajax4jsf.component.UIInclude;
+import org.ajax4jsf.webapp.taglib.UIComponentTagBase;
+
+/**
+ * @author shura
+ *
+ */
+public class IncludeTag extends UIComponentTagBase {
+
+ /**
+ * @author shura
+ *
+ */
+ private static final class NullJspWriter extends JspWriter {
+
+
+ /**
+ * @param arg0
+ * @param arg1
+ */
+ private NullJspWriter() {
+ super(1024, false);
+ }
+
+ public void clear() throws IOException {
+ }
+
+ public void clearBuffer() throws IOException {
+ }
+
+ public void close() throws IOException {
+ }
+
+ public void flush() throws IOException {
+ }
+
+ public int getRemaining() {
+ return 0;
+ }
+
+ public void newLine() throws IOException {
+ }
+
+ public void print(boolean arg0) throws IOException {
+ }
+
+ public void print(char arg0) throws IOException {
+ }
+
+ public void print(int arg0) throws IOException {
+ }
+
+ public void print(long arg0) throws IOException {
+ }
+
+ public void print(float arg0) throws IOException {
+ }
+
+ public void print(double arg0) throws IOException {
+ }
+
+ public void print(char[] arg0) throws IOException {
+ }
+
+ public void print(String arg0) throws IOException {
+ }
+
+ public void print(Object arg0) throws IOException {
+ }
+
+ public void println() throws IOException {
+ }
+
+ public void println(boolean arg0) throws IOException {
+ }
+
+ public void println(char arg0) throws IOException {
+ }
+
+ public void println(int arg0) throws IOException {
+ }
+
+ public void println(long arg0) throws IOException {
+ }
+
+ public void println(float arg0) throws IOException {
+ }
+
+ public void println(double arg0) throws IOException {
+ }
+
+ public void println(char[] arg0) throws IOException {
+ }
+
+ public void println(String arg0) throws IOException {
+ }
+
+ public void println(Object arg0) throws IOException {
+ }
+
+ public void write(char[] cbuf, int off, int len) throws IOException {
+ }
+ }
+
+ private ValueExpression viewId;
+
+ /**
+ * @param viewId
+ * the viewId to set
+ */
+ public void setViewId(ValueExpression viewId) {
+ this.viewId = viewId;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.ajax4jsf.webapp.taglib.UIComponentTagBase#release()
+ */
+ public void release() {
+ super.release();
+ viewId = null;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.ajax4jsf.webapp.taglib.UIComponentTagBase#setProperties(javax.faces.component.UIComponent)
+ */
+ protected void setProperties(UIComponent component) {
+ super.setProperties(component);
+ UIInclude include = (UIInclude) component;
+ if (this.viewId != null) {
+ if (this.viewId.isLiteralText()) {
+ try {
+
+ String value = (String) getFacesContext().getApplication()
+ .getExpressionFactory().coerceToType(
+ this.viewId.getExpressionString(),
+ String.class);
+
+ include.setViewId(value);
+ } catch (ELException e) {
+ throw new FacesException(e);
+ }
+ } else {
+ component.setValueExpression("viewId", this.viewId);
+ }
+ }
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see javax.faces.webapp.UIComponentTag#doEndTag()
+ */
+ public int doEndTag() throws JspException {
+ int i = super.doEndTag();
+ return i;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see javax.faces.webapp.UIComponentTag#doStartTag()
+ */
+ public int doStartTag() throws JspException {
+ int i = super.doStartTag();
+ String resourcePath;
+ UIComponent component = getComponentInstance();
+ UIInclude includeComponent = null;
+ if (component instanceof UIInclude) {
+ includeComponent = (UIInclude) component;
+ resourcePath = includeComponent.getViewId();
+ if(includeComponent.isWasNavigation()){
+ component.getChildren().clear();
+ }
+ } else {
+ resourcePath = (String) component.getAttributes().get("viewId");
+ }
+ JspWriter out;
+ if (component.isRendered()) {
+ out = this.pageContext.getOut();
+ } else {
+ // All content of response will be skip.
+ out = new NullJspWriter();
+ }
+ ServletRequest request = this.pageContext.getRequest();
+ ServletResponse response = this.pageContext.getResponse();
+ RequestDispatcher rd = request.getRequestDispatcher(resourcePath);
+ FacesContext facesContext = getFacesContext();
+ if(null == rd){
+ throw new JspException("UIInclude component "+component.getClientId(facesContext)+ " could't include page with path "+resourcePath);
+ }
+ try {
+ ServletResponseWrapperInclude responseWrapper = new ServletResponseWrapperInclude(
+ response, out);
+ rd.include(request, responseWrapper);
+ // Write buffered data, if any;
+ responseWrapper.flushBuffer();
+ } catch (Exception e) {
+ throw new JspException(e);
+ }
+ return i;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see javax.faces.webapp.UIComponentTag#getComponentType()
+ */
+ public String getComponentType() {
+ return UIInclude.COMPONENT_TYPE;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see javax.faces.webapp.UIComponentTag#getRendererType()
+ */
+ public String getRendererType() {
+ return null;
+ }
+
+}
Copied: root/ui-sandbox/trunk/components/core/src/main/java/org/ajax4jsf/taglib/html/jsp/KeepAliveTag.java (from rev 15053, root/ui/trunk/components/core/src/main/java/org/ajax4jsf/taglib/html/jsp/KeepAliveTag.java)
===================================================================
--- root/ui-sandbox/trunk/components/core/src/main/java/org/ajax4jsf/taglib/html/jsp/KeepAliveTag.java (rev 0)
+++ root/ui-sandbox/trunk/components/core/src/main/java/org/ajax4jsf/taglib/html/jsp/KeepAliveTag.java 2009-07-31 11:19:57 UTC (rev 15073)
@@ -0,0 +1,131 @@
+/**
+ * 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.taglib.html.jsp;
+
+import javax.el.ELContext;
+import javax.el.ExpressionFactory;
+import javax.el.ValueExpression;
+import javax.faces.application.Application;
+import javax.faces.context.FacesContext;
+import javax.servlet.jsp.JspException;
+import javax.servlet.jsp.tagext.Tag;
+import javax.servlet.jsp.tagext.TagSupport;
+
+import org.ajax4jsf.Messages;
+import org.ajax4jsf.event.AjaxPhaseListener;
+
+/**
+ * @author shura
+ *
+ */
+public class KeepAliveTag extends TagSupport {
+
+ /**
+ *
+ */
+ private static final long serialVersionUID = 4322021112358067548L;
+
+ private String beanName = null;
+
+ private ValueExpression ajaxOnly = null;
+
+ /**
+ * @return the ajaxOnly
+ */
+ public ValueExpression getAjaxOnly() {
+ return ajaxOnly;
+ }
+
+ /**
+ * @param ajaxOnly the ajaxOnly to set
+ */
+ public void setAjaxOnly(ValueExpression ajaxOnly) {
+ this.ajaxOnly = ajaxOnly;
+ }
+
+ /**
+ * @return the name
+ */
+ public String getBeanName() {
+ return beanName;
+ }
+
+ /**
+ * @param name the name to set
+ */
+ public void setBeanName(String name) {
+ this.beanName = name;
+ }
+
+ /* (non-Javadoc)
+ * @see javax.servlet.jsp.tagext.TagSupport#doStartTag()
+ */
+ public int doStartTag() throws JspException {
+ if (beanName == null) {
+ throw new JspException(Messages.getMessage(Messages.NULL_TYPE_ATTRIBUTE_ERROR));
+ }
+
+ FacesContext facesContext = FacesContext.getCurrentInstance();
+ Application application = facesContext.getApplication();
+ ExpressionFactory factory = application.getExpressionFactory();
+ ELContext elContext = facesContext.getELContext();
+ ValueExpression beanNameEL =
+ factory.createValueExpression(elContext, beanName, String.class);
+ if(!beanNameEL.isLiteralText()){
+ throw new JspException(Messages.getMessage(Messages.NAME_MUST_BE_LITERAL));
+ }
+ boolean isAjaxOnly = false;
+ if (null != ajaxOnly) {
+ if (ajaxOnly.isLiteralText())
+ {
+ //TODO: More sophisticated way to convert boolean value (yes/no, 1/0, on/off, etc.)
+ isAjaxOnly = Boolean.parseBoolean(ajaxOnly.getExpressionString());
+ }
+ else
+ {
+ isAjaxOnly = Boolean.TRUE.equals(ajaxOnly.getValue(elContext));
+ }
+
+ }
+ // Get bean instance from EL expression.
+ String beanExpression = "#{"+beanName+"}";
+ ValueExpression valueExpression =
+ factory.createValueExpression(elContext, beanExpression, Object.class);
+ Object bean = valueExpression.getValue(elContext);
+ // Put bean instance to ViewRoot.
+ String beanAttributeName = (isAjaxOnly ? AjaxPhaseListener.AJAX_BEAN_PREFIX : AjaxPhaseListener.VIEW_BEAN_PREFIX)
+ + beanName;
+ facesContext.getViewRoot().getAttributes().put(beanAttributeName, bean);
+ return Tag.SKIP_BODY;
+ }
+
+ /* (non-Javadoc)
+ * @see javax.servlet.jsp.tagext.TagSupport#release()
+ */
+ public void release() {
+ beanName = null;
+ ajaxOnly = null;
+ super.release();
+ }
+
+
+}
Copied: root/ui-sandbox/trunk/components/core/src/main/java/org/ajax4jsf/taglib/html/jsp/ServletResponseWrapperInclude.java (from rev 15053, root/ui/trunk/components/core/src/main/java/org/ajax4jsf/taglib/html/jsp/ServletResponseWrapperInclude.java)
===================================================================
--- root/ui-sandbox/trunk/components/core/src/main/java/org/ajax4jsf/taglib/html/jsp/ServletResponseWrapperInclude.java (rev 0)
+++ root/ui-sandbox/trunk/components/core/src/main/java/org/ajax4jsf/taglib/html/jsp/ServletResponseWrapperInclude.java 2009-07-31 11:19:57 UTC (rev 15073)
@@ -0,0 +1,168 @@
+/*
+ * Copyright 1999,2004 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.ajax4jsf.taglib.html.jsp;
+
+import java.io.IOException;
+import java.io.PrintWriter;
+import java.util.Locale;
+
+import javax.servlet.ServletOutputStream;
+import javax.servlet.ServletResponse;
+import javax.servlet.http.HttpServletResponse;
+import javax.servlet.http.HttpServletResponseWrapper;
+import javax.servlet.jsp.JspWriter;
+
+import org.ajax4jsf.io.FastBufferOutputStream;
+
+
+
+/**
+ * ServletResponseWrapper used by the JSP 'include' action.
+ *
+ * This wrapper response object is passed to RequestDispatcher.include(), so
+ * that the output of the included resource is appended to that of the including
+ * page.
+ *
+ * @author Pierre Delisle
+ */
+
+public class ServletResponseWrapperInclude extends HttpServletResponseWrapper {
+
+ /**
+ * PrintWriter which appends to the JspWriter of the including page.
+ */
+ private PrintWriter _printWriter;
+
+ private FastBufferOutputStream _bytes ;
+
+ private ServletOutputStream _servletStream;
+
+ private JspWriter _jspWriter;
+
+ private boolean useWriter = false;
+
+ private boolean useStream = false;
+
+ public ServletResponseWrapperInclude(ServletResponse response,
+ JspWriter jspWriter) {
+ super((HttpServletResponse) response);
+ this._printWriter = new PrintWriter(jspWriter);
+ this._jspWriter = jspWriter;
+ }
+
+ /**
+ * Returns a wrapper around the JspWriter of the including page.
+ */
+ public PrintWriter getWriter() throws IOException {
+ if (useStream) {
+ throw new IllegalStateException();
+ }
+ useWriter = true;
+ return _printWriter;
+ }
+
+ public ServletOutputStream getOutputStream() throws IOException {
+ if(useWriter){
+ throw new IllegalStateException();
+ }
+ if (!useStream) {
+ _bytes = new FastBufferOutputStream(getBufferSize());
+ _servletStream = new ServletOutputStream(){
+
+ /* (non-Javadoc)
+ * @see java.io.OutputStream#flush()
+ */
+ public void flush() throws IOException {
+ // TODO Auto-generated method stub
+ super.flush();
+ }
+
+ /* (non-Javadoc)
+ * @see java.io.OutputStream#write(byte[], int, int)
+ */
+ public void write(byte[] b, int off, int len) throws IOException {
+ // TODO Auto-generated method stub
+ _bytes.write(b, off, len);
+ }
+
+ /* (non-Javadoc)
+ * @see java.io.OutputStream#write(byte[])
+ */
+ public void write(byte[] b) throws IOException {
+ // TODO Auto-generated method stub
+ _bytes.write(b);
+ }
+
+ /* (non-Javadoc)
+ * @see java.io.OutputStream#write(int)
+ */
+ public void write(int b) throws IOException {
+ _bytes.write(b);
+ }
+
+ };
+ useStream = true;
+ }
+ return _servletStream;
+ }
+
+ /**
+ * Clears the output buffer of the JspWriter associated with the including
+ * page.
+ */
+ public void resetBuffer() {
+ try {
+ _jspWriter.clearBuffer();
+ useWriter = false;
+ useStream = false;
+ _bytes = null;
+ } catch (IOException ioe) {
+ }
+ }
+
+ public void reset() {
+ // TODO Auto-generated method stub
+ resetBuffer();
+ }
+
+ public void flushBuffer() throws IOException {
+ if (useStream) {
+ // TODO - detect encoding ?
+ _bytes.writeTo(_jspWriter, getCharacterEncoding());
+ _bytes = new FastBufferOutputStream(getBufferSize());
+ }
+ }
+
+ // Override ignored methods.
+ public void setBufferSize(int arg0) {
+ }
+
+ public void setContentLength(int arg0) {
+ }
+ public void setContentType(String arg0) {
+ }
+ public void setStatus(int arg0) {
+ }
+ public void setLocale(Locale arg0) {
+ }
+ public void sendRedirect(String arg0) throws IOException {
+ throw new IllegalStateException();
+ }
+// public void setStatus(int arg0, String arg1) {
+// }
+
+}
Copied: root/ui-sandbox/trunk/components/core/src/main/java/org/ajax4jsf/taglib/html/jsp/package-info.java (from rev 15053, root/ui/trunk/components/core/src/main/java/org/ajax4jsf/taglib/html/jsp/package-info.java)
===================================================================
--- root/ui-sandbox/trunk/components/core/src/main/java/org/ajax4jsf/taglib/html/jsp/package-info.java (rev 0)
+++ root/ui-sandbox/trunk/components/core/src/main/java/org/ajax4jsf/taglib/html/jsp/package-info.java 2009-07-31 11:19:57 UTC (rev 15073)
@@ -0,0 +1,4 @@
+/**
+ * Tag library contains JSP tags that are useful in creating dynamic reusable components
+ */
+package org.ajax4jsf.taglib.html.jsp;
Copied: root/ui-sandbox/trunk/components/core/src/main/java/org/richfaces/renderkit/html/gradientimages/ButtonGradientImage.java (from rev 15053, root/ui/trunk/components/core/src/main/java/org/richfaces/renderkit/html/gradientimages/ButtonGradientImage.java)
===================================================================
--- root/ui-sandbox/trunk/components/core/src/main/java/org/richfaces/renderkit/html/gradientimages/ButtonGradientImage.java (rev 0)
+++ root/ui-sandbox/trunk/components/core/src/main/java/org/richfaces/renderkit/html/gradientimages/ButtonGradientImage.java 2009-07-31 11:19:57 UTC (rev 15073)
@@ -0,0 +1,33 @@
+/**
+ * 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.renderkit.html.gradientimages;
+
+import org.richfaces.renderkit.html.images.BaseControlBackgroundImage;
+import org.richfaces.skin.Skin;
+
+public class ButtonGradientImage extends BaseControlBackgroundImage {
+
+ public ButtonGradientImage() {
+ super(Skin.additionalBackgroundColor, "trimColor", 8);
+ }
+
+}
Copied: root/ui-sandbox/trunk/components/core/src/main/java/org/richfaces/renderkit/html/gradientimages/ButtonInverseGradientImage.java (from rev 15053, root/ui/trunk/components/core/src/main/java/org/richfaces/renderkit/html/gradientimages/ButtonInverseGradientImage.java)
===================================================================
--- root/ui-sandbox/trunk/components/core/src/main/java/org/richfaces/renderkit/html/gradientimages/ButtonInverseGradientImage.java (rev 0)
+++ root/ui-sandbox/trunk/components/core/src/main/java/org/richfaces/renderkit/html/gradientimages/ButtonInverseGradientImage.java 2009-07-31 11:19:57 UTC (rev 15073)
@@ -0,0 +1,33 @@
+/**
+ * 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.renderkit.html.gradientimages;
+
+import org.richfaces.renderkit.html.images.BaseControlBackgroundImage;
+import org.richfaces.skin.Skin;
+
+public class ButtonInverseGradientImage extends BaseControlBackgroundImage {
+
+ public ButtonInverseGradientImage() {
+ super("trimColor", Skin.additionalBackgroundColor, 8);
+ }
+
+}
Copied: root/ui-sandbox/trunk/components/core/src/main/java/org/richfaces/renderkit/html/gradientimages/HeaderGradientImage.java (from rev 15053, root/ui/trunk/components/core/src/main/java/org/richfaces/renderkit/html/gradientimages/HeaderGradientImage.java)
===================================================================
--- root/ui-sandbox/trunk/components/core/src/main/java/org/richfaces/renderkit/html/gradientimages/HeaderGradientImage.java (rev 0)
+++ root/ui-sandbox/trunk/components/core/src/main/java/org/richfaces/renderkit/html/gradientimages/HeaderGradientImage.java 2009-07-31 11:19:57 UTC (rev 15073)
@@ -0,0 +1,33 @@
+/**
+ * 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.renderkit.html.gradientimages;
+
+import org.richfaces.renderkit.html.images.BaseControlBackgroundImage;
+import org.richfaces.skin.Skin;
+
+public class HeaderGradientImage extends BaseControlBackgroundImage {
+
+ public HeaderGradientImage() {
+ super(Skin.headerGradientColor, Skin.headerBackgroundColor, 8);
+ }
+
+}
Copied: root/ui-sandbox/trunk/components/core/src/main/java/org/richfaces/renderkit/html/gradientimages/HeaderInverseGradientImage.java (from rev 15053, root/ui/trunk/components/core/src/main/java/org/richfaces/renderkit/html/gradientimages/HeaderInverseGradientImage.java)
===================================================================
--- root/ui-sandbox/trunk/components/core/src/main/java/org/richfaces/renderkit/html/gradientimages/HeaderInverseGradientImage.java (rev 0)
+++ root/ui-sandbox/trunk/components/core/src/main/java/org/richfaces/renderkit/html/gradientimages/HeaderInverseGradientImage.java 2009-07-31 11:19:57 UTC (rev 15073)
@@ -0,0 +1,33 @@
+/**
+ * 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.renderkit.html.gradientimages;
+
+import org.richfaces.renderkit.html.images.BaseControlBackgroundImage;
+import org.richfaces.skin.Skin;
+
+public class HeaderInverseGradientImage extends BaseControlBackgroundImage {
+
+ public HeaderInverseGradientImage() {
+ super(Skin.headerBackgroundColor, Skin.headerGradientColor, 8);
+ }
+
+}
Copied: root/ui-sandbox/trunk/components/core/src/main/java/org/richfaces/renderkit/html/gradientimages/InputGradientImage.java (from rev 15053, root/ui/trunk/components/core/src/main/java/org/richfaces/renderkit/html/gradientimages/InputGradientImage.java)
===================================================================
--- root/ui-sandbox/trunk/components/core/src/main/java/org/richfaces/renderkit/html/gradientimages/InputGradientImage.java (rev 0)
+++ root/ui-sandbox/trunk/components/core/src/main/java/org/richfaces/renderkit/html/gradientimages/InputGradientImage.java 2009-07-31 11:19:57 UTC (rev 15073)
@@ -0,0 +1,33 @@
+/**
+ * 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.renderkit.html.gradientimages;
+
+import org.richfaces.renderkit.html.images.BaseControlBackgroundImage;
+import org.richfaces.skin.Skin;
+
+public class InputGradientImage extends BaseControlBackgroundImage {
+
+ public InputGradientImage() {
+ super(Skin.additionalBackgroundColor, Skin.controlBackgroundColor, 8);
+ }
+
+}
Copied: root/ui-sandbox/trunk/components/core/src/main/java/org/richfaces/renderkit/html/gradientimages/MenuGradientImage.java (from rev 15053, root/ui/trunk/components/core/src/main/java/org/richfaces/renderkit/html/gradientimages/MenuGradientImage.java)
===================================================================
--- root/ui-sandbox/trunk/components/core/src/main/java/org/richfaces/renderkit/html/gradientimages/MenuGradientImage.java (rev 0)
+++ root/ui-sandbox/trunk/components/core/src/main/java/org/richfaces/renderkit/html/gradientimages/MenuGradientImage.java 2009-07-31 11:19:57 UTC (rev 15073)
@@ -0,0 +1,33 @@
+/**
+ * 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.renderkit.html.gradientimages;
+
+import org.richfaces.renderkit.html.images.BaseControlBackgroundImage;
+import org.richfaces.skin.Skin;
+
+public class MenuGradientImage extends BaseControlBackgroundImage {
+
+ public MenuGradientImage() {
+ super("tabBackgroundColor", Skin.additionalBackgroundColor, 8);
+ }
+
+}
Copied: root/ui-sandbox/trunk/components/core/src/main/java/org/richfaces/renderkit/html/gradientimages/MenuInverseGradientImage.java (from rev 15053, root/ui/trunk/components/core/src/main/java/org/richfaces/renderkit/html/gradientimages/MenuInverseGradientImage.java)
===================================================================
--- root/ui-sandbox/trunk/components/core/src/main/java/org/richfaces/renderkit/html/gradientimages/MenuInverseGradientImage.java (rev 0)
+++ root/ui-sandbox/trunk/components/core/src/main/java/org/richfaces/renderkit/html/gradientimages/MenuInverseGradientImage.java 2009-07-31 11:19:57 UTC (rev 15073)
@@ -0,0 +1,33 @@
+/**
+ * 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.renderkit.html.gradientimages;
+
+import org.richfaces.renderkit.html.images.BaseControlBackgroundImage;
+import org.richfaces.skin.Skin;
+
+public class MenuInverseGradientImage extends BaseControlBackgroundImage {
+
+ public MenuInverseGradientImage() {
+ super(Skin.additionalBackgroundColor, "tabBackgroundColor", 8);
+ }
+
+}
Copied: root/ui-sandbox/trunk/components/core/src/main/java/org/richfaces/renderkit/html/gradientimages/TabGradientImage.java (from rev 15053, root/ui/trunk/components/core/src/main/java/org/richfaces/renderkit/html/gradientimages/TabGradientImage.java)
===================================================================
--- root/ui-sandbox/trunk/components/core/src/main/java/org/richfaces/renderkit/html/gradientimages/TabGradientImage.java (rev 0)
+++ root/ui-sandbox/trunk/components/core/src/main/java/org/richfaces/renderkit/html/gradientimages/TabGradientImage.java 2009-07-31 11:19:57 UTC (rev 15073)
@@ -0,0 +1,33 @@
+/**
+ * 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.renderkit.html.gradientimages;
+
+import org.richfaces.renderkit.html.images.BaseControlBackgroundImage;
+import org.richfaces.skin.Skin;
+
+public class TabGradientImage extends BaseControlBackgroundImage {
+
+ public TabGradientImage() {
+ super("tabBackgroundColor", Skin.generalBackgroundColor, 8);
+ }
+
+}
Copied: root/ui-sandbox/trunk/components/core/src/main/java/org/richfaces/renderkit/html/gradientimages/TabInverseGradientImage.java (from rev 15053, root/ui/trunk/components/core/src/main/java/org/richfaces/renderkit/html/gradientimages/TabInverseGradientImage.java)
===================================================================
--- root/ui-sandbox/trunk/components/core/src/main/java/org/richfaces/renderkit/html/gradientimages/TabInverseGradientImage.java (rev 0)
+++ root/ui-sandbox/trunk/components/core/src/main/java/org/richfaces/renderkit/html/gradientimages/TabInverseGradientImage.java 2009-07-31 11:19:57 UTC (rev 15073)
@@ -0,0 +1,33 @@
+/**
+ * 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.renderkit.html.gradientimages;
+
+import org.richfaces.renderkit.html.images.BaseControlBackgroundImage;
+import org.richfaces.skin.Skin;
+
+public class TabInverseGradientImage extends BaseControlBackgroundImage {
+
+ public TabInverseGradientImage() {
+ super(Skin.generalBackgroundColor, "tabBackgroundColor", 8);
+ }
+
+}
15 years, 5 months
JBoss Rich Faces SVN: r15072 - in branches/community/3.3.X: ui/menu-components/src/main/templates/org/richfaces and 1 other directory.
by richfaces-svn-commits@lists.jboss.org
Author: amarkhel
Date: 2009-07-31 06:48:10 -0400 (Fri, 31 Jul 2009)
New Revision: 15072
Modified:
branches/community/3.3.X/framework/impl/src/main/resources/org/richfaces/component/messages_de.properties
branches/community/3.3.X/ui/menu-components/src/main/templates/org/richfaces/htmlMenuItem.jspx
Log:
Fix RF-7540
Modified: branches/community/3.3.X/framework/impl/src/main/resources/org/richfaces/component/messages_de.properties
===================================================================
--- branches/community/3.3.X/framework/impl/src/main/resources/org/richfaces/component/messages_de.properties 2009-07-31 10:39:18 UTC (rev 15071)
+++ branches/community/3.3.X/framework/impl/src/main/resources/org/richfaces/component/messages_de.properties 2009-07-31 10:48:10 UTC (rev 15072)
@@ -1,7 +1,7 @@
# components
org.richfaces.component.UIExtendedDataTable.Menu.Columns=Spalten
-org.richfaces.component.UIExtendedDataTable.Menu.SortAscending=Absteigend sortieren
-org.richfaces.component.UIExtendedDataTable.Menu.SortDescending=Aufsteigend sortieren
+org.richfaces.component.UIExtendedDataTable.Menu.SortAscending=Aufsteigend sortieren
+org.richfaces.component.UIExtendedDataTable.Menu.SortDescending=Absteigend sortieren
org.richfaces.component.UIExtendedDataTable.Menu.GroupByColumn=Gruppierung anhand der Spalte
org.richfaces.component.UIExtendedDataTable.Menu.DisableGrouping=Gruppierung aufheben
org.richfaces.component.UIExtendedDataTable.NoData=Keine Daten
Modified: branches/community/3.3.X/ui/menu-components/src/main/templates/org/richfaces/htmlMenuItem.jspx
===================================================================
--- branches/community/3.3.X/ui/menu-components/src/main/templates/org/richfaces/htmlMenuItem.jspx 2009-07-31 10:39:18 UTC (rev 15071)
+++ branches/community/3.3.X/ui/menu-components/src/main/templates/org/richfaces/htmlMenuItem.jspx 2009-07-31 10:48:10 UTC (rev 15072)
@@ -59,12 +59,11 @@
<div id="#{clientId}"
class="#{menuItemClass}"
- onmouseup="Event.stop(event); #{component.attributes['onmouseup']}"
- onmousedown="Event.stop(event); #{component.attributes['onmousedown']}"
+
onclick="#{onclick}"
style="#{menuItemStyle}">
<f:call name="utils.encodeAttributes">
- <f:parameter value="onmousemove" />
+ <f:parameter value="onmousemove,onmousedown,onmouseup" />
</f:call>
<jsp:scriptlet><![CDATA[
15 years, 5 months
JBoss Rich Faces SVN: r15070 - in root/framework/trunk/impl/src/main: java/org/ajax4jsf/webapp and 4 other directories.
by richfaces-svn-commits@lists.jboss.org
Author: nbelaevski
Date: 2009-07-30 18:39:12 -0400 (Thu, 30 Jul 2009)
New Revision: 15070
Added:
root/framework/trunk/impl/src/main/java/org/richfaces/context/AttributesContext.java
root/framework/trunk/impl/src/main/java/org/richfaces/context/PartialViewContextFactoryImpl.java
root/framework/trunk/impl/src/main/java/org/richfaces/context/PartialViewContextImpl.java
root/framework/trunk/impl/src/main/java/org/richfaces/context/SingletonsContext.java
root/framework/trunk/impl/src/main/resources/META-INF/components.faces-config.xml
Removed:
root/framework/trunk/impl/src/main/java/org/richfaces/context/AbstractContext.java
root/framework/trunk/impl/src/main/java/org/richfaces/context/ApplicationContext.java
root/framework/trunk/impl/src/main/java/org/richfaces/context/RequestContext.java
Modified:
root/framework/trunk/impl/src/main/java/org/ajax4jsf/renderkit/AjaxRendererUtils.java
root/framework/trunk/impl/src/main/java/org/ajax4jsf/renderkit/RendererBase.java
root/framework/trunk/impl/src/main/java/org/ajax4jsf/renderkit/RendererUtils.java
root/framework/trunk/impl/src/main/java/org/ajax4jsf/webapp/PollEventsManager.java
root/framework/trunk/impl/src/main/java/org/richfaces/resource/AbstractBaseResource.java
root/framework/trunk/impl/src/main/java/org/richfaces/resource/ResourceHandlerImpl.java
root/framework/trunk/impl/src/main/resources/META-INF/faces-config.xml
root/framework/trunk/impl/src/main/resources/META-INF/resources/richfaces.js/4_0_0.js
Log:
Further work on framework
Modified: root/framework/trunk/impl/src/main/java/org/ajax4jsf/renderkit/AjaxRendererUtils.java
===================================================================
--- root/framework/trunk/impl/src/main/java/org/ajax4jsf/renderkit/AjaxRendererUtils.java 2009-07-30 16:13:54 UTC (rev 15069)
+++ root/framework/trunk/impl/src/main/java/org/ajax4jsf/renderkit/AjaxRendererUtils.java 2009-07-30 22:39:12 UTC (rev 15070)
@@ -196,47 +196,88 @@
public static StringBuffer buildOnEvent(UIComponent uiComponent,
FacesContext facesContext, String eventName, boolean omitDefaultActionUrl) {
StringBuffer onEvent = new StringBuffer();
- if (null != eventName) {
- String commandOnEvent = (String) uiComponent.getAttributes().get(
- eventName);
- if (commandOnEvent != null) {
- onEvent.append(commandOnEvent);
- onEvent.append(';');
- }
- }
- JSFunction ajaxFunction = buildAjaxFunction(uiComponent, facesContext);
- // Create formal parameter for non-input elements ???
- // Link Control pseudo-object
- // Options map. Possible options for function call :
- // control - name of form control for submit.
- // name - name for link control \
- // value - value of control. - possible replace by parameters ?
- // single true/false - submit all form or only one control.
- // affected - array of element's ID for update on responce.
- // oncomplete - function for call after complete request.
- // status - id of request status component.
- // parameters - map of parameters name/value for append on request.
- // ..........
- ajaxFunction.addParameter(buildEventOptions(facesContext, uiComponent, omitDefaultActionUrl));
+// if (null != eventName) {
+// String commandOnEvent = (String) uiComponent.getAttributes().get(
+// eventName);
+// if (commandOnEvent != null) {
+// onEvent.append(commandOnEvent);
+// onEvent.append(';');
+// }
+// }
+// JSFunction ajaxFunction = buildAjaxFunction(uiComponent, facesContext);
+// // Create formal parameter for non-input elements ???
+// // Link Control pseudo-object
+// // Options map. Possible options for function call :
+// // control - name of form control for submit.
+// // name - name for link control \
+// // value - value of control. - possible replace by parameters ?
+// // single true/false - submit all form or only one control.
+// // affected - array of element's ID for update on responce.
+// // oncomplete - function for call after complete request.
+// // status - id of request status component.
+// // parameters - map of parameters name/value for append on request.
+// // ..........
+// ajaxFunction.addParameter(buildEventOptions(facesContext, uiComponent, omitDefaultActionUrl));
+//
+// // appendAjaxSubmitParameters(facesContext, uiComponent, onEvent);
+// ajaxFunction.appendScript(onEvent);
+// if (uiComponent instanceof AjaxSupport) {
+// AjaxSupport support = (AjaxSupport) uiComponent;
+// if (support.isDisableDefault()) {
+// onEvent.append("; return false;");
+// }
+// }
+// log.debug(Messages.getMessage(Messages.BUILD_ONCLICK_INFO, uiComponent
+// .getId(), onEvent.toString()));
+ return onEvent;
- // appendAjaxSubmitParameters(facesContext, uiComponent, onEvent);
- ajaxFunction.appendScript(onEvent);
- if (uiComponent instanceof AjaxSupport) {
- AjaxSupport support = (AjaxSupport) uiComponent;
- if (support.isDisableDefault()) {
- onEvent.append("; return false;");
+ }
+
+ private static void appendParameters(FacesContext context, UIComponent component, Map<String, Object> parameters) {
+ if (component.getChildCount() > 0) {
+ for (UIComponent child : component.getChildren()) {
+ if (child instanceof UIParameter) {
+ UIParameter parameter = (UIParameter) child;
+
+ String name = parameter.getName();
+ Object value = parameter.getValue();
+
+ if (null == name) {
+ throw new IllegalArgumentException(Messages.getMessage(
+ Messages.UNNAMED_PARAMETER_ERROR, component
+ .getClientId(context)));
+ }
+
+ boolean escape = true;
+ if (child instanceof JavaScriptParameter) {
+ JavaScriptParameter actionParam = (JavaScriptParameter) child;
+ escape = !actionParam.isNoEscape();
+ }
+ if (escape) {
+ if(value == null) {
+ value = "";
+ }
+ parameters.put(name, value);
+ } else {
+ parameters.put(name, new JSReference(value.toString()));
+ // if(it.hasNext()){onEvent.append(',');};
+ // renderAjaxLinkParameter( name,
+ // value, onClick, jsForm, nestingForm);
+ }
+ }
}
}
- log.debug(Messages.getMessage(Messages.BUILD_ONCLICK_INFO, uiComponent
- .getId(), onEvent.toString()));
- return onEvent;
-
}
-
+
public static Map<String, Object> buildEventOptions(FacesContext facesContext,
UIComponent component) {
- return buildEventOptions(facesContext, component, null);
+ Map<String,Object> options = new HashMap<String, Object>();
+ appendParameters(facesContext, component, options);
+
+ String clientId = component.getClientId(facesContext);
+ options.put(clientId, clientId);
+ return options;
}
public static Map<String, Object> buildEventOptions(FacesContext facesContext,
@@ -245,12 +286,6 @@
return buildEventOptions(facesContext, uiComponent, params, false);
}
- public static Map<String, Object> buildEventOptions(FacesContext facesContext,
- UIComponent component, boolean omitDefaultActionUrl) {
-
- return buildEventOptions(facesContext, component, null, omitDefaultActionUrl);
- }
-
/**
* @param facesContext
* @param uiComponent
@@ -317,34 +352,7 @@
// Add application-wide Ajax parameters
parameters.putAll(ajaxContext.getCommonAjaxParameters());
// add child parameters
- for (Iterator<UIComponent> it = uiComponent.getChildren().iterator(); it.hasNext();) {
- UIComponent child = it.next();
- if (child instanceof UIParameter) {
- String name = ((UIParameter) child).getName();
- Object value = ((UIParameter) child).getValue();
- if (null == name) {
- throw new IllegalArgumentException(Messages.getMessage(
- Messages.UNNAMED_PARAMETER_ERROR, uiComponent
- .getClientId(facesContext)));
- }
- boolean escape = true;
- if (child instanceof JavaScriptParameter) {
- JavaScriptParameter actionParam = (JavaScriptParameter) child;
- escape = !actionParam.isNoEscape();
- }
- if (escape) {
- if(value == null) {
- value = "";
- }
- parameters.put(name, value);
- } else {
- parameters.put(name, new JSReference(value.toString()));
- // if(it.hasNext()){onEvent.append(',');};
- // renderAjaxLinkParameter( name,
- // value, onClick, jsForm, nestingForm);
- }
- }
- }
+ appendParameters(facesContext, uiComponent, parameters);
if (params != null) {
parameters.putAll(params);
@@ -468,13 +476,8 @@
public static JSFunction buildAjaxFunction(UIComponent uiComponent,
FacesContext facesContext, String functionName) {
JSFunction ajaxFunction = new JSFunction(functionName);
- // build form name or ActionUrl for script
- UIComponent nestingForm = getNestingForm(uiComponent);
- if (null == nestingForm) {
- ajaxFunction.addParameter(JSReference.NULL);
- } else {
- ajaxFunction.addParameter(nestingForm.getClientId(facesContext));
- }
+ ajaxFunction.addParameter(uiComponent.getClientId(facesContext));
+ ajaxFunction.addParameter("event");
return ajaxFunction;
}
Modified: root/framework/trunk/impl/src/main/java/org/ajax4jsf/renderkit/RendererBase.java
===================================================================
--- root/framework/trunk/impl/src/main/java/org/ajax4jsf/renderkit/RendererBase.java 2009-07-30 16:13:54 UTC (rev 15069)
+++ root/framework/trunk/impl/src/main/java/org/ajax4jsf/renderkit/RendererBase.java 2009-07-30 22:39:12 UTC (rev 15070)
@@ -29,6 +29,7 @@
import javax.faces.render.Renderer;
import org.ajax4jsf.Messages;
+import org.ajax4jsf.resource.InternetResource;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.richfaces.skin.Skin;
@@ -247,4 +248,8 @@
child.encodeEnd(facesContext);
}
+ //TODO method stub - replace with JSF 2.0 annotations
+ public InternetResource getResource(String name) {
+ return null;
+ }
}
Modified: root/framework/trunk/impl/src/main/java/org/ajax4jsf/renderkit/RendererUtils.java
===================================================================
--- root/framework/trunk/impl/src/main/java/org/ajax4jsf/renderkit/RendererUtils.java 2009-07-30 16:13:54 UTC (rev 15069)
+++ root/framework/trunk/impl/src/main/java/org/ajax4jsf/renderkit/RendererUtils.java 2009-07-30 22:39:12 UTC (rev 15070)
@@ -961,6 +961,18 @@
writer.endElement(HTML.SCRIPT_ELEM);
}
+ /**
+ * @param context
+ * @param component
+ * @param shortIds
+ * @since 4.0
+ * @return
+ */
+ public Collection<String> findComponentsFor(FacesContext context, UIComponent component, Collection<String> shortIds) {
+ //TODO - implement
+ return shortIds;
+ }
+
public UIComponent findComponentFor(FacesContext context,
UIComponent component, String id) {
Modified: root/framework/trunk/impl/src/main/java/org/ajax4jsf/webapp/PollEventsManager.java
===================================================================
--- root/framework/trunk/impl/src/main/java/org/ajax4jsf/webapp/PollEventsManager.java 2009-07-30 16:13:54 UTC (rev 15069)
+++ root/framework/trunk/impl/src/main/java/org/ajax4jsf/webapp/PollEventsManager.java 2009-07-30 22:39:12 UTC (rev 15070)
@@ -30,6 +30,7 @@
* @author asmirnov
*
*/
+//TODO: deprecate
public class PollEventsManager implements Serializable {
/**
@@ -39,6 +40,7 @@
public static final String EVENTS_MANAGER_KEY = PollEventsManager.class.getName();
+ //TODO should use cache - push is application-scoped, not session-scoped
private ConcurrentMap<String, PushEventsCounter> counters = new ConcurrentHashMap<String, PushEventsCounter>();
public void init(ServletContext servletContext) {
Deleted: root/framework/trunk/impl/src/main/java/org/richfaces/context/AbstractContext.java
===================================================================
--- root/framework/trunk/impl/src/main/java/org/richfaces/context/AbstractContext.java 2009-07-30 16:13:54 UTC (rev 15069)
+++ root/framework/trunk/impl/src/main/java/org/richfaces/context/AbstractContext.java 2009-07-30 22:39:12 UTC (rev 15070)
@@ -1,34 +0,0 @@
-package org.richfaces.context;
-
-import java.util.HashMap;
-import java.util.Map;
-
-public abstract class AbstractContext {
-
- private Map<String, Object> attributesMap = null;
-
- public Object getAttribute(String name) {
- Object result = null;
-
- if (attributesMap != null) {
- result = attributesMap.get(name);
- }
-
- return result;
- }
-
- public void setAttribute(String name, Object value) {
- if (value != null) {
- if (attributesMap == null) {
- attributesMap = new HashMap<String, Object>();
- }
-
- attributesMap.put(name, value);
- } else {
- if (attributesMap != null) {
- attributesMap.remove(name);
- }
- }
- }
-
-}
Deleted: root/framework/trunk/impl/src/main/java/org/richfaces/context/ApplicationContext.java
===================================================================
--- root/framework/trunk/impl/src/main/java/org/richfaces/context/ApplicationContext.java 2009-07-30 16:13:54 UTC (rev 15069)
+++ root/framework/trunk/impl/src/main/java/org/richfaces/context/ApplicationContext.java 2009-07-30 22:39:12 UTC (rev 15070)
@@ -1,42 +0,0 @@
-/**
- *
- */
-package org.richfaces.context;
-
-import java.util.Map;
-
-import javax.faces.context.ExternalContext;
-import javax.faces.context.FacesContext;
-
-/**
- * @author Nick Belaevski
- * @since 4.0
- */
-public final class ApplicationContext extends AbstractContext {
-
- private static final String APPLICATION_ATTRIBUTE_NAME = ApplicationContext.class.getName();
-
- private ApplicationContext() {
- super();
- }
-
- public static ApplicationContext getInstance() {
- return getInstance(FacesContext.getCurrentInstance());
- }
-
- public static ApplicationContext getInstance(FacesContext context) {
- ExternalContext externalContext = context.getExternalContext();
- Map<String, Object> applicationMap = externalContext.getApplicationMap();
-
- ApplicationContext applicationContext = (ApplicationContext) applicationMap.get(APPLICATION_ATTRIBUTE_NAME);
- if (applicationContext == null) {
- applicationContext = new ApplicationContext();
-
- applicationMap.put(APPLICATION_ATTRIBUTE_NAME, applicationContext);
- }
-
- return applicationContext;
- }
-
-
-}
Copied: root/framework/trunk/impl/src/main/java/org/richfaces/context/AttributesContext.java (from rev 15069, root/framework/trunk/impl/src/main/java/org/richfaces/context/AbstractContext.java)
===================================================================
--- root/framework/trunk/impl/src/main/java/org/richfaces/context/AttributesContext.java (rev 0)
+++ root/framework/trunk/impl/src/main/java/org/richfaces/context/AttributesContext.java 2009-07-30 22:39:12 UTC (rev 15070)
@@ -0,0 +1,22 @@
+package org.richfaces.context;
+
+import java.util.HashMap;
+import java.util.Map;
+
+public class AttributesContext {
+
+ private Map<String, Object> attributesMap = new HashMap<String, Object>();
+
+ public Object getAttribute(String name) {
+ return attributesMap.get(name);
+ }
+
+ public Object setAttribute(String name, Object value) {
+ if (value != null) {
+ return attributesMap.put(name, value);
+ } else {
+ return attributesMap.remove(name);
+ }
+ }
+
+}
Added: root/framework/trunk/impl/src/main/java/org/richfaces/context/PartialViewContextFactoryImpl.java
===================================================================
--- root/framework/trunk/impl/src/main/java/org/richfaces/context/PartialViewContextFactoryImpl.java (rev 0)
+++ root/framework/trunk/impl/src/main/java/org/richfaces/context/PartialViewContextFactoryImpl.java 2009-07-30 22:39:12 UTC (rev 15070)
@@ -0,0 +1,61 @@
+/**
+ * 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.context;
+
+import javax.faces.context.FacesContext;
+import javax.faces.context.PartialViewContext;
+import javax.faces.context.PartialViewContextFactory;
+
+/**
+ * @author Nick Belaevski
+ * @since 4.0
+ */
+public class PartialViewContextFactoryImpl extends PartialViewContextFactory {
+
+ private PartialViewContextFactory parentFactory;
+
+ public PartialViewContextFactoryImpl(PartialViewContextFactory parentFactory) {
+ super();
+ this.parentFactory = parentFactory;
+ }
+
+ @Override
+ public PartialViewContext getPartialViewContext(final FacesContext context) {
+ PartialViewContext partialViewContext = parentFactory.getPartialViewContext(context);
+
+ String clientId = context.getExternalContext().getRequestParameterMap().get("RICHFACES_AJAX");
+ if (clientId != null) {
+ partialViewContext = new PartialViewContextImpl(partialViewContext, clientId);
+ }
+
+ return partialViewContext;
+ }
+
+ /* (non-Javadoc)
+ * @see javax.faces.context.PartialViewContextFactory#getWrapped()
+ */
+ @Override
+ public PartialViewContextFactory getWrapped() {
+ return parentFactory;
+ }
+
+}
Added: root/framework/trunk/impl/src/main/java/org/richfaces/context/PartialViewContextImpl.java
===================================================================
--- root/framework/trunk/impl/src/main/java/org/richfaces/context/PartialViewContextImpl.java (rev 0)
+++ root/framework/trunk/impl/src/main/java/org/richfaces/context/PartialViewContextImpl.java 2009-07-30 22:39:12 UTC (rev 15070)
@@ -0,0 +1,138 @@
+/**
+ * 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.context;
+
+import java.util.Collection;
+import java.util.Collections;
+import java.util.LinkedHashSet;
+import java.util.Set;
+
+import javax.faces.component.UIComponent;
+import javax.faces.component.UIViewRoot;
+import javax.faces.component.visit.VisitCallback;
+import javax.faces.component.visit.VisitContext;
+import javax.faces.component.visit.VisitHint;
+import javax.faces.component.visit.VisitResult;
+import javax.faces.context.FacesContext;
+import javax.faces.context.PartialViewContext;
+import javax.faces.context.PartialViewContextWrapper;
+import javax.faces.event.PhaseId;
+
+import org.ajax4jsf.renderkit.AjaxRendererUtils;
+import org.ajax4jsf.renderkit.RendererUtils;
+
+/**
+ * @author Nick Belaevski
+ * @since 4.0
+ */
+public class PartialViewContextImpl extends PartialViewContextWrapper {
+
+ private final PartialViewContext wrappedContext;
+
+ private final String activatorId;
+
+ public PartialViewContextImpl(PartialViewContext wrappedContext, String activatorId) {
+ super();
+
+ this.wrappedContext = wrappedContext;
+ this.activatorId = activatorId;
+ }
+
+ @Override
+ public PartialViewContext getWrapped() {
+ return wrappedContext;
+ }
+
+ private VisitContext createVisitContext(FacesContext facesContext) {
+ return VisitContext.createVisitContext(facesContext,
+ Collections.singleton(activatorId),
+ Collections.singleton(VisitHint.SKIP_UNRENDERED)
+ );
+ }
+
+ private static final class ComponentIdsCallback implements VisitCallback {
+
+ private final String targetAttributeName;
+
+ public ComponentIdsCallback(String targetAttributeName) {
+ super();
+
+ this.targetAttributeName = targetAttributeName;
+ }
+
+ private Collection<String> componentIds = new LinkedHashSet<String>();
+
+ public Collection<String> getComponentIds() {
+ return componentIds;
+ }
+
+ public VisitResult visit(VisitContext context, UIComponent target) {
+ Object attributeValue = target.getAttributes().get(targetAttributeName);
+ Set<String> attributeIds = AjaxRendererUtils.asSet(attributeValue);
+ if (attributeIds != null) {
+ componentIds.addAll(RendererUtils.getInstance().findComponentsFor(context.getFacesContext(), target, attributeIds));
+ }
+
+ return VisitResult.COMPLETE;
+ }
+ }
+
+ private Collection<String> getComponentIds(String targetAttributeName) {
+ FacesContext facesContext = FacesContext.getCurrentInstance();
+ ComponentIdsCallback componentIdsCallback = new ComponentIdsCallback(targetAttributeName);
+
+ UIViewRoot viewRoot = facesContext.getViewRoot();
+
+ boolean visitResult = viewRoot.visitTree(
+ createVisitContext(facesContext),
+ componentIdsCallback);
+
+ if (!visitResult) {
+ //TODO
+ }
+
+ return componentIdsCallback.getComponentIds();
+ }
+
+ @Override
+ public void processPartial(PhaseId phaseId) {
+ PartialViewContext wrapped = getWrapped();
+
+ if (PhaseId.APPLY_REQUEST_VALUES.equals(phaseId)) {
+ Collection<String> executeIds = wrapped.getExecuteIds();
+ executeIds.clear();
+ executeIds.addAll(getComponentIds("execute"));
+ } else if (PhaseId.RENDER_RESPONSE.equals(phaseId)) {
+ Collection<String> renderIds = wrapped.getRenderIds();
+ renderIds.clear();
+ renderIds.addAll(getComponentIds("render"));
+ }
+
+ wrapped.processPartial(phaseId);
+ }
+
+ @Override
+ public void setPartialRequest(boolean isPartialRequest) {
+ // TODO Auto-generated method stub
+
+ }
+}
Deleted: root/framework/trunk/impl/src/main/java/org/richfaces/context/RequestContext.java
===================================================================
--- root/framework/trunk/impl/src/main/java/org/richfaces/context/RequestContext.java 2009-07-30 16:13:54 UTC (rev 15069)
+++ root/framework/trunk/impl/src/main/java/org/richfaces/context/RequestContext.java 2009-07-30 22:39:12 UTC (rev 15070)
@@ -1,60 +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.context;
-
-import java.util.Map;
-
-import javax.faces.context.ExternalContext;
-import javax.faces.context.FacesContext;
-
-/**
- * @author Nick Belaevski
- * @since 3.3.1
- */
-
-public final class RequestContext extends AbstractContext {
-
- private static final String REQUEST_ATTRIBUTE_NAME = RequestContext.class.getName();
-
- private RequestContext() {
- super();
- }
-
- public static RequestContext getInstance() {
- return getInstance(FacesContext.getCurrentInstance());
- }
-
- public static RequestContext getInstance(FacesContext context) {
- ExternalContext externalContext = context.getExternalContext();
- Map<String, Object> requestMap = externalContext.getRequestMap();
-
- RequestContext requestContext = (RequestContext) requestMap.get(REQUEST_ATTRIBUTE_NAME);
- if (requestContext == null) {
- requestContext = new RequestContext();
-
- requestMap.put(REQUEST_ATTRIBUTE_NAME, requestContext);
- }
-
- return requestContext;
- }
-
-}
Added: root/framework/trunk/impl/src/main/java/org/richfaces/context/SingletonsContext.java
===================================================================
--- root/framework/trunk/impl/src/main/java/org/richfaces/context/SingletonsContext.java (rev 0)
+++ root/framework/trunk/impl/src/main/java/org/richfaces/context/SingletonsContext.java 2009-07-30 22:39:12 UTC (rev 15070)
@@ -0,0 +1,85 @@
+/**
+ * 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.context;
+
+import java.util.Map;
+
+import javax.faces.context.FacesContext;
+
+/**
+ * @author Nick Belaevski
+ * @since 4.0
+ */
+public class SingletonsContext {
+
+ public static abstract class ContextProvider {
+
+ protected final String singletonContextAttributeName;
+
+ protected ContextProvider(String attributeSuffixName) {
+ this.singletonContextAttributeName = SingletonsContext.class.getName() + ":" + attributeSuffixName;
+ }
+
+ protected AttributesContext createContext() {
+ return new AttributesContext();
+ }
+
+ protected abstract Map<? super String, Object> getContextMap(FacesContext facesContext);
+
+ protected AttributesContext createAndStoreContext(FacesContext context) {
+ AttributesContext instance = createContext();
+ getContextMap(context).put(singletonContextAttributeName, instance);
+
+ return instance;
+ }
+
+ public AttributesContext get(FacesContext context) {
+ Map<? super String, Object> contextMap = getContextMap(context);
+
+ AttributesContext instance = (AttributesContext) contextMap.get(singletonContextAttributeName);
+ if (instance == null) {
+ instance = createAndStoreContext(context);
+ }
+
+ return instance;
+ }
+ }
+
+ public static final ContextProvider APPLICATION = new ContextProvider("Application") {
+
+ @Override
+ protected Map<String, Object> getContextMap(FacesContext facesContext) {
+ return facesContext.getExternalContext().getApplicationMap();
+ }
+
+ };
+
+ public static final ContextProvider FACES_CONTEXT = new ContextProvider("FacesContext") {
+
+ @Override
+ protected Map<? super String, Object> getContextMap(FacesContext facesContext) {
+ return facesContext.getAttributes();
+ }
+
+ };
+
+}
Modified: root/framework/trunk/impl/src/main/java/org/richfaces/resource/AbstractBaseResource.java
===================================================================
--- root/framework/trunk/impl/src/main/java/org/richfaces/resource/AbstractBaseResource.java 2009-07-30 16:13:54 UTC (rev 15069)
+++ root/framework/trunk/impl/src/main/java/org/richfaces/resource/AbstractBaseResource.java 2009-07-30 22:39:12 UTC (rev 15070)
@@ -39,7 +39,7 @@
import org.ajax4jsf.resource.InternetResource;
import org.ajax4jsf.resource.ResourceContext;
-import org.richfaces.context.ApplicationContext;
+import org.richfaces.context.SingletonsContext;
import org.richfaces.util.RichfacesLogger;
import org.richfaces.util.Util;
import org.slf4j.Logger;
@@ -134,11 +134,11 @@
//TODO - originally lastModified was set during resource creation.
//as resources can be managed beans this approach does not seem good
if (lastModified == null) {
- lastModified = (Date) ApplicationContext.getInstance(context).
+ lastModified = (Date) SingletonsContext.APPLICATION.get(context).
getAttribute(ResourceHandlerImpl.HANDLER_START_TIME_ATTRIBUTE);
if (LOGGER.isDebugEnabled()) {
- LOGGER.debug(MessageFormat.format("Using resource handler start time as last modified date: {0,date}", lastModified));
+ LOGGER.debug(MessageFormat.format("Using resource handler start time as last modified date: {0,date,dd MMM yyyy HH:mm:ss zzz}", lastModified));
}
}
Modified: root/framework/trunk/impl/src/main/java/org/richfaces/resource/ResourceHandlerImpl.java
===================================================================
--- root/framework/trunk/impl/src/main/java/org/richfaces/resource/ResourceHandlerImpl.java 2009-07-30 16:13:54 UTC (rev 15069)
+++ root/framework/trunk/impl/src/main/java/org/richfaces/resource/ResourceHandlerImpl.java 2009-07-30 22:39:12 UTC (rev 15070)
@@ -38,11 +38,13 @@
import javax.faces.context.ExternalContext;
import javax.faces.context.FacesContext;
import javax.imageio.ImageIO;
+import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.ajax4jsf.cache.Cache;
import org.ajax4jsf.cache.CacheManager;
-import org.richfaces.context.ApplicationContext;
+import org.richfaces.context.AttributesContext;
+import org.richfaces.context.SingletonsContext;
import org.richfaces.util.RichfacesLogger;
import org.richfaces.util.Util;
import org.richfaces.util.RequestStateManager.BooleanRequestStateVariable;
@@ -103,7 +105,7 @@
}
private void markStartTime(FacesContext facesContext) {
- ApplicationContext applicationContext = ApplicationContext.getInstance(facesContext);
+ AttributesContext applicationContext = SingletonsContext.APPLICATION.get(facesContext);
applicationContext.setAttribute(HANDLER_START_TIME_ATTRIBUTE, new Date());
}
@@ -338,26 +340,30 @@
if (contentType != null) {
externalContext.setResponseContentType(contentType);
}
-
- //TODO 'HEAD' HTTP method resources - ?
- //TODO setup output buffer size according to configuration parameter
- InputStream is = resource.getInputStream();
- OutputStream os = externalContext.getResponseOutputStream();
+
+ //TODO - portlets
+ HttpServletRequest httpServletRequest = (HttpServletRequest) externalContext.getRequest();
+ if (!"HEAD".equals(httpServletRequest.getMethod())) {
+ //TODO 'HEAD' HTTP method resources - ?
+ //TODO setup output buffer size according to configuration parameter
+ InputStream is = resource.getInputStream();
+ OutputStream os = externalContext.getResponseOutputStream();
- try {
- Util.copyStreamContent(is, os);
- } finally {
- if (is != null) {
- try {
- is.close();
- } catch (IOException e) {
- if (LOGGER.isDebugEnabled()) {
- LOGGER.debug(e.getMessage(), e);
+ try {
+ Util.copyStreamContent(is, os);
+ } finally {
+ if (is != null) {
+ try {
+ is.close();
+ } catch (IOException e) {
+ if (LOGGER.isDebugEnabled()) {
+ LOGGER.debug(e.getMessage(), e);
+ }
}
}
+ //TODO flush resource
+ //TODO dispose resource
}
- //TODO flush resource
- //TODO dispose resource
}
if (LOGGER.isDebugEnabled()) {
Added: root/framework/trunk/impl/src/main/resources/META-INF/components.faces-config.xml
===================================================================
--- root/framework/trunk/impl/src/main/resources/META-INF/components.faces-config.xml (rev 0)
+++ root/framework/trunk/impl/src/main/resources/META-INF/components.faces-config.xml 2009-07-30 22:39:12 UTC (rev 15070)
@@ -0,0 +1,10 @@
+<?xml version="1.0"?>
+<faces-config xmlns="http://java.sun.com/xml/ns/javaee"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ version="2.0">
+
+ <factory>
+ <partial-view-context-factory>org.richfaces.context.PartialViewContextFactoryImpl</partial-view-context-factory>
+ </factory>
+
+</faces-config>
Modified: root/framework/trunk/impl/src/main/resources/META-INF/faces-config.xml
===================================================================
--- root/framework/trunk/impl/src/main/resources/META-INF/faces-config.xml 2009-07-30 16:13:54 UTC (rev 15069)
+++ root/framework/trunk/impl/src/main/resources/META-INF/faces-config.xml 2009-07-30 22:39:12 UTC (rev 15070)
@@ -44,7 +44,7 @@
<managed-bean-name>ajaxContext</managed-bean-name>
<managed-bean-class>org.ajax4jsf.context.AjaxContextImpl</managed-bean-class>
<managed-bean-scope>request</managed-bean-scope>
- </managed-bean>
+ </managed-bean>
<!-- component>
<component-type>javax.faces.ViewRoot</component-type>
Modified: root/framework/trunk/impl/src/main/resources/META-INF/resources/richfaces.js/4_0_0.js
===================================================================
--- root/framework/trunk/impl/src/main/resources/META-INF/resources/richfaces.js/4_0_0.js 2009-07-30 16:13:54 UTC (rev 15069)
+++ root/framework/trunk/impl/src/main/resources/META-INF/resources/richfaces.js/4_0_0.js 2009-07-30 22:39:12 UTC (rev 15070)
@@ -1,6 +1,6 @@
-(function(richFaces, jQuery) {
+(function(richfaces, jQuery) {
//form.js
- richFaces.submitForm = function(form, parameters, target) {
+ richfaces.submitForm = function(form, parameters, target) {
if (typeof form === "string") { form = jQuery(form) };
var initialTarget = form.attr("target");
var parameterInputs = new Array();
@@ -13,7 +13,7 @@
var input = jQuery("input[name='" + parameterName + "']", form);
if (input.length == 0) {
- var newInput = jQuery("<input type='hidden' name='" + parameterName + "' id='" + parameterName + "' />").val(parameterValue);
+ var newInput = jQuery("<input />").attr({type: 'hidden', name: parameterName, value: parameterValue});
if (parameterName === 'javax.faces.portletbridge.STATE_ID' /* fix for fileUpload in portlets */) {
input = newInput.prependTo(form);
} else {
@@ -37,9 +37,178 @@
//
//utils.js
+ richfaces.console = (function(jQuery) {
+ var getConsole = function() {
+ var console = jQuery('#richfaces\\.console');
+ if (console.length == 0) {
+ console = jQuery("<div id='richfaces.console'><button>Clear</button></div>").appendTo("body");
+ }
+ console.find("button:first").click(function() {jQuery(this).nextAll().remove();});
+ return console;
+ };
+
+ var LOG_LEVEL_COLORS = {'debug': 'darkblue', 'info': 'blue', 'warn': 'yellow', 'error': 'red'};
+
+ var formatMessage = function(level, message) {
+ return level + '[' + new Date().toLocaleTimeString() + ']: ' + message;
+ };
+
+ var appendLogEntry = function(level, text) {
+ jQuery("<div style='color: " + LOG_LEVEL_COLORS[level] + "'></div>").appendTo(getConsole()).text(text);
+ };
+
+ var useFirebugConsole = true;
+
+ var loggers = {};
+ for (var logLevel in LOG_LEVEL_COLORS) {
+ loggers[logLevel] = (function() {
+ var _logLevel = logLevel;
+
+ if (window.console && useFirebugConsole) {
+ return function(message) {
+ window.console[_logLevel](formatMessage(_logLevel, message));
+ };
+ } else {
+ return function() {
+ appendLogEntry(_logLevel, formatMessage(_logLevel, message))
+ };
+ }
+ }());
+ }
+ return loggers;
+ }(jQuery));
+
+ /**
+ * Evaluates chained properties for the "base" object.
+ * For example, window.document.location is equivalent to
+ * "propertyNamesString" = "document.location" and "base" = window
+ * Evaluation is safe, so it stops on the first null or undefined object
+ *
+ * @param propertyNamesArray - array of strings that contains names of the properties to evaluate
+ * @param base - base object to evaluate properties on
+ * @return returns result of evaluation or empty string
+ */
+ richfaces.getValue = function(propertyNamesArray, base) {
+ var result = base;
+ var c = 0;
+ do {
+ result = result[propertyNamesArray[c++]];
+ } while (result && c != propertyNamesArray.length);
+
+ return result;
+ };
+
+ var VARIABLE_NAME_PATTERN_STRING = "[_A-Z,a-z]\\w*";
+ var VARIABLES_CHAIN = new RegExp("^\\s*"+VARIABLE_NAME_PATTERN_STRING+"(?:\\s*\\.\\s*"+VARIABLE_NAME_PATTERN_STRING+")*\\s*$");
+ var DOT_SEPARATOR = /\s*\.\s*/;
+
+ richfaces.evalMacro = function(macro, base) {
+ var value = "";
+ // variable evaluation
+ if (VARIABLES_CHAIN.test(macro)) {
+ // object's variable evaluation
+ var propertyNamesArray = jQuery.trim(macro).split(DOT_SEPARATOR);
+ value = richfaces.getValue(propertyNamesArray, base);
+ if (!value) {
+ value = richfaces.getValue(propertyNamesArray, window);
+ }
+ } else {
+ //js string evaluation
+ try {
+ if (base.eval) {
+ value = base.eval(macro);
+ } else with (base) {
+ value = eval(macro) ;
+ }
+ } catch (e) {
+ richfaces.console.warn("Exception: " + e.message + "\n[" + macro + "]");
+ }
+ }
+
+ if (typeof value == 'function') {
+ value = value(base);
+ }
+ //TODO 0 and false are also treated as null values
+ return value || "";
+ };
+
+ richfaces.interpolate = function (placeholders, context) {
+ var contextVarsArray = new Array();
+ for (var contextVar in context) {
+ if (/^\w+$/.test(contextVar)) {
+ //guarantees that no escaping for the below RegExp is necessary
+ contextVarsArray.push(contextVar);
+ }
+ }
+
+ var regexp = new RegExp("\\{(" + contextVarsArray.join("|") + ")\\}", "g");
+ return placeholders.replace(regexp, function(str, contextVar) {return context[contextVar];});
+ };
+
richfaces.clonePosition = function(element, baseElement, positioning, offset) {
};
//
+
+ var PUSH_RESOURCE_URL = "#{resource['org.richfaces.resource.PushResource']}";
+ var pushTracker = {};
+
+ richfaces.startPush = function(options) {
+ var pushId = options.pushId;
+ var interval = options.interval;
+ var ondataavailable = options.ondataavailable;
+
+ richfaces.stopPush(pushId);
+
+ pushTracker[pushId] = setTimeout(function() {
+ var ajaxOptions = {
+ type: "HEAD",
+ //TODO - encodeURIComponent; URL sessionId handling check
+ url: PUSH_RESOURCE_URL + "?id=" + pushId,
+ dataType: "text",
+ complete: function(xhr) {
+ var isPushActive = !!pushTracker[pushId];
+
+ delete pushTracker[pushId];
+
+ if (xhr.status == 200 && xhr.getResponseHeader("Ajax-Push-Status") == "READY") {
+ try {
+ ondataavailable();
+ } catch (e) {
+ // TODO: handle exception
+ }
+ }
+
+ if (isPushActive) {
+ richfaces.startPush(options);
+ }
+ }
+ };
+
+ if (options.timeout) {
+ ajaxOptions.timeout = options.timeout;
+ }
+
+ jQuery.ajax(ajaxOptions);
+ }, interval);
+ };
+
+ richfaces.stopPush = function(id) {
+ if (pushTracker[id]){
+ window.clearTimeout(pushTracker[id]);
+ delete pushTracker[id];
+ }
+ };
+
+ richfaces.ajax = function(source, event, options) {
+ var sourceId = source;
+
+ options.execute = "@component";
+ options.render = "@component";
+ options.RICHFACES_AJAX = sourceId;
+
+ jsf.ajax.request(source, event, options);
+ };
+
}(window.RichFaces = {}, jQuery));
15 years, 5 months
JBoss Rich Faces SVN: r15069 - branches/community/3.3.X/samples/richfaces-demo/src/main/webapp/richfaces/filteringFeature.
by richfaces-svn-commits@lists.jboss.org
Author: ilya_shaikovsky
Date: 2009-07-30 12:13:54 -0400 (Thu, 30 Jul 2009)
New Revision: 15069
Modified:
branches/community/3.3.X/samples/richfaces-demo/src/main/webapp/richfaces/filteringFeature/filteringUsage.xhtml
Log:
minor styling update
Modified: branches/community/3.3.X/samples/richfaces-demo/src/main/webapp/richfaces/filteringFeature/filteringUsage.xhtml
===================================================================
--- branches/community/3.3.X/samples/richfaces-demo/src/main/webapp/richfaces/filteringFeature/filteringUsage.xhtml 2009-07-30 16:11:22 UTC (rev 15068)
+++ branches/community/3.3.X/samples/richfaces-demo/src/main/webapp/richfaces/filteringFeature/filteringUsage.xhtml 2009-07-30 16:13:54 UTC (rev 15069)
@@ -27,7 +27,7 @@
<fieldset class="demo_fieldset">
<legend class="demo_legend">Filtering DataTable example</legend>
<div class="sample-container">
- <h:panelGrid columns="2" columnClasses="top">
+ <h:panelGrid columns="2" columnClasses="top, top">
<h:panelGroup>
<ui:include src="/richfaces/filteringFeature/examples/simpleFiltering.xhtml"/>
</h:panelGroup>
15 years, 5 months
JBoss Rich Faces SVN: r15068 - branches/community/3.3.X/samples/richfaces-demo/src/main/resources/org/richfaces/demo/common.
by richfaces-svn-commits@lists.jboss.org
Author: ilya_shaikovsky
Date: 2009-07-30 12:11:22 -0400 (Thu, 30 Jul 2009)
New Revision: 15068
Modified:
branches/community/3.3.X/samples/richfaces-demo/src/main/resources/org/richfaces/demo/common/components.properties
Log:
marks new on samples where RFCs was made..
Modified: branches/community/3.3.X/samples/richfaces-demo/src/main/resources/org/richfaces/demo/common/components.properties
===================================================================
--- branches/community/3.3.X/samples/richfaces-demo/src/main/resources/org/richfaces/demo/common/components.properties 2009-07-30 16:03:53 UTC (rev 15067)
+++ branches/community/3.3.X/samples/richfaces-demo/src/main/resources/org/richfaces/demo/common/components.properties 2009-07-30 16:11:22 UTC (rev 15068)
@@ -3,11 +3,11 @@
panel= richOutputs, Panel, /images/ico_panel.gif, /images/cn_panel.gif, panel.html, jbossrichfaces/freezone/docs/tlddoc/rich/panel.html, jbossrichfaces/freezone/docs/apidoc/org/richfaces/component/UIPanel.html, /richfaces/panel.jsf
separator= richOutputs, Separator, /images/ico_separator.gif, /images/cn_separator.gif, separator.html, jbossrichfaces/freezone/docs/tlddoc/rich/separator.html, jbossrichfaces/freezone/docs/apidoc/org/richfaces/component/UISeparator.html, /richfaces/separator.jsf
spacer= richOutputs, Spacer, /images/ico_spacer.gif, /images/cn_spacer.gif, spacer.html, jbossrichfaces/freezone/docs/tlddoc/rich/spacer.html, jbossrichfaces/freezone/docs/apidoc/org/richfaces/component/UISpacer.html, /richfaces/spacer.jsf
-tabPanel= richOutputs, Tab Panel, /images/ico_tabpanel.gif, /images/cn_tabpanel.gif, tabPanel.html, jbossrichfaces/freezone/docs/tlddoc/rich/tabPanel.html, jbossrichfaces/freezone/docs/apidoc/org/richfaces/component/UITabPanel.html, /richfaces/tabPanel.jsf, new
+tabPanel= richOutputs, Tab Panel, /images/ico_tabpanel.gif, /images/cn_tabpanel.gif, tabPanel.html, jbossrichfaces/freezone/docs/tlddoc/rich/tabPanel.html, jbossrichfaces/freezone/docs/apidoc/org/richfaces/component/UITabPanel.html, /richfaces/tabPanel.jsf
inputNumberSlider= richInputs, Input Number Slider, /images/ico_DataFilterSlider.gif, /images/cn_slider.gif, inputNumberSlider.html, jbossrichfaces/freezone/docs/tlddoc/rich/inputNumberSlider.html, jbossrichfaces/freezone/docs/apidoc/org/richfaces/component/UIInputNumberSlider.html, /richfaces/inputNumberSlider.jsf
inputNumberSpinner= richInputs, Input Number Spinner, /images/ico_spinner.gif, /images/cn_spinner.gif, inputNumberSpinner.html, jbossrichfaces/freezone/docs/tlddoc/rich/inputNumberSpinner.html, jbossrichfaces/freezone/docs/apidoc/org/richfaces/component/UIInputNumberSpinner.html, /richfaces/inputNumberSpinner.jsf
dataFilterSlider= richDataIterators, Data Filter Slider, /images/ico_DataFilterSlider.gif, /images/cn_DataFilterSlider.gif, dataFilterSlider.html, jbossrichfaces/freezone/docs/tlddoc/rich/dataFilterSlider.html, jbossrichfaces/freezone/docs/apidoc/org/richfaces/component/UIDataFltrSlider.html, /richfaces/dataFilterSlider.jsf
-dataTable=richDataIterators, Data Table, /images/ico_DataTable.gif, /images/cn_DataTable.gif, dataTable.html, jbossrichfaces/freezone/docs/tlddoc/rich/dataTable.html, jbossrichfaces/freezone/docs/apidoc/org/richfaces/component/UIDataTable.html, /richfaces/dataTable.jsf, new
+dataTable=richDataIterators, Data Table, /images/ico_DataTable.gif, /images/cn_DataTable.gif, dataTable.html, jbossrichfaces/freezone/docs/tlddoc/rich/dataTable.html, jbossrichfaces/freezone/docs/apidoc/org/richfaces/component/UIDataTable.html, /richfaces/dataTable.jsf
column= richDataIterators, Column, /images/ico_Column.gif, /images/cn_Column.gif, column.html, jbossrichfaces/freezone/docs/tlddoc/rich/column.html, jbossrichfaces/freezone/docs/apidoc/org/richfaces/component/UIColumn.html, /richfaces/dataTable.jsf
columnGroup= richDataIterators, Column Group, /images/ico_ColumnGroup.gif, /images/cn_ColumnGroup.gif, columnGroup.html, jbossrichfaces/freezone/docs/tlddoc/rich/columnGroup.html, jbossrichfaces/freezone/docs/apidoc/org/richfaces/component/UIColumnGroup.html, /richfaces/dataTable.jsf
dataDefinitionList= richDataIterators, Data Definition List, /images/ico_DataDefinitionList.gif, /images/cn_DataDefinitionList.gif, dataDefinitionList.html, jbossrichfaces/freezone/docs/tlddoc/rich/dataDefinitionList.html, jbossrichfaces/freezone/docs/apidoc/org/richfaces/component/UIDataDefinitionList.html, /richfaces/dataLists.jsf
@@ -29,12 +29,12 @@
togglePanel= richOutputs, Toggle Panel, /images/ico_TogglePanel.gif, /images/cn_TogglePanel.gif, togglePanel.html, jbossrichfaces/freezone/docs/tlddoc/rich/togglePanel.html, jbossrichfaces/freezone/docs/apidoc/org/richfaces/component/UITogglePanel.html, /richfaces/togglePanel.jsf
panelMenu= richOutputs, Panel Menu, /images/ico_panelMenu.gif, /images/cn_PanelMenu.gif, panelMenu.html, jbossrichfaces/freezone/docs/tlddoc/rich/panelMenu.html, jbossrichfaces/freezone/docs/apidoc/org/richfaces/component/UIPanelMenu.html, /richfaces/panelMenu.jsf
suggestionBox= richInputs, Suggestion Box, /images/ico_SuggestionBox.gif, /images/cn_SuggestionBox.gif, suggestionbox.html, jbossrichfaces/freezone/docs/tlddoc/rich/suggestionbox.html, jbossrichfaces/freezone/docs/apidoc/org/richfaces/component/UISuggestionBox.html, /richfaces/suggestionBox.jsf
-dataTableScroller= richDataIterators, Data Scroller, /images/ico_DataTableScroller.gif, /images/cn_DataTableScroller.gif, datascroller.html, jbossrichfaces/freezone/docs/tlddoc/rich/datascroller.html, jbossrichfaces/freezone/docs/apidoc/org/richfaces/component/UIDatascroller.html, /richfaces/dataTableScroller.jsf, new
+dataTableScroller= richDataIterators, Data Scroller, /images/ico_DataTableScroller.gif, /images/cn_DataTableScroller.gif, datascroller.html, jbossrichfaces/freezone/docs/tlddoc/rich/datascroller.html, jbossrichfaces/freezone/docs/apidoc/org/richfaces/component/UIDatascroller.html, /richfaces/dataTableScroller.jsf
dropDownMenu= richMenu, Drop Down Menu, /images/ico_DropDownMenu.gif, /images/cn_DropDownMenu.gif, dropDownMenu.html, jbossrichfaces/freezone/docs/tlddoc/rich/dropDownMenu.html, jbossrichfaces/freezone/docs/apidoc/org/richfaces/component/UIDropDownMenu.html, /richfaces/dropDownMenu.jsf
menuGroup= richMenu, Menu Group, /images/ico_MenuGroup.gif, /images/cn_MenuGroup.gif, menuGroup.html, jbossrichfaces/freezone/docs/tlddoc/rich/menuGroup.html, jbossrichfaces/freezone/docs/apidoc/org/richfaces/component/UIMenuGroup.html, /richfaces/dropDownMenu.jsf
menuItem= richMenu, Menu Item, /images/ico_MenuItem.gif, /images/cn_MenuItem.gif, menuItem.html, jbossrichfaces/freezone/docs/tlddoc/rich/menuItem.html, jbossrichfaces/freezone/docs/apidoc/org/richfaces/component/UIMenuItem.html, /richfaces/dropDownMenu.jsf
menuSeparator= richMenu, Menu Separator, /images/ico_MenuSeparator.gif, /images/cn_MenuSeparator.gif, menuSeparator.html, jbossrichfaces/freezone/docs/tlddoc/rich/menuSeparator.html, jbossrichfaces/freezone/docs/apidoc/org/richfaces/component/UIMenuSeparator.html, /richfaces/dropDownMenu.jsf
-calendar= richInputs, Calendar, /images/ico_Calendar.gif, /images/cn_Calendar.gif, calendar.html, jbossrichfaces/freezone/docs/tlddoc/rich/calendar.html, jbossrichfaces/freezone/docs/apidoc/org/richfaces/component/UICalendar.html, /richfaces/calendar.jsf, new
+calendar= richInputs, Calendar, /images/ico_Calendar.gif, /images/cn_Calendar.gif, calendar.html, jbossrichfaces/freezone/docs/tlddoc/rich/calendar.html, jbossrichfaces/freezone/docs/apidoc/org/richfaces/component/UICalendar.html, /richfaces/calendar.jsf
message= richMisc, Message, /images/ico_common.gif, /images/cn_Message.gif, message.html, jbossrichfaces/freezone/docs/tlddoc/rich/message.html, jbossrichfaces/freezone/docs/apidoc/org/richfaces/component/UIRichMessage.html, /richfaces/message.jsf
messages= richMisc, Messages, /images/ico_common.gif, /images/cn_Messages.gif, messages.html, jbossrichfaces/freezone/docs/tlddoc/rich/messages.html, jbossrichfaces/freezone/docs/apidoc/org/richfaces/component/UIRichMessages.html, /richfaces/messages.jsf
virtualEarth= richMisc, Virtual Earth, /images/ico_VirtualEarth.gif, /images/cn_VirtualEarth.gif, virtualEarth.html, jbossrichfaces/freezone/docs/tlddoc/rich/virtualEarth.html, jbossrichfaces/freezone/docs/apidoc/org/richfaces/component/UIVirtualEarth.html, /richfaces/virtualEarth.jsf
@@ -51,7 +51,7 @@
support= ajaxSupport, Ajax Support, /images/ico_common.gif, /images/cn_ajaxSupport.gif, support.html, jbossajax4jsf/freezone/docs/tlddoc/a4j/support.html, jbossajax4jsf/freezone/docs/apidoc/org/ajax4jsf/ajax/UIAjaxSupport.html, /richfaces/support.jsf
jsFunction= ajaxSupport, JS Function, /images/ico_common.gif, /images/cn_jsFunction.gif, jsFunction.html, jbossajax4jsf/freezone/docs/tlddoc/a4j/jsFunction.html, jbossajax4jsf/freezone/docs/apidoc/org/ajax4jsf/ajax/UIAjaxFunction.html, /richfaces/jsFunction.jsf
poll= ajaxSupport, Poll, /images/ico_common.gif, /images/cn_poll.gif, poll.html, jbossajax4jsf/freezone/docs/tlddoc/a4j/poll.html, jbossajax4jsf/freezone/docs/apidoc/org/ajax4jsf/ajax/UIPoll.html, /richfaces/poll.jsf
-push= ajaxSupport, Push, /images/ico_common.gif, /images/cn_push.gif, push.html, jbossajax4jsf/freezone/docs/tlddoc/a4j/push.html, jbossajax4jsf/freezone/docs/apidoc/org/ajax4jsf/ajax/UIPush.html, /richfaces/push.jsf
+push= ajaxSupport, Push, /images/ico_common.gif, /images/cn_push.gif, push.html, jbossajax4jsf/freezone/docs/tlddoc/a4j/push.html, jbossajax4jsf/freezone/docs/apidoc/org/ajax4jsf/ajax/UIPush.html, /richfaces/push.jsf , new
status= ajaxSupport, Status, /images/ico_common.gif, /images/cn_status.gif, status.html, jbossajax4jsf/freezone/docs/tlddoc/a4j/status.html, jbossajax4jsf/freezone/docs/apidoc/org/ajax4jsf/ajax/UIAjaxStatus.html, /richfaces/status.jsf
ajaxListener= ajaxSupport, Ajax Listener, /images/ico_common.gif, /images/cn_ajaxListener.gif, ajaxListener.html, jbossajax4jsf/freezone/docs/tlddoc/a4j/ajaxListener.html, jbossajax4jsf/freezone/docs/apidoc/org/ajax4jsf/taglib/html/jsp/AjaxListenerTag.html, /richfaces/ajaxListener.jsf
region= ajaxSupport, Ajax Region, /images/ico_common.gif, /images/cn_ajaxRegion.gif, region.html, jbossajax4jsf/freezone/docs/tlddoc/a4j/region.html, jbossajax4jsf/freezone/docs/apidoc/org/ajax4jsf/ajax/UIAjaxRegion.html, /richfaces/region.jsf
@@ -60,7 +60,7 @@
loadStyle= ajaxResources, Style, /images/ico_common.gif, /images/cn_Style.gif, loadStyle.html, jbossajax4jsf/freezone/docs/tlddoc/a4j/loadStyle.html, jbossajax4jsf/freezone/docs/apidoc/org/ajax4jsf/taglib/ajax/LoadStyleTag.html, /richfaces/style.jsf
keepAlive= ajaxResources, Keep Alive, /images/ico_common.gif, /images/cn_KeepAlive.gif, keepAlive.html, jbossajax4jsf/freezone/docs/tlddoc/a4j/keepAlive.html, jbossajax4jsf/freezone/docs/apidoc/org/ajax4jsf/taglib/html/jsp/KeepAliveTag.html, /richfaces/keepAlive.jsf
include= ajaxOutput, Include, /images/ico_common.gif, /images/cn_include2.gif, include.html, jbossajax4jsf/freezone/docs/tlddoc/a4j/include.html, jbossajax4jsf/freezone/docs/apidoc/org/ajax4jsf/ajax/UIInclude.html, /richfaces/include.jsf
-mediaOutput= ajaxOutput, Media Output, /images/ico_common.gif, /images/cn_MediaOutput.gif, mediaOutput.html, jbossajax4jsf/freezone/docs/tlddoc/a4j/mediaOutput.html, jbossajax4jsf/freezone/docs/apidoc/org/ajax4jsf/ajax/resource/UIMediaOutput.html, /richfaces/mediaOutput.jsf, new
+mediaOutput= ajaxOutput, Media Output, /images/ico_common.gif, /images/cn_MediaOutput.gif, mediaOutput.html, jbossajax4jsf/freezone/docs/tlddoc/a4j/mediaOutput.html, jbossajax4jsf/freezone/docs/apidoc/org/ajax4jsf/ajax/resource/UIMediaOutput.html, /richfaces/mediaOutput.jsf
outputPanel= ajaxOutput, Output Panel, /images/ico_common.gif, /images/cn_OutputPanel.gif, outputPanel.html, jbossajax4jsf/freezone/docs/tlddoc/a4j/outputPanel.html, jbossajax4jsf/freezone/docs/apidoc/org/ajax4jsf/ajax/UIAjaxOutputPanel.html, /richfaces/outputPanel.jsf
repeat= richDataIterators, Repeat, /images/ico_Repeat.gif, /images/cn_Repeat.gif, repeat.html, jbossajax4jsf/freezone/docs/tlddoc/a4j/repeat.html, jbossajax4jsf/freezone/docs/apidoc/org/ajax4jsf/ajax/repeat/UIRepeat.html, /richfaces/repeat.jsf
htmlCommandLink= ajaxMisc, Html Command Link, /images/ico_common.gif, /images/cn_HtmlCommandLink.gif, htmlCommandLink.html, jbossajax4jsf/freezone/docs/tlddoc/a4j/htmlCommandLink.html, jbossajax4jsf/freezone/docs/apidoc/org/ajax4jsf/taglib/ajax/HtmlCommandLinkTag.html, /richfaces/htmlCommandLink.jsf
@@ -78,7 +78,7 @@
inplaceInput= richInputs, Inplace Input, /images/ico_InplaceInput.gif, \t\t/images/cn_InplaceInput.gif, inplaceInput.html, jbossrichfaces/freezone/docs/tlddoc/rich/inplaceInput.html, jbossrichfaces/freezone/docs/apidoc/org/richfaces/component/UIInplaceInput.html, \t\t\t\t\t/richfaces/inplaceInput.jsf
inplaceSelect= richInputs, Inplace Select, /images/ico_InplaceSelect.gif, \t\t/images/cn_InplaceSelect.gif, inplaceSelect.html, jbossrichfaces/freezone/docs/tlddoc/rich/inplaceSelect.html, jbossrichfaces/freezone/docs/apidoc/org/richfaces/component/UIInplaceSelect.html, \t\t\t\t\t/richfaces/inplaceSelect.jsf
sorting=richDataIterators, Table Sorting, \t/images/ico_TableSorting.gif, \t\t/images/cn_TableSorting.gif, dataTable.html, jbossrichfaces/freezone/docs/tlddoc/rich/dataTable.html, jbossrichfaces/freezone/docs/apidoc/org/richfaces/component/UIDataTable.html, \t\t\t\t\t/richfaces/sortingFeature.jsf
-filtering=richDataIterators, Table Filtering, \t/images/ico_TableFiltering.gif, \t\t/images/cn_TableFiltering.gif, dataTable.html, jbossrichfaces/freezone/docs/tlddoc/rich/dataTable.html, jbossrichfaces/freezone/docs/apidoc/org/richfaces/component/UIDataTable.html, \t\t\t\t\t/richfaces/filteringFeature.jsf
+filtering=richDataIterators, Table Filtering, \t/images/ico_TableFiltering.gif, \t\t/images/cn_TableFiltering.gif, dataTable.html, jbossrichfaces/freezone/docs/tlddoc/rich/dataTable.html, jbossrichfaces/freezone/docs/apidoc/org/richfaces/component/UIDataTable.html, \t\t\t\t\t/richfaces/filteringFeature.jsf , new
columns =richDataIterators, \t Columns, \t\t\t/images/ico_columns.gif, \t\t/images/cn_Columns.gif, columns.html, jbossrichfaces/freezone/docs/tlddoc/rich/columns.html, jbossrichfaces/freezone/docs/apidoc/org/richfaces/taglib/ColumnsTag.html, \t\t\t\t\t/richfaces/columns.jsf
fileUpload =richInputs, \t File Upload, \t\t/images/ico_FileUpload.gif, \t\t/images/cn_FileUpload.gif, fileUpload.html, jbossrichfaces/freezone/docs/tlddoc/rich/fileUpload.html, jbossrichfaces/freezone/docs/apidoc/org/richfaces/component/UIFileUpload.html, \t\t\t\t\t/richfaces/fileUpload.jsf
StandardSkinning =richMisc, \t Standard Skinning, \t\t/images/ico_StandardComponentsSkinning.gif, \t\t/images/cn_StandardComponentsSkinning.gif, ArchitectureOverview.html\#StControlsSkinning, jbossrichfaces/freezone/docs/tlddoc/rich/StandardSkinning.html, jbossrichfaces/freezone/docs/apidoc/org/richfaces/component/UIfileUpload.html, \t\t\t\t\t/richfaces/standardSkinning.jsf
@@ -88,8 +88,8 @@
beanValidator=richValidators, \t Bean Validator, \t\t/images/ico_BeanValidator.gif, \t\t/images/cn_BeanValidator.gif, beanValidator.html, jbossrichfaces/freezone/docs/tlddoc/rich/beanValidator.html, jbossrichfaces/freezone/docs/apidoc/org/richfaces/component/UIBeanValidator.html, \t\t\t\t\t/richfaces/beanValidator.jsf
graphValidator=richValidators, \t Graph Validator, \t\t/images/ico_GraphValidator.gif, \t\t/images/cn_GraphValidator.gif, graphValidator.html, jbossrichfaces/freezone/docs/tlddoc/rich/graphValidator.html, jbossrichfaces/freezone/docs/apidoc/org/richfaces/component/UIGraphValidator.html, \t\t\t\t\t/richfaces/graphValidator.jsf
stateAPI=richMisc, \t State Manager API, \t\t/images/ico_StateManagerAPI.gif, \t\t/images/cn_StateManagerAPI.gif, ArchitectureOverview.html\#statemanagerapi, jbossrichfaces/freezone/docs/tlddoc/rich/graphValidator.html, jbossrichfaces/freezone/docs/apidoc/org/richfaces/component/UIhotkey.html, \t\t\t\t\t/richfaces/stateAPI.jsf
-extendedDataTable= richDataIterators, Extended Data Table, /images/ico_ExtendedDataTable.gif, /images/cn_ExtendedDataTable.gif, extendedDataTable.html, jbossrichfaces/freezone/docs/tlddoc/rich/extendedDataTable.html, jbossrichfaces/freezone/docs/apidoc/org/richfaces/component/UIExtendedDataTable.html, /richfaces/extendedDataTable.jsf
+extendedDataTable= richDataIterators, Extended Data Table, /images/ico_ExtendedDataTable.gif, /images/cn_ExtendedDataTable.gif, extendedDataTable.html, jbossrichfaces/freezone/docs/tlddoc/rich/extendedDataTable.html, jbossrichfaces/freezone/docs/apidoc/org/richfaces/component/UIExtendedDataTable.html, /richfaces/extendedDataTable.jsf, new
editor=richInputs, Editor, /images/ico_Editor.gif, /images/cn_Editor.gif, editor.html, jbossrichfaces/freezone/docs/tlddoc/rich/editor.html, jbossrichfaces/freezone/docs/apidoc/org/richfaces/component/UIEditor.html, /richfaces/editor.jsf
queue=ajaxSupport, Queue, /images/ico_common.gif, /images/cn_Queue.gif, queue.html, jbossrichfaces/freezone/docs/tlddoc/a4j/queue.html, jbossrichfaces/freezone/docs/apidoc/org/ajax4jsf/component/UIQueue.html, /richfaces/queue.jsf
-colorPicker= richInputs, Color Picker, /images/ico_ColorPicker.gif, /images/cn_ColorPicker.gif, ColorPicker.html, jbossrichfaces/freezone/docs/tlddoc/rich/colorPicker.html, jbossrichfaces/freezone/docs/apidoc/org/richfaces/component/UIColorPicker.html, /richfaces/colorPicker.jsf, new
-layouts=richMisc, Semantic Layouts, /images/ico_SemanticLayoutComponents.gif, /images/cn_SemanticLayoutComponents.gif, Layouts.html, jbossrichfaces/freezone/docs/tlddoc/rich/Page.html, jbossrichfaces/freezone/docs/apidoc/org/richfaces/component/UIPage.html, /richfaces/layouts.jsf, new
\ No newline at end of file
+colorPicker= richInputs, Color Picker, /images/ico_ColorPicker.gif, /images/cn_ColorPicker.gif, ColorPicker.html, jbossrichfaces/freezone/docs/tlddoc/rich/colorPicker.html, jbossrichfaces/freezone/docs/apidoc/org/richfaces/component/UIColorPicker.html, /richfaces/colorPicker.jsf
+layouts=richMisc, Semantic Layouts, /images/ico_SemanticLayoutComponents.gif, /images/cn_SemanticLayoutComponents.gif, Layouts.html, jbossrichfaces/freezone/docs/tlddoc/rich/Page.html, jbossrichfaces/freezone/docs/apidoc/org/richfaces/component/UIPage.html, /richfaces/layouts.jsf
\ No newline at end of file
15 years, 5 months
JBoss Rich Faces SVN: r15067 - in branches/community/3.3.X/samples/richfaces-demo/src/main: webapp/richfaces/extendedDataTable/examples and 1 other directory.
by richfaces-svn-commits@lists.jboss.org
Author: ilya_shaikovsky
Date: 2009-07-30 12:03:53 -0400 (Thu, 30 Jul 2009)
New Revision: 15067
Modified:
branches/community/3.3.X/samples/richfaces-demo/src/main/java/org/richfaces/demo/extendedDataTable/ExtendedTableBean.java
branches/community/3.3.X/samples/richfaces-demo/src/main/webapp/richfaces/extendedDataTable/examples/simple.xhtml
Log:
https://jira.jboss.org/jira/browse/RF-7361
Modified: branches/community/3.3.X/samples/richfaces-demo/src/main/java/org/richfaces/demo/extendedDataTable/ExtendedTableBean.java
===================================================================
--- branches/community/3.3.X/samples/richfaces-demo/src/main/java/org/richfaces/demo/extendedDataTable/ExtendedTableBean.java 2009-07-30 13:59:53 UTC (rev 15066)
+++ branches/community/3.3.X/samples/richfaces-demo/src/main/java/org/richfaces/demo/extendedDataTable/ExtendedTableBean.java 2009-07-30 16:03:53 UTC (rev 15067)
@@ -4,11 +4,15 @@
package org.richfaces.demo.extendedDataTable;
import java.util.ArrayList;
+import java.util.Iterator;
import java.util.List;
import org.richfaces.demo.capitals.Capital;
+import org.richfaces.demo.datafilterslider.DemoInventoryItem;
import org.richfaces.model.DataProvider;
import org.richfaces.model.ExtendedTableDataModel;
+import org.richfaces.model.selection.Selection;
+import org.richfaces.model.selection.SimpleSelection;
/**
* @author Ilya Shaikovsky
@@ -18,8 +22,10 @@
private String sortMode="single";
private String selectionMode="multi";
private Object tableState;
+ private Selection selection = new SimpleSelection();
+ private List<Capital> capitals = new ArrayList<Capital>();
private ExtendedTableDataModel<Capital> dataModel;
- private List<Capital> capitals = new ArrayList<Capital>();
+ private List<Capital> selectedCapitals = new ArrayList<Capital>();
public String getSortMode() {
return sortMode;
@@ -40,6 +46,15 @@
public ExtendedTableBean() {
}
+ public void takeSelection(){
+ selectedCapitals.clear();
+ Iterator<Object> iterator = getSelection().getKeys();
+ while (iterator.hasNext()) {
+ Object key = iterator.next();
+ selectedCapitals.add(getCapitalsDataModel().getObjectByKey(key));
+ }
+ }
+
public ExtendedTableDataModel<Capital> getCapitalsDataModel() {
if (dataModel == null) {
dataModel = new ExtendedTableDataModel<Capital>(new DataProvider<Capital>(){
@@ -84,4 +99,20 @@
this.tableState = tableState;
}
+ public Selection getSelection() {
+ return selection;
+ }
+
+ public void setSelection(Selection selection) {
+ this.selection = selection;
+ }
+
+ public List<Capital> getSelectedCapitals() {
+ return selectedCapitals;
+ }
+
+ public void setSelectedCapitals(List<Capital> selectedCapitals) {
+ this.selectedCapitals = selectedCapitals;
+ }
+
}
Modified: branches/community/3.3.X/samples/richfaces-demo/src/main/webapp/richfaces/extendedDataTable/examples/simple.xhtml
===================================================================
--- branches/community/3.3.X/samples/richfaces-demo/src/main/webapp/richfaces/extendedDataTable/examples/simple.xhtml 2009-07-30 13:59:53 UTC (rev 15066)
+++ branches/community/3.3.X/samples/richfaces-demo/src/main/webapp/richfaces/extendedDataTable/examples/simple.xhtml 2009-07-30 16:03:53 UTC (rev 15067)
@@ -1,64 +1,97 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
- xmlns:ui="http://java.sun.com/jsf/facelets"
- xmlns:h="http://java.sun.com/jsf/html"
- xmlns:f="http://java.sun.com/jsf/core"
- xmlns:a4j="http://richfaces.org/a4j"
- xmlns:rich="http://richfaces.org/rich">
+ xmlns:ui="http://java.sun.com/jsf/facelets"
+ xmlns:h="http://java.sun.com/jsf/html"
+ xmlns:f="http://java.sun.com/jsf/core"
+ xmlns:a4j="http://richfaces.org/a4j"
+ xmlns:rich="http://richfaces.org/rich">
- <ui:composition>
- <h:form>
- <h:panelGrid columns="2" columnClasses="top,top">
- <rich:extendedDataTable value="#{extendedTableBean.capitalsDataModel}" var="cap" id="table"
- width="580px" height="400px" sortMode="#{extendedTableBean.sortMode}"
- selectionMode="#{extendedTableBean.selectionMode}" tableState="#{extendedTableBean.tableState}">
- <rich:column sortable="false" label="Flag">
- <f:facet name="header">
- <h:outputText value="Flag"/>
- </f:facet>
- <h:graphicImage value="#{cap.stateFlag}"/>
- </rich:column>
- <rich:column sortable="true" sortBy="#{cap.state}" filterBy="#{cap.state}" filterEvent="onkeyup" width="170px" label="State Name">
- <f:facet name="header">
- <h:outputText value="State Name"/>
- </f:facet>
- <h:outputText value="#{cap.state}"/>
- </rich:column>
- <rich:column sortable="true" sortBy="#{cap.name}" filterBy="#{cap.name}" filterEvent="onkeyup" width="170px" label="State Capital">
- <f:facet name="header">
- <h:outputText value="State Capital"/>
- </f:facet>
- <h:outputText value="#{cap.name}"/>
- </rich:column>
- <rich:column sortable="false" label="Time Zone">
- <f:facet name="header">
- <h:outputText value="Time Zone"/>
- </f:facet>
- <h:outputText value="#{cap.timeZone}"/>
- </rich:column>
- </rich:extendedDataTable>
- <rich:panel>
- <f:facet name="header">
- <h:outputText value="Sort/Selection modes changing"/>
- </f:facet>
- <h:panelGrid columns="2">
- <h:outputText value="Sort Mode:"/>
- <h:selectOneMenu value="#{extendedTableBean.sortMode}">
- <f:selectItem itemLabel="Single" itemValue="single"/>
- <f:selectItem itemLabel="Multi" itemValue="multi"/>
- <a4j:support event="onchange" ajaxSingle="true" reRender="table"/>
- </h:selectOneMenu>
- <h:outputText value="Selection Mode:"/>
- <h:selectOneMenu value="#{extendedTableBean.selectionMode}">
- <a4j:support ajaxSingle="true" event="onchange" reRender="table"/>
- <f:selectItem itemLabel="Single" itemValue="single"/>
- <f:selectItem itemLabel="Multi" itemValue="multi"/>
- <f:selectItem itemLabel="None" itemValue="none"/>
- </h:selectOneMenu>
- </h:panelGrid>
- </rich:panel>
+<ui:composition>
+ <h:form>
+ <h:panelGrid columns="2" columnClasses="top , top">
+ <rich:extendedDataTable
+ value="#{extendedTableBean.capitalsDataModel}" var="cap" id="table"
+ width="580px" height="400px"
+ sortMode="#{extendedTableBean.sortMode}"
+ selectionMode="#{extendedTableBean.selectionMode}"
+ tableState="#{extendedTableBean.tableState}"
+ selection="#{extendedTableBean.selection}">
+ <rich:column sortable="false" label="Flag">
+ <f:facet name="header">
+ <h:outputText value="Flag" />
+ </f:facet>
+ <h:graphicImage value="#{cap.stateFlag}" />
+ </rich:column>
+ <rich:column sortable="true" sortBy="#{cap.state}"
+ filterBy="#{cap.state}" filterEvent="onkeyup" width="170px"
+ label="State Name">
+ <f:facet name="header">
+ <h:outputText value="State Name" />
+ </f:facet>
+ <h:outputText value="#{cap.state}" />
+ </rich:column>
+ <rich:column sortable="true" sortBy="#{cap.name}"
+ filterBy="#{cap.name}" filterEvent="onkeyup" width="170px"
+ label="State Capital">
+ <f:facet name="header">
+ <h:outputText value="State Capital" />
+ </f:facet>
+ <h:outputText value="#{cap.name}" />
+ </rich:column>
+ <rich:column sortable="false" label="Time Zone">
+ <f:facet name="header">
+ <h:outputText value="Time Zone" />
+ </f:facet>
+ <h:outputText value="#{cap.timeZone}" />
+ </rich:column>
+ <a4j:support reRender="selectiontable"
+ action="#{extendedTableBean.takeSelection}"
+ event="onselectionchange" />
+ </rich:extendedDataTable>
+ <h:panelGroup layout="block" style="width:250px">
+ <rich:panel>
+ <f:facet name="header">
+ <h:outputText value="Sort/Selection modes changing" />
+ </f:facet>
+ <h:panelGrid columns="2">
+ <h:outputText value="Sort Mode:" />
+ <h:selectOneMenu value="#{extendedTableBean.sortMode}">
+ <f:selectItem itemLabel="Single" itemValue="single" />
+ <f:selectItem itemLabel="Multi" itemValue="multi" />
+ <a4j:support event="onchange" ajaxSingle="true" reRender="table" />
+ </h:selectOneMenu>
+ <h:outputText value="Selection Mode:" />
+ <h:selectOneMenu value="#{extendedTableBean.selectionMode}">
+ <a4j:support ajaxSingle="true" event="onchange" reRender="table" />
+ <f:selectItem itemLabel="Single" itemValue="single" />
+ <f:selectItem itemLabel="Multi" itemValue="multi" />
+ <f:selectItem itemLabel="None" itemValue="none" />
+ </h:selectOneMenu>
+ </h:panelGrid>
+ </rich:panel>
+ <rich:panel>
+ <f:facet name="header">
+ <h:outputText value="Currently selected rows:" />
+ </f:facet>
+ <rich:dataTable value="#{extendedTableBean.selectedCapitals}"
+ var="sel" id="selectiontable">
+ <rich:column>
+ <h:graphicImage value="#{sel.stateFlag}" />
+ </rich:column>
+ <rich:column>
+ <h:outputText value="#{sel.state}" />
+ </rich:column>
+ <rich:column>
+ <h:outputText value="#{sel.name}" />
+ </rich:column>
+ <rich:column>
+ <h:outputText value="#{sel.timeZone}" />
+ </rich:column>
+ </rich:dataTable>
+ </rich:panel>
+ </h:panelGroup>
</h:panelGrid>
- </h:form>
- </ui:composition>
+ </h:form>
+</ui:composition>
</html>
\ No newline at end of file
15 years, 5 months