/// <summary>
 /// Returns a formatted header from the component's table model
 /// with tooltips needed for the check file.  There is no HTML
 /// here, instead keyword are injected as Strings that the check
 /// file parser will convert into HTML tooltips. </summary>
 /// <param name="tm"> Table model for the component under validation. </param>
 /// <returns> List of column headers with tooltips. </returns>
 private string[] getColumnHeader(StateMod_Data_TableModel tm)
 {
     string[] header        = getDataTableModelColumnHeader(tm);
     string[] return_header = new string[header.Length];
     // format the header to include HTML tooltips based on
     // the validation being performed on a column of data
     for (int i = 0; i < header.Length; i++)
     {
         Validator[] vals     = (tm.getValidators(i));
         string      val_desc = "Data validators for this column:\n";
         for (int j = 0; j < vals.Length; j++)
         {
             int num = j + 1;
             val_desc = val_desc + num + ". " + vals[j].ToString();
         }
         // write the final header string with tooltip
         // the %tooltip_start and %tooltip_end are special/keyword
         // Strings that are recognized when the HTML file is rendered.
         // These keywords will be converted into title tags needed to
         // produce an HTML tooltip.  See the checkText() method in
         // HTMLWriter.java class in RTi_Common for conversions.
         return_header[i] = "%tooltip_start" + val_desc +
                            "%tooltip_end" + header[i];
     }
     return(return_header);
 }
        /// <summary>
        /// Performs data validation based on the validators found in
        /// the table model for the current component. </summary>
        /// <param name="tm"> Interface implemented by each data table model. </param>
        /// <returns> List of data that has gone through data validation.
        /// If any element fails any one of its validators the content
        /// of that element is formatted to tag it as an error. </returns>
        private System.Collections.IList performDataValidation(StateMod_Data_TableModel tm, string title)
        {
            System.Collections.IList data = new List <object>();
            if (tm == null)
            {
                return(data);
            }
            Status status          = Status.OKAY;
            bool   row_had_problem = false;

            __gen_problems = 0;
            // Go through rows of data objects
            for (int i = 0; i < tm.getRowCount(); i++)
            {
                string[] row = new string[tm.getColumnCount()];
                row_had_problem = false;
                // Get the data column (this contains the data that needs to
                // be checked).
                for (int j = 0; j < tm.getColumnCount(); j++)
                {
                    Validator[] vals = (tm.getValidators(j));
                    // if there are no validators for this column then
                    // just add the data value.  If the value is blank
                    // then add a space so the check file is able to show
                    // the column.
                    if (vals.Length == 0)
                    {
                        string value = tm.getValueAt(i, j).ToString();
                        if (value.Length == 0)
                        {
                            value = " ";
                        }
                        row[j] = value;
                    }
                    // Run all validators found in the table model
                    for (int k = 0; k < vals.Length; k++)
                    {
                        status = vals[k].validate(tm.getValueAt(i, j));
                        row[j] = checkStatus(status, tm.getValueAt(i, j));
                        // if the current validator fails then don't
                        // check finer grained validators since there is no need.
                        // Log the error as a runtime message in the check file
                        if (status.getLevel() != Status.OK)
                        {
                            row_had_problem = true;
                            break;
                        }
                    }
                }
                // Add the data regardless if it fails or not.
                data.Add(row);
                if (row_had_problem)
                {
                    __gen_problems++;
                }
            }
            return(data);
        }
 /// <summary>
 /// Uses the table model object to obtain the column
 /// headers. </summary>
 /// <param name="tm"> StateMod_Data_TableModel Object. </param>
 /// <returns> List of column headers from the table model. </returns>
 private string[] getDataTableModelColumnHeader(StateMod_Data_TableModel tm)
 {
     if (tm == null)
     {
         return(new string[] {});
     }
     string[] header = new string[tm.getColumnCount()];
     for (int i = 0; i < tm.getColumnCount(); i++)
     {
         header[i] = tm.getColumnName(i);
     }
     return(header);
 }