List of usage examples for org.jdom2 Element getText
public String getText()
From source file:de.relaunch64.popelganda.database.Settings.java
License:Open Source License
public int getListGotoIndex() { Element el = root.getChild(SETTING_LISTGOTOINDEX); if (el != null) { try {//from w ww .j a va 2s .c om return Integer.parseInt(el.getText()); } catch (NumberFormatException ex) { return -1; } } return -1; }
From source file:de.relaunch64.popelganda.database.Settings.java
License:Open Source License
public int getDividerLocation() { Element el = root.getChild(SETTING_DIVIDER_LOCATION); if (el != null) { try {//w ww . ja v a2 s .c o m return Integer.parseInt(el.getText()); } catch (NumberFormatException ex) { return -1; } } return 4; }
From source file:de.relaunch64.popelganda.database.Settings.java
License:Open Source License
public int getLastUserScript() { Element el = root.getChild(SETTING_LAST_SCRIPT); try {/*from w w w .ja va 2s. c o m*/ if (el != null) return Integer.parseInt(el.getText()); } catch (NumberFormatException ex) { } return 0; }
From source file:de.relaunch64.popelganda.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>/*w w w. j ava 2 s .c o m*/ * - FONTSIZE<br> * - FONTCOLOR<br> * - FONTSTYLE<br> * - FONTWEIGHT<br> * @return the related font-information as string. */ public String getMainFont(int what) { Element el = root.getChild(SETTING_MAINFONT); String retval = ""; if (el != null) { switch (what) { case FONTNAME: retval = el.getText(); break; case FONTSIZE: retval = el.getAttributeValue("size"); break; } } return retval; }
From source file:de.relaunch64.popelganda.database.Settings.java
License:Open Source License
/** * Retrieves the main font as font-object. * @return the main-font as {@code Font} variable. *///from w w w . j a va2 s . c o m public Font getMainFont() { Element el = root.getChild(SETTING_MAINFONT); int fsize = Integer.parseInt(el.getAttributeValue("size")); return new Font(el.getText(), Font.PLAIN, fsize); }
From source file:de.relaunch64.popelganda.database.Settings.java
License:Open Source License
public int getLogSplitLayout() { // get attribute which stores last used desktop number Element el = root.getChild(SETTING_LOGSPLITLAYOUT); // check for valid value if (el != null) { try {//from w ww.ja v a2s . 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.relaunch64.popelganda.database.Settings.java
License:Open Source License
public int getLineNumerAlignment() { Element el = root.getChild(SETTING_LINE_NUMBER_ALIGNMENT); if (el != null) { try {//from w w w .j a v a 2s . c o m return Integer.parseInt(el.getText()); } catch (NumberFormatException ex) { return Gutter.RIGHT; } } return Gutter.RIGHT; }
From source file:de.relaunch64.popelganda.database.Settings.java
License:Open Source License
public ArrayList<Object[]> getReopenFiles() { // get reopen files Element el = root.getChild(SETTING_REOPEN_FILES); // check if we have any if (null == el) return null; // create return value ArrayList<Object[]> rofiles = new ArrayList<>(); // retrieve all children, each element representing one // file that should be re-opened List<Element> children = el.getChildren(); // iterate all children for (Element e : children) { // get file path File f = new File(e.getText()); // check if exists if (f.exists()) { // get compiler value String attr_c = e.getAttributeValue(ATTR_ASM); String attr_s = e.getAttributeValue(ATTR_SCRIPT); // init defaults Assembler assembler = Assemblers.ASM_KICKASSEMBLER; int script = -1; // check if we have compiler value try { if (attr_c != null) assembler = Assemblers.byID(Integer.parseInt(attr_c)); if (attr_s != null) script = Integer.parseInt(attr_s); } catch (NumberFormatException ex) { assembler = Assemblers.ASM_KICKASSEMBLER; script = -1;//from w ww . j a v a2 s.c om } // add compiler and filepath to return value rofiles.add(new Object[] { f, assembler, script }); } } return rofiles; }
From source file:de.sub.goobi.config.DigitalCollections.java
License:Open Source License
public static List<String> possibleDigitalCollectionsForProcess(Process process) throws JDOMException, IOException { List<String> result = new ArrayList<String>(); String filename = ConfigurationHelper.getInstance().getConfigurationFolder() + "goobi_digitalCollections.xml"; if (!Files.exists(Paths.get(filename))) { throw new FileNotFoundException("File not found: " + filename); }//ww w. j a va 2 s.c om /* Datei einlesen und Root ermitteln */ SAXBuilder builder = new SAXBuilder(); Document doc = builder.build(filename); Element root = doc.getRootElement(); /* alle Projekte durchlaufen */ List<Element> projekte = root.getChildren(); for (Iterator<Element> iter = projekte.iterator(); iter.hasNext();) { Element projekt = iter.next(); List<Element> projektnamen = projekt.getChildren("name"); for (Iterator<Element> iterator = projektnamen.iterator(); iterator.hasNext();) { Element projektname = iterator.next(); /* * wenn der Projektname aufgefhrt wird, dann alle Digitalen Collectionen in die Liste */ if (projektname.getText().equalsIgnoreCase(process.getProjekt().getTitel())) { List<Element> myCols = projekt.getChildren("DigitalCollection"); for (Iterator<Element> it2 = myCols.iterator(); it2.hasNext();) { Element col = it2.next(); result.add(col.getText()); } } } } return result; }
From source file:de.sub.goobi.config.DigitalCollections.java
License:Open Source License
public static String getDefaultDigitalCollectionForProcess(Process process) throws JDOMException, IOException { String filename = ConfigurationHelper.getInstance().getConfigurationFolder() + "goobi_digitalCollections.xml"; if (!Files.exists(Paths.get(filename))) { throw new FileNotFoundException("File not found: " + filename); }//from www. j a v a 2 s .c o m String firstCollection = ""; /* Datei einlesen und Root ermitteln */ SAXBuilder builder = new SAXBuilder(); Document doc = builder.build(filename); Element root = doc.getRootElement(); /* alle Projekte durchlaufen */ List<Element> projekte = root.getChildren(); for (Iterator<Element> iter = projekte.iterator(); iter.hasNext();) { Element projekt = iter.next(); List<Element> projektnamen = projekt.getChildren("name"); for (Iterator<Element> iterator = projektnamen.iterator(); iterator.hasNext();) { Element projektname = iterator.next(); /* * wenn der Projektname aufgefhrt wird, dann alle Digitalen Collectionen in die Liste */ if (projektname.getText().equalsIgnoreCase(process.getProjekt().getTitel())) { List<Element> myCols = projekt.getChildren("DigitalCollection"); for (Iterator<Element> it2 = myCols.iterator(); it2.hasNext();) { Element col = it2.next(); String collectionName = col.getText(); String defaultCollection = col.getAttributeValue("default"); if (defaultCollection.equalsIgnoreCase("true")) { return collectionName; } if (StringUtils.isBlank(firstCollection)) { firstCollection = collectionName; } } } } } return firstCollection; }