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

/**
 * this method gets the initiated fields (checkboxes) for the find-dialog, which
 * is opened from the main window. depending on this variable (and the set bits of it)
 * we can figure out which checkboxes should be initially selected.
 * //from  w  ww .j a  va2 s .  c  o  m
 * @return an integer value, where the single bits indicate whether a checkbox should be
 * selected or not.
 */
public int getSearchOptions() {
    Element el = settingsFile.getRootElement().getChild(SETTING_SEARCHOPTION);
    int retval = 0;
    if (el != null) {
        try {
            retval = Integer.parseInt(el.getText());
        } catch (NumberFormatException e) {
            return 0;
        }
    }
    return retval;
}

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

License:Open Source License

/**
 * this method gets the initiated fields (checkboxes) for the export-dialog, which
 * is opened from the main window. depending on this variable (and the set bits of it)
 * we can figure out which checkboxes should be initially selected.
 *
 * @return an integer value, where the single bits indicate whether a checkbox should be
 * selected or not.//from   w  w w .  j  a  v  a  2 s. com
 */
public int getExportParts() {
    Element el = settingsFile.getRootElement().getChild(SETTING_EXPORTPARTS);
    int retval = 0;
    if (el != null) {
        try {
            retval = Integer.parseInt(el.getText());
        } catch (NumberFormatException e) {
            return 0;
        }
    }
    return retval;
}

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

License:Open Source License

/**
 * @return an integer value indicating which export-format (docx, rtf, txt...) was lastly
 * selected by the user./*w w  w .ja  v a 2 s.co  m*/
 */
public int getExportFormat() {
    Element el = settingsFile.getRootElement().getChild(SETTING_EXPORTFORMAT);
    int retval = 0;
    if (el != null) {
        try {
            retval = Integer.parseInt(el.getText());
        } catch (NumberFormatException e) {
            return 0;
        }
    }
    return retval;
}

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

License:Open Source License

/**
 * @return an integer value indicating which export-format (docx, rtf, txt...) was lastly
 * selected by the user./* w  ww.  jav  a  2  s. co  m*/
 */
public int getDesktopExportFormat() {
    Element el = settingsFile.getRootElement().getChild(SETTING_DESKTOPEXPORTFORMAT);
    int retval = 0;
    if (el != null) {
        try {
            retval = Integer.parseInt(el.getText());
        } catch (NumberFormatException e) {
            return 0;
        }
    }
    return retval;
}

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

License:Open Source License

/**
 * @return an integer value indicating whether the user wants to export the desktop-data (entries)
 * with their comments, without comments or if only entries with comments at all should be exported.
 * <br><br>/* www.ja v a 2  s.  c o  m*/
 * Returns on of the following constants:<br>
 * - {@code EXP_COMMENT_YES}<br>
 * - {@code EXP_COMMENT_NO}<br>
 * - {@code EXP_COMMENT_ONLY}<br>
 */
public int getDesktopCommentExport() {
    Element el = settingsFile.getRootElement().getChild(SETTING_DESKTOPCOMMENTEXPORT);
    int retval = 0;
    if (el != null) {
        try {
            retval = Integer.parseInt(el.getText());
        } catch (NumberFormatException e) {
            return 0;
        }
    }
    return retval;
}

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

License:Open Source License

/**
 * this method gets the initiated fields (checkboxes) for the replace-dialog, which
 * is opened from the main window. depending on this variable (and the set bits of it)
 * we can figure out which checkboxes should be initially selected.
 *
 * @return an integer value, where the single bits indicate whether a checkbox should be
 * selected or not./*  w  w  w.  j a  va 2 s.c o  m*/
 */
public int getReplaceOptions() {
    Element el = settingsFile.getRootElement().getChild(SETTING_REPLACEOPTION);
    int retval = 0;
    if (el != null) {
        try {
            retval = Integer.parseInt(el.getText());
        } catch (NumberFormatException e) {
            return 0;
        }
    }
    return retval;
}

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

License:Open Source License

/**
 * This method gets the last used search term which was entered in the main window's
 * find dialog.//from  w w w.j  av  a  2s.c o  m
 * 
 * @return the last used search term for the find dialog
 */
public String getSearchWhat() {
    Element el = settingsFile.getRootElement().getChild(SETTING_SEARCHWHAT);
    String retval = "";
    if (el != null)
        retval = el.getText();
    return retval;
}

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

License:Open Source License

/**
 * This method gets the last used replace term which was entered in the main window's
 * replace dialog./*from   w  w w  . j a v a2s. co  m*/
 *
 * @return the last used replaceterm for the replace dialog
 */
public String getReplaceWhat() {
    Element el = settingsFile.getRootElement().getChild(SETTING_REPLACEWHAT);
    String retval = "";
    if (el != null)
        retval = el.getText();
    return retval;
}

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

License:Open Source License

/**
 * Retrieves the base filepath, i.e. the usual directory where the data file is stored. Setting
 * this base path enables relative path-settings for images, data files and e.g. linked
 * files (like DOCXs etc.), so the user can easily move his "data directory" and then simply
 * change the base path./*from www . j  a  va  2s.  c  o  m*/
 * 
 * @return {@code null}, if no value is set... else the directory of the data-file, <i>without</i> trailing
 * separator char
 */
public File getBaseDir() {
    // first, get the filepath, which is in relation to the zkn-path
    Element el = settingsFile.getRootElement().getChild(SETTING_FILEPATH);
    // create an empty string as return value
    String value = "";
    // is the element exists, copy the text to the return value
    if (el != null)
        value = el.getText();
    // when we have no filename, return null
    if (value.isEmpty())
        return null;
    // find last separator char to get the base-directory of the data-file
    int index = value.lastIndexOf(String.valueOf(File.separatorChar));
    // if nothing found, return null
    if (-1 == index)
        return null;
    try {
        // else cut off the filename, so we only have the data-file's directory
        value = value.substring(0, index);
    } catch (IndexOutOfBoundsException ex) {
        return null;
    }
    // else return filepath
    return new File(value);
}

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

License:Open Source License

/**
 * Retrieves the logical combination for filtering the link-list when the user
 * selectes a keyword in the jListKeywords. See method "filterLinks()" in "ZettelkastenView.java"
 * for more details//from  ww w  . j  av a 2s.c o  m
 * @return 
 */
public String getLogKeywordlist() {
    Element el = settingsFile.getRootElement().getChild(SETTING_LOGKEYWORDLIST);
    String retval = "";
    if (el != null)
        retval = el.getText();
    return retval;
}