コード例 #1
0
        /// <summary>
        /// Sets up the GUI.
        /// </summary>
        private void setupGUI()
        {
            __xdgSimpleJComboBox = new SimpleJComboBox();

//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @SuppressWarnings("unchecked") java.util.List<StateMod_Diversion> diversionsVector = (java.util.List<StateMod_Diversion>) __dataset.getComponentForComponentType(StateMod_DataSet.COMP_DIVERSION_STATIONS).getData();
            IList <StateMod_Diversion> diversionsVector = (IList <StateMod_Diversion>)__dataset.getComponentForComponentType(StateMod_DataSet.COMP_DIVERSION_STATIONS).getData();
            IList <string>             list_names       = StateMod_Util.createIdentifierListFromStateModData(diversionsVector, true, null);
            int size = list_names.Count;

            for (int i = 0; i < size; i++)
            {
                __xdgSimpleJComboBox.add(list_names[i] + " - Diversion");
            }

//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @SuppressWarnings("unchecked") java.util.List<StateMod_InstreamFlow> instreamFlowsVector = (java.util.List<StateMod_InstreamFlow>) __dataset.getComponentForComponentType(StateMod_DataSet.COMP_INSTREAM_STATIONS).getData();
            IList <StateMod_InstreamFlow> instreamFlowsVector = (IList <StateMod_InstreamFlow>)__dataset.getComponentForComponentType(StateMod_DataSet.COMP_INSTREAM_STATIONS).getData();

            list_names = StateMod_Util.createIdentifierListFromStateModData(instreamFlowsVector, true, null);
            size       = list_names.Count;
            for (int i = 0; i < size; i++)
            {
                __xdgSimpleJComboBox.add(list_names[i] + " - Instream Flow");
            }

//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @SuppressWarnings("unchecked") java.util.List<StateMod_StreamGage> gageVector = (java.util.List<StateMod_StreamGage>) __dataset.getComponentForComponentType(StateMod_DataSet.COMP_STREAMGAGE_STATIONS).getData();
            IList <StateMod_StreamGage> gageVector = (IList <StateMod_StreamGage>)__dataset.getComponentForComponentType(StateMod_DataSet.COMP_STREAMGAGE_STATIONS).getData();

            list_names = StateMod_Util.createIdentifierListFromStateModData(gageVector, true, null);
            size       = list_names.Count;
            for (int i = 0; i < size; i++)
            {
                __xdgSimpleJComboBox.add(list_names[i] + " - Stream Gage");
            }

//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @SuppressWarnings("unchecked") java.util.List<StateMod_StreamEstimate> estimateVector = (java.util.List<StateMod_StreamEstimate>) __dataset.getComponentForComponentType(StateMod_DataSet.COMP_STREAMESTIMATE_STATIONS).getData();
            IList <StateMod_StreamEstimate> estimateVector = (IList <StateMod_StreamEstimate>)__dataset.getComponentForComponentType(StateMod_DataSet.COMP_STREAMESTIMATE_STATIONS).getData();

            list_names = StateMod_Util.createIdentifierListFromStateModData(estimateVector, true, null);
            size       = list_names.Count;
            for (int i = 0; i < size; i++)
            {
                __xdgSimpleJComboBox.add(list_names[i] + " - Stream Estimate");
            }

//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @SuppressWarnings("unchecked") java.util.List<StateMod_Reservoir> reservoirsVector = (java.util.List<StateMod_Reservoir>) __dataset.getComponentForComponentType(StateMod_DataSet.COMP_RESERVOIR_STATIONS).getData();
            IList <StateMod_Reservoir> reservoirsVector = (IList <StateMod_Reservoir>)__dataset.getComponentForComponentType(StateMod_DataSet.COMP_RESERVOIR_STATIONS).getData();

            list_names           = StateMod_Util.createIdentifierListFromStateModData(reservoirsVector, true, null);
            size                 = list_names.Count;
            __xrgSimpleJComboBox = new SimpleJComboBox();
            for (int i = 0; i < size; i++)
            {
                __xrgSimpleJComboBox.add(list_names[i] + " - Reservoir");
            }

//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @SuppressWarnings("unchecked") java.util.List<StateMod_Well> wellsVector = (java.util.List<StateMod_Well>) __dataset.getComponentForComponentType(StateMod_DataSet.COMP_WELL_STATIONS).getData();
            IList <StateMod_Well> wellsVector = (IList <StateMod_Well>)__dataset.getComponentForComponentType(StateMod_DataSet.COMP_WELL_STATIONS).getData();

            list_names           = StateMod_Util.createIdentifierListFromStateModData(wellsVector, true, null);
            size                 = list_names.Count;
            __xwgSimpleJComboBox = new SimpleJComboBox();
            for (int i = 0; i < size; i++)
            {
                __xwgSimpleJComboBox.add(list_names[i] + " - Well");
            }

            // Define the button groups and add radio buttons to the group in the
            // order of the GUI...

            __general_ButtonGroup = new ButtonGroup();
            __general_ButtonGroup.add(__xstJRadioButton = new JRadioButton("-xst", false));
            __general_ButtonGroup.add(__xwbJRadioButton = new JRadioButton("-xwb", true));
            __general_ButtonGroup.add(__xwrJRadioButton = new JRadioButton("-xwr", false));
            __general_ButtonGroup.add(__xcuJRadioButton = new JRadioButton("-xcu", false));
            __compare_ButtonGroup = new ButtonGroup();
            __compare_ButtonGroup.add(__xdcJRadioButton = new JRadioButton("-xdc", true));
            __compare_ButtonGroup.add(__xrcJRadioButton = new JRadioButton("-xrc", false));
            __compare_ButtonGroup.add(__xwcJRadioButton = new JRadioButton("-xwc", false));
            __compare_ButtonGroup.add(__xscJRadioButton = new JRadioButton("-xsc", false));
            __graph_ButtonGroup = new ButtonGroup();
            __graph_ButtonGroup.add(__xdgJRadioButton = new JRadioButton("-xdg", true));
            __graph_ButtonGroup.add(__xrgJRadioButton = new JRadioButton("-xrg", false));
            __graph_ButtonGroup.add(__xwgJRadioButton = new JRadioButton("-xwg", false));
            __daily_ButtonGroup = new ButtonGroup();
            __daily_ButtonGroup.add(__xdyJRadioButton = new JRadioButton("-xdy", true));
            __daily_ButtonGroup.add(__xryJRadioButton = new JRadioButton("-xry", false));
            __daily_ButtonGroup.add(__xwyJRadioButton = new JRadioButton("-xwy", false));
            __other_ButtonGroup = new ButtonGroup();
            __other_ButtonGroup.add(__xnmJRadioButton = new JRadioButton("-xnm", true));
            __other_ButtonGroup.add(__xrxJRadioButton = new JRadioButton("-xrx", false));
            __other_ButtonGroup.add(__xspJRadioButton = new JRadioButton("-xsp", false));
            __other_ButtonGroup.add(__xbnJRadioButton = new JRadioButton("-xbn", false));

            // Set the selected item in the graph output, based on whether data
            // exists...

            bool something_selected = false;     // To help select a radio button

            if (__xdgSimpleJComboBox.getItemCount() == 0)
            {
                __xdgSimpleJComboBox.setEnabled(false);
            }
            else
            {
                __xdgSimpleJComboBox.select(0);
                __xdgJRadioButton.setSelected(true);
                something_selected = true;
            }
            if (__xrgSimpleJComboBox.getItemCount() == 0)
            {
                __xrgSimpleJComboBox.setEnabled(false);
            }
            else
            {
                __xrgSimpleJComboBox.select(0);
                if (!something_selected)
                {
                    __xrgJRadioButton.setSelected(true);
                    something_selected = true;
                }
            }
            if (__xwgSimpleJComboBox.getItemCount() == 0)
            {
                __xwgSimpleJComboBox.setEnabled(false);
            }
            else
            {
                __xwgSimpleJComboBox.select(0);
                if (!something_selected)
                {
                    __xwgJRadioButton.setSelected(true);
                }
            }

            __runStateModJButton = new JButton(__BUTTON_RUN_REPORT);
            __cancelJButton      = new JButton(__BUTTON_CANCEL);
            // REVISIT - enable when full help system is redesigned
            //__helpJButton = new JButton(__BUTTON_HELP);

            GridBagLayout gb        = new GridBagLayout();
            JPanel        mainPanel = new JPanel();

            mainPanel.setLayout(gb);

            int col1 = 0;
            int col2 = 1;
            int col3 = 2;
            int y;
            int bound = 2;     // buffer around components.

            __main_JTabbedPane = new JTabbedPane();

            __general_JPanel = new JPanel();
            __general_JPanel.setLayout(gb);
            __compare_JPanel = new JPanel();
            __compare_JPanel.setLayout(gb);
            __graph_JPanel = new JPanel();
            __graph_JPanel.setLayout(gb);
            __daily_JPanel = new JPanel();
            __daily_JPanel.setLayout(gb);
            __other_JPanel = new JPanel();
            __other_JPanel.setLayout(gb);

            /////////////////////////////////////////////////////////////
            // general panel
            /////////////////////////////////////////////////////////////
            y = 0;
            JGUIUtil.addComponent(__general_JPanel, new JLabel("Select one of the following report options." + "  Output files will have the extensions shown."), col1, y, 3, 1, 0, 0, 0, 0, bound, 0, GridBagConstraints.NONE, GridBagConstraints.WEST);
            JGUIUtil.addComponent(__general_JPanel, __xstJRadioButton, col1, ++y, 1, 1, 0, 0, 0, 0, 0, 0, GridBagConstraints.NONE, GridBagConstraints.WEST);
            __xstJLabel1 = new JLabel("Direct and Instream Flow Data (*.xdd)");
            __xstJLabel1.addMouseListener(this);
            JGUIUtil.addComponent(__general_JPanel, __xstJLabel1, col2, y, 1, 1, 0, 0, 0, bound, 0, 0, GridBagConstraints.NONE, GridBagConstraints.WEST);
            __xstJLabel2 = new JLabel("Reservoir Data - Total and by Account " + "(*.xre)");
            __xstJLabel2.addMouseListener(this);
            JGUIUtil.addComponent(__general_JPanel, __xstJLabel2, col2, ++y, 1, 1, 0, 0, 0, bound, 0, 0, GridBagConstraints.NONE, GridBagConstraints.WEST);
            __xstJLabel3 = new JLabel("Operation Right Summary (*.xop)");
            __xstJLabel3.addMouseListener(this);
            JGUIUtil.addComponent(__general_JPanel, __xstJLabel3, col2, ++y, 1, 1, 0, 0, 0, bound, 0, 0, GridBagConstraints.NONE, GridBagConstraints.WEST);
            __xstJLabel4 = new JLabel("Instream Flow Reach Summary (*.xir)");
            __xstJLabel4.addMouseListener(this);
            JGUIUtil.addComponent(__general_JPanel, __xstJLabel4, col2, ++y, 1, 1, 0, 0, 0, bound, 0, 0, GridBagConstraints.NONE, GridBagConstraints.WEST);
            __xstJLabel5 = new JLabel("Well Summary (*.xwe)");
            __xstJLabel5.addMouseListener(this);
            JGUIUtil.addComponent(__general_JPanel, __xstJLabel5, col2, ++y, 1, 1, 0, 0, 0, bound, 0, 0, GridBagConstraints.NONE, GridBagConstraints.WEST);

            JGUIUtil.addComponent(__general_JPanel, __xwbJRadioButton, col1, ++y, 1, 1, 0, 0, 0, 0, 0, 0, GridBagConstraints.NONE, GridBagConstraints.WEST);
            __xwbJLabel = new JLabel("Water balance (*.xwb) and " + "Ground Water Balance (*.xgw)");
            __xwbJLabel.addMouseListener(this);
            JGUIUtil.addComponent(__general_JPanel, __xwbJLabel, col2, y, 1, 1, 0, 0, 0, bound, 0, 0, GridBagConstraints.NONE, GridBagConstraints.WEST);

            JGUIUtil.addComponent(__general_JPanel, __xwrJRadioButton, col1, ++y, 1, 1, 0, 0, 0, 0, 0, 0, GridBagConstraints.NONE, GridBagConstraints.WEST);
            __xwrJLabel = new JLabel("Water rights list, sorted by basin " + "rank (*.xwr)");
            __xwrJLabel.addMouseListener(this);
            JGUIUtil.addComponent(__general_JPanel, __xwrJLabel, col2, y, 1, 1, 0, 0, 0, bound, 0, 0, GridBagConstraints.NONE, GridBagConstraints.WEST);

            JGUIUtil.addComponent(__general_JPanel, __xcuJRadioButton, col1, ++y, 1, 1, 0, 0, 0, 0, 0, 0, GridBagConstraints.NONE, GridBagConstraints.WEST);
            __xcuJLabel1 = new JLabel("Simulated Diversions and " + "Consumptive Use (*.xcu)");
            __xcuJLabel1.addMouseListener(this);
            JGUIUtil.addComponent(__general_JPanel, __xcuJLabel1, col2, y, 1, 1, 0, 0, 0, bound, 0, 0, GridBagConstraints.NONE, GridBagConstraints.WEST);
            __xcuJLabel2 = new JLabel("Water supply summary (*.xsu)");
            __xcuJLabel2.addMouseListener(this);
            JGUIUtil.addComponent(__general_JPanel, __xcuJLabel2, col2, ++y, 1, 1, 0, 0, 0, bound, 0, 0, GridBagConstraints.NONE, GridBagConstraints.WEST);
            __xcuJLabel3 = new JLabel("Shortage Summary (*.xsh)");
            __xcuJLabel3.addMouseListener(this);
            JGUIUtil.addComponent(__general_JPanel, __xcuJLabel3, col2, ++y, 1, 1, 0, 0, 0, bound, 0, 0, GridBagConstraints.NONE, GridBagConstraints.WEST);
            __xcuJLabel4 = new JLabel("CU by Water District (*.xwd)");
            __xcuJLabel4.addMouseListener(this);
            JGUIUtil.addComponent(__general_JPanel, __xcuJLabel4, col2, ++y, 1, 1, 0, 0, 0, bound, 0, 0, GridBagConstraints.NONE, GridBagConstraints.WEST);

            /////////////////////////////////////////////////////////////
            // compare panel
            /////////////////////////////////////////////////////////////
            y = 0;
            JGUIUtil.addComponent(__compare_JPanel, new JLabel("Select one of the following report options." + "  Output files will have the extensions shown."), col1, y, 3, 1, 0, 0, 0, 0, bound, 0, GridBagConstraints.NONE, GridBagConstraints.WEST);

            JGUIUtil.addComponent(__compare_JPanel, __xdcJRadioButton, col1, ++y, 1, 1, 0, 0, 0, 0, 0, 0, GridBagConstraints.NONE, GridBagConstraints.WEST);
            __xdcJLabel = new JLabel("Diversion comparison (*.xdc)");
            __xdcJLabel.addMouseListener(this);
            JGUIUtil.addComponent(__compare_JPanel, __xdcJLabel, col2, y, 1, 1, 0, 0, 0, bound, 0, 0, GridBagConstraints.NONE, GridBagConstraints.WEST);

            JGUIUtil.addComponent(__compare_JPanel, __xrcJRadioButton, col1, ++y, 1, 1, 0, 0, 0, 0, 0, 0, GridBagConstraints.NONE, GridBagConstraints.WEST);
            __xrcJLabel = new JLabel("Reservoir comparison (*.xrc)");
            __xrcJLabel.addMouseListener(this);
            JGUIUtil.addComponent(__compare_JPanel, __xrcJLabel, col2, y, 1, 1, 0, 0, 0, bound, 0, 0, GridBagConstraints.NONE, GridBagConstraints.WEST);

            JGUIUtil.addComponent(__compare_JPanel, __xwcJRadioButton, col1, ++y, 1, 1, 0, 0, 0, 0, 0, 0, GridBagConstraints.NONE, GridBagConstraints.WEST);
            __xwcJLabel = new JLabel("Well comparison (*.xwc)");
            __xwcJLabel.addMouseListener(this);
            JGUIUtil.addComponent(__compare_JPanel, __xwcJLabel, col2, y, 1, 1, 0, 0, 0, bound, 0, 0, GridBagConstraints.NONE, GridBagConstraints.WEST);

            JGUIUtil.addComponent(__compare_JPanel, __xscJRadioButton, col1, ++y, 1, 1, 0, 0, 0, 0, 0, 0, GridBagConstraints.NONE, GridBagConstraints.WEST);
            __xscJLabel = new JLabel("Stream flow gage comparison (*.xsc)");
            __xscJLabel.addMouseListener(this);
            JGUIUtil.addComponent(__compare_JPanel, __xscJLabel, col2, y, 1, 1, 0, 0, 0, bound, 0, 0, GridBagConstraints.NONE, GridBagConstraints.WEST);

            /////////////////////////////////////////////////////////////
            // graph panel
            /////////////////////////////////////////////////////////////
            y = 0;
            JGUIUtil.addComponent(__graph_JPanel, new JLabel("Select one of the following report options." + "  Output files will have the extensions shown."), col1, y, 3, 1, 0, 0, 0, 0, bound, 0, GridBagConstraints.NONE, GridBagConstraints.WEST);

            JGUIUtil.addComponent(__graph_JPanel, __xdgJRadioButton, col1, ++y, 1, 1, 0, 0, 0, 0, 0, 0, GridBagConstraints.NONE, GridBagConstraints.WEST);
            JGUIUtil.addComponent(__graph_JPanel, __xdgSimpleJComboBox, col2, y, 1, 1, 0, 0, 0, 0, 0, 0, GridBagConstraints.BOTH, GridBagConstraints.WEST);
            __xdgSimpleJComboBox.addMouseListener(this);
            __xdgJLabel = new JLabel("Direct diversion, instream flow and " + "gage graph (*.xdg)");
            __xdgJLabel.addMouseListener(this);
            JGUIUtil.addComponent(__graph_JPanel, __xdgJLabel, col3, y, 1, 1, 0, 0, 0, bound, 0, 0, GridBagConstraints.NONE, GridBagConstraints.WEST);

            JGUIUtil.addComponent(__graph_JPanel, __xrgJRadioButton, col1, ++y, 1, 1, 0, 0, 0, 0, 0, 0, GridBagConstraints.NONE, GridBagConstraints.WEST);
            JGUIUtil.addComponent(__graph_JPanel, __xrgSimpleJComboBox, col2, y, 1, 1, 0, 0, 0, 0, 0, 0, GridBagConstraints.BOTH, GridBagConstraints.WEST);
            __xrgSimpleJComboBox.addMouseListener(this);
            __xrgJLabel = new JLabel("Reservoir graph (*.xrg)");
            __xrgJLabel.addMouseListener(this);
            JGUIUtil.addComponent(__graph_JPanel, __xrgJLabel, col3, y, 1, 1, 0, 0, 0, bound, 0, 0, GridBagConstraints.NONE, GridBagConstraints.WEST);

            JGUIUtil.addComponent(__graph_JPanel, __xwgJRadioButton, col1, ++y, 1, 1, 0, 0, 0, 0, 0, 0, GridBagConstraints.NONE, GridBagConstraints.WEST);
            JGUIUtil.addComponent(__graph_JPanel, __xwgSimpleJComboBox, col2, y, 1, 1, 0, 0, 0, 0, 0, 0, GridBagConstraints.BOTH, GridBagConstraints.WEST);
            __xwgSimpleJComboBox.addMouseListener(this);
            __xwgJLabel = new JLabel("Well graph (*.xwg)");
            __xwgJLabel.addMouseListener(this);
            JGUIUtil.addComponent(__graph_JPanel, __xwgJLabel, col3, y, 1, 1, 0, 0, 0, bound, 0, 0, GridBagConstraints.NONE, GridBagConstraints.WEST);


            /////////////////////////////////////////////////////////////
            // daily panel
            /////////////////////////////////////////////////////////////
            y = 0;
            JGUIUtil.addComponent(__daily_JPanel, new JLabel("Select one of the following report options." + "  Output files will have the extensions shown."), col1, y, 3, 1, 0, 0, 0, 0, bound, 0, GridBagConstraints.NONE, GridBagConstraints.WEST);

            JGUIUtil.addComponent(__daily_JPanel, __xdyJRadioButton, col1, ++y, 1, 1, 0, 0, 0, 0, 0, 0, GridBagConstraints.NONE, GridBagConstraints.WEST);
            __xdyJLabel = new JLabel("Daily Direct Diversion and Instream Flow Data" + " (*.xdy)");
            __xdyJLabel.addMouseListener(this);
            JGUIUtil.addComponent(__daily_JPanel, __xdyJLabel, col2, y, 1, 1, 0, 0, 0, bound, 0, 0, GridBagConstraints.NONE, GridBagConstraints.WEST);

            JGUIUtil.addComponent(__daily_JPanel, __xryJRadioButton, col1, ++y, 1, 1, 0, 0, 0, 0, 0, 0, GridBagConstraints.NONE, GridBagConstraints.WEST);
            __xryJLabel = new JLabel("Daily Reservoir Data (*.xry)");
            __xryJLabel.addMouseListener(this);
            JGUIUtil.addComponent(__daily_JPanel, __xryJLabel, col2, y, 1, 1, 0, 0, 0, bound, 0, 0, GridBagConstraints.NONE, GridBagConstraints.WEST);

            JGUIUtil.addComponent(__daily_JPanel, __xwyJRadioButton, col1, ++y, 1, 1, 0, 0, 0, 0, 0, 0, GridBagConstraints.NONE, GridBagConstraints.WEST);
            __xwyJLabel = new JLabel("Daily Well Data (*.xwy)");
            __xwyJLabel.addMouseListener(this);
            JGUIUtil.addComponent(__daily_JPanel, __xwyJLabel, col2, y, 1, 1, 0, 0, 0, bound, 0, 0, GridBagConstraints.NONE, GridBagConstraints.WEST);

            /////////////////////////////////////////////////////////////
            // other panel
            /////////////////////////////////////////////////////////////
            y = 0;
            JGUIUtil.addComponent(__other_JPanel, new JLabel("Select one of the following report options." + "  Output files will have the extensions shown."), col1, y, 3, 1, 0, 0, 0, 0, bound, 0, GridBagConstraints.NONE, GridBagConstraints.WEST);

            JGUIUtil.addComponent(__other_JPanel, __xnmJRadioButton, col1, ++y, 1, 1, 0, 0, 0, 0, 0, 0, GridBagConstraints.NONE, GridBagConstraints.WEST);
            __xnmJLabel1 = new JLabel("Detailed Node Accounting, monthly (*.xnm) and ");
            __xnmJLabel1.addMouseListener(this);
            JGUIUtil.addComponent(__other_JPanel, __xnmJLabel1, col3, y, 1, 1, 0, 0, 0, bound, 0, 0, GridBagConstraints.NONE, GridBagConstraints.WEST);
            __xnmJLabel2 = new JLabel("Summary Node Accounting, average (*.xna)");
            __xnmJLabel2.addMouseListener(this);
            JGUIUtil.addComponent(__other_JPanel, __xnmJLabel2, col3, ++y, 1, 1, 0, 0, 0, bound, 0, 0, GridBagConstraints.NONE, GridBagConstraints.WEST);

            JGUIUtil.addComponent(__other_JPanel, __xrxJRadioButton, col1, ++y, 1, 1, 0, 0, 0, 0, 0, 0, GridBagConstraints.NONE, GridBagConstraints.WEST);
            __xrxJLabel = new JLabel("River data summary (*.xrx)");
            __xrxJLabel.addMouseListener(this);
            JGUIUtil.addComponent(__other_JPanel, __xrxJLabel, col3, y, 1, 1, 0, 0, 0, bound, 0, 0, GridBagConstraints.NONE, GridBagConstraints.WEST);

            JGUIUtil.addComponent(__other_JPanel, __xspJRadioButton, col1, ++y, 1, 1, 0, 0, 0, 0, 0, 0, GridBagConstraints.NONE, GridBagConstraints.WEST);
            __xspJLabel = new JLabel("Selected parameter printout," + " uses output control file (*.xsp)");
            __xspJLabel.addMouseListener(this);
            JGUIUtil.addComponent(__other_JPanel, __xspJLabel, col3, y, 1, 1, 0, 0, 0, bound, 0, 0, GridBagConstraints.NONE, GridBagConstraints.WEST);

            JGUIUtil.addComponent(__other_JPanel, __xbnJRadioButton, col1, ++y, 1, 1, 0, 0, 0, 0, 0, 0, GridBagConstraints.NONE, GridBagConstraints.WEST);
            __xbnJLabel = new JLabel("ASCII listing of Binary Direct and " + "Instream Data (*.xbn)");
            __xbnJLabel.addMouseListener(this);
            JGUIUtil.addComponent(__other_JPanel, __xbnJLabel, col3, y, 1, 1, 0, 0, 0, bound, 0, 0, GridBagConstraints.NONE, GridBagConstraints.WEST);

            __main_JTabbedPane.add("General", __general_JPanel);
            __main_JTabbedPane.add("Compare", __compare_JPanel);
            __main_JTabbedPane.add("Graph", __graph_JPanel);
            __main_JTabbedPane.add("Daily", __daily_JPanel);
            __main_JTabbedPane.add("Other", __other_JPanel);

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

            // add buttons
            JPanel p1 = new JPanel();

            p1.add(__runStateModJButton);
            p1.add(__cancelJButton);
            // REVISIT - add when full help system is redesigned.
            //p1.add(__helpJButton);
            //__helpJButton.setEnabled(false);
            //__helpJButton.addActionListener(this);
            __runStateModJButton.addActionListener(this);
            __cancelJButton.addActionListener(this);

            getContentPane().add("South", p1);

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

            pack();
            JGUIUtil.center(this);
            setVisible(true);
        }
コード例 #2
0
        /// <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>
        private void setupGUI()
        {
            addWindowListener(this);

            __descriptionTextField = new JTextField(25);
            __origDesc             = __nodes[__nodeNum].getDescription();
            __descriptionTextField.setText(__origDesc);
            __idTextField = new JTextField(10);
            __origID      = __nodes[__nodeNum].getCommonID();
            __idTextField.setText(__origID);
            __idTextField.addKeyListener(this);
            __xTextField = new JTextField(10);
            __origX      = StringUtil.formatString(__nodes[__nodeNum].getX(), "%13.6f").Trim();
            __xTextField.setText(__origX);
            __xTextField.addKeyListener(this);
            __yTextField = new JTextField(10);
            __origY      = StringUtil.formatString(__nodes[__nodeNum].getY(), "%13.6f").Trim();
            __yTextField.setText(__origY);
            __yTextField.addKeyListener(this);
            __areaTextField = new JTextField(10);
            __origArea      = StringUtil.formatString(__nodes[__nodeNum].getArea(), "%13.6f").Trim();
            __areaTextField.setText(__origArea);
            __areaTextField.addKeyListener(this);
            __precipitationTextField = new JTextField(10);
            __origPrecipitation      = StringUtil.formatString(__nodes[__nodeNum].getPrecip(), "%13.6f").Trim();
            __precipitationTextField.setText(__origPrecipitation);
            __precipitationTextField.addKeyListener(this);

            __typeComboBox = new SimpleJComboBox(false);
            __typeComboBox.add(__NODE_DIVERSION);
            __typeComboBox.add(__NODE_DIVERSION_AND_WELL);
            __typeComboBox.add(__NODE_INSTREAM_FLOW);
            __typeComboBox.add(__NODE_OTHER);
            __typeComboBox.add(__NODE_PLAN);
            __typeComboBox.add(__NODE_RESERVOIR);
            __typeComboBox.add(__NODE_STREAMFLOW);
            __typeComboBox.add(__NODE_WELL);

            int type = __nodes[__nodeNum].getType();

            if (type == HydrologyNode.NODE_TYPE_CONFLUENCE)
            {
                __typeComboBox.select(__NODE_CONFLUENCE);
            }
            else if (type == HydrologyNode.NODE_TYPE_DIV)
            {
                __typeComboBox.select(__NODE_DIVERSION);
            }
            else if (type == HydrologyNode.NODE_TYPE_DIV_AND_WELL)
            {
                __typeComboBox.select(__NODE_DIVERSION_AND_WELL);
            }
            else if (type == HydrologyNode.NODE_TYPE_END)
            {
                __typeComboBox.removeAll();
                __typeComboBox.add(__NODE_END);
            }
            else if (type == HydrologyNode.NODE_TYPE_ISF)
            {
                __typeComboBox.select(__NODE_INSTREAM_FLOW);
            }
            else if (type == HydrologyNode.NODE_TYPE_OTHER)
            {
                __typeComboBox.select(__NODE_OTHER);
            }
            else if (type == HydrologyNode.NODE_TYPE_PLAN)
            {
                __typeComboBox.select(__NODE_PLAN);
            }
            else if (type == HydrologyNode.NODE_TYPE_RES)
            {
                __typeComboBox.select(__NODE_RESERVOIR);
            }
            else if (type == HydrologyNode.NODE_TYPE_FLOW)
            {
                __typeComboBox.select(__NODE_STREAMFLOW);
            }
            else if (type == HydrologyNode.NODE_TYPE_WELL)
            {
                __typeComboBox.select(__NODE_WELL);
            }
            else if (type == HydrologyNode.NODE_TYPE_XCONFLUENCE)
            {
                __typeComboBox.select(__NODE_XCONFLUENCE);
            }
            else
            {
                __typeComboBox.removeAll();
                __typeComboBox.add("Unknown Type: " + type);
            }

            __typeComboBox.setMaximumRowCount(__typeComboBox.getItemCount());

            __origIType = type;
            __origType  = __typeComboBox.getSelected();

            __labelPositionComboBox = new SimpleJComboBox(false);
            __labelPositionComboBox.add(__ABOVE_CENTER);
            __labelPositionComboBox.add(__UPPER_RIGHT);
            __labelPositionComboBox.add(__RIGHT);
            __labelPositionComboBox.add(__LOWER_RIGHT);
            __labelPositionComboBox.add(__BELOW_CENTER);
            __labelPositionComboBox.add(__LOWER_LEFT);
            __labelPositionComboBox.add(__LEFT);
            __labelPositionComboBox.add(__UPPER_LEFT);
            __labelPositionComboBox.add(__CENTER);
            __labelPositionComboBox.setMaximumRowCount(__labelPositionComboBox.getItemCount());

            int dir = __nodes[__nodeNum].getLabelDirection() % 10;

            if (dir == 2)
            {
                __labelPositionComboBox.select(__BELOW_CENTER);
            }
            else if (dir == 1)
            {
                __labelPositionComboBox.select(__ABOVE_CENTER);
            }
            else if (dir == 4)
            {
                __labelPositionComboBox.select(__RIGHT);
            }
            else if (dir == 3)
            {
                __labelPositionComboBox.select(__LEFT);
            }
            else if (dir == 7)
            {
                __labelPositionComboBox.select(__UPPER_RIGHT);
            }
            else if (dir == 8)
            {
                __labelPositionComboBox.select(__LOWER_RIGHT);
            }
            else if (dir == 5)
            {
                __labelPositionComboBox.select(__LOWER_LEFT);
            }
            else if (dir == 6)
            {
                __labelPositionComboBox.select(__UPPER_LEFT);
            }
            else if (dir == 9)
            {
                __labelPositionComboBox.select(__CENTER);
            }
            else
            {
                __labelPositionComboBox.removeAll();
                __labelPositionComboBox.add("Unknown Position: " + dir);
            }

            __origIDir = dir;
            __origDir  = __labelPositionComboBox.getSelected();

            __isNaturalFlowCheckBox = new JCheckBox();
            __isImportCheckBox      = new JCheckBox();

            __origDirty = __nodes[__nodeNum].isDirty();

            __reservoirDirectionLabel    = new JLabel("Reservoir Direction: ");
            __reservoirDirectionComboBox = new SimpleJComboBox(false);
            __reservoirDirectionComboBox.setToolTipText("Reservoir body is to the indicated direction " + "(downstream follows the arrow).");
            __reservoirDirectionComboBox.add(__TOP);
            __reservoirDirectionComboBox.add(__BOTTOM);
            __reservoirDirectionComboBox.add(__LEFT);
            __reservoirDirectionComboBox.add(__RIGHT);

            int resDir = __nodes[__nodeNum].getLabelDirection() / 10;

            if (resDir == 1)
            {
                __reservoirDirectionComboBox.select(__BOTTOM);
            }
            else if (resDir == 2)
            {
                __reservoirDirectionComboBox.select(__TOP);
            }
            else if (resDir == 3)
            {
                __reservoirDirectionComboBox.select(__RIGHT);
            }
            else if (resDir == 4)
            {
                __reservoirDirectionComboBox.select(__LEFT);
            }
            else if (resDir == 0)
            {
            }
            else
            {
                __reservoirDirectionComboBox.removeAll();
                __reservoirDirectionComboBox.add("Unknown direction: " + resDir);
            }

            __origResIDir = resDir;
            __origResDir  = __reservoirDirectionComboBox.getSelected();

            JPanel panel = new JPanel();

            panel.setLayout(new GridBagLayout());

            int y = 0;

            JGUIUtil.addComponent(panel, new JLabel("ID: "), 0, y, 1, 1, 0, 0, GridBagConstraints.NONE, GridBagConstraints.EAST);
            JGUIUtil.addComponent(panel, __idTextField, 1, y, 1, 1, 0, 0, GridBagConstraints.NONE, GridBagConstraints.WEST);

            y++;
            JGUIUtil.addComponent(panel, new JLabel("Type: "), 0, y, 1, 1, 0, 0, GridBagConstraints.NONE, GridBagConstraints.EAST);
            JGUIUtil.addComponent(panel, __typeComboBox, 1, y, 1, 1, 0, 0, GridBagConstraints.NONE, GridBagConstraints.WEST);

            y++;
            JGUIUtil.addComponent(panel, new JLabel("Description: "), 0, y, 1, 1, 0, 0, GridBagConstraints.NONE, GridBagConstraints.EAST);
            JGUIUtil.addComponent(panel, __descriptionTextField, 1, y, 1, 1, 0, 0, GridBagConstraints.NONE, GridBagConstraints.WEST);

            y++;
            JGUIUtil.addComponent(panel, new JLabel("X: "), 0, y, 1, 1, 0, 0, GridBagConstraints.NONE, GridBagConstraints.EAST);
            JGUIUtil.addComponent(panel, __xTextField, 1, y, 1, 1, 0, 0, GridBagConstraints.NONE, GridBagConstraints.WEST);

            y++;
            JGUIUtil.addComponent(panel, new JLabel("Y: "), 0, y, 1, 1, 0, 0, GridBagConstraints.NONE, GridBagConstraints.EAST);
            JGUIUtil.addComponent(panel, __yTextField, 1, y, 1, 1, 0, 0, GridBagConstraints.NONE, GridBagConstraints.WEST);

            y++;
            JGUIUtil.addComponent(panel, new JLabel("Is natural flow?: "), 0, y, 1, 1, 0, 0, GridBagConstraints.NONE, GridBagConstraints.EAST);
            JGUIUtil.addComponent(panel, __isNaturalFlowCheckBox, 1, y, 1, 1, 0, 0, GridBagConstraints.NONE, GridBagConstraints.WEST);

            y++;
            JGUIUtil.addComponent(panel, new JLabel("Is import?: "), 0, y, 1, 1, 0, 0, GridBagConstraints.NONE, GridBagConstraints.EAST);
            JGUIUtil.addComponent(panel, __isImportCheckBox, 1, y, 1, 1, 0, 0, GridBagConstraints.NONE, GridBagConstraints.WEST);

            y++;
            JGUIUtil.addComponent(panel, new JLabel("Area: "), 0, y, 1, 1, 0, 0, GridBagConstraints.NONE, GridBagConstraints.EAST);
            JGUIUtil.addComponent(panel, __areaTextField, 1, y, 1, 1, 0, 0, GridBagConstraints.NONE, GridBagConstraints.WEST);
            y++;
            JGUIUtil.addComponent(panel, new JLabel("Precipitation: "), 0, y, 1, 1, 0, 0, GridBagConstraints.NONE, GridBagConstraints.EAST);
            JGUIUtil.addComponent(panel, __precipitationTextField, 1, y, 1, 1, 0, 0, GridBagConstraints.NONE, GridBagConstraints.WEST);
            if (__nodes[__nodeNum].getIsNaturalFlow())
            {
                __isNaturalFlowCheckBox.setSelected(true);
            }
            else
            {
                __isNaturalFlowCheckBox.setSelected(false);
                __areaTextField.setEnabled(false);
                __precipitationTextField.setEnabled(false);
            }
            __isNaturalFlowCheckBox.addActionListener(this);

            if (__nodes[__nodeNum].getIsImport())
            {
                __isImportCheckBox.setSelected(true);
            }
            else
            {
                __isImportCheckBox.setSelected(false);
            }
            __isImportCheckBox.addActionListener(this);

            __origNaturalFlow = __isNaturalFlowCheckBox.isSelected();
            __origImport      = __isImportCheckBox.isSelected();

            y++;
            JGUIUtil.addComponent(panel, new JLabel("Label Position: "), 0, y, 1, 1, 0, 0, GridBagConstraints.NONE, GridBagConstraints.EAST);
            JGUIUtil.addComponent(panel, __labelPositionComboBox, 1, y, 1, 1, 0, 0, GridBagConstraints.NONE, GridBagConstraints.WEST);

            y++;
            JGUIUtil.addComponent(panel, __reservoirDirectionLabel, 0, y, 1, 1, 0, 0, GridBagConstraints.NONE, GridBagConstraints.EAST);
            JGUIUtil.addComponent(panel, __reservoirDirectionComboBox, 1, y, 1, 1, 0, 0, GridBagConstraints.NONE, GridBagConstraints.WEST);

            y++;

            y = addUpstreamNodesToPanel(panel, y);
            addDownstreamNodeToPanel(panel, y);

            getContentPane().add(panel);

            JPanel southPanel = new JPanel();

            southPanel.setLayout(new GridBagLayout());

            __applyButton = new JButton(__BUTTON_APPLY);
            __applyButton.addActionListener(this);
            __okButton = new JButton(__BUTTON_OK);
            __okButton.addActionListener(this);
            JButton cancelButton = new JButton(__BUTTON_CANCEL);

            cancelButton.addActionListener(this);

            JGUIUtil.addComponent(southPanel, __applyButton, 0, 0, 1, 1, 1, 1, GridBagConstraints.NONE, GridBagConstraints.EAST);
            JGUIUtil.addComponent(southPanel, __okButton, 2, 0, 1, 1, 0, 0, GridBagConstraints.NONE, GridBagConstraints.EAST);
            JGUIUtil.addComponent(southPanel, cancelButton, 3, 0, 1, 1, 0, 0, GridBagConstraints.NONE, GridBagConstraints.EAST);

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

            pack();

            if (__origIType != HydrologyNode.NODE_TYPE_RES)
            {
                __reservoirDirectionLabel.setVisible(false);
                __reservoirDirectionComboBox.setVisible(false);
            }

            __typeComboBox.addActionListener(this);

            if (__parent.inStateModGUI())
            {
                __typeComboBox.setEnabled(false);
                __precipitationTextField.setEditable(false);
                __precipitationTextField.removeKeyListener(this);
                __descriptionTextField.setEditable(false);
                __descriptionTextField.removeKeyListener(this);
                __areaTextField.removeKeyListener(this);
                __areaTextField.setEditable(false);
                __idTextField.removeKeyListener(this);
                __idTextField.setEditable(false);
                __isNaturalFlowCheckBox.setEnabled(false);
                __isImportCheckBox.setEnabled(false);
            }

            JGUIUtil.center(this);
            setVisible(true);
        }