Example usage for com.google.gwt.user.client.ui Anchor setFocus

List of usage examples for com.google.gwt.user.client.ui Anchor setFocus

Introduction

In this page you can find the example usage for com.google.gwt.user.client.ui Anchor setFocus.

Prototype

@Override
    public void setFocus(boolean focused) 

Source Link

Usage

From source file:com.googlecode.mgwt.ui.client.MGWT.java

License:Apache License

/**
 * A utility method to hide the soft keyboard
 *//*from w  w w  . j  ava  2s .co m*/
public static void hideKeyBoard() {
    final Anchor anchor = new Anchor(" ");

    anchor.getElement().getStyle().setWidth(1, Unit.PX);
    anchor.getElement().getStyle().setHeight(1, Unit.PX);
    anchor.getElement().getStyle().setDisplay(Display.INLINE);
    anchor.getElement().getStyle().setFloat(Float.LEFT);

    RootPanel.get().add(anchor);
    anchor.setFocus(true);

    Scheduler.get().scheduleDeferred(new ScheduledCommand() {

        @Override
        public void execute() {
            anchor.removeFromParent();

        }
    });
}

From source file:de.swm.commons.mobile.client.utils.Utils.java

License:Apache License

/**
 * A utility method to hide the soft keyboard
 *///from   ww w.  j  ava2  s  .  c  o m
public static void hideKeyBoard() {
    final Anchor anchor = new Anchor(" ");

    anchor.getElement().getStyle().setWidth(1, Style.Unit.PX);
    anchor.getElement().getStyle().setHeight(1, Style.Unit.PX);
    anchor.getElement().getStyle().setDisplay(Style.Display.INLINE);
    anchor.getElement().getStyle().setFloat(Style.Float.LEFT);

    RootPanel.get().add(anchor);
    anchor.setFocus(true);

    Scheduler.get().scheduleDeferred(new Scheduler.ScheduledCommand() {

        @Override
        public void execute() {
            anchor.removeFromParent();

        }
    });

}