Esempio n. 1
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;
        }
Esempio n. 2
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
        }
Esempio n. 3
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;
        }
Esempio n. 4
0
        /// <summary>
        /// ContentsTreeItemSelected
        /// </summary>
        /// <param name="nodeTarget"></param>

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

            if (node == null || (node.Type & TypeFilter) == 0)
            {
                SelectionName.Text = SelectionTarget.Text = "";
                return;
            }

            else if (node.IsDataTableType)
            {
                MetaTable mt = MetaTableCollection.Get(node.Target);
                if (mt == null)
                {
                    return;                             // shouldn't happen
                }
                if (mt.SummarizedExists)                // Prompt user for summarization-level choice
                {
                    FocusedMetaTable = mt;
                    Point p = Form.MousePosition;
                    p = ContentsTreeWithSearch.ContentsTreeCtl.PointToClient(p);
                    SummarizationLevelContextMenu.Show(ContentsTreeWithSearch.ContentsTreeCtl, p);
                    return;
                }
            }

            SelectionName.Text   = node.Label;
            SelectionTarget.Text = node.Target;

// If item is double clicked then we're done

            MouseEventArgs ma = ContentsTreeWithSearch.CurrentContentsTreeMouseDownEvent;

            if (ma != null && ma.Clicks >= 2)
            {
                DialogResult = DialogResult.OK;
            }

            return;
        }