Example usage for java.io StringWriter append

List of usage examples for java.io StringWriter append

Introduction

In this page you can find the example usage for java.io StringWriter append.

Prototype

public StringWriter append(char c) 

Source Link

Document

Appends the specified character to this writer.

Usage

From source file:org.ofbiz.widget.form.MacroFormRenderer.java

public void renderFormatSingleWrapperOpen(Appendable writer, Map<String, Object> context, ModelForm modelForm)
        throws IOException {
    String style = FlexibleStringExpander.expandString(modelForm.getDefaultTableStyle(), context);
    StringWriter sr = new StringWriter();
    sr.append("<@renderFormatSingleWrapperOpen ");
    sr.append(" formName=\"");
    sr.append(modelForm.getName());/*w w w.  j a v a 2 s.  co  m*/
    sr.append("\" style=\"");
    sr.append(style);
    sr.append("\" />");
    executeMacro(writer, sr.toString());
}

From source file:org.ofbiz.widget.form.MacroFormRenderer.java

public void renderFormatListWrapperClose(Appendable writer, Map<String, Object> context, ModelForm modelForm)
        throws IOException {
    StringWriter sr = new StringWriter();
    sr.append("<@renderFormatListWrapperClose");
    sr.append(" formName=\"");
    sr.append(modelForm.getName());/*from   w  ww  . j a va2  s . c  o  m*/
    sr.append("\" />");
    executeMacro(writer, sr.toString());
    if (this.renderPagination) {
        this.renderNextPrev(writer, context, modelForm);
    }
    renderEndingBoundaryComment(writer, "Form Widget - Formal List Wrapper", modelForm);
}

From source file:org.ofbiz.widget.form.MacroFormRenderer.java

public void appendTooltip(Appendable writer, Map<String, Object> context, ModelFormField modelFormField)
        throws IOException {
    // render the tooltip, in other methods too
    String tooltip = modelFormField.getTooltip(context);
    StringWriter sr = new StringWriter();
    sr.append("<@renderTooltip ");
    sr.append("tooltip=\"");
    sr.append(FreeMarkerWorker.encodeDoubleQuotes(tooltip));
    sr.append("\" tooltipStyle=\"");
    sr.append(modelFormField.getTooltipStyle());
    sr.append("\" />");
    executeMacro(writer, sr.toString());
}

From source file:org.ofbiz.widget.form.MacroFormRenderer.java

public void renderFormatItemRowCellOpen(Appendable writer, Map<String, Object> context, ModelForm modelForm,
        ModelFormField modelFormField, int positionSpan) throws IOException {
    String areaStyle = modelFormField.getWidgetAreaStyle();
    StringWriter sr = new StringWriter();
    sr.append("<@renderFormatItemRowCellOpen ");
    sr.append(" fieldName=\"");
    sr.append(modelFormField.getName());
    sr.append("\" style=\"");
    sr.append(areaStyle);//w w  w. j  av  a 2s  . c o m
    sr.append("\" positionSpan=");
    sr.append(Integer.toString(positionSpan));
    sr.append(" />");
    executeMacro(writer, sr.toString());
}

From source file:org.ofbiz.widget.form.MacroFormRenderer.java

public void renderFormatFieldRowWidgetCellOpen(Appendable writer, Map<String, Object> context,
        ModelFormField modelFormField, int positions, int positionSpan, Integer nextPositionInRow)
        throws IOException {
    String areaStyle = modelFormField.getWidgetAreaStyle();
    StringWriter sr = new StringWriter();
    sr.append("<@renderFormatFieldRowWidgetCellOpen ");
    sr.append(" positionSpan=");
    sr.append(Integer.toString(positionSpan));
    sr.append(" style=\"");
    sr.append(areaStyle);/*w w  w.j a va  2 s .co  m*/
    sr.append("\" />");
    executeMacro(writer, sr.toString());

}

From source file:org.ofbiz.widget.form.MacroFormRenderer.java

public void renderContainerFindField(Appendable writer, Map<String, Object> context,
        ContainerField containerField) throws IOException {
    String id = containerField.getModelFormField().getIdName();
    String className = UtilFormatOut.checkNull(containerField.getModelFormField().getWidgetStyle());

    StringWriter sr = new StringWriter();
    sr.append("<@renderContainerField ");
    sr.append("id=\"");
    sr.append(id);// w  ww.j av  a  2 s  .com
    sr.append("\" className=\"");
    sr.append(className);
    sr.append("\" />");
    executeMacro(writer, sr.toString());
}

From source file:org.ofbiz.widget.form.MacroFormRenderer.java

public void renderLabel(Appendable writer, Map<String, Object> context, ModelScreenWidget.Label label)
        throws IOException {
    String labelText = label.getText(context);
    if (UtilValidate.isEmpty(labelText)) {
        // nothing to render
        return;//from  ww w .  j  a va  2  s  .  c o m
    }
    StringWriter sr = new StringWriter();
    sr.append("<@renderLabel ");
    sr.append("text=\"");
    sr.append(labelText);
    sr.append("\"");
    sr.append(" />");
    executeMacro(writer, sr.toString());
}

From source file:org.ofbiz.widget.form.MacroFormRenderer.java

public void addAsterisks(Appendable writer, Map<String, Object> context, ModelFormField modelFormField)
        throws IOException {
    String requiredField = "false";
    String requiredStyle = "";
    if (modelFormField.getRequiredField()) {
        requiredField = "true";
        requiredStyle = modelFormField.getRequiredFieldStyle();
    }/*from w w w .j a v a 2s  . com*/
    StringWriter sr = new StringWriter();
    sr.append("<@renderAsterisks ");
    sr.append("requiredField=\"");
    sr.append(requiredField);
    sr.append("\" requiredStyle=\"");
    sr.append(requiredStyle);
    sr.append("\" />");
    executeMacro(writer, sr.toString());
}

From source file:org.ofbiz.widget.form.MacroFormRenderer.java

/**
 * Renders the beginning boundary comment string.
 * @param writer The writer to write to//from ww  w .  jav a 2s.c om
 * @param widgetType The widget type: "Screen Widget", "Form Widget", etc.
 * @param modelWidget The widget
 */
public void renderBeginningBoundaryComment(Appendable writer, String widgetType, ModelWidget modelWidget)
        throws IOException {
    if (this.widgetCommentsEnabled) {
        StringWriter sr = new StringWriter();
        sr.append("<@formatBoundaryComment ");
        sr.append(" boundaryType=\"");
        sr.append("Begin");
        sr.append("\" widgetType=\"");
        sr.append(widgetType);
        sr.append("\" widgetName=\"");
        sr.append(modelWidget.getBoundaryCommentName());
        sr.append("\" />");
        executeMacro(writer, sr.toString());
    }
}

From source file:org.ofbiz.widget.form.MacroFormRenderer.java

/**
 * Renders the ending boundary comment string.
 * @param writer The writer to write to//from  ww  w .  j  a v  a  2  s.c om
 * @param widgetType The widget type: "Screen Widget", "Form Widget", etc.
 * @param modelWidget The widget
 */
public void renderEndingBoundaryComment(Appendable writer, String widgetType, ModelWidget modelWidget)
        throws IOException {
    if (this.widgetCommentsEnabled) {
        StringWriter sr = new StringWriter();
        sr.append("<@formatBoundaryComment ");
        sr.append(" boundaryType=\"");
        sr.append("End");
        sr.append("\" widgetType=\"");
        sr.append(widgetType);
        sr.append("\" widgetName=\"");
        sr.append(modelWidget.getBoundaryCommentName());
        sr.append("\" />");
        executeMacro(writer, sr.toString());
    }
}