Exemplo n.º 1
0
        public void Test_AddClicked_RowAddedAfterPostEditActionCalled()
        {
            //---------------Set up test pack-------------------
            //Get Grid with 4 items
            BusinessObjectCollection <MyBO> col;
            IReadOnlyGridControl            readOnlyGridControl = GetGridWith_4_Rows(out col, true);
            //AddControlToForm(readOnlyGridControl);
            IButton button  = readOnlyGridControl.Buttons["Add"];
            MyBO    myNewBo = null;
            PostObjectEditDelegate editorPostEditAction = null;

            readOnlyGridControl.BusinessObjectEditor = new DelegatedBusinessObjectEditor <MyBO>(
                delegate(MyBO obj, string uiDefName, PostObjectEditDelegate postEditAction)
            {
                myNewBo = obj;
                editorPostEditAction = postEditAction;
                return(true);
            });
            button.PerformClick();
            //-------------Assert Preconditions -------------
            Assert.IsNotNull(editorPostEditAction);
            Assert.IsNotNull(myNewBo);
            Assert.AreEqual(4, readOnlyGridControl.Grid.Rows.Count);
            //---------------Execute Test ----------------------
            editorPostEditAction(myNewBo, true);
            //---------------Test Result -----------------------
            Assert.AreEqual(5, readOnlyGridControl.Grid.Rows.Count);
        }
Exemplo n.º 2
0
        /// <summary>
        /// Edits the given object
        /// </summary>
        /// <param name="obj">The object to edit</param>
        /// <param name="uiDefName">The name of the set of ui definitions
        /// used to design the edit form. Setting this to an empty string
        /// will use a ui definition with no name attribute specified.</param>
        /// <param name="postEditAction">Action to be performed when the editing is completed or cancelled. Typically used if you want to update
        /// a grid or a list in an asynchronous environment (E.g. to select the recently edited item in the grid)</param>
        /// <returns>Returs true if edited successfully of false if the edits
        /// were cancelled</returns>
        public virtual bool EditObject(IBusinessObject obj, string uiDefName, PostObjectEditDelegate postEditAction)
        {
            BusinessObject       bo   = (BusinessObject)obj;
            IDefaultBOEditorForm form = CreateEditorForm(bo, uiDefName, postEditAction);

            return(form.ShowDialog());
        }
Exemplo n.º 3
0
 /// <summary>
 /// Creates a form in which a business object can be edited
 /// </summary>
 /// <param name="bo">The business object to edit</param>
 /// <param name="uiDefName">The name of the set of ui definitions
 /// used to design the edit form. Setting this to an empty string
 /// will use a ui definition with no name attribute specified.</param>
 /// <param name="action"></param>
 /// <returns>Returns a DefaultBOEditorForm object</returns>
 protected virtual IDefaultBOEditorForm CreateEditorForm(BusinessObject bo, string uiDefName, PostObjectEditDelegate action)
 {
     return(_controlFactory.CreateBOEditorForm(bo, uiDefName, action));
 }
 /// <summary>
 /// Constructs the <see cref="DefaultBOEditorFormVWG"/> class  with
 /// the specified businessObject, uiDefName and post edit action.
 /// </summary>
 /// <param name="bo">The business object to represent</param>
 /// <param name="uiDefName">The name of the ui def to use.</param>
 /// <param name="controlFactory">The <see cref="IControlFactory"/> to use for creating the Editor form controls</param>
 /// <param name="postObjectEditAction">Action to be performed when the editing is completed or cancelled. Typically used if you want to update
 /// a grid or a list in an asynchronous environment (E.g. to select the recently edited item in the grid).</param>
 public DefaultBOEditorFormVWG(BusinessObject bo, string uiDefName, IControlFactory controlFactory, PostObjectEditDelegate postObjectEditAction)
     : this(bo, uiDefName, controlFactory)
 {
     _postObjectEditAction = postObjectEditAction;
 }
Exemplo n.º 5
0
 /// <summary>
 /// Edits the given object
 /// </summary>
 /// <param name="obj">The object to edit</param>
 /// <param name="uiDefName">The name of the set of ui definitions
 /// used to design the edit form. Setting this to an empty string
 /// will use a ui definition with no name attribute specified.</param>
 /// <param name="postEditAction">Action to be performed when the editing is completed or cancelled. Typically used if you want to update
 /// a grid or a list in an asynchronous environment (E.g. to select the recently edited item in the grid)</param>
 /// <returns>Returs true if edited successfully of false if the edits
 /// were cancelled</returns>
 public virtual bool EditObject(IBusinessObject obj, string uiDefName, PostObjectEditDelegate postEditAction)
 {
     BusinessObject bo = (BusinessObject)obj;
     IDefaultBOEditorForm form = CreateEditorForm(bo, uiDefName, postEditAction);
     return form.ShowDialog();
 }
Exemplo n.º 6
0
 /// <summary>
 /// Creates a form in which a business object can be edited
 /// </summary>
 /// <param name="bo">The business object to edit</param>
 /// <param name="uiDefName">The name of the set of ui definitions
 /// used to design the edit form. Setting this to an empty string
 /// will use a ui definition with no name attribute specified.</param>
 /// <param name="action"></param>
 /// <returns>Returns a DefaultBOEditorForm object</returns>
 protected virtual IDefaultBOEditorForm CreateEditorForm(BusinessObject bo, string uiDefName, PostObjectEditDelegate action)
 {
     return _controlFactory.CreateBOEditorForm(bo, uiDefName, action);
 }
 /// <summary>
 /// Constructs the <see cref="DefaultBOEditorFormVWG"/> class  with 
 /// the specified businessObject, uiDefName and post edit action. 
 /// </summary>
 /// <param name="bo">The business object to represent</param>
 /// <param name="uiDefName">The name of the ui def to use.</param>
 /// <param name="controlFactory">The <see cref="IControlFactory"/> to use for creating the Editor form controls</param>
 /// <param name="postObjectEditAction">Action to be performed when the editing is completed or cancelled. Typically used if you want to update
 /// a grid or a list in an asynchronous environment (E.g. to select the recently edited item in the grid).</param>
 public DefaultBOEditorFormVWG(BusinessObject bo, string uiDefName, IControlFactory controlFactory, PostObjectEditDelegate postObjectEditAction)
     : this(bo, uiDefName, controlFactory)
 {
     _postObjectEditAction = postObjectEditAction;
 }
 /// <summary>
 /// Edits the given object
 /// </summary>
 /// <param name="obj">The object to edit</param>
 /// <param name="uiDefName">The name of the set of ui definitions
 /// used to design the edit form. Setting this to an empty string
 /// will use a ui definition with no name attribute specified.</param>
 /// <param name="postEditAction">Action to be performed when the editing is completed or cancelled. Typically used if you want to update
 /// a grid or a list in an asynchronous environment (E.g. to select the recently edited item in the grid)</param>
 /// <returns>Returs true if edited successfully of false if the edits
 /// were cancelled</returns>
 public bool EditObject(IBusinessObject obj, string uiDefName, PostObjectEditDelegate postEditAction)
 {
     return EditObject(obj, uiDefName);
 }