/** * <code>setRenderer</code> sets the renderer. * * @param renderer a <code>PairwiseSequenceRenderer</code>. * @exception ChangeVetoException if the change is vetoed. */ public void setRenderer(PairwiseSequenceRenderer renderer) throws ChangeVetoException { if (hasListeners()) { ChangeEvent ce = new ChangeEvent(this, RENDERER, renderer, this.renderer); ChangeSupport cs = getChangeSupport(RENDERER); synchronized (cs) { cs.firePreChangeEvent(ce); if (this.renderer instanceof Changeable) { Changeable c = (Changeable) this.renderer; c.removeChangeListener(rendererForwarder); } this.renderer = renderer; if (renderer instanceof Changeable) { Changeable c = (Changeable) renderer; c.addChangeListener(rendererForwarder); } cs.firePostChangeEvent(ce); } } else { this.renderer = renderer; } }
protected ChangeSupport getChangeSupport(ChangeType ct) { ChangeSupport cs = super.getChangeSupport(ct); if (rendererForwarder == null) { rendererForwarder = new PairwiseSequenceRenderer.PairwiseRendererForwarder(this, cs); if (renderer instanceof Changeable) { Changeable c = (Changeable) renderer; c.addChangeListener(rendererForwarder, SequenceRenderContext.REPAINT); } } return cs; }