Skip to content

Commit d1542c2

Browse files
authored
Merge branch 'develop' into addIanKo
2 parents f40e5d8 + 1fe433c commit d1542c2

38 files changed

Lines changed: 1073 additions & 1293 deletions

?/.java/fonts/1.8.0_121/fcinfo-1-its-cseb260-26.ucsd.edu-null-null-en.properties

Lines changed: 0 additions & 834 deletions
This file was deleted.

images/addCursor.png

993 Bytes
Loading

images/redo.png

2.09 KB
Loading

images/undo.png

2.06 KB
Loading
Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
package actions;
2+
3+
import ui.PaintPanel;
4+
5+
public class AddComponentActions extends MenuBarPaintAction{
6+
7+
protected int x;
8+
protected int y;
9+
10+
public AddComponentActions(PaintPanel panel) {
11+
super(panel);
12+
13+
setDefaultXY();
14+
}
15+
16+
/**
17+
* set the default point to the middle of paint panel
18+
*/
19+
public void setDefaultXY(){
20+
x = panel.getWidth()/2;
21+
y = panel.getHeight()/2;
22+
23+
}
24+
25+
26+
public void setX(int newX){
27+
x = newX;
28+
}
29+
30+
public void setY(int newY){
31+
y = newY;
32+
}
33+
34+
public void setXY(int newX, int newY){
35+
x = newX;
36+
y = newY;
37+
}
38+
39+
@Override
40+
public boolean canPerformAction() {
41+
// TODO Auto-generated method stub
42+
return false;
43+
}
44+
45+
@Override
46+
public void performAction() {
47+
// TODO Auto-generated method stub
48+
49+
}
50+
51+
@Override
52+
public String locationString() {
53+
// TODO Auto-generated method stub
54+
return null;
55+
}
56+
57+
}

src/actions/AddDataDisplayBoxAction.java

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
import ui.general.InputManager;
1313
import ui.general.InputManagerDelegate;
1414

15-
public class AddDataDisplayBoxAction extends MenuBarPaintAction {
15+
public class AddDataDisplayBoxAction extends AddComponentActions {
1616

1717
public AddDataDisplayBoxAction(PaintPanel panel) {
1818
super(panel);
@@ -30,10 +30,9 @@ public void performAction() {
3030
AddDataDisplayBoxGlobalAction associatedAction = (AddDataDisplayBoxGlobalAction) ActionName.ADD_DATA_DISPLAY_BOX
3131
.getAssociatedAction();
3232
associatedAction.setDisplayString("Data Display");
33-
associatedAction.setX(panel.getWidth() / 2);
34-
associatedAction.setY(panel.getHeight() / 2);
35-
GlobalPaintActionExecuter.getSharedInstance().execute(associatedAction,
36-
panel);
33+
associatedAction.setX(x);
34+
associatedAction.setY(y);
35+
GlobalPaintActionExecuter.getSharedInstance().execute(associatedAction, panel);
3736

3837
}
3938

src/actions/AddDataInputBoxAction.java

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,20 +6,22 @@
66
import paintcomponents.data.DataInputTextfieldPaintComponent;
77
import ui.PaintPanel;
88

9-
public class AddDataInputBoxAction extends MenuBarPaintAction {
9+
public class AddDataInputBoxAction extends AddComponentActions {
10+
1011

1112
public AddDataInputBoxAction(PaintPanel panel) {
1213
super(panel);
1314
}
1415

16+
1517
@Override
1618
public boolean canPerformAction() {
1719
return true;
1820
}
1921

2022
@Override
2123
public void performAction() {
22-
DataInputTextfieldPaintComponent comp = new DataInputTextfieldPaintComponent("Data Input", panel.getWidth() /2, panel.getHeight()/2);
24+
DataInputTextfieldPaintComponent comp = new DataInputTextfieldPaintComponent("Data Input", x,y);
2325

2426
// auto-select the component just created by the user
2527
if (panel.getSelectTool() != null) {

src/actions/AddLazyJavaClassAction.java

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
import actions.global.globalactions.AddLazyJavaClassGlobalAction;
99
import actions.menu.ActionsMenuBarTitles;
1010

11-
public class AddLazyJavaClassAction extends MenuBarPaintAction {
11+
public class AddLazyJavaClassAction extends AddComponentActions {
1212

1313
public AddLazyJavaClassAction(PaintPanel panel) {
1414
super(panel);
@@ -29,10 +29,8 @@ public void didFinishInput(Class input) {
2929
AddLazyJavaClassGlobalAction associatedAction = (AddLazyJavaClassGlobalAction) ActionName.ADD_LAZY_JAVA_CLASS_ACTION
3030
.getAssociatedAction();
3131
associatedAction.setClassToCreate(input);
32-
associatedAction.setCoord(panel.getWidth() / 2,
33-
panel.getHeight() / 2);
34-
GlobalPaintActionExecuter.getSharedInstance().execute(
35-
associatedAction, panel);
32+
associatedAction.setCoord(x, y);
33+
GlobalPaintActionExecuter.getSharedInstance().execute(associatedAction, panel);
3634

3735
}
3836
});

src/actions/edit/undoredo/SharedUndoRedoActionManager.java

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,5 +91,19 @@ public Stack<UndoRedoableInterface> getUndoStack() {
9191
public Stack<UndoRedoableInterface> getRedoStack() {
9292
return redoStack;
9393
}
94+
95+
/**
96+
* return the last item in undoStack
97+
*/
98+
public UndoRedoableInterface undoPeek(){
99+
return undoStack.peek();
100+
}
101+
102+
/**
103+
* return last item in redoStack
104+
*/
105+
public UndoRedoableInterface redoPeek(){
106+
return redoStack.peek();
107+
}
94108

95109
}

src/actions/edit/undoredo/UndoRedoableInterface.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
package actions.edit.undoredo;
22

3-
import ui.helper.historyui.HistoryDataObject;
3+
import ui.helper.historyui.TableUIDataObject;
44

5-
public abstract class UndoRedoableInterface extends HistoryDataObject {
5+
public abstract class UndoRedoableInterface extends TableUIDataObject {
66

77
public abstract void undoAction();
88
public abstract void redoAction();

0 commit comments

Comments
 (0)