public HBaseColumnFamilyData(ColumnDescriptor columnDescriptor)
        {
            // Remove ':' from name
            Name = new byte[columnDescriptor.Name.Length - 1];
            Array.Copy(columnDescriptor.Name, Name, Name.Length);

            ColumnDescriptor = columnDescriptor;
            MaxVersions = columnDescriptor.MaxVersions;
            BlockCacheEnabled = columnDescriptor.BlockCacheEnabled;
        }
Example #2
0
        /*
         *      @view Контекстное меню
         *      @summary Редактирование свойств столбца.
         */
        private void TSMItem_ColumnHeader__EditColumn_Click(object sender, EventArgs e)
        {
            var dialog = new AddColumnDialog();
            ColumnDescriptor descriptor = Model.ColumnDescriptors[CtxMenuColumnIndex];

            dialog.ShowDialog(descriptor);

            var result = dialog.Result;

            if (result.Success)
            {
                OnModelChanged();
                Model.UpdateColumnDescriptor(result.Value, CtxMenuColumnIndex);
                Model.UpdateColumnCells(result.Value, CtxMenuColumnIndex);
            }
        }
Example #3
0
 public SqlField(ColumnDescriptor column)
 {
     Type              = column.GetDbDataType(true);
     Name              = column.MemberName;
     PhysicalName      = column.ColumnName;
     CanBeNull         = column.CanBeNull;
     IsPrimaryKey      = column.IsPrimaryKey;
     PrimaryKeyOrder   = column.PrimaryKeyOrder;
     IsIdentity        = column.IsIdentity;
     IsInsertable      = !column.SkipOnInsert;
     IsUpdatable       = !column.SkipOnUpdate;
     SkipOnEntityFetch = column.SkipOnEntityFetch;
     CreateFormat      = column.CreateFormat;
     CreateOrder       = column.Order;
     ColumnDescriptor  = column;
 }
Example #4
0
        public string GenerateDocumentation(ColumnDescriptor rootColumn)
        {
            StringWriter             stringWriter   = new StringWriter();
            var                      processedTypes = new HashSet <Type>();
            Queue <ColumnDescriptor> columnQueue    = new Queue <ColumnDescriptor>();

            columnQueue.Enqueue(rootColumn);
            while (columnQueue.Any())
            {
                ColumnDescriptor columnDescriptor = columnQueue.Dequeue();
                var rowType = DataSchema.GetWrappedValueType(columnDescriptor.PropertyType);
                if (processedTypes.Contains(rowType))
                {
                    continue;
                }
                if (!IsNestedColumn(columnDescriptor))
                {
                    processedTypes.Add(rowType);
                    var collectionInfo = DataSchema.GetCollectionInfo(rowType);
                    if (collectionInfo != null)
                    {
                        columnQueue.Enqueue(ColumnDescriptor.RootColumn(rootColumn.DataSchema, collectionInfo.ElementType, rootColumn.UiMode));
                    }
                    else if (!IsScalar(rowType))
                    {
                        stringWriter.WriteLine("<div id=\"" + HtmlEncode(rowType.FullName) + "\"><span class=\"RowType\">" +
                                               HtmlEncode(GetTypeName(rowType)) + "</span>");
                        string description = GetTypeDescription(rowType);
                        if (!string.IsNullOrEmpty(description))
                        {
                            stringWriter.WriteLine("<span class=\"Description\">" + HtmlEncode(description) + "</span>");
                        }
                        stringWriter.WriteLine("</div>");
                        stringWriter.WriteLine(GetDocumentation(columnDescriptor));
                    }
                }
                foreach (var child in GetChildColumns(columnDescriptor))
                {
                    if (!IncludeHidden && DataSchema.IsHidden(child))
                    {
                        continue;
                    }
                    columnQueue.Enqueue(child);
                }
            }
            return(stringWriter.ToString());
        }
Example #5
0
        public MetadataRuleEditor(IDocumentContainer documentContainer)
        {
            InitializeComponent();
            _dataSchema = new SkylineDataSchema(documentContainer, SkylineDataSchema.GetLocalizedSchemaLocalizer());
            var rootColumn  = ColumnDescriptor.RootColumn(_dataSchema, typeof(ResultFile));
            var viewContext =
                new SkylineViewContext(rootColumn, new StaticRowSource(new ExtractedMetadataResultRow[0]));

            _metadataExtractor = new MetadataExtractor(_dataSchema, typeof(ResultFile));
            bindingListSource1.SetViewContext(viewContext);
            var sources = _metadataExtractor.GetSourceColumns().ToArray();

            comboSourceText.Items.AddRange(sources);
            comboMetadataTarget.Items.AddRange(_metadataExtractor.GetTargetColumns().ToArray());
            SelectItem(comboSourceText, PropertyPath.Root.Property(nameof(ResultFile.FileName)));
            FormatCultureInfo = CultureInfo.InvariantCulture;
        }
Example #6
0
        private ColumnSelector GetColumnSelector(Type rootType, PropertyPath propertyPath)
        {
            var            key = Tuple.Create(rootType, propertyPath);
            ColumnSelector columnSelector;

            lock (_columnSelectors)
            {
                if (!_columnSelectors.TryGetValue(key, out columnSelector))
                {
                    var rootColumn = ColumnDescriptor.RootColumn(SkylineDataSchema, rootType);
                    columnSelector = new ColumnSelector(rootColumn, propertyPath);
                    _columnSelectors.Add(key, columnSelector);
                }
            }

            return(columnSelector);
        }
Example #7
0
        private List <TItem> ApplyFilter <TItem>(IFilterOperation filterOperation, string operand, IEnumerable <TItem> items)
        {
            var dataSchema       = new DataSchema();
            var columnDescriptor = ColumnDescriptor.RootColumn(dataSchema, typeof(TItem));

            if (null == operand)
            {
                Assert.IsNull(filterOperation.GetOperandType(columnDescriptor));
            }
            else
            {
                Assert.IsNotNull(filterOperation.GetOperandType(columnDescriptor));
            }
            var predicate = filterOperation.MakePredicate(columnDescriptor, operand);

            return(items.Where(item => predicate(item)).ToList());
        }
Example #8
0
        /*
         *      Правка ячейки завершилась.
         */
        private void DGView_Table_CellEndEdit(object sender, DataGridViewCellEventArgs e)
        {
            var cell = DGView_Table.Rows[e.RowIndex].Cells[e.ColumnIndex];
            ColumnDescriptor columnDescriptor = Model.ColumnDescriptors[e.ColumnIndex];

            if (Formatter.TryFormat(
                    (string)cell.Value,
                    columnDescriptor.DataType,
                    columnDescriptor.Format.ToString(),
                    CultureInfo.GetCultureInfo(columnDescriptor.Format.Culture),
                    out string formatted))
            {
                cell.Value = formatted;
            }

            OnModelChanged();
        }
Example #9
0
        private ColumnDescriptor CreateColumnDefinition(ModelRelationshipInstance column)
        {
            var definition = new ColumnDescriptor();

            definition.Name = new Identifier {
                Value = column.ObjectName.GetName()
            };
            var type = column.Object.GetReferenced(Column.DataType).FirstOrDefault();


            if (type == null)
            {
                return(null);//COMPUTED COLUMN
            }
            definition.LiteralType = LiteralConverter.GetLiteralType(type.Name);
            return(definition);
        }
Example #10
0
        public MetadataRuleSetEditor(IDocumentContainer documentContainer, MetadataRuleSet metadataRuleSet, IEnumerable <MetadataRuleSet> existing)
        {
            InitializeComponent();
            DocumentContainer = documentContainer;
            metadataRuleSet   = metadataRuleSet ?? new MetadataRuleSet(typeof(ResultFile));
            _originalName     = metadataRuleSet.Name;
            _dataSchema       = new SkylineDataSchema(documentContainer, SkylineDataSchema.GetLocalizedSchemaLocalizer());
            var rootColumn         = ColumnDescriptor.RootColumn(_dataSchema, typeof(ExtractedMetadataResultRow));
            var viewInfo           = new ViewInfo(rootColumn, GetDefaultViewSpec());
            var skylineViewContext = new MetadataResultViewContext(rootColumn, new StaticRowSource(new MetadataStepResult[0]));

            bindingListSourceResults.SetViewContext(skylineViewContext, viewInfo);
            _metadataExtractor            = new MetadataExtractor(_dataSchema, typeof(ResultFile));
            _ruleRowList                  = new List <RuleRow>();
            bindingSourceRules.DataSource = new BindingList <RuleRow>(_ruleRowList);
            MetadataRuleSet               = metadataRuleSet;
            _existing = ImmutableList.ValueOfOrEmpty(existing);
        }
        public HBaseColumnFamilyData(IHBaseColumnFamilyData other)
        {
            Name = other.Name;
            MaxVersions = other.MaxVersions;
            BlockCacheEnabled = other.BlockCacheEnabled;

            // Add ':' to name
            byte[] name = new byte[Name.Length + 1];
            Name.CopyTo(name, 0);
            name[name.Length - 1] = (byte) ':';

            ColumnDescriptor = new ColumnDescriptor
                                   {
                                       Name = name,
                                       MaxVersions = this.MaxVersions,
                                       BlockCacheEnabled = this.BlockCacheEnabled
                                   };
        }
Example #12
0
        public void HBaseColumnFamilyDataConvertsFromColumnDescriptor()
        {
            byte[] columnName = Encoding.UTF8.GetBytes("cd");
            byte[] columnNameFromDb = Encoding.UTF8.GetBytes("cd:");

            ColumnDescriptor cd = new ColumnDescriptor
                                      {
                                          Name = columnNameFromDb,
                                          MaxVersions = 3,
                                          BlockCacheEnabled = true
                                      };
            HBaseColumnFamilyData cfData = new HBaseColumnFamilyData(cd);

            Assert.Equal(columnName, cfData.Name);
            Assert.Equal(cd.MaxVersions, cfData.MaxVersions);
            Assert.Equal(cd.BlockCacheEnabled, cfData.BlockCacheEnabled);
            Assert.Equal(cd, cfData.ColumnDescriptor);
        }
Example #13
0
        [Test] public void MergeListAndStateHiddenInsert()
        {
            ColumnDescriptor listSubjectColumn   = new ColumnDescriptor("Subject", 100);
            ColumnDescriptor stateSubjectColumn  = new ColumnDescriptor("Subject", 100);
            ColumnDescriptor stateDateColumn     = new ColumnDescriptor("Date", 50, ColumnDescriptorFlags.ShowIfNotEmpty);
            ColumnDescriptor listReceivedColumn  = new ColumnDescriptor("Received", 100);
            ColumnDescriptor stateReceivedColumn = new ColumnDescriptor("Received", 100);

            ResourceListState state = new ResourceListState(
                new ColumnDescriptor[] { stateSubjectColumn, stateDateColumn, stateReceivedColumn }, null, true);

            ColumnDescriptor[] result = _displayColumnManager.UpdateColumnsFromState(
                new ColumnDescriptor[] { listSubjectColumn, listReceivedColumn }, state);
            Assert.AreEqual(3, result.Length);
            Assert.AreEqual("Subject", result [0].PropNames [0]);
            Assert.AreEqual("Date", result [1].PropNames [0]);
            Assert.AreEqual("Received", result [2].PropNames [0]);
        }
        protected IEnumerable <TreeNode> MakeChildNodes(ColumnDescriptor parentColumnDescriptor)
        {
            var result = new List <TreeNode>();

            foreach (var columnDescriptor in ListChildren(parentColumnDescriptor))
            {
                var isAdvanced = IsAdvanced(columnDescriptor, parentColumnDescriptor);
                var child      = new TreeNode();
                if (isAdvanced)
                {
                    child.ForeColor = Color.Gray;
                }
                child.SelectedImageIndex = child.ImageIndex = (int)GetImageIndex(columnDescriptor);
                SetColumnDescriptor(child, columnDescriptor);
                result.Add(child);
            }
            return(result);
        }
Example #15
0
        public void TestDataBindingChildDisplayName()
        {
            var dataSchema               = new DataSchema();
            var coldescRoot              = ColumnDescriptor.RootColumn(dataSchema, typeof(RowValue));
            var coldescRetentionTime     = coldescRoot.ResolveChild("RetentionTime");
            var coldescMinRetentionTime  = coldescRetentionTime.ResolveChild("Min");
            var coldescMeanRetentionTime = coldescRetentionTime.ResolveChild("Mean");

            Assert.AreEqual("MinRetentionTime", dataSchema.GetColumnCaption(coldescMinRetentionTime).GetCaption(DataSchemaLocalizer.INVARIANT));
            Assert.AreEqual("AverageRetentionTime", dataSchema.GetColumnCaption(coldescMeanRetentionTime).GetCaption(DataSchemaLocalizer.INVARIANT));
            var coldescParent = coldescRoot.ResolveChild("Parent");
            var coldescParentRetentionTime     = coldescParent.ResolveChild("RetentionTime");
            var coldescParentMeanRetentionTime = coldescParentRetentionTime.ResolveChild("Mean");

            Assert.AreEqual("Parent", dataSchema.GetColumnCaption(coldescParent).GetCaption(DataSchemaLocalizer.INVARIANT));
            Assert.AreEqual("ParentRetentionTime", dataSchema.GetColumnCaption(coldescParentRetentionTime).GetCaption(DataSchemaLocalizer.INVARIANT));
            Assert.AreEqual("ParentAverageRetentionTime", dataSchema.GetColumnCaption(coldescParentMeanRetentionTime).GetCaption(DataSchemaLocalizer.INVARIANT));
        }
Example #16
0
        /**
         * Registers a column that is not by default included in the list of
         * visible columns for the specified resource type, but can always be
         * added to the list (even if none of the resources in the list have that
         * property).
         */

        public void RegisterAvailableColumn(string resourceType, ColumnDescriptor descriptor)
        {
            if (resourceType != null && !Core.ResourceStore.ResourceTypes.Exist(resourceType))
            {
                throw new ArgumentException("Invalid resource type " + resourceType, "resourceType");
            }
            PropNamesToIDs(descriptor.PropNames, false);    // validates the column descriptor

            DisplayColumn col = new DisplayColumn(-1, descriptor);

            if (resourceType == null)
            {
                AddColumnToList(_availableColumns, "", col);
            }
            else
            {
                AddColumnToList(_availableColumns, resourceType, col);
            }
        }
Example #17
0
 private static void UpdateGroupProvider(bool setGroupProviders, ColumnDescriptor desc,
                                         ResourcePropsColumn colHdr)
 {
     if (setGroupProviders)
     {
         if (desc.GroupProvider != null)
         {
             colHdr.GroupProvider = new GroupProviderAdapter(desc.GroupProvider);
         }
         else
         {
             colHdr.GroupProvider = GetGroupProvider(colHdr.PropIds);
         }
     }
     else
     {
         colHdr.GroupProvider = null;
     }
 }
Example #18
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);
        }
Example #19
0
        protected override void AddSourceValue(ValueToSqlConverter valueConverter, ColumnDescriptor column, SqlDataType columnType, object value, bool isFirstRow, bool isLastRow)
        {
            if (!_columnTypedTracker.ContainsKey(column))
            {
                _columnTypedTracker.Add(column, value != null);
            }

            if (value == null)
            {
                /* DB2 doesn't like NULLs without type information
                 * : ERROR [42610] [IBM][DB2/NT64] SQL0418N  The statement was not processed because the statement
                 * contains an invalid use of one of the following: an untyped parameter marker, the DEFAULT keyword
                 * , or a null value.
                 *
                 * See https://stackoverflow.com/questions/13381898
                 *
                 * Unfortunatelly, just use typed parameter doesn't help
                 *
                 * To fix it we need to cast at least one NULL in column if all column values are null.
                 * We will do it for last row, when we know that there is no non-null values in column and type hint
                 * needed.
                 *
                 * One thing I don't like is that in some cases DB2 can process query without type hints
                 */

                if (isLastRow && !_columnTypedTracker[column])
                {
                    // we type only NULLs in last row and only if there is no non-NULL values in other rows
                    // adding casts in other cases not required and could even lead to type conflicts if type in
                    // cast not compatible with non-null values in column
                    Command.Append("CAST(NULL AS ");
                    BuildColumnType(column, columnType);
                    Command.Append(")");
                    return;
                }
            }
            else
            {
                _columnTypedTracker[column] = true;
            }

            base.AddSourceValue(valueConverter, column, columnType, value, isFirstRow, isLastRow);
        }
Example #20
0
        public void UpdateColumnCells(ColumnDescriptor descriptor, int columnIndex)
        {
            // строка
            for (int i = 0; i < _table.Rows.Count - 1; i++)             // "_table.Rows.Count - 1" - игнорируем последнюю пустую строку
            {
                // ячейка
                string oldValue = _table.Rows[i].Cells[columnIndex].Value as string;
                string culture  = descriptor.Format.Culture;

                _table.Rows[i].Cells[columnIndex].Value = Formatter.TryFormat(
                    oldValue,
                    descriptor.DataType,
                    descriptor.Format.ToString(),
                    CultureInfo.GetCultureInfo(culture),
                    out string newValue);

                _table.Rows[i].Cells[columnIndex].Value = newValue;
            }
        }
Example #21
0
            /// <inheritdoc />
            public string GetText(object element, ColumnDescriptor column)
            {
                ErrorLogEntry item = (ErrorLogEntry)element;

                if (column == ErrorsViewListContentProvider.MessageColumn)
                {
                    return(item.Message);
                }
                if (column == ErrorsViewListContentProvider.PluginColumn)
                {
                    return(item.PluginName);
                }
                if (column == ErrorsViewListContentProvider.DateColumn)
                {
                    return(item.Timestamp.ToString());
                }

                return(null);
            }
Example #22
0
        private ScalarExpression GetColumnOrCastColumn(ColumnDescriptor column, string tableName)
        {
            var columnReference = new ColumnReferenceExpression();

            columnReference.MultiPartIdentifier = MultiPartIdentifierBuilder.Get(tableName, column.Name.GetName());

            if (column.UnderlyingType == "xml")
            {
                var cast = new CastCall();
                var type = new SqlDataTypeReference();
                type.SqlDataTypeOption = SqlDataTypeOption.NVarChar;
                type.Parameters.Add(new MaxLiteral());

                cast.DataType  = type;
                cast.Parameter = columnReference;
                return(cast);
            }

            return(columnReference);
        }
Example #23
0
 public SqlField(ColumnDescriptor column)
 {
     SystemType       = column.MemberType;
     Name             = column.MemberName;
     PhysicalName     = column.ColumnName;
     CanBeNull        = column.CanBeNull;
     IsPrimaryKey     = column.IsPrimaryKey;
     PrimaryKeyOrder  = column.PrimaryKeyOrder;
     IsIdentity       = column.IsIdentity;
     IsInsertable     = !column.SkipOnInsert;
     IsUpdatable      = !column.SkipOnUpdate;
     DataType         = column.DataType;
     DbType           = column.DbType;
     Length           = column.Length;
     Precision        = column.Precision;
     Scale            = column.Scale;
     CreateFormat     = column.CreateFormat;
     CreateOrder      = column.Order;
     ColumnDescriptor = column;
 }
Example #24
0
        public static ListPropertyType GetListPropertyType(ColumnDescriptor columnDescriptor, AggregateOperation aggregateOperation)
        {
            var propertyType = columnDescriptor.DataSchema.GetWrappedValueType(columnDescriptor.PropertyType);

            if (aggregateOperation != null)
            {
                propertyType = aggregateOperation.GetPropertyType(propertyType);
            }
            if (propertyType == typeof(bool))
            {
                return(ListPropertyType.TRUE_FALSE);
            }

            if (propertyType.IsPrimitive)
            {
                return(ListPropertyType.NUMBER);
            }

            return(ListPropertyType.TEXT);
        }
Example #25
0
 protected override void AddSourceValue(ValueToSqlConverter valueConverter, ColumnDescriptor column, SqlDataType columnType, object value, bool isFirstRow, bool isLastRow)
 {
     if (value == null || value is INullable && ((INullable)value).IsNull)
     {
         var casttype = (columnType.DataType == DataType.Undefined) ?
                        columnType.Type.GetTypeForCast(MapGuidAsString) :
                        SqlDataType.GetDataType(columnType.DataType).GetiSeriesType(MapGuidAsString);
         Command.Append($"CAST(NULL AS {casttype})");
         return;
     }
     // avoid parameters in source due to low limits for parameters number in providers
     if (!valueConverter.TryConvert(Command, columnType, value))
     {
         var colType = value.GetType().GetTypeForCast(MapGuidAsString);
         // we have to use parameter wrapped in a cast
         var name     = GetNextParameterName();
         var fullName = SqlBuilder.Convert(name, ConvertType.NameToQueryParameter).ToString();
         Command.Append($"CAST({fullName} as {colType})");
         AddParameter(new DataParameter(name, value, column.DataType));
     }
 }
Example #26
0
        private ColumnDescriptor FindColumnDescriptor(ColumnDescriptor start, PropertyPath propertyPath)
        {
            if (propertyPath.Equals(start.PropertyPath))
            {
                return(start);
            }

            foreach (var child in ListAllChildren(start))
            {
                if (propertyPath.StartsWith(child.PropertyPath))
                {
                    var result = FindColumnDescriptor(child, propertyPath);
                    if (result != null)
                    {
                        return(result);
                    }
                }
            }

            return(null);
        }
        private ImageIndexes GetImageIndex(ColumnDescriptor columnDescriptor)
        {
            if (null == columnDescriptor)
            {
                return(0);
            }
            if (null != columnDescriptor.CollectionInfo)
            {
                if (null != SublistId && SublistId.StartsWith(columnDescriptor.PropertyPath))
                {
                    return(ImageIndexes.Sublist);
                }
                return(ImageIndexes.Pivot);
            }
            var propertyType = columnDescriptor.PropertyType;

            if (null == propertyType)
            {
                return(ImageIndexes.Unknown);
            }
            if (typeof(ILinkValue).IsAssignableFrom(propertyType))
            {
                return(ImageIndexes.Link);
            }
            propertyType = columnDescriptor.DataSchema.GetWrappedValueType(propertyType);
            if (typeof(string) == propertyType)
            {
                return(ImageIndexes.Text);
            }
            if (typeof(bool) == propertyType)
            {
                return(ImageIndexes.Boolean);
            }
            if (propertyType.IsPrimitive)
            {
                return(ImageIndexes.Number);
            }
            return(ImageIndexes.Unknown);
        }
Example #28
0
        internal ColumnDescriptor[] UpdateColumnsFromState(ColumnDescriptor[] descriptors, ResourceListState state)
        {
            bool[]    usedColumns = new bool [state.Columns.Length];
            ArrayList result      = new ArrayList();

            for (int i = 0; i < descriptors.Length; i++)
            {
                bool found = false;
                for (int j = 0; j < state.Columns.Length; j++)
                {
                    if (state.Columns [j].PropNamesEqual(descriptors [i]))
                    {
                        ColumnDescriptor desc = descriptors [i];
                        desc.Flags = state.Columns [j].Flags;
                        result.Add(desc);
                        found           = true;
                        usedColumns [j] = true;
                        break;
                    }
                }
                if (!found)
                {
                    result.Add(descriptors [i]);
                }
            }

            for (int i = 0; i < state.Columns.Length; i++)
            {
                if (!usedColumns [i])
                {
                    int index = (i == 0)
                        ? 0
                        : FindColumn(result, state.Columns [i - 1]) + 1;
                    result.Insert(index, state.Columns [i]);
                }
            }

            return((ColumnDescriptor[])result.ToArray(typeof(ColumnDescriptor)));
        }
Example #29
0
        public void HBaseColumnFamilyDataConvertsFromHBaseColumnFamilyData()
        {
            byte[] columnNameInDb = Encoding.UTF8.GetBytes("cd:");

            ColumnDescriptor cd = new ColumnDescriptor
            {
                Name = columnNameInDb,
                MaxVersions = 3,
                BlockCacheEnabled = true
            };

            HBaseColumnFamilyData cf1 = new HBaseColumnFamilyData(cd);
            HBaseColumnFamilyData cf2 = new HBaseColumnFamilyData(cf1);

            Assert.Equal(cf1.Name, cf2.Name);
            Assert.Equal(cf1.MaxVersions, cf2.MaxVersions);
            Assert.Equal(cf1.BlockCacheEnabled, cf2.BlockCacheEnabled);

            Assert.Equal(cf1.ColumnDescriptor.Name, cf2.ColumnDescriptor.Name);
            Assert.Equal(cf1.ColumnDescriptor.MaxVersions, cf2.ColumnDescriptor.MaxVersions);
            Assert.Equal(cf1.ColumnDescriptor.BlockCacheEnabled, cf2.ColumnDescriptor.BlockCacheEnabled);
        }
Example #30
0
            internal PropertyTypeTag(ColumnDescriptor colDesc, int[] propIds, bool[] reverseLinks, bool initialChecked)
            {
                _initialChecked = initialChecked;
                ColDesc         = colDesc;
                ArrayList propNames = new ArrayList();

                for (int i = 0; i < propIds.Length; i++)
                {
                    string displayName = reverseLinks [i]
                        ? Core.ResourceStore.PropTypes [propIds [i]].ReverseDisplayName
                        : Core.ResourceStore.PropTypes [propIds [i]].DisplayName;
                    if (displayName == null)
                    {
                        displayName = Core.ResourceStore.PropTypes [propIds [i]].Name;
                    }
                    if (!propNames.Contains(displayName))
                    {
                        propNames.Add(displayName);
                    }
                }
                _name = String.Join(", ", (string[])propNames.ToArray(typeof(string)));
            }
Example #31
0
        /// <summary>
        /// Creates all columns for the viewer based on the given <paramref name="columns"/> descriptor.
        /// </summary>
        /// <param name="columns">Column descriptor collection</param>
        private void CreateColumns(ColumnDescriptor[] columns)
        {
            Columns.Clear();
            if (columns == null || columns.Length == 0)
            {
                return;
            }

            for (int i = -1; ++i != columns.Length;)
            {
                ColumnDescriptor columnDescriptor = columns[i];

                ColumnHeader columnHeader = new ColumnHeader {
                    Text      = columnDescriptor.HeaderText,
                    Width     = (int)columnDescriptor.DefaultWidth,
                    TextAlign = MapTextAlign(columnDescriptor.Orientation),
                    Tag       = columnDescriptor
                };

                Columns.Add(columnHeader);
            }
        }
Example #32
0
        public void TestDataBindingMapAttribute()
        {
            var tree = new AvailableFieldsTree
            {
                RootColumn         = ColumnDescriptor.RootColumn(new DataSchema(), typeof(Peptide)),
                ShowAdvancedFields = true
            };
            var idAminoAcidMoleculeElement = PropertyPath.Parse("AminoAcidsList!*.Molecule!*.Key");

            Assert.IsNull(tree.FindTreeNode(idAminoAcidMoleculeElement, false));
            var aminoAcidMoleculeElementNode = tree.FindTreeNode(idAminoAcidMoleculeElement, true);

            Assert.AreEqual("Element", aminoAcidMoleculeElementNode.Text);
            Assert.AreEqual(PropertyPath.Parse("AminoAcidsList!*.Molecule!*"), tree.GetTreeColumn(aminoAcidMoleculeElementNode.Parent).PropertyPath);
            Assert.AreEqual(PropertyPath.Parse("AminoAcidsList!*.Molecule!*.Value"), tree.GetValueColumn(aminoAcidMoleculeElementNode.Parent).PropertyPath);
            Assert.AreEqual(PropertyPath.Parse("AminoAcidsList!*"), tree.GetValueColumn(aminoAcidMoleculeElementNode.Parent.Parent).PropertyPath);
            var aminoAcidDictKeyNode  = tree.FindTreeNode(PropertyPath.Parse("AminoAcidsDict!*.Key"), true);
            var aminoAcidDictCodeNode = tree.FindTreeNode(PropertyPath.Parse("AminoAcidsDict!*.Value.Code"), true);

            Assert.AreEqual("Code", aminoAcidDictCodeNode.Text);
            Assert.AreSame(aminoAcidDictKeyNode.Parent, aminoAcidDictCodeNode.Parent);
        }
Example #33
0
        protected IEnumerable <TreeNode> MakeChildNodes(ColumnDescriptor parentColumnDescriptor)
        {
            var result = new List <TreeNode>();

            foreach (var columnDescriptor in ListChildren(parentColumnDescriptor))
            {
                var child = new TreeNode();
                if (IsObsolete(columnDescriptor))
                {
                    SetFontStyle(child, FontStyle.Strikeout);
                    child.ForeColor = SystemColors.GrayText;
                }
                else if (IsAdvanced(columnDescriptor, parentColumnDescriptor))
                {
                    SetFontStyle(child, FontStyle.Italic);
                    child.ForeColor = SystemColors.GrayText;
                }
                child.SelectedImageIndex = child.ImageIndex = (int)GetImageIndex(columnDescriptor);
                SetColumnDescriptor(child, columnDescriptor);
                result.Add(child);
            }
            return(result);
        }
Example #34
0
        private void AddUncheckedColumns(ArrayList propTypeList, IResourceList resList, Hashtable nameToPropTagMap)
        {
            foreach (IPropType propType in propTypeList)
            {
                bool   linksReverse = AreLinksReverse(resList, propType.Id);
                string displayName  = linksReverse ? propType.ReverseDisplayName : propType.DisplayName;
                if (displayName == null)
                {
                    displayName = propType.Name;
                }

                PropertyTypeTag propTypeTag = (PropertyTypeTag)nameToPropTagMap [displayName];
                if (propTypeTag == null)
                {
                    ColumnDescriptor colDesc = new ColumnDescriptor(propType.Name, 150);
                    _displayColumnManager.FindColumnDescriptor(propType.Name, ref colDesc);
                    propTypeTag = new PropertyTypeTag(colDesc,
                                                      new int[] { propType.Id }, new bool[] { linksReverse }, false);
                    nameToPropTagMap [displayName] = propTypeTag;
                }
                else if (!propTypeTag.InitialChecked)
                {
                    propTypeTag.AppendPropType(propType);
                }
            }

            ArrayList tags = new ArrayList(nameToPropTagMap.Values);

            tags.Sort();
            foreach (PropertyTypeTag tag in tags)
            {
                if (!tag.InitialChecked)
                {
                    AddPropTypeItem(tag, false);
                }
            }
        }
Example #35
0
 public void DoWork()
 {
     if (_pastSelectedColumn && null != _next)
     {
         return;
     }
     DateTime start = DateTime.Now;
     int counter = 0;
     while (0 < _queue.Count)
     {
         if (counter > 1000 && DateTime.Now.Subtract(start) > TimeSpan.FromMilliseconds(50))
         {
             return;
         }
         if (_totalCounter > MAX_COLUMNS_TO_SEARCH)
         {
             return;
         }
         string normalizedFindText = SearchState.MatchCase
             ? SearchState.FindText
             : SearchState.FindText.ToLower();
         var column = _queue.Dequeue();
         counter++;
         _totalCounter++;
         bool isSelected = Equals(column.PropertyPath, SearchState.SelectedPath);
         string columnCaption = column.GetColumnCaption(ColumnCaptionType.localized);
         if (!SearchState.MatchCase)
         {
             columnCaption = columnCaption.ToLower();
         }
         bool matches = columnCaption.Contains(normalizedFindText);
         if (isSelected)
         {
             _pastSelectedColumn = true;
         }
         if (matches)
         {
             if (isSelected)
             {
                 // don't find selected column
             }
             else if (_pastSelectedColumn)
             {
                 _next = column;
                 return;
             }
             else
             {
                 _previous = column;
             }
         }
         foreach (var child in SearchState.AvailableFieldsTree.ListChildren(column))
         {
             _queue.Enqueue(child);
         }
     }
 }
Example #36
0
      /// <summary>
      /// Initializes a new instance of the WWListView class, with predefined columns
      /// </summary>
      /// <param name="columnDescriptors">Array of column descriptors</param>
      public WWListView(ColumnDescriptor [] columnDescriptors) : this() 
      {
         this.m_colDesc = columnDescriptors;

         for(int i=0; i < columnDescriptors.Length; i++) 
         {
            ColumnHeader ch = new ColumnHeader();
            ch.Text = columnDescriptors[i].m_columnName;
            ch.Width = columnDescriptors[i].m_width;
            this.Columns.Add(ch);
            this.m_htColumnIndices.Add(columnDescriptors[i].m_attribName, i);
         }
      }
Example #37
0
 private void AddFilter(ColumnDescriptor columnDescriptor)
 {
     var newFilters = new List<FilterSpec>(ViewSpec.Filters)
         {
             new FilterSpec(columnDescriptor.PropertyPath, FilterOperations.OP_HAS_ANY_VALUE, null)
         };
     SetViewSpec(ViewSpec.SetFilters(newFilters), null);
     dataGridViewFilter.CurrentCell = dataGridViewFilter.Rows[dataGridViewFilter.Rows.Count - 1].Cells[colFilterOperation.Index];
 }
Example #38
0
 public void Read(TProtocol iprot)
 {
     TField field;
     iprot.ReadStructBegin();
     while (true)
     {
         field = iprot.ReadFieldBegin();
         if (field.Type == TType.Stop)
         {
             break;
         }
         switch (field.ID)
         {
             case 0:
                 if (field.Type == TType.Map)
                 {
                     {
                         this.Success = new Dictionary<byte[], ColumnDescriptor>();
                         TMap _map17 = iprot.ReadMapBegin();
                         for (int _i18 = 0; _i18 < _map17.Count; ++_i18)
                         {
                             byte[] _key19;
                             ColumnDescriptor _val20;
                             _key19 = iprot.ReadBinary();
                             _val20 = new ColumnDescriptor();
                             _val20.Read(iprot);
                             this.Success[_key19] = _val20;
                         }
                         iprot.ReadMapEnd();
                     }
                 }
                 else
                 {
                     TProtocolUtil.Skip(iprot, field.Type);
                 }
                 break;
             case 1:
                 if (field.Type == TType.Struct)
                 {
                     this.Io = new IOError();
                     this.Io.Read(iprot);
                 }
                 else
                 {
                     TProtocolUtil.Skip(iprot, field.Type);
                 }
                 break;
             default:
                 TProtocolUtil.Skip(iprot, field.Type);
                 break;
         }
         iprot.ReadFieldEnd();
     }
     iprot.ReadStructEnd();
 }
Example #39
0
        /// <summary>
        /// Loads descriptors from an XML file into memory.
        /// </summary>
        /// <param name="sFilePath">The path to the XML file.</param>
        public static void Load(string sFilePath)
        {
            if (!s_initialized)
                return;

            if (!File.Exists(sFilePath)) {
                Settings.UseExternalDescriptors = false;
                return;
            }

            s_columnDescriptors.Clear();
            GC.Collect();

            XmlReader fsDescriptors = null;

            try {
                fsDescriptors = XmlReader.Create(sFilePath);

                while (fsDescriptors.Read()) {
                    if(fsDescriptors.NodeType != XmlNodeType.Element || fsDescriptors.Name != "Table")
                        continue;

                    string sTableName = fsDescriptors.GetAttribute("Name");
                    int nColumnCount = Int32.Parse(fsDescriptors.GetAttribute("Columns"));

                    s_columnDescriptors.Add(sTableName, new Dictionary<int, ColumnDescriptor>(nColumnCount));

                    for (int i = 0; i < nColumnCount; i++) {
                        while (fsDescriptors.NodeType != XmlNodeType.Element || fsDescriptors.Name != "Column") {
                            if (!fsDescriptors.Read())
                                throw new Exception("Descriptors::Load(): Element ended unexpectedly.");
                        }

                        int nIndex = Int32.Parse(fsDescriptors.GetAttribute("Index"));
                        int nOffset = Int32.Parse(fsDescriptors.GetAttribute("Offset"));
                        int nSize = Int32.Parse(fsDescriptors.GetAttribute("Size"));

                        if (nIndex < 0 || nIndex >= nColumnCount || s_columnDescriptors[sTableName].ContainsKey(nIndex))
                            throw new Exception("Descriptors::Load(): Encountered unexpected column index.");

                        ColumnDescriptor colColumnDescriptor = new ColumnDescriptor();
                        colColumnDescriptor.Index = nIndex;
                        colColumnDescriptor.Offset = nOffset;
                        colColumnDescriptor.Size = nSize;

                        s_columnDescriptors[sTableName].Add(nIndex, colColumnDescriptor);

                        if (!fsDescriptors.Read())
                            throw new Exception("Descriptors::Load(): Element ended unexpectedly.");
                    }
                }
            } catch { }

            if (fsDescriptors != null)
                fsDescriptors.Close();

            IsFileLoaded = true;
        }
Example #40
0
        private string createValue(byte[] a_msg, ColumnDescriptor desc)
        {
            string str5;
            string[] strArray = new string[] { "Loadboard 2.2", "EZLink", "SW development board", "EZRadioPRO push button board", "SRW Motherboard", "Si4010 keyfob", "Henrietta demo node", "USB dongle", "EZRadioLC receiver boards", "", "", "Coin Cell Sensor node" };
            string[] strArray2 = new string[] { "Sensor node", "RKE keyfob" };
            string[] strArray3 = new string[] { "Association", "Button Pressed", "Sensor Data", "Unknown" };
            try
            {
                string str2;
                int num2;
                int num3;
                switch (desc.DisplayFormat)
                {
                    case DisplayFormat.Dec8:
                    {
                        int num15 = a_msg[this.AESOffset(desc.ByteIndex)];
                        return num15.ToString();
                    }
                    case DisplayFormat.Hex8:
                        return a_msg[this.AESOffset(desc.ByteIndex)].ToString("X2");

                    case DisplayFormat.Hex16:
                        str2 = "";
                        num2 = 0;
                        goto Label_032E;

                    case DisplayFormat.Hex32:
                        str2 = "";
                        num3 = 0;
                        goto Label_0376;

                    case DisplayFormat.AES:
                        if (a_msg[this.AESOffset(desc.ByteIndex)] != 1)
                        {
                            return "No";
                        }
                        return "Yes";

                    case DisplayFormat.ASCIIAESKey:
                        if (this._AESOffset != 0)
                        {
                            break;
                        }
                        return "";

                    case DisplayFormat.HwType:
                        return strArray[a_msg[this.AESOffset(desc.ByteIndex)]];

                    case DisplayFormat.AppType:
                        return strArray2[a_msg[this.AESOffset(desc.ByteIndex)]];

                    case DisplayFormat.Button:
                    {
                        string str = "";
                        if (a_msg[this.AESOffset(desc.ByteIndex)] == 0)
                        {
                            str = str + "0,";
                        }
                        if ((a_msg[this.AESOffset(desc.ByteIndex)] & 1) == 1)
                        {
                            str = str + "1,";
                        }
                        if ((a_msg[this.AESOffset(desc.ByteIndex)] & 2) == 2)
                        {
                            str = str + "2,";
                        }
                        if ((a_msg[this.AESOffset(desc.ByteIndex)] & 4) == 4)
                        {
                            str = str + "3,";
                        }
                        if ((a_msg[this.AESOffset(desc.ByteIndex)] & 8) == 8)
                        {
                            str = str + "4,";
                        }
                        if ((a_msg[this.AESOffset(desc.ByteIndex)] & 0x10) == 0x10)
                        {
                            str = str + "5,";
                        }
                        return str.Substring(0, str.Length - 1);
                    }
                    case DisplayFormat.PacketType:
                        if (((a_msg[this.AESOffset(desc.ByteIndex)] != 0x47) && (a_msg[this.AESOffset(desc.ByteIndex)] != 0x44)) && (a_msg[this.AESOffset(desc.ByteIndex)] != 0x45))
                        {
                            goto Label_03C4;
                        }
                        return strArray3[0];

                    case DisplayFormat.Temp:
                    {
                        string str3 = "+";
                        string str4 = " \x00b0C";
                        byte num4 = a_msg[this.AESOffset(desc.ByteIndex + 1)];
                        if (num4 > 5)
                        {
                            num4 = (byte) (num4 - 5);
                        }
                        if (num4 < 0x80)
                        {
                            num4 = (byte) (0x80 - num4);
                            str3 = "-";
                        }
                        else
                        {
                            num4 = (byte) (num4 - 0x80);
                        }
                        if ((num4 & 1) == 1)
                        {
                            str4 = ".5" + str4;
                        }
                        else
                        {
                            str4 = ".0" + str4;
                        }
                        int num16 = num4 >> 1;
                        return (str3 + num16.ToString() + str4);
                    }
                    case DisplayFormat.Battery:
                    {
                        byte num7 = (byte) (a_msg[this.AESOffset(desc.ByteIndex)] & 0x1f);
                        double num8 = 1.675 + (num7 * 0.05);
                        return (num8.ToString() + " V");
                    }
                    case DisplayFormat.RSSI:
                    {
                        double num14 = a_msg[this.AESOffset(desc.ByteIndex)];
                        num14 = (num14 - 230.0) / 2.0;
                        return (num14.ToString() + " dBm");
                    }
                    case DisplayFormat.Temp_S16_dC:
                    {
                        short num5 = (short) ((ushort) ((a_msg[this.AESOffset(desc.ByteIndex)] << 8) + a_msg[this.AESOffset(desc.ByteIndex + 1)]));
                        double num6 = ((float) num5) / 10f;
                        return (num6.ToString("F1") + " \x00b0C");
                    }
                    case DisplayFormat.Battery_U16_mV:
                    {
                        ushort num9 = (ushort) ((a_msg[this.AESOffset(desc.ByteIndex)] << 8) + a_msg[this.AESOffset(desc.ByteIndex + 1)]);
                        double num10 = ((float) num9) / 1000f;
                        return (num10.ToString("F3") + " V");
                    }
                    case DisplayFormat.Percent:
                    {
                        byte num11 = a_msg[this.AESOffset(desc.ByteIndex)];
                        return (num11.ToString() + "%");
                    }
                    case DisplayFormat.LightLevel_Lux:
                    {
                        byte num12 = a_msg[this.AESOffset(desc.ByteIndex)];
                        int num13 = num12 * 10;
                        return (num13.ToString() + " lux");
                    }
                    case DisplayFormat.NotAvailable:
                        return "--";

                    default:
                        goto Label_066E;
                }
                byte[] bytes = new byte[this._AESKeyLength];
                for (int i = 0; i < this._AESKeyLength; i++)
                {
                    bytes[i] = a_msg[desc.ByteIndex + i];
                }
                return BytesToHex(bytes);
            Label_0300:
                str2 = str2 + a_msg[this.AESOffset(desc.ByteIndex) + num2].ToString("X2");
                num2++;
            Label_032E:
                if (num2 < 2)
                {
                    goto Label_0300;
                }
                return str2;
            Label_0348:
                str2 = str2 + a_msg[this.AESOffset(desc.ByteIndex) + num3].ToString("X2");
                num3++;
            Label_0376:
                if (num3 < 4)
                {
                    goto Label_0348;
                }
                return str2;
            Label_03C4:
                if ((a_msg[this.AESOffset(desc.ByteIndex)] == 4) || ((a_msg[this.AESOffset(desc.ByteIndex)] == 3) && ((a_msg[this.AESOffset(desc.ByteIndex + 6)] & 1) == 1)))
                {
                    return strArray3[1];
                }
                if (((a_msg[this.AESOffset(desc.ByteIndex)] == 3) || (a_msg[this.AESOffset(desc.ByteIndex)] == 6)) || ((a_msg[this.AESOffset(desc.ByteIndex)] == 7) || (a_msg[this.AESOffset(desc.ByteIndex)] == 8)))
                {
                    return strArray3[2];
                }
                return strArray3[3];
            Label_066E:
                str5 = string.Empty;
            }
            catch
            {
                str5 = string.Empty;
            }
            return str5;
        }
 protected IEnumerable<TreeNode> MakeChildNodes(ColumnDescriptor parentColumnDescriptor)
 {
     var result = new List<TreeNode>();
     foreach (var columnDescriptor in ListChildren(parentColumnDescriptor))
     {
         var isAdvanced = IsAdvanced(columnDescriptor, parentColumnDescriptor);
         var child = new TreeNode();
         if (isAdvanced)
         {
             child.ForeColor = Color.Gray;
         }
         child.SelectedImageIndex = child.ImageIndex = (int) GetImageIndex(columnDescriptor);
         SetColumnDescriptor(child, columnDescriptor);
         result.Add(child);
     }
     return result;
 }
 private bool IsAdvanced(ColumnDescriptor columnDescriptor, ColumnDescriptor parent)
 {
     while (null != columnDescriptor && columnDescriptor.PropertyPath.StartsWith(parent.PropertyPath))
     {
         if (columnDescriptor.IsAdvanced)
         {
             return true;
         }
         columnDescriptor = columnDescriptor.Parent;
     }
     return false;
 }
 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;
 }
Example #44
0
 private void grayOutCellIfNeeded(DataGridViewCell cell, ColumnDescriptor desc)
 {
     if ((desc.DisplayFormat == DisplayFormat.ASCIIAESKey) && (desc.Length == 0))
     {
         cell.Style.BackColor = Color.LightGray;
     }
     if ((desc.DisplayFormat == DisplayFormat.Hex16) && (cell.Value.ToString() == "FFFF"))
     {
         cell.Style.BackColor = Color.LightGray;
     }
 }
 private void SetColumnDescriptor(TreeNode node, ColumnDescriptor columnDescriptor)
 {
     var nodeData = new NodeData(columnDescriptor);
     node.Tag = nodeData;
     node.Text = columnDescriptor.GetColumnCaption(ColumnCaptionType.localized);
     UpdateNode(node);
     node.Nodes.Clear();
     node.Nodes.Add(new TreeNode {Tag = NodeData.UninitializedTag});
 }
Example #46
0
 public void Read(TProtocol iprot)
 {
     TField field;
     iprot.ReadStructBegin();
     while (true)
     {
         field = iprot.ReadFieldBegin();
         if (field.Type == TType.Stop)
         {
             break;
         }
         switch (field.ID)
         {
             case 1:
                 if (field.Type == TType.String)
                 {
                     this.TableName = iprot.ReadBinary();
                 }
                 else
                 {
                     TProtocolUtil.Skip(iprot, field.Type);
                 }
                 break;
             case 2:
                 if (field.Type == TType.List)
                 {
                     {
                         this.ColumnFamilies = new List<ColumnDescriptor>();
                         TList _list26 = iprot.ReadListBegin();
                         for (int _i27 = 0; _i27 < _list26.Count; ++_i27)
                         {
                             var _elem28 = new ColumnDescriptor();
                             _elem28 = new ColumnDescriptor();
                             _elem28.Read(iprot);
                             this.ColumnFamilies.Add(_elem28);
                         }
                         iprot.ReadListEnd();
                     }
                 }
                 else
                 {
                     TProtocolUtil.Skip(iprot, field.Type);
                 }
                 break;
             default:
                 TProtocolUtil.Skip(iprot, field.Type);
                 break;
         }
         iprot.ReadFieldEnd();
     }
     iprot.ReadStructEnd();
 }
Example #47
0
 public void Read (TProtocol iprot)
 {
   TField field;
   iprot.ReadStructBegin();
   while (true)
   {
     field = iprot.ReadFieldBegin();
     if (field.Type == TType.Stop) { 
       break;
     }
     switch (field.ID)
     {
       case 0:
         if (field.Type == TType.Map) {
           {
             Success = new Dictionary<byte[], ColumnDescriptor>();
             TMap _map29 = iprot.ReadMapBegin();
             for( int _i30 = 0; _i30 < _map29.Count; ++_i30)
             {
               byte[] _key31;
               ColumnDescriptor _val32;
               _key31 = iprot.ReadBinary();
               _val32 = new ColumnDescriptor();
               _val32.Read(iprot);
               Success[_key31] = _val32;
             }
             iprot.ReadMapEnd();
           }
         } else { 
           TProtocolUtil.Skip(iprot, field.Type);
         }
         break;
       case 1:
         if (field.Type == TType.Struct) {
           Io = new IOError();
           Io.Read(iprot);
         } else { 
           TProtocolUtil.Skip(iprot, field.Type);
         }
         break;
       default: 
         TProtocolUtil.Skip(iprot, field.Type);
         break;
     }
     iprot.ReadFieldEnd();
   }
   iprot.ReadStructEnd();
 }
 private ImageIndexes GetImageIndex(ColumnDescriptor columnDescriptor)
 {
     if (null == columnDescriptor)
     {
         return 0;
     }
     if (null != columnDescriptor.CollectionInfo)
     {
         if (null != SublistId && SublistId.StartsWith(columnDescriptor.PropertyPath))
         {
             return ImageIndexes.Sublist;
         }
         return ImageIndexes.Pivot;
     }
     var propertyType = columnDescriptor.PropertyType;
     if (null == propertyType)
     {
         return ImageIndexes.Unknown;
     }
     if (typeof (ILinkValue).IsAssignableFrom(propertyType))
     {
         return ImageIndexes.Link;
     }
     propertyType = columnDescriptor.DataSchema.GetWrappedValueType(propertyType);
     if (typeof (string) == propertyType)
     {
         return ImageIndexes.Text;
     }
     if (typeof (bool) == propertyType)
     {
         return ImageIndexes.Boolean;
     }
     if (propertyType.IsPrimitive)
     {
         return ImageIndexes.Number;
     }
     return ImageIndexes.Unknown;
 }
 public NodeData(ColumnDescriptor treeColumn)
 {
     TreeColumn = treeColumn;
     if (treeColumn.CollectionInfo != null && treeColumn.CollectionInfo.IsDictionary)
     {
         ValueColumn = treeColumn.ResolveChild("Value"); // Not L10N
     }
     ValueColumn = ValueColumn ?? TreeColumn;
 }
Example #50
0
 private ColumnDescriptor GetPivotColumn(ColumnDescriptor columnDescriptor)
 {
     return PivotColumns.LastOrDefault(col => columnDescriptor.PropertyPath.StartsWith(col.PropertyPath));
 }
 public IEnumerable<ColumnDescriptor> ListChildren(ColumnDescriptor parent)
 {
     var allChildren = ListAllChildren(parent);
     if (ShowAdvancedFields)
     {
         return allChildren;
     }
     return allChildren.Where(child => !IsAdvanced(child, parent));
 }