Ejemplo n.º 1
0
        /// <summary>
        /// Get the context menu associated with a metatree node
        /// </summary>
        /// <param name="node"></param>
        /// <returns></returns>

        public ContextMenuStrip GetSingleNodeContextMenu(
            MetaTreeNode node)
        {
            bool singleNodeSelected = true;

            return(GetNodeContextMenu(node, singleNodeSelected));
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Get the context menu associated with a metatree node checking to see if multiple nodes are selected in the tree
        /// </summary>
        /// <param name="node"></param>
        /// <returns></returns>

        public ContextMenuStrip GetNodeContextMenu(
            MetaTreeNode node)
        {
            bool singleNodeSelected = QbContentsTree.SingleNodeSelected();

            return(GetNodeContextMenu(node, singleNodeSelected));
        }
Ejemplo n.º 3
0
        private void DeleteFavoriteMenuItem_Click(object sender, EventArgs e)
        {
            SessionManager.LogCommandUsage("ContentsFavoritesDelete");

            MetaTreeNode node = QbContentsTree.CurrentContentsMetaTreeNode;

            if (node == null)
            {
                return;
            }
            if (String.IsNullOrEmpty(node.Target))
            {
                return;
            }

            DialogResult dr = MessageBoxMx.Show(
                "Are you sure you want to delete: '" + node.Label + "' ?",
                "Confirm Delete", MessageBoxButtons.YesNoCancel, MessageBoxIcon.Question);

            if (dr != DialogResult.Yes)
            {
                return;
            }

            SessionManager.Instance.MainMenuControl.DeleteFavorite(node);
        }
Ejemplo n.º 4
0
 public void SetItemEnabledState(
     ToolStripMenuItem contentsCutQuery,
     ToolStripMenuItem contentsCopyQuery,
     ToolStripMenuItem contentsDeleteQuery,
     ToolStripMenuItem contentsRenameQuery)
 {
     foreach (TreeListNode node in ContentsTreeCtl.TreeList.Selection)
     {
         // if any node in the selection turns the menu to false, it stays false
         MetaTreeNode mtn            = ContentsTreeCtl.GetMetaTreeNode(node);
         bool         hasWriteAccess = Permissions.UserHasWriteAccess(SS.I.UserName, mtn.Target);
         if (contentsCutQuery.Enabled)
         {
             contentsCutQuery.Enabled = hasWriteAccess;
         }
         if (contentsDeleteQuery.Enabled)
         {
             contentsDeleteQuery.Enabled = hasWriteAccess;
         }
         if (contentsRenameQuery.Enabled)
         {
             contentsRenameQuery.Enabled = hasWriteAccess;
         }
         if (contentsCopyQuery.Enabled)
         {
             contentsCopyQuery.Enabled =
                 (hasWriteAccess || (MetaTreeNode.IsUserObjectNodeType(mtn.Type) && !MetaTreeNode.IsLeafNodeType(mtn.Type)));
         }
     }
 }
Ejemplo n.º 5
0
/// <summary>
/// Setup the form
/// </summary>

        void Setup()
        {
            // Temporary surrogates for current and other temp lists that gets added to the preferred project

            TempNodes = new List <MetaTreeNode>();

            foreach (TempCidList tcl in SS.I.TempCidLists)
            {
                UserObject uo = new UserObject(UserObjectType.CnList);
                uo.ParentFolder     = SS.I.PreferredProjectId;
                uo.ParentFolderType = (uo.ParentFolder.ToUpper().StartsWith("FOLDER_")) ? FolderTypeEnum.User : FolderTypeEnum.System;
                uo.Id          = tcl.Id;
                uo.Name        = "*" + tcl.Name;
                uo.AccessLevel = UserObjectAccess.Private;
                uo.Count       = tcl.Count;
                MetaTreeNode mtn = UserObjectTree.GetValidUserObjectTypeFolder(uo);
                mtn          = UserObjectTree.AddObjectToTree(uo);
                ParentFolder = uo.ParentFolder;
                TempNodes.Add(mtn);
            }

            ListTree1.FillTree(UserObjectType.CnList);
            ListTree2.FillTree(UserObjectType.CnList);

            StatusMessage.Caption = "";

            return;
        }
Ejemplo n.º 6
0
        /// <summary>
        /// Get subtree starting at specified node
        /// </summary>
        /// <param name="rootNodeName"></param>
        /// <returns></returns>

        public MetaTreeNode GetAfsSubtree(string rootNodeName)
        {
            if (ServiceFacade.UseRemoteServices)
            {
                NativeMethodTransportObject resultObject = ServiceFacade.CallServiceMethod(
                    ServiceCodes.MobiusMetaDataService,
                    MobiusMetaDataService.GetAfsSubtree,
                    new object[] { rootNodeName });

                if (resultObject == null)
                {
                    return(null);
                }
                MetaTreeNode mtn = resultObject.Value as MetaTreeNode;
                return(mtn);
            }

            else
            {
                if (MetaTreeFactoryInstance == null)
                {
                    MetaTreeFactoryInstance = new Mobius.MetaFactoryNamespace.MetaTreeFactory();
                }
                return(MetaTreeFactoryInstance.GetAfsSubtree(rootNodeName));
            }
        }
Ejemplo n.º 7
0
        internal void SetupMouseDown(ContentsTreeControl control, MouseEventArgs e)
        {
            ContentsTreeControl = control;

            CurrentContentsTreeMouseDownEvent = e;             // save event info for later use

            MetaTreeNode mtn = control.GetMetaTreeNodeAt(e.Location, out CurrentContentsTreeListNode);

            if (mtn == null || mtn.Target == null)
            {
                return;
            }
            CurrentContentsMetaTreeNode = mtn;

            if (e.Button != MouseButtons.Right)
            {
                return;                                             // all done if other than right button
            }
            if (mtn.Owner != SS.I.UserName)
            {
                return;                                         // not allowed to do anything with another user's folder
            }
            if (mtn.Type == MetaTreeNodeType.Project || mtn.Type == MetaTreeNodeType.SystemFolder ||
                mtn.Type == MetaTreeNodeType.UserFolder)          // can only create a user folder under these
            {
                CreateUserFolderMenuItem.Visible = true;
            }
            else
            {
                CreateUserFolderMenuItem.Visible = false;
            }

            TreePopupMenu.Show(control, new System.Drawing.Point(e.X, e.Y));
            return;
        }
Ejemplo n.º 8
0
        /// <summary>
        /// Filter out the nodes that should be hidden from the user
        /// </summary>
        /// <param name="nodes"></param>

        public static void FilterNodesForUser(Dictionary <string, MetaTreeNode> nodes)
        {
            HashSet <string> allowedMts = ClientState.UserInfo?.RestrictedViewAllowedMetaTables;
            HashSet <string> blockedMts = ClientState.UserInfo?.GenerallyRestrictedMetatables;

            if (!nodes.ContainsKey("ROOT"))
            {
                return;
            }

            MetaTreeNode root = nodes["ROOT"];

            try
            {
                if (blockedMts != null)
                {
                    FilterRestrictedMetatableNodeForUser(root, blockedMts, nodes);
                }

                if (allowedMts != null)
                {
                    FilterNodeForUser(root, allowedMts, nodes);
                }
            }

            catch (Exception ex)
            {
                throw new Exception(ex.Message, ex);
            }

            return;
        }
Ejemplo n.º 9
0
        /// <summary>
        /// Handle special KeyDown events
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>

        private void CommandLine_KeyDown(object sender, KeyEventArgs e)
        {
            LastCommandLineControlKeyDownTime = DateTime.Now;

            if (CheckForEscapePressed(e))
            {
            }

            else if (e.KeyCode == Keys.Enter)             // command entered
            {
                e.Handled = true;

                ExecuteCommandLine();
                return;

#if false // experimental code that opens the currently selected item in the dropdown rather than doing a more-complete search
                int i1 = ListControl.SelectedIndex;

                if (ListControl.Visible &&
                    i1 >= 0 &&                        // something selected
                    i1 < MatchingContentsNodes.Count) // within list of nodes found in the latest quicksearch
                {
                    MetaTreeNode mtn = MatchingContentsNodes[i1];
                    QbUtil.CallCurrentProcessTreeItemOperationMethod("Open", mtn.Target);
                    HideQuickSearchPopup();
                }

                else
                {
                    ExecuteCommandLine();                  // just execute the command line
                }
                return;
#endif
            }
        }
Ejemplo n.º 10
0
        private void ContentsTree_MouseDown(object sender, MouseEventArgs e)
        {
            CurrentContentsTreeMouseDownEvent = e;             // save event info for later use

            MetaTreeNode mtn = QbContentsTreeCtl.GetMetaTreeNodeAt(QbContentsTreeCtl.PointToClient(Cursor.Position), out CurrentContentsTreeListNode);

            if (mtn == null || mtn.Target == null)
            {
                return;
            }
            CurrentContentsMetaTreeNode = mtn;

            if (e.Button != MouseButtons.Right)
            {
                return;                                             // all done if other than right button
            }
            ContextMenuStrip ms = ContentsTreeContextMenus.GetNodeContextMenu(mtn);

            bool displayingSearchResults = (QbContentsTreeCtl.DisplayingAsList);

            ContentsTreeContextMenus.ShowInTreeMenuItem.Visible = displayingSearchResults;             // if showing search results enable item to show in tree

            if (ms != null)
            {
                ms.Show(QbContentsTreeCtl, new System.Drawing.Point(e.X, e.Y));
            }
            return;
        }
Ejemplo n.º 11
0
        /// <summary>
        /// Insert the rows for a metatree node including its children into the metatree_nodes table
        /// Called via command: Update MetatreeNodeTable
        /// </summary>
        /// <param name="toks"></param>
        /// <param name="dao"></param>

        public static int InsertMetatreeNodeRows(
            MetaTreeNode mtn,
            DbCommandMx dao)
        {
            int insCnt = 0;

            foreach (MetaTreeNode cn in mtn.Nodes)
            {
                string names  = "";
                string values = "";
                AddInsertColumn("parent_name", ref names, ref values, mtn.Name);
                AddInsertColumn("parent_label", ref names, ref values, mtn.Label);
                AddInsertColumn("parent_type", ref names, ref values, mtn.Type);
                AddInsertColumn("child_name", ref names, ref values, cn.Name);
                AddInsertColumn("child_label", ref names, ref values, cn.Label);
                AddInsertColumn("child_type", ref names, ref values, cn.Type);
                AddInsertColumn("child_size", ref names, ref values, cn.Size);
                AddInsertColumn("child_update_dt", ref names, ref values, cn.UpdateDateTime);

                string sql = "insert into " + MetatreeNodesTableName + " (" + names + ") " +
                             "values (" + values + ")";

                dao.Prepare(sql);
                dao.ExecuteNonReader();
                insCnt++;
            }

            return(insCnt);
        }
Ejemplo n.º 12
0
        private void ContentsTree_FocusedNodeChanged(object sender, EventArgs e)
        {
            ContentsTreeControl ctc = sender as ContentsTreeControl;

            if (ctc == null)
            {
                return;
            }
            MetaTreeNode node = ctc.GetMetaTreeNode(ctc.FocusedTreeListNode);

            if (node == null)
            {
                return;
            }

            if (String.IsNullOrEmpty(node.Target))
            {
            }
            else if (node.Type == MetaTreeNodeType.MetaTable ||
                     node.Type == MetaTreeNodeType.Annotation ||
                     node.Type == MetaTreeNodeType.CalcField ||
                     node.Type == MetaTreeNodeType.CnList ||   // for open list
                     node.Type == MetaTreeNodeType.Query)      // for open condFormat
            {
                AddTableButton.Enabled = true;                 // set enabled flag for "Add >>>" (to query) button
            }

            else
            {
                AddTableButton.Enabled = false;
            }
        }
Ejemplo n.º 13
0
        bool Save(bool prompt)
        {
            UserObject uo2;

            if (!IsValidCalcField())
            {
                return(false);
            }
            if (!GetCalcFieldForm())
            {
                return(false);
            }
            if (prompt)
            {
                uo2 = UserObjectSaveDialog.Show("Save Calculated Field Definition", UoIn);
                if (uo2 == null)
                {
                    return(false);
                }
            }
            else
            {
                uo2 = UoIn.Clone();
            }

            if (!UserObjectUtil.UserHasWriteAccess(uo2))
            {             // is the user authorized to save this?
                MessageBoxMx.ShowError("You are not authorized to save this calculated field");
                return(false);
            }

            SessionManager.DisplayStatusMessage("Saving calculated field...");

            string content = CalcField.Serialize();

            uo2.Content = content;

            //need the name of the folder to which the object will be saved
            MetaTreeNode targetFolder = UserObjectTree.GetValidUserObjectTypeFolder(uo2);

            if (targetFolder == null)
            {
                MessageBoxMx.ShowError("Failed to save your calculated field.");
                return(false);
            }

            UserObjectDao.Write(uo2);

            string tName = "CALCFIELD_" + uo2.Id.ToString();

            QbUtil.UpdateMetaTableCollection(tName);
            MainMenuControl.UpdateMruList(tName);

            string title = "Edit Calculated Field - " + uo2.Name;

            Text = title;
            UoIn = uo2.Clone();             // now becomes input object
            SessionManager.DisplayStatusMessage("");
            return(true);
        }
Ejemplo n.º 14
0
        /// <summary>
        /// Get a MetaTreeNode from either MetaTree or UserObjectTree
        /// searching both by name and target
        /// </summary>
        /// <param name="name"></param>
        /// <returns></returns>

        public static MetaTreeNode GetNode(
            string name)
        {
            MetaTreeNode mtn = MetaTree.GetNode(name); // check main tree first

            if (mtn == null)                           // check UserObject tree if not in main tree
            {
                mtn = UserObjectTree.GetNodeByName(name);
            }

            if (mtn == null)             // try by main tree target
            {
                mtn = MetaTree.GetNodeByTarget(name);
            }

            if (mtn == null)             // try UserObject tree target
            {
                mtn = UserObjectTree.GetNodeByTarget(name);
            }

            if (mtn != null)
            {
                return(mtn);
            }
            else
            {
                return(null);
            }
        }
Ejemplo n.º 15
0
/// <summary>
/// Build the basic projects nodes without assay, library or other assoc info
/// </summary>
/// <param name="projectNodeName"></param>
/// <param name="pNodes"></param>

        public void BuildAfsProjectNodes(
            string projectNodeName,
            Dictionary <string, MetaTreeNode> pNodes)
        {
            MetaTreeNode projNode, assayNode;

            List <AfsProject> projects = AfsProject.Select(projectNodeName);

            foreach (AfsProject p in projects)
            {
                if (!pNodes.ContainsKey(p.MbsProjectName))                 // add project node
                {
                    projNode                 = new MetaTreeNode(MetaTreeNodeType.Project);
                    projNode.Name            = projNode.Target = p.MbsProjectName;
                    projNode.Label           = p.ProjectLabel;
                    projNode.Owner           = "AFS";
                    pNodes[p.MbsProjectName] = projNode;

                    if (Nodes.ContainsKey(p.MbsDhtFolderName))                     // link to project parent if exists
                    {
                        projNode.Parent = Nodes[p.MbsDhtFolderName];
                    }
                }
            }

            return;
        }
Ejemplo n.º 16
0
/// <summary>
/// Build assay nodes
/// </summary>
/// <param name="projectNodeName"></param>
/// <param name="pNodes"></param>

        public void BuildAfsAssayNodes(
            string projectNodeName,
            Dictionary <string, MetaTreeNode> pNodes)
        {
            MetaTreeNode projNode, assayNode;

            List <AfsAssay> assays = AfsAssay.Select(projectNodeName);

            foreach (AfsAssay a in assays)
            {
                if (!pNodes.ContainsKey(a.MbsProjectName))
                {
                    continue;
                }

                projNode = pNodes[a.MbsProjectName];

                assayNode      = new MetaTreeNode(MetaTreeNodeType.MetaTable);
                assayNode.Name = a.MbsProjectName + "_" + a.AssayDb + "_" + a.AssayId; // assign unique name for project so label with assay use gets passed through

                assayNode.Target = a.AssayDb + "_" + a.AssayId;                        // target must match a metatable name

                assayNode.Label = a.AssayLabel;

                if (!Lex.IsNullOrEmpty(a.AssayUse))                 // append any assay use
                {
                    assayNode.Label += " (" + a.AssayUse + ")";
                }

                assayNode.Owner = "AFS";
                projNode.Nodes.Add(assayNode);
            }

            return;
        }
Ejemplo n.º 17
0
        /// <summary>
        /// Pass the tree operation to the proper handler
        /// </summary>
        /// <param name="op"></param>
        /// <param name="args"></param>

        public static void TreeItemOperation(
            string op,
            string args)
        {
            if (Lex.Eq(op, "Open"))
            {
                MetaTreeNode mtn = MetaTreeNodeCollection.GetNode(args);
                if (mtn == null || !mtn.IsUserObjectType)
                {
                    return;
                }

                Instance.ObjectName.Text = mtn.Label;
                Instance.SelectedNode    = mtn;
                Instance.OK_Click(null, null);
                return;
            }

            else
            {
                Instance.ContentsTreeWithSearch.ContentsTreeCtl.FindInContents(args);
            }

            return;
        }
Ejemplo n.º 18
0
        private void Setup()
        {
            InSetup = true;

            // Setup preferred project

            MetaTreeNode mtn = MetaTree.GetNode(SS.I.PreferredProjectId);

            // If not found create folder node
            // The following default folder node should exist in the MetaTree root node:
            //   <child name = "default_folder" l = "Private Queries, Lists..." type = "project" item = "default_folder" />

            if (mtn == null)
            {
                mtn       = new MetaTreeNode(MetaTreeNodeType.Project);
                mtn.Name  = mtn.Target = "DEFAULT_FOLDER";
                mtn.Label = "Private Queries, Lists...";
            }

            PreferredProject.Text   = mtn.Label;
            PreferredProjectId      = SS.I.PreferredProjectId;
            PreferredProjectChanged = false;

            // Setup default directory

            DefaultFolder.Text = ClientDirs.DefaultMobiusUserDocumentsFolder;

            // Setup zoom

            TableColumnZoom.ZoomPct    = SS.I.TableColumnZoom; // Setup zoom controls
            GraphicsColumnZoom.ZoomPct = SS.I.GraphicsColumnZoom;
            ZoomChanged = false;

            ScrollGridByRow.Checked   = !SS.I.ScrollGridByPixel;
            ScrollGridByPixel.Checked = SS.I.ScrollGridByPixel;
            InitialScrollGridByPixel  = SS.I.ScrollGridByPixel;

            // Setup look and feel

            LookAndFeelOption.Properties.Items.Clear();
            List <SkinInfoMx> skins = LookAndFeelMx.GetSkins();

            foreach (SkinInfoMx si in skins)
            {
                LookAndFeelOption.Properties.Items.Add(new ImageComboBoxItem(si.ExternalName, si.ImageIndex));
            }

            // Basic old styles (these cause dialog box to close for some reason)

            CurrentLookAndFeel       = SS.I.UserIniFile.Read("LookAndFeel", "Blue");
            LookAndFeelOption.Text   = LookAndFeelMx.GetExternalSkinName(CurrentLookAndFeel);
            ChangingLookAndFeelModes = false;
            InSetup = false;

            FindRelatedCpdsInQuickSearch.Checked = SS.I.FindRelatedCpdsInQuickSearch;
            RestoreWindowsAtStartup.Checked      = SS.I.RestoreWindowsAtStartup;

            return;
        }
Ejemplo n.º 19
0
        private void FavoritesMenuItem_MouseDown(object sender, MouseEventArgs e)
        {
            ToolStripMenuItem mi   = (ToolStripMenuItem)sender;
            MetaTreeNode      node = mi.Tag as MetaTreeNode;

            UpdateAndRenderMruList(node);
            return;
        }
Ejemplo n.º 20
0
        private void QueryListMenuItem_MouseDown(object sender, MouseEventArgs e)
        {
            ToolStripMenuItem mi   = (ToolStripMenuItem)sender;
            MetaTreeNode      node = mi.Tag as MetaTreeNode;

            SetMobiusSourceQuery(node);
            return;
        }
Ejemplo n.º 21
0
/// <summary>
/// Save the SpotfireLink UserObject
/// </summary>
/// <param name="prompt"></param>
/// <returns></returns>

        bool Save(bool prompt)
        {
            UserObject uo2;

            if (!IsValidSpotfireLink())
            {
                return(false);
            }
            if (!GetSpotfireLinkForm())
            {
                return(false);
            }
            if (prompt)
            {
                uo2 = UserObjectSaveDialog.Show("Save Spotfire link Definition", UoIn);
                if (uo2 == null)
                {
                    return(false);
                }
            }

            else
            {
                uo2 = UoIn.Clone();
            }

            uo2.Content = SpotfireViewProps.Serialize();

            if (!UserObjectUtil.UserHasWriteAccess(uo2))
            {             // is the user authorized to save this?
                MessageBoxMx.ShowError("You are not authorized to save this Spotfire link");
                return(false);
            }

            SessionManager.DisplayStatusMessage("Saving Spotfire link...");

            //need the name of the folder to which the object will be saved
            MetaTreeNode targetFolder = UserObjectTree.GetValidUserObjectTypeFolder(uo2);

            if (targetFolder == null)
            {
                MessageBoxMx.ShowError("Failed to save your Spotfire link.");
                return(false);
            }

            UserObjectDao.Write(uo2);

            MainMenuControl.UpdateMruList(uo2.InternalName);

            string title = "Edit Spotfire Link - " + uo2.Name;

            Text = title;
            UoIn = uo2.Clone();             // now becomes input object
            SessionManager.DisplayStatusMessage("");
            return(true);
        }
Ejemplo n.º 22
0
        void UpdateAndRenderMruList(MetaTreeNode node)
        {
            if (node == null)
            {
                return;
            }

            MainMenu.UpdateMruList(node.Target, false);
            UpdateSelectedNodesSet();
            SelectedNodes.Add(node.Target);
            RenderMruList();
        }
Ejemplo n.º 23
0
 /// <summary>
 /// Set visibility of menu items based on owner
 /// </summary>
 public void SetItemEnabledState(
     MetaTreeNode node,
     ToolStripMenuItem contentsCutQuery,
     ToolStripMenuItem contentsCopyQuery,
     ToolStripMenuItem contentsDeleteQuery,
     ToolStripMenuItem contentsRenameQuery)
 {
     contentsCutQuery.Enabled            =
         contentsRenameQuery.Enabled     =
             contentsDeleteQuery.Enabled = Permissions.UserHasWriteAccess(SS.I.UserName, node.Target);
     contentsCopyQuery.Enabled           = true;   // can alway copy if user can see it
 }
Ejemplo n.º 24
0
        private void SelectFromContentsTreeMenuItem_Click(object sender, EventArgs e)
        {
            MetaTreeNode node = SelectFromContents.SelectSingleItem(
                "Select a Query",
                "Select a Query to use to use for data retrieval",
                MetaTreeNodeType.Query,
                null,
                false);

            SetMobiusSourceQuery(node);
            return;
        }
Ejemplo n.º 25
0
        /// <summary>
        /// ContentsTreeItemSelected
        /// </summary>
        /// <param name="nodeTarget"></param>

        private void ContentsTreeItemSelected(string nodeTarget)
        {
            MetaTreeNode node = MetaTreeNodeCollection.GetNode(nodeTarget);

            if (node == null || !node.IsUserObjectType)
            {
                return;
            }

            ObjectName.Text = node.Name;     // show node name
            SelectedNode    = node;          // The selected node
        }
Ejemplo n.º 26
0
        void SetMobiusSourceQuery(MetaTreeNode node)
        {
            if (node == null || node.Type != MetaTreeNodeType.Query)
            {
                return;
            }

            SelectedQueryName        = node.Label;
            SelectedQueryId          = UserObject.ParseObjectIdFromInternalName(node.Name);
            SourceQueryComboBox.Text = SelectedQueryName;

            return;
        }
Ejemplo n.º 27
0
/// <summary>
/// Add a MetaTableItem to the DataTable
/// </summary>
/// <param name="mtName"></param>

        void AddMetaTableItemToDataTable(
            string mtName)
        {
            MetaTreeNode mtn = MetaTreeNodeCollection.GetNode(mtName);

            if (mtn != null && mtn.IsFolderType)
            {
                return;                                              // ignore folders
            }
            MetaTable mt = MetaTableCollection.Get(mtName);

            if (mt == null)
            {
                MessageBoxMx.ShowError("The selected item is not a recognized data table: " + mtName);
                return;
            }

            string allowedTypes = Qc.MetaColumn.TableMap;

            if (Lex.IsDefined(allowedTypes))             // see if supplied table is allowed
            {
                int      ai;
                string[] sa = allowedTypes.Split(',');
                for (ai = 0; ai < sa.Length; ai++)
                {
                    string allowedType = sa[ai];
                    if (Lex.IsUndefined(allowedType))
                    {
                        continue;
                    }
                    if (Lex.Contains(mt.Name, allowedType.Trim()))
                    {
                        break;
                    }
                }

                if (ai >= sa.Length)
                {
                    MessageBoxMx.ShowError("The selected data table is not is not of a type that can be added here (" + allowedTypes + ")");
                    return;
                }
            }

            MetaTableItem i = new MetaTableItem();

            i.ExternalName = mt.Label;
            i.InternalName = mt.Name;
            AddMetaTableItemToDataTable(i);

            return;
        }
Ejemplo n.º 28
0
        public static void ShowProjectDescription(
            string projNodeName)
        {
            StreamWriter sw;
            string       html, htmlFileName, flowScheme = "", flowSchemeFileName = "";

            ProjectDescriptionDialog form = new ProjectDescriptionDialog();

            MetaTreeNode mtn   = MetaTree.GetNode(projNodeName);
            string       title = (mtn != null ? mtn.Label : projNodeName);

            html = GetProjectHtmlDescription(projNodeName);
            if (Lex.IsNullOrEmpty(html))
            {
                html = "Unable to retrieve project description";
            }

            string[] sa = html.Split('\v');
            if (sa.Length >= 2)             // write flowscheme if exists
            {
                html               = sa[0];
                flowScheme         = sa[1];
                flowSchemeFileName = ClientDirs.TempDir + @"\FlowScheme" + UIMisc.PopupCount + ".xml";
                sw = new StreamWriter(flowSchemeFileName);
                sw.Write(flowScheme);
                sw.Close();
            }

            htmlFileName = ClientDirs.TempDir + @"\PopupHtml" + UIMisc.PopupCount + ".htm";

            sw = new StreamWriter(htmlFileName);
            sw.Write(html);
            sw.Close();

            UIMisc.PositionPopupForm(form);
            form.Text = title;
            form.Show();

            form.WebBrowser.Navigate(htmlFileName);

            if (flowSchemeFileName != "")
            {
                form.OpenFlowSchemeDiagram(flowSchemeFileName);
            }

            form.Tabs.SelectedTabPageIndex = 0;

            UsageDao.LogEvent("ShowProject", projNodeName);
            return;
        }
Ejemplo n.º 29
0
        private void ContentsTree_DoubleClick(object sender, EventArgs e)
        {
            MetaTreeNode node = QbContentsTreeCtl.FocusedMetaTreeNode;

            if (node == null || node.Target == null || node.Target == "")
            {
                return;
            }

            if (node.Type != MetaTreeNodeType.Url && node.Type != MetaTreeNodeType.Action)             // if not immediate action node then post message
            {
                ExecuteNodeAction(node);
            }
        }
Ejemplo n.º 30
0
        private void Combine_Click(object sender, EventArgs e)
        {
            ListLogicType op;

            MetaTreeNode mtn1 = GetListMetaTreeNode(ListTree1.TreeList.FocusedNode);

            if (mtn1 == null)
            {
                return;
            }

            MetaTreeNode mtn2 = GetListMetaTreeNode(ListTree2.TreeList.FocusedNode);

            if (mtn2 == null)
            {
                return;
            }

            if (ListAnd.Checked)
            {
                op = ListLogicType.Intersect;
            }
            else if (ListOr.Checked)
            {
                op = ListLogicType.Union;
            }
            else
            {
                op = ListLogicType.Difference;
            }
            int count = CidListDao.ExecuteListLogic(mtn1.Target, mtn2.Target, op);

            UserObject  uo = CidListCommand.ReadCurrentListHeader();
            TempCidList tl = CidListCommand.GetTempList("Current");

            if (uo != null && tl != null)
            {
                tl.Count = uo.Count;
                tl.Id    = uo.Id;
            }

            UpdateNode("Current");             // refresh the node to show the new count

            StatusMessage.Caption = count + " " + MetaTable.PrimaryKeyColumnLabel +
                                    "s have passed the combine and have been saved in *Current";

            SessionManager.CurrentResultKeys = CidListCommand.ReadCurrentListRemote().ToStringList();
            SessionManager.DisplayCurrentCount();
            return;
        }