You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@myfaces.apache.org by al...@apache.org on 2010/08/12 01:08:38 UTC
svn commit: r984615 - in
/myfaces/gsoc/html5-comp-lib/trunk/html5-comp-lib-core/src/main/java/org/apache/myfaces/html5:
behavior/ handler/
Author: aliok
Date: Wed Aug 11 23:08:38 2010
New Revision: 984615
URL: http://svn.apache.org/viewvc?rev=984615&view=rev
Log:
Moving documentation of behaviors to their handlers.
So, myfaces-build-plugin can create the correct doc.
Modified:
myfaces/gsoc/html5-comp-lib/trunk/html5-comp-lib-core/src/main/java/org/apache/myfaces/html5/behavior/DragSourceBehavior.java
myfaces/gsoc/html5-comp-lib/trunk/html5-comp-lib-core/src/main/java/org/apache/myfaces/html5/behavior/DropTargetBehavior.java
myfaces/gsoc/html5-comp-lib/trunk/html5-comp-lib-core/src/main/java/org/apache/myfaces/html5/handler/DragSourceBehaviorHandler.java
myfaces/gsoc/html5-comp-lib/trunk/html5-comp-lib-core/src/main/java/org/apache/myfaces/html5/handler/DropTargetBehaviorHandler.java
Modified: myfaces/gsoc/html5-comp-lib/trunk/html5-comp-lib-core/src/main/java/org/apache/myfaces/html5/behavior/DragSourceBehavior.java
URL: http://svn.apache.org/viewvc/myfaces/gsoc/html5-comp-lib/trunk/html5-comp-lib-core/src/main/java/org/apache/myfaces/html5/behavior/DragSourceBehavior.java?rev=984615&r1=984614&r2=984615&view=diff
==============================================================================
--- myfaces/gsoc/html5-comp-lib/trunk/html5-comp-lib-core/src/main/java/org/apache/myfaces/html5/behavior/DragSourceBehavior.java (original)
+++ myfaces/gsoc/html5-comp-lib/trunk/html5-comp-lib-core/src/main/java/org/apache/myfaces/html5/behavior/DragSourceBehavior.java Wed Aug 11 23:08:38 2010
@@ -27,11 +27,9 @@ import javax.faces.application.ResourceD
import javax.faces.application.ResourceDependency;
import javax.faces.context.FacesContext;
-import org.apache.myfaces.html5.event.DropEvent;
+import org.apache.myfaces.buildtools.maven2.plugin.builder.annotation.JSFBehavior;
+
-//TODO: use the myfaces annotation and fix the template!
-//@JSFBehavior(name = "fx:dragSource", id = "org.apache.myfaces.html5.DragSource")
-//@FacesBehavior(value="org.apache.myfaces.html5.DragSourceBehavior")
/**
* Adds the Html5 drag functionality to its parent. <br/>
* This behavior should be attached to "dragstart" event of the parent.
@@ -44,6 +42,7 @@ import org.apache.myfaces.html5.event.Dr
@ResourceDependency(name = "jsf.js", library = "javax.faces", target = "head"),
@ResourceDependency(name = "html5.js", library = "myfaces.apache.org", target = "head")
})
+@JSFBehavior(name = "fx:dragSource", id = "org.apache.myfaces.html5.DragSource")
public class DragSourceBehavior extends javax.faces.component.behavior.ClientBehaviorBase implements ValueExpressionHolder
{
@@ -63,17 +62,7 @@ public class DragSourceBehavior extends
}
/**
- * Action of for drag operation. Can be one of below:
- * <ul>
- * <li>copy: A copy of the source item may be made at the new location.</li>
- * <li>move: An item may be moved to a new location.</li>
- * <li>link: A link may be established to the source at the new location.</li>
- * <li>none: The item may not be dropped.</li>
- * </ul>
- * <br/>
- *
- * If nothing is specified, the action will be defined by the browser and can be adjusted using the modifier keys.
- * If dropTarget does not accept the action of this dragSource, then the DnD will fail.
+ * @see DragSourceBehavior#_action
*/
public String getAction()
{
@@ -86,10 +75,7 @@ public class DragSourceBehavior extends
}
/**
- * The types of the dropTargets that drags from this dragSource can be applied. Can be comma separated set or
- * String[] or Collection<String>. <br/>
- * If defined, drags from this dragSource will work into only the dropTargets that have one of the same type. The
- * drag will be accepted if 'types' of hx:dropTarget has one of the types defined here.
+ * @see DragSourceBehavior#_dropTargetTypes
*/
public Object getDropTargetTypes()
{
@@ -102,9 +88,7 @@ public class DragSourceBehavior extends
}
/**
- * Data to send to server when a successful drag&drop happens from this source. <br/>
- * The param can be received using the {@link DropEvent#getParam()} method at dropListener of the fx:dropTarget.
- *
+ * @see DragSourceBehavior#_param
*/
public String getParam()
{
Modified: myfaces/gsoc/html5-comp-lib/trunk/html5-comp-lib-core/src/main/java/org/apache/myfaces/html5/behavior/DropTargetBehavior.java
URL: http://svn.apache.org/viewvc/myfaces/gsoc/html5-comp-lib/trunk/html5-comp-lib-core/src/main/java/org/apache/myfaces/html5/behavior/DropTargetBehavior.java?rev=984615&r1=984614&r2=984615&view=diff
==============================================================================
--- myfaces/gsoc/html5-comp-lib/trunk/html5-comp-lib-core/src/main/java/org/apache/myfaces/html5/behavior/DropTargetBehavior.java (original)
+++ myfaces/gsoc/html5-comp-lib/trunk/html5-comp-lib-core/src/main/java/org/apache/myfaces/html5/behavior/DropTargetBehavior.java Wed Aug 11 23:08:38 2010
@@ -26,13 +26,11 @@ import javax.faces.application.ResourceD
import javax.faces.application.ResourceDependency;
import javax.faces.context.FacesContext;
+import org.apache.myfaces.buildtools.maven2.plugin.builder.annotation.JSFBehavior;
import org.apache.myfaces.html5.event.DropEvent;
import org.apache.myfaces.html5.event.DropListener;
-import org.apache.myfaces.html5.renderkit.behavior.DropTargetBehaviorRenderer;
+import org.apache.myfaces.html5.handler.DropTargetBehaviorHandler;
-//TODO: use the myfaces annotation and fix the template!
-//@JSFBehavior(name = "fx:dragTarget", id = "org.apache.myfaces.html5.DragDropTargetBehavior")
-//@FacesBehavior(value="org.apache.myfaces.html5.DropTargetBehavior")
/**
* Provides Html5 drop functionality to its parent.
*
@@ -44,6 +42,7 @@ import org.apache.myfaces.html5.renderki
@ResourceDependency(name = "jsf.js", library = "javax.faces", target = "head"),
@ResourceDependency(name = "html5.js", library = "myfaces.apache.org", target = "head")
})
+@JSFBehavior(name = "fx:dropTarget", id = "org.apache.myfaces.html5.DragDropTargetBehavior")
public class DropTargetBehavior extends javax.faces.component.behavior.ClientBehaviorBase implements ValueExpressionHolder
{
@@ -80,22 +79,7 @@ public class DropTargetBehavior extends
}
/**
- * Action to allow for drop operation. Can be one of below:
- * <ul>
- * <li>copy: A copy of the source item may be made at the new location.</li>
- * <li>move: An item may be moved to a new location.</li>
- * <li>link: A link may be established to the source at the new location.</li>
- * <li>copyLink: A copy or link operation is permitted.</li>
- * <li>copyMove: A copy or move operation is permitted.</li>
- * <li>linkMove: A link or move operation is permitted.</li>
- * <li>all: All operations are permitted.</li>
- * <li>none: The item may not be dropped.</li>
- * </ul>
- * <br/>
- *
- * If nothing is specified, any action will be accepted. Action is set by the hx:dragSource behavior, when the
- * element is generated by a MyFaces-Html5 component that has hx:dragSource behavior. For other elements, action is
- * set by the browser, and can be adjusted by pressing the modifier keys.
+ * @see DropTargetBehaviorHandler#_action
*/
public String getAction()
{
@@ -108,11 +92,7 @@ public class DropTargetBehavior extends
}
/**
- * The type of the drop target. Can be comma separated set or String[] or Collection<String>. <br/>
- * If defined, drags from elements that are generated by MyFaces-Html5 components with hx:dragSource behavior, will
- * be filtered. The drag will be accepted if dropTargetTypes of hx:dragSource is one of the allowed. For the drags
- * that are originated from other elements, this property is ignored. Please see acceptMimeTypes property for
- * accepting/rejecting drags from non-MyFaces-Html5 components.
+ * @see DropTargetBehaviorHandler#_types
*/
public Object getTypes()
{
@@ -125,43 +105,7 @@ public class DropTargetBehavior extends
}
/**
- * If this property is set, only content dropped into this drop zone with defined mime type will be accepted and
- * sent to server-side drop listener. Can be comma separated set or String[] or Collection<String>. <br/>
- * <br/>
- * HTML5 DnD allows us to drop anything into drop zone : files from desktop, images on some other document, etc. So
- * this property is a filter. If value is "*", any content dropped into this zone will be accepted. <br/>
- * <br/>
- * All type info and data of dropped stuff will be sent to dropListener. For example, if value of this property is
- * "*" and we drop some image from any Html page(even not generated by JSF), dropListener will be triggered with the
- * following data:
- * <table border="1">
- * <tr>
- * <td>content-type</td>
- * <td>value</td>
- * </tr>
- * <tr>
- * <td>text/uri-list</td>
- * <td>http://example.org/someImage.png</td>
- * </tr>
- * <tr>
- * <td>Text</td>
- * <td>http://example.org/someImage.png</td>
- * </tr>
- * <tr>
- * <td>text/plain</td>
- * <td>http://example.org/someImage.png</td>
- * </tr>
- * <tr>
- * <td>URL</td>
- * <td>http://example.org/someImage.png</td>
- * </tr>
- * </table>
- * <br/>
- *
- * Mime type is "text/x-myfaces-html5-dnd-source" for drag&drop events that is generated by MyFaces-Html5 components
- * and that mime type is defined at {@link DropTargetBehaviorRenderer#DEFAULT_MYFACES_MIME_TYPE}. Default value of
- * this property is "text/x-myfaces-html5-dnd-source", thus only MyFaces generated components can be dropped into
- * the drop target.
+ * @see DropTargetBehaviorHandler#_acceptMimeTypes
*/
// TODO: implement accepting all mime types with supporting '*' for the value.
public Object getAcceptMimeTypes()
@@ -175,9 +119,7 @@ public class DropTargetBehavior extends
}
/**
- * Space separated ids of components to rerender. <br/>
- * Value of this property will be passed through to jsf.ajax.request, thus semantics is same with jsf.ajax.request
- * and f:ajax. Just like those, @all, @this etc. can be used.
+ * @see DropTargetBehaviorHandler#_rerender
*/
public Object getRerender()
{
Modified: myfaces/gsoc/html5-comp-lib/trunk/html5-comp-lib-core/src/main/java/org/apache/myfaces/html5/handler/DragSourceBehaviorHandler.java
URL: http://svn.apache.org/viewvc/myfaces/gsoc/html5-comp-lib/trunk/html5-comp-lib-core/src/main/java/org/apache/myfaces/html5/handler/DragSourceBehaviorHandler.java?rev=984615&r1=984614&r2=984615&view=diff
==============================================================================
--- myfaces/gsoc/html5-comp-lib/trunk/html5-comp-lib-core/src/main/java/org/apache/myfaces/html5/handler/DragSourceBehaviorHandler.java (original)
+++ myfaces/gsoc/html5-comp-lib/trunk/html5-comp-lib-core/src/main/java/org/apache/myfaces/html5/handler/DragSourceBehaviorHandler.java Wed Aug 11 23:08:38 2010
@@ -38,6 +38,7 @@ import org.apache.myfaces.buildtools.mav
import org.apache.myfaces.buildtools.maven2.plugin.builder.annotation.JSFFaceletTag;
import org.apache.myfaces.html5.behavior.DragSourceBehavior;
import org.apache.myfaces.html5.component.api.Draggable;
+import org.apache.myfaces.html5.event.DropEvent;
import org.apache.myfaces.html5.renderkit.util.ClientBehaviorEvents;
import org.apache.myfaces.shared_html5.renderkit.RendererUtils;
@@ -54,19 +55,34 @@ public class DragSourceBehaviorHandler e
private static final Logger log = Logger.getLogger(DragSourceBehaviorHandler.class.getName());
/**
- * @see DragSourceBehavior#getAction()
+ * Action of for drag operation. Can be one of below:
+ * <ul>
+ * <li>copy: A copy of the source item may be made at the new location.</li>
+ * <li>move: An item may be moved to a new location.</li>
+ * <li>link: A link may be established to the source at the new location.</li>
+ * <li>none: The item may not be dropped.</li>
+ * </ul>
+ * <br/>
+ *
+ * If nothing is specified, the action will be defined by the browser and can be adjusted using the modifier keys.
+ * If dropTarget does not accept the action of this dragSource, then the DnD will fail.
+ *
*/
@JSFFaceletAttribute(name = "action", className = "javax.el.ValueExpression", deferredValueType = "java.lang.String")
private final TagAttribute _action;
/**
- * @see DragSourceBehavior#getDropTargetTypes()
+ * The types of the dropTargets that drags from this dragSource can be applied. Can be comma separated set or
+ * String[] or Collection<String>. <br/>
+ * If defined, drags from this dragSource will work into only the dropTargets that have one of the same type. The
+ * drag will be accepted if 'types' of hx:dropTarget has one of the types defined here.
*/
@JSFFaceletAttribute(name = "dropTargetTypes", className = "javax.el.ValueExpression", deferredValueType = "java.lang.Object")
private final TagAttribute _dropTargetTypes;
/**
- * @see DragSourceBehavior#getParam()
+ * Data to send to server when a successful drag&drop happens from this source. <br/>
+ * The param can be received using the {@link DropEvent#getParam()} method at dropListener of the fx:dropTarget.
*/
@JSFFaceletAttribute(name = "param", className = "javax.el.ValueExpression", deferredValueType = "java.lang.String")
private final TagAttribute _param;
@@ -139,8 +155,8 @@ public class DragSourceBehaviorHandler e
}
else
{
- dragSourceBehavior.setValueExpression("action", _action.getValueExpression(faceletContext,
- String.class));
+ dragSourceBehavior.setValueExpression("action",
+ _action.getValueExpression(faceletContext, String.class));
}
}
@@ -152,8 +168,8 @@ public class DragSourceBehaviorHandler e
}
else
{
- dragSourceBehavior.setValueExpression("dropTargetTypes", _dropTargetTypes.getValueExpression(
- faceletContext, Object.class));
+ dragSourceBehavior.setValueExpression("dropTargetTypes",
+ _dropTargetTypes.getValueExpression(faceletContext, Object.class));
}
}
if (_param != null)
@@ -164,8 +180,8 @@ public class DragSourceBehaviorHandler e
}
else
{
- dragSourceBehavior.setValueExpression("param", _param.getValueExpression(faceletContext,
- String.class));
+ dragSourceBehavior.setValueExpression("param",
+ _param.getValueExpression(faceletContext, String.class));
}
}
Modified: myfaces/gsoc/html5-comp-lib/trunk/html5-comp-lib-core/src/main/java/org/apache/myfaces/html5/handler/DropTargetBehaviorHandler.java
URL: http://svn.apache.org/viewvc/myfaces/gsoc/html5-comp-lib/trunk/html5-comp-lib-core/src/main/java/org/apache/myfaces/html5/handler/DropTargetBehaviorHandler.java?rev=984615&r1=984614&r2=984615&view=diff
==============================================================================
--- myfaces/gsoc/html5-comp-lib/trunk/html5-comp-lib-core/src/main/java/org/apache/myfaces/html5/handler/DropTargetBehaviorHandler.java (original)
+++ myfaces/gsoc/html5-comp-lib/trunk/html5-comp-lib-core/src/main/java/org/apache/myfaces/html5/handler/DropTargetBehaviorHandler.java Wed Aug 11 23:08:38 2010
@@ -40,6 +40,7 @@ import org.apache.myfaces.buildtools.mav
import org.apache.myfaces.html5.behavior.DropTargetBehavior;
import org.apache.myfaces.html5.event.DropEvent;
import org.apache.myfaces.html5.event.DropListener;
+import org.apache.myfaces.html5.renderkit.behavior.DropTargetBehaviorRenderer;
import org.apache.myfaces.html5.renderkit.util.ClientBehaviorEvents;
import org.apache.myfaces.shared_html5.renderkit.RendererUtils;
@@ -51,25 +52,83 @@ public class DropTargetBehaviorHandler e
private static final Logger log = Logger.getLogger(DropTargetBehaviorHandler.class.getName());
/**
- * @see DropTargetBehavior#getAction()
+ * Action to allow for drop operation. Can be one of below:
+ * <ul>
+ * <li>copy: A copy of the source item may be made at the new location.</li>
+ * <li>move: An item may be moved to a new location.</li>
+ * <li>link: A link may be established to the source at the new location.</li>
+ * <li>copyLink: A copy or link operation is permitted.</li>
+ * <li>copyMove: A copy or move operation is permitted.</li>
+ * <li>linkMove: A link or move operation is permitted.</li>
+ * <li>all: All operations are permitted.</li>
+ * <li>none: The item may not be dropped.</li>
+ * </ul>
+ * <br/>
+ *
+ * If nothing is specified, any action will be accepted. Action is set by the hx:dragSource behavior, when the
+ * element is generated by a MyFaces-Html5 component that has hx:dragSource behavior. For other elements, action is
+ * set by the browser, and can be adjusted by pressing the modifier keys.
+ *
*/
@JSFFaceletAttribute(name = "action", className = "javax.el.ValueExpression", deferredValueType = "java.lang.String")
private final TagAttribute _action;
/**
- * @see DropTargetBehavior#getTypes()
+ * The type of the drop target. Can be comma separated set or String[] or Collection<String>. <br/>
+ * If defined, drags from elements that are generated by MyFaces-Html5 components with hx:dragSource behavior, will
+ * be filtered. The drag will be accepted if dropTargetTypes of hx:dragSource is one of the allowed. For the drags
+ * that are originated from other elements, this property is ignored. Please see acceptMimeTypes property for
+ * accepting/rejecting drags from non-MyFaces-Html5 components.
*/
@JSFFaceletAttribute(name = "types", className = "javax.el.ValueExpression", deferredValueType = "java.lang.Object")
private final TagAttribute _types;
/**
- * @see DropTargetBehavior#getAcceptMimeTypes()
+ * If this property is set, only content dropped into this drop zone with defined mime type will be accepted and
+ * sent to server-side drop listener. Can be comma separated set or String[] or Collection<String>. <br/>
+ * <br/>
+ * HTML5 DnD allows us to drop anything into drop zone : files from desktop, images on some other document, etc. So
+ * this property is a filter. If value is "*", any content dropped into this zone will be accepted. <br/>
+ * <br/>
+ * All type info and data of dropped stuff will be sent to dropListener. For example, if value of this property is
+ * "*" and we drop some image from any Html page(even not generated by JSF), dropListener will be triggered with the
+ * following data:
+ * <table border="1">
+ * <tr>
+ * <td>content-type</td>
+ * <td>value</td>
+ * </tr>
+ * <tr>
+ * <td>text/uri-list</td>
+ * <td>http://example.org/someImage.png</td>
+ * </tr>
+ * <tr>
+ * <td>Text</td>
+ * <td>http://example.org/someImage.png</td>
+ * </tr>
+ * <tr>
+ * <td>text/plain</td>
+ * <td>http://example.org/someImage.png</td>
+ * </tr>
+ * <tr>
+ * <td>URL</td>
+ * <td>http://example.org/someImage.png</td>
+ * </tr>
+ * </table>
+ * <br/>
+ *
+ * Mime type is "text/x-myfaces-html5-dnd-source" for drag&drop events that is generated by MyFaces-Html5 components
+ * and that mime type is defined at {@link DropTargetBehaviorRenderer#DEFAULT_MYFACES_MIME_TYPE}. Default value of
+ * this property is "text/x-myfaces-html5-dnd-source", thus only MyFaces generated components can be dropped into
+ * the drop target.
*/
@JSFFaceletAttribute(name = "acceptMimeTypes", className = "javax.el.ValueExpression", deferredValueType = "java.lang.Object")
private final TagAttribute _acceptMimeTypes;
/**
- * @see DropTargetBehavior#getRerender()
+ * Space separated ids of components to rerender. <br/>
+ * Value of this property will be passed through to jsf.ajax.request, thus semantics is same with jsf.ajax.request
+ * and f:ajax. Just like those, @all, @this etc. can be used.
*/
@JSFFaceletAttribute(name = "rerender", className = "javax.el.ValueExpression", deferredValueType = "java.lang.Object")
private final TagAttribute _rerender;