Commit 71ac4e16 authored by Christos Christodoulopoulos's avatar Christos Christodoulopoulos
Browse files

Added some flourishes

-Congratulatory message at the end of the annotation
-Gold mode now shows files with annotations
parent ca600526
......@@ -30,6 +30,8 @@ public class JBCorpus {
private String annotator;
private boolean annotationFinished;
public JBCorpus(String file, String annotator) throws Exception {
this.annotator = annotator;
annotations = new ArrayList<JBDataStructure>();
......@@ -208,4 +210,12 @@ public class JBCorpus {
public List<JBDataStructure> getAnnotationsFromContext(int contextInd) {
return contextToAnnotation.get(contextInd);
}
public boolean isAnnotationFinished() {
return annotationFinished;
}
public void setAnnotationFinished(boolean annotationFinished) {
this.annotationFinished = annotationFinished;
}
}
......@@ -78,6 +78,8 @@ public class JBOpenDialog extends JDialog implements ActionListener, ItemListene
}
});
}
setTitle(jbtk.getUserID().toUpperCase() + ": " + getTitle());
setBounds(10, 10, 300, 600);
setVisible(true);
}
......@@ -165,8 +167,14 @@ public class JBOpenDialog extends JDialog implements ActionListener, ItemListene
// add new task lists
for (String aTasklist : tasklist) {
String suffix = "";
if (jbtk.isGold()) {
// Add the number of existing annotations for each task
int annotations = countAnnotations(aTasklist, tmp2);
if (annotations > 0) suffix = " (" + annotations + ")";
}
if (aTasklist.substring(aTasklist.lastIndexOf(".") + 1).equalsIgnoreCase("task"))
lm_newTask.addElement(aTasklist);
lm_newTask.addElement(aTasklist + suffix);
}
Vector<String> vec = new Vector<String>();
......@@ -188,6 +196,15 @@ public class JBOpenDialog extends JDialog implements ActionListener, ItemListene
}
}
}
private int countAnnotations(String task, List<String> annlist) {
int count = 0;
for (String anAnnlist : annlist) {
if (anAnnlist.substring(0, anAnnlist.lastIndexOf(".")).equals(task))
count++;
}
return count;
}
private void initBounds(Container cp) {
cp.setLayout(new BorderLayout());
......@@ -248,13 +265,19 @@ public class JBOpenDialog extends JDialog implements ActionListener, ItemListene
try {
if (!ls_newTask.isSelectionEmpty()) {
String[] tmp = getFileList(ls_newTask.getSelectedValue(), true);
if (tmp != null)
String value = ls_newTask.getSelectedValue();
// Remove the (#) if any
value = value.replaceAll(" \\([0-9]\\)", "");
String[] tmp = getFileList(value, true);
if (tmp != null) {
setVisible(false);
jbtk.openFile(tmp, true);
}
else
return;
} else {
String[] tmp = getFileList(ls_myTask.getSelectedValue(), false);
setVisible(false);
jbtk.openFile(tmp, false);
}
}
......
......@@ -380,6 +380,18 @@ public class JBToolkit extends JFrame implements ActionListener, ItemListener, L
}
catch (BadLocationException e) {e.printStackTrace();}
ta_context.setCaretPosition(bExtraId);
if (corpus.getCurrentAnnotationIndex() == corpus.getSize() - 1) {
bt_next.setEnabled(false);
if (!corpus.isAnnotationFinished()) {
JOptionPane.showMessageDialog(null, "Congratulations!", "End of File", JOptionPane.INFORMATION_MESSAGE);
corpus.setAnnotationFinished(true);
}
}
else bt_next.setEnabled(true);
if (corpus.getCurrentAnnotationIndex() == 0)
bt_prev.setEnabled(false);
else bt_prev.setEnabled(true);
}
private void updateGoldList() {
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment