Java tutorial
/* * Copyright (c) 2010-2012 Matthias Klass, Johannes Leimer, * Rico Lieback, Sebastian Gabriel, Lothar Gesslein, * Alexander Rampp, Kai Weidner * * This file is part of the Physalix Enrollment System * * Foobar is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * Foobar is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with Foobar. If not, see <http://www.gnu.org/licenses/>. */ package hsa.awp.admingui.usermanagement; import hsa.awp.admingui.controller.IAdminGuiController; import org.apache.wicket.ajax.AjaxRequestTarget; import org.apache.wicket.ajax.markup.html.form.AjaxButton; import org.apache.wicket.extensions.ajax.markup.html.modal.ModalWindow; import org.apache.wicket.markup.html.form.Form; import org.apache.wicket.markup.html.form.TextField; import org.apache.wicket.markup.html.panel.Panel; import org.apache.wicket.model.Model; import org.apache.wicket.spring.injection.annot.SpringBean; public class TemplateTestPanel extends Panel { /** * GuiController which feeds the Gui with Data. */ @SpringBean(name = "admingui.controller") private transient IAdminGuiController controller; public TemplateTestPanel(String id, final String template) { super(id); Form<String> form = new Form<String>("email-form"); final TextField<String> textField = new TextField<String>("email-field", new Model<String>(), String.class); form.add(textField); form.add(new AjaxButton("submit") { @Override protected void onSubmit(AjaxRequestTarget target, Form<?> form) { controller.testTemplate(textField.getModelObject(), template); ModalWindow modalWindow = findParent(ModalWindow.class); modalWindow.close(target); } }); add(form); } }