aboutsummaryrefslogtreecommitdiff
path: root/src/uk/org/ury/library/LibraryTableModel.java
diff options
context:
space:
mode:
authorMatt Windsor <mbw500@student.cs.york.ac.uk>2011-02-20 23:39:35 +0000
committerMatt Windsor <mbw500@student.cs.york.ac.uk>2011-02-20 23:39:35 +0000
commite2fc92f5c42dde942e8b71d38b9745b6f3c98053 (patch)
treed9d95332cee432390396bdc295d40a7ad5abe5ee /src/uk/org/ury/library/LibraryTableModel.java
parent904caa25f8de49cc20823a25ce8051dfdcae7c26 (diff)
Use swixml instead of procedural UI generation; retrieve tracks as well as albums, including digitised status etc.
Diffstat (limited to 'src/uk/org/ury/library/LibraryTableModel.java')
-rw-r--r--src/uk/org/ury/library/LibraryTableModel.java53
1 files changed, 50 insertions, 3 deletions
diff --git a/src/uk/org/ury/library/LibraryTableModel.java b/src/uk/org/ury/library/LibraryTableModel.java
index 6f55243..7883438 100644
--- a/src/uk/org/ury/library/LibraryTableModel.java
+++ b/src/uk/org/ury/library/LibraryTableModel.java
@@ -49,7 +49,7 @@ public class LibraryTableModel extends AbstractTableModel
public int
getColumnCount ()
{
- return 3;
+ return 5;
}
@@ -65,6 +65,19 @@ public class LibraryTableModel extends AbstractTableModel
}
+ /**
+ * @param c The column whose class should be investigated.
+ *
+ * @return the column class of column c.
+ */
+
+ @Override
+ public Class<?>
+ getColumnClass (int c) {
+ return getValueAt (0, c).getClass ();
+ }
+
+
/* (non-Javadoc)
* @see javax.swing.table.TableModel#getValueAt(int, int)
*/
@@ -78,10 +91,39 @@ public class LibraryTableModel extends AbstractTableModel
{
case 0: // Title
return li.get (LibraryProperty.TITLE);
+
case 1: // Artist
return li.get (LibraryProperty.ARTIST);
- case 2: // Medium
- return li.get (LibraryProperty.MEDIUM);
+
+ 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: // Digitised
+
+ // Return true if marked true, false if marked false or unknown etc.
+
+ String digitisedString = li.get (LibraryProperty.DIGITISED);
+
+ if (digitisedString.equals ("t"))
+ return true;
+ else
+ return false;
+
default:
return "";
}
@@ -103,7 +145,12 @@ public class LibraryTableModel extends AbstractTableModel
case 1:
return "Artist";
case 2:
+ return "Album";
+ case 3:
return "Medium";
+ case 4:
+ return "On system?";
+
default:
return "ERROR";
}