List of usage examples for org.apache.wicket.markup.html.panel FeedbackPanel getFeedbackMessagesModel
public final FeedbackMessagesModel getFeedbackMessagesModel()
From source file:gr.interamerican.wicket.markup.html.panel.picker.TestPickerPanel.java
License:Open Source License
/** * def.setDisableUnauthorizedButtons(false); * def.setItemSelectedActionFlag(new AlwaysDownFlag()); * /*from ww w. ja v a2 s . c o m*/ * The expected result is that the pick button will be enabled, * but a message will be rendered in the feedback panel when it * is pressed. */ @Test public void testPickAction_FlagDown_DisabledUnauthorizedFalse() { PickerPanelDef<BeanWithOrderedFields> def = createDef(); def.setDisableUnauthorizedButtons(false); def.setItemSelectedActionFlag(new AlwaysDownFlag()); tester.startPage(getTestPage(new PickerPanel<BeanWithOrderedFields>(def))); String buttonId = path("tableForm:selectButton"); tester.assertComponent(buttonId, AjaxButton.class); AjaxButton button = (AjaxButton) tester.getComponentFromLastRenderedPage(path("tableForm:selectButton")); assertTrue(button.isEnabled()); String feedbackPanelId = path("feedback"); tester.assertComponent(feedbackPanelId, FeedbackPanel.class); FeedbackPanel feedbackPanel = (FeedbackPanel) tester.getComponentFromLastRenderedPage(feedbackPanelId); /* * No messages yet. */ assertEquals(0, feedbackPanel.getFeedbackMessagesModel().getObject().size()); /* * Press the button. */ callback.setExecuted(false); tester.executeAjaxEvent(button, "onclick"); /* * The action was not executed, and the down message of the flag * is registered in the feedback panel. */ assertFalse(callback.isExecuted()); assertEquals(1, feedbackPanel.getFeedbackMessagesModel().getObject().size()); FeedbackMessage fm = feedbackPanel.getFeedbackMessagesModel().getObject().iterator().next(); assertEquals(AlwaysDownFlag.DOWN_MESSAGE, fm.getMessage().toString()); }
From source file:org.geogig.geoserver.web.repository.RepositoryEditPanelTest.java
License:Open Source License
@Test public void testPGAddWithEmptyFields() { // select PG config from the dropdown select(DropDownModel.PG_CONFIG);/*from ww w . j a va 2 s.c o m*/ // verify the PG config components are visible tester.assertInvisible(SETTINGS_PREFIX + "parentDirectory"); tester.assertVisible(SETTINGS_PREFIX + "repositoryNamePanel"); tester.assertVisible(SETTINGS_PREFIX + "pgPanel"); // click the Save button tester.executeAjaxEvent(SAVE_LINK, "click"); tester.assertRenderedPage(getStartPageClass()); // get the feedback panel FeedbackPanel c = (FeedbackPanel) tester.getComponentFromLastRenderedPage(FEEDBACK); List<FeedbackMessage> list = c.getFeedbackMessagesModel().getObject(); // by default, 3 required fields will be emtpy: repo name, database and password List<String> expectedMsgs = Lists.newArrayList("Field 'Repository Name' is required.", "Field 'Database Name' is required.", "Field 'Password' is required."); assertFeedbackMessages(list, expectedMsgs); }
From source file:org.geogig.geoserver.web.repository.RepositoryEditPanelTest.java
License:Open Source License
@Test public void testDirectoryAddWithEmptyFields() { // select Directory from the dropdown select(DropDownModel.DIRECTORY_CONFIG); // verify Directory config components are visible tester.assertVisible(SETTINGS_PREFIX + "parentDirectory"); tester.assertVisible(SETTINGS_PREFIX + "repositoryNamePanel"); tester.assertInvisible(SETTINGS_PREFIX + "pgPanel"); // click the Save button tester.executeAjaxEvent(SAVE_LINK, "click"); tester.assertRenderedPage(getStartPageClass()); // get the feedback panel FeedbackPanel c = (FeedbackPanel) tester.getComponentFromLastRenderedPage(FEEDBACK); List<FeedbackMessage> list = c.getFeedbackMessagesModel().getObject(); // by default, repo parent directory and repo name will be empty List<String> expectedMsgs = Lists.newArrayList("Field 'Repository Name' is required.", "Field 'Parent directory' is required."); assertFeedbackMessages(list, expectedMsgs); }
From source file:org.geogig.geoserver.web.repository.RepositoryImportPanelTest.java
License:Open Source License
@Test public void testPGImportMissingFields() { // select PG config from the dropdown select(DropDownModel.PG_CONFIG);/*from w w w . j ava 2 s . com*/ // verify the PG config components are visible tester.assertInvisible(SETTINGS_PREFIX + "repoDirectoryPanel"); tester.assertVisible(SETTINGS_PREFIX + "repositoryNamePanel"); tester.assertVisible(SETTINGS_PREFIX + "pgPanel"); // click the Import button tester.executeAjaxEvent(IMPORT_LINK, "click"); tester.assertRenderedPage(getStartPageClass()); // get the feedback panel FeedbackPanel c = (FeedbackPanel) tester.getComponentFromLastRenderedPage(FEEDBACK); List<FeedbackMessage> list = c.getFeedbackMessagesModel().getObject(); // by default, 3 required fields will be emtpy: repo name, database and password List<String> expectedMsgs = Lists.newArrayList("Field 'Repository Name' is required.", "Field 'Database Name' is required.", "Field 'Password' is required."); assertFeedbackMessages(list, expectedMsgs); }
From source file:org.geogig.geoserver.web.repository.RepositoryImportPanelTest.java
License:Open Source License
@Test public void testDirectoryImportMissingFields() { // select Directory from the dropdown select(DropDownModel.DIRECTORY_CONFIG); // verify Directory config components are visible tester.assertVisible(SETTINGS_PREFIX + "repoDirectoryPanel"); tester.assertInvisible(SETTINGS_PREFIX + "repositoryNamePanel"); tester.assertInvisible(SETTINGS_PREFIX + "pgPanel"); // click the Import button tester.executeAjaxEvent(IMPORT_LINK, "click"); tester.assertRenderedPage(getStartPageClass()); // get the feedback panel FeedbackPanel c = (FeedbackPanel) tester.getComponentFromLastRenderedPage(FEEDBACK); List<FeedbackMessage> list = c.getFeedbackMessagesModel().getObject(); // by default, repo directory will be empty List<String> expectedMsgs = Lists.newArrayList("Field 'Repository directory' is required."); assertFeedbackMessages(list, expectedMsgs); }
From source file:org.obiba.onyx.wicket.reusable.FeedbackWindow.java
License:Open Source License
@Override public FeedbackWindow setContent(Component component) { FeedbackPanel feedbackPanel = (FeedbackPanel) component; FeedbackMessage feedbackMessage = (feedbackPanel.getFeedbackMessagesModel().getObject()).get(0); component.add(new AttributeModifier("class", true, new Model<String>("feedback"))); if (feedbackMessage != null) { String messageLevel = feedbackMessage.getLevelAsString(); setType(Dialog.Type.valueOf(messageLevel)); setTitle(new StringResourceModel("Dialog." + messageLevel.toLowerCase(), this, null)); }//from w w w. j a va 2 s .c o m return (FeedbackWindow) super.setContent(component); }