示例#1
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="gridPanel"></param>
        /// <param name="qm"></param>

        public static void DisplayData(
            MoleculeGridPanel gridPanel,
            QueryManager qm)
        {
            if (gridPanel == null)             // if grid panel not defined assume display is in normal results panel
            {
                gridPanel = SessionManager.Instance.QueryResultsControl.MoleculeGridPageControl.MoleculeGridPanel;
                QbUtil.SetMode(QueryMode.Browse);                 // put into browse mode
            }

            else if (gridPanel.Parent is PopupGrid)             // display in popup grid
            {
                PopupGrid pug = gridPanel.Parent as PopupGrid;
                pug.Initialize(qm);                 // be sure popup is initialized
                WindowsHelper.FitFormOnScreen(pug);
                pug.Show();
            }

            MoleculeGridControl grid = qm.MoleculeGrid;

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

            RefreshDataDisplay(qm);
        }
示例#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;
        }