Example usage for com.vaadin.ui HorizontalLayout getComponentCount

List of usage examples for com.vaadin.ui HorizontalLayout getComponentCount

Introduction

In this page you can find the example usage for com.vaadin.ui HorizontalLayout getComponentCount.

Prototype

@Override
public int getComponentCount() 

Source Link

Document

Gets the number of contained components.

Usage

From source file:org.escidoc.browser.elabsmodul.views.StudyView.java

License:Open Source License

@Override
public void resetLayout() {
    Preconditions.checkNotNull(dynamicLayout, "View's dynamiclayout is null.");
    HorizontalLayout tempParentLayout = null;
    for (final Iterator<Component> iterator = dynamicLayout.getComponentIterator(); iterator.hasNext();) {
        final Component component = iterator.next();
        if (component instanceof HorizontalLayout) {
            tempParentLayout = (HorizontalLayout) component;
        } else {/*  w w  w  .j  ava2  s .com*/
            LOG.error("DynamicLayout can contain only HorizontalLayouts as direct child element.");
            break;
        }

        if (tempParentLayout.getComponentCount() != 2) {
            continue;
        }

        if (LabsLayoutHelper.switchToLabelFromEditedField(tempParentLayout)) {
            setModifiedComponent(null);
        }
    }
}

From source file:org.opencms.ui.apps.CmsQuickLaunchEditor.java

License:Open Source License

/**
 * Saves the changed apps setting.<p>
 *///from w  ww.  j a  v a2  s.  com
void saveToUser() {

    List<String> apps = new ArrayList<String>();
    HorizontalLayout appsLayout = m_userApps.getWrappedLayout();
    int count = appsLayout.getComponentCount();
    for (int i = 0; i < count; i++) {
        WrappedDraggableComponent wrapper = (WrappedDraggableComponent) appsLayout.getComponent(i);
        apps.add(wrapper.getItemId());
    }

    try {
        OpenCms.getWorkplaceAppManager().setUserQuickLaunchApps(A_CmsUI.getCmsObject(), apps);
    } catch (CmsException e) {
        CmsErrorDialog.showErrorDialog("Could not write user Quicklaunch apps", e);
    }
    close();
}

From source file:org.openeos.services.ui.vaadin.internal.DefaultVaadinERPWindowFactory.java

License:Apache License

protected Component createToolBar(final IWindow window) {
    HorizontalLayout horLayout = new HorizontalLayout();

    TreeMap<Integer, Integer> mapIndexes = new TreeMap<Integer, Integer>();

    for (WindowActionContributor contributor : windowActionContributiorList) {

        for (WindowAction action : contributor.getWindowActionList()) {
            if (action.isVisibeForWindow(window)) {
                Integer order = action.getOrder();
                Integer maxOrder = mapIndexes.floorKey(order);
                if (maxOrder == null) {
                    //add to the last
                    horLayout.addComponent(createToolBarButton(action, window));
                    mapIndexes.put(order, horLayout.getComponentCount() - 1);
                } else {
                    Integer index = mapIndexes.get(maxOrder);
                    horLayout.addComponent(createToolBarButton(action, window), index + 1);
                    mapIndexes.put(order, index + 1);
                }//  w w  w .j  a v  a2 s .c om
            }
        }
    }

    return horLayout;
}

From source file:org.opennms.features.topology.app.internal.ui.breadcrumbs.BreadcrumbComponent.java

License:Open Source License

@Override
public void graphChanged(GraphContainer graphContainer) {
    final BreadcrumbCriteria criteria = Criteria.getSingleCriteriaForGraphContainer(graphContainer,
            BreadcrumbCriteria.class, true);
    final HorizontalLayout breadcrumbLayout = (HorizontalLayout) getCompositionRoot();
    breadcrumbLayout.removeAllComponents();

    // Verify that breadcrumbs are enabled
    if (graphContainer.getMetaTopologyProvider()
            .getBreadcrumbStrategy() == BreadcrumbStrategy.SHORTEST_PATH_TO_ROOT) {
        final Collection<Vertex> displayVertices = graphContainer.getGraph().getDisplayVertices();
        if (!displayVertices.isEmpty()) {
            final PathTree pathTree = BreadcrumbPathCalculator.findPath(
                    graphContainer.getMetaTopologyProvider(),
                    displayVertices.stream().map(v -> (VertexRef) v).collect(Collectors.toSet()));
            final List<Breadcrumb> breadcrumbs = pathTree.toBreadcrumbs();
            criteria.setBreadcrumbs(breadcrumbs);
        }/*from ww  w. j a  va2 s.  c  o  m*/
        for (Breadcrumb eachBreadcrumb : criteria.getBreadcrumbs()) {
            if (breadcrumbLayout.getComponentCount() >= 1) {
                breadcrumbLayout.addComponent(new Label(" > "));
            }
            breadcrumbLayout.addComponent(createButton(graphContainer, eachBreadcrumb));
        }
    }
}