JBoss Rich Faces SVN: r20175 - trunk/examples/push-demo/src/main/webapp/WEB-INF.
by richfaces-svn-commits@lists.jboss.org
Author: ilya_shaikovsky
Date: 2010-11-26 09:04:44 -0500 (Fri, 26 Nov 2010)
New Revision: 20175
Modified:
trunk/examples/push-demo/src/main/webapp/WEB-INF/web.xml
Log:
minor correction for tomcat 6.
Modified: trunk/examples/push-demo/src/main/webapp/WEB-INF/web.xml
===================================================================
--- trunk/examples/push-demo/src/main/webapp/WEB-INF/web.xml 2010-11-25 16:15:30 UTC (rev 20174)
+++ trunk/examples/push-demo/src/main/webapp/WEB-INF/web.xml 2010-11-26 14:04:44 UTC (rev 20175)
@@ -12,17 +12,16 @@
<listener>
<listener-class>com.sun.faces.config.ConfigureListener</listener-class>
</listener>
-
- <filter-mapping>
- <filter-name>PushFilter</filter-name>
- <url-pattern>/faces/*</url-pattern>
- </filter-mapping>
-
<filter>
<filter-name>PushFilter</filter-name>
<filter-class>org.richfaces.webapp.PushFilter</filter-class>
<async-supported>true</async-supported>
</filter>
+
+ <filter-mapping>
+ <filter-name>PushFilter</filter-name>
+ <url-pattern>/faces/*</url-pattern>
+ </filter-mapping>
<!-- context-param>
<param-name>org.atmosphere.useWebSocket</param-name>
14 years, 1 month
JBoss Rich Faces SVN: r20174 - sandbox/trunk/examples/dnd-demo/src/main/webapp/examples.
by richfaces-svn-commits@lists.jboss.org
Author: abelevich
Date: 2010-11-25 11:15:30 -0500 (Thu, 25 Nov 2010)
New Revision: 20174
Modified:
sandbox/trunk/examples/dnd-demo/src/main/webapp/examples/dnd.xhtml
Log:
update demo
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-25 16:13:23 UTC (rev 20173)
+++ sandbox/trunk/examples/dnd-demo/src/main/webapp/examples/dnd.xhtml 2010-11-25 16:15:30 UTC (rev 20174)
@@ -50,33 +50,30 @@
</h:head>
<h:body>
<h:form>
-
- <dnd:dragIndicator id="ind" styleClass="rf-ind" acceptClass="rf-ind-acp" rejectClass="rf-ind-rej"/>
- <dnd:dragIndicator id="ind2" styleClass="rf-ind" acceptClass="rf-ind-acp" rejectClass="rf-ind-rej"/>
-
+ <dnd:dragIndicator id="ind" styleClass="rf-ind" acceptClass="rf-ind-acp" rejectClass="rf-ind-rej" />
<table>
<tr>
- <td>
- <a4j:outputPanel id="drg1" layout="block" styleClass="draggable">
- <dnd:dragBehavior event="mouseover" type="drg1" indicator="ind"/>
- </a4j:outputPanel>
- </td>
- <td>
- <a4j:outputPanel id="drg2" layout="block" styleClass="draggable">
- <dnd:dragBehavior event="mouseover" type="drg2" indicator="ind2"/>
- </a4j:outputPanel>
- </td>
- <td>
- <a4j:outputPanel id="drg3" layout="block" styleClass="draggable">
- <dnd:dragBehavior event="mouseover" type="drg3" indicator="ind"/>
- </a4j:outputPanel>
- </td>
+ <td><a4j:outputPanel id="drg1" layout="block"
+ styleClass="draggable">
+ <dnd:dragBehavior event="mouseover" type="drg1" indicator="ind" />
+ </a4j:outputPanel></td>
+ <td><a4j:outputPanel id="drg2" layout="block"
+ styleClass="draggable">
+ <dnd:dragBehavior event="mouseover" type="drg2" indicator="ind" />
+ </a4j:outputPanel></td>
+ <td><a4j:outputPanel id="drg3" layout="block"
+ styleClass="draggable">
+ <dnd:dragBehavior event="mouseover" type="drg3" indicator="ind" />
+ </a4j:outputPanel></td>
</tr>
- </table>
-
+ </table>
<a4j:outputPanel id="drp" layout="block" styleClass="droppable">
<dnd:dropBehavior event="mouseover" acceptType="drg1, drg2" />
</a4j:outputPanel>
+
+ <h:inputText>
+ <a4j:ajax/>
+ </h:inputText>
</h:form>
</h:body>
</html>
\ No newline at end of file
14 years, 1 month
JBoss Rich Faces SVN: r20173 - in sandbox/trunk/ui/drag-drop/ui/src/main: java/org/richfaces/component/behavior and 2 other directories.
by richfaces-svn-commits@lists.jboss.org
Author: abelevich
Date: 2010-11-25 11:13:23 -0500 (Thu, 25 Nov 2010)
New Revision: 20173
Added:
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/renderkit/DragIndicatorRendererBase.java
Modified:
sandbox/trunk/ui/drag-drop/ui/src/main/java/org/richfaces/component/behavior/DragBehavior.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/DropBehaviorRendererBase.java
sandbox/trunk/ui/drag-drop/ui/src/main/resources/META-INF/resources/org.richfaces/dnd-draggable.js
sandbox/trunk/ui/drag-drop/ui/src/main/resources/META-INF/resources/org.richfaces/dnd-droppable.js
Log:
add indicator, implement drop server decode and dropEvent creation
Added: 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 (rev 0)
+++ sandbox/trunk/ui/drag-drop/ui/src/main/java/org/richfaces/component/AbstractDragIndicator.java 2010-11-25 16:13:23 UTC (rev 20173)
@@ -0,0 +1,35 @@
+package org.richfaces.component;
+
+import javax.faces.component.UIComponentBase;
+
+import org.richfaces.cdk.annotations.Attribute;
+import org.richfaces.cdk.annotations.JsfComponent;
+import org.richfaces.cdk.annotations.JsfRenderer;
+import org.richfaces.cdk.annotations.Tag;
+
+@JsfComponent(
+ type = AbstractDragIndicator.COMPONENT_TYPE,
+ family = AbstractDragIndicator.COMPONENT_FAMILY,
+ generate = "org.richfaces.component.UIDragIndicator",
+ renderer = @JsfRenderer(type = "org.richfaces.DragIndicatorRenderer"),
+ tag = @Tag(name="dragIndicator")
+)
+public abstract class AbstractDragIndicator extends UIComponentBase {
+
+ public static final String COMPONENT_TYPE = "org.richfaces.DragIndicator";
+
+ public static final String COMPONENT_FAMILY = "org.richfaces.DragIndicator";
+
+ public String getFamily() {
+ return COMPONENT_FAMILY;
+ }
+
+ @Attribute
+ public abstract String getAcceptClass();
+
+ @Attribute
+ public abstract String getRejectClass();
+
+ @Attribute
+ public abstract String getDraggingClass();
+}
Modified: sandbox/trunk/ui/drag-drop/ui/src/main/java/org/richfaces/component/behavior/DragBehavior.java
===================================================================
--- sandbox/trunk/ui/drag-drop/ui/src/main/java/org/richfaces/component/behavior/DragBehavior.java 2010-11-25 16:11:55 UTC (rev 20172)
+++ sandbox/trunk/ui/drag-drop/ui/src/main/java/org/richfaces/component/behavior/DragBehavior.java 2010-11-25 16:13:23 UTC (rev 20173)
@@ -36,15 +36,22 @@
@JsfBehavior(
id = DragBehavior.BEHAVIOR_ID, tag = @Tag(name = "dragBehavior", handler = "org.richfaces.view.facelets.html.CustomBehaviorHandler", type = TagType.Facelets)
)
-public class DragBehavior extends ClientBehavior {
+public class DragBehavior extends ClientBehavior implements ClientDragBehavior {
public static final String BEHAVIOR_ID = "org.richfaces.component.behavior.DragBehavior";
enum PropertyKeys {
- type, indicator;
+ type, indicator, dragValue;
}
+ public void setDragValue(Object dragValue) {
+ getStateHelper().put(PropertyKeys.dragValue, dragValue);
+ }
+ public Object getDragValue() {
+ return getStateHelper().get(PropertyKeys.dragValue);
+ }
+
public void setIndicator(String indicator) {
getStateHelper().put(PropertyKeys.indicator, indicator);
}
@@ -67,6 +74,8 @@
setType((String)value);
} else if(compare(PropertyKeys.indicator, name)){
setIndicator((String)value);
+ } else if(compare(PropertyKeys.dragValue, name)) {
+ setDragValue(value);
}
}
@@ -78,5 +87,4 @@
public String getRendererType() {
return BEHAVIOR_ID;
}
-
}
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-25 16:11:55 UTC (rev 20172)
+++ sandbox/trunk/ui/drag-drop/ui/src/main/java/org/richfaces/component/behavior/DropBehavior.java 2010-11-25 16:13:23 UTC (rev 20173)
@@ -39,14 +39,22 @@
@JsfBehavior(
id = DropBehavior.BEHAVIOR_ID, tag = @Tag(name = "dropBehavior", handler = "org.richfaces.view.facelets.html.CustomBehaviorHandler", type = TagType.Facelets)
)
-public class DropBehavior extends ClientBehavior {
+public class DropBehavior extends ClientBehavior implements ClientDropBehavior {
public static final String BEHAVIOR_ID = "org.richfaces.component.behavior.DropBehavior";
enum PropertyKeys {
- acceptType
+ acceptType, dropValue
}
+ public void setDropValue(Object dropValue) {
+ getStateHelper().put(PropertyKeys.dropValue, dropValue);
+ }
+
+ public Object getDropValue() {
+ return getStateHelper().get(PropertyKeys.dropValue);
+ }
+
public void setAcceptType(Set<String> acceptType) {
getStateHelper().put(PropertyKeys.acceptType, acceptType);
}
@@ -59,7 +67,9 @@
public void setLiteralAttribute(String name, Object value) {
if(compare(PropertyKeys.acceptType, name)) {
setAcceptType(CoreAjaxRendererUtils.asSimpleSet(value));
- }
+ } else if(compare(PropertyKeys.dropValue, name)) {
+ setDropValue(value);
+ }
}
@Override
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-25 16:11:55 UTC (rev 20172)
+++ sandbox/trunk/ui/drag-drop/ui/src/main/java/org/richfaces/renderkit/DragBehaviorRendererBase.java 2010-11-25 16:13:23 UTC (rev 20173)
@@ -37,6 +37,7 @@
import org.ajax4jsf.javascript.JSFunction;
import org.richfaces.component.behavior.DragBehavior;
+import org.richfaces.component.behavior.ClientDragBehavior;
import org.richfaces.renderkit.util.RendererUtils;
/**
@@ -70,19 +71,16 @@
public Map<String, Object> getOptions(ClientBehaviorContext clientBehaviorContext, ClientBehavior behavior) {
Map<String, Object> options = new HashMap<String, Object>();
-
- if(behavior instanceof DragBehavior) {
- DragBehavior dragBehavior = (DragBehavior)behavior;
+ if(behavior instanceof ClientDragBehavior) {
+ ClientDragBehavior dragBehavior = (ClientDragBehavior)behavior;
options.put("indicator", getDragIndicatorClientId(clientBehaviorContext, dragBehavior));
options.put("type", dragBehavior.getType());
}
-
return options;
}
- public String getDragIndicatorClientId(ClientBehaviorContext clientBehaviorContext, DragBehavior dragBehavior) {
+ public String getDragIndicatorClientId(ClientBehaviorContext clientBehaviorContext, ClientDragBehavior dragBehavior) {
String indicatorId = dragBehavior.getIndicator();
-
if(indicatorId != null) {
FacesContext facesContext = clientBehaviorContext.getFacesContext();
UIComponent clientBehaviorHolder = clientBehaviorContext.getComponent();
@@ -91,9 +89,7 @@
if(indicator != null) {
indicatorId = indicator.getClientId(facesContext);
}
-
}
-
return indicatorId;
}
Added: 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 (rev 0)
+++ sandbox/trunk/ui/drag-drop/ui/src/main/java/org/richfaces/renderkit/DragIndicatorRendererBase.java 2010-11-25 16:13:23 UTC (rev 20173)
@@ -0,0 +1,15 @@
+package org.richfaces.renderkit;
+
+import javax.faces.application.ResourceDependencies;
+import javax.faces.application.ResourceDependency;
+
+
+@ResourceDependencies({
+ @ResourceDependency(library = "javax.faces", name = "jsf.js"),
+ @ResourceDependency(name = "jquery.js"),
+ @ResourceDependency(name = "richfaces.js"),
+ @ResourceDependency(name = "richfaces-base-component.js"),
+ @ResourceDependency(library = "org.richfaces", name = "dnd-indicator.js"),
+ @ResourceDependency(library = "org.richfaces", name = "indicator.ecss") })
+public class DragIndicatorRendererBase extends RendererBase {
+}
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-25 16:11:55 UTC (rev 20172)
+++ sandbox/trunk/ui/drag-drop/ui/src/main/java/org/richfaces/renderkit/DropBehaviorRendererBase.java 2010-11-25 16:13:23 UTC (rev 20173)
@@ -23,20 +23,30 @@
package org.richfaces.renderkit;
import java.util.HashMap;
+import java.util.List;
import java.util.Map;
+import java.util.Map.Entry;
+import java.util.Set;
import javax.faces.application.ResourceDependencies;
import javax.faces.application.ResourceDependency;
+import javax.faces.component.ContextCallback;
import javax.faces.component.UIComponent;
import javax.faces.component.behavior.ClientBehavior;
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;
+
/**
* @author abelevich
*
@@ -57,6 +67,20 @@
public class DropBehaviorRendererBase extends ClientBehaviorRenderer {
@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));
+ }
+ }
+
+ @Override
public String getScript(ClientBehaviorContext behaviorContext, ClientBehavior behavior) {
UIComponent parent = behaviorContext.getComponent();
JSFunction function = new JSFunction("RichFaces.ui.DnDManager.droppable");
@@ -68,12 +92,59 @@
public Map<String, Object> getOptions(ClientBehaviorContext behaviorContext, ClientBehavior behavior) {
Map<String, Object> options = new HashMap<String, Object>();
- if(behavior instanceof DropBehavior) {
- DropBehavior dropBehavior = (DropBehavior)behavior;
+ if(behavior instanceof ClientDropBehavior) {
+ ClientDropBehavior dropBehavior = (ClientDropBehavior)behavior;
options.put("acceptType", dropBehavior.getAcceptType());
}
return options;
}
-
+
+ private final class DropBehaviorContextCallBack implements ContextCallback {
+
+ private ClientDropBehavior dropBehavior;
+
+ private UIComponent dropSource;
+
+ public DropBehaviorContextCallBack(UIComponent dropSource, ClientDropBehavior dropBehavior) {
+ this.dropSource = dropSource;
+ this.dropBehavior = dropBehavior;
+ }
+
+ public void invokeContextCallback(FacesContext context, UIComponent target) {
+ ClientDragBehavior dragBehavior = getDragBehavior(target, "mouseover");
+
+ if(dragBehavior != null) {
+ DropBehaviorEvent dropEvent = new DropBehaviorEvent(dropSource, dropBehavior);
+ dropEvent.setDragSource(target);
+ dropEvent.setDragValue(dragBehavior.getDragValue());
+ dropEvent.setDropValue(dropBehavior.getDropValue());
+ dropEvent.queue();
+ } else {
+ //TODO: log
+ }
+ }
+
+ private ClientDragBehavior getDragBehavior(UIComponent parent, String event) {
+ if(parent instanceof ClientBehaviorHolder) {
+ Map<String, List<ClientBehavior>> behaviorsMap = ((ClientBehaviorHolder)parent).getClientBehaviors();
+ Set<Map.Entry<String, List<ClientBehavior>>> entries = behaviorsMap.entrySet();
+
+ for(Entry<String, List<ClientBehavior>> entry: entries) {
+ if(event.equals(entry.getKey())){
+ List<ClientBehavior> behaviors = entry.getValue();
+ for(ClientBehavior behavior: behaviors) {
+ if(behavior instanceof ClientDragBehavior) {
+ return (ClientDragBehavior)behavior;
+ }
+ }
+ }
+ }
+
+ }
+ return null;
+ }
+
+ }
+
}
Modified: sandbox/trunk/ui/drag-drop/ui/src/main/resources/META-INF/resources/org.richfaces/dnd-draggable.js
===================================================================
--- sandbox/trunk/ui/drag-drop/ui/src/main/resources/META-INF/resources/org.richfaces/dnd-draggable.js 2010-11-25 16:11:55 UTC (rev 20172)
+++ sandbox/trunk/ui/drag-drop/ui/src/main/resources/META-INF/resources/org.richfaces/dnd-draggable.js 2010-11-25 16:13:23 UTC (rev 20173)
@@ -15,9 +15,8 @@
}
this.options = options;
-
+
this.dragElement.data('type', this.options.type);
- this.dragElement.data('indicator', this.indicator);
this.dragElement.data("init", true);
this.dragElement.bind('dragstart', $.proxy(this.dragStart, this));
@@ -49,7 +48,7 @@
}
if(ui.helper[0] != this.dragElement[0]) {
- //ugly fix to prevent remove custom indicator from DOM tree. see jQuery draggable._clear method for details
+ //fix to prevent remove custom indicator from DOM tree. see jQuery draggable._clear method for details
ui.helper[0] = this.dragElement[0];
}
}
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-25 16:11:55 UTC (rev 20172)
+++ sandbox/trunk/ui/drag-drop/ui/src/main/resources/META-INF/resources/org.richfaces/dnd-droppable.js 2010-11-25 16:13:23 UTC (rev 20173)
@@ -18,13 +18,13 @@
$.extend(rf.ui.Droppable.prototype, ( function () {
return {
drop: function(e, ui) {
- var dragElement = 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);
},
dropover: function(event, ui) {
@@ -60,8 +60,16 @@
accept = (acceptType == this); return !(accept);
});
}
-
return accept;
+ },
+
+ __callAjax: function(e, ui){
+ var options = {};
+ if(ui.draggable) {
+ options['dragSource'] = ui.draggable.attr("id");
+ options['dropSource'] = this.dropElement.attr("id");
+ }
+ rf.ajax(this.dropElement[0], e, {parameters: options});
}
}
})());
14 years, 1 month
JBoss Rich Faces SVN: r20172 - in sandbox/trunk/ui/drag-drop/api/src/main/java/org/richfaces: component/behavior and 1 other directories.
by richfaces-svn-commits@lists.jboss.org
Author: abelevich
Date: 2010-11-25 11:11:55 -0500 (Thu, 25 Nov 2010)
New Revision: 20172
Added:
sandbox/trunk/ui/drag-drop/api/src/main/java/org/richfaces/component/behavior/
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/DropBehaviorEvent.java
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/DropListener.java
Log:
add dnd behaviors interfaces
Added: 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 (rev 0)
+++ sandbox/trunk/ui/drag-drop/api/src/main/java/org/richfaces/component/behavior/ClientDragBehavior.java 2010-11-25 16:11:55 UTC (rev 20172)
@@ -0,0 +1,15 @@
+package org.richfaces.component.behavior;
+
+import javax.faces.component.behavior.ClientBehavior;
+
+
+public interface ClientDragBehavior extends ClientBehavior {
+
+ public String getType();
+
+ public String getIndicator();
+
+ public Object getDragValue();
+
+}
+
Added: 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 (rev 0)
+++ sandbox/trunk/ui/drag-drop/api/src/main/java/org/richfaces/component/behavior/ClientDropBehavior.java 2010-11-25 16:11:55 UTC (rev 20172)
@@ -0,0 +1,14 @@
+package org.richfaces.component.behavior;
+
+import java.util.Set;
+
+import javax.faces.component.behavior.ClientBehavior;
+
+
+public interface ClientDropBehavior extends ClientBehavior{
+
+ public Set<String> getAcceptType();
+
+ public Object getDropValue();
+
+}
Added: 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 (rev 0)
+++ sandbox/trunk/ui/drag-drop/api/src/main/java/org/richfaces/event/DropBehaviorEvent.java 2010-11-25 16:11:55 UTC (rev 20172)
@@ -0,0 +1,56 @@
+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-25 15:28:35 UTC (rev 20171)
+++ sandbox/trunk/ui/drag-drop/api/src/main/java/org/richfaces/event/DropEvent.java 2010-11-25 16:11:55 UTC (rev 20172)
@@ -65,7 +65,7 @@
* )
*/
public void processListener(FacesListener listener) {
- ((DropListener) listener).processDrop(this);
+ //((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-25 15:28:35 UTC (rev 20171)
+++ sandbox/trunk/ui/drag-drop/api/src/main/java/org/richfaces/event/DropListener.java 2010-11-25 16:11:55 UTC (rev 20172)
@@ -21,21 +21,11 @@
package org.richfaces.event;
-import javax.faces.event.FacesListener;
+import javax.faces.event.BehaviorListener;
-/**
- * Listener for process Drop events
- *
- * @author shura
- *
- */
-public interface DropListener extends FacesListener {
- /**
- * Process event on Drop for this component.
- *
- * @param event
- */
- public void processDrop(DropEvent event);
+public interface DropListener extends BehaviorListener {
+
+ public void processDrop(DropBehaviorEvent event);
}
14 years, 1 month
JBoss Rich Faces SVN: r20171 - in branches/RF-8742-1/ui/validator/ui/src: test/java/org/richfaces/convert and 1 other directory.
by richfaces-svn-commits@lists.jboss.org
Author: pyaschenko
Date: 2010-11-25 10:28:35 -0500 (Thu, 25 Nov 2010)
New Revision: 20171
Added:
branches/RF-8742-1/ui/validator/ui/src/main/resources/META-INF/resources/org.richfaces/required-validator.js
branches/RF-8742-1/ui/validator/ui/src/test/java/org/richfaces/convert/RequiredValidatorTest.java
Modified:
branches/RF-8742-1/ui/validator/ui/src/test/java/org/richfaces/convert/BaseTest.java
Log:
http://jira.jboss.com/jira/browse/RF-9329
RequiredValidator and tests was added
Added: branches/RF-8742-1/ui/validator/ui/src/main/resources/META-INF/resources/org.richfaces/required-validator.js
===================================================================
--- branches/RF-8742-1/ui/validator/ui/src/main/resources/META-INF/resources/org.richfaces/required-validator.js (rev 0)
+++ branches/RF-8742-1/ui/validator/ui/src/main/resources/META-INF/resources/org.richfaces/required-validator.js 2010-11-25 15:28:35 UTC (rev 20171)
@@ -0,0 +1,9 @@
+RichFaces.csv.addValidator({"required":
+ (function(rf) {
+ return function (componentId, value, params) {
+ if (value.length==0) {
+ throw rf.csv.getMessage(params.customMessage, 'UIINPUT_REQUIRED', [componentId]);
+ }
+ }
+ })(window.RichFaces || (window.RichFaces={}))
+});
\ No newline at end of file
Modified: branches/RF-8742-1/ui/validator/ui/src/test/java/org/richfaces/convert/BaseTest.java
===================================================================
--- branches/RF-8742-1/ui/validator/ui/src/test/java/org/richfaces/convert/BaseTest.java 2010-11-25 14:19:25 UTC (rev 20170)
+++ branches/RF-8742-1/ui/validator/ui/src/test/java/org/richfaces/convert/BaseTest.java 2010-11-25 15:28:35 UTC (rev 20171)
@@ -199,6 +199,9 @@
HtmlInputText testComponent = new HtmlInputText();
testComponent.setLabel(TEST_COMPONENT_LABEL);
testBean.componentLabel = TEST_COMPONENT_LABEL;
+ if (errorMessage!=null) {
+ testComponent.setRequiredMessage(errorMessage);
+ }
return testComponent;
}
Added: branches/RF-8742-1/ui/validator/ui/src/test/java/org/richfaces/convert/RequiredValidatorTest.java
===================================================================
--- branches/RF-8742-1/ui/validator/ui/src/test/java/org/richfaces/convert/RequiredValidatorTest.java (rev 0)
+++ branches/RF-8742-1/ui/validator/ui/src/test/java/org/richfaces/convert/RequiredValidatorTest.java 2010-11-25 15:28:35 UTC (rev 20171)
@@ -0,0 +1,76 @@
+/*
+ * 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.convert;
+
+import javax.faces.validator.RequiredValidator;
+
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.richfaces.appplication.FacesMessages;
+
+/**
+ * @author Pavel Yaschenko
+ *
+ */
+(a)RunWith(ValidatorTestRunner.class)
+public class RequiredValidatorTest extends BaseTest {
+
+ private Enum<?>[] messages = { FacesMessages.UIINPUT_REQUIRED };
+
+ private void setup() {
+ setClientFunction("RichFaces.csv.getValidator('required')");
+ setObjectId(RequiredValidator.VALIDATOR_ID);
+ setErrorMessageEnums(messages);
+ }
+
+ public RequiredValidatorTest() {
+ super("META-INF/resources/org.richfaces/required-validator.js");
+ }
+
+ @Test
+ @TestDataHolder(
+ successes = {
+ @TestData(submittedValue = "foo")
+ },
+ failures = {
+ @TestData(submittedValue = "")
+ }
+ )
+
+ public void test() throws Exception {
+ setup();
+ }
+
+ @Test
+ @TestDataHolder(
+ successes = {
+ },
+ failures = {
+ @TestData(submittedValue = "")
+ }
+ )
+
+ public void customMessageTest() throws Exception {
+ setup();
+ setErrorMessage("Input message: value is required");
+ }
+}
14 years, 1 month
JBoss Rich Faces SVN: r20170 - in branches/RF-8742-1/ui/validator/ui/src: test/java/org/richfaces/convert and 1 other directory.
by richfaces-svn-commits@lists.jboss.org
Author: pyaschenko
Date: 2010-11-25 09:19:25 -0500 (Thu, 25 Nov 2010)
New Revision: 20170
Added:
branches/RF-8742-1/ui/validator/ui/src/main/resources/META-INF/resources/org.richfaces/regex-validator.js
branches/RF-8742-1/ui/validator/ui/src/test/java/org/richfaces/convert/RegexValidatorTest.java
Modified:
branches/RF-8742-1/ui/validator/ui/src/main/resources/META-INF/resources/org.richfaces/double-range-validator.js
branches/RF-8742-1/ui/validator/ui/src/main/resources/META-INF/resources/org.richfaces/long-range-validator.js
branches/RF-8742-1/ui/validator/ui/src/test/java/org/richfaces/convert/DoubleRangeValidatorTest.java
branches/RF-8742-1/ui/validator/ui/src/test/java/org/richfaces/convert/LongRangeValidatorTest.java
Log:
http://jira.jboss.com/jira/browse/RF-9329
RegexValidator and tests was added
bugfix
Modified: branches/RF-8742-1/ui/validator/ui/src/main/resources/META-INF/resources/org.richfaces/double-range-validator.js
===================================================================
--- branches/RF-8742-1/ui/validator/ui/src/main/resources/META-INF/resources/org.richfaces/double-range-validator.js 2010-11-25 13:11:20 UTC (rev 20169)
+++ branches/RF-8742-1/ui/validator/ui/src/main/resources/META-INF/resources/org.richfaces/double-range-validator.js 2010-11-25 14:19:25 UTC (rev 20170)
@@ -2,12 +2,17 @@
(function(rf) {
return function (componentId, value, params) {
- if (typeof value == "string") {
- value = $.trim(value);
+ var type = typeof value;
+ if (type != "number") {
+ if (type != "string") {
+ throw rf.csv.getMessage(params.customMessage, 'DOUBLE_RANGE_VALIDATOR_TYPE', [componentId, ""]);
+ } else {
+ value = $.trim(value);
+ if (!rf.csv.RE_FLOAT.test(value) || (value = parseFloat(value))==NaN) {
+ throw rf.csv.getMessage(params.customMessage, 'DOUBLE_RANGE_VALIDATOR_TYPE', [componentId, ""]);
+ }
+ }
}
- if (!rf.csv.RE_FLOAT.test(value) || (value = parseFloat(value))==NaN) {
- throw rf.csv.getMessage(params.customMessage, 'DOUBLE_RANGE_VALIDATOR_TYPE', [componentId, ""]);
- }
var isMinSet = typeof params.minimum == "number";
var isMaxSet = typeof params.maximum == "number";
Modified: branches/RF-8742-1/ui/validator/ui/src/main/resources/META-INF/resources/org.richfaces/long-range-validator.js
===================================================================
--- branches/RF-8742-1/ui/validator/ui/src/main/resources/META-INF/resources/org.richfaces/long-range-validator.js 2010-11-25 13:11:20 UTC (rev 20169)
+++ branches/RF-8742-1/ui/validator/ui/src/main/resources/META-INF/resources/org.richfaces/long-range-validator.js 2010-11-25 14:19:25 UTC (rev 20170)
@@ -2,12 +2,17 @@
(function(rf) {
return function (componentId, value, params) {
- if (typeof value == "string") {
- value = $.trim(value);
+ var type = typeof value;
+ if (type != "number") {
+ if (type != "string") {
+ throw rf.csv.getMessage(params.customMessage, 'LONG_RANGE_VALIDATOR_TYPE', [componentId, ""]);
+ } else {
+ value = $.trim(value);
+ if (!rf.csv.RE_DIGITS.test(value) || (value = parseInt(value, 10))==NaN) {
+ throw rf.csv.getMessage(params.customMessage, 'LONG_RANGE_VALIDATOR_TYPE', [componentId, ""]);
+ }
+ }
}
- if (!rf.csv.RE_DIGITS.test(value)) {
- throw rf.csv.getMessage(params.customMessage, 'LONG_RANGE_VALIDATOR_TYPE', [componentId, ""]);
- }
var isMinSet = typeof params.minimum == "number";
var isMaxSet = typeof params.maximum == "number";
Added: branches/RF-8742-1/ui/validator/ui/src/main/resources/META-INF/resources/org.richfaces/regex-validator.js
===================================================================
--- branches/RF-8742-1/ui/validator/ui/src/main/resources/META-INF/resources/org.richfaces/regex-validator.js (rev 0)
+++ branches/RF-8742-1/ui/validator/ui/src/main/resources/META-INF/resources/org.richfaces/regex-validator.js 2010-11-25 14:19:25 UTC (rev 20170)
@@ -0,0 +1,20 @@
+RichFaces.csv.addValidator({"regex":
+ (function(rf) {
+ return function (componentId, value, params) {
+
+ if (typeof params.pattern != "string" || params.pattern.length == 0) {
+ throw rf.csv.getMessage(params.customMessage, 'REGEX_VALIDATOR_PATTERN_NOT_SET', []);
+ }
+
+ var re;
+ try {
+ re = new RegExp(params.pattern);
+ } catch (e) {
+ throw rf.csv.getMessage(params.customMessage, 'REGEX_VALIDATOR_MATCH_EXCEPTION', []);
+ }
+ if (!re.test(value)){
+ throw rf.csv.getMessage(params.customMessage, 'REGEX_VALIDATOR_NOT_MATCHED', [params.pattern]);
+ }
+ }
+ })(window.RichFaces || (window.RichFaces={}))
+});
\ No newline at end of file
Modified: branches/RF-8742-1/ui/validator/ui/src/test/java/org/richfaces/convert/DoubleRangeValidatorTest.java
===================================================================
--- branches/RF-8742-1/ui/validator/ui/src/test/java/org/richfaces/convert/DoubleRangeValidatorTest.java 2010-11-25 13:11:20 UTC (rev 20169)
+++ branches/RF-8742-1/ui/validator/ui/src/test/java/org/richfaces/convert/DoubleRangeValidatorTest.java 2010-11-25 14:19:25 UTC (rev 20170)
@@ -69,7 +69,7 @@
successes = {
@TestData(submittedValue = "0.9"),
@TestData(submittedValue = "1.1"),
- @TestData(submittedValue = "1.2"),
+ @TestData(submittedValue = "1.2")
},
failures = {
@TestData(submittedValue = "1.3"),
Modified: branches/RF-8742-1/ui/validator/ui/src/test/java/org/richfaces/convert/LongRangeValidatorTest.java
===================================================================
--- branches/RF-8742-1/ui/validator/ui/src/test/java/org/richfaces/convert/LongRangeValidatorTest.java 2010-11-25 13:11:20 UTC (rev 20169)
+++ branches/RF-8742-1/ui/validator/ui/src/test/java/org/richfaces/convert/LongRangeValidatorTest.java 2010-11-25 14:19:25 UTC (rev 20170)
@@ -51,7 +51,7 @@
successes = {
@TestData(submittedValue = "5"),
@TestData(submittedValue = "7"),
- @TestData(submittedValue = "10"),
+ @TestData(submittedValue = "10")
},
failures = {
@TestData(submittedValue = "4"),
Added: branches/RF-8742-1/ui/validator/ui/src/test/java/org/richfaces/convert/RegexValidatorTest.java
===================================================================
--- branches/RF-8742-1/ui/validator/ui/src/test/java/org/richfaces/convert/RegexValidatorTest.java (rev 0)
+++ branches/RF-8742-1/ui/validator/ui/src/test/java/org/richfaces/convert/RegexValidatorTest.java 2010-11-25 14:19:25 UTC (rev 20170)
@@ -0,0 +1,80 @@
+/*
+ * 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.convert;
+
+import javax.faces.validator.RegexValidator;
+
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.richfaces.appplication.FacesMessages;
+
+/**
+ * @author Pavel Yaschenko
+ *
+ */
+(a)RunWith(ValidatorTestRunner.class)
+public class RegexValidatorTest extends BaseTest {
+
+ private Enum<?>[] messages = { FacesMessages.REGEX_VALIDATOR_MATCH_EXCEPTION, FacesMessages.REGEX_VALIDATOR_NOT_MATCHED, FacesMessages.REGEX_VALIDATOR_PATTERN_NOT_SET};
+
+ private void setup() {
+ setClientFunction("RichFaces.csv.getValidator('regex')");
+ setObjectId(RegexValidator.VALIDATOR_ID);
+ setErrorMessageEnums(messages);
+ }
+
+ public RegexValidatorTest() {
+ super("META-INF/resources/org.richfaces/regex-validator.js");
+ }
+
+ @Test
+ @TestDataHolder(
+ successes = {
+ @TestData(submittedValue = "hello Man!!!"),
+ @TestData(submittedValue = "say hello"),
+ @TestData(submittedValue = "--- hello ---")
+ },
+ failures = {
+ @TestData(submittedValue = "foo-foo-foo"),
+ @TestData(submittedValue = "")
+ }
+ )
+
+ public void test() throws Exception {
+ setup();
+ setAttribute("pattern", "hello");
+ }
+
+ @Test
+ @TestDataHolder(
+ successes = {
+ },
+ failures = {
+ @TestData(submittedValue = "text")
+ }
+ )
+
+ public void wrongPatternTest() throws Exception {
+ setup();
+ setAttribute("pattern", "((");
+ }
+}
14 years, 1 month
JBoss Rich Faces SVN: r20169 - in modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest: richInputNumberSlider and 1 other directory.
by richfaces-svn-commits@lists.jboss.org
Author: ppitonak(a)redhat.com
Date: 2010-11-25 08:11:20 -0500 (Thu, 25 Nov 2010)
New Revision: 20169
Added:
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richInputNumberSlider/
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richInputNumberSlider/TestRichSlider.java
Log:
https://jira.jboss.org/browse/RFPL-759
* added 42 tests for rich:inputNumberSlider
Added: modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richInputNumberSlider/TestRichSlider.java
===================================================================
--- modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richInputNumberSlider/TestRichSlider.java (rev 0)
+++ modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richInputNumberSlider/TestRichSlider.java 2010-11-25 13:11:20 UTC (rev 20169)
@@ -0,0 +1,698 @@
+/*******************************************************************************
+ * 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.tests.metamer.ftest.richInputNumberSlider;
+
+import java.text.ParseException;
+import static org.jboss.test.selenium.guard.request.RequestTypeGuardFactory.guardNoRequest;
+import static org.jboss.test.selenium.guard.request.RequestTypeGuardFactory.guardXhr;
+import static org.jboss.test.selenium.locator.LocatorFactory.jq;
+import static org.jboss.test.selenium.utils.URLUtils.buildUrl;
+import static org.testng.Assert.assertEquals;
+import static org.testng.Assert.assertFalse;
+import static org.testng.Assert.assertNotSame;
+import static org.testng.Assert.assertTrue;
+import static org.testng.Assert.fail;
+
+import java.net.URL;
+import java.text.SimpleDateFormat;
+import java.util.ArrayList;
+import java.util.Date;
+import java.util.List;
+import java.util.Set;
+import java.util.TreeSet;
+import javax.faces.event.PhaseId;
+
+import org.jboss.test.selenium.css.CssProperty;
+
+import org.jboss.test.selenium.encapsulated.JavaScript;
+import org.jboss.test.selenium.geometry.Point;
+import org.jboss.test.selenium.locator.Attribute;
+import org.jboss.test.selenium.locator.AttributeLocator;
+import org.jboss.test.selenium.locator.ElementLocator;
+import org.jboss.test.selenium.locator.JQueryLocator;
+import org.richfaces.tests.metamer.ftest.AbstractMetamerTest;
+import org.richfaces.tests.metamer.ftest.annotations.Inject;
+import org.richfaces.tests.metamer.ftest.annotations.IssueTracking;
+import org.richfaces.tests.metamer.ftest.annotations.Use;
+import org.testng.annotations.Test;
+
+/**
+ * Test case for page /faces/components/richInputNumberSlider/simple.xhtml
+ *
+ * @author <a href="mailto:ppitonak@redhat.com">Pavol Pitonak</a>
+ * @version $Revision$
+ */
+public class TestRichSlider extends AbstractMetamerTest {
+
+ private JQueryLocator slider = pjq("span[id$=slider]");
+ private JQueryLocator input = pjq("input.rf-insl-inp");
+ private JQueryLocator left = pjq("span.rf-insl-dec");
+ private JQueryLocator right = pjq("span.rf-insl-inc");
+ private JQueryLocator minBoundary = pjq("span.rf-insl-mn");
+ private JQueryLocator maxBoundary = pjq("span.rf-insl-mx");
+ private JQueryLocator track = pjq("span.rf-insl-trc");
+ private JQueryLocator handle = pjq("span.rf-insl-hnd");
+ private JQueryLocator tooltip = pjq("span.rf-insl-tt");
+ private JQueryLocator output = pjq("span[id$=output]");
+ private JQueryLocator time = jq("span[id$=requestTime]");
+ private String[] correctNumbers = {"-10", "-5", "-1", "0", "1", "5", "10"};
+ private String[] smallNumbers = {"-11", "-15", "-100"};
+ private String[] bigNumbers = {"11", "15", "100"};
+ private String[] decimalNumbers = {"1.4999", "5.6", "7.0001", "-5.50001", "-9.9", "1.222e0", "0e0", "-5.50001e0"};
+ @Inject
+ @Use(empty = true)
+ private String number;
+ @Inject
+ @Use(empty = true)
+ private Integer delay;
+ private JavaScript clickLeft = new JavaScript("jQuery(\"" + left.getRawLocator() + "\").mousedown().mouseup()");
+ private JavaScript clickRight = new JavaScript("jQuery(\"" + right.getRawLocator() + "\").mousedown().mouseup()");
+
+ @Override
+ public URL getTestUrl() {
+ return buildUrl(contextPath, "faces/components/richInputNumberSlider/simple.xhtml");
+ }
+
+ @Test
+ public void testInit() {
+ assertTrue(selenium.isDisplayed(slider), "Slider is not present on the page.");
+ assertTrue(selenium.isDisplayed(input), "Slider's input is not present on the page.");
+ assertFalse(selenium.isElementPresent(left), "Slider's left arrow should not be present on the page.");
+ assertFalse(selenium.isElementPresent(right), "Slider's right arrow should not be present on the page.");
+ assertTrue(selenium.isDisplayed(minBoundary), "Slider's min value is not present on the page.");
+ assertTrue(selenium.isDisplayed(maxBoundary), "Slider's max value is not present on the page.");
+ assertTrue(selenium.isDisplayed(track), "Slider's track is not present on the page.");
+ assertTrue(selenium.isDisplayed(handle), "Slider's handle is not present on the page.");
+ assertFalse(selenium.isElementPresent(tooltip), "Slider's tooltip should not be present on the page.");
+ }
+
+ @Test
+ @Use(field = "number", value = "correctNumbers")
+ public void testTypeIntoInputCorrect() {
+ String reqTime = selenium.getText(time);
+ guardXhr(selenium).type(input, number);
+ waitGui.failWith("Page was not updated").waitForChange(reqTime, retrieveText.locator(time));
+
+ assertEquals(selenium.getText(output), number, "Output was not updated.");
+ }
+
+ @Test
+ @Use(field = "number", value = "smallNumbers")
+ public void testTypeIntoInputSmall() {
+ String reqTime = selenium.getText(time);
+ guardXhr(selenium).type(input, number);
+ waitGui.failWith("Page was not updated").waitForChange(reqTime, retrieveText.locator(time));
+
+ assertEquals(selenium.getText(output), "-10", "Output was not updated.");
+ assertEquals(selenium.getValue(input), "-10", "Input was not updated.");
+ }
+
+ @Test
+ @Use(field = "number", value = "bigNumbers")
+ public void testTypeIntoInputBig() {
+ String reqTime = selenium.getText(time);
+ guardXhr(selenium).type(input, number);
+ waitGui.failWith("Page was not updated").waitForChange(reqTime, retrieveText.locator(time));
+
+ assertEquals(selenium.getText(output), "10", "Output was not updated.");
+ assertEquals(selenium.getValue(input), "10", "Input was not updated.");
+ }
+
+ @Test
+ @Use(field = "number", value = "decimalNumbers")
+ public void testTypeIntoInputDecimal() {
+ String reqTime = selenium.getText(time);
+ guardXhr(selenium).type(input, number);
+ waitGui.failWith("Page was not updated").waitForChange(reqTime, retrieveText.locator(time));
+
+ int roundedNumber = (int) Math.round(Double.parseDouble(number));
+
+ assertEquals(selenium.getText(output), Integer.toString(roundedNumber), "Output was not updated.");
+ assertEquals(selenium.getValue(input), Integer.toString(roundedNumber), "Input was not updated.");
+ }
+
+ @Test
+ public void testTypeIntoInputNotNumber() {
+ guardNoRequest(selenium).type(input, "aaa");
+ assertEquals(selenium.getText(output), "2", "Output should not be updated.");
+ assertEquals(selenium.getValue(input), "2", "Input should not be updated.");
+ }
+
+ @Test
+ public void testClickLeft() {
+ selenium.type(pjq("input[type=text][id$=delayInput]"), "500");
+ selenium.waitForPageToLoad();
+ selenium.click(pjq("input[type=radio][name$=showArrowsInput][value=true]"));
+ selenium.waitForPageToLoad();
+
+ selenium.runScript(clickLeft);
+ selenium.runScript(clickLeft);
+ selenium.runScript(clickLeft);
+ selenium.runScript(clickLeft);
+ waitGui.failWith("Output was not updated.").until(textEquals.locator(output).text("-2"));
+ }
+
+ @Test
+ public void testClickRight() {
+ selenium.type(pjq("input[type=text][id$=delayInput]"), "500");
+ selenium.waitForPageToLoad();
+ selenium.click(pjq("input[type=radio][name$=showArrowsInput][value=true]"));
+ selenium.waitForPageToLoad();
+
+ selenium.runScript(clickRight);
+ selenium.runScript(clickRight);
+ selenium.runScript(clickRight);
+ selenium.runScript(clickRight);
+ waitGui.failWith("Output was not updated.").until(textEquals.locator(output).text("6"));
+ }
+
+ @Test
+ public void testClick() {
+ String reqTime = selenium.getText(time);
+ guardXhr(selenium).mouseDownAt(track, new Point(0, 0));
+ waitGui.failWith("Page was not updated").waitForChange(reqTime, retrieveText.locator(time));
+ assertEquals(selenium.getText(output), "-10", "Output was not updated.");
+ String margin = selenium.getStyle(handle, CssProperty.MARGIN_LEFT).replace("px", "").trim();
+ assertEquals(Double.parseDouble(margin), 0d, "Left margin of handle.");
+
+ reqTime = selenium.getText(time);
+ guardXhr(selenium).mouseDownAt(track, new Point(30, 0));
+ waitGui.failWith("Page was not updated").waitForChange(reqTime, retrieveText.locator(time));
+ assertEquals(selenium.getText(output), "-7", "Output was not updated.");
+ margin = selenium.getStyle(handle, CssProperty.MARGIN_LEFT).replace("px", "").trim();
+ double marginD = Double.parseDouble(margin);
+ assertTrue(marginD > 25 && marginD < 30, "Left margin of handle should be between 25 and 30.");
+
+ reqTime = selenium.getText(time);
+ guardXhr(selenium).mouseDownAt(track, new Point(195, 0));
+ waitGui.failWith("Page was not updated").waitForChange(reqTime, retrieveText.locator(time));
+ assertEquals(selenium.getText(output), "10", "Output was not updated.");
+ margin = selenium.getStyle(handle, CssProperty.MARGIN_LEFT).replace("px", "").trim();
+ marginD = Double.parseDouble(margin);
+ assertTrue(marginD > 190 && marginD < 200, "Left margin of handle should be between 190 and 200.");
+ }
+
+ @Test
+ public void testDecreaseClass() {
+ selenium.click(pjq("input[type=radio][name$=showArrowsInput][value=true]"));
+ selenium.waitForPageToLoad();
+
+ testStyleClass(left, "decreaseClass");
+ }
+
+ @Test
+ public void testDecreaseSelectedClass() {
+ selenium.click(pjq("input[type=radio][name$=showArrowsInput][value=true]"));
+ selenium.waitForPageToLoad();
+
+ final String value = "metamer-ftest-class";
+ selenium.type(pjq("input[id$=decreaseSelectedClassInput]"), value);
+ selenium.waitForPageToLoad();
+
+ selenium.mouseDown(left);
+ assertTrue(selenium.belongsClass(left, value), "decreaseSelectedClass does not work");
+ }
+
+ @Test
+ @Use(field = "delay", ints = {200, 500, 3700})
+ public void testDelay() {
+ selenium.type(pjq("input[type=text][id$=delayInput]"), delay.toString());
+ selenium.waitForPageToLoad();
+ selenium.click(pjq("input[type=radio][name$=showArrowsInput][value=true]"));
+ selenium.waitForPageToLoad();
+
+ try {
+ verifyDelay(left, delay);
+ verifyDelay(right, delay);
+ } catch (ParseException ex) {
+ fail(ex.getMessage());
+ }
+ }
+
+ @Test
+ public void testDisabled() {
+ JQueryLocator selectOption = pjq("input[type=radio][name$=disabledInput][value=true]");
+ selenium.click(selectOption);
+ selenium.waitForPageToLoad();
+
+ AttributeLocator disabledAttribute = input.getAttribute(new Attribute("disabled"));
+ assertEquals(selenium.getAttribute(disabledAttribute), "disabled", "Input should be disabled.");
+
+ assertFalse(selenium.isElementPresent(handle), "Handle should not be present on the page.");
+
+ JQueryLocator handleDisabled = pjq("span.rf-insl-hnd-dis");
+ assertTrue(selenium.isElementPresent(handleDisabled), "An disabled handle should be displayed.");
+ assertTrue(selenium.isVisible(handleDisabled), "An disabled handle should be displayed.");
+ }
+
+ @Test
+ public void testEnableManualInput() {
+ JQueryLocator selectOption = pjq("input[type=radio][name$=enableManualInputInput][value=false]");
+ selenium.click(selectOption);
+ selenium.waitForPageToLoad();
+
+ AttributeLocator readonlyAttribute = input.getAttribute(new Attribute("readonly"));
+ assertEquals(selenium.getAttribute(readonlyAttribute), "readonly", "Input should be read-only.");
+
+ testClick();
+ }
+
+ @Test
+ public void testHandleClass() {
+ testStyleClass(handle, "handleClass");
+ }
+
+ @Test
+ public void testHandleSelectedClass() {
+ final String value = "metamer-ftest-class";
+ selenium.type(pjq("input[id$=handleSelectedClassInput]"), value);
+ selenium.waitForPageToLoad();
+
+ selenium.mouseDown(handle);
+ assertTrue(selenium.belongsClass(handle, value), "handleSelectedClass does not work");
+ }
+
+ @Test
+ public void testImmediate() {
+ JQueryLocator immediateInput = pjq("input[type=radio][name$=immediateInput][value=true]");
+ selenium.click(immediateInput);
+ selenium.waitForPageToLoad();
+
+ String reqTime = selenium.getText(time);
+ guardXhr(selenium).type(input, "4");
+ waitGui.failWith("Page was not updated").waitForChange(reqTime, retrieveText.locator(time));
+ assertEquals(selenium.getText(output), "4", "Output was not updated.");
+
+ assertPhases(PhaseId.RESTORE_VIEW, PhaseId.APPLY_REQUEST_VALUES, PhaseId.PROCESS_VALIDATIONS, PhaseId.UPDATE_MODEL_VALUES,
+ PhaseId.INVOKE_APPLICATION, PhaseId.RENDER_RESPONSE);
+ }
+
+ @Test
+ public void testIncreaseClass() {
+ selenium.click(pjq("input[type=radio][name$=showArrowsInput][value=true]"));
+ selenium.waitForPageToLoad();
+
+ testStyleClass(right, "increaseClass");
+ }
+
+ @Test
+ public void testIncreaseSelectedClass() {
+ selenium.click(pjq("input[type=radio][name$=showArrowsInput][value=true]"));
+ selenium.waitForPageToLoad();
+
+ final String value = "metamer-ftest-class";
+ selenium.type(pjq("input[id$=increaseSelectedClassInput]"), value);
+ selenium.waitForPageToLoad();
+
+ selenium.mouseDown(right);
+ assertTrue(selenium.belongsClass(right, value), "increaseSelectedClass does not work");
+ }
+
+ @Test
+ public void testInputClass() {
+ testStyleClass(input, "inputClass");
+ }
+
+ @Test
+ public void testInputPosition() {
+ JQueryLocator br = pjq("span[id$=slider] br");
+
+ selenium.click(pjq("input[type=radio][name$=inputPositionInput][value=bottom]"));
+ selenium.waitForPageToLoad();
+ int inputPosition = selenium.getElementPositionTop(input);
+ int trackPosition = selenium.getElementPositionTop(track);
+ assertTrue(trackPosition < inputPosition, "Track should be above input on the page.");
+ assertTrue(selenium.isElementPresent(br), "Track and input should not be on the same line.");
+
+ selenium.click(pjq("input[type=radio][name$=inputPositionInput][value=top]"));
+ selenium.waitForPageToLoad();
+ inputPosition = selenium.getElementPositionTop(input);
+ trackPosition = selenium.getElementPositionTop(track);
+ assertTrue(trackPosition > inputPosition, "Track should be below input on the page.");
+ assertTrue(selenium.isElementPresent(br), "Track and input should not be on the same line.");
+
+ selenium.click(pjq("input[type=radio][name$=inputPositionInput][value=right]"));
+ selenium.waitForPageToLoad();
+ inputPosition = selenium.getElementPositionLeft(input);
+ trackPosition = selenium.getElementPositionLeft(track);
+ assertTrue(trackPosition < inputPosition, "Track should be on the left of input on the page.");
+ assertFalse(selenium.isElementPresent(br), "Track and input should be on the same line.");
+
+ selenium.click(pjq("input[type=radio][name$=inputPositionInput][value=left]"));
+ selenium.waitForPageToLoad();
+ inputPosition = selenium.getElementPositionLeft(input);
+ trackPosition = selenium.getElementPositionLeft(track);
+ assertTrue(trackPosition > inputPosition, "Track should be on the right of input on the page.");
+ assertFalse(selenium.isElementPresent(br), "Track and input should be on the same line.");
+
+ selenium.click(pjq("input[type=radio][name$=inputPositionInput][value=]"));
+ selenium.waitForPageToLoad();
+ inputPosition = selenium.getElementPositionLeft(input);
+ trackPosition = selenium.getElementPositionLeft(track);
+ assertTrue(trackPosition < inputPosition, "Track should be on the left of input on the page.");
+ assertFalse(selenium.isElementPresent(br), "Track and input should be on the same line.");
+ }
+
+ @Test
+ public void testInputSize() {
+ JQueryLocator selectOption = pjq("input[type=text][id$=inputSizeInput]");
+
+ selenium.type(selectOption, "2");
+ selenium.waitForPageToLoad();
+ AttributeLocator sizeAttribute = input.getAttribute(new Attribute("size"));
+ assertEquals(selenium.getAttribute(sizeAttribute), "2", "Input's size attribute.");
+
+ selenium.type(selectOption, "40");
+ selenium.waitForPageToLoad();
+ assertEquals(selenium.getAttribute(sizeAttribute), "40", "Input's size attribute.");
+ }
+
+ @Test
+ public void testMaxValueType() {
+ JQueryLocator selectOption = pjq("input[type=text][id$=maxValueInput]");
+ selenium.type(selectOption, "13");
+ selenium.waitForPageToLoad();
+
+ String reqTime = selenium.getText(time);
+ guardXhr(selenium).type(input, "11");
+ waitGui.failWith("Page was not updated").waitForChange(reqTime, retrieveText.locator(time));
+ assertEquals(selenium.getText(output), "11", "Output was not updated.");
+
+ reqTime = selenium.getText(time);
+ guardXhr(selenium).type(input, "13");
+ waitGui.failWith("Page was not updated").waitForChange(reqTime, retrieveText.locator(time));
+ assertEquals(selenium.getText(output), "13", "Output was not updated.");
+ }
+
+ @Test
+ public void testMaxValueClick() {
+ JQueryLocator selectOption = pjq("input[type=text][id$=maxValueInput]");
+ selenium.type(selectOption, "20");
+ selenium.waitForPageToLoad();
+
+ String reqTime = selenium.getText(time);
+ guardXhr(selenium).mouseDownAt(track, new Point(170, 0));
+ waitGui.failWith("Page was not updated").waitForChange(reqTime, retrieveText.locator(time));
+ assertEquals(selenium.getText(output), "17", "Output was not updated.");
+ String margin = selenium.getStyle(handle, CssProperty.MARGIN_LEFT).replace("px", "").trim();
+ double marginD = Double.parseDouble(margin);
+ assertTrue(marginD > 165 && marginD < 175, "Left margin of handle should be between 165 and 175.");
+
+ reqTime = selenium.getText(time);
+ guardXhr(selenium).mouseDownAt(track, new Point(195, 0));
+ waitGui.failWith("Page was not updated").waitForChange(reqTime, retrieveText.locator(time));
+ assertEquals(selenium.getText(output), "20", "Output was not updated.");
+ margin = selenium.getStyle(handle, CssProperty.MARGIN_LEFT).replace("px", "").trim();
+ marginD = Double.parseDouble(margin);
+ assertTrue(marginD > 190 && marginD < 200, "Left margin of handle should be between 190 and 200.");
+ }
+
+ @Test
+ @IssueTracking("https://jira.jboss.org/browse/RF-9860")
+ public void testMaxlength() {
+ selenium.type(pjq("input[type=text][id$=maxlengthInput]"), "5");
+ selenium.waitForPageToLoad();
+
+ AttributeLocator attr = input.getAttribute(Attribute.MAXLENGTH);
+ assertEquals(selenium.getAttribute(attr), "5", "Attribute maxlength of input.");
+
+ selenium.type(pjq("input[type=text][id$=maxlengthInput]"), "");
+ selenium.waitForPageToLoad();
+
+ if (Integer.parseInt(selenium.getAttribute(attr)) == 0) {
+ fail("Null attribute maxlength should not be evaluated as 0.");
+ }
+ }
+
+ @Test
+ public void testMinValueType() {
+ JQueryLocator selectOption = pjq("input[type=text][id$=minValueInput]");
+ selenium.type(selectOption, "-13");
+ selenium.waitForPageToLoad();
+
+ String reqTime = selenium.getText(time);
+ guardXhr(selenium).type(input, "-11");
+ waitGui.failWith("Page was not updated").waitForChange(reqTime, retrieveText.locator(time));
+ assertEquals(selenium.getText(output), "-11", "Output was not updated.");
+
+ reqTime = selenium.getText(time);
+ guardXhr(selenium).type(input, "-13");
+ waitGui.failWith("Page was not updated").waitForChange(reqTime, retrieveText.locator(time));
+ assertEquals(selenium.getText(output), "-13", "Output was not updated.");
+ }
+
+ @Test
+ public void testMinValueClick() {
+ JQueryLocator selectOption = pjq("input[type=text][id$=minValueInput]");
+ selenium.type(selectOption, "-20");
+ selenium.waitForPageToLoad();
+
+ String reqTime = selenium.getText(time);
+ guardXhr(selenium).mouseDownAt(track, new Point(30, 0));
+ waitGui.failWith("Page was not updated").waitForChange(reqTime, retrieveText.locator(time));
+ assertEquals(selenium.getText(output), "-15", "Output was not updated.");
+ String margin = selenium.getStyle(handle, CssProperty.MARGIN_LEFT).replace("px", "").trim();
+ double marginD = Double.parseDouble(margin);
+ assertTrue(marginD > 25 && marginD < 35, "Left margin of handle should be between 25 and 35.");
+
+ reqTime = selenium.getText(time);
+ guardXhr(selenium).mouseDownAt(track, new Point(0, 0));
+ waitGui.failWith("Page was not updated").waitForChange(reqTime, retrieveText.locator(time));
+ assertEquals(selenium.getText(output), "-20", "Output was not updated.");
+ margin = selenium.getStyle(handle, CssProperty.MARGIN_LEFT).replace("px", "").trim();
+ marginD = Double.parseDouble(margin);
+ assertTrue(marginD >= 0 && marginD < 10, "Left margin of handle should be between 190 and 200.");
+ }
+
+ @Test
+ public void testOnchangeType() {
+ String value = "metamerEvents += \"change \"";
+ selenium.type(pjq("input[id$=onchangeInput]"), value);
+ selenium.waitForPageToLoad(TIMEOUT);
+
+ selenium.getEval(new JavaScript("window.metamerEvents = \"\";"));
+
+ String reqTime = selenium.getText(time);
+ guardXhr(selenium).type(input, "4");
+ waitGui.failWith("Page was not updated").waitForChange(reqTime, retrieveText.locator(time));
+
+ String[] events = selenium.getEval(new JavaScript("window.metamerEvents")).split(" ");
+
+ assertEquals(events[0], "change", "Attribute onchange doesn't work");
+ assertEquals(events.length, 1, "Only one event should be fired");
+ }
+
+ @Test
+ public void testOnchangeClick() {
+ selenium.click(pjq("input[type=radio][name$=showArrowsInput][value=true]"));
+ selenium.waitForPageToLoad();
+
+ String value = "metamerEvents += \"change \"";
+ selenium.type(pjq("input[id$=onchangeInput]"), value);
+ selenium.waitForPageToLoad(TIMEOUT);
+
+ selenium.getEval(new JavaScript("window.metamerEvents = \"\";"));
+
+ // click on track, left arrow and right arrow
+ selenium.mouseDownAt(track, new Point(30, 0));
+ selenium.mouseUpAt(track, new Point(30, 0));
+ selenium.runScript(clickRight);
+ selenium.runScript(clickLeft);
+
+ String[] events = selenium.getEval(new JavaScript("window.metamerEvents")).split(" ");
+ assertEquals(events[0], "change", "Attribute onchange doesn't work");
+ assertEquals(events[1], "change", "Attribute onchange doesn't work.");
+ assertEquals(events[1], "change", "Attribute onchange doesn't work.");
+ assertEquals(events.length, 3, "Three events should be fired.");
+ }
+
+ @Test
+ public void testRendered() {
+ selenium.click(pjq("input[type=radio][name$=renderedInput][value=false]"));
+ selenium.waitForPageToLoad();
+
+ assertFalse(selenium.isElementPresent(slider), "Slider should not be rendered when rendered=false.");
+ }
+
+ @Test
+ public void testShowArrows() {
+ selenium.click(pjq("input[type=radio][name$=showArrowsInput][value=true]"));
+ selenium.waitForPageToLoad();
+
+ assertTrue(selenium.isElementPresent(left), "Left arrow should be present on the page.");
+ assertTrue(selenium.isVisible(left), "Left arrow should be visible.");
+ assertTrue(selenium.isElementPresent(right), "Right arrow should be present on the page.");
+ assertTrue(selenium.isVisible(right), "Right arrow should be visible.");
+ }
+
+ @Test
+ public void testShowBoundaryValues() {
+ selenium.click(pjq("input[type=radio][name$=showBoundaryValuesInput][value=false]"));
+ selenium.waitForPageToLoad();
+
+ assertFalse(selenium.isElementPresent(minBoundary), "Boundary values should not be present on the page.");
+ assertFalse(selenium.isElementPresent(maxBoundary), "Boundary values should not be present on the page.");
+ }
+
+ @Test
+ public void testShowInput() {
+ selenium.click(pjq("input[type=radio][name$=showInputInput][value=false]"));
+ selenium.waitForPageToLoad();
+
+ if (selenium.isElementPresent(input)) {
+ assertFalse(selenium.isVisible(input), "Input should not be visible on the page.");
+ }
+ }
+
+ @Test
+ public void testShowToolTip() {
+ selenium.click(pjq("input[type=radio][name$=showToolTipInput][value=true]"));
+ selenium.waitForPageToLoad();
+
+ assertTrue(selenium.isElementPresent(tooltip), "Tooltip should be present on the page.");
+ assertFalse(selenium.isVisible(tooltip), "Tooltip should not be visible.");
+
+ selenium.mouseDownAt(track, new Point(0, 0));
+ assertTrue(selenium.isVisible(tooltip), "Tooltip should be visible.");
+ assertEquals(selenium.getText(tooltip), "-10", "Value of tooltip.");
+
+ selenium.mouseUpAt(track, new Point(0, 0));
+ assertFalse(selenium.isVisible(tooltip), "Tooltip should not be visible.");
+ }
+
+ @Test
+ public void testStyle() {
+ testStyle(slider, "style");
+ }
+
+ @Test
+ public void testStyleClass() {
+ testStyleClass(slider, "styleClass");
+ }
+
+ @Test
+ public void testTabindex() {
+ selenium.type(pjq("input[id$=tabindexInput]"), "55");
+ selenium.waitForPageToLoad(TIMEOUT);
+
+ AttributeLocator attr = track.getAttribute(new Attribute("tabindex"));
+ assertTrue(selenium.isAttributePresent(attr), "Attribute tabindex of track is not present.");
+ assertEquals(selenium.getAttribute(attr), "55", "Attribute tabindex of track.");
+
+ attr = input.getAttribute(new Attribute("tabindex"));
+ assertTrue(selenium.isAttributePresent(attr), "Attribute tabindex of input is not present.");
+ assertEquals(selenium.getAttribute(attr), "55", "Attribute tabindex of input.");
+ }
+
+ @Test
+ public void testToolTipClass() {
+ selenium.click(pjq("input[type=radio][name$=showToolTipInput][value=true]"));
+ selenium.waitForPageToLoad();
+
+ testStyleClass(tooltip, "toolTipClass");
+ }
+
+ @Test
+ public void testTrackClass() {
+ testStyleClass(track, "trackClass");
+ }
+
+ @Test
+ @Use(field = "number", value = "correctNumbers")
+ public void testValueCorrect() {
+ selenium.type(pjq("input[id$=valueInput]"), number);
+ selenium.waitForPageToLoad();
+
+ assertEquals(selenium.getText(output), number, "Output was not updated.");
+ assertEquals(selenium.getValue(input), number, "Input was not updated.");
+ }
+
+ @Test
+ @Use(field = "number", value = "smallNumbers")
+ public void testValueSmall() {
+ selenium.type(pjq("input[id$=valueInput]"), number);
+ selenium.waitForPageToLoad();
+
+ assertEquals(selenium.getText(output), number, "Output was not updated.");
+ assertEquals(selenium.getValue(input), "-10", "Input was not updated.");
+ }
+
+ @Test
+ @Use(field = "number", value = "bigNumbers")
+ public void testValueBig() {
+ selenium.type(pjq("input[id$=valueInput]"), number);
+ selenium.waitForPageToLoad();
+
+ assertEquals(selenium.getText(output), number, "Output was not updated.");
+ assertEquals(selenium.getValue(input), "10", "Input was not updated.");
+ }
+
+ /**
+ * Clicks on slider's arrow.
+ * @param arrow slider's left or right arrow locator
+ * @param clicks how many times should it be clicked
+ */
+ private void clickArrow(ElementLocator<?> arrow, int clicks) {
+ String reqTime = null;
+
+ for (int i = 0; i < clicks; i++) {
+ reqTime = selenium.getText(time);
+ guardXhr(selenium).runScript(new JavaScript("jQuery(\"" + arrow.getRawLocator() + "\").mousedown().mouseup()"));
+
+ waitGui.failWith("Page was not updated").waitForChange(reqTime, retrieveText.locator(time));
+ }
+ }
+
+ /**
+ * Clicks on slider's arrow and verifies delay.
+ * @param arrow slider's left or right arrow locator
+ * @param delay awaited delay between ajax requests
+ */
+ private void verifyDelay(JQueryLocator arrow, int delay) throws ParseException {
+ SimpleDateFormat sdf = new SimpleDateFormat("hh:mm:ss.SSS");
+ long delta = (long) (delay * 0.5);
+ Set<String> timesSet = new TreeSet<String>();
+
+ selenium.mouseDown(arrow);
+
+ for (int i = 0; i < 12; i++) {
+ timesSet.add(selenium.getText(time));
+ waitFor(delta);
+ }
+
+ selenium.mouseUp(arrow);
+
+ Date[] timesArray = new Date[timesSet.size()];
+ List<String> timesList = new ArrayList<String>(timesSet);
+
+ for (int i = 1; i < timesList.size(); i++) {
+ timesArray[i] = sdf.parse(timesList.get(i));
+ }
+
+ delta = (long) (delay * 0.2);
+ for (int i = 1; i < timesArray.length - 1; i++) {
+ long diff = timesArray[i + 1].getTime() - timesArray[i].getTime();
+ assertTrue(Math.abs(diff - delay) < delta, "Delay " + diff + " is too far from set value (" + delay + ")");
+ }
+
+ }
+}
Property changes on: modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richInputNumberSlider/TestRichSlider.java
___________________________________________________________________
Name: svn:keywords
+ Revision
14 years, 1 month
JBoss Rich Faces SVN: r20168 - modules/docs/trunk/Component_Reference/src/main/docbook/en-US/images.
by richfaces-svn-commits@lists.jboss.org
Author: SeanRogers
Date: 2010-11-25 00:41:51 -0500 (Thu, 25 Nov 2010)
New Revision: 20168
Modified:
modules/docs/trunk/Component_Reference/src/main/docbook/en-US/images/figu-Component_Reference-richtabPanel-richtabPanel_component.png
Log:
Updated tab panel image
Modified: modules/docs/trunk/Component_Reference/src/main/docbook/en-US/images/figu-Component_Reference-richtabPanel-richtabPanel_component.png
===================================================================
(Binary files differ)
14 years, 1 month
JBoss Rich Faces SVN: r20167 - in modules/docs/trunk/Component_Reference/src/main/docbook/en-US: extras and 1 other directory.
by richfaces-svn-commits@lists.jboss.org
Author: SeanRogers
Date: 2010-11-25 00:17:35 -0500 (Thu, 25 Nov 2010)
New Revision: 20167
Added:
modules/docs/trunk/Component_Reference/src/main/docbook/en-US/extras/exam-Component_Reference-richautocomplete-Customizing_the_filter.xml_sample
Modified:
modules/docs/trunk/Component_Reference/src/main/docbook/en-US/chap-Component_Reference-Rich_inputs.xml
Log:
Added clientFilter to rich:autocomplete
Modified: modules/docs/trunk/Component_Reference/src/main/docbook/en-US/chap-Component_Reference-Rich_inputs.xml
===================================================================
--- modules/docs/trunk/Component_Reference/src/main/docbook/en-US/chap-Component_Reference-Rich_inputs.xml 2010-11-25 04:37:19 UTC (rev 20166)
+++ modules/docs/trunk/Component_Reference/src/main/docbook/en-US/chap-Component_Reference-Rich_inputs.xml 2010-11-25 05:17:35 UTC (rev 20167)
@@ -69,12 +69,26 @@
</para>
-->
<para>
- Users can type into the combo-box's text field to enter a value, which also searches through the suggestion items in the drop-down box. By default, the first suggestion item is selected as the user types. This behavior can be deactivated by setting <code><varname>selectFirst</varname>="false"</code>.
+ Users can type into the text field to enter a value, which also searches through the suggestion items in the drop-down box. By default, the first suggestion item is selected as the user types. This behavior can be deactivated by setting <code><varname>selectFirst</varname>="false"</code>.
</para>
<para>
Setting <code><varname>autoFill</varname>="true"</code> causes the combo-box to fill the text field box with a matching suggestion as the user types.
</para>
</section>
+
+ <section id="sect-Component_Reference-richautocomplete-Customizing_the_filter">
+ <title>Customizing the filter</title>
+ <para>
+ The <sgmltag><rich:autocomplete></sgmltag> component uses the JavaScript <function>startsWith()</function> method to create the list of suggestions. The filtering is performed on the client side. Alternatively, use the <varname>clientFilter</varname> attribute to specify a custom filtering function. The custom function must accept two parameters: the <varname>subString</varname> parameter is the filtering value as typed into the text box by the user, and the <varname>value</varname> parameter is an item in the list of suggestions against which the <varname>subString</varname> must be checked. Each item is iterated through and passed to the function as the <varname>value</varname> parameter. The custom function must return a boolean value indicating whether the passed item meets the conditions of the filter, and the suggestion list is constructed from successful items.
+ </para>
+ <example id="exam-Component_Reference-richautocomplete-Customizing_the_filter">
+ <title>Customizing the filter</title>
+ <para>
+ This example demonstrates how to use a custom filter with the <varname>clientFilter</varname> attribute. The custom filter determines if the sub-string is contained anywhere in the suggestion item, instead of just at the start.
+ </para>
+ <programlisting language="XML" role="XML"><xi:include parse="text" href="extras/exam-Component_Reference-richautocomplete-Customizing_the_filter.xml_sample" xmlns:xi="http://www.w3.org/2001/XInclude" /></programlisting>
+ </example>
+ </section>
<!-- TODO
<section id="sect-Component_Reference-richautocomplete-richautocomplete_events">
Added: modules/docs/trunk/Component_Reference/src/main/docbook/en-US/extras/exam-Component_Reference-richautocomplete-Customizing_the_filter.xml_sample
===================================================================
--- modules/docs/trunk/Component_Reference/src/main/docbook/en-US/extras/exam-Component_Reference-richautocomplete-Customizing_the_filter.xml_sample (rev 0)
+++ modules/docs/trunk/Component_Reference/src/main/docbook/en-US/extras/exam-Component_Reference-richautocomplete-Customizing_the_filter.xml_sample 2010-11-25 05:17:35 UTC (rev 20167)
@@ -0,0 +1,13 @@
+<script>
+ function customFilter(subString, value){
+ if(subString.length>=1) {
+ if(value.indexOf(subString)!=-1)
+ return true;
+ }else return false;
+ };
+</script>
+<h:form>
+ <rich:autocomplete mode="client" minChars="0" autofill="false"
+ clientFilter="customFilter"
+ autocompleteMethod="#{autocompleteBean.autocomplete}" />
+</h:form>
14 years, 1 month
JBoss Rich Faces SVN: r20166 - modules/docs/trunk/Component_Reference/src/main/docbook/en-US.
by richfaces-svn-commits@lists.jboss.org
Author: SeanRogers
Date: 2010-11-24 23:37:19 -0500 (Wed, 24 Nov 2010)
New Revision: 20166
Modified:
modules/docs/trunk/Component_Reference/src/main/docbook/en-US/chap-Component_Reference-Rich_inputs.xml
Log:
Updated rich:calendar based on review
Modified: modules/docs/trunk/Component_Reference/src/main/docbook/en-US/chap-Component_Reference-Rich_inputs.xml
===================================================================
--- modules/docs/trunk/Component_Reference/src/main/docbook/en-US/chap-Component_Reference-Rich_inputs.xml 2010-11-24 23:24:52 UTC (rev 20165)
+++ modules/docs/trunk/Component_Reference/src/main/docbook/en-US/chap-Component_Reference-Rich_inputs.xml 2010-11-25 04:37:19 UTC (rev 20166)
@@ -212,6 +212,7 @@
</example>
</section>
+ <!--
<section id="sect-Component_Reference-richcalendar-Using_a_data_model">
<title>Using a data model</title>
<para>
@@ -221,6 +222,7 @@
Alternatively, with <code>mode="ajax"</code> the <sgmltag><rich:calendar></sgmltag> requests portions of data for rendering from a special data model. The data model can be defined through the <varname>dataModel</varname> attribute, which points to an object that implements the <classname>CalendarDataModel</classname> interface. If the <varname>dataModel</varname> attribute is not defined or has a value of <literal>null</literal>, the <literal>ajax</literal> mode functions the same as the <literal>client</literal> mode.
</para>
</section>
+ -->
<section id="sect-Component_Reference-richcalendar-Behavior_and_appearance">
<title>Behavior and appearance</title>
@@ -230,6 +232,8 @@
<para>
To change the appearance of the display button from the standard calendar icon, use the <varname>buttonIcon</varname> and <varname>buttonIconDisabled</varname> attributes to replace the icon with a specified file. Alternatively, use the <varname>buttonLabel</varname> attribute to display text on the button without an icon. If <varname>buttonLabel</varname> is specified then both the <varname>buttonIcon</varname> and <varname>buttonIconDisabled</varname> attributes are ignored. To hide the text field box, set <code>showInput="false"</code>.
</para>
+ <!-- TODO not in M4 -->
+ <!--
<para>
To change the default position at which the pop-up calendar is shown relative to the text field and button, use the <varname>jointPoint</varname> and <varname>direction</varname> attributes. The <varname>jointPoint</varname> attribute refers to the corner of the text field and button with which the calendar will be aligned and the <varname>direction</varname> specifies which direction the pop-up calendar will span relative to the joint point. The default settings are <code>jointPoint="bottom-left"</code> and <code>direction="bottom-right"</code>, causing the pop-up calendar to align with the bottom-left corner of the text field and span to the bottom-right, underneath the text field and button. The diagram shows the joint points and directions that can be used. Alternatively, set both <varname>jointPoint</varname> and <varname>direction</varname> attributes to <literal>auto</literal> to allow smart pop-up positioning. <xref linkend="figu-Component_Reference-richcalendar!
-Pop-up_positioning" /> shows the different possible settings for the <varname>jointPoint</varname> and <varname>direction</varname> attributes.
</para>
@@ -249,6 +253,7 @@
Pop-up positioning is determined using the <varname>jointPoint</varname> and <varname>direction</varname> attributes. Values for the <varname>jointPoint</varname> attribute are shown in red, while values for the <varname>direction</varname> attribute are shown in black.
</para>
</figure>
+ -->
<para>
The calendar features a <guibutton>Today</guibutton> button for locating today's date on the calendar. This can be set to three different values using the <varname>todayControlMode</varname> attribute:
</para>
@@ -272,6 +277,9 @@
<para>
To make the entire calendar read-only, set <code>readonly="true"</code>. This allows months and years to be browsed through with the arrow controls, but dates and times cannot be selected.
</para>
+ <para>
+ The locale for the calendar can be defined at the component level. All calendar labels will be localized according to this locale.
+ </para>
<!-- TODO not in M4 -->
<!--
<para>
@@ -285,8 +293,16 @@
<para>
The <sgmltag><rich:calendar></sgmltag> component can additionally allow a time of day to be specified with the date. After selecting a date the option to set a time becomes available. The default time can be set with the <varname>defaultTime</varname> attribute. If the time is altered and a new date is selected, it will not reset unless <code>resetTimeOnDateSelect="true"</code> is specified.
</para>
+ <note>
+ <title>Support for seconds</title>
+ <para>
+ In RichFaces 4, the <sgmltag><rich:calendar></sgmltag> component supports times that include seconds. Previous versions of RichFaces only supported hours and minutes.
+ </para>
+ </note>
</section>
-
+
+ <!-- TODO not in M4 -->
+ <!--
<section id="sect-Component_Reference-richcalendar-richcalendar_events">
<title><sgmltag><rich:calendar></sgmltag> events</title>
<para>
@@ -325,6 +341,7 @@
</listitem>
</itemizedlist>
</section>
+ -->
<section id="sect-Component_Reference-richcalendar-Reference_data">
<title>Reference data</title>
14 years, 1 month