Package com.vaadin.ui

Examples of com.vaadin.ui.AbstractComponent$ComponentErrorHandler


    }

    private void checkButton(Class<? extends Button> class1) {
        boolean ok = false;
        AbstractComponent b;
        try {
            b = class1.newInstance();
            b.setCaption("Button of type " + class1.getSimpleName());
            ok = true;
        } catch (Exception e1) {
            e1.printStackTrace();
        }
View Full Code Here


        mainWindow.addComponent(tabsheet);
        mainWindow.addComponent(panelC);
    }

    private AbstractComponent getRandomComponent(int caption) {
        AbstractComponent result = null;
        final int randint = seededRandom.nextInt(7);
        switch (randint) {
        case 0:
            // Label
            result = new Label();
            result.setCaption("Label component " + caption);
            break;
        case 1:
            // Button
            result = new Button();
            result.setCaption("Button component " + caption);
            break;
        case 2:
            // TextField
            result = new TextField();
            result.setCaption("TextField component " + caption);
            break;
        case 3:
            // Select
            result = new Select("Select " + caption);
            result.setCaption("Select component " + caption);
            ((Select) result).addItem("First item");
            ((Select) result).addItem("Second item");
            ((Select) result).addItem("Third item");
            break;
        case 4:
            // Link
            result = new Link("", new ExternalResource("http://www.vaadin.com"));
            result.setCaption("Link component " + caption);
            break;
        case 5:
            // Link
            VerticalLayout panelLayout = new VerticalLayout();
            panelLayout.setMargin(true);
            result = new Panel(panelLayout);
            result.setCaption("Panel component " + caption);
            panelLayout
                    .addComponent(new Label(
                            "Panel is a container for other components, by default it draws a frame around it's "
                                    + "extremities and may have a caption to clarify the nature of the contained components' purpose."
                                    + " Panel contains an layout where the actual contained components are added, "
                                    + "this layout may be switched on the fly."));
            ((Panel) result).setWidth("250px");
            break;
        case 6:
            // Datefield
            result = new DateField();
            ((DateField) result).setStyleName("calendar");
            ((DateField) result).setValue(new java.util.Date());
            result.setCaption("Calendar component " + caption);
            break;
        case 7:
            // Datefield
            result = new DateField();
            ((DateField) result).setValue(new java.util.Date());
            result.setCaption("Calendar component " + caption);
            break;
        }

        return result;
    }
View Full Code Here

    public void addComponents(List<Class<? extends Component>> components,
            String URL) {
        final HorizontalLayout hl = new HorizontalLayout();
        for (Class<? extends Component> cls : components) {
            try {
                AbstractComponent c = (AbstractComponent) cls.newInstance();
                c.setId(cls.getName());
                c.setCaption(cls.getName());
                c.setDescription(URL);
                c.setWidth("100px");
                c.setHeight("100px");
                hl.addComponent(c);

                new BrowserWindowOpener(URL).extend(c);

                if (c instanceof Button) {
View Full Code Here

                        levels.add(record.getLevel());
                    }
                });
        Map<String, Object> variables = new HashMap<String, Object>();
        final boolean[] isConnectorEnabledCalled = new boolean[1];
        AbstractComponent component = new AbstractComponent() {
            @Override
            public boolean isConnectorEnabled() {
                isConnectorEnabledCalled[0] = true;
                return false;
            }
View Full Code Here

    @Test
    public void testExpandRatio() {
        AbstractOrderedLayout layout = new AbstractOrderedLayout() {
        };

        AbstractComponent first = new AbstractComponent() {
        };
        AbstractComponent second = new AbstractComponent() {
        };

        layout.addComponent(first);
        layout.addComponent(second);

        int ratio = 2;
        layout.setExpandRatio(first, ratio);
        layout.setExpandRatio(second, 1);

        AbstractComponent replace = new AbstractComponent() {
        };
        layout.replaceComponent(first, replace);

        Assert.assertEquals("Expand ratio for replaced component is not "
                + "the same as for previous one", ratio,
View Full Code Here

    @Test
    public void testAlignment() {
        AbstractOrderedLayout layout = new AbstractOrderedLayout() {
        };

        AbstractComponent first = new AbstractComponent() {
        };
        AbstractComponent second = new AbstractComponent() {
        };

        layout.addComponent(first);
        layout.addComponent(second);

        Alignment alignment = Alignment.BOTTOM_RIGHT;
        layout.setComponentAlignment(first, alignment);
        layout.setComponentAlignment(second, Alignment.MIDDLE_CENTER);

        AbstractComponent replace = new AbstractComponent() {
        };
        layout.replaceComponent(first, replace);

        Assert.assertEquals("Alignment for replaced component is not "
                + "the same as for previous one", alignment,
View Full Code Here

import com.vaadin.ui.AbstractComponent;

public class TestAbstractComponentStyleNames extends TestCase {

    public void testSetMultiple() {
        AbstractComponent component = getComponent();
        component.setStyleName("style1 style2");
        assertEquals(component.getStyleName(), "style1 style2");
    }
View Full Code Here

        component.setStyleName("style1 style2");
        assertEquals(component.getStyleName(), "style1 style2");
    }

    public void testSetAdd() {
        AbstractComponent component = getComponent();
        component.setStyleName("style1");
        component.addStyleName("style2");
        assertEquals(component.getStyleName(), "style1 style2");
    }
View Full Code Here

        component.addStyleName("style2");
        assertEquals(component.getStyleName(), "style1 style2");
    }

    public void testAddSame() {
        AbstractComponent component = getComponent();
        component.setStyleName("style1 style2");
        component.addStyleName("style1");
        assertEquals(component.getStyleName(), "style1 style2");
    }
View Full Code Here

        component.addStyleName("style1");
        assertEquals(component.getStyleName(), "style1 style2");
    }

    public void testSetRemove() {
        AbstractComponent component = getComponent();
        component.setStyleName("style1 style2");
        component.removeStyleName("style1");
        assertEquals(component.getStyleName(), "style2");
    }
View Full Code Here

TOP

Related Classes of com.vaadin.ui.AbstractComponent$ComponentErrorHandler

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.