Package org.apache.wicket.util.string

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


   *            Used to generated the a common prefix for the id
   */
  public HeadForceTagIdHandler(final Class<?> markupFileClass)
  {
    // generate the prefix from class name
    final AppendingStringBuffer buffer = new AppendingStringBuffer(markupFileClass.getName());
    for (int i = 0; i < buffer.getValue().length; ++i)
    {
      if (Character.isLetterOrDigit(buffer.getValue()[i]) == false)
      {
        buffer.getValue()[i] = '-';
      }
    }

    buffer.append("-");
    headElementIdPrefix = buffer.toString();
  }
View Full Code Here


    /**
     * @return All entries of the objects that are created/updated or removed in this request
     */
    public String getAlteredObjects()
    {
      AppendingStringBuffer sb = new AppendingStringBuffer();
      for (int i = 0; i < entries.size(); i++)
      {
        String element = entries.get(i);
        sb.append(element);
        if (entries.size() != i + 1)
        {
          sb.append("<br/>");
        }
      }
      return sb.toString();
    }
View Full Code Here

    @Override
    protected void invoke(WebResponse response)
    {

      AppendingStringBuffer responseBuffer = new AppendingStringBuffer(builder);

      List<IResponseFilter> responseFilters = Application.get()
        .getRequestCycleSettings()
        .getResponseFilters();
View Full Code Here

      }

      @Override
      protected CharSequence getEventHandler()
      {
        return new AppendingStringBuffer(super.getEventHandler()).append("; return false;");
      }

      @Override
      protected IAjaxCallDecorator getAjaxCallDecorator()
      {
View Full Code Here

    if (decorator != null)
    {
      failure = decorator.decorateOnFailureScript(getComponent(), failure);
    }

    AppendingStringBuffer buff = new AppendingStringBuffer(256);
    buff.append("var ").append(IAjaxCallDecorator.WICKET_CALL_RESULT_VAR).append("=");
    buff.append(partialCall);

    buff.append(",function() { ").append(success).append("}.bind(this)");
    buff.append(",function() { ").append(failure).append("}.bind(this)");

    if (precondition != null)
    {
      buff.append(", function() {");
      buff.append(precondition);
      buff.append("}.bind(this)");
    }

    String channel = getChannelName();
    if (channel != null)
    {
      if (precondition == null)
      {
        buff.append(", null");
      }
      buff.append(", '");
      buff.append(channel);
      buff.append("'");
    }

    buff.append(");");

    CharSequence call = buff;

    if (!Strings.isEmpty(indicatorId))
    {
      final AppendingStringBuffer indicatorWithPrecondition = new AppendingStringBuffer(
        "if (");
      if (precondition != null)
      {
        indicatorWithPrecondition.append("function(){")
          .append(precondition)
          .append("}.bind(this)()");
      }
      else
      {
        indicatorWithPrecondition.append("true");
      }
      indicatorWithPrecondition.append(") { Wicket.showIncrementally('")
        .append(indicatorId)
        .append("');}")
        .append(call);

      call = indicatorWithPrecondition;
View Full Code Here

    if (throttleDelay == null)
    {
      throw new IllegalArgumentException("throttleDelay cannot be null");
    }

    return new AppendingStringBuffer("wicketThrottler.throttle( '").append(throttleId)
      .append("', ")
      .append(throttleDelay.getMilliseconds())
      .append(", function() { ")
      .append(script)
      .append("}.bind(this));");
View Full Code Here

   * @param attributeToBeIgnored
   * @return A xml string matching the tag
   */
  public CharSequence toXmlString(final String attributeToBeIgnored)
  {
    final AppendingStringBuffer buffer = new AppendingStringBuffer();

    buffer.append('<');

    if (type == TagType.CLOSE)
    {
      buffer.append('/');
    }

    if (namespace != null)
    {
      buffer.append(namespace);
      buffer.append(':');
    }

    buffer.append(name);

    final IValueMap attributes = getAttributes();
    if (attributes.size() > 0)
    {
      final Iterator<String> iterator = attributes.keySet().iterator();
      for (; iterator.hasNext();)
      {
        final String key = iterator.next();
        if ((key != null) &&
          ((attributeToBeIgnored == null) || !key.equalsIgnoreCase(attributeToBeIgnored)))
        {
          buffer.append(" ");
          buffer.append(key);
          CharSequence value = getAttribute(key);

          // Attributes without values are possible, e.g. 'disabled'
          if (value != null)
          {
            buffer.append("=\"");
            value = Strings.escapeMarkup(value);
            buffer.append(value);
            buffer.append("\"");
          }
        }
      }
    }

    if (type == TagType.OPEN_CLOSE)
    {
      buffer.append('/');
    }

    buffer.append('>');
    return buffer;
  }
View Full Code Here

   * @param requestHandler
   * @return The request target nice display string
   */
  private String getRequestHandlerString(final IRequestHandler requestHandler)
  {
    AppendingStringBuffer sb = new AppendingStringBuffer(128);
    if (requestHandler instanceof ListenerInterfaceRequestHandler)
    {
      ListenerInterfaceRequestHandler listener = (ListenerInterfaceRequestHandler)requestHandler;
      sb.append("Interface[component: ");
      sb.append(Classes.simpleName(listener.getComponent().getClass()));
      sb.append("(");
      sb.append(listener.getComponent().getPageRelativePath());
      sb.append("), page: ");
      sb.append(listener.getPage().getClass().getName());
      sb.append("(");
      sb.append(listener.getPage().getId());
      sb.append("), interface: ");
      sb.append(listener.getListenerInterface().getName());
      sb.append(".");
      sb.append(listener.getListenerInterface().getMethod().getName());
      sb.append("]");
    }
    else if (requestHandler instanceof BookmarkablePageRequestHandler)
    {
      BookmarkablePageRequestHandler pageRequestHandler = (BookmarkablePageRequestHandler)requestHandler;
      sb.append("BookmarkablePage[");
      sb.append(pageRequestHandler.getPageClass().getName());
      sb.append("(").append(pageRequestHandler.getPageParameters()).append(")");
      sb.append("]");
    }
    else if (requestHandler instanceof IPageRequestHandler)
    {
      IPageRequestHandler pageRequestHandler = (IPageRequestHandler)requestHandler;
      sb.append("PageRequest[");
      sb.append(pageRequestHandler.getPage().getClass().getName());
      sb.append("(");
      sb.append(pageRequestHandler.getPage().getId());
      sb.append(")]");
    }
    else if (requestHandler instanceof ResourceReferenceRequestHandler)
    {
      ResourceReferenceRequestHandler resourceRefenceHandler = (ResourceReferenceRequestHandler)requestHandler;
      sb.append("ResourceReference[");
      sb.append(resourceRefenceHandler.getResourceReference());
      sb.append("]");
    }
    else
    {
      sb.append(requestHandler.toString());
    }
    return sb.toString();
  }
View Full Code Here

  /**
   * @return A synthetic close tag for this tag
   */
  public final CharSequence syntheticCloseTagString()
  {
    AppendingStringBuffer buf = new AppendingStringBuffer();
    buf.append("</");
    if (getNamespace() != null)
    {
      buf.append(getNamespace()).append(":");
    }
    buf.append(getName()).append(">");

    return buf;
  }
View Full Code Here

      return value;
    }

    if (resourceSettings.getThrowExceptionOnMissingResource())
    {
      AppendingStringBuffer message = new AppendingStringBuffer("Unable to find property: '");
      message.append(key);
      message.append("'");

      if (component != null)
      {
        message.append(" for component: ");
        message.append(component.getPageRelativePath());
        message.append(" [class=").append(component.getClass().getName()).append("]");
      }

      throw new MissingResourceException(message.toString(), (component != null
        ? component.getClass().getName() : ""), key);
    }

    return "[Warning: Property for '" + key + "' not found]";
  }
View Full Code Here

TOP

Related Classes of org.apache.wicket.util.string.AppendingStringBuffer

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.