Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issue with TouchKit when used along with NavigationManager & NavigationView #159

Open
gguptha opened this issue Feb 3, 2015 · 0 comments

Comments

@gguptha
Copy link

gguptha commented Feb 3, 2015

Hi,

I have a TouchKit NavigationView which needs to fetch data from the database every time the page is viewed. The first time the page is displayed, the methods init (when used with PreConstruct) and attach is invoked. For all subsequently display of the page, those methods are not invoked and hence I cannot refresh the page with the latest data (which might have changed in the database). I understand that a lot of work is still under progress. I only want to know if I am doing anything wrong at the moment. Below is the code -

package com.ist.datacenter.ui;

import com.ist.datacenter.domain.Server;
import com.ist.datacenter.repository.jpa.ServerRepository;
import com.vaadin.addon.touchkit.ui.NavigationButton;
import com.vaadin.addon.touchkit.ui.NavigationView;
import com.vaadin.addon.touchkit.ui.VerticalComponentGroup;
import com.vaadin.ui.CssLayout;
import org.springframework.beans.factory.annotation.Autowired;
import org.vaadin.spring.annotation.VaadinComponent;
import org.vaadin.spring.annotation.VaadinUIScope;

import javax.annotation.PostConstruct;

@SuppressWarnings("serial")
@VaadinComponent
@VaadinUIScope
public class ServerManagement extends NavigationView
{
@Autowired
private ServerRepository serverRepository;

@PostConstruct
protected void init()
{
}

@Override
public void attach()
{
    super.attach();
    System.out.println("fetching servers");

    setCaption("Server Mgmt");

    // Main container to hold all the components
    final CssLayout viewGroup = new CssLayout();

    final VerticalComponentGroup serverGroup = new VerticalComponentGroup();
    serverGroup.setCaption("Server List");
    viewGroup.addComponent(serverGroup);

    // List of servers showing IP addresses
    Iterable<Server> servers = serverRepository.findAll();
    for(Server server : servers) {
        NavigationButton serverButton = new NavigationButton(server.getIpAddress());
        serverGroup.addComponent(serverButton);
    }

    // Set the content of the screen with the main container
    setContent(viewGroup);
}

}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants