From: lingutln Date: Fri, 23 Dec 2011 19:15:30 +0000 (+0000) Subject: Modified Enable/Disable functionality. Done by Nikhil. X-Git-Url: http://gitweb.planteome.org/?a=commitdiff_plain;h=d050a30274ad9b2bad94a0ca043999b029154254;p=old-jaiswallab-svn%2F.git Modified Enable/Disable functionality. Done by Nikhil. svn path=/; revision=235 --- diff --git a/Annotation/src/ie/dcu/apps/ist/views/SegmentationView.java b/Annotation/src/ie/dcu/apps/ist/views/SegmentationView.java index 9c7b4a8..d7dadce 100644 --- a/Annotation/src/ie/dcu/apps/ist/views/SegmentationView.java +++ b/Annotation/src/ie/dcu/apps/ist/views/SegmentationView.java @@ -449,8 +449,8 @@ public class SegmentationView extends Composite { return view.canUndo(); } - public boolean canAnnotate() { - return view.canAnnotate(); + public boolean CanLabel() { + return view.CanLabel(); } public boolean canRedo() { return view.canRedo(); @@ -763,7 +763,7 @@ public class SegmentationView extends Composite { Tool.ZoomOut.action.setEnabled(canZoomOut()); Tool.ZoomOriginal.action.setEnabled(canZoomOriginal()); Tool.ZoomBestFit.action.setEnabled(canZoomBestFit()); - comboLabel.setEnabled(canAnnotate()); + comboLabel.setEnabled(CanLabel()); assign.setEnabled(canZoomBestFit() & !(comboLabel.getText().isEmpty())); Tool.Foreground.action.setChecked(isAnnotatingForeground()); Tool.Background.action.setChecked(isAnnotatingBackground()); diff --git a/Annotation/src/ie/dcu/apps/ist/widgets/AnnotatedImageControl.java b/Annotation/src/ie/dcu/apps/ist/widgets/AnnotatedImageControl.java index d3dea1d..ed1c4b1 100644 --- a/Annotation/src/ie/dcu/apps/ist/widgets/AnnotatedImageControl.java +++ b/Annotation/src/ie/dcu/apps/ist/widgets/AnnotatedImageControl.java @@ -202,16 +202,16 @@ public class AnnotatedImageControl extends Composite { return false; } - public boolean canAnnotate() { + public boolean CanLabel() { if (ctx != null) { - return ctx.getAnnotations().canUndo(); + return ctx.getAnnotations().canLabel(); } return false; } public boolean canRedo() { if (ctx != null) { - return ctx.getAnnotations().canAnnotate(); + return ctx.getAnnotations().canLabel(); } return false; } diff --git a/Annotation/src/ie/dcu/segment/annotate/AnnotationManager.java b/Annotation/src/ie/dcu/segment/annotate/AnnotationManager.java index 88a94fe..92ff8e4 100644 --- a/Annotation/src/ie/dcu/segment/annotate/AnnotationManager.java +++ b/Annotation/src/ie/dcu/segment/annotate/AnnotationManager.java @@ -35,19 +35,27 @@ public class AnnotationManager { public boolean canUndo() { return !annotations.isEmpty(); } - - public boolean canAnnotate() { + /** + * Returns true only if there is atleast one Foreground Annotation and one Background Annotation. + * + * @return boolean value + */ + public boolean canLabel() { String[] temp = new String[annotations.size()]; int i = 0; + boolean containForeGround = false, containBackGround = false; for(Annotation ann : annotations) { temp[i++] = ann.getType().toString(); } for(int j=0;j