com.google.gwt.user.client.Command Java Examples
The following examples show how to use
com.google.gwt.user.client.Command.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: StudentStatusDialog.java From unitime with Apache License 2.0 | 6 votes |
public void massCancel(Command command) { iCommand = command; iForm.clear(); if (iSubject.getText().isEmpty() || iSubject.getText().equals(MESSAGES.defaulSubject()) || iSubject.getText().equals(SectioningStatusCookie.getInstance().getEmailSubject())) iSubject.setText(MESSAGES.defaulSubjectMassCancel()); iForm.addRow(MESSAGES.emailSubject(), iSubject); iForm.addRow(MESSAGES.emailCC(), iCC); iForm.addRow(MESSAGES.emailBody(), iMessage); iStatus.setSelectedIndex(0); for (int i = 0; i < iStatus.getItemCount(); i++) if ("Cancelled".equalsIgnoreCase(iStatus.getValue(i))) { iStatus.setSelectedIndex(i); break; } iStatusRow = iForm.addRow(MESSAGES.newStatus(), iStatus); iForm.addBottomRow(iButtons); iButtons.setEnabled("set-note", false); iButtons.setEnabled("send-email", false); iButtons.setEnabled("mass-cancel", true); iButtons.setEnabled("set-status", false); setText(MESSAGES.massCancel()); statusChanged(); center(); }
Example #2
Source File: ServerConfigPresenter.java From core with GNU Lesser General Public License v2.1 | 6 votes |
@Override public void prepareFromRequest(PlaceRequest request) { Command cmd = () -> { getProxy().manualReveal(ServerConfigPresenter.this); }; SecurityContextChangedEvent.AddressResolver resolver = new SecurityContextChangedEvent.AddressResolver<AddressTemplate>() { @Override public String resolve(AddressTemplate template) { String resolved = template.resolveAsKey(statementContext, serverStore.getSelectedServer().getServerName()); return resolved; } }; // RBAC: context change propagation SecurityContextChangedEvent.fire( ServerConfigPresenter.this, cmd, resolver ); }
Example #3
Source File: SuggestionsPage.java From unitime with Apache License 2.0 | 6 votes |
protected void computeSuggestion(final SelectedAssignmentsRequest request, final Command undo) { iCurrentAssignment.showLoading(); RPC.execute(request, new AsyncCallback<Suggestion>() { @Override public void onFailure(Throwable t) { if (undo != null) undo.execute(); iCurrentAssignment.setErrorMessage(MESSAGES.failedToComputeSelectedAssignment(t.getMessage())); UniTimeNotifications.error(MESSAGES.failedToComputeSelectedAssignment(t.getMessage()), t); } @Override public void onSuccess(Suggestion suggestion) { iCurrentAssignment.clearMessage(); iCurrentAssignment.setShowUnassign(!suggestion.hasDifferentAssignments()); iSelectedSuggestion.setValue(suggestion); if (iSuggestions != null) iSuggestions.setRequest(request); } }); }
Example #4
Source File: TopToolbar.java From appinventor-extensions with Apache License 2.0 | 6 votes |
@Override public void execute() { ProjectRootNode projectRootNode = Ode.getInstance().getCurrentYoungAndroidProjectRootNode(); if (projectRootNode != null) { String target = YoungAndroidProjectNode.YOUNG_ANDROID_TARGET_ANDROID; ChainableCommand cmd = new SaveAllEditorsCommand( new GenerateYailCommand( new BuildCommand(target, secondBuildserver, new ShowProgressBarCommand(target, new WaitForBuildResultCommand(target, new DownloadProjectOutputCommand(target)), "DownloadAction")))); if (!Ode.getInstance().getWarnBuild(secondBuildserver)) { cmd = new WarningDialogCommand(target, secondBuildserver, cmd); Ode.getInstance().setWarnBuild(secondBuildserver, true); } cmd.startExecuteChain(Tracking.PROJECT_ACTION_BUILD_DOWNLOAD_YA, projectRootNode, new Command() { @Override public void execute() { } }); } }
Example #5
Source File: ServerConfigPresenter.java From core with GNU Lesser General Public License v2.1 | 6 votes |
@Override protected void onReset() { super.onReset(); loadSocketBindings(new Command() { @Override public void execute() { if (serverStore.getSelectedServer() != null) { refreshView(); } getView().toggle( placeManager.getCurrentPlaceRequest().getParameter("action", "none") ); } }); }
Example #6
Source File: BaseWidgetMenuItemFactory.java From EasyML with Apache License 2.0 | 6 votes |
/** * Create DownloadDataItem * @param com * @return DownloadDataItem */ public static MenuItem createDownloadData(HasRightMouseUpMenu com) { Command command = new MenuItemCommand(com) { @Override public void execute() { DatasetWidget widget = (DatasetWidget) this.component; widget.getContextMenu().hide(); OutNodeShape shape = widget.getOutNodeShapes().get(0); String filename = shape.getAbsolutePath() + "/" + shape.getFileId(); String url = GWT.getModuleBaseURL().split("EMLStudio")[0] + "EMLStudioMonitor/filedownload?filename=" + filename; Window.open(url, "_blank", "status=0,toolbar=0,menubar=0,location=0"); } }; MenuItem item = new MenuItem("Download", command); return item; }
Example #7
Source File: SuggestionsPage.java From unitime with Apache License 2.0 | 6 votes |
protected void selectAssignment(SelectedAssignment selection, Command undo) { if (selection == null) return; SelectedAssignmentsRequest request = new SelectedAssignmentsRequest(selection.getClassId()); if (iSelectedAssignments != null) { for (Iterator<SelectedAssignment> i = iSelectedAssignments.iterator(); i.hasNext(); ) { SelectedAssignment a = i.next(); if (!a.getClassId().equals(request.getClassId())) request.addAssignment(a); else i.remove(); } iSelectedAssignments.add(selection); } else { iSelectedAssignments = new ArrayList<SelectedAssignment>(); iSelectedAssignments.add(selection); } request.addAssignment(selection); computeSuggestion(request, undo); }
Example #8
Source File: NewYoungAndroidProjectWizard.java From appinventor-extensions with Apache License 2.0 | 6 votes |
@Override public void show() { super.show(); // Wizard size (having it resize between page changes is quite annoying) int width = 340; int height = 40; this.center(); setPixelSize(width, height); super.setPagePanelHeight(85); DeferredCommand.addCommand(new Command() { public void execute() { projectNameTextBox.setFocus(true); projectNameTextBox.selectAll(); } }); }
Example #9
Source File: SockJSPushConnection.java From vertx-vaadin with MIT License | 6 votes |
@Override public void disconnect(Command command) { assert command != null; switch (state) { case CONNECTING: // Make the connection callback initiate the disconnection again state = State.CLOSING; pendingDisconnectCommand = command; break; case OPEN: // Normal disconnect getLogger().info("Closing push connection"); doDisconnect(socket); state = State.CLOSED; command.execute(); break; case CLOSING: case CLOSED: throw new IllegalStateException( "Can not disconnect more than once"); } }
Example #10
Source File: EditorManager.java From appinventor-extensions with Apache License 2.0 | 6 votes |
/** * Creates the editor manager. */ public EditorManager() { openProjectEditors = Maps.newHashMap(); dirtyProjectSettings = new HashSet<ProjectSettings>(); dirtyFileEditors = new HashSet<FileEditor>(); autoSaveTimer = new Timer() { @Override public void run() { // When the timer goes off, save all dirtyProjectSettings and // dirtyFileEditors. Ode.getInstance().lockScreens(true); // Lock out changes saveDirtyEditors(new Command() { @Override public void execute() { Ode.getInstance().lockScreens(false); // I/O finished, unlock } }); } }; }
Example #11
Source File: PerspectiveDragConfigModalView.java From dashbuilder with Apache License 2.0 | 6 votes |
@Override public void addItem(String name, Command onSelect) { AnchorElement anchor = Document.get().createAnchorElement(); anchor.setInnerText(name); LIElement li = Document.get().createLIElement(); li.getStyle().setCursor(Style.Cursor.POINTER); li.appendChild(anchor); selectorItems.appendChild((Node) li); Event.sinkEvents(anchor, Event.ONCLICK); Event.setEventListener(anchor, event -> { if(Event.ONCLICK == event.getTypeInt()) { onSelect.execute(); } }); }
Example #12
Source File: InputTemplateUrlWizard.java From appinventor-extensions with Apache License 2.0 | 6 votes |
@Override public void show() { super.show(); // Wizard size (having it resize between page changes is quite annoying) int width = 500; int height = 40; this.center(); setPixelSize(width, height); super.setPagePanelHeight(40); DeferredCommand.addCommand(new Command() { public void execute() { urlTextBox.setFocus(true); urlTextBox.selectAll(); } }); }
Example #13
Source File: GenerateYailCommand.java From appinventor-extensions with Apache License 2.0 | 6 votes |
@Override protected void execute(final ProjectNode node) { Ode.getInstance().getEditorManager().generateYailForBlocksEditors( new Command() { @Override public void execute() { executeNextCommand(node); } }, new Command() { @Override public void execute() { executionFailedOrCanceled(); } }); }
Example #14
Source File: ProgramUpdateMenu.java From EasyML with Apache License 2.0 | 6 votes |
public static MenuItem create(final ProgramLeaf node, final ProgramTree tree) { Command command = new MenuItemCommand(node) { @Override public void execute() { UpdateProgramPanel panel = new UpdateProgramPanel(tree,node); panel.show(node.getModule()); this.component.getContextMenu().hide(); } }; MenuItem item = new MenuItem("Update", command); return item; }
Example #15
Source File: SuggestionsPageContext.java From unitime with Apache License 2.0 | 6 votes |
protected void invert(final DateLocation date, boolean fireUpdate) { if (iSelectedDate != null) { iSelectedDate.removeStyleName("selected"); if (iSelectedDate.equals(date)) { iSelectedDate = null; return; } } iSelectedDate = date; if (iSelectedDate != null) iSelectedDate.addStyleName("selected"); if (fireUpdate) onSelection(new Command() { @Override public void execute() { invert(date, false); } }); }
Example #16
Source File: UserSettings.java From appinventor-extensions with Apache License 2.0 | 6 votes |
public void loadSettings(final Command next) { loading = true; Ode.getInstance().getUserInfoService().loadUserSettings( new OdeAsyncCallback<String>(MESSAGES.settingsLoadError()) { @Override public void onSuccess(String result) { OdeLog.log("Loaded global settings: " + result); decodeSettings(result); changed = false; loaded = true; loading = false; if (Ode.handleUserLocale() && next != null) { next.execute(); } } @Override public void onFailure(Throwable caught) { super.onFailure(caught); loading = false; } }); }
Example #17
Source File: DiagramController.java From EasyML with Apache License 2.0 | 6 votes |
/** * Show the context menu of the mouse position.(Position from mouse down event) * * @param event mouse down event. */ public void showContextualMenu(MouseDownEvent event){ final int X = event.getRelativeX(widgetPanel.getElement()); final int Y = event.getRelativeY(widgetPanel.getElement()); getMousePoint().setLeft(X); getMousePoint().setTop(Y); final int offsetX = event.getClientX(); final int offsetY = event.getClientY(); mouseOffsetPoint.setLeft(offsetX); mouseOffsetPoint.setTop(offsetY); cmenu.hide(); cmenu = new ContextMenu(); Command command = new Command() { @Override public void execute() { cmenu.hide(); } }; }
Example #18
Source File: VComboBoxMultiselect.java From vaadin-combobox-multiselect with Apache License 2.0 | 5 votes |
public MenuItem getMenuItem(Command command) { for (MenuItem menuItem : this.menu.getItems()) { if (command.equals(menuItem.getCommand())) { return menuItem; } } return null; }
Example #19
Source File: UniTimeConfirmationDialog.java From unitime with Apache License 2.0 | 5 votes |
public static void _confirm(String message, final JavaScriptObject callback, String question, String answer) { new UniTimeConfirmationDialog(callback == null ? Type.ALERT : Type.CONFIRM, message, question, answer, callback == null ? null : new Command() { @Override public void execute() { fireCallback(callback); } }).center(); }
Example #20
Source File: StudentSectioningWidget.java From unitime with Apache License 2.0 | 5 votes |
protected Command confirmEnrollmentVariableCredits(final Command callback) { if (iEligibilityCheck != null && iEligibilityCheck.hasGradeModes()) { final List<String> changes = getCourseChangesWithVarbiableCredit(); if (changes != null && !changes.isEmpty()) { return new Command() { @Override public void execute() { UniTimeConfirmationDialog.confirm(useDefaultConfirmDialog(), MESSAGES.confirmEnrollmentVariableCreditChange(ToolBox.toString(changes)), callback); } }; } } return callback; }
Example #21
Source File: MockComponent.java From appinventor-extensions with Apache License 2.0 | 5 votes |
@Override public void show() { super.show(); DeferredCommand.addCommand(new Command() { @Override public void execute() { newNameTextBox.setFocus(true); newNameTextBox.selectAll(); } }); }
Example #22
Source File: Connection.java From EasyML with Apache License 2.0 | 5 votes |
protected void initMenu() { menu = new ContextMenu(); menu.addItem(new MenuItem(deleteMenuText, true, new Command() { @Override public void execute() { controller.deleteConnection(Connection.this); startShape.removeConnection(Connection.this); endShape.removeConnection(Connection.this); menu.hide(); } })); }
Example #23
Source File: SuggestionsPageContext.java From unitime with Apache License 2.0 | 5 votes |
protected void select(final TimeLocation time, boolean fireUpdate) { if (iSelectedTime != null) iSelectedTime.removeStyleName("selected"); iSelectedTime = time; if (iSelectedTime != null) iSelectedTime.addStyleName("selected"); if (fireUpdate) onSelection(new Command() { @Override public void execute() { invert(time, false); } }); }
Example #24
Source File: StageTwoProvider.java From incubator-retired-wave with Apache License 2.0 | 5 votes |
/** * Swaps order of open and render. */ @Override protected void install() { if (isNewWave) { // For a new wave, initial state comes from local initialization. getConversations().createRoot().getRootThread().appendBlip(); // Adding any initial participant to the new wave getConversations().getRoot().addParticipantIds(otherParticipants); super.install(); whenReady.use(StageTwoProvider.this); } else { // For an existing wave, while we're still using the old protocol, // rendering must be delayed until the channel is opened, because the // initial state snapshots come from the channel. getConnector().connect(new Command() { @Override public void execute() { // This code must be kept in sync with the default install() // method, but excluding the connect() call. // Install diff control before rendering, because logical diff state // may // need to be adjusted due to arbitrary UI policies. getDiffController().install(); // Ensure the wave is rendered. stageOne.getDomAsViewProvider().setRenderer(getRenderer()); ensureRendered(); // Install eager UI. installFeatures(); // Rendering, and therefore the whole stage is now ready. whenReady.use(StageTwoProvider.this); } }); } }
Example #25
Source File: PopupMenu.java From swellrt with Apache License 2.0 | 5 votes |
/** * Constructs a {@PopupMenuItem} * * @param text The text label for the item. * @param cmd The command to run when the item is clicked. * @param isEnabled True if this menu item is enabled. * @param hide True if clicking this menu item should hide the popup. */ public PopupMenuItem(String text, Command cmd, boolean isEnabled, boolean hide) { super(text); setStyleName(RESOURCES.css().item()); setEnabled(isEnabled); defaultEnabled = isEnabled; command = cmd; this.hide = hide; if (isPreClicked) { // If this menu is pre-clicked it doesn't require a full click to select // an item, just a mouseup over the item. If the user then does click the // item then that will also give a mouseup so this handler will deal with // that case as well. addMouseUpHandler(new MouseUpHandler() { @Override public void onMouseUp(MouseUpEvent event) { onClicked(); } }); } else { addClickHandler(new ClickHandler() { public void onClick(ClickEvent e) { onClicked(); } }); } // Ensure that clicking this menu item doesn't affect the current selection. addMouseDownHandler(PREVENT_DEFAULT_HANDLER); }
Example #26
Source File: ContextMenu.java From appinventor-extensions with Apache License 2.0 | 5 votes |
/** * Adds a menu item to the context menu. * * @param text caption of menu item * @param command command to execute when menu item is chosen * @return menu item */ public MenuItem addItem(String text, final Command command) { MenuItem menuItem = new MenuItem(text, new Command() { @Override public void execute() { hide(); command.execute(); } }); menuItem.setStylePrimaryName("ode-ContextMenuItem"); menuBar.addItem(menuItem); return menuItem; }
Example #27
Source File: Box.java From appinventor-extensions with Apache License 2.0 | 5 votes |
/** * Creates a control to resize the box. */ private ResizeControl() { super(false); // no autohide VerticalPanel buttonPanel = new VerticalPanel(); buttonPanel.setSpacing(10); addControlButton(buttonPanel, "-", new Command() { @Override public void execute() { height = Math.max(100, height - 20); restoreHeight = height; onResize(width, height); } }); addControlButton(buttonPanel, "+", new Command() { @Override public void execute() { height = height + 20; restoreHeight = height; onResize(width, height); } }); addControlButton(buttonPanel, MESSAGES.done(), new Command() { @Override public void execute() { hide(); } }); add(buttonPanel); setModal(true); setStylePrimaryName("ode-BoxResizeControl"); }
Example #28
Source File: GadgetWidgetUi.java From incubator-retired-wave with Apache License 2.0 | 5 votes |
private void buildMenu() { // TODO(user): Use menu builder. menu = new MenuButton(CSS.metaButton() + " " + CSS.more(), "Gadget menu"); menu.addItem("Delete gadget", new Command() { @Override public void execute() { if (listener != null) { listener.deleteGadget(); } } }, true); menu.addItem("Select", new Command() { @Override public void execute() { if (listener != null) { listener.selectGadget(); } } }, true); menu.addItem("Reset", new Command() { @Override public void execute() { if (listener != null) { listener.resetGadget(); } } }, true); metaButtonsPanel.add(menu.getButton()); }
Example #29
Source File: MainMenu.java From document-management-system with GNU General Public License v2.0 | 5 votes |
/** * initAvailableLanguage */ public void initAvailableLanguage(List<GWTLanguage> langs) { for (final GWTLanguage lang : langs) { MenuItem menuItem = new MenuItem(Util.flagMenuHTML(lang.getId(), lang.getName()), true, new Command() { @Override public void execute() { Main.get().refreshLang(lang.getId()); } }); menuItem.addStyleName("okm-MainMenuItem"); subMenuLanguage.addItem(menuItem); } }
Example #30
Source File: StageTwo.java From swellrt with Apache License 2.0 | 5 votes |
/** * Creates the second stage. */ @Override protected void create(final Accessor<StageTwo> whenReady) { onStageInit(); final CountdownLatch synchronizer = CountdownLatch.create(2, new Command() { @Override public void execute() { install(); onStageLoaded(); whenReady.use(DefaultProvider.this); } }); fetchWave(new Accessor<WaveViewData>() { @Override public void use(WaveViewData x) { waveData = x; synchronizer.tick(); } }); // Defer everything else, to let the RPC go out. SchedulerInstance.getMediumPriorityTimer().scheduleDelayed(new Task() { @Override public void execute() { installStatics(); synchronizer.tick(); } }, 20); }