private void ShowColumnSelectorMenu() { throw new NotImplementedException(); // todo... #if false QueryColumn qc; DataRow dr; ColumnMapMsx colMap; int ri, ci; MouseEventArgs e = LastMouseDownEventArgs; Point p = new Point(e.X, e.Y); BandedGridHitInfo ghi = V.CalcHitInfo(p); ri = ghi.RowHandle; //if (ri < 0) return; BandedGridColumn col = ghi.Column; if (col == null) { return; } ci = col.AbsoluteIndex; if (ci != LabelCol) { return; } qc = null; // existing assignment if (ri != GridControl.NewItemRowHandle) { dr = DataTable.Rows[ri]; string spotfireName = dr[LabelCol] as string; qc = CurrentMap.ColumnMapCollection.GetQueryColumnForSpotfireColumnName(spotfireName); } ColumnSelectorFromQueryMsx csc = new ColumnSelectorFromQueryMsx(); csc.Setup(SVP, qc); csc.Flags.ExcludeNonNumericTypes = true; Point screenLoc = this.PointToScreen(p); QueryColumn qc2 = csc.ShowMenu(screenLoc); if (qc2 == null) { return; } if (ri == GridControl.NewItemRowHandle) // adding row { dr = DataTable.NewRow(); DataTable.Rows.Add(dr); if (IconImage.Visible) { dr[ValCol] = "(Min)"; dr[ValCol2] = "(Max)"; dr[IconImageCol] = Bitmaps.GetImageIndexFromName(ColumnImageCollection, CondFormat.DefaultColorScale); } else { Color[] ca = Bitmaps.GetColorSetByName(Bitmaps.ColorSetImageColors, CondFormat.DefaultColorSet); if (ca != null && ca.Length > 0) { dr[BackColorCol1] = ca[DataTable.Rows.Count % ca.Length]; } } } else { dr = DataTable.Rows[ri]; } colMap = CurrentMap.UpdateColumnMapList(qc2); dr[LabelCol] = colMap.SpotfireColumnName; return; #endif }
/// <summary> /// Add to the content of the rules control /// </summary> /// <param name="rules"></param> public void LoadDataTableFromCondFormatRules( CondFormatRules rules) { DataTable dt = DataTable; DataRow dr; InSetup = true; //bool saveEnabled = dt.EnableDataChangedEventHandlers(false); // turn off change events while filling // Setup for CF coloring style CondFormatStyle colorStyle = rules.ColoringStyle; if (colorStyle == CondFormatStyle.ColorScale) { //ColorStyleDropDown.Text = "Continuous Colors"; ColumnImageCollection = Bitmaps.I.ColorScaleImages; } else if (colorStyle == CondFormatStyle.DataBar) { //ColorStyleDropDown.Text = "Data Bars"; ColumnImageCollection = Bitmaps.I.DataBarsImages; } else if (colorStyle == CondFormatStyle.IconSet) { //ColorStyleDropDown.Text = "Icon Set"; ColumnImageCollection = Bitmaps.I.IconSetImages; } else { //ColorStyleDropDown.Text = "Discrete Colors"; ColumnImageCollection = null; } // Setup rules for color style if (rules == null) { InSetup = false; return; } for (int ri = 0; ri < rules.Count; ri++) // fill in the grid { CondFormatRule r = rules[ri]; dr = dt.NewRow(); dt.Rows.InsertAt(dr, ri); dr[LabelCol] = r.Name; dr[OpCol] = r.Op; dr[ValCol] = r.Value; dr[ValCol2] = r.Value2; dr[BackColorCol1] = r.BackColor1; if (Lex.IsDefined(r.ImageName)) { dr[IconImageCol] = Bitmaps.GetImageIndexFromName(ColumnImageCollection, r.ImageName); } else { dr[IconImageCol] = DBNull.Value; } } RulesGrid.DataSource = dt; // make the data visible //RulesGrid.AddNewRowAsNeeded(); //dt.EnableDataChangedEventHandlers(saveEnabled); InSetup = false; return; }