Skip to content
Snippets Groups Projects
Commit 259d36ec authored by AREZKI Celia's avatar AREZKI Celia
Browse files

The Decorator class adds functionality to the shapes. It also implements Shape...

The Decorator class adds functionality to the shapes. It also implements Shape and delegates method calls to the decorated shape.
parent 0e17f813
No related branches found
No related tags found
No related merge requests found
package shape;
import javafx.scene.canvas.GraphicsContext;
import javafx.geometry.Point2D;
public abstract class Decorator implements Shape {
protected Shape decoratedShape;
public Decorator(Shape decoratedShape) {
this.decoratedShape = decoratedShape;
}
@Override
public int pointsCount() {
return decoratedShape.pointsCount();
}
@Override
public Point2D point(int index) {
return decoratedShape.point(index);
}
@Override
public void draw(GraphicsContext graphicsContext) {
decoratedShape.draw(graphicsContext);
drawDecoration(graphicsContext);
}
protected abstract void drawDecoration(GraphicsContext graphicsContext);
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment