Example usage for org.jdom2 Element getText

List of usage examples for org.jdom2 Element getText

Introduction

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

Prototype

public String getText() 

Source Link

Document

Returns the textual content directly held under this element as a string.

Usage

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

License:Open Source License

/**
 * Gets the setting for the default locale
 * @return a string with a lowercase-2-letter-country-code for the default languags
 *///w  w w. j  a  v a 2  s . c o m
public String getLanguage() {
    Element el = settingsFile.getRootElement().getChild(SETTING_LOCALE);
    if (el != null)
        return el.getText();
    return Locale.getDefault().getLanguage();
}

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/*from  w  ww .java 2s.  c o  m*/
 *
 * @return {@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 boolean getAddAllToHistory() {
    Element el = settingsFile.getRootElement().getChild(SETTING_ADDALLTOHISTORY);
    if (el != null)
        return el.getText().equals("1");
    return false;
}

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

License:Open Source License

/**
 * retrieves the desktop-number of the last used desktop.
 * @param count the amount of desktops/* w w w. j  a  v a2  s . c  om*/
 * @return the number of the last used desktop, or {@code -1} if no desktop exists. if a lastly used
 * desktop was deleted, a {@code 0} is returned instead. if no desktop exists at all, {@code -1} is
 * returned.
 */
public int getLastUsedDesktop(int count) {
    // check for any desktops at all
    if (count < 1)
        return -1;
    // get attribute which stores last used desktop number
    Element el = settingsFile.getRootElement().getChild(SETTING_GETLASTUSEDDESKTOPNUMBER);
    // check for valid value
    if (el != null) {
        try {
            // retrieve value
            int retval = Integer.parseInt(el.getText());
            // check for valid bounds
            if (retval >= count)
                retval = 0;
            // return value
            return retval;
        } catch (NumberFormatException e) {
            return 0;
        }
    }
    return 0;
}

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

License:Open Source License

public int getSearchFrameSplitLayout() {
    // get attribute which stores last used desktop number
    Element el = settingsFile.getRootElement().getChild(SETTING_SEARCHFRAMESPLITLAYOUT);
    // check for valid value
    if (el != null) {
        try {/*  w  ww.j  a v  a 2  s  .c  o  m*/
            // retrieve value
            return Integer.parseInt(el.getText());
        } catch (NumberFormatException e) {
            return JSplitPane.HORIZONTAL_SPLIT;
        }
    }
    return JSplitPane.HORIZONTAL_SPLIT;
}

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

License:Open Source License

/**
 * Gets the setting whether new entries should be inserted at empty positions of previous
 * deleted entries or not.//from   w  w  w .  j a va 2  s  .  c o m
 * @return {@code 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 boolean getInsertNewEntryAtEmpty() {
    Element el = settingsFile.getRootElement().getChild(SETTING_FILLEMPTYPLACES);
    if (el != null)
        return el.getText().equals("1");
    return false;
}

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 style//from   w w  w.jav  a 2 s. co  m
 * @return {@code true} if a background-color for highlighting should be shown, false otherwise
 */
public boolean getShowHighlightBackground(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 (el != null)
        return el.getText().equals("1");
    return false;
}

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 style//from   w  w  w  . ja  va 2  s . com
 * @return {@code true} if a background-color for highlighting should be shown, false otherwise
 */
public String getHighlightBackgroundColor(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 (el != null)
        return el.getText();
    return "ffff66";
}

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

License:Open Source License

/**
 * /* w  w w.  j  a va  2s .  c om*/
 * @return 
 */
public String getAppendixBackgroundColor() {
    Element el = settingsFile.getRootElement().getChild(SETTING_APPENDIXBACKGROUNDCOLOR);
    if (el != null)
        return el.getText();
    return "f2f2f2";
}

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

License:Open Source License

/**
 * /*from w  w  w. j a  v a2 s  .c  o m*/
 * @return 
 */
public String getTableHeaderColor() {
    Element el = settingsFile.getRootElement().getChild(SETTING_TABLEHEADERCOLOR);
    if (el != null)
        return el.getText();
    return "e4e4e4";
}

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

License:Open Source License

/**
 * /*  ww w.  jav a 2  s  .  c o  m*/
 * @return 
 */
public String getTableRowEvenColor() {
    Element el = settingsFile.getRootElement().getChild(SETTING_TABLEEVENROWCOLOR);
    if (el != null)
        return el.getText();
    return "eeeeee";
}