Examples of AppendingStringBuffer


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

        @Override
    protected void onComponentTagBody(MarkupStream markupStream, ComponentTag openTag)
    {
      if (selectCallback != null)
      {
        AppendingStringBuffer b = new AppendingStringBuffer("\nfunction ");

        String functionName = getCallbackFunctionName();
        b.append(functionName).append("(calendar){\n");
        b.append("\tvar dateParam = calendar.date.getFullYear();\n");
        b.append("\tdateParam += '-';\n");
        b.append("\tdateParam += calendar.date.getMonth()+1;\n");
        b.append("\tdateParam += '-';\n");
        b.append("\tdateParam += calendar.date.getDate();\n");
        b.append("\tdateParam += '-';\n");
        b.append("\tdateParam += calendar.date.getHours();\n");
        b.append("\tdateParam += '-';\n");
        b.append("\tdateParam += calendar.date.getMinutes();\n");

        CharSequence handleCallback = selectCallback.handleCallback();
        b.append("\t").append(handleCallback).append("\n");
        b.append("}\n");

        replaceComponentTagBody(markupStream, openTag, b);
      }
    }
View Full Code Here

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

      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(']');
      }
      message.append(". Locale: ").append(locale).append(", style: ").append(style);

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

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

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

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

    {
      Map<String, String> map = new HashMap<>(4);
      map.put("clienttime", "' + (new Date().getTime() - clientTimeVariable)/1000 +  's");
      map.put("servertime", ((double)timeTaken) / 1000 + "s");

      AppendingStringBuffer defaultValue = new AppendingStringBuffer(128);
      defaultValue.append("Server parsetime: ");
      defaultValue.append(((double)timeTaken) / 1000);
      defaultValue.append("s, Client parsetime: ' + (new Date().getTime() - clientTimeVariable)/1000 +  's");

      String txt = Application.get()
        .getResourceSettings()
        .getLocalizer()
        .getString("ServerAndClientTimeFilter.statustext", null, Model.ofMap(map),
          defaultValue.toString());
      AppendingStringBuffer endScript = new AppendingStringBuffer(150);
      endScript.append("\n").append(JavaScriptUtils.SCRIPT_OPEN_TAG);
      endScript.append("\nwindow.defaultStatus='");
      endScript.append(txt);
      endScript.append("';\n").append(JavaScriptUtils.SCRIPT_CLOSE_TAG).append("\n");
      responseBuffer.insert(bodyIndex - 1, endScript);
      responseBuffer.insert(headIndex + 6, "\n" + JavaScriptUtils.SCRIPT_OPEN_TAG +
        "\nvar clientTimeVariable = new Date().getTime();\n" +
        JavaScriptUtils.SCRIPT_CLOSE_TAG + "\n");
    }
View Full Code Here

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

    {
      // Null is valid, so look up the value for it
      String option = getNullValidDisplayValue();

      // The <option> tag buffer
      final AppendingStringBuffer buffer = new AppendingStringBuffer(64 + option.length());

      // Add option tag
      buffer.append("\n<option");

      // If null is selected, indicate that
      if ("".equals(selectedValue))
      {
        buffer.append(" selected=\"selected\"");
      }

      // Add body of option tag
      buffer.append(" value=\"\">").append(option).append("</option>");
      return buffer;
    }
    else
    {
      // Null is not valid. Is it selected anyway?
View Full Code Here

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

   *            the Ajax {@link Response} body
   * @return filtered response
   */
  private AppendingStringBuffer invokeResponseFilters(final StringResponse contentResponse)
  {
    AppendingStringBuffer responseBuffer = new AppendingStringBuffer(
      contentResponse.getBuffer());

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

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

  }

  @Override
  public String toString(boolean markupOnly)
  {
    final AppendingStringBuffer buf = new AppendingStringBuffer(400);
    if (markupOnly == false)
    {
      buf.append(getRootMarkup().getMarkupResourceStream().toString());
      buf.append("\n");
    }

    for (int i = 0; i < size(); i++)
    {
      buf.append(get(i));
    }
    return buf.toString();
  }
View Full Code Here

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

          int offsetMins = (int)(Double.parseDouble(hourPart) * 6);

          // construct a GMT timezone offset string from the retrieved
          // offset which can be parsed by the TimeZone class.

          AppendingStringBuffer sb = new AppendingStringBuffer("GMT");
          sb.append(offsetHours > 0 ? '+' : '-');
          sb.append(Math.abs(offsetHours));
          sb.append(':');
          if (offsetMins < 10)
          {
            sb.append('0');
          }
          sb.append(offsetMins);
          timeZone = TimeZone.getTimeZone(sb.toString());
        }
        else
        {
          int offset = Integer.parseInt(utc);
          if (offset < 0)
          {
            utc = utc.substring(1);
          }
          timeZone = TimeZone.getTimeZone("GMT" + ((offset > 0) ? '+' : '-') + utc);
        }

        String dstOffset = getUtcDSTOffset();
        if (timeZone != null && dstOffset != null)
        {
          TimeZone dstTimeZone;
          dotPos = dstOffset.indexOf('.');
          if (dotPos >= 0)
          {
            String hours = dstOffset.substring(0, dotPos);
            String hourPart = dstOffset.substring(dotPos + 1);

            if (hours.startsWith("+"))
            {
              hours = hours.substring(1);
            }
            int offsetHours = Integer.parseInt(hours);
            int offsetMins = (int)(Double.parseDouble(hourPart) * 6);

            // construct a GMT timezone offset string from the
            // retrieved
            // offset which can be parsed by the TimeZone class.

            AppendingStringBuffer sb = new AppendingStringBuffer("GMT");
            sb.append(offsetHours > 0 ? '+' : '-');
            sb.append(Math.abs(offsetHours));
            sb.append(':');
            if (offsetMins < 10)
            {
              sb.append('0');
            }
            sb.append(offsetMins);
            dstTimeZone = TimeZone.getTimeZone(sb.toString());
          }
          else
          {
            int offset = Integer.parseInt(dstOffset);
            if (offset < 0)
View Full Code Here

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

    if (cycle.getRequest().getContainerRequest() instanceof HttpServletRequest)
    {
      HttpServletRequest containerRequest = (HttpServletRequest)cycle.getRequest()
        .getContainerRequest();

      AppendingStringBuffer url = new AppendingStringBuffer(containerRequest.getRequestURL());
      if (containerRequest.getQueryString() != null)
        url.append("?").append(containerRequest.getQueryString());

      requestLogger.logRequestedUrl(url.toString());
    }
  }
View Full Code Here

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

   * @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
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.