/// <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);
        }
        /// <summary>
        /// Sets up the GUI.
        /// </summary>
        private void setupGUI()
        {
            addWindowListener(this);

            JPanel panel = new JPanel();

            panel.setLayout(new GridBagLayout());

            int y = 0;

            JGUIUtil.addComponent(panel, new JLabel("Text:"), 0, y++, 1, 1, 1, 1, GridBagConstraints.NONE, GridBagConstraints.EAST);
            JGUIUtil.addComponent(panel, new JLabel("X:"), 0, y++, 1, 1, 1, 1, GridBagConstraints.NONE, GridBagConstraints.EAST);
            JGUIUtil.addComponent(panel, new JLabel("Y:"), 0, y++, 1, 1, 1, 1, GridBagConstraints.NONE, GridBagConstraints.EAST);
            JGUIUtil.addComponent(panel, new JLabel("Text Position:"), 0, y++, 1, 1, 1, 1, GridBagConstraints.NONE, GridBagConstraints.EAST);
            JGUIUtil.addComponent(panel, new JLabel("Font Name:"), 0, y++, 1, 1, 1, 1, GridBagConstraints.NONE, GridBagConstraints.EAST);
            JGUIUtil.addComponent(panel, new JLabel("Font Size:"), 0, y++, 1, 1, 1, 1, GridBagConstraints.NONE, GridBagConstraints.EAST);
            JGUIUtil.addComponent(panel, new JLabel("Font Style:"), 0, y++, 1, 1, 1, 1, GridBagConstraints.NONE, GridBagConstraints.EAST);

            __textTextField       = new JTextField(30);
            __textFieldBackground = __textTextField.getBackground();
            __xTextField          = new JTextField(15);
            __yTextField          = new JTextField(15);

            __textPositionComboBox = new SimpleJComboBox(false);
            string[] positions = GRText.getTextPositions();
            __textPositionComboBox.setMaximumRowCount(positions.Length);
            IList <string> positionsChoices = new List <string>();

            for (int i = 0; i < positions.Length; i++)
            {
                positionsChoices.Add(positions[i]);
            }
            __textPositionComboBox.setData(positionsChoices);

            __fontNameComboBox  = JGUIUtil.newFontNameJComboBox();
            __fontSizeTextField = new JTextField(7);
            __fontStyleComboBox = JGUIUtil.newFontStyleJComboBox();

            displayPropListValues();

            __textTextField.addKeyListener(this);
            __xTextField.addKeyListener(this);
            __yTextField.addKeyListener(this);
            __fontSizeTextField.addKeyListener(this);
            __textPositionComboBox.addActionListener(this);
            __fontNameComboBox.addActionListener(this);
            __fontStyleComboBox.addActionListener(this);

            y = 0;
            JGUIUtil.addComponent(panel, __textTextField, 1, y++, 1, 1, 1, 1, GridBagConstraints.NONE, GridBagConstraints.WEST);
            JGUIUtil.addComponent(panel, __xTextField, 1, y++, 1, 1, 1, 1, GridBagConstraints.NONE, GridBagConstraints.WEST);
            JGUIUtil.addComponent(panel, __yTextField, 1, y++, 1, 1, 1, 1, GridBagConstraints.NONE, GridBagConstraints.WEST);
            JGUIUtil.addComponent(panel, __textPositionComboBox, 1, y++, 1, 1, 1, 1, GridBagConstraints.NONE, GridBagConstraints.WEST);
            JGUIUtil.addComponent(panel, __fontNameComboBox, 1, y++, 1, 1, 1, 1, GridBagConstraints.NONE, GridBagConstraints.WEST);
            JGUIUtil.addComponent(panel, __fontSizeTextField, 1, y++, 1, 1, 1, 1, GridBagConstraints.NONE, GridBagConstraints.WEST);
            JGUIUtil.addComponent(panel, __fontStyleComboBox, 1, y++, 1, 1, 1, 1, GridBagConstraints.NONE, GridBagConstraints.WEST);

            if (!__editable)
            {
                __textTextField.setEditable(false);
                __xTextField.setEditable(false);
                __yTextField.setEditable(false);
                __textPositionComboBox.setEnabled(false);
                __fontNameComboBox.setEnabled(false);
                __fontSizeTextField.setEditable(false);
                __fontStyleComboBox.setEnabled(false);
            }

            __applyButton = new JButton(__BUTTON_APPLY);
            if (__editable)
            {
                __applyButton.setToolTipText("Apply changes.");
                __applyButton.addActionListener(this);
            }
            __applyButton.setEnabled(false);

            JButton cancelButton = new JButton(__BUTTON_CANCEL);

            cancelButton.setToolTipText("Discard changes and return.");
            cancelButton.addActionListener(this);

            __okButton = new JButton(__BUTTON_OK);
            __okButton.setToolTipText("Accept changes and return.");
            __okButton.setEnabled(false);
            __okButton.addActionListener(this);

            JPanel southPanel = new JPanel();

            southPanel.setLayout(new GridBagLayout());

            if (__editable)
            {
                JGUIUtil.addComponent(southPanel, __applyButton, 0, 0, 1, 1, 1, 1, 0, 10, 0, 10, GridBagConstraints.NONE, GridBagConstraints.EAST);
            }

            int space = 0;

            if (!__editable)
            {
                space = 1;
            }

            JGUIUtil.addComponent(southPanel, __okButton, 1, 0, 1, 1, space, space, 0, 10, 0, 10, GridBagConstraints.NONE, GridBagConstraints.EAST);

            if (__editable)
            {
                JGUIUtil.addComponent(southPanel, cancelButton, 2, 0, 1, 1, 0, 0, 0, 10, 0, 10, GridBagConstraints.NONE, GridBagConstraints.EAST);
            }
            else
            {
                __okButton.setEnabled(true);
            }

            getContentPane().add("Center", panel);
            getContentPane().add("South", southPanel);

            string app = JGUIUtil.getAppNameForWindows();

            if (string.ReferenceEquals(app, null) || app.Trim().Equals(""))
            {
                app = "";
            }
            else
            {
                app += " - ";
            }
            setTitle(app + "Node Properties");

            pack();
            setSize(getWidth() + 100, getHeight());
            JGUIUtil.center(this);
            setVisible(true);
        }