/// <summary> /// Process the user preferences for this scenario /// </summary> /// <param name="preferences"></param> public void SetPreferences(PopulationPrefs preferences) { // Gets the custom DIsplaySets if (preferences == null) { return; } // Add teh custom DisplaySets to the DisplaySet List foreach (DisplaySetInformation displaySet in preferences.DisplaySets) { DisplaySet.DisplaySetList.Add(displaySet); } // Assign the selected DisplaySet if (!preferences.SelectedDisplaySetName.Equals("")) { DisplaySetInformation displaySet = DisplaySet.GetDisplaySetByName(preferences.SelectedDisplaySetName); if (displaySet != null) { DisplaySet.CurrentDisplaySet = displaySet; } } Context.BlockSize = preferences.BlockSize; }
/// <summary> /// ANalize the Master Detail controller and creates the suitable nodes /// </summary> /// <param name="masterDetailController"></param> /// <param name="showDetailsGroupingNode"></param> private void InitializeMasterDetailNode(IUMasterDetailController masterDetailController, bool showDetailsGroupingNode) { // Keep the Master information. QueryContext = masterDetailController.Master.Context; // Initialize the DisplaySet information. mDisplaySetInfo = new DisplaySetInformation(masterDetailController.Master.DisplaySet.DisplaySetList[0].Name); // It has to be considered only the items that the agent is able to access. mDisplaySetInfo.DisplaySetItems = masterDetailController.Master.DisplaySet.DisplaySetList[0].GetVisibleDisplaySetItems(Logic.Agent.ClassName); QueryContext.DisplaySetAttributes = mDisplaySetInfo.GetDisplaySetItemsAsString(); Alias = CultureManager.TranslateString(masterDetailController.IdXMLDetailAlias, masterDetailController.DetailAlias); Action = masterDetailController.Master.Action; Navigation = masterDetailController.Master.Navigation; masterDetailController.Master.Action = null; masterDetailController.Master.Navigation = null; IUPopulationController lPopController = masterDetailController.Master as IUPopulationController; if (lPopController != null) { foreach (IUFilterController lFilter in lPopController.Filters) { Filters.Add(lFilter); } lPopController.Filters.Clear(); } // Analize every detail properties #region Details sub-nodes creation int nodeCounter = 0; TreeNodeController lSubNode = null; // Process all the Master-Detail details, in order to create the suitable sub-nodes. foreach (IDetailController lDetail in masterDetailController.Details) { bool lShowInTree = CalculateShowInTree(lDetail); lSubNode = new TreeNodeController(NodeId, NodeId + "_" + nodeCounter.ToString(), lDetail, null, false, showDetailsGroupingNode, lShowInTree); mSubNodes.Add(lSubNode); // Suscribe subnode events lSubNode.RefreshRequired += new EventHandler <RefreshNodeRequiredEventArgs>(HandleSubNodeRefreshRequired); lSubNode.ContextRequired += new EventHandler <ContextRequiredEventArgs>(HandleSubNodeContextRequired); nodeCounter++; // Special situation. If this Detail won't be shown in the Tree // assign the FinalNodeController. Only for the first one if (!lSubNode.ShowInTree && FinalNodeQueryController == null) { FinalNodeID = lSubNode.NodeId; FinalNodeQueryController = lDetail; lSubNode.ShowGroupingNode = false; } } #endregion Details sub-nodes creation // Empty the detail list masterDetailController.Details.Clear(); }
/// <summary> /// Constructor for object-valued elements /// </summary> /// <param name="name">Name of the DisplaySet item.</param> /// <param name="alias">Alias of the DisplaySet item.</param> /// <param name="idXML">IdXML of the DisplaySet item.</param> /// <param name="className">Definition class.</param> /// <param name="agents">List of agents of the DisplaySet item.</param> /// <param name="width">Width column of the DisplaySet item.</param> /// <param name="visible">True if the item is visible.</param> public DisplaySetItem(string name, string alias, string className, string idXML, List <string> agents, int width, bool visible, string[] oidFields, DisplaySetInformation supplementaryInfo) { mName = name; mAlias = alias; mClassName = className; mIdXML = idXML; mModelType = ModelType.Oid; mAgents = agents; mWidth = width; mVisible = visible; mOIDFields = new List <string>(oidFields); mSupplementaryInfo = supplementaryInfo; }
/// <summary> /// Copy constructor /// </summary> /// <param name="displaySetName"></param> public DisplaySetInformation(DisplaySetInformation displaySetToBeCopied) : this(displaySetToBeCopied.Name) { Custom = displaySetToBeCopied.Custom; foreach (DisplaySetItem item in displaySetToBeCopied.DisplaySetItems) { DisplaySetItem newItem = new DisplaySetItem(item); DisplaySetItems.Add(newItem); } if (displaySetToBeCopied.ServiceInfo != null) { ServiceInfo = new DisplaySetServiceInfo(displaySetToBeCopied.ServiceInfo); } }
/// <summary> /// Copy constructor /// </summary> /// <param name="item">Item to be copied</param> public DisplaySetItem(DisplaySetItem item) { mName = item.Name; mAlias = item.Alias; mIdXML = item.IdXML; mModelType = item.ModelType; mNullAllowed = item.NullAllowed; mDefinedSelectionOptions = item.DefinedSelectionOptions; mAgents = item.Agents; mVisible = item.Visible; mWidth = item.Width; mClassName = item.ClassName; mOIDFields = item.OIDFields; mSupplementaryInfo = item.SupplementaryInfo; }
private void btnCopyDisplaySet_Click(object sender, EventArgs e) { // Copy the selected DisplaySet ListView.SelectedListViewItemCollection selectedItems = lstDisplaySets.SelectedItems; if (selectedItems == null || selectedItems.Count == 0) return; ListViewItem item = lstDisplaySets.SelectedItems[0]; string displaySetName = item.Text; DisplaySetInformation displaySet = mTempDisplaySets[item.Index]; // Copy the information string newName = GetUniqueName("Customize"); // Copy the DisplaySet items DisplaySetInformation newDisplaySet = new DisplaySetInformation(displaySet); newDisplaySet.Name = newName; newDisplaySet.Custom = true; mTempDisplaySets.Add(newDisplaySet); // Add to the Tree and select it ListViewItem newItem = lstDisplaySets.Items.Add(newName); newItem.Selected = true; }
/// <summary> /// Adds an object-valued item to the DisplaySet. /// </summary> /// <param name="name">Name of the DisplaySet item.</param> /// <param name="alias">Alias of the DisplaySet item.</param> /// <param name="className">Definition class.</param> /// <param name="idXML">IdXML of the DisplaySet item.</param> /// <param name="agents">List of agents of the DisplaySet item.</param> /// <param name="width">Width column of the DisplaySet item.</param> public void Add(string name, string alias, string className, string idXML, string[] agents, int width, string[] oidFields, DisplaySetInformation supplementaryInfo) { List <string> lAgents = new List <string>(agents); DisplaySetItem lDisplaySetItem = new DisplaySetItem(name, alias, className, idXML, lAgents, width, true, oidFields, supplementaryInfo); mDisplaySetItems.Add(lDisplaySetItem); }
/// <summary> /// Gets the text to show in a node. /// </summary> /// <param name="displaySetInfo">Contains the Display Set information to format the data.</param> /// <param name="row">Contains the data to be formatted and then showed in a node.</param> /// <returns>A string formatted according the data type or the suitable label in case of Defined Selection.</returns> private string GetTextForNode(DisplaySetInformation displaySetInfo, DataRow row) { StringBuilder lAux = new StringBuilder(); // Retrieves the information from the DisplaySetInfo. foreach (DisplaySetItem displaySetItem in displaySetInfo.DisplaySetItems) { if (displaySetItem.Visible) { if (lAux.Length != 0) { lAux.Append(" "); } // In case of containing a null element nothing is done, // Otherwise the info of the current column is append to the final column if (row[displaySetItem.Name].GetType() != typeof(System.DBNull)) { if ((displaySetItem.DefinedSelectionOptions != null) && (displaySetItem.DefinedSelectionOptions.Count > 0)) { // The Display Set item has a Defined Selection pattern associated. string dsItemValue = string.Empty; foreach (KeyValuePair<object, string> dsOption in displaySetItem.DefinedSelectionOptions) { if (row[displaySetItem.Name].Equals(dsOption.Key)) { dsItemValue = dsOption.Value; break; } } lAux.Append(dsItemValue); } else { // A normal Display Set item. lAux.Append(DefaultFormats.ApplyDisplayFormat(row[displaySetItem.Name], displaySetItem.ModelType)); } } } } return lAux.ToString(); }
/// <summary> /// Adds the data corresponding to a node. /// </summary> /// <param name="treeNode">Tree node where it is going to be added the data.</param> /// <param name="data">DataTable containing the data to be added.</param> /// <param name="displaySetInfo">Display set information of the suitable node.</param> /// <param name="lastBlock">Boolean indicating if there is more data to show.</param> /// <param name="deleteExistingData">Boolean indicating if the loaded data will be deleted or not.</param> private void AddDataToNode(TreeNode treeNode, string lNodeName, DataTable data, DisplaySetInformation displaySetInfo, bool lastBlock, bool deleteExistingData) { mRaiseEventsFlag = false; // Will be true if is an IntermediaNode if (deleteExistingData) { if (treeNode == null) { mTreeViewIT.Nodes.Clear(); } else { treeNode.Nodes.Clear(); } } // No data for adding if (data == null || data.Rows.Count == 0) { mRaiseEventsFlag = true; return; } // To add data try { List<DataColumn> displaySetColumns = Adaptor.ServerConnection.GetDisplaySetColumns(data); if (displaySetColumns == null) return; // Search in the data table node information. foreach (System.Data.DataRow lRow in data.Rows) { string lTextForNode = GetTextForNode(displaySetInfo, lRow); // Sets the value TreeNode lNode = null; if (treeNode == null) { lNode = mTreeViewIT.Nodes.Add(lTextForNode); lNode.Name = "0"; } else { lNode = treeNode.Nodes.Add(lTextForNode); lNode.Name = lNodeName; } Oid lOid = Adaptor.ServerConnection.GetOid(data, lRow); InstanceNodeInfo instanceInfo = new InstanceNodeInfo(lOid); lNode.Tag = instanceInfo; // Sets the node image string imageKey = GetImageKeyForNode(lNode.Name, false); if (!imageKey.Equals("")) { lNode.ImageKey = imageKey; lNode.SelectedImageKey = imageKey; } // Sets the node contextual menu ContextMenuStrip menu = GetMenuForNode(lNode); lNode.ContextMenuStrip = menu; // Search in Subnodes AddDetailsNodes(lNode); } // If it is not the last block, add the final special node if (!lastBlock) { if (treeNode == null) { TreeNode lNextBlockNode = mTreeViewIT.Nodes.Add("0", "..."); lNextBlockNode.ImageKey = NextBlockImageKey; } else { TreeNode lNextBlockNode = treeNode.Nodes.Add(treeNode.Name, "..."); lNextBlockNode.ImageKey = NextBlockImageKey; } } } catch { } mRaiseEventsFlag = true; }
/// <summary> /// Creates the specific DisplaySetController of the 'DS_PasajeroAeronave' DisplaySet pattern. /// </summary> /// <param name="parentController">Parent controller.</param> /// <returns>Specific DisplaySetController of the 'DS_PasajeroAeronave' DisplaySet pattern.</returns> public static DisplaySetController DisplaySet_DS_PasajeroAeronave(SIGEM.Client.Controllers.Controller parentController) { DisplaySetController lDisplaySetController = new DisplaySetController(parentController); DisplaySetInformation lDisplaySetInfo = new DisplaySetInformation("DS_PasajeroAeronave"); string[] lAgentsDSItem0 = { Agents.Administrador }; lDisplaySetInfo.Add("Aeronave.id_Aeronave", "id_Aeronave", "Clas_1348178542592177CjtoVis_1ICtjoVis_1_Alias", ModelType.Autonumeric, lAgentsDSItem0, DefaultFormats.ColWidthAutonumeric); lDisplaySetController.CurrentDisplaySet = lDisplaySetInfo; return lDisplaySetController; }
private static bool IsCustom(DisplaySetInformation displaySet) { return displaySet.Custom; }
/// <summary> /// Adds an object-valued item to the DisplaySet. /// </summary> /// <param name="name">Name of the DisplaySet item.</param> /// <param name="alias">Alias of the DisplaySet item.</param> /// <param name="className">Definition class.</param> /// <param name="idXML">IdXML of the DisplaySet item.</param> /// <param name="agents">List of agents of the DisplaySet item.</param> /// <param name="width">Width column of the DisplaySet item.</param> public void Add(string name, string alias, string className, string idXML, string[] agents, int width, string[] oidFields, DisplaySetInformation supplementaryInfo) { List<string> lAgents = new List<string>(agents); DisplaySetItem lDisplaySetItem = new DisplaySetItem(name, alias, className, idXML, lAgents, width, true,oidFields, supplementaryInfo); mDisplaySetItems.Add(lDisplaySetItem); }
/// <summary> /// Refresh one instance using the context and Oid received as arguments. /// </summary> /// <param name="queryContext">Contexto del nodo.</param> /// <param name="nodeId">List of Oid to be refreshed.</param> /// <param name="oid">Oid of the instance to be refreshed.</param> /// <param name="displaySetInfo">DisplaySet information used to represent the instance data.</param> private void RefreshInstance(IUQueryContext queryContext, string nodeId, Oid oid, DisplaySetInformation displaySetInfo) { try { DataTable lInstance = Logic.ExecuteQueryInstance(Logic.Agent, oid, queryContext.DisplaySetAttributes); Tree.UpdateNodeValues(nodeId, oid, lInstance, displaySetInfo); } catch { } }
/// <summary> /// Creates the specific DisplaySetController of the '_Auto_' DisplaySet pattern. /// </summary> /// <param name="parentController">Parent controller.</param> /// <returns>Specific DisplaySetController of the '_Auto_' DisplaySet pattern.</returns> public static DisplaySetController DisplaySet__Auto_(SIGEM.Client.Controllers.Controller parentController) { DisplaySetController lDisplaySetController = new DisplaySetController(parentController); DisplaySetInformation lDisplaySetInfo = new DisplaySetInformation("_Auto_"); string[] lAgentsDSItem0 = { Agents.Administrador }; lDisplaySetInfo.Add("id_RevisarAeronave", "id_RevisarAeronave", "Clas_1348178542592347CjtoVis_AutoICtjoVis_1_Alias", ModelType.Autonumeric, lAgentsDSItem0, DefaultFormats.ColWidthAutonumeric); string[] lAgentsDSItem1 = { Agents.Administrador }; lDisplaySetInfo.Add("FechaRevision", "FechaRevision", "Clas_1348178542592347CjtoVis_AutoICtjoVis_2_Alias", ModelType.Date, lAgentsDSItem1, DefaultFormats.ColWidthDate); string[] lAgentsDSItem2 = { Agents.Administrador }; lDisplaySetInfo.Add("NombreRevisor", "NombreRevisor", "Clas_1348178542592347CjtoVis_AutoICtjoVis_3_Alias", ModelType.String, lAgentsDSItem2, DefaultFormats.ColWidthString20); string[] lAgentsDSItem3 = { Agents.Administrador }; lDisplaySetInfo.Add("Id_Aeronave", "Id_Aeronave", "Clas_1348178542592347CjtoVis_AutoICtjoVis_4_Alias", ModelType.String, lAgentsDSItem3, DefaultFormats.ColWidthString20); lDisplaySetController.CurrentDisplaySet = lDisplaySetInfo; return lDisplaySetController; }
/// <summary> /// Creates the specific DisplaySetController of the '_Auto_' DisplaySet pattern. /// </summary> /// <param name="parentController">Parent controller.</param> /// <returns>Specific DisplaySetController of the '_Auto_' DisplaySet pattern.</returns> public static DisplaySetController DisplaySet__Auto_(SIGEM.Client.Controllers.Controller parentController) { DisplaySetController lDisplaySetController = new DisplaySetController(parentController); DisplaySetInformation lDisplaySetInfo = new DisplaySetInformation("_Auto_"); string[] lAgentsDSItem0 = { Agents.Administrador }; lDisplaySetInfo.Add("id_Aeronave", "id_Aeronave", "Clas_1348178411520734CjtoVis_AutoICtjoVis_1_Alias", ModelType.Autonumeric, lAgentsDSItem0, DefaultFormats.ColWidthAutonumeric); string[] lAgentsDSItem1 = { Agents.Administrador }; lDisplaySetInfo.Add("Nombre", "Nombre", "Clas_1348178411520734CjtoVis_AutoICtjoVis_2_Alias", ModelType.Text, lAgentsDSItem1, DefaultFormats.ColWidthText); string[] lAgentsDSItem2 = { Agents.Administrador }; lDisplaySetInfo.Add("MaximoPasajeros", "MaximoPasajeros", "Clas_1348178411520734CjtoVis_AutoICtjoVis_3_Alias", ModelType.Int, lAgentsDSItem2, DefaultFormats.ColWidthInt); string[] lAgentsDSItem3 = { Agents.Administrador }; lDisplaySetInfo.Add("Origen", "Origen", "Clas_1348178411520734CjtoVis_AutoICtjoVis_4_Alias", ModelType.Text, lAgentsDSItem3, DefaultFormats.ColWidthText); string[] lAgentsDSItem4 = { Agents.Administrador }; lDisplaySetInfo.Add("Destino", "Destino", "Clas_1348178411520734CjtoVis_AutoICtjoVis_5_Alias", ModelType.Text, lAgentsDSItem4, DefaultFormats.ColWidthText); lDisplaySetController.CurrentDisplaySet = lDisplaySetInfo; return lDisplaySetController; }
/// <summary> /// Constructor for object-valued elements /// </summary> /// <param name="name">Name of the DisplaySet item.</param> /// <param name="alias">Alias of the DisplaySet item.</param> /// <param name="idXML">IdXML of the DisplaySet item.</param> /// <param name="className">Definition class.</param> /// <param name="agents">List of agents of the DisplaySet item.</param> /// <param name="width">Width column of the DisplaySet item.</param> /// <param name="visible">True if the item is visible.</param> public DisplaySetItem(string name, string alias, string className, string idXML, List<string> agents, int width, bool visible, string[] oidFields, DisplaySetInformation supplementaryInfo) { mName = name; mAlias = alias; mClassName = className; mIdXML = idXML; mModelType = ModelType.Oid; mAgents = agents; mWidth = width; mVisible = visible; mOIDFields = new List<string>(oidFields); mSupplementaryInfo = supplementaryInfo; }
private void ShowDisplaySetItems(DisplaySetInformation displaySet) { dTDisplaySetItems.Rows.Clear(); foreach (DisplaySetItem item in displaySet.DisplaySetItems) { DataRow row = dTDisplaySetItems.Rows.Add(); row["ItVisible"] = item.Visible; row["ItName"] = item.Alias; row["Expression"] = item.Name; row["DataType"] = item.ModelType.ToString(); } gridItems.AllowUserToAddRows = false; gridItems.AllowUserToDeleteRows = false; // Set Items grid properties if (displaySet.Custom) { // Custom DisplaySets can be modified gridItems.ReadOnly = false; gridItems.Columns["dataGridViewVisible"].ReadOnly = false; } else { // Modeled DisplaySets can not be modified gridItems.ReadOnly = true; gridItems.Columns["dataGridViewVisible"].ReadOnly = true; } }
/// <summary> /// Receives the Query controller of the scenario to be customized /// </summary> /// <param name="queryController">Query Controller</param> public void Initialize(IUQueryController queryController) { mQueryController = queryController; // Copy the DisplaySets to the temporal list foreach (DisplaySetInformation displaySet in mQueryController.DisplaySet.DisplaySetList) { DisplaySetInformation newDisplayset = new DisplaySetInformation(displaySet); mTempDisplaySets.Add(newDisplayset); } ApplyMultilanguage(); LoadDisplaySets(); LoadPopulationInfo(); }
private string GetInfoFromOid(Oid oid, DisplaySetInformation supplementaryInfo) { if (oid == null) return ""; // If no Supplementary information is requested, return the Oid values if (supplementaryInfo == null) { return UtilFunctions.OidFieldsToString(oid, ' '); } // Query to obtain the supplementary information values string displaySet = supplementaryInfo.DisplaySetItemsAsString(); DataTable lDataTable = null; try { lDataTable = Logic.ExecuteQueryInstance(Logic.Agent, oid, displaySet); } catch { return UtilFunctions.OidFieldsToString(oid, ' '); ; } // No data, return empty string if (lDataTable == null || lDataTable.Rows.Count == 0) return UtilFunctions.OidFieldsToString(oid, ' '); ; string lResult = ""; foreach (DisplaySetItem lItem in supplementaryInfo.DisplaySetItems) { if (!lResult.Equals("")) lResult += " "; lResult += DefaultFormats.ApplyDisplayFormat(lDataTable.Rows[0][lItem.Name], lItem.ModelType); } return lResult; }
/// <summary> /// ANalize the Master Detail controller and creates the suitable nodes /// </summary> /// <param name="masterDetailController"></param> /// <param name="showDetailsGroupingNode"></param> private void InitializeMasterDetailNode(IUMasterDetailController masterDetailController, bool showDetailsGroupingNode) { // Keep the Master information. QueryContext = masterDetailController.Master.Context; // Initialize the DisplaySet information. mDisplaySetInfo = new DisplaySetInformation(masterDetailController.Master.DisplaySet.DisplaySetList[0].Name); // It has to be considered only the items that the agent is able to access. mDisplaySetInfo.DisplaySetItems = masterDetailController.Master.DisplaySet.DisplaySetList[0].GetVisibleDisplaySetItems(Logic.Agent.ClassName); QueryContext.DisplaySetAttributes = mDisplaySetInfo.GetDisplaySetItemsAsString(); Alias = CultureManager.TranslateString(masterDetailController.IdXMLDetailAlias, masterDetailController.DetailAlias); Action = masterDetailController.Master.Action; Navigation = masterDetailController.Master.Navigation; masterDetailController.Master.Action = null; masterDetailController.Master.Navigation = null; IUPopulationController lPopController = masterDetailController.Master as IUPopulationController; if (lPopController != null) { foreach (IUFilterController lFilter in lPopController.Filters) { Filters.Add(lFilter); } lPopController.Filters.Clear(); } // Analize every detail properties #region Details sub-nodes creation int nodeCounter = 0; TreeNodeController lSubNode = null; // Process all the Master-Detail details, in order to create the suitable sub-nodes. foreach (IDetailController lDetail in masterDetailController.Details) { bool lShowInTree = CalculateShowInTree(lDetail); lSubNode = new TreeNodeController(NodeId, NodeId + "_" + nodeCounter.ToString(), lDetail, null, false, showDetailsGroupingNode, lShowInTree); mSubNodes.Add(lSubNode); // Suscribe subnode events lSubNode.RefreshRequired += new EventHandler<RefreshNodeRequiredEventArgs>(HandleSubNodeRefreshRequired); lSubNode.ContextRequired += new EventHandler<ContextRequiredEventArgs>(HandleSubNodeContextRequired); nodeCounter++; // Special situation. If this Detail won't be shown in the Tree // assign the FinalNodeController. Only for the first one if (!lSubNode.ShowInTree && FinalNodeQueryController == null) { FinalNodeID = lSubNode.NodeId; FinalNodeQueryController = lDetail; lSubNode.ShowGroupingNode = false; } } #endregion Details sub-nodes creation // Empty the detail list masterDetailController.Details.Clear(); }
/// <summary> /// Creates the specific DisplaySetController of the '_Auto_' DisplaySet pattern. /// </summary> /// <param name="parentController">Parent controller.</param> /// <returns>Specific DisplaySetController of the '_Auto_' DisplaySet pattern.</returns> public static DisplaySetController DisplaySet__Auto_(SIGEM.Client.Controllers.Controller parentController) { DisplaySetController lDisplaySetController = new DisplaySetController(parentController); DisplaySetInformation lDisplaySetInfo = new DisplaySetInformation("_Auto_"); string[] lAgentsDSItem0 = { Agents.Administrador }; lDisplaySetInfo.Add("id_Pasajero", "id_Pasajero", "Clas_1348178542592658CjtoVis_AutoICtjoVis_1_Alias", ModelType.Autonumeric, lAgentsDSItem0, DefaultFormats.ColWidthAutonumeric); string[] lAgentsDSItem1 = { Agents.Administrador }; lDisplaySetInfo.Add("Nombre", "Nombre", "Clas_1348178542592658CjtoVis_AutoICtjoVis_2_Alias", ModelType.Text, lAgentsDSItem1, DefaultFormats.ColWidthText); lDisplaySetController.CurrentDisplaySet = lDisplaySetInfo; return lDisplaySetController; }
/// <summary> /// Refreshes data for a root node. /// </summary> /// <param name="oidPathList">List of Oids of the suitable branch.</param> /// <param name="data">Data to be showed.</param> /// <param name="displaySetInfo">DisplaySet information to format the data.</param> /// <param name="lastBlock">Boolean indicating if there are more data to be retrieved.</param> public void RefreshBranch(List<KeyValuePair<string, Oid>> oidPathList, DataTable data, DisplaySetInformation displaySetInfo, bool lastBlock) { // Locate the parent node TreeNode lNode = GetNodeWithCompleteOidPath(oidPathList); if (lNode == null) { return; } // Add the new data AddDataToNode(lNode, lNode.Name, data, displaySetInfo, lastBlock, true); }
/// <summary> /// Creates the specific DisplaySetController of the 'DS_RevisionPasajero' DisplaySet pattern. /// </summary> /// <param name="parentController">Parent controller.</param> /// <returns>Specific DisplaySetController of the 'DS_RevisionPasajero' DisplaySet pattern.</returns> public static DisplaySetController DisplaySet_DS_RevisionPasajero(SIGEM.Client.Controllers.Controller parentController) { DisplaySetController lDisplaySetController = new DisplaySetController(parentController); DisplaySetInformation lDisplaySetInfo = new DisplaySetInformation("DS_RevisionPasajero"); string[] lAgentsDSItem0 = { Agents.Administrador }; lDisplaySetInfo.Add("PasajeroAeronave.Aeronave.id_Aeronave", "id_Aeronave", "Clas_1348178673664478CjtoVis_1ICtjoVis_1_Alias", ModelType.Autonumeric, lAgentsDSItem0, DefaultFormats.ColWidthAutonumeric); string[] lAgentsDSItem1 = { Agents.Administrador }; lDisplaySetInfo.Add("PasajeroAeronave.Pasajero.id_Pasajero", "id_Pasajero", "Clas_1348178673664478CjtoVis_1ICtjoVis_2_Alias", ModelType.Autonumeric, lAgentsDSItem1, DefaultFormats.ColWidthAutonumeric); string[] lAgentsDSItem2 = { Agents.Administrador }; lDisplaySetInfo.Add("PasajeroAeronave.Pasajero.Nombre", "Nombre", "Clas_1348178673664478CjtoVis_1ICtjoVis_3_Alias", ModelType.Text, lAgentsDSItem2, DefaultFormats.ColWidthText); lDisplaySetController.CurrentDisplaySet = lDisplaySetInfo; return lDisplaySetController; }
/// <summary> /// Shows data for grouping root node. /// </summary> /// <param name="nodeId">Node identifier.</param> /// <param name="data">DataTable object with the data to be showed.</param> /// <param name="displaySetInfo">Display Set information to format the data in the node.</param> /// <param name="lastBlock">Boolean indicating if there is more data to be showed.</param> /// <param name="showGroupingNode">Boolean indicating if the root node has to be collapsed (deleting its subnodes).</param> public void ShowDataInRootNode(string nodeId, DataTable data, DisplaySetInformation displaySetInfo, bool lastBlock, bool showGroupingNode) { NodeInfo nodeInfo = mIntermediaNodes[nodeId]; // If group node must be shown, find it and delete its subnodes TreeNode lParentNode = null; if (showGroupingNode) { TreeNode[] lGroupNodes = mTreeViewIT.Nodes.Find(nodeId, false); if (lGroupNodes.Length == 0) { lParentNode = mTreeViewIT.Nodes.Add(nodeId, nodeInfo.Alias); } else { // Get the first one lParentNode = lGroupNodes[0]; } lParentNode.ImageKey = nodeInfo.GroupImageKey; lParentNode.SelectedImageKey = nodeInfo.GroupImageKey; // Set contextual menu for grouping root node ContextMenuStrip menu = GetMenuForNode(lParentNode); lParentNode.ContextMenuStrip = menu; } // Add the data node AddDataToNode(lParentNode, nodeId, data, displaySetInfo, lastBlock, true); // If no data and Grouping node, add the ... node if (!nodeInfo.FinalNode && lParentNode != null && data == null) { TreeNode lNextBlockNode = lParentNode.Nodes.Add(nodeId, "..."); lNextBlockNode.ImageKey = NextBlockImageKey; } }
/// <summary> /// Updates the information for one instance in the tree. /// </summary> /// <param name="nodeId">Node identifier.</param> /// <param name="oid">Oid of the instance to be updated.</param> /// <param name="data">New data.</param> /// <param name="displaySetInfo">Display Set information used to represent the data in the node.</param> public void UpdateNodeValues(string nodeId, Oid oid, DataTable data, DisplaySetInformation displaySetInfo) { // Get the nodes with the same Id TreeNode[] lNodes = mTreeViewIT.Nodes.Find(nodeId, true); bool lSelectionChange = false; // Locate the node with the same Oid foreach (TreeNode lNode in lNodes) { if (lNode.Tag != null) { InstanceNodeInfo instanceNodeInfo = lNode.Tag as InstanceNodeInfo; if (instanceNodeInfo != null) { if (instanceNodeInfo.InstanceOid.Equals(oid)) { if (data == null || data.Rows.Count == 0) { // If the instance doesn't exist, delete the node mRaiseEventsFlag = false; TreeNode lPreviousSelected = mTreeViewIT.SelectedNode; mTreeViewIT.Nodes.Remove(lNode); mRaiseEventsFlag = true; TreeNode lCurrentSelected = mTreeViewIT.SelectedNode; if (!UtilFunctions.ObjectsEquals(lCurrentSelected, lPreviousSelected)) { lSelectionChange = true; } } else { // Update the node values. lNode.Text = GetTextForNode(displaySetInfo, data.Rows[0]); instanceNodeInfo.InstanceOid = Adaptor.ServerConnection.GetOid(data, data.Rows[0]); // Clear subnodes lNode.Nodes.Clear(); // Add the Deatils nodes AddDetailsNodes(lNode); } } } } } // If selected node has been modified, raise the event with the node selected if (lSelectionChange && mTreeViewIT.SelectedNode != null) { ProcessNodeSelected(mTreeViewIT.SelectedNode); } }
/// <summary> /// Creates the specific DisplaySetController of the '_Auto_' DisplaySet pattern. /// </summary> /// <param name="parentController">Parent controller.</param> /// <returns>Specific DisplaySetController of the '_Auto_' DisplaySet pattern.</returns> public static DisplaySetController DisplaySet__Auto_(SIGEM.Client.Controllers.Controller parentController) { DisplaySetController lDisplaySetController = new DisplaySetController(parentController); DisplaySetInformation lDisplaySetInfo = new DisplaySetInformation("_Auto_"); string[] lAgentsDSItem0 = { Agents.Administrador }; lDisplaySetInfo.Add("id_NaveNodriza", "id_NaveNodriza", "Clas_1347649273856884CjtoVis_AutoICtjoVis_1_Alias", ModelType.Autonumeric, lAgentsDSItem0, DefaultFormats.ColWidthAutonumeric); string[] lAgentsDSItem1 = { Agents.Administrador }; lDisplaySetInfo.Add("Nombre_NaveNodriza", "Nombre_NaveNodriza", "Clas_1347649273856884CjtoVis_AutoICtjoVis_2_Alias", ModelType.String, lAgentsDSItem1, DefaultFormats.ColWidthString20); lDisplaySetController.CurrentDisplaySet = lDisplaySetInfo; return lDisplaySetController; }
/// <summary> /// Deserialize from XML node /// </summary> /// <param name="insNode"></param> /// <param name="version"></param> public virtual void Deserialize(XmlNode insNode, string version) { SelectedDisplaySetName = insNode.Attributes["SelectedDS"].Value; // Get all Customized Display Sets XmlNodeList lDisplaySetNodes = insNode.SelectNodes("DisplaySet"); foreach (XmlNode lDisplaySetNode in lDisplaySetNodes) { DisplaySetInformation lDisplaySet = new DisplaySetInformation(""); lDisplaySet.Deserialize(lDisplaySetNode, version); DisplaySets.Add(lDisplaySet); } }