Search in sources :

Example 76 with Timer

use of com.google.gwt.user.client.Timer in project che by eclipse.

the class Window method hide.

/**
     * Hides the {@link Window} popup. The popup will animate out of view.
     */
public void hide() {
    if (blocked) {
        return;
    }
    if (!isShowing) {
        return;
    }
    isShowing = false;
    // Animate the popup out of existence.
    view.setShowing(false);
    // Remove the popup when the animation completes.
    new Timer() {

        @Override
        public void run() {
            if (blocked) {
                return;
            }
            // The popup may have been shown before this timer executes.
            if (!isShowing) {
                view.removeFromParent();
                Style style = view.contentContainer.getElement().getStyle();
                style.clearPosition();
                style.clearLeft();
                style.clearTop();
            }
        }
    }.schedule(view.getAnimationDuration());
}
Also used : Timer(com.google.gwt.user.client.Timer) Style(com.google.gwt.dom.client.Style)

Example 77 with Timer

use of com.google.gwt.user.client.Timer in project che by eclipse.

the class PopupLoaderImpl method setSuccess.

@Override
public void setSuccess() {
    // Stop animation timer
    playTimer.cancel();
    // Start hide animation
    getElement().addClassName("outDown");
    // Remove from the parent
    new Timer() {

        @Override
        public void run() {
            removeFromParent();
        }
    }.schedule(1000);
}
Also used : Timer(com.google.gwt.user.client.Timer)

Example 78 with Timer

use of com.google.gwt.user.client.Timer in project che by eclipse.

the class NewJavaSourceFileViewImpl method showDialog.

@Override
public void showDialog() {
    nameField.setText("");
    hideErrorHint();
    show();
    btnOk.setEnabled(false);
    new Timer() {

        @Override
        public void run() {
            nameField.setFocus(true);
        }
    }.schedule(300);
}
Also used : Timer(com.google.gwt.user.client.Timer)

Example 79 with Timer

use of com.google.gwt.user.client.Timer in project che by eclipse.

the class MainPagePresenter method loadImporters.

private void loadImporters() {
    final Map<String, Set<ProjectImporterDescriptor>> importersByCategory = new LinkedHashMap<>();
    final Unmarshallable<ProjectImporterData> unmarshaller = dtoUnmarshallerFactory.newUnmarshaller(ProjectImporterData.class);
    AsyncRequestCallback<ProjectImporterData> callback = new AsyncRequestCallback<ProjectImporterData>(unmarshaller) {

        @Override
        protected void onSuccess(ProjectImporterData data) {
            List<ProjectImporterDescriptor> result = data.getImporters();
            String defaultImporterId = data.getConfiguration().get(DEFAULT_PROJECT_IMPORTER);
            Iterator<ProjectImporterDescriptor> itr = result.iterator();
            while (itr.hasNext()) {
                ProjectImporterDescriptor importer = itr.next();
                if (importer.getId().equals(defaultImporterId)) {
                    Set<ProjectImporterDescriptor> importersSet = new LinkedHashSet<>();
                    importersSet.add(importer);
                    importersByCategory.put(importer.getCategory(), importersSet);
                    itr.remove();
                }
            }
            ProjectImporterDescriptor defaultImporter = null;
            for (ProjectImporterDescriptor importer : result) {
                if (importer.isInternal() || importer.getCategory() == null || importWizardRegistry.getWizardRegistrar(importer.getId()) == null) {
                    continue;
                }
                if (importersByCategory.containsKey(importer.getCategory())) {
                    importersByCategory.get(importer.getCategory()).add(importer);
                } else {
                    Set<ProjectImporterDescriptor> importersSet = new LinkedHashSet<>();
                    importersSet.add(importer);
                    importersByCategory.put(importer.getCategory(), importersSet);
                }
                if (importer.getId().equals(defaultImporterId)) {
                    defaultImporter = importer;
                }
            }
            setImporters(defaultImporter);
        }

        private void setImporters(final ProjectImporterDescriptor defaultImporter) {
            new Timer() {

                @Override
                public void run() {
                    view.setImporters(importersByCategory);
                    view.selectImporter(defaultImporter != null ? defaultImporter : importersByCategory.get(importersByCategory.keySet().iterator().next()).iterator().next());
                }
            }.schedule(300);
        }

        @Override
        protected void onFailure(Throwable exception) {
            notificationManager.notify(locale.failedToImportProject(), FAIL, FLOAT_MODE);
        }
    };
    projectImportersService.getProjectImporters(appContext.getDevMachine(), callback);
}
Also used : LinkedHashSet(java.util.LinkedHashSet) LinkedHashSet(java.util.LinkedHashSet) Set(java.util.Set) AsyncRequestCallback(org.eclipse.che.ide.rest.AsyncRequestCallback) LinkedHashMap(java.util.LinkedHashMap) ProjectImporterDescriptor(org.eclipse.che.api.project.shared.dto.ProjectImporterDescriptor) ProjectImporterData(org.eclipse.che.api.project.shared.dto.ProjectImporterData) Timer(com.google.gwt.user.client.Timer)

Example 80 with Timer

use of com.google.gwt.user.client.Timer in project rstudio by rstudio.

the class ModalDialogBase method showModal.

public void showModal() {
    if (mainWidget_ == null) {
        mainWidget_ = createMainWidget();
        // get the main widget to line up with the right edge of the buttons.
        mainWidget_.getElement().getStyle().setMarginRight(2, Unit.PX);
        mainPanel_.insert(mainWidget_, 0);
    }
    originallyActiveElement_ = DomUtils.getActiveElement();
    if (originallyActiveElement_ != null)
        originallyActiveElement_.blur();
    // position the dialog
    positionAndShowDialog(new Command() {

        @Override
        public void execute() {
            // defer shown notification to allow all elements to render
            // before attempting to interact w/ them programatically (e.g. setFocus)
            Timer timer = new Timer() {

                public void run() {
                    onDialogShown();
                }
            };
            timer.schedule(100);
        }
    });
}
Also used : Timer(com.google.gwt.user.client.Timer) Command(com.google.gwt.user.client.Command)

Aggregations

Timer (com.google.gwt.user.client.Timer)133 Command (com.google.gwt.user.client.Command)7 Element (com.google.gwt.dom.client.Element)6 ScheduledCommand (com.google.gwt.core.client.Scheduler.ScheduledCommand)4 Style (com.google.gwt.dom.client.Style)4 Request (com.google.gwt.http.client.Request)4 RequestBuilder (com.google.gwt.http.client.RequestBuilder)4 RequestCallback (com.google.gwt.http.client.RequestCallback)4 RequestException (com.google.gwt.http.client.RequestException)4 Response (com.google.gwt.http.client.Response)4 JSONString (com.google.gwt.json.client.JSONString)4 Widget (com.google.gwt.user.client.ui.Widget)4 ArrayList (java.util.ArrayList)4 ServerError (org.rstudio.studio.client.server.ServerError)4 Label (com.google.gwt.user.client.ui.Label)3 VerticalPanel (com.google.gwt.user.client.ui.VerticalPanel)3 Date (java.util.Date)3 SessionInfo (org.rstudio.studio.client.workbench.model.SessionInfo)3 SliderEvent (com.extjs.gxt.ui.client.event.SliderEvent)2 Animation (com.google.gwt.animation.client.Animation)2