Search in sources :

Example 6 with FileUpload

use of com.google.gwt.user.client.ui.FileUpload 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 7 with FileUpload

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

the class MetadataImportDialogController method createWorkingForm.

private void createWorkingForm() {
    if (formPanel == null) {
        formPanel = new FormPanel();
        formPanel.setMethod(FormPanel.METHOD_POST);
        formPanel.setEncoding(FormPanel.ENCODING_MULTIPART);
        formPanel.setAction(UPLOAD_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);
        propertiesFileImportPanel = new FlowPanel();
        mainFormPanel.add(propertiesFileImportPanel);
        formDomainIdText = new TextBox();
        formDomainIdText.setName("domainId");
        mainFormPanel.add(formDomainIdText);
        metadataFileUpload = new FileUpload();
        metadataFileUpload.setName("metadataFile");
        metadataFileUpload.getElement().setId("metaFileUpload");
        metadataFileUpload.addChangeHandler(new ChangeHandler() {

            @Override
            public void onChange(ChangeEvent event) {
                String filename = ((FileUpload) event.getSource()).getFilename();
                if (filename != null && filename.trim().length() > 0) {
                    metaFileLocation.setValue(filename);
                    importDialogModel.setUploadedFile(filename);
                    acceptButton.setDisabled(!isValid());
                } else {
                    metaFileLocation.setValue(resBundle.getString("importDialog.SELECT_METAFILE_LABEL", "browse for metadata file"));
                    importDialogModel.setUploadedFile(null);
                    acceptButton.setDisabled(!isValid());
                }
            }
        });
        mainFormPanel.add(metadataFileUpload);
        formPanel.addSubmitCompleteHandler(createSubmitCompleteHandler());
        VerticalPanel vp = (VerticalPanel) hiddenArea.getManagedObject();
        vp.add(formPanel);
    }
}
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) TextBox(com.google.gwt.user.client.ui.TextBox) FileUpload(com.google.gwt.user.client.ui.FileUpload)

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