@Override public String toString() { return factory.getConfigurable().getDisplayName(); }
/** * Set a value that is known to be a list. The value can be retrieved using this{@link #getPropertyStringList(String)} * <br> * Within the file, the value is stored as a single Comma Separated Value */ public void setPropertyStringList(String key, List<String> value) { setProperty(key, toListText(value)); }
/** * Just a "proxy" method - {@link AbstractConfigurable#store()} is not * visible to the users of instances of this class otherwise. */ public void store() { super.store(); }
protected void store() { try { ConfigurationManager.getInstance().store(this); } catch (Exception e) { logger.error("There was an error storing the new configuration for: "+this.getName(),e); } }
public List<ConfigurationUIFactory> getConfigurationUIFactoriesForConfigurable(Configurable configurable) { List<ConfigurationUIFactory> result = new ArrayList<ConfigurationUIFactory>(); for (ConfigurationUIFactory factory : getConfigurationUIFactories()) { if (factory.canHandle(configurable.getUUID())) { result.add(factory); } } return result; }
@Test public void testGetByConfigurable() { List<ConfigurationUIFactory> list=ConfigurationUIRegistry.getInstance().getConfigurationUIFactoriesForConfigurable(new DummyUIFactory1.DummyConfigurable1()); assertEquals("There should be 1 item in the list",1,list.size()); ConfigurationUIFactory f = list.get(0); assertTrue("The item should be a DummyUIFactory1",f instanceof DummyUIFactory1); assertTrue("The configurable should be a DummyUIFactory1.DummyConfigurable1",f.getConfigurable() instanceof DummyUIFactory1.DummyConfigurable1); assertTrue("The panel should be an instanceo fo a JLabel",f.getConfigurationPanel() instanceof JPanel); } }
/** * Constructs the AbstractConfigurable by either reading from a previously stored set of properties, * or by using the default values which results in them being stored for subsequent usage. */ public AbstractConfigurable() { try { ConfigurationManager.getInstance().populate(this); } catch (Exception e) { logger.error("There was an error reading the properties for the Configurable:"+getName(),e); } }
public boolean canHandle(String uuid) { return getConfigurable().getUUID().equals(uuid); }
public boolean canHandle(String uuid) { return getConfigurable().getUUID().equals(uuid); }
public JPanel getPanel() { return factory.getConfigurationPanel(); }
public Configurable getConfigurable() { return new DummyConfigurable2(); }
public Configurable getConfigurable() { return new DummyConfigurable1(); }
/** * Get an instance of the {@link ConfigurationManager} * * @return */ public static ConfigurationManager getInstance() { if (configManager == null) { configManager = new ConfigurationManager(); return configManager; } else { return configManager; } }
public List<ConfigurationUIFactory> getConfigurationUIFactories() { return getInstances(); } }
@Test public void testGetByConfigurable() { List<ConfigurationUIFactory> list=ConfigurationUIRegistry.getInstance().getConfigurationUIFactoriesForConfigurable(new DummyUIFactory1.DummyConfigurable1()); assertEquals("There should be 1 item in the list",1,list.size()); ConfigurationUIFactory f = list.get(0); assertTrue("The item should be a DummyUIFactory1",f instanceof DummyUIFactory1); assertTrue("The configurable should be a DummyUIFactory1.DummyConfigurable1",f.getConfigurable() instanceof DummyUIFactory1.DummyConfigurable1); assertTrue("The panel should be an instanceo fo a JLabel",f.getConfigurationPanel() instanceof JPanel); } }
public boolean canHandle(String uuid) { return getConfigurable().getUUID().equals(uuid); }
public boolean canHandle(String uuid) { return getConfigurable().getUUID().equals(uuid); }
public Configurable getConfigurable() { return new DummyConfigurable2(); }
public Configurable getConfigurable() { return new DummyConfigurable1(); }