Abbas
Abbas

Reputation: 3258

Vaadin example from 'Book of Vaadin' is not compiled

I am trying to re-create some of Vaadin examples from their book of Vaadin (LayoutExample.java). I am using their latest version v7. However, when trying to compile the following code, the compiler complains that addComponent in the last line is not defined for the type Panel. My question is, should the examples in the book of Vaadin be compiled with a different version of Vaadin?

I am evaluating Vaadin for a project but so far I have found many examples on their website that do not compile with the latest Vaadin library. Have i missed something?

    HorizontalLayout horlayout = new HorizontalLayout();

    Panel menuContainer = new Panel("The Possible Places");
    horlayout.addComponent(menuContainer);

    // A menu tree, fill it later.
    Tree menu = new Tree();
    menuContainer.addComponent(menu);

Upvotes: 0

Views: 367

Answers (2)

Charles Anthony
Charles Anthony

Reputation: 3155

As it states in the preface of the Book Of Vaadin

Writing this manual is an ongoing work and it is rarely completely up-to-date with the quick-evolving product. This version is a snapshot taken soon after the release of Vaadin 7.

While this edition is mostly updated for Vaadin 7, it may still contain some outdated content related to Vaadin 6.

Of course, this is not ideal; if you could report the URL that contains the outdated example to the Vaadin forum, it could be corrected and this will help other users.

Upvotes: 1

Abbas
Abbas

Reputation: 3258

Well, after reading their api documentation, i realized that a Panel holds one and only one component, which should be supplied in the constructor. The following code solved my problem but I am just wondering when they are going to update their example, and subsequently their book of vaadin!

    // A menu tree, fill it later.
    Tree menu = new Tree();
    menu.setSizeUndefined();

    // Layout for the menu area. Wrap the menu in a Panel to allow
    // scrollbar.
    Panel menuContainer = new Panel("The Possible Places", menu);

Upvotes: 0

Related Questions