Features

Download

Online

Gallery

Blog

  Index  | Recent Threads  | List Attachments  | Help  | Search
 Welcome Guest  |  Register  |  Login
Login Name  Password
 

Sweet Home 3D Forum



No member browsing this thread
Thread Status: Active
Total posts in this thread: 5
[ Jump to Last Post ]
Post new Thread
Author
Previous Thread This topic has been viewed 1787 times and has 4 replies Next Thread
enkonyito
Advanced Member
Member's Avatar


Joined: May 28, 2015
Post Count: 399
Status: Offline
Reply to this Post  Reply with Quote 
Saved property not taken into account correctly

In a derived version of SH3D-6.1, I added a new CEILING_LIGHT_ENABLED room property.
Although it is saved in the Home.xml file after modifying the HomeXMLExporter.java file, only the default value is taken into account when opening a project.

I based on the methods related to the CEILING_VISIBLE room property but it seems that I missed something because the expected operation is not the same.
[Apr 4, 2019 5:08:05 AM] Show Printable Version of Post    View Member Profile    Send Private Message [Link] Report threatening or abusive post: please login first  Go to top 
Puybaret
Expert
Member's Avatar

France
Joined: Nov 7, 2005
Post Count: 6723
Status: Offline
Reply to this Post  Reply with Quote 
Re: Saved property not taken into account correctly

The additional attributes you save in a subclass of HomeXMLExporter should be read in a subclass of HomeXMLHandler.
But why don't you manage your additional information with the methods setProperty / getProperty available on subclasses of HomeObject, like the Room class? This would prevent you from subclassing classes which handle XML files.
----------------------------------------
Emmanuel Puybaret, Sweet Home 3D developer
[Apr 4, 2019 2:58:59 PM] Show Printable Version of Post    View Member Profile    Send Private Message    Hidden to Guest [Link] Report threatening or abusive post: please login first  Go to top 
enkonyito
Advanced Member
Member's Avatar


Joined: May 28, 2015
Post Count: 399
Status: Offline
Reply to this Post  Reply with Quote 
Re: Saved property not taken into account correctly

But why don't you manage your additional information with the methods setProperty / getProperty available on subclasses of HomeObject, like the Room class? This would prevent you from subclassing classes which handle XML files.

Indeed, it's more practical!
<room level='level0' areaVisible='true' areaXOffset='-130.0' areaYOffset='55.99997' floorColor='FF586178' ceilingVisible='false'>
<point x='503.75' y='50.30641'/>
<point x='503.75' y='426.80637'/>
<point x='11.25' y='426.8065'/>
<point x='11.25' y='50.30641'/>
</room>
<room level='level1' areaVisible='true' areaXOffset='-132.15613' areaYOffset='109.9032' floorVisible='false' floorColor='FF586178'>
<property name='ceilingLightEnabled' value='true'/>
<point x='503.8' y='50.3'/>
<point x='503.8' y='426.8'/>
<point x='11.2' y='426.8'/>
<point x='11.2' y='50.3'/>
</room>


By selecting rooms of different state:
- with NullableCheckBox, I get the error
Caused by: java.lang.NullPointerException
at com.eteks.sweethome3d.viewcontroller.RoomController.setCeilingLightEnabled(RoomController.java:982)
at com.eteks.sweethome3d.viewcontroller.RoomController.updateProperties(RoomController.java:420)
at com.eteks.sweethome3d.viewcontroller.RoomController.<init>(RoomController.java:119)
at com.eteks.sweethome3d.viewcontroller.PlanController.modifySelectedRooms(PlanController.java:1691)
- with JCheckBox or by capturing the exception, the global state is not indicated (empty).
[Apr 5, 2019 11:49:38 PM] Show Printable Version of Post    View Member Profile    Send Private Message [Link] Report threatening or abusive post: please login first  Go to top 
Puybaret
Expert
Member's Avatar

France
Joined: Nov 7, 2005
Post Count: 6723
Status: Offline
Reply to this Post  Reply with Quote 
Re: Saved property not taken into account correctly

A NullableCheckBox instance isn't nullable by default. You should call setNullable(true) to be able to call setValue(null).
Just look in source code, there are plenty of examples.
----------------------------------------
Emmanuel Puybaret, Sweet Home 3D developer
[Apr 6, 2019 11:54:42 AM] Show Printable Version of Post    View Member Profile    Send Private Message    Hidden to Guest [Link] Report threatening or abusive post: please login first  Go to top 
enkonyito
Advanced Member
Member's Avatar


Joined: May 28, 2015
Post Count: 399
Status: Offline
Reply to this Post  Reply with Quote 
Re: Saved property not taken into account correctly

My mistake, by declaring the ceilingLightEnabled global variable in the RoomController.java file I had used boolean instead of Boolean . sad

Thanks!
[Apr 6, 2019 10:45:12 PM] Show Printable Version of Post    View Member Profile    Send Private Message [Link] Report threatening or abusive post: please login first  Go to top 
[ Jump to Last Post ]
Show Printable Version of Thread  Post new Thread

    Get Sweet Home 3D at SourceForge.net. Fast, secure and Free Open Source software downloads
   
© Copyright 2006-2019 eTeks - All rights reserved