Exemplo n.º 1
0
        /// <summary>
        /// Sets the data column according to PropertyEntryColumn
        /// </summary>
        /// <param name="column">The column.</param>
        /// <param name="tableColumn">The table column.</param>
        /// <exception cref="System.ArgumentOutOfRangeException"></exception>
        public static void setDataColumn(this PropertyEntryColumn column, DataColumn tableColumn)
        {
            tableColumn.Caption = column.toColumnCaption(false);
            //tableColumn.SetHeading(column.toColumnCaption(false));
            tableColumn.ColumnName = "_" + column.ToString();

            tableColumn.ExtendedProperties[templateFieldStyling.text_horizontalAligment] = printHorizontal.left;

            tableColumn.ExtendedProperties[templateFieldStyling.render_isHidden] = false;

            tableColumn.ExtendedProperties[templateFieldDataTable.col_name] = column;

            //tableColumn.ExtendedProperties[templateFieldStyling.color_variationRole] = acePaletteVariationRole.none;
            tableColumn.ExtendedProperties[templateFieldStyling.color_variationAdjustment] = 0;

            String desc = column.getDescriptionForKey();

            switch (column)
            {
            case PropertyEntryColumn.entry_key:
                tableColumn.DataType = typeof(String);

                break;

            case PropertyEntryColumn.entry_name:
                tableColumn.DataType = typeof(String);
                tableColumn.ExtendedProperties[templateFieldStyling.color_variationAdjustment] = 1;
                //desc = "Human-readable name of the property";
                break;

            case PropertyEntryColumn.property_description:
            case PropertyEntryColumn.entry_description:
                tableColumn.DataType = typeof(String);
                //desc = "About / info on the property";
                break;

            case PropertyEntryColumn.entry_value:
                tableColumn.DataType = typeof(String);
                tableColumn.ExtendedProperties[templateFieldStyling.color_variationAdjustment] = 2;
                tableColumn.ExtendedProperties[templateFieldStyling.text_horizontalAligment]   = printHorizontal.right;
                // desc = "Formated value";
                break;

            case PropertyEntryColumn.entry_valueAndUnit:
                tableColumn.DataType = typeof(String);

                tableColumn.ExtendedProperties[templateFieldStyling.text_horizontalAligment]   = printHorizontal.right;
                tableColumn.ExtendedProperties[templateFieldStyling.color_variationAdjustment] = 2;
                // desc = "Formated value with unit sufix";
                break;

            case PropertyEntryColumn.role_letter:
                tableColumn.DataType = typeof(String);
                // desc = "Letter asociated with the role of the property";
                break;

            case PropertyEntryColumn.role_symbol:
                tableColumn.DataType = typeof(String);
                // desc = "Symbol associated with the role of the property";
                break;

            case PropertyEntryColumn.role_name:
                tableColumn.DataType = typeof(String);
                // desc = "Descriptive name of the property role";
                break;

            case PropertyEntryColumn.entry_unit:
                tableColumn.DataType = typeof(String);
                tableColumn.ExtendedProperties[templateFieldStyling.color_variationAdjustment] = 1;
                // desc = "The unit short name - abbr./sufix";
                break;

            case PropertyEntryColumn.entry_unitname:
                tableColumn.DataType = typeof(String);
                // desc = "Name of the property unit";
                break;

            case PropertyEntryColumn.entry_importance:
                // desc = "Remarks on property relevance and/or on alarming value";
                tableColumn.DataType = typeof(String);
                break;

            default:
                throw new ArgumentOutOfRangeException();
            }

            tableColumn.ExtendedProperties[templateFieldDataTable.col_desc] = desc;
            // return column.ToString();
        }
Exemplo n.º 2
0
        /// <summary>
        /// To the column caption.
        /// </summary>
        /// <param name="column">The column.</param>
        /// <returns></returns>
        /// <exception cref="System.ArgumentOutOfRangeException"></exception>
        public static String toColumnCaption(this PropertyEntryColumn column, Boolean showException = true)
        {
            switch (column)
            {
            case PropertyEntryColumn.entry_key:
                return("Key");

                break;

            case PropertyEntryColumn.entry_name:
                return("Name");

                break;

            case PropertyEntryColumn.entry_description:
                return("Description");

                break;

            case PropertyEntryColumn.entry_value:
                return("Value");

                break;

            case PropertyEntryColumn.entry_valueAndUnit:
                return("Value");

                break;

            case PropertyEntryColumn.role_letter:
                return("Letter");

                break;

            case PropertyEntryColumn.role_symbol:
                return("Symbol");

                break;

            case PropertyEntryColumn.role_name:
                return("Role");

                break;

            case PropertyEntryColumn.entry_unit:
                return("Unit");

                break;

            case PropertyEntryColumn.entry_unitname:
                return("Unit");

                break;

            case PropertyEntryColumn.entry_importance:
                return("Relevance");

                break;

            case PropertyEntryColumn.none:
                return(" -- ");

                break;

            default:
                if (showException)
                {
                    throw new ArgumentOutOfRangeException(nameof(column), "toColumnCaption failed to find string for [" + column.ToString() + "] in PropertyEntryColumnExtensions - toColumnCaption()");
                }
                return(column.ToString());

                break;
            }
            return(column.ToString());
        }