/// <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_ReservoirAreaCap ra = (StateMod_ReservoirAreaCap)_data.get(row);

            switch (col)
            {
            case COL_RESERVOIR_ID:
                ra.setCgoto((string)value);
                break;

            case COL_CAPACITY:
                dval = ((double?)value).Value;
                ra.setConten(dval);
                break;

            case COL_AREA:
                dval = ((double?)value).Value;
                ra.setSurarea(dval);
                break;

            case COL_SEEPAGE:
                dval = ((double?)value).Value;
                ra.setSeepage(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_ReservoirAreaCap ra = (StateMod_ReservoirAreaCap)_data.get(row);

            // necessary for worksheets that display area capacities 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:
                ra.setCgoto((string)value);
                break;

            case COL_CAPACITY:
                dval = ((double?)value).Value;
                ra.setConten(dval);
                break;

            case COL_AREA:
                dval = ((double?)value).Value;
                ra.setSurarea(dval);
                break;

            case COL_SEEPAGE:
                dval = ((double?)value).Value;
                ra.setSeepage(dval);
                break;
            }

            if (!__singleReservoir)
            {
                col++;
            }

            base.setValueAt(value, row, col);
        }
Пример #3
0
        /// <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 as the GUI title. </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>
        /// <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_ReservoirAreaCap_Data_JFrame(java.util.List data, String titleString, boolean editable) throws Exception
        public StateMod_ReservoirAreaCap_Data_JFrame(System.Collections.IList data, string titleString, bool editable) : base()
        {
            int j     = 0;
            int size  = 0;
            int size2 = 0;
            StateMod_Reservoir        r = null;
            StateMod_ReservoirAreaCap a = null;

            System.Collections.IList areacaps = 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];
                areacaps = r.getAreaCaps();
                if (areacaps == null)
                {
                    continue;
                }

                size2 = areacaps.Count;

                for (j = 0; j < size2; j++)
                {
                    a = (StateMod_ReservoirAreaCap)areacaps[j];
                    a.setCgoto(r.getID());
                    v.Add(a);
                }
            }

            initialize(v, titleString, editable);
            setSize(400, getHeight());
        }