Skip to content

Commit

Permalink
Merge pull request #8 from Vukan-Markovic/develop
Browse files Browse the repository at this point in the history
1.8
  • Loading branch information
vukan-markovic authored Jan 14, 2019
2 parents d73a998 + 1f9e81b commit e56d381
Show file tree
Hide file tree
Showing 35 changed files with 22 additions and 32 deletions.
Binary file modified bin/adapter/HexagonAdapter.class
Binary file not shown.
Binary file modified bin/commands/CmdBringToFront.class
Binary file not shown.
Binary file modified bin/commands/CmdUpdateHexagon.class
Binary file not shown.
Binary file modified bin/commands/CmdUpdateLine.class
Binary file not shown.
Binary file modified bin/commands/CmdUpdatePoint.class
Binary file not shown.
Binary file modified bin/commands/CmdUpdateRectangle.class
Binary file not shown.
Binary file modified bin/commands/CmdUpdateSquare.class
Binary file not shown.
Binary file modified bin/frame/DrawingFrame$1.class
Binary file not shown.
Binary file modified bin/frame/DrawingFrame$10.class
Binary file not shown.
Binary file modified bin/frame/DrawingFrame$11.class
Binary file not shown.
Binary file modified bin/frame/DrawingFrame$12.class
Binary file not shown.
Binary file modified bin/frame/DrawingFrame$13.class
Binary file not shown.
Binary file modified bin/frame/DrawingFrame$14.class
Binary file not shown.
Binary file modified bin/frame/DrawingFrame$15.class
Binary file not shown.
Binary file modified bin/frame/DrawingFrame$2.class
Binary file not shown.
Binary file modified bin/frame/DrawingFrame$3.class
Binary file not shown.
Binary file modified bin/frame/DrawingFrame$4.class
Binary file not shown.
Binary file modified bin/frame/DrawingFrame$5.class
Binary file not shown.
Binary file modified bin/frame/DrawingFrame$6.class
Binary file not shown.
Binary file modified bin/frame/DrawingFrame$7.class
Binary file not shown.
Binary file modified bin/frame/DrawingFrame$8.class
Binary file not shown.
Binary file modified bin/frame/DrawingFrame$9.class
Binary file not shown.
Binary file modified bin/frame/DrawingFrame.class
Binary file not shown.
Binary file modified bin/strategy/FileLog.class
Binary file not shown.
6 changes: 3 additions & 3 deletions src/adapter/HexagonAdapter.java
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ public HexagonAdapter clone() {
Hexagon h = new Hexagon(getXcoordinate(), getYcoordinate(), getR());
h.setBorderColor(getColor());
h.setAreaColor(getInteriorColor());
return new HexagonAdapter(hexagon);
return new HexagonAdapter(h);
}

/**
Expand All @@ -126,17 +126,17 @@ public Color getColor() {
}

public void setColor(Color color) {
super.setColor(color);
hexagon.setBorderColor(color);
super.setColor(color);
}

public Color getInteriorColor() {
return hexagon.getAreaColor();
}

public void setInteriorColor(Color color) {
super.setInteriorColor(color);
hexagon.setAreaColor(color);
super.setInteriorColor(color);
}

public int getR() {
Expand Down
4 changes: 2 additions & 2 deletions src/commands/CmdBringToFront.java
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@
public class CmdBringToFront implements Command {
private DrawingModel model;
private Shape shape;
private int index;
private int size;
private int index;

public CmdBringToFront(DrawingModel model, Shape shape, int size) {
this.model = model;
Expand All @@ -33,7 +33,7 @@ public void execute() {
*/
@Override
public void unexecute() {
model.removeAtIndex(model.getAll().size() - 1);
model.removeAtIndex(size);
model.addToIndex(index, shape);
}
}
2 changes: 1 addition & 1 deletion src/commands/CmdUpdateHexagon.java
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ public void execute() {
*/
@Override
public void unexecute() {
oldState.moveTo(originalState.getXcoordinate(), newState.getYcoordinate());
oldState.moveTo(originalState.getXcoordinate(), originalState.getYcoordinate());
oldState.setColor(originalState.getColor());
oldState.setInteriorColor(originalState.getInteriorColor());
oldState.setR(originalState.getR());
Expand Down
4 changes: 2 additions & 2 deletions src/commands/CmdUpdateLine.java
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,8 @@ public void execute() {
*/
@Override
public void unexecute() {
oldState.setInitial(originalState.getInitial());
oldState.setLast(originalState.getLast());
oldState.setInitial(originalState.getInitial().clone());
oldState.setLast(originalState.getLast().clone());
oldState.setColor(originalState.getColor());
}
}
3 changes: 1 addition & 2 deletions src/commands/CmdUpdatePoint.java
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,7 @@ public void execute() {
*/
@Override
public void unexecute() {
oldState.setXcoordinate(originalState.getXcoordinate());
oldState.setYcoordinate(originalState.getYcoordinate());
oldState.moveTo(originalState.getXcoordinate(), originalState.getYcoordinate());
oldState.setColor(originalState.getColor());
}
}
4 changes: 1 addition & 3 deletions src/commands/CmdUpdateRectangle.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@
import shapes.Rectangle;

/**
* @author Vukan Marković
*
* Class that represent command for update existing rectangle from the draw.
*/
public class CmdUpdateRectangle implements Command {
Expand Down Expand Up @@ -35,7 +33,7 @@ public void execute() {
*/
@Override
public void unexecute() {
oldState.setUpLeft(originalState.getUpLeft());
oldState.setUpLeft(originalState.getUpLeft().clone());
oldState.setWidth(originalState.getWidth());
oldState.setSide(originalState.getSide());
oldState.setColor(originalState.getColor());
Expand Down
2 changes: 1 addition & 1 deletion src/commands/CmdUpdateSquare.java
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ public void execute() {
*/
@Override
public void unexecute() {
oldState.setUpLeft(originalState.getUpLeft());
oldState.setUpLeft(originalState.getUpLeft().clone());
oldState.setSide(originalState.getSide());
oldState.setColor(originalState.getColor());
oldState.setInteriorColor(originalState.getInteriorColor());
Expand Down
20 changes: 5 additions & 15 deletions src/frame/DrawingFrame.java
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,7 @@
import java.awt.event.*;

/**
* @author Vukan Markovic
* @version 1.0
* @since 11.01.2019.
* Class that contains view, all GUI elements of the application and communicate with controller.
*/
public class DrawingFrame extends JFrame {
private static final long serialVersionUID = 1L;
Expand Down Expand Up @@ -468,15 +466,6 @@ public MouseAdapter getMouseAdapterBringToFront() {
public MouseAdapter getMouseAdapterBringToBack() {
return mouseAdapterBringToBack;
}

public void setController(DrawingController controller) {
this.controller = controller;
controller.addPropertyChangedListener(new DrawingObserver(this));
}

public static long getSerialversionuid() {
return serialVersionUID;
}

public JToggleButton getTglBtnDrawPoint() {
return tglBtnDrawPoint;
Expand Down Expand Up @@ -517,8 +506,9 @@ public MouseAdapter getMouseAdapterEdgeColor() {
public MouseAdapter getMouseAdapterInteriorColor() {
return mouseAdapterInteriorColor;
}

public JList<String> getActivityLog() {
return activityLog;

public void setController(DrawingController controller) {
this.controller = controller;
controller.addPropertyChangedListener(new DrawingObserver(this));
}
}
2 changes: 1 addition & 1 deletion src/strategy/FileDraw.java
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
import shapes.Shape;

/**
*
* Class that is responsible to save and open draw as serializable file.
*/
public class FileDraw implements FileHandler {
private FileOutputStream fileOutputStream;
Expand Down
3 changes: 3 additions & 0 deletions src/strategy/FileLog.java
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,9 @@
import shapes.Shape;
import shapes.Square;

/**
* Class that is responsible to save and parse log of executed commands.
*/
public class FileLog implements FileHandler {
private BufferedWriter writer;
private BufferedReader reader;
Expand Down
4 changes: 2 additions & 2 deletions src/strategy/FilePicture.java
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@ public void save(File file) {
BufferedImage imagebuffer = null;
try {
imagebuffer = new Robot().createScreenCapture(frame.getView().getBounds());
} catch (AWTException e1) {
e1.printStackTrace();
} catch (AWTException e) {
System.out.println(e.getMessage());
}
frame.getView().paint(imagebuffer.createGraphics());
try {
Expand Down

0 comments on commit e56d381

Please sign in to comment.