Examples of AppendingStringBuffer


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

            if (!basedir.isDirectory())
            {
              throw new IllegalStateException(
                "unable to read resources from directory " + basedir);
            }
            addResources(scope, new AppendingStringBuffer(), basedir);
          }
        }
      }
      catch (IOException e)
      {
View Full Code Here

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

      {
        option = getLocalizer().getString("nullValid", this, "");
      }

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

   * @return The javascript
   */
  private String getElementsDeleteJavaScript()
  {
    // build the javascript call
    final AppendingStringBuffer buffer = new AppendingStringBuffer(100);

    buffer.append("Wicket.Tree.removeNodes(\"");

    // first parameter is the markup id of tree (will be used as prefix to
    // build ids of child items
    buffer.append(getMarkupId() + "_\",[");

    // append the ids of elements to be deleted
    buffer.append(deleteIds);

    // does the buffer end if ','?
    if (buffer.endsWith(","))
    {
      // it does, trim it
      buffer.setLength(buffer.length() - 1);
    }

    buffer.append("]);");

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

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 = null;
      RequestCycle requestCycle = RequestCycle.get();

      if (page.isPageStateless())
      {
        pageUrl = requestCycle.urlFor(page.getClass(), page.getPageParameters());
        appendAssignment(buffer, "settings.ie8_src", pageUrl);
      }
      else
      {
        IRequestHandler handler = new RenderPageRequestHandler(new PageProvider(page));

        pageUrl = requestCycle.urlFor(handler);
        String ie8_pageUrl = requestCycle.getUrlRenderer().renderRelativeUrl(
          requestCycle.mapUrlFor(handler));
        appendAssignment(buffer, "settings.ie8_src", ie8_pageUrl);
      }

      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("};\n");
    }

    postProcessSettings(buffer);

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

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

    int index = responseBuffer.indexOf("<head>");
    long timeTaken = System.currentTimeMillis() - RequestCycle.get().getStartTime();

    if (index != -1)
    {
      AppendingStringBuffer script = new AppendingStringBuffer(75);
      script.append("\n");
      script.append(JavaScriptUtils.SCRIPT_OPEN_TAG);
      script.append("\n\twindow.defaultStatus='");
      script.append("Host: ");
      script.append(host);
      script.append(", handled in: ");
      script.append(Duration.milliseconds(timeTaken));
      script.append("';\n");
      script.append(JavaScriptUtils.SCRIPT_CLOSE_TAG);
      script.append("\n");
      responseBuffer.insert(index + 6, script);
    }
    return responseBuffer;
  }
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

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

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