Skip to main content

alphaWorks  >  Forums  >  IBM Reflexive User Interface Builder  >  developerWorks

Binding with real data?    Point your RSS reader here for a feed of the latest messages in this thread


     

 
 

My developerWorks
 Welcome, Guest
Sign in or register
Permlink Replies: 1 - Pages: 1 - Last Post: May 24, 2005 6:34 PM Last Post By: Threads: [ Previous | Next ]

Posts: 2
Registered: Apr 01, 2005 09:44:32 AM
Binding with real data?
Posted: Apr 02, 2005 05:43:16 PM
Click to report abuse...   Click to reply to this thread Reply
After reading the good! tutorial, I still have at least one question I hope someone can clear out for me.

How to bind a component in the GUI to a 'component' in my java program?

The way I expect to be using RIB, is to define the GUI and probably some datatype field validation in the rib-XML.

But handling of events, storing and getting values from TextFields I'd like to handle in my javaprogram. Thus I miss someway to connect a field described in the gui to a field within my application.

What I would imagine is that the GuiBuilder should ask my program for the initial value when initializing a field, and notificating me whenever changes / events happens in the field.

It this possible... how?

Posts: 6
Registered: Sep 22, 2004 06:05:35 PM
Re: Binding with real data?
Posted: May 24, 2005 06:34:05 PM   in response to: in response to: 's post
Click to report abuse...   Click to reply to this thread Reply
RIB supports your needs to a limited extent by two methods (assuming you have given the component(s) you want to work with a [b]rgb:id[/b] value): 1) you can obtain the component from the RgbEngine using the [b]getGuiComponent(String id)[/b] method. Once you have the component, you can add your own listeners to it as you normally would. 2) Use the [b]rgb:listener[/b] attribute on any tag of the form add[i]XXX[/i]Listener to specify the class name of a class to handle the event.

From the RIB user's guide:

[i]There is also one other way to add event handlers in RIB. Elements with names of the form addXXXListener can take a rib:listener attribute. The value of this attribute is a fully-qualified class name of the object to serve as the event handler. When this option is used, the text content of the element is ignored. The class to be instantiated must have only a constructor with a com.ibm.wac.rgb.engine.SymbolTable parameter. This is to allow access to the components defined in the script. For example, a line in the actionPerformed method of an object to serve as an event handler for the clearButton might read:

((JTextField) symbolTable.get("nameField")).setText("" );

in order to clear the nameField of the GUI constructed in the script of Example 2.[/i]

Point your RSS reader here for a feed of the latest messages in all forums