@Test public void propertyChange_band_change_with_option() { PropertyContainer propertyContainer = new PropertyContainer(); propertyContainer.addProperty(Property.create("xProduct", Product.class)); propertyContainer.addProperty(Property.create("yProduct", Product.class)); propertyContainer.addProperty(Property.create("zProduct", Product.class)); propertyContainer.addProperty(Property.create("colorProduct", Product.class)); propertyContainer.addProperty(Property.create("xBand", Band.class)); propertyContainer.addProperty(Property.create("yBand", Band.class)); propertyContainer.addProperty(Property.create("zBand", Band.class)); propertyContainer.addProperty(Property.create("colorBand", Band.class)); RefreshActionEnabler refreshActionEnabler = new RefreshActionEnabler(refreshButton); refreshActionEnabler.addProductBandEnablement("xProduct", "xBand"); refreshActionEnabler.addProductBandEnablement("yProduct", "yBand"); refreshActionEnabler.addProductBandEnablement("zProduct", "zBand"); refreshActionEnabler.addProductBandEnablement("colorProduct", "colorBand", true); propertyContainer.addPropertyChangeListener(refreshActionEnabler); propertyContainer.setValue("colorBand", new Band("name", ProductData.TYPE_INT8, 1, 1)); assertFalse(refreshButton.isEnabled()); propertyContainer.setValue("xBand", new Band("name", ProductData.TYPE_INT8, 1, 1)); assertFalse(refreshButton.isEnabled()); propertyContainer.setValue("yBand", new Band("name", ProductData.TYPE_INT8, 1, 1)); assertFalse(refreshButton.isEnabled()); propertyContainer.setValue("colorBand", new Band("otherName", ProductData.TYPE_INT8, 1, 1)); assertFalse(refreshButton.isEnabled()); propertyContainer.setValue("zBand", new Band("name", ProductData.TYPE_INT8, 1, 1)); assertTrue(refreshButton.isEnabled()); propertyContainer.setValue("colorBand", null); assertTrue(refreshButton.isEnabled()); }
public void addProductBandEnablement(String productPropertyName, String bandPropertyName) { addProductBandEnablement(productPropertyName, bandPropertyName, false); }
RefreshActionEnabler implements PropertyChangeListener { public void addProductBandEnablement(String productPropertyName, String bandPropertyName) { addProductBandEnablement(productPropertyName, bandPropertyName, false); } }
RefreshActionEnabler implements PropertyChangeListener { public void addProductBandEnablement(String productPropertyName, String bandPropertyName) { addProductBandEnablement(productPropertyName, bandPropertyName, false); } RefreshActionEnabler(AbstractButton rb, String... componentNames); }
RefreshActionEnabler implements PropertyChangeListener { public void addProductBandEnablement(String productPropertyName, String bandPropertyName) { addProductBandEnablement(productPropertyName, bandPropertyName, false); } RefreshActionEnabler(AbstractButton rb, String... componentNames); void addProductBandEnablement(String productPropertyName, String bandPropertyName); void addProductBandEnablement(String productPropertyName, String bandPropertyName, boolean isOptional); @Override void propertyChange(PropertyChangeEvent evt); }
RefreshActionEnabler implements PropertyChangeListener { public void addProductBandEnablement(String productPropertyName, String bandPropertyName) { addProductBandEnablement(productPropertyName, bandPropertyName, false); } RefreshActionEnabler(AbstractButton rb, String... componentNames); void addProductBandEnablement(String productPropertyName, String bandPropertyName); void addProductBandEnablement(String productPropertyName, String bandPropertyName, boolean isOptional); @Override void propertyChange(PropertyChangeEvent evt);  }