Example usage for org.jdom2 Element getAttributeValue

List of usage examples for org.jdom2 Element getAttributeValue

Introduction

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

Prototype

public String getAttributeValue(final String attname) 

Source Link

Document

This returns the attribute value for the attribute with the given name and within no namespace, null if there is no such attribute, and the empty string if the attribute value is empty.

Usage

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

License:Open Source License

/**
 * Retrieves settings for the mainfont (the font used for the main-entry-textfield).
 * @param what (indicates, which font-characteristic we want to have. use following constants:<br>
 * - FONTNAME<br>/*from   w w w .jav  a  2s. c  om*/
 * - FONTSIZE<br>
 * - FONTCOLOR<br>
 * - FONTSTYLE<br>
 * - FONTWEIGHT<br>
 * @return the related font-information as string.
 */
public String getAuthorFont(int what) {
    Element el = settingsFile.getRootElement().getChild(SETTING_AUTHORFONT);
    String retval = "";
    if (el != null) {
        switch (what) {
        case FONTNAME:
            retval = el.getText();
            break;
        case FONTSIZE:
            retval = el.getAttributeValue("size");
            break;
        case FONTCOLOR:
            retval = el.getAttributeValue("color");
            break;
        case FONTSTYLE:
            retval = el.getAttributeValue("style");
            break;
        case FONTWEIGHT:
            retval = el.getAttributeValue("weight");
            break;
        }
    }
    return retval;
}

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

License:Open Source License

public String getCodeFont(int what) {
    Element el = settingsFile.getRootElement().getChild(SETTING_CODEFONT);
    String retval = "";
    if (el != null) {
        switch (what) {
        case FONTNAME:
            retval = el.getText();//from w  w w.j av a  2  s . c  o  m
            break;
        case FONTSIZE:
            retval = el.getAttributeValue("size");
            break;
        case FONTCOLOR:
            retval = el.getAttributeValue("color");
            break;
        case FONTSTYLE:
            retval = el.getAttributeValue("style");
            break;
        case FONTWEIGHT:
            retval = el.getAttributeValue("weight");
            break;
        }
    }
    return retval;
}

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

License:Open Source License

/**
 * Retrieves settings for the mainfont (the font used for the main-entry-textfield).
 * @param what (indicates, which font-characteristic we want to have. use following constants:<br>
 * - FONTNAME<br>/*www . j a v a  2 s .c  o  m*/
 * - FONTSIZE<br>
 * - FONTCOLOR<br>
 * - FONTSTYLE<br>
 * - FONTWEIGHT<br>
 * @return the related font-information as string.
 */
public String getRemarksFont(int what) {
    Element el = settingsFile.getRootElement().getChild(SETTING_REMARKSFONT);
    String retval = "";
    if (el != null) {
        switch (what) {
        case FONTNAME:
            retval = el.getText();
            break;
        case FONTSIZE:
            retval = el.getAttributeValue("size");
            break;
        case FONTCOLOR:
            retval = el.getAttributeValue("color");
            break;
        case FONTSTYLE:
            retval = el.getAttributeValue("style");
            break;
        case FONTWEIGHT:
            retval = el.getAttributeValue("weight");
            break;
        }
    }
    return retval;
}

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

License:Open Source License

/**
 * Retrieves settings for the desktop-window's main headers.
 * @param what (indicates, which font-characteristic we want to have. use following constants:<br>
 * - FONTNAME<br>/*w w  w  .ja  v  a  2s.c o  m*/
 * - FONTSIZE<br>
 * - FONTCOLOR<br>
 * - FONTSTYLE<br>
 * - FONTWEIGHT<br>
 * @return the related font-information as string.
 */
public String getDesktopHeaderfont(int what) {
    Element el = settingsFile.getRootElement().getChild(SETTING_DESKTOPHEADERFONT);
    String retval = "";
    if (el != null) {
        switch (what) {
        case FONTNAME:
            retval = el.getText();
            break;
        case FONTSIZE:
            retval = el.getAttributeValue("size");
            break;
        case FONTCOLOR:
            retval = el.getAttributeValue("color");
            break;
        case FONTSTYLE:
            retval = el.getAttributeValue("style");
            break;
        case FONTWEIGHT:
            retval = el.getAttributeValue("weight");
            break;
        }
    }
    return retval;
}

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

License:Open Source License

/**
 * Retrieves settings for the desktop-window's item headers (additional display items).
 * @param what (indicates, which font-characteristic we want to have. use following constants:<br>
 * - FONTNAME<br>//from  ww  w  . ja va 2  s .  co  m
 * - FONTSIZE<br>
 * - FONTCOLOR<br>
 * - FONTSTYLE<br>
 * - FONTWEIGHT<br>
 * @return the related font-information as string.
 */
public String getDesktopItemHeaderfont(int what) {
    Element el = settingsFile.getRootElement().getChild(SETTING_DESKTOPITEMHEADERFONT);
    String retval = "";
    if (el != null) {
        switch (what) {
        case FONTNAME:
            retval = el.getText();
            break;
        case FONTSIZE:
            retval = el.getAttributeValue("size");
            break;
        case FONTCOLOR:
            retval = el.getAttributeValue("color");
            break;
        case FONTSTYLE:
            retval = el.getAttributeValue("style");
            break;
        case FONTWEIGHT:
            retval = el.getAttributeValue("weight");
            break;
        }
    }
    return retval;
}

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

License:Open Source License

/**
 * Retrieves settings for the desktop-window's items (additional display items).
 * @param what (indicates, which font-characteristic we want to have. use following constants:<br>
 * - FONTNAME<br>/*  w  w  w . j  a v a2 s .  co  m*/
 * - FONTSIZE<br>
 * - FONTCOLOR<br>
 * - FONTSTYLE<br>
 * - FONTWEIGHT<br>
 * @return the related font-information as string.
 */
public String getDesktopItemfont(int what) {
    Element el = settingsFile.getRootElement().getChild(SETTING_DESKTOPITEMFONT);
    String retval = "";
    if (el != null) {
        switch (what) {
        case FONTNAME:
            retval = el.getText();
            break;
        case FONTSIZE:
            retval = el.getAttributeValue("size");
            break;
        case FONTCOLOR:
            retval = el.getAttributeValue("color");
            break;
        case FONTSTYLE:
            retval = el.getAttributeValue("style");
            break;
        case FONTWEIGHT:
            retval = el.getAttributeValue("weight");
            break;
        }
    }
    return retval;
}

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

License:Open Source License

/**
 * Retrieves settings for the style of highlighting the search terms in the search result window.
 * @param what indicates, which style-characteristic we want to have. use following constants:<br>
 * - FONTSIZE<br>//from w  w  w  . ja  va 2s  .c o m
 * - FONTCOLOR<br>
 * - FONTSTYLE<br>
 * - FONTWEIGHT<br>
 * @param style
 * @return the related style-information as string.
 */
public String getHighlightSearchStyle(int what, int style) {
    String hs_style;
    switch (style) {
    case HtmlUbbUtil.HIGHLIGHT_STYLE_SEARCHRESULTS:
        hs_style = SETTING_HIGHLIGHTSEARCHSTYLE;
        break;
    case HtmlUbbUtil.HIGHLIGHT_STYLE_KEYWORDS:
        hs_style = SETTING_HIGHLIGHTKEYWORDSTYLE;
        break;
    case HtmlUbbUtil.HIGHLIGHT_STYLE_LIVESEARCH:
        hs_style = SETTING_HIGHLIGHTLIVESEARCHSTYLE;
        break;
    default:
        hs_style = SETTING_HIGHLIGHTSEARCHSTYLE;
        break;
    }
    Element el = settingsFile.getRootElement().getChild(hs_style);
    String retval = "";
    if (el != null) {
        switch (what) {
        case FONTNAME:
            retval = el.getText();
            break;
        case FONTSIZE:
            retval = el.getAttributeValue("size");
            break;
        case FONTCOLOR:
            retval = el.getAttributeValue("color");
            break;
        case FONTSTYLE:
            retval = el.getAttributeValue("style");
            break;
        case FONTWEIGHT:
            retval = el.getAttributeValue("weight");
            break;
        }
    }
    return retval;
}

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

License:Open Source License

/**
 * Retrieves settings for the desktop-window's comment font.
 * @param what (indicates, which font-characteristic we want to have. use following constants:<br>
 * - FONTNAME<br>//from w  w w  . j ava  2s .  com
 * - FONTSIZE<br>
 * - FONTCOLOR<br>
 * - FONTSTYLE<br>
 * - FONTWEIGHT<br>
 * @return the related font-information as string.
 */
public String getDesktopCommentfont(int what) {
    Element el = settingsFile.getRootElement().getChild(SETTING_DESKTOPCOMMENTFONT);
    String retval = "";
    if (el != null) {
        switch (what) {
        case FONTNAME:
            retval = el.getText();
            break;
        case FONTSIZE:
            retval = el.getAttributeValue("size");
            break;
        case FONTCOLOR:
            retval = el.getAttributeValue("color");
            break;
        case FONTSTYLE:
            retval = el.getAttributeValue("style");
            break;
        case FONTWEIGHT:
            retval = el.getAttributeValue("weight");
            break;
        }
    }
    return retval;
}

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

License:Open Source License

/**
 * Retrieves settings for the titlefont (the font used for the main-entry's title).
 * @param what (indicates, which font-characteristic we want to have. use following constants:<br>
 * - FONTNAME<br>//from   ww w.  j av  a 2  s  . c  o  m
 * - FONTSIZE<br>
 * - FONTCOLOR<br>
 * - FONTSTYLE<br>
 * - FONTWEIGHT<br>
 * @return the related font-information as string.
 */
public String getTitleFont(int what) {
    Element el = settingsFile.getRootElement().getChild(SETTING_TITLEFONT);
    String retval = "";
    if (el != null) {
        switch (what) {
        case FONTNAME:
            retval = el.getText();
            break;
        case FONTSIZE:
            retval = el.getAttributeValue("size");
            break;
        case FONTCOLOR:
            retval = el.getAttributeValue("color");
            break;
        case FONTSTYLE:
            retval = el.getAttributeValue("style");
            break;
        case FONTWEIGHT:
            retval = el.getAttributeValue("weight");
            break;
        }
    }
    return retval;
}

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

License:Open Source License

/**
 * Retrieves settings for the titlefont (the font used for the main-entry's title).
 * @param what (indicates, which font-characteristic we want to have. use following constants:<br>
 * - FONTNAME<br>/* w w  w.j a v  a 2 s. co m*/
 * - FONTSIZE<br>
 * - FONTCOLOR<br>
 * - FONTSTYLE<br>
 * - FONTWEIGHT<br>
 * @return the related font-information as string.
 */
public String getAppendixHeaderFont(int what) {
    Element el = settingsFile.getRootElement().getChild(SETTING_APPENDIXHEADERFONT);
    String retval = "";
    if (el != null) {
        switch (what) {
        case FONTNAME:
            retval = el.getText();
            break;
        case FONTSIZE:
            retval = el.getAttributeValue("size");
            break;
        case FONTCOLOR:
            retval = el.getAttributeValue("color");
            break;
        case FONTSTYLE:
            retval = el.getAttributeValue("style");
            break;
        case FONTWEIGHT:
            retval = el.getAttributeValue("weight");
            break;
        }
    }
    return retval;
}