CardLayout Manager in Vaadin ? Like Swing Java?

Is there any Layout like CardLayout manager on vaadin like Java Swing has?
I need to show 3 panels animated in time.

Top PK next 10 seconds later ,
Top10 PVP etc…

And my second question is , is there anything like JList with Label and Image on vaadin ?

There is no direct CardLayout replacement, but besides the animation you could any of the basic layouts. Take a look at sampler for code examples:
demo.vaadin.com/sampler/

I think the JList is just called Select in Vaadin. Again the sampler helps you to find the right component to use. If you want to simple way of binding arrays or collections of objects to the Vaadin select/table/tree components take a look at the CollectionContainer add-on:
vaadin.com/addon/collectioncontainer

Hi Sami,

I have the same problem: I want to replace some buttons in-place when user changes from view mode to edit mode. I would use a CardLayout for that. How can it be done without?

Greetings,
Oliver

Hi Oliver,


ComponentContainer#replaceComponent
I’d use the method, and something along the lines of the following

Component  viewButtons = [ .... a Layout component containing buttons for view mode]

Component editButtons = [ .... a Layout component containing buttons for view mode]

ComponentContainer mainContainer = [ The main layout of the view ]


Component currentButtons = viewButtons;
mainContainer.add(currentButtons);

public void showViewButtons(){
    mainContainer.replaceComponent(currentButtons, viewButtons);
    currentButtons = viewButtons;
}

public void showEditButtons(){
    mainContainer.replaceComponent(currentButtons, editButtons);
    currentButtons = editButtons;
}

Cheers,

Charles

Hi Charles,

thanks for this good solution.

Cheers,
Oliver

Nice Charles… good thinking !!

Vaadin has something called a TabSheet that doesn’t inherit from Layout but seems to correspond to what a Swing container would do if it had Swing’s CardLayout active:

sampler: https://demo.vaadin.com/sampler/#ui/structure/tab-sheet
javadoc: https://vaadin.com/api/index.html?com/vaadin/ui/AbstractComponentContainer.html

None of the solutions on this page mention Vaadin’s TabSheet. Is there a reason why this would not be a suitable substitute?