Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Code Clean up #472

Merged
merged 12 commits into from
Feb 28, 2023
1 change: 0 additions & 1 deletion src/main/java/edu/rpi/legup/app/GameBoardFacade.java
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,6 @@ public static void setupConfig() {
public void setPuzzleEditor(Puzzle puzzle) {
this.puzzle = puzzle;
this.puzzleEditor.setPuzzleView(puzzle);
// this.history.clear();
}

public void setConfig(Config config) {
Expand Down
2 changes: 2 additions & 0 deletions src/main/java/edu/rpi/legup/app/PuzzleKeyAccelerator.java
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,8 @@ public void keyPressed(KeyEvent e) {

String update = "";
if (rule.getRuleType() == RuleType.CASE) {
// TODO: review this line of code and figure out what it's supposed to do:
// TODO: remove if necessary
// handleCaseRule((CaseRule)rule);
}
else {
Expand Down
1 change: 0 additions & 1 deletion src/main/java/edu/rpi/legup/ui/DynamicView.java
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,6 @@ public void resetStatus() {
}

public void reset() {
// System.out.println("get into the reset");
Puzzle puzzle = GameBoardFacade.getInstance().getPuzzleModule();
Board board1 = GameBoardFacade.getInstance().getBoard();
board1.setModifiable(true);
Expand Down
17 changes: 2 additions & 15 deletions src/main/java/edu/rpi/legup/ui/HomePanel.java
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,6 @@ private void initButtons() {
this.buttons[2].addActionListener(CursorController.createListener(this, openPuzzleListener)); // PLACEHOLDER

for (int i = 0; i < this.buttons.length - 1; i++) { // -1 to avoid the batch grader button
//this.buttons[i].setPreferredSize(new Dimension(100, 100));
this.buttons[i].setBounds(200, 200, 700, 700);
}
this.buttons[3] = new JButton("Batch Grader");
Expand All @@ -175,18 +174,12 @@ private void initButtons() {
this.buttons[3].addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
// ProofEditorPanel panel=new ProofEditorPanel(new FileDialog(new Frame()),new JFrame(), legupUI);
// //legupUI.setVisible(false);
// panel.checkProofAll();
//checkfolder();

try {
use_xml_to_check();
}
catch (Exception ex) {
throw new RuntimeException(ex);
}
//checkallproof1();
System.out.println("finished checking the folder");

}
Expand Down Expand Up @@ -226,8 +219,6 @@ public void checkfolder(){
writer.append(",");
writer.append("Solved or not");
writer.append("\n");
//csvWriter.flush();
//csvWriter.close();

for (final File folderEntry : folder.listFiles(File::isDirectory)) {
writer.append(folderEntry.getName());
Expand Down Expand Up @@ -317,7 +308,7 @@ public void use_xml_to_check() throws Exception{
File resultFile = new File(folder.getAbsolutePath() + File.separator +"result.csv");
SAXParserFactory spf = SAXParserFactory.newInstance();
SAXParser saxParser = spf.newSAXParser();
// String path = "C:\\Users\\LiWeiJun\\Desktop\\TestSet\\TestSet\\roseh";

//read the xml file
try (BufferedWriter writer = new BufferedWriter(new FileWriter(resultFile))) {
writer.write("Name");
Expand Down Expand Up @@ -533,10 +524,7 @@ public void traverseDir1(File folder, BufferedWriter writer, String path) throws
}
}
private void initText() {
// Note: until an auto-changing version label is implemented in the future, I removed
// the version text from the home screen to avoid confusion

// this.text = new JLabel[3];
// TODO: add version text after auto-changing version label is implemented. (text[2] = version)
this.text = new JLabel[2];

JLabel welcome = new JLabel("Welcome to Legup");
Expand All @@ -553,7 +541,6 @@ private void initText() {

this.text[0] = welcome;
this.text[1] = credits;
// this.text[2] = version;
}

private void render() {
Expand Down
3 changes: 2 additions & 1 deletion src/main/java/edu/rpi/legup/ui/LegupUI.java
Original file line number Diff line number Diff line change
Expand Up @@ -139,8 +139,9 @@ public void errorEncountered(String error) {
JOptionPane.showMessageDialog(null, error);
}

// TODO: implement
public void showStatus(String status, boolean error, int timer) {
// TODO: implement
Acewvrs marked this conversation as resolved.
Show resolved Hide resolved

}

//ask to edu.rpi.legup.save current proof
Expand Down
1 change: 0 additions & 1 deletion src/main/java/edu/rpi/legup/ui/PickGameDialog.java
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,6 @@ public void initPuzzles() {
puzzles = new String[games.length][];
puzzleBox = new JTextField();
for (int x = 0; x < games.length; ++x) {
// o = GameBoardFacade.getInstance().getConfig().getBoardsForPuzzle(games[x]).toArray();
puzzles[x] = new String[o.length];

for (int y = 0; y < o.length; ++y) {
Expand Down
21 changes: 3 additions & 18 deletions src/main/java/edu/rpi/legup/ui/ProofEditorPanel.java
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ public JMenuBar getMenuBar() {
file = new JMenu("File");
newPuzzle = new JMenuItem("Open");
resetPuzzle = new JMenuItem("Reset Puzzle");
// genPuzzle = new JMenuItem("Puzzle Generators");
// genPuzzle = new JMenuItem("Puzzle Generators"); // TODO: implement puzzle generator
saveProofAs = new JMenuItem("Save Proof As"); // create a new file to save
saveProofChange = new JMenuItem("Save Proof Change"); // save to the current file
preferences = new JMenuItem("Preferences");
Expand Down Expand Up @@ -203,9 +203,6 @@ public JMenuBar getMenuBar() {
helpLegup = new JMenuItem("Help Legup");
aboutLegup = new JMenuItem("About Legup");

// unused
// help = new JMenu("Help");

mBar.add(file);
file.add(newPuzzle);
newPuzzle.addActionListener((ActionEvent) -> promptPuzzle());
Expand All @@ -216,12 +213,6 @@ public JMenuBar getMenuBar() {
newPuzzle.setAccelerator(KeyStroke.getKeyStroke('N', InputEvent.CTRL_DOWN_MASK));
}

// file.add(genPuzzle);
//// genPuzzle.addActionListener((ActionEvent) ->
//// {
//// pickGameDialog = new PickGameDialog(this, true);
//// pickGameDialog.setVisible(true);
//// });
file.add(resetPuzzle);
resetPuzzle.addActionListener(a -> {
Puzzle puzzle = GameBoardFacade.getInstance().getPuzzleModule();
Expand Down Expand Up @@ -974,16 +965,10 @@ private void submit() {
}
}

private void directions() {
JOptionPane.showMessageDialog(null, "For every move you make, you must provide a rule for it (located in the Rules panel).\n" + "While working on the edu.rpi.legup.puzzle, you may click on the \"Check\" button to test your proof for correctness.", "Directions", JOptionPane.PLAIN_MESSAGE);
}

public void errorEncountered(String error) {
JOptionPane.showMessageDialog(null, error);
}

// TODO: implement
public void showStatus(String status, boolean error, int timer) {
// TODO: implement
Acewvrs marked this conversation as resolved.
Show resolved Hide resolved

}

protected void fitTreeViewToScreen() {
Expand Down
2 changes: 0 additions & 2 deletions src/main/java/edu/rpi/legup/ui/ScrollView.java
Original file line number Diff line number Diff line change
Expand Up @@ -170,8 +170,6 @@ public void zoom(int n, Point point) {
}

public void zoomTo(double newScale) {
//System.out.println("Zooming to " + newScale);

// check zoom bounds
if (newScale < minScale) {
newScale = minScale;
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/edu/rpi/legup/ui/ZoomWidget.java
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ public class ZoomWidget extends JLabel {
private MouseAdapter open = new MouseAdapter() {
public void mouseClicked(MouseEvent e) {
palette.slider.setValue(parent.getZoom());
palette.show(e.getComponent(), 0, 0);//e.getX(), e.getY() );
palette.show(e.getComponent(), 0, 0);
}
};

Expand Down