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(rename = "rowHeaderWidth", skip_serializing_if = "Option::is_none", default)]
21    #[derive_with(with = conjure_object::private::DoubleWrapper)]
22    row_header_width: Option<f64>,
23    #[builder(default, into)]
24    #[serde(
25        rename = "showColumnHeaders",
26        skip_serializing_if = "Option::is_none",
27        default
28    )]
29    show_column_headers: Option<bool>,
30    #[builder(default, into)]
31    #[serde(rename = "showCellLabels", skip_serializing_if = "Option::is_none", default)]
32    show_cell_labels: Option<bool>,
33    #[builder(custom(type = super::ValueTableMultiCellConfig, convert = Box::new))]
34    #[serde(rename = "gridDefaultCellConfigs")]
35    grid_default_cell_configs: Box<super::ValueTableMultiCellConfig>,
36    #[builder(default, list(item(type = super::ValueTableGridRowColumnConfig)))]
37    #[serde(rename = "columnConfigs", skip_serializing_if = "Vec::is_empty", default)]
38    column_configs: Vec<super::ValueTableGridRowColumnConfig>,
39    #[builder(default, list(item(type = super::ValueTableGridRowColumnConfig)))]
40    #[serde(rename = "rowConfigs", skip_serializing_if = "Vec::is_empty", default)]
41    row_configs: Vec<super::ValueTableGridRowColumnConfig>,
42    #[serde(rename = "rowCount")]
43    row_count: i32,
44    #[serde(rename = "columnCount")]
45    column_count: i32,
46    #[builder(default, list(item(type = super::ValueTableGridValueTableCell)))]
47    #[serde(rename = "cells", skip_serializing_if = "Vec::is_empty", default)]
48    cells: Vec<super::ValueTableGridValueTableCell>,
49}
50impl ValueTableLayoutGrid {
51    /// Constructs a new instance of the type.
52    #[inline]
53    pub fn new(
54        grid_default_cell_configs: super::ValueTableMultiCellConfig,
55        row_count: i32,
56        column_count: i32,
57    ) -> Self {
58        Self::builder()
59            .grid_default_cell_configs(grid_default_cell_configs)
60            .row_count(row_count)
61            .column_count(column_count)
62            .build()
63    }
64    /// If true, display row headers.
65    #[inline]
66    pub fn show_row_headers(&self) -> Option<bool> {
67        self.show_row_headers.as_ref().map(|o| *o)
68    }
69    /// The width of the row headers in pixels.
70    #[inline]
71    pub fn row_header_width(&self) -> Option<f64> {
72        self.row_header_width.as_ref().map(|o| *o)
73    }
74    /// If true, display column headers.
75    #[inline]
76    pub fn show_column_headers(&self) -> Option<bool> {
77        self.show_column_headers.as_ref().map(|o| *o)
78    }
79    /// If true, display channel names in the cells.
80    #[inline]
81    pub fn show_cell_labels(&self) -> Option<bool> {
82        self.show_cell_labels.as_ref().map(|o| *o)
83    }
84    /// Panel-level defaults for cell visualisations
85    #[inline]
86    pub fn grid_default_cell_configs(&self) -> &super::ValueTableMultiCellConfig {
87        &*self.grid_default_cell_configs
88    }
89    /// Column-level configurations.
90    #[inline]
91    pub fn column_configs(&self) -> &[super::ValueTableGridRowColumnConfig] {
92        &*self.column_configs
93    }
94    /// Row-level configurations.
95    #[inline]
96    pub fn row_configs(&self) -> &[super::ValueTableGridRowColumnConfig] {
97        &*self.row_configs
98    }
99    #[inline]
100    pub fn row_count(&self) -> i32 {
101        self.row_count
102    }
103    #[inline]
104    pub fn column_count(&self) -> i32 {
105        self.column_count
106    }
107    /// An array of cells to display in the table.
108    #[inline]
109    pub fn cells(&self) -> &[super::ValueTableGridValueTableCell] {
110        &*self.cells
111    }
112}