Win a copy of Kotlin in Action this week in the Kotlin forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

jgoodies binding  RSS feed

 
Dirk Ulrich
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I intend to display a JComboBox in the GUI which is fed with instances of JavaBeans called QueryBean which simply has a name and a queryString property and extends com.jgoodies.binding.beans.Model.
There shall be only the query name be visible in the combobox and whenever the user selects an item from the combobox the appropriate queryString shall be displayed in the also displayed JTextArea. (If you have sample code how to use a JEditorPane I would appreciate to get the code. )

How can I achieve this using jgoodies? I don't find appropriate examples in the WWW.

Thank you.
 
Alan Mehio
Ranch Hand
Posts: 73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
Just asking ; What make you use com.jgoodies.binding.beans.Model? are you planing to bind your GUI to a back end bean? If not so why not using DefaultComboBoxModel directly as your modle for the JComboBox. your constructor will be DefaultComboBoxModel ( new Vector<YourJavaBean>());

your javaBean toString implementation of the JavaBean will show the name and not the query. Please read the tutorial first and try to do something first and if you get into the trobule; just highlight the problem in a short executed runnable code

Please read this first

How to Use ComboBox


Regards,
Alan Mehio
London
 
Dirk Ulrich
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yes, I want / need to bind the GUI model to a domain model (QueryBean) using the jgoodies framework (com.jgoodies.bind package).
 
Alan Mehio
Ranch Hand
Posts: 73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Dirk,
Dirk xxxx wrote:Yes, I want / need to bind the GUI model to a domain model (QueryBean) using the jgoodies framework (com.jgoodies.bind package).


Thanks for your reply actually I have not used the jdoodies binding mechnism; but as described from you problem; this has nothing to do with Binding since the item is selected and you want to display the selection or actually append it into the JTextArea? so what this has to do with binding. Then take a look at this FORM BINDING BEAN there is a reference implementation; it may help.


Do you want me to post a sample code of your problem description ? please let me know


 
Dirk Ulrich
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Well, I don't have a written description of the problem to solve.
I just have to implement a GUI using jGoodies which should communicate with a server using HTTP via Spring remoting.
Some GUI components will be initialized with content from the server side (or better from a database) like a JComboBox which shall display the name of user-defined SQL queries. Whenever such a name in the JComboBox is selected the assigned SQL query string shall be displayed within the JTextArea component.
Furthermore a delete button must be shown to enable the user to delete such a named query. From this point of view I thought there is a binding needed to synchronize the domain model (and the database) with the presentation model.

The GUI will be expanded by a scheduling area where the user can define an interval in which the SQL query shall be executed automatically after the definition has been scheduled (send to the server). Furthermore an export area exist where the user can define an export target for the result of the automatically executed SQL Query (job).

So I thought of a QueryBean, a JobBean and an ExporterBean which must be bound anyhow.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!