/// <summary> /// Saves the input back into the dataset. </summary> /// <returns> true if the data was saved successfuly. False if not. </returns> private bool saveData() { string routine = "StateMod_Well_Right_JFrame.saveData"; if (!__worksheet.stopEditing()) { // don't save if there are errors. Message.printWarning(1, routine, "There are errors in the data " + "that must be corrected before data can be saved.", this); return(false); } if (checkInput() > 0) { return(false); } // now only save data if any are different. bool needToSave = false; // if the Vectors are differently-sized, they're different //JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @SuppressWarnings("unchecked") java.util.List<StateMod_WellRight> wv = (java.util.List<StateMod_WellRight>)__worksheet.getAllData(); IList <StateMod_WellRight> wv = (IList <StateMod_WellRight>)__worksheet.getAllData(); // w for worksheet IList <StateMod_WellRight> lv = (IList <StateMod_WellRight>)__currentWell.getRights(); // l for welL needToSave = !(StateMod_WellRight.Equals(wv, lv)); Message.printStatus(1, routine, "Saving? .........[" + needToSave + "]"); if (!needToSave) { // there's nothing different -- users may even have deleted // some rights and added back in identical values return(true); } // at this point, remove the old diversion rights from the original // component Vector //JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @SuppressWarnings("unchecked") java.util.List<StateMod_WellRight> wellRights = (java.util.List<StateMod_WellRight>)(__dataset.getComponentForComponentType(StateMod_DataSet.COMP_WELL_RIGHTS)).getData(); IList <StateMod_WellRight> wellRights = (IList <StateMod_WellRight>)(__dataset.getComponentForComponentType(StateMod_DataSet.COMP_WELL_RIGHTS)).getData(); int size = lv.Count; StateMod_WellRight wr; for (int i = 0; i < size; i++) { wr = lv[i]; StateMod_Util.removeFromVector(wellRights, wr); } // now add the elements from the new Vector to the wellRights // Vector. size = wv.Count; StateMod_WellRight cwr = null; for (int i = 0; i < size; i++) { wr = (StateMod_WellRight)wv[i]; cwr = (StateMod_WellRight)wr.clone(); cwr._isClone = false; wellRights.Add(cwr); } // sort the wellRights Vector // REVISIT (JTS - 2003-10-10) // here we are sorting the full data array -- may be a performance // issue IList <StateMod_WellRight> sorted = StateMod_Util.sortStateMod_DataVector(wellRights); __dataset.getComponentForComponentType(StateMod_DataSet.COMP_WELL_RIGHTS).setData(sorted); __currentWell.disconnectRights(); __currentWell.connectRights(sorted); __dataset.setDirty(StateMod_DataSet.COMP_WELL_RIGHTS, true); return(true); }