001/** 002 * 003 */ 004package icy.common.listener.weak; 005 006import icy.gui.main.ActiveSequenceListener; 007import icy.main.Icy; 008import icy.sequence.Sequence; 009import icy.sequence.SequenceEvent; 010 011/** 012 * @author Stephane 013 */ 014public class WeakActiveSequenceListener extends WeakListener<ActiveSequenceListener> implements ActiveSequenceListener 015{ 016 public WeakActiveSequenceListener(ActiveSequenceListener listener) 017 { 018 super(listener); 019 } 020 021 @Override 022 public void removeListener(Object source) 023 { 024 Icy.getMainInterface().removeActiveSequenceListener(this); 025 } 026 027 @Override 028 public void sequenceActivated(Sequence sequence) 029 { 030 031 final ActiveSequenceListener listener = getListener(null); 032 033 if (listener != null) 034 listener.sequenceActivated(sequence); 035 } 036 037 @Override 038 public void sequenceDeactivated(Sequence sequence) 039 { 040 final ActiveSequenceListener listener = getListener(null); 041 042 if (listener != null) 043 listener.sequenceDeactivated(sequence); 044 } 045 046 @Override 047 public void activeSequenceChanged(SequenceEvent event) 048 { 049 final ActiveSequenceListener listener = getListener(null); 050 051 if (listener != null) 052 listener.activeSequenceChanged(event); 053 } 054}