List of usage examples for com.google.gwt.user.client.ui FormPanel ENCODING_MULTIPART
String ENCODING_MULTIPART
To view the source code for com.google.gwt.user.client.ui FormPanel ENCODING_MULTIPART.
Click Source Link
From source file:burrito.client.widgets.blobstore.BlobStoreUploader.java
License:Apache License
public BlobStoreUploader(Integer requiredWidth, Integer requiredHeight, final AsyncCallback<String> callback) { FlowPanel inner = new FlowPanel(); inner.add(file);/* ww w . j a v a 2 s . c o m*/ file.setName("file"); file.addChangeHandler(new ChangeHandler() { @Override public void onChange(ChangeEvent event) { getUploadURLAndPost(); } }); form.setEncoding(FormPanel.ENCODING_MULTIPART); form.setMethod(FormPanel.METHOD_POST); if (requiredWidth != null) { inner.add(new Hidden("width", String.valueOf(requiredWidth))); } if (requiredHeight != null) { inner.add(new Hidden("height", String.valueOf(requiredHeight))); } form.addSubmitHandler(new SubmitHandler() { @Override public void onSubmit(SubmitEvent event) { file.setVisible(false); progress.setVisible(true); } }); form.addSubmitCompleteHandler(new SubmitCompleteHandler() { @Override public void onSubmitComplete(SubmitCompleteEvent event) { file.setVisible(true); progress.setVisible(false); String results = event.getResults().replaceAll("<.*?>", ""); // sometime, <pre> tags are added by the browser if (results.contains("OK#")) { String blobStoreKey = results.replace("OK#", ""); callback.onSuccess(blobStoreKey); } else { Window.alert(results); callback.onFailure(new RuntimeException("Failure response from server")); } } }); progress.setVisible(false); inner.add(progress); form.add(inner); initWidget(form); }
From source file:com.anritsu.mcreleaseportal.client.UploadFile.java
public UploadFile() { initWidget(uiBinder.createAndBindUi(this)); getService().enableChangesXMLUpload(enableChangesXMLUploadCallback); serviceDescription.setIcon(IconType.INFO_CIRCLE); serviceDescription.addClickHandler(new ClickHandler() { @Override// w w w . j ava 2 s .co m public void onClick(ClickEvent event) { getService().getSchemaLink(getSchemaLinkCallback); serviceDescriptionModal.show(); } }); confirmMCPackageInfoUpdate.addHideHandler(new ModalHideHandler() { public void onHide(ModalHideEvent evt) { loadingGif.setVisible(false); hPanel.setVisible(true); mcPackageInfoPanel.setVisible(true); mcPackageDependencyInfo.setVisible(true); } }); selectFile.addClickHandler(new ClickHandler() { @Override public void onClick(ClickEvent event) { mcPackageInfoPanel.setVisible(false); mcPackageDependencyInfo.setVisible(false); submitFileUpload.setEnabled(false); fileUpload.click(); } }); fileUpload.addChangeHandler(new ChangeHandler() { @Override public void onChange(ChangeEvent event) { if (fileUpload.getFilename().contains("xml")) { fileUploadFormPanel.setEncoding(FormPanel.ENCODING_MULTIPART); fileUploadFormPanel.setMethod(FormPanel.METHOD_POST); fileUploadFormPanel.setAction(GWT.getModuleBaseURL() + "fileupload"); fileUploadFormPanel.submit(); hPanel.setVisible(false); loadingGif.setVisible(true); } else { Notify.notify("", "Wrong file type selected!", IconType.THUMBS_DOWN, NotifyType.INFO); } } }); fileUploadFormPanel.addSubmitCompleteHandler(new FormPanel.SubmitCompleteHandler() { @Override public void onSubmitComplete(FormPanel.SubmitCompleteEvent event) { fileUploadFormPanel.reset(); hPanel.setVisible(true); loadingGif.setVisible(false); getService().validateChangesXML(validateChangesXMLAsyncCallback); } }); submitFileUpload.addClickHandler(new ClickHandler() { @Override public void onClick(ClickEvent event) { hPanel.setVisible(false); loadingGif.setVisible(true); mcPackageInfoPanel.setVisible(false); mcPackageDependencyInfo.setVisible(false); getService().isMCPackagePresentInDB(isMCPackagePresentInDBCallback); } }); updateMCPackageInfo.addClickHandler(new ClickHandler() { @Override public void onClick(ClickEvent event) { updateMCPackageInfo.setText("Inserting data to DB..."); closeOverwriteConfirmation.setVisible(false); updateMCPackageInfo.setEnabled(false); getService().addMCPackageToDB(addMCPackageToDBCallback); } }); }
From source file:com.audata.client.checkout.CheckinDialog.java
License:Open Source License
public CheckinDialog(String uuid, String name) { this.uuid = uuid; this.name = name; this.setText(LANG.check_in_msg_Text() + ": " + this.name); VerticalPanel main = new VerticalPanel(); main.setSize("100%", "100%"); main.setSpacing(3);//w w w.j a v a2 s. c o m main.setHorizontalAlignment(HasAlignment.ALIGN_LEFT); this.undo = new RadioButton("ActionGroup", LANG.check_in_Text()); this.checkin = new RadioButton("ActionGroup", LANG.check_in_version_Text()); this.undo.setChecked(true); this.undo.addClickListener(this); this.checkin.addClickListener(this); main.add(this.undo); main.add(this.checkin); this.upload = new UploadPanel(); String url = AuDoc.jsonCall.getURL(); this.upload.setAction(url + "docIO.php"); this.upload.setEncoding(FormPanel.ENCODING_MULTIPART); this.upload.setMethod(FormPanel.METHOD_POST); this.upload.setVisible(false); main.add(upload); HorizontalPanel buttons = new HorizontalPanel(); buttons.setSpacing(3); this.ok = new Button(LANG.ok_Text()); this.ok.addClickListener(this); buttons.add(this.ok); this.cancel = new Button(LANG.cancel_Text()); this.cancel.addClickListener(this); buttons.add(this.cancel); main.add(buttons); main.setCellHorizontalAlignment(buttons, HasAlignment.ALIGN_RIGHT); this.setWidget(main); }
From source file:com.audata.client.newRecord.Metadata.java
License:Open Source License
public void onShow(Wizard parent) { this.upload = new UploadPanel(); String url = AuDoc.jsonCall.getURL(); this.upload.setAction(url + "docIO.php"); this.upload.setEncoding(FormPanel.ENCODING_MULTIPART); this.upload.setMethod(FormPanel.METHOD_POST); this.fields.clear(); this.addFields(); HashMap v = parent.getValues(); ArrayList a = (ArrayList) v.get("udfields"); this.rTypeName = (String) v.get("typename"); this.fields.addAll(a); this.paintFields(); }
From source file:com.audata.client.record.RecordProperties.java
License:Open Source License
public RecordProperties(RecordPropertiesDialog parent, String cot) { this.parent = parent; this.cot = cot; this.main = new VerticalPanel(); this.main.setSpacing(3); this.title = new Label(LANG.record_props_Text()); this.title.addStyleName("audoc-subsection"); //prepare upload panel this.upload = new UploadPanel(); String url = AuDoc.jsonCall.getURL(); this.upload.setAction(url + "docIO.php"); this.upload.setEncoding(FormPanel.ENCODING_MULTIPART); this.upload.setMethod(FormPanel.METHOD_POST); //load default fields this.initWidget(this.main); }
From source file:com.codenvy.ide.client.wizard.project.imports.ImportFileViewImpl.java
License:Apache License
/** {@inheritDoc} */ @Override/*from www. jav a2s . co m*/ public void showDialog() { uploadForm.setEncoding(FormPanel.ENCODING_MULTIPART); uploadForm.setMethod(FormPanel.METHOD_POST); VerticalPanel panel = new VerticalPanel(); uploadForm.setWidget(panel); file = new FileUpload(); file.setName("ImportFile"); file.setHeight("26px"); file.setWidth("100%"); file.addChangeHandler(new ChangeHandler() { @Override public void onChange(ChangeEvent changeEvent) { if (!file.getFilename().endsWith(".dbs")) { delegate.onFileNameChangedWithInvalidFormat(); } else { delegate.onFileNameChanged(); } } }); panel.add(file); this.center(); this.show(); }
From source file:com.dawg6.web.dhcalc.client.SavePanel.java
License:Open Source License
public SavePanel() { CaptionPanel captionPanel = new CaptionPanel("Save/Load"); initWidget(captionPanel);/* ww w . j a v a2 s .co m*/ FlexTable flexTable_3 = new FlexTable(); flexTable_3.setCellPadding(2); captionPanel.setContentWidget(flexTable_3); tabPanel = new TabPanel(); flexTable_3.setWidget(0, 0, tabPanel); browserPanel = new FlexTable(); browserPanel.setCellPadding(2); if (Storage.isLocalStorageSupported()) { tabPanel.add(browserPanel, "Browser Storage", false); } storageList = new ListBox(); browserPanel.setWidget(0, 0, storageList); storageList.setWidth("100%"); storageList.setVisibleItemCount(5); nameField = new TextBox(); nameField.setVisibleLength(30); nameField.setText("Enter a Name"); browserPanel.setWidget(1, 0, nameField); Button btnNewButton = new Button("New button"); browserPanel.setWidget(1, 1, btnNewButton); btnNewButton.setText("Add"); btnNewButton.addClickHandler(new ClickHandler() { @Override public void onClick(ClickEvent event) { addLocalStorage(); } }); HorizontalPanel horizontalPanel = new HorizontalPanel(); horizontalPanel.setSpacing(5); horizontalPanel.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_CENTER); browserPanel.setWidget(2, 0, horizontalPanel); Button button_6 = new Button("New button"); button_6.setText("Save"); horizontalPanel.add(button_6); button_6.addClickHandler(new ClickHandler() { @Override public void onClick(ClickEvent event) { saveLocalStorage(); } }); Button button_5 = new Button("New button"); horizontalPanel.add(button_5); button_5.setText("Restore"); button_5.addClickHandler(new ClickHandler() { @Override public void onClick(ClickEvent event) { restoreLocalStorage(); } }); Button button_2 = new Button("New button"); horizontalPanel.add(button_2); button_2.setText("Delete"); button_2.addClickHandler(new ClickHandler() { @Override public void onClick(ClickEvent event) { deleteLocalStorage(); } }); Button btnNewButton_1 = new Button("New button"); horizontalPanel.add(btnNewButton_1); btnNewButton_1.setText("Rename"); btnNewButton_1.addClickHandler(new ClickHandler() { @Override public void onClick(ClickEvent event) { renameLocalStorage(); } }); browserPanel.getFlexCellFormatter().setColSpan(0, 0, 1); browserPanel.getFlexCellFormatter().setColSpan(2, 0, 1); browserPanel.getFlexCellFormatter().setColSpan(0, 0, 2); browserPanel.getFlexCellFormatter().setColSpan(2, 0, 2); browserPanel.getCellFormatter().setHorizontalAlignment(2, 0, HasHorizontalAlignment.ALIGN_CENTER); filePanel = new FlexTable(); filePanel.setCellPadding(2); tabPanel.add(filePanel, "Local File", false); HorizontalPanel horizontalPanel_1 = new HorizontalPanel(); filePanel.setWidget(0, 0, horizontalPanel_1); loadPanel = new FormPanel(); loadPanel.setMethod(FormPanel.METHOD_POST); loadPanel.setEncoding(FormPanel.ENCODING_MULTIPART); loadPanel.setAction("loadData"); horizontalPanel_1.add(loadPanel); HorizontalPanel horizontalPanel_2 = new HorizontalPanel(); loadPanel.setWidget(horizontalPanel_2); horizontalPanel_2.setSize("100%", "100%"); fileUpload = new FileUpload(); fileUpload.setName("file"); horizontalPanel_2.add(fileUpload); clientKey = new Hidden("client"); horizontalPanel_2.add(clientKey); filePanel.getFlexCellFormatter().setColSpan(0, 0, 1); Button button = new Button("Save Data..."); filePanel.setWidget(1, 0, button); button.setText("Save File"); Button button_1 = new Button("Load Data..."); filePanel.setWidget(1, 1, button_1); button_1.setText("Load File"); filePanel.getFlexCellFormatter().setColSpan(0, 0, 2); filePanel.getCellFormatter().setHorizontalAlignment(1, 0, HasHorizontalAlignment.ALIGN_CENTER); filePanel.getCellFormatter().setHorizontalAlignment(1, 1, HasHorizontalAlignment.ALIGN_CENTER); button_1.addClickHandler(new ClickHandler() { @Override public void onClick(ClickEvent event) { loadFile(); } }); button.addClickHandler(new ClickHandler() { @Override public void onClick(ClickEvent event) { saveFile(); } }); textPanel = new FlexTable(); textPanel.setCellPadding(2); tabPanel.add(textPanel, "Copy/Paste", false); textArea = new TextArea(); textArea.setText( "Paste previously saved form data here and click \"Restore.\" Or press \"Current\" to paste current Form data."); textArea.setVisibleLines(5); textPanel.setWidget(0, 0, textArea); textArea.setSize("100%", ""); Button button_3 = new Button("Save Data..."); button_3.setText("Current"); textPanel.setWidget(1, 0, button_3); textArea.addClickHandler(new ClickHandler() { @Override public void onClick(ClickEvent event) { textArea.selectAll(); } }); nameField.addClickHandler(new ClickHandler() { @Override public void onClick(ClickEvent event) { nameField.selectAll(); } }); button_3.addClickHandler(new ClickHandler() { @Override public void onClick(ClickEvent event) { if (listener != null) { FormData data = listener.getFormData(); JSONObject obj = JsonUtil.toJSONObject(data); textArea.setText(JsonUtil.formatJsonText(obj.toString())); textArea.selectAll(); } } }); Button button_4 = new Button("Load Data..."); button_4.setText("Restore"); button_4.addClickHandler(new ClickHandler() { @Override public void onClick(ClickEvent event) { if (listener != null) { String text = textArea.getText(); FormData data = JsonUtil.parseFormData(text); listener.setFormData(data); textArea.setText(""); } } }); textPanel.setWidget(1, 1, button_4); textPanel.getFlexCellFormatter().setColSpan(0, 0, 2); textPanel.getCellFormatter().setHorizontalAlignment(1, 0, HasHorizontalAlignment.ALIGN_CENTER); textPanel.getCellFormatter().setHorizontalAlignment(1, 1, HasHorizontalAlignment.ALIGN_CENTER); flexTable_3.getFlexCellFormatter().setColSpan(0, 0, 1); storageList.addChangeHandler(new ChangeHandler() { @Override public void onChange(ChangeEvent event) { int i = storageList.getSelectedIndex(); if (i >= 0) { String name = storageList.getItemText(i); if (name != null) nameField.setText(name); } } }); }
From source file:com.dimdim.conference.ui.resources.client.SelectOnlyFileDialog.java
License:Open Source License
protected Widget getContent() { VerticalPanel contentPanel = new VerticalPanel(); contentPanel.setStyleName("powerpoint-info-text"); //Label comment1 = new Label(ResourceGlobals.getResourceGlobals().getSelectFileComment1().replaceAll("file",this.docType)); Label comment1 = new Label(ResourceGlobals.getResourceGlobals().getSelectFileComment1()); comment1.setStyleName("change-photo-picture-caption"); comment1.addStyleName("common-text"); comment1.addStyleName("common-4px-top-bottom-spacing"); comment1.setWordWrap(true);/*from ww w .j a v a 2 s . c o m*/ // comment1.setWidth("200px"); // comment1.setWidth("250px"); contentPanel.add(comment1); contentPanel.add(new HTML(" ")); this.selectFileForm = new FormPanel(); this.selectFileForm.setAction(this.commandURLFactory.getPhotoUploadURL()); this.selectFileForm.setEncoding(FormPanel.ENCODING_MULTIPART); this.selectFileForm.setMethod(FormPanel.METHOD_POST); this.existingFileField = new FileUpload(); this.existingFileField.setName("photo"); this.selectFileForm.add(this.existingFileField); this.existingFileField.setStyleName("photo-file-upload-field"); contentPanel.add(this.selectFileForm); contentPanel.add(new HTML(" ")); this.errorMessage.setStyleName("common-text"); contentPanel.add(this.errorMessage); return contentPanel; }
From source file:com.dimdim.conference.ui.user.client.ChangePictureDialog.java
License:Open Source License
protected Widget getContent() { VerticalPanel contentPanel = new VerticalPanel(); contentPanel.setStyleName("change-photo-content-panel"); String defaultPhotoUrl = UserGlobals.getUserGlobals().getDefaultPhotoUrl(); String currentPhotoUrl = this.me.getPhotoUrl(); //Window.alert("inside chage picture"); this.defaultPhotoButton = new RadioButton("PhotoSelection"); this.defaultPhotoButton.addClickListener(this); this.defaultPhotoButton.setStyleName("change-photo-radio-button"); this.customPhotoButton = new RadioButton("PhotoSelection"); this.customPhotoButton.addClickListener(this); this.customPhotoButton.setStyleName("change-photo-radio-button"); // Custom Photo caption Label comment1 = new Label(UserGlobals.getUserGlobals().getChangePictureComment1()); comment1.setStyleName("change-photo-picture-caption"); comment1.addStyleName("common-text"); contentPanel.add(comment1);//from w ww . ja v a 2 s .c o m Label comment2 = new Label(UserGlobals.getUserGlobals().getChangePictureComment2()); comment2.setStyleName("change-photo-picture-caption"); comment2.addStyleName("common-text"); contentPanel.add(comment2); HorizontalPanel customPhotoCaption = new HorizontalPanel(); customPhotoCaption.setStyleName("change-photo-picture-caption"); customPhotoCaption.add(this.customPhotoButton); Label label2 = new Label(UIStrings.getChangePhotoLabel()); label2.setStyleName("common-text"); label2.addStyleName("change-photo-label"); customPhotoCaption.add(label2); // HorizontalPanel uploadCaption = new HorizontalPanel(); // uploadCaption.setStyleName("change-photo-picture-caption"); // this.uploadLink = new Label("Upload"); // this.uploadLink.addClickListener(this); // this.uploadLink.setStyleName("common-text"); // this.uploadLink.addStyleName("change-photo-upload-label"); // this.uploadLink.addStyleName("common-anchor"); // uploadCaption.add(this.uploadLink); // Create a form panel for the photo file upload. this.photoUploadForm = new FormPanel(); this.photoUploadForm.setAction(this.commandURLFactory.getPhotoUploadURL()); this.photoUploadForm.setEncoding(FormPanel.ENCODING_MULTIPART); this.photoUploadForm.setMethod(FormPanel.METHOD_POST); this.photoUploadField = new FileUpload(); this.photoUploadField.setName("photo"); this.photoUploadForm.add(this.photoUploadField); this.photoUploadField.setStyleName("photo-file-upload-field"); contentPanel.add(customPhotoCaption); contentPanel.add(this.photoUploadForm); // contentPanel.add(uploadCaption); // Default Photo Caption HorizontalPanel defaultPhotoCaption = new HorizontalPanel(); defaultPhotoCaption.setStyleName("change-photo-picture-caption"); defaultPhotoCaption.add(this.defaultPhotoButton); Label label1 = new Label(UIStrings.getUseDefaultPhotoLabel()); label1.setStyleName("common-text"); label1.addStyleName("change-photo-label"); defaultPhotoCaption.add(label1); if (UserGlobals.getUserGlobals().isPhotoUrlDefault(currentPhotoUrl)) { this.defaultPhotoButton.setChecked(true); this.customPhotoButton.setChecked(false); } else { this.defaultPhotoButton.setChecked(false); this.customPhotoButton.setChecked(true); } contentPanel.add(defaultPhotoCaption); // Photo Panel if (currentPhotoUrl == null || currentPhotoUrl.length() == 0) { currentPhotoUrl = defaultPhotoUrl; } Image photoImage = new Image(currentPhotoUrl); photoImage.setStyleName("change-photo-picture"); contentPanel.add(photoImage); contentPanel.setCellVerticalAlignment(photoImage, VerticalPanel.ALIGN_MIDDLE); contentPanel.setCellHorizontalAlignment(photoImage, HorizontalPanel.ALIGN_LEFT); // this.photoUploadField.setVisible(false); // this.uploadLink.setVisible(false); return contentPanel; }
From source file:com.edgenius.wiki.gwt.client.space.SpaceLogoForm.java
License:Open Source License
public SpaceLogoForm() { final FormPanel form = new FormPanel(); form.setAction(GwtClientUtils.getBaseUrl() + "space/logo.do"); form.setMethod(FormPanel.METHOD_POST); form.setEncoding(FormPanel.ENCODING_MULTIPART); form.addSubmitHandler(this); form.addSubmitCompleteHandler(this); VerticalPanel panel = new VerticalPanel(); panel.add(message);/*from w w w . ja v a2 s . c o m*/ panel.add(spaceUname); HorizontalPanel h1 = new HorizontalPanel(); Label uploadLabel = new Label(Msg.consts.logo()); uploadLabel.setStyleName(Css.FORM_LABEL); FileUpload upload = new FileUpload(); upload.setName("file"); h1.add(uploadLabel); h1.add(upload); panel.add(h1); form.setWidget(panel); // Button update = new Button(Msg.consts.update()); update.addClickHandler(new ClickHandler() { public void onClick(ClickEvent event) { form.submit(); } }); Button cancel = new Button(Msg.consts.cancel()); cancel.addClickHandler(new ClickHandler() { public void onClick(ClickEvent event) { //return to link panel for (Iterator<SpaceUpdateListener> iter = listener.iterator(); iter.hasNext();) { iter.next().spaceUpdateCancelled(); } } }); ButtonBar btnBar = new ButtonBar(); btnBar.add(update); btnBar.add(cancel); VerticalPanel main = new VerticalPanel(); main.add(form); main.add(btnBar); setWidget(main); }