Overblog
Suivre ce blog
Editer l'article 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

Published by Oracle Forms community - dans Bean - general
commenter cet article

commentaires

I have worked out how to use the sun java plugin to run the example 28/12/2007 09:48

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.

Oracle Forms community 28/12/2007 10:10

Probably because the Bean uses some 1.4 Java instructions while JInitiator is restricted to the 1.3 instruction set.

why we can not use the JInitiator to run this example? 28/12/2007 08:13

>This bean won't work with the JInitiator.why we can not use the JInitiator to run this example?thanks.

Sun java Plugin 28/12/2007 07:56

>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.

it does not work . 27/12/2007 09:25

Hello, I downloaded your Zip file, and run it on Form Builder.But I found the Drag & Drop Function did not work at all.

Oracle Forms community 27/12/2007 10:33

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.

Ondrej Pacay 21/06/2007 22:06

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 ?