001/*
002 *   ForwardingChangeListener  -- A change listener that forwards the change on to an AbstractGeomElement.
003 *
004 *   Copyright (C) 2014-2015, Joseph A. Huwaldt
005 *   All rights reserved.
006 *   
007 *   This library is free software; you can redistribute it and/or
008 *   modify it under the terms of the GNU Lesser General Public
009 *   License as published by the Free Software Foundation; either
010 *   version 2.1 of the License, or (at your option) any later version.
011 *   
012 *   This library is distributed in the hope that it will be useful,
013 *   but WITHOUT ANY WARRANTY; without even the implied warranty of
014 *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
015 *   Lesser General Public License for more details.
016 *
017 *   You should have received a copy of the GNU Lesser General Public License
018 *   along with this program; if not, write to the Free Software
019 *   Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
020 *   Or visit:  http://www.gnu.org/licenses/lgpl.html
021 */
022package geomss.geom;
023
024import javax.swing.event.ChangeEvent;
025import javax.swing.event.ChangeListener;
026
027/**
028 * A ChangeListener that forwards the change event on to a target
029 * AbstractGeomElement instance.
030 *
031 * <p> Modified by: Joseph A. Huwaldt </p>
032 *
033 * @author Joseph A. Huwaldt, Date: January 2, 2014
034 * @version August 28, 2015
035 */
036public class ForwardingChangeListener implements ChangeListener {
037
038    private final AbstractGeomElement targetGeom;
039
040    public ForwardingChangeListener(AbstractGeomElement target) {
041        targetGeom = target;
042    }
043
044    @Override
045    public void stateChanged(ChangeEvent e) {
046        targetGeom.fireChangeEvent();
047    }
048}