コード例 #1
0
        /// <summary>
        /// Sets up the data Vectors to display the location climate station data in the GUI.
        /// </summary>
        private void setupData()
        {
            int num             = 0;
            int size            = _data.size();
            StateCU_Location l  = null;
            string           id = null;

            __data = new System.Collections.IList[__COLUMNS];
            for (int i = 0; i < __COLUMNS; i++)
            {
                __data[i] = new List <object>();
            }

            int rows = 0;

            for (int i = 0; i < size; i++)
            {
                l   = (StateCU_Location)_data.get(i);
                id  = l.getID();
                num = l.getNumClimateStations();

                for (int j = 0; j < num; j++)
                {
                    __data[__COL_ID].Add(id);
                    __data[__COL_STA_ID].Add(l.getClimateStationID(j));
                    __data[__COL_TEMP_WT].Add(new double?(l.getTemperatureStationWeight(j)));
                    __data[__COL_PRECIP_WT].Add(new double?(l.getPrecipitationStationWeight(j)));
                    __data[__COL_ORO_TEMP_ADJ].Add(new double?(l.getOrographicTemperatureAdjustment(j)));
                    __data[__COL_ORO_PRECIP_ADJ].Add(new double?(l.getOrographicPrecipitationAdjustment(j)));
                    rows++;
                }
            }
            _rows = rows;
        }
コード例 #2
0
        /// <summary>
        /// From AbstractTableMode.  Returns the data that should be placed in the JTable at the given row and column. </summary>
        /// <param name="row"> the row for which to return data. </param>
        /// <param name="col"> the column for which to return data. </param>
        /// <returns> the data that should be placed in the JTable at the given row and col. </returns>
        public virtual object getValueAt(int row, int col)
        {
            if (_sortOrder != null)
            {
                row = _sortOrder[row];
            }

            if (__singleLocation)
            {
                switch (col)
                {
                case 1:
                case 2:
                    StateCU_Location location = (StateCU_Location)_data.get(row);
                    switch (col)
                    {
                    case 1:
                        return(location.getID());

                    case 2:
                        return(location.getName());
                    }

                case 3:
                    return(new double?(__delays.getDelayTablePercent(row)));

                case 4:
                    return(__delays.getDelayTableID(row));

                case 5:
                    return(__parentLocation.getClimateStationID(row));

                case 6:
                    int index = StateCU_Util.IndexOf(__stations, __parentLocation.getClimateStationID(row));
                    if (index == -1)
                    {
                        return("N/A");
                    }
                    return(((StateCU_ClimateStation)__stations[row]).getName());

                case 7:
                    return(new double?(__parentLocation.getPrecipitationStationWeight(row)));

                case 8:
                    return(new double?(__parentLocation.getTemperatureStationWeight(row)));

                case 9:
                case 10:
                case 11:
                case 12:
                case 13:
                    StateMod_DiversionRight right = (StateMod_DiversionRight)__rights[row];
                    switch (col)
                    {
                    case 9:
                        return(right.getID());

                    case 10:
                        return(right.getName());

                    case 11:
                        return(Convert.ToDouble(right.getIrtem()));

                    case 12:
                        return(new double?(right.getDcrdiv()));

                    case 13:
                        return(new int?(right.getSwitch()));
                    }

                default:
                    return("");
                }
            }
            else
            {
                StateCU_Location location = (StateCU_Location)_data.get(row);
                switch (col)
                {
                case __COL_ID:
                    return(location.getID());

                case __COL_NAME:
                    return(location.getName());

                case __COL_ELEVATION:
                    return(new double?(location.getElevation()));

                case __COL_LATITUDE:
                    return(new double?(location.getLatitude()));

                case __COL_REGION1:
                    return(location.getRegion1());

                case __COL_REGION2:
                    return(location.getRegion2());

                case __COL_NUM_STA:
                    return(new int?(location.getNumClimateStations()));

                case __COL_AWC:
                    return(new double?(location.getAwc()));
                }
            }
            return("");
        }