use of com.google.gwt.core.client.Scheduler.ScheduledCommand in project rstudio by rstudio.
the class FilesPane method onBeforeSelected.
@Override
public void onBeforeSelected() {
if (needsInit) {
needsInit = false;
FileSystemItem home = FileSystemItem.home();
observer_.onFileNavigation(home);
} else {
Scheduler.get().scheduleDeferred(new ScheduledCommand() {
@Override
public void execute() {
filesList_.redraw();
}
});
}
}
use of com.google.gwt.core.client.Scheduler.ScheduledCommand in project rstudio by rstudio.
the class RSConnectDeploy method populateDeploymentFiles.
private void populateDeploymentFiles(final ProgressIndicator indicator) {
if (source_ == null)
return;
// dependencies; just inject it directly into the list.
if (source_.isSelfContained() && source_.isStatic() && !source_.isWebsiteRmd()) {
ArrayList<String> files = new ArrayList<String>();
FileSystemItem selfContained = FileSystemItem.createFile(source_.getDeployFile());
files.add(selfContained.getName());
setFileList(files, null, null);
setPrimaryFile(selfContained.getName());
return;
}
// ternery operator maps to appropriate files to list for deployment:
// website code - website code directory
// static website - website build directory
// document - R Markdown document
// non-document - Shiny app directory
final String fileSource = source_.isDocument() ? source_.isWebsiteRmd() ? source_.isStatic() ? source_.getDeployDir() : source_.getWebsiteDir() : source_.getDeployFile() : source_.getDeployDir();
indicator.onProgress("Collecting files...");
server_.getDeploymentFiles(fileSource, asMultipleRmd_, new ServerRequestCallback<RSConnectDeploymentFiles>() {
@Override
public void onResponseReceived(RSConnectDeploymentFiles files) {
if (files.getDirSize() > files.getMaxSize()) {
indicator.onError("The item to be deployed (" + fileSource + ") " + "exceeds the maximum deployment size, which is " + StringUtil.formatFileSize(files.getMaxSize()) + "." + " Consider creating a new directory containing " + "only the content you wish to deploy.");
} else {
if (files.getDirList() == null || files.getDirList().length() == 0) {
indicator.onError("Could not determine the list of " + "files to deploy.");
indicator.onCompleted();
}
setFileList(JsArrayUtil.fromJsArrayString(files.getDirList()), fromPrevious_ != null ? fromPrevious_.getAdditionalFiles() : null, fromPrevious_ != null ? fromPrevious_.getIgnoredFiles() : null);
if (!source_.isWebsiteRmd())
setPrimaryFile(FileSystemItem.createFile(source_.getDeployFile()).getName());
}
Scheduler.get().scheduleDeferred(new ScheduledCommand() {
@Override
public void execute() {
indicator.clearProgress();
}
});
}
@Override
public void onError(ServerError error) {
// we need to have a list of files to deploy to proceed
indicator.onError("Could not find files to deploy: \n\n" + error.getMessage());
indicator.onCompleted();
}
});
}
use of com.google.gwt.core.client.Scheduler.ScheduledCommand in project GwtMobile by dennisjzh.
the class CheckBoxGroup method onClick.
@Override
public void onClick(ClickEvent e) {
final EventTarget target = e.getNativeEvent().getEventTarget();
String targetTagName = ((Element) target.cast()).getTagName().toUpperCase();
Utils.Console("onClick target " + targetTagName);
if (targetTagName.equals("LABEL")) {
// if check box label is click, another (simulated) click event with
return;
// check box INPUT as target will fire after this one. So this click event
// can be safely ignored.
}
Element div = Element.as(target);
while (!div.getNodeName().toUpperCase().equals("SPAN") || div.getParentElement() != this.getElement()) {
div = div.getParentElement();
if (div == null) {
Utils.Console("CheckBoxGroup onClick: span not found");
return;
}
}
final int index = DOM.getChildIndex(this.getElement(), (com.google.gwt.user.client.Element) div);
com.google.gwt.user.client.ui.CheckBox checkbox = (com.google.gwt.user.client.ui.CheckBox) _panel.getWidget(index);
Utils.Console("onClick " + checkbox.getValue());
if (targetTagName.equals("INPUT")) {
Utils.Console("onClick value changed");
// if target is check box INPUT, check box value is
checkbox.setValue(checkbox.getValue());
// already changed when click event is fired.
// just need to set its current value back to the check box
// to update style.
} else {
checkbox.setValue(!checkbox.getValue());
}
Scheduler.get().scheduleDeferred(new ScheduledCommand() {
@Override
public void execute() {
SelectionChangedEvent selectionChangedEvent = new SelectionChangedEvent(index, target);
fireEvent(selectionChangedEvent);
}
});
}
use of com.google.gwt.core.client.Scheduler.ScheduledCommand in project blogwt by billy1380.
the class GalleryPlugin method emit.
/* (non-Javadoc)
*
* @see org.markdown4j.Plugin#emit(java.lang.StringBuilder, java.util.List,
* java.util.Map) */
@Override
public void emit(StringBuilder out, final List<String> lines, final Map<String, String> params) {
final String id = HTMLPanel.createUniqueId();
out.append("<div id=\"");
out.append(id);
out.append("\"> Loading gallery...</div>");
Scheduler.get().scheduleDeferred(new ScheduledCommand() {
@Override
public void execute() {
if (manager != null) {
manager.fireEvent(new PluginContentReadyEvent(GalleryPlugin.this, lines, params, id, "None"));
}
}
});
}
use of com.google.gwt.core.client.Scheduler.ScheduledCommand in project che by eclipse.
the class PopupKeyDownListener method handleEvent.
@Override
public void handleEvent(final Event evt) {
if (evt instanceof KeyboardEvent) {
final KeyboardEvent keyEvent = (KeyboardEvent) evt;
switch(keyEvent.getKeyCode()) {
case KeyCodes.KEY_ESCAPE:
Scheduler.get().scheduleDeferred(new ScheduledCommand() {
@Override
public void execute() {
popupWidget.hide();
}
});
break;
case KeyCodes.KEY_DOWN:
focusNext();
break;
case KeyCodes.KEY_UP:
focusPrevious();
break;
case KeyCodes.KEY_HOME:
focusFirst();
break;
case KeyCodes.KEY_END:
focusLast();
break;
case KeyCodes.KEY_ENTER:
evt.preventDefault();
evt.stopImmediatePropagation();
validateItem();
break;
default:
}
}
}
Aggregations