Package com.vaadin.ui

Examples of com.vaadin.ui.Component


    protected Component createTestComponent(
            Class<? extends AbstractComponentTest> cls) {
        try {
            AbstractComponentTest t = cls.newInstance();
            t.init();
            Component c = t.getMainWindow().getContent();
            t.getMainWindow().setContent(null);
            return c;
        } catch (InstantiationException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
View Full Code Here


        Class<?>[] components = { Button.class, CheckBox.class,
                DateField.class, NativeButton.class, Link.class, Label.class,
                Panel.class, Slider.class, TextArea.class, TextField.class,
                Upload.class };
        for (Class<?> clazz : components) {
            Component c;
            try {
                c = (Component) clazz.newInstance();
            } catch (Exception e) {
                e.printStackTrace();
                continue;
            }
            c.setCaption(clazz.getSimpleName());
            c.setIcon(icon);
            gl.addComponent(c);
        }

        // TabSheet, caption + tab icons
        TabSheet tabs = new TabSheet();
View Full Code Here

    }

    @Test
    public void addComponent() {
        TestUI ui = new TestUI();
        Component c = new Label("abc");

        ui.addComponent(c);

        assertSame(c.getParent(), ui.iterator().next());
        assertSame(c, ui.getContent().iterator().next());
        assertEquals(1, ui.getComponentCount());
        assertEquals(1, ui.getContent().getComponentCount());
    }
View Full Code Here

    }

    @Test
    public void removeComponent() {
        TestUI ui = new TestUI();
        Component c = new Label("abc");

        ui.addComponent(c);

        ui.removeComponent(c);
View Full Code Here

    }

    @Test
    public void replaceComponent() {
        TestUI ui = new TestUI();
        Component c = new Label("abc");
        Component d = new Label("def");

        ui.addComponent(c);

        ui.replaceComponent(c, d);

        assertSame(d.getParent(), ui.iterator().next());
        assertSame(d, ui.getContent().iterator().next());
        assertEquals(1, ui.getComponentCount());
        assertEquals(1, ui.getContent().getComponentCount());
    }
View Full Code Here

public class TestTabSheet {

    @Test
    public void addExistingComponent() {
        Component c = new Label("abc");
        TabSheet tabSheet = new TabSheet();
        tabSheet.addComponent(c);
        tabSheet.addComponent(c);

        Iterator<Component> iter = tabSheet.getComponentIterator();
View Full Code Here

        assertNotNull(tabSheet.getTab(c));
    }

    @Test
    public void getComponentFromTab() {
        Component c = new Label("abc");
        TabSheet tabSheet = new TabSheet();
        Tab tab = tabSheet.addTab(c);
        assertEquals(c, tab.getComponent());
    }
View Full Code Here

    public void testOrderedLayoutAttachListener() {
        // Reset state variables
        resetVariables();

        // Add component -> Should trigger attach listener
        Component comp = new Label();
        olayout.addComponent(comp);

        // Attach counter should get incremented
        assertEquals(1, attachCounter);
View Full Code Here

        assertFalse(indexOfComponent == -1);
    }

    public void testOrderedLayoutDetachListener() {
        // Add a component to detach
        Component comp = new Label();
        olayout.addComponent(comp);

        // Reset state variables (since they are set by the attach listener)
        resetVariables();
View Full Code Here

    public void testGridLayoutAttachListener() {
        // Reset state variables
        resetVariables();

        // Add component -> Should trigger attach listener
        Component comp = new Label();
        gridlayout.addComponent(comp);

        // Attach counter should get incremented
        assertEquals(1, attachCounter);
View Full Code Here

TOP

Related Classes of com.vaadin.ui.Component

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.