Skip to content

Commit

Permalink
Merge pull request #2 from mpfthprblmtq/hotfix
Browse files Browse the repository at this point in the history
Update version, fix null conditions on the JTable and resource files
  • Loading branch information
mpfthprblmtq authored Dec 7, 2018
2 parents b56f2fa + 811b528 commit 606ef9a
Show file tree
Hide file tree
Showing 6 changed files with 22 additions and 10 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -20,3 +20,6 @@ nbproject/build-impl.xml
nbproject/genfiles.properties
nbproject/project.properties
nbproject/project.xml
moose.icns
Moose-1.0.0.pkg
moose-installer.pkg
Binary file modified deploy/moose.jar
Binary file not shown.
2 changes: 1 addition & 1 deletion src/moose/Main.java
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
public class Main {

// version
public static String version = "1.1.1";
public static String version = "1.1.2";

// create and instantiate the frames and controllers
public static Frame frame = new Frame();
Expand Down
5 changes: 4 additions & 1 deletion src/moose/controllers/SongController.java
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,10 @@ public class SongController {
HashMap<Integer, Song> songs = new HashMap<>(); // hashmap to contain Song objects
ArrayList edited_songs = new ArrayList(); // arraylist to contain indices of edited songs to save

public SongController(JTable table) {
public SongController() {
}

public void setTable(JTable table) {
this.table = table;
}

Expand Down
1 change: 1 addition & 0 deletions src/moose/views/Frame.form
Original file line number Diff line number Diff line change
Expand Up @@ -287,6 +287,7 @@
<EventHandler event="keyReleased" listener="java.awt.event.KeyListener" parameters="java.awt.event.KeyEvent" handler="tableKeyReleased"/>
</Events>
<AuxValues>
<AuxValue name="JavaCodeGenerator_InitCodePost" type="java.lang.String" value="songController.setTable(table);"/>
<AuxValue name="JavaCodeGenerator_VariableModifier" type="java.lang.Integer" value="1"/>
</AuxValues>
</Component>
Expand Down
21 changes: 13 additions & 8 deletions src/moose/views/Frame.java
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ public class Frame extends javax.swing.JFrame {
Logger logger = new Logger();

// controller, instantiated in constructor
public SongController songController;
public SongController songController = new SongController();;

// some graphics ivars
ActionListener menuListener; // listener for the popup menu objects
Expand Down Expand Up @@ -90,7 +90,6 @@ public Frame() {
init();
});
}
songController = new SongController(table);
}

/**
Expand All @@ -110,7 +109,6 @@ public Frame(File folder) {
init();
});
}
songController = new SongController(table);

// add the songs in the folder param to start
ArrayList<File> files = new ArrayList<>();
Expand Down Expand Up @@ -345,13 +343,13 @@ public void setRowIcon(int icon, int row) {
row = table.convertRowIndexToModel(row);
switch (icon) {
case DEFAULT:
model.setValueAt(new ImageIcon(this.getClass().getResource("../../resources/default.jpg")), row, 0);
model.setValueAt(new ImageIcon(this.getClass().getResource("/resources/default.jpg")), row, 0);
break;
case EDITED:
model.setValueAt(new ImageIcon(this.getClass().getResource("../../resources/edit.png")), row, 0);
model.setValueAt(new ImageIcon(this.getClass().getResource("/resources/edit.png")), row, 0);
break;
case SAVED:
model.setValueAt(new ImageIcon(this.getClass().getResource("../../resources/check.png")), row, 0);
model.setValueAt(new ImageIcon(this.getClass().getResource("/resources/check.png")), row, 0);
break;
}
}
Expand All @@ -378,7 +376,7 @@ public boolean addFileToTable(File file) {

// add the row to the table
model.addRow(new Object[]{
new ImageIcon(this.getClass().getResource("../../resources/default.png")), // adds the default status icon
new ImageIcon(this.getClass().getResource("/resources/default.png")), // adds the default status icon
s.getFile(), // hidden file object
s.getFile().getName().replace(".mp3", ""), // actual editable file name
s.getTitle(),
Expand Down Expand Up @@ -598,6 +596,7 @@ public void actionPerformed(java.awt.event.ActionEvent evt) {
table.setRowHeight(20);
table.setSelectionMode(ListSelectionModel.MULTIPLE_INTERVAL_SELECTION);
table.setShowGrid(true);
songController.setTable(table);
table.addMouseListener(new java.awt.event.MouseAdapter() {
public void mousePressed(java.awt.event.MouseEvent evt) {
tableMousePressed(evt);
Expand Down Expand Up @@ -1255,6 +1254,12 @@ public void doCommand(String command) {
case "clear event log":
Main.settings.settingsController.clearEventLog();
break;
case "open error log":
Main.settings.settingsController.openErrorLog();
break;
case "open event log":
Main.settings.settingsController.openEventLog();
break;
default:
JOptionPane.showMessageDialog(this, "Unknown Command!");
break;
Expand All @@ -1265,7 +1270,7 @@ public void doCommand(String command) {
* Show the about dialog, includes name, version, and copyright
*/
public void showAboutDialog() {
Icon icon = new ImageIcon(this.getClass().getResource("../../resources/moose128.png"));
Icon icon = new ImageIcon(this.getClass().getResource("/resources/moose128.png"));
JOptionPane.showMessageDialog(null,
"Moose\nVersion: " + Main.version + "\n" + "© Pat Ripley 2018",
"About Moose", JOptionPane.PLAIN_MESSAGE, icon);
Expand Down

0 comments on commit 606ef9a

Please sign in to comment.