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); }
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; }
public override int GetHashCode() { unchecked { return((RowKey.GetHashCode() * 397) ^ RowData.GetHashCode()); } }
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())); }
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); }
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)); }
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)); }
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)); }
public ColumnPropertyDescriptor(ColumnDescriptor columnDescriptor, RowKey rowKey) : this(columnDescriptor, RowKey.QualifyIdentifierPath(rowKey, columnDescriptor.IdPath)) { RowKey = rowKey; }
public RowKey(RowKey parent, IdentifierPath identifierPath, object value) { Parent = parent; IdentifierPath = identifierPath; Value = value; }
public RowValue(RowKey rowKey, object rowData) { RowKey = rowKey; RowData = rowData; }