Class: Syskit::GUI::ModelViews::DataService

Inherits:
Component show all
Defined in:
lib/syskit/gui/model_views/data_service.rb

Constant Summary

Constants inherited from ComponentNetworkBaseView

ComponentNetworkBaseView::Button, ComponentNetworkBaseView::DATA_SERVICE_WITHOUT_NAMES_TEMPLATE, ComponentNetworkBaseView::DATA_SERVICE_WITH_NAMES_TEMPLATE

Instance Attribute Summary

Attributes inherited from Component

#interface_options

Attributes inherited from ComponentNetworkBaseView

#current_model, #page, #plan

Instance Method Summary collapse

Methods inherited from Component

#render_doc

Methods inherited from ComponentNetworkBaseView

#buttonClicked, #clear, common_graph_buttons, #compute_system_network, #disable, #enable, find_definition_place, graph_annotation_buttons, html_defined_in, #instanciate_model, make_annotation_buttons, #push_plan, #render_require_section, #save_svg, task_annotation_buttons

Constructor Details

#initialize(page) ⇒ DataService

Returns a new instance of DataService



4
5
6
7
8
9
# File 'lib/syskit/gui/model_views/data_service.rb', line 4

def initialize(page)
    super(page)
    buttons = Array.new
    buttons.concat(self.class.common_graph_buttons('interface'))
    interface_options[:buttons] = buttons
end

Instance Method Details

#list_services(task) ⇒ Object



11
12
13
14
15
16
17
18
19
# File 'lib/syskit/gui/model_views/data_service.rb', line 11

def list_services(task)
    services = super
    services.first.last.shift
    if services.first.last.empty?
        Array.new
    else
        services
    end
end

#render(model, options = Hash.new) ⇒ Object



21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
# File 'lib/syskit/gui/model_views/data_service.rb', line 21

def render(model, options = Hash.new)
    super

    providers = Array.new
    Syskit::TaskContext.each_submodel do |component_m|
        next if component_m.placeholder?
        if component_m.fullfills?(model)
            providers << [component_m.name, component_m]
        end
    end
    Syskit::Composition.each_submodel do |composition_m|
        next if composition_m.placeholder?
        next if composition_m.is_specialization?
        if composition_m.fullfills?(model)
            providers << [composition_m.name, composition_m]
        else
            composition_m.specializations.each_specialization do |spec|
                if spec.composition_model.fullfills?(model)
                    providers << [spec.to_s, composition_m.root_model]
                end
            end
        end
    end

    providers = providers.sort_by(&:first).
        map do |name, model|
            page.link_to(model, name)
        end
    page.render_list("Provided By", providers)
end

#render_data_services(task, with_names = false) ⇒ Object



52
53
54
# File 'lib/syskit/gui/model_views/data_service.rb', line 52

def render_data_services(task, with_names = false)
    super
end