use of com.google.gwt.event.dom.client.ChangeHandler in project che by eclipse.
the class UploadFileViewImpl method addFile.
private void addFile() {
file = new FileUpload();
file.setHeight("22px");
file.setWidth("100%");
file.setName("file");
file.ensureDebugId("file-uploadFile-ChooseFile");
file.addChangeHandler(new ChangeHandler() {
@Override
public void onChange(ChangeEvent event) {
delegate.onFileNameChanged();
}
});
uploadPanel.insert(file, 0);
}
use of com.google.gwt.event.dom.client.ChangeHandler in project gwtphonegap by dankurka.
the class CameraBrowserFileInput method getPicture.
@Override
public CameraPopoverHandle getPicture(final PictureOptions options, final PictureCallback callback) {
if (!input.isAttached()) {
callback.onFailure("after #cleanUp(), this instance is no longer useful");
return popoverHandle;
}
@SuppressWarnings("unused") final ChangeHandler handler = new ChangeHandler() {
private final HandlerRegistration reg = input.addChangeHandler(this);
@Override
public void onChange(ChangeEvent event) {
reg.removeHandler();
if (options.getDestinationType() == PictureOptions.DESTINATION_TYPE_DATA_URL) {
getBase64(new ReaderCallback<FileReader>() {
@Override
public void onCallback(FileReader result) {
callback.onSuccess(result.getResult());
}
});
} else {
callback.onSuccess(getFileUri());
}
}
};
open(input.getElement());
return popoverHandle;
}
use of com.google.gwt.event.dom.client.ChangeHandler in project rstudio by rstudio.
the class RSConnectDeploy method initialize.
@Inject
public void initialize(RSConnectServerOperations server, RSAccountConnector connector, GlobalDisplay display, UIPrefs prefs) {
server_ = server;
connector_ = connector;
display_ = display;
prefs_ = prefs;
accountList_ = new RSConnectAccountList(server_, display_, false, !asStatic_);
appName_ = new AppNameTextbox(this);
// when the account list finishes populating, select the account from the
// previous deployment if we have one
accountList_.setOnRefreshCompleted(new Operation() {
@Override
public void execute() {
if (fromPrevious_ != null) {
// when re-deploying, select the account used the last time
// around
accountList_.selectAccount(fromPrevious_.getAccount());
} else {
// when doing a first-time publish, select the account the user
// prefers (currently this just tracks the last account used)
RSConnectAccount preferred = prefs_.preferredPublishAccount().getGlobalValue();
if (preferred != null) {
accountList_.selectAccount(preferred);
}
// validate the app name now that we have an account selected
appName_.validateAppName();
}
}
});
// when the user selects a different account, show the appropriate UI
addAccountChangeHandler(new ChangeHandler() {
@Override
public void onChange(ChangeEvent arg0) {
if (fromPrevious_ != null) {
boolean existing = accountList_.getSelectedAccount().equals(fromPrevious_.getAccount());
appInfoPanel_.setVisible(existing);
newAppPanel_.setVisible(!existing);
// validate name if necessary
if (existing && onDeployEnabled_ != null)
onDeployEnabled_.execute();
else if (!existing)
appName_.validateAppName();
} else {
// re-validate app name as different accounts have different
// name restrictions
appName_.validateAppName();
}
}
});
}
use of com.google.gwt.event.dom.client.ChangeHandler in project rstudio by rstudio.
the class EditSnippetsDialog method createMainWidget.
@Override
protected Widget createMainWidget() {
panel_ = new DockLayoutPanel(Unit.PX);
// compute the widget size and set it
Size size = new Size(900, 900);
size = DomMetrics.adjustedElementSize(size, null, // pad
70, // client margin
100);
panel_.setWidth(size.width + "px");
panel_.setHeight(size.height + "px");
// snippet types
snippetTypes_ = new WidgetListBox<EditableSnippets>();
snippetTypes_.addChangeHandler(new ChangeHandler() {
@Override
public void onChange(ChangeEvent event) {
updateEditor(snippetTypes_.getSelectedItem());
}
});
snippetTypes_.addItem(new EditableSnippets("R", FileTypeRegistry.R));
snippetTypes_.addItem(new EditableSnippets(FileTypeRegistry.CPP));
snippetTypes_.addItem(new EditableSnippets(FileTypeRegistry.MARKDOWN));
snippetTypes_.addItem(new EditableSnippets(FileTypeRegistry.TEX));
snippetTypes_.addItem(new EditableSnippets(FileTypeRegistry.JS));
snippetTypes_.addItem(new EditableSnippets(FileTypeRegistry.HTML));
snippetTypes_.addItem(new EditableSnippets(FileTypeRegistry.CSS));
snippetTypes_.addItem(new EditableSnippets(FileTypeRegistry.SQL));
snippetTypes_.addItem(new EditableSnippets(FileTypeRegistry.JAVA));
snippetTypes_.addItem(new EditableSnippets(FileTypeRegistry.PYTHON));
snippetTypes_.addItem(new EditableSnippets(FileTypeRegistry.STAN));
panel_.addWest(snippetTypes_, 150);
// editor
docDisplay_ = new AceEditor();
docDisplay_.setUseSoftTabs(false);
docDisplay_.setTabSize(uiPrefs_.numSpacesForTab().getValue());
docDisplay_.addValueChangeHandler(new ValueChangeHandler<Void>() {
@Override
public void onValueChange(ValueChangeEvent<Void> event) {
editorDirty_ = true;
}
});
docDisplay_.setFileType(FileTypeRegistry.SNIPPETS);
SimplePanel panel = new SimplePanel();
panel.addStyleName("EditDialog");
panel.getElement().getStyle().setMarginLeft(8, Unit.PX);
panel.setWidget(docDisplay_.asWidget());
panel_.add(panel);
TextEditingTarget.syncFontSize(releaseOnDismiss_, events_, this, fontSizeManager_);
snippetTypes_.setSelectedIndex(0, true);
return panel_;
}
use of com.google.gwt.event.dom.client.ChangeHandler in project rstudio by rstudio.
the class NewConnectionSnippetDialog method createMainWidget.
@Override
protected Widget createMainWidget() {
SimplePanel wrapper = new SimplePanel();
wrapper.setStyleName(RES.styles().wrapper());
Grid connGrid = new Grid(initialConfig_.size(), 2);
connGrid.addStyleName(RES.styles().grid());
for (int idxParams = 0; idxParams < initialConfig_.size(); idxParams++) {
final String key = initialConfig_.get(idxParams).getKey();
Label label = new Label(key + ":");
label.addStyleName(RES.styles().label());
connGrid.setWidget(idxParams, 0, label);
connGrid.getRowFormatter().setVerticalAlign(idxParams, HasVerticalAlignment.ALIGN_TOP);
final TextBox textbox = new TextBox();
textbox.setText(initialConfig_.get(idxParams).getValue());
textbox.addStyleName(RES.styles().textbox());
connGrid.setWidget(idxParams, 1, textbox);
textbox.addChangeHandler(new ChangeHandler() {
@Override
public void onChange(ChangeEvent arg0) {
partsKeyValues_.put(key, textbox.getValue());
}
});
}
wrapper.add(connGrid);
return wrapper;
}
Aggregations