Search in sources :

Example 91 with ScheduledCommand

use of com.google.gwt.core.client.Scheduler.ScheduledCommand in project rstudio by rstudio.

the class TerminalSession method setVisible.

@Override
public void setVisible(boolean isVisible) {
    super.setVisible(isVisible);
    if (isVisible) {
        connect();
        // Inform the terminal that there may have been a resize. This could 
        // happen on first display, or if the terminal was hidden behind other
        // terminal sessions and there was a resize.
        // A delay is needed to give the xterm.js implementation an
        // opportunity to be ready for this.
        Scheduler.get().scheduleDeferred(new ScheduledCommand() {

            @Override
            public void execute() {
                onResize();
            }
        });
    }
}
Also used : ScheduledCommand(com.google.gwt.core.client.Scheduler.ScheduledCommand)

Example 92 with ScheduledCommand

use of com.google.gwt.core.client.Scheduler.ScheduledCommand in project rstudio by rstudio.

the class XTermWidget method onUnload.

@Override
protected void onUnload() {
    super.onUnload();
    if (initialized_) {
        initialized_ = false;
        Scheduler.get().scheduleDeferred(new ScheduledCommand() {

            public void execute() {
                terminal_.blur();
            }
        });
    }
}
Also used : ScheduledCommand(com.google.gwt.core.client.Scheduler.ScheduledCommand)

Example 93 with ScheduledCommand

use of com.google.gwt.core.client.Scheduler.ScheduledCommand in project rstudio by rstudio.

the class DocUpdateSentinel method doSave.

private boolean doSave(String path, String fileType, String encoding, ProgressIndicator progress) {
    boolean didSave = false;
    try {
        didSave = doSaveImpl(path, fileType, encoding, progress);
    } catch (Exception ex) {
        // log the exception that caused the problem (not all progress
        // indicators, even if present, will report it)
        Debug.log("Exception occurred during save: ");
        Debug.logException(ex);
        // report error to progress indicator if present
        if (progress != null) {
            progress.onError("Could not save " + path + ": " + ex.getMessage());
        }
    }
    // Update marks after document save
    Scheduler.get().scheduleDeferred(new ScheduledCommand() {

        @Override
        public void execute() {
            if (docDisplay_.isVimModeOn()) {
                String oldMarksSpec = "";
                if (hasProperty("marks"))
                    oldMarksSpec = getProperty("marks");
                String newMarksSpec = VimMarks.encode(docDisplay_.getMarks());
                if (!oldMarksSpec.equals(newMarksSpec))
                    setProperty("marks", newMarksSpec);
            }
        }
    });
    return didSave;
}
Also used : ScheduledCommand(com.google.gwt.core.client.Scheduler.ScheduledCommand)

Example 94 with ScheduledCommand

use of com.google.gwt.core.client.Scheduler.ScheduledCommand in project perun by CESNET.

the class MainMenu method prepare.

/**
	 * This MUST be called when GUI is loading
	 */
public void prepare() {
    // Clears previous
    this.sectionsMap.clear();
    this.sectionsIds.clear();
    this.menuStackPanel.clear();
    // Stack panel settings
    menuStackPanel.setWidth(MENU_WIDTH + "px");
    menuStackPanel.addStyleName("menuStackPanel");
    LargeIcons iconsLarge = LargeIcons.INSTANCE;
    int i = 0;
    // SECTION PERUN ADMIN
    if (session.isPerunAdmin()) {
        MainMenuSection perunAdmin = new MainMenuSection("Perun admin", new VosTabItem(), iconsLarge.perunIcon(), PERUN_ADMIN);
        this.sectionsMap.put(PERUN_ADMIN, perunAdmin);
        this.sectionsIds.put(PERUN_ADMIN, i);
        Scheduler.get().scheduleDeferred(new ScheduledCommand() {

            public void execute() {
                buildPerunAdminMenu();
            }
        });
        i++;
        menuStackPanel.add(perunAdmin.getWidget(), perunAdmin.getHeader(), true);
    }
    // SECTION PERUN ADMIN
    if (session.isSecurityAdmin()) {
        MainMenuSection secAdmin = new MainMenuSection("Security admin", new SecurityTeamSelectTabItem(), iconsLarge.userPoliceEnglandIcon(), PERUN_ADMIN);
        this.sectionsMap.put(SECURITY_ADMIN, secAdmin);
        this.sectionsIds.put(SECURITY_ADMIN, i);
        Scheduler.get().scheduleDeferred(new ScheduledCommand() {

            public void execute() {
                buildSecurityAdminMenu();
            }
        });
        i++;
        menuStackPanel.add(secAdmin.getWidget(), secAdmin.getHeader(), true);
    }
    // SECTION VO ADMIN
    if (session.isVoAdmin() || session.isVoObserver() || session.isPerunAdmin()) {
        MainMenuSection voAdmin = new MainMenuSection("VO manager", new VosSelectTabItem(), iconsLarge.buildingIcon(), VO_ADMIN);
        this.sectionsMap.put(VO_ADMIN, voAdmin);
        this.sectionsIds.put(VO_ADMIN, i);
        Scheduler.get().scheduleDeferred(new ScheduledCommand() {

            public void execute() {
                buildVoAdminMenu();
            }
        });
        i++;
        menuStackPanel.add(voAdmin.getWidget(), voAdmin.getHeader(), true);
    }
    // SECTION GROUP ADMIN
    if (session.isGroupAdmin() || session.isVoAdmin() || session.isPerunAdmin()) {
        MainMenuSection groupAdmin = new MainMenuSection("Group manager", new GroupsTabItem(null), iconsLarge.groupIcon(), GROUP_ADMIN);
        this.sectionsMap.put(GROUP_ADMIN, groupAdmin);
        this.sectionsIds.put(GROUP_ADMIN, i);
        Scheduler.get().scheduleDeferred(new ScheduledCommand() {

            public void execute() {
                buildGroupAdminMenu();
            }
        });
        i++;
        menuStackPanel.add(groupAdmin.getWidget(), groupAdmin.getHeader(), true);
    }
    // SECTION FACILITY ADMIN
    if (session.isFacilityAdmin() || session.isPerunAdmin()) {
        MainMenuSection facilityAdmin = new MainMenuSection("Facility manager", new FacilitiesSelectTabItem(), iconsLarge.databaseServerIcon(), FACILITY_ADMIN);
        this.sectionsMap.put(FACILITY_ADMIN, facilityAdmin);
        this.sectionsIds.put(FACILITY_ADMIN, i);
        Scheduler.get().scheduleDeferred(new ScheduledCommand() {

            public void execute() {
                buildFacilityAdminMenu();
            }
        });
        i++;
        menuStackPanel.add(facilityAdmin.getWidget(), facilityAdmin.getHeader(), true);
    }
    // SECTION USER - ALWAYS
    MainMenuSection user = new MainMenuSection("User", null, iconsLarge.userGrayIcon(), USER);
    this.sectionsMap.put(USER, user);
    this.sectionsIds.put(USER, i);
    Scheduler.get().scheduleDeferred(new ScheduledCommand() {

        public void execute() {
            buildUserMenu();
        }
    });
    i++;
    menuStackPanel.add(user.getWidget(), user.getHeader(), true);
}
Also used : ScheduledCommand(com.google.gwt.core.client.Scheduler.ScheduledCommand) SecurityTeamSelectTabItem(cz.metacentrum.perun.webgui.tabs.securitytabs.SecurityTeamSelectTabItem) LargeIcons(cz.metacentrum.perun.webgui.client.resources.LargeIcons)

Example 95 with ScheduledCommand

use of com.google.gwt.core.client.Scheduler.ScheduledCommand in project opennms by OpenNMS.

the class SearchStateManager method handleAutocompleteEvent.

public boolean handleAutocompleteEvent(final NativeEvent event) {
    final String eventType = event.getType();
    final int eventKeyCode = event.getKeyCode();
    LOG.info("handleAutocompleteEvent(" + m_state + "): received " + eventType + " (keyCode = " + eventKeyCode + ")");
    if ("keydown".equals(eventType)) {
        switch(eventKeyCode) {
            case KeyCodes.KEY_ESCAPE:
                Scheduler.get().scheduleDeferred(new ScheduledCommand() {

                    @Override
                    public void execute() {
                        m_state = m_state.cancelSearching(SearchStateManager.this);
                    }
                });
                event.stopPropagation();
                break;
            case KeyCodes.KEY_ENTER:
                Scheduler.get().scheduleDeferred(new ScheduledCommand() {

                    @Override
                    public void execute() {
                        m_state = m_state.currentEntrySelected(SearchStateManager.this);
                    }
                });
                event.stopPropagation();
                break;
        }
    } else if ("click".equals(eventType) || "touchstart".equals(eventType)) {
        // someone clicked on an entry
        Scheduler.get().scheduleDeferred(new ScheduledCommand() {

            @Override
            public void execute() {
                m_state = m_state.currentEntrySelected(SearchStateManager.this);
            }
        });
        event.stopPropagation();
        return true;
    } else {
        LOG.info("handleAutocompleteEvent(" + m_state + "): unhandled event: " + eventType);
        return true;
    }
    return false;
}
Also used : ScheduledCommand(com.google.gwt.core.client.Scheduler.ScheduledCommand)

Aggregations

ScheduledCommand (com.google.gwt.core.client.Scheduler.ScheduledCommand)104 Position (org.rstudio.studio.client.workbench.views.source.editors.text.ace.Position)7 Element (com.google.gwt.dom.client.Element)6 Range (org.rstudio.studio.client.workbench.views.source.editors.text.ace.Range)6 JsArray (com.google.gwt.core.client.JsArray)5 Command (com.google.gwt.user.client.Command)5 ServerError (org.rstudio.studio.client.server.ServerError)5 JsArrayString (com.google.gwt.core.client.JsArrayString)4 ArrayList (java.util.ArrayList)4 Test (org.junit.Test)4 FileSystemItem (org.rstudio.core.client.files.FileSystemItem)4 RepeatingCommand (com.google.gwt.core.client.Scheduler.RepeatingCommand)3 ClickEvent (com.google.gwt.event.dom.client.ClickEvent)3 Event (com.google.gwt.user.client.Event)3 NativePreviewHandler (com.google.gwt.user.client.Event.NativePreviewHandler)3 Timer (com.google.gwt.user.client.Timer)3 WindowEx (org.rstudio.core.client.dom.WindowEx)3 SourcePosition (org.rstudio.studio.client.workbench.views.source.model.SourcePosition)3 ErrorDialog (com.google.gerrit.client.ErrorDialog)2 OnEditEnabler (com.google.gerrit.client.ui.OnEditEnabler)2