diff options
author | Matt Windsor <mbw500@student.cs.york.ac.uk> | 2011-03-07 13:50:24 +0000 |
---|---|---|
committer | Matt Windsor <mbw500@student.cs.york.ac.uk> | 2011-03-07 13:50:24 +0000 |
commit | 9b4647f1ae8c3f41163d0d4053504dab861d0c94 (patch) | |
tree | b621e8c0b75a5cadd69f938116b1637f7ad0c94d /src/uk/org/ury/library/LibraryTableModel.java | |
parent | c33f098de8a43a2df778d4d694e0c07bbde59828 (diff) |
Emergency impending hard drive failure dump - lots of changes on the frontend, but they're all potentially controversial so I'm not pushing to master yet. Beginnings of show viewer. Application now run through demo menu, which allows for the links between modules to be tested.
Diffstat (limited to 'src/uk/org/ury/library/LibraryTableModel.java')
-rw-r--r-- | src/uk/org/ury/library/LibraryTableModel.java | 116 |
1 files changed, 62 insertions, 54 deletions
diff --git a/src/uk/org/ury/library/LibraryTableModel.java b/src/uk/org/ury/library/LibraryTableModel.java index c648520..f380274 100644 --- a/src/uk/org/ury/library/LibraryTableModel.java +++ b/src/uk/org/ury/library/LibraryTableModel.java @@ -7,7 +7,8 @@ import java.util.List; import javax.swing.table.AbstractTableModel; -import uk.org.ury.library.LibraryItem.LibraryProperty; +import uk.org.ury.database.exceptions.MissingPropertyException; +import uk.org.ury.library.LibraryItemProperty; /** @@ -88,60 +89,67 @@ public class LibraryTableModel extends AbstractTableModel { LibraryItem li = data.get (rowIndex); - switch (columnIndex) + try + { + switch (columnIndex) + { + case 0: // Title + return li.get (LibraryItemProperty.TITLE); + + case 1: // Artist + return li.get (LibraryItemProperty.ARTIST); + + case 2: // Album + return li.get (LibraryItemProperty.ALBUM); + + case 3: // Medium + + // TODO: Make this less kludge-y + + String mediumString = li.get (LibraryItemProperty.MEDIUM); + + if (mediumString.equals ("c")) + return "Compact Disc"; + else if (mediumString.equals ("7")) + return "7\" Vinyl"; + else if (mediumString.equals ("2")) + return "12\" Vinyl"; + else + return "Unrecognised"; + + case 4: // Clean? + + // Return true if marked true, false if marked false or unknown etc. + + String cleanString = li.get (LibraryItemProperty.IS_CLEAN); + + // TODO: Nicer way of showing this + + if (cleanString.equals ("y")) + return "Yes"; + else if (cleanString.equals ("n")) + return "No"; + else + return "???"; + + case 5: // isDigitised + + // Return true if marked true, false if marked false or unknown etc. + + String digitisedString = li.get (LibraryItemProperty.IS_DIGITISED); + + if (digitisedString.equals ("t")) + return true; + else + return false; + + default: + return ""; + } + } + catch (MissingPropertyException e) { - case 0: // Title - return li.get (LibraryProperty.TITLE); - - case 1: // Artist - return li.get (LibraryProperty.ARTIST); - - case 2: // Album - return li.get (LibraryProperty.ALBUM); - - case 3: // Medium - - // TODO: Make this less kludge-y - - String mediumString = li.get (LibraryProperty.MEDIUM); - - if (mediumString.equals ("c")) - return "Compact Disc"; - else if (mediumString.equals ("7")) - return "7\" Vinyl"; - else if (mediumString.equals ("2")) - return "12\" Vinyl"; - else - return "Unrecognised"; - - case 4: // Clean? - - // Return true if marked true, false if marked false or unknown etc. - - String cleanString = li.get (LibraryProperty.IS_CLEAN); - - // TODO: Nicer way of showing this - - if (cleanString.equals ("y")) - return "Yes"; - else if (cleanString.equals ("n")) - return "No"; - else - return "???"; - - case 5: // isDigitised - - // Return true if marked true, false if marked false or unknown etc. - - String digitisedString = li.get (LibraryProperty.IS_DIGITISED); - - if (digitisedString.equals ("t")) - return true; - else - return false; - - default: - return ""; + return "Unknown"; } } |