Package org.apache.wicket

Examples of org.apache.wicket.MarkupContainer


  }

  @Test
  public void fragment_doesNotDequeueAcrossRegion()
  {
    MarkupContainer a = new A();

    TestPage page = new TestPage();
    page.setPageMarkup("<f wicket:id='fragment'></f><wicket:fragment wicket:id='f'><a wicket:id='a'></a></wicket:fragment>");

    Fragment fragment = new Fragment("fragment", "f", page);

    page.queue(a, fragment);

    assertThat(page, hasPath(new Path(fragment)));
    assertThat(a.getParent(), is(nullValue()));
  }
View Full Code Here


 
  @Test
  public void containerTag1()
  {
    MarkupContainer a = new A(), b = new B();

    TestPage page = new TestPage();
    page.setPageMarkup("<wicket:container wicket:id='a'><b wicket:id='b'></b></wicket:container>");

    page.queue(a, b);
View Full Code Here

     */
    @Override
    @SuppressWarnings("unchecked")
    public Component newAutoComponent(final String autoId, PathInfo pathInfo)
    {
      final MarkupContainer container = pathInfo.getContainer();

      if ((pathInfo.extension != null) &&
        supportedPageExtensions.contains(pathInfo.extension))
      {
        // Obviously a href like href="myPkg.MyLabel.html" will do as
        // well. Wicket will not throw an exception. It accepts it.

        Page page = container.getPage();
        final IClassResolver defaultClassResolver = page.getApplication()
          .getApplicationSettings()
          .getClassResolver();
        String className = Packages.absolutePath(page.getClass(), pathInfo.path);
        className = Strings.replaceAll(className, "/", ".").toString();
        if (className.startsWith("."))
        {
          className = className.substring(1);
        }

        try
        {
          final Class<? extends Page> clazz = (Class<? extends Page>)defaultClassResolver.resolveClass(className);
          return new AutolinkBookmarkablePageLink<Void>(autoId, clazz,
            pathInfo.pageParameters, pathInfo.anchor);
        }
        catch (ClassNotFoundException ex)
        {
          log.warn("Did not find corresponding java class: " + className);
          // fall through
        }

        // Make sure base markup pages (inheritance) are handled correct
        MarkupContainer parentWithContainer = container;
        if (container.getParent() != null)
        {
          parentWithContainer = container.findParentWithAssociatedMarkup();
        }
        if ((parentWithContainer instanceof Page) && !pathInfo.path.startsWith("/") &&
View Full Code Here

      return false;
    }

    if (!(item instanceof MarkupContainer))
      return false;
    MarkupContainer container = (MarkupContainer)item;
    if (container.get(child.getId()) != child)
      return false;
    if (child.getParent() != container)
      return false;
    return true;
  }
View Full Code Here

    // Search for the fragment markup
    IMarkupFragment childMarkup = markup.find(markupId);
    if (childMarkup == null)
    {
      // There is one more option if the markup provider has associated markup
      MarkupContainer markupProvider = getMarkupProvider(container);
      Markup associatedMarkup = markupProvider.getAssociatedMarkup();
      if (associatedMarkup != null)
      {
        markup = associatedMarkup;
        if (markup != null)
        {
          childMarkup = markup.find(markupId);
        }
      }
    }

    if (childMarkup == null)
    {
      throw new MarkupNotFoundException("No Markup found for Fragment " + markupId +
        " in providing markup container " + markupProvider.toString());
    }

    if (child == null)
    {
      return childMarkup;
View Full Code Here

   */
  public void onActivate(final IBreadCrumbParticipant previous)
  {
    if (previous != null)
    {
      MarkupContainer parent = previous.getComponent().getParent();
      if (parent != null)
      {
        final String thisId = component.getId();
        if (parent.get(thisId) != null)
        {
          parent.replace(component);
        }
        else
        {
          // try to search downwards to match the id
          // NOTE unfortunately, we can't rely on the path pre 2.0
          Component c = parent.visitChildren(new IVisitor<Component, Component>()
          {
            public void component(final Component component,
              final IVisit<Component> visit)
            {
              if (component.getId().equals(thisId))
              {
                visit.stop(component);
              }
            }
          });
          if (c == null)
          {
            // not found... do a reverse search (upwards)
            c = parent.visitParents(MarkupContainer.class,
              new IVisitor<MarkupContainer, Component>()
              {
                public void component(final MarkupContainer component,
                  final IVisit<Component> visit)
                {
View Full Code Here

   * @return The link component
   */
  protected Component newJunctionLink(final MarkupContainer parent, final String id,
    final String imageId, final TreeNode node)
  {
    final MarkupContainer junctionLink;

    if (node.isLeaf() == false)
    {
      junctionLink = newLink(parent, id, new ILinkCallback()
      {
        private static final long serialVersionUID = 1L;

        public void onClick(final AjaxRequestTarget target)
        {
          if (isNodeExpanded(node))
          {
            getTreeState().collapseNode(node);
          }
          else
          {
            getTreeState().expandNode(node);
          }
          onJunctionLinkClicked(target, node);
          if (target != null)
          {
            updateTree(target);
          }
        }
      });
    }
    else
    {
      junctionLink = new WebMarkupContainer(id)
      {
        private static final long serialVersionUID = 1L;

        /**
         * {@inheritDoc}
         */
        @Override
        protected void onComponentTag(final ComponentTag tag)
        {
          super.onComponentTag(tag);
          tag.put("onclick", "return false");
        }
      };
    }

    if (imageId != null)
    {
      junctionLink.add(newJunctionImage(junctionLink, imageId, node));
    }

    return junctionLink;
  }
View Full Code Here

      add(newIndentation(this, "indent", node, level));

      add(newJunctionLink(this, "link", "image", node));

      MarkupContainer nodeLink = newNodeLink(this, "nodeLink", node);
      add(nodeLink);

      nodeLink.add(newNodeIcon(nodeLink, "icon", node));

      nodeLink.add(new Label("label", new AbstractReadOnlyModel<String>()
      {
        private static final long serialVersionUID = 1L;

        /**
         * @see org.apache.wicket.model.AbstractReadOnlyModel#getObject()
View Full Code Here

    // Search for the fragment markup
    IMarkupFragment childMarkup = markup.find(markupId);
    if (childMarkup == null)
    {
      // There is one more option if the markup provider has associated markup
      MarkupContainer markupProvider = getMarkupProvider(container);
      Markup associatedMarkup = markupProvider.getAssociatedMarkup();
      if (associatedMarkup != null)
      {
        markup = associatedMarkup;
        if (markup != null)
        {
View Full Code Here

   *            tree node for which the link should be created.
   * @return The link component
   */
  protected Component newJunctionLink(MarkupContainer parent, final String id, final Object node)
  {
    final MarkupContainer junctionLink;

    if (isLeaf(node) == false)
    {
      junctionLink = newLink(id, new ILinkCallback()
      {
        private static final long serialVersionUID = 1L;

        public void onClick(AjaxRequestTarget target)
        {
          if (isNodeExpanded(node))
          {
            getTreeState().collapseNode(node);
          }
          else
          {
            getTreeState().expandNode(node);
          }
          onJunctionLinkClicked(target, node);
          updateTree(target);
        }
      });
      junctionLink.add(new Behavior()
      {
        private static final long serialVersionUID = 1L;

        @Override
        public void onComponentTag(Component component, ComponentTag tag)
View Full Code Here

TOP

Related Classes of org.apache.wicket.MarkupContainer

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.