Example usage for com.vaadin.ui ComponentContainer iterator

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

Introduction

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

Prototype

@Override
public Iterator<Component> iterator();

Source Link

Document

Gets an iterator to the collection of contained components.

Usage

From source file:edu.kit.dama.ui.commons.util.UIUtils7.java

License:Apache License

/**
 * Set all components within pContainer to readOnly/notReadOnly. If pRecursive
 * is set true, containers withing the provided container are processed
 * recursively. If a contained component is a button, the button is
 * enabled/disabled instead of setting it to readOnly.
 *
 * @param pContainer The container to process
 * @param pRecursive Recurse into sub-containers
 * @param pValue TRUE = ReadOnly// www. j  a v  a2 s.  co  m
 */
public static void setReadOnly(ComponentContainer pContainer, boolean pRecursive, boolean pValue) {
    pContainer.setReadOnly(pValue);

    if (pRecursive) {
        Iterator<Component> com = pContainer.iterator();
        while (com.hasNext()) {
            Component next = com.next();
            if (next instanceof ComponentContainer) {
                setReadOnly((ComponentContainer) next, pRecursive, pValue);
            } else if (next instanceof Button) {
                ((Button) next).setEnabled(!pValue);
            } else {
                next.setReadOnly(pValue);
            }
        }
    }
}

From source file:edu.kit.dama.ui.commons.util.UIUtils7.java

License:Apache License

/**
 * Enable/disable all components within pContainer. If pRecursive is set true,
 * containers withing the provided container are processed recursively.
 *
 * @param pContainer The container to process
 * @param pRecursive Recurse into sub-containers
 * @param pValue TRUE = Enabled/*  w ww.  ja v  a 2  s  .  co  m*/
 */
public static void setEnabled(ComponentContainer pContainer, boolean pRecursive, boolean pValue) {
    pContainer.setReadOnly(pValue);

    if (pRecursive) {
        Iterator<Component> com = pContainer.iterator();
        while (com.hasNext()) {
            Component next = com.next();
            if (next instanceof ComponentContainer) {
                setEnabled((ComponentContainer) next, pRecursive, pValue);
            } else {
                next.setEnabled(pValue);
            }
        }
    }
}

From source file:edu.kit.dama.ui.commons.util.UIUtils7.java

License:Apache License

/**
 * Validate all components within the provided component container. If a
 * component is invalid, an appropriate component error will be set and the
 * method returns 'FALSE'. For valid components, the component error will be
 * removed. If all components are valid according to their setup, 'TRUE' will
 * be returned. A component can be invalid because:
 *
 * <ul>//from w  w w.j  ava 2 s  .c om
 *
 * <li>A validator installed by <i>Component.addValidator()</i> fails</li>
 *
 * <li>The component is marked as 'required' and contains no value</li>
 *
 * </ul>
 *
 *
 * @param pContainer The component container to validate.
 *
 * @return TRUE if all components within pContainer are valid.
 */
public static boolean validate(ComponentContainer pContainer) {
    boolean result = true;
    Iterator<Component> i = pContainer.iterator();
    while (i.hasNext()) {
        Component c = i.next();
        result = validate(c);
    }
    return result;
}

From source file:edu.nps.moves.mmowgli.modules.actionplans.ActionPlanPageTabPanel.java

License:Open Source License

protected boolean mediaUpdatedOobTL(ComponentContainer cont, Object medId) {
    Iterator<Component> itr = cont.iterator();
    while (itr.hasNext()) {
        MediaPanel imp = findMed(itr.next());
        if (imp != null && imp.getMedia().getId() == (Long) medId) {
            imp.mediaUpdatedOobTL();//w  w  w.ja  v a2s .c  o  m
            return true;
        }
    }
    return false;
}