|
Sweet Home 3D Forum » List all forums » » Forum: Developers » » » Thread: Add a new home property to a change listener |
|
| Print at Dec 19, 2025, 9:18:20 PM | |
| Posted by enkonyito at Jun 7, 2017, 4:15:35 AM |
|
Add a new home property to a change listener 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: this.home.addPropertyChangeListener(Home.Property.valueOf(ENHANCED_EXTERNAL_BRIGHTNESS),I have this error: Exception in thread "AWT-EventQueue-0" java.lang.IllegalArgumentException: No enum constant com.eteks.sweethome3d.model.Home.Property.enhancedExternalBrightness---------------------------------------- EnkoNyito |
| Posted by Puybaret at Jun 7, 2017, 12:51:44 PM |
|
Re: Add a new home property to a change listener The method valueOf of an enum takes into account only values of the enum that exist. The main problem comes from the fact that enums are final, and using enums for these properties is actually a wrong idea I had ![]() ---------------------------------------- Emmanuel Puybaret, Sweet Home 3D creator |
| Posted by enkonyito at Jun 7, 2017, 10:29:22 PM |
|
Re: Add a new home property to a change listener I wanted to bind the enhance external brightness option of the photo panel to the video panel. The alternative would be an implicit selection from the photo panel only. The main problem comes from the fact that enums are final, and using enums for these properties is actually a wrong idea I had I do not know if other developers needed to add a new home property to existing ones but if there is a solution for it to be possible without too much changing the source code, why not?![]() ---------------------------------------- EnkoNyito |
|
|
Current timezone is GMT Dec 19, 2025, 9:18:20 PM |