List of usage examples for com.google.gwt.user.client.ui FormPanel setAction
public void setAction(SafeUri url)
From source file:org.vectomatic.client.rep.controller.ExportController.java
License:Open Source License
public ExportController(RepApplication app, FormPanel form) { super(app);/*w ww .j a v a2s . c om*/ _form = form; form.setMethod(FormPanel.METHOD_POST); Element svgexport = DOM.getElementById("svgexport"); String uri = ""; if (svgexport != null) { uri = svgexport.getAttribute("content"); } form.setAction(uri); _hidden = new Hidden(); _hidden.setName("data"); form.add(_hidden); _exportSVG11MenuItem = new ControllerMenuItem(app.getView(), app.getConstants().exportSVG11Command(), new ControllerBase(_app) { @Override public void activate(DrawingView view) { export(new SVG11Visitor()); } }); _exportSVG12MenuItem = new ControllerMenuItem(app.getView(), app.getConstants().exportSVG12Command(), new ControllerBase(_app) { @Override public void activate(DrawingView view) { export(new SVG12Visitor()); } }); }
From source file:therandomhomepage.mainclient.FeedbackPanel.java
License:Apache License
public FeedbackPanel() { NamedFrame mailFrame = new NamedFrame("mailFrame"); mailFrame.setVisible(false);//from w ww . j a v a 2s. c o m final FormPanel form = new FormPanel(mailFrame); form.setAction("/php/sendMail.php"); form.setMethod(FormPanel.METHOD_GET); form.setEncoding(FormPanel.ENCODING_URLENCODED); VerticalPanel panel = new VerticalPanel(); panel.setHorizontalAlignment(VerticalPanel.ALIGN_CENTER); panel.setVerticalAlignment(VerticalPanel.ALIGN_TOP); panel.add(form); panel.add(mailFrame); initWidget(panel); table = new FlexTable(); table.addStyleName("divBlock"); table.addStyleName("feedbackForm"); table.setWidget(1, 0, new HTML("<h3>Feedback</h3>")); table.setWidget(2, 0, new Label("Name: ")); table.getFlexCellFormatter().setVerticalAlignment(1, 0, HasVerticalAlignment.ALIGN_TOP); TextBox txtName = new TextBox(); txtName.setName("txtName"); table.setWidget(2, 1, txtName); table.setWidget(3, 0, new Label("Email: ")); table.getFlexCellFormatter().setVerticalAlignment(2, 0, HasVerticalAlignment.ALIGN_TOP); txtEmail = new TextBox(); txtEmail.setName("txtEmail"); table.setWidget(3, 1, txtEmail); table.setWidget(4, 0, new Label("Subject: ")); table.getFlexCellFormatter().setVerticalAlignment(3, 0, HasVerticalAlignment.ALIGN_TOP); ListBox subject = new ListBox(); subject.setName("selSubject"); subject.addItem("General", "General"); subject.addItem("Comments", "Comments"); subject.addItem("Suggestion", "Suggestion"); subject.addItem("Bug report", "Bug report"); subject.addItem("Others", "Others"); table.setWidget(4, 1, subject); table.setWidget(5, 0, new Label("Message: ")); table.getFlexCellFormatter().setVerticalAlignment(4, 0, HasVerticalAlignment.ALIGN_TOP); txtMessage = new TextArea(); txtMessage.setName("txtMessage"); txtMessage.setCharacterWidth(50); txtMessage.setVisibleLines(8); table.setWidget(5, 1, txtMessage); btnSubmit = new Button("Submit", new ClickListener() { public void onClick(Widget sender) { form.submit(); } }); table.setWidget(6, 0, btnSubmit); form.add(table); form.addFormHandler(new FormHandler() { public void onSubmitComplete(FormSubmitCompleteEvent event) { //ignore this } public void onSubmit(FormSubmitEvent event) { if (txtEmail.getText().trim().length() == 0) { Window.alert("Please provide your email address !"); event.setCancelled(true); txtEmail.setFocus(true); } else if (txtMessage.getText().trim().length() == 0) { Window.alert("Please provide feedback !"); event.setCancelled(true); txtMessage.setFocus(true); } else { HTML thanksHTML = new HTML( "<b class=\"thanks\">We really appreciate your feedback. Thanks a lot !</b>"); table.setWidget(0, 1, thanksHTML); btnSubmit.setEnabled(false); } } }); }