Package org.apache.wicket

Examples of org.apache.wicket.Component$ComponentBorderChange


  private Component getChildComponent(final MarkupStream markupStream,
    MarkupContainer enclosureParent)
  {
    String fullChildId = getChildId();

    Component controller = enclosureParent.get(fullChildId);
    if (controller == null)
    {
      int orgIndex = markupStream.getCurrentIndex();
      try
      {
View Full Code Here


          submitter = findSubmittingButton();

          if (submitter instanceof IFormSubmittingComponent)
          {
            IFormSubmittingComponent submittingComponent = (IFormSubmittingComponent) submitter;
            Component component = (Component) submitter;

            if (!component.isVisibleInHierarchy())
            {
              throw new WicketRuntimeException("Submit Button " +
                submittingComponent.getInputName() + " (path=" +
                component.getPageRelativePath() + ") is not visible");
            }

            if (!component.isEnabledInHierarchy())
            {
              throw new WicketRuntimeException("Submit Button " +
                submittingComponent.getInputName() + " (path=" +
                component.getPageRelativePath() + ") is not enabled");
            }
          }
        }

        // When processing was triggered by a Wicket IFormSubmittingComponent and that
        // component indicates it wants to be called immediately
        // (without processing), call the IFormSubmittingComponent.onSubmit* methods right
        // away.
        if (submitter != null && !submitter.getDefaultFormProcessing())
        {
          submitter.onSubmit();
          submitter.onAfterSubmit();
        }
        else
        {
          // the submit request might be for one of the nested forms, so let's
          // find the right one:
          final Form<?> formToProcess = findFormToProcess(submitter);

          // process the form for this request
          formToProcess.process(submitter);
        }
      }
    }
    // If multi part did fail check if an error is registered and call
    // onError
    else if (hasError())
    {
      callOnError(submitter);
    }

    // update auto labels if we are inside an ajax request
    final AjaxRequestTarget target = getRequestCycle().find(AjaxRequestTarget.class);
    if (target != null)
    {
      visitChildren(FormComponent.class, new IVisitor<FormComponent<?>, Void>()
      {
        @Override
        public void component(FormComponent<?> component, IVisit<Void> visit)
        {
          component.updateAutoLabels(target);
        }
      });
    }
  }
View Full Code Here

    // add an empty textfield (otherwise IE doesn't work)
    buffer.append("<input type=\"text\" autocomplete=\"off\"/>");

    // add the submitting component
    final Component submittingComponent = (Component)defaultSubmittingComponent;
    buffer.append("<input type=\"submit\" name=\"");
    buffer.append(defaultSubmittingComponent.getInputName());
    buffer.append("\" onclick=\" var b=document.getElementById('");
    buffer.append(submittingComponent.getMarkupId());
    buffer
      .append("'); if (b!=null&amp;&amp;b.onclick!=null&amp;&amp;typeof(b.onclick) != 'undefined') {  var r = Wicket.bind(b.onclick, b)(); if (r != false) b.click(); } else { b.click(); };  return false;\" ");
    buffer.append(" />");

    // close div
View Full Code Here

    getResponse().write(buffer);

    // if a default submitting component was set, handle the rendering of that
    if (defaultSubmittingComponent instanceof Component)
    {
      final Component submittingComponent = (Component)defaultSubmittingComponent;
      if (submittingComponent.isVisibleInHierarchy()
          && submittingComponent.isEnabledInHierarchy())
      {
        appendDefaultButtonField();
      }
    }
  }
View Full Code Here

   */
  public static String getRootFormRelativeId(Component component)
  {
    String id = component.getId();
    final PrependingStringBuffer inputName = new PrependingStringBuffer(id.length());
    Component c = component;
    while (true)
    {
      inputName.prepend(id);
      c = c.getParent();
      if (c == null || (c instanceof Form<?> && ((Form<?>)c).isRootForm())
        || c instanceof Page)
      {
        break;
      }
      inputName.prepend(Component.PATH_SEPARATOR);
      id = c.getId();
    }

    /*
     * having input name "submit" causes problems with JavaScript, so we create a unique string
     * to replace it by prepending a path separator, as this identification can be assigned to
View Full Code Here

   */
  protected CharSequence appendAnchor(final ComponentTag tag, CharSequence url)
  {
    if (url != null)
    {
      Component anchor = getAnchor();
      if (anchor != null)
      {
        if (url.toString().indexOf('#') == -1)
        {
          String id;
          if (anchor.getOutputMarkupId())
          {
            id = anchor.getMarkupId();
          }
          else
          {
            id = anchor.getMarkupAttributes().getString("id");
          }

          if (id != null)
          {
            url = url + "#" + anchor.getMarkupId();
          }
          else
          {
            throw new WicketRuntimeException("an achor component was set on " + this +
              " but it neither has outputMarkupId set to true " +
View Full Code Here

      protected void populateItem(ListItem<IColumn<T, S>> item)
      {
        final IColumn<T, S> col = item.getModelObject();
        item.setRenderBodyOnly(true);

        Component filter = null;

        if (col instanceof IFilteredColumn)
        {
          IFilteredColumn<T, S> filteredCol = (IFilteredColumn<T, S>)col;
          filter = filteredCol.getFilter(FILTER_ID, form);
        }

        if (filter == null)
        {
          filter = new NoFilter(FILTER_ID);
        }
        else
        {
          if (!filter.getId().equals(FILTER_ID))
          {
            throw new IllegalStateException(
              "filter component returned  with an invalid component id. invalid component id [" +
                filter.getId() +
                "] required component id [" +
                getId() +
                "] generating column [" + col.toString() + "] ");
          }
        }

        if (col instanceof IStyledColumn)
        {
          filter.add(new Behavior()
          {
            private static final long serialVersionUID = 1L;

            /**
             * @see Behavior#onComponentTag(Component, ComponentTag)
View Full Code Here

   * @throws Exception
   */
  @Test
  public void label() throws Exception
  {
    Component label = new MyPage().get("label");
    IMarkupFragment markup = label.getMarkup();
    compareMarkupWithString(markup, "<span wicket:id=\"label\">text</span>");

    label = new MyPanelPage().get("panel:label");
    markup = label.getMarkup();
    compareMarkupWithString(markup, "<span wicket:id=\"label\">text</span>");
  }
View Full Code Here

  public void setComponentPathAttributeName()
  {
    String attributeName = "data-wicket-path";
    tester.getApplication().getDebugSettings().setComponentPathAttributeName(attributeName);
    MockPageWithLink page = new MockPageWithLink();
    Component link = new Link(MockPageWithLink.LINK_ID)
    {
      @Override
      public void onClick()
      {
      }
    }.setMarkupId(MockPageWithLink.LINK_ID);
    page.add(link);
    tester.startPage(page);

    TagTester tagTester = tester.getTagById(MockPageWithLink.LINK_ID);
    String wicketPath = tagTester.getAttribute(attributeName);
    assertEquals(link.getPageRelativePath(), wicketPath);
  }
View Full Code Here

  @Test
  public void setComponentPathAttributeNameDeprected()
  {
    tester.getApplication().getDebugSettings().setOutputComponentPath(true);
    MockPageWithLink page = new MockPageWithLink();
    Component link = new Link(MockPageWithLink.LINK_ID)
    {
      @Override
      public void onClick()
      {
      }
    }.setMarkupId(MockPageWithLink.LINK_ID);
    page.add(link);
    tester.startPage(page);

    TagTester tagTester = tester.getTagById(MockPageWithLink.LINK_ID);
    String wicketPath = tagTester.getAttribute("wicketpath");
    assertEquals(link.getPageRelativePath(), wicketPath);
  }
View Full Code Here

TOP

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

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.