/** Check if something has changed and if so recrete it to the cached objects. */ private void checkCache() { // final long start = System.nanoTime(); // final boolean calculateCache = calculateCache(); // if (calculateCache) { checkChildren(); // Check if the grid is valid final int mc = MigLayoutToolkitImpl.getMigPlatformDefaults().getModCount(); if (lastModCount != mc) { grid = null; lastModCount = mc; reason.append("lastmodcount,"); } int hash = container.getSize().hashCode(); for (final Iterator<IComponentWrapperCommon> it = ccMap.keySet().iterator(); it.hasNext(); ) { hash += it.next().getLayoutHashCode(); } if (hash != lastHash) { reason.append("hash " + hash + " vs " + lastHash + ","); reason.append(container.getSize() + ","); grid = null; lastHash = hash; } // } if (grid == null) { // CHECKSTYLE:OFF // System.out.println("new Grid for " + this + " [" + reason + "]"); // CHECKSTYLE:ON grid = new GridCommon(cacheParentW, lc, rowSpecs, colSpecs, ccMap, callbackList); reason.setLength(0); } // if (calculateCache) { // final long end = System.nanoTime(); // final long currentTime = end - start; // // if (currentTime > 1000000) { // return; // } // if (cacheTime < currentTime) { // cacheTime = currentTime; // //cacheTimeSetMs = System.currentTimeMillis(); // cacheTimeSetNano = end; // //CHECKSTYLE:OFF // System.out.println("nano time: " + (cacheTime) + " [" + this + "]"); // //CHECKSTYLE:ON // } // } }