Example usage for org.jdom2 Element setText

List of usage examples for org.jdom2 Element setText

Introduction

In this page you can find the example usage for org.jdom2 Element setText.

Prototype

public Element setText(final String text) 

Source Link

Document

Sets the content of the element to be the text given.

Usage

From source file:de.relaunch64.popelganda.database.Settings.java

License:Open Source License

/**
 * Add a new recent document to the position {@code nr} in the list of recent documents.
 * @param nr the number of the requested recent document. use a value from 1 to {@link #recentDocCount recentDocCount}.
 * @param fp the filepath to the recently used document as string
 * @param assembler//from www. j  av  a 2 s. com
 * @param userScript
 */
public void setRecentDoc(int nr, String fp, Assembler assembler, int userScript) {
    // check for valid parameter
    if (null == fp || -1 == nr) {
        return;
    }
    // retrieve element
    Element el = root.getChild(SETTING_RECENT_DOC + String.valueOf(nr));
    // if element does not exist, create new...
    if (null == el) {
        el = new Element(SETTING_RECENT_DOC + String.valueOf(nr));
        // and add it to the document
        root.addContent(el);
    }
    // add filepath
    el.setText(fp);
    el.setAttribute(REC_DOC_ASSEMBLER, String.valueOf(assembler.getID()));
    el.setAttribute(REC_DOC_SCRIPT, String.valueOf(userScript));
}

From source file:de.relaunch64.popelganda.database.Settings.java

License:Open Source License

public void setLastUsedPath(File f) {
    Element el = root.getChild(SETTING_LAST_USED_PATH);
    if (null == el) {
        el = new Element(SETTING_LAST_USED_PATH);
        root.addContent(el);//from ww w  . j ava2  s  .  c  om
    }
    el.setText(f.getAbsolutePath());
}

From source file:de.relaunch64.popelganda.database.Settings.java

License:Open Source License

public void setAntiAlias(String aa) {
    Element el = root.getChild(SETTING_ANTIALIAS);
    if (null == el) {
        el = new Element(SETTING_ANTIALIAS);
        root.addContent(el);/*from  w w w.java2 s  . c  om*/
    }
    el.setText(aa);
}

From source file:de.relaunch64.popelganda.database.Settings.java

License:Open Source License

public void setScaleFont(boolean scale) {
    Element el = root.getChild(SETTING_SCALE_FONT);
    if (null == el) {
        el = new Element(SETTING_SCALE_FONT);
        root.addContent(el);/*w  w w.jav  a 2 s.c  om*/
    }
    el.setText(scale == Boolean.TRUE ? "1" : "0");
}

From source file:de.relaunch64.popelganda.database.Settings.java

License:Open Source License

public void setSidebarIsHidden(boolean val) {
    Element el = root.getChild(SETTING_SIDEBAR_ISHIDDEN);
    if (null == el) {
        el = new Element(SETTING_SIDEBAR_ISHIDDEN);
        root.addContent(el);//from   ww w  .j a va2s  .c  om
    }
    el.setText(val == Boolean.TRUE ? "1" : "0");
}

From source file:de.relaunch64.popelganda.database.Settings.java

License:Open Source License

public void setUseNoTabs(boolean val) {
    Element el = root.getChild(SETTING_USE_NOTABS);
    if (null == el) {
        el = new Element(SETTING_USE_NOTABS);
        root.addContent(el);//  ww  w. ja va  2 s . c  o  m
    }
    el.setText(val == Boolean.TRUE ? "1" : "0");
}

From source file:de.relaunch64.popelganda.database.Settings.java

License:Open Source License

public void setFindByType(boolean val) {
    Element el = root.getChild(SETTING_FINDBYTYPE);
    if (null == el) {
        el = new Element(SETTING_FINDBYTYPE);
        root.addContent(el);//from   www .  j  a va  2  s.c  om
    }
    el.setText(val == Boolean.TRUE ? "1" : "0");
}

From source file:de.relaunch64.popelganda.database.Settings.java

License:Open Source License

public void setWaitForProcess(boolean val) {
    Element el = root.getChild(SETTING_WAITFORPROCESS);
    if (null == el) {
        el = new Element(SETTING_WAITFORPROCESS);
        root.addContent(el);/*  ww  w  .  j a v a 2  s .  c o  m*/
    }
    el.setText(val == Boolean.TRUE ? "1" : "0");
}

From source file:de.relaunch64.popelganda.database.Settings.java

License:Open Source License

public void setCodeFolding(boolean val) {
    Element el = root.getChild(SETTING_CODE_FOLDING);
    if (null == el) {
        el = new Element(SETTING_CODE_FOLDING);
        root.addContent(el);//w  w w . ja va  2  s.c  o m
    }
    el.setText(val == Boolean.TRUE ? "1" : "0");
}

From source file:de.relaunch64.popelganda.database.Settings.java

License:Open Source License

public void setCodeFoldingTokens(int tokens) {
    Element el = root.getChild(SETTING_CF_MANUAL);
    if (null == el) {
        el = new Element(SETTING_CF_MANUAL);
        root.addContent(el);//from  w w w . ja v  a 2s. c  o m
    }
    el.setText(((tokens & Assemblers.CF_TOKEN_MANUAL) != 0) ? "1" : "0");
    el = root.getChild(SETTING_CF_BRACES);
    if (null == el) {
        el = new Element(SETTING_CF_BRACES);
        root.addContent(el);
    }
    el.setText(((tokens & Assemblers.CF_TOKEN_BRACES) != 0) ? "1" : "0");
    el = root.getChild(SETTING_CF_LABELS);
    if (null == el) {
        el = new Element(SETTING_CF_LABELS);
        root.addContent(el);
    }
    el.setText(((tokens & Assemblers.CF_TOKEN_LABELS) != 0) ? "1" : "0");
    el = root.getChild(SETTING_CF_DIRECTIVES);
    if (null == el) {
        el = new Element(SETTING_CF_DIRECTIVES);
        root.addContent(el);
    }
    el.setText(((tokens & Assemblers.CF_TOKEN_DIRECTIVES) != 0) ? "1" : "0");
    el = root.getChild(SETTING_CF_STRUCTS);
    if (null == el) {
        el = new Element(SETTING_CF_STRUCTS);
        root.addContent(el);
    }
    el.setText(((tokens & Assemblers.CF_TOKEN_STRUCTS) != 0) ? "1" : "0");
    el = root.getChild(SETTING_CF_SECTIONS);
    if (null == el) {
        el = new Element(SETTING_CF_SECTIONS);
        root.addContent(el);
    }
    el.setText(((tokens & Assemblers.CF_TOKEN_SECTIONS) != 0) ? "1" : "0");
}