public void testUrlLinkModified() { // print(tester.getLastRenderedPage(), true, true); final FormTester requestFormTester = tester.newFormTester("demoRequestsForm"); final String requestName = "WMS_describeLayer.url"; requestFormTester.select("demoRequestsList", 1); /* * There's an AjaxFormSubmitBehavior attached to onchange so force it */ tester.executeAjaxEvent("demoRequestsForm:demoRequestsList", "onchange"); tester.assertModelValue("demoRequestsForm:demoRequestsList", requestName); final String modifiedUrl = "http://modified/url"; TextField url = (TextField) tester.getComponentFromLastRenderedPage("demoRequestsForm:url"); url.setModelValue(new String[] {modifiedUrl}); assertEquals(modifiedUrl, url.getValue()); final boolean isAjax = true; tester.clickLink("demoRequestsForm:submit", isAjax); tester.assertVisible("responseWindow"); IModel model = tester.getLastRenderedPage().getModel(); assertTrue(model.getObject() instanceof DemoRequest); DemoRequest req = (DemoRequest) model.getObject(); String requestUrl = req.getRequestUrl(); assertEquals(modifiedUrl, requestUrl); }
public UserDetailForm(final String id) { super(id); name = new TextField("name", new PropertyModel(properties, "name")); name.setRequired(true); name.setModelValue(user.getName()); add(name); // add(nameFeedback = new ComponentFeedbackPanel("nameFeedback", // name)); add(new Label("nameLabel", "Meno")); add(new FormComponentFeedbackBorder("border").add(name)); surname = new TextField("surname", new PropertyModel(properties, "surname")); surname.setRequired(true); surname.setModelValue(user.getSurname()); add(surname); // add(surnameFeedback = new ComponentFeedbackPanel("surnameFeedback", // surname)); add(new Label("surnameLabel", "Priezvisko")); email = new TextField("email", new PropertyModel(properties, "email")); email.setRequired(true); email.setModelValue(user.getEmail()); email.setEnabled(false); add(email); // add(addressFeedback = new ComponentFeedbackPanel("addressFeedback", // address)); add(new Label("emailLabel", "Email")); login = new TextField("login", new PropertyModel(properties, "login")); login.setRequired(true); login.setModelValue(user.getLogin()); login.setEnabled(false); add(login); // add(loginNameFeedback = new ComponentFeedbackPanel("loginNameFeedback", // loginName)); add(new Label("loginLabel", "Login")); // region= new TextField("region", new PropertyModel(properties, // "region")); // region.setRequired(false); // region.setModelValue(user.getRegion()); // add(region); // add(new Label("regionLabel","Region")); County mesto = new County(); town = new DropDownChoice("town", new PropertyModel(mesto, "name"), TOWN_LIST); town.setRequired(false); if (user.getTown() != null) mesto.setName(user.getTown().getName()); add(town); add(new Label("townLabel", "Town")); HandicapType postihnutie = new HandicapType(); handicapType = new DropDownChoice( "handicapType", new PropertyModel(postihnutie, "name"), HANDICAPTYPE_LIST); handicapType.setRequired(false); if (user.getHandicapType() != null) postihnutie.setName(user.getHandicapType().getName()); add(handicapType); add(new Label("handicapTypeLabel", "Handicap")); preferRegion = new CheckBox("preferRegion", new PropertyModel(properties, "preferRegion")); add(preferRegion); add(new Label("preferRegionLabel", "Preferujem")); add(new Label("registrationDateLabel", "Dátum registrácie:")); add(new Label("userRegistrationDateLabel", dateFormat.format(user.getRegistrationDate()))); password = new PasswordTextField("password", new PropertyModel(properties, "password")); add(password); password.setRequired(false); // add(passwordFeedback = new ComponentFeedbackPanel( // "passwordFeedback", password)); add(new Label("passwordLabel", "Heslo:")); passwordAgain = new PasswordTextField("passwordAgain", new PropertyModel(properties, "passwordAgain")); add(passwordAgain); passwordAgain.setRequired(false); // add(passwordAgainFeedback = new ComponentFeedbackPanel("passwordAgainFeedback", // passwordAgain)); add(new Label("passwordAgainLabel", "Heslo znova")); add(submit = new Button("submit", new ResourceModel("button.submit"))); // add(submitFeedback = new ComponentFeedbackPanel("submitFeedback", // submit)); }