Create new RichFaces Documentation Jira issue

This will launch the RichFaces Jira page - to complete your feedback please login if needed, and submit the Jira.

JBoss.orgCommunity Documentation

6.7.6.  < rich:dndParam > available since 3.0.0

This component is used for passing parameters during drag-and-drop operations.

Table 6.143. rich : dndParam attributes

Attribute Name Description
binding JSF: The attribute takes a value-binding expression for a component property of a backing bean
id JSF: Every component may have a unique id that is automatically created if omitted
nameA name of this parameter
rendered JSF: If "false", this component is not rendered
typeHTML: This attribute defines parameter functionality. Possible values are "drag", "drop" and "default". Default value is "default".
value JSF: The current value for this component

Table 6.144. Component identification parameters

NameValue
component-typeorg.richfaces.DndParam
component-classorg.richfaces.component.html.HtmlDndParam
tag-classorg.richfaces.taglib.DndParamTag

Here is a simple example as it could be used on a page, nested in one of the drag-and-drop components:

Example:


...
<rich:dragSupport dragType="file">
        <rich:dndParam name="testDrag" value="testDragValue" 
                        type="drag"/>
</rich:dragSupport>
...

Example:

import org.richfaces.component.html.HtmlDndParam;

...
HtmlDndParam myDparam = new HtmlDndParam();
...

dndParam is used during drag-and-drop operations to pass parameters to an indicator. At first, a parameter type is defined with the type attribute (to specify parameter functionality), then a parameter name could be defined with the name and value attribute. Although, it's possible to use nested content defined inside dndParam for value definition, instead of the attribute.

Variants of usage:

In this case, dndParam is of a drag type and is defined in the following way:

Example:


...
<rich:dragSupport ... > 
        <rich:dndParam type="drag" name="dragging"> 
                <h:graphicImage value="/img/product1_small.png"/> 
        </rich:dndParam> 
        <h:graphicImage value="product1.png"/> 
</rich:dragSupport>
...

Here dndParam defines an icon that is used by an indicator when a drag is on the place of a default icon (e.g. a minimized image of a draggable element)

In this case dndParam is of a drag type and is defined in the following way:

Example:


...
<rich:dragSupport ... > 
        <rich:dndParam type="drag" name="label" value="#{msg.subj}"/>
        ...
</rich:dragSupport>
...

The parameter is transmitted into an indicator for usage in an informational part of the dragIndicator component (inside an indicator a call to {label} happens)

In this case dndParam is of a drop type and is defined in the following way:

Example:


...
<rich:dropSupport ... > 
        <rich:dndParam type="drop" name="comp" > 
                <h:graphicImage height="16" width="16" value="/images/comp.png"/> 
        </rich:dndParam>
        ...
</rich:dropSupport >
...

Here, dndParam passes icons into an indicator, if dragged content of a comp type is above the given drop zone that processes it on the next drop event.

<rich:dndParam> has no skin parameters and custom style classes, as the component isn't visual.

On the component LiveDemo page you can see the example of <rich:dndParam> usage and sources for the given example.