当前位置: 首页>>代码示例>>Java>>正文


Java FileUpload类代码示例

本文整理汇总了Java中com.google.gwt.user.client.ui.FileUpload的典型用法代码示例。如果您正苦于以下问题:Java FileUpload类的具体用法?Java FileUpload怎么用?Java FileUpload使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


FileUpload类属于com.google.gwt.user.client.ui包,在下文中一共展示了FileUpload类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: FileInputButton

import com.google.gwt.user.client.ui.FileUpload; //导入依赖的package包/类
public FileInputButton() {
    wrapper = new Span();
    wrapper.addStyleName(Styles.BTN);
    upload = new FileUpload();

    upload.addChangeHandler(new ChangeHandler() {
        @Override
        public void onChange(ChangeEvent event) {
            fireChanged();
        }
    });

    wrapper.add(upload);
    wrapper.addStyleName("btn-file");
    initWidget(wrapper);
}
 
开发者ID:kiegroup,项目名称:appformer,代码行数:17,代码来源:FileInputButton.java

示例2: showDialog

import com.google.gwt.user.client.ui.FileUpload; //导入依赖的package包/类
/** {@inheritDoc} */
@Override
public void showDialog() {
  errorMessage.setText("");
  fileContent = null;
  fileUpload = new FileUpload();
  fileUpload.setHeight("22px");
  fileUpload.setWidth("100%");
  fileUpload.setName("file");
  fileUpload.ensureDebugId("import-from-config-ChooseFile");
  addHandler(fileUpload.getElement());

  fileUpload.addChangeHandler(event -> buttonImport.setEnabled(fileUpload.getFilename() != null));

  uploadForm.add(fileUpload);

  this.show();
}
 
开发者ID:eclipse,项目名称:che,代码行数:19,代码来源:ImportFromConfigViewImpl.java

示例3: FormatterPreferencePageViewImpl

import com.google.gwt.user.client.ui.FileUpload; //导入依赖的package包/类
@Inject
public FormatterPreferencePageViewImpl(
    FormatterPreferencePageViewImplUiBinder uiBinder,
    JavaLocalizationConstant localizationConstant) {
  widget = uiBinder.createAndBindUi(this);
  fileUpload = new FileUpload();
  radioButtonGroup = new RadioButtonGroup();
  targetPanel.add(radioButtonGroup);

  radioButtonGroup.addButton(
      localizationConstant.formatterPreferencesProjectLabel(),
      localizationConstant.formatterPreferencesProjectDescription(),
      null,
      event -> isWorkspace = false);

  radioButtonGroup.addButton(
      localizationConstant.formatterPreferencesWorkspaceLabel(),
      localizationConstant.formatterPreferencesWorkspaceDescription(),
      null,
      event -> isWorkspace = true);

  radioButtonGroup.selectButton(0);

  uploadForm.add(fileUpload);
  importButton.setEnabled(false);
}
 
开发者ID:eclipse,项目名称:che,代码行数:27,代码来源:FormatterPreferencePageViewImpl.java

示例4: selectFile

import com.google.gwt.user.client.ui.FileUpload; //导入依赖的package包/类
public static void selectFile(final Callback<JavaScriptObject, String> aCallback, String aFileTypes) {
	final FileUpload fu = new FileUpload();
	fu.getElement().getStyle().setPosition(Style.Position.ABSOLUTE);
	fu.setWidth("10px");
	fu.setHeight("10px");
	fu.getElement().getStyle().setLeft(-100, Style.Unit.PX);
	fu.getElement().getStyle().setTop(-100, Style.Unit.PX);
	fu.addChangeHandler(new ChangeHandler() {
		@Override
		public void onChange(ChangeEvent event) {
			Utils.JsObject jsFu = fu.getElement().cast();
			JavaScriptObject oFiles = jsFu.getJs("files");
			if (oFiles != null) {
				JsArray<JavaScriptObject> jsFiles = oFiles.cast();
				for (int i = 0; i < jsFiles.length(); i++) {
					try {
						aCallback.onSuccess(jsFiles.get(i));
					} catch (Exception ex) {
						Logger.getLogger(Utils.class.getName()).log(Level.SEVERE, null, ex);
					}
				}
			}
			fu.removeFromParent();
		}
	});
	RootPanel.get().add(fu, -100, -100);
	fu.click();
	Scheduler.get().scheduleFixedDelay(new Scheduler.RepeatingCommand() {
		@Override
		public boolean execute() {
			fu.removeFromParent();
			return false;
		}
	}, 1000 * 60 * 1);// 1 min
}
 
开发者ID:marat-gainullin,项目名称:platypus-js,代码行数:36,代码来源:JsUi.java

示例5: getValue

import com.google.gwt.user.client.ui.FileUpload; //导入依赖的package包/类
private static String getValue(FormPanel formPanel) {
	String value = null;
	
       if (formPanel instanceof HasWidgets) {
           HasWidgets hasWidgets = formPanel;
           Iterator<Widget> itr = hasWidgets.iterator();
           while (itr.hasNext()) {
               Widget widget = itr.next();
               if (widget instanceof Grid) {
                   Grid gridPanel = (Grid) widget;
                   FileUpload fileUpload = (FileUpload) gridPanel.getWidget(0, 0);
                   value = DOM.getElementAttribute(fileUpload.getElement(), "fu-uuid");
                   handleSimpleValue(formPanel, value);
               }
           }
       }
       
       return value;
}
 
开发者ID:qafedev,项目名称:qafe-platform,代码行数:20,代码来源:BuiltinHandlerHelper.java

示例6: showDialog

import com.google.gwt.user.client.ui.FileUpload; //导入依赖的package包/类
@Override
public void showDialog() {
    uploadFormVPanel.clear();
    certFile = new FileUpload();
    certFile.setHeight("22px");
    certFile.setWidth("100%");
    certFile.setName("certFile");
    certFile.addChangeHandler(new ChangeHandler() {
        @Override
        public void onChange(ChangeEvent event) {
            delegate.onFileNameChanged();
        }
    });
    uploadFormVPanel.add(certFile);

    this.show();
}
 
开发者ID:codenvy-legacy,项目名称:plugin-datasource,代码行数:18,代码来源:UploadSslTrustCertDialogViewImpl.java

示例7: execute

import com.google.gwt.user.client.ui.FileUpload; //导入依赖的package包/类
public void execute() {
	if (toolBarOption.addDocumentOption) {
		FileToUpload fileToUpload = new FileToUpload();
		fileToUpload.setFileUpload(new FileUpload());
		fileToUpload.setPath((String) Main.get().activeFolderTree.getActualPath());
		fileToUpload.setAction(UIFileUploadConstants.ACTION_INSERT);
		Main.get().fileUpload.addPendingFileToUpload(fileToUpload);
		Main.get().activeFolderTree.hideMenuPopup();
	}
}
 
开发者ID:openkm,项目名称:document-management-system,代码行数:11,代码来源:TaxonomyMenu.java

示例8: createFileUpload

import com.google.gwt.user.client.ui.FileUpload; //导入依赖的package包/类
private FileUpload createFileUpload() {
  fileUpload = new FileUpload();
  fileUpload.getElement().getStyle().setDisplay(Style.Display.NONE);

  if (fileTypes != null) {
    // Convert the format that the SWFUpload/Flash parameter expects to the W3C DOM standard
    // See: http://dev.w3.org/html5/spec/states-of-the-type-attribute.html#attr-input-accept
    fileUpload.getElement()
        .setAttribute("accept", this.fileTypes.replaceAll("\\;", ",").replaceAll("\\*\\.", "."));

    // TODO(jake): Need to consider validation of this in the file queued handler as well,
    // as the browsers don't appear to consistently support the "accept" attribute
  }

  final AbsolutePanel panel = this;

  fileUpload.addChangeHandler(new ChangeHandler() {
    public void onChange(ChangeEvent event) {

      JsArray<?> selectedFiles = nativeGetSelectedFiles(fileUpload.getElement());

      // Every time a file is selected replace the FileUpload component running in the DOM so that
      // the user can continue to attempt uploading the same file multiple times (otherwise the
      // "ChangeHandler" never fires)
      panel.remove(fileUpload);
      panel.add(createFileUpload());

      addFilesToQueue(selectedFiles);

    }
  });
  return fileUpload;
}
 
开发者ID:jiakuan,项目名称:gwt-uploader,代码行数:34,代码来源:Uploader.java

示例9: openFileDialog

import com.google.gwt.user.client.ui.FileUpload; //导入依赖的package包/类
private void openFileDialog(FileUpload fileUpload, boolean multipleFiles) {

    if (multipleFiles) {
      fileUpload.getElement().setAttribute("multiple", "true");
    } else {
      fileUpload.getElement().removeAttribute("multiple");
    }

    if (fileDialogStartHandler != null) {
      fileDialogStartHandler.onFileDialogStartEvent(new FileDialogStartEvent());
    }
    InputElement.as(fileUpload.getElement()).click();
  }
 
开发者ID:jiakuan,项目名称:gwt-uploader,代码行数:14,代码来源:Uploader.java

示例10: createFileUpload

import com.google.gwt.user.client.ui.FileUpload; //导入依赖的package包/类
private FileUpload createFileUpload() {
    // Create a FileUpload widget.
    FileUpload upload = new FileUpload();
    upload.setName("uploadFormElement");

    return upload;
}
 
开发者ID:Teiid-Designer,项目名称:teiid-webui,代码行数:8,代码来源:UploadDriverPanel.java

示例11: initSelectWorkflowFromFilePanel

import com.google.gwt.user.client.ui.FileUpload; //导入依赖的package包/类
private void initSelectWorkflowFromFilePanel() {
    fromFilePanel = new VLayout();
    fromFilePanel.setHeight("30px");

    fileUpload = new FileUpload();
    fileUpload.setName("job");

    VerticalPanel formContent = new VerticalPanel();
    formContent.setHeight("30px");

    Hidden hiddenField = new Hidden();
    hiddenField.setName(SESSION_ID_PARAMETER_NAME);
    hiddenField.setValue(LoginModel.getInstance().getSessionId());
    formContent.add(hiddenField);
    formContent.add(fileUpload);

    final FormPanel importFromFileformPanel = new FormPanel();
    importFromFileformPanel.setEncoding(FormPanel.ENCODING_MULTIPART);
    importFromFileformPanel.setMethod(FormPanel.METHOD_POST);
    importFromFileformPanel.setAction(URL_UPLOAD_FILE);
    importFromFileformPanel.add(formContent);
    importFromFileformPanel.addSubmitCompleteHandler(fileUploadCompleteHandler());
    importFromFileformPanel.setHeight("30px");
    fromFilePanel.addMember(importFromFileformPanel);

    sendFromFileButton = new Button("Upload file");
    sendFromFileButton.addClickHandler(clickHandlerForUploadFromFileButton(importFromFileformPanel));

}
 
开发者ID:ow2-proactive,项目名称:scheduling-portal,代码行数:30,代码来源:SubmitWindow.java

示例12: addFileUploadForm

import com.google.gwt.user.client.ui.FileUpload; //导入依赖的package包/类
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);
}
 
开发者ID:eclipse,项目名称:che,代码行数:16,代码来源:UploadFolderFromZipViewImpl.java

示例13: addFile

import com.google.gwt.user.client.ui.FileUpload; //导入依赖的package包/类
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);
}
 
开发者ID:eclipse,项目名称:che,代码行数:16,代码来源:UploadFileViewImpl.java

示例14: getFileNameShouldBeExecuted

import com.google.gwt.user.client.ui.FileUpload; //导入依赖的package包/类
@Test
public void getFileNameShouldBeExecuted() {
  view.file = mock(FileUpload.class);
  when(view.file.getFilename()).thenReturn("fileName");

  view.getFileName();

  verify(view.file).getFilename();
}
 
开发者ID:eclipse,项目名称:che,代码行数:10,代码来源:UploadFileViewImplTest.java

示例15: closeShouldBeExecuted

import com.google.gwt.user.client.ui.FileUpload; //导入依赖的package包/类
@Test
public void closeShouldBeExecuted() {
  view.uploadPanel = mock(FlowPanel.class);
  view.file = mock(FileUpload.class);
  view.overwrite = mock(CheckBox.class);
  view.btnUpload = mock(Button.class);

  view.closeDialog();

  verify(view.uploadPanel).remove((FileUpload) anyObject());
  verify(view.btnUpload).setEnabled(eq(false));
  verify(view.overwrite).setValue(eq(false));
}
 
开发者ID:eclipse,项目名称:che,代码行数:14,代码来源:UploadFileViewImplTest.java


注:本文中的com.google.gwt.user.client.ui.FileUpload类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。