DragAgent"
From Documentation
(Created page with "{{ZATSEssentialsPageHeader}} <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 an...") |
m (correct highlight (via JWB)) |
||
(6 intermediate revisions by 2 users not shown) | |||
Line 1: | Line 1: | ||
{{ZATSEssentialsPageHeader}} | {{ZATSEssentialsPageHeader}} | ||
+ | __TOC__ | ||
− | + | = Drag & Drop = | |
− | |||
− | The following code | + | <code> DragAgent </code> makes you mimic the dragging of a component and drop it onto another component. You have to query the component you want to drag first and convert it as <code> DragAgent </code> then call <code> dropOn(ComponentAgent) </code>. 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. | ||
+ | |||
+ | [[File:Zats-mimic-dragDrop.png]] | ||
+ | |||
+ | The following code represents how to drag a ''listitem'' from left ''listbox'' to right ''listbox''. | ||
<source lang="java"> | <source lang="java"> | ||
Line 16: | Line 22: | ||
</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 | ||
+ | | | ||
+ | |} | ||
+ | {{ZATSEssentialsPageHeader}} | ||
{{ZATSEssentialsPageFooter}} | {{ZATSEssentialsPageFooter}} |
Latest revision as of 02:55, 18 January 2022
Drag & Drop
DragAgent
makes you mimic the dragging of a component and drop it onto 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.
The following code represents 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
Sub-class of HtmlBasedComponent | 5, 6 |