Пример #1
0
 public static IdentifierPath QualifyIdentifierPath(RowKey rowKey, IdentifierPath identifierPath)
 {
     if (rowKey == null)
     {
         return(identifierPath);
     }
     string[] parts = new string[identifierPath.Length];
     while (identifierPath.Length > 0)
     {
         parts[identifierPath.Length - 1] = identifierPath.Name;
         identifierPath = identifierPath.Parent;
     }
     while (rowKey != null)
     {
         if (rowKey.IdentifierPath.Length <= parts.Length)
         {
             parts[rowKey.IdentifierPath.Length - 1] = rowKey.Value.ToString();
         }
         rowKey = rowKey.Parent;
     }
     foreach (var part in parts)
     {
         identifierPath = new IdentifierPath(identifierPath, part);
     }
     return(identifierPath);
 }
Пример #2
0
 public static IdentifierPath QualifyIdentifierPath(RowKey rowKey, IdentifierPath identifierPath)
 {
     if (rowKey == null)
     {
         return identifierPath;
     }
     string[] parts = new string[identifierPath.Length];
     while (identifierPath.Length > 0)
     {
         parts[identifierPath.Length - 1] = identifierPath.Name;
         identifierPath = identifierPath.Parent;
     }
     while (rowKey != null)
     {
         if (rowKey.IdentifierPath.Length <= parts.Length)
         {
             parts[rowKey.IdentifierPath.Length - 1] = rowKey.Value.ToString();
         }
         rowKey = rowKey.Parent;
     }
     foreach (var part in parts)
     {
         identifierPath = new IdentifierPath(identifierPath, part);
     }
     return identifierPath;
 }
Пример #3
0
 public override int GetHashCode()
 {
     unchecked
     {
         return((RowKey.GetHashCode() * 397) ^ RowData.GetHashCode());
     }
 }
Пример #4
0
        public PropertyDescriptorCollection GetItemProperties(PropertyDescriptor[] listAccessors)
        {
            var propertyDescriptors = new List <PropertyDescriptor>();
            var pivotColumns        = new Dictionary <RowKey, List <ColumnDescriptor> >();

            foreach (var columnDescriptor in ViewInfo.ColumnDescriptors)
            {
                var pivotValues = _pivoter.GetPivotValues(columnDescriptor.IdPath);
                if (pivotValues == null)
                {
                    propertyDescriptors.Add(new ColumnPropertyDescriptor(columnDescriptor, null));
                    continue;
                }
                List <ColumnDescriptor> columns;
                foreach (var value in pivotValues)
                {
                    if (!pivotColumns.TryGetValue(value, out columns))
                    {
                        columns = new List <ColumnDescriptor>();
                        pivotColumns.Add(value, columns);
                    }
                    columns.Add(columnDescriptor);
                }
            }
            var pivotKeys = pivotColumns.Keys.ToArray();

            Array.Sort(pivotKeys, RowKey.GetComparison(DataSchema, pivotColumns.Keys.Select(rk => rk.IdentifierPath)));
            foreach (var pivotKey in pivotKeys)
            {
                propertyDescriptors.AddRange(pivotColumns[pivotKey].Select(cd => new ColumnPropertyDescriptor(cd, pivotKey)).ToArray());
            }
            return(new PropertyDescriptorCollection(propertyDescriptors.ToArray()));
        }
Пример #5
0
 public bool Equals(RowKey other)
 {
     if (ReferenceEquals(null, other))
     {
         return false;
     }
     if (ReferenceEquals(this, other))
     {
         return true;
     }
     return Equals(Parent, other.Parent) && Equals(IdentifierPath, other.IdentifierPath) && Equals(Value, other.Value);
 }
Пример #6
0
 public bool Equals(RowKey other)
 {
     if (ReferenceEquals(null, other))
     {
         return(false);
     }
     if (ReferenceEquals(this, other))
     {
         return(true);
     }
     return(Equals(Parent, other.Parent) && Equals(IdentifierPath, other.IdentifierPath) && Equals(Value, other.Value));
 }
Пример #7
0
        public object GetPropertyValue(RowItem rowItem, RowKey rowKey)
        {
            while (!IdPath.StartsWith(rowItem.SublistId))
            {
                rowItem = rowItem.Parent;
            }
            if (IdPath.Equals(rowItem.SublistId))
            {
                return(rowItem.Value);
            }
            var parentValue = Parent.GetPropertyValue(rowItem, rowKey);

            if (parentValue == null)
            {
                return(null);
            }
            return(GetPropertyValueFromParent(parentValue, rowKey));
        }
Пример #8
0
 public object GetPropertyValueFromParent(object parentComponent, RowKey rowKey)
 {
     if (parentComponent == null)
     {
         return(null);
     }
     if (PropertyDescriptor == null)
     {
         var collectionInfo = CollectionInfo;
         if (collectionInfo == null)
         {
             return(null);
         }
         var key = rowKey.FindValue(IdPath);
         if (key == null)
         {
             return(null);
         }
         return(collectionInfo.GetItemFromKey(parentComponent, key));
     }
     return(PropertyDescriptor.GetValue(parentComponent));
 }
Пример #9
0
 public ColumnPropertyDescriptor(ColumnDescriptor columnDescriptor, RowKey rowKey) : this(columnDescriptor, RowKey.QualifyIdentifierPath(rowKey, columnDescriptor.IdPath))
 {
     RowKey = rowKey;
 }
Пример #10
0
 public RowKey(RowKey parent, IdentifierPath identifierPath, object value)
 {
     Parent = parent;
     IdentifierPath = identifierPath;
     Value = value;
 }
Пример #11
0
 public RowKey(RowKey parent, IdentifierPath identifierPath, object value)
 {
     Parent         = parent;
     IdentifierPath = identifierPath;
     Value          = value;
 }
Пример #12
0
 public RowValue(RowKey rowKey, object rowData)
 {
     RowKey  = rowKey;
     RowData = rowData;
 }