/** * Sets the ReactionSet contained in this ChemModel. * * @param sor the ReactionSet to store in this model * * @see #getReactionSet */ @Override public void setReactionSet(IReactionSet sor) { if (this.setOfReactions != null) this.setOfReactions.removeListener(this); this.setOfReactions = sor; if (this.setOfReactions != null) this.setOfReactions.addListener(this); notifyChanged(); }
/** * Sets the ReactionSet contained in this ChemModel. * * @param sor the ReactionSet to store in this model * * @see #getReactionSet */ @Override public void setReactionSet(IReactionSet sor) { if (this.setOfReactions != null) this.setOfReactions.removeListener(this); this.setOfReactions = sor; if (this.setOfReactions != null) this.setOfReactions.addListener(this); notifyChanged(); }
@Test @Override public void testStateChanged_IChemObjectChangeEvent() { ChemObjectListenerImpl listener = new ChemObjectListenerImpl(); IReactionSet chemObject = (IReactionSet) newChemObject(); chemObject.addListener(listener); chemObject.addReaction(chemObject.getBuilder().newInstance(IReaction.class)); Assert.assertTrue(listener.changed); listener.reset(); Assert.assertFalse(listener.changed); }