Class: Syskit::GUI::ModelViews::Type
- Defined in:
- lib/syskit/gui/model_views/type.rb
Instance Attribute Summary collapse
-
#page ⇒ Object
readonly
Returns the value of attribute page.
-
#type_rendering ⇒ Object
readonly
Returns the value of attribute type_rendering.
Instance Method Summary collapse
- #clear ⇒ Object
- #disable ⇒ Object
- #enable ⇒ Object
-
#initialize(page) ⇒ Type
constructor
A new instance of Type.
- #render(type, options = Hash.new) ⇒ Object
- #render_port_list(content) ⇒ Object
Constructor Details
Instance Attribute Details
#page ⇒ Object (readonly)
Returns the value of attribute page
5 6 7 |
# File 'lib/syskit/gui/model_views/type.rb', line 5 def page @page end |
#type_rendering ⇒ Object (readonly)
Returns the value of attribute type_rendering
6 7 8 |
# File 'lib/syskit/gui/model_views/type.rb', line 6 def type_rendering @type_rendering end |
Instance Method Details
#clear ⇒ Object
20 21 |
# File 'lib/syskit/gui/model_views/type.rb', line 20 def clear end |
#disable ⇒ Object
17 18 |
# File 'lib/syskit/gui/model_views/type.rb', line 17 def disable end |
#render(type, options = Hash.new) ⇒ Object
34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 |
# File 'lib/syskit/gui/model_views/type.rb', line 34 def render(type, = Hash.new) type_rendering.render(type) producers, consumers = Set.new, Set.new [Syskit::Component,Syskit::DataService].each do |base_model| base_model.each_submodel do |submodel| next if submodel.placeholder? submodel.each_output_port do |port| if port.type.name == type.name producers << [page.link_to(submodel), port.name] end end submodel.each_input_port do |port| if port.type.name == type.name consumers << [page.link_to(submodel), port.name] end end end end fragment = render_port_list(producers.to_a.sort) page.push('Producers', fragment) fragment = render_port_list(consumers.to_a.sort) page.push('Consumers', fragment) end |
#render_port_list(content) ⇒ Object
23 24 25 26 27 28 29 30 31 32 |
# File 'lib/syskit/gui/model_views/type.rb', line 23 def render_port_list(content) template = <<-EOHTML <ul class="body-header-list"> <% content.each do |model, port| %> <li><b><%= model %></b>.<%= port %> <% end %> </ul> EOHTML ERB.new(template).result(binding) end |