Hi satya,
I create one listener that I use on all my focus widgets. To use it
just
ForceOnFocusStyle.add(anyFocusWidet);
Regards,
Freller
import com.google.gwt.user.client.ui.FocusListener;
import com.google.gwt.user.client.ui.FocusWidget;
import com.google.gwt.user.client.ui.Widget;
public class ForceOnFocusStyle implements FocusListener {
public static final String FOCUS_STYLE_NAME = "focus";
protected ForceOnFocusStyle() {
} // end of
ForceOnFocusStyle
protected static ForceOnFocusStyle __instance = new
ForceOnFocusStyle();
public static void add(FocusWidget victim) {
try {
victim.addFocusListener( ForceOnFocusStyle.__instance);
} catch (ClassCastException exc) {
}
} // end of
add
public static void remove(FocusWidget victim) {
try {
victim.removeFocusListener( ForceOnFocusStyle.__instance);
} catch (ClassCastException exc) {
}
} // end of
remove
// Interface FocusListener
--------------------------------------------------------------------------------------------------
public void onFocus(Widget sender) {
sender.addStyleName( FOCUS_STYLE_NAME);
}
public void onLostFocus(Widget sender) {
sender.removeStyleName( FOCUS_STYLE_NAME);
}
} // end of class
ForceOnFocusStyle
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Google Web Toolkit" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/Google-Web-Toolkit?hl=en
-~----------~----~----~----~------~----~------~--~---