Here is a Java bean that allows the Drag 'n Drop within a Swing JTree item.
This bean is proposed by Minas Lyrakis from Greece.
This bean uses itself the DispatchingBean of Tom Cleymans. (so it needs the sun Java plugin 1.4 at least)
You can Drag 'n Drop nodes within the same tree but also from one tree to another as well.
When dragging a node, press the Ctrl keybord key if you want to keep the original object (COPY).
The implementation class of the Bean Item
The bean has to be initialized at startup of the form:
The public methods
Initialize the JTree
FBean.Invoke('BLOCK.BEAN', 1, 'InitAddNode', '1,1,Node1');
Associate a bean with its forms item
FBean.invoke('BLOCK.BEAN', 1, 'setFormItemName', 'TEST.SWTREE1');
When you put more than one Swing JTree bean area, this command allows to etablish the correspondance between each Java bean and its forms item.
Add a node at runtime:
to_char(gv.NodeNumber) || ', Node' | |to_char(gv.NodeNumber) );
Remove the current node at runtime:
FBean.Invoke('BLOCK.BEAN', 1, 'RunRemoveNode', '' );
The sample dialog
. Download the SWTree.zip file
. Unzip the file
. run the SWTree.sql SQL script file to create the required database objects
. copy the SWTree1.jar file in the <ORACLE_HOME>/forms/java directory
. Edit your /forms/server/formsweb.cfg file to add this jar file
. Open the test_SWTree2.fmb module (Oracle Forms 9.0.2)
. Compile all and run the module
. This bean needs the Sun Java plugin 1.4 at least