New Navigator and View controls. Vaadin 7

https://vaadin.com/wiki/-/wiki/Main/Creating%20a%20bookmarkable%20application%20with%20back%20button%20support

Looked at the above article. Code does not work. For example the reference to import com.vaadin.server.WrappedRequest;. No such animal WrappedRequest in 7 Beta 3. Created other class files per the article and pasted the code examples in. Lots of red everywhere… lol

I am a newbie to Vaadin. I bought the Learning Vaadin. Read it.

Went through the Book Of Vaadin. Created the example project with Roo. Worked fine. I noticed it makes extensive use of plugin extensions to accomplish the Navigation / View design. I thought it was Interesting that the most basic (getting started) example has to go outside the core product to do something so simple. I looked at the code it generated but I am hesitant to go that route as the online docs seem to indicate this methodology and the associated plugins are going to be obsoleted by Vaadin 7x.

As I said I am new, so I am going to start out by apologizing for my next few remarks as I have been a developer for many years and have a certain perception of how project development should work.

As a developer I want to build products with the tools I select, not spend my time fighting just trying to get the tools to simply work. My customer is paying me to build products not fight with tools.

As a newbie I am just trying to understand. If the base examples blow up I am not going to crack open the source at this point and fix it as a lot of you surely do as part of the open source community. I am just trying to swim at this point.

If someone posts an example, my perception is that it should work without having to debug it. I tried a few of the “Sampler Examples” as well. The few I tried if you create a class using the class naming convention shown in the example and drop in the code, they all bleed red. And they seem to assume you just know where the example code snippets should go or will understand how to fix them. They look like class files. So I would go New → Class → and drop the code in based on my past experience. I must be missing something… lol

What I need at at this point is an example of Navigation —> View control where you have a main startup page with menus/buttons which load/display new views without swapping out the entire page. Similiar to the Roo example as previously mentioned but using Vaadin 7 instead as it is the future. Probably going to use a Header/Footer template, but I would just like to see something that works with Beta3 at all at this point.

Again, I apologize. Not intending to flame anyone. Just frustrated at my complete lack of productivity. I am used to commercial products where you buy them, drop them in and the and the code examples just work… This is a new experience for me and I am not used to it.

Any help at this point would be appreciated. I am sure a year from now these issues will seem simple.

FYI. Installed 7 per the instructions. Created the product in Eclipse… New Vaadin 7 project. That’s where I started with the example code… Picked Beta 3 in project creation wizard.

This project is going to take at least a year using multiple developers. I really need to start out with a coding approach that will still be in use a year from now not obsolete in a few months.

Thanks in advance…

I am sorry your initial experience wasn’t that great. However the wiki you have used to get your examples from isn’t updated to the current beta version and your compilation errors are due to an API change. The WrappedRequest was changed to com.vaadin.server.VaadinRequest and the constructor for Navigator has been changed to take the UI instead of Page. Other than that the article is up to date as far as I can tell. Additional info can be found
here
aswell. But please do realize that this is a beta version and they are still working on the documentation/book for Vaadin 7.

I hope this helps you,

Bart

Thanks. I looked at the other article you mentioned and it has the same problems with the old syntax as my original article. I am trying to fix it in Exlipse but when I paste it in there is a LOT of red. I tried to change the references as you recommended but I just don’t have enough experience at this point. As a beginner I am not sure how to fix some of the warnings. it’s like slogging through mud. Another day shot and can’t get a simple menu/couple of windows popping up.

:frowning:

We have a lead on this project who wants to use Vaadin. But as one of the other primary developers after working on this the last couple of weeks I can’t recommend it at this point. Seems a really risky proposition for the customer to try to implement something when its so difficult to even get simple examples to work. Using other products I have used in the past in the last two weeks I would have the entire framework shelled out and be on to the business and data layers. So far I can’t even get any of the Navigate / View examples to work using Vaadin 7 sample code.

I know all of the experienced Vaadin developers are probably shaking their heads at this point but as new users and our first time exposure to your suite of products I hope you take my comments to heart. In over 15 years of development I have never spent so much time trying to accomplish basic tasks like these.

If there was just one good “working” example out there I could paste in and take for a spin that was remotely close to what I am doing… lol

Thanks for the reply anyway…

@Les

Thats why the thing is called beta. What do you expect. With your 15 year dev experience you may remember the times when betas were not even public accessible but only to selected experienced users that were called beta testers, btdt ;.).
No one would have judged a product by its beta. Use the 6.x.x branch if you want to have stable version, incl. well documented API…
Especially since view and navigator and UI were only introduced recently with vadin 7,

Cheers

Thomas

Thanks for the reply. All true. I just have a specific reason due to this large project we have just started. I want to use the new not the old. The timing is just unfortunate I grant you. If I use the old way with the plugin (that does work) then I am signing up the team for a lot of rework in a few months. See original post. As for beta, again your are correct. But I would assume two things at this point. 1) By beta release 4 I would hope they have probably got a good idea about how to open a window and a view. Personally I would have started with that as it is so basic a feature/functionality. 2) I know they are running test cases in the back that work so it would be nice if the Vaadin 7 examples would actually refer to components that actually exist. What is the point in publishing an example on the site that is wrong? Would you not agree that is a waste of time for both the poster and the readers? So far they have posted two Vaadin 7 examples of this and both refer to non-existent objects in the library.

Thanks again for taking the time to reply. Not helpful though…

If you install newest vaadin plugin http://vaadin.com/eclipse/experimental in eclipse, and create a new vaadin project with it, it gives you this code:

package com.example.yourproject;

import com.vaadin.server.VaadinRequest;
import com.vaadin.ui.*;

public class yourprojectUI extends UI {
@Override
public void init(VaadinRequest request) {
Label label = new Label(“Hello Vaadin user”);
addComponent(label);
}

}

there you have both UI and the request, from where you can proceed your development…

First thing we did days ago. Then tried to use the non working examples. Actually looking at other products now.

Create a project named Navigationtest with vaadin plugin for 7beta4. Remove the generated NavigationtestUI class and put these classes in:

import com.vaadin.navigator.View;
import com.vaadin.navigator.ViewChangeListener.ViewChangeEvent;
import com.vaadin.ui.Label;
import com.vaadin.ui.Panel;

public class CountView extends Panel implements View {

public static final String NAME = "count";

private static int count = 1;

public CountView() {
    addComponent(new Label("Created: " + count++));
}

public void enter(ViewChangeEvent event) {

}

}

import com.vaadin.navigator.View;
import com.vaadin.navigator.ViewChangeListener.ViewChangeEvent;
import com.vaadin.ui.Panel;

import com.vaadin.server.ExternalResource;
import com.vaadin.ui.Link;

public class MainView extends Panel implements View {

public static final String NAME = "";

public MainView() {

    Link lnk = new Link("Count", new ExternalResource("#!"
            + CountView.NAME));
    addComponent(lnk);

}

 public void enter(ViewChangeEvent event) {

}

}

import com.vaadin.server.VaadinRequest;
import com.vaadin.ui.*;
import com.vaadin.navigator.Navigator;
import com.vaadin.navigator.Navigator.SimpleViewDisplay;

public class NavigationtestUI extends UI {

@Override
public void init(VaadinRequest request) {

    // Create Navigator, use the UI content layout to display the views
    Navigator navigator = new Navigator(this, getContent());

    // Add some Views
    navigator.addView(MainView.NAME, new MainView()); // no fragment

    // #count will be a new instance each time we navigate to it, counts:
    navigator.addView(CountView.NAME, CountView.class);

    // Navigate to view
    navigator.navigate();
}

}

This worked for me…

Thank you!!! I tried that and it worked the first time for me as well. Hopefully over the next few months, all of the team members will have had the opportunity to get very familiar with Vaadin and begin to contribute to the community as well. Just no time to fight brush fires right now. Appreciate your help.

Les