Original issue 1364 created by codenameone on 2015-02-19T14:27:12.000Z:
com.codename1.ui.Component.preferredSizeImpl() is unsafe as it sets the preferredSize from calcPreferredSize() which may be overridden.
This can be troublesome because on the other side getPreferredSize() returns a reference to the private member preferredSize. If it springs to mind to override calcPreferredSize() of a component and to return the result of getPreferredSize of another Component one can get very funny results which could easily drive one crazy.
Hence I suggest that within com.codename1.ui.Component.preferredSizeImpl() the result of calcPreferredSize() should better be transferred into the preferredSize member by using its com.codename1.ui.geom.Dimension.setWidth(int) and com.codename1.ui.geom.Dimension.setHeight(int) methods.
Original issue 1364 created by codenameone on 2015-02-19T14:27:12.000Z:
com.codename1.ui.Component.preferredSizeImpl() is unsafe as it sets the preferredSize from calcPreferredSize() which may be overridden.
This can be troublesome because on the other side getPreferredSize() returns a reference to the private member preferredSize. If it springs to mind to override calcPreferredSize() of a component and to return the result of getPreferredSize of another Component one can get very funny results which could easily drive one crazy.
Hence I suggest that within com.codename1.ui.Component.preferredSizeImpl() the result of calcPreferredSize() should better be transferred into the preferredSize member by using its com.codename1.ui.geom.Dimension.setWidth(int) and com.codename1.ui.geom.Dimension.setHeight(int) methods.