JBoss Rich Faces SVN: r20194 - trunk/ui/input/ui/src/main/java/org/richfaces/view/facelets.
by richfaces-svn-commits@lists.jboss.org
Author: abelevich
Date: 2010-11-26 13:49:44 -0500 (Fri, 26 Nov 2010)
New Revision: 20194
Removed:
trunk/ui/input/ui/src/main/java/org/richfaces/view/facelets/html/
Modified:
trunk/ui/input/ui/src/main/java/org/richfaces/view/facelets/AutocompleteHandler.java
trunk/ui/input/ui/src/main/java/org/richfaces/view/facelets/CalendarHandler.java
Log:
fix packages, remove unn package
Modified: trunk/ui/input/ui/src/main/java/org/richfaces/view/facelets/AutocompleteHandler.java
===================================================================
--- trunk/ui/input/ui/src/main/java/org/richfaces/view/facelets/AutocompleteHandler.java 2010-11-26 18:47:16 UTC (rev 20193)
+++ trunk/ui/input/ui/src/main/java/org/richfaces/view/facelets/AutocompleteHandler.java 2010-11-26 18:49:44 UTC (rev 20194)
@@ -19,7 +19,7 @@
* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
*/
-package org.richfaces.view.facelets.html;
+package org.richfaces.view.facelets;
import javax.el.ValueExpression;
import javax.faces.component.UIComponent;
Modified: trunk/ui/input/ui/src/main/java/org/richfaces/view/facelets/CalendarHandler.java
===================================================================
--- trunk/ui/input/ui/src/main/java/org/richfaces/view/facelets/CalendarHandler.java 2010-11-26 18:47:16 UTC (rev 20193)
+++ trunk/ui/input/ui/src/main/java/org/richfaces/view/facelets/CalendarHandler.java 2010-11-26 18:49:44 UTC (rev 20194)
@@ -21,7 +21,7 @@
*/
-package org.richfaces.view.facelets.html;
+package org.richfaces.view.facelets;
import javax.faces.view.facelets.ComponentConfig;
import javax.faces.view.facelets.ComponentHandler;
14 years, 1 month
JBoss Rich Faces SVN: r20193 - trunk/ui/input/api/src/main/java/org/richfaces/event.
by richfaces-svn-commits@lists.jboss.org
Author: abelevich
Date: 2010-11-26 13:47:16 -0500 (Fri, 26 Nov 2010)
New Revision: 20193
Added:
trunk/ui/input/api/src/main/java/org/richfaces/event/MethodExpressionCurrentDateChangeListener.java
Log:
move class from impl
Copied: trunk/ui/input/api/src/main/java/org/richfaces/event/MethodExpressionCurrentDateChangeListener.java (from rev 20190, trunk/ui/input/ui/src/main/java/org/richfaces/taglib/MethodExpressionCurrentDateChangeListener.java)
===================================================================
--- trunk/ui/input/api/src/main/java/org/richfaces/event/MethodExpressionCurrentDateChangeListener.java (rev 0)
+++ trunk/ui/input/api/src/main/java/org/richfaces/event/MethodExpressionCurrentDateChangeListener.java 2010-11-26 18:47:16 UTC (rev 20193)
@@ -0,0 +1,52 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright ${year}, Red Hat, Inc. and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+
+package org.richfaces.taglib;
+
+import javax.el.MethodExpression;
+import javax.faces.context.FacesContext;
+
+import org.richfaces.event.CurrentDateChangeEvent;
+import org.richfaces.event.CurrentDateChangeListener;
+
+/**
+ * @author amarkhel
+ *
+ */
+public class MethodExpressionCurrentDateChangeListener implements CurrentDateChangeListener {
+
+ private MethodExpression methodExpression;
+
+ public MethodExpressionCurrentDateChangeListener() {
+ super();
+ }
+
+ public MethodExpressionCurrentDateChangeListener(MethodExpression methodExpression) {
+ super();
+ this.methodExpression = methodExpression;
+ }
+
+ public void processCurrentDateChange(CurrentDateChangeEvent event) {
+ FacesContext facesContext = FacesContext.getCurrentInstance();
+ methodExpression.invoke(facesContext.getELContext(), new Object[] { event });
+ }
+}
14 years, 1 month
JBoss Rich Faces SVN: r20192 - in trunk/ui/input/ui/src/main/java/org/richfaces/view/facelets: html and 1 other directory.
by richfaces-svn-commits@lists.jboss.org
Author: abelevich
Date: 2010-11-26 13:42:29 -0500 (Fri, 26 Nov 2010)
New Revision: 20192
Added:
trunk/ui/input/ui/src/main/java/org/richfaces/view/facelets/AutocompleteHandler.java
trunk/ui/input/ui/src/main/java/org/richfaces/view/facelets/CalendarHandler.java
Removed:
trunk/ui/input/ui/src/main/java/org/richfaces/view/facelets/html/AutocompleteHandler.java
trunk/ui/input/ui/src/main/java/org/richfaces/view/facelets/html/CalendarHandler.java
Log:
move
Copied: trunk/ui/input/ui/src/main/java/org/richfaces/view/facelets/AutocompleteHandler.java (from rev 20191, trunk/ui/input/ui/src/main/java/org/richfaces/view/facelets/html/AutocompleteHandler.java)
===================================================================
--- trunk/ui/input/ui/src/main/java/org/richfaces/view/facelets/AutocompleteHandler.java (rev 0)
+++ trunk/ui/input/ui/src/main/java/org/richfaces/view/facelets/AutocompleteHandler.java 2010-11-26 18:42:29 UTC (rev 20192)
@@ -0,0 +1,143 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc. and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.richfaces.view.facelets.html;
+
+import javax.el.ValueExpression;
+import javax.faces.component.UIComponent;
+import javax.faces.context.FacesContext;
+import javax.faces.convert.Converter;
+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.richfaces.component.AbstractAutocomplete;
+
+/**
+ * @author Nick Belaevski
+ */
+//TODO nick - this should be generated by CDK
+public class AutocompleteHandler extends ComponentHandler {
+
+ private static final MetaRule AUTOCOMPLETE_METHOD_META_RULE = new MetaRule() {
+
+ @Override
+ public Metadata applyRule(String name, TagAttribute attribute,
+ MetadataTarget meta) {
+ if (meta.isTargetInstanceOf(AbstractAutocomplete.class)) {
+ if ("autocompleteMethod".equals(name)) {
+ return new MethodMetadata(attribute, FacesContext.class,
+ UIComponent.class, String.class) {
+ public void applyMetadata(FaceletContext ctx, Object instance) {
+ ((AbstractAutocomplete) instance).setAutocompleteMethod(getMethodExpression(ctx));
+ }
+ };
+ }
+
+ if ("converter".equals(name)) {
+ return new ConverterMetadata(attribute) {
+ public void applyMetadata(FaceletContext ctx, Object instance) {
+ ((AbstractAutocomplete) instance).setConverter(this.getConverter(ctx,
+ (AbstractAutocomplete) instance,
+ this.getAttr().getValueExpression(ctx, Converter.class)));
+ }
+ };
+ }
+
+ if ("itemConverter".equals(name)) {
+ return new ConverterMetadata(attribute) {
+ public void applyMetadata(FaceletContext ctx, Object instance) {
+ ((AbstractAutocomplete) instance).setItemConverter(this.getConverter(ctx,
+ (AbstractAutocomplete) instance,
+ this.getAttr().getValueExpression(ctx, Converter.class)));
+ }
+ };
+ }
+
+ }
+
+ return null;
+ }
+ };
+
+ public AutocompleteHandler(ComponentConfig config) {
+ super(config);
+ }
+
+ @Override
+ protected MetaRuleset createMetaRuleset(Class type) {
+ MetaRuleset metaRuleset = super.createMetaRuleset(type);
+ metaRuleset.addRule(AUTOCOMPLETE_METHOD_META_RULE);
+ return metaRuleset;
+ }
+
+ abstract static class ConverterMetadata extends Metadata {
+
+ private final TagAttribute attr;
+
+ public ConverterMetadata(TagAttribute attr) {
+ this.attr = attr;
+ }
+
+ public TagAttribute getAttr() {
+ return attr;
+ }
+
+ public Converter getConverter(FaceletContext ctx,
+ AbstractAutocomplete component, ValueExpression converter) {
+ ValueExpression ve = null;
+ Converter c = null;
+ if (converter != null) {
+ ve = converter;
+ try {
+ c = (Converter) ve.getValue(ctx);
+ } catch (Exception e) {
+ // ok
+ }
+
+ }
+ if (c == null) {
+ c = this.createConverter(ctx, component);
+ }
+ if (c == null) {
+ // throw new TagException(this.getTag(), "No Converter was
+ // created");
+ }
+ return c;
+ }
+
+ private String getConverterId(FaceletContext ctx) {
+ return this.getAttr().getValue(ctx);
+ }
+
+ private Converter createConverter(FaceletContext ctx,
+ AbstractAutocomplete component) {
+ return ctx.getFacesContext().getApplication().createConverter(
+ getConverterId(ctx));
+ }
+
+ }
+}
Copied: trunk/ui/input/ui/src/main/java/org/richfaces/view/facelets/CalendarHandler.java (from rev 20191, trunk/ui/input/ui/src/main/java/org/richfaces/view/facelets/html/CalendarHandler.java)
===================================================================
--- trunk/ui/input/ui/src/main/java/org/richfaces/view/facelets/CalendarHandler.java (rev 0)
+++ trunk/ui/input/ui/src/main/java/org/richfaces/view/facelets/CalendarHandler.java 2010-11-26 18:42:29 UTC (rev 20192)
@@ -0,0 +1,82 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc. and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+
+
+package org.richfaces.view.facelets.html;
+
+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.richfaces.component.AbstractCalendar;
+import org.richfaces.taglib.MethodExpressionCurrentDateChangeListener;
+
+/**
+ * @author amarkhel
+ *
+ */
+public class CalendarHandler extends ComponentHandler {
+
+ private static final CalendarHandlerMetaRule METARULE = new CalendarHandlerMetaRule();
+
+ public CalendarHandler(ComponentConfig config) {
+ super(config);
+ }
+
+ protected MetaRuleset createMetaRuleset(Class type) {
+ MetaRuleset m = super.createMetaRuleset(type);
+ m.addRule(METARULE);
+ return m;
+ }
+
+ static class CalendarHandlerMetaRule extends MetaRule {
+
+ public Metadata applyRule(String name, TagAttribute attribute, MetadataTarget meta) {
+ if (meta.isTargetInstanceOf(AbstractCalendar.class) && "currentDataChangeListener".equals(name)) {
+ return new CalendarMapper(attribute);
+ }
+ return null;
+ }
+
+ }
+
+ static class CalendarMapper extends Metadata {
+
+ private static final Class[] SIGNATURE = new Class[] { org.richfaces.event.CurrentDateChangeListener.class };
+
+ private final TagAttribute attribute;
+
+ public CalendarMapper(TagAttribute attribute) {
+ this.attribute = attribute;
+ }
+
+ public void applyMetadata(FaceletContext ctx, Object instance) {
+ ((AbstractCalendar) instance).addCurrentDateChangeListener((new MethodExpressionCurrentDateChangeListener(
+ this.attribute.getMethodExpression(ctx, null, SIGNATURE))));
+ }
+ }
+}
Deleted: trunk/ui/input/ui/src/main/java/org/richfaces/view/facelets/html/AutocompleteHandler.java
===================================================================
--- trunk/ui/input/ui/src/main/java/org/richfaces/view/facelets/html/AutocompleteHandler.java 2010-11-26 18:35:06 UTC (rev 20191)
+++ trunk/ui/input/ui/src/main/java/org/richfaces/view/facelets/html/AutocompleteHandler.java 2010-11-26 18:42:29 UTC (rev 20192)
@@ -1,143 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2010, Red Hat, Inc. and individual contributors
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.richfaces.view.facelets;
-
-import javax.el.ValueExpression;
-import javax.faces.component.UIComponent;
-import javax.faces.context.FacesContext;
-import javax.faces.convert.Converter;
-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.richfaces.component.AbstractAutocomplete;
-
-/**
- * @author Nick Belaevski
- */
-//TODO nick - this should be generated by CDK
-public class AutocompleteHandler extends ComponentHandler {
-
- private static final MetaRule AUTOCOMPLETE_METHOD_META_RULE = new MetaRule() {
-
- @Override
- public Metadata applyRule(String name, TagAttribute attribute,
- MetadataTarget meta) {
- if (meta.isTargetInstanceOf(AbstractAutocomplete.class)) {
- if ("autocompleteMethod".equals(name)) {
- return new MethodMetadata(attribute, FacesContext.class,
- UIComponent.class, String.class) {
- public void applyMetadata(FaceletContext ctx, Object instance) {
- ((AbstractAutocomplete) instance).setAutocompleteMethod(getMethodExpression(ctx));
- }
- };
- }
-
- if ("converter".equals(name)) {
- return new ConverterMetadata(attribute) {
- public void applyMetadata(FaceletContext ctx, Object instance) {
- ((AbstractAutocomplete) instance).setConverter(this.getConverter(ctx,
- (AbstractAutocomplete) instance,
- this.getAttr().getValueExpression(ctx, Converter.class)));
- }
- };
- }
-
- if ("itemConverter".equals(name)) {
- return new ConverterMetadata(attribute) {
- public void applyMetadata(FaceletContext ctx, Object instance) {
- ((AbstractAutocomplete) instance).setItemConverter(this.getConverter(ctx,
- (AbstractAutocomplete) instance,
- this.getAttr().getValueExpression(ctx, Converter.class)));
- }
- };
- }
-
- }
-
- return null;
- }
- };
-
- public AutocompleteHandler(ComponentConfig config) {
- super(config);
- }
-
- @Override
- protected MetaRuleset createMetaRuleset(Class type) {
- MetaRuleset metaRuleset = super.createMetaRuleset(type);
- metaRuleset.addRule(AUTOCOMPLETE_METHOD_META_RULE);
- return metaRuleset;
- }
-
- abstract static class ConverterMetadata extends Metadata {
-
- private final TagAttribute attr;
-
- public ConverterMetadata(TagAttribute attr) {
- this.attr = attr;
- }
-
- public TagAttribute getAttr() {
- return attr;
- }
-
- public Converter getConverter(FaceletContext ctx,
- AbstractAutocomplete component, ValueExpression converter) {
- ValueExpression ve = null;
- Converter c = null;
- if (converter != null) {
- ve = converter;
- try {
- c = (Converter) ve.getValue(ctx);
- } catch (Exception e) {
- // ok
- }
-
- }
- if (c == null) {
- c = this.createConverter(ctx, component);
- }
- if (c == null) {
- // throw new TagException(this.getTag(), "No Converter was
- // created");
- }
- return c;
- }
-
- private String getConverterId(FaceletContext ctx) {
- return this.getAttr().getValue(ctx);
- }
-
- private Converter createConverter(FaceletContext ctx,
- AbstractAutocomplete component) {
- return ctx.getFacesContext().getApplication().createConverter(
- getConverterId(ctx));
- }
-
- }
-}
Deleted: trunk/ui/input/ui/src/main/java/org/richfaces/view/facelets/html/CalendarHandler.java
===================================================================
--- trunk/ui/input/ui/src/main/java/org/richfaces/view/facelets/html/CalendarHandler.java 2010-11-26 18:35:06 UTC (rev 20191)
+++ trunk/ui/input/ui/src/main/java/org/richfaces/view/facelets/html/CalendarHandler.java 2010-11-26 18:42:29 UTC (rev 20192)
@@ -1,81 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2010, Red Hat, Inc. and individual contributors
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-
-
-package org.richfaces.taglib;
-
-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.richfaces.component.AbstractCalendar;
-
-/**
- * @author amarkhel
- *
- */
-public class CalendarHandler extends ComponentHandler {
-
- private static final CalendarHandlerMetaRule METARULE = new CalendarHandlerMetaRule();
-
- public CalendarHandler(ComponentConfig config) {
- super(config);
- }
-
- protected MetaRuleset createMetaRuleset(Class type) {
- MetaRuleset m = super.createMetaRuleset(type);
- m.addRule(METARULE);
- return m;
- }
-
- static class CalendarHandlerMetaRule extends MetaRule {
-
- public Metadata applyRule(String name, TagAttribute attribute, MetadataTarget meta) {
- if (meta.isTargetInstanceOf(AbstractCalendar.class) && "currentDataChangeListener".equals(name)) {
- return new CalendarMapper(attribute);
- }
- return null;
- }
-
- }
-
- static class CalendarMapper extends Metadata {
-
- private static final Class[] SIGNATURE = new Class[] { org.richfaces.event.CurrentDateChangeListener.class };
-
- private final TagAttribute attribute;
-
- public CalendarMapper(TagAttribute attribute) {
- this.attribute = attribute;
- }
-
- public void applyMetadata(FaceletContext ctx, Object instance) {
- ((AbstractCalendar) instance).addCurrentDateChangeListener((new MethodExpressionCurrentDateChangeListener(
- this.attribute.getMethodExpression(ctx, null, SIGNATURE))));
- }
- }
-}
14 years, 1 month
JBoss Rich Faces SVN: r20191 - in trunk/ui/input/ui/src/main/java/org/richfaces: view/facelets and 1 other directories.
by richfaces-svn-commits@lists.jboss.org
Author: abelevich
Date: 2010-11-26 13:35:06 -0500 (Fri, 26 Nov 2010)
New Revision: 20191
Added:
trunk/ui/input/ui/src/main/java/org/richfaces/view/facelets/html/AutocompleteHandler.java
trunk/ui/input/ui/src/main/java/org/richfaces/view/facelets/html/CalendarHandler.java
Removed:
trunk/ui/input/ui/src/main/java/org/richfaces/taglib/CalendarHandler.java
trunk/ui/input/ui/src/main/java/org/richfaces/view/facelets/AutocompleteHandler.java
Log:
move custom handler to appropriate package
Deleted: trunk/ui/input/ui/src/main/java/org/richfaces/taglib/CalendarHandler.java
===================================================================
--- trunk/ui/input/ui/src/main/java/org/richfaces/taglib/CalendarHandler.java 2010-11-26 18:29:33 UTC (rev 20190)
+++ trunk/ui/input/ui/src/main/java/org/richfaces/taglib/CalendarHandler.java 2010-11-26 18:35:06 UTC (rev 20191)
@@ -1,81 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2010, Red Hat, Inc. and individual contributors
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-
-
-package org.richfaces.taglib;
-
-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.richfaces.component.AbstractCalendar;
-
-/**
- * @author amarkhel
- *
- */
-public class CalendarHandler extends ComponentHandler {
-
- private static final CalendarHandlerMetaRule METARULE = new CalendarHandlerMetaRule();
-
- public CalendarHandler(ComponentConfig config) {
- super(config);
- }
-
- protected MetaRuleset createMetaRuleset(Class type) {
- MetaRuleset m = super.createMetaRuleset(type);
- m.addRule(METARULE);
- return m;
- }
-
- static class CalendarHandlerMetaRule extends MetaRule {
-
- public Metadata applyRule(String name, TagAttribute attribute, MetadataTarget meta) {
- if (meta.isTargetInstanceOf(AbstractCalendar.class) && "currentDataChangeListener".equals(name)) {
- return new CalendarMapper(attribute);
- }
- return null;
- }
-
- }
-
- static class CalendarMapper extends Metadata {
-
- private static final Class[] SIGNATURE = new Class[] { org.richfaces.event.CurrentDateChangeListener.class };
-
- private final TagAttribute attribute;
-
- public CalendarMapper(TagAttribute attribute) {
- this.attribute = attribute;
- }
-
- public void applyMetadata(FaceletContext ctx, Object instance) {
- ((AbstractCalendar) instance).addCurrentDateChangeListener((new MethodExpressionCurrentDateChangeListener(
- this.attribute.getMethodExpression(ctx, null, SIGNATURE))));
- }
- }
-}
Deleted: trunk/ui/input/ui/src/main/java/org/richfaces/view/facelets/AutocompleteHandler.java
===================================================================
--- trunk/ui/input/ui/src/main/java/org/richfaces/view/facelets/AutocompleteHandler.java 2010-11-26 18:29:33 UTC (rev 20190)
+++ trunk/ui/input/ui/src/main/java/org/richfaces/view/facelets/AutocompleteHandler.java 2010-11-26 18:35:06 UTC (rev 20191)
@@ -1,143 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2010, Red Hat, Inc. and individual contributors
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.richfaces.view.facelets;
-
-import javax.el.ValueExpression;
-import javax.faces.component.UIComponent;
-import javax.faces.context.FacesContext;
-import javax.faces.convert.Converter;
-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.richfaces.component.AbstractAutocomplete;
-
-/**
- * @author Nick Belaevski
- */
-//TODO nick - this should be generated by CDK
-public class AutocompleteHandler extends ComponentHandler {
-
- private static final MetaRule AUTOCOMPLETE_METHOD_META_RULE = new MetaRule() {
-
- @Override
- public Metadata applyRule(String name, TagAttribute attribute,
- MetadataTarget meta) {
- if (meta.isTargetInstanceOf(AbstractAutocomplete.class)) {
- if ("autocompleteMethod".equals(name)) {
- return new MethodMetadata(attribute, FacesContext.class,
- UIComponent.class, String.class) {
- public void applyMetadata(FaceletContext ctx, Object instance) {
- ((AbstractAutocomplete) instance).setAutocompleteMethod(getMethodExpression(ctx));
- }
- };
- }
-
- if ("converter".equals(name)) {
- return new ConverterMetadata(attribute) {
- public void applyMetadata(FaceletContext ctx, Object instance) {
- ((AbstractAutocomplete) instance).setConverter(this.getConverter(ctx,
- (AbstractAutocomplete) instance,
- this.getAttr().getValueExpression(ctx, Converter.class)));
- }
- };
- }
-
- if ("itemConverter".equals(name)) {
- return new ConverterMetadata(attribute) {
- public void applyMetadata(FaceletContext ctx, Object instance) {
- ((AbstractAutocomplete) instance).setItemConverter(this.getConverter(ctx,
- (AbstractAutocomplete) instance,
- this.getAttr().getValueExpression(ctx, Converter.class)));
- }
- };
- }
-
- }
-
- return null;
- }
- };
-
- public AutocompleteHandler(ComponentConfig config) {
- super(config);
- }
-
- @Override
- protected MetaRuleset createMetaRuleset(Class type) {
- MetaRuleset metaRuleset = super.createMetaRuleset(type);
- metaRuleset.addRule(AUTOCOMPLETE_METHOD_META_RULE);
- return metaRuleset;
- }
-
- abstract static class ConverterMetadata extends Metadata {
-
- private final TagAttribute attr;
-
- public ConverterMetadata(TagAttribute attr) {
- this.attr = attr;
- }
-
- public TagAttribute getAttr() {
- return attr;
- }
-
- public Converter getConverter(FaceletContext ctx,
- AbstractAutocomplete component, ValueExpression converter) {
- ValueExpression ve = null;
- Converter c = null;
- if (converter != null) {
- ve = converter;
- try {
- c = (Converter) ve.getValue(ctx);
- } catch (Exception e) {
- // ok
- }
-
- }
- if (c == null) {
- c = this.createConverter(ctx, component);
- }
- if (c == null) {
- // throw new TagException(this.getTag(), "No Converter was
- // created");
- }
- return c;
- }
-
- private String getConverterId(FaceletContext ctx) {
- return this.getAttr().getValue(ctx);
- }
-
- private Converter createConverter(FaceletContext ctx,
- AbstractAutocomplete component) {
- return ctx.getFacesContext().getApplication().createConverter(
- getConverterId(ctx));
- }
-
- }
-}
Copied: trunk/ui/input/ui/src/main/java/org/richfaces/view/facelets/html/AutocompleteHandler.java (from rev 20190, trunk/ui/input/ui/src/main/java/org/richfaces/view/facelets/AutocompleteHandler.java)
===================================================================
--- trunk/ui/input/ui/src/main/java/org/richfaces/view/facelets/html/AutocompleteHandler.java (rev 0)
+++ trunk/ui/input/ui/src/main/java/org/richfaces/view/facelets/html/AutocompleteHandler.java 2010-11-26 18:35:06 UTC (rev 20191)
@@ -0,0 +1,143 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc. and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.richfaces.view.facelets;
+
+import javax.el.ValueExpression;
+import javax.faces.component.UIComponent;
+import javax.faces.context.FacesContext;
+import javax.faces.convert.Converter;
+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.richfaces.component.AbstractAutocomplete;
+
+/**
+ * @author Nick Belaevski
+ */
+//TODO nick - this should be generated by CDK
+public class AutocompleteHandler extends ComponentHandler {
+
+ private static final MetaRule AUTOCOMPLETE_METHOD_META_RULE = new MetaRule() {
+
+ @Override
+ public Metadata applyRule(String name, TagAttribute attribute,
+ MetadataTarget meta) {
+ if (meta.isTargetInstanceOf(AbstractAutocomplete.class)) {
+ if ("autocompleteMethod".equals(name)) {
+ return new MethodMetadata(attribute, FacesContext.class,
+ UIComponent.class, String.class) {
+ public void applyMetadata(FaceletContext ctx, Object instance) {
+ ((AbstractAutocomplete) instance).setAutocompleteMethod(getMethodExpression(ctx));
+ }
+ };
+ }
+
+ if ("converter".equals(name)) {
+ return new ConverterMetadata(attribute) {
+ public void applyMetadata(FaceletContext ctx, Object instance) {
+ ((AbstractAutocomplete) instance).setConverter(this.getConverter(ctx,
+ (AbstractAutocomplete) instance,
+ this.getAttr().getValueExpression(ctx, Converter.class)));
+ }
+ };
+ }
+
+ if ("itemConverter".equals(name)) {
+ return new ConverterMetadata(attribute) {
+ public void applyMetadata(FaceletContext ctx, Object instance) {
+ ((AbstractAutocomplete) instance).setItemConverter(this.getConverter(ctx,
+ (AbstractAutocomplete) instance,
+ this.getAttr().getValueExpression(ctx, Converter.class)));
+ }
+ };
+ }
+
+ }
+
+ return null;
+ }
+ };
+
+ public AutocompleteHandler(ComponentConfig config) {
+ super(config);
+ }
+
+ @Override
+ protected MetaRuleset createMetaRuleset(Class type) {
+ MetaRuleset metaRuleset = super.createMetaRuleset(type);
+ metaRuleset.addRule(AUTOCOMPLETE_METHOD_META_RULE);
+ return metaRuleset;
+ }
+
+ abstract static class ConverterMetadata extends Metadata {
+
+ private final TagAttribute attr;
+
+ public ConverterMetadata(TagAttribute attr) {
+ this.attr = attr;
+ }
+
+ public TagAttribute getAttr() {
+ return attr;
+ }
+
+ public Converter getConverter(FaceletContext ctx,
+ AbstractAutocomplete component, ValueExpression converter) {
+ ValueExpression ve = null;
+ Converter c = null;
+ if (converter != null) {
+ ve = converter;
+ try {
+ c = (Converter) ve.getValue(ctx);
+ } catch (Exception e) {
+ // ok
+ }
+
+ }
+ if (c == null) {
+ c = this.createConverter(ctx, component);
+ }
+ if (c == null) {
+ // throw new TagException(this.getTag(), "No Converter was
+ // created");
+ }
+ return c;
+ }
+
+ private String getConverterId(FaceletContext ctx) {
+ return this.getAttr().getValue(ctx);
+ }
+
+ private Converter createConverter(FaceletContext ctx,
+ AbstractAutocomplete component) {
+ return ctx.getFacesContext().getApplication().createConverter(
+ getConverterId(ctx));
+ }
+
+ }
+}
Copied: trunk/ui/input/ui/src/main/java/org/richfaces/view/facelets/html/CalendarHandler.java (from rev 20190, trunk/ui/input/ui/src/main/java/org/richfaces/taglib/CalendarHandler.java)
===================================================================
--- trunk/ui/input/ui/src/main/java/org/richfaces/view/facelets/html/CalendarHandler.java (rev 0)
+++ trunk/ui/input/ui/src/main/java/org/richfaces/view/facelets/html/CalendarHandler.java 2010-11-26 18:35:06 UTC (rev 20191)
@@ -0,0 +1,81 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc. and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+
+
+package org.richfaces.taglib;
+
+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.richfaces.component.AbstractCalendar;
+
+/**
+ * @author amarkhel
+ *
+ */
+public class CalendarHandler extends ComponentHandler {
+
+ private static final CalendarHandlerMetaRule METARULE = new CalendarHandlerMetaRule();
+
+ public CalendarHandler(ComponentConfig config) {
+ super(config);
+ }
+
+ protected MetaRuleset createMetaRuleset(Class type) {
+ MetaRuleset m = super.createMetaRuleset(type);
+ m.addRule(METARULE);
+ return m;
+ }
+
+ static class CalendarHandlerMetaRule extends MetaRule {
+
+ public Metadata applyRule(String name, TagAttribute attribute, MetadataTarget meta) {
+ if (meta.isTargetInstanceOf(AbstractCalendar.class) && "currentDataChangeListener".equals(name)) {
+ return new CalendarMapper(attribute);
+ }
+ return null;
+ }
+
+ }
+
+ static class CalendarMapper extends Metadata {
+
+ private static final Class[] SIGNATURE = new Class[] { org.richfaces.event.CurrentDateChangeListener.class };
+
+ private final TagAttribute attribute;
+
+ public CalendarMapper(TagAttribute attribute) {
+ this.attribute = attribute;
+ }
+
+ public void applyMetadata(FaceletContext ctx, Object instance) {
+ ((AbstractCalendar) instance).addCurrentDateChangeListener((new MethodExpressionCurrentDateChangeListener(
+ this.attribute.getMethodExpression(ctx, null, SIGNATURE))));
+ }
+ }
+}
14 years, 1 month
JBoss Rich Faces SVN: r20189 - in sandbox/trunk/examples/dnd-demo/src/main: java/org and 3 other directories.
by richfaces-svn-commits@lists.jboss.org
Author: abelevich
Date: 2010-11-26 13:25:12 -0500 (Fri, 26 Nov 2010)
New Revision: 20189
Added:
sandbox/trunk/examples/dnd-demo/src/main/java/org/
sandbox/trunk/examples/dnd-demo/src/main/java/org/demo/
sandbox/trunk/examples/dnd-demo/src/main/java/org/demo/DataBean.java
Modified:
sandbox/trunk/examples/dnd-demo/src/main/webapp/WEB-INF/web.xml
sandbox/trunk/examples/dnd-demo/src/main/webapp/examples/dnd.xhtml
Log:
extend demo
Added: sandbox/trunk/examples/dnd-demo/src/main/java/org/demo/DataBean.java
===================================================================
--- sandbox/trunk/examples/dnd-demo/src/main/java/org/demo/DataBean.java (rev 0)
+++ sandbox/trunk/examples/dnd-demo/src/main/java/org/demo/DataBean.java 2010-11-26 18:25:12 UTC (rev 20189)
@@ -0,0 +1,15 @@
+package org.demo;
+
+import javax.faces.bean.ManagedBean;
+import javax.faces.bean.SessionScoped;
+
+import org.richfaces.event.DropEvent;
+
+@ManagedBean
+@SessionScoped
+public class DataBean {
+
+ public void processEvent(DropEvent event) {
+ System.out.println("DataBean.processEvent()");
+ }
+}
Modified: sandbox/trunk/examples/dnd-demo/src/main/webapp/WEB-INF/web.xml
===================================================================
--- sandbox/trunk/examples/dnd-demo/src/main/webapp/WEB-INF/web.xml 2010-11-26 18:16:17 UTC (rev 20188)
+++ sandbox/trunk/examples/dnd-demo/src/main/webapp/WEB-INF/web.xml 2010-11-26 18:25:12 UTC (rev 20189)
@@ -1,50 +1,103 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://java.sun.com/xml/ns/javaee"
- xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
- xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
- version="2.5">
-
- <display-name>Sample RichFaces 4 Application</display-name>
+<?xml version='1.0' encoding='UTF-8'?>
- <!-- context-param>
- <param-name>org.richfaces.skin</param-name>
- <param-value>#{skinBean.skin}</param-value>
- </context-param>
- <context-param>
- <param-name>org.richfaces.enableControlSkinning</param-name>
- <param-value>#{skinBean.enableElementsSkinning}</param-value>
- </context-param>
- <context-param>
- <param-name>org.richfaces.enableControlSkinningClasses</param-name>
- <param-value>#{skinBean.enableClassesSkinning}</param-value>
- </context-param -->
+ <!--
+ DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. Copyright
+ 1997-2007 Sun Microsystems, Inc. All rights reserved. The contents of
+ this file are subject to the terms of either the GNU General Public
+ License Version 2 only ("GPL") or the Common Development and
+ Distribution License("CDDL") (collectively, the "License"). You may
+ not use this file except in compliance with the License. You can
+ obtain a copy of the License at
+ https://glassfish.dev.java.net/public/CDDL+GPL.html or
+ glassfish/bootstrap/legal/LICENSE.txt. See the License for the
+ specific language governing permissions and limitations under the
+ License. When distributing the software, include this License Header
+ Notice in each file and include the License file at
+ glassfish/bootstrap/legal/LICENSE.txt. Sun designates this particular
+ file as subject to the "Classpath" exception as provided by Sun in the
+ GPL Version 2 section of the License file that accompanied this code.
+ If applicable, add the following below the License Header, with the
+ fields enclosed by brackets [] replaced by your own identifying
+ information: "Portions Copyrighted [year] [name of copyright owner]"
+ Contributor(s): If you wish your version of this file to be governed
+ by only the CDDL or only the GPL Version 2, indicate your decision by
+ adding "[Contributor] elects to include this software in this
+ distribution under the [CDDL or GPL Version 2] license." If you don't
+ indicate a single choice of license, a recipient has the option to
+ distribute your version of this file under either the CDDL, the GPL
+ Version 2 or to extend the choice of license to its licensees as
+ provided above. However, if you add GPL Version 2 code and therefore,
+ elected the GPL Version 2 license, then the option applies only if the
+ new code is made subject to such option by the copyright holder.
+ -->
- <context-param>
- <param-name>javax.faces.PROJECT_STAGE</param-name>
- <param-value>Development</param-value>
- </context-param>
- <context-param>
- <param-name>javax.faces.SKIP_COMMENTS</param-name>
- <param-value>true</param-value>
- </context-param>
- <servlet>
- <servlet-name>Faces Servlet</servlet-name>
- <servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
- <load-on-startup>1</load-on-startup>
- </servlet>
- <servlet-mapping>
- <servlet-name>Faces Servlet</servlet-name>
- <url-pattern>*.jsf</url-pattern>
- </servlet-mapping>
- <servlet-mapping>
- <servlet-name>Faces Servlet</servlet-name>
- <url-pattern>/faces/*</url-pattern>
- </servlet-mapping>
- <welcome-file-list>
- <welcome-file>faces/index.xhtml</welcome-file>
- </welcome-file-list>
- <session-config>
- <session-timeout>30</session-timeout>
- </session-config>
-</web-app>
\ No newline at end of file
+<web-app version="2.5" xmlns="http://java.sun.com/xml/ns/javaee"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd">
+
+ <display-name></display-name>
+ <description></description>
+ <context-param>
+ <param-name>javax.faces.PROJECT_STAGE</param-name>
+ <param-value>Development</param-value>
+ </context-param>
+
+ <context-param>
+ <param-name>org.richfaces.enableControlSkinning</param-name>
+ <param-value>true</param-value>
+ </context-param>
+ <context-param>
+ <param-name>org.richfaces.enableControlSkinningClasses</param-name>
+ <param-value>true</param-value>
+ </context-param>
+
+
+ <context-param>
+ <param-name>javax.faces.STATE_SAVING_METHOD</param-name>
+ <param-value>server</param-value>
+ </context-param>
+
+ <context-param>
+ <param-name>javax.faces.DEFAULT_SUFFIX</param-name>
+ <param-value>.xhtml</param-value>
+ </context-param>
+ <context-param>
+ <param-name>facelets.DEVELOPMENT</param-name>
+ <param-value>true</param-value>
+ </context-param>
+
+ <context-param>
+ <description>
+ Set this flag to true if you want the JavaServer Faces
+ Reference Implementation to validate the XML in your
+ faces-config.xml resources against the DTD. Default
+ value is false.
+ </description>
+ <param-name>com.sun.faces.validateXml</param-name>
+ <param-value>true</param-value>
+ </context-param>
+
+ <!-- Faces Servlet -->
+ <servlet>
+ <servlet-name>Faces Servlet</servlet-name>
+ <servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
+ <load-on-startup>1</load-on-startup>
+ </servlet>
+
+
+ <!-- Faces Servlet Mapping -->
+ <!--
+
+ This mapping identifies a jsp page as having JSF content. If a request
+ comes to the server for foo.faces, the container will send the request
+ to the FacesServlet, which will expect a corresponding foo.jsp page to
+ exist containing the content.
+ -->
+ <servlet-mapping>
+ <servlet-name>Faces Servlet</servlet-name>
+ <url-pattern>/faces/*</url-pattern>
+ <url-pattern>*.jsf</url-pattern>
+ </servlet-mapping>
+
+</web-app>
Modified: sandbox/trunk/examples/dnd-demo/src/main/webapp/examples/dnd.xhtml
===================================================================
--- sandbox/trunk/examples/dnd-demo/src/main/webapp/examples/dnd.xhtml 2010-11-26 18:16:17 UTC (rev 20188)
+++ sandbox/trunk/examples/dnd-demo/src/main/webapp/examples/dnd.xhtml 2010-11-26 18:25:12 UTC (rev 20189)
@@ -68,11 +68,12 @@
</tr>
</table>
<a4j:outputPanel id="drp" layout="block" styleClass="droppable">
- <dnd:dropBehavior event="mouseover" acceptType="drg1, drg2" />
+ <dnd:dropBehavior event="mouseover" acceptType="drg1, drg2" dropListener="#{dataBean.processEvent}"></dnd:dropBehavior>
+ <a4j:ajax event="click"/>
</a4j:outputPanel>
+
- <h:inputText>
- <a4j:ajax/>
+ <h:inputText >
</h:inputText>
</h:form>
</h:body>
14 years, 1 month
JBoss Rich Faces SVN: r20188 - in sandbox/trunk/ui/drag-drop: api/src/main/java/org/richfaces/component/behavior and 9 other directories.
by richfaces-svn-commits@lists.jboss.org
Author: abelevich
Date: 2010-11-26 13:16:17 -0500 (Fri, 26 Nov 2010)
New Revision: 20188
Added:
sandbox/trunk/ui/drag-drop/api/src/main/java/org/richfaces/event/MethodExpressionDropListener.java
sandbox/trunk/ui/drag-drop/ui/src/main/java/org/richfaces/renderkit/DnDBehaviorRenderBase.java
sandbox/trunk/ui/drag-drop/ui/src/main/java/org/richfaces/view/
sandbox/trunk/ui/drag-drop/ui/src/main/java/org/richfaces/view/facelets/
sandbox/trunk/ui/drag-drop/ui/src/main/java/org/richfaces/view/facelets/html/
sandbox/trunk/ui/drag-drop/ui/src/main/java/org/richfaces/view/facelets/html/DropBehaviorHandler.java
Removed:
sandbox/trunk/ui/drag-drop/api/src/main/java/org/richfaces/component/Draggable.java
sandbox/trunk/ui/drag-drop/api/src/main/java/org/richfaces/component/Dropzone.java
sandbox/trunk/ui/drag-drop/api/src/main/java/org/richfaces/event/DnDEvent.java
sandbox/trunk/ui/drag-drop/api/src/main/java/org/richfaces/event/DragEvent.java
sandbox/trunk/ui/drag-drop/api/src/main/java/org/richfaces/event/DragListener.java
sandbox/trunk/ui/drag-drop/api/src/main/java/org/richfaces/event/DropBehaviorEvent.java
sandbox/trunk/ui/drag-drop/api/src/main/java/org/richfaces/event/DropSource.java
Modified:
sandbox/trunk/ui/drag-drop/api/src/main/java/org/richfaces/component/behavior/ClientDragBehavior.java
sandbox/trunk/ui/drag-drop/api/src/main/java/org/richfaces/component/behavior/ClientDropBehavior.java
sandbox/trunk/ui/drag-drop/api/src/main/java/org/richfaces/event/DropEvent.java
sandbox/trunk/ui/drag-drop/api/src/main/java/org/richfaces/event/DropListener.java
sandbox/trunk/ui/drag-drop/ui/src/main/java/org/richfaces/component/AbstractDragIndicator.java
sandbox/trunk/ui/drag-drop/ui/src/main/java/org/richfaces/component/behavior/DropBehavior.java
sandbox/trunk/ui/drag-drop/ui/src/main/java/org/richfaces/renderkit/DragBehaviorRendererBase.java
sandbox/trunk/ui/drag-drop/ui/src/main/java/org/richfaces/renderkit/DragIndicatorRendererBase.java
sandbox/trunk/ui/drag-drop/ui/src/main/java/org/richfaces/renderkit/DropBehaviorRendererBase.java
sandbox/trunk/ui/drag-drop/ui/src/main/resources/META-INF/resources/org.richfaces/dnd-droppable.js
sandbox/trunk/ui/drag-drop/ui/src/main/resources/META-INF/resources/org.richfaces/dnd-manager.js
Log:
implement drop decode, dropEvent creation, drop listeners support
Deleted: sandbox/trunk/ui/drag-drop/api/src/main/java/org/richfaces/component/Draggable.java
===================================================================
--- sandbox/trunk/ui/drag-drop/api/src/main/java/org/richfaces/component/Draggable.java 2010-11-26 17:27:32 UTC (rev 20187)
+++ sandbox/trunk/ui/drag-drop/api/src/main/java/org/richfaces/component/Draggable.java 2010-11-26 18:16:17 UTC (rev 20188)
@@ -1,154 +0,0 @@
-/**
- * License Agreement.
- *
- * Rich Faces - Natural Ajax for Java Server Faces (JSF)
- *
- * Copyright (C) 2007 Exadel, Inc.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License version 2.1 as published by the Free Software Foundation.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-package org.richfaces.component;
-
-import javax.faces.context.FacesContext;
-
-import org.richfaces.event.DragListener;
-
-/**
- * Interface for all draggable components. Describe bean properties, implemented
- * by component.
- *
- * @author shura
- *
- */
-public interface Draggable {
-
- /**
- * Getter for value parameter, used as key for draggable component.
- *
- * @return
- */
- public Object getDragValue();
-
- public void setDragValue(Object value);
-
- /**
- * Getter for id of component ( instance of {@link UIDragIndicator} ) used
- * for create drag cursor.
- *
- * @return
- */
- public String getDragIndicator();
-
- /**
- * @param dragIndicator
- * - id of cursor component
- */
- public void setDragIndicator(String dragIndicator);
-
- /**
- * Draggable implementation may wish to resolve drag indicator id to
- * clientId itself
- *
- * @param facesContext
- * {@link FacesContext} instance
- * @return resolved indicator client id or null
- * @since 3.1
- */
- public String getResolvedDragIndicator(FacesContext facesContext);
-
- /**
- * Getter for type of this draggable ( file, mail etc ).
- *
- * @return
- */
- public String getDragType();
-
- /**
- * @param dragType
- */
- public void setDragType(String dragType);
-
- /**
- * Getter for JavaScript event handler, called before start drag operation.
- * If this handler return false, drag operation is cancelled.
- *
- * @return javaScript code of event handler.
- */
- public String getOndragstart();
-
- /**
- * @param dragType
- */
- public void setOndragstart(String ondrag);
-
- /**
- * Getter for JavaScript event handler; Called when drag operation end.
- *
- * @return javaScript code of event handler.
- */
- public String getOndragend();
-
- public void setOndragend(String ondrag);
-
- /**
- * Getter for JavaScript event handler; Called when dragged element over the
- * dropzone.
- *
- * @return javaScript code of event handler.
- */
- public String getOndropover();
-
- public void setOndropover(String ondropover);
-
- /**
- * Getter for JavaScript event handler; Called when dragged element out the
- * dropzone.
- *
- * @return javaScript code of event handler.
- */
- public String getOndropout();
-
- public void setOndropout(String ondropout);
-
- /**
- * Append drag listener to component listeners collection
- *
- * @param listener
- */
- public void addDragListener(DragListener listener);
-
- /**
- * Get array of all Drop Listeners
- *
- * @return
- */
- public DragListener[] getDragListeners();
-
- /**
- * Remove drop listener from component listeners array.
- *
- * @param listener
- */
- public void removeDragListener(DragListener listener);
-
- public String getGrabCursors();
-
- public void setGrabCursors(String grabCursors);
-
- public String getGrabbingCursors();
-
- public void setGrabbingCursors(String grabbingCursors);
-
-}
Deleted: sandbox/trunk/ui/drag-drop/api/src/main/java/org/richfaces/component/Dropzone.java
===================================================================
--- sandbox/trunk/ui/drag-drop/api/src/main/java/org/richfaces/component/Dropzone.java 2010-11-26 17:27:32 UTC (rev 20187)
+++ sandbox/trunk/ui/drag-drop/api/src/main/java/org/richfaces/component/Dropzone.java 2010-11-26 18:16:17 UTC (rev 20188)
@@ -1,139 +0,0 @@
-/**
- * License Agreement.
- *
- * Rich Faces - Natural Ajax for Java Server Faces (JSF)
- *
- * Copyright (C) 2007 Exadel, Inc.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License version 2.1 as published by the Free Software Foundation.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-package org.richfaces.component;
-
-import org.richfaces.event.DropSource;
-
-/**
- * Base interface for all components, accesible as drop zone.
- *
- * @author shura
- *
- */
-public interface Dropzone extends DropSource {
-
- /**
- * Getter for dropType's , accepted by this zone.
- *
- * @return
- */
- public Object getAcceptedTypes();
-
- public void setAcceptedTypes(Object types);
-
- /**
- * Getter for mapping between drop types and indicator states.
- *
- * @return
- */
- public Object getTypeMapping();
-
- public void setTypeMapping(Object types);
-
- /**
- * Getter for mapping between drop types and acceptable cursors
- *
- * @return
- */
- public Object getCursorTypeMapping();
-
- public void setCursorTypeMapping(Object types);
-
- /**
- * Getter for JavaScript event handler, called then drag curcor enter in
- * component area. If this handler return false, or "declined", drop
- * operation on this component not allowed. If handler return true or
- * "allowed" , or any other supported indicator states, drop operation is
- * allowed and corresponding indicator state will be displayed.
- *
- * @return javaScript code of event handler.
- */
- public String getOndragenter();
-
- /**
- * @param dragType
- */
- public void setOndragenter(String ondrag);
-
- /**
- * Getter for JavaScript event handler, called before drag cursor leave
- * component area.
- *
- * @return javaScript code of event handler.
- */
- public String getOndragexit();
-
- /**
- * @param dragType
- */
- public void setOndragexit(String ondrag);
-
- public Object getDropValue();
-
- public void setDropValue(Object o);
-
- /**
- * Javascript code called before drop event.
- *
- * @parameter
- * @return the acceptClass
- */
- public abstract String getOndrop();
-
- /**
- * @param newOndrop
- * the value to set
- */
- public abstract void setOndrop(String newOndrop);
-
- /**
- * Javascript handler for event fired on drop even the drop for given type
- * is not available
- *
- * @parameter
- * @return the acceptClass
- */
- public abstract String getOndropend();
-
- /**
- * @param newname
- * the value to set
- */
- public abstract void setOndropend(String ondropend);
-
- /**
- * Getter for the list of comma separated cursors that indicates when
- * acceptable draggable over dropzone
- */
- public String getAcceptCursors();
-
- public void setAcceptCursors(String acceptCursors);
-
- /**
- * Getter for the list of comma separated cursors that indicates when
- * rejectable draggable over dropzone
- */
- public String getRejectCursors();
-
- public void setRejectCursors(String rejectCursors);
-
-}
Modified: sandbox/trunk/ui/drag-drop/api/src/main/java/org/richfaces/component/behavior/ClientDragBehavior.java
===================================================================
--- sandbox/trunk/ui/drag-drop/api/src/main/java/org/richfaces/component/behavior/ClientDragBehavior.java 2010-11-26 17:27:32 UTC (rev 20187)
+++ sandbox/trunk/ui/drag-drop/api/src/main/java/org/richfaces/component/behavior/ClientDragBehavior.java 2010-11-26 18:16:17 UTC (rev 20188)
@@ -1,3 +1,25 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright ${year}, Red Hat, Inc. and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+
package org.richfaces.component.behavior;
import javax.faces.component.behavior.ClientBehavior;
@@ -3,4 +25,8 @@
+/**
+ * @author abelevich
+ *
+ */
public interface ClientDragBehavior extends ClientBehavior {
Modified: sandbox/trunk/ui/drag-drop/api/src/main/java/org/richfaces/component/behavior/ClientDropBehavior.java
===================================================================
--- sandbox/trunk/ui/drag-drop/api/src/main/java/org/richfaces/component/behavior/ClientDropBehavior.java 2010-11-26 17:27:32 UTC (rev 20187)
+++ sandbox/trunk/ui/drag-drop/api/src/main/java/org/richfaces/component/behavior/ClientDropBehavior.java 2010-11-26 18:16:17 UTC (rev 20188)
@@ -1,3 +1,25 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright ${year}, Red Hat, Inc. and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+
package org.richfaces.component.behavior;
import java.util.Set;
@@ -4,11 +26,21 @@
import javax.faces.component.behavior.ClientBehavior;
+import org.richfaces.event.DropListener;
+
+/**
+ * @author abelevich
+ *
+ */
public interface ClientDropBehavior extends ClientBehavior{
public Set<String> getAcceptType();
public Object getDropValue();
+
+ public void addDropListener(DropListener dropListener);
+
+ public void removeDropListener(DropListener dropListener);
}
Deleted: sandbox/trunk/ui/drag-drop/api/src/main/java/org/richfaces/event/DnDEvent.java
===================================================================
--- sandbox/trunk/ui/drag-drop/api/src/main/java/org/richfaces/event/DnDEvent.java 2010-11-26 17:27:32 UTC (rev 20187)
+++ sandbox/trunk/ui/drag-drop/api/src/main/java/org/richfaces/event/DnDEvent.java 2010-11-26 18:16:17 UTC (rev 20188)
@@ -1,48 +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.event;
-
-import javax.faces.component.UIComponent;
-import javax.faces.event.FacesEvent;
-
-/**
- *
- * <br />
- * <br />
- *
- * Created 12.11.2007
- *
- * @author Nick Belaevski
- * @since 3.2
- */
-
-public abstract class DnDEvent extends FacesEvent {
- /**
- *
- */
- private static final long serialVersionUID = -2455016405742082110L;
-
- public DnDEvent(UIComponent component) {
- super(component);
- }
-
-}
Deleted: sandbox/trunk/ui/drag-drop/api/src/main/java/org/richfaces/event/DragEvent.java
===================================================================
--- sandbox/trunk/ui/drag-drop/api/src/main/java/org/richfaces/event/DragEvent.java 2010-11-26 17:27:32 UTC (rev 20187)
+++ sandbox/trunk/ui/drag-drop/api/src/main/java/org/richfaces/event/DragEvent.java 2010-11-26 18:16:17 UTC (rev 20188)
@@ -1,108 +0,0 @@
-/**
- * License Agreement.
- *
- * Rich Faces - Natural Ajax for Java Server Faces (JSF)
- *
- * Copyright (C) 2007 Exadel, Inc.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License version 2.1 as published by the Free Software Foundation.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-package org.richfaces.event;
-
-import javax.faces.component.UIComponent;
-import javax.faces.event.FacesListener;
-
-import org.richfaces.component.Draggable;
-import org.richfaces.component.Dropzone;
-
-/**
- * @author Nick Belaevski - nbelaevski(a)exadel.com created 27.12.2006
- *
- */
-public class DragEvent extends DnDEvent {
-
- private static final long serialVersionUID = 6179268394391836905L;
-
- private Dropzone dropTarget;
- private Object acceptedTypes;
- private Object dropValue;
- /**
- *
- */
-
- public DragEvent(UIComponent uiComponent) {
- super(uiComponent);
- }
-
- /*
- * (non-Javadoc)
- *
- * @see
- * javax.faces.event.FacesEvent#isAppropriateListener(javax.faces.event.
- * FacesListener)
- */
- public boolean isAppropriateListener(FacesListener faceslistener) {
- return faceslistener instanceof DragListener;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see
- * javax.faces.event.FacesEvent#processListener(javax.faces.event.FacesListener
- * )
- */
- public void processListener(FacesListener faceslistener) {
- ((DragListener) faceslistener).processDrag(this);
- }
-
- public Object getDragValue() {
- return ((Draggable) this.getSource()).getDragValue();
- }
-
- public Dropzone getDropTarget() {
- return dropTarget;
- }
-
- /**
- * @see java.util.EventObject#toString()
- */
- /*
- * public String toString() { return new ToStringBuilder(this,
- * ToStringStyle.MULTI_LINE_STYLE). append("component",
- * getComponent()).append("source", getSource()).append("phaseId",
- * getPhaseId()). append("dragValue", getDragValue()). append("dropTarget",
- * getDropTarget()). append("dropValue", getDropValue()). toString(); }
- */
- public void setDropTarget(Dropzone dropTarget) {
- this.dropTarget = dropTarget;
- }
-
- public Object getAcceptedTypes() {
- return acceptedTypes;
- }
-
- public void setAcceptedTypes(Object acceptedTypes) {
- this.acceptedTypes = acceptedTypes;
- }
-
- public Object getDropValue() {
- return dropValue;
- }
-
- public void setDropValue(Object dropValue) {
- this.dropValue = dropValue;
- }
-}
Deleted: sandbox/trunk/ui/drag-drop/api/src/main/java/org/richfaces/event/DragListener.java
===================================================================
--- sandbox/trunk/ui/drag-drop/api/src/main/java/org/richfaces/event/DragListener.java 2010-11-26 17:27:32 UTC (rev 20187)
+++ sandbox/trunk/ui/drag-drop/api/src/main/java/org/richfaces/event/DragListener.java 2010-11-26 18:16:17 UTC (rev 20188)
@@ -1,33 +0,0 @@
-/**
- * License Agreement.
- *
- * Rich Faces - Natural Ajax for Java Server Faces (JSF)
- *
- * Copyright (C) 2007 Exadel, Inc.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License version 2.1 as published by the Free Software Foundation.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-package org.richfaces.event;
-
-import javax.faces.event.FacesListener;
-
-/**
- * @author Nick Belaevski - nbelaevski(a)exadel.com created 27.12.2006
- *
- */
-public interface DragListener extends FacesListener {
- public void processDrag(DragEvent event);
-
-}
Deleted: sandbox/trunk/ui/drag-drop/api/src/main/java/org/richfaces/event/DropBehaviorEvent.java
===================================================================
--- sandbox/trunk/ui/drag-drop/api/src/main/java/org/richfaces/event/DropBehaviorEvent.java 2010-11-26 17:27:32 UTC (rev 20187)
+++ sandbox/trunk/ui/drag-drop/api/src/main/java/org/richfaces/event/DropBehaviorEvent.java 2010-11-26 18:16:17 UTC (rev 20188)
@@ -1,56 +0,0 @@
-package org.richfaces.event;
-
-import javax.faces.component.UIComponent;
-import javax.faces.component.behavior.Behavior;
-import javax.faces.event.BehaviorEvent;
-import javax.faces.event.FacesListener;
-
-public class DropBehaviorEvent extends BehaviorEvent {
-
- private static final long serialVersionUID = 3717071628237886288L;
-
- private Object dropValue;
-
- private Object dragValue;
-
- private UIComponent dragSource;
-
- public Object getDropValue() {
- return dropValue;
- }
-
- public void setDropValue(Object dropValue) {
- this.dropValue = dropValue;
- }
-
- public Object getDragValue() {
- return dragValue;
- }
-
- public void setDragValue(Object dragValue) {
- this.dragValue = dragValue;
- }
-
- public UIComponent getDragSource() {
- return dragSource;
- }
-
- public void setDragSource(UIComponent dragSource) {
- this.dragSource = dragSource;
- }
-
- public DropBehaviorEvent(UIComponent component, Behavior behavior) {
- super(component, behavior);
- }
-
- @Override
- public boolean isAppropriateListener(FacesListener listener) {
- return (listener instanceof DropListener);
- }
-
- @Override
- public void processListener(FacesListener listener) {
- ((DropListener) listener).processDrop(this);
- }
-
-}
Modified: sandbox/trunk/ui/drag-drop/api/src/main/java/org/richfaces/event/DropEvent.java
===================================================================
--- sandbox/trunk/ui/drag-drop/api/src/main/java/org/richfaces/event/DropEvent.java 2010-11-26 17:27:32 UTC (rev 20187)
+++ sandbox/trunk/ui/drag-drop/api/src/main/java/org/richfaces/event/DropEvent.java 2010-11-26 18:16:17 UTC (rev 20188)
@@ -1,111 +1,95 @@
-/**
- * License Agreement.
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright ${year}, Red Hat, Inc. and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
*
- * Rich Faces - Natural Ajax for Java Server Faces (JSF)
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
*
- * 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,
+ * This software is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * 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
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
*/
package org.richfaces.event;
+import java.util.Set;
+
import javax.faces.component.UIComponent;
+import javax.faces.component.behavior.Behavior;
+import javax.faces.event.BehaviorEvent;
import javax.faces.event.FacesListener;
-import org.richfaces.component.Draggable;
-import org.richfaces.component.Dropzone;
-
/**
- * @author shura
- *
+ * @author abelevich
+ *
*/
-public class DropEvent extends DnDEvent {
+public class DropEvent extends BehaviorEvent {
- /**
- *
- */
- private static final long serialVersionUID = 1660545054556302746L;
-
- private Draggable draggableSource;
- private String dragType;
+ private static final long serialVersionUID = 3717071628237886288L;
+
+ private Object dropValue;
+
private Object dragValue;
-
- public DropEvent(UIComponent component) {
- super(component);
+
+ private Set<String> acceptType;
+
+ private UIComponent dragSource;
+
+
+ public DropEvent(UIComponent component, Behavior behavior) {
+ super(component, behavior);
}
-
- /*
- * (non-Javadoc)
- *
- * @see
- * javax.faces.event.FacesEvent#isAppropriateListener(javax.faces.event.
- * FacesListener)
- */
- public boolean isAppropriateListener(FacesListener listener) {
- return listener instanceof DropListener;
+
+ public Set<String> getAcceptType() {
+ return acceptType;
}
- /*
- * (non-Javadoc)
- *
- * @see
- * javax.faces.event.FacesEvent#processListener(javax.faces.event.FacesListener
- * )
- */
- public void processListener(FacesListener listener) {
- //((DropListener) listener).processDrop(this);
+ public void setAcceptType(Set<String> acceptType) {
+ this.acceptType = acceptType;
}
-
- /**
- * @return the dropValue
- */
+
public Object getDropValue() {
- return ((Dropzone) this.getSource()).getDropValue();
+ return dropValue;
}
- public Draggable getDraggableSource() {
- return draggableSource;
+ public void setDropValue(Object dropValue) {
+ this.dropValue = dropValue;
}
- /**
- * @see java.util.EventObject#toString()
- */
- /*
- * public String toString() { return new ToStringBuilder(this,
- * ToStringStyle.MULTI_LINE_STYLE). append("component", getComponent()).
- * append("source", getSource()). append("phaseId", getPhaseId()).
- * append("dropValue", getDropValue()). append("draggableSource",
- * getDraggableSource()). append("dragValue", getDragValue()). toString(); }
- */
- public void setDraggableSource(Draggable draggableSource) {
- this.draggableSource = draggableSource;
+ public Object getDragValue() {
+ return dragValue;
}
- public String getDragType() {
- return dragType;
+ public void setDragValue(Object dragValue) {
+ this.dragValue = dragValue;
}
- public void setDragType(String dragType) {
- this.dragType = dragType;
+ public UIComponent getDragSource() {
+ return dragSource;
}
- public Object getDragValue() {
- return dragValue;
+ public void setDragSource(UIComponent dragSource) {
+ this.dragSource = dragSource;
}
- public void setDragValue(Object dragValue) {
- this.dragValue = dragValue;
+ @Override
+ public boolean isAppropriateListener(FacesListener listener) {
+ return (listener instanceof DropListener);
}
+
+ @Override
+ public void processListener(FacesListener listener) {
+ ((DropListener) listener).processDrop(this);
+ }
+
}
Modified: sandbox/trunk/ui/drag-drop/api/src/main/java/org/richfaces/event/DropListener.java
===================================================================
--- sandbox/trunk/ui/drag-drop/api/src/main/java/org/richfaces/event/DropListener.java 2010-11-26 17:27:32 UTC (rev 20187)
+++ sandbox/trunk/ui/drag-drop/api/src/main/java/org/richfaces/event/DropListener.java 2010-11-26 18:16:17 UTC (rev 20188)
@@ -1,22 +1,23 @@
-/**
- * License Agreement.
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright ${year}, Red Hat, Inc. and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
*
- * Rich Faces - Natural Ajax for Java Server Faces (JSF)
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
*
- * 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,
+ * This software is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * 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
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
*/
package org.richfaces.event;
@@ -24,8 +25,12 @@
import javax.faces.event.BehaviorListener;
+/**
+ * @author abelevich
+ *
+ */
public interface DropListener extends BehaviorListener {
- public void processDrop(DropBehaviorEvent event);
+ public void processDrop(DropEvent event);
}
Deleted: sandbox/trunk/ui/drag-drop/api/src/main/java/org/richfaces/event/DropSource.java
===================================================================
--- sandbox/trunk/ui/drag-drop/api/src/main/java/org/richfaces/event/DropSource.java 2010-11-26 17:27:32 UTC (rev 20187)
+++ sandbox/trunk/ui/drag-drop/api/src/main/java/org/richfaces/event/DropSource.java 2010-11-26 18:16:17 UTC (rev 20188)
@@ -1,59 +0,0 @@
-/**
- * License Agreement.
- *
- * Rich Faces - Natural Ajax for Java Server Faces (JSF)
- *
- * Copyright (C) 2007 Exadel, Inc.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License version 2.1 as published by the Free Software Foundation.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-package org.richfaces.event;
-
-import javax.faces.el.MethodBinding;
-
-/**
- * Interface for component applicable to process drag/drop events.
- *
- * @author shura
- *
- */
-public interface DropSource {
-
- /**
- * Append drop listener to component listeners collection
- *
- * @param listener
- */
- public void addDropListener(DropListener listener);
-
- /**
- * Get array of all Drop Listeners
- *
- * @return
- */
- public DropListener[] getDropListeners();
-
- /**
- * Remove drop listener from component listeners array.
- *
- * @param listener
- */
- public void removeDropListener(DropListener listener);
-
- public void setDropListener(MethodBinding binding);
-
- public MethodBinding getDropListener();
-
-}
Added: sandbox/trunk/ui/drag-drop/api/src/main/java/org/richfaces/event/MethodExpressionDropListener.java
===================================================================
--- sandbox/trunk/ui/drag-drop/api/src/main/java/org/richfaces/event/MethodExpressionDropListener.java (rev 0)
+++ sandbox/trunk/ui/drag-drop/api/src/main/java/org/richfaces/event/MethodExpressionDropListener.java 2010-11-26 18:16:17 UTC (rev 20188)
@@ -0,0 +1,49 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright ${year}, Red Hat, Inc. and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+
+package org.richfaces.event;
+
+import javax.el.MethodExpression;
+import javax.faces.context.FacesContext;
+
+
+/**
+ * @author abelevich
+ *
+ */
+public class MethodExpressionDropListener implements DropListener {
+ private MethodExpression methodExpression;
+
+ public MethodExpressionDropListener() {
+ super();
+ }
+
+ public MethodExpressionDropListener(MethodExpression methodExpression) {
+ super();
+ this.methodExpression = methodExpression;
+ }
+
+ public void processDrop(DropEvent event) {
+ FacesContext facesContext = FacesContext.getCurrentInstance();
+ methodExpression.invoke(facesContext.getELContext(), new Object[] { event });
+ }
+}
Modified: sandbox/trunk/ui/drag-drop/ui/src/main/java/org/richfaces/component/AbstractDragIndicator.java
===================================================================
--- sandbox/trunk/ui/drag-drop/ui/src/main/java/org/richfaces/component/AbstractDragIndicator.java 2010-11-26 17:27:32 UTC (rev 20187)
+++ sandbox/trunk/ui/drag-drop/ui/src/main/java/org/richfaces/component/AbstractDragIndicator.java 2010-11-26 18:16:17 UTC (rev 20188)
@@ -1,3 +1,25 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright ${year}, Red Hat, Inc. and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+
package org.richfaces.component;
import javax.faces.component.UIComponentBase;
@@ -7,6 +29,10 @@
import org.richfaces.cdk.annotations.JsfRenderer;
import org.richfaces.cdk.annotations.Tag;
+/**
+ * @author abelevich
+ *
+ */
@JsfComponent(
type = AbstractDragIndicator.COMPONENT_TYPE,
family = AbstractDragIndicator.COMPONENT_FAMILY,
Modified: sandbox/trunk/ui/drag-drop/ui/src/main/java/org/richfaces/component/behavior/DropBehavior.java
===================================================================
--- sandbox/trunk/ui/drag-drop/ui/src/main/java/org/richfaces/component/behavior/DropBehavior.java 2010-11-26 17:27:32 UTC (rev 20187)
+++ sandbox/trunk/ui/drag-drop/ui/src/main/java/org/richfaces/component/behavior/DropBehavior.java 2010-11-26 18:16:17 UTC (rev 20188)
@@ -29,6 +29,7 @@
import org.richfaces.cdk.annotations.JsfBehavior;
import org.richfaces.cdk.annotations.Tag;
import org.richfaces.cdk.annotations.TagType;
+import org.richfaces.event.DropListener;
import org.richfaces.renderkit.util.CoreAjaxRendererUtils;
/**
@@ -37,7 +38,7 @@
*/
@JsfBehavior(
- id = DropBehavior.BEHAVIOR_ID, tag = @Tag(name = "dropBehavior", handler = "org.richfaces.view.facelets.html.CustomBehaviorHandler", type = TagType.Facelets)
+ id = DropBehavior.BEHAVIOR_ID, tag = @Tag(name = "dropBehavior", handler = "org.richfaces.view.facelets.html.DropBehaviorHandler", type = TagType.Facelets)
)
public class DropBehavior extends ClientBehavior implements ClientDropBehavior {
@@ -63,6 +64,14 @@
return (Set<String>)getStateHelper().eval(PropertyKeys.acceptType);
}
+ public void addDropListener(DropListener listener) {
+ addBehaviorListener(listener);
+ }
+
+ public void removeDropListener(DropListener listener) {
+ removeBehaviorListener(listener);
+ }
+
@Override
public void setLiteralAttribute(String name, Object value) {
if(compare(PropertyKeys.acceptType, name)) {
@@ -76,4 +85,5 @@
public String getRendererType() {
return BEHAVIOR_ID;
}
+
}
Added: sandbox/trunk/ui/drag-drop/ui/src/main/java/org/richfaces/renderkit/DnDBehaviorRenderBase.java
===================================================================
--- sandbox/trunk/ui/drag-drop/ui/src/main/java/org/richfaces/renderkit/DnDBehaviorRenderBase.java (rev 0)
+++ sandbox/trunk/ui/drag-drop/ui/src/main/java/org/richfaces/renderkit/DnDBehaviorRenderBase.java 2010-11-26 18:16:17 UTC (rev 20188)
@@ -0,0 +1,67 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright ${year}, Red Hat, Inc. and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+
+package org.richfaces.renderkit;
+
+import java.util.Map;
+
+import javax.faces.component.UIComponent;
+import javax.faces.component.behavior.ClientBehavior;
+import javax.faces.component.behavior.ClientBehaviorContext;
+import javax.faces.render.ClientBehaviorRenderer;
+
+import org.ajax4jsf.javascript.JSFunction;
+import org.ajax4jsf.javascript.JSReference;
+import org.richfaces.renderkit.util.RendererUtils;
+
+/**
+ * @author abelevich
+ *
+ */
+public abstract class DnDBehaviorRenderBase extends ClientBehaviorRenderer {
+
+ private static final RendererUtils UTILS = RendererUtils.getInstance();
+
+
+ protected abstract Map<String, Object> getOptions(ClientBehaviorContext behaviorContext, ClientBehavior clientBehavior);
+
+ protected abstract String getScriptName();
+
+ public String getScript(ClientBehaviorContext behaviorContext, ClientBehavior behavior) {
+ UIComponent parent = behaviorContext.getComponent();
+ String scriptName = getScriptName();
+ String script = null;
+ if(!"".equals(scriptName)) {
+ JSFunction function = new JSFunction(scriptName);
+ function.addParameter(JSReference.EVENT);
+ function.addParameter(parent.getClientId(behaviorContext.getFacesContext()));
+ function.addParameter(getOptions(behaviorContext, behavior));
+ script = function.toScript();
+ }
+ return script;
+ }
+
+ public RendererUtils getUtils() {
+ return UTILS;
+ }
+
+}
Modified: sandbox/trunk/ui/drag-drop/ui/src/main/java/org/richfaces/renderkit/DragBehaviorRendererBase.java
===================================================================
--- sandbox/trunk/ui/drag-drop/ui/src/main/java/org/richfaces/renderkit/DragBehaviorRendererBase.java 2010-11-26 17:27:32 UTC (rev 20187)
+++ sandbox/trunk/ui/drag-drop/ui/src/main/java/org/richfaces/renderkit/DragBehaviorRendererBase.java 2010-11-26 18:16:17 UTC (rev 20188)
@@ -31,14 +31,11 @@
import javax.faces.component.behavior.ClientBehavior;
import javax.faces.component.behavior.ClientBehaviorContext;
import javax.faces.context.FacesContext;
-import javax.faces.render.ClientBehaviorRenderer;
import javax.faces.render.FacesBehaviorRenderer;
import javax.faces.render.RenderKitFactory;
-import org.ajax4jsf.javascript.JSFunction;
-import org.richfaces.component.behavior.DragBehavior;
import org.richfaces.component.behavior.ClientDragBehavior;
-import org.richfaces.renderkit.util.RendererUtils;
+import org.richfaces.component.behavior.DragBehavior;
/**
* @author abelevich
@@ -56,19 +53,8 @@
@ResourceDependency(library = "org.richfaces", name = "dnd-draggable.js"),
@ResourceDependency(library = "org.richfaces", name = "dnd-manager.js")
})
-public class DragBehaviorRendererBase extends ClientBehaviorRenderer {
-
- private static final RendererUtils UTILS = RendererUtils.getInstance();
-
- @Override
- public String getScript(ClientBehaviorContext behaviorContext, ClientBehavior behavior) {
- UIComponent parent = behaviorContext.getComponent();
- JSFunction function = new JSFunction("RichFaces.ui.DnDManager.draggable");
- function.addParameter(parent.getClientId(behaviorContext.getFacesContext()));
- function.addParameter(getOptions(behaviorContext, behavior));
- return function.toString();
- }
-
+public class DragBehaviorRendererBase extends DnDBehaviorRenderBase {
+
public Map<String, Object> getOptions(ClientBehaviorContext clientBehaviorContext, ClientBehavior behavior) {
Map<String, Object> options = new HashMap<String, Object>();
if(behavior instanceof ClientDragBehavior) {
@@ -79,6 +65,11 @@
return options;
}
+ @Override
+ protected String getScriptName() {
+ return "RichFaces.ui.DnDManager.draggable";
+ }
+
public String getDragIndicatorClientId(ClientBehaviorContext clientBehaviorContext, ClientDragBehavior dragBehavior) {
String indicatorId = dragBehavior.getIndicator();
if(indicatorId != null) {
@@ -92,9 +83,4 @@
}
return indicatorId;
}
-
- public RendererUtils getUtils() {
- return UTILS;
- }
-
}
Modified: sandbox/trunk/ui/drag-drop/ui/src/main/java/org/richfaces/renderkit/DragIndicatorRendererBase.java
===================================================================
--- sandbox/trunk/ui/drag-drop/ui/src/main/java/org/richfaces/renderkit/DragIndicatorRendererBase.java 2010-11-26 17:27:32 UTC (rev 20187)
+++ sandbox/trunk/ui/drag-drop/ui/src/main/java/org/richfaces/renderkit/DragIndicatorRendererBase.java 2010-11-26 18:16:17 UTC (rev 20188)
@@ -1,3 +1,25 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright ${year}, Red Hat, Inc. and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+
package org.richfaces.renderkit;
import javax.faces.application.ResourceDependencies;
@@ -4,6 +26,11 @@
import javax.faces.application.ResourceDependency;
+/**
+ * @author abelevich
+ *
+ */
+
@ResourceDependencies({
@ResourceDependency(library = "javax.faces", name = "jsf.js"),
@ResourceDependency(name = "jquery.js"),
Modified: sandbox/trunk/ui/drag-drop/ui/src/main/java/org/richfaces/renderkit/DropBehaviorRendererBase.java
===================================================================
--- sandbox/trunk/ui/drag-drop/ui/src/main/java/org/richfaces/renderkit/DropBehaviorRendererBase.java 2010-11-26 17:27:32 UTC (rev 20187)
+++ sandbox/trunk/ui/drag-drop/ui/src/main/java/org/richfaces/renderkit/DropBehaviorRendererBase.java 2010-11-26 18:16:17 UTC (rev 20188)
@@ -36,15 +36,13 @@
import javax.faces.component.behavior.ClientBehaviorContext;
import javax.faces.component.behavior.ClientBehaviorHolder;
import javax.faces.context.FacesContext;
-import javax.faces.render.ClientBehaviorRenderer;
import javax.faces.render.FacesBehaviorRenderer;
import javax.faces.render.RenderKitFactory;
-import org.ajax4jsf.javascript.JSFunction;
import org.richfaces.component.behavior.ClientDragBehavior;
import org.richfaces.component.behavior.ClientDropBehavior;
import org.richfaces.component.behavior.DropBehavior;
-import org.richfaces.event.DropBehaviorEvent;
+import org.richfaces.event.DropEvent;
/**
@@ -64,29 +62,22 @@
@ResourceDependency(library = "org.richfaces", name = "dnd-droppable.js"),
@ResourceDependency(library = "org.richfaces", name = "dnd-manager.js")
})
-public class DropBehaviorRendererBase extends ClientBehaviorRenderer {
+public class DropBehaviorRendererBase extends DnDBehaviorRenderBase {
@Override
public void decode(FacesContext facesContext, UIComponent component, ClientBehavior behavior) {
if (null == facesContext || null == component || behavior == null) {
throw new NullPointerException();
}
-
- String clientId = component.getClientId(facesContext);
+
Map<String, String> requestParamMap = facesContext.getExternalContext().getRequestParameterMap();
- if(clientId.equals(requestParamMap.containsKey("dropSource"))) {
- String dragSource = (String) requestParamMap.get("dragSource");
- facesContext.getViewRoot().invokeOnComponent(facesContext, dragSource, new DropBehaviorContextCallBack(component, (ClientDropBehavior)behavior));
- }
+ String dragSource = (String) requestParamMap.get("dragSource");
+ facesContext.getViewRoot().invokeOnComponent(facesContext, dragSource, new DropBehaviorContextCallBack(component, (ClientDropBehavior)behavior));
}
@Override
- public String getScript(ClientBehaviorContext behaviorContext, ClientBehavior behavior) {
- UIComponent parent = behaviorContext.getComponent();
- JSFunction function = new JSFunction("RichFaces.ui.DnDManager.droppable");
- function.addParameter(parent.getClientId(behaviorContext.getFacesContext()));
- function.addParameter(getOptions(behaviorContext, behavior));
- return function.toString();
+ protected String getScriptName() {
+ return "RichFaces.ui.DnDManager.droppable";
}
public Map<String, Object> getOptions(ClientBehaviorContext behaviorContext, ClientBehavior behavior) {
@@ -115,10 +106,11 @@
ClientDragBehavior dragBehavior = getDragBehavior(target, "mouseover");
if(dragBehavior != null) {
- DropBehaviorEvent dropEvent = new DropBehaviorEvent(dropSource, dropBehavior);
+ DropEvent dropEvent = new DropEvent(dropSource, dropBehavior);
dropEvent.setDragSource(target);
dropEvent.setDragValue(dragBehavior.getDragValue());
dropEvent.setDropValue(dropBehavior.getDropValue());
+ dropEvent.setAcceptType(dropBehavior.getAcceptType());
dropEvent.queue();
} else {
//TODO: log
Added: sandbox/trunk/ui/drag-drop/ui/src/main/java/org/richfaces/view/facelets/html/DropBehaviorHandler.java
===================================================================
--- sandbox/trunk/ui/drag-drop/ui/src/main/java/org/richfaces/view/facelets/html/DropBehaviorHandler.java (rev 0)
+++ sandbox/trunk/ui/drag-drop/ui/src/main/java/org/richfaces/view/facelets/html/DropBehaviorHandler.java 2010-11-26 18:16:17 UTC (rev 20188)
@@ -0,0 +1,78 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright ${year}, Red Hat, Inc. and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+
+package org.richfaces.view.facelets.html;
+
+import javax.faces.view.facelets.BehaviorConfig;
+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.richfaces.component.behavior.ClientDropBehavior;
+import org.richfaces.event.MethodExpressionDropListener;
+
+/**
+ * @author abelevich
+ *
+ */
+public class DropBehaviorHandler extends CustomBehaviorHandler{
+
+ private static final DropBehaviorMetaRule METARULE = new DropBehaviorMetaRule();
+
+ public DropBehaviorHandler(BehaviorConfig config) {
+ super(config);
+ }
+
+ protected MetaRuleset createMetaRuleset(Class type) {
+ MetaRuleset m = super.createMetaRuleset(type);
+ m.addRule(METARULE);
+ return m;
+ }
+
+ static class DropBehaviorMetaRule extends MetaRule {
+ public Metadata applyRule(String name, TagAttribute attribute, MetadataTarget meta) {
+ if (meta.isTargetInstanceOf(ClientDropBehavior.class) && "dropListener".equals(name)) {
+ return new DropBehaviorMapper(attribute);
+ }
+ return null;
+ }
+ }
+
+ static class DropBehaviorMapper extends Metadata {
+
+ private static final Class[] SIGNATURE = new Class[] { org.richfaces.event.DropEvent.class };
+
+ private final TagAttribute attribute;
+
+ public DropBehaviorMapper(TagAttribute attribute) {
+ this.attribute = attribute;
+ }
+
+ public void applyMetadata(FaceletContext ctx, Object instance) {
+ ((ClientDropBehavior) instance).addDropListener((new MethodExpressionDropListener( this.attribute.getMethodExpression(ctx, null, SIGNATURE))));
+ }
+ }
+
+}
Modified: sandbox/trunk/ui/drag-drop/ui/src/main/resources/META-INF/resources/org.richfaces/dnd-droppable.js
===================================================================
--- sandbox/trunk/ui/drag-drop/ui/src/main/resources/META-INF/resources/org.richfaces/dnd-droppable.js 2010-11-26 17:27:32 UTC (rev 20187)
+++ sandbox/trunk/ui/drag-drop/ui/src/main/resources/META-INF/resources/org.richfaces/dnd-droppable.js 2010-11-26 18:16:17 UTC (rev 20188)
@@ -5,10 +5,8 @@
rf.ui.Droppable = function(id, options) {
this.options = options;
this.dropElement = $(document.getElementById(id));
-
+
this.dropElement.droppable({addClasses: false});
- this.dropElement.droppable("option", "hoverClass", 'rf-drop-hover');
- this.dropElement.droppable("option", "activeClass", 'rf-drop-highlight');
this.dropElement.data("init", true);
this.dropElement.bind('drop', $.proxy(this.drop, this));
this.dropElement.bind('dropover', $.proxy(this.dropover, this));
@@ -18,13 +16,15 @@
$.extend(rf.ui.Droppable.prototype, ( function () {
return {
drop: function(e, ui) {
- var helper = ui.helper;
- var indicator = rf.$(helper.attr("id"));
- if(indicator) {
- helper.removeClass(indicator.acceptClass());
- helper.removeClass(indicator.rejectClass());
+ if(this.accept(ui.draggable)) {
+ var helper = ui.helper;
+ var indicator = rf.$(helper.attr("id"));
+ if(indicator) {
+ helper.removeClass(indicator.acceptClass());
+ helper.removeClass(indicator.rejectClass());
+ }
+ this.__callAjax(e, ui);
}
- this.__callAjax(e, ui);
},
dropover: function(event, ui) {
@@ -65,11 +65,12 @@
__callAjax: function(e, ui){
var options = {};
+ var originalEvent = this.options['event'];
if(ui.draggable) {
options['dragSource'] = ui.draggable.attr("id");
- options['dropSource'] = this.dropElement.attr("id");
+ options['javax.faces.behavior.event'] = originalEvent.type;
}
- rf.ajax(this.dropElement[0], e, {parameters: options});
+ rf.ajax(this.dropElement[0], originalEvent, {parameters: options});
}
}
})());
Modified: sandbox/trunk/ui/drag-drop/ui/src/main/resources/META-INF/resources/org.richfaces/dnd-manager.js
===================================================================
--- sandbox/trunk/ui/drag-drop/ui/src/main/resources/META-INF/resources/org.richfaces/dnd-manager.js 2010-11-26 17:27:32 UTC (rev 20187)
+++ sandbox/trunk/ui/drag-drop/ui/src/main/resources/META-INF/resources/org.richfaces/dnd-manager.js 2010-11-26 18:16:17 UTC (rev 20188)
@@ -9,16 +9,18 @@
var droppables = {};
return {
- draggable: function(id, options) {
+ draggable: function(event, id, options) {
var draggable = draggables[id];
if(!draggable) {
+ options['event'] = event;
draggables[id] = new rf.ui.Draggable(id, options);
}
},
- droppable: function(id, options) {
+ droppable: function(event, id, options) {
var droppable = droppables[id];
if(!droppable) {
+ options['event'] = event;
droppables[id] = new rf.ui.Droppable(id, options);
}
}
14 years, 1 month
JBoss Rich Faces SVN: r20187 - trunk/ui/output/ui/src/main/resources/META-INF/resources/org.richfaces.
by richfaces-svn-commits@lists.jboss.org
Author: konstantin.mishin
Date: 2010-11-26 12:27:32 -0500 (Fri, 26 Nov 2010)
New Revision: 20187
Modified:
trunk/ui/output/ui/src/main/resources/META-INF/resources/org.richfaces/progressBar.js
Log:
RF-9496
Modified: trunk/ui/output/ui/src/main/resources/META-INF/resources/org.richfaces/progressBar.js
===================================================================
--- trunk/ui/output/ui/src/main/resources/META-INF/resources/org.richfaces/progressBar.js 2010-11-26 16:49:58 UTC (rev 20186)
+++ trunk/ui/output/ui/src/main/resources/META-INF/resources/org.richfaces/progressBar.js 2010-11-26 17:27:32 UTC (rev 20187)
@@ -3,6 +3,7 @@
rf.ui = rf.ui || {};
var defaultOptions = {
+ interval: 1000,
minValue: 0,
maxValue: 100
};
14 years, 1 month
JBoss Rich Faces SVN: r20186 - sandbox/trunk/ui/fileupload/ui/src/main/resources/META-INF/resources/org.richfaces.
by richfaces-svn-commits@lists.jboss.org
Author: konstantin.mishin
Date: 2010-11-26 11:49:58 -0500 (Fri, 26 Nov 2010)
New Revision: 20186
Added:
sandbox/trunk/ui/fileupload/ui/src/main/resources/META-INF/resources/org.richfaces/fu-add-dis.gif
Modified:
sandbox/trunk/ui/fileupload/ui/src/main/resources/META-INF/resources/org.richfaces/fileupload.ecss
Log:
RF-9501
Modified: sandbox/trunk/ui/fileupload/ui/src/main/resources/META-INF/resources/org.richfaces/fileupload.ecss
===================================================================
--- sandbox/trunk/ui/fileupload/ui/src/main/resources/META-INF/resources/org.richfaces/fileupload.ecss 2010-11-26 16:48:59 UTC (rev 20185)
+++ sandbox/trunk/ui/fileupload/ui/src/main/resources/META-INF/resources/org.richfaces/fileupload.ecss 2010-11-26 16:49:58 UTC (rev 20186)
@@ -110,8 +110,9 @@
overflow: hidden;
position: relative;
}
+
.rf-fu-btn-cnt-add-dis {
- background-image: url("#{resource['org.richfaces:fu-add.gif']}");
+ background-image: url("#{resource['org.richfaces:fu-add-dis.gif']}");
color: '#{richSkin.tabDisabledTextColor}';
}
Added: sandbox/trunk/ui/fileupload/ui/src/main/resources/META-INF/resources/org.richfaces/fu-add-dis.gif
===================================================================
(Binary files differ)
Property changes on: sandbox/trunk/ui/fileupload/ui/src/main/resources/META-INF/resources/org.richfaces/fu-add-dis.gif
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
14 years, 1 month