@Test public void wrapSimpleComponent() { final Button component = new Button("Hello"); final UI app = instance.wrap(component); final Component content = app.getUI().getContent(); assertEquals("Main content must be vertical layout", VerticalLayout.class, content.getClass()); final VerticalLayout layout = (VerticalLayout) content; assertEquals("Should have a single component", 1, layout.getComponentCount()); assertEquals("Component was not set properly", component, layout.getComponent(0)); }
public UI wrap(Component component) { if (component instanceof UI) { return (UI) component; } if (component instanceof Window) { return wrapWindow((Window) component); } if (component instanceof Layout) { return wrapLayout((Layout) component); } final VerticalLayout layout = new VerticalLayout(); layout.setMargin(true); layout.setSizeFull(); layout.addComponent(component); layout.setExpandRatio(component, 1); return wrapLayout(layout); }
ComponentWrapper { public UI wrap(Component component) { if (component instanceof UI) { return (UI) component; } if (component instanceof Window) { return wrapWindow((Window) component); } if (component instanceof Layout) { return wrapLayout((Layout) component); } final VerticalLayout layout = new VerticalLayout(); layout.setMargin(true); layout.setSizeFull(); layout.addComponent(component); layout.setExpandRatio(component, 1); return wrapLayout(layout); } }
ComponentWrapper { public UI wrap(Component component) { if (component instanceof UI) { return (UI) component; } if (component instanceof Window) { return wrapWindow((Window) component); } if (component instanceof Layout) { return wrapLayout((Layout) component); } final VerticalLayout layout = new VerticalLayout(); layout.setMargin(true); layout.setSizeFull(); layout.addComponent(component); layout.setExpandRatio(component, 1); return wrapLayout(layout); } ComponentWrapper(ComponentBasedVaadinServer server); }
ComponentWrapper { public UI wrap(Component component) { if (component instanceof UI) { return (UI) component; } if (component instanceof Window) { return wrapWindow((Window) component); } if (component instanceof Layout) { return wrapLayout((Layout) component); } final VerticalLayout layout = new VerticalLayout(); layout.setMargin(true); layout.setSizeFull(); layout.addComponent(component); layout.setExpandRatio(component, 1); return wrapLayout(layout); } ComponentWrapper(ComponentBasedVaadinServer server); UI wrap(Component component); UI wrapLayout(Layout layout); UI wrapWindow(Window window); }
ComponentWrapper { public UI wrap(Component component) { if (component instanceof UI) { return (UI) component; } if (component instanceof Window) { return wrapWindow((Window) component); } if (component instanceof Layout) { return wrapLayout((Layout) component); } final VerticalLayout layout = new VerticalLayout(); layout.setMargin(true); layout.setSizeFull(); layout.addComponent(component); layout.setExpandRatio(component, 1); return wrapLayout(layout); } ComponentWrapper(ComponentBasedVaadinServer server); UI wrap(Component component); UI wrapLayout(Layout layout); UI wrapWindow(Window window);  }