package org.helioviewer.jhv.data.datatype.event;

import java.awt.EventQueue;
import java.util.HashSet;
import java.util.Set;

public abstract class AbstractJHVEvent implements JHVEvent {

    protected boolean highlighted;
    protected Set<JHVEventHighlightListener> listeners;
    private Object owner;

    public AbstractJHVEvent() {
        highlighted = false;
        listeners = new HashSet<JHVEventHighlightListener>();
    }

    @Override
    public void highlight(boolean isHighlighted, Object owner) {
        if ((isHighlighted || (!isHighlighted && owner == this.owner)) && isHighlighted != highlighted) {
            highlighted = isHighlighted;
            this.owner = owner;
            fireHighlightChanged();
        }
    }

    @Override
    public void addHighlightListener(JHVEventHighlightListener l) {
        listeners.add(l);
    }

    @Override
    public void removeHighlightListener(JHVEventHighlightListener l) {
        listeners.remove(listeners);
    }

    @Override
    public boolean isHighlighted() {
        return highlighted;
    }

    private void fireHighlightChanged() {
        // TODO Auto-generated method stub
        EventQueue.invokeLater(new Runnable() {

            @Override
            public void run() {
                for (JHVEventHighlightListener l : listeners) {
                    l.eventHightChanged(AbstractJHVEvent.this);
                }
            }
        });
    }
}

@@ -47,36 +47,8 @@
 t;%0A%0A
-import java.awt.EventQueue;%0A
 impo
@@ -1089,162 +1089,8 @@
 ) %7B%0A
-        // TODO Auto-generated method stub%0A        EventQueue.invokeLater(new Runnable() %7B%0A%0A            @Override%0A            public void run() %7B%0A        
     
@@ -1153,24 +1153,16 @@
         
-      
-  
 l.eventH
@@ -1209,43 +1209,9 @@
     
-        %7D%0A            %7D%0A        %7D);
+%7D
 %0A   

remove invoke later