예제 #1
0
        private IList <ColumnDescriptor> ListAllChildren(ColumnDescriptor parent)
        {
            var result = new List <ColumnDescriptor>();

            if (parent.CollectionInfo != null && parent.CollectionInfo.IsDictionary)
            {
                if (ShowAdvancedFields)
                {
                    result.Add(parent.ResolveChild("Key"));                     // Not L10N
                }
                result.AddRange(ListAllChildren(parent.ResolveChild("Value"))); // Not L10N
                return(result);
            }
            foreach (var child in parent.GetChildColumns())
            {
                var collectionColumn = child.GetCollectionColumn();
                // ReSharper disable once ConvertIfStatementToNullCoalescingExpression
                if (null != collectionColumn)
                {
                    result.Add(collectionColumn);
                }
                else
                {
                    result.Add(child);
                }
            }
            return(result);
        }
예제 #2
0
        public static IEnumerable <ColumnDescriptor> GetChildColumns(ColumnDescriptor columnDescriptor)
        {
            var collectionColumn = columnDescriptor.GetCollectionColumn();

            if (null != collectionColumn)
            {
                if (collectionColumn.PropertyType.IsGenericType &&
                    collectionColumn.PropertyType.GetGenericTypeDefinition() == typeof(KeyValuePair <,>))
                {
                    return(new[] { collectionColumn.ResolveChild("Key"), collectionColumn.ResolveChild("Value") });
                }
                return(collectionColumn.GetChildColumns());
            }
            return(columnDescriptor.GetChildColumns());
        }
예제 #3
0
        public static IEnumerable <TextColumnWrapper> GetAllTextColumnWrappers(ColumnDescriptor columnDescriptor)
        {
            var columns = Enumerable.Empty <TextColumnWrapper>();

            if (columnDescriptor.CollectionInfo != null || columnDescriptor.IsAdvanced)
            {
                return(columns);
            }

            if (!typeof(SkylineObject).IsAssignableFrom(columnDescriptor.PropertyType) &&
                !@"Locator".Equals(columnDescriptor.PropertyPath.Name))
            {
                columns = columns.Append(new TextColumnWrapper(columnDescriptor));
            }

            columns = columns.Concat(columnDescriptor.GetChildColumns().SelectMany(GetAllTextColumnWrappers));

            return(columns);
        }
예제 #4
0
        protected IList <ColumnDescriptor> ListChildren(ColumnDescriptor parent)
        {
            var result = new List <ColumnDescriptor>();

            if (parent.CollectionInfo != null && parent.CollectionInfo.IsDictionary)
            {
                result.Add(new ColumnDescriptor(parent, "Key"));
                result.AddRange(ListChildren(new ColumnDescriptor(parent, "Value")));
                return(result);
            }
            foreach (var child in parent.GetChildColumns())
            {
                var collectionInfo = parent.DataSchema.GetCollectionInfo(child.PropertyType);
                if (collectionInfo != null)
                {
                    result.Add(new ColumnDescriptor(child, collectionInfo));
                }
                else
                {
                    result.Add(child);
                }
            }
            return(result);
        }
예제 #5
0
 private IList<ColumnDescriptor> ListAllChildren(ColumnDescriptor parent)
 {
     var result = new List<ColumnDescriptor>();
     if (parent.CollectionInfo != null && parent.CollectionInfo.IsDictionary)
     {
         if (ShowAdvancedFields)
         {
             result.Add(parent.ResolveChild("Key")); // Not L10N
         }
         result.AddRange(ListAllChildren(parent.ResolveChild("Value"))); // Not L10N
         return result;
     }
     foreach (var child in parent.GetChildColumns())
     {
         var collectionColumn = child.GetCollectionColumn();
         // ReSharper disable once ConvertIfStatementToNullCoalescingExpression
         if (null != collectionColumn)
         {
             result.Add(collectionColumn);
         }
         else
         {
             result.Add(child);
         }
     }
     return result;
 }