/// <summary> /// Setup options for an axis /// </summary> /// <param name="axis"></param> /// <param name="svm"></param> public void Setup( ScaleAxisMsx axis, VisualMsx visual, SpotfireViewProps svp, EventHandler editValueChangedEventHandler = null) { InSetup = true; Axis = axis; Visual = visual; SVP = svp; ValueChangedCallback = editValueChangedEventHandler; ColumnSelector.Setup(axis, visual, svp, EditValueChanged); // Range if (axis.Range.Low == null) { RangeMin.Text = "Automatic"; } else { RangeMin.Text = axis.Range.Low.ToString(); } if (axis.Range.High == null) { RangeMax.Text = "Automatic"; } else { RangeMax.Text = axis.Range.High.ToString(); } IncludeOrigin.Checked = axis.IncludeZeroInAutoZoom; ShowZoomSlider.Checked = Axis.ManualZoom; ShowGridLines.Checked = Axis.Scale.ShowGridlines; // Labels ShowLabels.Checked = Axis.Scale.ShowLabels; if (Axis.Scale.LabelOrientation == LabelOrientationMsx.Horizontal) { HorizontalLabels.Checked = true; } else { VerticalLabels.Checked = true; } bool usingMaxTickLayout = (Axis.Scale.LabelLayout == ScaleLabelLayoutMsx.MaximumNumberOfTicks); MaxNumberOfLabels.Checked = usingMaxTickLayout; MaxNumberOfTicks.Enabled = usingMaxTickLayout; MaxNumberOfTicks.Value = Axis.Scale.MaximumNumberOfTicks; // Scaling LogScale.Checked = axis.TransformType == AxisTransformTypeMsx.Log10; ReverseScale.Checked = axis.Reversed; InSetup = false; return; }
/// <summary> /// Build metatable for a Spotfire analysis link /// </summary> /// <param name="name"></param> /// <returns></returns> public MetaTable GetMetaTable( string name) { UserObject uo; SpotfireViewProps sl; MetaTable mt, mt2; MetaColumn mc; int objectId; string prefix = "spotfirelink_"; if (name.ToLower().IndexOf(prefix) != 0) { return(null); } string tok = name.Substring(prefix.Length); // get the object id if (!int.TryParse(tok, out objectId)) { return(null); } uo = UserObjectDao.Read(objectId); if (uo == null) { return(null); } if (!Permissions.UserHasReadAccess(Security.UserName, uo)) { return(null); } try { sl = SpotfireViewProps.Deserialize(uo.Content); if (sl == null) { throw new Exception("Null Deserialize result for object " + uo.Id); } } catch (Exception ex) { DebugLog.Message(ex); return(null); } MetaTable root = MetaTableCollection.GetWithException(MetaTable.PrimaryRootTable); mt = MetaTableCollection.GetWithException("SPOTFIRELINK_MODEL"); mt = mt.Clone(); // build metatable here mt.Name = "SPOTFIRELINK_" + uo.Id; mt.Code = uo.Content; // store serialized SpotfireLink content in Code field mt.Parent = root; mt.MetaBrokerType = MetaBrokerType.SpotfireLink; mt.TableMap = root.TableMap; // allow searches on CorpId mt.Label = uo.Name; foreach (MetaColumn mc0 in mt.MetaColumns) { mc0.InitialSelection = ColumnSelectionEnum.Hidden; } foreach (SpotfireLinkParameter sp in sl.SpotfireLinkParameters.Values) { mc = mt.GetMetaColumnByName(sp.Name); if (mc == null) { continue; } bool b = false; bool.TryParse(sp.Value, out b); mc.InitialSelection = b ? ColumnSelectionEnum.Selected : ColumnSelectionEnum.Hidden; } if (mt.KeyMetaColumn.InitialSelection != ColumnSelectionEnum.Selected) { mt.KeyMetaColumn.InitialSelection = ColumnSelectionEnum.Unselected; } mc = mt.GetMetaColumnByName("VISUALIZATION"); if (mc != null) { mc.InitialSelection = ColumnSelectionEnum.Selected; } SetAllInQueryInitialCriteria(mt, "invitro_assays", "invitro_assays_default_to_all", "in (ALL_ASSAY_INVITRO_ASSAYS_IN_THIS_QUERY)"); SetAllInQueryInitialCriteria(mt, "insilico_models", "insilico_models_default_to_all", "in (ALL_SPM_INSILICO_MODELS_IN_THIS_QUERY)"); return(mt); }
/// <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 }
/// <summary> /// Open a spotfire link or webplayer url /// Example: https://[server]/SpotfireWeb/ViewAnalysis.aspx?file=/Mobius/Visualizations/MdbAssay_MOBIUS&configurationBlock=CorpId_LIST={1,3,5}; /// Example: https://[server]/SpotfireWeb/ViewAnalysis.aspx?file=/Mobius/Visualizations/SELECT_MOBIUS_DATA_Test&configurationBlock=SQLPARMS="1,3,5,7,9"; /// </summary> /// <param name="link">Open a spotfire link or Webplayer URL </param> /// <param name="browserControl"></param> public static void OpenLink( string link, string title, WebBrowser browserControl) { SpotfireViewProps sl = null; UserObject uo = null; UserObjectType uoType; string url; PopupHtml form; int uoId; if (Lex.IsUndefined(title)) { title = link; } if (Lex.IsUndefined(link)) // prompt for the link to open { string prompt = "Open Spotfire Link "; uo = UserObjectOpenDialog.ShowDialog(UserObjectType.SpotfireLink, prompt); if (uo == null) { return; } link = uo.InternalName; } if (Lex.StartsWith(link, "SPOTFIRELINK_")) // get the link user object { string internalName = link; bool parseOk = UserObject.ParseObjectTypeAndIdFromInternalName(link, out uoType, out uoId); uo = UserObjectDao.Read(uoId); if (uo == null) { throw new Exception("User object not found " + internalName); } sl = SpotfireViewProps.Deserialize(uo.Content); title = uo.Name; url = BuildUrl(sl); if (Lex.IsUndefined(url)) { return; // cancelled } } else { url = link; // assume link is a complete url } if (browserControl == null) // Open the link within a WebBrowser control { form = new PopupHtml(); UIMisc.PositionPopupForm(form); form.Text = title; form.Show(); browserControl = form.WebBrowser; } browserControl.Navigate(url); return; }
/// <summary> /// Setup the control for the specified column and format style /// (Doesn't set the list of specific rules) /// </summary> /// <param name="columnType">MetaColumnType for column</param> public void SetupDataTableAndGrid( SpotfireViewProps svp, CondFormatRules rules) { SVP = svp; Rules = rules; ColoringStyle = rules.ColoringStyle; CondFormatStyle cfStyle = rules.ColoringStyle; DataTable dt = new DataTable(); DataTable = dt; // save ref to table dt.Columns.Add("RuleName", typeof(string)); // column id dt.Columns.Add("Operator", typeof(string)); dt.Columns.Add("Value", typeof(string)); dt.Columns.Add("Value2", typeof(string)); V.Columns[OpCol].Visible = false; // hide operator V.Columns[ValCol].Caption = "Comparison Value"; V.Columns[ValCol].FieldName = "Value"; // restore name V.Columns[ValCol].UnboundType = UnboundColumnType.Bound; // column is bound V.Columns[ValCol2].Visible = true; // show high val V.Columns[ValCol].Width = ValColWidth; V.Columns[ValCol2].Width = ValCol2Width; EnableCfStyleOptions(colorSets: true, colorScales: false, dataBars: false, iconSets: true); // don't allow non-discrete styles string ops = "Equal to|" + "Between|" + ">|" + "<|" + ">=|" + "<=|" + "Not Equal to|" + "Not Between|" + "Any other value|" + "Missing"; if (cfStyle == CondFormatStyle.ColorScale) { ops = "Between"; // only allow between rule V.Columns[ValCol].Caption = "Bottom Color Data Value"; V.Columns[ValCol2].Caption = "Top Color Data Value"; } else // single color (cfStyle == CondFormatStyle.ColorSet { V.Columns[ValCol].Visible = false; V.Columns[ValCol2].Visible = false; } string[] list = ops.Split('|'); RepositoryItemComboBox cb = V.Columns[OpCol].ColumnEdit as RepositoryItemComboBox; if (cb != null) { cb.Items.Clear(); cb.Items.AddRange(list); } dt.Columns.Add("BackColor1", typeof(Color)); dt.Columns.Add("IconImageIdx", typeof(int)); SetColumnVisibilityForColoringStyle(cfStyle); dt.RowChanged += new DataRowChangeEventHandler(DataRowChangeEventHandler); dt.RowDeleted += new DataRowChangeEventHandler(DataRowDeletedEventHandler); return; }