Commit f23b853b authored by Christos Christodoulopoulos's avatar Christos Christodoulopoulos
Browse files

Show corpus saving message only when unsaved

Auto-marked "gold" annotator doesn't count as a change
parent 28d56ca2
......@@ -3,6 +3,7 @@ package jubilee.datastructure;
import jubilee.toolkit.JBToolkit;
import jubilee.treebank.TBNode;
import jubilee.treebank.TBTree;
import jubilee.util.DataManager;
import jubilee.util.FileTokenizer;
import javax.swing.*;
......@@ -198,7 +199,8 @@ public class JBDataStructure {
public void setAnnotator(String annotator) {
if (!this.annotator.equals(annotator)) {
this.annotator = annotator;
hasChanged(true);
if (!annotator.equals(DataManager.GOLD_ID))
hasChanged(true);
}
}
......
......@@ -78,7 +78,7 @@ public class JBToolkit extends JFrame implements ActionListener, ItemListener, L
private static JBToolkit instance;
public JBToolkit(String title, String sysDir, String userID, final int maxAnn) {
public JBToolkit(final String title, String sysDir, String userID, final int maxAnn) {
super(title);
str_frameTitle = title;
s_sysDir = sysDir;
......@@ -95,13 +95,19 @@ public class JBToolkit extends JFrame implements ActionListener, ItemListener, L
addWindowListener(new WindowAdapter() {
@Override
public void windowClosing(WindowEvent e) {
int confirm = JOptionPane.showOptionDialog(null, "Save to file and exit?",
"Exit Confirmation", JOptionPane.YES_NO_OPTION, JOptionPane.QUESTION_MESSAGE, null, null, null);
if (confirm == 0) {
menuFileSave();
setVisible(false);
showOpenDialog();
}
if (!title.startsWith(EDITED)) {
setVisible(false);
showOpenDialog();
}
else {
int confirm = JOptionPane.showOptionDialog(null, "Save to file and exit?",
"Exit Confirmation", JOptionPane.YES_NO_OPTION, JOptionPane.QUESTION_MESSAGE, null, null, null);
if (confirm == 0) {
menuFileSave();
setVisible(false);
showOpenDialog();
}
}
}
});
instance = this;
......@@ -269,7 +275,6 @@ public class JBToolkit extends JFrame implements ActionListener, ItemListener, L
if (isNewTask) {
if (isGold()) {
String taskFile = str_dataset.get(DataManager.ANNOTATION) + File.separator + filename[1];
// XXX Not sure if this is right
corpus = new JBCorpus(taskFile, DataManager.GOLD_ID);
}
else {
......@@ -284,7 +289,6 @@ public class JBToolkit extends JFrame implements ActionListener, ItemListener, L
moreCorpora = new JBCorpus[filename.length-1];
for (int i=1; i<filename.length; i++) {
filename[i] = str_dataset.get(DataManager.ANNOTATION) + File.separator + filename[i];
// XXX Not sure if this is right
moreCorpora[i-1] = new JBCorpus(filename[i], DataManager.GOLD_ID);
}
}
......@@ -391,6 +395,7 @@ public class JBToolkit extends JFrame implements ActionListener, ItemListener, L
}
}
//TODO What does this do?
void updateGoldTopList() {
if (isGold()) {
JBDataStructure annotation = corpus.getCurrentAnnotation();
......
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