Exemplo n.º 1
0
        /// <inheritdoc/>
        public void AttachExtraPresenters(CLEMPresenter clemPresenter)
        {
            try
            {
                // Create the grid to display data in
                gridView = new GridView(clemPresenter.View as ViewBase);
                GridPresenter gridPresenter = new GridPresenter();

                // Create the SQL display
                sqlView = new TextInputView(clemPresenter.View as ViewBase);

                // Generate the table using the model
                pivot = clemPresenter.ClemModel as ReportPivot;
                gridPresenter.Attach(null, gridView, clemPresenter.ExplorerPresenter);

                // Attach the views to display data
                clem = clemPresenter.View as CLEMView;

                clem.AddTabView("Data", gridView);
                clemPresenter.PresenterList.Add("Data", this);

                clem.AddTabView("SQL", sqlView);
                clemPresenter.PresenterList.Add("SQL", this);
            }
            catch (Exception err)
            {
                clemPresenter.ExplorerPresenter.MainPresenter.ShowError(err);
            }
        }
Exemplo n.º 2
0
        /// <inheritdoc/>
        public void AttachExtraPresenters(CLEMPresenter clemPresenter)
        {
            try
            {
                // Create the grid to display data in
                gridView = new GridView(clemPresenter.view as ViewBase);
                GridPresenter gridPresenter = new GridPresenter();

                // Generate the table using the model
                pivot = clemPresenter.clemModel as ReportPivot;
                gridView.DataSource = pivot.GenerateTable();
                gridPresenter.Attach(null, gridView, clemPresenter.explorerPresenter);

                // Attach the view to display data

                clem = clemPresenter.view as CLEMView;
                clem.AddTabView("Data", gridView);
                clemPresenter.presenterList.Add("Data", this);

                //clem.TabSelected += Refresh;
            }
            catch (Exception err)
            {
                clemPresenter.explorerPresenter.MainPresenter.ShowError(err);
            }
        }
Exemplo n.º 3
0
        /// <inheritdoc/>
        public void AttachExtraPresenters(CLEMPresenter clemPresenter)
        {
            try
            {
                bool   parentOfReport = false;
                Report report         = clemPresenter.Model as Report;
                if (report is null)
                {
                    report         = clemPresenter.Model.FindChild <Report>();
                    parentOfReport = true;
                }

                rv = new ReportView(clemPresenter.View as ViewBase);
                ViewBase reportView = new ViewBase(rv, "ApsimNG.Resources.Glade.DataStoreView.glade");

                dataStorePresenter = new DataStorePresenter(new string[] { (parentOfReport)? (clemPresenter.Model as IModel).Name:report.Name });

                Simulations simulations = report.FindAncestor <Simulations>();
                if (simulations != null)
                {
                    dataStore = simulations.FindChild <IDataStore>();
                }

                Simulation simulation = report.FindAncestor <Simulation>();
                Experiment experiment = report.FindAncestor <Experiment>();
                Zone       paddock    = report.FindAncestor <Zone>();

                IModel zoneAnscestor = report.FindAncestor <Zone>();

                // Only show data which is in scope of this report.
                // E.g. data from this zone and either experiment (if applicable) or simulation.
                if (paddock != null)
                {
                    dataStorePresenter.ZoneFilter = paddock;
                }
                if (zoneAnscestor is null & experiment != null)
                {
                    // allows the inner reports of the base simulation to be displayed
                    // when an experiment is being undertaken
                    // otherwise reports are considered child of experiment and will only display experiment results.
                    dataStorePresenter.ExperimentFilter = experiment;
                }
                else if (simulation != null)
                {
                    dataStorePresenter.SimulationFilter = simulation;
                }

                dataStorePresenter.Attach(dataStore, reportView, clemPresenter.ExplorerPresenter);

                // Attach the view to display data
                clem = clemPresenter.View as CLEMView;
                clem.AddTabView("Data", reportView);
                clemPresenter.PresenterList.Add("Data", this);
            }
Exemplo n.º 4
0
        /// <inheritdoc/>
        public void AttachExtraPresenters(CLEMPresenter clemPresenter)
        {
            try
            {
                Report report = clemPresenter.model as Report;

                ReportView rv         = new ReportView(clemPresenter.view as ViewBase);
                ViewBase   reportView = new ViewBase(rv, "ApsimNG.Resources.Glade.DataStoreView.glade");

                DataStorePresenter dataStorePresenter = new DataStorePresenter(new string[] { report.Name });

                Simulations simulations = report.FindAncestor <Simulations>();
                if (simulations != null)
                {
                    dataStore = simulations.FindChild <IDataStore>();
                }

                Simulation simulation = report.FindAncestor <Simulation>();
                Experiment experiment = report.FindAncestor <Experiment>();
                Zone       paddock    = report.FindAncestor <Zone>();

                // Only show data which is in scope of this report.
                // E.g. data from this zone and either experiment (if applicable) or simulation.
                if (paddock != null)
                {
                    dataStorePresenter.ZoneFilter = paddock;
                }

                if (experiment != null)
                {
                    dataStorePresenter.ExperimentFilter = experiment;
                }
                else if (simulation != null)
                {
                    dataStorePresenter.SimulationFilter = simulation;
                }

                dataStorePresenter.Attach(dataStore, reportView, clemPresenter.explorerPresenter);

                // Attach the view to display data
                clem = clemPresenter.view as CLEMView;
                clem.AddTabView("Data", reportView);
                clemPresenter.presenterList.Add("Data", this);

                //clem.TabSelected += Refresh;
            }
            catch (Exception err)
            {
                clemPresenter.explorerPresenter.MainPresenter.ShowError(err);
            }
        }
Exemplo n.º 5
0
        /// <inheritdoc/>
        public void AttachExtraPresenters(CLEMPresenter clemPresenter)
        {
            try
            {
                clem  = clemPresenter.View as CLEMView;
                query = clemPresenter.ClemModel as ReportQuery;

                var store = query.FindInScope <IDataStore>();

                // Create the Data presenter
                gridView = new GridView(clemPresenter.View as ViewBase);

                var gridPresenter = new GridPresenter();
                gridPresenter.Attach(null, gridView, clemPresenter.ExplorerPresenter);

                // Attach the tab
                clem.AddTabView("Data", gridView);
                clemPresenter.PresenterList.Add("Data", this);
            }
            catch (Exception err)
            {
                clemPresenter.ExplorerPresenter.MainPresenter.ShowError(err);
            }
        }