// Copyright 1996, Marimba Inc. All Rights Reserved.


// @(#)ShapeWidget.java, 1.3, 10/01/96





package marimba.gui;





import java.awt.*;





import marimba.persist.*;





/**


 * A graphical shape widget.


 *


 * @author	Arthur van Hoff


 * @version 	1.3, 10/01/96


 */


public abstract class ShapeWidget extends Widget {


    /**


     * The shape can fill itself.


     * @see #isFilled


     * @see #setFilled


     */


    public boolean  filled = true;





    /**


     * The shape can draw a line in the foreground color.


     * @see #hasLine


     * @see #setLine


     */


    public boolean  line = true;








    /**


     * Constructor.


     */


    public ShapeWidget() {


	setForeground(Color.black);


	setBackground(Color.white);


    }





    /**


     * Get the properties of this widget.


     */


    public void getProperties(PropertyList list) {


	super.getProperties(list);


	list.setBoolean("filled", filled, true);


	list.setBoolean("line", line, true);


    }





    /**


     * Set the properties of this widget.


     */


    public void setProperties(PropertyList list) {


	super.setProperties(list);


	line = list.getBoolean("line", true);


	filled = list.getBoolean("filled", true);





	// REMIND: backward compatibility introduced in version 0.93


	boolean  oldfill = list.getBoolean("fill", true);


	if (!oldfill) {


	    this.filled = false;


	}


    }





    /**


     * Check if the shape is filled.


     * @see #filled


     */


    public boolean isFilled() {


	return filled;


    }





    /**


     * Let the shape fill itself or not.


     * @see #filled


     */


    public void setFilled(boolean filled) {


	if (this.filled != filled) {


	    this.filled = filled;


	    repaint();


	}


    }





    /**


     * Check if the shape draws a line.


     * @see #line


     */


    public boolean hasLine() {


	return line;


    }





    /**


     * Let the shape draw a line or not.


     * @see #line


     */


    public void setLine(boolean line) {


	if (this.line != line) {


	    this.line = line;


	    repaint();


	}


    }


}


