Examples of PrependingStringBuffer


Examples of org.apache.wicket.util.string.PrependingStringBuffer

      }
      else
      {
        // Add the actual URL. This will be relative to the Wicket
        // Servlet/Filter, with no leading '/'.
        PrependingStringBuffer prepender = new PrependingStringBuffer(url.toString());

        // Prepend prefix to the URL to make it relative to the current
        // request.
        prepender.prepend(requestCycle.getRequest().getRelativePathPrefixToWicketHandler());

        result = prepender.toString();
        // We need to special-case links to the home page if we're at the
        // same level.
        if (result.length() == 0)
        {
          result = "./";
View Full Code Here

Examples of org.apache.wicket.util.string.PrependingStringBuffer

   *
   * @return Colon separated path to this component in the component hierarchy
   */
  public final String getPath()
  {
    final PrependingStringBuffer buffer = new PrependingStringBuffer(32);
    for (Component c = this; c != null; c = c.getParent())
    {
      if (buffer.length() > 0)
      {
        buffer.prepend(PATH_SEPARATOR);
      }
      buffer.prepend(c.getId());
    }
    return buffer.toString();
  }
View Full Code Here

Examples of org.apache.wicket.util.string.PrependingStringBuffer

   * @return form relative identification string
   */
  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
     * an submit form component name
     */
    if ("submit".equals(inputName.toString()))
    {
      inputName.prepend(Component.PATH_SEPARATOR);
    }
    return inputName.toString();
  }
View Full Code Here

Examples of org.apache.wicket.util.string.PrependingStringBuffer

   * @return form relative identification string
   */
  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
     * an submit form component name
     */
    if ("submit".equals(inputName.toString()))
    {
      inputName.prepend(Component.PATH_SEPARATOR);
    }
    return inputName.toString();
  }
View Full Code Here

Examples of org.apache.wicket.util.string.PrependingStringBuffer

  private static final Logger logger = LoggerFactory.getLogger(ServletWebRequest.class);

  @Override
  public String getPrefixToContextPath()
  {
    PrependingStringBuffer buffer = new PrependingStringBuffer();
    Url filterPrefixUrl = Url.parse(filterPrefix, getCharset());
    for (int i = 0; i < filterPrefixUrl.getSegments().size() - 1; ++i)
    {
      buffer.prepend("../");
    }
    return buffer.toString();
  }
View Full Code Here

Examples of org.apache.wicket.util.string.PrependingStringBuffer

   *
   * @return Colon separated path to this component in the component hierarchy
   */
  public final String getPath()
  {
    final PrependingStringBuffer buffer = new PrependingStringBuffer(32);
    for (Component c = this; c != null; c = c.getParent())
    {
      if (buffer.length() > 0)
      {
        buffer.prepend(PATH_SEPARATOR);
      }
      buffer.prepend(c.getId());
    }
    return buffer.toString();
  }
View Full Code Here

Examples of org.apache.wicket.util.string.PrependingStringBuffer

    if (url.startsWith("/"))
    {
      url = url.substring(1);
    }

    PrependingStringBuffer buffer = new PrependingStringBuffer(url);
    for (int i = 0; i < getBaseUrl().getSegments().size() - 1; ++i)
    {
      buffer.prepend("../");
    }

    buffer.prepend(request.getPrefixToContextPath());

    return buffer.toString();
  }
View Full Code Here

Examples of org.apache.wicket.util.string.PrependingStringBuffer

   */
  public String getInputName()
  {
    // TODO: keep this in sync with AbstractSubmitLink#getInputName
    String id = getId();
    final PrependingStringBuffer inputName = new PrependingStringBuffer(id.length());
    Component c = this;
    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
    if (inputName.equals("submit"))
    {
      inputName.prepend(Component.PATH_SEPARATOR);
    }
    Form<?> form = findParent(Form.class);

    if (form != null)
    {
      return form.getInputNamePrefix() + inputName.toString();
    }
    else
    {
      return inputName.toString();
    }
  }
View Full Code Here

Examples of org.apache.wicket.util.string.PrependingStringBuffer

   */
  public String getInputName()
  {
    // TODO: This is a copy & paste from the FormComponent class.
    String id = getId();
    final PrependingStringBuffer inputName = new PrependingStringBuffer(id.length());
    Component c = this;
    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
    if (inputName.equals("submit"))
    {
      inputName.prepend(Component.PATH_SEPARATOR);
    }
    return inputName.toString();
  }
View Full Code Here

Examples of org.apache.wicket.util.string.PrependingStringBuffer

      }
      else
      {
        // Add the actual URL. This will be relative to the Wicket
        // Servlet/Filter, with no leading '/'.
        PrependingStringBuffer prepender = new PrependingStringBuffer(url.toString());

        // Prepend prefix to the URL to make it relative to the current
        // request.
        prepender.prepend(requestCycle.getRequest().getRelativePathPrefixToWicketHandler());

        result = prepender.toString();
        // We need to special-case links to the home page if we're at the
        // same level.
        if (result.length() == 0)
        {
          result = "./";
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.