예제 #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();

                // 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);
            }
        }
예제 #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();

                // 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);
            }
        }
예제 #3
0
        /// <summary>
        /// Attach inherited class additional presenters is needed
        /// </summary>
        public void AttachExtraPresenters(CLEMPresenter clemPresenter)
        {
            //UI Results
            try
            {
                ActivityLedgerGridView ledgerView = new ActivityLedgerGridView(clemPresenter.View as ViewBase);
                ReportView             rv         = new ReportView(clemPresenter.View as ViewBase);
                ViewBase reportView = new ViewBase(rv, "ApsimNG.Resources.Glade.DataStoreView.glade");

                Model report = clemPresenter.Model as Model;

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

                DataStorePresenter          dataStorePresenter    = new DataStorePresenter();
                ActivityLedgerGridPresenter activityGridPresenter = new ActivityLedgerGridPresenter();
                Simulation simulation = report.FindAncestor <Simulation>();
                Zone       paddock    = report.FindAncestor <Zone>();

                if (paddock != null)
                {
                    dataStorePresenter.ZoneFilter = paddock;
                }

                if (simulation != null)
                {
                    if (simulation.Parent is Experiment)
                    {
                        dataStorePresenter.ExperimentFilter = simulation.Parent as Experiment;
                    }
                    else
                    {
                        dataStorePresenter.SimulationFilter = simulation;
                    }
                }

                dataStorePresenter.Attach(dataStore, reportView, clemPresenter.ExplorerPresenter);
                activityGridPresenter.CreateHtml     = (clemPresenter.Model as ReportActivitiesPerformed).CreateHTML;
                activityGridPresenter.ModelReport    = report as Report;
                activityGridPresenter.ModelName      = report.Name;
                activityGridPresenter.SimulationName = simulation.Name;
                activityGridPresenter.ZoneName       = paddock.Name;
                activityGridPresenter.Attach(dataStore, ledgerView, clemPresenter.ExplorerPresenter);
                dataStorePresenter.tableDropDown.SelectedValue = report.Name;

                (clemPresenter.View as CLEMView).AddTabView("Display", ledgerView);
                clemPresenter.PresenterList.Add("Display", activityGridPresenter);

                (clemPresenter.View as CLEMView).AddTabView("Data", reportView);
                clemPresenter.PresenterList.Add("Data", dataStorePresenter);
            }
            catch (Exception err)
            {
                this.explorerPresenter.MainPresenter.ShowError(err);
            }
        }
예제 #4
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);
            }
예제 #5
0
        /// <summary>
        /// Attach inherited class additional presenters is needed
        /// </summary>
        public void AttachExtraPresenters(CLEMPresenter clemPresenter)
        {
            object     newView         = new MarkdownView(clemPresenter.View as ViewBase);
            IPresenter labourPresenter = new LabourAllocationPresenter();

            if (newView != null && labourPresenter != null)
            {
                clemPresenter.View.AddTabView("Display", newView);
                labourPresenter.Attach(clemPresenter.Model, newView, clemPresenter.ExplorerPresenter);
                clemPresenter.PresenterList.Add("Display", labourPresenter);
            }
        }
예제 #6
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);
            }
        }
예제 #7
0
 /// <summary>
 /// Attach inherited class additional presenters is needed
 /// </summary>
 public void AttachExtraPresenters(CLEMPresenter clemPresenter)
 {
     //Display
     try
     {
         object     newView         = new MarkdownView(clemPresenter.view as ViewBase);
         IPresenter labourPresenter = new LabourAllocationPresenter();
         if (newView != null && labourPresenter != null)
         {
             clemPresenter.view.AddTabView("Display", newView);
             labourPresenter.Attach(clemPresenter.model, newView, clemPresenter.explorerPresenter);
             clemPresenter.presenterList.Add("Display", labourPresenter);
         }
     }
     catch (Exception err)
     {
         this.explorerPresenter.MainPresenter.ShowError(err);
     }
 }
예제 #8
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);
            }
        }