This content has been marked as final. Show 3 replies
No not yet. There was such a feature but it wasn't ready for the GA so I had to remove it. The problem with your implementation is that it doesn't take pasted code into account. I think what I would do is subclass TextField and create a new Content to be used. This new implementation of Content would wrap the normal one, but would impose the two character limit.
I think that would work, though I haven't tried it.
BTW, the wrinkle I hadn't resolved (which is why this maximumLength property didn't make it in the 2.0 GA for TextField) was what should happen when a TextField has 20 characters, but then programmatically the maximum length is set to 15 chars. Do we throw away the last 5 chars? Throw an exception? Allow the TextField length to exceed the maximumLength?
I guess the right answer is to throw away the last 5 chars and enforce the invariant that the number of chars is always <= the maximumLength. But I didn't have time to sort it out. What do you think?
you stated: "I would do is subclass TextField and create a new Content to be used. This new implementation of Content would wrap the normal one, but would impose the two character limit."
Could you give us a hint, how you'd like to subclass TextField and wrap content? I tried to do so but I failed because content is declared final.