Search in sources :

Example 1 with FileUpload

use of com.google.gwt.user.client.ui.FileUpload in project che by eclipse.

the class UploadFolderFromZipViewImpl method addFileUploadForm.

private void addFileUploadForm() {
    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 2 with FileUpload

use of com.google.gwt.user.client.ui.FileUpload in project data-access by pentaho.

the class AnalysisImportDialogController method createWorkingForm.

private void createWorkingForm() {
    if (formPanel == null) {
        formPanel = new FormPanel();
        formPanel.setMethod(FormPanel.METHOD_POST);
        formPanel.setEncoding(FormPanel.ENCODING_MULTIPART);
        formPanel.setAction(MONDRIAN_POSTANALYSIS_URL);
        formPanel.getElement().getStyle().setProperty("position", "absolute");
        formPanel.getElement().getStyle().setProperty("visibility", "hidden");
        formPanel.getElement().getStyle().setProperty("overflow", "hidden");
        formPanel.getElement().getStyle().setProperty("clip", "rect(0px,0px,0px,0px)");
        mainFormPanel = new FlowPanel();
        formPanel.add(mainFormPanel);
        analysisFileUpload = new FileUpload();
        analysisFileUpload.setName("uploadAnalysis");
        analysisFileUpload.getElement().setId("analysisFileUpload");
        analysisFileUpload.addChangeHandler(new ChangeHandler() {

            @Override
            public void onChange(ChangeEvent event) {
                schemaNameLabel.setValue(((FileUpload) event.getSource()).getFilename());
                importDialogModel.setUploadedFile(((FileUpload) event.getSource()).getFilename());
                acceptButton.setDisabled(!isValid());
            }
        });
        mainFormPanel.add(analysisFileUpload);
        VerticalPanel vp = (VerticalPanel) hiddenArea.getManagedObject();
        vp.add(formPanel);
    // addSubmitHandler(); moved to GwtDataSourceEditorEntryPoint
    }
}
Also used : VerticalPanel(com.google.gwt.user.client.ui.VerticalPanel) FormPanel(com.google.gwt.user.client.ui.FormPanel) ChangeEvent(com.google.gwt.event.dom.client.ChangeEvent) PropertyChangeEvent(java.beans.PropertyChangeEvent) ChangeHandler(com.google.gwt.event.dom.client.ChangeHandler) FlowPanel(com.google.gwt.user.client.ui.FlowPanel) FileUpload(com.google.gwt.user.client.ui.FileUpload)

Example 3 with FileUpload

use of com.google.gwt.user.client.ui.FileUpload in project data-access by pentaho.

the class MetadataImportDialogController method addLocalizedBundle.

@Bindable
public void addLocalizedBundle() {
    final FileUpload localizedBundleUpload = new FileUpload();
    localizedBundleUpload.setName("localeFiles");
    localizedBundleUpload.getElement().setId("propertyFileUpload" + FILE_UPLOAD_SUFFIX++);
    localizedBundleUpload.addChangeHandler(new ChangeHandler() {

        @Override
        public void onChange(ChangeEvent event) {
            String fileName = ((FileUpload) event.getSource()).getFilename();
            if (fileName == null || fileName.length() < 1) {
                // Trying to detect a cancel
                propertiesFileImportPanel.remove(localizedBundleUpload);
            } else {
                importDialogModel.addLocalizedBundle(fileName, fileName);
            }
        }
    });
    propertiesFileImportPanel.add(localizedBundleUpload);
    jsClickUpload(localizedBundleUpload.getElement().getId());
}
Also used : ChangeEvent(com.google.gwt.event.dom.client.ChangeEvent) PropertyChangeEvent(java.beans.PropertyChangeEvent) ChangeHandler(com.google.gwt.event.dom.client.ChangeHandler) FileUpload(com.google.gwt.user.client.ui.FileUpload) Bindable(org.pentaho.ui.xul.stereotype.Bindable)

Example 4 with FileUpload

use of com.google.gwt.user.client.ui.FileUpload in project data-access by pentaho.

the class UploadFileEntryPoint method onModuleLoad.

public void onModuleLoad() {
    // Create a FormPanel and point it at a service.
    final FormPanel uploadForm = new FormPanel();
    uploadForm.setAction(GWT.getModuleBaseURL() + "/UploadService");
    // Because we're going to add a FileUpload widget, we'll need to set the
    // form to use the POST method, and multipart MIME encoding.
    uploadForm.setEncoding(FormPanel.ENCODING_MULTIPART);
    uploadForm.setMethod(FormPanel.METHOD_POST);
    // Create a panel to hold all of the form widgets.
    VerticalPanel panel = new VerticalPanel();
    uploadForm.setWidget(panel);
    // Create a TextBox, giving it a name so that it will be submitted.
    final TextBox tb = new TextBox();
    tb.setName("textBoxFormElement");
    panel.add(tb);
    // Create a FileUpload widget.
    FileUpload upload = new FileUpload();
    upload.setName("uploadFormElement");
    panel.add(upload);
    // Add a 'Upload' button.
    Button uploadSubmitButton = new Button("Upload");
    panel.add(uploadSubmitButton);
    uploadSubmitButton.addClickListener(new ClickListener() {

        public void onClick(Widget sender) {
            uploadForm.submit();
        }
    });
    uploadForm.addFormHandler(new FormHandler() {

        public void onSubmit(FormSubmitEvent event) {
        }

        public void onSubmitComplete(FormSubmitCompleteEvent event) {
            Window.alert(event.getResults());
        }
    });
    RootPanel.get().add(uploadForm);
}
Also used : FormSubmitCompleteEvent(com.google.gwt.user.client.ui.FormSubmitCompleteEvent) VerticalPanel(com.google.gwt.user.client.ui.VerticalPanel) FormPanel(com.google.gwt.user.client.ui.FormPanel) Button(com.google.gwt.user.client.ui.Button) Widget(com.google.gwt.user.client.ui.Widget) FormHandler(com.google.gwt.user.client.ui.FormHandler) TextBox(com.google.gwt.user.client.ui.TextBox) FormSubmitEvent(com.google.gwt.user.client.ui.FormSubmitEvent) FileUpload(com.google.gwt.user.client.ui.FileUpload) ClickListener(com.google.gwt.user.client.ui.ClickListener)

Example 5 with FileUpload

use of com.google.gwt.user.client.ui.FileUpload in project ovirt-engine by oVirt.

the class IconEditorWidget method onUploadIconButton.

@UiHandler("uploadButton")
void onUploadIconButton(ClickEvent event) {
    hiddenPanel.clear();
    final FileUpload inputFileWidget = new FileUpload();
    // $NON-NLS-1$ //$NON-NLS-2$
    inputFileWidget.getElement().setAttribute("accept", "image/gif,image/jpeg,image/png");
    inputFileWidget.addChangeHandler(e -> readUploadedIconFile(inputFileWidget.getElement()));
    inputFileWidget.getElement().setTabIndex(-1);
    hiddenPanel.add(inputFileWidget);
    inputFileWidget.click();
}
Also used : FileUpload(com.google.gwt.user.client.ui.FileUpload) UiHandler(com.google.gwt.uibinder.client.UiHandler)

Aggregations

FileUpload (com.google.gwt.user.client.ui.FileUpload)7 ChangeEvent (com.google.gwt.event.dom.client.ChangeEvent)5 ChangeHandler (com.google.gwt.event.dom.client.ChangeHandler)5 FormPanel (com.google.gwt.user.client.ui.FormPanel)3 VerticalPanel (com.google.gwt.user.client.ui.VerticalPanel)3 PropertyChangeEvent (java.beans.PropertyChangeEvent)3 FlowPanel (com.google.gwt.user.client.ui.FlowPanel)2 TextBox (com.google.gwt.user.client.ui.TextBox)2 UiHandler (com.google.gwt.uibinder.client.UiHandler)1 Button (com.google.gwt.user.client.ui.Button)1 ClickListener (com.google.gwt.user.client.ui.ClickListener)1 FormHandler (com.google.gwt.user.client.ui.FormHandler)1 FormSubmitCompleteEvent (com.google.gwt.user.client.ui.FormSubmitCompleteEvent)1 FormSubmitEvent (com.google.gwt.user.client.ui.FormSubmitEvent)1 Widget (com.google.gwt.user.client.ui.Widget)1 Bindable (org.pentaho.ui.xul.stereotype.Bindable)1