Package org.apache.wicket.markup

Examples of org.apache.wicket.markup.WicketParseException


    }

    // remove tag must not be open-close tags
    if (tag.isOpenClose())
    {
      throw new WicketParseException("Wicket remove tag must not be an open-close tag:", tag);
    }

    // Find the corresponding close tag and remove all tags in between
    ComponentTag closeTag;
    while (null != (closeTag = (ComponentTag)getNextFilter().nextTag()))
    {
      // No Wicket component tags are allowed within the preview region.
      // Wicket components will a component name assigned.
      if (closeTag.getId() == null)
      {
        continue;
      }

      // The first Wicket component following the preview region open
      // tag, must be it's corresponding close tag.
      if (closeTag.closes(tag))
      {
        // The tag (from open to close) should be ignored by
        // MarkupParser and not be added to the Markup.
        tag.setIgnore(true);
        return tag;
      }

      throw new WicketParseException(
        "Markup remove regions must not contain Wicket component tags:", closeTag);
    }

    throw new WicketParseException(
      "Did not find close tag for markup remove region. Open tag:", tag);
  }
View Full Code Here


      // no action required
    }
    else
    // if (problemEscalation == ERR_THROW_EXCEPTION)
    {
      throw new WicketParseException(msg, tag);
    }
  }
View Full Code Here

      // the child attribute of the open tag if required
      else if (tag.isClose())
      {
        if (stack == null)
        {
          throw new WicketParseException("Missing open tag for Enclosure:", tag);
        }

        // Remove the open tag from the stack
        ComponentTag lastEnclosure = stack.pop();

        // If the child attribute has not been given by the user,
        // then ...
        if (childId != null)
        {
          lastEnclosure.put(CHILD_ATTRIBUTE, childId);
          lastEnclosure.setModified(true);
          childId = null;
        }

        if (stack.size() == 0)
        {
          stack = null;
        }
      }
      else
      {
        throw new WicketParseException("Open-close tag not allowed for Enclosure:", tag);
      }
    }
    // Are we inside a wicket:enclosure tag?
    else if ((tag.getId() != null) && (isWicketTag == false) && (stack != null))
    {
      ComponentTag lastEnclosure = stack.lastElement();

      // If the enclosure tag has NO child attribute, then ...
      if (lastEnclosure.getString(CHILD_ATTRIBUTE) == null)
      {
        // We encountered more than one child component inside
        // the enclosure and are not able to automatically
        // determine the child component to delegate the
        // isVisible() to => Exception
        if (childId != null)
        {
          throw new WicketParseException(
            "Use <wicket:enclosure child='xxx'> to name the child component:", tag);
        }
        // Remember the child id. The open tag will be updated
        // once the close tag is found. See above.
        childId = tag.getId();
View Full Code Here

        {
          stack.pop();
        }
        else
        {
          throw new WicketParseException("Tag does not have a close tag:", top);
        }
      }

      return tag;
    }

    if (log.isDebugEnabled())
    {
      log.debug("tag: " + tag.toUserDebugString() + ", stack: " + stack);
    }

    // Check tag type
    if (tag.isOpen())
    {
      // Push onto stack
      stack.push(tag);
    }
    else if (tag.isClose())
    {
      // Check that there is something on the stack
      if (stack.size() > 0)
      {
        // Pop the top tag off the stack
        ComponentTag top = stack.pop();

        // If the name of the current close tag does not match the
        // tag on the stack then we may have a mismatched close tag
        boolean mismatch = !top.hasEqualTagName(tag);

        if (mismatch)
        {
          top.setHasNoCloseTag(true);

          // Pop any simple tags off the top of the stack
          while (mismatch && !requiresCloseTag(top.getName()))
          {
            top.setHasNoCloseTag(true);

            // Pop simple tag
            if (stack.isEmpty())
            {
              break;
            }
            top = stack.pop();

            // Does new top of stack mismatch too?
            mismatch = !top.hasEqualTagName(tag);
          }

          // If adjusting for simple tags did not fix the problem,
          // it must be a real mismatch.
          if (mismatch)
          {
            throw new ParseException("Tag " + top.toUserDebugString() +
              " has a mismatched close tag at " + tag.toUserDebugString(),
              top.getPos());
          }
        }

        // Tag matches, so add pointer to matching tag
        tag.setOpenTag(top);
      }
      else
      {
        throw new WicketParseException("Tag does not have a matching open tag:", tag);
      }
    }
    else if (tag.isOpenClose())
    {
      // Tag closes itself
View Full Code Here

      // If the tag is not a well-known wicket namespace tag
      if (!isWellKnown(xmlTag))
      {
        // give up
        throw new WicketParseException("Unknown tag name with Wicket namespace: '" +
          xmlTag.getName() +
          "'. Might be you haven't installed the appropriate resolver?", tag);
      }
    }
    else
    {
      // Everything else, except tags with Wicket namespace
      tag = new ComponentTag(xmlTag);
    }

    if (wicketIdValue != null)
    {
      if (wicketIdValue.trim().length() == 0)
      {
        throw new WicketParseException(
          "The wicket:id attribute value must not be empty. May be unmatched quotes?!?",
          tag);
      }
      // Make it a wicket component. Otherwise it would be RawMarkup
      tag.setId(wicketIdValue);
View Full Code Here

        // Tag matches, so add pointer to matching tag
        tag.setOpenTag(top);
      }
      else
      {
        throw new WicketParseException("Tag does not have a matching open tag:", tag);
      }
    }
    else if (tag.isOpenClose())
    {
      // Tag closes itself
View Full Code Here

      // If the tag is not a well-known wicket namespace tag
      if (!isWellKnown(tag))
      {
        // give up
        throw new WicketParseException("Unknown tag name with Wicket namespace: '" +
          tag.getName() + "'. Might be you haven't installed the appropriate resolver?",
          tag);
      }
    }

    if (wicketIdValue != null)
    {
      if (wicketIdValue.trim().length() == 0)
      {
        throw new WicketParseException(
          "The wicket:id attribute value must not be empty. May be unmatched quotes?!?",
          tag);
      }
      // Make it a wicket component. Otherwise it would be RawMarkup
      tag.setId(wicketIdValue);
View Full Code Here

TOP

Related Classes of org.apache.wicket.markup.WicketParseException

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.