Package org.apache.wicket.util.string

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


    {
      renderer.setBaseUrl(oldBase);
    }

    Form<?> root = getRootForm();
    return new AppendingStringBuffer("document.getElementById('").append(
      root.getHiddenFieldId())
      .append("').value='")
      .append(url)
      .append("';document.getElementById('")
      .append(root.getMarkupId())
View Full Code Here


   */
  protected void appendDefaultButtonField(final MarkupStream markupStream,
    final ComponentTag openTag)
  {

    AppendingStringBuffer buffer = new AppendingStringBuffer();

    // div that is not visible (but not display:none either)
    buffer.append(HIDDEN_DIV_START);

    // add an empty textfield (otherwise IE doesn't work)
    buffer.append("<input type=\"text\" autocomplete=\"off\"/>");

    // add the submitting component
    final Component submittingComponent = (Component)defaultSubmittingComponent;
    buffer.append("<input type=\"submit\" name=\"");
    buffer.append(defaultSubmittingComponent.getInputName());
    buffer.append("\" onclick=\" var b=document.getElementById('");
    buffer.append(submittingComponent.getMarkupId());
    buffer.append("'); if (b!=null&amp;&amp;b.onclick!=null&amp;&amp;typeof(b.onclick) != 'undefined') {  var r = Wicket.bind(b.onclick, b)(); if (r != false) b.click(); } else { b.click(); };  return false;\" ");
    buffer.append(" />");

    // close div
    buffer.append("</div>");

    getResponse().write(buffer);
  }
View Full Code Here

    {
      // get the hidden field id
      String nameAndId = getHiddenFieldId();

      // render the hidden field
      AppendingStringBuffer buffer = new AppendingStringBuffer(HIDDEN_DIV_START).append(
        "<input type=\"hidden\" name=\"")
        .append(nameAndId)
        .append("\" id=\"")
        .append(nameAndId)
        .append("\" />");

      // if it's a get, did put the parameters in the action attribute,
      // and have to write the url parameters as hidden fields
      if (encodeUrlInHiddenFields())
      {
        String url = getActionUrl().toString();
        int i = url.indexOf('?');
        String queryString = (i > -1) ? url.substring(i + 1) : url;
        String[] params = Strings.split(queryString, '&');

        writeParamsAsHiddenFields(params, buffer);
      }
      buffer.append("</div>");
      getResponse().write(buffer);

      // if a default submitting component was set, handle the rendering of that
      if (defaultSubmittingComponent instanceof Component)
      {
View Full Code Here

  {
    // Iterate through choices
    final List<? extends T> choices = getChoices();

    // Buffer to hold generated body
    final AppendingStringBuffer buffer = new AppendingStringBuffer((choices.size() + 1) * 70);

    // The selected value
    final String selected = getValue();

    // Loop through choices
View Full Code Here

   * @see FormComponent#getModelValue()
   */
  @Override
  public final String getModelValue()
  {
    final AppendingStringBuffer buffer = new AppendingStringBuffer();

    final Collection<T> selectedValues = getModelObject();
    if (selectedValues != null)
    {
      final List<? extends T> choices = getChoices();
      for (T object : selectedValues)
      {
        if (buffer.length() > 0)
        {
          buffer.append(VALUE_SEPARATOR);
        }
        int index = choices.indexOf(object);
        buffer.append(getChoiceRenderer().getIdValue(object, index));
      }
    }

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

  protected CharSequence getEventHandler()
  {
    final String formId = getForm().getMarkupId();
    final CharSequence url = getCallbackUrl();

    AppendingStringBuffer call = new AppendingStringBuffer("wicketSubmitFormById('").append(
      formId).append("', '").append(url).append("', ");

    if (getComponent() instanceof IFormSubmittingComponent)
    {
      call.append("'")
        .append(((IFormSubmittingComponent)getComponent()).getInputName())
        .append("' ");
    }
    else
    {
      call.append("null");
    }

    return generateCallbackScript(call) + ";";
  }
View Full Code Here

          String encryptedQueryString = urlCrypt.encryptUrlSafe(queryString);

          encryptedQueryString = WicketURLEncoder.QUERY_INSTANCE.encode(encryptedQueryString);

          // build the new complete url
          return new AppendingStringBuffer(urlPrefix).append("?x=").append(
            encryptedQueryString);
        }
      }
    }
View Full Code Here

      {
        throw new WicketRuntimeException("Programming error: we should come here");
      }
      int pos2 = url.indexOf("&");

      AppendingStringBuffer urlBuf = new AppendingStringBuffer(url.length() +
        encodedParamReplacement.length());
      urlBuf.append(url.subSequence(0, pos1 + 1));
      urlBuf.append(encodedParamReplacement);
      if (pos2 != -1)
      {
        urlBuf.append(url.substring(pos2));
      }
      this.url = urlBuf.toString();
    }
View Full Code Here

      private static final long serialVersionUID = 1L;

      @Override
      protected void onComponentTagBody(MarkupStream markupStream, ComponentTag openTag)
      {
        AppendingStringBuffer script = new AppendingStringBuffer(
          "<script type='text/javascript'>_filter_focus_restore('").append(
          getFocusTrackerFieldCssId()).append("');</script>");
        replaceComponentTagBody(markupStream, openTag, script);
      }
    });
View Full Code Here

   */
  protected CharSequence encode(RequestCycle requestCycle,
    IBookmarkablePageRequestTarget requestTarget)
  {
    // Begin encoding URL
    final AppendingStringBuffer url = new AppendingStringBuffer(64);

    // Get page Class
    final Class<? extends Page> pageClass = requestTarget.getPageClass();
    final Application application = Application.get();

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.