/// <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> /// Performs general and specific data checks on location climate station data. </summary> /// <param name="props"> A property list for specific properties. </param> /// <param name="data_vector"> Vector of data to check. </param> private void checkLocationClimateStationsData(PropList props, System.Collections.IList data_vector) { // Create elements for the checks and check file string[] header = StateCU_CropCharacteristics.getDataHeader(); System.Collections.IList data = new List <object>(); string title = "Location Climate Station"; // Perform the general validation using the Data Table Model StateCU_Data_TableModel tm = new StateCU_Location_ClimateStation_TableModel(data_vector); System.Collections.IList @checked = performDataValidation(tm, title); //String [] columnHeader = getDataTableModelColumnHeader( tm ); string[] columnHeader = getColumnHeader(tm); // Do specific checks int size = 0; if (data_vector != null) { size = data_vector.Count; } data = doSpecificDataChecks(data_vector, props); // Add the data and checks to the check file. // Provides basic header information for this data check table string info = "The following " + title + " (" + data.Count + " out of " + size + ") have no ....."; // Create data models for Check file CheckFile_DataModel dm = new CheckFile_DataModel(data, header, title, info, data.Count, size); CheckFile_DataModel gen_dm = new CheckFile_DataModel(@checked, columnHeader, title + " Missing or Invalid Data", "", __gen_problems, size); __check_file.addData(dm, gen_dm); }
/// <summary> /// Called when the Apply button is pressed. This commits any changes to the data /// objects. /// </summary> protected internal override void apply() { StateCU_CropCharacteristics station = null; int size = _data.Count; for (int i = 0; i < size; i++) { station = (StateCU_CropCharacteristics)_data[i]; station.createBackup(); } }
/// <summary> /// Called when the cancel button is pressed. This discards any changes made to /// the data objects. /// </summary> protected internal override void cancel() { StateCU_CropCharacteristics station = null; int size = _data.Count; for (int i = 0; i < size; i++) { station = (StateCU_CropCharacteristics)_data[i]; station.restoreOriginal(); } }
/// <summary> /// Saves the information associated with the currently-selected crop. /// 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 differents tation or pressed /// the close button. /// </summary> private void saveInformation(int record) { if (!__editable || record == -1) { return; } if (!checkInput()) { return; } StateCU_CropCharacteristics crop = (StateCU_CropCharacteristics)__cropsVector[record]; crop.setName(__nameJTextField.getText()); crop.setID(__cropIDJTextField.getText()); }
/// <summary> /// Sets the parent well under which the right and return flow data is stored. </summary> /// <param name="parent"> the parent well. </param> public virtual void setParentCropCharacteristics(StateCU_CropCharacteristics parent) { // TODO SAM 2007-03-01 Evaluate use //__parentCrop = parent; }
/// <summary> /// 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]; } StateCU_CropCharacteristics crop = (StateCU_CropCharacteristics)_data.get(row); if (__singleCrop) { switch (col) { case __COL_NAME: return(crop.getName()); case __COL_DAY_PCT: if (__blaneyCriddle == null) { return(new int?(0)); } if (__dayNotPercent) { return(new int?(__blaneyCriddle.getNckcp(row))); } else { return(new int?(__blaneyCriddle.getNckca(row))); } case __COL_VALUE: if (__blaneyCriddle == null) { return(new double?(0)); } if (__dayNotPercent) { return(new double?(__blaneyCriddle.getCkcp(row))); } else { return(new double?(__blaneyCriddle.getCkca(row))); } } } else { switch (col) { case __COL_NAME: return(crop.getName()); case __COL_GDATE1: return(new int?(crop.getGdate1())); case __COL_GDATE2: return(new int?(crop.getGdate2())); case __COL_GDATE3: return(new int?(crop.getGdate3())); case __COL_GDATE4: return(new int?(crop.getGdate4())); case __COL_GDATE5: return(new int?(crop.getGdate5())); case __COL_GDATES: return(new int?(crop.getGdates())); case __COL_TMOIS1: return(new double?(crop.getTmois1())); case __COL_TMOIS2: return(new double?(crop.getTmois2())); case __COL_MAD: return(new double?(crop.getMad())); case __COL_IRX: return(new double?(crop.getIrx())); case __COL_FRX: return(new double?(crop.getFrx())); case __COL_AWC: return(new double?(crop.getAwc())); case __COL_APD: return(new double?(crop.getApd())); case __COL_TFLAG1: return(new int?(crop.getTflg1())); case __COL_TFLAG2: return(new int?(crop.getTflg2())); case __COL_CUT2: return(new int?(crop.getCut2())); case __COL_CUT3: return(new int?(crop.getCut3())); } } return(""); }
/// <summary> /// Processes a table selection (either via a mouse press or programmatically /// from selectTableIndex() by writing the old data back to the data set component /// and getting the next selection's data out of the data and displaying it /// on the form. </summary> /// <param name="index"> the index of the reservoir to display on the form. </param> private void processTableSelection(int index) { __lastCropIndex = __currentCropIndex; __currentCropIndex = __worksheet.getOriginalRowNumber(index); saveLastRecord(); if (__worksheet.getSelectedRow() == -1) { nothingSelected(); return; } somethingSelected(); StateCU_CropCharacteristics crop = (StateCU_CropCharacteristics)__cropsVector[__currentCropIndex]; __cropIDJTextField.setText(crop.getID()); __nameJTextField.setText(crop.getName()); StateCU_Util.checkAndSet(crop.getGdate1(), __plantMonthJTextField); StateCU_Util.checkAndSet(crop.getGdate2(), __plantDayJTextField); StateCU_Util.checkAndSet(crop.getGdate3(), __harvestMonthJTextField); StateCU_Util.checkAndSet(crop.getGdate4(), __harvestDayJTextField); StateCU_Util.checkAndSet(crop.getGdate5(), __daysToCoverJTextField); StateCU_Util.checkAndSet(crop.getGdates(), __seasonLengthJTextField); StateCU_Util.checkAndSet(crop.getTmois1(), __earliestValueJTextField); StateCU_Util.checkAndSet(crop.getTmois2(), __latestValueJTextField); StateCU_Util.checkAndSet(crop.getFrx(), __maxRootFeetJTextField); StateCU_Util.checkAndSet(crop.getApd(), __maxAppDepthJTextField); StateCU_Util.checkAndSet(crop.getCut2(), __firstDaysBetweenJTextField); StateCU_Util.checkAndSet(crop.getCut3(), __secondDaysBetweenJTextField); int flag = crop.getTflg1(); if (flag == -999) { flag = 3; } __earliestFlagComboBox.select(flag); flag = crop.getTflg2(); if (flag == -999) { flag = 3; } __latestFlagComboBox.select(flag); int bcindex = StateCU_Util.indexOfName(__blaneyVector, crop.getID()); StateCU_BlaneyCriddle bc = null; if (bcindex != -1) { bc = (StateCU_BlaneyCriddle)__blaneyVector[bcindex]; if (bc.getFlag().Equals("Percent", StringComparison.OrdinalIgnoreCase)) { __coeffWorksheet.setColumnName(3, "PERCENT"); } else { __coeffWorksheet.setColumnName(3, "DAY"); } } __blaneyModel.setBlaneyCriddle(bc); }