private void ShowMenuStripField(int popTop, int popLeft, int objIndex, FastRow objRow)
        {
            var pop = new PopupListBox(objRow.cells[objIndex].CellValue,
                                       lastHitRow,
                                       lastHitColumn,
                                       columnProperty[lastHitColumn].PropertyType, OnValueEntered, this);

            pop.ShowOptions(popLeft, popTop);
        }
        private void ShowTextBoxField(int popTop, int popLeft, int objIndex, FastRow objRow)
        {
            var pop = new PopupTextBox(objRow.cells[objIndex].CellValue,
                                       lastHitColumn.ResultedWidth, CellHeight,
                                       lastHitRow,
                                       lastHitColumn,
                                       columnProperty[lastHitColumn], OnValueEntered);

            pop.Show(this, popLeft, popTop);
        }
        private void AddRow(object obj)
        {
            var row = new FastRow(this, obj, columnProperty);

            if (userDrawCellText != null)
            {
                row.UserDrawCellText += OnUserDrawCellText;
            }
            rows.Add(row);
        }
        /// <summary>
        /// обновить одну строку
        /// вернуть флаг необходимости перерисовки
        /// </summary>
        public bool UpdateRow(int rowIndex, object boundValue)
        {
            if (rowIndex >= rows.Count || rowIndex < 0)
            {
                return(false);
            }
            var selected = rows[rowIndex].Selected;
            var row      = new FastRow(this, boundValue, columnProperty)
            {
                Selected = selected
            };

            if (userDrawCellText != null)
            {
                row.UserDrawCellText += OnUserDrawCellText;
            }
            rows[rowIndex] = row;
            return(true);
        }
 private void ShowTextBoxField(int popTop, int popLeft, int objIndex, FastRow objRow)
 {
     var pop = new PopupTextBox(objRow.cells[objIndex].CellValue,
                                lastHitColumn.ResultedWidth, CellHeight,
                                lastHitRow,
                                lastHitColumn,
                                columnProperty[lastHitColumn], OnValueEntered);
     pop.Show(this, popLeft, popTop);
 }
 private void ShowMenuStripField(int popTop, int popLeft, int objIndex, FastRow objRow)
 {
     var pop = new PopupListBox(objRow.cells[objIndex].CellValue,
                                lastHitRow,
                                lastHitColumn,
                                columnProperty[lastHitColumn].PropertyType, OnValueEntered, this);
     pop.ShowOptions(popLeft, popTop);
 }
Example #7
0
        public List<FastRow> Group(List<FastRow> dataRows, int level)
        {
            if (GroupingFunctions == null || level >= GroupingFunctions.Count)
                return dataRows;
            var funct = GroupingFunctions[level];
            if (funct == null)
                return dataRows;

            var groupDicts = new Dictionary<FastRow, List<FastRow>>();
            foreach (var dataRow in dataRows)
            {
                object groupKey;
                string label;
                funct(dataRow.ValueObject, out groupKey, out label);
                var group = groupDicts.FirstOrDefault(g =>
                    {
                        var a = g.Key.ValueObject as IComparable;
                        var b = groupKey as IComparable;
                        if (a == null || b == null)
                            return false;
                        return a.CompareTo(b) == 0;
                    }).Key;
                if (group == null)
                {
                    group = new FastRow(this, groupKey, new Dictionary<FastColumn, PropertyInfo>()) { IsGroupingRow = true };
                    columns.ForEach(c => group.cells.Add(new FastCell {CellString = label}));
                    groupDicts.Add(group, new List<FastRow>());
                }
                // пока "кидаем" все строки в исходном порядке
                dataRow.OwnerGroupingRow = group;
                groupDicts[group].Add(dataRow);
            }

            // сортируем строки группирования, группируем "закинутые" вложенные строки, формируем результат
            var groupKeysObject = groupDicts.Select(kv => kv.Key.ValueObject).ToList();
            if (GroupingComparisons != null && level < GroupingComparisons.Count)
            {
                groupKeysObject.Sort(GroupingComparisons[level]);
            }
            var result = new List<FastRow>();
            foreach (var groupKeyObject in groupKeysObject)
            {
                var groupKey = groupDicts.Keys.FirstOrDefault(k => k.ValueObject == groupKeyObject);
                var groupValue = groupDicts[groupKey];
                var groupValues = Group(groupValue, level + 1).ToList();
                groupValue.Clear();
                groupValue.AddRange(groupValues);
                result.Add(groupKey);
                result.AddRange(groupValue);
            }
            return result;
        }
Example #8
0
        public List <FastRow> Group(List <FastRow> dataRows, int level)
        {
            if (GroupingFunctions == null || level >= GroupingFunctions.Count)
            {
                return(dataRows);
            }
            var funct = GroupingFunctions[level];

            if (funct == null)
            {
                return(dataRows);
            }

            var groupDicts = new Dictionary <FastRow, List <FastRow> >();

            foreach (var dataRow in dataRows)
            {
                object groupKey;
                string label;
                funct(dataRow.ValueObject, out groupKey, out label);
                var group = groupDicts.FirstOrDefault(g =>
                {
                    var a = g.Key.ValueObject as IComparable;
                    var b = groupKey as IComparable;
                    if (a == null || b == null)
                    {
                        return(false);
                    }
                    return(a.CompareTo(b) == 0);
                }).Key;
                if (group == null)
                {
                    group = new FastRow(this, groupKey, new Dictionary <FastColumn, PropertyInfo>())
                    {
                        IsGroupingRow = true
                    };
                    columns.ForEach(c => group.cells.Add(new FastCell {
                        CellString = label
                    }));
                    groupDicts.Add(group, new List <FastRow>());
                }
                // пока "кидаем" все строки в исходном порядке
                dataRow.OwnerGroupingRow = group;
                groupDicts[group].Add(dataRow);
            }

            // сортируем строки группирования, группируем "закинутые" вложенные строки, формируем результат
            var groupKeysObject = groupDicts.Select(kv => kv.Key.ValueObject).ToList();

            if (GroupingComparisons != null && level < GroupingComparisons.Count)
            {
                groupKeysObject.Sort(GroupingComparisons[level]);
            }
            var result = new List <FastRow>();

            foreach (var groupKeyObject in groupKeysObject)
            {
                var groupKey    = groupDicts.Keys.FirstOrDefault(k => k.ValueObject == groupKeyObject);
                var groupValue  = groupDicts[groupKey];
                var groupValues = Group(groupValue, level + 1).ToList();
                groupValue.Clear();
                groupValue.AddRange(groupValues);
                result.Add(groupKey);
                result.AddRange(groupValue);
            }
            return(result);
        }