From: preecej Date: Tue, 15 May 2012 23:58:32 +0000 (+0000) Subject: in progress: ontologyTerm refactoring associated with term detail web service call X-Git-Url: http://gitweb.planteome.org/?a=commitdiff_plain;h=0d4228e7778ad41781839d1f531c397d4fdf3701;p=old-jaiswallab-svn%2F.git in progress: ontologyTerm refactoring associated with term detail web service call svn path=/; revision=329 --- diff --git a/Annotation/.classpath b/Annotation/.classpath index 22412b6..6eb1bbe 100644 --- a/Annotation/.classpath +++ b/Annotation/.classpath @@ -3,9 +3,9 @@ - - - - + + + + diff --git a/Annotation/src/ie/dcu/apps/ist/views/SegmentationView.java b/Annotation/src/ie/dcu/apps/ist/views/SegmentationView.java index ff81779..2af7ee9 100644 --- a/Annotation/src/ie/dcu/apps/ist/views/SegmentationView.java +++ b/Annotation/src/ie/dcu/apps/ist/views/SegmentationView.java @@ -53,7 +53,7 @@ public class SegmentationView extends Composite { private Composite termDetailComposite; // term detail table - private Table termDetailTable; + private static Table termDetailTable; // Control to change brush size private final BrushControl brushControl; @@ -234,6 +234,10 @@ public class SegmentationView extends Composite { viewSelectionToolbar.pack(); } + private String parseAccessionIdFromComboLabel(Combo comboLabel) { + return comboLabel.getText().substring(comboLabel.getText().indexOf('{')+1,comboLabel.getText().length()-1); + } + /** * Third tool bar for holding the Annotate Combo box. */ @@ -248,7 +252,7 @@ public class SegmentationView extends Composite { }); comboLabel.addSelectionListener(new SelectionAdapter() { public void widgetSelected(SelectionEvent e) { - selectDropdownLabel(e, comboLabel.getText().substring(comboLabel.getText().indexOf('{')+1,comboLabel.getText().length()-1)); + termDetailLookup(parseAccessionIdFromComboLabel(comboLabel)); } }); assign = SwtUtils.addButton(termLookupBar, 55, "Assign"); @@ -256,6 +260,13 @@ public class SegmentationView extends Composite { public void widgetSelected(SelectionEvent arg0) { if(view.getContext().isEnabled()) { + OntologyTerm term = new OntologyTerm(); + term.setName((String)comboLabel.getData(comboLabel.getText())); + term.setAccessionId(parseAccessionIdFromComboLabel(comboLabel)); + view.getContext().getEnabledMask().ontologyTerm = term; + /* TODO: remove this and reference SegementationMake.ontologyTerm.getName() instead + * (find tooltip and any other reference as well) + */ view.getContext().getEnabledMask().segmentName = (String) comboLabel.getData(comboLabel.getText()); } execute(Tool.AssignButton, null); @@ -310,21 +321,13 @@ public class SegmentationView extends Composite { searchSpecies.setEnabled(!(speciesCombo.getText().isEmpty())); speciesCombo.setListVisible(true); } - - // TODO: you need to find the event hook for segment selection, that resets the comboLabel and the .accessionId (you should use accessionId in this context) - public void selectSegment(SelectionEvent e) { - System.out.println("curr accession id (from segment): " + this.view.getContext().getEnabledMask().accessionId); - termDetailLookup(this.view.getContext().getEnabledMask().accessionId); - } - - public void selectDropdownLabel(SelectionEvent e, String accessionId) { - System.out.println("curr accession id (from label): " + accessionId); - //System.out.println("curr comboLabel value: " + comboLabel.getText()); - termDetailLookup(accessionId); - } - - private void termDetailLookup(String accessionId) { - // call term detail web service method using accession id (from 1) segment obj or 2) label selection (before assign button is clicked)) + + /* + * call term detail web service method using accession id from 1) segment obj or 2) label selection + * (before assign button is clicked) + */ + public static void termDetailLookup(String accessionId) { + System.out.println("curr accession id (from segment or label): " + accessionId); termDetailTable.setEnabled(true); } diff --git a/Annotation/src/ie/dcu/apps/ist/widgets/AnnotatedImageControl.java b/Annotation/src/ie/dcu/apps/ist/widgets/AnnotatedImageControl.java index 757d175..091b311 100644 --- a/Annotation/src/ie/dcu/apps/ist/widgets/AnnotatedImageControl.java +++ b/Annotation/src/ie/dcu/apps/ist/widgets/AnnotatedImageControl.java @@ -438,9 +438,10 @@ public class AnnotatedImageControl extends Composite { { enableClickedSegment(view.canvasToImage(mouseClickedPoint)); // For setting the comboLabel value and tooltip on clicking a segment - String segmentName = ctx.getEnabledMask().segmentName; + String segmentName = ctx.getEnabledMask().ontologyTerm.getName(); getCanvas().setToolTipText(segmentName); SegmentationView.comboLabel.setText(segmentName); + SegmentationView.termDetailLookup(ctx.getEnabledMask().ontologyTerm.getAccessionId()); } repaint(); } diff --git a/Annotation/src/ie/dcu/segment/SegmentationMask.java b/Annotation/src/ie/dcu/segment/SegmentationMask.java index 32ba6e1..ef79baa 100644 --- a/Annotation/src/ie/dcu/segment/SegmentationMask.java +++ b/Annotation/src/ie/dcu/segment/SegmentationMask.java @@ -2,6 +2,7 @@ package ie.dcu.segment; import ie.dcu.matrix.ByteMatrix; import ie.dcu.segment.annotate.AnnotationManager; +import ie.dcu.apps.ist.labelling.OntologyTerm; import java.io.*; @@ -62,12 +63,17 @@ public class SegmentationMask extends ByteMatrix{ //The layering number of the segmentation mask. public int layerNumber; - //The name(label) associated with each segment. + @Deprecated + //The name(label) associated with each segment. - replaced with Term object public String segmentName; - // accession id associated with the segmentName + @Deprecated + // accession id associated with the segmentName - replaced with Term object public String accessionId; + // holds the accessionId and name of the ontology term associated with this segment + public OntologyTerm ontologyTerm; + //The maskImage each segment. public Image maskImage;