List of usage examples for org.dom4j Element attributeValue
String attributeValue(QName qName);
From source file:cc.warlock.core.client.settings.macro.internal.MacroConfigurationProvider.java
License:Open Source License
@Override protected void parseChild(Element child) { if (child.getName().equals("macro")) { String command = child.attributeValue("command"); int keycode = intValue(child, "keycode"); int modifiers = intValue(child, "modifiers"); Macro macro = new Macro(this, keycode, modifiers); macro.addHandler(new CommandMacroHandler(command)); macros.add(macro);/*from w w w . j av a2s .c o m*/ } }
From source file:cc.warlock.core.configuration.TreeConfigurationProvider.java
License:Open Source License
protected static boolean booleanValue(Element element, String attr) { return Boolean.parseBoolean(element.attributeValue(attr)); }
From source file:cc.warlock.core.configuration.TreeConfigurationProvider.java
License:Open Source License
protected static int intValue(Element element, String attr) { return Integer.parseInt(element.attributeValue(attr)); }
From source file:cc.warlock.core.configuration.TreeConfigurationProvider.java
License:Open Source License
protected String stringValue(Element element, String attr) { return element.attributeValue(attr); }
From source file:cc.warlock.core.script.configuration.ScriptConfiguration.java
License:Open Source License
public void parseScriptConfig(Element scriptConfig) { // clear();//ww w. j ava 2 s . c o m for (Element element : (List<Element>) scriptConfig.elements()) { if ("dir".equals(element.getName())) { scriptDirectories.add(new File(element.getTextTrim())); } else if ("autoScan".equals(element.getName())) { scanTimeout.set(Long.parseLong(element.attributeValue("timeout"))); autoScan.set(Boolean.parseBoolean(element.getTextTrim())); } else if ("suppressExceptions".equals(element.getName())) { suppressExceptions.set(Boolean.parseBoolean(element.getTextTrim())); } else if ("script-prefix".equals(element.getName())) { scriptPrefix = element.getTextTrim(); } else if ("engine-file-extensions".equals(element.getName())) { for (Element extElement : (List<Element>) element.elements()) { addEngineExtension(element.attributeValue("engineId"), extElement.getTextTrim()); } } } }
From source file:cc.warlock.core.stormfront.ProfileConfiguration.java
License:Open Source License
public void parseElement(Element element) { if (element.getName().equals("account")) { String accountName = element.attributeValue("name"); String password = element.attributeValue("password"); Account account = new Account(accountName, Account.decryptPassword(password)); accounts.put(accountName, account); for (Element pElement : (List<Element>) element.elements()) { String profileId = pElement.attributeValue("id"); String profileName = pElement.attributeValue("name"); String gameCode = pElement.attributeValue("gameCode"); String gameName = pElement.attributeValue("gameName"); Profile profile = new Profile(); profile.setAccount(account); profile.setId(profileId);/*from w w w.j a va 2s.c om*/ profile.setName(profileName); profile.setGameCode(gameCode); profile.setGameName(gameName); account.getProfiles().add(profile); } } }
From source file:cc.warlock.rcp.application.WarlockPerspectiveLayout.java
License:Open Source License
public void parseElement(Element element) { if (element.attribute("x") != null) { bounds.x = Integer.parseInt(element.attributeValue("x")); bounds.y = Integer.parseInt(element.attributeValue("y")); bounds.width = Integer.parseInt(element.attributeValue("width")); bounds.height = Integer.parseInt(element.attributeValue("height")); }/*from www. ja va2 s. co m*/ }
From source file:cc.warlock.rcp.configuration.GameViewConfiguration.java
License:Open Source License
public void parseElement(Element element) { if (element.getName().equals("game-view")) { bufferLines = Integer.parseInt(element.attributeValue("buffer")); suppressPrompt = Boolean.parseBoolean(element.attributeValue("suppressPrompt")); for (Element e : (List<Element>) element.elements()) { if (e.getName().equals("default-colors")) { defaultBackground = new WarlockColor(e.attributeValue("background")); defaultForeground = new WarlockColor(e.attributeValue("foreground")); defaultEchoBackground = new WarlockColor(e.attributeValue("echo-background")); defaultEchoForeground = new WarlockColor(e.attributeValue("echo-foreground")); } else if (e.getName().equals("default-font")) { defaultFontFace = e.attributeValue("face"); defaultFontSize = Integer.parseInt(e.attributeValue("size")); }// ww w .ja v a 2 s. c o m } } }
From source file:cc.warlock.rcp.help.WikiCategory.java
License:Open Source License
public static List<WikiPage> search(String text) { ArrayList<WikiPage> pages = new ArrayList<WikiPage>(); try {/* w w w . ja v a2 s . co m*/ URL url = new URL(MEDIAWIKI_API + "?action=query&list=search&srsearch=" + text + "&format=xml"); SAXReader reader = new SAXReader(); Document document = reader.read(url); for (Element page : (List<Element>) document.selectNodes("//p")) { WikiPage wikiPage = new WikiPage(null, page.attributeValue("title")); pages.add(wikiPage); } } catch (MalformedURLException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (DocumentException e) { // TODO Auto-generated catch block e.printStackTrace(); } return pages; }
From source file:cc.warlock.rcp.help.WikiCategory.java
License:Open Source License
protected void loadPages() { try {//w w w .jav a2 s . c o m URL url = new URL( MEDIAWIKI_API + "?action=query&list=categorymembers&cmcategory=" + name + "&format=xml"); SAXReader reader = new SAXReader(); Document document = reader.read(url); for (Element page : (List<Element>) document.selectNodes("//cm")) { WikiPage wikiPage = new WikiPage(page.attributeValue("pageid"), page.attributeValue("title")); pages.add(wikiPage); } } catch (MalformedURLException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (DocumentException e) { // TODO Auto-generated catch block e.printStackTrace(); } }