|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object edu.jhu.tmaj.client.image.draw.AbstractDrawable
public abstract class AbstractDrawable
All shapes drawn onto a DrawableLabel extend this class
Field Summary | |
---|---|
protected static int |
BLACK_SQUARE_SIZE
The size of the black squares that are drawn around an image when it's selected |
protected DrawableLabel |
drawableLabel
|
protected boolean |
isCompleted
|
static int |
MARGIN
Specifies how close a mouse click must be to an shapes border for the program to select the shape |
protected int |
userID
|
Constructor Summary | |
---|---|
AbstractDrawable(DrawableLabel d)
|
Method Summary | |
---|---|
protected boolean |
allowMoving()
Returns true if user has completed drawing the shape |
protected void |
changeNormalStatusToModified()
Indicate user has modified an existing shape in the database |
void |
createFromShapeRecord(ShapeRecord shapeRecord)
Called from subclasses that override this method, this class only sets the shapeID variable |
boolean |
createNewShapeOnMousePress()
Returns true |
void |
draw(java.awt.Graphics g)
Sets the color and draws the black squares aroudn the Drawable |
protected static void |
drawBlackSquare(java.awt.Graphics g,
int x,
int y)
Draws a black square of size BLACK_SQUARE_SIZE at position (x,y) |
protected void |
drawBlackSquares(java.awt.Graphics g,
Point[] points)
Draws black squares around the shape (indicates the shape has been selected) |
protected Point[] |
getBlackSquares()
Returns an empty array; This method is overwritten in subclasses |
protected java.awt.Color |
getColor()
Returns the color in which the drawable will be painted |
protected int |
getDrawingX(int x)
Gets the X that should be drawn onto the label using the g.drawXXX, given the X in the database |
protected int |
getDrawingY(int y)
|
abstract InsertSQL |
getInsertSQL(int scoredImageID)
Returns a SQL statement to update an existing shape in the database. |
protected int |
getNormalX(int x)
Gets the X that should be stored into the database, given the X that has been generated by a mouseEvent |
protected int |
getNormalY(int y)
|
int |
getShapeID()
Gets the unique ShapeID of this shape in the database table Shapes |
DrawableStatus |
getStatus()
Returns the status of this shape, e.g. |
abstract UpdateSQL |
getUpdateSQL()
Returns a SQL statement to insert this shape into the database. |
int |
getUserID()
Returns the UserID of the person drawing this shape |
void |
handleKeyPressed(java.awt.event.KeyEvent e)
Does nothing. |
void |
handleMouseDragged(java.awt.event.MouseEvent e)
Moves the shape depending on difference between last point, if the user has finished drawing it. |
void |
handleMousePressed(java.awt.event.MouseEvent e)
Registers tempX and tempX if moving is allowed |
void |
handleMouseReleased(java.awt.event.MouseEvent e)
Indicate the user has finished drawing the shape |
boolean |
isCompleted()
Returns true if the user is finished drawing the shape |
boolean |
isHighlighted()
Returns true if the drawable is selected |
protected abstract void |
move(int xDiff,
int yDiff)
Moves the shape by adding xDiff and YDiff to it's current x and y, respectively. |
protected void |
repaintDrawableLabel()
|
void |
setDrawableLabel(DrawableLabel label)
Sets the DrawableLabel on which this shape is being drawn |
void |
setIsCompleted(boolean b)
Sets whether the user has finished drawing the shape |
void |
setIsHighlighted(boolean b)
|
void |
setShapeID(int i)
Sets the unique ShapeID of this shape in the database table Shapes |
void |
setStatus(DrawableStatus i)
|
void |
setUserID(int i)
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected boolean isCompleted
protected transient int userID
protected transient DrawableLabel drawableLabel
public static final int MARGIN
protected static final int BLACK_SQUARE_SIZE
Constructor Detail |
---|
public AbstractDrawable(DrawableLabel d)
Method Detail |
---|
protected void repaintDrawableLabel()
public abstract UpdateSQL getUpdateSQL()
public abstract InsertSQL getInsertSQL(int scoredImageID)
protected abstract void move(int xDiff, int yDiff)
public boolean isHighlighted()
public void setIsHighlighted(boolean b)
protected java.awt.Color getColor()
public void draw(java.awt.Graphics g)
protected Point[] getBlackSquares()
public DrawableStatus getStatus()
public void setStatus(DrawableStatus i)
public int getShapeID()
public void setShapeID(int i)
public void createFromShapeRecord(ShapeRecord shapeRecord)
protected int getNormalX(int x)
protected int getNormalY(int y)
protected int getDrawingX(int x)
protected int getDrawingY(int y)
public void setDrawableLabel(DrawableLabel label)
protected void drawBlackSquares(java.awt.Graphics g, Point[] points)
protected static void drawBlackSquare(java.awt.Graphics g, int x, int y)
public boolean isCompleted()
public void setIsCompleted(boolean b)
public void handleMousePressed(java.awt.event.MouseEvent e)
public void handleMouseDragged(java.awt.event.MouseEvent e)
protected void changeNormalStatusToModified()
protected boolean allowMoving()
public void handleMouseReleased(java.awt.event.MouseEvent e)
public void handleKeyPressed(java.awt.event.KeyEvent e)
public boolean createNewShapeOnMousePress()
public int getUserID()
public void setUserID(int i)
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |