Example usage for com.vaadin.ui AbstractLayout getComponentIterator

List of usage examples for com.vaadin.ui AbstractLayout getComponentIterator

Introduction

In this page you can find the example usage for com.vaadin.ui AbstractLayout getComponentIterator.

Prototype

@Deprecated
@Override
public Iterator<Component> getComponentIterator() 

Source Link

Usage

From source file:dk.apaq.vaadin.addon.printservice.RemotePrintServiceManager.java

License:Open Source License

private static RemotePrintServiceManager createManager(AbstractLayout app) {
    //Window mainWindow = app.getMainWindow();
    //if(mainWindow == null) {
    //    throw new NullPointerException("Application must have a main window set before adding a Print Manager can be created.");
    //}//w  w w. j a v a2  s  . co  m

    //look for already added browsercookies

    Iterator<Component> it = app.getComponentIterator();
    while (it.hasNext()) {
        Component c = it.next();
        if (c instanceof RemotePrintServiceManager) {
            return (RemotePrintServiceManager) c;
        }
    }

    //...else create and add a new one.
    PrintServiceApplet applet = new PrintServiceApplet();
    RemotePrintServiceManager manager = new RemotePrintServiceManager(applet);
    applet.setManager(manager);

    app.addComponent(manager);
    return manager;
}