class Vizkit::PortsItem

Attributes

task[R]

Public Class Methods

new(task,options = Hash.new) click to toggle source
Calls superclass method Vizkit::VizkitItem.new
# File lib/vizkit/vizkit_items.rb, line 484
def initialize(task,options = Hash.new)
    super()
    @options = Kernel.validate_options options,:item_type => :label
    @task = task
    setEditable false
    if @options[:item_type] == :label
        setText "Ports"
        task.on_port_reachable do |port_name|
            next if child?(port_name)
            port = task.port(port_name)
            port.once_on_reachable do
                append_port(port) unless child?(port_name)
            end
            port.on_error do |e|
                # add port to display the error
                append_port(port) unless child?(port_name)
            end
        end
    end
end

Public Instance Methods

append_port(port) click to toggle source
# File lib/vizkit/vizkit_items.rb, line 505
def append_port(port)
    if port.input?
        appendRow([InputPortItem.new(port),InputPortItem.new(port,:item_type => :value)])
    elsif port.output?
        p1 = OutputPortItem.new(port)
        p2 = OutputPortItem.new(port,:item_type => :value)
        appendRow([p1,p2])
        if expanded?
            p1.expand
            p2.expand
        end
    else
        raise "Port #{port} is neither an input nor an output port"
    end
end
context_menu(pos,parent_widget,items = []) click to toggle source
# File lib/vizkit/vizkit_items.rb, line 521
def context_menu(pos,parent_widget,items = [])
end