public VisualizerSettingsDialog(DataQueryResult result, VisualizerSettingsCollection settings)
        {
            this.result   = result;
            this.settings = settings;

            Initialize();
        }
Ejemplo n.º 2
0
        public override void Initialize(DataQueryResult query, VisualizerSettingsCollection settings, bool preserveSort = true)
        {
            if (query == null)
            {
                throw new ArgumentNullException("query");
            }
            if (settings == null)
            {
                throw new ArgumentNullException("settings");
            }

            try {
                if (initializing)
                {
                    return;
                }

                initializing    = true;
                initialized     = false;
                currentSettings = settings.GetSettings <TableVisualizerSettings> () ?? new TableVisualizerSettings();
                skip            = new List <DbField> (currentSettings.SkippedColumns);

                if (dataQueryResult != null)
                {
                    dataQueryResult.Result.ListChanged -= OnModelListChanged;
                }

                dataQueryResult = query;
                if (model != null && preserveSort)
                {
                    dataQueryResult.Result.Sort(model.SortColumn);
                }
                dataQueryResult.Result.ListChanged += OnModelListChanged;

                LazyTableModel oldModel = model;
                model              = dataQueryResult.Result;
                model.SortChanged += sortModel_SortChanged;

                if (oldModel != null && !ReferenceEquals(oldModel, model))
                {
                    oldModel.SortChanged -= sortModel_SortChanged;
                    oldModel.Dispose();
                }

                listReset        = true;
                listChangedRized = false;
                if (!dataQueryResult.Result.Start())
                {
                    // Already started and possibly finished
                    OnModelListChanged(query.Result, new ListChangedEventArgs(ListChangedType.Reset, query.Result.Count - 1));
                }
                else
                {
                    SwitchToWidget(imgLoading);
                }
            } finally {
                initializing = false;
            }
        }
Ejemplo n.º 3
0
        public object Clone()
        {
            VisualizerSettingsCollection ret = new VisualizerSettingsCollection();

            foreach (VisualizerSettingsWraper wraper in this)
            {
                ret.Add((VisualizerSettingsWraper)wraper.Clone());
            }
            ret.isDirty = isDirty;

            return(ret);
        }
Ejemplo n.º 4
0
        public override bool SaveSettings(VisualizerSettingsCollection settings)
        {
            if (settings == null)
            {
                throw new ArgumentNullException("settings");
            }

            UpdateCurrentSettings();
            settings.SetSettings(currentSettings);

            return(true);
        }
Ejemplo n.º 5
0
        public override bool LoadSettings(DataQueryResult result, VisualizerSettingsCollection settings)
        {
            if (result == null)
            {
                throw new ArgumentNullException("result");
            }
            if (settings == null)
            {
                throw new ArgumentNullException("settings");
            }
            if (initialized)
            {
                throw new ApplicationException("The settings are already initialized");
            }

            TableVisualizerSettings tableSettings = settings.GetSettings <TableVisualizerSettings> () ?? new TableVisualizerSettings();

            chkShowTotals.Active = tableSettings.ShowTotals;
            List <DbField> skip = new List <DbField> (tableSettings.SkippedColumns);

            for (uint i = 0; i < result.Columns.Length; i++)
            {
                string  columnName  = ReportProvider.GetReportFieldColumnName(result, (int)i);
                DbField columnField = result.Columns [i].Field;

                CheckButton btn = new CheckButton(columnName);
                tblColumns.Attach(btn, 0, 1, i, i + 1,
                                  AttachOptions.Expand | AttachOptions.Fill | AttachOptions.Shrink,
                                  AttachOptions.Fill, 0, 0);
                btn.Active = !skip.Contains(columnField);
                btn.Show();
                buttons.Add(new KeyValuePair <CheckButton, DbField> (btn, columnField));
            }

            currentSettings = tableSettings;
            initialized     = true;

            return(true);
        }
Ejemplo n.º 6
0
 public abstract bool SaveSettings(VisualizerSettingsCollection settings);
Ejemplo n.º 7
0
 public abstract bool LoadSettings(DataQueryResult result, VisualizerSettingsCollection settings);
 public abstract void Initialize(DataQueryResult query, VisualizerSettingsCollection settings, bool preserveSort = true);