From: preecej Date: Wed, 4 Jul 2012 01:56:30 +0000 (+0000) Subject: Memory disposal work (when opening a new file) in progress. X-Git-Url: http://gitweb.planteome.org/?a=commitdiff_plain;h=f9e86ec5de9277e21b7759df080ecfa444fe9c87;p=old-jaiswallab-svn%2F.git Memory disposal work (when opening a new file) in progress. svn path=/; revision=351 --- diff --git a/Annotation/resources/config/view.properties b/Annotation/resources/config/view.properties index 91bb3ea..a95f7bd 100644 --- a/Annotation/resources/config/view.properties +++ b/Annotation/resources/config/view.properties @@ -49,10 +49,12 @@ SegmentationView.Action.SetPainter.image= SegmentationView.Action.SegmenterOptions.text=Configure Segmenter@Ctrl+Shift+C SegmentationView.Action.SegmenterOptions.tooltip=Configure the segmenter SegmentationView.Action.SegmenterOptions.image=file:resources/icons/preferences.png -SegmentationView.Action.SetLabel.text=Annotate : +SegmentationView.Action.SetLabel.text=Annotate: SegmentationView.Action.SetLabel.tooltip=Annotate the segmented piece. SegmentationView.Action.SetLabel.image= -SegmentationView.Action.SetCurator.text=Curator Name : +SegmentationView.Action.SetSpecies.text=Species Name: +SegmentationView.Action.SetSpecies.tooltip=Type in your species of interest and click the 'Search' button. +SegmentationView.Action.SetSpecies.image= +SegmentationView.Action.SetCurator.text=Curator Name: SegmentationView.Action.SetCurator.tooltip=Select the name of the curator. SegmentationView.Action.SetCurator.image= - diff --git a/Annotation/src/ie/dcu/apps/ist/AppWindow.java b/Annotation/src/ie/dcu/apps/ist/AppWindow.java index 6582410..e2e98b6 100644 --- a/Annotation/src/ie/dcu/apps/ist/AppWindow.java +++ b/Annotation/src/ie/dcu/apps/ist/AppWindow.java @@ -732,5 +732,13 @@ public class AppWindow extends ApplicationWindow implements FileDropListener { image = null; } } + + /* + * clear all image and metadata + */ + public void disposeAll() { + + } + } } diff --git a/Annotation/src/ie/dcu/apps/ist/actions/OpenAction.java b/Annotation/src/ie/dcu/apps/ist/actions/OpenAction.java index 991a319..fbfb518 100644 --- a/Annotation/src/ie/dcu/apps/ist/actions/OpenAction.java +++ b/Annotation/src/ie/dcu/apps/ist/actions/OpenAction.java @@ -2,6 +2,7 @@ package ie.dcu.apps.ist.actions; import ie.dcu.apps.ist.*; import ie.dcu.apps.ist.views.SegmentationView; +import ie.dcu.apps.ist.views.SegmentationView.Tool; import ie.dcu.segment.SegmentationContext; import java.io.*; @@ -40,6 +41,9 @@ public class OpenAction extends AppAction { public boolean open(File file) { String name = file.getName(); try { + // clear the decks + window.getView().resetView(); + if (SegmentationContext.isContextFile(file)) { // Load context @@ -67,7 +71,7 @@ public class OpenAction extends AppAction { } catch (IOException e) { handleError(file, e); - status(Warning, "Proplem opening file %s", name); + status(Warning, "Problem opening file %s", name); return false; } diff --git a/Annotation/src/ie/dcu/apps/ist/views/SegmentationView.java b/Annotation/src/ie/dcu/apps/ist/views/SegmentationView.java index 7bd5766..0fdcf1b 100644 --- a/Annotation/src/ie/dcu/apps/ist/views/SegmentationView.java +++ b/Annotation/src/ie/dcu/apps/ist/views/SegmentationView.java @@ -59,9 +59,6 @@ public class SegmentationView extends Composite { // term detail table private static Table termDetailTable; - // Composite for Term synonyms (nested in Term details table) - private Composite termSynonymComposite; - // term synonym table (1-col list of nested synonyms) private static Table termSynonymTable; @@ -83,7 +80,7 @@ public class SegmentationView extends Composite { private static boolean labelMode = false; // Combo box housing the selectable views - private Combo combo; + private static Combo combo; public static Combo comboLabel,curatorCombo,speciesCombo; @@ -125,6 +122,7 @@ public class SegmentationView extends Composite { SetPainter, SetLabel, AssignButton, + SetSpecies, SearchSpeciesButton, SetCurator, SegmenterOptions; @@ -185,8 +183,7 @@ public class SegmentationView extends Composite { addListeners(); updateToolStates(); } - - + private void initTools() { for (Tool t : Tool.values()) { if (t.action == null) { @@ -245,6 +242,29 @@ public class SegmentationView extends Composite { viewSelectionToolbar.pack(); } + private void resetViewSelectionToolbar(SegmentationPainter painter) { + this.setPainter(painter); + combo.setText(painter.getName()); + } + + /* + * used to clear the view for closing a file, switching files, or opening a new file; + * removes all in-memory instances of segmentation data and metadata; + * TODO: then recall this method from the Open (Open Recent), Go Next, Go Previous, and Close...when you add Close + */ + public void resetView() { + comboLabel.deselectAll(); + Tool.OperatingMode.action.setChecked(false); + resetViewSelectionToolbar(painters.get("Combined")); + clearTermDetailTable(); + clearTermSynonymTable(); + collectionId.setText(""); + comment.setText(""); + curatorCombo.deselectAll(); + speciesCombo.deselectAll(); + + } + private String parseAccessionIdFromComboLabel(Combo comboLabel) { return comboLabel.getText().substring(comboLabel.getText().indexOf('{')+1,comboLabel.getText().length()-1); } @@ -460,13 +480,35 @@ public class SegmentationView extends Composite { termDetailTable.setEnabled(false); termDetailTable.pack(); } + + public void clearTermDetailTable() { + TableItem[] items = termDetailTable.getItems(); + for(int i=0; i