aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatt Windsor <mbw500@student.cs.york.ac.uk>2011-02-21 23:21:35 +0000
committerMatt Windsor <mbw500@student.cs.york.ac.uk>2011-02-21 23:21:35 +0000
commitc33f098de8a43a2df778d4d694e0c07bbde59828 (patch)
treea6ffd4c0b133db81079ca0746088da76d511f438
parentaf1013959f6ab36ed9f2ff603c08116ee1b55c57 (diff)
Added auth; added clean property to Libraryitem etc., fixed a bug in LibraryViewerPanel which searching twice in a row for zero-result strings would crash the frontend.
-rw-r--r--res/conf.xml4
-rw-r--r--src/uk/org/ury/library/LibraryItem.java3
-rw-r--r--src/uk/org/ury/library/LibraryTableModel.java26
-rw-r--r--src/uk/org/ury/library/LibraryUtils.java2
-rw-r--r--src/uk/org/ury/library/viewer/LibraryViewerPanel.java14
5 files changed, 36 insertions, 13 deletions
diff --git a/res/conf.xml b/res/conf.xml
index 4795e94..e685082 100644
--- a/res/conf.xml
+++ b/res/conf.xml
@@ -16,7 +16,7 @@
<auth>
<user>xauth</user>
- <pass>pass</pass>
+ <pass>rCtVyBuN</pass>
<type>read_only</type>
</auth>
@@ -25,4 +25,4 @@
<pass>password</pass>
<type>read_write</type>
</auth>
-</config> \ No newline at end of file
+</config>
diff --git a/src/uk/org/ury/library/LibraryItem.java b/src/uk/org/ury/library/LibraryItem.java
index f4283b0..881f840 100644
--- a/src/uk/org/ury/library/LibraryItem.java
+++ b/src/uk/org/ury/library/LibraryItem.java
@@ -43,7 +43,8 @@ public class LibraryItem
ADD_SURNAME ("snameadd"),
EDIT_FORENAME ("fnameedit"),
EDIT_SURNAME ("snameedit"),
- DIGITISED ("digitised");
+ IS_DIGITISED ("digitised"),
+ IS_CLEAN ("clean");
public final String sql;
diff --git a/src/uk/org/ury/library/LibraryTableModel.java b/src/uk/org/ury/library/LibraryTableModel.java
index 7883438..c648520 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 5;
+ return 6;
}
@@ -73,7 +73,8 @@ public class LibraryTableModel extends AbstractTableModel
@Override
public Class<?>
- getColumnClass (int c) {
+ getColumnClass (int c)
+ {
return getValueAt (0, c).getClass ();
}
@@ -113,11 +114,26 @@ public class LibraryTableModel extends AbstractTableModel
else
return "Unrecognised";
- case 4: // Digitised
+ 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.DIGITISED);
+ String digitisedString = li.get (LibraryProperty.IS_DIGITISED);
if (digitisedString.equals ("t"))
return true;
@@ -149,6 +165,8 @@ public class LibraryTableModel extends AbstractTableModel
case 3:
return "Medium";
case 4:
+ return "Clean?";
+ case 5:
return "On system?";
default:
diff --git a/src/uk/org/ury/library/LibraryUtils.java b/src/uk/org/ury/library/LibraryUtils.java
index fbccd6f..1c69004 100644
--- a/src/uk/org/ury/library/LibraryUtils.java
+++ b/src/uk/org/ury/library/LibraryUtils.java
@@ -78,7 +78,7 @@ public class LibraryUtils
+ " datereleased, EXTRACT(EPOCH FROM dateadded) as dateadded,"
+ " EXTRACT(EPOCH FROM datetime_lastedit) AS dateedited,"
+ " shelfletter, shelfnumber, cdid, memberid_add, memberid_lastedit,"
- + " digitised,"
+ + " digitised, clean,"
+ " a.fname AS fnameadd, a.sname AS snameadd, b.fname AS fnameedit, b.sname AS snameedit"
+ " FROM rec_record AS r"
+ " INNER JOIN rec_track AS t ON (r.recordid = t.recordid)"
diff --git a/src/uk/org/ury/library/viewer/LibraryViewerPanel.java b/src/uk/org/ury/library/viewer/LibraryViewerPanel.java
index af35149..7057cc0 100644
--- a/src/uk/org/ury/library/viewer/LibraryViewerPanel.java
+++ b/src/uk/org/ury/library/viewer/LibraryViewerPanel.java
@@ -99,6 +99,11 @@ public class LibraryViewerPanel extends FrontendPanel
{
FrontendError.reportFatal ("UI creation failure: " + e.getMessage (), null);
}
+
+
+ // Fine-tune table
+
+ resultsTable.setAutoCreateRowSorter (true);
}
@@ -194,11 +199,6 @@ public class LibraryViewerPanel extends FrontendPanel
{
// Ignore
}
-
-
- // Force table update with new results.
-
- resultsTable.setModel (new LibraryTableModel (master.getLibraryList ()));
/* Re-enable widgets and swap panels according to whether
@@ -220,6 +220,10 @@ public class LibraryViewerPanel extends FrontendPanel
}
else
{
+ // Force table update with new results.
+
+ resultsTable.setModel (new LibraryTableModel (master.getLibraryList ()));
+
messagePanel.setVisible (false);
resultsPane.setVisible (true);
}