Overblog
Editer l'article Suivre ce blog Administration + Créer mon blog
23 février 2007 5 23 /02 /février /2007 14:15

 Purpose

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.


Swing JTree

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, p
ress the Ctrl keybord key if you want to keep the original object (COPY).




The implementation class of the Bean Item

     pack1.SWTree

The bean has to be initialized at startup of the form:

When-New-Form-Instance trigger:

fbean.register_Bean('BLOCK.BEAN',1,'pack1.SWTree');

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:

FBean.Invoke(
              'BLOCK.BEAN',
              1,
              'RunAddNode',
              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

Partager cet article
Repost0

commentaires

I
Hello.I have worked out how to use the sun java plugin to run this example.Thanks so much for your tips.But I still have the following question.why we can not use the JInitiator to run this example? thanks.
Répondre
O
Probably because the Bean uses some 1.4 Java instructions while JInitiator is restricted to the 1.3 instruction set.
W
>This bean won't work with the JInitiator.why we can not use the JInitiator to run this example?thanks.
Répondre
S
>You probably missed a step in the installation. First of all, make sure you have installed the Sun Java plugin. This bean won't work with the JInitiator. Be sure you have copied the .JAR file in your /forms/java directory and add it to the archive and archive_jini tags of your /forms/server/formsweb.cfg file. Thanks for your reply. but I dont really understand the useage of the Sun Java Plugin here, How Can I install and configure it to make sure the example run smoothly.Thanks.
Répondre
I
Hello, I downloaded your Zip file, and run it on Form Builder.But I found the Drag & Drop Function did not work at all.
Répondre
O
You probably missed a step in the installation. First of all, make sure you have installed the Sun Java plugin. This bean won't work with the JInitiator. Be sure you have copied the .JAR file in your /forms/java directory and add it to the archive and archive_jini tags of your /forms/server/formsweb.cfg file.
O
Hi, i see that you are integrating a SWING component into the forms application. What about thread safety ? It looks to me, that Oracle EWT framework is doing graphical updates in different threads.  Cant this freeze your forms ?
Répondre