Skip to main content

nominal_api/conjure/objects/scout/chartdefinition/api/
value_table_layout_grid.rs

1/// A 2D grid layout for the value table where cells are laid out in specific
2/// rows and columns. Supports hierarchical cell visualisation configurations, favoring when present:
3/// the cell's own definition, then the column's, then the row's, then the panel's.
4#[derive(
5    Debug,
6    Clone,
7    conjure_object::serde::Serialize,
8    conjure_object::serde::Deserialize,
9    conjure_object::private::DeriveWith
10)]
11#[serde(crate = "conjure_object::serde")]
12#[derive_with(PartialEq, Eq, PartialOrd, Ord, Hash)]
13#[conjure_object::private::staged_builder::staged_builder]
14#[builder(crate = conjure_object::private::staged_builder, update, inline)]
15pub struct ValueTableLayoutGrid {
16    #[builder(default, into)]
17    #[serde(rename = "showRowHeaders", skip_serializing_if = "Option::is_none", default)]
18    show_row_headers: Option<bool>,
19    #[builder(default, into)]
20    #[serde(
21        rename = "showColumnHeaders",
22        skip_serializing_if = "Option::is_none",
23        default
24    )]
25    show_column_headers: Option<bool>,
26    #[builder(default, into)]
27    #[serde(rename = "showCellLabels", skip_serializing_if = "Option::is_none", default)]
28    show_cell_labels: Option<bool>,
29    #[builder(custom(type = super::ValueTableMultiCellConfig, convert = Box::new))]
30    #[serde(rename = "gridDefaultCellConfigs")]
31    grid_default_cell_configs: Box<super::ValueTableMultiCellConfig>,
32    #[builder(default, list(item(type = super::ValueTableGridRowColumnConfig)))]
33    #[serde(rename = "columnConfigs", skip_serializing_if = "Vec::is_empty", default)]
34    column_configs: Vec<super::ValueTableGridRowColumnConfig>,
35    #[builder(default, list(item(type = super::ValueTableGridRowColumnConfig)))]
36    #[serde(rename = "rowConfigs", skip_serializing_if = "Vec::is_empty", default)]
37    row_configs: Vec<super::ValueTableGridRowColumnConfig>,
38    #[serde(rename = "rowCount")]
39    row_count: i32,
40    #[serde(rename = "columnCount")]
41    column_count: i32,
42    #[builder(default, list(item(type = super::ValueTableGridValueTableCell)))]
43    #[serde(rename = "cells", skip_serializing_if = "Vec::is_empty", default)]
44    cells: Vec<super::ValueTableGridValueTableCell>,
45}
46impl ValueTableLayoutGrid {
47    /// Constructs a new instance of the type.
48    #[inline]
49    pub fn new(
50        grid_default_cell_configs: super::ValueTableMultiCellConfig,
51        row_count: i32,
52        column_count: i32,
53    ) -> Self {
54        Self::builder()
55            .grid_default_cell_configs(grid_default_cell_configs)
56            .row_count(row_count)
57            .column_count(column_count)
58            .build()
59    }
60    /// If true, display row headers.
61    #[inline]
62    pub fn show_row_headers(&self) -> Option<bool> {
63        self.show_row_headers.as_ref().map(|o| *o)
64    }
65    /// If true, display column headers.
66    #[inline]
67    pub fn show_column_headers(&self) -> Option<bool> {
68        self.show_column_headers.as_ref().map(|o| *o)
69    }
70    /// If true, display channel names in the cells.
71    #[inline]
72    pub fn show_cell_labels(&self) -> Option<bool> {
73        self.show_cell_labels.as_ref().map(|o| *o)
74    }
75    /// Panel-level defaults for cell visualisations
76    #[inline]
77    pub fn grid_default_cell_configs(&self) -> &super::ValueTableMultiCellConfig {
78        &*self.grid_default_cell_configs
79    }
80    /// Column-level configurations.
81    #[inline]
82    pub fn column_configs(&self) -> &[super::ValueTableGridRowColumnConfig] {
83        &*self.column_configs
84    }
85    /// Row-level configurations.
86    #[inline]
87    pub fn row_configs(&self) -> &[super::ValueTableGridRowColumnConfig] {
88        &*self.row_configs
89    }
90    #[inline]
91    pub fn row_count(&self) -> i32 {
92        self.row_count
93    }
94    #[inline]
95    pub fn column_count(&self) -> i32 {
96        self.column_count
97    }
98    /// An array of cells to display in the table.
99    #[inline]
100    pub fn cells(&self) -> &[super::ValueTableGridValueTableCell] {
101        &*self.cells
102    }
103}