Package com.vaadin.ui

Examples of com.vaadin.ui.ComponentContainer$ComponentDetachEvent


        b.addListener(new ClickListener() {

            @Override
            public void buttonClick(ClickEvent event) {
                Button b = event.getButton();
                ComponentContainer cc = (ComponentContainer) b.getParent();
                cc.removeComponent(b);
            }
        });

        return b;
    }
View Full Code Here


                    new_name.setItemCaptionPropertyId(cont
                            .getContainerPropertyIds().iterator().next());

                }
            } else if (c instanceof ComponentContainer) {
                ComponentContainer new_name = (ComponentContainer) c;
                new_name.addComponent(new Label("component 1 in test container"));
                new_name.addComponent(new Button("component 2"));
            } else if (c instanceof Embedded) {
                Embedded em = (Embedded) c;
                em.setSource(new ThemeResource("test.png"));
            } else if (c instanceof Label) {
                ((Label) c).setValue("Test label");
View Full Code Here

        btn.setId(caption);
        btn.addClickListener(new Button.ClickListener() {
            @Override
            public void buttonClick(Button.ClickEvent event) {
                try {
                    ComponentContainer target = targetClass.newInstance();
                    for (int i = 0; i < 61; i++) {
                        target.addComponent(new TextField("Test"));
                    }
                    parent.setContent(target);
                } catch (InstantiationException e) {
                    throw new RuntimeException(e);
                } catch (IllegalAccessException e) {
View Full Code Here

        Button b = new Button("Wrap main layout in a TabSheet");
        b.addClickListener(new Button.ClickListener() {
            @Override
            public void buttonClick(ClickEvent event) {
                TabSheet tabsheet = new TabSheet();
                ComponentContainer mainParent = (ComponentContainer) mainLayout
                        .getParent();
                mainParent.replaceComponent(mainLayout, tabsheet);
                tabsheet.addTab(mainLayout, "Default tab");
            }
        });
        mainLayout.addComponent(b);
    }
View Full Code Here

                if (containerType == null) {
                    return;
                }

                boolean wrapped = wrapInPanel.booleanValue();
                ComponentContainer container = containerType.buildLayout(
                        ((Number) levels.getValue()).intValue(),
                        ((Number) childAmount.getValue()).intValue(), leafType,
                        !wrapped);
                if (wrapped) {
                    Panel panel = new Panel(container);
View Full Code Here

            return;
        }

        Object iconType = iconTypeSelect.getValue();
        try {
            ComponentContainer newContainer = createContainer(containerClass,
                    iconType);
            replaceComponent(container, newContainer);
            container = newContainer;
            log.log("Container changed to " + containerClass.getName() + "/"
                    + iconType);
View Full Code Here

    }

    private static ComponentContainer createContainer(
            Class<? extends ComponentContainer> containerClass, Object iconType)
            throws InstantiationException, IllegalAccessException {
        ComponentContainer container = containerClass.newInstance();
        for (String size : sizes) {
            Label title = new Label("<h3>" + size + "x" + size + "</h3>",
                    ContentMode.HTML);
            container.addComponent(title);
            for (String icon : icons) {
                ThemeResource res = new ThemeResource("../runo/icons/" + size
                        + "/" + icon);
                if (TYPE_CAPTION.equals(iconType)) {
                    Label name = new Label();
                    name.setCaption(icon);
                    name.setIcon(res);
                    container.addComponent(name);
                } else if (TYPE_EMBEDDED.equals(iconType)) {
                    Embedded e = new Embedded(icon, res);
                    container.addComponent(e);
                }
            }
        }

        return container;
View Full Code Here

        if (!(component.getParent() instanceof ComponentContainer)) {
            throw new IllegalStateException(
                    "The given Component must be attached to a ComponentContainer.");
        }

        ComponentContainer container = (ComponentContainer) component
                .getParent();
        try {
            for (Map.Entry<String, String> attribute : attributes.entrySet()) {
                Method writeMethod = getWriteMethod(attribute.getKey(),
                        container.getClass());
                if (writeMethod != null) {
                    AttributeParser parser = getParserFor(writeMethod
                            .getParameterTypes()[1]);
                    if (parser != null) {
                        invokeWithAttributeFilters(writeMethod, container,
View Full Code Here

        if (component instanceof Panel) {
            Panel panel = (Panel) component;
            errors = validateComponentRelativeSizes(panel.getContent(), errors,
                    parent);
        } else if (component instanceof ComponentContainer) {
            ComponentContainer lo = (ComponentContainer) component;
            Iterator it = lo.getComponentIterator();
            while (it.hasNext()) {
                errors = validateComponentRelativeSizes((Component) it.next(),
                        errors, parent);
            }
        } else if (component instanceof Form) {
View Full Code Here

        if (component instanceof Panel) {
            Panel panel = (Panel) component;
            errors = validateComponentRelativeSizes(panel.getContent(), errors,
                    parent);
        } else if (component instanceof ComponentContainer) {
            ComponentContainer lo = (ComponentContainer) component;
            Iterator<Component> it = lo.getComponentIterator();
            while (it.hasNext()) {
                errors = validateComponentRelativeSizes(it.next(), errors,
                        parent);
            }
        } else if (component instanceof Form) {
View Full Code Here

TOP

Related Classes of com.vaadin.ui.ComponentContainer$ComponentDetachEvent

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.