コード例 #1
0
        /// <summary>
        /// InitializeMapForDev
        /// </summary>
        /// <param name="dm"></param>

        void InitializeMapForDev(DataTableMapMsx dm)
        {
            QueryTable  qt      = null;
            QueryColumn qc      = null;
            string      alias   = "";
            string      colName = "";

            if (dm.ColumnMapCollection != null && dm.ColumnMapCollection.Count > 0)
            {
                return;
            }

            dm.ColumnMapCollection = new ColumnMapCollection();

            DataTableMsx dt = SVP.Doc.DataManager.TableCollection[0];

            dm.SpotfireDataTable = dt;

            foreach (DataColumnMsx dc in dt.Columns)
            {
                colName = dc.Name;
                int i1 = colName.IndexOf(".");
                if (i1 <= 0 || i1 + 1 >= colName.Length)                 // name without alias
                {
                    alias = "T1";
                }

                else
                {
                    alias   = colName.Substring(0, i1);
                    colName = colName.Substring(i1 + 1);
                }

                int qti = Query.GetQueryTableIndexByAlias(alias);
                if (qti < 0)
                {
                    continue;
                }

                qt = Query.Tables[qti];

                qc = qt.GetQueryColumnByLabel(colName);
                if (qc == null)
                {
                    continue;
                }

                ColumnMapMsx cm = new ColumnMapMsx();
                cm.QueryColumn = qc;

                cm.SpotfireColumn = dc;

                cm.SpotfireColumnName = dc.Name;
                cm.Role = dc.Name;

                dm.ColumnMapCollection.Add(cm);
            }

            return;
        }
コード例 #2
0
        internal void SetupColumnsTab()
        {
            QueryColumn  qc  = null;
            ColumnMapMsx map = null;

            AssertMx.IsNotNull(SVP, "ViewManager");
            //AssertMx.IsNotNull(SVP.BaseQuery, "ViewQuery");

            //ColumnsTabSourceQueryControl.Setup(SVM.SVP.DataMap);

            // Id column

            //IdColumnQc = CurrentMap.ColumnMapCollection.GetQueryColumnForSpotfireColumnName(V.IdColumnName);
            //if (IdColumnQc == null)
            //{
            //	IdColumnQc = SVP.BaseQuery.GetFirstMatchingQueryColumn(MetaColumnType.CompoundId, mustBeSelected: true);
            //}
            //IdColumnSelector.Setup(SVP, IdColumnQc, EditValueChanged);

            // Focus Column

            //FocusColumnQc = CurrentMap.ColumnMapCollection.GetQueryColumnForSpotfireColumnName(V.FocusColumnName);
            //if (FocusColumnQc == null)
            //{
            //	FocusColumnQc = SVP.BaseQuery.GetFirstMatchingQueryColumn(MetaColumnType.Structure, mustBeSelected: true);
            //}
            //FocusColumnSelector.Setup(SVP, FocusColumnQc, EditValueChanged);

            // Horizontal & vertical chart setups

            SetupCondFormatRulesFromColorCodingItems(HorizontalGradientBarChartControl, V.SelectedColumns, CondFormatStyle.ColorScale);
            SetupCondFormatRulesFromColorCodingItems(VerticalBarChartControl, V.FeatureColumns, CondFormatStyle.ColorSet);

            return;
        }
コード例 #3
0
		private void DeselectAllItems_Click(object sender, EventArgs e)
		{
			for (int fi = 1; fi < CurrentMap.Count; fi++) // deselect all but first col
			{
				ColumnMapMsx cm = CurrentMap[fi];
				cm.Selected = false;
			}

			UpdateFieldGridDataTable();
		}
コード例 #4
0
		private void SelectAllItems_Click(object sender, EventArgs e)
		{
			for (int fi = 0; fi < CurrentMap.Count; fi++)
			{
				ColumnMapMsx cm = CurrentMap[fi];
				cm.Selected = true;
			}

			UpdateFieldGridDataTable();
		}
コード例 #5
0
		private void SelectDefaultItems_Click(object sender, EventArgs e)
		{
			for (int fi = 0; fi < CurrentMap.Count; fi++)
			{
				ColumnMapMsx cm = CurrentMap[fi];
				MetaColumn mc = cm?.QueryColumn?.MetaColumn;
				if (mc == null) continue;
				cm.Selected = mc.InitialSelection == ColumnSelectionEnum.Selected;
			}

			UpdateFieldGridDataTable();
		}
コード例 #6
0
        /// <summary>
        /// Retrieve Spotfire name for mapped col for display in grid
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>

        private void BandedGridView_CustomColumnDisplayText(object sender, CustomColumnDisplayTextEventArgs e)
        {
            if (!(e.Value is ColumnMapMsx))
            {
                return;
            }

            ColumnMapMsx map = e.Value as ColumnMapMsx;

            e.DisplayText = map.SpotfireColumnName;
            return;
        }
コード例 #7
0
        SortInfoMsx GetSortColumn(
            ColumnSelectorFromQueryMsx selectorCtl,
            CheckEdit ascendingCtl)
        {
            ColumnMapMsx cm = selectorCtl.SelectedColumn;

            if (cm == null)
            {
                return(null);
            }

            SortInfoMsx si = new SortInfoMsx();

            si.DataColumnReference   = cm.SpotfireColumn;
            si.DataColumnReferenceId = cm.SpotfireColumnName;

            si.SortOrder = ascendingCtl.Checked ? SortOrderMsx.Ascending : SortOrderMsx.Descending;

            return(si);
        }
コード例 #8
0
		/// <summary>
		/// Get the Field definitions from the grid
		/// </summary>

		public DataTableMapMsx GetColumnMapList()
		{
			DataTableMapMsx map = new DataTableMapMsx();
			map.ParentMapList = SVP.DataTableMaps;
			DataTableMaps.CurrentMap = map;

			foreach (DataRow dr in FieldDataTable.Rows)
			{
				ColumnMapMsx fli = dr["ColumnMapMsxRefField"] as ColumnMapMsx;
				if (fli == null) continue;

				QueryColumn qc = fli.QueryColumn;
				if (qc == null) continue;

				fli.QueryColumn = qc;
				fli.SpotfireColumnName = dr["SpotfireColNameField"] as string;
				fli.Selected = (bool)dr["SelectedField"]; // not currently used
				CurrentMap.Add(fli);
			}

			return CurrentMap;
		}
コード例 #9
0
        /// <summary>
        /// Get the changed column expression and update the AxisExpression
        /// </summary>

        void DataMapSelectedColumnChanged(
            object sender = null,
            EventArgs e   = null)
        {
            if (InSetup)
            {
                return;
            }

            ColumnMapCollection cml = null;             // DataMapControl?.CurrentMap?.ColumnMapCollection?.GetSelectedColumnMapList();

            if (cml?.ColumnMapList.Count == 0)
            {
                return;                                            // ???
            }
            else if (cml.ColumnMapList.Count > 1)
            {
                cml = cml;                                                                    // more than one col
            }
            ColumnMapMsx cm = cml.ColumnMapList[0];                                           // new selected column

            if (ParsedColExpr.ColumnNames.Count == 0 && ParsedColExpr.AxisExpression != null) // if no cols then add button
            {
                ParsedColExpr.AxisExpression.ColExprList.Add(ParsedColExpr);                  // add to expression list
            }

            ParsedColExpr.ColumnNames = new List <string>();
            ParsedColExpr.ColumnNames.Add(cm.SpotfireColumnName);
            ParsedColExpr.Expression = ParsedColExpr.Format();
            if (ParsedColExpr.AxisExpression != null)
            {
                ParsedColExpr.AxisExpression.Expression = ParsedColExpr.AxisExpression.Format();
            }

            PC.SetupLayoutPanel();

            EditValueChanged();
        }
コード例 #10
0
/// <summary>
/// Get the Field definitions from the grid
/// </summary>

        public ColumnMapCollection GetFields()
        {
            FieldList = new ColumnMapCollection();
            foreach (DataRow dr in FieldDataTable.Rows)
            {
                ColumnMapMsx fli = dr["ColumnMapMsxRefCol"] as ColumnMapMsx;
                if (fli == null)
                {
                    continue;
                }
                QueryColumn qc = fli.QueryColumn;
                if (qc == null)
                {
                    continue;
                }
                fli.QueryColumn   = qc;
                fli.ParameterName = dr["SpotfireColumnName"] as string;
                fli.Selected      = (bool)dr["FieldSelectedCol"];
                FieldList.Add(fli);
            }

            return(FieldList);
        }
コード例 #11
0
        private void Timer_Tick(object sender, EventArgs e0)
        {
            QueryColumn qc;

            if (!Timer.Enabled)
            {
                return;
            }

            Timer.Enabled = false;

            MouseEventArgs e   = LastMouseDownEventArgs;
            Point          p   = new Point(e.X, e.Y);
            GridHitInfo    ghi = FieldGridView.CalcHitInfo(p);

            int ri = ghi.RowHandle;

            if (ri < 0)
            {
                return;
            }
            GridColumn gc = ghi.Column;

            if (gc == null)
            {
                return;
            }
            int c = gc.AbsoluteIndex;

            DataRow      dRow = FieldDataTable.Rows[ri];
            ColumnMapMsx i    = dRow["ColumnMapMsxRefCol"] as ColumnMapMsx;          // currently item

            if (i == null)
            {
                qc = null;
            }
            else
            {
                qc = i.QueryColumn;
            }

            if (Lex.Eq(gc.FieldName, "FieldDatabaseTableCol") || Lex.Eq(gc.FieldName, "FieldDatabaseColumnCol"))
            {
                FieldSelectorControl fieldSelector = new FieldSelectorControl();
                fieldSelector.QueryColumn = qc;

                p = this.PointToScreen(p);

                SelectColumnOptions sco = new SelectColumnOptions();

                sco.ExcludeImages = true;

                sco.FirstTableKeyOnly   = true;
                sco.SelectFromQueryOnly = true;
                sco.IncludeNoneItem     = true;

                DialogResult dr = fieldSelector.SelectColumnFromQuery(Query, fieldSelector.QueryColumn, sco, p.X, p.Y, out qc);
                if (dr != DialogResult.OK)
                {
                    return;
                }

                if (qc != null)
                {
                    if (i == null)
                    {
                        i = new ColumnMapMsx();
                    }
                    i.QueryColumn                  = qc;
                    dRow["FieldSelectedCol"]       = true;
                    dRow["ColumnMapMsxRefCol"]     = i;
                    dRow["FieldDatabaseTableCol"]  = qc.QueryTable.ActiveLabel;
                    dRow["FieldDatabaseColumnCol"] = qc.ActiveLabel;
                    FieldGrid.RefreshDataSource();
                }

                else                 // set to none
                {
                    dRow["ColumnMapMsxRefCol"]    = null;
                    dRow["FieldDatabaseTableCol"] = dRow["FieldDatabaseColumnCol"] = "";
                }

                if (ri == FieldDataTable.Rows.Count - 1)
                {                 // add blank row at end if needed
                    dRow = FieldDataTable.NewRow();
                    FieldDataTable.Rows.Add(dRow);
                }
            }

            //else if (Lex.Eq(gc.FieldName, "EditAxisPropertiesCol"))
            //{
            //  DialogResult dr = AxisOptionsDialog.ShowDialog(ax);
            //  if (dr == DialogResult.OK) Changed = true;
            //}

            return;
        }
コード例 #12
0
        /// <summary>
        /// Build tooltip for data row
        /// </summary>
        /// <param name="dri">Data row index</param>
        /// <returns></returns>

        internal SuperToolTip BuildDataRowTooltip(
            TooltipDimensionDef ttDim,
            int dri)
        {
            ColumnMapMsx cm;
            QueryTable   qt;
            QueryColumn  qc;
            MetaTable    mt;
            MetaColumn   mc;
            int          i1, i2;

            if (BaseQuery == null || BaseQuery.Tables.Count == 0 || Dtm == null)
            {
                return(null);
            }
            qt = BaseQuery.Tables[0];

            SuperToolTip s = new SuperToolTip();

            s.MaxWidth      = 200;
            s.AllowHtmlText = DefaultBoolean.True;

            ToolTipItem i = new ToolTipItem();

            i.AllowHtmlText = DefaultBoolean.True;
            i.Appearance.TextOptions.WordWrap = WordWrap.Wrap;

            ColumnMapCollection cml2 = new ColumnMapCollection();             // list of fields we'll actually display

            int strPos = -1;

            ColumnMapCollection cml = ttDim.Fields;

            if (cml.Count == 0)
            {
                return(s);
            }

            for (i1 = 0; i1 < cml.Count; i1++)
            {
                cm = cml[i1];
                qc = cm.QueryColumn;
                if (qc == null || !cm.Selected)
                {
                    continue;
                }
                //if (qc.IsKey) continue;
                if (qc.MetaColumn.DataType == MetaColumnType.Structure)
                {
                    strPos = i1;
                }

                for (i2 = 0; i2 < cml2.Count; i2++)                 // see if already have the column
                {
                    if (qc == cml2[i2].QueryColumn)
                    {
                        break;
                    }
                }
                if (i2 < cml2.Count)
                {
                    continue;
                }

                cml2.Add(cm);
            }

            if (cml2.Count == 0)
            {
                return(null);                             // no fields
            }
            if (strPos < 0 && ttDim.IncludeStructure)
            {                                  // include str if requested & not already included
                qc     = qt.FirstStructureQueryColumn;
                strPos = cml2.Count;           // put str at end
                //strPos = keyPos + 1; // place str after key
                if (qc != null && qc.Selected) // regular selected Qc?
                {
                    cml2.ColumnMapList.Insert(strPos, ColumnMapMsx.BuildFromQueryColumn(qc));
                }

                else                 // look in root table for a structure
                {
                    mt = qt.MetaTable.Root;
                    if (mt.FirstStructureMetaColumn != null)
                    {
                        qt            = new QueryTable(mt);
                        qc            = new QueryColumn();              // add qc with no vo pos as indicator that must be selected
                        qc.MetaColumn = mt.FirstStructureMetaColumn;
                        qc.Selected   = true;
                        qt.AddQueryColumn(qc);
                        cml2.ColumnMapList.Insert(strPos, ColumnMapMsx.BuildFromQueryColumn(qc));
                    }
                }
            }

            string keyVal = "";

            foreach (ColumnMapMsx fli0 in cml2.ColumnMapList)             // format each field
            {
                qc = fli0.QueryColumn;
                mc = qc.MetaColumn;

                i.Text += "<b>";                 // build label
                if (!Lex.IsNullOrEmpty(fli0.ParameterName))
                {
                    i.Text += fli0.ParameterName;
                }
                else
                {
                    i.Text += fli0.QueryColumn.ActiveLabel;
                }
                i.Text += ": </b>";

                if (qc.VoPosition >= 0)
                {
                    int       ti   = qc.QueryTable.TableIndex;
                    int       dri2 = Dtm.AdjustDataRowToCurrentDataForTable(dri, ti, true);
                    DataRowMx dr   = Qm.DataTable.Rows[dri2];
                    if (dr == null)
                    {
                        continue;
                    }
                    ResultsTable rt         = Rf.Tables[ti];
                    object       fieldValue = dr[qc.VoPosition];
                    if (!NullValue.IsNull(fieldValue))
                    {
                        if (qc.IsKey)
                        {
                            keyVal = fieldValue.ToString();
                        }
                        MobiusDataType     mdt = MobiusDataType.ConvertToMobiusDataType(qc.MetaColumn.DataType, fieldValue);
                        FormattedFieldInfo ffi = Qm.ResultsFormatter.FormatField(qc, mdt);

                        if (mc.DataType != MetaColumnType.Structure)
                        {
                            i.Text += ffi.FormattedText;
                            i.Text += "<br>";
                        }
                        else
                        {
                            i = ToolTipUtil.AppendBitmapToToolTip(s, i, ffi.FormattedBitmap);
                        }
                    }

                    else
                    {
                        i.Text += "<br>";                      // no data
                    }
                }

                else if (!Lex.IsNullOrEmpty(keyVal))                 // select structure from db (may already have)
                {
                    MoleculeMx cs = MoleculeUtil.SelectMoleculeForCid(keyVal, qc.MetaColumn.MetaTable);
                    if (cs != null)
                    {
                        int width = ResultsFormatFactory.QcWidthInCharsToDisplayColWidthInMilliinches(mc.Width, ResultsFormat);
                        FormattedFieldInfo ffi = Qm.ResultsFormatter.FormatStructure(cs, new CellStyleMx(), 's', 0, width, -1);
                        i = ToolTipUtil.AppendBitmapToToolTip(s, i, ffi.FormattedBitmap);
                    }
                }
            }

            if (i.Text.Length > 0)
            {
                s.Items.Add(i);
            }

            if (s.Items.Count == 0)
            {             // show something by default
                i            = new ToolTipItem();
                i.Text       = "No fields selected";
                i.LeftIndent = 6;
                i.Appearance.TextOptions.WordWrap = WordWrap.Wrap;
                s.Items.Add(i);
            }

            //ToolTipTitleItem ti = new ToolTipTitleItem();
            //ti.Text = "Dude";
            //s.Items.Add(ti);

            //ToolTipItem i = new ToolTipItem();
            //i.Text = "Subtext that is fairly long longer longest";
            //i.LeftIndent = 6;
            //i.Appearance.TextOptions.WordWrap = WordWrap.Wrap;
            //s.Items.Add(i);

            //i = new ToolTipItem();
            //Image img = Bitmap.FromFile(@"C:\Mobius_OpenSource\Mobius-3.0\ClientComponents\Resources\Mobius76x76DkBlueBack.bmp");
            //i.Image = img;
            //s.Items.Add(i);

            //ToolTipSeparatorItem si = new ToolTipSeparatorItem();

            return(s);

            //ChartPanel.ToolTipController.ToolTipLocation = ToolTipLocation.TopCenter;
            //ChartPanel.ToolTipController.AllowHtmlText = true;
            //string s = point.SeriesPointID.ToString();
            //s = "This <b>SuperToolTip</b> supports <i>HTML formatting</i>";
        }