aboutsummaryrefslogtreecommitdiff
path: root/src/uk/org/ury/library/viewer/LibraryViewer.java
diff options
context:
space:
mode:
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;
}