Esempio n. 1
0
        public void InitializeNewRow()
        {
            if (this.newRowInitialized)
            {
                return;
            }
            if (!this.ViewTemplate.IsVirtualRows)
            {
                if (this.ViewTemplate.ListSource.IsDataBound && this.ViewTemplate.MasterTemplate.AddNewBoundRowBeforeEdit)
                {
                    this.ViewTemplate.BeginUpdate();
                    this.boundRow           = this.ViewTemplate.ListSource.AddNew();
                    this.boundRow.IsVisible = false;
                    this.ViewTemplate.EndUpdate(false);
                    (this.boundRow.DataBoundItem as IEditableObject)?.BeginEdit();
                }
                this.FillParentData();
            }
            if (this.ViewTemplate != null && this.ViewTemplate.ListSource != null)
            {
                this.ViewTemplate.ListSource.CreateATransactionForEveryValueSetting = false;
            }
            DefaultValuesNeededEventArgs args = new DefaultValuesNeededEventArgs((GridViewRowInfo)this);

            this.ViewTemplate.EventDispatcher.RaiseEvent <DefaultValuesNeededEventArgs>(EventDispatcher.DefaultValuesNeeded, (object)this.ViewTemplate, args);
            this.IsModified        = args.AddWithDefaultValues;
            this.newRowInitialized = true;
        }
        protected virtual bool MatchesSearchCriteria(
            string searchCriteria,
            GridViewRowInfo row,
            GridViewColumn col)
        {
            if (row == null || searchCriteria == null || searchCriteria.Length == 0)
            {
                return(false);
            }
            GridViewGroupRowInfo viewGroupRowInfo = row as GridViewGroupRowInfo;

            if (col == null && viewGroupRowInfo == null)
            {
                return(false);
            }
            string source = viewGroupRowInfo == null?this.GetCellFormattedValue(row, col) : viewGroupRowInfo.HeaderText;

            if (source == null)
            {
                return(false);
            }
            CompareOptions options = CompareOptions.Ordinal;

            if (!this.CaseSensitive)
            {
                options = this.CompareOptions;
            }
            return(this.Culture.CompareInfo.IndexOf(source, searchCriteria, options) >= 0);
        }
        public static void RaiseCurrentChanged(
            GridViewTemplate template,
            GridViewRowInfo row,
            GridViewColumn column,
            bool user)
        {
            if (template == null)
            {
                throw new ArgumentNullException("Template");
            }
            MasterGridViewTemplate masterTemplate = template.MasterTemplate;

            if (masterTemplate == null)
            {
                return;
            }
            GridViewEventInfo eventInfo  = new GridViewEventInfo(KnownEvents.CurrentChanged, GridEventType.Both, GridEventDispatchMode.Send);
            object            originator = user ? (object)(RadCollectionView <GridViewRowInfo>)null : (object)template.DataView;

            masterTemplate.SynchronizationService.DispatchEvent(new GridViewEvent((object)template, originator, new object[2]
            {
                (object)row,
                (object)column
            }, eventInfo));
        }
Esempio n. 4
0
        internal bool RaiseRowValidatingEvent(GridViewRowInfo row)
        {
            RowValidatingEventArgs args = new RowValidatingEventArgs(row);

            this.gridViewElement.Template.EventDispatcher.RaiseEvent <RowValidatingEventArgs>(EventDispatcher.RowValidating, (object)this, args);
            return(args.Cancel);
        }
Esempio n. 5
0
        public virtual bool EndEdit()
        {
            bool flag = false;

            if (this.EndEditCore(true, false))
            {
                flag = true;
                GridViewRowInfo currentRow = this.gridViewElement.Template.CurrentRow;
                if (currentRow == null)
                {
                    return(true);
                }
                if (currentRow is GridViewNewRowInfo)
                {
                    flag = this.FinishEditingOperation();
                }
                else if (currentRow.IsModified)
                {
                    this.gridViewElement.Template.ListSource.BeginUpdate();
                    flag = currentRow.CallOnEndEdit();
                    this.gridViewElement.Template.ListSource.EndUpdate(false);
                    currentRow.IsModified = false;
                    if (currentRow.ViewTemplate.EnableCustomGrouping && currentRow.ViewTemplate.GroupDescriptors.Count > 0)
                    {
                        currentRow.ViewTemplate.Refresh();
                    }
                }
            }
            return(flag);
        }
        public virtual string GetCellFormattedValue(GridViewRowInfo row, GridViewColumn column)
        {
            GridViewDataColumn gridViewDataColumn = column as GridViewDataColumn;

            if (gridViewDataColumn == null || string.IsNullOrEmpty(gridViewDataColumn.FormatString) && !(gridViewDataColumn is GridViewComboBoxColumn))
            {
                Convert.ToString(row[column]);
            }
            GridViewComboBoxColumn viewComboBoxColumn1 = gridViewDataColumn as GridViewComboBoxColumn;
            object lookupValue = row[column];

            if (viewComboBoxColumn1 != null && viewComboBoxColumn1.HasLookupValue)
            {
                lookupValue = viewComboBoxColumn1.GetLookupValue(lookupValue);
            }
            GridDataConversionInfo dataConversionInfo  = new GridDataConversionInfo(column as IDataConversionInfoProvider);
            GridViewComboBoxColumn viewComboBoxColumn2 = column as GridViewComboBoxColumn;

            if (viewComboBoxColumn2 != null)
            {
                dataConversionInfo.DataType          = viewComboBoxColumn2.DisplayMemberDataType;
                dataConversionInfo.DataTypeConverter = TypeDescriptor.GetConverter(viewComboBoxColumn2.DisplayMemberDataType);
            }
            return(RadDataConverter.Instance.Format(lookupValue, typeof(string), (IDataConversionInfoProvider)dataConversionInfo) as string);
        }
Esempio n. 7
0
        public override int GetRowHeight(GridViewRowInfo rowInfo)
        {
            GridViewDetailsRowInfo viewDetailsRowInfo = rowInfo as GridViewDetailsRowInfo;

            if (viewDetailsRowInfo != null && viewDetailsRowInfo.ActualHeight != -1)
            {
                return(viewDetailsRowInfo.ActualHeight);
            }
            if (rowInfo is GridViewTableHeaderRowInfo)
            {
                if (!this.Owner.GridViewElement.AutoSizeRows || rowInfo.Height == -1)
                {
                    return((int)this.DesiredSize.Height);
                }
                return(rowInfo.Height);
            }
            if (rowInfo.Height != -1)
            {
                return(Math.Max(rowInfo.Height, rowInfo.MinHeight));
            }
            if (rowInfo is GridViewGroupRowInfo)
            {
                return(this.Owner.GroupHeaderHeight);
            }
            return((int)this.tree.ColumnRowsTotalHeight);
        }
Esempio n. 8
0
        private void ClearValue_Click(object sender, EventArgs e)
        {
            GridViewRowInfo rowInfo = this.RowInfo;

            this.Value = (object)null;
            this.SetContent();
            this.Invalidate();
        }
 public override Type GetCellType(GridViewRowInfo row)
 {
     if (row is GridViewTableHeaderRowInfo)
     {
         return(typeof(GridTableHeaderCellElement));
     }
     return(typeof(GridRowHeaderCellElement));
 }
Esempio n. 10
0
 public virtual void Initialize(GridViewColumn column, GridRowElement row)
 {
   this.column = column;
   this.rowElement = row;
   if (row == null)
     return;
   this.row = row.RowInfo;
 }
 internal bool IsSelected(GridViewRowInfo row, GridViewColumn column)
 {
     if (row != null && column is GridViewDataColumn)
     {
         return(this.hashtable.Contains((object)this.GetHashCodeString(row, column)));
     }
     return(false);
 }
Esempio n. 12
0
 protected void EnsureScrollingDelta(GridViewRowInfo rowInfo, bool isLastRow, ref int delta)
 {
     if (!isLastRow && !rowInfo.IsPinned)
     {
         return;
     }
     delta -= this.RowSpacing;
 }
Esempio n. 13
0
 public GridViewRowInfo(GridViewInfo viewInfo)
 {
     this.viewInfo  = viewInfo;
     this.state[32] = true;
     this.state[64] = true;
     this.state[1]  = false;
     this.parent    = (GridViewRowInfo)null;
 }
Esempio n. 14
0
 public override Type GetCellType(GridViewRowInfo row)
 {
     if (row is GridViewTableHeaderRowInfo)
     {
         return(typeof(GridColumnGroupCellElement));
     }
     return((Type)null);
 }
Esempio n. 15
0
 public override Type GetCellType(GridViewRowInfo row)
 {
     if (row is GridViewDataRowInfo || row is GridViewNewRowInfo)
     {
         return(typeof(GridImageCellElement));
     }
     return(base.GetCellType(row));
 }
        protected virtual bool IsFirstChildRow(IHierarchicalRow parent, GridViewRowInfo row)
        {
            ITraverser <GridViewRowInfo> traverser = this.GetTraverser(parent);

            traverser.Reset();
            traverser.MoveNext();
            return(traverser.Current == row);
        }
Esempio n. 17
0
        protected virtual void NavigateToPage(GridViewRowInfo row, Keys keys)
        {
            IGridNavigator navigator = this.GridViewElement.Navigator;

            navigator.BeginSelection(new GridNavigationContext(GridNavigationInputType.Keyboard, MouseButtons.None, keys));
            navigator.SelectRow(row);
            navigator.EndSelection();
        }
Esempio n. 18
0
 public GridViewHeaderCellEventArgs(
     GridViewRowInfo row,
     GridViewColumn column,
     ToggleState state)
     : base(row, column)
 {
     this.state = state;
 }
Esempio n. 19
0
 public GridViewCellCancelEventArgs(
     GridViewRowInfo row,
     GridViewColumn column,
     IInputEditor editor)
 {
     this.row          = row;
     this.column       = column;
     this.activeEditor = editor;
 }
Esempio n. 20
0
 internal GridViewCellCancelEventArgs(GridCellElement cell, IInputEditor editor)
 {
     if (cell != null)
     {
         this.row    = cell.RowInfo;
         this.column = cell.ColumnInfo;
     }
     this.activeEditor = editor;
 }
Esempio n. 21
0
 public override object this[GridViewRowInfo row]
 {
     get
     {
         try
         {
             if (row.DataBoundItem == null)
             {
                 return((object)null);
             }
             if (this.subPropertyMode)
             {
                 return(this.GetSubPropertyValue(this.Column.FieldName, row.DataBoundItem));
             }
             if (string.IsNullOrEmpty(this.Column.FieldName))
             {
                 return((object)null);
             }
             return(this.Template.ListSource.GetBoundValue(row.DataBoundItem, this.Column.FieldName));
         }
         catch (RowNotInTableException ex)
         {
             return((object)null);
         }
         catch (ArgumentException ex)
         {
             return((object)null);
         }
         catch (Exception ex)
         {
             this.RaiseError(ex, GridViewDataErrorContexts.Display);
             return((object)null);
         }
     }
     set
     {
         try
         {
             if (row.DataBoundItem == null)
             {
                 return;
             }
             if (this.subPropertyMode)
             {
                 this.Template.ListSource.SetBoundValue((IDataItem)row, this.Column.Name, value, this.Column.FieldName);
             }
             else
             {
                 this.Template.ListSource.SetBoundValue((IDataItem)row, this.Column.FieldName, this.Column.Name, value, (string)null);
             }
         }
         catch (Exception ex)
         {
             this.Template.SetError(new GridViewCellCancelEventArgs(row, this.Column, (IInputEditor)null), ex);
         }
     }
 }
 public GridViewRowSourceNeededEventArgs(
     GridViewRowInfo parentRow,
     GridViewTemplate template,
     IList <GridViewRowInfo> sourceCollection)
 {
     this.parentRow        = parentRow;
     this.template         = template;
     this.sourceCollection = sourceCollection;
 }
 public GridViewCustomFilteringEventArgs(
     GridViewTemplate template,
     GridViewRowInfo row,
     bool visible)
 {
     this.template = template;
     this.row      = row;
     this.visible  = visible;
 }
Esempio n. 24
0
 public GridViewCellInfo(
     GridViewRowInfo row,
     GridViewColumn column,
     GridViewCellInfoCollection owner)
 {
     this.row    = row;
     this.column = column;
     this.owner  = owner;
 }
Esempio n. 25
0
        public RectangleF GetCorrectedColumnBounds(
            GridViewRowInfo row,
            GridViewColumn column,
            bool rightToLeft,
            RectangleF clientRect)
        {
            ColumnGroupsCellArrangeInfo info = this.currentAutoSizeArrangeInfo == null || !this.currentAutoSizeArrangeInfo.ContainsKey(column) ? this.GetColumnData(column) : this.currentAutoSizeArrangeInfo[column];

            if (info == null)
            {
                return(RectangleF.Empty);
            }
            RectangleF bounds = info.Bounds;

            if (row == null || row is GridViewTableHeaderRowInfo || this.Owner.GridViewElement.AutoSizeRows)
            {
                float num1 = info.Bounds.X + info.Bounds.Width;
                float num2 = info.Bounds.Y + info.Bounds.Height;
                bounds = new RectangleF((float)(int)info.Bounds.X, (float)(int)info.Bounds.Y, (float)((int)num1 - (int)info.Bounds.X), (float)((int)num2 - (int)info.Bounds.Y));
            }
            else
            {
                float num1 = info.Bounds.Y - this.tree.GroupRowsTotalHeight;
                float num2 = info.Bounds.X + info.Bounds.Width;
                float num3 = num1 + info.Bounds.Height;
                if ((row is GridViewDataRowInfo || row is GridViewSummaryRowInfo) && row.Height != -1)
                {
                    num1 *= (float)row.Height / this.tree.ColumnRowsTotalHeight;
                    num3 *= (float)row.Height / this.tree.ColumnRowsTotalHeight;
                }
                bounds = new RectangleF((float)(int)info.Bounds.X, (float)(int)num1, (float)((int)num2 - (int)info.Bounds.X), (float)((int)num3 - (int)num1));
            }
            int x = (int)bounds.X;

            bounds.X     = column.PinPosition == PinnedColumnPosition.Right ? bounds.X + (float)this.Owner.CellSpacing : Math.Max(0.0f, bounds.X + (float)this.Owner.CellSpacing);
            bounds.Width = (float)((int)bounds.Width - ((int)bounds.X - x));
            if (row is GridViewTableHeaderRowInfo && this.ShouldStretchColumn(info))
            {
                bounds.Y      -= this.tree.GroupRowsTotalHeight;
                bounds.Height += this.tree.GroupRowsTotalHeight;
            }
            else if (row is GridViewDataRowInfo && info.RowIndex > 0 || !(row is GridViewDataRowInfo) && info.Depth > 1)
            {
                bounds.Y      += (float)this.Owner.CellSpacing;
                bounds.Height -= (float)this.Owner.CellSpacing;
            }
            if (column is GridViewRowHeaderColumn || column is GridViewIndentColumn)
            {
                bounds.Y      = 0.0f;
                bounds.Height = clientRect.Height;
            }
            if (rightToLeft)
            {
                bounds = LayoutUtils.RTLTranslateNonRelative(bounds, clientRect);
            }
            return(bounds);
        }
Esempio n. 26
0
 public HierarchyRowTraverserPosition(
     GridViewRowInfo hierarchyRow,
     GridViewRowInfo current,
     int index)
 {
     this.hierarchyRow = hierarchyRow;
     this.current      = current;
     this.index        = index;
 }
Esempio n. 27
0
 public PrintCellFormattingEventArgs(
     GridViewRowInfo row,
     GridViewColumn column,
     CellPrintElement printCell)
 {
     this.row       = row;
     this.column    = column;
     this.printCell = printCell;
 }
 public GridElementToolTipTextNeededEventArgs(
     ToolTip toolTip,
     int rowIndex,
     GridViewRowInfo row,
     string tooltipText)
     : base(toolTip, tooltipText)
 {
     this.rowIndex = rowIndex;
     this.row      = row;
 }
        public override bool IsCompatible(GridViewRowInfo data, object context)
        {
            GridViewGroupRowInfo viewGroupRowInfo = data as GridViewGroupRowInfo;

            if (viewGroupRowInfo != null)
            {
                return(viewGroupRowInfo.GroupLevel == this.groupLevel);
            }
            return(false);
        }
Esempio n. 30
0
        protected override bool CanEnterEditMode(GridViewRowInfo rowInfo)
        {
            GridExpanderItem elementAtPoint = GridVisualElement.GetElementAtPoint <GridExpanderItem>((RadElementTree)this.GridViewElement.ElementTree, this.MouseDownLocation);

            if (base.CanEnterEditMode(rowInfo))
            {
                return(elementAtPoint == null);
            }
            return(false);
        }