public ReportElement(DataProvider dataProvider, DataAccumulator dataAccumulator)
        {
            this.DataProvider    = dataProvider;
            this.DataAccumulator = dataAccumulator;

            this.ColumnHeaderText = this.DataProvider.ProposedColumnHeaderText;
        }
        public ReportElementTemplate WithDataAccumulator(DataAccumulator dataAccumulator)
        {
            this.DataAccumulatorTypeName   = dataAccumulator.GetType().GetDisplayName();
            this.DataAccumulatorParameters = dataAccumulator.GetParameterSnapshotWithInnerObjects();

            return(this);
        }
        public ExperimentBase ToExperiment()
        {
            Component environment = EnvironmentRegistry
                                    .GetEnvironments()
                                    .Single(t => t.FullName.Equals(this.EnvironmentTypeName))
                                    .InstantiateWithDefaultConstructor <Component>();

            Component presentationEnvironment = environment.Clone();

            Component agent = AgentRegistry
                              .GetAgents(environment.ComponentType)
                              .Single(t => t.FullName.Equals(this.AgentTypeName))
                              .InstantiateWithDefaultConstructor <Component>();

            ExperimentBase result = ExperimentBase.Instantiate(environment, presentationEnvironment, agent);

            result.SetParametersFromSnapshot(this.ExperimentParameters);
            environment.SetParametersFromSnapshotWithInnerObjects(this.EnvironmentParameters);
            presentationEnvironment.SetParametersFromSnapshotWithInnerObjects(this.EnvironmentParameters);
            agent.SetParametersFromSnapshotWithInnerObjects(this.AgentParameters);

            result.Reporter = this.ReporterTemplate.ToReporter(
                ReportTrigger.GetReportTriggers().ToArray(),
                DataSource.GetDataSources(result).ToArray(),
                DataAccumulator.GetDataAccumulators().ToArray());

            return(result);
        }
        public ReportElement ToReportElement(DataSource[] dataSources, Type[] dataAccumulators)
        {
            DataSource      dataSource      = DataSource.FindDataSource(dataSources, this.DataSourceObjectTypeName);
            DataProvider    dataProvider    = dataSource.ToDataProvider(this.DataSourceObjectFieldName);
            DataAccumulator dataAccumulator = dataAccumulators
                                              .Single(da => da.GetDisplayName().Equals(this.DataAccumulatorTypeName))
                                              .InstantiateWithDefaultConstructor <DataAccumulator>();

            dataAccumulator.SetParametersFromSnapshotWithInnerObjects(this.DataAccumulatorParameters);

            return(new ReportElement(dataProvider, dataAccumulator));
        }
Beispiel #5
0
        private TabPageInfo AddReportFile(string fileName, bool editable)
        {
            TabPage newTabPage = new TabPage(Path.GetFileName(fileName));

            this.reportFilesTabControl.TabPages.Add(newTabPage);

            Button removeReportFileButton = new Button();

            removeReportFileButton.Text     = "Remove this report file";
            removeReportFileButton.AutoSize = true;

            removeReportFileButton.Anchor = AnchorStyles.Bottom | AnchorStyles.Right;

            int rightOffset  = removeReportFileButton.Margin.Right + newTabPage.Padding.Right;
            int bottomOffset = removeReportFileButton.Margin.Bottom + newTabPage.Padding.Bottom;

            removeReportFileButton.Location = new Point(
                newTabPage.Width - removeReportFileButton.Width - rightOffset,
                newTabPage.Height - removeReportFileButton.Height - bottomOffset);

            removeReportFileButton.Tag    = newTabPage;
            removeReportFileButton.Click += new EventHandler(RemoveReportFileButtonClick);

            newTabPage.Controls.Add(removeReportFileButton);

            ReportWriterConfigurationControl reportWriterControl = new ReportWriterConfigurationControl(
                ReportTrigger.GetReportTriggers().ToArray(),
                DataAccumulator.GetDataAccumulators().ToArray(),
                this.Experiment,
                editable);

            reportWriterControl.Dock = DockStyle.Top;

            newTabPage.Controls.Add(reportWriterControl);

            TabPageInfo tabPageInfo = new TabPageInfo()
            {
                FileName            = fileName,
                ReportWriterControl = reportWriterControl
            };

            newTabPage.Tag = tabPageInfo;

            newTabPage.Select();

            return(tabPageInfo);
        }