Created
June 10, 2013 06:45
-
-
Save porcelli/5746952 to your computer and use it in GitHub Desktop.
sample gwt bad code
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| final FormPanel form = new FormPanel(); | |
| form.setEncoding(FormPanel.ENCODING_MULTIPART); | |
| form.setMethod(FormPanel.METHOD_POST); | |
| form.addStyleName("table-center"); | |
| form.addStyleName("demo-FormPanel"); | |
| VerticalPanel holder = new VerticalPanel(); | |
| holder.add(new Label("User ID")); | |
| TextBox userid = new TextBox(); | |
| userid.setName("userid"); | |
| holder.add(userid); | |
| holder.add(new Label("Password")); | |
| PasswordTextBox passwd = new PasswordTextBox(); | |
| passwd.setName("passwd"); | |
| holder.add(passwd); | |
| holder.add(new Button("Submit", new ClickListener() | |
| { | |
| public void onClick(Widget sender) | |
| { | |
| // form.submit(); | |
| } | |
| })); | |
| form.add(holder); | |
| // form.setAction("url"); | |
| form.addFormHandler(new FormHandler() | |
| { | |
| public void onSubmit(FormSubmitEvent event) | |
| { | |
| // if (something_is_wrong) | |
| // { | |
| // Take some action | |
| // event.setCancelled(true); | |
| // } | |
| } | |
| public void onSubmitComplete( | |
| FormSubmitCompleteEvent event) | |
| { | |
| Window.alert(event.getResults()); | |
| } | |
| }); | |
| RootPanel.get("demo").add(form); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment