package net.sf.arianne.marboard.client.gui;
import java.awt.Color;
import net.sf.arianne.marboard.client.gui.component.MarboardObservableImpl;
import net.sf.arianne.marboard.client.gui.drawingtool.DotDrawingTool;
/**
* Keeps track of the state of the board.
*
* @author hendrik
*/
public class BoardState extends MarboardObservableImpl<BoardState> {
private String filename;
private boolean dirty;
private DrawingTool drawingTool;
private int thickness;
private Color color;
private Color fillColor;
/**
* creates a new Board State
*/
public BoardState() {
super();
filename = null;
dirty = false;
drawingTool = new DotDrawingTool();
thickness = 3;
color = Color.BLACK;
fillColor = Color.WHITE;
}
/**
* gets the name of file associated with the current board
*
* @return name of file or <code>null</code>
*/
public String getFilename() {
return filename;
}
/**
* sets the file name this board was loaded from
*
* @param filename filename
*/
public void setFilename(String filename) {
this.filename = filename;
this.setChanged();
this.notifyObservers();
}
/**
* was this board modified after it was last saved?
*
* @return true, if the board was modified; false otherwise
*/
public boolean isDirty() {
return dirty;
}
/**
* marks the board as modified.
*
* @param dirty true to mark the board as modified, false to mark it as not modified
*/
public void setDirty(boolean dirty) {
this.dirty = dirty;
this.setChanged();
this.notifyObservers();
}
/**
* gets the selected drawing tool.
*
* @return DrawingTool
*/
public DrawingTool getDrawingTool() {
return drawingTool;
}
/**
* sets the selected drawing tool.
*
* @param drawingTool selected DrawingTool
*/
public void setDrawingTool(DrawingTool drawingTool) {
this.drawingTool = drawingTool;
this.setChanged();
this.notifyObservers();
}
/**
* gets the selected thickness.
*
* @return thickness
*/
public int getThickness() {
return thickness;
}
/**
* sets the selected thickness.
*
* @param thickness selected thickness
*/
public void setThickness(int thickness) {
this.thickness = thickness;
this.setChanged();
this.notifyObservers();
}
/**
* gets the selected color
*
* @return selected Color
*/
public Color getColor() {
return color;
}
/**
* sets the selected color
*
* @param color selected color
*/
public void setColor(Color color) {
this.color = color;
this.setChanged();
this.notifyObservers();
}
/**
* gets the selected fill color
*
* @return selected fill Color
*/
public Color getFillColor() {
return fillColor;
}
/**
* sets the selected fill color
*
* @param fillColor selected fill color
*/
public void setFillColor(Color fillColor) {
this.fillColor = fillColor;
this.setChanged();
this.notifyObservers();
}
}