Object FindObjectToOpen(GridColumn column, int rowHandle)
        {
            Object result = null;

            if (column != null && GridListEditor != null && GridListEditor.GridView() != null)
            {
                Object    currObject = XtraGridUtils.GetRow(GridListEditor.GridView(), rowHandle);
                ITypeInfo typeInfo   = currObject != null
                                         ? XafTypesInfo.Instance.FindTypeInfo(currObject.GetType())
                                         : _listView.ObjectTypeInfo;

                IMemberInfo memberInfo = typeInfo.FindMember(column.FieldName);
                Object      lastObject = null;
                if (GridListEditor.GridView().ActiveEditor != null)
                {
                    lastObject = GridListEditor.GridView().ActiveEditor.EditValue;
                }
                else if (currObject != null && memberInfo != null)
                {
                    lastObject = FindLastObject(currObject, memberInfo);
                }
                if (memberInfo != null && (IsDetailViewExists(lastObject) &&
                                           DataManipulationRight.CanRead(typeInfo.Type, memberInfo.Name, currObject,
                                                                         LinkToListViewController.FindCollectionSource(
                                                                             Controller.Frame),
                                                                         ObjectSpace)))
                {
                    result = lastObject;
                }
            }
            return(result);
        }
Beispiel #2
0
        public override void CancelUpdateCurrentRow()
        {
            int updatedRowHandle = FocusedRowHandle;

            isNewItemRowCancelling = (updatedRowHandle == BaseGridController.NewItemRow);
            try {
                newItemRowObject = GetFocusedObject();
                base.CancelUpdateCurrentRow();
                if (updatedRowHandle == BaseGridController.NewItemRow)
                {
                    int storedFocusedHandle = FocusedRowHandle;
                    FocusedRowHandle = BaseGridController.NewItemRow;
                    if (CancelNewRow != null)
                    {
                        CancelNewRow(this, EventArgs.Empty);
                    }
                    XtraGridUtils.SelectRowByHandle(this, storedFocusedHandle);
                }
                else
                {
                    if (RestoreCurrentRow != null)
                    {
                        RestoreCurrentRow(this, EventArgs.Empty);
                    }
                }
            } finally {
                newItemRowObject       = null;
                isNewItemRowCancelling = false;
            }
        }
        object GetFocusedRowObject(IColumnView view)
        {
            if (view.Window == null)
            {
                return(XtraGridUtils.GetFocusedRowObject(CollectionSource, (DevExpress.XtraGrid.Views.Base.ColumnView)view));
            }
            int rowHandle = view.FocusedRowHandle;

            if (!((!view.IsDataRow(rowHandle) && !view.IsNewItemRow(rowHandle))))
            {
                return(XtraGridUtils.GetFocusedRowObject((DevExpress.XtraGrid.Views.Base.ColumnView)view));
            }
            return(XtraGridUtils.GetFocusedRowObject(CollectionSource, (DevExpress.XtraGrid.Views.Base.ColumnView)view));
        }
Beispiel #4
0
        object GetFocusedRowObject(DevExpress.ExpressApp.Win.Editors.XafGridView view)
        {
            if (view is XpandXafGridView && ((XpandXafGridView)view).Window == null)
            {
                return(XtraGridUtils.GetFocusedRowObject(_collectionSourceBase, view));
            }
            int rowHandle = view.FocusedRowHandle;

            if (!((!view.IsDataRow(rowHandle) && !view.IsNewItemRow(rowHandle))))
            {
                return(view.GetRow(rowHandle));
            }
            return(XtraGridUtils.GetFocusedRowObject(_collectionSourceBase, view));
        }
Beispiel #5
0
        protected override void RaiseShownEditor()
        {
            var gridInplaceEdit = ActiveEditor as IGridInplaceEdit;

            if (gridInplaceEdit != null)
            {
                var focusedRowObject = XtraGridUtils.GetFocusedRowObject(this);
                if (focusedRowObject is IXPSimpleObject)
                {
                    (gridInplaceEdit).GridEditingObject = focusedRowObject;
                }
            }
            base.RaiseShownEditor();
        }
Beispiel #6
0
 private object GetFocusedObject()
 {
     return(XtraGridUtils.GetFocusedRowObject(this));
 }