diff options
author | Matt Windsor <matt@deling.(none)> | 2011-03-18 08:28:09 +0000 |
---|---|---|
committer | Matt Windsor <matt@deling.(none)> | 2011-03-18 08:28:09 +0000 |
commit | d547f87da5f68c12dede7c9d45618cae11ff5699 (patch) | |
tree | 613aa95d94b363c72ba9a7be639c74f76edf81f8 /src/uk/org/ury/library/viewer/LibraryViewer.java | |
parent | c8bb324e757587e742df0824304144e1eb881cee (diff) |
Mega-commit to the rescue! Added Javadoc snapshot (admittedly old); show UI now fixed-layout; UI uses system selection colours for accents; now uses bapsserver password and can thus talk to show database relations; removed member relation dependencies until further notice; attempted to get application and applet launchers working but having issues with the latter; started working on a server communicating via a minimal implementation of HTTP 1.1 (standardisation required eventually).
Diffstat (limited to 'src/uk/org/ury/library/viewer/LibraryViewer.java')
-rw-r--r-- | src/uk/org/ury/library/viewer/LibraryViewer.java | 95 |
1 files changed, 19 insertions, 76 deletions
diff --git a/src/uk/org/ury/library/viewer/LibraryViewer.java b/src/uk/org/ury/library/viewer/LibraryViewer.java index a98fa54..9587d5e 100644 --- a/src/uk/org/ury/library/viewer/LibraryViewer.java +++ b/src/uk/org/ury/library/viewer/LibraryViewer.java @@ -1,27 +1,21 @@ package uk.org.ury.library.viewer; -import java.lang.reflect.InvocationTargetException; - import java.util.ArrayList; import java.util.List; -import javax.swing.SwingUtilities; - import uk.org.ury.config.ConfigReader; import uk.org.ury.database.DatabaseDriver; import uk.org.ury.database.UserClass; import uk.org.ury.database.exceptions.MissingCredentialsException; 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; +import uk.org.ury.frontend.exceptions.UICreationFailureException; import uk.org.ury.library.LibraryUtils; import uk.org.ury.library.exceptions.EmptySearchException; +import uk.org.ury.library.item.LibraryItem; public class LibraryViewer extends AbstractFrontendModule { @@ -33,7 +27,6 @@ public class LibraryViewer extends AbstractFrontendModule private DatabaseDriver dd; private List<LibraryItem> libraryList; private LibraryViewerPanel panel; - private FrontendFrame frame; private ConfigReader config; @@ -53,64 +46,9 @@ public class LibraryViewer extends AbstractFrontendModule System.out.println(e); } - frame = null; libraryList = new ArrayList<LibraryItem> (); panel = null; } - - - /** - * Initialise the library viewer frontend as an applet. - */ - - public void - init () - { - frame = null; - libraryList = new ArrayList<LibraryItem> (); - panel = null; - - - try - { - SwingUtilities.invokeAndWait (new Runnable () - { - public void - run () - { - panel.setOpaque (true); - setContentPane (panel); - - runFrontend (null); - } - - }); - } - catch (InterruptedException e) - { - // TODO Auto-generated catch block - e.printStackTrace (); - } - catch (InvocationTargetException e) - { - // TODO Auto-generated catch block - e.printStackTrace (); - } - } - - - /** - * Run the library viewer frontend as an applet. - */ - - public void - start () - { - frame = null; - panel = new LibraryViewerPanel (this, null); - - add (panel); - } /** @@ -129,14 +67,22 @@ public class LibraryViewer extends AbstractFrontendModule catch (MissingCredentialsException e) { // TODO: Privilege de-escalation - FrontendError.reportFatal (e.getMessage (), frame); + master.fatalError (e.getMessage ()); } catch (Exception f) { - FrontendError.reportFatal (f.getMessage (), frame); + master.fatalError (f.getMessage ()); } - panel = new LibraryViewerPanel (this, master); + try + { + panel = new LibraryViewerPanel (this, master); + } + catch (UICreationFailureException e) + { + master.fatalError (e.getMessage ()); + } + return panel; } @@ -152,19 +98,16 @@ public class LibraryViewer extends AbstractFrontendModule * * @throws EmptySearchException if the search string is * empty or null (from LibraryUtils.search). + * + * @throws QueryFailureException if the search query + * fails (from LibraryUtils.search). */ public void - doSearch (String search) throws EmptySearchException + doSearch (String search) + throws EmptySearchException, QueryFailureException { - try - { - libraryList = LibraryUtils.search (dd, search); - } - catch (QueryFailureException e) - { - FrontendError.reportFatal (e.getMessage (), frame); - } + libraryList = LibraryUtils.search (dd, search); } |