Cell representations
In a table view in the Syside VS Code Extension, each column shows one aspect of the element its navigation chain reaches, such as its name, its documentation or its value. That aspect is the column’s representation, and it is the same for every cell in the column.
A column sets its representation in its
featureRepresentation attribute, using a value from the
SysideViews::Representation enumeration (short name ColRep):
Representation |
Description |
Writable |
|---|---|---|
|
The element name exactly as written in the source model. |
✗ |
|
The short name as written in the source model (the |
✗ |
|
The semantically resolved name of the element (may differ from |
✗ |
|
The semantically resolved short name of the element. |
✗ |
|
The fully qualified name of the element, including all enclosing namespaces. The default. |
✗ |
|
All documentation blocks on the element, concatenated in declaration order. |
✗ |
|
The declared direction of a feature ( |
✗ |
|
The value of the target element itself. The chain must land on a feature. |
✓ |
|
A single named or unnamed documentation block, selected by
|
✓ |
|
The language-specific textual body of the target element, such as the
|
✓ |
Any representation can follow any chain: the same ColRep::name column renders the
row element, its owner, or each fanned-out port, depending only on columnFeature.
Representation parameters
Two representations take a parameter that selects which value to show:
Parameter |
Representation |
What it represents |
|---|---|---|
|
|
The name of the documentation block to show. |
|
|
The language of the textual body to show. An empty |
Because featureRepresentation subsets a ColRep member, the parameter is set by
redefining it inside the block:
view Rationale :> columnViews {
attribute :>> featureRepresentation :> ColRep::specificDocumentation {
attribute :>> documentationName = "rationale";
}
}
Cell outcomes
Every cell ends up in one of four states, which decide what it shows and whether it can be edited. Rows, columns and cells explains where they come from.
Outcome |
Shown |
Editable |
|---|---|---|
Value found |
The rendered value: the chain reached an element and the representation found a value on it. |
Per the editability rules. |
Applicable, no value |
The column’s |
Yes, when the representation is writable. |
Not applicable |
The column’s |
Never. |
Truncated |
The first element found, with a warning note: a |
Never. |
Editable representations
A cell can be edited inline when two things hold: the representation is writable
(featureValue, specificDocumentation, or 'language'), and the column’s
chain resolved to exactly one target for that row. Cells in List columns are
always read-only, as are not-applicable and truncated cells.
specificDocumentation and 'language' cells edit as free text.
featureValue is writable when the target is an attribute usage. For other feature
kinds, such as parts and ports, the value is read-only. For a writable attribute,
the column picks an editor based on the attribute’s declared type. If the type is not
explicit, it is inferred from existing values. The following types are supported:
Attribute type |
Editor behavior |
|---|---|
Enumeration |
Single-select dropdown listing the literals of the attribute’s declared enumeration. |
Enumeration (multiplicity upper bound above 1) |
Multi-select dropdown with the same literal list. See Single-select versus multi-select dropdowns. |
Boolean |
Dropdown with |
String |
Free-text input. |
Numeric |
Numeric input. |
Quantities from the SI standard library are read-only and display without their
unit.
A new featureValue is bound with default in a definition and with = in a usage.
An existing binding keeps its keyword.
Missing attributes
A featureValue column can also create an attribute that does not exist yet. This
works when the column’s last step looks up an attribute by name:
:>> columnFeature = NamedUsage(
baseViewElement, "priority", NameType::name, UsageKind::attributeUsage
);
For a row whose element has no priority attribute, the cell shows defaultValue
and can still be edited. Saving a value adds a priority attribute to the element
the step started from, which is the row’s element in this one-step chain. With
NameType::shortName, the new attribute gets priority as its short name instead.
The cell stays read-only, and nothing is created, when:
An earlier step found no element.
A
Firststep found more than one element.An earlier step crossed an inheritance boundary (see Inherited values).
Single-select versus multi-select dropdowns
Whether an enumeration column renders a single-select or a multi-select dropdown is
decided by the attribute declaration in the model, not by the view. The attribute’s
declared multiplicity is what matters. With the default multiplicity of one, the cell
edits as a single-select dropdown. Declare an upper bound above one, or an unbounded
multiplicity such as [0..*], and the same column renders a multi-select dropdown:
enum def Category { safety; performance; usability; }
requirement def MaxAltitude {
attribute mainCategory : Category; // single-select dropdown
attribute categories : Category [0..*]; // multi-select dropdown
}
Selected literals from a multi-select cell are written back as a collection value, for
example (Category::safety, Category::usability). If the attribute declares no
multiplicity of its own, the multiplicity is inherited from the attribute it redefines.
Inherited values
Navigating usage features (the Usage and RequirementConstraints families and
NamedUsage) includes inherited features, and inherited cells are marked as such in
the UI. Editing rules differ by representation:
A
featureValuecell whose final step landed on an inherited attribute stays editable. Saving writes a redefinition of the attribute onto the element the final step started from, the row’s element for a one-step chain, and leaves the base untouched. If the base bound the value with=rather thandefault, the cell is read-only.A
'language'orspecificDocumentationcell is read-only whenever its chain crossed an inheritance boundary anywhere, and so is afeatureValuecell whose chain crossed one before the final step. To make such a cell editable, redefine the constraint or documentation in the row’s element.Steps that move to another element, such as
HeritageFirst,DefinitionsFirstandOwner, do not count as crossing inheritance. This chain edits the base element directly:NamedUsage(HeritageFirst(baseViewElement), "x", NameType::name)
What an edit writes explains why the rules differ.