Examples of AppendingStringBuffer


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

   *
   * @return javascript that opens the window
   */
  protected final String getWindowOpenJavaScript()
  {
    AppendingStringBuffer buffer = new AppendingStringBuffer(500);

    if (isCustomComponent() == true)
    {
      buffer.append("var element = document.getElementById(\"");
      buffer.append(getContentMarkupId());
      buffer.append("\");\n");
    }

    buffer.append("var settings = new Object();\n");

    appendAssignment(buffer, "settings.minWidth", getMinimalWidth());
    appendAssignment(buffer, "settings.minHeight", getMinimalHeight());
    appendAssignment(buffer, "settings.className", getCssClassName());
    appendAssignment(buffer, "settings.width", getInitialWidth());

    if ((isUseInitialHeight() == true) || (isCustomComponent() == false))
    {
      appendAssignment(buffer, "settings.height", getInitialHeight());
    }
    else
    {
      buffer.append("settings.height=null;\n");
    }

    appendAssignment(buffer, "settings.resizable", isResizable());

    if (isResizable() == false)
    {
      appendAssignment(buffer, "settings.widthUnit", getWidthUnit());
      appendAssignment(buffer, "settings.heightUnit", getHeightUnit());
    }

    if (isCustomComponent() == false)
    {
      Page page = createPage();
      if (page == null)
      {
        throw new WicketRuntimeException("Error creating page for modal dialog.");
      }
      CharSequence pageUrl;
      RequestCycle requestCycle = RequestCycle.get();

      page.getSession().getPageManager().touchPage(page);
      if (page.isPageStateless())
      {
        pageUrl = requestCycle.urlFor(page.getClass(), page.getPageParameters());
      }
      else
      {
        IRequestHandler handler = new RenderPageRequestHandler(new PageProvider(page));
        pageUrl = requestCycle.urlFor(handler);
      }

      appendAssignment(buffer, "settings.src", pageUrl);
    }
    else
    {
      buffer.append("settings.element=element;\n");
    }

    if (getCookieName() != null)
    {
      appendAssignment(buffer, "settings.cookieId", getCookieName());
    }

    Object title = getTitle() != null ? getTitle().getObject() : null;
    if (title != null)
    {
      appendAssignment(buffer, "settings.title", escapeQuotes(title.toString()));
    }

    if (getMaskType() == MaskType.TRANSPARENT)
    {
      buffer.append("settings.mask=\"transparent\";\n");
    }
    else if (getMaskType() == MaskType.SEMI_TRANSPARENT)
    {
      buffer.append("settings.mask=\"semi-transparent\";\n");
    }

    appendAssignment(buffer, "settings.autoSize", autoSize);

    appendAssignment(buffer, "settings.unloadConfirmation", showUnloadConfirmation());

    // set true if we set a windowclosedcallback
    boolean haveCloseCallback = false;

    // in case user is interested in window close callback or we have a pagemap to clean attach
    // notification request
    if (windowClosedCallback != null)
    {
      WindowClosedBehavior behavior = getBehaviors(WindowClosedBehavior.class).get(0);
      buffer.append("settings.onClose = function() { ");
      buffer.append(behavior.getCallbackScript());
      buffer.append(" };\n");

      haveCloseCallback = true;
    }

    // in case we didn't set windowclosecallback, we need at least callback on close button, to
    // close window property (thus cleaning the shown flag)
    if ((closeButtonCallback != null) || (haveCloseCallback == false))
    {
      CloseButtonBehavior behavior = getBehaviors(CloseButtonBehavior.class).get(0);
      buffer.append("settings.onCloseButton = function() { ");
      buffer.append(behavior.getCallbackScript());
      buffer.append(";return false;};\n");
    }

    postProcessSettings(buffer);

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

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

    }

    @Override
    protected void invoke(WebResponse response)
    {
      AppendingStringBuffer responseBuffer = new AppendingStringBuffer(builder);

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

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

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

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

    static final String COMMENT = "<!-- comment -->";

    @Override
    public AppendingStringBuffer filter(AppendingStringBuffer responseBuffer)
    {
      return new AppendingStringBuffer(responseBuffer).append(COMMENT);
    }
View Full Code Here

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

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

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

    // Value of this choice
    final String selected = getValue();

    // Loop through choices
View Full Code Here

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

   */
  @Override
  public final String getModelValue()
  {
    final Collection<T> selectedValues = getModelObject();
    final AppendingStringBuffer buffer = new AppendingStringBuffer();
    if (selectedValues != null)
    {
      final List<? extends T> choices = getChoices();
      for (T object : selectedValues)
      {
        int index = choices.indexOf(object);
        buffer.append(getChoiceRenderer().getIdValue(object, index));
        buffer.append(VALUE_SEPARATOR);
      }
    }
    return buffer.toString();
  }
View Full Code Here

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

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

   */
  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

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

    {
      // 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

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

      for (File file : files)
      {
        if (file.isDirectory())
        {
          addResources(scope,
            new AppendingStringBuffer(relativePath).append(file.getName()).append('/'),
            file);
        }
        else
        {
          String name = file.getName();
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.