/** * <p>Clears the cache of this painter only, and not of any of the children.</p> */ public void clearLocalCache() { super.clearCache(); }
/** * <p>Clears the cache of this painter only, and not of any of the children.</p> */ public void clearLocalCache() { super.clearCache(); }
/** * <p>Clears the cache of this painter only, and not of any of the children.</p> */ public void clearLocalCache() { super.clearCache(); }
/** * <p>Clears the cache of this painter only, and not of any of the children.</p> */ public void clearLocalCache() { super.clearCache(); }
/** * <p>Clears the cache of this painter only, and not of any of the children.</p> */ public void clearLocalCache() { super.clearCache(); }
/** * <p>Clears the cache of this <code>Painter</code>, and all child * <code>Painters</code>. This is done to ensure that resources * are collected, even if clearCache is called by some framework * or other code that doesn't realize this is a CompoundPainter.</p> * * <p>Call #clearLocalCache if you only want to clear the cache of this * <code>CompoundPainter</code> * * {@inheritDoc} */ @Override public void clearCache() { if (!clearLocalCacheOnly) { for (Painter<?> p : painters) { if (p instanceof AbstractPainter) { AbstractPainter<?> ap = (AbstractPainter<?>) p; ap.clearCache(); } } } super.clearCache(); }
/** * Sets the dirty bit. If true, then the painter is considered dirty, and the cache * will be cleared. This property is bound. * * @param d whether this <code>Painter</code> is dirty. */ protected void setDirty(boolean d) { boolean old = isDirty(); this.dirty = d; firePropertyChange("dirty", old, isDirty()); if (isDirty()) { clearCache(); } }
/** * Sets the dirty bit. If true, then the painter is considered dirty, and the cache * will be cleared. This property is bound. * * @param d whether this <code>Painter</code> is dirty. */ protected void setDirty(boolean d) { boolean old = isDirty(); this.dirty = d; firePropertyChange("dirty", old, isDirty()); if (isDirty()) { clearCache(); } }
/** * Sets the dirty bit. If true, then the painter is considered dirty, and the cache * will be cleared. This property is bound. * * @param d whether this <code>Painter</code> is dirty. */ protected void setDirty(boolean d) { boolean old = isDirty(); this.dirty = d; firePropertyChange("dirty", old, isDirty()); if (isDirty()) { clearCache(); } }
/** * Sets the dirty bit. If true, then the painter is considered dirty, and the cache * will be cleared. This property is bound. * * @param d whether this <code>Painter</code> is dirty. */ protected void setDirty(boolean d) { boolean old = isDirty(); this.dirty = d; firePropertyChange("dirty", old, isDirty()); if (isDirty()) { clearCache(); } }
/** * Sets the dirty bit. If true, then the painter is considered dirty, and the cache * will be cleared. This property is bound. * * @param d whether this <code>Painter</code> is dirty. */ protected void setDirty(boolean d) { boolean old = isDirty(); this.dirty = d; firePropertyChange("dirty", old, isDirty()); if (isDirty()) { clearCache(); } }
/** * Sets the dirty bit. If true, then the painter is considered dirty, and the cache * will be cleared. This property is bound. * * @param d whether this <code>Painter</code> is dirty. */ protected void setDirty(boolean d) { boolean old = isDirty(); this.dirty = d; firePropertyChange("dirty", old, isDirty()); if (isDirty()) { clearCache(); } }
/** * <p>Sets whether this <code>AbstractPainter</code> can be cached as an image. * If true, this is treated as a hint. That is, a cacheable may or may not be used. * The {@link #shouldUseCache} method actually determines whether the cacheable is used. * However, if false, then this is treated as an absolute value. That is, no * cacheable will be used.</p> * * <p>If set to false, then #clearCache is called to free system resources.</p> * * @param cacheable */ public void setCacheable(boolean cacheable) { boolean old = isCacheable(); this.cacheable = cacheable; firePropertyChange("cacheable", old, isCacheable()); if (!isCacheable()) { clearCache(); } }
/** * <p>Sets whether this <code>AbstractPainter</code> can be cached as an image. * If true, this is treated as a hint. That is, a cacheable may or may not be used. * The {@link #shouldUseCache} method actually determines whether the cacheable is used. * However, if false, then this is treated as an absolute value. That is, no * cacheable will be used.</p> * * <p>If set to false, then #clearCache is called to free system resources.</p> * * @param cacheable the cache flag */ public void setCacheable(boolean cacheable) { boolean old = isCacheable(); this.cacheable = cacheable; firePropertyChange("cacheable", old, isCacheable()); if (!isCacheable()) { clearCache(); } }
/** * <p>Sets whether this <code>AbstractPainter</code> can be cached as an image. * If true, this is treated as a hint. That is, a cacheable may or may not be used. * The {@link #shouldUseCache} method actually determines whether the cacheable is used. * However, if false, then this is treated as an absolute value. That is, no * cacheable will be used.</p> * * <p>If set to false, then #clearCache is called to free system resources.</p> * * @param cacheable */ public void setCacheable(boolean cacheable) { boolean old = isCacheable(); this.cacheable = cacheable; firePropertyChange("cacheable", old, isCacheable()); if (!isCacheable()) { clearCache(); } }
/** * <p>Sets whether this <code>AbstractPainter</code> can be cached as an image. * If true, this is treated as a hint. That is, a cacheable may or may not be used. * The {@link #shouldUseCache} method actually determines whether the cacheable is used. * However, if false, then this is treated as an absolute value. That is, no * cacheable will be used.</p> * * <p>If set to false, then #clearCache is called to free system resources.</p> * * @param cacheable */ public void setCacheable(boolean cacheable) { boolean old = isCacheable(); this.cacheable = cacheable; firePropertyChange("cacheable", old, isCacheable()); if (!isCacheable()) { clearCache(); } }
/** * <p>Sets whether this <code>AbstractPainter</code> can be cached as an image. * If true, this is treated as a hint. That is, a cacheable may or may not be used. * The {@link #shouldUseCache} method actually determines whether the cacheable is used. * However, if false, then this is treated as an absolute value. That is, no * cacheable will be used.</p> * * <p>If set to false, then #clearCache is called to free system resources.</p> * * @param cacheable */ public void setCacheable(boolean cacheable) { boolean old = isCacheable(); this.cacheable = cacheable; firePropertyChange("cacheable", old, isCacheable()); if (!isCacheable()) { clearCache(); } }
/** * <p>Sets whether this <code>AbstractPainter</code> can be cached as an image. * If true, this is treated as a hint. That is, a cacheable may or may not be used. * The {@link #shouldUseCache} method actually determines whether the cacheable is used. * However, if false, then this is treated as an absolute value. That is, no * cacheable will be used.</p> * * <p>If set to false, then #clearCache is called to free system resources.</p> * * @param cacheable */ public void setCacheable(boolean cacheable) { boolean old = isCacheable(); this.cacheable = cacheable; firePropertyChange("cacheable", old, isCacheable()); if (!isCacheable()) { clearCache(); } }
/** * {@link AbstractPainter} will pass any object to * {@link AbstractPainter#doPaint(Graphics2D, Object, int, int) doPaint}. */ @Test public void testPaintWithAnyObject() { p.paint(g, "yo", 10, 10); if (p.isCacheable()) { verify(p).doPaint(any(Graphics2D.class), eq("yo"), eq(10), eq(10)); } else { verify(p).doPaint(g, "yo", 10, 10); } p.clearCache(); p.paint(g, 1f, 10, 10); if (p.isCacheable()) { verify(p).doPaint(any(Graphics2D.class), eq(1f), eq(10), eq(10)); } else { verify(p).doPaint(g, 1f, 10, 10); } }
/** * Issue #??-swingx: clearCache has no detectable effect. Test was poorly designed. It has had * an effect for a long time, but the member is not bound, so the test was failing erroneously. */ @Test public void testClearCacheDetectable() { p.setCacheable(true); p.paint(g, null, 10, 10); // sanity //when caching we get a different graphics object verify(p).doPaint(any(Graphics2D.class), isNull(), eq(10), eq(10)); assertThat("clean after paint", false, is(p.isDirty())); assertThat("cacheable is enabled", true, is(p.isCacheable())); assertThat("has a cached image", false, is(p.isCacheCleared())); p.clearCache(); assertThat("has a cached image", true, is(p.isCacheCleared())); }