aboutsummaryrefslogtreecommitdiff
path: root/src/uk/org/ury/library/viewer/LibraryViewer.java
diff options
context:
space:
mode:
authorMatt Windsor <mbw500@student.cs.york.ac.uk>2011-03-07 13:50:24 +0000
committerMatt Windsor <mbw500@student.cs.york.ac.uk>2011-03-07 13:50:24 +0000
commit9b4647f1ae8c3f41163d0d4053504dab861d0c94 (patch)
treeb621e8c0b75a5cadd69f938116b1637f7ad0c94d /src/uk/org/ury/library/viewer/LibraryViewer.java
parentc33f098de8a43a2df778d4d694e0c07bbde59828 (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/viewer/LibraryViewer.java')
-rw-r--r--src/uk/org/ury/library/viewer/LibraryViewer.java69
1 files changed, 24 insertions, 45 deletions
diff --git a/src/uk/org/ury/library/viewer/LibraryViewer.java b/src/uk/org/ury/library/viewer/LibraryViewer.java
index 19f94fb..a98fa54 100644
--- a/src/uk/org/ury/library/viewer/LibraryViewer.java
+++ b/src/uk/org/ury/library/viewer/LibraryViewer.java
@@ -15,6 +15,8 @@ import uk.org.ury.database.exceptions.QueryFailureException;
import uk.org.ury.frontend.AbstractFrontendModule;
import uk.org.ury.frontend.FrontendError;
import uk.org.ury.frontend.FrontendFrame;
+import uk.org.ury.frontend.FrontendMaster;
+import uk.org.ury.frontend.FrontendModulePanel;
import uk.org.ury.library.LibraryItem;
@@ -32,40 +34,28 @@ public class LibraryViewer extends AbstractFrontendModule
private List<LibraryItem> libraryList;
private LibraryViewerPanel panel;
private FrontendFrame frame;
- private static ConfigReader config;
+ private ConfigReader config;
/**
- * Main function, for running this module as a standalone
- * application.
- *
- * @param args The command-line argument array.
- */
-
- public static void
- main (String[] args)
- {
- try {
- config = new ConfigReader("res/conf.xml");
- }
- catch(MissingCredentialsException e) {
- System.out.println(e);
- }
- LibraryViewer lv = new LibraryViewer ();
- lv.runFrontendInFrame ();
- }
-
-
- /**
- * Construct a new LibraryViewer.
+ * Construct a new LibraryViewer as a frontend object.
*/
public
LibraryViewer ()
{
+ try
+ {
+ config = new ConfigReader ("res/conf.xml");
+ }
+ catch (MissingCredentialsException e)
+ {
+ System.out.println(e);
+ }
+
frame = null;
libraryList = new ArrayList<LibraryItem> ();
- panel = new LibraryViewerPanel (this);
+ panel = null;
}
@@ -78,7 +68,7 @@ public class LibraryViewer extends AbstractFrontendModule
{
frame = null;
libraryList = new ArrayList<LibraryItem> ();
- panel = new LibraryViewerPanel (this);
+ panel = null;
try
@@ -91,7 +81,7 @@ public class LibraryViewer extends AbstractFrontendModule
panel.setOpaque (true);
setContentPane (panel);
- runFrontend ();
+ runFrontend (null);
}
});
@@ -117,38 +107,24 @@ public class LibraryViewer extends AbstractFrontendModule
start ()
{
frame = null;
- panel = new LibraryViewerPanel (this);
+ panel = new LibraryViewerPanel (this, null);
add (panel);
}
-
-
- /**
- * Run the library viewer frontend in a FrontendFrame.
- */
-
- public void
- runFrontendInFrame ()
- {
- FrontendFrame frame = new FrontendFrame (panel);
- this.frame = frame;
-
- runFrontend ();
- }
-
+
/**
* Run the library viewer frontend.
*/
- private void
- runFrontend ()
+ public FrontendModulePanel
+ runFrontend (FrontendMaster master)
{
dd = null;
try
{
- dd = new DatabaseDriver(config, UserClass.READ_ONLY);
+ dd = new DatabaseDriver (config, UserClass.READ_ONLY);
}
catch (MissingCredentialsException e)
{
@@ -159,6 +135,9 @@ public class LibraryViewer extends AbstractFrontendModule
{
FrontendError.reportFatal (f.getMessage (), frame);
}
+
+ panel = new LibraryViewerPanel (this, master);
+ return panel;
}