/// <summary> /// Inserts the specified value into the table at the given position. </summary> /// <param name="value"> the object to store in the table cell. </param> /// <param name="row"> the row of the cell in which to place the object. </param> /// <param name="col"> the column of the cell in which to place the object. </param> public virtual void setValueAt(object value, int row, int col) { StateCU_ClimateStation station = (StateCU_ClimateStation)_data.get(row); switch (col) { case __COL_ID: station.setID((string)value); break; case __COL_NAME: station.setName((string)value); break; case __COL_ELEVATION: station.setElevation(((double?)value).Value); break; case __COL_LATITUDE: station.setLatitude(((double?)value).Value); break; case __COL_REGION1: station.setRegion1((string)value); break; case __COL_REGION2: station.setRegion2((string)value); break; case __COL_ZH: station.setZh(((double?)value).Value); break; case __COL_ZM: station.setZm(((double?)value).Value); break; } base.setValueAt(value, row, col); }
/// <summary> /// Saves the information associated with the currently-selected station. /// The user doesn't need to hit the return key for the gui to recognize changes. /// The info is saved each time the user selects a different station or pressed the close button. /// </summary> private void saveInformation(int record) { if (!__editable || record == -1) { return; } StateCU_ClimateStation station = __stationsVector[record]; if (!checkInput()) { return; } station.setName(__nameJTextField.getText()); station.setID(__stationIDJTextField.getText()); station.setLatitude((new double?(__latitudeJTextField.getText()))); station.setElevation((new double?(__elevationJTextField.getText()))); station.setRegion1(__region1JTextField.getText()); station.setRegion2(__region2JTextField.getText()); }
/// <summary> /// Read the StateCU climate stations file and return as a list of CUClimateStation. </summary> /// <param name="filename"> filename containing CLI records. </param> //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET: //ORIGINAL LINE: public static java.util.List<StateCU_ClimateStation> readStateCUFile(String filename) throws java.io.IOException public static IList <StateCU_ClimateStation> readStateCUFile(string filename) { string rtn = "StateCU_ClimateStation.readStateCUFile"; string iline = null; IList <object> v = new List <object> (10); IList <StateCU_ClimateStation> sta_Vector = new List <StateCU_ClimateStation> (100); // Data to return. int[] format_0 = new int[] { StringUtil.TYPE_STRING, StringUtil.TYPE_STRING, StringUtil.TYPE_STRING, StringUtil.TYPE_SPACE, StringUtil.TYPE_STRING, StringUtil.TYPE_STRING, StringUtil.TYPE_SPACE, StringUtil.TYPE_STRING, StringUtil.TYPE_STRING, StringUtil.TYPE_STRING }; int[] format_0w = new int[] { 12, 6, 9, 2, 20, 8, 2, 24, 8, 8 }; StateCU_ClimateStation sta = null; StreamReader @in = null; try { Message.printStatus(2, rtn, "Reading StateCU climate station file: \"" + filename + "\""); // The following throws an IOException if the file cannot be opened... @in = new StreamReader(filename); string @string; while (!string.ReferenceEquals((iline = @in.ReadLine()), null)) { // check for comments if (iline.StartsWith("#", StringComparison.Ordinal) || iline.Trim().Length == 0) { continue; } // allocate new StateCU_ClimateStation instance... sta = new StateCU_ClimateStation(); StringUtil.fixedRead(iline, format_0, format_0w, v); sta.setID(((string)v[0]).Trim()); @string = ((string)v[1]).Trim(); if ((@string.Length != 0) && StringUtil.isDouble(@string)) { sta.setLatitude(StringUtil.atod(@string)); } @string = ((string)v[2]).Trim(); if ((@string.Length != 0) && StringUtil.isDouble(@string)) { sta.setElevation(StringUtil.atod(@string)); } sta.setRegion1(((string)v[3]).Trim()); sta.setRegion2(((string)v[4]).Trim()); sta.setName(((string)v[5]).Trim()); @string = ((string)v[6]).Trim(); if ((@string.Length != 0) && StringUtil.isDouble(@string)) { sta.setZh(double.Parse(@string)); } @string = ((string)v[7]).Trim(); if ((@string.Length != 0) && StringUtil.isDouble(@string)) { sta.setZm(double.Parse(@string)); } // add the StateCU_ClimateStation to the list... sta_Vector.Add(sta); } } finally { if (@in != null) { @in.Close(); } } return(sta_Vector); }