From c564d188c1a8106d866651eba5c4cf60fbc0c232 Mon Sep 17 00:00:00 2001 From: jprocter Date: Wed, 19 Oct 2011 18:24:08 +0100 Subject: [PATCH] extend alignPanel api with OOMHandler call to raise OOM events appropriately in GUI --- src/jalview/api/AlignmentViewPanel.java | 3 ++- src/jalview/api/OOMHandlerI.java | 8 ++++++++ src/jalview/appletgui/AlignmentPanel.java | 7 +++++++ src/jalview/gui/AlignmentPanel.java | 6 ++++++ 4 files changed, 23 insertions(+), 1 deletion(-) create mode 100644 src/jalview/api/OOMHandlerI.java diff --git a/src/jalview/api/AlignmentViewPanel.java b/src/jalview/api/AlignmentViewPanel.java index d9c97f4..d971acb 100644 --- a/src/jalview/api/AlignmentViewPanel.java +++ b/src/jalview/api/AlignmentViewPanel.java @@ -26,9 +26,10 @@ import jalview.structure.StructureSelectionManager; * @author JimP * */ -public interface AlignmentViewPanel +public interface AlignmentViewPanel extends OOMHandlerI { AlignmentI getAlignment(); StructureSelectionManager getStructureSelectionManager(); + void paintAlignment(boolean b); } diff --git a/src/jalview/api/OOMHandlerI.java b/src/jalview/api/OOMHandlerI.java new file mode 100644 index 0000000..c14b4f7 --- /dev/null +++ b/src/jalview/api/OOMHandlerI.java @@ -0,0 +1,8 @@ +package jalview.api; + +public interface OOMHandlerI +{ + + void raiseOOMWarning(String string, OutOfMemoryError error); + +} diff --git a/src/jalview/appletgui/AlignmentPanel.java b/src/jalview/appletgui/AlignmentPanel.java index 224b966..c5adccb 100644 --- a/src/jalview/appletgui/AlignmentPanel.java +++ b/src/jalview/appletgui/AlignmentPanel.java @@ -979,5 +979,12 @@ public class AlignmentPanel extends Panel implements AdjustmentListener, Alignme { return StructureSelectionManager.getStructureSelectionManager(av.applet); } + @Override + public void raiseOOMWarning(String string, OutOfMemoryError error) + { + // TODO: JAL-960 + System.err.println("Out of memory whilst '"+string+"'"); + error.printStackTrace(); + } } diff --git a/src/jalview/gui/AlignmentPanel.java b/src/jalview/gui/AlignmentPanel.java index 36983d5..bcfb088 100644 --- a/src/jalview/gui/AlignmentPanel.java +++ b/src/jalview/gui/AlignmentPanel.java @@ -1451,4 +1451,10 @@ public class AlignmentPanel extends GAlignmentPanel implements { return av.getStructureSelectionManager(); } + + @Override + public void raiseOOMWarning(String string, OutOfMemoryError error) + { + new OOMWarning(string, error, this); + } } -- 1.7.10.2