Example #1
0
        /// <summary>
        /// Constructor. </summary>
        /// <param name="crop"> StateCU_CropCharacteristics object to display </param>
        /// <param name="editable"> whether the display should be editable or not. </param>
        public StateCU_CropCharacteristics_JFrame(StateCU_DataSet dataset, StateCU_CropCharacteristics crop, bool editable) : base(dataset.getBaseName() + " - StateCU GUI - Crop Characteristics")
        {
            __currentCropIndex = -1;
            __editable         = editable;

            __dataset       = dataset;
            __cropComponent = __dataset.getComponentForComponentType(StateCU_DataSet.COMP_CROP_CHARACTERISTICS);
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @SuppressWarnings("unchecked") java.util.List<StateCU_CropCharacteristics> cropsVector0 = (java.util.List<StateCU_CropCharacteristics>)__cropComponent.getData();
            IList <StateCU_CropCharacteristics> cropsVector0 = (IList <StateCU_CropCharacteristics>)__cropComponent.getData();

            __cropsVector = cropsVector0;

            __blaneyComponent = __dataset.getComponentForComponentType(StateCU_DataSet.COMP_BLANEY_CRIDDLE);
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @SuppressWarnings("unchecked") java.util.List<StateCU_BlaneyCriddle> blaneyVector0 = (java.util.List<StateCU_BlaneyCriddle>)__blaneyComponent.getData();
            IList <StateCU_BlaneyCriddle> blaneyVector0 = (IList <StateCU_BlaneyCriddle>)__blaneyComponent.getData();

            __blaneyVector = blaneyVector0;

            string id    = crop.getID();
            int    index = StateCU_Util.IndexOf(__cropsVector, id);

            setupGUI(index);
        }
	/// <summary>
	/// Constructor. </summary>
	/// <param name="title"> Title for JFrame.  If null, an appropriate default is used. </param>
	/// <param name="dataset"> dataset containing data to display </param>
	/// <param name="station"> StateCU_ClimateStation object to display </param>
	/// <param name="editable"> whether the display should be editable or not. </param>
	public StateCU_ClimateStation_JFrame(string title, StateCU_DataSet dataset, StateCU_ClimateStation station, bool editable)
	{
		if (string.ReferenceEquals(title, null))
		{
			setTitle("StateCU Climate Stations");
		}
		else
		{
			setTitle(title);
		}
		__dataset = dataset;
		__currentStationIndex = -1;

		__stationComponent = __dataset.getComponentForComponentType(StateCU_DataSet.COMP_CLIMATE_STATIONS);
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @SuppressWarnings("unchecked") java.util.List<StateCU_ClimateStation> stationsVector0 = (java.util.List<StateCU_ClimateStation>)__stationComponent.getData();
		IList<StateCU_ClimateStation> stationsVector0 = (IList<StateCU_ClimateStation>)__stationComponent.getData();
		__stationsVector = stationsVector0;

		string id = station.getID();
		int index = StateCU_Util.IndexOf(__stationsVector, id);

		__editable = editable;

		setupGUI(index);
	}
        /// <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("");
        }