예제 #1
0
            public virtual void ActionPerformed(ActionEvent e)
            {
                string com = e.GetActionCommand();

                switch (com)
                {
                case "Open File":
                {
                    File file = this._enclosing.GetFile(true);
                    if (file != null)
                    {
                        this._enclosing.OpenFile(file);
                    }
                    break;
                }

                case "Load URL":
                {
                    string url = this._enclosing.GetURL();
                    if (url != null)
                    {
                        this._enclosing.OpenURL(url);
                    }
                    break;
                }

                case "Exit":
                {
                    NERGUI.Exit();
                    break;
                }

                case "Clear":
                {
                    this._enclosing.ClearDocument();
                    break;
                }

                case "Cut":
                {
                    this._enclosing.CutDocument();
                    break;
                }

                case "Copy":
                {
                    this._enclosing.CopyDocument();
                    break;
                }

                case "Paste":
                {
                    this._enclosing.PasteDocument();
                    break;
                }

                case "Load CRF from File":
                {
                    File file = this._enclosing.GetFile(true);
                    if (file != null)
                    {
                        this._enclosing.LoadClassifier(file);
                    }
                    break;
                }

                case "Load CRF from Classpath":
                {
                    string text = JOptionPane.ShowInputDialog(this._enclosing.frame, "Enter a classpath resource for an NER classifier");
                    if (text != null)
                    {
                        // User didn't click cancel
                        this._enclosing.LoadClassifier(text);
                    }
                    break;
                }

                case "Load Default CRF":
                {
                    this._enclosing.LoadClassifier((File)null);
                    break;
                }

                case "Run NER":
                {
                    this._enclosing.Extract();
                    break;
                }

                case "Save Untagged File":
                {
                    this._enclosing.SaveUntaggedContents(this._enclosing.loadedFile);
                    break;
                }

                case "Save Untagged File As ...":
                {
                    this._enclosing.SaveUntaggedContents(this._enclosing.GetFile(false));
                    break;
                }

                case "Save Tagged File As ...":
                {
                    File f = this._enclosing.GetFile(false);
                    if (f != null)
                    {
                        // i.e., they didn't cancel out of the file dialog
                        NERGUI.SaveFile(f, this._enclosing.taggedContents);
                    }
                    break;
                }

                default:
                {
                    NERGUI.log.Info("Unknown Action: " + e);
                    break;
                }
                }
            }
예제 #2
0
 internal ActionPerformer(NERGUI _enclosing)
 {
     this._enclosing = _enclosing;
 }
예제 #3
0
 internal InputListener(NERGUI _enclosing)
 {
     this._enclosing = _enclosing;
 }