Exemplo n.º 1
0
        /// <summary>
        /// Allocate a new MoleculeGridPageControl
        /// and link into any associated QueryResultsContol
        /// </summary>
        /// <param name="qm"></param>
        /// <param name="container"></param>
        /// <returns></returns>

        public static MoleculeGridPageControl AllocateNewMoleculeGridPageControl(
            QueryManager qm,
            Control container)
        {
            QueryResultsControl     qrc = null;
            PopupGrid               pug = null;
            MoleculeGridPageControl page;
            MoleculeGridPanel       panel;
            MoleculeGridControl     grid;

            Query         q  = qm.Query;
            ResultsFormat rf = qm.ResultsFormat;

            page = new MoleculeGridPageControl();             // Create a new, clean page, panel and grids

            panel = page.MoleculeGridPanel;
            grid  = panel.SelectBaseGridViewGrid(qm);
            qm.LinkMember(grid);             // link grid into qm
            grid.ShowCheckMarkCol = q.ShowGridCheckBoxes;

            if (container is QueryResultsControl && rf.NotPopupOutputFormContext)             // normal query results
            {
                qrc = container as QueryResultsControl;
                qrc.RemoveExistingControlsFromResultsPageControlContainer(); // properly dispose of any existing DevExpress controls

                qrc.MoleculeGridPageControl = page;                          // link query results to this page
                qrc.ResultsPageControlContainer.Controls.Add(page);
                page.Dock = DockStyle.Fill;
            }

            return(page);
        }
Exemplo n.º 2
0
/// <summary>
/// Configure the results page control for the current page
/// </summary>
/// <param name="qrc"></param>
/// <param name="page"></param>
/// <returns></returns>

        static internal ResultsPageControl Configure(
            QueryResultsControl qrc,
            ResultsPage page)
        {
            qrc.RemoveExistingControlsFromResultsPageControlContainer(); // properly dispose of any existing DevExpress controls

            ResultsPageControl rpc = new ResultsPageControl();           // page control with common tools and display area

            qrc.ResultsPageControl = rpc;                                // link the QueryResultsControl to rpc
            rpc.ResultsPage        = page;                               // set the page that the rpc references

            PanelControl     commonTools = rpc.Tools;                    // the array of common tools
            ResultsPagePanel rpp         = rpc.ResultsPagePanel;         // panel containing the display, filters and DoD panels

            page.ResultsPagePanel = rpp;

            //PanelControl rppc = qrc.ResultsPageControlContainer; // panel that contains the dock panels and rendering controls for the associated page views (1 per dock panel)
            //QueryResultsControl.DisposeOfChildMobiusControls(rppc); // properly dispose of any existing DevExpress controls
            //rppc.Controls.Clear(); // clear the view while building

            PanelControl rppc = qrc.ResultsPageControlContainer; // panel that contains the dock panels and rendering controls for the associated page views (1 per dock panel)

            rpp.Location = new Point(0, 0);                      // make the rpp the same size as rppc before adding it to avoid a resize
            rpp.Size     = rppc.Size;
            rpp.Visible  = false;                                // don't make visible until later
            rpp.Parent   = rppc;                                 // associate to parent before added to parent

            ViewsPanel viewsPanel = rpp.ViewsPanel;              // Views DockPanels and their contained rendering controls go in here

            Query q = qrc.CrvQuery;                              // be sure we have a base QM

            if (q != null)
            {             // be sure the QueryManager is complete
                QueryManager qm = q.QueryManager as QueryManager;

                if (qm == null)                 // allocate query manager if needed
                {
                    qm             = new QueryManager();
                    q.QueryManager = qm;
                    qm.LinkMember(q);
                }

                qm.CompleteInitialization(OutputDest.WinForms); // be sure QueryManager is complete
                qm.LinkMember(qrc);                             // be sure qrc is linked to qm
            }

            ////rpp.SuspendLayout();
            ////rppc.Controls.Add(rpp); // add the results page panel to the page container panel (needed to look up control tree to get Qrc)

            if (page.ShowFilterPanel)
            {
                rpp.RenderFilterPanel();
                rpp.FiltersDockPanel.Visibility = DockVisibility.Visible;
            }
            else
            {
                rpp.FiltersDockPanel.Visibility = DockVisibility.Hidden;
            }

            if (page.ShowDetailsOnDemand)
            {
                rpp.RenderDetailsOnDemandPanel();
                rpp.DodDockPanel.Visibility = DockVisibility.Visible;
            }
            else
            {
                rpp.DodDockPanel.Visibility = DockVisibility.Hidden;
            }

            bool showBeforeLayout = (page.Views.Count == 1 && page.Views[0].ViewType == ResultsViewType.Spotfire);

            if (showBeforeLayout)
            {
                rpp.Visible = true;
                rppc.Controls.Add(rpp);                 // add the results page panel to the page container panel
                rpp.Dock = DockStyle.Fill;
                rpp.ViewsPanel.LayoutAndRenderViews();  // add the data views
            }

            else                                       // layout before showing
            {
                rpp.ViewsPanel.LayoutAndRenderViews(); // add the data views
                rpp.Visible = true;
                rppc.Controls.Add(rpp);                // add the results page panel to the page container panel
            }

            ////rpp.ResumeLayout();

            rpp.ViewsPanel.FocusActiveView();

            return(rpc);
        }
Exemplo n.º 3
0
        /// <summary>
        /// Format grid and show the data
        /// </summary>
        /// <param name="qm"></param>
        /// <param name="container">Either a QueryResultsControl or a PopupGrid</param>

        public static void ConfigureAndShow(
            QueryManager qm,
            Control container)
        {
            QueryResultsControl     qrc = null;
            PopupGrid               pug = null;
            MoleculeGridPageControl page;
            MoleculeGridPanel       panel;
            MoleculeGridControl     grid;

            Query         q  = qm.Query;
            ResultsFormat rf = qm.ResultsFormat;

            //qm.QueryResultsControl = null;

            page = new MoleculeGridPageControl();             // Create a new, clean page, panel and grids

            panel = page.MoleculeGridPanel;
            grid  = panel.SelectBaseGridViewGrid(qm);
            qm.LinkMember(grid);             // link grid into qm
            grid.ShowCheckMarkCol = q.ShowGridCheckBoxes;

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

            grid.DataSource = null;                                               // clear source for header build
            qm.DataTable    = dt;                                                 // restore data table
            grid.FormatGridHeaders(qm.ResultsFormat);                             // qm.MoleculeGrid.V.Columns.Count should be set for proper cols

            if (container is QueryResultsControl && rf.NotPopupOutputFormContext) // normal query results
            {
                qrc = container as QueryResultsControl;
                qrc.RemoveExistingControlsFromResultsPageControlContainer(); // properly dispose of any existing DevExpress controls

                qrc.MoleculeGridPageControl = page;                          // link query results to this page
                qrc.ResultsPageControlContainer.Controls.Add(page);
                page.Dock = DockStyle.Fill;
                //qm.QueryResultsControl = qrc; // link view set into query manager (used for filtering)

                if (q.Parent == null)                 // switch display to browse mode if root query
                {
                    QbUtil.SetMode(QueryMode.Browse, q);
                }

                if (rf.Query.LogicType == QueryLogicType.And)                 // log grid query by logic type
                {
                    UsageDao.LogEvent("QueryGridAnd", "");
                }
                else if (rf.Query.LogicType == QueryLogicType.Or)
                {
                    UsageDao.LogEvent("QueryGridOr", "");
                }
                else if (rf.Query.LogicType == QueryLogicType.Complex)
                {
                    UsageDao.LogEvent("QueryGridComplex", "");
                }
            }

            else if (container is PopupGrid || rf.PopupOutputFormContext)             // popup results
            {
                if (container is PopupGrid)
                {
                    pug = container as PopupGrid;
                }

                else                 // create a popup
                {
                    pug      = new PopupGrid(qm);
                    pug.Text = q.UserObject.Name;
                }

                if (pug.Controls.ContainsKey(panel.Name))                 // remove any existing panel control
                {
                    pug.Controls.RemoveByKey(panel.Name);
                }
                pug.Controls.Add(panel);
                pug.MoleculeGridPanel = panel;                 // restore direct link as well

                grid.ScaleView(q.ViewScale);
                UIMisc.PositionPopupForm(pug);
                pug.Text = q.UserObject.Name;
                pug.Show();
            }

            else
            {
                throw new Exception("Invalid container type: " + container.GetType());
            }

            // Set the DataSource to the real DataTable

            panel.SetDataSource(qm, dt);

            return;
        }