Hello!

To see the file structure, click on "tree".

Note that updates take place every 10 minutes, commits may not be seen immediately.
Memory disposal work (when opening a new file) in progress.
authorpreecej <preecej@localhost>
Wed, 4 Jul 2012 01:56:30 +0000 (01:56 +0000)
committerpreecej <preecej@localhost>
Wed, 4 Jul 2012 01:56:30 +0000 (01:56 +0000)
svn path=/; revision=351

Annotation/resources/config/view.properties
Annotation/src/ie/dcu/apps/ist/AppWindow.java
Annotation/src/ie/dcu/apps/ist/actions/OpenAction.java
Annotation/src/ie/dcu/apps/ist/views/SegmentationView.java
Annotation/src/ie/dcu/apps/ist/widgets/AnnotatedImageControl.java

index 91bb3ea99f931b41c1e8f9f1c4c49d49a06a4537..a95f7bd5579b4f7cf0ecb2ebf591ccc5b88a72be 100644 (file)
@@ -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=
-
index 6582410451d10642020aee114a330b41cc905196..e2e98b6332d2bb8aeb384a8c14aa2efc0aec22ee 100644 (file)
@@ -732,5 +732,13 @@ public class AppWindow extends ApplicationWindow implements FileDropListener {
                                image = null;
                        }
                }
+               
+               /*
+                * clear all image and metadata 
+                */
+               public void disposeAll() {
+                       
+               }
+               
        }
 }
index 991a319a5cec8f876132b0318697d4fd40f02016..fbfb5187716c221f4ad7471224ce53055969eef6 100644 (file)
@@ -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;
                }
index 7bd57665c9279276db5e15e26f20e82505ceba7c..0fdcf1b5caac4795be1d20bf4b2de8c9893e338f 100644 (file)
@@ -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<items.length; i++)
+        {
+                       items[i].setText(1, "");
+                       termDetailTable.getColumn(1).pack();
+               termDetailTable.setEnabled(false);
+               termDetailTable.pack();
+        }
+       }
+
+       public void clearTermSynonymTable() {
+               TableItem[] items = termSynonymTable.getItems();
+        for(TableItem item : items)
+        {
+               item.setText(0,"");
+               termSynonymTable.getColumn(0).pack();
+               termSynonymTable.setEnabled(false);
+               termSynonymTable.pack();
+        }
+       }
        
        private void createTermDetailFields() {
                
                // Combo box and label for species
-               SwtUtils.addLabelToComposite(termDetailComposite, "Species Name");
+               SwtUtils.addLabelToComposite(termDetailComposite, getAction(Tool.SetSpecies).getText());
                speciesCombo = SwtUtils.addComboToComposite(termDetailComposite, 250, SWT.READ_ONLY);
-               speciesCombo.setToolTipText( getAction(Tool.SetPainter).getToolTipText());
+               speciesCombo.setToolTipText( getAction(Tool.SetSpecies).getToolTipText());
                
                searchSpecies = SwtUtils.addButtonToComposite(termDetailComposite, 55, "Search");
                Label dummyLabel = SwtUtils.spacer(termDetailComposite);
@@ -479,7 +521,7 @@ public class SegmentationView extends Composite {
                // Combo box and label for curator
                SwtUtils.addLabelToComposite(termDetailComposite, getAction(Tool.SetCurator).getText());
                curatorCombo = SwtUtils.addComboToComposite(termDetailComposite, 250, SWT.READ_ONLY);
-               curatorCombo.setToolTipText( getAction(Tool.SetPainter).getToolTipText());
+               curatorCombo.setToolTipText( getAction(Tool.SetCurator).getToolTipText());
                curatorCombo.addSelectionListener(new SelectionAdapter() {
                        public void widgetSelected(SelectionEvent e) {
                                execute(Tool.SetPainter, null);
@@ -492,12 +534,12 @@ public class SegmentationView extends Composite {
                // text field for collection Id
                SwtUtils.addLabelToComposite(termDetailComposite, "Collection Id");
                collectionId = SwtUtils.addTextFieldToComposite(termDetailComposite);
-               collectionId.setToolTipText( getAction(Tool.SetPainter).getToolTipText());
+               //collectionId.setToolTipText( getAction(Tool.SetPainter).getToolTipText());
                
                // Comments Text Area
                SwtUtils.addLabelToComposite(termDetailComposite, "Comments");
                comment = SwtUtils.addTextAreaToComposite(termDetailComposite);
-               comment.setToolTipText( getAction(Tool.SetPainter).getToolTipText());
+               //comment.setToolTipText( getAction(Tool.SetPainter).getToolTipText());
        }
        
        private void layoutControls() {
@@ -617,8 +659,6 @@ public class SegmentationView extends Composite {
                gd.grabExcessVerticalSpace = true;
                gd.verticalAlignment = SWT.FILL;
                comment.setLayoutData(gd);
-               
-               
        }
        
        private void updatePainters() {
index c161f8df7186389d3cb2ef4913d39830980cb33f..8d2831437b87a09b5d5374781bcd78385fcf4b8a 100644 (file)
@@ -413,7 +413,7 @@ public class AnnotatedImageControl extends Composite {
                        Point mouseClickedPoint = new Point(event.x,event.y);
                        // For the right click
                        if(event.button == 3)
-                       {
+                       { /* // JP - don't want this functionality right now
                                PopUpLabelDialog dialog = new PopUpLabelDialog(getShell());
                                PopUpLabelDialog.Result result = dialog.open();
                                if (result != null) 
@@ -430,7 +430,7 @@ public class AnnotatedImageControl extends Composite {
                                System.out.println("selected"+lab);
                                        //comboLabel.setText(result.comboText);
                                        //execute(Tool.AssignButton, null);
-                               }
+                               }*/
                        }
                        else if(event.button == 1)
                        {