Left: Implement composite structures

This commit is contained in:
Minh Bui
2020-12-08 18:38:32 +07:00
commit ce1a245ca6
45 changed files with 2343 additions and 0 deletions
+11
View File
@@ -0,0 +1,11 @@
package view.interfaces;
public interface IDialogChoice<T> {
String getDialogTitle();
String getDialogText();
T[] getDialogOptions();
T getCurrentSelection();
}
+27
View File
@@ -0,0 +1,27 @@
package view.interfaces;
import java.awt.Color;
import java.awt.Stroke;
import java.util.EnumMap;
import model.AbstractShape;
import model.ShapeColor;
/**
* IDrawShape interface
*
* Responsibility: Interface for the strategy pattern for drawing shapes.
*
* Note that if offset is true, an algorithm for drawing boundary is used instead.
*
* @author Minh Bui
*
*/
public interface IDrawShape {
int SELECT_STROKE_OFFSET = 5;
int SELECT_WIDTH_HEIGHT_OFFSET = 10;
void draw(AbstractShape shape, PaintCanvasBase canvas, EnumMap<ShapeColor, Color> colorMap, Stroke selectStroke,
boolean offset);
}
+5
View File
@@ -0,0 +1,5 @@
package view.interfaces;
public interface IEventCallback {
void run();
}
+9
View File
@@ -0,0 +1,9 @@
package view.interfaces;
import view.EventName;
import javax.swing.*;
public interface IGuiWindow {
JButton getButton(EventName eventName);
}
+8
View File
@@ -0,0 +1,8 @@
package view.interfaces;
import view.EventName;
public interface IUiModule {
void addEvent(EventName eventName, IEventCallback command);
<T> T getDialogResponse(IDialogChoice dialogChoice);
}
+8
View File
@@ -0,0 +1,8 @@
package view.interfaces;
import javax.swing.*;
import java.awt.*;
public abstract class PaintCanvasBase extends JComponent {
public abstract Graphics2D getGraphics2D();
}