package wicket.contrib.smartform.web.page;

import java.util.HashMap;
import java.util.Map;

import wicket.PageParameters;
import wicket.contrib.smartform.web.BasePage;
import wicket.markup.html.form.Button;
import wicket.markup.html.form.Form;
import wicket.markup.html.form.TextField;
import wicket.markup.html.form.validation.IntegerValidator;
import wicket.markup.html.panel.FeedbackPanel;
import wicket.model.Model;
import wicket.model.PropertyModel;

/**
 * 
 */
public class TestPage extends BasePage {

	/**
	 * Constructor that is invoked when page is invoked without a session.
	 * 
	 * @param parameters
	 *            Page parameters
	 */
	public TestPage(final PageParameters parameters) {
		FeedbackPanel panel = new FeedbackPanel("fb");
		add(panel);
		Form globalForm = new Form("globalForm") {
			protected void onSubmit() {
				super.onSubmit();
			}
			
		};
		add(globalForm);
		Map map = new HashMap();
		map.put("gf", "nothing");
		globalForm.add(new TextField("globalField", new PropertyModel(map, "gf")).add(IntegerValidator.INT));
		Button globalButton =new Button("globalButton", new Model("Valid")) {
			protected void onSubmit() {
				super.onSubmit();
				System.out.println("toto");
			}
			
		};
		globalButton.setDefaultFormProcessing(false);
		globalForm.add(globalButton);
	}

}
