Example usage for com.vaadin.ui VerticalLayout iterator

List of usage examples for com.vaadin.ui VerticalLayout iterator

Introduction

In this page you can find the example usage for com.vaadin.ui VerticalLayout iterator.

Prototype

@Override
public Iterator<Component> iterator() 

Source Link

Document

Gets the component container iterator for going trough all the components in the container.

Usage

From source file:com.foc.vaadin.gui.layouts.FVHTMLLayout.java

License:Apache License

@Override
public Iterator<Component> getComponentIterator() {
    VerticalLayout verticalLayout = null;
    Component component = getCompositionRoot();
    if (component instanceof VerticalLayout) {
        verticalLayout = (VerticalLayout) component;
    }/*ww  w .  j  av  a 2s.com*/
    return verticalLayout != null ? verticalLayout.iterator() : null;
}

From source file:com.haulmont.cuba.web.WebWindowManager.java

License:Apache License

@Override
protected void showWindow(final Window window, final String caption, final String description, OpenType type,
        final boolean multipleOpen) {
    OpenType targetOpenType = type.copy();

    // for backward compatibility only
    copyDialogParamsToOpenType(targetOpenType);

    overrideOpenTypeParams(targetOpenType, window.getDialogOptions());

    boolean forciblyDialog = false;
    if (targetOpenType.getOpenMode() != OpenMode.DIALOG && hasModalWindow()) {
        targetOpenType.setOpenMode(OpenMode.DIALOG);
        forciblyDialog = true;//from  w  ww. ja  v  a 2 s . c o  m
    }

    if (targetOpenType.getOpenMode() == OpenMode.THIS_TAB && tabs.size() == 0) {
        targetOpenType.setOpenMode(OpenMode.NEW_TAB);
    }

    final WindowOpenInfo openInfo = new WindowOpenInfo(window, targetOpenType.getOpenMode());
    Component component;

    window.setCaption(caption);
    window.setDescription(description);

    switch (targetOpenType.getOpenMode()) {
    case NEW_TAB:
    case NEW_WINDOW:
        final WebAppWorkArea workArea = getConfiguredWorkArea(createWorkAreaContext(window));
        workArea.switchTo(AppWorkArea.State.WINDOW_CONTAINER);

        if (workArea.getMode() == Mode.SINGLE) {
            VerticalLayout mainLayout = workArea.getSingleWindowContainer();
            if (mainLayout.iterator().hasNext()) {
                ComponentContainer oldLayout = (ComponentContainer) mainLayout.iterator().next();
                WindowBreadCrumbs oldBreadCrumbs = tabs.get(oldLayout);
                if (oldBreadCrumbs != null) {
                    Window oldWindow = oldBreadCrumbs.getCurrentWindow();
                    oldWindow.closeAndRun(MAIN_MENU_ACTION_ID,
                            () -> showWindow(window, caption, description, OpenType.NEW_TAB, false));
                    return;
                }
            }
        } else {
            final Integer hashCode = getWindowHashCode(window);
            ComponentContainer tab = null;
            if (hashCode != null && !multipleOpen) {
                tab = findTab(hashCode);
            }
            ComponentContainer oldLayout = tab;
            final WindowBreadCrumbs oldBreadCrumbs = tabs.get(oldLayout);

            if (oldBreadCrumbs != null
                    && windowOpenMode.containsKey(oldBreadCrumbs.getCurrentWindow().getFrame())
                    && !multipleOpen) {
                Window oldWindow = oldBreadCrumbs.getCurrentWindow();
                selectWindowTab(((Window.Wrapper) oldBreadCrumbs.getCurrentWindow()).getWrappedWindow());

                int tabPosition = -1;
                final TabSheetBehaviour tabSheet = workArea.getTabbedWindowContainer().getTabSheetBehaviour();
                String tabId = tabSheet.getTab(tab);
                if (tabId != null) {
                    tabPosition = tabSheet.getTabPosition(tabId);
                }

                final int finalTabPosition = tabPosition;
                oldWindow.closeAndRun(MAIN_MENU_ACTION_ID, () -> {
                    showWindow(window, caption, description, OpenType.NEW_TAB, false);

                    Window wrappedWindow = window;
                    if (window instanceof Window.Wrapper) {
                        wrappedWindow = ((Window.Wrapper) window).getWrappedWindow();
                    }

                    if (finalTabPosition >= 0 && finalTabPosition < tabSheet.getComponentCount() - 1) {
                        moveWindowTab(workArea, wrappedWindow, finalTabPosition);
                    }
                });
                return;
            }
        }
        component = showWindowNewTab(window, multipleOpen);
        break;

    case THIS_TAB:
        getConfiguredWorkArea(createWorkAreaContext(window)).switchTo(AppWorkArea.State.WINDOW_CONTAINER);

        component = showWindowThisTab(window, caption, description);
        break;

    case DIALOG:
        component = showWindowDialog(window, targetOpenType, forciblyDialog);
        break;

    default:
        throw new UnsupportedOperationException();
    }

    openInfo.setData(component);

    if (window instanceof Window.Wrapper) {
        Window wrappedWindow = ((Window.Wrapper) window).getWrappedWindow();
        windowOpenMode.put(wrappedWindow, openInfo);
    } else {
        windowOpenMode.put(window, openInfo);
    }

    afterShowWindow(window);
}