/// <summary> /// Set arguments Context values from arguments Controllers values. /// </summary> public override void UpdateContext() { foreach (ArgumentController lArgument in InputFields) { // Argument value. Context.SetInputFieldValue(lArgument.Name, lArgument.Value); // Argument enable. Context.SetInputFieldEnabled(lArgument.Name, lArgument.Enabled); ArgumentOVPreloadController lArgumentOVPreload = lArgument as ArgumentOVPreloadController; if (lArgumentOVPreload != null) { Context.SetInputFieldSupplementaryInfo(lArgument.Name, lArgumentOVPreload.Editor.DisplaySetAttributes); if (lArgumentOVPreload.OrderCriteria != null) { Context.SetInputFieldOrderCriteria(lArgument.Name, lArgumentOVPreload.OrderCriteria.Name); } } // Set Multi-Selection. Context.SetMultiSelectionInputFieldValue(lArgument.Name, lArgument.MultiSelectionAllowed); } base.UpdateContext(); }
/// <summary> /// Create and build context structure to this controller. /// </summary> protected virtual void ConfigureInitialContext() { // Only the first time is called, before create new arguments context. Context.InputFields.Clear(); // Initialize the context with the information from the arguments foreach (ArgumentController lArgument in InputFields) { // if argument does not exist it is created (Gets or Create). IUContextArgumentInfo lContextArgumentInfo = Context.GetInputField(lArgument.Name); // Set Value and Enabled to the context lContextArgumentInfo.Value = lArgument.Value; lContextArgumentInfo.Enabled = true; lContextArgumentInfo.Visible = true; lContextArgumentInfo.NullAllowed = lArgument.NullAllowed; lContextArgumentInfo.Mandatory = lArgument.Mandatory; lContextArgumentInfo.MultiSelectionAllowed = lArgument.MultiSelectionAllowed; // If is Preload set displayset attributes & OrderCriteria. ArgumentOVPreloadController lArgumentOVPreload = lArgument as ArgumentOVPreloadController; if (lArgumentOVPreload != null) { lContextArgumentInfo.SupplementaryInfo = lArgumentOVPreload.Editor.DisplaySetAttributes; if (lArgumentOVPreload.OrderCriteria != null) { lContextArgumentInfo.OrderCriteria = lArgumentOVPreload.OrderCriteria.Name; } } } base.UpdateContext(); }
/// <summary> /// Sets the context data and configurations to input fields controller. /// </summary> /// <param name="context">IUInputFieldsContext reference.</param> protected virtual void ConfigureInputFieldsByContext(IUInputFieldsContext context) { mEnabledChangeArgument = false; if (context != null) { // Set the input fields values from context values. foreach (ArgumentController lArgument in InputFields) { // Preload population associated to the argument. if (context.GetInputFieldPreloadPopulationInitialized(lArgument.Name)) { ArgumentOVPreloadController lOVPreloadArgument = lArgument as ArgumentOVPreloadController; if (lOVPreloadArgument != null) { lOVPreloadArgument.SetPopulation(context.GetInputFieldPreloadPopulation(lArgument.Name)); context.SetInputFieldPreloadPopulationInitialized(lArgument.Name, false); } } // Set Value. lArgument.Value = context.GetInputFieldValue(lArgument.Name); // Set Enable. lArgument.Enabled = context.GetInputFieldEnabled(lArgument.Name); // Set Mandatory. lArgument.Mandatory = context.GetInputFieldMandatory(lArgument.Name); // Set Visible. lArgument.Visible = context.GetInputFieldVisible(lArgument.Name); ArgumentOVController lOVArgument = lArgument as ArgumentOVController; // When the argument is OV, it is possible to exits multiselection if (lOVArgument != null) { if ((lOVArgument.Enabled) && (lOVArgument.MultiSelectionAllowed)) { List <Oid> lInstancesSelected = lOVArgument.Value as List <Oid>; if ((lInstancesSelected != null) && (lInstancesSelected.Count > 1)) { // Is there is multiselection and more than one selected, // the oid editors must be disable. lOVArgument.EnabledEditors = false; } } } } foreach (ArgumentController lArgument in InputFields) { // Set the focus to the editor. if (context.GetInputFieldFocused(lArgument.Name)) { lArgument.Focused = true; // After setting the focus to the editor, // the focus of the input fields is cleared. context.ClearInputFieldsFocus(); break; } } } mEnabledChangeArgument = true; }