T - the type of the represented model objectspublic abstract class SimpleView<T>
extends java.lang.Object
| Constructor and Description |
|---|
SimpleView(javafx.scene.canvas.Canvas canvas,
javafx.geometry.Point2D point,
T model)
Creates a view for the given
model
to put on the given canvas at the given point. |
SimpleView(T model)
Creates a view for the given
model. |
| Modifier and Type | Method and Description |
|---|---|
void |
click()
Click event handler of this
SimpleView. |
void |
draw()
Implements the rendering of the graphical element.
|
protected javafx.scene.canvas.Canvas |
getCanvas()
Returns a reference the
canvas this view belongs to. |
protected abstract javafx.scene.image.Image |
getImage()
Returns the
Image that visually represents the model. |
static javafx.scene.image.Image |
getImage(java.lang.String filename)
Loads the image that represents this view's corresponding model,
adds is to the storage if it isn't in there yet.
|
protected T |
getModel()
Returns this view's corresponding model.
|
protected javafx.geometry.Point2D |
getPoint()
Returns this view's position defining point.
|
void |
injectCanvas(javafx.scene.canvas.Canvas canvas)
Setter of the canvas.
|
void |
injectPoint(javafx.geometry.Point2D point)
Setter of the position.
|
public SimpleView(T model)
model.model - the model object to represent with this viewpublic SimpleView(javafx.scene.canvas.Canvas canvas,
javafx.geometry.Point2D point,
T model)
model
to put on the given canvas at the given point.canvas - the canvas to draw onpoint - the position for drawingmodel - the model object to represent with this viewpublic void injectCanvas(javafx.scene.canvas.Canvas canvas)
canvas - the desired canvaspublic void injectPoint(javafx.geometry.Point2D point)
point - the desires positionpublic static javafx.scene.image.Image getImage(java.lang.String filename)
filename - path to the image fileprotected javafx.scene.canvas.Canvas getCanvas()
canvas this view belongs to.protected javafx.geometry.Point2D getPoint()
public void click()
SimpleView.protected T getModel()
public void draw()
protected abstract javafx.scene.image.Image getImage()
Image that visually represents the model.