/// <summary> /// Saves the results of applying the parser to the current text to /// the specified filename. /// </summary> public virtual void SaveOutput(string filename) { if (filename == null || filename.Equals(string.Empty)) { return; } string text = textPane.GetText(); StringReader reader = new StringReader(text); DocumentPreprocessor processor = new DocumentPreprocessor(reader); ITokenizerFactory <IHasWord> tf = tlp.GetTokenizerFactory(); processor.SetTokenizerFactory(tf); IList <IList <IHasWord> > sentences = new List <IList <IHasWord> >(); foreach (IList <IHasWord> sentence in processor) { sentences.Add(sentence); } JProgressBar progress = new JProgressBar(0, sentences.Count); JButton cancel = new JButton(); JDialog dialog = new JDialog(new Frame(), "Parser Progress", true); dialog.SetSize(300, 150); dialog.Add(BorderLayout.North, new JLabel("Parsing " + sentences.Count + " sentences")); dialog.Add(BorderLayout.Center, progress); dialog.Add(BorderLayout.South, cancel); //dialog.add(progress); ParserPanel.SaveOutputThread thread = new ParserPanel.SaveOutputThread(this, filename, progress, dialog, cancel, sentences); cancel.SetText("Cancel"); cancel.SetToolTipText("Cancel"); cancel.AddActionListener(null); thread.Start(); dialog.SetVisible(true); }
public SaveOutputThread(ParserPanel _enclosing, string filename, JProgressBar progress, JDialog dialog, JButton button, IList <IList <IHasWord> > sentences) { this._enclosing = _enclosing; this.filename = filename; this.progress = progress; this.dialog = dialog; this.button = button; this.sentences = sentences; }
private void centerDialog(Component paramComponent, JDialog paramJDialog) { Rectangle rectangle = paramComponent.Bounds; int i = paramJDialog.Width; int j = paramJDialog.Height; int k = (paramComponent.Width - paramJDialog.Width) / 2; int m = (paramComponent.Height - paramJDialog.Height) / 2; paramJDialog.setLocation(paramComponent.X + k, paramComponent.Y + m); }
public virtual string ShowListSelectionDialog(IList <string> files, Point location) { Frame frame = new Frame(); //System.out.println(location); //frame.setLocation(location); JDialog dialog = new JDialog(frame, "Jar File Chooser", true); dialog.SetLocation(location); JList fileList = new JList(new Vector <string>(files)); fileList.SetSelectionMode(ListSelectionModelConstants.SingleSelection); IMouseListener mouseListener = new _MouseAdapter_68(dialog); // double clicked fileList.AddMouseListener(mouseListener); JScrollPane scroll = new JScrollPane(fileList); JButton okay = new JButton(); okay.SetText("Okay"); okay.SetToolTipText("Okay"); okay.AddActionListener(null); JButton cancel = new JButton(); cancel.SetText("Cancel"); cancel.SetToolTipText("Cancel"); cancel.AddActionListener(null); GridBagLayout gridbag = new GridBagLayout(); GridBagConstraints constraints = new GridBagConstraints(); dialog.SetLayout(gridbag); constraints.gridwidth = GridBagConstraints.Remainder; constraints.fill = GridBagConstraints.Both; constraints.weightx = 1.0; constraints.weighty = 1.0; gridbag.SetConstraints(scroll, constraints); dialog.Add(scroll); constraints.gridwidth = GridBagConstraints.Relative; constraints.fill = GridBagConstraints.None; constraints.weighty = 0.0; gridbag.SetConstraints(okay, constraints); dialog.Add(okay); constraints.gridwidth = GridBagConstraints.Remainder; gridbag.SetConstraints(cancel, constraints); dialog.Add(cancel); dialog.Pack(); dialog.SetSize(dialog.GetPreferredSize()); dialog.SetVisible(true); if (fileList.IsSelectionEmpty()) { return(null); } return(files[fileList.GetSelectedIndex()]); }
/// <summary> /// Sets the title in a uniform fashion, as determined by the values passed in. /// The general pattern of the title will be /// "AppName - DataSet Base Name - Window Name (status)" </summary> /// <param name="dialog"> the dialog on which to set the title. Cannot be null. </param> /// <param name="dataset"> the dataset from which to get the base dataset name. The /// basename can be null or "", in which case it won't be included in the title. /// The dataset can be null. </param> /// <param name="window_title"> the title of the window. Can be null or "", in which /// case it won't be included in the title. </param> /// <param name="status"> the status of the window. Can be null or "", in which case /// it won't be included in the title. </param> public static void setTitle(JDialog dialog, StateMod_DataSet dataset, string window_title, string status) { string title = ""; int count = 0; string appName = JGUIUtil.getAppNameForWindows().Trim(); if (!appName.Trim().Equals("")) { title += appName; count++; } if (dataset != null) { string basename = dataset.getBaseName(); if (!string.ReferenceEquals(basename, null) && !basename.Trim().Equals("")) { if (count > 0) { title += " - "; } title += basename.Trim(); count++; } } if (!string.ReferenceEquals(window_title, null) && !window_title.Trim().Equals("")) { if (count > 0) { title += " - "; } title += window_title.Trim(); count++; } if (!string.ReferenceEquals(status, null) && !status.Trim().Equals("")) { if (count > 0) { title += " "; } title += "(" + status + ")"; } dialog.setTitle(title); }
public UIProgressBarDialog(JDialog paramJDialog, string paramString, int paramInt) : base(paramJDialog, paramString, false) { if (!InstanceFieldsInitialized) { InitializeInstanceFields(); InstanceFieldsInitialized = true; } setSize(380, 130); Modal = true; init(paramInt); Resizable = false; if (paramJDialog != null) { this.previousFocus = paramJDialog.MostRecentFocusOwner; } }
public _MouseAdapter_68(JDialog dialog) { this.dialog = dialog; }