Ejemplo n.º 1
0
        /// <summary>
        ///  Edit conditional formatting
        /// </summary>
        /// <param name="cf"></param>
        /// <param name="title"></param>
        /// <returns></returns>

        public static CondFormat Edit(
            CondFormat cf,
            bool editForUserObjectStorage = false,
            string title = "Conditional Formatting Rules")
        {
            InitialSerializedForm = cf.Serialize();             // save for later compare
            //if (Instance == null) // always create new instance because the any changed height of the grid editor controls is maintained otherwise
            Instance = new CondFormatEditor();

            Instance.Text = title;
            Instance.ShowEditorWhenActivated  = true;
            Instance.EditForUserObjectStorage = editForUserObjectStorage;
            Instance.CondFormatToForm(cf);

            DialogResult dr = Instance.ShowDialog(SessionManager.ActiveForm);

            if (dr == DialogResult.Cancel)
            {
                return(null);
            }

            cf = Instance.FormToCondFormat();

            cf.Rules.InitializeInternalMatchValues(cf.ColumnType);

            return(cf);
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Open the specified target
        /// </summary>
        /// <param name="mtn"></param>

        public static void OpenMetaTreeNode(
            MetaTreeNode mtn)
        {
            UserObject uo;
            string     tok;
            int        i1;

            if (mtn == null)
            {
                return;
            }
            MetaTreeNodeType nodeType = mtn.Type;
            string           target   = mtn.Target;

            //if (!Permissions.UserHasReadAccess(SS.I.UserName, target))
            //{
            //  MessageBoxMx.ShowError("You are not authorized to open: " + mtn.Label);
            //  return;
            //}

            if (nodeType == MetaTreeNodeType.MetaTable ||             // data table types
                nodeType == MetaTreeNodeType.CalcField ||
                nodeType == MetaTreeNodeType.Annotation ||
                nodeType == MetaTreeNodeType.ResultsView)
            {
                QbUtil.AddAndRenderTables(target);                 //.CallCurrentProcessTreeItemOperationMethod("Open", target);
            }

            else if (nodeType == MetaTreeNodeType.CondFormat)
            {
                uo = ParseAndReadUserObject(mtn.Name);
                if (uo == null)
                {
                    return;
                }
                tok = uo.InternalName;
                CondFormatEditor.EditUserObject(uo.InternalName);
            }

            else if (MetaTreeNode.IsFolderNodeType(nodeType))
            {
                if (Lex.StartsWith(target, "USERDATABASE_"))                 // edit a user compound database
                {
                    uo = ParseAndReadUserObject(target);
                    if (uo == null)
                    {
                        return;
                    }
                    UserData.OpenExistingUserDatabase(uo);
                }
            }

            else if (nodeType == MetaTreeNodeType.Url)
            {             // open url or execute click function
                if ((i1 = Lex.IndexOf(target, "ClickFunction")) >= 0)
                {
                    string cmd = target.Substring(i1 + "ClickFunction".Length + 1);                     // get function name
                    ClickFunctions.Process(cmd, null);
                }

                else if (Lex.Contains(target, "SpotfireWeb"))                 // link to Spotfire webplayer
                {
                    SpotfireLinkUI.OpenLink(target);
                }

                else
                {
                    SystemUtil.StartProcess(target);                  // open in default user browser
                }
            }

            else if (nodeType == MetaTreeNodeType.Action)
            {             // execute action
                CommandLine.Execute(mtn.Target);
            }

            else if (nodeType == MetaTreeNodeType.CnList)             // open list
            {
                uo = ParseAndReadUserObject(target);
                if (uo == null)
                {
                    return;
                }
                tok = uo.InternalName;
                CidListEditor.Edit(tok);
            }

            else if (nodeType == MetaTreeNodeType.Query)             // open query
            {
                uo = ParseAndReadUserObject(target);
                if (uo == null)
                {
                    return;
                }

                if (uo.Type == UserObjectType.Query)                 // normal query
                {
                    tok = uo.InternalName;

                    string nextCommand = QbUtil.OpenQuery(tok);
                    while (!(String.IsNullOrEmpty(nextCommand)))
                    {
                        nextCommand = CommandExec.ExecuteCommand(nextCommand);
                    }
                }

                else if (uo.Type == UserObjectType.MultiTable)                 // multitable query
                {
                    QbUtil.AddAndRenderTables(target);
                }
            }

            else if (nodeType == MetaTreeNodeType.Library)
            {
                CommandExec.ExecuteCommandAsynch("ContentsViewLibAsList " + mtn.Name);
            }
        }