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

Added "corpus edited" notification

parent 05cf8764
package jubilee.datastructure;
import jubilee.toolkit.JBToolkit;
import jubilee.treebank.TBNode;
import jubilee.treebank.TBTree;
import jubilee.util.FileTokenizer;
......@@ -189,6 +190,11 @@ public class JBDataStructure {
public void hasChanged(boolean changed) {
this.changed = changed;
if (changed) {
String title = JBToolkit.getInstance().getTitle();
if (!title.startsWith(JBToolkit.EDITED))
JBToolkit.getInstance().setTitle(JBToolkit.EDITED + title);
}
}
public String toProbankString() {
......
......@@ -24,7 +24,6 @@
package jubilee.toolkit;
import jubilee.awt.JDCFileDialog;
import jubilee.awt.JDCTextAreaFrame;
import jubilee.datastructure.JBCorpus;
import jubilee.datastructure.JBDataStructure;
import jubilee.util.DataManager;
......@@ -44,9 +43,9 @@ import java.util.ArrayList;
import java.util.HashMap;
@SuppressWarnings("serial")
public class JBToolkit extends JFrame implements ActionListener, ItemListener, ListSelectionListener
{
private String str_frameTitle;
public class JBToolkit extends JFrame implements ActionListener, ItemListener, ListSelectionListener {
public final static String EDITED = "[EDITED] ";
private String str_frameTitle;
private String str_userID;
// dataset[0] = resource, dataset[1] = directory-paths
private HashMap<String, String> str_dataset;
......@@ -72,9 +71,10 @@ public class JBToolkit extends JFrame implements ActionListener, ItemListener, L
int i_maxAnn;
static public String s_sysDir = null;
private JScrollPane sentencePane;
public JBToolkit(String title, String sysDir, String userID, final int maxAnn) {
private static JBToolkit instance;
public JBToolkit(String title, String sysDir, String userID, final int maxAnn) {
super(title);
str_frameTitle = title;
s_sysDir = sysDir;
......@@ -100,8 +100,18 @@ public class JBToolkit extends JFrame implements ActionListener, ItemListener, L
}
}
});
instance = this;
}
public static JBToolkit getInstance() {
// This shouldn't be called before the creation of the main interface
if (instance == null) {
System.err.println("Someone is requesting an instance of the main interface prior to initialization");
System.exit(-1);
}
return instance;
}
boolean isGold()
{
return str_userID.equalsIgnoreCase(DataManager.GOLD_ID);
......@@ -190,7 +200,7 @@ public class JBToolkit extends JFrame implements ActionListener, ItemListener, L
// bottom of the treeview
sentencePane = new JScrollPane(ta_context);
JScrollPane sentencePane = new JScrollPane(ta_context);
sentencePane.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_NEVER);
JPanel bottomPanel = new JPanel();
......@@ -452,6 +462,9 @@ public class JBToolkit extends JFrame implements ActionListener, ItemListener, L
private void menuFileSave(String filename) {
try {
corpus.saveCorpus(filename);
String title = getTitle();
if (title.startsWith(EDITED))
setTitle(title.replace(EDITED, ""));
}
catch (Exception e) {
JOptionPane.showMessageDialog(null, "There was an error: \n" + e.getMessage(), "Error",
......
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