All Downloads are FREE. Search and download functionalities are using the official Maven repository.

de.larmic.butterfaces.component.showcase.example.XhtmlCodeExample Maven / Gradle / Ivy

package de.larmic.butterfaces.component.showcase.example;

/**
 * Created by larmic on 12.12.14.
 */
public class XhtmlCodeExample extends AbstractCodeExample {

    private final StringBuilder innerContent = new StringBuilder();

    private final boolean useFontAwesome;
    private final boolean usePassThrough;

    public XhtmlCodeExample(final boolean useFontAwesome) {
        this("xhtml", "xhtml", useFontAwesome, false);
    }

    public XhtmlCodeExample(final boolean useFontAwesome, final boolean usePassThrough) {
        this("xhtml", "xhtml", useFontAwesome, usePassThrough);
    }

    public XhtmlCodeExample(final String tabName, final String tabId, final boolean useFontAwesome, final boolean usePassThrough) {
        super(tabName, tabId);
        this.useFontAwesome = useFontAwesome;
        this.usePassThrough = usePassThrough;
    }

    @Override
    public String getPrettyPrintLang() {
        return "lang-html";
    }

    public StringBuilder appendInnerContent(final String content) {
        return this.appendInnerContent(content, true);
    }

    public StringBuilder appendInnerContent(final String content, final boolean lineBreak) {
        if (lineBreak) {
            return innerContent.append(content).append("\n");
        } else {
            return innerContent.append(content);
        }
    }

    @Override
    public String toString() {
        final StringBuilder stringBuilder = new StringBuilder();

        stringBuilder.append(" \n");
        stringBuilder.append(" \n");
        if (useFontAwesome) {
            stringBuilder.append(" \n");
            stringBuilder.append("    \n");
            stringBuilder.append(" \n");
        } else {
            stringBuilder.append(" \n");
        }
        stringBuilder.append("");
        stringBuilder.append("\n");
        stringBuilder.append("    ");
        stringBuilder.append("\n");
        stringBuilder.append(innerContent.toString());
        stringBuilder.append("\n");
        stringBuilder.append("     \n");
        stringBuilder.append(" \n");
        stringBuilder.append("");
        return stringBuilder.toString();
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy