public virtual void setBlaneyCriddle(StateCU_BlaneyCriddle bc)
        {
            __blaneyCriddle = bc;

            if (bc == null)
            {
                _rows = 0;
                fireTableDataChanged();
                return;
            }

            string flag = bc.getFlag();

            if (flag.Equals("Day", StringComparison.OrdinalIgnoreCase))
            {
                __dayNotPercent = true;
                _rows           = 25;
            }
            else
            {
                __dayNotPercent = false;
                _rows           = 21;
            }
            fireTableDataChanged();
        }
Exemplo n.º 2
0
        /// <summary>
        /// Creates a backup of the current data object and stores it in _original,
        /// for use in determining if an object was changed inside of a GUI.
        /// </summary>
        public virtual void createBackup()
        {
            _original = clone();
            ((StateCU_BlaneyCriddle)_original)._isClone = false;
            _isClone = true;

            StateCU_BlaneyCriddle bc = (StateCU_BlaneyCriddle)_original;

            if (bc.__ckca != null)
            {
                __ckca  = new double[21];
                __nckca = new int[21];
                for (int i = 0; i < 21; i++)
                {
                    __ckca[i]  = bc.__ckca[i];
                    __nckca[i] = bc.__nckca[i];
                }
            }
            else
            {
                __ckcp  = new double[25];
                __nckcp = new int[25];
                for (int i = 0; i < 25; i++)
                {
                    __ckcp[i]  = bc.__ckcp[i];
                    __nckcp[i] = bc.__nckcp[i];
                }
            }
        }
Exemplo n.º 3
0
        /// <summary>
        /// Sets up internal arrays. </summary>
        /// <param name="data"> the Vector of data (non-null) that will be displayed in the table model. </param>
        private void initialize(System.Collections.IList data)
        {
            int size = data.Count;

            __firstRows = new int[size];
            __day       = new bool[size];

            int row = 0;
            StateCU_BlaneyCriddle bc = null;

            for (int i = 0; i < size; i++)
            {
                bc = (StateCU_BlaneyCriddle)data[i];

                __firstRows[i] = row;

                if (bc.getFlag().Equals("Percent", StringComparison.OrdinalIgnoreCase))
                {
                    row     += 21;
                    __day[i] = false;
                }
                else
                {
                    row     += 25;
                    __day[i] = true;
                }
            }

            _rows = row;
        }
        /// <summary>
        /// Performs general and specific data checks on Blaney-Criddle data. </summary>
        /// <param name="props"> A property list for specific properties. </param>
        /// <param name="data_vector"> list of data to check. </param>
        private void checkBlaneyCriddleData(PropList props, System.Collections.IList data_vector)
        {
            // Create elements for the checks and check file
            string[] header = StateCU_BlaneyCriddle.getDataHeader();
            System.Collections.IList data = new List <object>();
            string title = "Blaney Criddle";

            // Perform the general validation using the Data Table Model
            StateCU_Data_TableModel tm = new StateCU_BlaneyCriddle_TableModel(data_vector, false);

            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, tm.getRowCount());
            CheckFile_DataModel gen_dm = new CheckFile_DataModel(@checked, columnHeader, title + " Missing or Invalid Data", "", __gen_problems, tm.getRowCount());

            __check_file.addData(dm, gen_dm);
        }
        /// <summary>
        /// Called when the cancel button is pressed.  This discards any changes made to the data objects.
        /// </summary>
        protected internal override void cancel()
        {
            StateCU_BlaneyCriddle station = null;
            int size = _data.Count;

            for (int i = 0; i < size; i++)
            {
                station = (StateCU_BlaneyCriddle)_data[i];
                station.restoreOriginal();
            }
        }
        /// <summary>
        /// Called when the Apply button is pressed. This commits any changes to the data objects.
        /// </summary>
        protected internal override void apply()
        {
            StateCU_BlaneyCriddle station = null;
            int size = _data.Count;

            for (int i = 0; i < size; i++)
            {
                station = (StateCU_BlaneyCriddle)_data[i];
                station.createBackup();
            }
        }
Exemplo n.º 7
0
        /// <summary>
        /// Cancels any changes made to this object within a GUI since createBackup()
        /// was called and sets _original to null.
        /// </summary>
        public override void restoreOriginal()
        {
            StateCU_BlaneyCriddle bc = (StateCU_BlaneyCriddle)_original;

            base.restoreOriginal();

            __flag  = bc.__flag;
            __ckca  = bc.__ckca;
            __nckca = bc.__nckca;
            __ckcp  = bc.__ckcp;
            __nckcp = bc.__nckcp;

            _isClone  = false;
            _original = null;
        }
Exemplo n.º 8
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)
        {
            // make sure the row numbers are never sorted ...
            if (_sortOrder != null)
            {
                row = _sortOrder[row];
            }

            int dataPos = lookupVectorPositionForRow(row);

            StateCU_BlaneyCriddle bc = (StateCU_BlaneyCriddle)_data.get(dataPos);

            int num = row - __firstRows[dataPos];

            switch (col)
            {
            case __COL_CROP_NAME:
                return(bc.getName());

            case __COL_DAY_PCT:
                if (__day[dataPos])
                {
                    return(new int?(bc.getNckcp(num)));
                }
                else
                {
                    return(new int?(bc.getNckca(num)));
                }

            case __COL_COEFF:
                if (__day[dataPos])
                {
                    return(new double?(bc.getCkcp(num)));
                }
                else
                {
                    return(new double?(bc.getCkca(num)));
                }

            case __COL_BCM:
                return(new int?(bc.getKtsw()));
            }
            return("");
        }
Exemplo n.º 9
0
        /// <summary>
        /// Inserts the specified value into the table at the given position. </summary>
        /// <param name="value"> the object to store in the table cell. </param>
        /// <param name="row"> the row of the cell in which to place the object. </param>
        /// <param name="col"> the column of the cell in which to place the object. </param>
        public virtual void setValueAt(object value, int row, int col)
        {
            if (_sortOrder != null)
            {
                row = _sortOrder[row];
            }

            int dataPos = lookupVectorPositionForRow(row);

            StateCU_BlaneyCriddle bc = (StateCU_BlaneyCriddle)_data.get(dataPos);

            int num = row - __firstRows[dataPos];

            switch (col)
            {
            case __COL_CROP_NAME:
                bc.setName((string)value);
                break;

            case __COL_DAY_PCT:
                int ival = ((int?)value).Value;
                bc.setCurvePosition(num, ival);
                break;

            case __COL_COEFF:
                double dval = ((double?)value).Value;
                bc.setCurveValue(num, dval);
                break;

            case __COL_BCM:
                int bcmval = ((int?)value).Value;
                bc.setKtsw(bcmval);
                break;
            }

            base.setValueAt(value, row, col);
        }
Exemplo n.º 10
0
        /// <summary>
        /// Writes a list of StateCU_BlaneyCriddle objects to a list file.  A header is
        /// printed to the top of the file, containing the commands used to generate the
        /// file.  Any strings in the body of the file that contain the field delimiter will be wrapped in "...". </summary>
        /// <param name="filename"> the name of the file to which the data will be written. </param>
        /// <param name="delimiter"> the delimiter to use for separating field values. </param>
        /// <param name="update"> whether to update an existing file, retaining the current
        /// header (true) or to create a new file with a new header. </param>
        /// <param name="data"> the Vector of objects to write. </param>
        /// <exception cref="Exception"> if an error occurs. </exception>
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
//ORIGINAL LINE: public static void writeListFile(String filename, String delimiter, boolean update, java.util.List<StateCU_BlaneyCriddle> data, java.util.List<String> outputComments) throws Exception
        public static void writeListFile(string filename, string delimiter, bool update, IList <StateCU_BlaneyCriddle> data, IList <string> outputComments)
        {
            string routine = "StateCU_BlaneyCriddle.writeListFile";
            int    size    = 0;

            if (data != null)
            {
                size = data.Count;
            }

            IList <string> fields = new List <string>();

            fields.Add("Name");
            fields.Add("CurveType");
            fields.Add("DayPercent");
            fields.Add("Coefficient");
            int fieldCount = fields.Count;

            string[] names   = new string[fieldCount];
            string[] formats = new string[fieldCount];
            int      comp    = StateCU_DataSet.COMP_BLANEY_CRIDDLE;
            string   s       = null;

            for (int i = 0; i < fieldCount; i++)
            {
                s          = (string)fields[i];
                names[i]   = StateCU_Util.lookupPropValue(comp, "FieldName", s);
                formats[i] = StateCU_Util.lookupPropValue(comp, "Format", s);
            }

            string oldFile = null;

            if (update)
            {
                oldFile = IOUtil.getPathUsingWorkingDir(filename);
            }

            int                   j             = 0;
            int                   k             = 0;
            PrintWriter           @out          = null;
            StateCU_BlaneyCriddle bc            = null;
            IList <string>        commentString = new List <string>(1);

            commentString.Add("#");
            IList <string> ignoreCommentString = new List <string>(1);

            ignoreCommentString.Add("#>");
            string[]      line   = new string[fieldCount];
            string        flag   = null;
            StringBuilder buffer = new StringBuilder();

            try
            {
                // Add some basic comments at the top of the file.  However, do this to a copy of the
                // incoming comments so that they are not modified in the calling code.
                IList <string> newComments2 = null;
                if (outputComments == null)
                {
                    newComments2 = new List <string>();
                }
                else
                {
                    newComments2 = new List <string>(outputComments);
                }
                newComments2.Insert(0, "");
                newComments2.Insert(1, "StateCU Blaney-Criddle crop coefficients as a delimited list file.");
                newComments2.Insert(2, "");
                @out = IOUtil.processFileHeaders(oldFile, IOUtil.getPathUsingWorkingDir(filename), newComments2, commentString, ignoreCommentString, 0);

                for (int i = 0; i < fieldCount; i++)
                {
                    if (i > 0)
                    {
                        buffer.Append(delimiter);
                    }
                    buffer.Append("\"" + names[i] + "\"");
                }

                @out.println(buffer.ToString());

                for (int i = 0; i < size; i++)
                {
                    bc   = (StateCU_BlaneyCriddle)data[i];
                    flag = bc.getFlag();
                    if (flag.Equals("Percent", StringComparison.OrdinalIgnoreCase))
                    {
                        for (j = 0; j < 21; j++)
                        {
                            line[0] = StringUtil.formatString(bc.getName(), formats[0]).Trim();
                            line[1] = StringUtil.formatString(bc.getFlag(), formats[1]).Trim();
                            line[2] = StringUtil.formatString(bc.getNckca(j), formats[2]).Trim();
                            line[3] = StringUtil.formatString(bc.getCkca(j), formats[3]).Trim();

                            buffer = new StringBuilder();
                            for (k = 0; k < fieldCount; k++)
                            {
                                if (k > 0)
                                {
                                    buffer.Append(delimiter);
                                }
                                if (line[k].IndexOf(delimiter, StringComparison.Ordinal) > -1)
                                {
                                    line[k] = "\"" + line[k] + "\"";
                                }
                                buffer.Append(line[k]);
                            }
                            @out.println(buffer.ToString());
                        }
                    }
                    else
                    {
                        for (j = 0; j < 25; j++)
                        {
                            line[0] = StringUtil.formatString(bc.getName(), formats[0]).Trim();
                            line[1] = StringUtil.formatString(bc.getFlag(), formats[1]).Trim();
                            line[2] = StringUtil.formatString(bc.getNckcp(j), formats[2]).Trim();
                            line[3] = StringUtil.formatString(bc.getCkcp(j), formats[3]).Trim();

                            buffer = new StringBuilder();
                            for (k = 0; k < fieldCount; k++)
                            {
                                if (k > 0)
                                {
                                    buffer.Append(delimiter);
                                }
                                if (line[k].IndexOf(delimiter, StringComparison.Ordinal) > -1)
                                {
                                    line[k] = "\"" + line[k] + "\"";
                                }
                                buffer.Append(line[k]);
                            }
                            @out.println(buffer.ToString());
                        }
                    }
                }
            }
            catch (Exception e)
            {
                Message.printWarning(3, routine, e);
                throw e;
            }
            finally
            {
                if (@out != null)
                {
                    @out.flush();
                    @out.close();
                }
                @out = null;
            }
        }
Exemplo n.º 11
0
        /// <summary>
        /// Write a list of StateCU_BlaneyCriddle to an opened file. </summary>
        /// <param name="data_Vector"> A Vector of StateCU_BlaneyCriddle to write. </param>
        /// <param name="out"> output PrintWriter. </param>
        /// <param name="props"> Properties to control the output.  Currently only the
        /// optional Precision property can be set, indicating how many digits after the
        /// decimal should be printed (default is 3). </param>
        /// <exception cref="IOException"> if an error occurs. </exception>
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
//ORIGINAL LINE: private static void writeVector(java.util.List<StateCU_BlaneyCriddle> data_Vector, java.io.PrintWriter out, RTi.Util.IO.PropList props) throws java.io.IOException
        private static void writeVector(IList <StateCU_BlaneyCriddle> data_Vector, PrintWriter @out, PropList props)
        {
            int    i, j;
            string cmnt = "#>";
            // Missing data are handled by formatting all as strings (blank if necessary).
            bool version10 = false;     // Indicate if old Version 10 format is written

            if (props == null)
            {
                props = new PropList("StateCU_BlaneyCriddle");
            }
            string Precision = props.getValue("Precision");
            string Version   = props.getValue("Version");

            if (!string.ReferenceEquals(Version, null) && Version.Equals("10"))
            {
                // Version 10 is an older version.
                version10 = true;
            }

            int Precision_int = 3;

            if ((!string.ReferenceEquals(Precision, null)) && StringUtil.isInteger(Precision))
            {
                Precision_int = StringUtil.atoi(Precision);
            }

            @out.println(cmnt);
            @out.println(cmnt + "  StateCU Blaney-Criddle Crop Coefficient (KBC) File");
            @out.println(cmnt);
            @out.println(cmnt + "  Record 1 format (a80)");
            @out.println(cmnt);
            @out.println(cmnt + "  Title     remark:  Title");
            @out.println(cmnt);
            @out.println(cmnt + "  Record 2 format (free format)");
            @out.println(cmnt);
            @out.println(cmnt + "  NumCurves     nc:  Number of crop coefficient curves");
            @out.println(cmnt);
            @out.println(cmnt + "  Record 3 format (free format)");
            @out.println(cmnt);
            @out.println(cmnt + "  ID            id:  Crop number (not used by StateCU)");
            @out.println(cmnt + "  CropName   cropn:  Crop name (e.g., ALFALFA)");
            @out.println(cmnt + "  CurveType   flag:  Growth curve type");
            @out.println(cmnt + "                     Day = perennial; specify 25 values");
            @out.println(cmnt + "                           for start, middle, end of month");
            @out.println(cmnt + "                     Percent = annual; specify 21 values");
            @out.println(cmnt + "                           for 0, 5, ..., 100% of season");
            @out.println(cmnt);
            if (!version10)
            {
                // Include newer format information...
                @out.println(cmnt + "  BCMethod    ktsw:  Blaney-Criddle Method");
                @out.println(cmnt + "                     0 = SCS Modified Blaney-Criddle");
                @out.println(cmnt + "                     1 = Original Blaney-Criddle");
                @out.println(cmnt + "                     2 = Modifed Blaney-Criddle w/ Elev. Adj.");
                @out.println(cmnt + "                     3 = Original Blaney-Criddle w/ Elev. Adj.");
                @out.println(cmnt + "                     4 = Pochop");
                @out.println(cmnt);
            }
            @out.println(cmnt + "  Record 4 format (free format)");
            @out.println(cmnt);
            @out.println(cmnt + "Position     nckca:  Percent (0 to 100) of growing season for annual crop");
            @out.println(cmnt + "             nckcp:  Day of year (1 to 366) for perennial crop");
            @out.println(cmnt + "Coeff         ckca:  Crop coefficient for annual crop");
            @out.println(cmnt + "         OR   ckcp:  Crop coefficient for perennial crop");
            @out.println(cmnt);
            @out.println(cmnt + "Title...");
            @out.println(cmnt + "NumCurves");
            @out.println(cmnt + "ID CropName CurveType");
            @out.println(cmnt + "Position Coeff");
            @out.println(cmnt + "----------------------------");
            @out.println(cmnt + "EndHeader");
            @out.println("Crop Coefficient Curves for Blaney-Criddle");

            int num = 0;

            if (data_Vector != null)
            {
                num = data_Vector.Count;
            }
            @out.println(num);
            StateCU_BlaneyCriddle kbc = null;

            int[]    nckca        = null;
            int[]    nckcp        = null;
            double[] ckca         = null;
            double[] ckcp         = null;
            int      size         = 0;
            string   value_format = "%9." + Precision_int + "f";

            for (i = 0; i < num; i++)
            {
                kbc = (StateCU_BlaneyCriddle)data_Vector[i];
                if (kbc == null)
                {
                    continue;
                }

                // Just get all the data.  Null arrays are used as a check
                // below to know what data to output...
                nckca = kbc.getNckca();
                nckcp = kbc.getNckcp();
                ckca  = kbc.getCkca();
                ckcp  = kbc.getCkcp();

                // Do not truncate the name to 20 characters if version 10 because
                // doing so may result in arbitrary cut of the current crop names and
                // result in different output from old anyhow.
                string name = kbc.getName();
                // Since free format, the ID must always have something.  If
                // we don't know, put -999...
                string id = "" + (i + 1);         // Default to sequential number
                if (version10)
                {
                    // Previously used -999
                    id = "-999";
                }
                if (!StateCU_Util.isMissing(kbc.getID()))
                {
                    // Changes elsewhere impact this so also use -999 unless it is a number
                    if (StringUtil.isInteger(kbc.getID()))
                    {
                        id = "" + kbc.getID();
                    }
                    else
                    {
                        id = "-999";
                    }
                    // Can't use the crop name because StateCU expects a number (?)
                    //id = kbc.getID();
                }
                // Output based on the version because file comparisons may be done when verifying files.
                if (version10)
                {
                    // No ktsw...
                    @out.println(id + " " + name + " " + kbc.getFlag());
                }
                else
                {
                    // With ktsw, but OK if blank.
                    @out.println(id + " " + name + " " + kbc.getFlag() + " " + kbc.getKtsw());
                }

                if (nckca != null)
                {
                    size = nckca.Length;
                }
                else
                {
                    size = nckcp.Length;
                }
                for (j = 0; j < size; j++)
                {
                    if (nckca != null)
                    {
                        // Print annual curve (Percent)...
                        @out.println(StringUtil.formatString(nckca[j], "%-3d") + StringUtil.formatString(ckca[j], value_format));
                    }
                    else
                    {
                        // Print perennial curve (Day)...
                        @out.println(StringUtil.formatString((int)nckcp[j], "%-3d") + StringUtil.formatString(ckcp[j], value_format));
                    }
                }
            }
        }
Exemplo n.º 12
0
        /// <summary>
        /// Read the StateCU KBC file and return as a Vector of StateCU_BlaneyCriddle. </summary>
        /// <param name="filename"> filename containing KBC records. </param>
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
//ORIGINAL LINE: public static java.util.List<StateCU_BlaneyCriddle> readStateCUFile(String filename) throws java.io.IOException
        public static IList <StateCU_BlaneyCriddle> readStateCUFile(string filename)
        {
            string rtn   = "StateCU_BlaneyCriddle.readKBCFile";
            string iline = null;
            StateCU_BlaneyCriddle         kbc        = null;
            IList <StateCU_BlaneyCriddle> kbc_Vector = new List <StateCU_BlaneyCriddle>(25);
            StreamReader @in       = null;
            bool         version10 = isVersion_10(filename); // Is version 10 (old) format?

            Message.printStatus(1, rtn, "Reading StateCU KBC file: " + filename);
            // The following throws an IOException if the file cannot be opened...
            @in = new StreamReader(filename);
            int    nc    = -1;
            string title = null;     // The title is currently read but not stored since it is never really used for anything.

            while (!string.ReferenceEquals((iline = @in.ReadLine()), null))
            {
                // check for comments
                if (iline.StartsWith("#", StringComparison.Ordinal) || iline.Trim().Length == 0)
                {
                    continue;
                }
                if (string.ReferenceEquals(title, null))
                {
                    title = iline;
                }
                else if (nc < 0)
                {
                    // Assume that the line contains the number of crops
                    nc = StringUtil.atoi(iline.Trim());
                    break;
                }
            }

            // Now loop through the number of curves...

            // TODO SAM 2007-02-18 Evaluate if needed
            //String id;
            string cropn, flag;
            int    npts;

            int[]          nckca = null;
            int[]          nckcp = null;
            double[]       ckc   = null;
            string         ktsw  = null;
            IList <string> tokens;
            int            j = 0;

            for (int i = 0; i < nc; i++)
            {
                nckca = null;         // use to check whether annual or perennial below.
                // Read a free format line...

                iline = @in.ReadLine();

                tokens = StringUtil.breakStringList(iline.Trim(), " \t", StringUtil.DELIM_SKIP_BLANKS);
                // TODO SAM 2007-02-18 Evaluate if needed
                //id = (String)tokens.elementAt(0);
                cropn = (string)tokens[1];
                flag  = (string)tokens[2];

                if (version10)
                {
                    ktsw = "";
                }
                else
                {
                    ktsw = (string)tokens[3];
                }
                // Allocate new StateCU_BlaneyCriddle instance...

                kbc = new StateCU_BlaneyCriddle(flag);
                kbc.setName(cropn);
                // TODO SAM 2005-05-22 Ignore the old ID and use the crop name - this facilitates
                // sorting and other standard StateCU_Data features.
                //kbc.setID ( id );
                kbc.setID(cropn);

                if (StringUtil.isInteger(ktsw))
                {
                    kbc.setKtsw(StringUtil.atoi(ktsw));
                }

                // Read the coefficients...
                if (flag.Equals("Day", StringComparison.OrdinalIgnoreCase))
                {
                    ckc   = kbc.getCkcp();
                    nckcp = kbc.getNckcp();
                }
                else
                {
                    ckc   = kbc.getCkca();
                    nckca = kbc.getNckca();
                }
                npts = ckc.Length;

                for (j = 0; j < npts; j++)
                {
                    iline = @in.ReadLine();

                    tokens = StringUtil.breakStringList(iline.Trim(), " \t", StringUtil.DELIM_SKIP_BLANKS);
                    if (nckca == null)
                    {
                        // Processing perennial crop...
                        nckcp[j] = StringUtil.atoi((string)tokens[0]);
                        ckc[j]   = StringUtil.atod((string)tokens[1]);
                    }
                    else
                    {
                        // Processing annual crop...
                        nckca[j] = StringUtil.atoi((string)tokens[0]);
                        ckc[j]   = StringUtil.atod((string)tokens[1]);
                    }
                }

                // add the StateCU_BlaneyCriddle to the vector...
                kbc_Vector.Add(kbc);
            }
            if (@in != null)
            {
                @in.Close();
            }
            return(kbc_Vector);
        }
Exemplo n.º 13
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);
        }