Package com.vaadin.ui

Examples of com.vaadin.ui.Component


                }
            }
        };

        filteringInflater.addAttributeFilter(filter);
        Component filteredView = filteringInflater
                .inflate(getXml("attributefilter-test.xml"));
        Component view = inflater.inflate(getXml("attributefilter-test.xml"));

        // check caption
        Button button200px = (Button) Clara.findComponentById(filteredView,
                "button200px");
        assertEquals("filteredValue", button200px.getCaption());
View Full Code Here


        assertEquals("{i18n:test}", button200px.getCaption());
    }

    @Test
    public void inflate_singleButton_findByIdWorks() {
        Component view = inflater.inflate(getXml("single-button.xml"));

        // check that the id my-button returns a Button
        assertEquals(com.vaadin.ui.Button.class,
                Clara.findComponentById(view, "myButton").getClass());
View Full Code Here

            Map<String, String> attributes)
            throws ComponentInstantiationException {
        try {
            Class<? extends Component> componentClass = resolveComponentClass(
                    namespace, name);
            Component newComponent = componentClass.newInstance();
            handleAttributes(newComponent, attributes);
            return newComponent;
        } catch (Exception e) {
            throw createException(e, namespace, name);
        }
View Full Code Here

    }

    private void bindEventHandler(ComponentMapper mapper, Object controller,
            Method method, EventHandler eventListener) {
        String componentId = eventListener.value();
        Component component = mapper.findById(componentId);

        Class<?> eventClass = (method.getParameterTypes().length > 0 ? method
                .getParameterTypes()[0] : null);
        if (eventClass != null && component != null) {
            Method addListenerMethod = findAddListenerMethod(
                    component.getClass(), eventClass);
            if (addListenerMethod != null) {
                try {
                    Object listener = createListenerProxy(
                            addListenerMethod.getParameterTypes()[0],
                            eventClass, method, controller);
View Full Code Here

    }

    private void bindDataSource(ComponentMapper mapper, Object controller,
            Method method, DataSource dataSource) {
        String componentId = dataSource.value();
        Component component = mapper.findById(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

            if (uri.startsWith("urn:" + URN_NAMESPACE_ID + ":")) {
                // Throw an exception if the id is already used.
                verifyUniqueId(attributes);

                Component component = instantiateComponent(uri, localName,
                        attributes.getValue(ID_ATTRIBUTE));

                if (root == null) {
                    // This was the first Component created -> root.
                    root = component;
View Full Code Here

                componentStack.push(component);
            }
        }

        private void attachComponent(Component component) {
            Component topComponent = componentStack.isEmpty() ? null
                    : componentStack.peek();
            if (topComponent instanceof SingleComponentContainer) {
                ((SingleComponentContainer) topComponent).setContent(component);
            } else if (currentContainer != null) {
                currentContainer.addComponent(component);
View Full Code Here

        @Override
        public void endElement(String uri, String localName, String qName)
                throws SAXException {
            super.endElement(uri, localName, qName);
            Component component = componentStack.pop();
            if (component instanceof ComponentContainer) {
                Component parent = component.getParent();
                while (parent != null
                        && !(parent instanceof ComponentContainer)) {
                    parent = parent.getParent();
                }
                currentContainer = (ComponentContainer) parent;
            }
        }
View Full Code Here

    public Component createComponent(String namespace, String name)
            throws ComponentInstantiationException {
        try {
            Class<? extends Component> componentClass = resolveComponentClass(
                    namespace, name);
            Component newComponent = componentClass.newInstance();
            return newComponent;
        } catch (Exception e) {
            throw createException(e, namespace, name);
        }
    }
View Full Code Here

        secondFilter = getSecondFilter();
    }

    @Test
    public void testCreateMethod_usingAllParametersWithTwoFilters_filtersAndControllerCalled() {
        Component layout = Clara.create(xml, controller, firstFilter,
                secondFilter);

        // check caption
        Button button200px = (Button) Clara.findComponentById(layout,
                "button200px");
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.