From 7e220a2a8da58a9dd5b70ddd6b6cb61268b11b63 Mon Sep 17 00:00:00 2001 From: lingutln Date: Thu, 22 Dec 2011 23:27:43 +0000 Subject: [PATCH] Modifications to Enable/Disable functionality. Done by Nikhil. svn path=/; revision=233 --- .../ie/dcu/apps/ist/views/SegmentationView.java | 8 +++++--- .../apps/ist/widgets/AnnotatedImageControl.java | 8 +++++++- .../ie/dcu/segment/annotate/AnnotationManager.java | 14 ++++++++++++++ 3 files changed, 26 insertions(+), 4 deletions(-) diff --git a/Annotation/src/ie/dcu/apps/ist/views/SegmentationView.java b/Annotation/src/ie/dcu/apps/ist/views/SegmentationView.java index 9104c26..9c7b4a8 100644 --- a/Annotation/src/ie/dcu/apps/ist/views/SegmentationView.java +++ b/Annotation/src/ie/dcu/apps/ist/views/SegmentationView.java @@ -448,8 +448,10 @@ public class SegmentationView extends Composite { public boolean canUndo() { return view.canUndo(); } - - + + public boolean canAnnotate() { + return view.canAnnotate(); + } public boolean canRedo() { return view.canRedo(); } @@ -761,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(canZoomBestFit()); + comboLabel.setEnabled(canAnnotate()); 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 89eb761..d3dea1d 100644 --- a/Annotation/src/ie/dcu/apps/ist/widgets/AnnotatedImageControl.java +++ b/Annotation/src/ie/dcu/apps/ist/widgets/AnnotatedImageControl.java @@ -202,10 +202,16 @@ public class AnnotatedImageControl extends Composite { return false; } + public boolean canAnnotate() { + if (ctx != null) { + return ctx.getAnnotations().canUndo(); + } + return false; + } public boolean canRedo() { if (ctx != null) { - return ctx.getAnnotations().canRedo(); + return ctx.getAnnotations().canAnnotate(); } return false; } diff --git a/Annotation/src/ie/dcu/segment/annotate/AnnotationManager.java b/Annotation/src/ie/dcu/segment/annotate/AnnotationManager.java index 7ea886d..cb45665 100644 --- a/Annotation/src/ie/dcu/segment/annotate/AnnotationManager.java +++ b/Annotation/src/ie/dcu/segment/annotate/AnnotationManager.java @@ -36,6 +36,20 @@ public class AnnotationManager { return !annotations.isEmpty(); } + public boolean canAnnotate() { + String[] temp = new String[annotations.size()]; + int i = 0; + for(Annotation ann : annotations) + { + temp[i++] = ann.getType().toString(); + System.out.println(ann.getType()); + } + for(int j=0;j