/// <summary> /// Constructor. </summary> /// <param name="data"> the data to display in the worksheet. Can be null or empty, in /// which case an empty worksheet is shown. </param> /// <param name="titleString"> the String to display in the title of the GUI. </param> /// <param name="editable"> whether the data in the JFrame can be edited or not. If true /// the data can be edited, if false they can not. </param> /// <param name="precip"> if true, then the climate stations to view are precip stations. /// If false, they are evap stations. </param> /// <exception cref="Exception"> if there is an error building the worksheet. </exception> //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET: //ORIGINAL LINE: public StateMod_ReservoirClimate_Data_JFrame(java.util.List data, String titleString, boolean editable, boolean precip) throws Exception public StateMod_ReservoirClimate_Data_JFrame(System.Collections.IList data, string titleString, bool editable, bool precip) : base() { int j = 0; int size = 0; int size2 = 0; StateMod_Reservoir r = null; StateMod_ReservoirClimate c = null; System.Collections.IList climates = null; System.Collections.IList v = new List <object>(); if (data != null) { size = data.Count; } for (int i = 0; i < size; i++) { r = (StateMod_Reservoir)data[i]; climates = r.getClimates(); if (climates == null) { continue; } size2 = climates.Count; for (j = 0; j < size2; j++) { c = (StateMod_ReservoirClimate)climates[j]; if (c == null) { // skip } else if (!precip && c.getType() == StateMod_ReservoirClimate.CLIMATE_EVAP) { c.setCgoto(r.getID()); v.Add(c); } else if (precip && c.getType() == StateMod_ReservoirClimate.CLIMATE_PTPX) { c.setCgoto(r.getID()); v.Add(c); } } } initialize(v, titleString, editable); setSize(377, getHeight()); }
/// <summary> /// Sets the value at the specified position to the specified value. </summary> /// <param name="value"> the value to set the cell to. </param> /// <param name="row"> the row of the cell for which to set the value. </param> /// <param name="col"> the col of the cell for which to set the value. </param> public virtual void setValueAt(object value, int row, int col) { if (_sortOrder != null) { row = _sortOrder[row]; } double dval; StateMod_ReservoirClimate cl = (StateMod_ReservoirClimate)_data.get(row); switch (col) { case COL_RESERVOIR_ID: cl.setCgoto((string)value); break; case COL_STATION: string s = (string)value; int index = s.IndexOf(" - ", StringComparison.Ordinal); if (index > -1) { s = s.Substring(0, index); } cl.setID(s); break; case COL_PCT_WEIGHT: dval = ((double?)value).Value; cl.setWeight(dval); break; } base.setValueAt(value, row, col); }
/// <summary> /// Sets the value at the specified position to the specified value. </summary> /// <param name="value"> the value to set the cell to. </param> /// <param name="row"> the row of the cell for which to set the value. </param> /// <param name="col"> the col of the cell for which to set the value. </param> public virtual void setValueAt(object value, int row, int col) { if (_sortOrder != null) { row = _sortOrder[row]; } double dval; StateMod_ReservoirClimate cl = (StateMod_ReservoirClimate)_data.get(row); // necessary for table models that display climate data for 1+ // reservoirs, so that the -1st column (ID) can also be displayed. // By doing it this way, code can be shared between the two kinds of // table models and less maintenance is necessary. if (!__singleReservoir) { col--; } switch (col) { case COL_RESERVOIR_ID: cl.setCgoto((string)value); break; case COL_STATION: string s = (string)value; int index = s.IndexOf(" - ", StringComparison.Ordinal); if (index > -1) { s = s.Substring(0, index); } cl.setID(s); break; case COL_PCT_WEIGHT: dval = ((double?)value).Value; cl.setWeight(dval); break; } if (!__singleReservoir) { col++; } base.setValueAt(value, row, col); }