Пример #1
0
 private void SaveSQLForSpotfireUseMenuItem_Click(object sender, EventArgs e)
 {
     SpotfireLinkUI.StoreSpotfireQueryTableSql();
 }
Пример #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);
            }
        }
Пример #3
0
        /// <summary>
        /// Edit a new or existing Spotfire link
        /// </summary>
        /// <param name="cf"></param>
        /// <param name="uoIn"></param>
        /// <returns></returns>

        public static UserObject Edit(
            SpotfireViewProps sl,
            UserObject uoIn)
        {
            SpotfireLinkUI lastInstance = Instance;

            Instance = new SpotfireLinkUI();
            SpotfireLinkUI i = Instance;

            //if (UalUtil.IniFile.Read("SpotfireLinkHelpUrl") != "")
            //  Instance.Help.Enabled = true;

            if (lastInstance != null)
            {
                Instance.StartPosition = FormStartPosition.Manual;
                Instance.Location      = lastInstance.Location;
                Instance.Size          = lastInstance.Size;
                lastInstance           = null;
            }

            if (uoIn == null)
            {
                uoIn = new UserObject(UserObjectType.SpotfireLink);
            }

            else if (uoIn.Id > 0)             // get existing metatable for calc field for exclusion in BuildQuickSelectTableMenu
            {
                if (MainMenuControl != null)
                {
                    MainMenuControl.UpdateMruList(uoIn.InternalName);
                }
            }

            Instance.UoIn = uoIn;

            string title = "Edit Spotfire Link";

            if (!String.IsNullOrEmpty(uoIn.Name))
            {
                title += " - " + uoIn.Name;

                if (uoIn.Id > 0)                 // include internal name?
                {
                    title += " - (SPOTFIRELINK_" + uoIn.Id + ")";
                }
            }

            Instance.Text = title;

            Instance.SpotfireViewProps = sl;  // what we're editing
            Instance.SetupForm();             // set up the form

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

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

            return(Instance.UoIn);            // return saved object
        }