예제 #1
0
        /// <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);
        }