class SumRendererText

this file is part of manqod manqod is distributed under the CDDL licence the author of manqod is Dobai-Pataky Balint(dpblnt@gmail.com)

Attributes

column[RW]

Public Class Methods

new(column) click to toggle source
Calls superclass method
# File lib/ListHolder/ListPanel/ListSum/Text.rb, line 7
def initialize(column)
        @column=column
        @decimals=case column.header["type"]
                when "gtk_float" then 2
                else 0
        end
        super()
        set_alignment(column.alignment,0.5)
end

Public Instance Methods

inspect() click to toggle source
# File lib/ListHolder/ListPanel/ListSum/Text.rb, line 29
def inspect
        to_s
end
to_s() click to toggle source
# File lib/ListHolder/ListPanel/ListSum/Text.rb, line 26
def to_s
        "SumRenderer of #{column}"
end
update(new_value=0) click to toggle source
# File lib/ListHolder/ListPanel/ListSum/Text.rb, line 18
def update(new_value=0)
        set_text(case column.header['type']
                when "gtk_int" then number_format(new_value,@column.decimals_attribute)
                when "gtk_float" then number_format(new_value,@column.decimals_attribute)
                when "gtk_duration" then new_value.to_i.strftime(column.duration_format)
        end)
end