示例#1
0
        /// <summary>
        /// Render the view by configuring the control for the current view settings
        /// </summary>

        public override void ConfigureRenderingControl()
        {
            if (Qm == null)
            {
                return;
            }

            MoleculeGridControl grid = GridPanel.SelectBaseGridViewGrid(Qm);

            Qm.LinkMember(grid);           // link grid into qm

            DataTableMx dt = Qm.DataTable; // save ref to data table

            grid.DataSource = null;        // clear source for header build
            Qm.DataTable    = dt;          // restore data table in qm

            grid.ShowCheckMarkCol = BaseQuery.ShowGridCheckBoxes;
            grid.FormatGridHeaders(Qm.ResultsFormat);      // qm.MoleculeGrid.V.Columns.Count should be set for proper cols
            grid.Visible = true;                           // now visible

            Qrc.MoleculeGridPageControl = GridPageControl; // link query results to this page

            GridPanel.SetDataSource(Qm, dt);

            ResultsFormatter fmtr = Qm.ResultsFormatter;

            if (fmtr != null && fmtr.FormattingStarted && !fmtr.BrowseExistingResults)              // if already formatting need to start grid display
            {
                grid.StartDisplay();
            }

            ConfigureCount++;
            return;
        }
示例#2
0
        /// <summary>
        /// Display the tool data
        /// </summary>
        /// <param name="qm"></param>
        /// <param name="serializeContentInQuery"></param>

        public static void DisplayDataOld(         // Old version from 1/4/2017
            QueryManager qm,
            MoleculeGridPanel gridPanel,
            bool serializeContentInQuery,
            bool fitDataToGridWidth = false)
        {
            MoleculeGridControl grid = null;

            bool displayAsNormalQueryResults = (gridPanel == null);                                  // if grid panel not defined assume display is in normal results panel
            bool displayAsPopupGrid          = (gridPanel != null && gridPanel.Parent is PopupGrid); // display in popup grid

            Query q = qm.Query;

            q.SetupQueryPagesAndViews();             // be sure we have a default view page

            if (serializeContentInQuery)
            {                                             // no database behind this table so persist within the query
                MetaTable mt = q.Tables[0].MetaTable;     // assume just one metatable
                foreach (MetaColumn mc in mt.MetaColumns) // no criteria allowed
                {
                    mc.IsSearchable = false;
                }

                q.SerializeMetaTablesWithQuery = true;             // if no broker then save the metatable definition
                q.SerializeResultsWithQuery    = true;             // also save results when saving the query
                q.BrowseSavedResultsUponOpen   = true;             // open the results when the query is opened
                q.ResultsDataTable             = qm.DataTable;     // point the query to this results table
            }

            ResultsFormatFactory rff = new ResultsFormatFactory(qm, OutputDest.WinForms);

            rff.Build();                                      // build format
            ResultsFormatter fmtr = new ResultsFormatter(qm); // and formatter

            if (displayAsNormalQueryResults)
            {
                gridPanel = SessionManager.Instance.QueryResultsControl.MoleculeGridPageControl.MoleculeGridPanel;
                QbUtil.AddQuery(qm.Query);                             // add to the list of visible queries
                QueriesControl.Instance.CurrentBrowseQuery = qm.Query; // make it current
            }

            grid = gridPanel.SelectBaseGridViewGrid(qm);

            //if (qm.ResultsFormat.UseBandedGridView)
            //	grid = gridPanel.BandedViewGrid;

            //else grid = gridPanel.LayoutViewGrid;

            qm.MoleculeGrid   = grid;
            grid.QueryManager = qm;

            DataTableMx dt = qm.DataTable;      // save ref to data table

            grid.DataSource = null;             // clear source for header build
            if (fitDataToGridWidth && grid.BGV != null)
            {
                grid.BGV.OptionsView.ColumnAutoWidth = true;                                                     // set view for auto width to fit within view
            }
            grid.FormatGridHeaders(qm.ResultsFormat);
            qm.DataTable = dt;                                 // restore data table

            qm.DataTableManager.SetResultsKeysFromDatatable(); // set the results keys

            if (displayAsNormalQueryResults)
            {
                QbUtil.SetMode(QueryMode.Browse);                 // put into browse mode
            }
            else if (displayAsPopupGrid)
            {
                PopupGrid pug = gridPanel.Parent as PopupGrid;
                pug.Initialize(qm);                 // be sure popup is initialized
                pug.Show();
            }

            gridPanel.Visible = true;
            grid.Visible      = true;
            grid.DataSource   = qm.DataTable;           // set the datasource for the grid to the datatable

            RefreshDataDisplay(qm);

            return;
        }