On Thu, Nov 19, 2009 at 7:12 AM, Sandro Martini <[email protected]>wrote:
> Hi Todd, > > showEllipsis would be a boolean style in LabelSkin. Creating a subclass > just to avoid an if statement seems a bit much :-) > Yes, you have reason, but I was thinking at a simple way to avoid > adding if and calculations (the current length of the generated > string, when this has to be enabled, etc), so the current component > could be not modified and keep the best performances without having to > handle not-so-common cases ... > And could be useful also for us to see (and to show) how to extend our > components. > The boolean style *would* avoid unnecessary calculations. Also, this wouldn't affect preferred size at all, so there are no corresponding calculations in those methods. In layout(), we would only run the code if the showEllipsis style was set to true, and we were given less than our preferred width. Subclassing would not add to performance, and it's just not necessary here - this is a prime use case for a style property. > > I don't think I've ever seen a text area with an ellipsis, but I have > seen it used (very rarely) in text inputs. > > For text area I was thinking at a text area inside a table cell, but > having the ability to show only some of its contents ... I had many > times this situation doing by hand SELECT of DB Tables with fields > containing long text descriptions and the resulting output if not the > best (usually the row containing that data will by displayed with a > monster height to fit all the text). > But I agree that this is a corner case. > The only use case for using a TextArea as a cell renderer is when you have newlines in the string, and you're using the newly added variableRowHeight style in table view. But in this case, you're not going to use the ellipsis, because you've chosen to grow your cells vertically. If you want to keep the cells to one line and show an ellipsis, then your renderer should be using a Label, not a TextArea. > > Up to you on whether to open a ticket. We have a lot of TODOs in code > that > > hark back to the pre-ASF days, and I don't really think we need to create > > tickets for all of them (we've been knocking them off one by one - > creating > > tickets would yield a lot of spam). > Ok, but you remember that I have very little memory, so could be > useful for me as a reminder, so if there aren't objections I'd add it > for the 1.5 > By all means, a ticket can't hurt :) It can just say "Implement the showEllipsis style in LabelSkin"
