Class: Ea::Diagram::DisplayConfig
- Inherits:
-
Object
- Object
- Ea::Diagram::DisplayConfig
- Defined in:
- lib/ea/diagram/display_config.rb
Overview
Models the behavioral display flags from t_diagram.Style and t_diagram.StyleEx. Controls WHAT is rendered (compartments, visibility levels, notes) — distinct from Theme which controls HOW it looks (colors, fonts, stroke widths).
Style (a.k.a. Style1) carries the per-diagram visibility toggles set via the "Features" panel:
HideAtts=1 → hide attribute compartment
HideOps=1 → hide operation compartment
HideStereo=1 → hide stereotype labels
StyleEx carries extended flags including the theme identifier and notes/labels visibility:
Theme=:119 → theme id (consumed by Ea::Theme::Registry)
SuppressFOC=1 → suppress foreign object content (images, OLE)
AttPub=1 → show public attributes
AttPri=1 → show private attributes
AttPro=1 → show protected attributes
ShowNotes=0 → hide element notes
ShowBorder=1 → render diagram frame
HideQuals=0 → show qualifier names
SuppConnLbls=0 → show connector labels
Usage:
config = DisplayConfig.from_style(style: diagram.style,
style_ex: diagram.style_ex)
config.show_attributes? # → false iff Style has HideAtts=1
Constant Summary collapse
- DEFAULT_SHOW_PUBLIC =
"1"- DEFAULT_SHOW_PRIVATE =
"1"- DEFAULT_SHOW_PROTECTED =
"1"- DEFAULT_SHOW_BORDER =
"1"- DEFAULT_SUPPRESS_CONN_LABELS =
"0"- DEFAULT_SHOW_NOTES =
"0"
Instance Attribute Summary collapse
-
#style_ex_flags ⇒ Object
readonly
Returns the value of attribute style_ex_flags.
-
#style_flags ⇒ Object
readonly
Returns the value of attribute style_flags.
Class Method Summary collapse
-
.from_style(style:, style_ex:) ⇒ DisplayConfig
Build a DisplayConfig from the raw Style and StyleEx strings.
-
.from_style_ex(style_ex) ⇒ Object
Backwards-compatible single-arg form: treats the argument as StyleEx.
Instance Method Summary collapse
- #hide_qualifiers? ⇒ Boolean
-
#initialize(style_flags: {}, style_ex_flags: {}) ⇒ DisplayConfig
constructor
A new instance of DisplayConfig.
-
#scale_page_indicators? ⇒ Boolean
Page indicator scaling (Print... → Show Page Breaks).
-
#show_attributes? ⇒ Boolean
---- Feature visibility (Style) ----.
- #show_border? ⇒ Boolean
- #show_connector_labels? ⇒ Boolean
-
#show_connector_names? ⇒ Boolean
Connector role/name labels.
-
#show_constraints? ⇒ Boolean
Constraints compartment (OCL invariants).
-
#show_extended_stereotypes? ⇒ Boolean
Extended stereotype labels (e.g., profile-specific stereotypes beyond UML's standard set).
-
#show_notes? ⇒ Boolean
---- Diagram decorations (StyleEx) ----.
-
#show_operation_parameters? ⇒ Boolean
Operation parameter type list.
- #show_operations? ⇒ Boolean
- #show_private_attributes? ⇒ Boolean
- #show_protected_attributes? ⇒ Boolean
-
#show_public_attributes? ⇒ Boolean
---- Attribute visibility levels (StyleEx) ----.
-
#show_sequence_numbers? ⇒ Boolean
Sequence numbers on elements.
- #show_stereotypes? ⇒ Boolean
-
#show_tagged_values? ⇒ Boolean
Tagged values compartment.
- #suppress_foreign_object_content? ⇒ Boolean
-
#to_style_ex ⇒ Object
Serialize the union of flags back to a StyleEx-shaped string.
-
#use_alias? ⇒ Boolean
Element Alias instead of Name in the header.
Constructor Details
#initialize(style_flags: {}, style_ex_flags: {}) ⇒ DisplayConfig
Returns a new instance of DisplayConfig.
45 46 47 48 |
# File 'lib/ea/diagram/display_config.rb', line 45 def initialize(style_flags: {}, style_ex_flags: {}) @style_flags = style_flags @style_ex_flags = style_ex_flags end |
Instance Attribute Details
#style_ex_flags ⇒ Object (readonly)
Returns the value of attribute style_ex_flags.
43 44 45 |
# File 'lib/ea/diagram/display_config.rb', line 43 def style_ex_flags @style_ex_flags end |
#style_flags ⇒ Object (readonly)
Returns the value of attribute style_flags.
43 44 45 |
# File 'lib/ea/diagram/display_config.rb', line 43 def style_flags @style_flags end |
Class Method Details
.from_style(style:, style_ex:) ⇒ DisplayConfig
Build a DisplayConfig from the raw Style and StyleEx strings. Both are optional; missing strings produce an empty flag set.
56 57 58 59 |
# File 'lib/ea/diagram/display_config.rb', line 56 def self.from_style(style:, style_ex:) new(style_flags: parse_flags(style), style_ex_flags: parse_flags(style_ex)) end |
.from_style_ex(style_ex) ⇒ Object
Backwards-compatible single-arg form: treats the argument as StyleEx. New callers should pass both style: and style_ex:.
63 64 65 |
# File 'lib/ea/diagram/display_config.rb', line 63 def self.from_style_ex(style_ex) from_style(style: nil, style_ex: style_ex) end |
Instance Method Details
#hide_qualifiers? ⇒ Boolean
154 155 156 |
# File 'lib/ea/diagram/display_config.rb', line 154 def hide_qualifiers? style_ex_flags["HideQuals"] == "1" end |
#scale_page_indicators? ⇒ Boolean
Page indicator scaling (Print... → Show Page Breaks).
121 122 123 |
# File 'lib/ea/diagram/display_config.rb', line 121 def scale_page_indicators? style_flags["ScalePI"] == "1" end |
#show_attributes? ⇒ Boolean
---- Feature visibility (Style) ----
69 70 71 |
# File 'lib/ea/diagram/display_config.rb', line 69 def show_attributes? style_flags["HideAtts"] != "1" end |
#show_border? ⇒ Boolean
145 146 147 |
# File 'lib/ea/diagram/display_config.rb', line 145 def show_border? style_ex_flags.fetch("ShowBorder", DEFAULT_SHOW_BORDER) == "1" end |
#show_connector_labels? ⇒ Boolean
149 150 151 152 |
# File 'lib/ea/diagram/display_config.rb', line 149 def show_connector_labels? style_ex_flags.fetch("SuppConnectorLabels", DEFAULT_SUPPRESS_CONN_LABELS) != "1" end |
#show_connector_names? ⇒ Boolean
Connector role/name labels. EA defaults to showing them.
111 112 113 |
# File 'lib/ea/diagram/display_config.rb', line 111 def show_connector_names? style_flags["SuppCN"] != "1" end |
#show_constraints? ⇒ Boolean
Constraints compartment (OCL invariants). Defaults to false.
116 117 118 |
# File 'lib/ea/diagram/display_config.rb', line 116 def show_constraints? style_flags["ShowCons"] == "1" end |
#show_extended_stereotypes? ⇒ Boolean
Extended stereotype labels (e.g., profile-specific stereotypes beyond UML's standard set). EA defaults to showing them.
89 90 91 |
# File 'lib/ea/diagram/display_config.rb', line 89 def show_extended_stereotypes? style_flags["HideEStereo"] != "1" end |
#show_notes? ⇒ Boolean
---- Diagram decorations (StyleEx) ----
141 142 143 |
# File 'lib/ea/diagram/display_config.rb', line 141 def show_notes? style_ex_flags.fetch("ShowNotes", DEFAULT_SHOW_NOTES) == "1" end |
#show_operation_parameters? ⇒ Boolean
Operation parameter type list. When false, EA shows op()
instead of op(name: Type). Defaults to true.
100 101 102 |
# File 'lib/ea/diagram/display_config.rb', line 100 def show_operation_parameters? style_flags["OpParams"] != "0" end |
#show_operations? ⇒ Boolean
73 74 75 |
# File 'lib/ea/diagram/display_config.rb', line 73 def show_operations? style_flags["HideOps"] != "1" end |
#show_private_attributes? ⇒ Boolean
131 132 133 |
# File 'lib/ea/diagram/display_config.rb', line 131 def show_private_attributes? style_ex_flags.fetch("AttPri", DEFAULT_SHOW_PRIVATE) == "1" end |
#show_protected_attributes? ⇒ Boolean
135 136 137 |
# File 'lib/ea/diagram/display_config.rb', line 135 def show_protected_attributes? style_ex_flags.fetch("AttPro", DEFAULT_SHOW_PROTECTED) == "1" end |
#show_public_attributes? ⇒ Boolean
---- Attribute visibility levels (StyleEx) ----
127 128 129 |
# File 'lib/ea/diagram/display_config.rb', line 127 def show_public_attributes? style_ex_flags.fetch("AttPub", DEFAULT_SHOW_PUBLIC) == "1" end |
#show_sequence_numbers? ⇒ Boolean
Sequence numbers on elements. EA defaults to hiding them.
94 95 96 |
# File 'lib/ea/diagram/display_config.rb', line 94 def show_sequence_numbers? style_flags["ShowSN"] == "1" end |
#show_stereotypes? ⇒ Boolean
77 78 79 |
# File 'lib/ea/diagram/display_config.rb', line 77 def show_stereotypes? style_flags["HideStereo"] != "1" end |
#show_tagged_values? ⇒ Boolean
Tagged values compartment. EA defaults to hiding it; the user explicitly opts in via Style1 ShowTags=1.
83 84 85 |
# File 'lib/ea/diagram/display_config.rb', line 83 def show_tagged_values? style_flags["ShowTags"] == "1" end |
#suppress_foreign_object_content? ⇒ Boolean
158 159 160 |
# File 'lib/ea/diagram/display_config.rb', line 158 def suppress_foreign_object_content? style_ex_flags["SuppressFOC"] == "1" end |
#to_style_ex ⇒ Object
Serialize the union of flags back to a StyleEx-shaped string. Style and StyleEx are merged because EA serializes them as one string when round-tripped through some tools.
165 166 167 |
# File 'lib/ea/diagram/display_config.rb', line 165 def to_style_ex style_flags.merge(style_ex_flags).map { |k, v| "#{k}=#{v}" }.join(";") end |
#use_alias? ⇒ Boolean
Element Alias instead of Name in the header. Defaults to false — most diagrams show the Name.
106 107 108 |
# File 'lib/ea/diagram/display_config.rb', line 106 def use_alias? style_flags["UseAlias"] == "1" end |