What is Alternative of Card Layout of Java in Vaadin

Hello Vaadin Community.

As you Know In java native language there is a card layout. which makes stack of different components over each other and display only 1 component at a time.
I have a similar problem i.e i have a split panel. and it has left side menu and right side a working area. I want to change my right side working area components e.g different panels will display on selecting any menu entry.

If I want to achieve this with simple Java i would use card layout and put all my panels in card layout and on action,i will display the specific panel by activating specific card which holding that panel.

But I did not Know how to achieve this in Vaadin … Is there any Card layout or any other component or procedure to achieve this? Thanks.

I also use repalceComponent(Coponent old,Component new) method But it’s rendering is very slow and i want a fast method.

Hi,

There is no explicit CardLayout in Vaadin - but it is trivial to implement, by using the #replaceComponent(Component old, Component new)

That is the main way to do what you want.

The replaceComponent method itself have no effect (at all) on the rendering speed - if you do have rendering speed issues, I suggest that the problem is likely to lay in whatever’s in the new component. To confirm this, try a simple replace using a simple label - do you still have rendering speed problems? If so, I suggest that problem is environmental (Proxy servers? Routing? Using GAE?) and not related to the new component.

However, my money’s on the problem being related to the complexity of the new component.

Cheers,

Charles.

Thanks Charles. The Problem was in my other Component. I just changed the Layout method and it worked.

Mr. Charles Because I m New to Vaadin so i wana Know is there any component in vaadin alternative to HTML something in form.

Basically I wana implement search functionality. i have a textField with Button. i want that when user write something in TextField and press enter then my bottom Panels change and show the Search results. Or when the user Press Search Button then same thing should Happen.


12490.png

Hi,

Well - you’d just use the Form component, a button, and a ClickListener!

Look, I strongly suggest (as I do to anyone starting with Vaadin) to
follow the tutorial
, and read the
Book of Vaadin.
The tutorial takes maybe an hour or so, and skim reading the book probably takes a couple of hours.

It’s clear, well written, and really worth spending your time doing.

Cheers,

Charles.

Thanks For Pointing me But I have already tried Tutorials. But my problem is how to implement Enter Key Listener over TextField ?

To click the button on Enter, button#setClickShortcut(KeyCode.ENTER);

See the source of this sampler example http://demo.vaadin.com/sampler#ShortcutBasics

Cheers,

Charles.

Oh My mistake was i m putting different listeners and shortcuts to textField instead of Button … It worked … charles thanks you are awesome !!:smiley: