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

            addWindowListener(this);

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

            p.add("JWorksheet.AllowCopy=true");
            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=SingleRowSelection");

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

            try
            {
                /* TODO SAM 2011-01-02 Comment out - might allow something similar if editing is enabled
                 * and choices of IDs are provided
                 * List accounts = __currentRes.getAccounts();
                 * List v3 = new Vector();
                 * int size = accounts.size();
                 * StateMod_ReservoirAccount ra = null;
                 * for (int i = 0; i < size; i++) {
                 *      ra = (StateMod_ReservoirAccount)accounts.get(i);
                 *      v3.add("" + ra.getID() + " - " + ra.getName());
                 * }
                 * for (int i = 1; i < size; i++) {
                 *      v3.add("-" + (i + 1) + " - Fill first " + (i + 1)
                 + " accounts");
                 + }
                 +
                 + List v = new Vector();
                 + List v2 = __currentRes.getRights();
                 + StateMod_ReservoirRight rr;
                 + for (int i = 0; i < v2.size(); i++) {
                 +      rr = (StateMod_ReservoirRight)
                 +              ((StateMod_ReservoirRight)v2.get(i))
                 +              .clone();
                 +      v.add(rr);
                 + }
                 */
                // Get the list of all returns and filter for this reservoir
                // TODO SAM 2011-01-02 The code needs to use a table model with lists if editing is enabled
                StateMod_Reservoir_Return_Data_TableModel   tmr = new StateMod_Reservoir_Return_Data_TableModel(__currentResReturnList, __editable);
                StateMod_Reservoir_Return_Data_CellRenderer crr = new StateMod_Reservoir_Return_Data_CellRenderer(tmr);

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

                /*
                 * List onOff = StateMod_ReservoirRight.getIrsrswChoices(true);
                 * __worksheet.setColumnJComboBoxValues(
                 *      StateMod_ReservoirRight_TableModel.COL_ON_OFF, onOff,
                 *      false);
                 * __worksheet.setColumnJComboBoxValues(
                 *      StateMod_ReservoirRight_TableModel.COL_ACCOUNT_DIST,
                 *      v3, false);
                 * List rightTypes =
                 *      StateMod_ReservoirRight.getItyrsrChoices(true);
                 * __worksheet.setColumnJComboBoxValues(
                 *      StateMod_ReservoirRight_TableModel.COL_RIGHT_TYPE,
                 *      rightTypes, false);
                 * List fillTypes=StateMod_ReservoirRight.getN2fillChoices(true);
                 * __worksheet.setColumnJComboBoxValues(
                 *      StateMod_ReservoirRight_TableModel.COL_FILL_TYPE,
                 *      fillTypes, false);
                 */

                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);

            __addReturn_JButton    = new JButton(__BUTTON_ADD_RETURN);
            __deleteReturn_JButton = new JButton(__BUTTON_DEL_RETURN);
            __deleteReturn_JButton.setEnabled(false);
            __help_JButton = new JButton(__BUTTON_HELP);
            __help_JButton.setEnabled(false);
            __close_JButton = new JButton(__BUTTON_CLOSE);
            JButton cancelJButton = new JButton(__BUTTON_CANCEL);
            JButton applyJButton  = new JButton(__BUTTON_APPLY);

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

            bigPanel.setLayout(gb);

            FlowLayout fl = new FlowLayout(FlowLayout.RIGHT);
            JPanel     p1 = new JPanel();

            p1.setLayout(fl);

            GridLayout gl         = new GridLayout(2, 2, 1, 1);
            JPanel     info_panel = new JPanel();

            info_panel.setLayout(gl);

            JPanel main_panel = new JPanel();

            main_panel.setLayout(new BorderLayout());

            info_panel.add(new JLabel("Reservoir:"));
            info_panel.add(new JLabel(__currentRes.getID()));
            info_panel.add(new JLabel("Reservoir name:"));
            info_panel.add(new JLabel(__currentRes.getName()));

            if (__editable)
            {
                p1.add(__addReturn_JButton);
                p1.add(__deleteReturn_JButton);
            }
            p1.add(applyJButton);
            p1.add(cancelJButton);
            //	p1.add(__helpJButton);
            p1.add(__close_JButton);
            if (!__editable)
            {
                applyJButton.setEnabled(false);
                applyJButton.setToolTipText("Editing reservoir return data is not implemented.");
                __close_JButton.setEnabled(false);
                __close_JButton.setToolTipText("Editing reservoir return data is not implemented.");
            }

            main_panel.add(jsw, "Center");
            main_panel.add(p1, "South");

            JGUIUtil.addComponent(bigPanel, info_panel, 0, 0, 1, 1, 0, 0, GridBagConstraints.NONE, GridBagConstraints.NORTHWEST);
            JGUIUtil.addComponent(bigPanel, main_panel, 0, 1, 10, 10, 1, 1, GridBagConstraints.BOTH, GridBagConstraints.SOUTH);
            __addReturn_JButton.addActionListener(this);
            __deleteReturn_JButton.addActionListener(this);
            __help_JButton.addActionListener(this);
            __close_JButton.addActionListener(this);
            applyJButton.addActionListener(this);
            cancelJButton.addActionListener(this);

            getContentPane().add(bigPanel);

            JPanel bottomJPanel = new JPanel();

            bottomJPanel.setLayout(gb);
            __messageJTextField = new JTextField();
            __messageJTextField.setEditable(false);
            JGUIUtil.addComponent(bottomJPanel, __messageJTextField, 0, 0, 7, 1, 1.0, 0.0, GridBagConstraints.HORIZONTAL, GridBagConstraints.WEST);
            __statusJTextField = new JTextField(5);
            __statusJTextField.setEditable(false);
            JGUIUtil.addComponent(bottomJPanel, __statusJTextField, 7, 0, 1, 1, 0.0, 0.0, GridBagConstraints.NONE, GridBagConstraints.WEST);
            getContentPane().add("South", bottomJPanel);

            pack();
            setSize(760, 400);
            JGUIUtil.center(this);
            setVisible(true);
            if (widths != null)
            {
                __worksheet.setColumnWidths(widths);
            }
        }
        /// <summary>
        /// Sets up the GUI.
        /// </summary>
        private void setupGUI()
        {
            string routine = "setupGUI";

            addWindowListener(this);

            __addOwner    = new JButton(__BUTTON_ADD_OWNER);
            __deleteOwner = new JButton(__BUTTON_DEL_OWNER);
            __deleteOwner.setEnabled(false);
            __helpJButton = new JButton(__BUTTON_HELP);
            __helpJButton.setEnabled(false);
            __closeJButton = new JButton(__BUTTON_CLOSE);
            JButton cancelJButton = new JButton(__BUTTON_CANCEL);
            JButton applyJButton  = new JButton(__BUTTON_APPLY);

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

            bigPanel.setLayout(gb);

            FlowLayout fl = new FlowLayout(FlowLayout.RIGHT);
            JPanel     p1 = new JPanel();

            p1.setLayout(fl);

            GridLayout gl         = new GridLayout(2, 2, 1, 1);
            JPanel     info_panel = new JPanel();

            info_panel.setLayout(gl);

            JPanel main_panel = new JPanel();

            main_panel.setLayout(new BorderLayout());

            info_panel.add(new JLabel("Reservoir ID:"));
            info_panel.add(new JLabel(__currentRes.getID()));
            info_panel.add(new JLabel("Reservoir name:"));
            info_panel.add(new JLabel(__currentRes.getName()));

            if (__editable)
            {
                p1.add(__addOwner);
                p1.add(__deleteOwner);
            }
            p1.add(applyJButton);
            p1.add(cancelJButton);
            //	p1.add(__helpJButton);
            p1.add(__closeJButton);

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

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

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

            try
            {
                IList <StateMod_ReservoirAccount> v  = new List <StateMod_ReservoirAccount>();
                IList <StateMod_ReservoirAccount> v2 = __currentRes.getAccounts();
                StateMod_ReservoirAccount         ra;
                for (int i = 0; i < v2.Count; i++)
                {
                    ra = (StateMod_ReservoirAccount)v2[i].clone();
                    v.Add(ra);
                }
                StateMod_ReservoirAccount_TableModel   tmr = new StateMod_ReservoirAccount_TableModel(v, __editable, true);
                StateMod_ReservoirAccount_CellRenderer crr = new StateMod_ReservoirAccount_CellRenderer(tmr);

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

                IList <string> owner = StateMod_ReservoirAccount.getN2ownChoices(true);
                __worksheet.setColumnJComboBoxValues(StateMod_ReservoirAccount_TableModel.COL_OWNERSHIP_TIE, owner, false);

                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);

            main_panel.add(jsw, "Center");
            main_panel.add(p1, "South");

            JGUIUtil.addComponent(bigPanel, info_panel, 0, 0, 1, 1, 0, 0, GridBagConstraints.NONE, GridBagConstraints.NORTHWEST);
            JGUIUtil.addComponent(bigPanel, main_panel, 0, 1, 10, 10, 1, 1, GridBagConstraints.BOTH, GridBagConstraints.SOUTH);
            __addOwner.addActionListener(this);
            __deleteOwner.addActionListener(this);
            __helpJButton.addActionListener(this);
            __closeJButton.addActionListener(this);
            applyJButton.addActionListener(this);
            cancelJButton.addActionListener(this);

            getContentPane().add(bigPanel);

            JPanel bottomJPanel = new JPanel();

            bottomJPanel.setLayout(gb);
            __messageJTextField = new JTextField();
            __messageJTextField.setEditable(false);
            JGUIUtil.addComponent(bottomJPanel, __messageJTextField, 0, 0, 7, 1, 1.0, 0.0, GridBagConstraints.HORIZONTAL, GridBagConstraints.WEST);
            __statusJTextField = new JTextField(5);
            __statusJTextField.setEditable(false);
            JGUIUtil.addComponent(bottomJPanel, __statusJTextField, 7, 0, 1, 1, 0.0, 0.0, GridBagConstraints.NONE, GridBagConstraints.WEST);
            getContentPane().add("South", bottomJPanel);

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

            if (widths != null)
            {
                __worksheet.setColumnWidths(widths);
            }
        }
        /// <summary>
        /// Sets up the GUI
        /// </summary>
        public virtual void setupGUI()
        {
            string routine = "setupGUI";

            addWindowListener(this);

            __addDepletion    = new JButton(__BUTTON_ADD_DEPLETION);
            __deleteDepletion = new JButton(__BUTTON_DELETE_DEPLETION);
            __deleteDepletion.setEnabled(false);
            __helpJButton = new JButton(__BUTTON_HELP);
            __helpJButton.setEnabled(false);
            __closeJButton = new JButton(__BUTTON_CLOSE);
            JButton cancelJButton = new JButton(__BUTTON_CANCEL);
            JButton applyJButton  = new JButton(__BUTTON_APPLY);

            // AWT portion
            GridBagLayout gb         = new GridBagLayout();
            JPanel        mainJPanel = new JPanel();

            mainJPanel.setLayout(gb);

            FlowLayout fl = new FlowLayout(FlowLayout.RIGHT);
            JPanel     p1 = new JPanel();

            p1.setLayout(fl);

            GridLayout gl         = new GridLayout(2, 2, 1, 1);
            JPanel     info_panel = new JPanel();

            info_panel.setLayout(gl);

            JPanel main_panel = new JPanel();

            main_panel.setLayout(new BorderLayout());

            info_panel.add(new JLabel("Well:"));
            info_panel.add(new JLabel(__currentWell.getID()));
            info_panel.add(new JLabel("Well name:"));
            info_panel.add(new JLabel(__currentWell.getName()));

            if (__editable)
            {
                p1.add(__addDepletion);
                p1.add(__deleteDepletion);
            }
            p1.add(applyJButton);
            p1.add(cancelJButton);
            //	p1.add(__helpJButton);
            p1.add(__closeJButton);

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

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

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

            try
            {
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @SuppressWarnings("unchecked") java.util.List<StateMod_RiverNetworkNode> nodes = (java.util.List<StateMod_RiverNetworkNode>)(__dataset.getComponentForComponentType(StateMod_DataSet.COMP_RIVER_NETWORK).getData());
                IList <StateMod_RiverNetworkNode> nodes = (IList <StateMod_RiverNetworkNode>)(__dataset.getComponentForComponentType(StateMod_DataSet.COMP_RIVER_NETWORK).getData());
                IList <StateMod_ReturnFlow>       v     = new List <StateMod_ReturnFlow>();
                IList <StateMod_ReturnFlow>       v2    = __currentWell.getDepletions();
                StateMod_ReturnFlow rf;
                for (int i = 0; i < v2.Count; i++)
                {
                    rf = (StateMod_ReturnFlow)v2[i].clone();
                    rf.setCrtnid(rf.getCrtnid() + StateMod_Util.findNameInVector(rf.getCrtnid(), nodes, true));
                    v.Add(rf);
                }

                StateMod_ReturnFlow_TableModel   tmw = new StateMod_ReturnFlow_TableModel(__dataset, v, __editable, false);
                StateMod_ReturnFlow_CellRenderer crw = new StateMod_ReturnFlow_CellRenderer(tmw);

                jsw         = new JScrollWorksheet(crw, tmw, p);
                __worksheet = jsw.getJWorksheet();

                IList <string> ids = StateMod_Util.createIdentifierListFromStateModData(nodes, true, null);
                __worksheet.setColumnJComboBoxValues(StateMod_ReturnFlow_TableModel.COL_RIVER_NODE, ids, false);

                IList <StateMod_DelayTable> delayIDs = null;
                if (__dataset.getIday() == 1)
                {
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @SuppressWarnings("unchecked") java.util.List<StateMod_DelayTable> delayIDs0 = (java.util.List<StateMod_DelayTable>)(__dataset.getComponentForComponentType(StateMod_DataSet.COMP_DELAY_TABLES_DAILY).getData());
                    IList <StateMod_DelayTable> delayIDs0 = (IList <StateMod_DelayTable>)(__dataset.getComponentForComponentType(StateMod_DataSet.COMP_DELAY_TABLES_DAILY).getData());
                    delayIDs = delayIDs0;
                }
                else
                {
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @SuppressWarnings("unchecked") java.util.List<StateMod_DelayTable> delayIDs0 = (java.util.List<StateMod_DelayTable>)(__dataset.getComponentForComponentType(StateMod_DataSet.COMP_DELAY_TABLES_MONTHLY).getData());
                    IList <StateMod_DelayTable> delayIDs0 = (IList <StateMod_DelayTable>)(__dataset.getComponentForComponentType(StateMod_DataSet.COMP_DELAY_TABLES_MONTHLY).getData());
                    delayIDs = delayIDs0;
                }
                ids = StateMod_Util.createIdentifierListFromStateModData(delayIDs, true, null);
                __worksheet.setColumnJComboBoxValues(StateMod_ReturnFlow_TableModel.COL_RETURN_ID, ids, false);
                widths = crw.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);

            main_panel.add(jsw, "Center");
            main_panel.add(p1, "South");
            JGUIUtil.addComponent(mainJPanel, info_panel, 0, 0, 1, 1, 0, 0, GridBagConstraints.NONE, GridBagConstraints.NORTHWEST);
            JGUIUtil.addComponent(mainJPanel, main_panel, 0, 1, 10, 10, 1, 1, GridBagConstraints.BOTH, GridBagConstraints.SOUTH);

            getContentPane().add(mainJPanel);

            JPanel bottomJPanel = new JPanel();

            bottomJPanel.setLayout(gb);
            __messageJTextField = new JTextField();
            __messageJTextField.setEditable(false);
            JGUIUtil.addComponent(bottomJPanel, __messageJTextField, 0, 0, 7, 1, 1.0, 0.0, GridBagConstraints.HORIZONTAL, GridBagConstraints.WEST);
            __statusJTextField = new JTextField(5);
            __statusJTextField.setEditable(false);
            JGUIUtil.addComponent(bottomJPanel, __statusJTextField, 7, 0, 1, 1, 0.0, 0.0, GridBagConstraints.NONE, GridBagConstraints.WEST);
            getContentPane().add("South", bottomJPanel);

            __addDepletion.addActionListener(this);
            __deleteDepletion.addActionListener(this);
            __closeJButton.addActionListener(this);
            __helpJButton.addActionListener(this);
            applyJButton.addActionListener(this);
            cancelJButton.addActionListener(this);

            pack();
            setSize(520, 280);
            JGUIUtil.center(this);
            setVisible(true);

            if (widths != null)
            {
                __worksheet.setColumnWidths(widths);
            }
        }
        /// <summary>
        /// Sets up the GUI.
        /// </summary>
        public virtual void setupGUI()
        {
            string routine = "setupGUI";

            addWindowListener(this);

            __addPrecip     = new JButton(__BUTTON_ADD_PRECIPITATION_STATION);
            __addEvap       = new JButton(__BUTTON_ADD_EVAPORATION_STATION);
            __deleteStation = new JButton(__BUTTON_DELETE_PRECIPITATION_STATION);
            __deleteStation.setEnabled(false);
            __helpJButton = new JButton(__BUTTON_HELP);
            __helpJButton.setEnabled(false);
            __closeJButton = new JButton(__BUTTON_CLOSE);
            JButton cancelJButton = new JButton(__BUTTON_CANCEL);
            JButton applyJButton  = new JButton(__BUTTON_APPLY);

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

            bigPanel.setLayout(gb);

            FlowLayout fl = new FlowLayout(FlowLayout.RIGHT);
            JPanel     p1 = new JPanel();

            p1.setLayout(fl);

            GridLayout gl         = new GridLayout(2, 2, 1, 1);
            JPanel     info_panel = new JPanel();

            info_panel.setLayout(gl);

            JPanel main_panel = new JPanel();

            main_panel.setLayout(new BorderLayout());

            info_panel.add(new JLabel("Reservoir:"));
            info_panel.add(new JLabel(__currentRes.getID()));
            info_panel.add(new JLabel("Reservoir name:"));
            info_panel.add(new JLabel(__currentRes.getName()));

            if (__editable)
            {
                p1.add(__addPrecip);
                p1.add(__addEvap);
                p1.add(__deleteStation);
            }
            p1.add(applyJButton);
            p1.add(cancelJButton);
            //	p1.add(__helpJButton);
            p1.add(__closeJButton);

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

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

            int[]            widthsP = null;
            JScrollWorksheet jswP    = null;
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @SuppressWarnings("unchecked") java.util.List<String> stations = StateMod_Util.createIdentifierListFromTS(combineData((java.util.List<RTi.TS.MonthTS>)__dataset.getComponentForComponentType(StateMod_DataSet.COMP_PRECIPITATION_TS_MONTHLY).getData(), (java.util.List<RTi.TS.MonthTS>)__dataset.getComponentForComponentType(StateMod_DataSet.COMP_EVAPORATION_TS_MONTHLY).getData()), true, null);
            IList <string> stations = StateMod_Util.createIdentifierListFromTS(combineData((IList <MonthTS>)__dataset.getComponentForComponentType(StateMod_DataSet.COMP_PRECIPITATION_TS_MONTHLY).getData(), (IList <MonthTS>)__dataset.getComponentForComponentType(StateMod_DataSet.COMP_EVAPORATION_TS_MONTHLY).getData()), true, null);

            try
            {
                IList <StateMod_ReservoirClimate> temp   = getPrecipitationStations(__currentRes.getClimates());
                IList <StateMod_ReservoirClimate> clones = new List <StateMod_ReservoirClimate>();
                StateMod_ReservoirClimate         r      = null;
                int size = temp.Count;
                for (int i = 0; i < size; i++)
                {
                    r = temp[i];
                    clones.Add((StateMod_ReservoirClimate)r.clone());
                }

                __tableModelP = new StateMod_ReservoirClimate_TableModel(clones, __editable, true);
                StateMod_ReservoirClimate_CellRenderer crr = new StateMod_ReservoirClimate_CellRenderer(__tableModelP);

                jswP         = new JScrollWorksheet(crr, __tableModelP, p);
                __worksheetP = jswP.getJWorksheet();

                __worksheetP.setColumnJComboBoxValues(StateMod_ReservoirClimate_TableModel.COL_STATION, stations, true);

                widthsP = crr.getColumnWidths();
            }
            catch (Exception e)
            {
                Message.printWarning(1, routine, "Error building worksheet.", this);
                Message.printWarning(2, routine, e);
                jswP         = new JScrollWorksheet(0, 0, p);
                __worksheetP = jswP.getJWorksheet();
            }
            __worksheetP.setPreferredScrollableViewportSize(null);

            __worksheetP.setHourglassJFrame(this);
            __worksheetP.addMouseListener(this);
            __worksheetP.addKeyListener(this);

            int[]            widthsE = null;
            JScrollWorksheet jswE    = null;

            try
            {
                IList <StateMod_ReservoirClimate> temp   = getEvaporationStations(__currentRes.getClimates());
                IList <StateMod_ReservoirClimate> clones = new List <StateMod_ReservoirClimate>();
                StateMod_ReservoirClimate         r      = null;
                int size = temp.Count;
                for (int i = 0; i < size; i++)
                {
                    r = temp[i];
                    clones.Add((StateMod_ReservoirClimate)r.clone());
                }

                __tableModelE = new StateMod_ReservoirClimate_TableModel(clones, __editable, true);
                StateMod_ReservoirClimate_CellRenderer crr = new StateMod_ReservoirClimate_CellRenderer(__tableModelE);

                jswE         = new JScrollWorksheet(crr, __tableModelE, p);
                __worksheetE = jswE.getJWorksheet();

                __worksheetE.setColumnJComboBoxValues(StateMod_ReservoirClimate_TableModel.COL_STATION, stations, true);
                widthsE = crr.getColumnWidths();
            }
            catch (Exception e)
            {
                Message.printWarning(1, routine, "Error building worksheet.", this);
                Message.printWarning(2, routine, e);
                jswE         = new JScrollWorksheet(0, 0, p);
                __worksheetE = jswE.getJWorksheet();
            }
            __worksheetE.setPreferredScrollableViewportSize(null);

            __worksheetE.setHourglassJFrame(this);
            __worksheetE.addMouseListener(this);
            __worksheetE.addKeyListener(this);

            JPanel worksheets = new JPanel();

            worksheets.setLayout(gb);

            JPanel panelP = new JPanel();

            panelP.setLayout(gb);
            panelP.setBorder(BorderFactory.createTitledBorder("Precipitation Stations"));
            JGUIUtil.addComponent(panelP, jswP, 0, 0, 1, 1, 1, 1, GridBagConstraints.BOTH, GridBagConstraints.NORTHWEST);

            JPanel panelE = new JPanel();

            panelE.setLayout(gb);
            panelE.setBorder(BorderFactory.createTitledBorder("Evaporation Stations"));
            JGUIUtil.addComponent(panelE, jswE, 0, 0, 1, 1, 1, 1, GridBagConstraints.BOTH, GridBagConstraints.NORTHWEST);

            JGUIUtil.addComponent(worksheets, panelP, 0, 0, 1, 1, 1, 1, GridBagConstraints.BOTH, GridBagConstraints.NORTHWEST);
            JGUIUtil.addComponent(worksheets, panelE, 0, 1, 1, 1, 1, 1, GridBagConstraints.BOTH, GridBagConstraints.NORTHWEST);

            main_panel.add(worksheets, "Center");
            main_panel.add(p1, "South");

            // assemble parts
            JGUIUtil.addComponent(bigPanel, info_panel, 0, 0, 1, 1, 0, 0, GridBagConstraints.NONE, GridBagConstraints.NORTHWEST);

            JGUIUtil.addComponent(bigPanel, main_panel, 0, 1, 10, 10, 1, 1, GridBagConstraints.BOTH, GridBagConstraints.SOUTH);
            __addEvap.addActionListener(this);
            __addPrecip.addActionListener(this);
            __deleteStation.addActionListener(this);
            __helpJButton.addActionListener(this);
            __closeJButton.addActionListener(this);
            applyJButton.addActionListener(this);
            cancelJButton.addActionListener(this);

            getContentPane().add(bigPanel);

            JPanel bottomJPanel = new JPanel();

            bottomJPanel.setLayout(gb);
            __messageJTextField = new JTextField();
            __messageJTextField.setEditable(false);
            JGUIUtil.addComponent(bottomJPanel, __messageJTextField, 0, 0, 7, 1, 1.0, 0.0, GridBagConstraints.HORIZONTAL, GridBagConstraints.WEST);
            __statusJTextField = new JTextField(5);
            __statusJTextField.setEditable(false);
            JGUIUtil.addComponent(bottomJPanel, __statusJTextField, 7, 0, 1, 1, 0.0, 0.0, GridBagConstraints.NONE, GridBagConstraints.WEST);
            getContentPane().add("South", bottomJPanel);

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

            if (widthsP != null)
            {
                __worksheetP.setColumnWidths(widthsP);
            }
            if (widthsE != null)
            {
                __worksheetE.setColumnWidths(widthsE);
            }
        }
예제 #5
0
        /// <summary>
        /// Sets up the GUI.
        /// </summary>
        private void setupGUI()
        {
            string routine = "setupGUI";

            addWindowListener(this);

            __addAreaCap    = new JButton(__BUTTON_ADD_AREA_CAPACITY);
            __deleteAreaCap = new JButton(__BUTTON_DEL_AREA_CAPACITY);
            __deleteAreaCap.setEnabled(false);
            __helpJButton = new JButton(__BUTTON_HELP);
            __helpJButton.setEnabled(false);
            __closeJButton = new JButton(__BUTTON_CLOSE);
            JButton cancelJButton = new JButton(__BUTTON_CANCEL);
            JButton applyJButton  = new JButton(__BUTTON_APPLY);

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

            bigPanel.setLayout(gb);

            FlowLayout fl = new FlowLayout(FlowLayout.RIGHT);
            JPanel     p0 = new JPanel();

            p0.setLayout(fl);
            p0.add(__GraphArea_JButton    = new SimpleJButton(__GraphArea_String, __GraphArea_String, this));
            p0.add(__GraphSeepage_JButton = new SimpleJButton(__GraphSeepage_String, __GraphSeepage_String, this));

            GridLayout gl         = new GridLayout(2, 2, 1, 1);
            JPanel     info_panel = new JPanel();

            info_panel.setLayout(gl);

            //JPanel main_panel = new JPanel();
            //main_panel.setLayout(new BorderLayout());

            info_panel.add(new JLabel("Reservoir:"));
            info_panel.add(new JLabel(__currentRes.getID()));
            info_panel.add(new JLabel("Reservoir name:"));
            info_panel.add(new JLabel(__currentRes.getName()));

            JPanel p1 = new JPanel();

            p1.setLayout(fl);
            if (__editable)
            {
                p1.add(__addAreaCap);
                p1.add(__deleteAreaCap);
            }
            p1.add(applyJButton);
            p1.add(cancelJButton);
            //	p1.add(__helpJButton);
            p1.add(__closeJButton);

            PropList p = new PropList("StateMod_Reservoir__AreaCap_JFrame.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.AllowCopy=true");
            p.add("JWorksheet.SelectionMode=SingleRowSelection");

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

            try
            {
                IList <StateMod_ReservoirAreaCap> v  = new List <StateMod_ReservoirAreaCap>();
                IList <StateMod_ReservoirAreaCap> v2 = __currentRes.getAreaCaps();
                for (int i = 0; i < v2.Count; i++)
                {
                    v.Add((StateMod_ReservoirAreaCap)v2[i].clone());
                }
                StateMod_ReservoirAreaCap_TableModel   tmr = new StateMod_ReservoirAreaCap_TableModel(v, __editable, true);
                StateMod_ReservoirAreaCap_CellRenderer crr = new StateMod_ReservoirAreaCap_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);

            //main_panel.add(jsw, "Center");
            // Does not work well...
            //main_panel.add(p1, "South");

            // assemble parts
            JGUIUtil.addComponent(bigPanel, info_panel, 0, 0, 1, 1, 0, 0, GridBagConstraints.HORIZONTAL, GridBagConstraints.NORTHWEST);
            JGUIUtil.addComponent(bigPanel, jsw, 0, 1, 10, 10, 1.0, 1.0, GridBagConstraints.BOTH, GridBagConstraints.SOUTH);
            JPanel button_panel = new JPanel();

            button_panel.setLayout(gb);
            JGUIUtil.addComponent(button_panel, p0, 0, 0, 10, 1, 0, 0, GridBagConstraints.HORIZONTAL, GridBagConstraints.SOUTHEAST);
            JGUIUtil.addComponent(button_panel, p1, 0, 1, 10, 1, 0, 0, GridBagConstraints.HORIZONTAL, GridBagConstraints.SOUTHEAST);
            JGUIUtil.addComponent(bigPanel, button_panel, 0, 11, 10, 1, 0, 0, GridBagConstraints.HORIZONTAL, GridBagConstraints.SOUTHEAST);
            __addAreaCap.addActionListener(this);
            __deleteAreaCap.addActionListener(this);
            __helpJButton.addActionListener(this);
            __closeJButton.addActionListener(this);
            applyJButton.addActionListener(this);
            cancelJButton.addActionListener(this);

            getContentPane().add(bigPanel);

            JPanel bottomJPanel = new JPanel();

            bottomJPanel.setLayout(gb);
            __messageJTextField = new JTextField();
            __messageJTextField.setEditable(false);
            JGUIUtil.addComponent(bottomJPanel, __messageJTextField, 0, 0, 7, 1, 1.0, 0.0, GridBagConstraints.HORIZONTAL, GridBagConstraints.WEST);
            __statusJTextField = new JTextField(5);
            __statusJTextField.setEditable(false);
            JGUIUtil.addComponent(bottomJPanel, __statusJTextField, 7, 0, 1, 1, 0.0, 0.0, GridBagConstraints.NONE, GridBagConstraints.WEST);
            getContentPane().add("South", bottomJPanel);

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

            if (widths != null)
            {
                __worksheet.setColumnWidths(widths);
            }
        }
예제 #6
0
        /// <summary>
        /// Sets up the GUI. </summary>
        /// <exception cref="Exception"> if there is an error setting up the worksheet. </exception>
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
//ORIGINAL LINE: private void setupGUI() throws Exception
        private void setupGUI()
        {
            addWindowListener(this);

            JPanel panel = new JPanel();

            panel.setLayout(new GridBagLayout());

            // buildJScrollWorksheet is defined in the derived classes (it is
            // abstract in this class).  It creates a JScrollWorksheet and returns it.
            __scrollWorksheet = buildJScrollWorksheet();
            _worksheet        = __scrollWorksheet.getJWorksheet();

            JGUIUtil.addComponent(panel, __scrollWorksheet, 0, 0, 1, 1, 1, 1, GridBagConstraints.BOTH, GridBagConstraints.CENTER);

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

            SimpleJButton exportButton = new SimpleJButton(_BUTTON_EXPORT, this);
            SimpleJButton printButton  = new SimpleJButton(_BUTTON_PRINT, this);
            SimpleJButton okButton     = new SimpleJButton(_BUTTON_OK, this);

            SimpleJButton applyButton  = null;
            SimpleJButton cancelButton = null;

            if (_editable)
            {
                applyButton  = new SimpleJButton(_BUTTON_APPLY, this);
                cancelButton = new SimpleJButton(_BUTTON_CANCEL, this);
            }

            JPanel bottomPanel = new JPanel();

            bottomPanel.setLayout(new FlowLayout(FlowLayout.RIGHT));
            bottomPanel.add(exportButton);
            bottomPanel.add(printButton);
            bottomPanel.add(okButton);

            if (_editable)
            {
                bottomPanel.add(applyButton);
                bottomPanel.add(cancelButton);
            }

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

            JGUIUtil.setIcon(this, JGUIUtil.getIconImage());

            setTitle(_titleString);
            pack();

            setSize(800, 400);
            JGUIUtil.center(this);

            setVisible(true);

            JWorksheet_DefaultTableCellRenderer renderer = _worksheet.getCellRenderer();

            int[] widths = renderer.getColumnWidths();
            if (widths != null)
            {
                _worksheet.setColumnWidths(widths);
            }
        }
예제 #7
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);
        }
        /// <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);
        }
예제 #9
0
        /// <summary>
        /// Sets up the GUI.
        /// </summary>
        private void setupGUI()
        {
            string routine = "setupGUI";

            addWindowListener(this);

            __addRight     = new JButton(__BUTTON_ADD_RIGHT);
            __deleteRight  = new JButton(__BUTTON_DEL_RIGHT);
            __closeJButton = new JButton(__BUTTON_CLOSE);
            __helpJButton  = new JButton(__BUTTON_HELP);
            JButton cancelJButton = new JButton(__BUTTON_CANCEL);
            JButton applyJButton  = new JButton(__BUTTON_APPLY);

            __helpJButton.setEnabled(false);

            GridBagLayout gbl      = new GridBagLayout();
            JPanel        bigPanel = new JPanel();

            bigPanel.setLayout(gbl);

            JPanel p1 = new JPanel();

            p1.setLayout(new FlowLayout(FlowLayout.RIGHT));

            GridLayout gl         = new GridLayout(2, 2, 1, 1);
            JPanel     info_panel = new JPanel();

            info_panel.setLayout(gl);

            JPanel main_panel = new JPanel();

            main_panel.setLayout(new BorderLayout());

            info_panel.add(new JLabel("Diversion ID: "));
            info_panel.add(new JLabel(__currentDiv.getID()));
            info_panel.add(new JLabel("Diversion name: "));
            info_panel.add(new JLabel(__currentDiv.getName()));
            if (__editable)
            {
                p1.add(__addRight);
                p1.add(__deleteRight);
                __deleteRight.setEnabled(false);
            }
            //p1.add(__helpJButton);
            p1.add(applyJButton);
            p1.add(cancelJButton);
            p1.add(__closeJButton);

            PropList p = new PropList("StateMod_Diversion_Right_JFrame" + ".JWorksheet");

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

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

            try
            {
                System.Collections.IList v  = new List <object>();
                System.Collections.IList v2 = __currentDiv.getRights();
                for (int i = 0; i < v2.Count; i++)
                {
                    v.Add(((StateMod_DiversionRight)(v2[i])).clone());
                }
                StateMod_DiversionRight_TableModel tmd = new StateMod_DiversionRight_TableModel(v, __editable, false);

                StateMod_DiversionRight_CellRenderer crd = new StateMod_DiversionRight_CellRenderer(tmd);

                jsw         = new JScrollWorksheet(crd, tmd, p);
                __worksheet = jsw.getJWorksheet();

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

            System.Collections.IList v = new List <object>();
            v.Add("0 - Off");
            v.Add("1 - On");

            __worksheet.setColumnJComboBoxValues(StateMod_DiversionRight_TableModel.COL_ON_OFF, v);

            main_panel.add(jsw, "Center");
            main_panel.add(p1, "South");

            JGUIUtil.addComponent(bigPanel, info_panel, 0, 0, 1, 1, 0, 0, GridBagConstraints.NONE, GridBagConstraints.NORTHWEST);
            JGUIUtil.addComponent(bigPanel, main_panel, 0, 1, 10, 10, 1, 1, GridBagConstraints.BOTH, GridBagConstraints.SOUTH);

            getContentPane().add(bigPanel);

            JPanel bottomJPanel = new JPanel();

            bottomJPanel.setLayout(gbl);
            __messageJTextField = new JTextField();
            __messageJTextField.setEditable(false);
            JGUIUtil.addComponent(bottomJPanel, __messageJTextField, 0, 0, 7, 1, 1.0, 0.0, GridBagConstraints.HORIZONTAL, GridBagConstraints.WEST);
            __statusJTextField = new JTextField(5);
            __statusJTextField.setEditable(false);
            JGUIUtil.addComponent(bottomJPanel, __statusJTextField, 7, 0, 1, 1, 0.0, 0.0, GridBagConstraints.NONE, GridBagConstraints.WEST);
            getContentPane().add("South", bottomJPanel);

            __addRight.addActionListener(this);
            __deleteRight.addActionListener(this);
            __closeJButton.addActionListener(this);
            __helpJButton.addActionListener(this);
            cancelJButton.addActionListener(this);
            applyJButton.addActionListener(this);

            pack();
            setSize(600, 450);
            JGUIUtil.center(this);
            setVisible(true);

            if (widths != null)
            {
                __worksheet.setColumnWidths(widths);
            }
        }
예제 #10
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);
            }
        }
        /// <summary>
        /// Sets up the GUI.
        /// </summary>
        public virtual void setupGUI()
        {
            string routine = "setupGUI";

            addWindowListener(this);

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

            p.add("JWorksheet.AllowCopy=true");
            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=SingleRowSelection");

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

            try
            {
                IList <StateMod_ReservoirAccount> accounts = __currentRes.getAccounts();
                IList <string>            v3   = new List <string>();
                int                       size = accounts.Count;
                StateMod_ReservoirAccount ra   = null;
                for (int i = 0; i < size; i++)
                {
                    ra = accounts[i];
                    v3.Add("" + ra.getID() + " - " + ra.getName());
                }
                for (int i = 1; i < size; i++)
                {
                    v3.Add("-" + (i + 1) + " - Fill first " + (i + 1) + " accounts");
                }

                IList <StateMod_ReservoirRight> v  = new List <StateMod_ReservoirRight>();
                IList <StateMod_ReservoirRight> v2 = __currentRes.getRights();
                StateMod_ReservoirRight         rr;
                for (int i = 0; i < v2.Count; i++)
                {
                    rr = (StateMod_ReservoirRight)v2[i].clone();
                    v.Add(rr);
                }
                StateMod_ReservoirRight_TableModel   tmr = new StateMod_ReservoirRight_TableModel(v, __editable);
                StateMod_ReservoirRight_CellRenderer crr = new StateMod_ReservoirRight_CellRenderer(tmr);

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

                IList <string> onOff = StateMod_ReservoirRight.getIrsrswChoices(true);
                __worksheet.setColumnJComboBoxValues(StateMod_ReservoirRight_TableModel.COL_ON_OFF, onOff, false);
                __worksheet.setColumnJComboBoxValues(StateMod_ReservoirRight_TableModel.COL_ACCOUNT_DIST, v3, false);
                IList <string> rightTypes = StateMod_ReservoirRight.getItyrsrChoices(true);
                __worksheet.setColumnJComboBoxValues(StateMod_ReservoirRight_TableModel.COL_RIGHT_TYPE, rightTypes, false);
                IList <string> fillTypes = StateMod_ReservoirRight.getN2fillChoices(true);
                __worksheet.setColumnJComboBoxValues(StateMod_ReservoirRight_TableModel.COL_FILL_TYPE, fillTypes, false);

                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);

            __addRight    = new JButton(__BUTTON_ADD_RIGHT);
            __deleteRight = new JButton(__BUTTON_DEL_RIGHT);
            __deleteRight.setEnabled(false);
            __helpJButton = new JButton(__BUTTON_HELP);
            __helpJButton.setEnabled(false);
            __closeJButton = new JButton(__BUTTON_CLOSE);
            JButton cancelJButton = new JButton(__BUTTON_CANCEL);
            JButton applyJButton  = new JButton(__BUTTON_APPLY);

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

            bigPanel.setLayout(gb);

            FlowLayout fl = new FlowLayout(FlowLayout.RIGHT);
            JPanel     p1 = new JPanel();

            p1.setLayout(fl);

            GridLayout gl         = new GridLayout(2, 2, 1, 1);
            JPanel     info_panel = new JPanel();

            info_panel.setLayout(gl);

            JPanel main_panel = new JPanel();

            main_panel.setLayout(new BorderLayout());

            info_panel.add(new JLabel("Reservoir:"));
            info_panel.add(new JLabel(__currentRes.getID()));
            info_panel.add(new JLabel("Reservoir name:"));
            info_panel.add(new JLabel(__currentRes.getName()));

            if (__editable)
            {
                p1.add(__addRight);
                p1.add(__deleteRight);
            }
            p1.add(applyJButton);
            p1.add(cancelJButton);
            //	p1.add(__helpJButton);
            p1.add(__closeJButton);

            main_panel.add(jsw, "Center");
            main_panel.add(p1, "South");

            JGUIUtil.addComponent(bigPanel, info_panel, 0, 0, 1, 1, 0, 0, GridBagConstraints.NONE, GridBagConstraints.NORTHWEST);
            JGUIUtil.addComponent(bigPanel, main_panel, 0, 1, 10, 10, 1, 1, GridBagConstraints.BOTH, GridBagConstraints.SOUTH);
            __addRight.addActionListener(this);
            __deleteRight.addActionListener(this);
            __helpJButton.addActionListener(this);
            __closeJButton.addActionListener(this);
            applyJButton.addActionListener(this);
            cancelJButton.addActionListener(this);

            getContentPane().add(bigPanel);

            JPanel bottomJPanel = new JPanel();

            bottomJPanel.setLayout(gb);
            __messageJTextField = new JTextField();
            __messageJTextField.setEditable(false);
            JGUIUtil.addComponent(bottomJPanel, __messageJTextField, 0, 0, 7, 1, 1.0, 0.0, GridBagConstraints.HORIZONTAL, GridBagConstraints.WEST);
            __statusJTextField = new JTextField(5);
            __statusJTextField.setEditable(false);
            JGUIUtil.addComponent(bottomJPanel, __statusJTextField, 7, 0, 1, 1, 0.0, 0.0, GridBagConstraints.NONE, GridBagConstraints.WEST);
            getContentPane().add("South", bottomJPanel);

            pack();
            setSize(760, 400);
            JGUIUtil.center(this);
            setVisible(true);
            if (widths != null)
            {
                __worksheet.setColumnWidths(widths);
            }
        }
        /// <summary>
        /// Sets up the GUI.
        /// </summary>
        private void setupGUI()
        {
            string routine = "setupGUI";

            addWindowListener(this);

            __addReturnFlow    = new JButton(__BUTTON_ADD_RETURN_FLOW);
            __deleteReturnFlow = new JButton(__BUTTON_DEL_RETURN_FLOW);
            __deleteReturnFlow.setEnabled(false);
            __helpJButton = new JButton(__BUTTON_HELP);
            __helpJButton.setEnabled(false);
            __closeJButton = new JButton(__BUTTON_CLOSE);
            JButton cancelJButton = new JButton(__BUTTON_CANCEL);
            JButton applyJButton  = new JButton(__BUTTON_APPLY);

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

            mainJPanel.setLayout(gb);

            FlowLayout fl = new FlowLayout(FlowLayout.RIGHT);
            JPanel     p1 = new JPanel();

            p1.setLayout(fl);

            GridLayout gl         = new GridLayout(2, 2, 1, 1);
            JPanel     info_panel = new JPanel();

            info_panel.setLayout(gl);

            JPanel main_panel = new JPanel();

            main_panel.setLayout(new BorderLayout());

            info_panel.add(new JLabel("Well:"));
            info_panel.add(new JLabel(__currentWell.getID()));
            info_panel.add(new JLabel("Well name:"));
            info_panel.add(new JLabel(__currentWell.getName()));

            if (__editable)
            {
                p1.add(__addReturnFlow);
                p1.add(__deleteReturnFlow);
            }
            p1.add(applyJButton);
            p1.add(cancelJButton);
            //	p1.add(__helpJButton);
            p1.add(__closeJButton);

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

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

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

            try
            {
                System.Collections.IList nodes = (System.Collections.IList)(__dataset.getComponentForComponentType(StateMod_DataSet.COMP_RIVER_NETWORK).getData());
                System.Collections.IList v     = new List <object>();
                System.Collections.IList v2    = __currentWell.getReturnFlows();
                StateMod_ReturnFlow      rf;
                for (int i = 0; i < v2.Count; i++)
                {
                    rf = (StateMod_ReturnFlow)((StateMod_ReturnFlow)v2[i]).clone();
                    rf.setCrtnid(rf.getCrtnid() + StateMod_Util.findNameInVector(rf.getCrtnid(), nodes, true));
                    v.Add(rf);
                }

                StateMod_ReturnFlow_TableModel   tmw = new StateMod_ReturnFlow_TableModel(__dataset, v, __editable, true);
                StateMod_ReturnFlow_CellRenderer crw = new StateMod_ReturnFlow_CellRenderer(tmw);

                jsw         = new JScrollWorksheet(crw, tmw, p);
                __worksheet = jsw.getJWorksheet();

                v = StateMod_Util.createIdentifierListFromStateModData(nodes, true, null);
                __worksheet.setColumnJComboBoxValues(StateMod_ReturnFlow_TableModel.COL_RIVER_NODE, v, false);

                // 10
                System.Collections.IList delayIDs = null;
                if (__dataset.getIday() == 1)
                {
                    delayIDs = (System.Collections.IList)(__dataset.getComponentForComponentType(StateMod_DataSet.COMP_DELAY_TABLES_DAILY).getData());
                }
                else
                {
                    delayIDs = (System.Collections.IList)(__dataset.getComponentForComponentType(StateMod_DataSet.COMP_DELAY_TABLES_MONTHLY).getData());
                }
                v = StateMod_Util.createIdentifierListFromStateModData(delayIDs, true, null);
                __worksheet.setColumnJComboBoxValues(StateMod_ReturnFlow_TableModel.COL_RETURN_ID, v, false);
                widths = crw.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);

            main_panel.add(jsw, "Center");
            main_panel.add(p1, "South");
            JGUIUtil.addComponent(mainJPanel, info_panel, 0, 0, 1, 1, 0, 0, GridBagConstraints.NONE, GridBagConstraints.NORTHWEST);
            JGUIUtil.addComponent(mainJPanel, main_panel, 0, 1, 10, 10, 1, 1, GridBagConstraints.BOTH, GridBagConstraints.SOUTH);

            getContentPane().add(mainJPanel);

            JPanel bottomJPanel = new JPanel();

            bottomJPanel.setLayout(gb);
            __messageJTextField = new JTextField();
            __messageJTextField.setEditable(false);
            JGUIUtil.addComponent(bottomJPanel, __messageJTextField, 0, 0, 7, 1, 1.0, 0.0, GridBagConstraints.HORIZONTAL, GridBagConstraints.WEST);
            __statusJTextField = new JTextField(5);
            __statusJTextField.setEditable(false);
            JGUIUtil.addComponent(bottomJPanel, __statusJTextField, 7, 0, 1, 1, 0.0, 0.0, GridBagConstraints.NONE, GridBagConstraints.WEST);
            getContentPane().add("South", bottomJPanel);

            __addReturnFlow.addActionListener(this);
            __deleteReturnFlow.addActionListener(this);
            __closeJButton.addActionListener(this);
            __helpJButton.addActionListener(this);
            applyJButton.addActionListener(this);
            cancelJButton.addActionListener(this);

            pack();
            setSize(520, 280);
            JGUIUtil.center(this);
            setVisible(true);

            if (widths != null)
            {
                __worksheet.setColumnWidths(widths);
            }
        }
        /// <summary>
        /// Sets up the GUI.
        /// </summary>
        private void setupGUI()
        {
            string routine = "setupGUI";

            addWindowListener(this);

            __addRowButton         = new SimpleJButton(__BUTTON_ADD_ROW, this);
            __deleteRowButton      = new SimpleJButton(__BUTTON_DELETE_ROW, this);
            __saveTemplateButton   = new SimpleJButton(__BUTTON_SAVE_FILE, this);
            __clearWorksheetButton = new SimpleJButton(__BUTTON_CLEAR_LIST, this);
            __loadTemplateButton   = new SimpleJButton(__BUTTON_LOAD_FILE, this);
            __helpButton           = new SimpleJButton(__BUTTON_HELP, this);
            __helpButton.setEnabled(false);
            __closeButton = new SimpleJButton(__BUTTON_CLOSE, this);

            __useAllJCheckBox = new JCheckBox(__CHECKBOX_USE_ALL, false);
            __useAllJCheckBox.addActionListener(this);

            // Make a main panel to be the resizable body of the frame...

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

            main_JPanel.setLayout(gb);

            GridLayout gl        = new GridLayout(2, 2, 2, 2);
            JPanel     top_panel = new JPanel();

            top_panel.setLayout(gl);

            JPanel radio_panel = new JPanel();

            radio_panel.setLayout(gb);

            GridLayout gl2           = new GridLayout(1, 0, 2, 0);
            JPanel     bottom_JPanel = new JPanel();

            bottom_JPanel.setLayout(gl2);

            FlowLayout fl = new FlowLayout(FlowLayout.CENTER);
            JPanel     final_button_JPanel = new JPanel();

            final_button_JPanel.setLayout(fl);

            JPanel grid_JPanel = new JPanel();

            grid_JPanel.setLayout(gb);


            // add add a row, delete selected rows, clear spreadsheet,
            // select template, save template buttons
            top_panel.add(__addRowButton);
            top_panel.add(__deleteRowButton);
            top_panel.add(__clearWorksheetButton);
            top_panel.add(__loadTemplateButton);
            int y = 0;

            JGUIUtil.addComponent(main_JPanel, top_panel, 0, y, 10, 3, 0, 0, 10, 10, 10, 10, GridBagConstraints.NONE, GridBagConstraints.NORTH);

            y += 3;
            JGUIUtil.addComponent(main_JPanel, __useAllJCheckBox, 0, ++y, 1, 1, 0, 0, 0, 0, 0, 0, GridBagConstraints.NONE, GridBagConstraints.WEST);

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

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

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

            try
            {
                __tableModel = new StateMod_OutputControl_TableModel(this, new List <object>(), (System.Collections.IList)__riverNetworkComp.getData());

                StateMod_OutputControl_CellRenderer cro = new StateMod_OutputControl_CellRenderer(__tableModel);

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

                System.Collections.IList v = StateMod_Util.arrayToList(StateMod_GraphNode.node_types);
                v.Add("Other");
                __worksheet.setColumnJComboBoxValues(0, v);

                __worksheet.setCellSpecificJComboBoxColumn(1, false);

                System.Collections.IList offOn = new List <object>();
                offOn.Add("Off");
                offOn.Add("On");
                __worksheet.setColumnJComboBoxValues(2, offOn);

                __tableModel.setWorksheet(__worksheet);

                widths = cro.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.setHourglassJFrame(this);

            JGUIUtil.addComponent(grid_JPanel, jsw, 0, 0, 1, 1, 1, 1, GridBagConstraints.BOTH, GridBagConstraints.CENTER);

            JGUIUtil.addComponent(main_JPanel, grid_JPanel, 0, ++y, 10, 12, 1, 1, GridBagConstraints.BOTH, GridBagConstraints.CENTER);

            y += 11;     // To account for grid height

            // Add bottom buttons - these are alphabetical so be
            //	careful if you add more ...

            final_button_JPanel.add(__closeButton);
            // REVISIT SAM 2006-03-04
            // Help is not currently enabled
            //final_button_JPanel.add(__helpButton);
            final_button_JPanel.add(__saveTemplateButton);

            // Add the final buttons on the bottom to the bottom panel...
            bottom_JPanel.add(final_button_JPanel);
            // Add the button panel to the frame...
            JGUIUtil.addComponent(main_JPanel, bottom_JPanel, 0, ++y, 10, 1, 0, 0, GridBagConstraints.VERTICAL, GridBagConstraints.SOUTH);

            // Add the main panel as the resizable content...

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

            // Add JTextFields for messages...
            JPanel message_JPanel = new JPanel();

            message_JPanel.setLayout(gb);
            __messageJTextField = new JTextField();
            __messageJTextField.setEditable(false);
            __statusJTextField = new JTextField("             ");
            __statusJTextField.setEditable(false);
            JGUIUtil.addComponent(message_JPanel, __messageJTextField, 0, 0, 9, 1, 1, 0, GridBagConstraints.HORIZONTAL, GridBagConstraints.WEST);
            JGUIUtil.addComponent(message_JPanel, __statusJTextField, 9, 0, 1, 1, 0, 0, GridBagConstraints.HORIZONTAL, GridBagConstraints.SOUTH);
            getContentPane().add("South", message_JPanel);

            pack();
            setSize(670, 500);
            JGUIUtil.center(this);
            setVisible(true);

            if (widths != null)
            {
                __worksheet.setColumnWidths(widths);
            }
        }
예제 #14
0
	/// <summary>
	/// Sets up the GUI. </summary>
	/// <param name="index"> Data item to display. </param>
	private void setupGUI(int index)
	{
		string routine = "StateMod_DelayTable_JFrame";

		addWindowListener(this);

		// AWT portion
		JPanel p1 = new JPanel(); // selection list and grid
		JPanel p2 = new JPanel(); // search widgets
		JPanel pmain = new JPanel(); // everything but close and help buttons

		__searchID = new JTextField(10);
		__findNextDelay = new JButton("Find Next");

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

		bool percent = true;
		if (__dataset.getInterv() == -100 || __dataset.getInterv() < -1)
		{
			percent = false;
		}

		int[] widthsR = null;
		JScrollWorksheet jswR = null;
		try
		{
			StateMod_DelayTable_TableModel tmd = new StateMod_DelayTable_TableModel(new List<double?>(), __monthly_data, __editable, percent);
			tmd.setSubDelays(new List<double?>());
			StateMod_DelayTable_CellRenderer crd = new StateMod_DelayTable_CellRenderer(tmd);

			jswR = new JScrollWorksheet(crd, tmd, p);
			__worksheetR = jswR.getJWorksheet();

			// remove the ID column
			__worksheetR.removeColumn(0);
			widthsR = crd.getColumnWidths();
		}
		catch (Exception e)
		{
			Message.printWarning(1, routine, "Error building worksheet.");
			Message.printWarning(2, routine, e);
			jswR = new JScrollWorksheet(0, 0, p);
			__worksheetR = jswR.getJWorksheet();
		}
		__worksheetR.setPreferredScrollableViewportSize(null);

		// Assume all have the same units so pass in the first one...
		__worksheetR.setHourglassJFrame(this);
		__worksheetR.addMouseListener(this);
		__worksheetR.addKeyListener(this);

		__graphDelayJButton = new JButton("Graph");

		if (__delaysVector.Count == 0)
		{
			__graphDelayJButton.setEnabled(false);
		}

		__helpJButton = new JButton(__BUTTON_HELP);
		__helpJButton.setEnabled(false);
		__closeJButton = new JButton(__BUTTON_CLOSE);
		__addReturn = new JButton(__BUTTON_ADD_RETURN);
		__deleteReturn = new JButton(__BUTTON_DELETE_RETURN);
		__deleteReturn.setEnabled(false);
		JButton cancelJButton = new JButton(__BUTTON_CANCEL);
		JButton applyJButton = new JButton(__BUTTON_APPLY);

		GridBagLayout gb = new GridBagLayout();
		p1.setLayout(gb);
		p2.setLayout(gb);
		pmain.setLayout(gb);

		int y;

		int[] widthsL = null;
		JScrollWorksheet jswL = null;
		try
		{
			StateMod_DelayTable_TableModel tmd = new StateMod_DelayTable_TableModel(__delaysVector, __monthly_data, __editable, percent);
			StateMod_DelayTable_CellRenderer crd = new StateMod_DelayTable_CellRenderer(tmd);

			jswL = new JScrollWorksheet(crd, tmd, p);
			__worksheetL = jswL.getJWorksheet();

			// remove all the columns but the ID column.
			__worksheetL.removeColumn(1);
			__worksheetL.removeColumn(2);
			widthsL = crd.getColumnWidths();
		}
		catch (Exception e)
		{
			Message.printWarning(1, routine, "Error building worksheet.");
			Message.printWarning(2, routine, e);
			jswL = new JScrollWorksheet(0, 0, p);
			__worksheetL = jswL.getJWorksheet();
		}
		__worksheetL.setPreferredScrollableViewportSize(null);
		__worksheetR.setPreferredScrollableViewportSize(null);
		__worksheetL.setHourglassJFrame(this);
		__worksheetL.addMouseListener(this);
		__worksheetL.addKeyListener(this);

		JGUIUtil.addComponent(pmain, jswL, 0, 0, 2, 12, .2, 1, 10, 10, 1, 10, GridBagConstraints.BOTH, GridBagConstraints.WEST);

		JGUIUtil.addComponent(pmain, jswR, 5, 1, 18, 24, 1, 1, 10, 10, 10, 10, GridBagConstraints.BOTH, GridBagConstraints.WEST);

		JPanel bottomJPanel = new JPanel();
		bottomJPanel.setLayout(gb);
		__messageJTextField = new JTextField();
		__messageJTextField.setEditable(false);
		JGUIUtil.addComponent(bottomJPanel, __messageJTextField, 0, 1, 7, 1, 1.0, 0.0, GridBagConstraints.HORIZONTAL, GridBagConstraints.WEST);
		__statusJTextField = new JTextField(5);
		__statusJTextField.setEditable(false);
		JGUIUtil.addComponent(bottomJPanel, __statusJTextField, 7, 1, 1, 1, 0.0, 0.0, GridBagConstraints.NONE, GridBagConstraints.WEST);

		// close and help buttons
		JPanel pfinal = new JPanel();
		FlowLayout fl = new FlowLayout(FlowLayout.RIGHT);
		pfinal.setLayout(fl);
		if (__editable)
		{
			pfinal.add(__addReturn);
			pfinal.add(__deleteReturn);
		}
		pfinal.add(applyJButton);
		pfinal.add(cancelJButton);
		pfinal.add(__closeJButton);
		pfinal.add(__graphDelayJButton);
	//	pfinal.add(__helpJButton);

		JGUIUtil.addComponent(bottomJPanel, pfinal, 0, 0, 8, 1, 1, 1, GridBagConstraints.HORIZONTAL, GridBagConstraints.CENTER);

		__helpJButton.addActionListener(this);
		__closeJButton.addActionListener(this);
		__graphDelayJButton.addActionListener(this);
		__addReturn.addActionListener(this);
		__deleteReturn.addActionListener(this);
		cancelJButton.addActionListener(this);
		applyJButton.addActionListener(this);

		// add search areas
		y = 0;
		JPanel searchPanel = new JPanel();
		searchPanel.setLayout(gb);
		searchPanel.setBorder(BorderFactory.createTitledBorder("Search above list for:     "));
		JGUIUtil.addComponent(searchPanel, new JLabel("ID"), 0, y, 1, 1, 0, 0, 5, 0, 0, 0, GridBagConstraints.NONE, GridBagConstraints.WEST);
		JGUIUtil.addComponent(searchPanel, __searchID, 1, y, 1, 1, 1, 1, 0, 0, 0, 0, GridBagConstraints.HORIZONTAL, GridBagConstraints.EAST);
		__searchID.addActionListener(this);
		y++;
		JGUIUtil.addComponent(searchPanel, __findNextDelay, 0, y, 4, 1, 0, 0, 10, 0, 0, 0, GridBagConstraints.NONE, GridBagConstraints.CENTER);
		__findNextDelay.addActionListener(this);
		JGUIUtil.addComponent(pmain, searchPanel, 0, GridBagConstraints.RELATIVE, 1, 1, 0, 0, 5, 10, 20, 10, GridBagConstraints.NONE, GridBagConstraints.SOUTHWEST);

		getContentPane().add("Center", pmain);
		getContentPane().add("South", bottomJPanel);

		if (__dataset_wm != null)
		{
			__dataset_wm.setWindowOpen(__window_type, this);
		}
		pack();
		setSize(530, 400);
		JGUIUtil.center(this);
		setVisible(true);

		if (widthsR != null)
		{
			__worksheetR.setColumnWidths(widthsR);
		}
		if (widthsL != null)
		{
			__worksheetL.setColumnWidths(widthsL);
		}

		selectLeftTableIndex(index, false, true);
	}