/* @(#)PaintableSequenceComposite.java   2.3.2   10 September 2004
 *
 * Copyright 2004
 * College of Computer and Information Science
 * Northeastern University
 * Boston, MA  02115
 *
 * The Java Power Tools software may be used for educational
 * purposes as long as this copyright notice is retained intact
 * at the top of all source files.
 *
 * To discuss possible commercial use of this software, 
 * contact Richard Rasala at Northeastern University, 
 * College of Computer and Information Science,
 * 617-373-2462 or rasala@ccs.neu.edu.
 *
 * The Java Power Tools software has been designed and built
 * in collaboration with Viera Proulx and Jeff Raab.
 *
 * Should this software be modified, the words "Modified from 
 * Original" must be included as a comment below this notice.
 *
 * All publication rights are retained.  This software or its 
 * documentation may not be published in any media either
 * in whole or in part without explicit permission.
 *
 * This software was created with support from Northeastern 
 * University and from NSF grant DUE-9950829.
 */

package edu.neu.ccs.gui;

import edu.neu.ccs.gui.*;
import edu.neu.ccs.util.*;

import java.awt.*;
import java.awt.geom.*;
import javax.swing.*;
import java.beans.*;

/**
 * <p>The class <code>PaintableSequenceComposite</code> is a base
 * class for the construction of <code>Paintable</code> classes.
 * Although the class is not abstract, nothing useful can be done
 * with it directly.</p>
 *
 * <p>A derived class can control exactly what is inserted into the
 * internal <code>PaintableSequence</code> via the protected access
 * method <code>getPaintableSequence()</code> but this sequence is
 * not visible to a public caller.  Thus, all features of a
 * <code>PaintableSequence</code> are available to a derived class
 * without public exposure of this implementation.</p>
 *
 * <p>Aside from the protected access method
 * <code>getPaintableSequence()</code>,
 * all methods simply implement the two interfaces
 * <code>Paintable()</code> and <code>SupportsPropertyChange()</code>
 * and do this by delegation to the internal paintable sequence.</p>
 *
 * @author  Richard Rasala
 * @version 2.3.2
 * @since   2.3.2
 */
public class PaintableSequenceComposite
    implements Paintable, SupportsPropertyChange, JPTConstants
{
    /** The internal paintable sequence. */
    private PaintableSequence sequence = new PaintableSequence();
    
    
    /**
     * <p>Returns the internal paintable sequence.</p>
     *
     * @return the internal paintable sequence
     */
    protected PaintableSequence getPaintableSequence() {
        return sequence;
    }
    
    
    /* Delegate Paintable interface calls to the internal sequence. */
    
    
    public void paint(Graphics g)
    {
        sequence.paint(g);
    }
    
    
    public Rectangle2D getBounds2D()
    {
        return sequence.getBounds2D();
    }
    
    
    public Point2D getCenter()
    {
        return sequence.getCenter();
    }
    
    
    public boolean contains(double x, double y)
    {
        return sequence.contains(x, y);
    }
    
    
    public boolean contains(Point2D p)
    {
         return sequence.contains(p);
    }
   
    
    public void setVisible(boolean visible)
    {
        sequence.setVisible(visible);
    }
    
    
    public boolean isVisible()
    {
        return sequence.isVisible();
    }
    
    
    public void setOpacity(float opacity)
    {
        sequence.setOpacity(opacity);
    }
    
    
    public float getOpacity()
    {
        return sequence.getOpacity();
    }
    
    
    public Graphics2D getPreparedGraphics2D(Graphics g) {
        return sequence.getPreparedGraphics2D(g);
    }
    
    
    /* Delegate SupportsPropertyChange interface calls to the internal sequence. */
    
    
    public void addPropertyChangeListener(PropertyChangeListener listener)
    {
        sequence.addPropertyChangeListener(listener);
    }
    
    public void addPropertyChangeListener(
        String propertyName,
        PropertyChangeListener listener)
    {
        sequence.addPropertyChangeListener(propertyName, listener);
    }
    
    
    public void addPropertyChangeListeners(PropertyChangeListener[] listeners)
    {
        sequence.addPropertyChangeListeners(listeners);
    }
    
    
    public void addPropertyChangeListeners(
        String propertyName,
        PropertyChangeListener[] listeners)
    {
        sequence.addPropertyChangeListeners(propertyName, listeners);
    }
    
    
    public void removePropertyChangeListener(PropertyChangeListener listener)
    {
        sequence.removePropertyChangeListener(listener);
    }
    
    
    public void removePropertyChangeListener(
        String propertyName,
        PropertyChangeListener listener)
    {
        sequence.removePropertyChangeListener(propertyName, listener);
    }
    
    
    public PropertyChangeListener[] getPropertyChangeListeners()
    {
        return sequence.getPropertyChangeListeners();
    }
    
    
    public PropertyChangeListener[] getPropertyChangeListeners(String propertyName)
    {
        return sequence.getPropertyChangeListeners(propertyName);
    }
    
    
    public boolean hasListeners(String propertyName)
    {
        return sequence.hasListeners(propertyName);
    }
    
    
    public void firePropertyChange(
        String propertyName,
        Object oldValue,
        Object newValue)
    {
        sequence.firePropertyChange(propertyName, oldValue, newValue);
    }
    
    
    public void firePropertyChange(
        String propertyName,
        boolean oldValue,
        boolean newValue)
    {
        sequence.firePropertyChange(propertyName, oldValue, newValue);
    }
    
    
    public void firePropertyChange(
        String propertyName,
        char oldValue,
        char newValue)
    {
        sequence.firePropertyChange(propertyName, oldValue, newValue);
    }
    
    
    public void firePropertyChange(
        String propertyName,
        byte oldValue,
        byte newValue)
    {
        sequence.firePropertyChange(propertyName, oldValue, newValue);
    }
    
    
    public void firePropertyChange(
        String propertyName,
        short oldValue,
        short newValue)
    {
        sequence.firePropertyChange(propertyName, oldValue, newValue);
    }
    
    
    public void firePropertyChange(
        String propertyName,
        int oldValue,
        int newValue)
    {
        sequence.firePropertyChange(propertyName, oldValue, newValue);
    }
    
    
    public void firePropertyChange(
        String propertyName,
        long oldValue,
        long newValue)
    {
        sequence.firePropertyChange(propertyName, oldValue, newValue);
    }
    
    
    public void firePropertyChange(
        String propertyName,
        float oldValue,
        float newValue)
    {
        sequence.firePropertyChange(propertyName, oldValue, newValue);
    }
    
    
    public void firePropertyChange(
        String propertyName,
        double oldValue,
        double newValue)
    {
        sequence.firePropertyChange(propertyName, oldValue, newValue);
    }
    
    
    public void firePropertyChange(PropertyChangeEvent evt)
    {
        sequence.firePropertyChange(evt);
    }
    
    
    public PropertyChangeForwardingListener getForwardingListener()
    {
        return sequence.getForwardingListener();
    }
    
    
    public void addForwardingListener(Object object)
    {
        sequence.addForwardingListener(object);
    }
    
    
    public void removeForwardingListener(Object object)
    {
        sequence.removeForwardingListener(object);
    }
    
    
    public void removeAndAddForwardingListener(Object oldobject, Object newobject)
    {
        sequence.removeAndAddForwardingListener(oldobject, newobject);
    }
       
}
