Saturday, September 25

Adding Drag and Drop Functionality for DVT Graphs

You can configure drag and drop for the DVT bubble and scatter graphs, which permits the consumer to change the price of a marker by way of repositioning it. When you want customers to be able to tug and drop in a graph, you use the dragSource and dropTarget tags. Additionally, you use the DataFlavor object to decide the legitimate Java form of the sources for the drop target, in this example a GraphSelection item. You additionally have to enforce any required functionality in response to the drag and drop motion
The scatterGraph aspect incorporates both a dragSource tag and a dropTarget tag. You also use a dataFlavor tag to determine the form of object being dropped.

You additionally must put into effect a listener for the drop event. The object of the drop event is referred to as the transferable, which includes the payload of the drop. Your listener have to get entry to the transferable object, and from there, use the DataFlavor item to verify that the item can be dropped. You then use the drop occasion to get the target factor and update the assets with the dropped object.

To upload drag and drop fuctionaility , first upload supply and goal tags to the graph. Then implement the occasion handler technique in order to handle the common sense for the drag and drop motion. For statistics approximately what happens at runtime, see Section 34.Three.2, “What Happens at Runtime.”

To add drag and drop capability:

In the Component Palette, from the Operations panel, drag a Drop Target tag and drop it as a infant to the graph component.

In the Insert Drop Target dialog, input an expression that evaluates to a technique on a managed bean that will manage the event (you'll create this code in Step 6).

In the Insert Data Flavor conversation, enter oracle.Adf.View.Faces.Bi.Issue.Graph.GraphSelection, that is the class for the object that may be dropped onto the target. This entry can be used to create a dataFlavor tag, which determines the sort of item that can be dropped onto the target.

In the Property Inspector, set a cost for Discriminant, if wanted. A discriminant is an arbitrary string used to decide which source can drop on the goal. For instance, suppose you have got two graphs that both be given an GraphSelection object, GraphA and GraphB. You also have  resources, both of which are GraphSelection gadgets. By placing a discriminant fee on GraphA with a price of alpha, simplest the GraphSelection supply that provides the discriminant price of alpha may be everyday.

In the Structure window, pick the dropTarget tag. In the Property inspector, pick MOVE because the price for Actions.

In the Component Palette, from the Operations panel, drag and drop a Drag Source as a infant to the graph issue.

With the dragSource tag selected, in the Property Inspector set MOVE as the allowed Action and upload any wished discriminant, as configured for the dataFlavor tag.

In the managed bean referenced inside the EL expression created in Step 2, create the occasion handler approach (using the identical name as in the EL expression) in an effort to take care of the drag and drop capability.

This technique need to take a DropEvent event as a parameter and go back a DnDAction object, that is the action in order to be executed whilst the source is dropped, in this case DnDAction.MOVE. This approach must check the DropEvent occasion to determine whether or not it will take delivery of the drop. If the technique accepts the drop, it must carry out the drop and go back the DnDAction item it accomplished. Otherwise, it need to go back DnDAction.NONE to signify that the drop changed into rejected. The method ought to additionally check for the presence of the dataFlavor object, in this example oracle.Adf.View.Faces.Bi.Element.Graph.GraphSelection.

Leave a Reply

Your email address will not be published. Required fields are marked *