List of usage examples for org.jdom2 Element getText
public String getText()
From source file:de.danielluedecke.zettelkasten.database.Settings.java
License:Open Source License
/** * Retrieves the filepath of the last used import path when data was imported * @return the filepath of the last opened import directory, or null if no filepath was specified. *//*ww w . j a v a 2 s . c om*/ public File getLastOpenedImportDir() { // we do this step by step rather that appending a ".getText()" to the line below, because // by doing so we can check whether the child element exists or not, and avoiding null pointer // exceptions // first, get the filepath, which is in relation to the zkn-path Element el = settingsFile.getRootElement().getChild(SETTING_LASTOPENEDIMPORTDIR); // 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; // else return filepath return new File(value); }
From source file:de.danielluedecke.zettelkasten.database.Settings.java
License:Open Source License
/** * Retrieves the filepath of the last used import path when data was imported * @return the filepath of the last opened import directory, or null if no filepath was specified. *//*from w w w. j a v a 2s . c o m*/ public File getLastOpenedExportDir() { // we do this step by step rather that appending a ".getText()" to the line below, because // by doing so we can check whether the child element exists or not, and avoiding null pointer // exceptions // first, get the filepath, which is in relation to the zkn-path Element el = settingsFile.getRootElement().getChild(SETTING_LASTOPENEDEXPORTDIR); // 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; // else return filepath return new File(value); }
From source file:de.danielluedecke.zettelkasten.database.Settings.java
License:Open Source License
/** * Retrieves the filepath of the last used image path when inserting images to a new entry * @return the filepath of the last opened image directory, or null if no filepath was specified. *//*from www . ja v a 2s . c o m*/ public File getLastOpenedAttachmentDir() { // we do this step by step rather that appending a ".getText()" to the line below, because // by doing so we can check whether the child element exists or not, and avoiding null pointer // exceptions // first, get the filepath, which is in relation to the zkn-path Element el = settingsFile.getRootElement().getChild(SETTING_LASTOPENEDATTACHMENTDIR); // 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; // else return filepath return new File(value); }
From source file:de.danielluedecke.zettelkasten.database.Settings.java
License:Open Source License
/** * Retrieves the filepath for the external backup when leaving the application * @return the filepath of the external backup, or null if no path was specified */// w w w . ja v a 2 s.c o m public File getExtraBackupPath() { // first, get the filepath, which is in relation to the zkn-path Element el = settingsFile.getRootElement().getChild(SETTING_EXTRABACKUPPATH); // 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; // else return filepath return new File(value); }
From source file:de.danielluedecke.zettelkasten.database.Settings.java
License:Open Source License
/** * Retrieves the filepath for the external converter tool "pandoc" * @return the filepath for the external converter tool "pandoc" *///from w w w. j a v a2 s .com public String getPandocPath() { // first, get the filepath, which is in relation to the zkn-path Element el = settingsFile.getRootElement().getChild(SETTING_PANDOCPATH); // 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; // else return filepath return value; }
From source file:de.danielluedecke.zettelkasten.database.Settings.java
License:Open Source License
/** * Retrieves the filepath of the last used bibtex-file. we need this path when exporting * entries (from the desktop or the export-method from the main frame), and the user wants * to create a separate BibTex-File out of the authors that have been exported. * * @return the filepath of the last used bixb text file, or null if no path is saved *//*from w w w.j av a2s . co m*/ public File getLastUsedBibTexFile() { // first, get the filepath, which is in relation to the zkn-path Element el = settingsFile.getRootElement().getChild(SETTING_LASTUSEDBIBTEXFILE); // 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; // else return filepath return new File(value); }
From source file:de.danielluedecke.zettelkasten.database.Settings.java
License:Open Source License
/** * Gets the startup entry. This is the entry which is displayed immediately after opening * a data file.//from w w w. j av a 2 s. c o m * @return the number of the startup entry */ public int getStartupEntry() { Element el = settingsFile.getRootElement().getChild(SETTING_STARTUPENTRY); int retval = -1; if (el != null) { try { retval = Integer.parseInt(el.getText()); } catch (NumberFormatException e) { retval = -1; } } return retval; }
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.ja va 2 s . co m*/ * @return an integer value, where the single bits indicate whether a checkbox should be * selected or not. */ public int getSearchWhere() { Element el = settingsFile.getRootElement().getChild(SETTING_SEARCHWHERE); int retval = Constants.SEARCH_CONTENT | Constants.SEARCH_TITLE | Constants.SEARCH_KEYWORDS | Constants.SEARCH_REMARKS; if (el != null) { try { retval = Integer.parseInt(el.getText()); } catch (NumberFormatException e) { return Constants.SEARCH_CONTENT | Constants.SEARCH_TITLE | Constants.SEARCH_KEYWORDS | Constants.SEARCH_REMARKS; } } 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./*from w w w. j a v a 2s .com*/ */ public int getReplaceWhere() { Element el = settingsFile.getRootElement().getChild(SETTING_REPLACEWHERE); int retval = Constants.SEARCH_CONTENT | Constants.SEARCH_TITLE | Constants.SEARCH_KEYWORDS | Constants.SEARCH_REMARKS; if (el != null) { try { retval = Integer.parseInt(el.getText()); } catch (NumberFormatException e) { return Constants.SEARCH_CONTENT | Constants.SEARCH_TITLE | Constants.SEARCH_KEYWORDS | Constants.SEARCH_REMARKS; } } return retval; }
From source file:de.danielluedecke.zettelkasten.database.Settings.java
License:Open Source License
/** * this method gets the initiated fields (checkboxes) for the desktop-display-dialog, which * is opened from the desktop-window. depending on this variable (and the set bits of it) * we can figure out which checkboxes should be initially selected. * //from w ww.ja v a2 s .co m * @return an integer value, where the single bits indicate whether a checkbox should be * selected or not. */ public int getDesktopDisplayItems() { Element el = settingsFile.getRootElement().getChild(SETTING_DESKTOPDISPLAYITEMS); int retval = Constants.DESKTOP_SHOW_REMARKS | Constants.DESKTOP_SHOW_AUTHORS; if (el != null) { try { retval = Integer.parseInt(el.getText()); } catch (NumberFormatException e) { return Constants.DESKTOP_SHOW_REMARKS | Constants.DESKTOP_SHOW_AUTHORS; } } return retval; }