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.danielluedecke.zettelkasten.database.Settings.java

License:Open Source License

public void setShowEntryHeadline(boolean val) {
    Element el = settingsFile.getRootElement().getChild(SETTING_SHOWENTRYHEADLINE);
    if (null == el) {
        el = new Element(SETTING_SHOWENTRYHEADLINE);
        settingsFile.getRootElement().addContent(el);
    }//from  w w w  .  jav a 2  s .c o m
    el.setText((val) ? "1" : "0");
}

From source file:de.danielluedecke.zettelkasten.database.Settings.java

License:Open Source License

/**
 * Sets the setting for the extended keyword-quick-input when editing new entries..
 * @param val true if the extended keyword-quickinput should be activated
 *///from  w  ww.j a va2  s  .  c  o m
public void setQuickInputExtended(int val) {
    Element el = settingsFile.getRootElement().getChild(SETTING_QUICKINPUTEXTENDED);
    if (null == el) {
        el = new Element(SETTING_QUICKINPUTEXTENDED);
        settingsFile.getRootElement().addContent(el);
    }
    el.setText(String.valueOf(val));
}

From source file:de.danielluedecke.zettelkasten.database.Settings.java

License:Open Source License

/**
 * Sets the spell-correction-variable. If true, the grids in lists and tables should be displayed.
 * @param val (true if the spelling should be automatically corrected, false otherwise)
 *///from   www .j  av a 2 s  .  c o  m
public void setSpellCorrect(boolean val) {
    Element el = settingsFile.getRootElement().getChild(SETTING_SPELLCORRECT);
    if (null == el) {
        el = new Element(SETTING_SPELLCORRECT);
        settingsFile.getRootElement().addContent(el);
    }
    el.setText((val) ? "1" : "0");
}

From source file:de.danielluedecke.zettelkasten.database.Settings.java

License:Open Source License

/**
 * Sets the steno-variable. If true, steno is activated, false otherwise
 * @param val {@code true} if steno is activated, false otherwise
 *//*from www  .  ja va2  s .c o  m*/
public void setStenoActivated(boolean val) {
    Element el = settingsFile.getRootElement().getChild(SETTING_STENOACTIVATED);
    if (null == el) {
        el = new Element(SETTING_STENOACTIVATED);
        settingsFile.getRootElement().addContent(el);
    }
    el.setText((val) ? "1" : "0");
}

From source file:de.danielluedecke.zettelkasten.database.Settings.java

License:Open Source License

public void setHighlightWholeWord(boolean val) {
    Element el = settingsFile.getRootElement().getChild(SETTING_HIGHLIGHTWHOLEWORD);
    if (null == el) {
        el = new Element(SETTING_HIGHLIGHTWHOLEWORD);
        settingsFile.getRootElement().addContent(el);
    }//from  ww  w. j  a v a2  s  .c  o  m
    el.setText((val) ? "1" : "0");
}

From source file:de.danielluedecke.zettelkasten.database.Settings.java

License:Open Source License

public void setHighlightWholeWordSearch(boolean val) {
    Element el = settingsFile.getRootElement().getChild(SETTING_HIGHLIGHTWHOLEWORDSEARCH);
    if (null == el) {
        el = new Element(SETTING_HIGHLIGHTWHOLEWORDSEARCH);
        settingsFile.getRootElement().addContent(el);
    }//ww  w  .ja va2  s  .  c o m
    el.setText((val) ? "1" : "0");
}

From source file:de.danielluedecke.zettelkasten.database.Settings.java

License:Open Source License

public void setTableFont(String f) {
    Element el = settingsFile.getRootElement().getChild(SETTING_TABLEFONT);
    if (null == el) {
        el = new Element(SETTING_TABLEFONT);
        settingsFile.getRootElement().addContent(el);
    }/*  w ww.j  av  a2 s. co  m*/
    el.setText(f);
}

From source file:de.danielluedecke.zettelkasten.database.Settings.java

License:Open Source License

public void setDesktopOutlineFont(String f) {
    Element el = settingsFile.getRootElement().getChild(SETTING_DESKTOPOUTLINEFONT);
    if (null == el) {
        el = new Element(SETTING_DESKTOPOUTLINEFONT);
        settingsFile.getRootElement().addContent(el);
    }/*  w  w  w .j a va  2  s .  c  o  m*/
    el.setText(f);
}

From source file:de.danielluedecke.zettelkasten.database.Settings.java

License:Open Source License

/**
 * Changes settings for the mainfont (the font used for the main-entry-textfield).
 * @param value (the new value for the font-characteristic)
 * @param what (indicates, which font-characteristic we want to have. use following constants:<br>
 * - FONTNAME<br>/*  w ww  .j a  va2s.c  om*/
 * - FONTSIZE<br>
 * - FONTCOLOR<br>
 * - FONTSTYLE<br>
 * - FONTWEIGHT<br>
 */
public void setMainfont(String value, int what) {
    Element el = settingsFile.getRootElement().getChild(SETTING_MAINFONT);
    if (null == el) {
        el = new Element(SETTING_MAINFONT);
        settingsFile.getRootElement().addContent(el);
    }
    switch (what) {
    case FONTNAME:
        el.setText(value);
        break;
    case FONTSIZE:
        el.setAttribute("size", value);
        break;
    case FONTCOLOR:
        el.setAttribute("color", value);
        break;
    case FONTSTYLE:
        el.setAttribute("style", value);
        break;
    case FONTWEIGHT:
        el.setAttribute("weight", value);
        break;
    }
}

From source file:de.danielluedecke.zettelkasten.database.Settings.java

License:Open Source License

/**
 * Changes settings for the mainfont (the font used for the main-entry-textfield).
 * @param value (the new value for the font-characteristic)
 * @param what (indicates, which font-characteristic we want to have. use following constants:<br>
 * - FONTNAME<br>// w ww . j av a  2  s .  c o m
 * - FONTSIZE<br>
 * - FONTCOLOR<br>
 * - FONTSTYLE<br>
 * - FONTWEIGHT<br>
 */
public void setAuthorFont(String value, int what) {
    Element el = settingsFile.getRootElement().getChild(SETTING_AUTHORFONT);
    if (null == el) {
        el = new Element(SETTING_AUTHORFONT);
        settingsFile.getRootElement().addContent(el);
    }
    switch (what) {
    case FONTNAME:
        el.setText(value);
        break;
    case FONTSIZE:
        el.setAttribute("size", value);
        break;
    case FONTCOLOR:
        el.setAttribute("color", value);
        break;
    case FONTSTYLE:
        el.setAttribute("style", value);
        break;
    case FONTWEIGHT:
        el.setAttribute("weight", value);
        break;
    }
}