Examples of ChildComponentContainer


Examples of com.vaadin.terminal.gwt.client.ui.layout.ChildComponentContainer

                    cc = widgetToComponentContainer.get(paintable);
                    cc.setWidth("");
                    cc.setHeight("");
                } else {
                    // A new component
                    cc = new ChildComponentContainer((Widget) paintable,
                            CellBasedLayout.ORIENTATION_VERTICAL);
                    widgetToComponentContainer.put((Widget) paintable, cc);
                    cc.setWidth("");
                    canvas.add(cc, 0, 0);
                }
View Full Code Here

Examples of com.vaadin.terminal.gwt.client.ui.layout.ChildComponentContainer

        layoutCells();

        // clean non rendered components
        for (Widget w : nonRenderedWidgets.keySet()) {
            ChildComponentContainer childComponentContainer = widgetToComponentContainer
                    .get(w);
            paintableToCell.remove(w);
            widgetToComponentContainer.remove(w);
            childComponentContainer.removeFromParent();
            client.unregisterPaintable((Paintable) w);
        }
        nonRenderedWidgets = null;

        rendering = false;
View Full Code Here

Examples of com.vaadin.terminal.gwt.client.ui.layout.ChildComponentContainer

    public boolean hasChildComponent(Widget component) {
        return paintableToCell.containsKey(component);
    }

    public void replaceChildComponent(Widget oldComponent, Widget newComponent) {
        ChildComponentContainer componentContainer = widgetToComponentContainer
                .remove(oldComponent);
        if (componentContainer == null) {
            return;
        }

        componentContainer.setWidget(newComponent);
        widgetToComponentContainer.put(newComponent, componentContainer);

        paintableToCell.put((Paintable) newComponent,
                paintableToCell.get(oldComponent));
    }
View Full Code Here

Examples of com.vaadin.terminal.gwt.client.ui.layout.ChildComponentContainer

        paintableToCell.put((Paintable) newComponent,
                paintableToCell.get(oldComponent));
    }

    public void updateCaption(Paintable component, UIDL uidl) {
        ChildComponentContainer cc = widgetToComponentContainer.get(component);
        if (cc != null) {
            cc.updateCaption(uidl, client);
        }
        if (!rendering) {
            // ensure rel size details are updated
            paintableToCell.get(component).updateRelSizeStatus(uidl);
            /*
 
View Full Code Here

Examples of com.vaadin.terminal.gwt.client.ui.layout.ChildComponentContainer

            final UIDL childUIDL = (UIDL) it.next();
            final Paintable child = client.getPaintable(childUIDL);
            Widget widget = (Widget) child;

            // Create container for component
            ChildComponentContainer childComponentContainer = getComponentContainer(widget);

            if (childComponentContainer == null) {
                // This is a new component
                childComponentContainer = createChildContainer(widget);
            }

            addOrMoveChild(childComponentContainer, pos++);

            /*
             * Components which are to be expanded in the same orientation as
             * the layout are rendered later when it is clear how much space
             * they can use
             */
            if (!Util.isCached(childUIDL)) {
                FloatSize relativeSize = Util.parseRelativeSize(childUIDL);
                childComponentContainer.setRelativeSize(relativeSize);
            }

            if (childComponentContainer.isComponentRelativeSized(orientation)) {
                relativeSizeComponents.add(childComponentContainer);
                relativeSizeComponentUIDL.add(childUIDL);
            } else {
                if (isDynamicWidth()) {
                    childComponentContainer.renderChild(childUIDL, client, -1);
                } else {
                    childComponentContainer.renderChild(childUIDL, client,
                            activeLayoutSize.getWidth());
                }
                if (sizeHasChangedDuringRendering && Util.isCached(childUIDL)) {
                    // notify cached relative sized component about size
                    // chance
                    client.handleComponentRelativeSize(childComponentContainer
                            .getWidget());
                }
            }

            uidlWidgets.add(widget);

        }

        // w.mark("Rendering of "
        // + (uidlWidgets.size() - relativeSizeComponents.size())
        // + " absolute size components done");

        /*
         * Remove any children after pos. These are the ones that previously
         * were in the layout but have now been removed
         */
        removeChildrenAfter(pos);

        // w.mark("Old children removed");

        /* Fetch alignments and expand ratio from UIDL */
        updateAlignmentsAndExpandRatios(uidl, uidlWidgets);
        // w.mark("Alignments and expand ratios updated");

        /* Fetch widget sizes from rendered components */
        updateWidgetSizes();
        // w.mark("Widget sizes updated");

        recalculateLayout();
        // w.mark("Layout size calculated (" + activeLayoutSize +
        // ") offsetSize: "
        // + getOffsetWidth() + "," + getOffsetHeight());

        /* Render relative size components */
        for (int i = 0; i < relativeSizeComponents.size(); i++) {
            ChildComponentContainer childComponentContainer = relativeSizeComponents
                    .get(i);
            UIDL childUIDL = relativeSizeComponentUIDL.get(i);

            if (isDynamicWidth()) {
                childComponentContainer.renderChild(childUIDL, client, -1);
            } else {
                childComponentContainer.renderChild(childUIDL, client,
                        activeLayoutSize.getWidth());
            }

            if (Util.isCached(childUIDL)) {
                /*
                 * We must update the size of the relative sized component if
                 * the expand ratio or something else in the layout changes
                 * which affects the size of a relative sized component
                 */
                client.handleComponentRelativeSize(childComponentContainer
                        .getWidget());
            }

            // childComponentContainer.updateWidgetSize();
        }

        // w.mark("Rendering of " + (relativeSizeComponents.size())
        // + " relative size components done");

        /* Fetch widget sizes for relative size components */
        for (ChildComponentContainer childComponentContainer : widgetToComponentContainer
                .values()) {

            /* Update widget size from DOM */
            childComponentContainer.updateWidgetSize();
        }

        // w.mark("Widget sizes updated");

        /*
 
View Full Code Here

Examples of com.vaadin.terminal.gwt.client.ui.layout.ChildComponentContainer

            // FIXME extra pixels should be divided among expanded widgets if
            // such a widgets exists

            Iterator<Widget> widgetIterator = iterator();
            while (widgetIterator.hasNext() && remaining-- > 0) {
                ChildComponentContainer childComponentContainer = (ChildComponentContainer) widgetIterator
                        .next();
                childComponentContainer.expandExtra(orientation, 1);
            }
        }

    }
View Full Code Here

Examples of com.vaadin.terminal.gwt.client.ui.layout.ChildComponentContainer

        if (isHorizontal()) {
            height = activeLayoutSize.getHeight();
            int availableWidth = activeLayoutSize.getWidth();
            boolean first = true;
            while (widgetIterator.hasNext()) {
                ChildComponentContainer childComponentContainer = (ChildComponentContainer) widgetIterator
                        .next();
                if (!childComponentContainer
                        .isComponentRelativeSized(ORIENTATION_HORIZONTAL)) {
                    /*
                     * Only components with non-relative size in the main
                     * direction has a container size
                     */
                    width = childComponentContainer.getWidgetSize().getWidth()
                            + childComponentContainer
                                    .getCaptionWidthAfterComponent();

                    /*
                     * If the component does not have a specified size in the
                     * main direction the caption may determine the space used
                     * by the component
                     */
                    if (!childComponentContainer
                            .widgetHasSizeSpecified(orientation)) {
                        int captionWidth = childComponentContainer
                                .getCaptionRequiredWidth();
                        // ApplicationConnection.getConsole().log(
                        // "Component width: " + width
                        // + ", caption width: " + captionWidth);
                        if (captionWidth > width) {
                            width = captionWidth;
                        }
                    }
                } else {
                    width = 0;
                }

                if (!isDynamicWidth()) {
                    if (availableWidth == 0) {
                        /*
                         * Let the overflowing components overflow. IE has
                         * problems with zero sizes.
                         */
                        // width = 0;
                        // height = 0;
                    } else if (width > availableWidth) {
                        width = availableWidth;

                        if (!first) {
                            width -= activeSpacing.hSpacing;
                        }
                        availableWidth = 0;
                    } else {
                        availableWidth -= width;
                        if (!first) {
                            availableWidth -= activeSpacing.hSpacing;
                        }
                    }

                    first = false;
                }

                childComponentContainer.setContainerSize(width, height);
            }
        } else {
            width = activeLayoutSize.getWidth();
            while (widgetIterator.hasNext()) {
                ChildComponentContainer childComponentContainer = (ChildComponentContainer) widgetIterator
                        .next();

                if (!childComponentContainer
                        .isComponentRelativeSized(ORIENTATION_VERTICAL)) {
                    /*
                     * Only components with non-relative size in the main
                     * direction has a container size
                     */
                    height = childComponentContainer.getWidgetSize()
                            .getHeight()
                            + childComponentContainer
                                    .getCaptionHeightAboveComponent();
                } else {
                    height = 0;
                }

                childComponentContainer.setContainerSize(width, height);
            }

        }

    }
View Full Code Here

Examples of com.vaadin.terminal.gwt.client.ui.layout.ChildComponentContainer

    /**
     * Updates the spacing between components. Needs to be done only when
     * components are added/removed.
     */
    private void updateContainerMargins() {
        ChildComponentContainer firstChildComponent = getFirstChildComponentContainer();
        if (firstChildComponent != null) {
            firstChildComponent.setMarginLeft(0);
            firstChildComponent.setMarginTop(0);

            for (ChildComponentContainer childComponent : widgetToComponentContainer
                    .values()) {
                if (childComponent == firstChildComponent) {
                    continue;
View Full Code Here

Examples of com.vaadin.terminal.gwt.client.ui.layout.ChildComponentContainer

    }

    private ChildComponentContainer createChildContainer(Widget child) {

        // Create a container DIV for the child
        ChildComponentContainer childComponent = new ChildComponentContainer(
                child, orientation);

        return childComponent;

    }
View Full Code Here

Examples of com.vaadin.terminal.gwt.client.ui.layout.ChildComponentContainer

    }

    public RenderSpace getAllocatedSpace(Widget child) {
        int width = 0;
        int height = 0;
        ChildComponentContainer childComponentContainer = getComponentContainer(child);
        // WIDTH CALCULATION
        if (isVertical()) {
            width = activeLayoutSize.getWidth();
            width -= childComponentContainer.getCaptionWidthAfterComponent();
        } else if (!isDynamicWidth()) {
            // HORIZONTAL
            width = childComponentContainer.getContSize().getWidth();
            width -= childComponentContainer.getCaptionWidthAfterComponent();
        }

        // HEIGHT CALCULATION
        if (isHorizontal()) {
            height = activeLayoutSize.getHeight();
            height -= childComponentContainer.getCaptionHeightAboveComponent();
        } else if (!isDynamicHeight()) {
            // VERTICAL
            height = childComponentContainer.getContSize().getHeight();
            height -= childComponentContainer.getCaptionHeightAboveComponent();
        }

        // ApplicationConnection.getConsole().log(
        // "allocatedSpace for " + Util.getSimpleName(child) + ": "
        // + width + "," + height);
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.