\r
import org.apache.wicket.PageParameters;\r
import org.apache.wicket.RestartResponseException;\r
+import org.apache.wicket.ajax.AjaxRequestTarget;\r
+import org.apache.wicket.ajax.markup.html.form.AjaxButton;\r
import org.apache.wicket.extensions.markup.html.form.DateTextField;\r
import org.apache.wicket.markup.html.form.Button;\r
import org.apache.wicket.markup.html.form.DropDownChoice;\r
setStatelessHint(false);\r
setOutputMarkupId(true);\r
\r
- Form<Void> form = new Form<Void>("editForm") {\r
+ Form<Void> form = new Form<Void>("editForm");\r
+ add(form);\r
+\r
+ nameModel = Model.of(tm.name);\r
+ dueModel = Model.of(tm.due);\r
+ statusModel = Model.of(tm.status);\r
+ notificationModel = Model.of(true);\r
+\r
+ form.add(new TextField<String>("name", nameModel));\r
+ form.add(new DateTextField("due", dueModel, "yyyy-MM-dd"));\r
+\r
+ List<Status> statusChoices = Arrays.asList(Status.Open, Status.Closed);\r
+ form.add(new DropDownChoice<TicketModel.Status>("status", statusModel, statusChoices));\r
+\r
+ form.add(new AjaxButton("save") {\r
\r
private static final long serialVersionUID = 1L;\r
\r
@Override\r
- protected void onSubmit() {\r
-\r
+ protected void onSubmit(AjaxRequestTarget target, Form<?> form) {\r
String name = nameModel.getObject();\r
if (StringUtils.isEmpty(name)) {\r
return;\r
// TODO error\r
}\r
}\r
- };\r
- add(form);\r
-\r
- nameModel = Model.of(tm.name);\r
- dueModel = Model.of(tm.due);\r
- statusModel = Model.of(tm.status);\r
- notificationModel = Model.of(true);\r
-\r
- form.add(new TextField<String>("name", nameModel));\r
- form.add(new DateTextField("due", dueModel, "yyyy-MM-dd"));\r
-\r
- List<Status> statusChoices = Arrays.asList(Status.Open, Status.Closed);\r
- form.add(new DropDownChoice<TicketModel.Status>("status", statusModel, statusChoices));\r
-\r
- form.add(new Button("save"));\r
+ });\r
Button cancel = new Button("cancel") {\r
private static final long serialVersionUID = 1L;\r
\r
\r
import org.apache.wicket.PageParameters;\r
import org.apache.wicket.RestartResponseException;\r
+import org.apache.wicket.ajax.AjaxRequestTarget;\r
+import org.apache.wicket.ajax.markup.html.form.AjaxButton;\r
import org.apache.wicket.extensions.markup.html.form.DateTextField;\r
import org.apache.wicket.markup.html.form.Button;\r
import org.apache.wicket.markup.html.form.Form;\r
setStatelessHint(false);\r
setOutputMarkupId(true);\r
\r
- Form<Void> form = new Form<Void>("editForm") {\r
+ Form<Void> form = new Form<Void>("editForm");\r
+ add(form);\r
+\r
+ nameModel = Model.of("");\r
+ dueModel = Model.of(new Date(System.currentTimeMillis() + TimeUtils.ONEDAY));\r
+\r
+ form.add(new TextField<String>("name", nameModel));\r
+ form.add(new DateTextField("due", dueModel, "yyyy-MM-dd"));\r
+\r
+ form.add(new AjaxButton("create") {\r
\r
private static final long serialVersionUID = 1L;\r
\r
@Override\r
- protected void onSubmit() {\r
-\r
+ protected void onSubmit(AjaxRequestTarget target, Form<?> form) {\r
String name = nameModel.getObject();\r
if (StringUtils.isEmpty(name)) {\r
return;\r
// TODO error\r
}\r
}\r
- };\r
- add(form);\r
-\r
- nameModel = Model.of("");\r
- dueModel = Model.of(new Date(System.currentTimeMillis() + TimeUtils.ONEDAY));\r
-\r
- form.add(new TextField<String>("name", nameModel));\r
- form.add(new DateTextField("due", dueModel, "yyyy-MM-dd"));\r
+ });\r
\r
- form.add(new Button("create"));\r
Button cancel = new Button("cancel") {\r
private static final long serialVersionUID = 1L;\r
\r