JBoss Rich Faces SVN: r11573 - trunk/ui/progressBAR/src/main/java/org/richfaces/renderkit.
by richfaces-svn-commits@lists.jboss.org
Author: andrei_exadel
Date: 2008-12-05 06:50:42 -0500 (Fri, 05 Dec 2008)
New Revision: 11573
Modified:
trunk/ui/progressBAR/src/main/java/org/richfaces/renderkit/AbstractProgressBarRenderer.java
Log:
Fix nonsense catch handler
Modified: trunk/ui/progressBAR/src/main/java/org/richfaces/renderkit/AbstractProgressBarRenderer.java
===================================================================
--- trunk/ui/progressBAR/src/main/java/org/richfaces/renderkit/AbstractProgressBarRenderer.java 2008-12-05 06:24:39 UTC (rev 11572)
+++ trunk/ui/progressBAR/src/main/java/org/richfaces/renderkit/AbstractProgressBarRenderer.java 2008-12-05 11:50:42 UTC (rev 11573)
@@ -54,6 +54,8 @@
import org.ajax4jsf.renderkit.ComponentsVariableResolver;
import org.ajax4jsf.renderkit.RendererUtils.HTML;
import org.ajax4jsf.resource.CountingOutputWriter;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
import org.richfaces.component.UIProgressBar;
/**
@@ -63,6 +65,8 @@
*
*/
public class AbstractProgressBarRenderer extends TemplateEncoderRendererBase {
+
+ private static final Log log = LogFactory.getLog(AbstractProgressBarRenderer.class);
/** Ajax function performing polling */
private static final String AJAX_POLL_FUNCTION = "A4J.AJAX.Poll";
@@ -123,7 +127,7 @@
* @return
*/
public StringBuffer getMarkup(FacesContext context, UIComponent component) {
- StringBuffer result = null;
+ StringBuffer result = new StringBuffer();
CountingOutputWriter customWriter = new CountingOutputWriter();
try {
if (hasChildren(component)) {
@@ -161,7 +165,7 @@
result = customWriter.getContent();
}
} catch (Exception e) {
- e.getMessage();
+ log.error("Error occurred during rendering of progress bar label. It switched to empty string", e);
}
return result;
16 years, 1 month
JBoss Rich Faces SVN: r11572 - trunk/ui/tree/src/main/java/org/richfaces/component.
by richfaces-svn-commits@lists.jboss.org
Author: nbelaevski
Date: 2008-12-05 01:24:39 -0500 (Fri, 05 Dec 2008)
New Revision: 11572
Modified:
trunk/ui/tree/src/main/java/org/richfaces/component/UITree.java
Log:
https://jira.jboss.org/jira/browse/RF-4557
Modified: trunk/ui/tree/src/main/java/org/richfaces/component/UITree.java
===================================================================
--- trunk/ui/tree/src/main/java/org/richfaces/component/UITree.java 2008-12-05 05:12:04 UTC (rev 11571)
+++ trunk/ui/tree/src/main/java/org/richfaces/component/UITree.java 2008-12-05 06:24:39 UTC (rev 11572)
@@ -934,6 +934,8 @@
}
};
+ component.getAttributes().put("escape", Boolean.TRUE);
+
return component;
}
16 years, 1 month
JBoss Rich Faces SVN: r11571 - trunk/ui/beanValidator/src/main/java/org/richfaces/validator.
by richfaces-svn-commits@lists.jboss.org
Author: nbelaevski
Date: 2008-12-05 00:12:04 -0500 (Fri, 05 Dec 2008)
New Revision: 11571
Modified:
trunk/ui/beanValidator/src/main/java/org/richfaces/validator/BeanValidator.java
Log:
https://jira.jboss.org/jira/browse/RF-4847
Modified: trunk/ui/beanValidator/src/main/java/org/richfaces/validator/BeanValidator.java
===================================================================
--- trunk/ui/beanValidator/src/main/java/org/richfaces/validator/BeanValidator.java 2008-12-05 03:00:30 UTC (rev 11570)
+++ trunk/ui/beanValidator/src/main/java/org/richfaces/validator/BeanValidator.java 2008-12-05 05:12:04 UTC (rev 11571)
@@ -284,7 +284,16 @@
if (null == appBundle || null == locale) {
return null;
}
- ResourceBundle bundle = ResourceBundle.getBundle(appBundle, locale);
+
+ ResourceBundle bundle;
+
+ ClassLoader classLoader = Thread.currentThread().getContextClassLoader();
+ if (classLoader != null) {
+ bundle = ResourceBundle.getBundle(appBundle, locale, classLoader);
+ } else {
+ bundle = ResourceBundle.getBundle(appBundle, locale);
+ }
+
return bundle;
}
16 years, 1 month
JBoss Rich Faces SVN: r11570 - trunk/framework/impl/src/main/javascript/ajaxjsf.
by richfaces-svn-commits@lists.jboss.org
Author: nbelaevski
Date: 2008-12-04 22:00:30 -0500 (Thu, 04 Dec 2008)
New Revision: 11570
Modified:
trunk/framework/impl/src/main/javascript/ajaxjsf/JSFAJAX.js
Log:
https://jira.jboss.org/jira/browse/RF-2776
Modified: trunk/framework/impl/src/main/javascript/ajaxjsf/JSFAJAX.js
===================================================================
--- trunk/framework/impl/src/main/javascript/ajaxjsf/JSFAJAX.js 2008-12-04 20:41:46 UTC (rev 11569)
+++ trunk/framework/impl/src/main/javascript/ajaxjsf/JSFAJAX.js 2008-12-05 03:00:30 UTC (rev 11570)
@@ -1313,7 +1313,7 @@
},
radio : function(control){
- this._check_query(control);
+ this._radio_query(control);
},
checkbox : function(control){
@@ -1492,6 +1492,12 @@
}
},
+ _radio_query : function(control) {
+ if( control.checked ) {
+ this.appendParameter(control.name, control.value?control.value:"");
+ }
+ },
+
// Append parameter to query. if name exist, append to array of parameters
appendParameter: function(cname,value){
if( ! this._query[cname] ){
16 years, 1 month
JBoss Rich Faces SVN: r11569 - trunk/ui/tree/src/main/java/org/richfaces/component/events.
by richfaces-svn-commits@lists.jboss.org
Author: nbelaevski
Date: 2008-12-04 15:41:46 -0500 (Thu, 04 Dec 2008)
New Revision: 11569
Modified:
trunk/ui/tree/src/main/java/org/richfaces/component/events/TreeEvents.java
Log:
DnD Events refactoring
Modified: trunk/ui/tree/src/main/java/org/richfaces/component/events/TreeEvents.java
===================================================================
--- trunk/ui/tree/src/main/java/org/richfaces/component/events/TreeEvents.java 2008-12-04 19:02:04 UTC (rev 11568)
+++ trunk/ui/tree/src/main/java/org/richfaces/component/events/TreeEvents.java 2008-12-04 20:41:46 UTC (rev 11569)
@@ -65,13 +65,9 @@
} else if (event instanceof NodeSelectedEvent) {
binding = eventsProducer.getNodeSelectListener();
} else if (event instanceof DropEvent) {
- if (((DropEvent) event).isValid()) {
- binding = eventsProducer.getDropListener();
- }
+ binding = eventsProducer.getDropListener();
} else if (event instanceof DragEvent) {
- if (((DragEvent) event).isValid()) {
- binding = eventsProducer.getDragListener();
- }
+ binding = eventsProducer.getDragListener();
}
if (binding != null) {
16 years, 1 month
JBoss Rich Faces SVN: r11568 - trunk/samples/dragDropDemo/src/main/webapp/pages.
by richfaces-svn-commits@lists.jboss.org
Author: nbelaevski
Date: 2008-12-04 14:02:04 -0500 (Thu, 04 Dec 2008)
New Revision: 11568
Modified:
trunk/samples/dragDropDemo/src/main/webapp/pages/index.jsp
Log:
https://jira.jboss.org/jira/browse/RF-961
Modified: trunk/samples/dragDropDemo/src/main/webapp/pages/index.jsp
===================================================================
--- trunk/samples/dragDropDemo/src/main/webapp/pages/index.jsp 2008-12-04 18:52:08 UTC (rev 11567)
+++ trunk/samples/dragDropDemo/src/main/webapp/pages/index.jsp 2008-12-04 19:02:04 UTC (rev 11568)
@@ -33,48 +33,160 @@
<h:form id="form">
<h:selectOneRadio binding="#{skinBean.component}" />
<h:commandLink action="#{skinBean.change}" value="set skin" />
-
- <h:panelGroup id="dragValueText">
- <h:outputText value="#{bean.dragValue}" />
- </h:panelGroup>
-
- <h:panelGrid columns="3">
- <h:dataTable var="type" value="#{bean.types}">
- <h:column>
- <h:panelGrid styleClass="dropzoneDecoration" id="drop1">
- <h:outputText value="#{type} - drop" />
+ </h:form>
+ <h:panelGrid columns="3">
+ <h:form>
+ <fieldset>
+ <legend>Tables</legend>
+
+ <h:panelGroup id="dragValueText">
+ <h:outputText value="#{bean.dragValue}" />
+ </h:panelGroup>
- <dnd:dropSupport reRender="dragValueText" action="#{bean.dropAction}" acceptedTypes="#{type}" dropListener="#{bean.processDrop}" dropValue="#{type} - value">
- <a4j:actionparam value="#{type} - test drop param" assignTo="#{bean.testParam}" />
- </dnd:dropSupport>
- </h:panelGrid>
- </h:column>
- </h:dataTable>
-
- <h:dataTable var="type" value="#{bean.types}">
- <h:column>
- <h:panelGrid styleClass="dropzoneDecoration" id="drag1">
- <h:outputText value="#{type} - drag" />
+ <h:panelGrid columns="3">
+ <h:dataTable var="type" value="#{bean.types}">
+ <h:column>
+ <h:panelGrid styleClass="dropzoneDecoration" id="drop1A">
+ <h:outputText value="#{type} - drop" />
+
+ <dnd:dropSupport reRender="dragValueText" action="#{bean.dropAction}" acceptedTypes="#{type}" dropListener="#{bean.processDrop}" dropValue="#{type} - value">
+ <a4j:actionparam value="#{type} - test drop param" assignTo="#{bean.testParam}" />
+ </dnd:dropSupport>
+ </h:panelGrid>
+ </h:column>
+ </h:dataTable>
+
+ <h:dataTable var="type" value="#{bean.types}">
+ <h:column>
+ <h:panelGrid styleClass="dropzoneDecoration" id="drag1">
+ <h:outputText value="#{type} - drag" />
+
+ <dnd:dragSupport dragType="#{type}" dragValue="#{type} - value" action="#{bean.dragAction}" dragListener="#{bean.processDrag}">
+ <a4j:actionparam value="#{type} - test drag param" assignTo="#{bean.testParam}" />
+ </dnd:dragSupport>
+ </h:panelGrid>
+ </h:column>
+ </h:dataTable>
- <dnd:dragSupport dragType="#{type}" dragValue="#{type} - value" action="#{bean.dragAction}" dragListener="#{bean.processDrag}">
- <a4j:actionparam value="#{type} - test drag param" assignTo="#{bean.testParam}" />
- </dnd:dragSupport>
- </h:panelGrid>
- </h:column>
- </h:dataTable>
-
- <h:dataTable var="type" value="#{bean.types}">
- <h:column>
- <h:panelGrid styleClass="dropzoneDecoration" id="drop2">
- <h:outputText value="#{type} - drop" />
+ <h:dataTable var="type" value="#{bean.types}">
+ <h:column>
+ <h:panelGrid styleClass="dropzoneDecoration" id="drop1B">
+ <h:outputText value="#{type} - drop" />
+
+ <dnd:dropSupport reRender="dragValueText" action="#{bean.dropAction}" acceptedTypes="#{type}" dropListener="#{bean.processDrop}" dropValue="#{type} - value">
+ </dnd:dropSupport>
+ </h:panelGrid>
+ </h:column>
+ </h:dataTable>
+ </h:panelGrid>
+ </fieldset>
+ </h:form>
+ <h:form>
+ <fieldset>
+ <legend>Regions</legend>
+
+ <h:panelGroup id="regionsDragValueText">
+ <h:outputText value="#{bean.dragValue}" />
+ </h:panelGroup>
+ <h:panelGrid columns="3">
+ <h:dataTable var="type" value="#{bean.types}">
+ <h:column>
+ <a4j:region>
+ <h:panelGrid styleClass="dropzoneDecoration" id="drop2A">
+ <h:outputText value="#{type} - drop" />
+
+ <dnd:dropSupport ajaxSingle="true" reRender="regionsDragValueText" action="#{bean.dropAction}" acceptedTypes="#{type}" dropListener="#{bean.processDrop}" dropValue="#{type} - value">
+ <a4j:actionparam value="#{type} - test drop param" assignTo="#{bean.testParam}" />
+ </dnd:dropSupport>
+ </h:panelGrid>
+ </a4j:region>
+ </h:column>
+ </h:dataTable>
+
+ <h:dataTable var="type" value="#{bean.types}">
+ <h:column>
+ <a4j:region>
+ <h:panelGrid styleClass="dropzoneDecoration" id="drag2">
+ <h:outputText value="#{type} - drag" />
+
+ <dnd:dragSupport ajaxSingle="true" dragType="#{type}" dragValue="#{type} - value" action="#{bean.dragAction}" dragListener="#{bean.processDrag}">
+ <a4j:actionparam value="#{type} - test drag param" assignTo="#{bean.testParam}" />
+ </dnd:dragSupport>
+ </h:panelGrid>
+ </a4j:region>
+ </h:column>
+ </h:dataTable>
- <dnd:dropSupport reRender="dragValueText" action="#{bean.dropAction}" acceptedTypes="#{type}" dropListener="#{bean.processDrop}" dropValue="#{type} - value">
- </dnd:dropSupport>
- </h:panelGrid>
- </h:column>
- </h:dataTable>
- </h:panelGrid>
+ <h:dataTable var="type" value="#{bean.types}">
+ <h:column>
+ <a4j:region>
+ <h:panelGrid styleClass="dropzoneDecoration" id="drop2B">
+ <h:outputText value="#{type} - drop" />
+
+ <dnd:dropSupport ajaxSingle="true" reRender="regionsDragValueText" action="#{bean.dropAction}" acceptedTypes="#{type}" dropListener="#{bean.processDrop}" dropValue="#{type} - value">
+ </dnd:dropSupport>
+ </h:panelGrid>
+ </a4j:region>
+ </h:column>
+ </h:dataTable>
+ </h:panelGrid>
+ </fieldset>
+ </h:form>
+
+ <h:panelGroup>
+ <fieldset>
+ <legend>Forms</legend>
+
+ <h:panelGroup id="formsDragValueText">
+ <h:outputText value="#{bean.dragValue}" />
+ </h:panelGroup>
+ <h:panelGrid columns="3">
+ <h:dataTable var="type" value="#{bean.types}">
+ <h:column>
+ <h:form>
+ <h:panelGrid styleClass="dropzoneDecoration" id="drag3A">
+ <h:outputText value="#{type} - drop" />
+
+ <dnd:dropSupport ajaxSingle="true" reRender="formsDragValueText" action="#{bean.dropAction}" acceptedTypes="#{type}" dropListener="#{bean.processDrop}" dropValue="#{type} - value">
+ <a4j:actionparam value="#{type} - test drop param" assignTo="#{bean.testParam}" />
+ </dnd:dropSupport>
+ </h:panelGrid>
+ </h:form>
+ </h:column>
+ </h:dataTable>
+
+ <h:dataTable var="type" value="#{bean.types}">
+ <h:column>
+ <h:form>
+ <h:panelGrid styleClass="dropzoneDecoration" id="drag3">
+ <h:outputText value="#{type} - drag" />
+
+ <dnd:dragSupport ajaxSingle="true" dragType="#{type}" dragValue="#{type} - value" action="#{bean.dragAction}" dragListener="#{bean.processDrag}">
+ <a4j:actionparam value="#{type} - test drag param" assignTo="#{bean.testParam}" />
+ </dnd:dragSupport>
+ </h:panelGrid>
+ </h:form>
+ </h:column>
+ </h:dataTable>
+
+ <h:dataTable var="type" value="#{bean.types}">
+ <h:column>
+ <h:form>
+ <h:panelGrid styleClass="dropzoneDecoration" id="drop3B">
+ <h:outputText value="#{type} - drop" />
+
+ <dnd:dropSupport ajaxSingle="true" reRender="formsDragValueText" action="#{bean.dropAction}" acceptedTypes="#{type}" dropListener="#{bean.processDrop}" dropValue="#{type} - value">
+ </dnd:dropSupport>
+ </h:panelGrid>
+ </h:form>
+ </h:column>
+ </h:dataTable>
+ </h:panelGrid>
+ </fieldset>
+ </h:panelGroup>
+ </h:panelGrid>
+ <h:form id="form2">
<dnd:dragIndicator id="indicator" acceptClass="accept" rejectClass="reject" style="width: 500px;">
<f:facet name="single">
<f:verbatim>
16 years, 1 month
JBoss Rich Faces SVN: r11567 - in trunk/ui/drag-drop/src/main/java/org/richfaces: renderkit and 1 other directory.
by richfaces-svn-commits@lists.jboss.org
Author: nbelaevski
Date: 2008-12-04 13:52:08 -0500 (Thu, 04 Dec 2008)
New Revision: 11567
Removed:
trunk/ui/drag-drop/src/main/java/org/richfaces/renderkit/DnDEventsExchangeMailer.java
Modified:
trunk/ui/drag-drop/src/main/java/org/richfaces/component/UIDragSupport.java
trunk/ui/drag-drop/src/main/java/org/richfaces/component/UIDropSupport.java
trunk/ui/drag-drop/src/main/java/org/richfaces/renderkit/DnDValidator.java
trunk/ui/drag-drop/src/main/java/org/richfaces/renderkit/DraggableRendererContributor.java
trunk/ui/drag-drop/src/main/java/org/richfaces/renderkit/DropzoneRendererContributor.java
Log:
https://jira.jboss.org/jira/browse/RF-961
Modified: trunk/ui/drag-drop/src/main/java/org/richfaces/component/UIDragSupport.java
===================================================================
--- trunk/ui/drag-drop/src/main/java/org/richfaces/component/UIDragSupport.java 2008-12-04 18:47:19 UTC (rev 11566)
+++ trunk/ui/drag-drop/src/main/java/org/richfaces/component/UIDragSupport.java 2008-12-04 18:52:08 UTC (rev 11567)
@@ -59,15 +59,13 @@
super.broadcast(event);
if (event instanceof DragEvent) {
DragEvent dragEvent = (DragEvent) event;
- if (dragEvent.isValid()) {
- MethodBinding binding = getDragListener();
- if (binding != null) {
- binding.invoke(getFacesContext(), new Object[] {event});
- }
-
- new AjaxEvent(this).queue();
- new ActionEvent(this).queue();
+ MethodBinding binding = getDragListener();
+ if (binding != null) {
+ binding.invoke(getFacesContext(), new Object[] {event});
}
+
+ new AjaxEvent(this).queue();
+ new ActionEvent(this).queue();
}
}
Modified: trunk/ui/drag-drop/src/main/java/org/richfaces/component/UIDropSupport.java
===================================================================
--- trunk/ui/drag-drop/src/main/java/org/richfaces/component/UIDropSupport.java 2008-12-04 18:47:19 UTC (rev 11566)
+++ trunk/ui/drag-drop/src/main/java/org/richfaces/component/UIDropSupport.java 2008-12-04 18:52:08 UTC (rev 11567)
@@ -57,15 +57,13 @@
public void broadcast(FacesEvent event) throws AbortProcessingException {
super.broadcast(event);
if (event instanceof DropEvent) {
- if (((DropEvent) event).isValid()) {
- MethodBinding binding = getDropListener();
- if (binding != null) {
- binding.invoke(getFacesContext(), new Object[] {event});
- }
-
- new AjaxEvent(this).queue();
- new ActionEvent(this).queue();
+ MethodBinding binding = getDropListener();
+ if (binding != null) {
+ binding.invoke(getFacesContext(), new Object[] {event});
}
+
+ new AjaxEvent(this).queue();
+ new ActionEvent(this).queue();
}
}
Deleted: trunk/ui/drag-drop/src/main/java/org/richfaces/renderkit/DnDEventsExchangeMailer.java
===================================================================
--- trunk/ui/drag-drop/src/main/java/org/richfaces/renderkit/DnDEventsExchangeMailer.java 2008-12-04 18:47:19 UTC (rev 11566)
+++ trunk/ui/drag-drop/src/main/java/org/richfaces/renderkit/DnDEventsExchangeMailer.java 2008-12-04 18:52:08 UTC (rev 11567)
@@ -1,183 +0,0 @@
-/**
- * License Agreement.
- *
- * JBoss RichFaces - Ajax4jsf Component Library
- *
- * Copyright (C) 2007 Exadel, Inc.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License version 2.1 as published by the Free Software Foundation.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-package org.richfaces.renderkit;
-
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
-
-import javax.faces.component.ContextCallback;
-import javax.faces.component.UIComponent;
-import javax.faces.context.FacesContext;
-
-import org.apache.commons.collections.MultiHashMap;
-import org.richfaces.component.Draggable;
-import org.richfaces.component.Dropzone;
-import org.richfaces.event.DnDEvent;
-
-/**
- * @author Nick Belaevski - nbelaevski(a)exadel.com
- * created 27.12.2006
- *
- */
-final class DnDEventsExchangeMailer {
- private DnDEventsExchangeMailer() {
-
- }
-
- private static class EventInfoStructure {
- private DnDEvent dndEvent;
- private EventCallback eventCallback;
-
- private Object type;
- private Object value;
-
- public EventInfoStructure(DnDEvent dndEvent,
- EventCallback eventCallback, Object type, Object value) {
- super();
- this.dndEvent = dndEvent;
- this.eventCallback = eventCallback;
- this.type = type;
- this.value = value;
- }
-
- }
-
- static abstract class EventCallback {
- abstract void processEvent(DnDEvent dndEvent, UIComponent source, FacesContext facesContext, Object type, Object value);
- }
-
- static DnDEventsExchangeMailer getInstance(FacesContext facesContext) {
- synchronized (facesContext) {
- Map requestMap = facesContext.getExternalContext().getRequestMap();
-
- String attrName = DnDEventsExchangeMailer.class.getName();
- DnDEventsExchangeMailer instance;
- if ((instance = (DnDEventsExchangeMailer) requestMap.get(attrName)) == null) {
- instance = new DnDEventsExchangeMailer();
-
- requestMap.put(attrName, instance);
- }
-
- return instance;
- }
- }
-
- private Map<String, EventInfoStructure> queuedMap = new HashMap<String, EventInfoStructure>();
-
- private Map<String, UIComponent> components = new HashMap<String, UIComponent>();
-
- private void processEvent(UIComponent source, FacesContext facesContext, DnDEvent dndEvent, EventCallback callback, Object type, Object value) {
- if (callback != null) {
- callback.processEvent(dndEvent, source, facesContext, type, value);
- }
- }
-
- /**
- * Decode drag & drop events. Collect pairs of correspondent drag & drop events and send them
- * together where OnDrag becomes always before OnDrop.
- *
- * @param sourceId Id of element event come from
- * @param target component that receive event
- * @param facesContext Faces context
- * @param dndEvent drag & drop event descriptor
- * @param callback call back method
- * @param type type of dragged/dropped value
- * @param value dragged/dropped value
- * @param isDraggable whether the event related draggable component or dropzone one.
- */
- public void mailEvent(String sourceId, UIComponent target, FacesContext facesContext, final DnDEvent dndEvent,
- final EventCallback callback, final Object type, final Object value, boolean isDraggable) {
-
- final UIComponent component = components.get(sourceId);
- String targetId = target.getClientId(facesContext);
-
- if (component == null) {
- //component with that sourceId have never mailed anything before - wait
- if (queuedMap.containsKey(sourceId)) {
- throw new IllegalStateException("Drag source with id '" + sourceId + "' already specified.");
- }
- queuedMap.put(sourceId, new EventInfoStructure(dndEvent, callback, type, value));
- components.put(targetId, target);
- } else {
- //check queued mail lists for current component
- final EventInfoStructure eventInfo = (EventInfoStructure) queuedMap.get(targetId);
- if (eventInfo != null) {
- Draggable draggable;
- Dropzone dropzone;
-
- final EventInfoStructure dragEventInfo = isDraggable ? eventInfo : new EventInfoStructure(dndEvent, callback, type, value);
- final EventInfoStructure dropEventInfo = isDraggable ? new EventInfoStructure(dndEvent, callback, type, value) : eventInfo;
-
- Object acceptedTypes;
- Object dragType;
-
- if (isDraggable) {
- draggable = (Draggable) target;
- dropzone = (Dropzone) component;
-
- acceptedTypes = eventInfo.type;
- dragType = type;
- } else {
- draggable = (Draggable) component;
- dropzone = (Dropzone) target;
-
- acceptedTypes = type;
- dragType = eventInfo.type;
- }
-
- if (DnDValidator.validateAcceptTypes(facesContext,
- draggable, dropzone,
- dragType, acceptedTypes)) {
-
- // Make sure that we will have OnDrag event occur first
- facesContext.getViewRoot().invokeOnComponent(facesContext, isDraggable ? targetId : sourceId, new ContextCallback() {
- public void invokeContextCallback(FacesContext fc,
- UIComponent targetComponent) {
-
- processEvent(targetComponent, fc, dragEventInfo.dndEvent, dragEventInfo.eventCallback,
- dropEventInfo.type, dropEventInfo.value);
-
- dropEventInfo.dndEvent.queue();
- }
- });
-
- facesContext.getViewRoot().invokeOnComponent(facesContext, isDraggable ? sourceId : targetId, new ContextCallback() {
- public void invokeContextCallback(FacesContext fc,
- UIComponent targetComponent) {
-
- processEvent(targetComponent, fc, dropEventInfo.dndEvent, dropEventInfo.eventCallback,
- dragEventInfo.type, dragEventInfo.value);
-
- dragEventInfo.dndEvent.queue();
- }
- });
- }
-
- queuedMap.remove(targetId);
- }
- }
- }
-
-}
-
Modified: trunk/ui/drag-drop/src/main/java/org/richfaces/renderkit/DnDValidator.java
===================================================================
--- trunk/ui/drag-drop/src/main/java/org/richfaces/renderkit/DnDValidator.java 2008-12-04 18:47:19 UTC (rev 11566)
+++ trunk/ui/drag-drop/src/main/java/org/richfaces/renderkit/DnDValidator.java 2008-12-04 18:52:08 UTC (rev 11567)
@@ -41,8 +41,8 @@
class DnDValidator {
private final static String MESSAGE_FORMAT = "Dropzone [{0}] with accepted types {1} cannot accept Draggable [{2}] with dragType [{3}]";
- static boolean validateAcceptTypes(FacesContext context, Draggable draggable, Dropzone dropzone, Object dragType, Object acceptedTypes) {
- Set set = AjaxRendererUtils.asSet(acceptedTypes);
+ static boolean validateAcceptTypes(FacesContext context, Draggable draggable, Dropzone dropzone, String dragType, Object acceptedTypes) {
+ Set<String> set = AjaxRendererUtils.asSet(acceptedTypes);
if (set == null || !set.contains(dragType)) {
UIComponent component = (UIComponent) dropzone;
String text = MessageFormat.format(
Modified: trunk/ui/drag-drop/src/main/java/org/richfaces/renderkit/DraggableRendererContributor.java
===================================================================
--- trunk/ui/drag-drop/src/main/java/org/richfaces/renderkit/DraggableRendererContributor.java 2008-12-04 18:47:19 UTC (rev 11566)
+++ trunk/ui/drag-drop/src/main/java/org/richfaces/renderkit/DraggableRendererContributor.java 2008-12-04 18:52:08 UTC (rev 11567)
@@ -32,10 +32,6 @@
import org.ajax4jsf.renderkit.AjaxRendererUtils;
import org.ajax4jsf.renderkit.RendererUtils;
import org.richfaces.component.Draggable;
-import org.richfaces.component.Dropzone;
-import org.richfaces.event.DnDEvent;
-import org.richfaces.event.DragEvent;
-import org.richfaces.renderkit.DnDEventsExchangeMailer.EventCallback;
/**
* @author shura
@@ -45,18 +41,6 @@
public final static String DRAG_SOURCE_ID = "dragSourceId";
- private static final EventCallback dragEventsCallback = new EventCallback() {
-
- void processEvent(DnDEvent dndEvent, UIComponent source,
- FacesContext facesContext, Object type, Object value) {
-
- DragEvent dragEvent = (DragEvent) dndEvent;
- dragEvent.setDropTarget((Dropzone) source);
- dragEvent.setDropValue(value);
- dragEvent.setAcceptedTypes(type);
- }
- };
-
private static DraggableRendererContributor instance;
private DraggableRendererContributor() {
@@ -96,23 +80,7 @@
}
public void decode(FacesContext context, UIComponent component, CompositeRenderer compositeRenderer) {
- DnDEventsExchangeMailer eventsExchanger = DnDEventsExchangeMailer.getInstance(context);
- String clientId = component.getClientId(context);
- Map paramMap = context.getExternalContext().getRequestParameterMap();
-
- if(clientId.equals(paramMap.get(DRAG_SOURCE_ID))){
- String dropTargetId = (String) paramMap.get(DropzoneRendererContributor.DROP_TARGET_ID);
-
- if (compositeRenderer != null) {
- compositeRenderer.contributorDecodeCallback(component, context, this, dropTargetId);
- }
-
- Draggable draggable = (Draggable) component;
-
- eventsExchanger.mailEvent(dropTargetId, component,
- context, new DragEvent(component), dragEventsCallback, draggable.getDragType(),
- draggable.getDragValue(), true);
- }
+ //decoding is done solely by dropzone
}
public String[] getStyleDependencies() {
Modified: trunk/ui/drag-drop/src/main/java/org/richfaces/renderkit/DropzoneRendererContributor.java
===================================================================
--- trunk/ui/drag-drop/src/main/java/org/richfaces/renderkit/DropzoneRendererContributor.java 2008-12-04 18:47:19 UTC (rev 11566)
+++ trunk/ui/drag-drop/src/main/java/org/richfaces/renderkit/DropzoneRendererContributor.java 2008-12-04 18:52:08 UTC (rev 11567)
@@ -24,9 +24,11 @@
import java.util.Map;
import javax.faces.FacesException;
+import javax.faces.component.ContextCallback;
import javax.faces.component.UIComponent;
import javax.faces.context.FacesContext;
+import org.ajax4jsf.component.ContextCallbackWrapper;
import org.ajax4jsf.javascript.DnDScript;
import org.ajax4jsf.javascript.JSFunction;
import org.ajax4jsf.javascript.JSFunctionDefinition;
@@ -36,12 +38,11 @@
import org.ajax4jsf.renderkit.AjaxRendererUtils;
import org.richfaces.component.Draggable;
import org.richfaces.component.Dropzone;
-import org.richfaces.event.DnDEvent;
+import org.richfaces.event.DragEvent;
import org.richfaces.event.DropEvent;
import org.richfaces.json.JSONCollection;
import org.richfaces.json.JSONException;
import org.richfaces.json.JSONMap;
-import org.richfaces.renderkit.DnDEventsExchangeMailer.EventCallback;
/**
* @author shura
@@ -51,21 +52,6 @@
public static final String DROP_TARGET_ID = "dropTargetId";
- private static final EventCallback dropEventsCallback = new EventCallback() {
-
- void processEvent(DnDEvent dndEvent, UIComponent source,
- FacesContext facesContext, Object type, Object value) {
-
- DropEvent dropEvent = (DropEvent) dndEvent;
- Draggable draggable = (Draggable) source;
- dropEvent.setDraggableSource(draggable);
-
- dropEvent.setDragType((String) type);
- dropEvent.setDragValue(value);
-
- }
- };
-
private DropzoneRendererContributor() {
super();
}
@@ -153,26 +139,58 @@
return null;
}
+ private static final class DraggableDecoderContextCallback implements ContextCallback {
+
+ private Dropzone dropzone;
+
+ public DraggableDecoderContextCallback(Dropzone dropzone) {
+ super();
+
+ this.dropzone = dropzone;
+ }
+
+ public void invokeContextCallback(FacesContext context,
+ UIComponent target) {
+
+ Draggable draggable = (Draggable) target;
+
+ String dragType = draggable.getDragType();
+ Object acceptedTypes = dropzone.getAcceptedTypes();
+
+ if (DnDValidator.validateAcceptTypes(context,
+ draggable, dropzone,
+ dragType, acceptedTypes)) {
+
+ DragEvent dragEvent = new DragEvent((UIComponent) draggable);
+ dragEvent.setDropTarget(dropzone);
+ dragEvent.setAcceptedTypes(acceptedTypes);
+ dragEvent.setDropValue(dropzone.getDropValue());
+
+ DropEvent dropEvent = new DropEvent((UIComponent) dropzone);
+ dropEvent.setDraggableSource(draggable);
+ dropEvent.setDragType(dragType);
+ dropEvent.setDragValue(draggable.getDragValue());
+
+ dragEvent.queue();
+ dropEvent.queue();
+ }
+ }
+ }
+
public void decode(FacesContext context, UIComponent component, CompositeRenderer compositeRenderer) {
- DnDEventsExchangeMailer eventsExchanger = DnDEventsExchangeMailer.getInstance(context);
-
String clientId = component.getClientId(context);
- Map paramMap = context.getExternalContext().getRequestParameterMap();
+ Map<String, String> paramMap = context.getExternalContext().getRequestParameterMap();
if(clientId.equals(paramMap.get(DROP_TARGET_ID))){
String dragSourceId = (String) paramMap.get(DraggableRendererContributor.DRAG_SOURCE_ID);
-
- if (compositeRenderer != null) {
- compositeRenderer.contributorDecodeCallback(component, context, this, dragSourceId);
+
+ if (dragSourceId != null && dragSourceId.length() != 0) {
+ DraggableDecoderContextCallback draggableDecoderContextCallback =
+ new DraggableDecoderContextCallback((Dropzone) component);
+
+ context.getViewRoot().invokeOnComponent(context, dragSourceId,
+ new ContextCallbackWrapper(draggableDecoderContextCallback));
}
-
- Dropzone dropzone = (Dropzone) component;
-
- eventsExchanger.mailEvent(dragSourceId, component,
- context, new DropEvent(component), dropEventsCallback,
- dropzone.getAcceptedTypes(),
- dropzone.getDropValue(), false
- );
}
}
@@ -189,7 +207,7 @@
definition.addToBody("var options = ").addToBody(ScriptUtils.toScript(requestOpts)).addToBody(";");
definition.addToBody("options.parameters['" + DROP_TARGET_ID + "'] = '" + component.getClientId(context) + "';");
//TODO nick - remove as legacy
- definition.addToBody("Object.extend(options.parameters,drag.getParameters());");
+ definition.addToBody("Richfaces.mergeObjects(options.parameters, drag.getParameters());");
definition.addToBody("var dzOptions = this.getDropzoneOptions(); if (dzOptions.ondrop) { if (!dzOptions.ondrop.call(this, event)) return; };");
JSFunction dropFunction = AjaxRendererUtils.buildAjaxFunction(component, context);
16 years, 1 month
JBoss Rich Faces SVN: r11566 - in trunk/framework: impl/src/main/java/org/richfaces/renderkit and 1 other directory.
by richfaces-svn-commits@lists.jboss.org
Author: nbelaevski
Date: 2008-12-04 13:47:19 -0500 (Thu, 04 Dec 2008)
New Revision: 11566
Modified:
trunk/framework/api/src/main/java/org/richfaces/event/DnDEvent.java
trunk/framework/api/src/main/java/org/richfaces/event/DragEvent.java
trunk/framework/api/src/main/java/org/richfaces/event/DropEvent.java
trunk/framework/impl/src/main/java/org/richfaces/renderkit/CompositeRenderer.java
Log:
DnD event and related classes refactored
Modified: trunk/framework/api/src/main/java/org/richfaces/event/DnDEvent.java
===================================================================
--- trunk/framework/api/src/main/java/org/richfaces/event/DnDEvent.java 2008-12-04 18:37:08 UTC (rev 11565)
+++ trunk/framework/api/src/main/java/org/richfaces/event/DnDEvent.java 2008-12-04 18:47:19 UTC (rev 11566)
@@ -23,7 +23,6 @@
import javax.faces.component.UIComponent;
import javax.faces.event.FacesEvent;
-import javax.faces.event.FacesListener;
/**
*
@@ -44,25 +43,4 @@
super(component);
}
- protected Object value;
-
- private boolean valid = true;
-
- public boolean isAppropriateListener(FacesListener listener) {
- return valid;
- }
-
- public void invalidate() {
- valid = false;
- }
-
- public boolean isValid() {
- return valid;
- }
-
- public void processListener(FacesListener listener) {
- if (!valid) {
- throw new IllegalStateException();
- }
- }
}
Modified: trunk/framework/api/src/main/java/org/richfaces/event/DragEvent.java
===================================================================
--- trunk/framework/api/src/main/java/org/richfaces/event/DragEvent.java 2008-12-04 18:37:08 UTC (rev 11565)
+++ trunk/framework/api/src/main/java/org/richfaces/event/DragEvent.java 2008-12-04 18:47:19 UTC (rev 11566)
@@ -36,6 +36,7 @@
private Dropzone dropTarget;
private Object acceptedTypes;
+ private Object dropValue;
/**
*
*/
@@ -49,14 +50,13 @@
* @see javax.faces.event.FacesEvent#isAppropriateListener(javax.faces.event.FacesListener)
*/
public boolean isAppropriateListener(FacesListener faceslistener) {
- return super.isAppropriateListener(faceslistener) && faceslistener instanceof DragListener;
+ return faceslistener instanceof DragListener;
}
/* (non-Javadoc)
* @see javax.faces.event.FacesEvent#processListener(javax.faces.event.FacesListener)
*/
public void processListener(FacesListener faceslistener) {
- super.processListener(faceslistener);
((DragListener) faceslistener).processDrag(this);
}
@@ -93,10 +93,10 @@
}
public Object getDropValue() {
- return value;
+ return dropValue;
}
public void setDropValue(Object dropValue) {
- this.value = dropValue;
+ this.dropValue = dropValue;
}
}
Modified: trunk/framework/api/src/main/java/org/richfaces/event/DropEvent.java
===================================================================
--- trunk/framework/api/src/main/java/org/richfaces/event/DropEvent.java 2008-12-04 18:37:08 UTC (rev 11565)
+++ trunk/framework/api/src/main/java/org/richfaces/event/DropEvent.java 2008-12-04 18:47:19 UTC (rev 11566)
@@ -40,6 +40,7 @@
private Draggable draggableSource;
private String dragType;
+ private Object dragValue;
public DropEvent(UIComponent component) {
super(component);
@@ -49,14 +50,13 @@
* @see javax.faces.event.FacesEvent#isAppropriateListener(javax.faces.event.FacesListener)
*/
public boolean isAppropriateListener(FacesListener listener) {
- return super.isAppropriateListener(listener) && listener instanceof DropListener;
+ return listener instanceof DropListener;
}
/* (non-Javadoc)
* @see javax.faces.event.FacesEvent#processListener(javax.faces.event.FacesListener)
*/
public void processListener(FacesListener listener) {
- super.processListener(listener);
((DropListener) listener).processDrop(this);
}
@@ -98,10 +98,10 @@
}
public Object getDragValue() {
- return value;
+ return dragValue;
}
public void setDragValue(Object dragValue) {
- this.value = dragValue;
+ this.dragValue = dragValue;
}
}
Modified: trunk/framework/impl/src/main/java/org/richfaces/renderkit/CompositeRenderer.java
===================================================================
--- trunk/framework/impl/src/main/java/org/richfaces/renderkit/CompositeRenderer.java 2008-12-04 18:37:08 UTC (rev 11565)
+++ trunk/framework/impl/src/main/java/org/richfaces/renderkit/CompositeRenderer.java 2008-12-04 18:47:19 UTC (rev 11566)
@@ -219,11 +219,6 @@
return (RendererContributor[]) renderers.toArray(new RendererContributor[renderers.size()]);
}
- public void contributorDecodeCallback(UIComponent component, FacesContext context, RendererContributor contributor,
- Object argument) {
-
- }
-
protected void addParameterEncoder(AttributeParametersEncoder encoder) {
parameterEncoders.add(encoder);
}
16 years, 1 month
JBoss Rich Faces SVN: r11565 - trunk/test-applications/seleniumTest/richfaces/src/test/java/org/richfaces.
by richfaces-svn-commits@lists.jboss.org
Author: konstantin.mishin
Date: 2008-12-04 13:37:08 -0500 (Thu, 04 Dec 2008)
New Revision: 11565
Modified:
trunk/test-applications/seleniumTest/richfaces/src/test/java/org/richfaces/SeleniumTestBase.java
Log:
RF-5197
only for test
Modified: trunk/test-applications/seleniumTest/richfaces/src/test/java/org/richfaces/SeleniumTestBase.java
===================================================================
--- trunk/test-applications/seleniumTest/richfaces/src/test/java/org/richfaces/SeleniumTestBase.java 2008-12-04 18:03:41 UTC (rev 11564)
+++ trunk/test-applications/seleniumTest/richfaces/src/test/java/org/richfaces/SeleniumTestBase.java 2008-12-04 18:37:08 UTC (rev 11565)
@@ -141,31 +141,6 @@
@BeforeClass
@Parameters({"browser", "filterPrefix"})
public void startSelenium(String browser, String filterPrefix) {
- String[] paths = {"/usr/lib/firefox-1.0.4/firefox",
- "/usr/lib/firefox-1.5.0.10/firefox",
- "/usr/lib/firefox-1.5.0.12/firefox",
- "/usr/lib64/firefox-1.5.0.12/firefox",
- "/usr/lib/firefox-3.0b5/firefox",
- "/usr/lib64/firefox-3.0b5/firefox",
- "/usr/lib/firefox-3.0.1/firefox",
- "/usr/lib64/firefox-3.0.1/firefox",
- "/usr/lib/firefox/firefox",
- "/opt/MozillaFirefox/lib/firefox"
- };
- if ("*firefox".equals(browser)) {
- for (int i = 0; i < paths.length && "*firefox".equals(browser); i++) {
- String path = paths[i] + "-bin";
- File file = new File(path);
- if (file.isFile()) {
- browser += " " + path;
- } /*else {
- file = new File(path + "-bin");
- if (file.isFile()) {
- browser += " " + path + "-bin";
- }
- }*/
- }
- }
synchronized (MUTEX) {
this.filterPrefix = filterPrefix;
selenium = createSeleniumClient(protocol + "://" + host + ":" + port + "/", browser);
16 years, 1 month
JBoss Rich Faces SVN: r11564 - trunk/test-applications/seleniumTest/richfaces/src/test/java/org/richfaces.
by richfaces-svn-commits@lists.jboss.org
Author: konstantin.mishin
Date: 2008-12-04 13:03:41 -0500 (Thu, 04 Dec 2008)
New Revision: 11564
Modified:
trunk/test-applications/seleniumTest/richfaces/src/test/java/org/richfaces/SeleniumTestBase.java
Log:
RF-5197
only for test
Modified: trunk/test-applications/seleniumTest/richfaces/src/test/java/org/richfaces/SeleniumTestBase.java
===================================================================
--- trunk/test-applications/seleniumTest/richfaces/src/test/java/org/richfaces/SeleniumTestBase.java 2008-12-04 18:02:17 UTC (rev 11563)
+++ trunk/test-applications/seleniumTest/richfaces/src/test/java/org/richfaces/SeleniumTestBase.java 2008-12-04 18:03:41 UTC (rev 11564)
@@ -154,16 +154,16 @@
};
if ("*firefox".equals(browser)) {
for (int i = 0; i < paths.length && "*firefox".equals(browser); i++) {
- String path = paths[i];
+ String path = paths[i] + "-bin";
File file = new File(path);
if (file.isFile()) {
browser += " " + path;
- } else {
+ } /*else {
file = new File(path + "-bin");
if (file.isFile()) {
browser += " " + path + "-bin";
}
- }
+ }*/
}
}
synchronized (MUTEX) {
16 years, 1 month