/// <summary>
        /// Sets up the GUI.
        /// </summary>
        private void setupGUI()
        {
            string routine = "StateMod_QueryTool_JFrame.setupGUI";

            addWindowListener(this);

            GridBagLayout gb = new GridBagLayout();

            JPanel main_JPanel = new JPanel();

            main_JPanel.setLayout(gb);
            JGUIUtil.addComponent(main_JPanel, new JLabel("Component:"), 0, 0, 1, 1, 0, 0, GridBagConstraints.NONE, GridBagConstraints.EAST);
            __component_JComboBox = new SimpleJComboBox(false);
            __component_JComboBox.add("Diversion Stations");
            JGUIUtil.addComponent(main_JPanel, __component_JComboBox, 1, 0, 2, 1, 0, 0, GridBagConstraints.NONE, GridBagConstraints.WEST);

            try
            {
                __input_filter_diversion_JPanel = new StateMod_Diversion_InputFilter_JPanel(__dataset);
                JGUIUtil.addComponent(main_JPanel, __input_filter_diversion_JPanel, 0, 1, 4, 4, 0, 0, GridBagConstraints.NONE, GridBagConstraints.WEST);
            }
            catch (Exception)
            {
                Message.printWarning(1, routine, "Unable to initialize input filter for diversion stations.");
            }
            getContentPane().add(main_JPanel);

            // add bottom buttons
            FlowLayout fl = new FlowLayout(FlowLayout.CENTER);

            JPanel buttonPanel = new JPanel();

            buttonPanel.setLayout(fl);
            __query_JButton = new SimpleJButton(__Query_String, this);
            __query_JButton.setToolTipText("Query the data set using specified criteria.");
            __display_JButton = new SimpleJButton(__Display_String, this);
            __display_JButton.setToolTipText("Display the results of the query.");
            __display_JButton.setEnabled(false);     // Enable after query.
            __cancel_JButton = new SimpleJButton(__Cancel_String, this);
            __cancel_JButton.setToolTipText("Cancel query and close window.");

            buttonPanel.add(__query_JButton);
            buttonPanel.add(__display_JButton);
            buttonPanel.add(__cancel_JButton);

            JPanel bottomJPanel = new JPanel();

            bottomJPanel.setLayout(gb);
            JGUIUtil.addComponent(bottomJPanel, buttonPanel, 0, 0, 8, 1, 1, 0, GridBagConstraints.HORIZONTAL, GridBagConstraints.CENTER);
            __message_JTextField = new JTextField();
            __message_JTextField.setText("Select filter criteria and then press Query");
            __message_JTextField.setEditable(false);
            JGUIUtil.addComponent(bottomJPanel, __message_JTextField, 0, 1, 7, 1, 1.0, 0.0, GridBagConstraints.HORIZONTAL, GridBagConstraints.WEST);
            __status_JTextField = new JTextField(5);
            __status_JTextField.setEditable(false);
            JGUIUtil.addComponent(bottomJPanel, __status_JTextField, 7, 1, 1, 1, 0.0, 0.0, GridBagConstraints.NONE, GridBagConstraints.WEST);
            getContentPane().add("South", bottomJPanel);

            if (__dataset_wm != null)
            {
                __dataset_wm.setWindowOpen(StateMod_DataSet_WindowManager.WINDOW_CONTROL, this);
            }

            pack();
            setSize(550, 190);     // Allows replacement res option to display
            JGUIUtil.center(this);
            setResizable(true);
            setVisible(true);
        }
        /// <summary>
        /// Sets up the GUI. </summary>
        /// <param name="index"> the index of the network node to preselect. </param>
        private void setupGUI(int index)
        {
            string routine = "StateMod_RiverNetworkNode_JFrame.setupGUI";

            addWindowListener(this);

            JPanel p1 = new JPanel();     // entire top half

            __searchID             = new JTextField(10);
            __searchName           = new JTextField(10);
            __findNext             = new JButton(__BUTTON_FIND_NEXT);
            __searchCriteriaGroup  = new ButtonGroup();
            __searchIDJRadioButton = new JRadioButton("ID", true);
            __searchIDJRadioButton.addActionListener(this);
            __searchCriteriaGroup.add(__searchIDJRadioButton);
            __searchNameJRadioButton = new JRadioButton("Name", false);
            __searchNameJRadioButton.addActionListener(this);
            __searchCriteriaGroup.add(__searchNameJRadioButton);

            __idJTextField = new JTextField(12);
            __idJTextField.setEditable(false);
            __nameJTextField = new JTextField(24);
            __nameJTextField.setEditable(false);
            __nodeJTextField    = new JTextField(12);
            __commentJTextField = new JTextField(24);

            __showOnMap_JButton = new SimpleJButton(__BUTTON_SHOW_ON_MAP, this);
            __showOnMap_JButton.setToolTipText("Annotate map with location (button is disabled if layer does not have matching ID)");
            __showOnNetwork_JButton = new SimpleJButton(__BUTTON_SHOW_ON_NETWORK, this);
            __showOnNetwork_JButton.setToolTipText("Annotate network with location");
            __applyJButton  = new JButton(__BUTTON_APPLY);
            __cancelJButton = new JButton(__BUTTON_CANCEL);
            __helpJButton   = new JButton(__BUTTON_HELP);
            __closeJButton  = new JButton(__BUTTON_CLOSE);

            GridBagLayout gb = new GridBagLayout();

            p1.setLayout(gb);

            int y = 0;

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

            p.add("JWorksheet.ShowPopupMenu=true");
            p.add("JWorksheet.AllowCopy=true");
            p.add("JWorksheet.SelectionMode=SingleRowSelection");

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

            try
            {
                StateMod_RiverNetworkNode_TableModel   tmr = new StateMod_RiverNetworkNode_TableModel(__riverNetworkNodesVector);
                StateMod_RiverNetworkNode_CellRenderer crr = new StateMod_RiverNetworkNode_CellRenderer(tmr);

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

                widths = crr.getColumnWidths();
            }
            catch (Exception e)
            {
                Message.printWarning(2, routine, e);
                jsw         = new JScrollWorksheet(0, 0, p);
                __worksheet = jsw.getJWorksheet();
            }
            __worksheet.setPreferredScrollableViewportSize(null);
            __worksheet.setHourglassJFrame(this);
            __worksheet.addMouseListener(this);
            __worksheet.addKeyListener(this);
            JGUIUtil.addComponent(p1, jsw, 0, y, 4, 9, 1, 1, 0, 0, 0, 0, GridBagConstraints.BOTH, GridBagConstraints.WEST);

            JGUIUtil.addComponent(p1, new JLabel("ID:"), 5, y, 1, 1, 0, 0, 0, 0, 0, 0, GridBagConstraints.NONE, GridBagConstraints.EAST);
            JGUIUtil.addComponent(p1, __idJTextField, 6, y++, 1, 1, 0, 0, 0, 0, 0, 0, GridBagConstraints.NONE, GridBagConstraints.WEST);
            JGUIUtil.addComponent(p1, new JLabel("Name:"), 5, y, 1, 1, 0, 0, 0, 0, 0, 0, GridBagConstraints.NONE, GridBagConstraints.EAST);
            JGUIUtil.addComponent(p1, __nameJTextField, 6, y++, 1, 1, 0, 0, 0, 0, 0, 0, GridBagConstraints.NONE, GridBagConstraints.WEST);
            JGUIUtil.addComponent(p1, new JLabel("Downstream Node:"), 5, y, 1, 1, 0, 0, 0, 0, 0, 0, GridBagConstraints.NONE, GridBagConstraints.EAST);
            JGUIUtil.addComponent(p1, __nodeJTextField, 6, y++, 1, 1, 0, 0, 0, 0, 0, 0, GridBagConstraints.NONE, GridBagConstraints.WEST);
            JGUIUtil.addComponent(p1, new JLabel("Comment:"), 5, y, 1, 1, 0, 0, 0, 0, 0, 0, GridBagConstraints.NONE, GridBagConstraints.EAST);
            JGUIUtil.addComponent(p1, __commentJTextField, 6, y++, 1, 1, 0, 0, 0, 0, 0, 0, GridBagConstraints.NONE, GridBagConstraints.WEST);


            //
            // add search areas
            //

            y = 10;

            JPanel searchPanel = new JPanel();

            searchPanel.setLayout(gb);
            searchPanel.setBorder(BorderFactory.createTitledBorder("Search list for:     "));
            JGUIUtil.addComponent(p1, searchPanel, 0, y, 1, 1, 0, 0, 10, 0, 0, 0, GridBagConstraints.NONE, GridBagConstraints.WEST);
            JGUIUtil.addComponent(searchPanel, __searchIDJRadioButton, 0, ++y, 1, 1, 0, 0, 5, 0, 0, 0, GridBagConstraints.NONE, GridBagConstraints.WEST);
            JGUIUtil.addComponent(searchPanel, __searchID, 1, y, 1, 1, 0, 0, 0, 0, 0, 0, GridBagConstraints.HORIZONTAL, GridBagConstraints.EAST);
            __searchID.addActionListener(this);
            JGUIUtil.addComponent(searchPanel, __searchNameJRadioButton, 0, ++y, 1, 1, 0, 0, 5, 0, 0, 0, GridBagConstraints.NONE, GridBagConstraints.WEST);
            __searchName.setEditable(false);
            JGUIUtil.addComponent(searchPanel, __searchName, 1, y, 1, 1, 0, 0, 0, 0, 0, 0, GridBagConstraints.HORIZONTAL, GridBagConstraints.EAST);
            __searchName.addActionListener(this);
            JGUIUtil.addComponent(searchPanel, __findNext, 0, ++y, 4, 1, 0, 0, 10, 0, 0, 0, GridBagConstraints.NONE, GridBagConstraints.WEST);
            __findNext.addActionListener(this);

            //
            // add close and help buttons
            //
            JPanel     pfinal = new JPanel();
            FlowLayout fl     = new FlowLayout(FlowLayout.RIGHT);

            pfinal.setLayout(fl);
            __helpJButton.setEnabled(false);
            pfinal.add(__showOnMap_JButton);
            pfinal.add(__showOnNetwork_JButton);
            if (__editable)
            {
                pfinal.add(__applyJButton);
                pfinal.add(__cancelJButton);
            }
            pfinal.add(__closeJButton);
            //	pfinal.add(__helpJButton);
            __applyJButton.addActionListener(this);
            __cancelJButton.addActionListener(this);
            __helpJButton.addActionListener(this);
            __closeJButton.addActionListener(this);
            getContentPane().add("Center", p1);
            getContentPane().add("South", pfinal);

            initializeDisables();

            selectTableIndex(index);

            if (__dataset_wm != null)
            {
                __dataset_wm.setWindowOpen(StateMod_DataSet_WindowManager.WINDOW_RIVER_NETWORK, this);
            }

            pack();
            setSize(690, 400);
            JGUIUtil.center(this);
            setVisible(true);

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

            __worksheet.addSortListener(this);
        }
예제 #3
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);
        }
예제 #4
0
        /// <summary>
        /// Sets up the GUI.
        /// </summary>
        private void setupGUI()
        {
            string routine = "StateMod_Response_JFrame.setupGUI";

            addWindowListener(this);

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

            p.add("JWorksheet.ShowPopupMenu=true");
            p.add("JWorksheet.AllowCopy=true");
            p.add("JWorksheet.SelectionMode=SingleRowSelection");

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

            try
            {
                // Operate on a copy of the table model...
                __tableModel = new StateMod_Response_TableModel(__dataset_copy);
                StateMod_Response_CellRenderer crr = new StateMod_Response_CellRenderer(__tableModel);

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

                __tableModel.setWorksheet(__worksheet);

                widths = crr.getColumnWidths();
            }
            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.addMouseListener(this);
            __worksheet.addKeyListener(this);
            __worksheet.setHourglassJFrame(this);

            /* TODO SAM 2007-03-01 Evaluate logic
             * boolean renameAllowed = false;
             * if (__tableModel != null) {
             *      renameAllowed = true;
             * }
             */

            JPanel top_panel = new JPanel();

            top_panel.setLayout(new GridBagLayout());
            int y = 0;

            JGUIUtil.addComponent(top_panel, new JLabel("To rename a data set component, select a row and " + "either type a new file name or use the Browse button."), 0, y++, 2, 1, 0, 0, GridBagConstraints.NONE, GridBagConstraints.NORTHWEST);

            JGUIUtil.addComponent(top_panel, new JLabel("If ARE DATA MODIFIED? is YES, data for the " + "component have been modified by the GUI but the file has not been written."), 0, y++, 2, 1, 0, 0, GridBagConstraints.NONE, GridBagConstraints.NORTHWEST);

            JGUIUtil.addComponent(top_panel, new JLabel("Consequently, StateMod will not recognize the " + "changes until the data are saved with File...Save."), 0, y++, 2, 1, 0, 0, GridBagConstraints.NONE, GridBagConstraints.NORTHWEST);

            JGUIUtil.addComponent(top_panel, new JLabel("If a filename is changed, the file with the original filename will remain " + "even after the new file is saved."), 0, y++, 2, 1, 0, 0, GridBagConstraints.NONE, GridBagConstraints.NORTHWEST);

            JGUIUtil.addComponent(top_panel, new JLabel("Data set base name (from *.rsp):  "), 0, y, 1, 1, 0, 0, GridBagConstraints.NONE, GridBagConstraints.NORTHEAST);
            JGUIUtil.addComponent(top_panel, new JLabel(__dataset.getBaseName()), 1, y++, 1, 1, 1, 1, GridBagConstraints.BOTH, GridBagConstraints.NORTHWEST);
            JGUIUtil.addComponent(top_panel, new JLabel("Data set directory:  "), 0, y, 1, 1, 0, 0, GridBagConstraints.NONE, GridBagConstraints.NORTHEAST);
            JGUIUtil.addComponent(top_panel, new JLabel(__dataset.getDataSetDirectory()), 1, y++, 1, 1, 1, 1, GridBagConstraints.BOTH, GridBagConstraints.NORTHWEST);

            getContentPane().add("North", top_panel);

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

            JPanel button_panel = new JPanel();

            __browse_JButton = new SimpleJButton(__BUTTON_BROWSE, this);
            __browse_JButton.setEnabled(false);
            __browse_JButton.setToolTipText("Select an existing file.");
            button_panel.add(__browse_JButton);
            __apply_JButton = new SimpleJButton(__BUTTON_APPLY, this);
            //__apply_JButton.setEnabled(false);
            __apply_JButton.setToolTipText("Set the file names.  File...Save is still required to save files.");
            button_panel.add(__apply_JButton);
            __cancel_JButton = new SimpleJButton(__BUTTON_CANCEL, this);
            __cancel_JButton.setToolTipText("Cancel file name changes.");
            button_panel.add(__cancel_JButton);
            __close_JButton = new SimpleJButton(__BUTTON_CLOSE, this);
            __close_JButton.setToolTipText("Apply file name changes and close " + "window.  File...Save is still required to save files.");
            //__close_JButton.setEnabled (false);
            button_panel.add(__close_JButton);
            //__help_JButton = new SimpleJButton(__BUTTON_HELP, this);
            //__help_JButton.setEnabled(false);
            //button_panel.add(__help_JButton);

            JPanel bottom_panel = new JPanel();

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

            pack();

            if (__dataset_wm != null)
            {
                __dataset_wm.setWindowOpen(StateMod_DataSet_WindowManager.WINDOW_RESPONSE, this);
            }

            setSize(700, 500);
            JGUIUtil.center(this);

            setVisible(true);

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