Example usage for com.google.gwt.user.client Timer Timer

List of usage examples for com.google.gwt.user.client Timer Timer

Introduction

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

Prototype

Timer

Source Link

Usage

From source file:com.codenvy.ide.ext.java.client.newsourcefile.NewJavaSourceFileViewImpl.java

License:Open Source License

@Override
public void showDialog() {
    nameField.setText("");
    hideErrorHint();/*  w  w w.ja  va 2 s. c o  m*/
    show();
    btnOk.setEnabled(false);
    new Timer() {
        @Override
        public void run() {
            nameField.setFocus(true);
        }
    }.schedule(300);
}

From source file:com.codenvy.plugin.contribution.client.dialogs.commit.CommitViewImpl.java

License:Open Source License

@Override
public void show(@Nonnull String commitDescription) {
    this.commitDescription.setText(commitDescription);
    new Timer() {
        @Override//from ww  w  .  j  a  v  a  2s.com
        public void run() {
            CommitViewImpl.this.commitDescription.setFocus(true);
        }
    }.schedule(300);
    super.show();
}

From source file:com.codenvy.plugin.contribution.client.steps.WaitForkOnRemoteStep.java

License:Open Source License

@Override
public void execute(@Nonnull final ContributorWorkflow workflow) {
    if (timer == null) {
        timer = new Timer() {
            @Override/*from www .  j  a  v  a2  s.c o m*/
            public void run() {
                checkRepository(workflow.getContext(), new AsyncCallback<Void>() {
                    @Override
                    public void onFailure(final Throwable caught) {
                        timer.schedule(POLL_FREQUENCY_MS);
                    }

                    @Override
                    public void onSuccess(final Void result) {
                        workflow.setStep(nextStep);
                        workflow.executeStep();
                    }
                });
            }
        };
    }

    timer.schedule(POLL_FREQUENCY_MS);
}

From source file:com.codenvy.redhat.plugin.quick.start.ide.action.OpenFileAction.java

License:Open Source License

private void scrollToLine(EditorPartPresenter editor, @Nullable String lineParam) {
    if (Strings.isNullOrEmpty(lineParam)) {
        return;//from w w  w.j  a  v a2  s  .c  o m
    }

    if (!(editor instanceof TextEditor)) {
        return;
    }
    new Timer() {
        @Override
        public void run() {
            try {
                int lineNumber = parseInt(lineParam);
                TextEditor textEditor = (TextEditor) editor;
                textEditor.getDocument().setCursorPosition(new TextPosition(lineNumber - 1, 0));
            } catch (NumberFormatException e) {
                Log.error(getClass(), localization.fileToOpenLineIsNotANumber());
            }
        }
    }.schedule(300);
}

From source file:com.cognitivemedicine.metricsdashboard.client.widgets.Alerts.java

License:Apache License

public static void notify(Panel parent, String title, String message) {
    final DialogBox d = new DialogBox();
    d.setText(title);// w w  w . ja  v a 2  s. c o  m
    d.setModal(false);
    // d.center();
    Button closeButton = new Button("Close", new ClickHandler() {
        public void onClick(ClickEvent event) {
            d.hide();
        }
    });
    // d.add(closeButton);
    d.addCloseHandler(new CloseHandler<PopupPanel>() {
        @Override
        public void onClose(CloseEvent<PopupPanel> event) {
            d.hide();
        }
    });

    VerticalPanel v = new VerticalPanel();
    // v.add(new Label(message));

    HTML html = new HTML();
    html.setHTML(message);
    html.addClickHandler(new ClickHandler() {
        @Override
        public void onClick(ClickEvent event) {
            d.hide();
        }
    });

    v.add(html);
    v.add(closeButton);
    d.setWidget(v);
    // d.setPopupPosition(Window.getClientWidth()-d.getOffsetWidth(),
    // Window.getClientHeight()-d.getOffsetWidth());

    Timer t = new Timer() {
        @Override
        public void run() {
            d.hide();
        }
    };
    t.schedule(3000);

    d.setWidth("300px");
    d.setHeight("200px");
    d.center();
    // d.setPopupPosition(Window.getClientWidth()-d.getOffsetWidth(),
    // Window.getClientHeight()-d.getOffsetWidth());
    // d.show();
}

From source file:com.cubusmail.client.util.MessageListTimer.java

License:Open Source License

private MessageListTimer() {

    this.timer = new Timer() {

        public void run() {

            EventBroker.get().fireMessagesReload();
        }//from w w w  .j a  v a  2 s  .  co m
    };

}

From source file:com.databasepreservation.visualization.client.common.lists.AsyncTableCell.java

public void autoUpdate(int periodMillis) {
    if (autoUpdateTimer != null) {
        autoUpdateTimer.cancel();//w  ww .  j ava 2s  . co m
    }

    autoUpdateTimer = new Timer() {

        @Override
        public void run() {
            dataProvider.update(new AsyncCallback<Void>() {

                @Override
                public void onFailure(Throwable caught) {
                    // disable auto-update
                    autoUpdateTimer.cancel();
                }

                @Override
                public void onSuccess(Void result) {
                    // do nothing
                }
            });
        }
    };

    autoUpdateTimerMillis = periodMillis;
    if (this.isAttached()) {
        autoUpdateTimer.scheduleRepeating(periodMillis);
    }

}

From source file:com.databasepreservation.visualization.shared.client.widgets.Toast.java

/**
 * Create a new message popup/*from  w  w w .jav a 2s  . co m*/
 * 
 * @param type
 * @param title
 * @param message
 */
public Toast(MessagePopupType type, String title, String message) {
    super(false);
    this.type = type;
    slotNumber = getNextSlot(this);
    layout = new FlowPanel();
    focus = new AccessibleFocusPanel(layout);
    titleLabel = new Label(title);
    messageLabel = new Label(message);

    if (type.equals(MessagePopupType.ERROR_MESSAGE)) {
        layout.addStyleName("toast-error");
    } else if (type.equals(MessagePopupType.INFO)) {
        layout.addStyleName("toast-info");
    }

    layout.add(titleLabel);
    layout.add(messageLabel);

    setWidget(focus);

    focus.addClickHandler(new ClickHandler() {

        @Override
        public void onClick(ClickEvent event) {
            hide();
        }
    });

    hideTimer = new Timer() {
        public void run() {
            hide();
        }
    };

    layout.addStyleName("wui-toast");
    titleLabel.addStyleName("toast-title");
    messageLabel.addStyleName("toast-message");
}

From source file:com.dawg6.web.dhcalc.client.Service.java

License:Open Source License

private Service() {
    newsTimer = new Timer() {

        @Override//from  w  w w  .j a va  2  s. c o  m
        public void run() {
            checkNews(null);
        }
    };

    checkNews(null);
    newsTimer.scheduleRepeating(30000);
}

From source file:com.dc.tes.ui.client.control.LogInfoPopPanel.java

License:Open Source License

private void afterShow() {
    Timer t = new Timer() {
        public void run() {
            afterHide();/*from www  . java2  s .co  m*/
        }
    };
    t.schedule(config.display);
}