/*
 * Copyright (c) 2008 Haulmont Technology Ltd. All Rights Reserved.
 * Haulmont Technology proprietary and confidential.
 * Use is subject to license terms.

 * Author: Nikolay Gorodnov
 * Created: 27.08.2009 15:58:58
 *
 * $Id$
 */
package com.haulmont.cuba.gui;

import com.haulmont.cuba.gui.components.IFrame;
import com.haulmont.cuba.gui.components.Window;
import com.haulmont.cuba.gui.components.Component;

/**
 * Utility class to work for GenericUI components
 */
public abstract class ComponentsHelper {

    /**
     * Visit all components below the specified container
     */
    public static void walkComponents(
            com.haulmont.cuba.gui.components.Component.Container container,
            ComponentVisitor visitor
    ) {
        __walkComponents(container, visitor, "");
    }

    private static void __walkComponents(
            com.haulmont.cuba.gui.components.Component.Container container,
            ComponentVisitor visitor,
            String path
    ) {
        for (com.haulmont.cuba.gui.components.Component component : container.getOwnComponents()) {
            visitor.visit(component, path + component.getId());

            if (component instanceof com.haulmont.cuba.gui.components.Component.Container) {
                String p = component instanceof IFrame ?
                        path + component.getId() + "." :
                        path;
                __walkComponents(((com.haulmont.cuba.gui.components.Component.Container) component), visitor, p);
            }
        }
    }

    /**
     * Get the topmost window for the specified component
     */
    public static Window getWindow(Component.BelongToFrame component) {
        IFrame frame = component.getFrame();
        while (frame != null) {
            if (frame instanceof Window)
                return (Window) frame;
            frame = frame.getFrame();
        }
        return null;
    }
}

@@ -1141,57 +1141,337 @@
     
-visitor.visit(component, path + component.getId()
+String id = component.getId();%0D%0A            if (id == null && component instanceof Component.ActionOwner%0D%0A                    && ((Component.ActionOwner) component).getAction() != null) %7B%0D%0A                id = ((Component.ActionOwner) component).getAction().getId();%0D%0A            %7D%0D%0A            visitor.visit(component, path + id
 );%0D%0A

Fix ids for ActionOwner elements