Package com.vaadin.ui

Examples of com.vaadin.ui.Component


        getLayout().addComponent(hsplit);

        Button swap = new Button("Swap components", new Button.ClickListener() {
            @Override
            public void buttonClick(ClickEvent event) {
                Component first = hsplit.getFirstComponent();
                hsplit.removeComponent(first);

                Component second = hsplit.getSecondComponent();
                hsplit.removeComponent(second);

                hsplit.setFirstComponent(second);
                hsplit.setSecondComponent(first);
            }
View Full Code Here


    @Override
    public void paintContent(PaintTarget target) throws PaintException {
        super.paintContent(target);
        int paintedComponents = 0;
        for (int i = 0; i < components.length; i++) {
            Component c = components[i];
            if (c.isAttached()) {
                target.addAttribute("component" + paintedComponents++, c);
            } else {
                Logger.getLogger(SourceIs.class.getName())
                        .log(Level.WARNING,
                                "SourceIs component {0} at index {1} is not attached to the component hierachy and will thus be ignored",
                                new Object[] { c.getClass().getName(),
                                        Integer.valueOf(i) });
            }
        }
        target.addAttribute("c", paintedComponents);
    }
View Full Code Here

    }

    @Override
    public boolean accept(DragAndDropEvent dragEvent) {
        if (dragEvent.getTransferable() instanceof TransferableImpl) {
            Component sourceComponent = ((TransferableImpl) dragEvent
                    .getTransferable()).getSourceComponent();
            for (Component c : components) {
                if (c == sourceComponent) {
                    return true;
                }
View Full Code Here

        public void reportErrors(StringBuilder clientJSON,
                PrintStream serverErrorStream) {
            clientJSON.append("{");

            Component parent = component.getParent();
            String paintableId = component.getConnectorId();

            clientJSON.append("\"id\":\"" + paintableId + "\"");

            if (invalidHeight) {
View Full Code Here

            return childComponent;
        }

        public static LayoutClickEvent createEvent(ComponentContainer layout,
                MouseEventDetails mouseDetails, Connector clickedConnector) {
            Component clickedComponent = (Component) clickedConnector;
            Component childComponent = clickedComponent;
            while (childComponent != null
                    && childComponent.getParent() != layout) {
                childComponent = childComponent.getParent();
            }

            return new LayoutClickEvent(layout, mouseDetails, clickedComponent,
                    childComponent);
        }
View Full Code Here

     * to obtain the underlying container of the source component.
     *
     * @return Container
     */
    public Container getSourceContainer() {
        Component sourceComponent = getSourceComponent();
        if (sourceComponent instanceof Container.Viewer) {
            return ((Container.Viewer) sourceComponent)
                    .getContainerDataSource();
        } else {
            // this should not happen
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) {
            currentContainer = (ComponentContainer) component.getParent();
        }
    }
View Full Code Here

        if (attributeFilters != null) {
            for (AttributeFilter filter : attributeFilters) {
                inflater.addAttributeFilter(filter);
            }
        }
        Component result = inflater.inflate(xml,
                binder.getAlreadyAssignedFields(controller));

        // Bind to controller.
        binder.bind(result, controller);
        return result;
View Full Code Here

        // root component.
        if (componentId.equals(root.getId())) {
            return root;
        } else if (root instanceof HasComponents) {
            for (Component c : (HasComponents) root) {
                Component result = findComponentById(c, componentId);
                if (result != null) {
                    return result;
                }
            }
        }
View Full Code Here

    }

    private void bindField(Component componentRoot, Object controller,
            Field field) {
        String componentId = extractComponentId(field);
        Component component = tryToFindComponentById(componentRoot, componentId);

        try {
            field.setAccessible(true);
            if (field.get(controller) == null) {
                field.set(controller, component);
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.