예제 #1
0
        /// <summary>
        /// Sets up the GUI.
        /// </summary>
        private void setupGUI()
        {
            string routine = "StateMod_Save_JDialog.setupGUI";

            addWindowListener(this);

            PropList p = new PropList("StateMod_Save_JDialog.JWorksheet");

            /*
             * p.add("JWorksheet.CellFont=Courier");
             * p.add("JWorksheet.CellStyle=Plain");
             * p.add("JWorksheet.CellSize=11");
             * p.add("JWorksheet.HeaderFont=Arial");
             * p.add("JWorksheet.HeaderStyle=Plain");
             * p.add("JWorksheet.HeaderSize=11");
             * p.add("JWorksheet.HeaderBackground=LightGray");
             * p.add("JWorksheet.RowColumnPresent=false");
             */
            p.add("JWorksheet.ShowPopupMenu=true");
            p.add("JWorksheet.SelectionMode=MultipleDiscontinuousRowSelection");

            int[]            widths = null;
            JScrollWorksheet jsw    = null;

            try
            {
                __tableModel = new StateMod_Save_TableModel(__dataset);
                StateMod_Save_CellRenderer crr = new StateMod_Save_CellRenderer(__tableModel);

                jsw         = new JScrollWorksheet(crr, __tableModel, p);
                __worksheet = jsw.getJWorksheet();

                widths = crr.getColumnWidths();
                // Select all the rows initially...
                __worksheet.selectAllRows();
            }
            catch (Exception e)
            {
                Message.printWarning(1, routine, "Error building worksheet.");
                Message.printWarning(2, routine, e);
                jsw         = new JScrollWorksheet(0, 0, p);
                __worksheet = jsw.getJWorksheet();
            }
            __worksheet.setPreferredScrollableViewportSize(null);
            __worksheet.setHourglassJFrame(__parent);

            __helpButton = new SimpleJButton(__BUTTON_HELP, this);
            __helpButton.setEnabled(false);
            __saveButton = new SimpleJButton(__BUTTON_SAVE, this);
            __saveButton.setToolTipText("Save data to file(s).");
            __cancelButton = new SimpleJButton(__BUTTON_CANCEL, this);
            __cancelButton.setToolTipText("Cancel without saving data to file(s).");

            JPanel panel = new JPanel();

            panel.setLayout(new GridBagLayout());
            JGUIUtil.addComponent(panel, new JLabel("Data from the following files have been modified."), 0, 0, 2, 1, 1, 1, 0, 0, 0, 0, GridBagConstraints.NONE, GridBagConstraints.NORTHWEST);
            JGUIUtil.addComponent(panel, new JLabel("Select files to be saved and press the \"Save Selected Files\" button."), 0, 1, 2, 1, 1, 1, 0, 0, 0, 0, GridBagConstraints.NONE, GridBagConstraints.NORTHWEST);
            JGUIUtil.addComponent(panel, new JLabel("To change the filenames, use the Data...Control...Response menu"), 0, 2, 2, 1, 1, 1, 0, 0, 0, 0, GridBagConstraints.NONE, GridBagConstraints.NORTHWEST);
            JGUIUtil.addComponent(panel, new JLabel("Data set base name (from *.rsp):  "), 0, 3, 1, 1, 0, 0, 0, 0, 0, 0, GridBagConstraints.NONE, GridBagConstraints.NORTHEAST);
            JGUIUtil.addComponent(panel, new JLabel(__dataset.getBaseName()), 1, 3, 1, 1, 1, 1, 0, 0, 0, 0, GridBagConstraints.BOTH, GridBagConstraints.NORTHWEST);
            JGUIUtil.addComponent(panel, new JLabel("Data set directory:  "), 0, 4, 1, 1, 0, 0, 0, 0, 0, 0, GridBagConstraints.NONE, GridBagConstraints.NORTHEAST);
            JGUIUtil.addComponent(panel, new JLabel(__dataset.getDataSetDirectory()), 1, 4, 1, 1, 1, 1, 0, 0, 0, 0, GridBagConstraints.BOTH, GridBagConstraints.NORTHWEST);

            __updateCheckbox = new JCheckBox((string)null, true);
            JGUIUtil.addComponent(panel, __updateCheckbox, 0, 6, 1, 1, 0, 0, 0, 0, 0, 0, GridBagConstraints.NONE, GridBagConstraints.NORTHEAST);
            JGUIUtil.addComponent(panel, new JLabel("Carry forward old file comments?"), 1, 6, 1, 1, 0, 0, 0, 0, 0, 0, GridBagConstraints.NONE, GridBagConstraints.NORTHWEST);

            getContentPane().add("North", panel);
            getContentPane().add("Center", jsw);

            JPanel button_panel = new JPanel();

            button_panel.add(__saveButton);
            button_panel.add(__cancelButton);
            //	button_panel.add(__helpButton);

            JPanel bottom_panel = new JPanel();

            bottom_panel.setLayout(new BorderLayout());
            getContentPane().add("South", bottom_panel);
            bottom_panel.add("South", button_panel);

            pack();
            setSize(700, 500);

            JGUIUtil.center(this);

            if (widths != null)
            {
                __worksheet.setColumnWidths(widths, __parent.getGraphics());
            }

            setVisible(true);
        }