Community
Participate
Working Groups
Created attachment 82955 [details] Test case Hello, After recent refactoring of WrapLabel class (introduction of WrappingLabel) the contract of the method getPreferredSize(int, int) is changed. I believe that prior to refactoring the attached testcase was not failing (also I can't directly check it now, but I am pretty sure that WrapLabel and Label behaved the same way in the past and was in fact interchangeable from layout point of view). The main consequence of this for the UML2Tools is described in the #209644 -- that is, ToolbarLayout passes complete available space of container as hints. With the old version of code, the "natural" size was returned, and the label was centered by layouter. With actual version of the code, the hints are returned as is, and the label is drawn left-aligned.
This is how the flow figures work in GEF. The preferred size uses up the whole width even if the text isn't that long. I tried to avoid this by returning the preferred size as it used to be returned, but had other issues. I will need to revisit this, but unfortunately it is not a simple fix. Would you like me to put the old WrapLabel back in the code so you can use that for now in the UML2Tools project?
I digged into this code yesterday :), and I agree that there seems to be no easy fixes. I have two suggestions, if possible, 1. Yes, the resurrection of the old version of the WrapLabel would probably help. 2. Also, I would like to have some utility method in the new WrappingLabel that may calculate the "natural" preferred size of the figure. It would allow us to modify external layouter code to take into account preferredSize contract changes. What do you think? Regards, Michael
Michael, the method WrappingLabel.getTextBounds() calculates the bounds of the label's text. This uses the label's complete text regardless of whether the text is currently truncated. Is this sufficient for what you need?
[GMF Restructure] Bug 319140 : product GMF and component Runtime was the original product and component for this bug