return view.canUndo();
}
- public boolean canAnnotate() {
- return view.canAnnotate();
+ public boolean CanLabel() {
+ return view.CanLabel();
}
public boolean canRedo() {
return view.canRedo();
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());
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;
}
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<temp.length;j++)
{
- System.out.println(temp[j]);
+ if(temp[j] == "Foreground")
+ containForeGround = true;
+ if(temp[j] == "Background")
+ containBackGround = true;
}
- return !annotations.isEmpty();
+ return (containForeGround && containBackGround);
}
public boolean canRedo() {