/// <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) } }
/// <summary> /// Responds to action performed events. </summary> /// <param name="ae"> the ActionEvent that occurred. </param> public virtual void actionPerformed(ActionEvent ae) { string action = ae.getActionCommand(); if (action.Equals(__BUTTON_BROWSE)) { string file = browseForFile(); if (file.Trim().Equals("")) { return; } __tableModel.setValueAt(file, __worksheet.getSelectedRow(), StateMod_Response_TableModel.COL_NAME); } else if (action.Equals(__BUTTON_APPLY)) { saveData(); } else if (action.Equals(__BUTTON_CANCEL)) { closeWindow(); } else if (action.Equals(__BUTTON_CLOSE)) { if (saveData()) { closeWindow(); } } else if (action.Equals(__BUTTON_HELP)) { // TODO HELP(JTS - 2003-09-10) } }
/// <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) { try { string action = e.getActionCommand(); object source = e.getSource(); if (action.Equals(__BUTTON_HELP)) { // REVISIT HELP (JTS - 2003-06-10 } else if (action.Equals(__BUTTON_CLOSE)) { saveCurrentRecord(); dispose(); } else if (action.Equals(__BUTTON_APPLY)) { saveCurrentRecord(); } else if (action.Equals(__BUTTON_CANCEL)) { dispose(); } else if (action.Equals(__BUTTON_GRAPH) || action.Equals(__BUTTON_TABLE) || action.Equals(__BUTTON_SUMMARY)) { displayTSViewJFrame(action); } else if (source == __findNextStation) { searchWorksheet(__worksheet.getSelectedRow() + 1); } else if (source == __searchID || source == __searchName) { searchWorksheet(); } else if (source == __searchNameJRadioButton) { __searchName.setEditable(true); __searchID.setEditable(false); } else if (source == __searchIDJRadioButton) { __searchName.setEditable(false); __searchID.setEditable(true); } } catch (Exception ex) { Console.WriteLine(ex.ToString()); Console.Write(ex.StackTrace); } }
/// <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) } }
/// <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(); } }
/// <summary> /// Responds to action performed events. </summary> /// <param name="e"> the ActionEvent that happened. </param> public virtual void actionPerformed(ActionEvent e) { string routine = "StateMod_RiverNetworkNode_JFrame.actionPerformed"; if (Message.isDebugOn) { Message.printDebug(1, routine, "In actionPerformed: " + e.getActionCommand()); } object source = e.getSource(); if (source == __closeJButton) { saveCurrentRecord(); int size = __riverNetworkNodesVector.Count; StateMod_RiverNetworkNode r = null; bool changed = false; for (int i = 0; i < size; i++) { r = __riverNetworkNodesVector[i]; if (!changed && r.changed()) { changed = true; } r.acceptChanges(); } if (changed) { __dataset.setDirty(StateMod_DataSet.COMP_RIVER_NETWORK, true); } if (__dataset_wm != null) { __dataset_wm.closeWindow(StateMod_DataSet_WindowManager.WINDOW_RIVER_NETWORK); } else { JGUIUtil.close(this); } } else if (source == __applyJButton) { saveCurrentRecord(); int size = __riverNetworkNodesVector.Count; StateMod_RiverNetworkNode r = null; bool changed = false; for (int i = 0; i < size; i++) { r = __riverNetworkNodesVector[i]; if (!changed && r.changed()) { changed = true; } r.createBackup(); } if (changed) { __dataset.setDirty(StateMod_DataSet.COMP_RIVER_NETWORK, true); } } else if (source == __cancelJButton) { int size = __riverNetworkNodesVector.Count; StateMod_RiverNetworkNode r = null; for (int i = 0; i < size; i++) { r = __riverNetworkNodesVector[i]; r.restoreOriginal(); } if (__dataset_wm != null) { __dataset_wm.closeWindow(StateMod_DataSet_WindowManager.WINDOW_RIVER_NETWORK); } else { JGUIUtil.close(this); } } else if (source == __helpJButton) { // REVISIT HELP (JTS - 2003-08-18) } else if (source == __searchIDJRadioButton) { __searchName.setEditable(false); __searchID.setEditable(true); } else if (source == __searchNameJRadioButton) { __searchName.setEditable(true); __searchID.setEditable(false); } else if (source == __showOnMap_JButton) { GeoRecord geoRecord = getSelectedRiverNetworkNode().getGeoRecord(); GRShape shape = geoRecord.getShape(); __dataset_wm.showOnMap(getSelectedRiverNetworkNode(), "Node: " + getSelectedRiverNetworkNode().getID() + " - " + getSelectedRiverNetworkNode().getName(), new GRLimits(shape.xmin, shape.ymin, shape.xmax, shape.ymax), geoRecord.getLayer().getProjection()); } else if (source == __showOnNetwork_JButton) { StateMod_Network_JFrame networkEditor = __dataset_wm.getNetworkEditor(); if (networkEditor != null) { HydrologyNode node = networkEditor.getNetworkJComponent().findNode(getSelectedRiverNetworkNode().getID(), false, false); if (node != null) { __dataset_wm.showOnNetwork(getSelectedRiverNetworkNode(), "Node: " + getSelectedRiverNetworkNode().getID() + " - " + getSelectedRiverNetworkNode().getName(), new GRLimits(node.getX(), node.getY(), node.getX(), node.getY())); } } } else if (source == __findNext) { searchWorksheet(__worksheet.getSelectedRow() + 1); } else if (source == __searchID || source == __searchName) { searchWorksheet(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_DelayTable_JFrame" + ".actionPerformed"; if (Message.isDebugOn) { Message.printDebug(1, routine, "In actionPerformed: " + e.getActionCommand()); } string action = e.getActionCommand(); if (action.Equals(__BUTTON_HELP)) { // REVISIT HELP (JTS - 2003-06-09) } else if (action.Equals(__BUTTON_CLOSE)) { closeWindow(); } else if (action.Equals(__BUTTON_APPLY)) { saveDelayTable(); int size = __delaysVector.Count; StateMod_DelayTable dt = null; bool changed = false; for (int i = 0; i < size; i++) { dt = (StateMod_DelayTable)__delaysVector[i]; if (!changed && dt.changed()) { changed = true; } dt.createBackup(); } if (changed) { __dataset.setDirty(__componentType, true); } } else if (action.Equals(__BUTTON_CANCEL)) { __worksheetR.deselectAll(); int size = __delaysVector.Count; StateMod_DelayTable dt = null; bool changed = false; for (int i = 0; i < size; i++) { dt = (StateMod_DelayTable)__delaysVector[i]; if (!changed && dt.changed()) { changed = true; } dt.restoreOriginal(); } if (__dataset_wm != null) { __dataset_wm.closeWindow(__window_type); } else { JGUIUtil.close(this); } } else if (action.Equals(__BUTTON_ADD_RETURN)) { int row = __worksheetR.getSelectedRow(); int total_num_rows = __worksheetR.getRowCount() - 1; if (row == -1) { row = total_num_rows; } if (row != -1) { if (row == total_num_rows) { int x = new ResponseJDialog(this, "Insert row", "Do you wish to add a new row above " + "the last row?\n" + "uniquetempvar.response(); if (x == ResponseJDialog.CANCEL) { return; } else if (x == ResponseJDialog.NO) { row += 1; } } __worksheetR.insertRowAt(new double?(0), row); __worksheetR.scrollToRow(row); __worksheetR.selectRow(row); } else { __worksheetR.addRow(new double?(0)); __worksheetR.scrollToRow(0); __worksheetR.selectRow(0); } __deleteReturn.setEnabled(true); } else if (action.Equals(__BUTTON_DELETE_RETURN)) { int row = __worksheetR.getSelectedRow(); if (row != -1) { int x = (new ResponseJDialog(this, "Delete Return", "Delete return?", ResponseJDialog.YES | ResponseJDialog.NO)).response(); if (x == ResponseJDialog.NO) { return; } //StateMod_DelayTable dt = (StateMod_DelayTable) //__worksheetL.getRowData( //__worksheetL.getSelectedRow()); __worksheetR.deleteRow(row); __deleteReturn.setEnabled(false); } else { Message.printWarning(1, routine, "Must select desired right to delete."); } } else if (e.getSource() == __findNextDelay) { searchLeftWorksheet(__worksheetL.getSelectedRow() + 1); } else if (e.getSource() == __searchID) { searchLeftWorksheet(); } else { if (__worksheetL.getSelectedRow() == -1) { new ResponseJDialog(this, "You must first select a delay from the list.", ResponseJDialog.OK); return; } else if (e.getSource() == __graphDelayJButton) { try { __worksheetR.deselectAll(); int index = __worksheetL.getSelectedRow(); if (index == -1) { return; } StateMod_DelayTable currentDelay = ((StateMod_DelayTable) __delaysVector[index]); int j; DateTime date; TSIdent tsident = new TSIdent(); tsident.setLocation(currentDelay.getID()); tsident.setSource("StateMod"); if (__monthly_data) { tsident.setInterval("Month"); } else { tsident.setInterval("Day"); } tsident.setType("Delay"); DateTime date1 = null; DateTime date2 = null; int interval_base; if (__monthly_data) { date1 = new DateTime(DateTime.PRECISION_MONTH); date2 = new DateTime(DateTime.PRECISION_MONTH); interval_base = TimeInterval.MONTH; } else { date1 = new DateTime(DateTime.PRECISION_DAY); date2 = new DateTime(DateTime.PRECISION_DAY); interval_base = TimeInterval.DAY; } date1.setMonth(1); date1.setYear(1); date2.setMonth(1); date2.setYear(1); date2.addInterval(interval_base, (currentDelay.getNdly() - 1)); TS ts = null; if (__monthly_data) { ts = new MonthTS(); } else { ts = new DayTS(); } ts.setDate1(date1); ts.setDate2(date2); ts.setIdentifier(tsident); if (__monthly_data) { ts.setDescription(ts.getLocation() + " Monthly Delay Table"); } else { ts.setDescription(ts.getLocation() + " Daily Delay Table"); } ts.setDataType("Delay"); ts.setDataUnits(currentDelay.getUnits()); ts.allocateDataSpace(); double max = 0.0; for (date = new DateTime(date1), j = 0; date.lessThanOrEqualTo(date2); date.addInterval(interval_base, 1), j++) { ts.setDataValue(date, currentDelay.getRet_val(j)); if (currentDelay.getRet_val(j) > max) { max = currentDelay.getRet_val(j); } } IList<TS> tslist = new List<TS>(); tslist.Add(ts); PropList graphProps = new PropList("TSView"); // If dealing with small values, use a high // of precision... if (max < 1.0) { graphProps.set("YAxisPrecision","6"); graphProps.set("OutputPrecision","6"); } else { graphProps.set("YAxisPrecision","3"); graphProps.set("OutputPrecision","3"); } graphProps.set("InitialView", "Graph"); graphProps.set("TotalWidth", "600"); graphProps.set("TotalHeight", "400"); if (__monthly_data) { graphProps.set("Title", ts.getLocation() + " Monthly Delay Table"); } else { graphProps.set("Title", ts.getLocation() + " Daily Delay Table"); } graphProps.set("DisplayFont", "Courier"); graphProps.set("DisplaySize", "11"); graphProps.set("PrintFont", "Courier"); graphProps.set("PrintSize", "7"); graphProps.set("PageLength", "100"); new TSViewJFrame(tslist, graphProps); } catch (Exception) { Message.printWarning(1, routine, "Unable to graph delay. "); } } } }