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

/**
 * Gets the setting whether all displayed/watched entries should be added to the history
 * of displayed entries, or whether only the activated entries should be added to
 * the history list//w ww . j ava2s  . co m
 *
 * @param val {@code true} if every displayed entry should be added to the history list, {@code false} if only
 * activated entries should be added to it.
 */
public void setAddAllToHistory(boolean val) {
    Element el = settingsFile.getRootElement().getChild(SETTING_ADDALLTOHISTORY);
    if (null == el) {
        el = new Element(SETTING_ADDALLTOHISTORY);
        settingsFile.getRootElement().addContent(el);
    }
    el.setText((val) ? "1" : "0");
}

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

License:Open Source License

/**
 * Stores the currently used desktop, so this desktop can be shown on next program
 * startup.// w  w  w  . j a  v a 2 s .  co m
 * @param val the index-number of the currently used desktop, starting with the index-number {code 0}
 * for the first desktop.
 */
public void setLastUsedDesktop(int val) {
    Element el = settingsFile.getRootElement().getChild(SETTING_GETLASTUSEDDESKTOPNUMBER);
    if (null == el) {
        el = new Element(SETTING_GETLASTUSEDDESKTOPNUMBER);
        settingsFile.getRootElement().addContent(el);
    }
    el.setText(String.valueOf(val));
}

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

License:Open Source License

public void setSearchFrameSplitLayout(int val) {
    Element el = settingsFile.getRootElement().getChild(SETTING_SEARCHFRAMESPLITLAYOUT);
    if (null == el) {
        el = new Element(SETTING_SEARCHFRAMESPLITLAYOUT);
        settingsFile.getRootElement().addContent(el);
    }/*from w ww.  java2s. c  om*/
    el.setText(String.valueOf(val));
}

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

License:Open Source License

/**
 * Sets the setting whether new entries should be inserted at empty positions of previous
 * deleted entries or not./*ww  w  . java2 s. co m*/
 * @param val true if new entries should be inserted at empty positions; false if new entries should
 * be inserted at the end of the data file
 */
public void setInsertNewEntryAtEmpty(boolean val) {
    Element el = settingsFile.getRootElement().getChild(SETTING_FILLEMPTYPLACES);
    if (null == el) {
        el = new Element(SETTING_FILLEMPTYPLACES);
        settingsFile.getRootElement().addContent(el);
    }
    el.setText((val) ? "1" : "0");
}

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

License:Open Source License

/**
 * Gets the settings, whether highlighting searchresults and keywords should highlight
 * the background, i.e. setting a background-color or not
 * @param val true if a background-color for highlighting should be shown, false otherwise
 * @param style//w  ww . ja va 2 s  .  co m
 */
public void setShowHighlightBackground(boolean val, int style) {
    String hs_style;
    switch (style) {
    case HtmlUbbUtil.HIGHLIGHT_STYLE_SEARCHRESULTS:
        hs_style = SETTING_SHOWHIGHLIGHTBACKGROUND;
        break;
    case HtmlUbbUtil.HIGHLIGHT_STYLE_KEYWORDS:
        hs_style = SETTING_SHOWHIGHLIGHTKEYWORDBACKGROUND;
        break;
    case HtmlUbbUtil.HIGHLIGHT_STYLE_LIVESEARCH:
        hs_style = SETTING_SHOWHIGHLIGHTLIVESEARCHBACKGROUND;
        break;
    default:
        hs_style = SETTING_SHOWHIGHLIGHTBACKGROUND;
        break;
    }
    Element el = settingsFile.getRootElement().getChild(hs_style);
    if (null == el) {
        el = new Element(hs_style);
        settingsFile.getRootElement().addContent(el);
    }
    el.setText((val) ? "1" : "0");
}

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

License:Open Source License

/**
 * Gets the settings, whether highlighting searchresults and keywords should highlight
 * the background, i.e. setting a background-color or not
 * @param col/* ww w  .  j a  v a  2  s  .  com*/
 * @param style
 */
public void setHighlightBackgroundColor(String col, int style) {
    String hs_style;
    switch (style) {
    case HtmlUbbUtil.HIGHLIGHT_STYLE_SEARCHRESULTS:
        hs_style = SETTING_HIGHLIGHTBACKGROUNDCOLOR;
        break;
    case HtmlUbbUtil.HIGHLIGHT_STYLE_KEYWORDS:
        hs_style = SETTING_HIGHLIGHTKEYWORDBACKGROUNDCOLOR;
        break;
    case HtmlUbbUtil.HIGHLIGHT_STYLE_LIVESEARCH:
        hs_style = SETTING_HIGHLIGHTLIVESEARCHBACKGROUNDCOLOR;
        break;
    default:
        hs_style = SETTING_HIGHLIGHTBACKGROUNDCOLOR;
        break;
    }
    Element el = settingsFile.getRootElement().getChild(hs_style);
    if (null == el) {
        el = new Element(hs_style);
        settingsFile.getRootElement().addContent(el);
    }
    el.setText(col);
}

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

License:Open Source License

/**
 * /* w  ww  . ja  v  a  2  s.c o m*/
 * @param col 
 */
public void setReflistBackgroundColor(String col) {
    Element el = settingsFile.getRootElement().getChild(SETTING_APPENDIXBACKGROUNDCOLOR);
    if (null == el) {
        el = new Element(SETTING_APPENDIXBACKGROUNDCOLOR);
        settingsFile.getRootElement().addContent(el);
    }
    el.setText(col);
}

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

License:Open Source License

/**
 * //from   w  w w  .  j  a  v a  2  s. c o  m
 * @param col 
 */
public void setTableHeaderColor(String col) {
    Element el = settingsFile.getRootElement().getChild(SETTING_TABLEHEADERCOLOR);
    if (null == el) {
        el = new Element(SETTING_TABLEHEADERCOLOR);
        settingsFile.getRootElement().addContent(el);
    }
    el.setText(col);
}

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

License:Open Source License

/**
 * // w  ww. j av a2  s .  c  om
 * @param col 
 */
public void setTableRowEvenColor(String col) {
    Element el = settingsFile.getRootElement().getChild(SETTING_TABLEEVENROWCOLOR);
    if (null == el) {
        el = new Element(SETTING_TABLEEVENROWCOLOR);
        settingsFile.getRootElement().addContent(el);
    }
    el.setText(col);
}

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

License:Open Source License

/**
 * /*from w  w w .j a v  a 2 s.  c  o m*/
 * @param col 
 */
public void setTableRowOddColor(String col) {
    Element el = settingsFile.getRootElement().getChild(SETTING_TABLEODDROWCOLOR);
    if (null == el) {
        el = new Element(SETTING_TABLEODDROWCOLOR);
        settingsFile.getRootElement().addContent(el);
    }
    el.setText(col);
}