Package org.apache.wicket

Examples of org.apache.wicket.Component$ComponentModelChange


  }

  @Override
  protected boolean matchesSafely(Component item)
  {
    Component cursor = item;
    for (int i = 0; i < path.size(); i++)
    {
      if (!(cursor instanceof MarkupContainer))
      {
        return false;
      }

      String id = path.get(i).getId();
      Component child = ((MarkupContainer)cursor).get(id);
      if (child== null)
      {
        return false;
      }
     
View Full Code Here


  }

  @Override
  public void describeMismatchSafely(Component item, Description desc)
  {
    Component cursor = item;

    int matched = 0;

    String error = null;

    for (int i = 0; i < path.size(); i++)
    {
      matched = i;
      if (!(cursor instanceof MarkupContainer))
      {
        error = "next component has to be at least a MarkupContainer to contain children, but was: " +
          toString(cursor);
        break;
      }

      cursor = ((MarkupContainer)cursor).get(path.get(i).getId());
      if (cursor == null)
      {
        error = "next child with id: '" + path.get(i).getId() + "' not found";
        break;
      }
      if (!path.get(i).getType().isAssignableFrom(cursor.getClass()))
      {
        error = "expected next child of type: " + path.get(i).getType().getSimpleName() +
          ", but found: " + toString(cursor);
        break;
      }
View Full Code Here

        // the components all get rendered as disabled, so the browser would not send
        // any parameters. thus FormTester must not send any either.
        assertTrue(getRequest().getPostParameters().getParameterNames().isEmpty());
      }
    });
    final Component form = tester.getComponentFromLastRenderedPage("form");
    form.setEnabled(false);
    assertFalse(form.isEnabled());
    Component check = tester.getComponentFromLastRenderedPage("form:checkbox");
    assertTrue(check.isEnabled());
    assertFalse(check.isEnabledInHierarchy());
    FormTester formTester = tester.newFormTester("form");
    try
    {
      formTester.submit();
      fail("Executing the listener on disabled component is not allowed.");
View Full Code Here

        // Create an instance of the component
        try
        {
          Constructor<? extends Component> con = componentClass.getConstructor(new Class[] { String.class });

          Component comp = con.newInstance(MockPageWithLinkAndComponent.COMPONENT_ID);
          page.replace(comp);
          comp.setOutputMarkupId(true);

          target.add(comp);
        }
        catch (Exception e)
        {
View Full Code Here

    Serializable target = object;

    if (object instanceof Component)
    {
      // clone to not detach the original component (WICKET-5013, 5014)
      Component clone = (Component) cloneObject(object);
      clone.detach();

      target = clone;
    }
    else if (object instanceof IDetachable)
    {
      // clone to not detach the original IDetachable (WICKET-5013, 5014)
      IDetachable clone = (IDetachable) cloneObject(object);
      clone.detach();

      target = clone;
    }

    return objectSizeOfStrategy.sizeOf(target);
View Full Code Here

  @Override
  protected void updateAjaxAttributes(AjaxRequestAttributes attributes)
  {
    super.updateAjaxAttributes(attributes);
   
    Component component = getComponent();
   
    //textfiels and textareas will trigger this behavior with event 'inputchange'
    //while all the other components will use 'change'
    if (component instanceof TextField || component instanceof TextArea)
    {
View Full Code Here

    @Override
    protected Object replaceObject(Object obj) throws IOException
    {
      if (obj instanceof Component)
      {
        final Component component = (Component)obj;
        String name = component.getPath();
        replacedComponents.put(name, component);
        return name;
      }
      return super.replaceObject(obj);
    }
View Full Code Here

  @Override
  protected void onBind()
  {
    super.onBind();

    Component component = getComponent();
    if (!(component instanceof FormComponent))
    {
      throw new WicketRuntimeException("Behavior " + getClass().getName()
        + " can only be added to an instance of a FormComponent");
    }
View Full Code Here

   * @return form to submit or {@code null} if none found
   */
  protected Form<?> findForm()
  {
    // try to find form in the hierarchy of owning component
    Component component = getComponent();
    if (component instanceof Form<?>)
    {
      return (Form<?>)component;
    }
    else
    {
      return component.findParent(Form.class);
    }
  }
View Full Code Here

   */
  @Test
  public void toggleButtonEnabledState()
  {
    tester.startPage(MockFormPage.class);
    Component submit = tester.getComponentFromLastRenderedPage("form:submit");
    assertTrue(submit.isEnabled());
    submit.setEnabled(false);
    assertFalse(submit.isEnabled());
  }
View Full Code Here

TOP

Related Classes of org.apache.wicket.Component$ComponentModelChange

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.