RoiMaskSelector { public void updateMaskSource(Product newProduct) { if (product != newProduct) { if (product != null) { product.removeProductNodeListener(productNodeListener); } if (newProduct != null) { newProduct.addProductNodeListener(productNodeListener); } this.product = newProduct; updateRoiMasks(); } } RoiMaskSelector(BindingContext bindingContext);  RoiMaskSelector(BindingContext bindingContext, AbstractButton showMaskManagerButton); JPanel createPanel(); void updateMaskSource(Product newProduct); final static String PROPERTY_NAME_USE_ROI_MASK; final static String PROPERTY_NAME_ROI_MASK; }
@Test public void testEnabledStateWhenProductContainsMasks() { roiMaskSelector.updateMaskSource(createProductWithMasks()); assertTrue(roiMaskSelector.useRoiMaskCheckBox.isEnabled()); assertFalse(roiMaskSelector.roiMaskComboBox.isEnabled()); assertTrue(roiMaskSelector.showMaskManagerButton.isEnabled()); }
@Test public void testEnabledStateWhenProductContainsMasksAndUseRoiMaskIsChecked() throws ValidationException { roiMaskSelector.updateMaskSource(createProductWithMasks()); bindingContext.getPropertySet().getProperty(RoiMaskSelector.PROPERTY_NAME_USE_ROI_MASK).setValue(Boolean.TRUE); assertTrue(roiMaskSelector.useRoiMaskCheckBox.isEnabled()); assertTrue(roiMaskSelector.roiMaskComboBox.isEnabled()); assertTrue(roiMaskSelector.showMaskManagerButton.isEnabled()); }
@Test public void testEnabledStateWhenProductContainsNoMasks() { roiMaskSelector.updateMaskSource(createProduct()); assertFalse(roiMaskSelector.useRoiMaskCheckBox.isEnabled()); assertFalse(roiMaskSelector.roiMaskComboBox.isEnabled()); assertTrue(roiMaskSelector.showMaskManagerButton.isEnabled()); }