MouseEventFilter.java :  » Testing » jacareto » jacareto » filter » Java Open Source

Java Open Source » Testing » jacareto 
jacareto » jacareto » filter » MouseEventFilter.java
/*
 * Jacareto Copyright (c) 2002-2005
 * Applied Computer Science Research Group, Darmstadt University of
 * Technology, Institute of Mathematics & Computer Science,
 * Ludwigsburg University of Education, and Computer Based
 * Learning Research Group, Aachen University. All rights reserved.
 *
 * Jacareto is free software; you can redistribute it and/or
 * modify it under the terms of the GNU General Public
 * License as published by the Free Software Foundation; either
 * version 2 of the License, or (at your option) any later version.
 *
 * Jacareto is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * General Public License for more details.
 *
 * You should have received a copy of the GNU General Public
 * License along with Jacareto; if not, write to the Free
 * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
 *
 */

package jacareto.filter;


import jacareto.record.MouseEventRecordable;
import jacareto.struct.StructureElement;
import jacareto.system.Environment;

import java.awt.event.MouseEvent;

/**
 * A structure element matches this filter if it is a mouse event and no mouse motion event.
 *
 * @author <a href="mailto:cspannagel@web.de">Christian Spannagel</a>
 * @version 1.0
 */
public class MouseEventFilter extends Filter {
    /**
     * Creates a new mouse event filter.
     *
     * @param env the environment
     */
    public MouseEventFilter (Environment env) {
        super(env);
    }

    /**
     * Returns the name.
     *
     * @return DOCUMENT ME!
     */
    public String getName () {
        return language.getString ("Filters.MouseEventFilter.Name");
    }

    /**
     * Returns <code>true</code> when a given structure elements is of the class specified by the
     * classname
     *
     * @param element DOCUMENT ME!
     *
     * @return DOCUMENT ME!
     */
    public boolean matches (StructureElement element) {
        return (element != null) && (element instanceof MouseEventRecordable) &&
        ((((MouseEventRecordable) element).getID () != MouseEvent.MOUSE_MOVED) &&
        (((MouseEventRecordable) element).getID () != MouseEvent.MOUSE_DRAGGED));
    }
}
java2s.com  | Contact Us | Privacy Policy
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.