Author: vbaranov
Date: 2008-04-24 07:55:55 -0400 (Thu, 24 Apr 2008)
New Revision: 8114
Added:
trunk/ui/dataFilterSlider/src/main/java/org/richfaces/taglib/DataFilterSliderTagBase.java
Modified:
trunk/ui/dataFilterSlider/src/main/config/component/dataFilterSlider.xml
trunk/ui/dataFilterSlider/src/main/java/org/richfaces/component/UIDataFltrSlider.java
trunk/ui/dataFilterSlider/src/main/java/org/richfaces/taglib/DataFilterSliderListenerTagHandler.java
Log:
http://jira.jboss.com/jira/browse/RF-2801
Modified: trunk/ui/dataFilterSlider/src/main/config/component/dataFilterSlider.xml
===================================================================
--- trunk/ui/dataFilterSlider/src/main/config/component/dataFilterSlider.xml 2008-04-24
11:49:59 UTC (rev 8113)
+++ trunk/ui/dataFilterSlider/src/main/config/component/dataFilterSlider.xml 2008-04-24
11:55:55 UTC (rev 8114)
@@ -22,9 +22,7 @@
<tag>
<name>dataFilterSlider</name>
<classname>org.richfaces.taglib.DataFilterSliderTag</classname>
- <superclass>
- org.ajax4jsf.webapp.taglib.HtmlComponentTagBase
- </superclass>
+
<superclass>org.richfaces.taglib.DataFilterSliderTagBase</superclass>
<test/>
</tag>
<taghandler generate="true">
@@ -206,9 +204,16 @@
<property>
<name>onSlideSubmit</name>
<classname>boolean</classname>
- <description>If the slider value changes must submit a form,
onSlideSubmit can be true</description>
+ <description>DEPRECATED(use submitOnSlide). If the slider value changes
must submit a form. Default value is true.</description>
<defaultvalue>true</defaultvalue>
</property>
+
+ <property>
+ <name>submitOnSlide</name>
+ <classname>boolean</classname>
+ <description>If the slider value changes must submit a form. Default value
is true.</description>
+ <defaultvalue>true</defaultvalue>
+ </property>
<property>
<name>storeResults</name>
Modified:
trunk/ui/dataFilterSlider/src/main/java/org/richfaces/component/UIDataFltrSlider.java
===================================================================
---
trunk/ui/dataFilterSlider/src/main/java/org/richfaces/component/UIDataFltrSlider.java 2008-04-24
11:49:59 UTC (rev 8113)
+++
trunk/ui/dataFilterSlider/src/main/java/org/richfaces/component/UIDataFltrSlider.java 2008-04-24
11:55:55 UTC (rev 8114)
@@ -28,17 +28,14 @@
import javax.faces.component.UICommand;
import javax.faces.component.UIComponent;
-import javax.faces.component.UIComponentBase;
import javax.faces.component.UIData;
import javax.faces.context.FacesContext;
import javax.faces.el.MethodBinding;
import javax.faces.event.AbortProcessingException;
import javax.faces.event.FacesEvent;
-import javax.faces.event.PhaseId;
import javax.faces.model.ListDataModel;
import org.ajax4jsf.component.AjaxComponent;
-import org.ajax4jsf.event.AjaxEvent;
import org.ajax4jsf.renderkit.AjaxRendererUtils;
import org.ajax4jsf.renderkit.RendererUtils;
import org.richfaces.event.DataFilterSliderAdapter;
@@ -118,7 +115,7 @@
_active = active;
}
- private Map getSession() {
+ private Map<String, Object> getSession() {
return getFacesContext().getExternalContext().getSessionMap();
}
@@ -259,10 +256,16 @@
public abstract void setTrackStyleClass(String trackStyleClass);
+ @Deprecated
public abstract boolean isOnSlideSubmit();
+ @Deprecated
public abstract void setOnSlideSubmit(boolean value);
+ public abstract boolean isSubmitOnSlide();
+
+ public abstract void setSubmitOnSlide(boolean value);
+
public abstract boolean isStoreResults();
public abstract void setStoreResults(boolean storeResults);
Modified:
trunk/ui/dataFilterSlider/src/main/java/org/richfaces/taglib/DataFilterSliderListenerTagHandler.java
===================================================================
---
trunk/ui/dataFilterSlider/src/main/java/org/richfaces/taglib/DataFilterSliderListenerTagHandler.java 2008-04-24
11:49:59 UTC (rev 8113)
+++
trunk/ui/dataFilterSlider/src/main/java/org/richfaces/taglib/DataFilterSliderListenerTagHandler.java 2008-04-24
11:55:55 UTC (rev 8114)
@@ -22,6 +22,7 @@
package org.richfaces.taglib;
import javax.faces.component.UIComponent;
+import javax.faces.context.FacesContext;
import javax.faces.el.MethodBinding;
import org.richfaces.event.DataFilterSliderEvent;
@@ -32,6 +33,7 @@
import com.sun.facelets.tag.Metadata;
import com.sun.facelets.tag.MetadataTarget;
import com.sun.facelets.tag.TagAttribute;
+import com.sun.facelets.tag.TagAttributes;
import com.sun.facelets.tag.jsf.ComponentConfig;
import com.sun.facelets.tag.jsf.ComponentHandler;
@@ -39,30 +41,44 @@
public class DataFilterSliderListenerTagHandler extends ComponentHandler {
private final static String SLIDER_LISTENER = "sliderListener";
-
public DataFilterSliderListenerTagHandler(ComponentConfig config) {
- super(config);
+ super(config);
}
protected MetaRuleset createMetaRuleset(Class clazz) {
- MetaRuleset ruleset = super.createMetaRuleset(clazz);
+ TagAttributes attributes = this.tag.getAttributes();
+ TagAttribute attribute = attributes.get("onSlideSubmit");
+ if ((attribute != null) && (attributes.get("submitOnSlide") != null))
{
+ TagAttribute idAttribute = attributes.get("id");
+ StringBuilder builder = new StringBuilder();
+ builder.append("submitOnSlide attribute has been already set for component with
id=");
+ builder.append(idAttribute != null ? idAttribute.getValue() : null);
+ builder.append(": [").append(attribute.getValue()).append("].
");
+ builder.append("Attribute onSlideSubmit is deprecated and thus has been
dropped!");
- ruleset.addRule(new MetaRule() {
+ FacesContext.getCurrentInstance().getExternalContext().log(builder.toString());
+ }
- public Metadata applyRule(String name, final TagAttribute attribute,
MetadataTarget metadataTarget) {
- if (SLIDER_LISTENER.equals(name)) {
- return new Metadata() {
- public void applyMetadata(FaceletContext context, Object object)
{
- MethodBinding binding =
context.getFacesContext().getApplication().createMethodBinding(attribute.getValue(), new
Class[] {DataFilterSliderEvent.class});
- ((UIComponent) object).getAttributes().put(SLIDER_LISTENER,
binding);
- }
- };
- }
- return null;
- }
- });
+ MetaRuleset ruleset = super.createMetaRuleset(clazz);
+ ruleset.alias("submitOnSlide", "onSlideSubmit");
- return ruleset;
+ ruleset.addRule(new MetaRule() {
+
+ public Metadata applyRule(String name, final TagAttribute attribute, MetadataTarget
metadataTarget) {
+ if (SLIDER_LISTENER.equals(name)) {
+ return new Metadata() {
+ public void applyMetadata(FaceletContext context, Object object) {
+ MethodBinding binding =
context.getFacesContext().getApplication().createMethodBinding(
+ attribute.getValue(), new Class[] { DataFilterSliderEvent.class });
+ ((UIComponent) object).getAttributes().put(SLIDER_LISTENER, binding);
+ }
+ };
+ }
+ return null;
+ }
+ });
+
+ return ruleset;
}
}
Added:
trunk/ui/dataFilterSlider/src/main/java/org/richfaces/taglib/DataFilterSliderTagBase.java
===================================================================
---
trunk/ui/dataFilterSlider/src/main/java/org/richfaces/taglib/DataFilterSliderTagBase.java
(rev 0)
+++
trunk/ui/dataFilterSlider/src/main/java/org/richfaces/taglib/DataFilterSliderTagBase.java 2008-04-24
11:55:55 UTC (rev 8114)
@@ -0,0 +1,97 @@
+package org.richfaces.taglib;
+
+import javax.el.ELException;
+import javax.el.ValueExpression;
+import javax.faces.FacesException;
+import javax.faces.component.UIComponent;
+import javax.faces.context.FacesContext;
+
+import org.ajax4jsf.webapp.taglib.HtmlComponentTagBase;
+import org.richfaces.component.UIDataFltrSlider;
+
+public abstract class DataFilterSliderTagBase extends HtmlComponentTagBase {
+
+ /**
+ * Constant String message
+ */
+ private static String ATTRIBUTE_DEPRECATION_MESSAGE = "Attribute onSlideSubmit
is deprecated!";
+
+ /**
+ * Flag indicating that attribute 'onSlideSubmit' has already been set
+ */
+ private boolean isSubmitOnSlideSet = false;
+
+ /*
+ * submitOnSlide If the slider value changes must submit a form. Default
+ * value is true.
+ */
+ private ValueExpression _submitOnSlide = null;
+
+ /**
+ * DEPRECATED(use submitOnSlide). If the slider value changes must submit a
+ * form. Default value is true. Setter for onSlideSubmit
+ *
+ * @param onSlideSubmit - new value
+ */
+ public void setOnSlideSubmit(ValueExpression onSlideSubmit) {
+ FacesContext.getCurrentInstance().getExternalContext().log(ATTRIBUTE_DEPRECATION_MESSAGE);
+ if (!isSubmitOnSlideSet && (_submitOnSlide != null)) {
+ logValueDeprecation(_submitOnSlide);
+ }
+ this._submitOnSlide = onSlideSubmit;
+ isSubmitOnSlideSet = true;
+ }
+
+ /**
+ * If the slider value changes must submit a form. Default value is true.
+ * Setter for submitOnSlide
+ *
+ * @param submitOnSlide - new value
+ */
+ public void setSubmitOnSlide(ValueExpression submitOnSlide) {
+ if (!isSubmitOnSlideSet) {
+ this._submitOnSlide = submitOnSlide;
+ } else {
+ logValueDeprecation(this._submitOnSlide);
+ }
+
+ }
+
+ private void logValueDeprecation(ValueExpression value) {
+ StringBuilder builder = new StringBuilder();
+ builder.append("submitOnSlide attribute has been already set for DataFilterSlider
component with id=");
+ builder.append(this.getId());
+ builder.append(": [").append(value.getExpressionString()).append("].
");
+ builder.append(ATTRIBUTE_DEPRECATION_MESSAGE);
+
+ FacesContext.getCurrentInstance().getExternalContext().log(builder.toString());
+ }
+
+ protected void setProperties(UIComponent component) {
+ super.setProperties(component);
+
+ if (this._submitOnSlide != null) {
+ if (this._submitOnSlide.isLiteralText()) {
+ UIDataFltrSlider filterSlider = (UIDataFltrSlider) component;
+ try {
+ Boolean __onSlideSubmit = (Boolean)
getFacesContext().getApplication().getExpressionFactory()
+ .coerceToType(this._submitOnSlide.getExpressionString(), Boolean.class);
+
+ filterSlider.setSubmitOnSlide(__onSlideSubmit.booleanValue());
+ } catch (ELException e) {
+ throw new FacesException(e);
+ }
+ } else {
+ component.setValueExpression("onSlideSubmit", this._submitOnSlide);
+ }
+ }
+
+ }
+
+ public void release() {
+ super.release();
+ isSubmitOnSlideSet = false;
+ _submitOnSlide = null;
+ }
+
+}
Property changes on:
trunk/ui/dataFilterSlider/src/main/java/org/richfaces/taglib/DataFilterSliderTagBase.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Name: svn:keywords
+ Author Id Revision Date
Name: svn:eol-style
+ native