JBoss.orgCommunity Documentation
Some concepts covered in this chapter may refer to the previous version of Richfaces, version 3.3.3. This chapter is scheduled for review to ensure all information is up to date.
Read this chapter for details on adding drag and drop support to controls.
The <rich:dragBehavior>
behavior can be added to a component to indicate it is capable of being dragged by the user. The dragged item can then be dropped into a compatible drop area, designated using the <rich:dropBehavior>
behavior.
To add drag support to a component, attach the <rich:dragBehavior>
behavior as a child element.
The type
attribute must be specified, and can be any identifying string. Dragged items can only be dropped in drop zones where the type
attribute of the <rich:dragBehavior>
behavior is listed in the acceptedTypes
attribute of the <rich:dropBehavior>
behavior.
To bind data to the dragged object, use the dragValue
attribute. The dragValue
attribute specifies an item in a data model, which is then bound to the parent component when it is dragged. This facilitates handling event data during a drop event.
The <rich:dropBehavior>
behavior can be added to a component so that the component can accept dragged items. The dragged items must support the <rich:dragBehavior>
behavior, and be of a compatible drop type.
To allow dragged items to be dropped on a component, attach the <rich:dropBehavior>
behavior as a child element to the component.
The acceptedTypes
attribute must be specified. The acceptedTypes
attribute is a comma-separated list of strings that match the types of dragged items. Dragged items can only be dropped in drop zones where the type
attribute of the <rich:dragBehavior>
behavior is listed in the acceptedTypes
attribute of the <rich:dropBehavior>
behavior.
To provide additional parameters for a drop event, use the dropValue
attribute.
The <rich:dropBehavior>
behavior raises the DropEvent
server-side event when an object is dropped. The event uses the following parameters:
The dragComponent
identifies the component being dragged (the parent of the <rich:dragBehavior>
behavior).
The dropComponent
parameter identifies the drop zone component (the parent of the <rich:dropBehavior>
behavior).
The dragSource
parameter is the content of the <rich:dragBehavior>
behavior's dragValue
attribute.
The dropSource
parameter is the content of the <rich:dropBehavior>
behavior's dropValue
attribute.