// Copyright (C) Stichting Deltares 2018. All rights reserved.
//
// This file is part of Ringtoets.
//
// Ringtoets is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program. If not, see .
//
// All names, logos, and references to "Deltares" are registered trademarks of
// Stichting Deltares and remain full property of Stichting Deltares at all times.
// All rights reserved.
using System;
using System.Collections.Generic;
using System.Drawing;
using System.Linq;
using Core.Common.Controls.DataGrid;
using Ringtoets.AssemblyTool.Data;
using RingtoetsCommonFormsResources = Ringtoets.Common.Forms.Properties.Resources;
namespace Ringtoets.Integration.Forms.Views
{
///
/// This class defines a table in which properties of instances are displayed.
///
/// The type of the enum to display in the table rows.
public class AssemblyCategoriesTable : DataGridViewControl
where T : struct
{
///
/// Creates a new instance of .
///
public AssemblyCategoriesTable()
{
AddColumns();
}
///
/// Sets the given for which the properties
/// are shown in the table.
///
/// The collection of .
public void SetData(IEnumerable> categories)
{
SetDataSource(categories?.Select(category => new AssemblyCategoryRow(category.Item1, category.Item2, category.Item3)).ToArray());
}
private void AddColumns()
{
AddTextBoxColumn(nameof(AssemblyCategoryRow.Group),
RingtoetsCommonFormsResources.AssemblyCategory_Group_DisplayName,
true);
AddColorColumn(nameof(AssemblyCategoryRow.Color),
RingtoetsCommonFormsResources.AssemblyCategory_Color_DisplayName);
AddTextBoxColumn(nameof(AssemblyCategoryRow.LowerBoundary),
RingtoetsCommonFormsResources.AssemblyCategory_LowerBoundary_DisplayName,
true);
AddTextBoxColumn(nameof(AssemblyCategoryRow.UpperBoundary),
RingtoetsCommonFormsResources.AssemblyCategory_UpperBoundary_DisplayName,
true);
}
}
}