/** * Constructor. * * @param page * the page which components are being updated. */ public PartialPageUpdate(final Page page) { this.page = page; this.originalHeaderContainer = page.get(HtmlHeaderSectionHandler.HEADER_ID); WebResponse response = (WebResponse) page.getResponse(); bodyBuffer = new ResponseBuffer(response); headerBuffer = new ResponseBuffer(response); }
}).get(DummyPanelPage.TEST_PANEL_ID);
}).get(DummyPanelPage.TEST_PANEL_ID);
/** * Constructor. * * @param page * the page which components are being updated. */ public PartialPageUpdate(final Page page) { this.page = page; this.originalHeaderContainer = page.get(HtmlHeaderSectionHandler.HEADER_ID); WebResponse response = (WebResponse) page.getResponse(); bodyBuffer = new ResponseBuffer(response); headerBuffer = new ResponseBuffer(response); }
@Override public void onClick(Optional<AjaxRequestTarget> targetOptional) { targetOptional.ifPresent(target -> { Component componentToBeReplaced = target.getPage().get(PATH_TO_MONITOR_DETAILS); JamonMonitorDetailsPanel replacement = new JamonMonitorDetailsPanel( PATH_TO_MONITOR_DETAILS, monitorLabel); componentToBeReplaced.replaceWith(replacement); target.add(replacement); }); } }
private void replaceMonitorDetailsPanel(AjaxRequestTarget target) { EmptyMarkupContainer emptyMarkupContainer = new EmptyMarkupContainer( PATH_TO_MONITOR_DETAILS); target.getPage().get(PATH_TO_MONITOR_DETAILS).replaceWith(emptyMarkupContainer); target.add(emptyMarkupContainer); } }
private void replaceJamonMonitorTable(final TextField<?> monitorLabel, AjaxRequestTarget target, MonitorSpecification specification) { JamonMonitorTable toBeReplaced = (JamonMonitorTable)target.getPage() .get(PATH_TO_STATISTICS_TABLE); JamonMonitorTable replacement = new JamonMonitorTable(PATH_TO_STATISTICS_TABLE, specification, toBeReplaced.getItemsPerPage()); toBeReplaced.replaceWith(replacement); target.add(replacement); }
/** * assert component enabled. * * @param path * path to component * @return a <code>Result</code> */ public Result isEnabled(String path) { Component component = getLastRenderedPage().get(path); if (component == null) { fail("path: '" + path + "' does no exist for page: " + Classes.simpleName(getLastRenderedPage().getClass())); } return isTrue("component '" + path + "' is disabled", component.isEnabledInHierarchy()); }
/** * Gets the component with the given path from last rendered page. This method fails in case the * component couldn't be found, and it will return null if the component was found, but is not * visible. * * @param path * Path to component * @return The component at the path * @see org.apache.wicket.MarkupContainer#get(String) */ public Component getComponentFromLastRenderedPage(String path) { final Component component = getLastRenderedPage().get(path); if (component == null) { fail("path: '" + path + "' does not exist for page: " + Classes.simpleName(getLastRenderedPage().getClass())); return component; } if (component.isVisibleInHierarchy()) { return component; } return null; }
/** * Gets the component with the given path from last rendered page. This method fails in case the * component couldn't be found, and it will return null if the component was found, but is not * visible. * * @param path * Path to component * @return The component at the path * @see org.apache.wicket.MarkupContainer#get(String) */ public Component getComponentFromLastRenderedPage(String path) { final Component component = getLastRenderedPage().get(path); if (component == null) { fail("path: '" + path + "' does not exist for page: " + Classes.simpleName(getLastRenderedPage().getClass())); return component; } if (component.isVisibleInHierarchy()) { return component; } return null; }
/** * assert component visible. * * @param path * path to component * @return a <code>Result</code> */ public Result isVisible(String path) { Component component = getLastRenderedPage().get(path); if (component == null) { fail("path: '" + path + "' does no exist for page: " + Classes.simpleName(getLastRenderedPage().getClass())); } return isTrue("component '" + path + "' is not visible", component.isVisibleInHierarchy()); }
/** * assert component disabled. * * @param path * path to component * @return a <code>Result</code> */ public Result isDisabled(String path) { Component component = getLastRenderedPage().get(path); if (component == null) { fail("path: '" + path + "' does no exist for page: " + Classes.simpleName(getLastRenderedPage().getClass())); } return isFalse("component '" + path + "' is enabled", component.isEnabledInHierarchy()); }
/** * assert component visible. * * @param path * path to component * @return a <code>Result</code> */ public Result isVisible(String path) { Component component = getLastRenderedPage().get(path); if (component == null) { fail("path: '" + path + "' does no exist for page: " + Classes.simpleName(getLastRenderedPage().getClass())); } return isTrue("component '" + path + "' is not visible", component.isVisibleInHierarchy()); }
Component component = page.get(componentPath); if (component != null)
/** * assert component required. * * @param path * path to component * @return a <code>Result</code> */ public Result isRequired(String path) { Component component = getLastRenderedPage().get(path); if (component == null) { fail("path: '" + path + "' does no exist for page: " + Classes.simpleName(getLastRenderedPage().getClass())); } else if (component instanceof FormComponent == false) { fail("path: '" + path + "' is not a form component"); } return isRequired((FormComponent<?>)component); }
Component component = getLastRenderedPage().get(path); if (component == null)
private void executeHandlers(AjaxRequestTarget target, Page page) { for (EventSubscription curSubscription : subscriptions) { if (curSubscription.getContextAwareFilter().apply(event)) { String componentPath = curSubscription.getComponentPath(); Component component = page.get(componentPath); if (component != null) { if (curSubscription.getBehaviorIndex() == null) { invokeMethod(target, curSubscription, component); } else { invokeMethod(target, curSubscription, component.getBehaviorById(curSubscription.getBehaviorIndex())); } } else { LOGGER.debug("Cannot find component with path '{}' in page '{}'. Maybe it has been removed.", componentPath, page); EventBus.get().unregister(page, curSubscription); } } } }
/** * Get the drag source of the given request. * * @param request * request on which a drag happened * @return drag source */ final static DragSource read(Page page, Request request) { String path = request.getRequestParameters().getParameterValue("path").toString(); Component component = page.get(path); if (component == null) { throw new PageExpiredException("No drag source found " + path); } int behavior = request.getRequestParameters().getParameterValue("behavior").toInt(); return (DragSource)component.getBehaviorById(behavior); } }
public void testRemoveLinks() { // print(tester.getLastRenderedPage(), true, true); tester.assertComponent("form", Form.class); tester.assertModelValue("form:panel:container:identifiers:listContainer:items:1:itemProperties:0:component:border:txt", "one"); tester.assertModelValue("form:panel:container:identifiers:listContainer:items:2:itemProperties:0:component:border:txt", "two"); // remove the first identifier tester.executeAjaxEvent("form:panel:container:identifiers:listContainer:items:1:itemProperties:2:component:remove", "onclick"); assertNull(tester.getLastRenderedPage().get("form:panel:container:identifiers:listContainer:items:1:itemProperties:0:component:border:txt")); tester.assertModelValue("form:panel:container:identifiers:listContainer:items:2:itemProperties:0:component:border:txt", "two"); // remove the second as well tester.executeAjaxEvent("form:panel:container:identifiers:listContainer:items:2:itemProperties:2:component:remove", "onclick"); assertNull(tester.getLastRenderedPage().get("form:panel:container:identifiers:listContainer:items:1:itemProperties:0:component:border:txt")); assertNull(tester.getLastRenderedPage().get("form:panel:container:identifiers:listContainer:items:2:itemProperties:0:component:border:txt")); // print(tester.getLastRenderedPage(), true, true); // now trigger the validation, we cannot be without spatial data identifiers tester.submitForm("form"); String error = new ParamResourceModel("UniqueResourceIdentifiersEditor.noSpatialDatasetIdentifiers", null).getString(); tester.assertErrorMessages(new String[] {error}); }
@Override protected void onSubmit(AjaxRequestTarget target, Form<?> form) { //since this is not a regular form submit we have to manually update models // of form components we care about ((FormComponent)TestLDAPConnectionPanel.this.get("username")).processInput(); ((FormComponent)TestLDAPConnectionPanel.this.get("password")).processInput(); ((FormComponent)LDAPAuthProviderPanel.this.get("serverURL")).processInput(); ((FormComponent)LDAPAuthProviderPanel.this.get("useTLS")).processInput(); ((FormComponent)LDAPAuthProviderPanel.this.get("userDnPattern")).processInput(); ((FormComponent)LDAPAuthProviderPanel.this.get("userFilter")).processInput(); ((FormComponent)LDAPAuthProviderPanel.this.get("userFormat")).processInput(); String username = (String)((FormComponent)TestLDAPConnectionPanel.this.get("username")).getConvertedInput(); String password = (String)((FormComponent)TestLDAPConnectionPanel.this.get("password")).getConvertedInput(); LDAPSecurityServiceConfig ldapConfig = (LDAPSecurityServiceConfig) getForm().getModelObject(); doTest(ldapConfig, username, password); target.addComponent(getPage().get("feedback")); }