Add a new home property to a change listener

by enkonyito » Wed Jun 07, 2017 2:15 am

The setProperty method allow to set a new property associated with a home.
But can this property be taken into account by the addPropertyChangeListener method without returning an IllegalArgumentException if you use valueOf (String name)?

With this code:

Code: Select all

this.home.addPropertyChangeListener(Home.Property.valueOf(ENHANCED_EXTERNAL_BRIGHTNESS),
	    new PropertyChangeListener() {
	    	public void propertyChange(PropertyChangeEvent ev) {
	    		isEnhancedExternalBrightness = Boolean.parseBoolean(home.getProperty(ENHANCED_EXTERNAL_BRIGHTNESS));
	    		externalBrightnessEnabledCheckBox.setSelected(isEnhancedExternalBrightness);
	    	}
    	});
I have this error:

Code: Select all

Exception in thread "AWT-EventQueue-0" java.lang.IllegalArgumentException: No enum constant com.eteks.sweethome3d.model.Home.Property.enhancedExternalBrightness