Tribune

Home » Liferay Portal » English » 3. Development

Vista Combinata Vista Piatta Vista ad Albero
Discussioni [ Precedente | Successivo ]
toggle
Markus Alfter
Vaadin TextField loses focus when a component is displayed(TextChangeEvent)
19 luglio 2012 0.48
Risposta

Markus Alfter

Punteggio: New Member

Messaggi: 4

Data di Iscrizione: 6 marzo 2012

Messaggi recenti

Hello everyone,

I am using Vaadin Portlets (6.8.1) with Liferay (6.1 GA1).

I have a TextField and would like to show a component after a TextChangeEvent.
The component will be displayed if the TextField contains more than two
characters. Less than three characters hide them.

In Firefox, everthing works correctly, but in the IE8 the TextField loses the
focus.

The issue happens only in the liferay enviroment and in the IE8. A plain Vaadin
project in Tomcat works correctly.

I have a code demo here:

 1
 2package TestFocus.windows;
 3
 4import com.vaadin.event.FieldEvents.TextChangeEvent;
 5import com.vaadin.event.FieldEvents.TextChangeListener;
 6import com.vaadin.ui.AbstractTextField.TextChangeEventMode;
 7import com.vaadin.ui.Label;
 8import com.vaadin.ui.TextField;
 9import com.vaadin.ui.Window;
10
11public class ApplicationWindow extends Window {
12
13    public ApplicationWindow() {
14
15        final Label label = new Label("result");
16        label.setVisible(false);
17
18        final TextField tf = new TextField("search");
19        tf.setTextChangeEventMode(TextChangeEventMode.LAZY);
20        tf.setTextChangeTimeout(200);
21        tf.setImmediate(true);
22        tf.addListener(new TextChangeListener() {
23
24            public void textChange(TextChangeEvent event) {
25
26                if (event.getText().length() > 2 ) {
27                    label.setVisible(true);
28                } else {
29                    label.setVisible(false);
30                }
31            }
32        });
33
34        addComponent(tf);
35        addComponent(label);
36    }
37}


What am I doing wrong? It's a bug? Can someone help me?

Many thanks!

Post in Vaadin Forum
David H Nebinger
RE: Vaadin TextField loses focus when a component is displayed(TextChangeEv
19 luglio 2012 9.01
Risposta

David H Nebinger

Community Moderator

Punteggio: Liferay Legend

Messaggi: 12140

Data di Iscrizione: 1 settembre 2006

Messaggi recenti

Inside of your listener can you add a focus call?

1((TextField) event.getComponent()).focus();
Markus Alfter
RE: Vaadin TextField loses focus when a component is displayed(TextChangeEv
20 luglio 2012 10.49
Risposta

Markus Alfter

Punteggio: New Member

Messaggi: 4

Data di Iscrizione: 6 marzo 2012

Messaggi recenti

Hi David,

thanks for the help.

Your proposal brings no solution. Unfortunately, the problem persists.

Perhaps you have an idea?

Regards,
Markus
David H Nebinger
RE: Vaadin TextField loses focus when a component is displayed(TextChangeEv
20 luglio 2012 10.56
Risposta

David H Nebinger

Community Moderator

Punteggio: Liferay Legend

Messaggi: 12140

Data di Iscrizione: 1 settembre 2006

Messaggi recenti

You did recompile the widgetset using the vaadin controlpanel for liferay?
Markus Alfter
RE: Vaadin TextField loses focus when a component is displayed(TextChangeEv
20 luglio 2012 11.32
Risposta

Markus Alfter

Punteggio: New Member

Messaggi: 4

Data di Iscrizione: 6 marzo 2012

Messaggi recenti

Yes I did. The focus is lost at each TextChangeEvent.
David H Nebinger
RE: Vaadin TextField loses focus when a component is displayed(TextChangeEv
20 luglio 2012 11.41
Risposta

David H Nebinger

Community Moderator

Punteggio: Liferay Legend

Messaggi: 12140

Data di Iscrizione: 1 settembre 2006

Messaggi recenti

I think there's going to be too many moving parts here (Liferay, GWT, Vaadin) to come up with any possible solution. I see that your vaadin forum post hasn't gotten any replies, but I believe it's going to be a vaadin issue in the end (although I certainly don't want to toss them under the bus ;-) and your only hope will be some resolution from their end.

Did you try opening an issue on the Vaadin side? The forum is followed by some of the Vaadin folks, but an issue would certainly get their attention. Since you have a working test case that will reproduce the issue, that should be included too.
Markus Alfter
RE: Vaadin TextField loses focus when a component is displayed(TextChangeEv
20 luglio 2012 12.51
Risposta

Markus Alfter

Punteggio: New Member

Messaggi: 4

Data di Iscrizione: 6 marzo 2012

Messaggi recenti

I will create a issue, Many thanks!

Vaadin Trac #9157
Paul Butenko
RE: Vaadin TextField loses focus when a component is displayed(TextChangeEv
7 maggio 2013 1.44
Risposta

Paul Butenko

Punteggio: Junior Member

Messaggi: 38

Data di Iscrizione: 1 luglio 2010

Messaggi recenti

There is no answer at ticket.
Does anybody solved this problem?

BR,
Paul