本文整理汇总了Java中com.google.gwt.user.client.ui.FileUpload.setName方法的典型用法代码示例。如果您正苦于以下问题:Java FileUpload.setName方法的具体用法?Java FileUpload.setName怎么用?Java FileUpload.setName使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.google.gwt.user.client.ui.FileUpload
的用法示例。
在下文中一共展示了FileUpload.setName方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: 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();
}
示例2: 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();
}
示例3: 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;
}
示例4: 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));
}
示例5: 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);
}
示例6: 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);
}
示例7: KeystoreUploadWizard
import com.google.gwt.user.client.ui.FileUpload; //导入方法依赖的package包/类
/**
* Creates a new keystore upload wizard.
*/
public KeystoreUploadWizard(final Command callbackAfterUpload) {
super(MESSAGES.keystoreUploadWizardCaption(), true, false);
// Initialize UI
final FileUpload upload = new FileUpload();
upload.setName(ServerLayout.UPLOAD_USERFILE_FORM_ELEMENT);
setStylePrimaryName("ode-DialogBox");
VerticalPanel panel = new VerticalPanel();
panel.setVerticalAlignment(VerticalPanel.ALIGN_MIDDLE);
panel.add(upload);
addPage(panel);
// Create finish command (upload a keystore)
initFinishCommand(new Command() {
@Override
public void execute() {
String filename = upload.getFilename();
if (filename.endsWith(KEYSTORE_EXTENSION)) {
String uploadUrl = GWT.getModuleBaseURL() + ServerLayout.UPLOAD_SERVLET + "/" +
ServerLayout.UPLOAD_USERFILE + "/" + StorageUtil.ANDROID_KEYSTORE_FILENAME;
Uploader.getInstance().upload(upload, uploadUrl,
new OdeAsyncCallback<UploadResponse>(
// failure message
MESSAGES.keystoreUploadError()) {
@Override
public void onSuccess(UploadResponse uploadResponse) {
switch (uploadResponse.getStatus()) {
case SUCCESS:
if (callbackAfterUpload != null) {
callbackAfterUpload.execute();
}
break;
default:
ErrorReporter.reportError(MESSAGES.keystoreUploadError());
break;
}
}
});
} else {
Window.alert(MESSAGES.notKeystoreError());
center();
}
}
});
}
示例8: ProjectUploadWizard
import com.google.gwt.user.client.ui.FileUpload; //导入方法依赖的package包/类
/**
* Creates a new project upload wizard.
*/
public ProjectUploadWizard() {
super(MESSAGES.projectUploadWizardCaption(), true, false);
// Initialize UI
final FileUpload upload = new FileUpload();
upload.setName(ServerLayout.UPLOAD_PROJECT_ARCHIVE_FORM_ELEMENT);
setStylePrimaryName("ode-DialogBox");
VerticalPanel panel = new VerticalPanel();
panel.setVerticalAlignment(VerticalPanel.ALIGN_MIDDLE);
panel.add(upload);
addPage(panel);
// Create finish command (upload a project archive)
initFinishCommand(new Command() {
@Override
public void execute() {
String filename = upload.getFilename();
if (filename.endsWith(PROJECT_ARCHIVE_EXTENSION)) {
// Strip extension and leading path off filename. We need to support both Unix ('/') and
// Windows ('\\') path separators. File.pathSeparator is not available in GWT.
filename = filename.substring(0, filename.length() - PROJECT_ARCHIVE_EXTENSION.length()).
substring(Math.max(filename.lastIndexOf('/'), filename.lastIndexOf('\\')) + 1);
// Make sure the project name is legal and unique.
if (!TextValidators.checkNewProjectName(filename)) {
return;
}
String uploadUrl = GWT.getModuleBaseURL() + ServerLayout.UPLOAD_SERVLET + "/" +
ServerLayout.UPLOAD_PROJECT + "/" + filename;
Uploader.getInstance().upload(upload, uploadUrl,
new OdeAsyncCallback<UploadResponse>(
// failure message
MESSAGES.projectUploadError()) {
@Override
public void onSuccess(UploadResponse uploadResponse) {
switch (uploadResponse.getStatus()) {
case SUCCESS:
String info = uploadResponse.getInfo();
UserProject userProject = UserProject.valueOf(info);
Ode ode = Ode.getInstance();
Project uploadedProject = ode.getProjectManager().addProject(userProject);
ode.openYoungAndroidProjectInDesigner(uploadedProject);
break;
case NOT_PROJECT_ARCHIVE:
// This may be a "severe" error; but in the
// interest of reducing the number of red errors, the
// line has been changed to report info not an error.
// This error is triggered when the user attempts to
// upload a zip file that is not a project.
ErrorReporter.reportInfo(MESSAGES.notProjectArchiveError());
break;
default:
ErrorReporter.reportError(MESSAGES.projectUploadError());
break;
}
}
});
} else {
Window.alert(MESSAGES.notProjectArchiveError());
center();
}
}
});
}
示例9: createFileUpload
import com.google.gwt.user.client.ui.FileUpload; //导入方法依赖的package包/类
private FileUpload createFileUpload() {
FileUpload upload = new FileUpload();
upload.setName(ServerLayout.UPLOAD_COMPONENT_ARCHIVE_FORM_ELEMENT);
return upload;
}
示例10: ComponentUploadWizard
import com.google.gwt.user.client.ui.FileUpload; //导入方法依赖的package包/类
public ComponentUploadWizard() {
super(MESSAGES.componentUploadWizardCaption(), true, false);
final FileUpload uploadWiget = new FileUpload();
uploadWiget.setName(ServerLayout.UPLOAD_COMPONENT_ARCHIVE_FORM_ELEMENT);
VerticalPanel panel = new VerticalPanel();
panel.setVerticalAlignment(VerticalPanel.ALIGN_MIDDLE);
panel.add(uploadWiget);
addPage(panel);
setStylePrimaryName("ode-DialogBox");
initFinishCommand(new Command() {
@Override
public void execute() {
if (!uploadWiget.getFilename().endsWith(COMPONENT_ARCHIVE_EXTENSION)) {
Window.alert(MESSAGES.notComponentArchiveError());
return;
}
String url = GWT.getModuleBaseURL() +
ServerLayout.UPLOAD_SERVLET + "/" +
ServerLayout.UPLOAD_COMPONENT + "/" +
trimLeadingPath(uploadWiget.getFilename());
Uploader.getInstance().upload(uploadWiget, url,
new OdeAsyncCallback<UploadResponse>() {
@Override
public void onSuccess(UploadResponse uploadResponse) {
Component component = Component.valueOf(uploadResponse.getInfo());
ErrorReporter.reportInfo("Uploaded successfully");
}
});
}
private String trimLeadingPath(String filename) {
// Strip leading path off filename.
// We need to support both Unix ('/') and Windows ('\\') separators.
return filename.substring(Math.max(filename.lastIndexOf('/'), filename.lastIndexOf('\\')) + 1);
}
});
}