[richfaces-svn-commits] JBoss Rich Faces SVN: r2118 - in trunk: framework/impl/src/main/java/org/ajax4jsf/component and 1 other directories.
richfaces-svn-commits at lists.jboss.org
richfaces-svn-commits at lists.jboss.org
Tue Aug 7 15:15:02 EDT 2007
Author: alexsmirnov
Date: 2007-08-07 15:15:02 -0400 (Tue, 07 Aug 2007)
New Revision: 2118
Added:
trunk/framework/impl/src/main/java/org/ajax4jsf/component/EventValueBinding.java
Removed:
trunk/ui/core/src/main/java/org/ajax4jsf/component/EventValueBinding.java
Modified:
trunk/framework/api/src/main/java/org/ajax4jsf/component/AjaxSupport.java
trunk/ui/core/src/main/java/org/ajax4jsf/component/UIAjaxSupport.java
Log:
Move ajaxSupport common classet to impl
Modified: trunk/framework/api/src/main/java/org/ajax4jsf/component/AjaxSupport.java
===================================================================
--- trunk/framework/api/src/main/java/org/ajax4jsf/component/AjaxSupport.java 2007-08-07 19:11:20 UTC (rev 2117)
+++ trunk/framework/api/src/main/java/org/ajax4jsf/component/AjaxSupport.java 2007-08-07 19:15:02 UTC (rev 2118)
@@ -30,7 +30,7 @@
* @version $Revision: 1.1.2.1 $ $Date: 2007/01/09 18:57:34 $
*
*/
-public interface AjaxSupport extends AjaxComponent {
+public interface AjaxSupport {
/**
* @return JavaScript eventString. Rebuild on every call, since
Copied: trunk/framework/impl/src/main/java/org/ajax4jsf/component/EventValueBinding.java (from rev 2114, trunk/ui/core/src/main/java/org/ajax4jsf/component/EventValueBinding.java)
===================================================================
--- trunk/framework/impl/src/main/java/org/ajax4jsf/component/EventValueBinding.java (rev 0)
+++ trunk/framework/impl/src/main/java/org/ajax4jsf/component/EventValueBinding.java 2007-08-07 19:15:02 UTC (rev 2118)
@@ -0,0 +1,208 @@
+/**
+ * License Agreement.
+ *
+ * Ajax4jsf 1.1 - 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.StateHolder;
+import javax.faces.component.UIComponent;
+import javax.faces.context.FacesContext;
+import javax.faces.el.EvaluationException;
+import javax.faces.el.PropertyNotFoundException;
+import javax.faces.el.ValueBinding;
+
+import org.ajax4jsf.Messages;
+import org.ajax4jsf.component.AjaxComponent;
+import org.ajax4jsf.component.AjaxSupport;
+import org.ajax4jsf.renderkit.AjaxRendererUtils;
+
+/**
+ * Inner class for build event string for parent component.
+ *
+ * @author shura (latest modification by $Author: alexsmirnov $)
+ * @version $Revision: 1.1.2.1 $ $Date: 2007/01/09 18:57:38 $ Disadvantages -
+ * not rebuild event string setted as EL expression. TODO - save
+ * expressions for build event string at render phase.
+ */
+public class EventValueBinding extends ValueBinding implements StateHolder {
+
+ /**
+ *
+ */
+ private static final long serialVersionUID = -6583167387542332290L;
+
+ private String _componentId;
+
+ /**
+ * current update component. transient since saved state as component.
+ */
+ transient private AjaxSupport _component = null;
+
+ /**
+ * Default constructor for restoreState.
+ */
+ public EventValueBinding() {
+
+ }
+
+ /**
+ * Constructor for build from AjaxComponent.
+ *
+ * @param update
+ */
+ public EventValueBinding(AjaxSupport update) {
+ _component = update;
+ // _componentId = string;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see javax.faces.el.ValueBinding#getType(javax.faces.context.FacesContext)
+ */
+ public Class getType(FacesContext facesContext) throws EvaluationException,
+ PropertyNotFoundException {
+
+ return String.class;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see javax.faces.el.ValueBinding#getValue(javax.faces.context.FacesContext)
+ */
+ public Object getValue(FacesContext facesContext)
+ throws EvaluationException, PropertyNotFoundException {
+ if (((UIComponent) getComponent(facesContext)).isRendered()) {
+ return getComponent(facesContext).getEventString();
+
+ } else {
+ return null;
+ }
+ }
+
+ private AjaxSupport getComponent(FacesContext facesContext)
+ throws EvaluationException {
+
+ if (_component == null) {
+ UIComponent uiComponent = facesContext.getViewRoot().findComponent(
+ _componentId);
+ if (null != uiComponent && uiComponent instanceof AjaxComponent) {
+ _component = (AjaxSupport) uiComponent;
+ } else {
+ throw new EvaluationException(Messages.getMessage(
+ Messages.COMPONENT_NOT_FOUND, _componentId));
+ }
+
+ }
+
+ return _component;
+ }
+
+ /**
+ * @param component
+ * the component to set
+ */
+ public void setComponent(AjaxSupport component) {
+ _component = component;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see javax.faces.el.ValueBinding#isReadOnly(javax.faces.context.FacesContext)
+ */
+ public boolean isReadOnly(FacesContext facesContext)
+ throws EvaluationException, PropertyNotFoundException {
+ // TODO Auto-generated method stub
+ return true;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see javax.faces.el.ValueBinding#setValue(javax.faces.context.FacesContext,
+ * java.lang.Object)
+ */
+ public void setValue(FacesContext facesContext, Object value)
+ throws EvaluationException, PropertyNotFoundException {
+ throw new EvaluationException(Messages
+ .getMessage(Messages.EVENT_IS_READ_ONLY));
+
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see javax.faces.component.StateHolder#saveState(javax.faces.context.FacesContext)
+ */
+ public Object saveState(FacesContext context) {
+ if (null == _component) {
+ return _componentId;
+ } else {
+ return AjaxRendererUtils
+ .getAbsoluteId((UIComponent) getComponent(context));
+ }
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see javax.faces.component.StateHolder#restoreState(javax.faces.context.FacesContext,
+ * java.lang.Object)
+ */
+ public void restoreState(FacesContext context, Object state) {
+ // TODO Auto-generated method stub
+ _componentId = (String) state;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see javax.faces.component.StateHolder#isTransient()
+ */
+ public boolean isTransient() {
+ // TODO Auto-generated method stub
+ return false;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see javax.faces.component.StateHolder#setTransient(boolean)
+ */
+ public void setTransient(boolean newTransientValue) {
+ // TODO Auto-generated method stub
+
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see javax.faces.el.ValueBinding#getExpressionString()
+ */
+ public String getExpressionString() {
+ // FacesContext context = FacesContext.getCurrentInstance();
+ // UIComponent component = (UIComponent) getComponent(context);
+ // return "#{ajaxSupport["+component.getClientId(context)+"]}";
+ return null;
+ }
+
+}
\ No newline at end of file
Deleted: trunk/ui/core/src/main/java/org/ajax4jsf/component/EventValueBinding.java
===================================================================
--- trunk/ui/core/src/main/java/org/ajax4jsf/component/EventValueBinding.java 2007-08-07 19:11:20 UTC (rev 2117)
+++ trunk/ui/core/src/main/java/org/ajax4jsf/component/EventValueBinding.java 2007-08-07 19:15:02 UTC (rev 2118)
@@ -1,208 +0,0 @@
-/**
- * License Agreement.
- *
- * Ajax4jsf 1.1 - 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.StateHolder;
-import javax.faces.component.UIComponent;
-import javax.faces.context.FacesContext;
-import javax.faces.el.EvaluationException;
-import javax.faces.el.PropertyNotFoundException;
-import javax.faces.el.ValueBinding;
-
-import org.ajax4jsf.Messages;
-import org.ajax4jsf.component.AjaxComponent;
-import org.ajax4jsf.component.AjaxSupport;
-import org.ajax4jsf.renderkit.AjaxRendererUtils;
-
-/**
- * Inner class for build event string for parent component.
- *
- * @author shura (latest modification by $Author: alexsmirnov $)
- * @version $Revision: 1.1.2.1 $ $Date: 2007/01/09 18:57:38 $ Disadvantages -
- * not rebuild event string setted as EL expression. TODO - save
- * expressions for build event string at render phase.
- */
-public class EventValueBinding extends ValueBinding implements StateHolder {
-
- /**
- *
- */
- private static final long serialVersionUID = -6583167387542332290L;
-
- private String _componentId;
-
- /**
- * current update component. transient since saved state as component.
- */
- transient private AjaxSupport _component = null;
-
- /**
- * Default constructor for restoreState.
- */
- public EventValueBinding() {
-
- }
-
- /**
- * Constructor for build from AjaxComponent.
- *
- * @param update
- */
- public EventValueBinding(AjaxSupport update) {
- _component = update;
- // _componentId = string;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see javax.faces.el.ValueBinding#getType(javax.faces.context.FacesContext)
- */
- public Class getType(FacesContext facesContext) throws EvaluationException,
- PropertyNotFoundException {
-
- return String.class;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see javax.faces.el.ValueBinding#getValue(javax.faces.context.FacesContext)
- */
- public Object getValue(FacesContext facesContext)
- throws EvaluationException, PropertyNotFoundException {
- if (((UIComponent) getComponent(facesContext)).isRendered()) {
- return getComponent(facesContext).getEventString();
-
- } else {
- return null;
- }
- }
-
- private AjaxSupport getComponent(FacesContext facesContext)
- throws EvaluationException {
-
- if (_component == null) {
- UIComponent uiComponent = facesContext.getViewRoot().findComponent(
- _componentId);
- if (null != uiComponent && uiComponent instanceof AjaxComponent) {
- _component = (AjaxSupport) uiComponent;
- } else {
- throw new EvaluationException(Messages.getMessage(
- Messages.COMPONENT_NOT_FOUND, _componentId));
- }
-
- }
-
- return _component;
- }
-
- /**
- * @param component
- * the component to set
- */
- public void setComponent(AjaxSupport component) {
- _component = component;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see javax.faces.el.ValueBinding#isReadOnly(javax.faces.context.FacesContext)
- */
- public boolean isReadOnly(FacesContext facesContext)
- throws EvaluationException, PropertyNotFoundException {
- // TODO Auto-generated method stub
- return true;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see javax.faces.el.ValueBinding#setValue(javax.faces.context.FacesContext,
- * java.lang.Object)
- */
- public void setValue(FacesContext facesContext, Object value)
- throws EvaluationException, PropertyNotFoundException {
- throw new EvaluationException(Messages
- .getMessage(Messages.EVENT_IS_READ_ONLY));
-
- }
-
- /*
- * (non-Javadoc)
- *
- * @see javax.faces.component.StateHolder#saveState(javax.faces.context.FacesContext)
- */
- public Object saveState(FacesContext context) {
- if (null == _component) {
- return _componentId;
- } else {
- return AjaxRendererUtils
- .getAbsoluteId((UIComponent) getComponent(context));
- }
- }
-
- /*
- * (non-Javadoc)
- *
- * @see javax.faces.component.StateHolder#restoreState(javax.faces.context.FacesContext,
- * java.lang.Object)
- */
- public void restoreState(FacesContext context, Object state) {
- // TODO Auto-generated method stub
- _componentId = (String) state;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see javax.faces.component.StateHolder#isTransient()
- */
- public boolean isTransient() {
- // TODO Auto-generated method stub
- return false;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see javax.faces.component.StateHolder#setTransient(boolean)
- */
- public void setTransient(boolean newTransientValue) {
- // TODO Auto-generated method stub
-
- }
-
- /*
- * (non-Javadoc)
- *
- * @see javax.faces.el.ValueBinding#getExpressionString()
- */
- public String getExpressionString() {
- // FacesContext context = FacesContext.getCurrentInstance();
- // UIComponent component = (UIComponent) getComponent(context);
- // return "#{ajaxSupport["+component.getClientId(context)+"]}";
- return null;
- }
-
-}
\ No newline at end of file
Modified: trunk/ui/core/src/main/java/org/ajax4jsf/component/UIAjaxSupport.java
===================================================================
--- trunk/ui/core/src/main/java/org/ajax4jsf/component/UIAjaxSupport.java 2007-08-07 19:11:20 UTC (rev 2117)
+++ trunk/ui/core/src/main/java/org/ajax4jsf/component/UIAjaxSupport.java 2007-08-07 19:15:02 UTC (rev 2118)
@@ -151,63 +151,6 @@
public void setParentProperties(UIComponent parent) {
ValueBinding valueBinding;
-// Map parentAttributes = parent.getAttributes();
-/* if (parent instanceof ActionSource && null == getEvent())
- {
- log.debug("Set properties for parent as ActionSource");
- // Translate AJAX properties to parent component.
- if (_reRender != null)
- {
- parentAttributes
- .put(AjaxRendererUtils.AJAX_REGIONS_ATTRIBUTE,
- _reRender);
- }
- else if ((valueBinding = getValueBinding("reRender")) != null)
- {
- parent.setValueBinding(
- AjaxRendererUtils.AJAX_REGIONS_ATTRIBUTE,
- valueBinding);
- }
- if (_oncomplete != null)
- {
- parentAttributes
- .put(AjaxRendererUtils.ONCOMPLETE_ATTR_NAME,
- _oncomplete);
- }
- else if ((valueBinding = getValueBinding("oncomplete")) != null)
- {
- parent.setValueBinding(
- AjaxRendererUtils.ONCOMPLETE_ATTR_NAME,
- valueBinding);
- }
- if (_status != null)
- {
- parentAttributes.put(AjaxRendererUtils.STATUS_ATTR_NAME,
- _status);
- }
- else if ((valueBinding = getValueBinding("status")) != null)
- {
- parent.setValueBinding(AjaxRendererUtils.STATUS_ATTR_NAME,
- valueBinding);
- }
- if (_limitToListSet)
- {
- parentAttributes.put(
- AjaxRendererUtils.LIMITTOLIST_ATTR_NAME, Boolean
- .valueOf(_limitToList));
- }
- else if ((valueBinding = getValueBinding("limitToList")) != null)
- {
- parent.setValueBinding(
- AjaxRendererUtils.LIMITTOLIST_ATTR_NAME,
- valueBinding);
- }
- // Add Listener for all supported types.
- AjaxRegionListener listener = new AjaxRegionListener();
- ((ActionSource) parent).addActionListener(listener);
- }
- else*/ if (null != getEvent())
- {
if (log.isDebugEnabled())
{
log.debug(Messages.getMessage(Messages.SET_VALUE_BINDING_FOR_EVENT, getEvent()));
@@ -217,8 +160,6 @@
// test for valid event attribute name.
// TODO - test for compability with concrete element.
parent.setValueBinding(getEvent(), valueBinding);
- }
-
}
protected UIComponent getSingleComponent() {
More information about the richfaces-svn-commits
mailing list