001/*
002 * Copyright 2010-2015 Institut Pasteur.
003 * 
004 * This file is part of Icy.
005 * 
006 * Icy is free software: you can redistribute it and/or modify
007 * it under the terms of the GNU General Public License as published by
008 * the Free Software Foundation, either version 3 of the License, or
009 * (at your option) any later version.
010 * 
011 * Icy is distributed in the hope that it will be useful,
012 * but WITHOUT ANY WARRANTY; without even the implied warranty of
013 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
014 * GNU General Public License for more details.
015 * 
016 * You should have received a copy of the GNU General Public License
017 * along with Icy. If not, see <http://www.gnu.org/licenses/>.
018 */
019package icy.painter;
020
021import icy.common.CollapsibleEvent;
022
023/**
024 * @deprecated Use {@link Overlay} classes instead.
025 */
026@Deprecated
027public class PainterEvent implements CollapsibleEvent
028{
029    public enum PainterEventType
030    {
031        PAINTER_CHANGED;
032    }
033
034    private final Painter source;
035    private final PainterEventType type;
036
037    public PainterEvent(Painter source, PainterEventType type)
038    {
039        this.source = source;
040        this.type = type;
041    }
042
043    /**
044     * @return the source
045     */
046    public Painter getSource()
047    {
048        return source;
049    }
050
051    /**
052     * @return the type
053     */
054    public PainterEventType getType()
055    {
056        return type;
057    }
058
059    @Override
060    public boolean collapse(CollapsibleEvent event)
061    {
062        if (equals(event))
063        {
064            // nothing to do here
065            return true;
066        }
067
068        return false;
069    }
070
071    @Override
072    public int hashCode()
073    {
074        return source.hashCode() ^ type.hashCode();
075    }
076
077    @Override
078    public boolean equals(Object obj)
079    {
080        if (obj instanceof PainterEvent)
081        {
082            final PainterEvent e = (PainterEvent) obj;
083
084            return (source == e.getSource()) && (type == e.getType());
085        }
086
087        return super.equals(obj);
088    }
089}