Friday, February 7, 2014

Help to create Lightweight widgets

Hi,
I know there is a lot of doc in the web, but I cannot understand well many things...please feel free to help me:

#1 Does addClickListener() and addClickHandler() does the exact same thing (listener is just deprecated) ?

#2 I have created the following widget:

public class AreaPlaceHolder__TA_heavy extends TextArea
{...
addFocusHandler(new FocusHandler() ...
addBlurHandler(new BlurHandler() ...
...}

BecauseI just have a onBlur and onFocus events to intercept, so I would like to optimise this widget such as :

public class AreaPlaceHolder__TA_light extends AreaElement implements BlurHandler, FocusHandler
{...
public void onFocus(FocusEvent event)...
public void onBlur(BlurEvent event)...
}...

- Is it the good/best way to have a lighter version of  AreaPlaceHolder__TA_heavy  (and to always be able to use it in UI Binder)?

#3 When I create my own widget, I do not know 
 - when to extend Widget ?
 - when to extend Composite ?
 - when I am free to extend neither of them ? (I do not know if I need to at least extend one of them)

#4 Finally, I really would like to use event Bubbling, there is a lot of 'little' code on the net, but nothing satisfy me...I mean, I would like to write a little class where a HTMLPanel has 3 differents ButtonElement and the HTMLPanel intercepts :
 - a clickEvent on button1 and say "hello 1" 
 - a clickEvent on button2 and say "hello 2" 
 - a clickEvent on button3 and say "hello 3"

I just see complicated all theses DOM manipulation, sink event so if you can give me the little example I need, I think I will be able to replace a lot of widgets by there Elements and reduce a lot my code (useful for the mobile version).

Thanks you a lot,
Axel


 





--
You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-web-toolkit+unsubscribe@googlegroups.com.
To post to this group, send email to google-web-toolkit@googlegroups.com.
Visit this group at http://groups.google.com/group/google-web-toolkit.
For more options, visit https://groups.google.com/groups/opt_out.

No comments:

Post a Comment