/** * Adds a painter to the queue of painters * @param painter the painter that is added */ public void addPainter(Painter<T> painter) { Collection<Painter<T>> old = new ArrayList<Painter<T>>(getPainters()); this.painters.add(painter); if (painter instanceof AbstractPainter) { ((AbstractPainter<?>) painter).addPropertyChangeListener(handler); } setDirty(true); firePropertyChange("painters", old, getPainters()); }
/** * Sets the array of Painters to use. These painters will be executed in * order. A null value will be treated as an empty array. To prevent unexpected * behavior all values in provided array are copied to internally held array. * Any changes to the original array will not be reflected. * * @param painters array of painters, which will be painted in order */ public void setPainters(Painter... painters) { Painter[] old = getPainters(); this.painters = new Painter[painters == null ? 0 : painters.length]; if (painters != null) { System.arraycopy(painters, 0, this.painters, 0, this.painters.length); } setDirty(true); firePropertyChange("painters", old, getPainters()); }
/** * Removes a painter from the queue of painters * @param painter the painter that is added */ public void removePainter(Painter<T> painter) { Collection<Painter<T>> old = new ArrayList<Painter<T>>(getPainters()); this.painters.remove(painter); if (painter instanceof AbstractPainter) { ((AbstractPainter<?>) painter).removePropertyChangeListener(handler); } setDirty(true); firePropertyChange("painters", old, getPainters()); }
/** * Sets the array of Painters to use. These painters will be executed in * order. A null value will be treated as an empty array. To prevent unexpected * behavior all values in provided array are copied to internally held array. * Any changes to the original array will not be reflected. * * @param painters array of painters, which will be painted in order */ public void setPainters(List<? extends Painter<T>> painters) { Collection<Painter<T>> old = new ArrayList<Painter<T>>(getPainters()); for (Painter<T> p : old) { if (p instanceof AbstractPainter) { ((AbstractPainter<?>) p).removePropertyChangeListener(handler); } } this.painters.clear(); this.painters.addAll(painters); for (Painter<T> p : this.painters) { if (p instanceof AbstractPainter) { ((AbstractPainter<?>) p).addPropertyChangeListener(handler); } } setDirty(true); firePropertyChange("painters", old, getPainters()); }
/** * {@inheritDoc} */ @Override protected void doPaint(Graphics2D g, T component, int width, int height) { for (Painter<T> p : getPainters()) { Graphics2D temp = (Graphics2D) g.create(); try { p.paint(temp, component, width, height); if(isClipPreserved()) { g.setClip(temp.getClip()); } } finally { temp.dispose(); } } }
Painter[] old = getPainters(); firePropertyChange("painters", old, getPainters());
Painter[] old = getPainters(); firePropertyChange("painters", old, getPainters());
Painter[] old = getPainters(); firePropertyChange("painters", old, getPainters());
/** * {@inheritDoc} */ @Override protected void doPaint(Graphics2D g, T component, int width, int height) { for (Painter<T> p : getPainters()) { Graphics2D temp = (Graphics2D) g.create(); try { p.paint(temp, component, width, height); if(isClipPreserved()) { g.setClip(temp.getClip()); } } finally { temp.dispose(); } } }
/** * {@inheritDoc} */ @Override protected void doPaint(Graphics2D g, T component, int width, int height) { for (Painter<T> p : getPainters()) { Graphics2D temp = (Graphics2D) g.create(); try { p.paint(temp, component, width, height); if(isClipPreserved()) { g.setClip(temp.getClip()); } } finally { temp.dispose(); } } }
/** * {@inheritDoc} */ @Override protected void doPaint(Graphics2D g, T component, int width, int height) { for (Painter p : getPainters()) { Graphics2D temp = (Graphics2D) g.create(); try { p.paint(temp, component, width, height); if(isClipPreserved()) { g.setClip(temp.getClip()); } } finally { temp.dispose(); } } }
@Override protected void doPaint(Graphics2D g, T component, int width, int height) { for (Painter<T> p : getPainters()) { Graphics2D temp = (Graphics2D) g.create(); try { p.paint(temp, component, width, height); if (isClipPreserved()) { g.setClip(temp.getClip()); } } finally { temp.dispose(); } } }
/** * {@inheritDoc} * <p> * Overridden for CompoundPainter defaults. */ @Test @Override public void testDefaults() { //TODO replace with super.testDefaults() when corrected copyOfSuper_testDefaultsWithCorrectedValues(); // super.testDefaults(); CompoundPainter cp = (CompoundPainter) p; assertThat(cp.getPainters(), is(new Painter[0])); assertThat(cp.getTransform(), is(nullValue())); assertThat(cp.isCheckingDirtyChildPainters(), is(true)); assertThat(cp.isClipPreserved(), is(false)); }