Ejemplo n.º 1
0
                protected sealed override void OpenEdit(RowManager rowManager)
                {
                    Debug.Assert(rowManager == RowManager);

                    KeepInitialInputElement(rowManager);

                    if (rowManager.VirtualRow != null)
                    {
                        _insertingRow         = rowManager.VirtualRow;
                        _insertingRow.DataRow = DataSet.BeginAdd();
                    }
                    else
                    {
                        _insertingRow = new RowPresenter(rowManager, DataSet.BeginAdd());
                    }
                    _insertingRow.RawIndex = InsertingRowRawIndex;

                    if (rowManager.VirtualRowPlacement == VirtualRowPlacement.Head)
                    {
                        rowManager.VirtualRow = new RowPresenter(rowManager, 0);
                    }
                    else if (rowManager.VirtualRowPlacement == VirtualRowPlacement.Tail)
                    {
                        rowManager.VirtualRow = new RowPresenter(rowManager, -1);
                    }
                    else if (rowManager.VirtualRow != null)
                    {
                        rowManager.VirtualRow = null;
                    }
                    rowManager.Editing = this;
                    rowManager.OnRowsChanged();
                    rowManager.SetCurrentRow(_insertingRow, false);
                }
Ejemplo n.º 2
0
                protected sealed override RowPresenter CommitEdit(RowManager rowManager, bool staysOnInserting)
                {
                    Debug.Assert(!rowManager.IsEditing);
                    Debug.Assert(rowManager == RowManager);

                    DisposeInsertingRow(false);
                    var newDataRow    = DataSet.EndAdd(CommitEditIndex);
                    var newCurrentRow = rowManager[newDataRow];

                    if (!rowManager.CurrentRowChangeSuspended)
                    {
                        if (newCurrentRow != null)
                        {
                            rowManager.CurrentRow = newCurrentRow;
                        }
                    }

                    if (staysOnInserting)
                    {
                        StayOnInserting(rowManager, newCurrentRow);
                        var currentView = rowManager.CurrentRow?.View;
                        if (currentView != null && currentView.ContainsKeyboardFocus() && InitialInputElement != null && InitialInputElement != currentView.ActiveInputElement &&
                            (InitialInputElement as DependencyObject).FindVisaulAncestor <RowView>() == currentView)
                        {
                            InitialInputElement.Focus();
                        }
                    }
                    return(newCurrentRow);
                }
Ejemplo n.º 3
0
 public override void OnRowsChanged(RowManager rowManager)
 {
     if (rowManager.CurrentRow.IsDisposed)
     {
         CancelEdit(rowManager);
     }
 }
Ejemplo n.º 4
0
 protected InsertHandler(RowManager rowManager, RowPresenter reference)
 {
     Debug.Assert(rowManager != null);
     Debug.Assert(reference == null || reference.RowManager == rowManager);
     RowManager = rowManager;
     Reference  = reference;
 }
Ejemplo n.º 5
0
                protected override RowPresenter CommitEdit(RowManager rowManager, bool staysOnInserting)
                {
                    var currentRow = rowManager.CurrentRow;

                    currentRow.DataRow.EndEdit();
                    return(currentRow);
                }
Ejemplo n.º 6
0
                protected sealed override void RollbackEdit(RowManager rowManager)
                {
                    Debug.Assert(!rowManager.IsEditing);
                    Debug.Assert(rowManager == RowManager);

                    DataSet.CancelAdd();
                    DisposeInsertingRow(true);
                }
Ejemplo n.º 7
0
                private void KeepInitialInputElement(RowManager rowManager)
                {
                    var currentView = rowManager.CurrentRow?.View;

                    if (currentView != null)
                    {
                        InitialInputElement = currentView.ActiveInputElement;
                    }
                }
Ejemplo n.º 8
0
 private void DisposeInsertingRow(bool isRollback)
 {
     _insertingRow.DataRow = null;
     _insertingRow.Dispose();
     if (isRollback)
     {
         RowManager._suggestedCurrentRow = CurrentRowAfterRollback;
         RowManager.OnRowsChanged();
     }
 }
Ejemplo n.º 9
0
 public override void OnRowsChanged(RowManager rowManager)
 {
     if (Reference != null)
     {
         if (Reference.IsDisposed)
         {
             Reference = ReferenceForDisposed;
         }
         else
         {
             RefreshReferenceRawIndex();
         }
     }
     if (rowManager.VirtualRowPlacement == VirtualRowPlacement.Tail)
     {
         rowManager.VirtualRow.RawIndex = rowManager.Rows.Count - 1;
     }
     if (InsertingRow != null)
     {
         InsertingRow.RawIndex = InsertingRowRawIndex;
     }
 }
Ejemplo n.º 10
0
            private static EditHandler GetCurrentRowEditHandler(RowManager rowManager)
            {
                var currentRow = rowManager.CurrentRow;

                if (currentRow.IsVirtual)
                {
                    var virtualRowPlacement = rowManager.VirtualRowPlacement;
                    if (virtualRowPlacement == VirtualRowPlacement.Head)
                    {
                        return(InsertHandler.EditVirtualHead(rowManager));
                    }
                    else
                    {
                        Debug.Assert(virtualRowPlacement == VirtualRowPlacement.Tail);
                        return(InsertHandler.EditVirtualTail(rowManager));
                    }
                }
                else
                {
                    return(EditCurrentHandler.Singleton);
                }
            }
Ejemplo n.º 11
0
 public InsertAfterHandler(RowManager rowManager, RowPresenter reference)
     : base(rowManager, reference)
 {
 }
Ejemplo n.º 12
0
 protected override void StayOnInserting(RowManager rowManager, RowPresenter rowInserted)
 {
     rowManager.BeginInsertBefore(null, rowInserted);
 }
Ejemplo n.º 13
0
 public static InsertHandler After(RowManager rowManager, RowPresenter reference)
 {
     return(new InsertAfterHandler(rowManager, reference));
 }
Ejemplo n.º 14
0
 public static InsertHandler Before(RowManager rowManager, RowPresenter reference)
 {
     return(new InsertBeforeHandler(rowManager, reference));
 }
Ejemplo n.º 15
0
 public EditVirtualTailHandler(RowManager rowManager)
     : base(rowManager, null)
 {
 }
Ejemplo n.º 16
0
 protected override void StayOnInserting(RowManager rowManager, RowPresenter rowInserted)
 {
     Debug.Assert(rowManager.VirtualRow != null);
     rowManager.CurrentRow = rowManager.VirtualRow;
 }
Ejemplo n.º 17
0
 protected abstract void StayOnInserting(RowManager rowManager, RowPresenter rowInserted);