private double getRequiredSize(final LayoutConfig layoutConfig,
                                   final int dim,
                                   final int index,
                                   final int step,
                                   final boolean min) {
        double totalSize = 0;
        if (layoutConfig instanceof TabLayoutConfig) {
            if (min) {
                totalSize = MIN_COMPONENT_WIDTH;
            } else {
                final TabLayoutConfig tabLayoutConfig = (TabLayoutConfig) layoutConfig;
                totalSize = tabLayoutConfig.getPreferredSize().get(dim);
                totalSize = Math.max(MIN_COMPONENT_WIDTH, totalSize);
            }

        } else if (layoutConfig instanceof SplitLayoutConfig) {
            final SplitLayoutConfig splitLayoutConfig = (SplitLayoutConfig) layoutConfig;
            for (int i = index; i >= 0 && i < splitLayoutConfig.count(); i += step) {
                final LayoutConfig child = splitLayoutConfig.get(i);
                final double childSize = getRequiredSize(child, dim, 0, 1, min);

                if (splitLayoutConfig.getDimension() == dim) {
                    // It this split layout is in the same direction as the
                    // dimension we are measuring then we need to sum the sizes.
                    totalSize += childSize;
                } else if (totalSize < childSize) {
                    // If this split layout is in a different direction to the
                    // dimension we are measuring then just remember the largest
                    // size.
                    totalSize = childSize;
                }
            }
        }

        return totalSize;
    }
Tests the supplied layout to see if it is the current mouse target and
returns mouse target if it is.

@param x               The mouse x coordinate.
@param y               The mouse y coordinate.
@param splitter        True if the layout is a splitter. Splitters are targeted
                       outside their rect.
@param layoutConfig    The layout data to test to see if it is a target.
@param positionAndSize The position and size of the layout being tested.
@return The mouse target if the tested layout is the target, else null.
stroom-core-client/src/main/java/stroom/dashboard/client/flexlayout/FlexLayout.java