Package org.apache.wicket.markup

Examples of org.apache.wicket.markup.MarkupException


      return markup;
    }

    if (parent == null)
    {
      throw new MarkupException(
        "Can not determine Markup. Component is not yet connected to a parent. " +
          toString());
    }

    markup = parent.getMarkup(this);
View Full Code Here


  public final void internalRenderComponent()
  {
    final IMarkupFragment markup = getMarkup();
    if (markup == null)
    {
      throw new MarkupException("Markup not found. Component: " + toString());
    }

    final MarkupStream markupStream = new MarkupStream(markup);

    // Get mutable copy of next tag
View Full Code Here

    final IDebugSettings debugSettings = Application.get().getDebugSettings();
    if (debugSettings.isLinePreciseReportingOnAddComponentEnabled())
    {
      child.setMetaData(ADDED_AT_KEY,
        ComponentStrings.toString(child, new MarkupException("added")));
    }

    final Page page = findPage();
    if (page != null)
    {
View Full Code Here

      {
        renderedComponents = new HashSet<Component>();
      }
      if (renderedComponents.add(component) == false)
      {
        throw new MarkupException(
          "The component " +
            component +
            " was rendered already. You can render it only once during a render phase. Class relative path: " +
            component.getClassRelativePath());
      }
View Full Code Here

    // Get the component class name
    final String classname = tag.getAttributes().getString("class");
    if ((classname == null) || (classname.trim().length() == 0))
    {
      throw new MarkupException("Tag <wicket:component> must have attribute 'class'");
    }

    // construct the component. It must have a constructor with a single
    // String (componentId) parameter.
    final Component component;
    try
    {
      // Load the class. In case a Groovy Class Resolver has been provided,
      // the name might be a Groovy file.
      // Note: Spring based components are not supported this way. May be we
      // should provide a ComponentFactory like we provide a PageFactory.
      final Class<?> componentClass = container.getSession()
        .getClassResolver()
        .resolveClass(classname);

      final Constructor<?> constructor = componentClass.getConstructor(new Class[] { String.class });
      component = (Component)constructor.newInstance(componentId);
    }
    catch (ClassNotFoundException e)
    {
      throw new MarkupException("Unable to create Component from wicket tag: Cause: " +
        e.getMessage());
    }
    catch (NoSuchMethodException e)
    {
      throw new MarkupException("Unable to create Component from wicket tag: Cause: " +
        e.getMessage());
    }
    catch (InvocationTargetException e)
    {
      throw new MarkupException("Unable to create Component from wicket tag: Cause: " +
        e.getMessage());
    }
    catch (IllegalAccessException e)
    {
      throw new MarkupException("Unable to create Component from wicket tag: Cause: " +
        e.getMessage());
    }
    catch (InstantiationException e)
    {
      throw new MarkupException("Unable to create Component from wicket tag: Cause: " +
        e.getMessage());
    }
    catch (ClassCastException e)
    {
      throw new MarkupException("Unable to create Component from wicket tag: Cause: " +
        e.getMessage());
    }
    catch (SecurityException e)
    {
      throw new MarkupException("Unable to create Component from wicket tag: Cause: " +
        e.getMessage());
    }

    // Get all remaining attributes and invoke the component's setters
    for (Map.Entry<String, Object> entry : tag.getAttributes().entrySet())
View Full Code Here

      }
    }

    if (method == null)
    {
      throw new MarkupException("Unable to initialize Component. Method with name " +
        methodName + " not found");
    }

    // The method must have a single parameter
    final Class<?>[] parameterClasses = method.getParameterTypes();
    if (parameterClasses.length != 1)
    {
      throw new MarkupException("Unable to initialize Component. Method with name " +
        methodName + " must have one and only one parameter");
    }

    // Convert the parameter if necessary, depending on the setter's
    // attribute
    final Class<?> paramClass = parameterClasses[0];
    try
    {
      final IConverter<?> converter = Application.get()
        .getConverterLocator()
        .getConverter(paramClass);
      final Object param = converter.convertToObject(value, locale);
      if (param == null)
      {
        throw new MarkupException("Unable to convert value '" + value + "' into " +
          paramClass + ". May be there is no converter for that type registered?");
      }
      method.invoke(object, param);
    }
    catch (IllegalAccessException ex)
    {
      throw new MarkupException(
        "Unable to initialize Component. Failure while invoking method " + methodName +
          ". Cause: " + ex);
    }
    catch (InvocationTargetException ex)
    {
      throw new MarkupException(
        "Unable to initialize Component. Failure while invoking method " + methodName +
          ". Cause: " + ex);
    }
    catch (NumberFormatException ex)
    {
      throw new MarkupException(
        "Unable to initialize Component. Failure while invoking method " + methodName +
          ". Cause: " + ex);
    }
  }
View Full Code Here

      final Page page = container.getPage();
      final String pageClassName = (page != null) ? page.getClass().getName() : "unknown";
      final IResourceStream stream = markupStream.getResource();
      final String streamName = (stream != null) ? stream.toString() : "unknown";

      throw new MarkupException(
        "Mis-placed <wicket:head>. <wicket:head> must be outside of <wicket:panel>, <wicket:border>, and <wicket:extend>. Error occured while rendering page: " +
          pageClassName + " using markup stream: " + streamName);
    }

    // We were not able to handle the tag
View Full Code Here

      {
        renderedComponents = new HashSet<Component>();
      }
      if (renderedComponents.add(component) == false)
      {
        throw new MarkupException(
          "The component " +
            component +
            " was rendered already. You can render it only once during a render phase. Class relative path: " +
            component.getClassRelativePath());
      }
View Full Code Here

    final IDebugSettings debugSettings = getApplication().getDebugSettings();
    if (debugSettings.isLinePreciseReportingOnNewComponentEnabled() && debugSettings.getComponentUseCheck())
    {
      setMetaData(CONSTRUCTED_AT_KEY,
        ComponentStrings.toString(this, new MarkupException("constructed")));
    }

    if (model != null)
    {
      setModelImpl(wrap(model));
View Full Code Here

  public final void internalRenderComponent()
  {
    final IMarkupFragment markup = getMarkup();
    if (markup == null)
    {
      throw new MarkupException("Markup not found. Component: " + toString());
    }

    final MarkupStream markupStream = new MarkupStream(markup);

    // Get mutable copy of next tag
View Full Code Here

TOP

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

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.