Class: MyRendererList

Inherits:
Gtk::VBox
  • Object
show all
Includes:
ManqodCommon, Observable
Defined in:
lib/FormHolder/Form/InputHolder/List.rb

Overview

this file is part of manqod manqod is distributed under the CDDL licence the author of manqod is Dobai-Pataky Balint([email protected])

Direct Known Subclasses

FieldList

Defined Under Namespace

Classes: List, ListButton

Constant Summary

Constants included from ManqodCommon

ManqodCommon::CRITICAL, ManqodCommon::DEBUG, ManqodCommon::ERROR, ManqodCommon::INFO, ManqodCommon::NORMAL, ManqodCommon::WARNING

Constants included from Eprint

Eprint::DOMAIN, Eprint::LEVEL

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from ManqodCommon

#add_where, #admin, #admin_cache, #admin_qrow, #admin_rows, #backtrace_to_debug, #cache, #changed_ids_of_base, #client, #client_fields, #client_image_of_id, #client_qrow, #client_query, #client_rows, #eeval, #escape_string, #getBinding, #guess_base, #guess_table, #image_of_id, #lzero, #manqod_db, #measure, #myexec, #nick, #nick_id, #number_format, #reconnect_manqod_db, #rows, #run_events, #send_message, #sendmail, #set_manqod_db_uri, #set_nick

Methods included from Eprint

#ecode, #edebug, #eerror, #einfo, #enormal, #eprint, #ewarn, #gtk_set_edebug, #set_edebug, #tell_exception

Constructor Details

#initialize(pc) ⇒ MyRendererList

Returns a new instance of MyRendererList.



86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
# File 'lib/FormHolder/Form/InputHolder/List.rb', line 86

def initialize(pc)
	@pc=pc
	@list=List.new(self)
	@scroller=Gtk::ScrolledWindow.new
	buttons=Gtk::HButtonBox.new.set_layout_style(Gtk::ButtonBox::END)
	super()
	pack_start(scroller)
	pack_start(buttons,false,false) unless target.to_i == -1
	button=ListButton.new
	pc.add_observer(button)
	button.signal_connect('clicked') do |c|
		@form=Myform::MyFormHolder.new("dialog",self,@pc.target_runmode,target)
		@form.set_parentM(parentM)
		ret=form.run(text.to_i)
		list.update(ret) if ret and ret>0
	end
	buttons.pack_start(button)
	scroller.set_hscrollbar_policy(Gtk::POLICY_AUTOMATIC).add(list)
	list.set_model(@model=MyRendererModel.new(list))
	list.selection.signal_connect('changed'){|me|
			if me.selected then 
				edebug("#{self} selection changed by user: #{pc.default} -> #{me.selected[0]}. emiting signal","list-list","debug")
				pc.changed
				pc.notify_observers(pc)
				run_events(item['id'],'form_item-Action')
			end
		}

#		signal_connect('key-press-event'){|me,key| list.model.update_filter(me,key)}
end

Instance Attribute Details

#formObject

Returns the value of attribute form.



118
119
120
# File 'lib/FormHolder/Form/InputHolder/List.rb', line 118

def form
  @form
end

#listObject

Returns the value of attribute list.



117
118
119
# File 'lib/FormHolder/Form/InputHolder/List.rb', line 117

def list
  @list
end

#modelObject

Returns the value of attribute model.



117
118
119
# File 'lib/FormHolder/Form/InputHolder/List.rb', line 117

def model
  @model
end

#pcObject

signal_connect(‘key-press-event’){|me,key| list.model.update_filter(me,key)}



116
117
118
# File 'lib/FormHolder/Form/InputHolder/List.rb', line 116

def pc
  @pc
end

#scrollerObject

signal_connect(‘key-press-event’){|me,key| list.model.update_filter(me,key)}



116
117
118
# File 'lib/FormHolder/Form/InputHolder/List.rb', line 116

def scroller
  @scroller
end

Instance Method Details

#itemObject



120
121
122
# File 'lib/FormHolder/Form/InputHolder/List.rb', line 120

def item
	pc.item
end

#parentMObject



124
125
126
# File 'lib/FormHolder/Form/InputHolder/List.rb', line 124

def parentM
	pc.parentM
end

#parentselectedObject



146
147
148
# File 'lib/FormHolder/Form/InputHolder/List.rb', line 146

def parentselected
	pc.parentselected
end

#qrowObject



168
169
170
# File 'lib/FormHolder/Form/InputHolder/List.rb', line 168

def qrow
	parentM.qrow
end

#queryObject



164
165
166
# File 'lib/FormHolder/Form/InputHolder/List.rb', line 164

def query
	parentM.query
end

#set_label(label) ⇒ Object



150
151
152
# File 'lib/FormHolder/Form/InputHolder/List.rb', line 150

def set_label(label)
	pc.set_label(label)
end

#set_model(model) ⇒ Object

update



142
143
144
# File 'lib/FormHolder/Form/InputHolder/List.rb', line 142

def set_model(model)
	list.set_model(model)
end

#set_selected(id_to_select) ⇒ Object



132
133
134
# File 'lib/FormHolder/Form/InputHolder/List.rb', line 132

def set_selected(id_to_select)
	list.set_selected(id_to_select)
end

#set_sensitive(sens) ⇒ Object



158
159
160
161
# File 'lib/FormHolder/Form/InputHolder/List.rb', line 158

def set_sensitive(sens)
	@list.set_sensitive(sens)
	self
end

#targetObject



154
155
156
# File 'lib/FormHolder/Form/InputHolder/List.rb', line 154

def target
	pc.target
end

#textObject



128
129
130
# File 'lib/FormHolder/Form/InputHolder/List.rb', line 128

def text
	list.selection.selected[0] if !list.selection.selected.nil?
end

#to_sObject



172
173
174
# File 'lib/FormHolder/Form/InputHolder/List.rb', line 172

def to_s
	"List: (#{item['description']})"
end

#update(id_to_select = item['default']) ⇒ Object



136
137
138
139
140
# File 'lib/FormHolder/Form/InputHolder/List.rb', line 136

def update(id_to_select=item['default'])
	run_events(item['id'],'form_item-BeforeUpdate')
	list.update(id_to_select)
	run_events(item['id'],'form_item-AfterUpdate')
end