/// <summary>
        /// Responds to action performed events. </summary>
        /// <param name="e"> the ActionEvent that occurred. </param>
        public virtual void actionPerformed(ActionEvent e)
        {
            string action = e.getActionCommand();

            if (action.Equals(__BUTTON_ADD_OWNER))
            {
                StateMod_ReservoirAccount anAccount = new StateMod_ReservoirAccount();
                anAccount._isClone = true;
                int rowCount = __worksheet.getRowCount();
                if (rowCount == 0)
                {
                    anAccount.setID(1);
                }
                else
                {
                    StateMod_ReservoirAccount lastAccount = (StateMod_ReservoirAccount)__worksheet.getLastRowData();
                    string id = lastAccount.getID();
                    anAccount.setID("" + ((Convert.ToInt32(id)) + 1));
                }
                __worksheet.addRow(anAccount);
                __worksheet.scrollToLastRow();
                __worksheet.selectLastRow();
                __deleteOwner.setEnabled(true);
            }
            else if (action.Equals(__BUTTON_DEL_OWNER))
            {
                int row = __worksheet.getSelectedRow();
                if (row != -1)
                {
                    int x = (new ResponseJDialog(this, "Delete owner", "Delete owner?", ResponseJDialog.YES | ResponseJDialog.NO)).response();
                    if (x == ResponseJDialog.NO)
                    {
                        return;
                    }
                    __worksheet.deleteRow(row);
                    __deleteOwner.setEnabled(false);
                }
            }
            else if (action.Equals(__BUTTON_CLOSE))
            {
                if (saveData())
                {
                    setVisible(false);
                    dispose();
                }
            }
            else if (action.Equals(__BUTTON_APPLY))
            {
                saveData();
            }
            else if (action.Equals(__BUTTON_CANCEL))
            {
                setVisible(false);
                dispose();
            }
            else if (action.Equals(__BUTTON_HELP))
            {
                // REVISIT HELP (JTS - 2003-06-09)
            }
        }
Exemple #2
0
        /// <summary>
        /// Responds to action performed events. </summary>
        /// <param name="e"> the ActionEvent that happened. </param>
        public virtual void actionPerformed(ActionEvent e)
        {
            string action = e.getActionCommand();

            if (action.Equals(__GraphArea_String))
            {
                graph(__GraphArea_String);
            }
            else if (action.Equals(__GraphSeepage_String))
            {
                graph(__GraphSeepage_String);
            }
            else if (action.Equals(__BUTTON_ADD_AREA_CAPACITY))
            {
                StateMod_ReservoirAreaCap anAreaCapNode = new StateMod_ReservoirAreaCap();
                anAreaCapNode._isClone = true;
                __worksheet.addRow(anAreaCapNode);
                __worksheet.scrollToLastRow();
                __worksheet.selectLastRow();
                __deleteAreaCap.setEnabled(true);
            }
            else if (action.Equals(__BUTTON_DEL_AREA_CAPACITY))
            {
                int row = __worksheet.getSelectedRow();
                if (row != -1)
                {
                    int x = (new ResponseJDialog(this, "Delete Content/Area/Seepage line?", "Delete Content/Area/Seepage line?", ResponseJDialog.YES | ResponseJDialog.NO)).response();
                    if (x == ResponseJDialog.NO)
                    {
                        return;
                    }
                    __worksheet.deleteRow(row);
                    __deleteAreaCap.setEnabled(false);
                }
            }
            else if (action.Equals(__BUTTON_CLOSE))
            {
                if (saveData())
                {
                    setVisible(false);
                    dispose();
                }
            }
            else if (action.Equals(__BUTTON_APPLY))
            {
                saveData();
            }
            else if (action.Equals(__BUTTON_CANCEL))
            {
                setVisible(false);
                dispose();
            }
            else if (action.Equals(__BUTTON_HELP))
            {
                // REVISIT HELP (JTS - 2003-06-09)
            }
        }
        /// <summary>
        /// Responds to action performed events. </summary>
        /// <param name="e"> the ActionEvent that happened. </param>
        public virtual void actionPerformed(ActionEvent e)
        {
            string action = e.getActionCommand();

            if (action.Equals(__BUTTON_ADD_DEPLETION))
            {
                StateMod_ReturnFlow aReturnFlow = new StateMod_ReturnFlow(StateMod_DataSet.COMP_WELL_STATIONS);
                aReturnFlow._isClone = true;
                __worksheet.addRow(aReturnFlow);
                __worksheet.scrollToLastRow();
                __worksheet.selectLastRow();
                __deleteDepletion.setEnabled(true);
            }
            else if (action.Equals(__BUTTON_DELETE_DEPLETION))
            {
                int row = __worksheet.getSelectedRow();
                if (row != -1)
                {
                    int x = (new ResponseJDialog(this, "Delete Depletion", "Delete depletion?", ResponseJDialog.YES | ResponseJDialog.NO)).response();
                    if (x == ResponseJDialog.NO)
                    {
                        return;
                    }
                    __worksheet.cancelEditing();
                    __worksheet.deleteRow(row);
                    __deleteDepletion.setEnabled(false);
                }
            }
            else if (action.Equals(__BUTTON_CLOSE))
            {
                if (saveData())
                {
                    setVisible(false);
                    dispose();
                }
            }
            else if (action.Equals(__BUTTON_APPLY))
            {
                saveData();
            }
            else if (action.Equals(__BUTTON_CANCEL))
            {
                setVisible(false);
                dispose();
            }
            else if (action.Equals(__BUTTON_HELP))
            {
                // REVISIT HELP (JTS - 2003-06-24)
            }
        }
        /// <summary>
        /// Responds to action performed events. </summary>
        /// <param name="e"> the ActionEvent that happened. </param>
        public virtual void actionPerformed(ActionEvent e)
        {
            string routine = "StateMod_Reservoir_Return_JFrame::actionPerformed";

            string action = e.getActionCommand();

            if (action.Equals(__BUTTON_ADD_RETURN))
            {
                StateMod_ReturnFlow aReturn = new StateMod_ReturnFlow(StateMod_DataSet.COMP_RESERVOIR_RETURN);
                aReturn._isClone = true;
                StateMod_ReturnFlow last = (StateMod_ReturnFlow)__worksheet.getLastRowData();

                if (last == null)
                {
                    aReturn.setID(StateMod_Util.createNewID(__currentRes.getID()));
                    aReturn.setCgoto(__currentRes.getID());
                }
                else
                {
                    aReturn.setID(StateMod_Util.createNewID(last.getID()));
                    aReturn.setCgoto(last.getCgoto());
                }
                __worksheet.scrollToLastRow();
                __worksheet.addRow(aReturn);
                __worksheet.selectLastRow();
                __deleteReturn_JButton.setEnabled(true);
            }
            else if (action.Equals(__BUTTON_DEL_RETURN))
            {
                int row = __worksheet.getSelectedRow();
                if (row != -1)
                {
                    int x = (new ResponseJDialog(this, "Delete return", "Delete reservoir return?", ResponseJDialog.YES | ResponseJDialog.NO)).response();
                    if (x == ResponseJDialog.NO)
                    {
                        return;
                    }

                    __worksheet.cancelEditing();
                    __worksheet.deleteRow(row);
                    __deleteReturn_JButton.setEnabled(false);
                }
                else
                {
                    Message.printWarning(1, routine, "Must select desired return to delete.");
                }
            }
            else if (action.Equals(__BUTTON_CLOSE))
            {
                if (saveData())
                {
                    setVisible(false);
                    dispose();
                }
            }
            else if (action.Equals(__BUTTON_APPLY))
            {
                saveData();
            }
            else if (action.Equals(__BUTTON_CANCEL))
            {
                setVisible(false);
                dispose();
            }
            else if (e.getSource() == __help_JButton)
            {
                // TODO HELP (JTS - 2003-06-09)
            }
        }
        /// <summary>
        /// Reponds to action performed events. </summary>
        /// <param name="e"> the ActionEvent that happened. </param>
        public virtual void actionPerformed(ActionEvent e)
        {
            string action = e.getActionCommand();

            if (action.Equals(__BUTTON_ADD_PRECIPITATION_STATION))
            {
                StateMod_ReservoirClimate aClimateNode = new StateMod_ReservoirClimate();
                aClimateNode._isClone = true;
                aClimateNode.setType(StateMod_ReservoirClimate.CLIMATE_PTPX);
                __worksheetP.addRow(aClimateNode);
                __worksheetP.scrollToLastRow();
                __worksheetP.selectLastRow();
                checkDeleteStationButton();
            }
            else if (action.Equals(__BUTTON_ADD_EVAPORATION_STATION))
            {
                StateMod_ReservoirClimate aClimateNode = new StateMod_ReservoirClimate();
                aClimateNode._isClone = true;
                aClimateNode.setType(StateMod_ReservoirClimate.CLIMATE_EVAP);
                __worksheetE.addRow(aClimateNode);
                __worksheetE.scrollToLastRow();
                __worksheetE.selectLastRow();
                checkDeleteStationButton();
            }
            else if (action.Equals(__BUTTON_DELETE_PRECIPITATION_STATION))
            {
                int rowP  = __worksheetP.getSelectedRow();
                int rowE  = __worksheetE.getSelectedRow();
                int count = 0;
                if (rowP > -1)
                {
                    count++;
                }
                if (rowE > -1)
                {
                    count++;
                }
                if (count > 0)
                {
                    string plural = "s";
                    if (count == 1)
                    {
                        plural = "";
                    }
                    int x = (new ResponseJDialog(this, "Delete climate station" + plural, "Delete climate station" + plural + "?", ResponseJDialog.YES | ResponseJDialog.NO)).response();
                    if (x == ResponseJDialog.NO)
                    {
                        return;
                    }
                    if (rowP > -1)
                    {
                        __worksheetP.deleteRow(rowP);
                        __deleteStation.setEnabled(false);
                        __worksheetP.scrollToLastRow();
                    }
                    if (rowE > -1)
                    {
                        __worksheetE.deleteRow(rowE);
                        __deleteStation.setEnabled(false);
                        __worksheetE.scrollToLastRow();
                    }
                }
            }
            else if (action.Equals(__BUTTON_CLOSE))
            {
                if (saveData())
                {
                    setVisible(false);
                    dispose();
                }
            }
            else if (action.Equals(__BUTTON_APPLY))
            {
                saveData();
            }
            else if (action.Equals(__BUTTON_CANCEL))
            {
                setVisible(false);
                dispose();
            }
            else if (action.Equals(__BUTTON_HELP))
            {
                // REVISIT HELP (JTS - 2003-06-09)
            }
        }
Exemple #6
0
        /// <summary>
        /// Responds to action performed events. </summary>
        /// <param name="e"> the ActionEvent that happened. </param>
        public virtual void actionPerformed(ActionEvent e)
        {
            string routine = "StateMod_Well_Right_JFrame.actionPerformed";

            string action = e.getActionCommand();

            if (action.Equals(__BUTTON_ADD_RIGHT))
            {
                StateMod_WellRight aRight = new StateMod_WellRight();
                aRight._isClone = true;
                StateMod_WellRight last = (StateMod_WellRight)__worksheet.getLastRowData();

                if (last == null)
                {
                    aRight.setID(StateMod_Util.createNewID(__currentWell.getID()));
                    aRight.setCgoto(__currentWell.getID());
                }
                else
                {
                    aRight.setID(StateMod_Util.createNewID(last.getID()));
                    aRight.setCgoto(last.getCgoto());
                }
                __worksheet.addRow(aRight);
                __worksheet.scrollToLastRow();
                __worksheet.selectLastRow();
                __deleteRight.setEnabled(true);
            }
            else if (action.Equals(__BUTTON_DEL_RIGHT))
            {
                int row = __worksheet.getSelectedRow();
                if (row != -1)
                {
                    int x = (new ResponseJDialog(this, "Delete right", "Delete well right?", ResponseJDialog.YES | ResponseJDialog.NO)).response();
                    if (x == ResponseJDialog.NO)
                    {
                        return;
                    }

                    __worksheet.cancelEditing();
                    __worksheet.deleteRow(row);
                    __deleteRight.setEnabled(false);
                }
                else
                {
                    Message.printWarning(1, routine, "Must select desired right to delete.");
                }
            }
            else if (action.Equals(__BUTTON_HELP))
            {
                // REVISIT HELP (JTS - 2003-06-10)
            }
            else if (action.Equals(__BUTTON_CLOSE))
            {
                if (saveData())
                {
                    setVisible(false);
                    dispose();
                }
            }
            else if (action.Equals(__BUTTON_APPLY))
            {
                saveData();
            }
            else if (action.Equals(__BUTTON_CANCEL))
            {
                setVisible(false);
                dispose();
            }
        }