Skip to content

Commit d860c1b

Browse files
authored
Merge pull request #125 from UCSDOalads/funcGroup
Remove .xml file after testing file open/save function and fixed the String class problem
2 parents 08602ca + 074befe commit d860c1b

3 files changed

Lines changed: 15 additions & 4 deletions

File tree

src/actions/AddLazyJavaMethodComponentAction.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,14 +46,15 @@ public void performAction() {
4646
String desiaredConstructorIndex = JOptionPane.showInputDialog(
4747
"Please enter the index of the constructor you would like to use: \n\n\n"
4848

49+
4950
+ getMethodsSelectionUI(methods));
5051
//call DialogInputChecker to check input
5152
DialogInputChecker inputChecker = new DialogInputChecker();
5253
if(inputChecker.isValidNumber(desiaredConstructorIndex, 0, methods.length -1)){
5354
AddLazyJavaMethodComponentGlobalAction assiciatedAction
5455
= (AddLazyJavaMethodComponentGlobalAction) ActionName.ADD_LAZY_JAVA_METHOD_ACTION.getAssiciatedAction();
5556
assiciatedAction.setMethodComponent(comp);
56-
assiciatedAction.setMethod(String.class.getMethods()[Integer.parseInt(desiaredConstructorIndex)]);
57+
assiciatedAction.setMethod(comp.getDisplayingClass().getMethods()[Integer.parseInt(desiaredConstructorIndex)]);
5758
GlobalPaintActionExecuter.getSharedInstance().execute(assiciatedAction, panel);
5859
}
5960
}

src/actions/global/globalactions/FileOpenAndSaveGlobalActionTest.java

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@
1414
import actions.global.GlobalPaintActionExecuter;
1515
import paintcomponents.java.lazy.ClassPaintComponent;
1616
import ui.PaintPanel;
17+
import java.io.File;
18+
import java.nio.file.Files;
1719

1820
/*
1921
* @author Yidong Luo
@@ -39,7 +41,7 @@ public void test() {
3941
FileSaveAsGlobalAction fileSaveAssociatedAction
4042
= (FileSaveAsGlobalAction) ActionName.FILE_SAVE_AS_GLOBAL_ACTION
4143
.getAssiciatedAction();
42-
fileSaveAssociatedAction.setFilePath("temp.xml");
44+
fileSaveAssociatedAction.setFilePath("JSPFileSaveOpenTest.xml");
4345
fileSaveAssociatedAction.execute(panel);
4446

4547

@@ -54,15 +56,18 @@ public void test() {
5456
FileOpenGlobalAction fileOpenAssociatedAction
5557
= (FileOpenGlobalAction) ActionName.FILE_OPEN_GLOBAL_ACTION
5658
.getAssiciatedAction();
57-
fileOpenAssociatedAction.setFileToOpen("temp.xml");
59+
fileOpenAssociatedAction.setFileToOpen("JSPFileSaveOpenTest.xml");
5860
fileOpenAssociatedAction.execute(panel);
5961

6062
//Components on the panel should be the same as what was saved to be
6163
assertEquals(1, panel.getPaintComponents().size());
6264
assertTrue(panel.getPaintComponents().get(0)
6365
instanceof ClassPaintComponent);
6466

65-
67+
File xml = new File("JSPFileSaveOpenTest.xml");
68+
69+
xml.delete();
70+
6671
}
6772

6873
}
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
package painttools.tools;
2+
3+
public @interface DefaultPaintTool {
4+
5+
}

0 commit comments

Comments
 (0)