Java Code Examples for com.google.gwt.user.client.DeferredCommand#addCommand()
The following examples show how to use
com.google.gwt.user.client.DeferredCommand#addCommand() .
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: 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 2
Source File: RemixedYoungAndroidProjectWizard.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 = 320; int height = 40; this.center(); setPixelSize(width, height); super.setPagePanelHeight(40); DeferredCommand.addCommand(new Command() { public void execute() { projectNameTextBox.setFocus(true); projectNameTextBox.selectAll(); } }); }
Example 3
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 4
Source File: ComponentRenameWizard.java From appinventor-extensions with Apache License 2.0 | 6 votes |
@Override public void show() { super.show(); int width = 320; int height = 40; this.center(); setPixelSize(width, height); super.setPagePanelHeight(40); DeferredCommand.addCommand(new Command() { public void execute() { renameTextBox.setFocus(true); } }); }
Example 5
Source File: CopyYoungAndroidProjectCommand.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 6
Source File: DragSourceSupport.java From appinventor-extensions with Apache License 2.0 | 5 votes |
@Override public void onMouseDown(Widget sender, int x, int y) { if (mouseIsDown) { OdeLog.wlog("received onMouseDown event when we thought the mouse was already down"); } mouseIsDown = true; startX = x; startY = y; if (!captured) { // Force browser to keep sending us events until the mouse is released dom.setCapture(sender.getElement()); captured = true; } // Prevent default actions like image-dragging and text selections from being triggered dom.eventPreventDefaultOfCurrentEvent(); // TODO(user): Consider removing this, since it seems to have // less effect (at least on Firefox 2) than the line above, // is more complex, and is browser-dependent. DeferredCommand.addCommand(new Command() { @Override public void execute() { clearSelections(); } }); }
Example 7
Source File: DragSourceSupport.java From appinventor-extensions with Apache License 2.0 | 5 votes |
@Override public void onTouchEnd(TouchEndEvent event) { final Widget src = (Widget) event.getSource(); if (src instanceof MockComponent) { // We only select on CLICK, which isn't generated on mobile DeferredCommand.addCommand(new Command() { @Override public void execute() { ((MockComponent) src).select(); } }); } onMouseUp(src, dragX, dragY); }
Example 8
Source File: MockFusionTablesControl.java From appinventor-extensions with Apache License 2.0 | 5 votes |
/** * Generate a dialog box indicating that the FusiontablesControl is * deprecated. */ @Override protected void onAttach() { super.onAttach(); if (!warningGiven) { warningGiven = true; DeferredCommand.addCommand(new Command() { @Override public void execute() { Ode.getInstance().genericWarning(MESSAGES.FusionTablesDeprecated()); } }); } }
Example 9
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 10
Source File: LocalStorageServiceProxy.java From shortyz with GNU General Public License v3.0 | 5 votes |
@Override public Request findPuzzle(final Long puzzleId, final AsyncCallback<Puzzle> callback) { GWT.log(WindowContext.INSTANCE.isInitialized() +" init", null); if(!WindowContext.INSTANCE.isInitialized()){ WindowContext.INSTANCE.initialize(new WindowContextCallback(){ @Override public void onInitialized() { GWT.log("Init callback", null); findPuzzle(puzzleId, callback); } }); return new FakeRequest(); } if(WindowContext.INSTANCE.get(puzzleId.toString()) != null){ GWT.log("Found local data.", null); DeferredCommand.addCommand(new Command(){ @Override public void execute() { loadInternal(puzzleId, callback); } }); return new FakeRequest(); } return super.findPuzzle(puzzleId, callback); }
Example 11
Source File: BufferedLogger.java From swellrt with Apache License 2.0 | 5 votes |
@Override public void lazyLog(Level level, Object... messages) { // NOTE(user): It is best to assume that DeferredCommand can execute // immediately. // NOTE(danilatos): We use DeferredCommand rather than // org.waveprotocol.wave.Scheduler, so that we can log in // the Scheduler implementations. boolean doFlush = buffer.isEmpty(); buffer.add(new LogMessage(messages, level)); if (doFlush) { DeferredCommand.addCommand(flush); } }
Example 12
Source File: BufferedLogger.java From incubator-retired-wave with Apache License 2.0 | 5 votes |
@Override public void lazyLog(Level level, Object... messages) { // NOTE(user): It is best to assume that DeferredCommand can execute // immediately. // NOTE(danilatos): We use DeferredCommand rather than // org.waveprotocol.wave.Scheduler, so that we can log in // the Scheduler implementations. boolean doFlush = buffer.isEmpty(); buffer.add(new LogMessage(messages, level)); if (doFlush) { DeferredCommand.addCommand(flush); } }
Example 13
Source File: UserSettings.java From appinventor-extensions with Apache License 2.0 | 4 votes |
@Override public void saveSettings(final Command command) { if (Ode.getInstance().isReadOnly()) { return; // Don't save when in read-only mode } if (loading) { // If we are in the process of loading, we must defer saving. DeferredCommand.addCommand(new Command() { @Override public void execute() { saveSettings(command); } }); } else if (!loaded) { // Do not save settings that have not been loaded. We should // only wind up in this state if we are in the early phases of // loading the App Inventor client code. If saveSettings is // called in this state, it is from the onWindowClosing // handler. We do *not* want to over-write a persons valid // settings with this empty version, so we just return. return; } else if (!changed) { // Do not save UserSettings if they haven't changed. return; } else { String s = encodeSettings(); OdeLog.log("Saving global settings: " + s); Ode.getInstance().getUserInfoService().storeUserSettings( s, new OdeAsyncCallback<Void>( // failure message MESSAGES.settingsSaveError()) { @Override public void onSuccess(Void result) { changed = false; if (command != null) { command.execute(); } } }); } }
Example 14
Source File: YoungAndroidAssetSelectorPropertyEditor.java From appinventor-extensions with Apache License 2.0 | 4 votes |
/** * Creates a new property editor for selecting a Young Android asset. * * @param editor the editor that this property editor belongs to */ public YoungAndroidAssetSelectorPropertyEditor(final YaFormEditor editor) { Project project = Ode.getInstance().getProjectManager().getProject(editor.getProjectId()); assetsFolder = ((YoungAndroidProjectNode) project.getRootNode()).getAssetsFolder(); project.addProjectChangeListener(this); VerticalPanel selectorPanel = new VerticalPanel(); assetsList = new ListBox(); assetsList.setVisibleItemCount(10); assetsList.setWidth("100%"); selectorPanel.add(assetsList); choices = new ListWithNone(MESSAGES.noneCaption(), new ListWithNone.ListBoxWrapper() { @Override public void addItem(String item) { assetsList.addItem(item); } @Override public String getItem(int index) { return assetsList.getItemText(index); } @Override public void removeItem(int index) { assetsList.removeItem(index); } @Override public void setSelectedIndex(int index) { assetsList.setSelectedIndex(index); } }); // Fill choices with the assets. if (assetsFolder != null) { for (ProjectNode node : assetsFolder.getChildren()) { choices.addItem(node.getName()); } } Button addButton = new Button(MESSAGES.addButton()); addButton.setWidth("100%"); addButton.addClickHandler(new ClickHandler() { @Override public void onClick(ClickEvent event) { FileUploadedCallback callback = new FileUploadedCallback() { @Override public void onFileUploaded(FolderNode folderNode, FileNode fileNode) { // At this point, the asset has been uploaded to the server, and // has even been added to the assetsFolder. We are all set! choices.selectValue(fileNode.getName()); closeAdditionalChoiceDialog(true); } }; FileUploadWizard uploader = new FileUploadWizard(assetsFolder, callback); uploader.show(); } }); selectorPanel.add(addButton); selectorPanel.setWidth("100%"); // At this point, the editor hasn't finished loading. // Use a DeferredCommand to finish the initialization after the editor has finished loading. DeferredCommand.addCommand(new Command() { @Override public void execute() { if (editor.isLoadComplete()) { finishInitialization(); } else { // Editor still hasn't finished loading. DeferredCommand.addCommand(this); } } }); initAdditionalChoicePanel(selectorPanel); }
Example 15
Source File: YoungAndroidComponentSelectorPropertyEditor.java From appinventor-extensions with Apache License 2.0 | 4 votes |
/** * Creates a new property editor for selecting a component, where the * user chooses among components of one or more component types. * * @param editor the editor that this property editor belongs to * @param componentTypes types of component that can be selected, or null if * all types of components can be selected. */ public YoungAndroidComponentSelectorPropertyEditor(final YaFormEditor editor, Set<String> componentTypes) { this.editor = editor; this.componentTypes = componentTypes; VerticalPanel selectorPanel = new VerticalPanel(); componentsList = new ListBox(); componentsList.setVisibleItemCount(10); componentsList.setWidth("100%"); selectorPanel.add(componentsList); selectorPanel.setWidth("100%"); choices = new ListWithNone(MESSAGES.noneCaption(), new ListWithNone.ListBoxWrapper() { @Override public void addItem(String item) { componentsList.addItem(item); } @Override public String getItem(int index) { return componentsList.getItemText(index); } @Override public void removeItem(int index) { componentsList.removeItem(index); } @Override public void setSelectedIndex(int index) { componentsList.setSelectedIndex(index); } }); // At this point, the editor hasn't finished loading. // Use a DeferredCommand to finish the initialization after the editor has finished loading. DeferredCommand.addCommand(new Command() { @Override public void execute() { if (editor.isLoadComplete()) { finishInitialization(); } else { // Editor still hasn't finished loading. DeferredCommand.addCommand(this); } } }); initAdditionalChoicePanel(selectorPanel); }