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.



84
85
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
# File 'lib/FormHolder/Form/InputHolder/List.rb', line 84

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.



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

def form
  @form
end

#listObject

Returns the value of attribute list.



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

def list
  @list
end

#modelObject

Returns the value of attribute model.



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

def model
  @model
end

#pcObject

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



114
115
116
# File 'lib/FormHolder/Form/InputHolder/List.rb', line 114

def pc
  @pc
end

#scrollerObject

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



114
115
116
# File 'lib/FormHolder/Form/InputHolder/List.rb', line 114

def scroller
  @scroller
end

Instance Method Details

#itemObject



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

def item
	pc.item
end

#parentMObject



122
123
124
# File 'lib/FormHolder/Form/InputHolder/List.rb', line 122

def parentM
	pc.parentM
end

#parentselectedObject



144
145
146
# File 'lib/FormHolder/Form/InputHolder/List.rb', line 144

def parentselected
	pc.parentselected
end

#qrowObject



166
167
168
# File 'lib/FormHolder/Form/InputHolder/List.rb', line 166

def qrow
	parentM.qrow
end

#queryObject



162
163
164
# File 'lib/FormHolder/Form/InputHolder/List.rb', line 162

def query
	parentM.query
end

#set_label(label) ⇒ Object



148
149
150
# File 'lib/FormHolder/Form/InputHolder/List.rb', line 148

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

#set_model(model) ⇒ Object

update



140
141
142
# File 'lib/FormHolder/Form/InputHolder/List.rb', line 140

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

#set_selected(id_to_select) ⇒ Object



130
131
132
# File 'lib/FormHolder/Form/InputHolder/List.rb', line 130

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

#set_sensitive(sens) ⇒ Object



156
157
158
159
# File 'lib/FormHolder/Form/InputHolder/List.rb', line 156

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

#targetObject



152
153
154
# File 'lib/FormHolder/Form/InputHolder/List.rb', line 152

def target
	pc.target
end

#textObject



126
127
128
# File 'lib/FormHolder/Form/InputHolder/List.rb', line 126

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

#to_sObject



170
171
172
# File 'lib/FormHolder/Form/InputHolder/List.rb', line 170

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

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



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

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