Package org.apache.wicket

Examples of org.apache.wicket.Component


    tester.newFormTester("form").submit("ajaxButton");
    assertEquals("a text value", page.text);
    assertTrue(ajaxButtonSubmitted.get());

    assertFalse(ajaxSubmitLinkSubmitted.get());
    Component submitter = page.form.get("ajaxlink");
    tester.newFormTester("form").submit(submitter);
    assertEquals("a text value", page.text);
    assertTrue(ajaxSubmitLinkSubmitted.get());

    tester.clickLink("form:link");
View Full Code Here


   */
  @Test
  public void renderComponentRelativeErrorMessage()
  {
    tester.startPage(new ComponentFeedbackResourceTestingPage());
    Component label = tester.getComponentFromLastRenderedPage("label");
    tester.assertComponentFeedbackMessage(label, "error.msg", null, new ExactLevelFeedbackMessageFilter(FeedbackMessage.ERROR));
  }
View Full Code Here

   */
  @Test
  public void renderComponentRelativeInfoMessage()
  {
    tester.startPage(new ComponentFeedbackResourceTestingPage());
    Component label = tester.getComponentFromLastRenderedPage("label");
    tester.assertComponentFeedbackMessage(label, "info.msg", null, new ExactLevelFeedbackMessageFilter(FeedbackMessage.INFO));
  }
View Full Code Here

      return null;
    }

    final String id = tag.getAttribute(getWicketNamespace(markupStream) + WICKET_FOR).trim();

    Component component = findRelatedComponent(container, id);
    if (component == null)
    {
      throw new ComponentNotFoundException("Could not find form component with id '" + id +
        "' while trying to resolve wicket:for attribute");
    }

    if (!(component instanceof ILabelProvider))
    {
      throw new WicketRuntimeException("Component pointed to by wicket:for attribute '" + id +
        "' does not implement " + ILabelProvider.class.getName());
    }

    if (!component.getOutputMarkupId())
    {
      component.setOutputMarkupId(true);
      if (component.hasBeenRendered())
      {
        logger.warn(
          "Component: {} is referenced via a wicket:for attribute but does not have its outputMarkupId property set to true",
          component.toString(false));
      }
    }

    if (component instanceof FormComponent)
    {
      component.setMetaData(MARKER_KEY, new AutoLabelMarker((FormComponent<?>)component));
    }

    return new AutoLabel("label" + container.getPage().getAutoIndex(), component);
  }
View Full Code Here

   */
  static Component findRelatedComponent(MarkupContainer container, final String id)
  {
    // try the quick and easy route first

    Component component = container.get(id);
    if (component != null)
    {
      return component;
    }

View Full Code Here

      {
        path = componentIdPageId + path;
      }
    }

    Component component = getLastRenderedPage().get(path);
    if (component == null)
    {
      fail("path: '" + path + "' does not exist for page: " +
        Classes.simpleName(getLastRenderedPage().getClass()));
      return null;
    }

    if (!wantVisibleInHierarchy || component.isVisibleInHierarchy())
    {
      return component;
    }

    // Not found or not visible
View Full Code Here

   *            expected component class
   * @return a <code>Result</code>
   */
  public <C extends Component> Result isComponent(String path, Class<C> expectedComponentClass)
  {
    Component component = getComponentFromLastRenderedPage(path);
    if (component == null)
    {
      return Result.fail("Component not found: " + path);
    }

    return isTrue("component '" + Classes.simpleName(component.getClass()) + "' is not type:" +
      Classes.simpleName(expectedComponentClass),
      expectedComponentClass.isAssignableFrom(component.getClass()));
  }
View Full Code Here

   */
  public Result isVisible(final String path)
  {
    final Result result;

    Component component = getComponentFromLastRenderedPage(path, false);
    if (component == null)
    {
      result = Result.fail("path: '" + path + "' does no exist for page: " +
        Classes.simpleName(getLastRenderedPage().getClass()));
    }
    else
    {
      result = isTrue("component '" + path + "' is not visible",
        component.isVisibleInHierarchy());
    }

    return result;
  }
View Full Code Here

   */
  public Result isInvisible(final String path)
  {
    final Result result;

    Component component = getComponentFromLastRenderedPage(path, false);
    if (component == null)
    {
      result = Result.fail("path: '" + path + "' does no exist for page: " +
        Classes.simpleName(getLastRenderedPage().getClass()));
    }
    else
    {
      result = isFalse("component '" + path + "' is visible",
        component.isVisibleInHierarchy());
    }

    return result;
  }
View Full Code Here

   *            path to component
   * @return a <code>Result</code>
   */
  public Result isEnabled(final String path)
  {
    Component component = getComponentFromLastRenderedPage(path);
    if (component == null)
    {
      fail("path: '" + path + "' does no exist for page: " +
        Classes.simpleName(getLastRenderedPage().getClass()));
    }

    return isTrue("component '" + path + "' is disabled", component.isEnabledInHierarchy());
  }
View Full Code Here

TOP

Related Classes of org.apache.wicket.Component

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.