List of usage examples for com.google.gwt.user.client.ui FormPanel FormPanel
public FormPanel()
From source file:opus.gwt.management.console.client.dashboard.DashboardPanel.java
License:Apache License
public DashboardPanel(ClientFactory clientFactory) { initWidget(uiBinder.createAndBindUi(this)); this.eventBus = clientFactory.getEventBus(); this.clientFactory = clientFactory; this.JSVarHandler = clientFactory.getJSVariableHandler(); this.applications = clientFactory.getApplications(); activeButton.setText(""); deleteForm = new FormPanel(); registerHandlers();/* w ww. j a va 2 s. c om*/ setDeletePopupPanelInitialState(); }
From source file:opus.gwt.management.console.client.dashboard.DeleteProjectPanel.java
License:Apache License
public DeleteProjectPanel(ClientFactory clientFactory, String projectName) { initWidget(uiBinder.createAndBindUi(this)); this.eventBus = clientFactory.getEventBus(); JSVarHandler = new JSVariableHandler(); deleteForm = new FormPanel(); this.projectName = projectName; projectLabel.setText(projectName);//from w w w. ja va2 s . c o m registerHandlers(); setupDeleteForm(); }
From source file:org.bonitasoft.forms.client.view.widget.FileUploadWidget.java
License:Open Source License
protected void createFileUploadForm(final String FileUloadName) { formPanel = new FormPanel(); formPanel.setEncoding(FormPanel.ENCODING_MULTIPART); formPanel.setMethod(FormPanel.METHOD_POST); FormElement.as(formPanel.getElement()).setAcceptCharset("UTF-8"); formPanel.setAction(RpcFormsServices.getFileUploadURL()); fileUpload = addFileUploalToFormPanel(FileUloadName); }
From source file:org.cloudcoder.app.client.view.BulkRegistrationPanel.java
License:Open Source License
/** * Constructor./*from w ww . j a v a2 s .c om*/ */ public BulkRegistrationPanel(final CloudCoderPage page) { super(new FormPanel()); FormPanel formPanel = (FormPanel) getPanel(); formPanel.setWidth("100%"); formPanel.setHeight("144px"); formPanel.setEncoding(FormPanel.ENCODING_MULTIPART); formPanel.setMethod(FormPanel.METHOD_POST); formPanel.setAction(GWT.getModuleBaseURL() + "registerStudents"); this.layoutPanel = new LayoutPanel(); formPanel.add(layoutPanel); double y = 10.0; // Add widgets InlineHTML fileFormatMsg = new InlineHTML("File should be tab-delimited in format:<br>" + "<tt>username firstname lastname email password</tt>"); y = addWidget(y, fileFormatMsg, "", new NoopFieldValidator(), 36.0); this.fileUpload = new FileUpload(); fileUpload.setName("fileupload"); y = addWidget(y, fileUpload, "Filename:", new NoopFieldValidator()); this.submitButton = new SubmitButton("Register students"); y = addWidget(y, submitButton, "", new NoopFieldValidator()); this.courseId = new Hidden(); courseId.setName("courseId"); layoutPanel.add(courseId); formPanel.addSubmitHandler(new SubmitHandler() { @Override public void onSubmit(SubmitEvent event) { page.getSession().add(StatusMessage.pending("Uploading student data...")); } }); formPanel.addSubmitCompleteHandler(new SubmitCompleteHandler() { @Override public void onSubmitComplete(SubmitCompleteEvent event) { String results = event.getResults(); if (results == null) { page.getSession().add(StatusMessage.error("Error communicating with server")); } else { if (results.startsWith("Error: ")) { results = results.substring("Error: ".length()); page.getSession().add(StatusMessage.error(results)); } else { page.getSession().add(StatusMessage.goodNews(results)); clear(); } } } }); }
From source file:org.datacleaner.monitor.shared.widgets.FileUploadFunctionHandler.java
License:Open Source License
public static void uploadFile(String fileUploadElementId) { final Element element = Document.get().getElementById(fileUploadElementId); final InputElement inputElement = getFileInput(element); if (inputElement == null) { throw new IllegalArgumentException("No file input found within element id: " + fileUploadElementId); }//from w w w . j a v a2s. c o m GWT.log("Found file input element: " + inputElement); final String inputName = inputElement.getName(); final Element parent = inputElement.getParentElement(); parent.setInnerHTML("<div class='loader'></div>"); // use "contentType" param because form submission requires everything // to be text/html final String url = Urls.createRelativeUrl("util/upload?contentType=text/html"); final RootPanel rootPanel = RootPanel.get(); final FormPanel form = new FormPanel(); form.setVisible(false); form.setAction(url); form.setMethod(FormPanel.METHOD_POST); form.setEncoding(FormPanel.ENCODING_MULTIPART); form.getElement().appendChild(inputElement); form.addSubmitCompleteHandler(new SubmitCompleteHandler() { @Override public void onSubmitComplete(SubmitCompleteEvent event) { final String stringResponse = event.getResults(); GWT.log("File upload form submit complete! Results: " + stringResponse); try { final JSONValue jsonResponse = JSONParser.parseLenient(stringResponse); final JSONArray jsonFiles = jsonResponse.isObject().get("files").isArray(); final JSONValue jsonFile = jsonFiles.get(0); final String jsonFileStr = jsonFile.toString(); parent.setInnerHTML("<p>File uploaded!</p><input type='hidden' name='" + inputName + "' value='" + jsonFileStr + "' />"); rootPanel.remove(form); } catch (Exception e) { ErrorHandler.showErrorDialog("Unexpected error occurred", "An error occurred when uploading the file to the server.", stringResponse); } } }); rootPanel.add(form); GWT.log("Submitting hidden file upload form"); form.submit(); }
From source file:org.dataconservancy.dcs.access.client.ui.UploadBagDialog.java
License:Apache License
public UploadBagDialog(String bagUrl //, final CaptionPanel researchObjectPanel, final Button ingestButton ) {//from w w w .j av a 2s . c om dBox = new DialogBox(false, true); Panel panel = new FlowPanel(); dBox.setAnimationEnabled(true); dBox.setText("Upload Bag as a .zip file"); dBox.setWidget(panel); dBox.center(); final HorizontalPanel buttons = new HorizontalPanel(); buttons.setSpacing(5); Button upload = new Button("Upload"); Button cancel = new Button("Cancel"); buttons.add(upload); buttons.add(cancel); final FormPanel form = new FormPanel(); FlowPanel formcontents = new FlowPanel(); form.add(formcontents); Hidden depositurl = new Hidden("bagUrl"); depositurl.setValue(bagUrl); final FileUpload upfile = new FileUpload(); upfile.setName("file"); formcontents.add(upfile); formcontents.add(depositurl); form.setMethod(FormPanel.METHOD_POST); form.setEncoding(FormPanel.ENCODING_MULTIPART); form.setAction(SeadApp.BAG_UPLOAD_URL); panel.add(new Label("Uploaded files will be included in the SIP.")); panel.add(form); panel.add(buttons); upload.addClickHandler(new ClickHandler() { public void onClick(ClickEvent event) { form.submit(); } }); cancel.addClickHandler(new ClickHandler() { public void onClick(ClickEvent event) { dBox.hide(); } }); form.addSubmitCompleteHandler(new SubmitCompleteHandler() { public void onSubmitComplete(SubmitCompleteEvent event) { if (event.getResults() == null) { Window.alert("File upload failed"); dBox.hide(); return; } String[] tempString = event.getResults().split(";"); final String sipPath = tempString[tempString.length - 1].split("<")[0]; String jsonString = event.getResults(); jsonString = jsonString.substring(jsonString.indexOf('{'), jsonString.lastIndexOf('}') + 1); dBox.hide(); JsDcp dcp = JsDcp.create(); JsSearchResult result = JsSearchResult.create(jsonString); for (int i = 0; i < result.matches().length(); i++) { Util.add(dcp, result.matches().get(i)); } PublishDataView.EVENT_BUS.fireEvent(new EntityEditEvent(dcp, true, sipPath)); } }); }
From source file:org.dataconservancy.dcs.access.client.ui.UploadFgdcDialog.java
License:Apache License
public UploadFgdcDialog(String fileUploadUrl) { dBox = new DialogBox(false, true); Panel panel = new FlowPanel(); dBox.setAnimationEnabled(true);//from w w w. j a va 2 s. c o m // dBox.setText("Upload local file"); dBox.setStyleName("dialogBox"); dBox.setWidget(panel); dBox.center(); final HorizontalPanel buttons = new HorizontalPanel(); buttons.setSpacing(5); Button upload = new Button("Upload"); Button cancel = new Button("Cancel"); buttons.add(upload); buttons.add(cancel); final FormPanel form = new FormPanel(); FlowPanel formcontents = new FlowPanel(); form.add(formcontents); final FileUpload upfile = new FileUpload(); upfile.setName("file"); Hidden depositurl = new Hidden("depositurl"); depositurl.setValue(fileUploadUrl); //depositConfig.fileUploadUrl()); formcontents.add(upfile); formcontents.add(depositurl); form.setMethod(FormPanel.METHOD_POST); form.setEncoding(FormPanel.ENCODING_MULTIPART); form.setAction(SeadApp.FILE_UPLOAD_URL); panel.add(Util.label("Upload Metadata file to be included in the SIP.", "greenFont")); panel.add(form); panel.add(buttons); upload.addClickHandler(new ClickHandler() { public void onClick(ClickEvent event) { form.submit(); } }); cancel.addClickHandler(new ClickHandler() { public void onClick(ClickEvent event) { dBox.hide(); } }); form.addSubmitCompleteHandler(new SubmitCompleteHandler() { public void onSubmitComplete(SubmitCompleteEvent event) { if (event.getResults() == null) { Window.alert("File upload failed"); dBox.hide(); return; } String[] parts = event.getResults().split("\\^"); if (parts.length != 4) { Window.alert("File upload failed: " + event.getResults()); dBox.hide(); return; } String filesrc = parts[1].trim(); MediciIngestPresenter.metadataSrc = filesrc; dBox.hide(); MediciIngestPresenter.mdCb.setText("Uploaded Metadata!"); MediciIngestPresenter.mdCb.setEnabled(false); //Fire an event to update FGDC's successful update } }); }
From source file:org.dataconservancy.dcs.access.client.view.PublishDataView.java
License:Creative Commons License
public PublishDataView() { publishContainer = new VerticalPanel(); publishContainer.addStyleName("PublishContainer"); projectDesciptionPanel = new CaptionPanel("Project Description"); researchObjectPanel = new CaptionPanel("Research Object"); licensePanel = new CaptionPanel("License "); projectDesciptionPanel.setStyleName("CaptionPanelStyle"); researchObjectPanel.setStyleName("CaptionPanelStyle"); licensePanel.setStyleName("CaptionPanelStyle"); publishContainer.add(researchObjectPanel); publishContainer.add(projectDesciptionPanel); publishContainer.add(licensePanel);/*from www . j a v a 2s. c o m*/ Grid project = new Grid(3, 2); Label projectName = new Label("Project Name"); projectList = new ListBox(false); Label projectDescription = new Label("Project Description"); project.setCellSpacing(3); project.setCellPadding(3); projectNameTB = new TextBox(); projectNameTB.setEnabled(false); project.setWidget(0, 0, projectName); project.setWidget(0, 1, projectNameTB); abstractTB = new TextArea(); abstractTB.setEnabled(false); project.setWidget(1, 0, projectDescription); project.setWidget(1, 1, abstractTB); VerticalPanel descriptionPanel = new VerticalPanel(); descriptionPanel.add(project); warningPanel = new VerticalPanel(); descriptionPanel.add(warningPanel); projectDesciptionPanel.add(descriptionPanel); Grid ROGrid = new Grid(4, 2); Label uploadLabel = new Label("Upload Local Bag"); previewButton = new Button("Submit Dataset for Review"); form = new FormPanel(); FlowPanel formcontents = new FlowPanel(); form.add(formcontents); Hidden depositurl = new Hidden("bagUrl"); depositurl.setValue(SeadApp.bagIturl); final FileUpload upfile = new FileUpload(); upfile.setName("file"); formcontents.add(upfile); formcontents.add(depositurl); form.setMethod(FormPanel.METHOD_POST); form.setEncoding(FormPanel.ENCODING_MULTIPART); form.setAction(SeadApp.BAG_UPLOAD_URL); Grid uploadGrid = new Grid(4, 2); uploadGrid.setWidget(1, 0, uploadLabel); uploadGrid.setWidget(1, 1, form); uploadBag = new Button("Upload"); uploadGrid.setWidget(3, 1, uploadBag); ROGrid.setCellSpacing(3); ROGrid.setCellPadding(3); // ROGrid.setWidget(0, 0, ROLabel); //ROGrid.setWidget(0, 1, ROList); //ROGrid.setWidget(1, 1, new HTML("Or")); //ROGrid.setWidget(2, 1, browsePanel); //ROGrid.setWidget(2, 1, uploadBag); researchObjectPanel.add(uploadGrid); Panel innerLicensePanel = new FlowPanel(); errorMessage = new Label(); licenseBox = new CheckBox( "By clicking this checkbox, I certify that I agree to release my research data under the terms of the Creative Commons license."); innerLicensePanel.add(errorMessage); innerLicensePanel.add(licenseBox); licensePanel.add(innerLicensePanel); HorizontalPanel previewButtonPanel = new HorizontalPanel(); previewButtonPanel.setWidth("600px"); previewButtonPanel.setStyleName("Margin"); Button clearButton = new Button("Start over"); clearButton.addClickHandler(new ClickHandler() { @Override public void onClick(ClickEvent event) { History.newItem(SeadState.UPLOAD.toToken("new")); } }); previewButtonPanel.setHorizontalAlignment(HorizontalPanel.ALIGN_LEFT); previewButtonPanel.add(clearButton); previewButtonPanel.setHorizontalAlignment(HorizontalPanel.ALIGN_RIGHT); previewButtonPanel.add(previewButton); previewButton.setEnabled(false); publishContainer.add(previewButtonPanel); }
From source file:org.dataconservancy.dcs.ingest.ui.client.Application.java
License:Apache License
private void displayUploadFileDialog() { final DialogBox db = new DialogBox(false, true); Panel panel = new FlowPanel(); db.setAnimationEnabled(true);//w w w . j a v a 2 s . co m db.setText("Upload local file"); db.setWidget(panel); db.center(); final HorizontalPanel buttons = new HorizontalPanel(); buttons.setSpacing(5); Button upload = new Button("Upload"); Button cancel = new Button("Cancel"); buttons.add(upload); buttons.add(cancel); final FormPanel form = new FormPanel(); FlowPanel formcontents = new FlowPanel(); form.add(formcontents); final FileUpload upfile = new FileUpload(); upfile.setName("file"); Hidden depositurl = new Hidden("depositurl"); depositurl.setValue(depositConfig.fileUploadUrl()); formcontents.add(upfile); formcontents.add(depositurl); form.setMethod(FormPanel.METHOD_POST); form.setEncoding(FormPanel.ENCODING_MULTIPART); form.setAction(FILE_UPLOAD_URL); panel.add(new Label("Uploaded files will be included in the SIP.")); panel.add(form); panel.add(buttons); upload.addClickHandler(new ClickHandler() { public void onClick(ClickEvent event) { form.submit(); } }); cancel.addClickHandler(new ClickHandler() { public void onClick(ClickEvent event) { db.hide(); } }); form.addSubmitCompleteHandler(new SubmitCompleteHandler() { public void onSubmitComplete(SubmitCompleteEvent event) { if (event.getResults() == null) { Window.alert("File upload failed"); db.hide(); return; } String[] parts = event.getResults().split("\\^"); if (parts.length != 4) { Window.alert("File upload failed: " + event.getResults()); db.hide(); return; } String filesrc = parts[1].trim(); // TODO String fileatomurl = parts[2].trim(); files.setVisible(true); String id = nextFileId(); fileids.add(id); files.add(new FileEditor(id, upfile.getFilename(), filesrc), id); files.selectTab(files.getWidgetCount() - 1); db.hide(); } }); }
From source file:org.drools.brms.client.admin.BackupManager.java
License:Apache License
private Widget newImportWidget() { final FormPanel uploadFormPanel = new FormPanel(); uploadFormPanel.setAction(GWT.getModuleBaseURL() + "backup"); uploadFormPanel.setEncoding(FormPanel.ENCODING_MULTIPART); uploadFormPanel.setMethod(FormPanel.METHOD_POST); HorizontalPanel panel = new HorizontalPanel(); uploadFormPanel.setWidget(panel);//from www .j a v a 2 s . c om final FileUpload upload = new FileUpload(); upload.setName(HTMLFileManagerFields.FILE_UPLOAD_FIELD_NAME_IMPORT); panel.add(upload); panel.add(new Label("import:")); ImageButton ok = new ImageButton("images/upload.gif"); ok.addClickListener(new ClickListener() { public void onClick(Widget sender) { doImportFile(uploadFormPanel); } private void doImportFile(final FormPanel uploadFormPanel) { if (Window.confirm("Are you sure you want to import? this will erase any content in the " + "repository currently?")) { LoadingPopup.showMessage("Importing repository, please wait, as this could take some time..."); uploadFormPanel.submit(); } } }); panel.add(ok); uploadFormPanel.addFormHandler(new FormHandler() { public void onSubmitComplete(FormSubmitCompleteEvent event) { if (event.getResults().indexOf("OK") > -1) { Window.alert( "Rules repository imported successfully. Please refresh your browser (F5) to show the new content. "); } else { ErrorPopup.showMessage( "Unable to import into the repository. Consult the server logs for error messages."); } LoadingPopup.close(); } public void onSubmit(FormSubmitEvent event) { if (upload.getFilename().length() == 0) { Window.alert("You did not specify an exported repository filename !"); event.setCancelled(true); } else if (!upload.getFilename().endsWith(".xml")) { Window.alert("Please specify a valid repository xml file."); event.setCancelled(true); } } }); return uploadFormPanel; }