for a search box I have in my application I’d like to have the whole content of the TextField selected on mouse click.
The behavior I’m talking about is the one you can see at
this site , and is actually the one I see when I select the TextField by cicling through components by pressing the tab key.
Is there any cleaner way to accomplish this than attaching a focus listener that executes a JavaScript to the field?
You can use setSelectionRange(int, int) to select text in the field. Having the field immediate might be a good idea so that the serevr knows the length of the text in the field.
As for handling mouse clicks, one option would be to use a layout click listener in the parent layout of the fields - Vaadin text fields do not support click listeners directly.
The problem is that I’m stuck with Vaadin 6.3 at the moment (cause I had to tweak it a bit to solve some path issues I was having with the corporate reverse proxy) and there’s no such method in the API (there’s the @since 6.4 tag).
Sooner or later I’ll move to a newer version, but I’m waiting for Vaadin 7…
Do you know of any other way I could select text inside the TextField using Vaadin 6.3?
As far as I know, not without changes to the client side VTextField or some Javascript (and not sure how to integrate that cleanly).
Are your changes such that also others could benefit from them? What have you had to change? Maybe an enhancement request in Vaadin trac could be in place if they would be of benefit to others - with or without a patch.
In any case, I would recommend making for yourself a patch of your changes against the base revision you started with and checking if you can easily apply that to the latest 6.4 series code. Always keep a patch from the latest base revision you have used handy, that will make future migrations easier.
Also, I would recommend not duplicating and editing the full source code of Vaadin but only the class(es) you need to touch and using the JAR for the rest to keep your modifications more separate and easier to port between versions, especially if you don’t need to make API changes.
Thank you, I’ll see what I can do with Javascript…
I had to make Vaadin insert a String at the beginning of every resource path, that is the junction name (see the picture at
this page to understand what a junction is), so that the reverse proxy doesn’t look for resources on its local filesystem, but asks the backend server (the application server running Vaadin). Since Vaadin uses the context root as “root” for every path (like “/MyApplication/image.png”) I had it check whether every path starts with the junction name configured in web.xml and, if not, it automatically translates it (like “/junctionName/MyApplication/image.png”).
This “patch” could help developers dealing with IBM WebSEAL version 5.1 or below, as newer version have a feature that automatically fixes this issue (called transparent path junctions, FWIW).
When I’m done with this project I’ll surely have a look at how the patch submission process works for Vaadin, and I’ll submit my patch :smug:
I’d say it’s about a couple of hundreds lines of code, tops…
Hi, I am beginning a proof-of-concept project of Vaadin 6.8.5 deployed on WebSphere Application Server 8 and authentication via TAM WebSeal 6.1. I would appreciate you could share the patch for customizing resource and link paths so I can handle the junction string issue. I have deployed sample.war and got “Cookies disabled” message on Chrome 22, blank page on Firefox 16 and a “Failed to load the widgetset: …” popup on IE 7.
Thanks in advance,
Héctor
Hi,
unfortunately I don’t have access to that code right now (changed job… and country ATM!), and I won’t until I get home by the end of the year (I have a copy somewhere in an external backup hard disk).
Since you’re working with TAM 6.1, have you tried using
transparent path junctions ? Those should work out of the box!
Hi, thanks for replying. I have tried to get our Security Team try the transparent junction capability but it may take more than a while for organizational (corporate-cultural-technical) issues. This is why I usually end up tweaking applications to work or using frameworks/libraries that can get over this situation.
I would appreciate any suggestion where to start digging in the Vaadin’s source code to make the changes.
Best Regards,
Héctor
Yeah, that’s how corporate stuff tends to work… :unsure:
It’s been quite a long time, but from what I remember I worked with the
com.service.ApplicationContext mainly. From a brief look I just took, it looks like now that has been replaced by
com.terminal.gwt.server.AbstractCommunicationManager , so you probably have to work with
URIHandler.handleURI() implementations (in
com.vaadin.Application ,
com.vaadin.ui.Window and
com.vaadin.ui.LoginForm ). I’m sorry I don’t have much time now, but it really didn’t take me more than a day or two to make it work back in the day, so I think you’ll be able to fix it pretty quickly!
Thank you very much Michele. I could make sample.war work that day (night really…) by changing the “appUri” string generation in AbstractApplicationServlet (in vaadin-6.7.4.jar). I’ll continue my proof-of-concept project with Vaadin 6.8.5 considering this workaround. I am not sure if I’ll find more lines to change but until now it seems to work. If everything goes fine I will post the code changes in this thread.
Best regards,
Héctor