JBoss.org Community Documentation

- Prev
- Next

## 6.39. < rich:dndParam >

### 6.39.1. Description

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

Table 6.150. rich : dndParam attributes

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

Table 6.151. Component identification parameters

Name | Value
--- | ---
component-type | org.richfaces.DndParam
component-class | org.richfaces.component.html.HtmlDndParam
tag-class | org.richfaces.taglib.DndParamTag

### 6.39.2. Creating the Component with a Page Tag

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>

    ...

### 6.39.3. Creating the Component Dynamically Using Java

Example:

    import org.richfaces.component.html.HtmlDndParam;

    ...

    HtmlDndParam myDparam = new HtmlDndParam();

    ...

### 6.39.4. Details of Usage

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:

- Parameters passing for a drag icon when an indicator is in drag.

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)

- Parameters passing for an indicator informational part during a drag.

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)

- Parameters passing happens when dragged content is brought onto some zone with dropSupport

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.

### 6.39.5. Look-and-Feel Customization

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

### 6.39.6. Relevan Resources Links

Here you can see the example of <rich:dndParam> usage and sources for the given example.

- Prev6.38. < rich:subTable >
- Top of page
- Front page
- Next6.40. < rich:dragIndicator >