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

/**
 * Sets the filepath of the last used import path when data was imported
 * @param fp the filepath of the last opened import directory
 *//*from   w  ww.j  a va 2  s .  co  m*/
public void setLastOpenedImportDir(File fp) {
    // try to find filepath-element
    Element el = settingsFile.getRootElement().getChild(SETTING_LASTOPENEDIMPORTDIR);
    if (null == el) {
        el = new Element(SETTING_LASTOPENEDIMPORTDIR);
        settingsFile.getRootElement().addContent(el);
    }
    // set new file path which should be now relative to the zkn-path
    el.setText((null == fp) ? "" : fp.toString());
}

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

License:Open Source License

/**
 * Sets the filepath of the last used import path when data was imported
 * @param fp the filepath of the last opened import directory
 *///from   w w  w  . j  a  v a2  s  . c o  m
public void setLastOpenedExportDir(File fp) {
    // try to find filepath-element
    Element el = settingsFile.getRootElement().getChild(SETTING_LASTOPENEDEXPORTDIR);
    if (null == el) {
        el = new Element(SETTING_LASTOPENEDEXPORTDIR);
        settingsFile.getRootElement().addContent(el);
    }
    // set new file path which should be now relative to the zkn-path
    el.setText((null == fp) ? "" : fp.toString());
}

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

License:Open Source License

/**
 * Sets the filepath of the last used image path when inserting images to a new entry
 * @param fp the filepath of the last opened image directory
 *//*  ww  w  .  jav a 2 s.  c  o  m*/
public void setLastOpenedAttachmentDir(File fp) {
    // try to find filepath-element
    Element el = settingsFile.getRootElement().getChild(SETTING_LASTOPENEDATTACHMENTDIR);
    if (null == el) {
        el = new Element(SETTING_LASTOPENEDATTACHMENTDIR);
        settingsFile.getRootElement().addContent(el);
    }
    // set new file path which should be now relative to the zkn-path
    el.setText((null == fp) ? "" : fp.toString());
}

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

License:Open Source License

/**
 * Sets the filepath for the external backup when leaving the application
 * @param fp the filepath of the external backup
 *//*from  ww w .j a v a2 s .com*/
public void setExtraBackupPath(String fp) {
    // try to find filepath-element
    Element el = settingsFile.getRootElement().getChild(SETTING_EXTRABACKUPPATH);
    if (null == el) {
        el = new Element(SETTING_EXTRABACKUPPATH);
        settingsFile.getRootElement().addContent(el);
    }
    // set new file path which should be now relative to the zkn-path
    el.setText(fp);
}

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

License:Open Source License

/**
 * Sets the filepath for the for the external converter tool "pandoc"
 * @param fp the filepath to the external converter tool "pandoc"
 *//*from w w  w .ja  v  a2  s .c o m*/
public void setPandocPath(String fp) {
    // try to find filepath-element
    Element el = settingsFile.getRootElement().getChild(SETTING_PANDOCPATH);
    if (null == el) {
        el = new Element(SETTING_PANDOCPATH);
        settingsFile.getRootElement().addContent(el);
    }
    // set new file path which should be now relative to the zkn-path
    el.setText(fp);
}

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

License:Open Source License

/**
 * Sets 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.
 *
 * @param fp the filepath of the last used bixb text file
 *///from  w ww .  ja va  2 s .co  m
public void setLastUsedBibTexFile(String fp) {
    // try to find filepath-element
    Element el = settingsFile.getRootElement().getChild(SETTING_LASTUSEDBIBTEXFILE);
    if (null == el) {
        el = new Element(SETTING_LASTUSEDBIBTEXFILE);
        settingsFile.getRootElement().addContent(el);
    }
    // set new file path which should be now relative to the zkn-path
    el.setText(fp);
}

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  ww .j  a  va  2s . c o m*/
 * @param nr (the number of the last viewed/activated entry)
 */
public void setStartupEntry(int nr) {
    Element el = settingsFile.getRootElement().getChild(SETTING_STARTUPENTRY);
    if (null == el) {
        el = new Element(SETTING_STARTUPENTRY);
        settingsFile.getRootElement().addContent(el);
    }
    el.setText(String.valueOf(nr));
}

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

License:Open Source License

/**
 * this method sets 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  .jav  a 2s.  c  om*/
 * @param where an integer value, where the single bits indicate whether a checkbox should be
 * selected or not.
 */
public void setSearchWhere(int where) {
    Element el = settingsFile.getRootElement().getChild(SETTING_SEARCHWHERE);
    if (null == el) {
        el = new Element(SETTING_SEARCHWHERE);
        settingsFile.getRootElement().addContent(el);
    }
    el.setText(String.valueOf(where));
}

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

License:Open Source License

/**
 * this method sets 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.
 *
 * @param where an integer value, where the single bits indicate whether a checkbox should be
 * selected or not.//www. j  a  v a 2 s.  c  om
 */
public void setReplaceWhere(int where) {
    Element el = settingsFile.getRootElement().getChild(SETTING_REPLACEWHERE);
    if (null == el) {
        el = new Element(SETTING_REPLACEWHERE);
        settingsFile.getRootElement().addContent(el);
    }
    el.setText(String.valueOf(where));
}

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

License:Open Source License

/**
 * this method sets 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  w w.  j  a  va  2 s.co  m
 * @param items an integer value, where the single bits indicate whether a checkbox should be
 * selected or not.
 */
public void setDesktopDisplayItems(int items) {
    Element el = settingsFile.getRootElement().getChild(SETTING_DESKTOPDISPLAYITEMS);
    if (null == el) {
        el = new Element(SETTING_DESKTOPDISPLAYITEMS);
        settingsFile.getRootElement().addContent(el);
    }
    el.setText(String.valueOf(items));
}