From 9b4647f1ae8c3f41163d0d4053504dab861d0c94 Mon Sep 17 00:00:00 2001 From: Matt Windsor Date: Mon, 7 Mar 2011 13:50:24 +0000 Subject: 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. --- src/uk/org/ury/library/LibraryTableModel.java | 116 ++++++++++++++------------ 1 file changed, 62 insertions(+), 54 deletions(-) (limited to 'src/uk/org/ury/library/LibraryTableModel.java') 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"; } } -- cgit v1.2.3