DragAgent"

From Documentation
Line 1: Line 1:
 
{{ZATSEssentialsPageHeader}}
 
{{ZATSEssentialsPageHeader}}
  
 +
__TOC__
  
 +
 +
= Drag & Drop =
  
 
<tt> DragAgent </tt> makes you mimic dragging a component and drop on another component. You have to query the component you want to drag first and convert it as <tt> DragAgent </tt> then call <tt> dropOn(ComponentAgent) </tt>. The argument you pass into the method is the target component you want to drop on.
 
<tt> DragAgent </tt> makes you mimic dragging a component and drop on another component. You have to query the component you want to drag first and convert it as <tt> DragAgent </tt> then call <tt> dropOn(ComponentAgent) </tt>. The argument you pass into the method is the target component you want to drop on.
Line 18: Line 21:
  
 
</source>
 
</source>
 +
 +
 +
=Supported Components=
 +
 +
{| border="1" | width="100%"
 +
! <center>Components</center>
 +
! <center>Version</center>
 +
! <center>Note</center>
 +
|-
 +
| Sub-class of <javadoc> org.zkoss.zk.ui.HtmlBasedComponent </javadoc>
 +
| 5, 6
 +
|
 +
|}
  
  
  
 
{{ZATSEssentialsPageFooter}}
 
{{ZATSEssentialsPageFooter}}

Revision as of 02:26, 16 May 2012



Drag & Drop

DragAgent makes you mimic dragging a component and drop on another component. You have to query the component you want to drag first and convert it as DragAgent then call dropOn(ComponentAgent) . The argument you pass into the method is the target component you want to drop on.

Assume that we have two listbox: leftBox, rightBox, you can drag listitem between two listboxes.

Zats-mimic-dragDrop.png

The following code presents how to drag a listitem from left listbox to right listbox.

		//move 1 item from left to right
		ComponentAgent draggedItem = leftBox.query("listcell[label='ZK Forge']").getParent();
		draggedItem.as(DragAgent.class).dropOn(rightBox);


Supported Components

Components
Version
Note
Sub-class of HtmlBasedComponent 5, 6




Last Update : 2012/05/16

Copyright © Potix Corporation. This article is licensed under GNU Free Documentation License.