List of usage examples for com.google.gwt.user.client.ui FileUpload setName
public void setName(String name)
From source file:org.drools.guvnor.client.packages.NewSubPackageWizard.java
License:Apache License
public static Widget newImportWidget(final Command afterCreatedEvent, final FormStylePopup parent) { final FormPanel uploadFormPanel = new FormPanel(); uploadFormPanel.setAction(GWT.getModuleBaseURL() + "package"); uploadFormPanel.setEncoding(FormPanel.ENCODING_MULTIPART); uploadFormPanel.setMethod(FormPanel.METHOD_POST); HorizontalPanel panel = new HorizontalPanel(); uploadFormPanel.setWidget(panel);/* w ww. jav a 2s. co m*/ final FileUpload upload = new FileUpload(); upload.setName(HTMLFileManagerFields.CLASSIC_DRL_IMPORT); panel.add(upload); panel.add(new Label(constants.upload())); ImageButton ok = new ImageButton(images.upload(), constants.Import()); ClickHandler okClickHandler = new ClickHandler() { public void onClick(ClickEvent event) { if (Window.confirm(constants.ImportMergeWarning())) { LoadingPopup.showMessage(constants.ImportingDRLPleaseWait()); uploadFormPanel.submit(); } } }; ok.addClickHandler(okClickHandler); panel.add(ok); final FormStylePopup packageNamePopup = new FormStylePopup(images.packageLarge(), constants.PackageName()); HorizontalPanel packageNamePanel = new HorizontalPanel(); packageNamePopup.addRow(new Label(constants.ImportedDRLContainsNoNameForThePackage())); final TextBox packageName = new TextBox(); packageNamePanel.add(new Label(constants.PackageName() + ":")); packageNamePanel.add(packageName); Button uploadWithNameButton = new Button(constants.OK()); uploadWithNameButton.addClickHandler(okClickHandler); packageNamePanel.add(uploadWithNameButton); packageNamePopup.addRow(packageNamePanel); uploadFormPanel.addSubmitCompleteHandler(new SubmitCompleteHandler() { public void onSubmitComplete(SubmitCompleteEvent event) { if (event.getResults().indexOf("OK") > -1) { //NON-NLS Window.alert(constants.PackageWasImportedSuccessfully()); afterCreatedEvent.execute(); parent.hide(); if (packageNamePopup != null) { packageNamePopup.hide(); } } else if (event.getResults().indexOf("Missing package name.") > -1) { //NON-NLS LoadingPopup.close(); packageNamePopup.show(); } else { ErrorPopup.showMessage( Format.format(constants.UnableToImportIntoThePackage0(), event.getResults())); } LoadingPopup.close(); } }); uploadFormPanel.addSubmitHandler(new SubmitHandler() { public void onSubmit(SubmitEvent event) { if (upload.getFilename().length() == 0) { Window.alert(constants.YouDidNotChooseADrlFileToImport()); event.cancel(); } else if (!upload.getFilename().endsWith(".drl")) { //NON-NLS Window.alert(constants.YouCanOnlyImportDrlFiles()); event.cancel(); } else if (packageName.getText() != null && !packageName.getText().equals("")) { uploadFormPanel .setAction(uploadFormPanel.getAction() + "?packageName=" + packageName.getText()); } } }); return uploadFormPanel; }
From source file:org.ebayopensource.turmeric.policy.adminui.client.view.common.FileUploaderWidget.java
License:Open Source License
/** * Gets the file uploader widget./*from ww w .j a v a 2 s .c om*/ * * @param form * the form * @param entity * the entity * @return the file uploader widget */ public static Widget getFileUploaderWidget(final FormPanel form, final String entity) { VerticalPanel holder = new VerticalPanel(); final FileUpload fu = new FileUpload(); fu.setName("upload"); holder.add(fu); holder.add(new Button(PolicyAdminUIUtil.policyAdminConstants.importAction(), new ClickHandler() { public void onClick(ClickEvent event) { if (!fu.getFilename().isEmpty() && Window.confirm(PolicyAdminUIUtil.policyAdminConstants.importAction() + " " + entity + PolicyAdminUIUtil.policyAdminConstants.from() + " " + fu.getFilename() + "?")) { form.submit(); } } })); form.addSubmitHandler(new FormPanel.SubmitHandler() { public void onSubmit(SubmitEvent event) { } }); form.addSubmitCompleteHandler(new FormPanel.SubmitCompleteHandler() { public void onSubmitComplete(SubmitCompleteEvent event) { int indexFrom = event.getResults().indexOf("<pre>") + 5; int indexTo = event.getResults().indexOf("</pre>"); if (indexTo - indexFrom > 1) { Window.alert(event.getResults().substring(indexFrom, indexTo)); } else { Window.alert(PolicyAdminUIUtil.policyAdminMessages.successfulOperationMessage()); } } }); form.add(holder); return form; }
From source file:org.eurekastreams.web.client.ui.common.form.elements.avatar.AvatarUploadFormElement.java
License:Apache License
/** * Create an avatar upload form element. * /*from w w w .j ava2 s . c om*/ * @param label * the label of the element. * @param desc * the description. * @param servletPath * the path to hit to upload the image * @param inProcessor * the processor. * @param inStrategy * the strategy. */ public AvatarUploadFormElement(final String label, final String desc, final String servletPath, final ActionProcessor inProcessor, final ImageUploadStrategy inStrategy) { description = desc; strategy = inStrategy; Boolean resizeable = strategy.isResizable(); errorBox = new FlowPanel(); errorBox.addStyleName(StaticResourceBundle.INSTANCE.coreCss().formErrorBox()); errorBox.add(new Label("There was an error uploading your image. Please be sure " + "that your photo is under 4MB and is a PNG, JPG, or GIF.")); errorBox.setVisible(false); this.addStyleName(StaticResourceBundle.INSTANCE.coreCss().formAvatarUpload()); this.addStyleName(StaticResourceBundle.INSTANCE.coreCss().formElement()); processor = inProcessor; // AvatarEntity Entity = inEntity; uploadForm.setAction(servletPath); uploadForm.setEncoding(FormPanel.ENCODING_MULTIPART); uploadForm.setMethod(FormPanel.METHOD_POST); Label photoLabel = new Label(label); photoLabel.addStyleName(StaticResourceBundle.INSTANCE.coreCss().formLabel()); panel.add(photoLabel); FlowPanel avatarModificationPanel = new FlowPanel(); avatarModificationPanel.addStyleName(StaticResourceBundle.INSTANCE.coreCss().avatarModificationPanel()); avatarContainer.addStyleName(StaticResourceBundle.INSTANCE.coreCss().avatarContainer()); avatarModificationPanel.add(avatarContainer); FlowPanel photoButtonPanel = new FlowPanel(); photoButtonPanel.addStyleName(StaticResourceBundle.INSTANCE.coreCss().formPhotoButtonPanel()); if (resizeable) { editButton = new Anchor("Resize"); editButton.addStyleName(StaticResourceBundle.INSTANCE.coreCss().formResizeButton()); editButton.addStyleName(StaticResourceBundle.INSTANCE.coreCss().formButton()); photoButtonPanel.add(editButton); } deleteButton = new Anchor("Delete"); deleteButton.addStyleName(StaticResourceBundle.INSTANCE.coreCss().formDeleteButton()); deleteButton.addStyleName(StaticResourceBundle.INSTANCE.coreCss().formButton()); photoButtonPanel.add(deleteButton); avatarModificationPanel.add(photoButtonPanel); panel.add(avatarModificationPanel); FlowPanel uploadPanel = new FlowPanel(); uploadPanel.addStyleName(StaticResourceBundle.INSTANCE.coreCss().formUploadPanel()); uploadPanel.add(errorBox); // Wrapping the FileUpload because otherwise IE7 shifts it way // to the right. I couldn't figure out why, // but for whatever reason, this works. FlowPanel fileUploadWrapper = new FlowPanel(); FileUpload upload = new FileUpload(); upload.setName("imageUploadFormElement"); upload.addStyleName(StaticResourceBundle.INSTANCE.coreCss().formAvatarUpload()); fileUploadWrapper.add(upload); uploadPanel.add(fileUploadWrapper); uploadPanel.add(new Label(description)); Anchor submitButton = new Anchor(""); submitButton.addStyleName(StaticResourceBundle.INSTANCE.coreCss().formUploadButton()); submitButton.addStyleName(StaticResourceBundle.INSTANCE.coreCss().formButton()); uploadPanel.add(submitButton); hiddenImage = new Image(); hiddenImage.addStyleName(StaticResourceBundle.INSTANCE.coreCss().avatarHiddenOriginal()); uploadPanel.add(hiddenImage); panel.add(uploadPanel); submitButton.addClickHandler(new ClickHandler() { public void onClick(final ClickEvent event) { uploadForm.submit(); } }); uploadForm.setWidget(panel); this.add(uploadForm); uploadForm.addSubmitCompleteHandler(new SubmitCompleteHandler() { public void onSubmitComplete(final SubmitCompleteEvent ev) { String result = ev.getResults().replaceAll("\\<.*?\\>", ""); final boolean fail = "fail".equals(result); errorBox.setVisible(fail); if (!fail) { String[] results = result.split(","); if (results.length >= 4) { strategy.setX(Integer.parseInt(results[1])); strategy.setY(Integer.parseInt(results[2])); strategy.setCropSize(Integer.parseInt(results[3])); } onAvatarIdChanged(results[0], strategy.getEntityType() == EntityType.PERSON); } } }); if (editButton != null) { editButton.addClickHandler(new ClickHandler() { public void onClick(final ClickEvent inArg0) { // Since the size of the image is required before we can correctly show the // resize dialog, this method determines the avatar url and sets image url. // The load event of that image being loaded will kick off the resize modal. AvatarUrlGenerator urlGenerator = new AvatarUrlGenerator(EntityType.PERSON); hiddenImage.setUrl(urlGenerator.getOriginalAvatarUrl(avatarId)); } }); hiddenImage.addLoadHandler(new LoadHandler() { public void onLoad(final LoadEvent inEvent) { imageCropDialog = new ImageCropContent(strategy, processor, avatarId, new Command() { public void execute() { onAvatarIdChanged(strategy.getImageId(), strategy.getEntityType() == EntityType.PERSON); } }, hiddenImage.getWidth() + "px", hiddenImage.getHeight() + "px"); Dialog dialog = new Dialog(imageCropDialog); dialog.showCentered(); } }); } if (strategy.getImageType().equals(ImageType.BANNER)) { onAvatarIdChanged(strategy.getImageId(), strategy.getId().equals(strategy.getImageEntityId()), true, strategy.getEntityType() == EntityType.PERSON); } else { onAvatarIdChanged(strategy.getImageId(), strategy.getEntityType() == EntityType.PERSON); } deleteButton.addClickHandler(new ClickHandler() { @SuppressWarnings("unchecked") public void onClick(final ClickEvent event) { if (new WidgetJSNIFacadeImpl().confirm("Are you sure you want to delete your current photo?")) { strategy.getDeleteAction().delete(strategy.getDeleteParam()); } } }); Session.getInstance().getEventBus().addObserver(ClearUploadedImageEvent.class, new Observer<ClearUploadedImageEvent>() { public void update(final ClearUploadedImageEvent event) { if (event.getImageType().equals(strategy.getImageType()) && event.getEntityType().equals(strategy.getEntityType())) { if (event.getImageType().equals(ImageType.BANNER)) { onAvatarIdChanged(event.getEntity().getBannerId(), strategy.getId().equals(event.getEntity().getBannerEntityId()), true, strategy.getEntityType() == EntityType.PERSON); } else { onAvatarIdChanged(null, strategy.getEntityType() == EntityType.PERSON); } } } }); }
From source file:org.freemedsoftware.gwt.client.screen.patient.ScannedDocumentsEntryScreen.java
License:Open Source License
protected void initClinicalAssesmentForm() { containerScannedDocumentsForm = new VerticalPanel(); containerScannedDocumentsForm.setWidth("100%"); if (canWrite) tabPanel.add(containerScannedDocumentsForm, scannedDocumentsEntryLabel.getText()); containerScannedDocumentsForm.setWidth("100%"); scannedDocumentsEntryLabel.setStyleName(AppConstants.STYLE_LABEL_HEADER_MEDIUM); scannedDocumentsEntryLabel.setVisible(false); containerScannedDocumentsForm.add(scannedDocumentsEntryLabel); int row = 0;/*from w w w . j a v a 2 s .co m*/ final FlexTable flexTable = new FlexTable(); containerScannedDocumentsForm.add(flexTable); Label label = new Label(_("Date")); flexTable.setWidget(row, 0, label); final CustomDatePicker date = new CustomDatePicker(); flexTable.setWidget(row, 1, date); containerScannedDocumentsFormFields.put("imagedt", date); row++; label = new Label(_("Type of Image")); flexTable.setWidget(row, 0, label); final CustomListBox typeOfImage = new CustomListBox(); typeOfImage.addItem(_("Operative Report"), "op_report/misc"); typeOfImage.addItem("- " + _("Colonoscopy"), "op_report/colonoscopy"); typeOfImage.addItem("- " + _("Endoscopy"), "op_report/endoscopy"); typeOfImage.addItem(_("Miscellaneous"), "misc/misc"); typeOfImage.addItem("- " + _("Consult"), "misc/consult"); typeOfImage.addItem("- " + _("Discharge Summary"), "misc/discharge_summary"); typeOfImage.addItem("- " + _("History and Physical"), "misc/history_and_physical"); typeOfImage.addItem(_("Lab Report"), "lab_report/misc"); typeOfImage.addItem("- CBC", "lab_report/cbc"); typeOfImage.addItem("- C8", "lab_report/c8"); typeOfImage.addItem("- LFT", "lab_report/lft"); typeOfImage.addItem("- " + _("Lipid Profile"), "lab_report/lipid_profile"); typeOfImage.addItem("- UA", "lab_report/ua"); typeOfImage.addItem("- " + _("Thyroid Profile"), "lab_report/thyroid_profile"); typeOfImage.addItem(_("Letters"), "letters/misc"); typeOfImage.addItem(_("Oncology"), "oncology/misc"); typeOfImage.addItem(_("Hospital Records"), "hospital/misc"); typeOfImage.addItem("- " + _("Discharge Summary"), "hospital/discharge"); typeOfImage.addItem(_("Pathology"), "pathology/misc"); typeOfImage.addItem(_("Patient"), "patient/misc"); typeOfImage.addItem("- " + _("Consent"), "patient/consent"); typeOfImage.addItem("- " + _("History"), "patient/history"); typeOfImage.addItem("- " + _("Time Out"), "patient/time_out"); typeOfImage.addItem(_("Questionnaire"), "questionnaire/misc"); typeOfImage.addItem(_("Radiology"), "radiology/misc"); typeOfImage.addItem("- " + _("Abdominal Radiograph"), "radiology/abdominal_radiograph"); typeOfImage.addItem("- " + _("Chest Radiograph"), "radiology/chest_radiograph"); typeOfImage.addItem("- " + _("Abdominal CT Reports"), "radiology/abdominal_ct_reports"); typeOfImage.addItem("- " + _("Chest CT Reports"), "radiology/chest_ct_reports"); typeOfImage.addItem("- " + _("Mammogram Reports"), "radiology/mammogram_reports"); typeOfImage.addItem(_("Insurance Card"), "insurance_card"); typeOfImage.addItem(_("Referral"), "referral/misc"); typeOfImage.addItem("- " + _("Notes"), "referral/notes"); typeOfImage.addItem("- " + _("Radiographs"), "referral/radiographs"); typeOfImage.addItem("- " + _("Lab Reports"), "referral/lab_reports"); typeOfImage.addItem("- " + _("Consult"), "referral/consult"); typeOfImage.addItem(_("Financial Information"), "financial/misc"); flexTable.setWidget(row, 1, typeOfImage); containerScannedDocumentsFormFields.put("imagetypecat", typeOfImage); row++; label = new Label(_("Physician")); flexTable.setWidget(row, 0, label); final ProviderWidget provider = new ProviderWidget(); flexTable.setWidget(row, 1, provider); containerScannedDocumentsFormFields.put("imagephy", provider); row++; label = new Label(_("Description")); flexTable.setWidget(row, 0, label); final TextArea description = new TextArea(); flexTable.setWidget(row, 1, description); containerScannedDocumentsFormFields.put("imagedesc", description); row++; label = new Label(_("Attach Image")); flexTable.setWidget(row, 0, label); final FileUpload fileUpload = new FileUpload(); fileUpload.setName("imageupload"); final FormPanel formPanel = new FormPanel(); formPanel.setEncoding(FormPanel.ENCODING_MULTIPART); formPanel.setMethod(FormPanel.METHOD_POST); formPanel.add(fileUpload); formPanel.addSubmitCompleteHandler(new SubmitCompleteHandler() { @Override public void onSubmitComplete(SubmitCompleteEvent arg0) { Integer id = (Integer) JsonUtil.shoehornJson(JSONParser.parseStrict(arg0.getResults()), "Integer"); if (id != null) { Util.showInfoMsg(moduleName, _("Document added successfully.")); formPanel.reset(); resetForm(); populateAvailableData(); } else { Util.showErrorMsg(moduleName, _("Failed to add document.")); } } }); flexTable.setWidget(row, 1, formPanel); row++; HorizontalPanel buttonContainer = new HorizontalPanel(); flexTable.setWidget(row, 1, buttonContainer); wSubmit = new CustomButton(_("Submit"), AppConstants.ICON_ADD); buttonContainer.add(wSubmit); wSubmit.addClickHandler(new ClickHandler() { @Override public void onClick(ClickEvent arg0) { String method = "Add"; HashMap<String, String> data = Util.populateHashMap(containerScannedDocumentsFormFields); data.put("imagepat", patientId.toString()); if (scannedDocumentId != null) { data.put("id", scannedDocumentId.toString()); method = "Mod"; } String[] params = { JsonUtil.jsonify(data) }; String url = Util.getJsonRequest("org.freemedsoftware.module.ScannedDocuments." + method, params); formPanel.setAction(url); formPanel.submit(); } }); CustomButton resetButton = new CustomButton(_("Reset"), AppConstants.ICON_CLEAR); buttonContainer.add(resetButton); resetButton.addClickHandler(new ClickHandler() { @Override public void onClick(ClickEvent arg0) { formPanel.reset(); resetForm(); } }); wDelete = new CustomButton(_("Delete"), AppConstants.ICON_DELETE); buttonContainer.add(wDelete); wDelete.setVisible(false); wDelete.addClickHandler(new ClickHandler() { public void onClick(ClickEvent evt) { deleteRecord(SCANNED_DOCUMENT, scannedDocumentId); } }); }
From source file:org.guvnor.m2repo.client.M2RepoEditorView.java
License:Apache License
public WellForm doUploadForm() { form = new WellForm(); form.setAction(GWT.getModuleBaseURL() + "m2repo/file"); form.setEncoding(FormPanel.ENCODING_MULTIPART); form.setMethod(FormPanel.METHOD_POST); FileUpload up = new FileUpload(); //up.setWidth("100px"); up.setName(HTMLFileManagerFields.UPLOAD_FIELD_NAME_ATTACH); Button ok = new Button("upload"); ok.addClickHandler(new ClickHandler() { public void onClick(ClickEvent event) { showUploadingBusy();/* w w w . j a v a 2s.c o m*/ submitUpload(); } }); //form.add(fields); form.addSubmitCompleteHandler(new WellForm.SubmitCompleteHandler() { public void onSubmitComplete(final WellForm.SubmitCompleteEvent event) { if ("OK".equalsIgnoreCase(event.getResults())) { BusyPopup.close(); Window.alert("Uploaded successfully"); hiddenFieldsPanel.setVisible(false); hiddenArtifactIdField.setText(null); hiddenGroupIdField.setText(null); hiddenVersionIdField.setText(null); resultsP.clear(); JarListEditor table = new JarListEditor(m2RepoService); resultsP.add(table); } else if ("NO VALID POM".equalsIgnoreCase(event.getResults())) { BusyPopup.close(); Window.alert("The Jar does not contain a valid POM file. Please specify GAV info manually."); hiddenFieldsPanel.setVisible(true); } else { BusyPopup.close(); Window.alert("Upload failed:" + event.getResults()); hiddenFieldsPanel.setVisible(false); hiddenArtifactIdField.setText(null); hiddenGroupIdField.setText(null); hiddenVersionIdField.setText(null); } } }); HorizontalPanel fields = new HorizontalPanel(); fields.add(up); fields.add(ok); hiddenGroupIdField.setName(HTMLFileManagerFields.GROUP_ID); hiddenGroupIdField.setText(null); //hiddenGroupIdField.setVisible(false); hiddenArtifactIdField.setName(HTMLFileManagerFields.ARTIFACT_ID); hiddenArtifactIdField.setText(null); //hiddenArtifactIdField.setVisible(false); hiddenVersionIdField.setName(HTMLFileManagerFields.VERSION_ID); hiddenVersionIdField.setText(null); //hiddenVersionIdField.setVisible(false); hiddenFieldsPanel.setVisible(false); hiddenFieldsPanel.addAttribute("GroupID:", hiddenGroupIdField); hiddenFieldsPanel.addAttribute("ArtifactID:", hiddenArtifactIdField); hiddenFieldsPanel.addAttribute("VersionID:", hiddenVersionIdField); VerticalPanel allFields = new VerticalPanel(); allFields.add(fields); allFields.add(hiddenFieldsPanel); form.add(allFields); return form; }
From source file:org.jboss.as.console.client.shared.deployment.DeploymentStep1.java
License:Open Source License
public Widget asWidget() { final TabPanel tabs = new TabPanel(); tabs.setStyleName("default-tabpanel"); // -------/*from w w w . j a v a 2 s. c o m*/ VerticalPanel layout = new VerticalPanel(); layout.setStyleName("window-content"); // Create a FormPanel and point it at a service. final FormPanel form = new FormPanel(); String url = Console.getBootstrapContext().getProperty(BootstrapContext.DEPLOYMENT_API); form.setAction(url); form.setEncoding(FormPanel.ENCODING_MULTIPART); form.setMethod(FormPanel.METHOD_POST); // Create a panel to hold all of the form widgets. VerticalPanel panel = new VerticalPanel(); panel.getElement().setAttribute("style", "width:100%"); form.setWidget(panel); // Create a FileUpload widget. final FileUpload upload = new FileUpload(); upload.setName("uploadFormElement"); panel.add(upload); final HTML errorMessages = new HTML("Please chose a file!"); errorMessages.setStyleName("error-panel"); errorMessages.setVisible(false); panel.add(errorMessages); // Add a 'submit' button. ClickHandler cancelHandler = new ClickHandler() { @Override public void onClick(ClickEvent event) { window.hide(); } }; ClickHandler submitHandler = new ClickHandler() { @Override public void onClick(ClickEvent event) { errorMessages.setVisible(false); // verify form String filename = upload.getFilename(); if (tabs.getTabBar().getSelectedTab() == 1) { // unmanaged content if (unmanagedForm.validate().hasErrors()) { return; } else { wizard.onCreateUnmanaged(unmanagedForm.getUpdatedEntity()); } } else if (filename != null && !filename.equals("")) { loading = Feedback.loading(Console.CONSTANTS.common_label_plaseWait(), Console.CONSTANTS.common_label_requestProcessed(), new Feedback.LoadingCallback() { @Override public void onCancel() { } }); form.submit(); } else { errorMessages.setVisible(true); } } }; DialogueOptions options = new DialogueOptions(Console.CONSTANTS.common_label_next(), submitHandler, Console.CONSTANTS.common_label_cancel(), cancelHandler); // Add an event handler to the form. form.addSubmitCompleteHandler(new FormPanel.SubmitCompleteHandler() { @Override public void onSubmitComplete(FormPanel.SubmitCompleteEvent event) { getLoading().hide(); String html = event.getResults(); // Step 1: upload content, retrieve hash value try { String json = html; try { if (!GWT.isScript()) // TODO: Formpanel weirdness json = html.substring(html.indexOf(">") + 1, html.lastIndexOf("<")); } catch (StringIndexOutOfBoundsException e) { // if I get this exception it means I shouldn't strip out the html // this issue still needs more research Log.debug("Failed to strip out HTML. This should be preferred?"); } JSONObject response = JSONParser.parseLenient(json).isObject(); JSONObject result = response.get("result").isObject(); String hash = result.get("BYTES_VALUE").isString().stringValue(); // step2: assign name and group wizard.onUploadComplete(upload.getFilename(), hash); } catch (Exception e) { Log.error(Console.CONSTANTS.common_error_failedToDecode() + ": " + html, e); } // Option 2: Unmanaged content } }); String stepText = "<h3>" + Console.CONSTANTS.common_label_step() + "1/2: " + Console.CONSTANTS.common_label_deploymentSelection() + "</h3>"; layout.add(new HTML(stepText)); HTML description = new HTML(); description.setHTML(Console.CONSTANTS.common_label_chooseFile()); description.getElement().setAttribute("style", "padding-bottom:15px;"); layout.add(description); layout.add(form); // Unmanaged form VerticalPanel unmanagedPanel = new VerticalPanel(); unmanagedPanel.setStyleName("window-content"); String unmanagedText = "<h3>" + Console.CONSTANTS.common_label_step() + "1/1: Specify Deployment</h3>"; unmanagedPanel.add(new HTML(unmanagedText)); unmanagedForm = new Form<DeploymentRecord>(DeploymentRecord.class); TextAreaItem path = new TextAreaItem("path", "Path"); TextBoxItem relativeTo = new TextBoxItem("relativeTo", "Relative To", false); TextBoxItem name = new TextBoxItem("name", "Name"); TextBoxItem runtimeName = new TextBoxItem("runtimeName", "Runtime Name"); CheckBoxItem archive = new CheckBoxItem("archive", "Is Archive?"); archive.setValue(true); unmanagedForm.setFields(path, relativeTo, archive, name, runtimeName); unmanagedPanel.add(unmanagedForm.asWidget()); // Composite view tabs.add(layout, "Managed"); tabs.add(unmanagedPanel, "Unmanaged"); tabs.selectTab(0); return new WindowContentBuilder(tabs, options).build(); }
From source file:org.jbpm.form.builder.ng.model.client.form.items.FileInputFormItem.java
License:Apache License
private void populate(FileUpload fileUpload) { if (this.name != null) { fileUpload.setName(this.name); }// www. j a v a 2 s . c om if (getWidth() != null) { fileUpload.setWidth(getWidth()); } if (getHeight() != null) { fileUpload.setHeight(getHeight()); } }
From source file:org.jbpm.form.builder.ng.model.client.form.items.FileInputFormItem.java
License:Apache License
@Override public Widget cloneDisplay(Map<String, Object> data) { FileUpload fu = new FileUpload(); populate(fu);//from ww w .ja v a 2s. c o m if (getOutput() != null && getOutput().get("name") != null) { fu.setName(String.valueOf(getOutput().get("name"))); } super.populateActions(fu.getElement()); return fu; }
From source file:org.jbpm.formbuilder.client.form.items.FileInputFormItem.java
License:Apache License
@Override public Widget cloneDisplay(Map<String, Object> data) { FileUpload fu = new FileUpload(); populate(fu);// w w w. j a va2s. c om if (getOutput() != null && getOutput().getName() != null) { fu.setName(getOutput().getName()); } super.populateActions(fu.getElement()); return fu; }
From source file:org.kie.guvnor.commons.ui.client.widget.AttachmentFileWidget.java
License:Apache License
public AttachmentFileWidget() { form.setEncoding(FormPanel.ENCODING_MULTIPART); form.setMethod(FormPanel.METHOD_POST); form.addSubmitCompleteHandler(new FormPanel.SubmitCompleteHandler() { @Override/* w w w.j a v a 2 s . c om*/ public void onSubmitComplete(final FormPanel.SubmitCompleteEvent event) { if ("OK".equalsIgnoreCase(event.getResults())) { executeCallback(successCallback); Window.alert(CommonConstants.INSTANCE.UploadSuccess()); } else { executeCallback(errorCallback); Window.alert(CommonConstants.INSTANCE.UploadFailure0(event.getResults())); } } }); final FileUpload up = new FileUpload(); up.setName(FileManagerFields.UPLOAD_FIELD_NAME_ATTACH); fields.add(up); form.add(fields); initWidget(form); }