List of usage examples for com.google.gwt.user.client.ui FormPanel submit
public void submit()
From source file:org.utgenome.gwt.utgb.client.track.lib.NavigatorTrack.java
License:Apache License
public NavigatorTrack() { super("NavigatorTrack"); panel.setStyleName("toolbox"); panel.setWidth("100%"); speciesBox.addChangeHandler(new PropertyChangeHandler(UTGBProperty.SPECIES, speciesBox)); revisionBox.addChangeHandler(new PropertyChangeHandler(UTGBProperty.REVISION, revisionBox)); regionBox.addKeyUpHandler(new SequenceRangeChangeListner()); targetBox.addKeyUpHandler(new KeyUpHandler() { public void onKeyUp(KeyUpEvent e) { int keyCode = e.getNativeKeyCode(); if (keyCode == KeyCodes.KEY_ENTER || keyCode == KeyCodes.KEY_TAB) { getTrackGroup().getPropertyWriter().setProperty(UTGBProperty.TARGET, targetBox.getText()); }/*from w w w. j av a2 s . c o m*/ } }); targetBox.setWidth("100px"); // value selectors hp.setVerticalAlignment(HorizontalPanel.ALIGN_MIDDLE); hp.add(new FormLabel("Species")); hp.add(speciesBox); hp.add(new FormLabel("Ref.")); hp.add(revisionBox); hp.add(new FormLabel("Chr.")); hp.add(targetBox); // window locator regionBox.setWidth("160px"); hp2.setVerticalAlignment(HorizontalPanel.ALIGN_MIDDLE); hp2.add(new FormLabel("Region")); hp2.add(regionBox); Button strandSwitch = new Button("reverse"); Style.margin(strandSwitch, Style.LEFT, 2); Style.border(strandSwitch, 2, Style.BORDER_OUTSET, "white"); strandSwitch.addClickHandler(new ClickHandler() { public void onClick(ClickEvent e) { isPlusStrand = !isPlusStrand; TrackWindow window = getTrackGroup().getTrackWindow(); if (isPlusStrand) { getTrackGroup().setTrackWindowLocation(window.getEndOnGenome(), window.getStartOnGenome()); } else { getTrackGroup().setTrackWindowLocation(window.getEndOnGenome(), window.getStartOnGenome()); } } }); // TODO reverse button //hp2.add(strandSwitch); hp2.add(new ScrollButtonSet()); // save view final FormPanel saveViewForm = new FormPanel(); saveViewForm.setAction(GWT.getModuleBaseURL() + "utgb-core/EchoBackView"); saveViewForm.setEncoding(FormPanel.ENCODING_URLENCODED); saveViewForm.setMethod(FormPanel.METHOD_POST); final Hidden viewData = new Hidden("view"); final Hidden time = new Hidden("time"); final Button saveButton = new Button("save view"); HorizontalPanel formLayout = new HorizontalPanel(); formLayout.setVerticalAlignment(HorizontalPanel.ALIGN_MIDDLE); viewData.setVisible(false); formLayout.add(viewData); formLayout.add(time); formLayout.add(saveButton); saveButton.addClickHandler(new ClickHandler() { public void onClick(ClickEvent e) { XMLWriter xmlWriter = new XMLWriter(); getTrackGroup().toXML(xmlWriter); String view = xmlWriter.toString(); viewData.setValue(view); // send the time stamp Date today = new Date(); time.setValue(Long.toString(today.getTime())); saveViewForm.submit(); } }); saveViewForm.add(formLayout); DOM.setStyleAttribute(saveViewForm.getElement(), "margin", "0"); hp.add(saveViewForm); Button loadButton = new Button("load view"); loadButton.addClickHandler(new ClickHandler() { public void onClick(ClickEvent e) { getTrackGroup().insertTrack(new ViewLoaderTrack(), getTrackGroup().getTrackIndex(_self) + 1); } }); hp.add(loadButton); }
From source file:org.utgenome.gwt.utgb.client.track.lib.ViewLoaderTrack.java
License:Apache License
public ViewLoaderTrack() { super("View Loader"); // load view via HTTP HorizontalPanel hp = new HorizontalPanel(); hp.setVerticalAlignment(HorizontalPanel.ALIGN_MIDDLE); hp.add(new FormLabel("View Silk URL: ")); urlBox.setWidth("400px"); urlBox.addKeyPressHandler(new KeyPressHandler() { public void onKeyPress(KeyPressEvent e) { if (e.getCharCode() == KeyCodes.KEY_ENTER) { downloadView(urlBox.getText()); }/* w ww . j a v a 2s.c o m*/ } }); Button loadButton = new Button("load"); loadButton.addClickHandler(new ClickHandler() { public void onClick(ClickEvent e) { downloadView(urlBox.getText()); } }); hp.add(urlBox); hp.add(loadButton); // load view from a file final FormPanel fileUploadForm = new FormPanel(); fileUploadForm.setAction(GWT.getModuleBaseURL() + "utgb-core/loadview"); fileUploadForm.setEncoding(FormPanel.ENCODING_MULTIPART); fileUploadForm.setMethod(FormPanel.METHOD_POST); HorizontalPanel formButtonPanel = new HorizontalPanel(); FileUpload fileBox = new FileUpload(); fileBox.setName("file"); fileBox.setWidth("300px"); Button uploadButton = new Button("submit"); uploadButton.addClickHandler(new ClickHandler() { public void onClick(ClickEvent e) { fileUploadForm.submit(); } }); formButtonPanel.add(new FormLabel("View Silk File:")); formButtonPanel.add(fileBox); formButtonPanel.add(uploadButton); fileUploadForm.add(formButtonPanel); DOM.setStyleAttribute(fileUploadForm.getElement(), "margin", "0"); fileUploadForm.addSubmitCompleteHandler(new SubmitCompleteHandler() { public void onSubmitComplete(SubmitCompleteEvent e) { getFrame().setNowLoading(); String viewXML = extractEmbeddedSilkInComment(e.getResults()); setViewSilk(viewXML); } }); // set panes panel.setStyleName("toolbox"); panel.add(hp); panel.add(fileUploadForm); }
From source file:therandomhomepage.mainclient.FeedbackPanel.java
License:Apache License
public FeedbackPanel() { NamedFrame mailFrame = new NamedFrame("mailFrame"); mailFrame.setVisible(false);// w w w . j a v a 2 s. c om 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); } } }); }