private final void checkCache(Container parent) {
        if (parent == null) {
            return;
        }
        ContainerWrapper par = checkParent(parent);

        // Check if the grid is valid
        int mc = PlatformDefaults.getModCount();
        if (lastModCount != mc) {
            grid = null;
            lastModCount = mc;
        }

        int hash = 0;
        for (Iterator<ComponentWrapper> it = ccMap.keySet().iterator();
                it.hasNext();) {
            hash += it.next().getLayoutHashCode();
        }
        if (hash != lastHash) {
            grid = null;
            lastHash = hash;
        }

        if (parent.isValid() == false) {
            Dimension ps = parent.getSize();
            if (lastInvalidSize == null || !lastInvalidSize.equals(ps)) {
                grid = null;
                lastInvalidSize = ps;
            }
        }

        setDebug(par, lc.getDebugMillis() > 0);

        if (grid == null) {
            grid =  new Grid(par, lc, rowSpecs, colSpecs, ccMap, callbackList);
        }
    }