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();
}
});
}
}
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();
}
});
}
}
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;
}
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);
}
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;
}
Aggregations