From: <ton...@us...> - 2008-02-15 12:44:12
|
Revision: 576 http://dl-learner.svn.sourceforge.net/dl-learner/?rev=576&view=rev Author: tonytacker Date: 2008-02-15 04:44:08 -0800 (Fri, 15 Feb 2008) Log Message: ----------- add isValidValue(value) to all widgets Modified Paths: -------------- trunk/src/dl-learner/org/dllearner/gui/WidgetPanelBoolean.java trunk/src/dl-learner/org/dllearner/gui/WidgetPanelDouble.java trunk/src/dl-learner/org/dllearner/gui/WidgetPanelInteger.java trunk/src/dl-learner/org/dllearner/gui/WidgetPanelString.java trunk/src/dl-learner/org/dllearner/gui/WidgetPanelStringSet.java trunk/src/dl-learner/org/dllearner/gui/WidgetPanelStringTupleList.java Modified: trunk/src/dl-learner/org/dllearner/gui/WidgetPanelBoolean.java =================================================================== --- trunk/src/dl-learner/org/dllearner/gui/WidgetPanelBoolean.java 2008-02-15 10:14:14 UTC (rev 575) +++ trunk/src/dl-learner/org/dllearner/gui/WidgetPanelBoolean.java 2008-02-15 12:44:08 UTC (rev 576) @@ -150,16 +150,19 @@ value = true; specialOption = (BooleanConfigOption) config.getComponentManager() .getConfigOption(componentOption, configOption.getName()); - try { - ConfigEntry<Boolean> specialEntry = new ConfigEntry<Boolean>( - specialOption, value); - config.getComponentManager().applyConfigEntry(component, - specialEntry); - System.out.println("set Boolean: " + configOption.getName() + " = " - + value); - } catch (InvalidConfigOptionValueException s) { - s.printStackTrace(); - } + if (specialOption.isValidValue(value)) { + try { + ConfigEntry<Boolean> specialEntry = new ConfigEntry<Boolean>( + specialOption, value); + config.getComponentManager().applyConfigEntry(component, + specialEntry); + System.out.println("set Boolean: " + configOption.getName() + + " = " + value); + } catch (InvalidConfigOptionValueException s) { + s.printStackTrace(); + } + } else + System.out.println("Boolean: not valid value"); } } Modified: trunk/src/dl-learner/org/dllearner/gui/WidgetPanelDouble.java =================================================================== --- trunk/src/dl-learner/org/dllearner/gui/WidgetPanelDouble.java 2008-02-15 10:14:14 UTC (rev 575) +++ trunk/src/dl-learner/org/dllearner/gui/WidgetPanelDouble.java 2008-02-15 12:44:08 UTC (rev 576) @@ -146,15 +146,18 @@ value = Double.parseDouble(doubleField.getText()); // get from input specialOption = (DoubleConfigOption) config.getComponentManager() .getConfigOption(componentOption, configOption.getName()); - try { - ConfigEntry<Double> specialEntry = new ConfigEntry<Double>( - specialOption, value); - config.getComponentManager().applyConfigEntry(component, - specialEntry); - System.out.println("set Double: " + configOption.getName() + " = " - + value); - } catch (InvalidConfigOptionValueException s) { - s.printStackTrace(); - } + if (specialOption.isValidValue(value)) { + try { + ConfigEntry<Double> specialEntry = new ConfigEntry<Double>( + specialOption, value); + config.getComponentManager().applyConfigEntry(component, + specialEntry); + System.out.println("set Double: " + configOption.getName() + + " = " + value); + } catch (InvalidConfigOptionValueException s) { + s.printStackTrace(); + } + } else + System.out.println("Double: not valid value"); } } Modified: trunk/src/dl-learner/org/dllearner/gui/WidgetPanelInteger.java =================================================================== --- trunk/src/dl-learner/org/dllearner/gui/WidgetPanelInteger.java 2008-02-15 10:14:14 UTC (rev 575) +++ trunk/src/dl-learner/org/dllearner/gui/WidgetPanelInteger.java 2008-02-15 12:44:08 UTC (rev 576) @@ -147,15 +147,18 @@ value = Integer.parseInt(integerField.getText()); // get from input specialOption = (IntegerConfigOption) config.getComponentManager() .getConfigOption(componentOption, configOption.getName()); - try { - ConfigEntry<Integer> specialEntry = new ConfigEntry<Integer>( - specialOption, value); - config.getComponentManager().applyConfigEntry(component, - specialEntry); - System.out.println("set Integer: " + configOption.getName() + " = " - + value); - } catch (InvalidConfigOptionValueException s) { - s.printStackTrace(); - } + if (specialOption.isValidValue(value)) { + try { + ConfigEntry<Integer> specialEntry = new ConfigEntry<Integer>( + specialOption, value); + config.getComponentManager().applyConfigEntry(component, + specialEntry); + System.out.println("set Integer: " + configOption.getName() + + " = " + value); + } catch (InvalidConfigOptionValueException s) { + s.printStackTrace(); + } + } else + System.out.println("Integer: not valid value"); } } Modified: trunk/src/dl-learner/org/dllearner/gui/WidgetPanelString.java =================================================================== --- trunk/src/dl-learner/org/dllearner/gui/WidgetPanelString.java 2008-02-15 10:14:14 UTC (rev 575) +++ trunk/src/dl-learner/org/dllearner/gui/WidgetPanelString.java 2008-02-15 12:44:08 UTC (rev 576) @@ -123,7 +123,7 @@ value = (String) config.getComponentManager() .getConfigOptionValue(oldComponent, configOption.getName()); - if (value != null) { + if (value != null) { stringField.setText(value.toString()); setEntry(); } @@ -165,16 +165,19 @@ value = stringField.getText(); // get from input specialOption = (StringConfigOption) config.getComponentManager() .getConfigOption(componentOption, configOption.getName()); - try { - ConfigEntry<String> specialEntry = new ConfigEntry<String>( - specialOption, value); - config.getComponentManager().applyConfigEntry(component, - specialEntry); - System.out.println("set String: " + configOption.getName() + " = " - + value); - } catch (InvalidConfigOptionValueException s) { - s.printStackTrace(); - } + if (specialOption.isValidValue(value)) { + try { + ConfigEntry<String> specialEntry = new ConfigEntry<String>( + specialOption, value); + config.getComponentManager().applyConfigEntry(component, + specialEntry); + System.out.println("set String: " + configOption.getName() + + " = " + value); + } catch (InvalidConfigOptionValueException s) { + s.printStackTrace(); + } + } else + System.out.println("String: not valid value"); } /* Modified: trunk/src/dl-learner/org/dllearner/gui/WidgetPanelStringSet.java =================================================================== --- trunk/src/dl-learner/org/dllearner/gui/WidgetPanelStringSet.java 2008-02-15 10:14:14 UTC (rev 575) +++ trunk/src/dl-learner/org/dllearner/gui/WidgetPanelStringSet.java 2008-02-15 12:44:08 UTC (rev 576) @@ -295,18 +295,20 @@ StringSetConfigOption specialOption; specialOption = (StringSetConfigOption) config.getComponentManager() .getConfigOption(componentOption, configOption.getName()); + if (specialOption.isValidValue(value)) { + try { + ConfigEntry<Set<String>> specialEntry = new ConfigEntry<Set<String>>( + specialOption, value); + config.getComponentManager().applyConfigEntry(component, + specialEntry); + System.out.println("set StringSet: " + configOption.getName() + + " = " + value); + } catch (InvalidConfigOptionValueException s) { + s.printStackTrace(); + } + } else + System.out.println("StringSet: not valid value"); - try { - ConfigEntry<Set<String>> specialEntry = new ConfigEntry<Set<String>>( - specialOption, value); - config.getComponentManager().applyConfigEntry(component, - specialEntry); - System.out.println("set StringSet: " + configOption.getName() - + " = " + value); - } catch (InvalidConfigOptionValueException s) { - s.printStackTrace(); - } - } /** Modified: trunk/src/dl-learner/org/dllearner/gui/WidgetPanelStringTupleList.java =================================================================== --- trunk/src/dl-learner/org/dllearner/gui/WidgetPanelStringTupleList.java 2008-02-15 10:14:14 UTC (rev 575) +++ trunk/src/dl-learner/org/dllearner/gui/WidgetPanelStringTupleList.java 2008-02-15 12:44:08 UTC (rev 576) @@ -242,17 +242,19 @@ specialOption = (StringTupleListConfigOption) config .getComponentManager().getConfigOption(componentOption, configOption.getName()); - - try { - ConfigEntry<List<StringTuple>> specialEntry = new ConfigEntry<List<StringTuple>>( - specialOption, value); - config.getComponentManager().applyConfigEntry(component, - specialEntry); - System.out.println("set StringTupleList: " + configOption.getName() - + " = " + value); - } catch (InvalidConfigOptionValueException s) { - s.printStackTrace(); - } + if (specialOption.isValidValue(value)) { + try { + ConfigEntry<List<StringTuple>> specialEntry = new ConfigEntry<List<StringTuple>>( + specialOption, value); + config.getComponentManager().applyConfigEntry(component, + specialEntry); + System.out.println("set StringTupleList: " + + configOption.getName() + " = " + value); + } catch (InvalidConfigOptionValueException s) { + s.printStackTrace(); + } + } else + System.out.println("StringTupleList: not valid value"); } /** This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |