/// <summary>
 /// Learns formatting data from source
 /// </summary>
 /// <param name="source">The source.</param>
 public void Learn(MetaTableProperty source)
 {
     if (ValueTypeName.isNullOrEmpty())
     {
         ValueTypeName = source.ValueTypeName;
     }
     if (ValueFormat.isNullOrEmpty())
     {
         ValueFormat = source.ValueFormat;
     }
     if (decimalDelimiter.isNullOrEmpty())
     {
         decimalDelimiter = source.decimalDelimiter;
     }
     if (thousantDelimiter.isNullOrEmpty())
     {
         thousantDelimiter = source.thousantDelimiter;
     }
     if (ContentType == CellContentType.unknown)
     {
         ContentType = source.ContentType;
     }
     if (AllContentTypes == CellContentType.unknown)
     {
         AllContentTypes = source.AllContentTypes;
     }
     factor = source.factor;
 }
 public String GetStoredValue(MetaTableProperty property)
 {
     if (!properties.ContainsKey(property.PropertyName))
     {
         return(property.GetDefaultData());
     }
     return(properties[property.PropertyName]);
 }
 public SourceTableCell GetLinkedCell(MetaTableProperty property)
 {
     if (!HasLinkedCell(property))
     {
         return(null);
     }
     return(sourceCellLinks[property.PropertyName]);
 }
 public Object GetOutputValue(MetaTableProperty property)
 {
     if (!properties.ContainsKey(property.PropertyName))
     {
         return(property.GetDefaultData());
     }
     return(property.GetValue(properties[property.PropertyName]));
 }
 public Boolean HasLinkedCell(MetaTableProperty property)
 {
     if (!sourceCellLinks.ContainsKey(property.PropertyName))
     {
         return(false);
     }
     if (sourceCellLinks[property.PropertyName] == null)
     {
         return(false);
     }
     return(true);
 }
Esempio n. 6
0
        public Int32 ApplySchema(IEnumerable <MetaTableProperty> schemaProperties)
        {
            Int32 c = 0;

            foreach (MetaTableProperty sp in schemaProperties)
            {
                MetaTableProperty p = properties.Get(sp.PropertyName);
                if (p != null)
                {
                    p.Learn(sp);
                    c++;
                }
            }

            return(c);
        }
Esempio n. 7
0
        public List <String> GetAllValuesForProperty(MetaTableProperty property)
        {
            List <String> output = new List <string>();

            if (property == null)
            {
                return(output);
            }
            if (!Any())
            {
                return(output);
            }

            foreach (MetaTableEntry entry in items)
            {
                if (entry != null)
                {
                    output.Add(entry.GetStoredValue(property));
                }
            }

            return(output);
        }
Esempio n. 8
0
        public DataColumn GetColumn(MetaTableProperty property, DataTable output, RefinedPropertyStats propertyStats = null)
        {
            if (!output.Columns.Contains(property.PropertyName))
            {
                DataColumn cl = output.Columns.Add(property.PropertyName);

                cl.SetHeading(property.DisplayName);
                cl.SetValueType(property.GetValueType());

                if (!property.ValueFormat.isNullOrEmpty())
                {
                    cl.SetFormat(property.ValueFormat);
                }
                cl.SetLetter(property.PropertyName);

                if (propertyStats != null)
                {
                    cl.SetWidth(Math.Min(propertyStats.max_width, 30));
                }

                StringBuilder sb = new StringBuilder();
                sb.Append("Content: " + property.ContentType.ToString());
                //sb.Append("Property name: " + property.PropertyName);
                if (!property.ValueTypeName.isNullOrEmpty())
                {
                    sb.Append(" ValueType: " + property.ValueTypeName);
                }

                cl.SetDesc(sb.ToString());

                return(cl);
            }
            else
            {
                return(null);
            }
        }
 public Boolean HasValueFor(MetaTableProperty property)
 {
     return(properties.ContainsKey(property.PropertyName));
 }