/** * <p>Iterates over all child <code>Painter</code>s and gives them a chance * to validate themselves. If any of the child painters are dirty, then * this <code>CompoundPainter</code> marks itself as dirty.</p> * * {@inheritDoc} */ @Override protected void validate(T object) { boolean dirty = false; for (Painter p : painters) { if (p instanceof AbstractPainter) { AbstractPainter ap = (AbstractPainter)p; ap.validate(object); if (ap.isDirty()) { dirty = true; break; } } } clearLocalCacheOnly = true; setDirty(dirty); //super will call clear cache clearLocalCacheOnly = false; }
/** * <p>Iterates over all child <code>Painter</code>s and gives them a chance * to validate themselves. If any of the child painters are dirty, then * this <code>CompoundPainter</code> marks itself as dirty.</p> * * {@inheritDoc} */ @Override protected void validate(T object) { boolean dirty = false; for (Painter<?> p : painters) { if (p instanceof AbstractPainter) { AbstractPainter ap = (AbstractPainter) p; ap.validate(object); if (ap.isDirty()) { dirty = true; break; } } } clearLocalCacheOnly = true; setDirty(dirty); //super will call clear cache clearLocalCacheOnly = false; }
/** * <p>Iterates over all child <code>Painter</code>s and gives them a chance * to validate themselves. If any of the child painters are dirty, then * this <code>CompoundPainter</code> marks itself as dirty.</p> */ @Override protected void validate(T object) { boolean dirty = false; for (Painter<T> p : painters) { if (p instanceof AbstractPainter) { AbstractPainter<T> ap = (AbstractPainter<T>) p; ap.validate(object); if (ap.isDirty()) { dirty = true; break; } } } clearLocalCacheOnly = true; setDirty(dirty); //super will call clear cache clearLocalCacheOnly = false; }
/** * <p>Iterates over all child <code>Painter</code>s and gives them a chance * to validate themselves. If any of the child painters are dirty, then * this <code>CompoundPainter</code> marks itself as dirty.</p> * * {@inheritDoc} */ @Override protected void validate(T object) { boolean dirty = false; for (Painter<?> p : painters) { if (p instanceof AbstractPainter) { AbstractPainter ap = (AbstractPainter) p; ap.validate(object); if (ap.isDirty()) { dirty = true; break; } } } clearLocalCacheOnly = true; setDirty(dirty); //super will call clear cache clearLocalCacheOnly = false; }
/** * <p>Iterates over all child <code>Painter</code>s and gives them a chance * to validate themselves. If any of the child painters are dirty, then * this <code>CompoundPainter</code> marks itself as dirty.</p> * * {@inheritDoc} */ @Override protected void validate(T object) { boolean dirty = false; for (Painter<?> p : painters) { if (p instanceof AbstractPainter) { AbstractPainter ap = (AbstractPainter) p; ap.validate(object); if (ap.isDirty()) { dirty = true; break; } } } clearLocalCacheOnly = true; setDirty(dirty); //super will call clear cache clearLocalCacheOnly = false; }
/** * Ensure that paint orders calls correctly. */ @Test public void testInOrderPaintCallsWithoutCaching() { when(p.shouldUseCache()).thenReturn(false); InOrder orderedCalls = inOrder(p); p.paint(g, null, 10, 10); orderedCalls.verify(p).configureGraphics(g); orderedCalls.verify(p, times(0)).validate(null); orderedCalls.verify(p).doPaint(g, null, 10, 10); }
validate(obj); BufferedImage cache = cachedImage == null ? null : cachedImage.get(); boolean invalidCache = null == cache ||
/** * Ensure that paint orders calls correctly. */ @Test public void testInOrderPaintCallsWithCaching() { when(p.shouldUseCache()).thenReturn(true); InOrder orderedCalls = inOrder(p); p.paint(g, null, 10, 10); orderedCalls.verify(p).configureGraphics(g); orderedCalls.verify(p).validate(null); //when caching we get a different graphics object verify(p).doPaint(any(Graphics2D.class), isNull(), eq(10), eq(10)); }
validate(obj); BufferedImage cache = cachedImage == null ? null : cachedImage.get(); boolean invalidCache = null == cache ||
validate(obj); BufferedImage cache = cachedImage == null ? null : cachedImage.get(); boolean invalidCache = null == cache ||
validate(obj); BufferedImage cache = cachedImage == null ? null : cachedImage.get(); boolean invalidCache = null == cache ||
validate(obj); BufferedImage cache = cachedImage == null ? null : cachedImage.get(); boolean invalidCache = null == cache ||
validate(obj); BufferedImage cache = cachedImage == null ? null : cachedImage.get(); boolean invalidCache = null == cache ||