Package com.vaadin.ui

Examples of com.vaadin.ui.Component$Event


     * @param method
     */
    private void bindEventHandler(Component componentRoot, Object controller,
            Method method) {
        String componentId = method.getAnnotation(UiHandler.class).value();
        Component component = tryToFindComponentById(componentRoot, componentId);

        Class<?> eventType = (method.getParameterTypes().length > 0 ? method
                .getParameterTypes()[0] : null);
        if (eventType == null) {
            throw new BinderException(
                    "Couldn't figure out event type for method " + method + ".");
        }

        Method addListenerMethod = getAddListenerMethod(component.getClass(),
                eventType);
        if (addListenerMethod != null) {
            try {
                Object listener = createListenerProxy(
                        addListenerMethod.getParameterTypes()[0], eventType,
View Full Code Here


     * @param method
     */
    private void bindDataSource(Component componentRoot, Object controller,
            Method method) {
        String componentId = method.getAnnotation(UiDataSource.class).value();
        Component component = tryToFindComponentById(componentRoot, componentId);
        Class<?> dataSourceClass = method.getReturnType();

        try {
            // Vaadin data model consists of Property/Item/Container
            // objects and each of them have a Viewer interface.
View Full Code Here

            throw new BinderException(e);
        }
    }

    private Component tryToFindComponentById(Component root, String id) {
        Component component = Clara.findComponentById(root, id);
        if (component == null) {
            throw new BinderException("No component found for id: " + id + ".");
        }
        return component;
    }
View Full Code Here

        assertEquals(Unit.PERCENTAGE, layout.getPosition(button).getLeftUnits());
    }

    @Test
    public void inflate_singleButtonNoNamespace_buttonInstantiated() {
        Component button = inflater
                .inflate(getXml("single-button-no-namespace.xml"));

        // check that the composition root is actually a Button
        assertEquals(com.vaadin.ui.Button.class, button.getClass());

        // check attributes
        assertEquals("My Button", button.getCaption());
        assertEquals(true, button.isReadOnly());
    }
View Full Code Here

        assertEquals(true, button.isReadOnly());
    }

    @Test
    public void inflate_singleLayout_layoutWithMarginsInstantiated() {
        Component layout = inflater.inflate(getXml("single-layout.xml"));

        // check margin="true false false true"
        assertEquals(new MarginInfo(true, false, false, true),
                ((VerticalLayout) layout).getMargin());
    }
View Full Code Here

                ((VerticalLayout) layout).getMargin());
    }

    @Test
    public void inflate_singleLayout_sizeFull() {
        Component layout = inflater.inflate(getXml("single-layout.xml"));

        assertEquals(100, layout.getWidth(), 0);
        assertEquals(100, layout.getHeight(), 0);
        assertEquals(Unit.PERCENTAGE, layout.getWidthUnits());
        assertEquals(Unit.PERCENTAGE, layout.getHeightUnits());
    }
View Full Code Here

        assertEquals(Unit.PERCENTAGE, layout.getHeightUnits());
    }

    @Test
    public void inflate_simpleMargin_layoutMarginTrue() {
        Component layout = inflater.inflate(getXml("simple-margin.xml"));

        // check margin="true"
        assertEquals(new MarginInfo(true),
                ((VerticalLayout) layout).getMargin());
    }
View Full Code Here

    @Test
    public void inflate_alignmentTest_alignmentAssignedCorrectly() {
        VerticalLayout layout = (VerticalLayout) inflater
                .inflate(getXml("alignment-test.xml"));

        Component child = layout.getComponent(0);
        assertEquals(Alignment.TOP_RIGHT, layout.getComponentAlignment(child));
    }
View Full Code Here

        assertEquals(Alignment.TOP_RIGHT, layout.getComponentAlignment(child));
    }

    @Test
    public void inflate_layoutAttributes_layoutAttributesApplied() {
        Component layout = inflater.inflate(getXml("layout-attributes.xml"));

        // check that the composition root is actually a VerticalLayout
        assertEquals(com.vaadin.ui.VerticalLayout.class, layout.getClass());

        // check expandRatio
        VerticalLayout verticalLayout = (VerticalLayout) layout;
        Component button = verticalLayout.getComponentIterator().next();
        assertEquals(1.0f, verticalLayout.getExpandRatio(button), 0.0f);
    }
View Full Code Here

        assertEquals(1.0f, verticalLayout.getExpandRatio(button), 0.0f);
    }

    @Test
    public void inflate_componentHasWidth_widthAttributeApplied() {
        Component layout = inflater.inflate(getXml("component-width.xml"));

        // check width
        Button button200px = (Button) Clara.findComponentById(layout,
                "button200px");
        assertEquals(200.0f, button200px.getWidth(), 0.0f);
View Full Code Here

TOP

Related Classes of com.vaadin.ui.Component$Event

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.