package startLab6.shapes; import java.awt.Color; import java.awt.Graphics; import java.awt.Point; import java.util.ArrayList; import java.util.List; /** * @author hornick * @version 1.0 * @created 21-Jan-2014 6:13:49 PM */ public class ShapeManager { private Color currentFillColor = Color.BLUE; private boolean currentLabelFlag = false; private Color currentOutlineColor = Color.BLACK; private boolean outlineEnabledFlag = false; /** * The currently active shape-creation parameters. Any new shapes created via a * call to ShapeManager's addShape() method will use these parameters. These are * the default values, but they may be modified by calling this ShapeManager's * mutator methods. */ private Shape.ShapeType currentShape = Shape.ShapeType.Rectangle; /** * The number automatically assigned to each new Shape created by the ShapeManager; * automatically incremented with each new Shape created. */ private static int sequenceNumber = 0; /** * Main shape collection managed by ShapeManager */ private List shapes; /** * standard Singleton attribute */ private static ShapeManager uniqueInstance = null; /** * Default constructor. */ public ShapeManager(){ shapes = new ArrayList(); // TODO: UNDO } /** * Causes the ShapeManager to create a new shape based on the currently selected * parameters, and add the new shape to it's collection. * * @param start coordinates specifying where the new shape starts * @param end coordinates specifying where the new shape ends */ public void createNewShape(Point start, Point end){ // TODO: Stub } /** * @return the currentFillColor */ public Color getCurrentFillColor(){ return currentFillColor; } /** * @return the currentOutlineColor */ public Color getCurrentOutlineColor(){ return currentOutlineColor; } /** * @return the currentShape */ public AbstractShape.ShapeType getCurrentShape(){ return currentShape; } /** * Iterate over & draw shapes * * @param g -- Target graphics object */ public void draw(Graphics g) { // TODO: stub } /** * @return the currentLabelFlag */ public boolean isCurrentLabelFlag(){ return currentLabelFlag; } /** * @return true if drawing outlined shapes is enabled. */ public boolean isOutlineEnabled() { return outlineEnabledFlag; } /** * Remove a shape from the collection * * @param shape the Shape to be removed, including its descendants */ public void removeShape(Shape shape){ // TODO: Stub. } /** * * @param currentFillColor the currentFillColor to set */ public void setCurrentFillColor(Color currentFillColor){ this.currentFillColor = currentFillColor; } /** * * @param currentLabelFlag the currentLabelFlag to set */ public void setCurrentLabelFlag(boolean currentLabelFlag){ this.currentLabelFlag = currentLabelFlag; } /** * * @param outlineEnabledFlag if true, enable drawing outlines. */ public void setOutlineEnabledFlag(boolean outlineEnabledFlag) { this.outlineEnabledFlag = outlineEnabledFlag; } /** * * @param currentOutlineColor the currentOutlineColor to set */ public void setCurrentOutlineColor(Color currentOutlineColor){ this.currentOutlineColor = currentOutlineColor; } /** * * @param currentShape the currentShape to set * EXTRA CREDIT TODO: Eliminate ShapeType enum and use a FactoryPattern to handle this! */ public void setCurrentShape(Shape.ShapeType currentShape){ this.currentShape = currentShape; } }