Search in sources :

Example 46 with ChangeHandler

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);
}
Also used : ChangeEvent(com.google.gwt.event.dom.client.ChangeEvent) ChangeHandler(com.google.gwt.event.dom.client.ChangeHandler) FileUpload(com.google.gwt.user.client.ui.FileUpload)

Example 47 with ChangeHandler

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;
}
Also used : HandlerRegistration(com.google.web.bindery.event.shared.HandlerRegistration) ChangeEvent(com.google.gwt.event.dom.client.ChangeEvent) ChangeHandler(com.google.gwt.event.dom.client.ChangeHandler) FileReader(com.googlecode.gwtphonegap.client.file.FileReader)

Example 48 with ChangeHandler

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();
            }
        }
    });
}
Also used : RSConnectAccount(org.rstudio.studio.client.rsconnect.model.RSConnectAccount) ChangeEvent(com.google.gwt.event.dom.client.ChangeEvent) ChangeHandler(com.google.gwt.event.dom.client.ChangeHandler) ProgressOperation(org.rstudio.core.client.widget.ProgressOperation) Operation(org.rstudio.core.client.widget.Operation) Inject(com.google.inject.Inject)

Example 49 with ChangeHandler

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_;
}
Also used : ChangeEvent(com.google.gwt.event.dom.client.ChangeEvent) ValueChangeEvent(com.google.gwt.event.logical.shared.ValueChangeEvent) DockLayoutPanel(com.google.gwt.user.client.ui.DockLayoutPanel) ValueChangeHandler(com.google.gwt.event.logical.shared.ValueChangeHandler) ChangeHandler(com.google.gwt.event.dom.client.ChangeHandler) Size(org.rstudio.core.client.Size) SimplePanel(com.google.gwt.user.client.ui.SimplePanel) AceEditor(org.rstudio.studio.client.workbench.views.source.editors.text.AceEditor) Void(org.rstudio.studio.client.server.Void)

Example 50 with ChangeHandler

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;
}
Also used : ChangeEvent(com.google.gwt.event.dom.client.ChangeEvent) ChangeHandler(com.google.gwt.event.dom.client.ChangeHandler) Grid(com.google.gwt.user.client.ui.Grid) Label(com.google.gwt.user.client.ui.Label) SimplePanel(com.google.gwt.user.client.ui.SimplePanel) TextBox(com.google.gwt.user.client.ui.TextBox)

Aggregations

ChangeEvent (com.google.gwt.event.dom.client.ChangeEvent)98 ChangeHandler (com.google.gwt.event.dom.client.ChangeHandler)98 ClickEvent (com.google.gwt.event.dom.client.ClickEvent)41 ClickHandler (com.google.gwt.event.dom.client.ClickHandler)41 JsonCallbackEvents (cz.metacentrum.perun.webgui.json.JsonCallbackEvents)31 ListBox (org.gwtbootstrap3.client.ui.ListBox)31 JavaScriptObject (com.google.gwt.core.client.JavaScriptObject)28 ValueChangeEvent (com.google.gwt.event.logical.shared.ValueChangeEvent)27 ValueChangeHandler (com.google.gwt.event.logical.shared.ValueChangeHandler)27 TabMenu (cz.metacentrum.perun.webgui.widgets.TabMenu)27 ArrayList (java.util.ArrayList)21 CustomButton (cz.metacentrum.perun.webgui.widgets.CustomButton)20 PerunError (cz.metacentrum.perun.webgui.model.PerunError)16 ListBoxWithObjects (cz.metacentrum.perun.webgui.widgets.ListBoxWithObjects)15 TabItem (cz.metacentrum.perun.webgui.tabs.TabItem)13 FormStylePopup (org.uberfire.ext.widgets.common.client.common.popups.FormStylePopup)12 HashMap (java.util.HashMap)11 Map (java.util.Map)9 Button (org.gwtbootstrap3.client.ui.Button)9 HTML (com.google.gwt.user.client.ui.HTML)7