class Syskit::GUI::ModelViews::Type

Attributes

page[R]
type_rendering[R]

Public Class Methods

new(page) click to toggle source
Calls superclass method
# File lib/syskit/gui/model_views/type.rb, line 8
def initialize(page)
    super()
    @page = page
    @type_rendering = OroGen::HTML::Type.new(page)
end

Public Instance Methods

clear() click to toggle source
# File lib/syskit/gui/model_views/type.rb, line 20
def clear
end
disable() click to toggle source
# File lib/syskit/gui/model_views/type.rb, line 17
def disable
end
enable() click to toggle source
# File lib/syskit/gui/model_views/type.rb, line 14
def enable
end
render(type, options = Hash.new) click to toggle source
# File lib/syskit/gui/model_views/type.rb, line 34
def render(type, options = 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.respond_to?(:proxied_data_services)
            next if (submodel.respond_to?(:private_specialization?) && submodel.private_specialization?) || !submodel.name
            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) click to toggle source
# 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