In that case make your custom events...

You need to create 1 class and 2 interfaces... YourEvent.class (class),
YourHandler(interface) and HasYourHandler(interface)

See and copy any shared event as SelectionEvent, SelectionHandler &
HasSelectionHandler. (see the code of this ones and copy them)

In your panel instead of delegating the event to the button do this:
return addHandler(handler, YourEvent.getType());

And then you should trigger the events:
searchButton.addClickHandler(new ClickHandler() {
void onClick() {
YourPanel.this.fireEvent(new YourEvent(someParameters));
}
});

Its hard to explain this in two words... you should google for "gwt events
system" or look in the google code page of gwt, I think there is a document
that explain this

2010/7/13 Vik <vik....@gmail.com>

> hie
>
> Thanks but i have following doubt:
>
> Since i need two different handlers for two search panels then where will
> be the deciding logic ?
> and how exactly i will call this addClickHandler method?
>
>
> 1. How will i call it
>
> Thankx and Regards
>
> Vik
> Founder
> www.sakshum.com
> www.sakshum.blogspot.com
>
>
> On Mon, Jul 12, 2010 at 10:28 PM, Gal Dolber <gal.dol...@gmail.com> wrote:
>
>> class YourSearchPanel extends Composite *implements HasClickHandlers {*
>> *
>> *
>> *...*
>> *public HandlerRegistration addClickHandler(ClickHandler handler) {*
>> *yourSearchButton.addClickHandler(handler);*
>> *}*
>> *
>> *
>> *}*
>> *
>> *
>> *And move the rpc logic out of your widget
>> *
>> 2010/7/12 Vik <vik....@gmail.com>
>>
>>>  Hie
>>>
>>> I have a UI which shows a search panel having 3 list boxes to select from
>>> and a search button.
>>>
>>> I have two different pages where this UI has to be exactly same except
>>> the search button needs to call  different rpc services.
>>>
>>> How should I write the code once and resue it both the places? Please
>>> advise...
>>>
>>> Thankx and Regards
>>>
>>> Vik
>>> Founder
>>> www.sakshum.com
>>> www.sakshum.blogspot.com
>>>
>>> --
>>> You received this message because you are subscribed to the Google Groups
>>> "Google Web Toolkit" group.
>>> To post to this group, send email to google-web-toolkit@googlegroups.com
>>> .
>>> To unsubscribe from this group, send email to
>>> google-web-toolkit+unsubscr...@googlegroups.com<google-web-toolkit%2bunsubscr...@googlegroups.com>
>>> .
>>> For more options, visit this group at
>>> http://groups.google.com/group/google-web-toolkit?hl=en.
>>>
>>
>>
>>
>> --
>> http://gwtupdates.blogspot.com/
>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "Google Web Toolkit" group.
>> To post to this group, send email to google-web-tool...@googlegroups.com.
>> To unsubscribe from this group, send email to
>> google-web-toolkit+unsubscr...@googlegroups.com<google-web-toolkit%2bunsubscr...@googlegroups.com>
>> .
>> For more options, visit this group at
>> http://groups.google.com/group/google-web-toolkit?hl=en.
>>
>
>  --
> You received this message because you are subscribed to the Google Groups
> "Google Web Toolkit" group.
> To post to this group, send email to google-web-tool...@googlegroups.com.
> To unsubscribe from this group, send email to
> google-web-toolkit+unsubscr...@googlegroups.com<google-web-toolkit%2bunsubscr...@googlegroups.com>
> .
> For more options, visit this group at
> http://groups.google.com/group/google-web-toolkit?hl=en.
>



-- 
http://gwtupdates.blogspot.com/

-- 
You received this message because you are subscribed to the Google Groups 
"Google Web Toolkit" group.
To post to this group, send email to google-web-tool...@googlegroups.com.
To unsubscribe from this group, send email to 
google-web-toolkit+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/google-web-toolkit?hl=en.

Reply via email to