@Test public void testTabConfig() throws Exception { ConfigThingy conf = new ConfigThingy("Tab", "ID \"id\" TITLE \"title\" TIP \"tip\" HOTKEY \"key\" CLOSEACTION \"action\""); ConfigThingy inputConf = new ConfigThingy("Eingabefelder", "(TYPE \"LABEL\")"); conf.addChild(inputConf); ConfigThingy buttonConf = new ConfigThingy("Buttons", "(TYPE \"LABEL\")"); conf.addChild(buttonConf); TabConfig tab = new TabConfig(conf); assertEquals("Tab", tab.getId()); assertEquals("tip", tab.getTip()); assertEquals('K', tab.getHotkey()); assertEquals("title", tab.getTitle()); assertEquals("action", tab.getCloseAction()); assertFalse(tab.getControls().isEmpty()); assertFalse(tab.getButtons().isEmpty()); }
public TabConfig(ConfigThingy tabConf) throws FormModelException { id = tabConf.getName(); title = tabConf.getString("TITLE", ""); closeAction = tabConf.getString("CLOSEACTION", "abort"); tip = tabConf.getString("TIP", ""); String hotkeyString = tabConf.getString("HOTKEY", ""); hotkey = 0; if (!hotkeyString.isEmpty()) { hotkey = hotkeyString.toUpperCase().charAt(0); } try { ConfigThingy inputFields = tabConf.query("Eingabefelder"); for (ConfigThingy fields : inputFields) { for (ConfigThingy controlConf : fields) { controls.add(new UIElementConfig(controlConf)); } } ConfigThingy buttonConf = tabConf.query("Buttons"); for (ConfigThingy fields : buttonConf) { for (ConfigThingy controlConf : fields) { buttons.add(new UIElementConfig(controlConf)); } } } catch (ConfigurationErrorException e) { throw new FormModelException("Invalid tab", e); } }
TabConfig { public TabConfig(ConfigThingy tabConf) throws FormModelException { id = tabConf.getName(); title = tabConf.getString("TITLE", ""); closeAction = tabConf.getString("CLOSEACTION", "abort"); tip = tabConf.getString("TIP", ""); String hotkeyString = tabConf.getString("HOTKEY", ""); hotkey = 0; if (!hotkeyString.isEmpty()) { hotkey = hotkeyString.toUpperCase().charAt(0); } try { ConfigThingy inputFields = tabConf.query("Eingabefelder"); for (ConfigThingy fields : inputFields) { for (ConfigThingy controlConf : fields) { controls.add(new UIElementConfig(controlConf)); } } ConfigThingy buttonConf = tabConf.query("Buttons"); for (ConfigThingy fields : buttonConf) { for (ConfigThingy controlConf : fields) { buttons.add(new UIElementConfig(controlConf)); } } } catch (ConfigurationErrorException e) { throw new FormModelException("Invalid tab", e); } } }
TabConfig { public TabConfig(ConfigThingy tabConf) throws FormModelException { id = tabConf.getName(); title = tabConf.getString("TITLE", ""); closeAction = tabConf.getString("CLOSEACTION", "abort"); tip = tabConf.getString("TIP", ""); String hotkeyString = tabConf.getString("HOTKEY", ""); hotkey = 0; if (!hotkeyString.isEmpty()) { hotkey = hotkeyString.toUpperCase().charAt(0); } try { ConfigThingy inputFields = tabConf.query("Eingabefelder"); for (ConfigThingy fields : inputFields) { for (ConfigThingy controlConf : fields) { controls.add(new UIElementConfig(controlConf)); } } ConfigThingy buttonConf = tabConf.query("Buttons"); for (ConfigThingy fields : buttonConf) { for (ConfigThingy controlConf : fields) { buttons.add(new UIElementConfig(controlConf)); } } } catch (ConfigurationErrorException e) { throw new FormModelException("Invalid tab", e); } } TabConfig(ConfigThingy tabConf); }
TabConfig { public TabConfig(ConfigThingy tabConf) throws FormModelException { id = tabConf.getName(); title = tabConf.getString("TITLE", ""); closeAction = tabConf.getString("CLOSEACTION", "abort"); tip = tabConf.getString("TIP", ""); String hotkeyString = tabConf.getString("HOTKEY", ""); hotkey = 0; if (!hotkeyString.isEmpty()) { hotkey = hotkeyString.toUpperCase().charAt(0); } try { ConfigThingy inputFields = tabConf.query("Eingabefelder"); for (ConfigThingy fields : inputFields) { for (ConfigThingy controlConf : fields) { controls.add(new UIElementConfig(controlConf)); } } ConfigThingy buttonConf = tabConf.query("Buttons"); for (ConfigThingy fields : buttonConf) { for (ConfigThingy controlConf : fields) { buttons.add(new UIElementConfig(controlConf)); } } } catch (ConfigurationErrorException e) { throw new FormModelException("Invalid tab", e); } } TabConfig(ConfigThingy tabConf); String getId(); String getTitle(); String getCloseAction(); String getTip(); char getHotkey(); List<UIElementConfig> getControls(); List<UIElementConfig> getButtons(); }
TabConfig { public TabConfig(ConfigThingy tabConf) throws FormModelException { id = tabConf.getName(); title = tabConf.getString("TITLE", ""); closeAction = tabConf.getString("CLOSEACTION", "abort"); tip = tabConf.getString("TIP", ""); String hotkeyString = tabConf.getString("HOTKEY", ""); hotkey = 0; if (!hotkeyString.isEmpty()) { hotkey = hotkeyString.toUpperCase().charAt(0); } try { ConfigThingy inputFields = tabConf.query("Eingabefelder"); for (ConfigThingy fields : inputFields) { for (ConfigThingy controlConf : fields) { controls.add(new UIElementConfig(controlConf)); } } ConfigThingy buttonConf = tabConf.query("Buttons"); for (ConfigThingy fields : buttonConf) { for (ConfigThingy controlConf : fields) { buttons.add(new UIElementConfig(controlConf)); } } } catch (ConfigurationErrorException e) { throw new FormModelException("Invalid tab", e); } } TabConfig(ConfigThingy tabConf); String getId(); String getTitle(); String getCloseAction(); String getTip(); char getHotkey(); List<UIElementConfig> getControls(); List<UIElementConfig> getButtons();  }