Class: MyInputHolder

Inherits:
Object
  • Object
show all
Includes:
Conf, GtkAttributes, ManqodCommon, Observable
Defined in:
lib/FormHolder/Form/InputHolder.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])

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 GtkAttributes

#default_attribute, #gtk_attribute, #gtk_attribute_of_object, #gtkobjectid, #gtkobjecttype, #set_gtk_attribute

Methods included from Conf

#get_conf, #load_conf, #save_conf, #set_conf

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, #qrow, #query, #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(item, caller) ⇒ MyInputHolder

The InputHolders is a container widget, holds input widets for the Form

  • item is a hash read from mysql

  • caller is the parent widget, usually the Form



14
15
16
17
18
19
20
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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
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
# File 'lib/FormHolder/Form/InputHolder.rb', line 14

def initialize(item,caller)
	@item=item
	@visibility=true
	@caller=caller
	@default_is_set=false
	if parentM.runmode=="wysiwygf"
		@frame_button=Gtk::Button.new
		else
		@frame_button=nil
	end
	@query_result=Hash.new
	@widget=Gtk::Frame.new
	@expander=Gtk::Expander.new("").set_expanded(true)
	@expander.signal_connect("notify::expanded"){
		set_visible
		parentM.form_holder.vshrink(@widget.allocation.height)
	}
	@widget.set_label_widget(Gtk::HBox.new(false,10))
	if frame_button
		frame_button.set_image(Gtk::Image.new(Gtk::Stock::PREFERENCES,Gtk::IconSize::MENU)).set_relief(Gtk::ReliefStyle::NONE)
		frame_button.signal_connect('clicked'){|me|
			menuw=Gtk::Window.new(Gtk::Window::POPUP)
#				menuw.set_opacity(0.5)#  -- not compatible with galatea

			menuw.add(menu=Gtk::Table.new(3,3))
			menu.attach_defaults(go_left=Gtk::Button.new,0,1,1,2)
			go_left.set_image(Gtk::Image.new(Gtk::Stock::GO_BACK,Gtk::IconSize::SMALL_TOOLBAR)).set_relief(Gtk::ReliefStyle::NONE).signal_connect('clicked',menuw,self){|me,parentw,ih|
				ih.item['x']=lzero(ih.item['x'].to_i-1,2)
				reattach
			}
			menu.attach_defaults(span_left=Gtk::Button.new,0,1,0,1)
			span_left.set_image(Gtk::Image.new(Gtk::Stock::GOTO_FIRST,Gtk::IconSize::SMALL_TOOLBAR)).set_relief(Gtk::ReliefStyle::NONE).signal_connect('clicked',menuw){|me,parentw|
				ih.item['xspan']=lzero(ih.item['xspan'].to_i-1,2)
				reattach
			}
			
			menu.attach_defaults(go_right=Gtk::Button.new,2,3,1,2)
			go_right.set_image(Gtk::Image.new(Gtk::Stock::GO_FORWARD,Gtk::IconSize::SMALL_TOOLBAR)).set_relief(Gtk::ReliefStyle::NONE).signal_connect('clicked',menuw){|me,parentw|
				ih.item['x']=lzero(ih.item['x'].to_i+1,2)
				reattach
			}
			menu.attach_defaults(span_right=Gtk::Button.new,0,1,2,3)
			span_right.set_image(Gtk::Image.new(Gtk::Stock::GOTO_LAST,Gtk::IconSize::SMALL_TOOLBAR)).set_relief(Gtk::ReliefStyle::NONE).signal_connect('clicked',menuw){|me,parentw|
				ih.item['xspan']=lzero(ih.item['xspan'].to_i+1,2)
				reattach
			}
			
			menu.attach_defaults(go_up=Gtk::Button.new,1,2,0,1)
			go_up.set_image(Gtk::Image.new(Gtk::Stock::GO_UP,Gtk::IconSize::SMALL_TOOLBAR)).set_relief(Gtk::ReliefStyle::NONE).signal_connect('clicked',menuw){|me,parentw|
				ih.item['y']=lzero(ih.item['y'].to_i-1,2)
				reattach
			}
			menu.attach_defaults(span_up=Gtk::Button.new,2,3,0,1)
			span_up.set_image(Gtk::Image.new(Gtk::Stock::GOTO_TOP,Gtk::IconSize::SMALL_TOOLBAR)).set_relief(Gtk::ReliefStyle::NONE).signal_connect('clicked',menuw){|me,parentw|
				ih.item['yspan']=lzero(ih.item['yspan'].to_i-1,2)
				reattach
			}

			menu.attach_defaults(go_down=Gtk::Button.new,1,2,2,3)
			go_down.set_image(Gtk::Image.new(Gtk::Stock::GO_DOWN,Gtk::IconSize::SMALL_TOOLBAR)).set_relief(Gtk::ReliefStyle::NONE).signal_connect('clicked',menuw){|me,parentw|
				ih.item['y']=lzero(ih.item['y'].to_i+1,2)
				reattach
			}
			menu.attach_defaults(span_down=Gtk::Button.new,2,3,2,3)
			span_down.set_image(Gtk::Image.new(Gtk::Stock::GOTO_BOTTOM,Gtk::IconSize::SMALL_TOOLBAR)).set_relief(Gtk::ReliefStyle::NONE).signal_connect('clicked',menuw){|me,parentw|
				ih.item['yspan']=lzero(ih.item['yspan'].to_i+1,2)
				reattach
			}

			menu.attach_defaults(go_close=Gtk::Button.new,1,2,1,2)
			go_close.set_image(Gtk::Image.new(Gtk::Stock::CLOSE,Gtk::IconSize::SMALL_TOOLBAR)).set_relief(Gtk::ReliefStyle::NONE).signal_connect('clicked',menuw){|me,parentw|
				parentw.hide
			}
			
			menuw.set_modal(true).set_window_position(Gtk::Window::POS_MOUSE).show_all
=begin
#disabled per current compiz is generating the leave notify event in the wrong order
=end
			menuw.signal_connect('leave-notify-event'){|me,e|
				me.hide if e.window == me.window
			}
			menuw.signal_connect("hide"){|me|
				query("update gtkformitems set x='#{ih.item['x']}', y='#{ih.item['y']}',xspan='#{ih.item['xspan']}', yspan='#{ih.item['yspan']}' where id='#{ih.item['id']}'")
			}
		}
	end
	
	#Button in info mode is editable
	item['editable']=(item['gtktype']=='gtk_button').to_s if caller.runmode == 'info'
	@widget.set_border_width(1)

	@widget.add(@eventbox=Gtk::EventBox.new)
	set_include_in_query_building(gtk_attribute("include-in-query-building"))
	repack_renderer
	
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(sym, *args) ⇒ Object

This hack returns the contained widget’s if this class is called without method



453
454
455
# File 'lib/FormHolder/Form/InputHolder.rb', line 453

def method_missing(sym,*args)
	renderer
end

Instance Attribute Details

#callerObject (readonly)

Returns the value of attribute caller.



110
111
112
# File 'lib/FormHolder/Form/InputHolder.rb', line 110

def caller
  @caller
end

#default_is_setObject (readonly)

Returns the value of attribute default_is_set.



111
112
113
# File 'lib/FormHolder/Form/InputHolder.rb', line 111

def default_is_set
  @default_is_set
end

#eventboxObject (readonly)

Returns the value of attribute eventbox.



110
111
112
# File 'lib/FormHolder/Form/InputHolder.rb', line 110

def eventbox
  @eventbox
end

#frame_buttonObject (readonly)

Returns the value of attribute frame_button.



110
111
112
# File 'lib/FormHolder/Form/InputHolder.rb', line 110

def frame_button
  @frame_button
end

#include_in_query_buildingObject (readonly)

Returns the value of attribute include_in_query_building.



111
112
113
# File 'lib/FormHolder/Form/InputHolder.rb', line 111

def include_in_query_building
  @include_in_query_building
end

#infoObject (readonly)

Returns the value of attribute info.



110
111
112
# File 'lib/FormHolder/Form/InputHolder.rb', line 110

def info
  @info
end

#itemObject (readonly)

Returns the value of attribute item.



110
111
112
# File 'lib/FormHolder/Form/InputHolder.rb', line 110

def item
  @item
end

#query_resultObject (readonly)

Returns the value of attribute query_result.



111
112
113
# File 'lib/FormHolder/Form/InputHolder.rb', line 111

def query_result
  @query_result
end

#rendererObject (readonly)

Returns the value of attribute renderer.



110
111
112
# File 'lib/FormHolder/Form/InputHolder.rb', line 110

def renderer
  @renderer
end

#titleObject (readonly)

Returns the value of attribute title.



110
111
112
# File 'lib/FormHolder/Form/InputHolder.rb', line 110

def title
  @title
end

#type_defObject (readonly)

Returns the value of attribute type_def.



111
112
113
# File 'lib/FormHolder/Form/InputHolder.rb', line 111

def type_def
  @type_def
end

#widgetObject (readonly)

Returns the value of attribute widget.



110
111
112
# File 'lib/FormHolder/Form/InputHolder.rb', line 110

def widget
  @widget
end

Instance Method Details

#batch?Boolean

Returns:

  • (Boolean)


346
347
348
# File 'lib/FormHolder/Form/InputHolder.rb', line 346

def batch?
	(gtk_attribute("batch") || "false").upcase == "TRUE"
end

#dataObject

Returns the mysql field name of this widget



258
259
260
# File 'lib/FormHolder/Form/InputHolder.rb', line 258

def data
	item['data']
end

#defaultObject

Returns the default value of the input widget



278
279
280
# File 'lib/FormHolder/Form/InputHolder.rb', line 278

def default
	item['default']
end

#default_set?Boolean

Returns:

  • (Boolean)


273
274
275
# File 'lib/FormHolder/Form/InputHolder.rb', line 273

def default_set?
	@default_is_set == true
end

#descriptionObject

Returns the description of the input widget



319
320
321
# File 'lib/FormHolder/Form/InputHolder.rb', line 319

def description
	item['description']
end

#editableObject

Returns String ‘true’ if the widget is editable



327
328
329
# File 'lib/FormHolder/Form/InputHolder.rb', line 327

def editable
	editable?
end

#editable?Boolean

Returns boolean true if the widget is editable

Returns:

  • (Boolean)


331
332
333
# File 'lib/FormHolder/Form/InputHolder.rb', line 331

def editable?
	item['editable'].to_s.upcase=='TRUE'
end

#get_maxObject

Returns widget’s max value



375
376
377
# File 'lib/FormHolder/Form/InputHolder.rb', line 375

def get_max
	item["max"]
end

#get_minObject

Returns widget’s min value



370
371
372
# File 'lib/FormHolder/Form/InputHolder.rb', line 370

def get_min
	item["min"]
end

#initialObject

Returns the input widget’s initial value(set by the Form on init)



315
316
317
# File 'lib/FormHolder/Form/InputHolder.rb', line 315

def initial
	item["initial"]
end

#inspectObject

Identify this widget



465
466
467
# File 'lib/FormHolder/Form/InputHolder.rb', line 465

def inspect
	"InputHolder of #{renderer.inspect}"
end

#multiselector?Boolean

Returns true if the widget handles multiediting

Returns:

  • (Boolean)


428
429
430
# File 'lib/FormHolder/Form/InputHolder.rb', line 428

def multiselector?
	gtk_attribute("multiselector") == "true"
end

#parentMObject

Returns the parent module



424
425
426
# File 'lib/FormHolder/Form/InputHolder.rb', line 424

def parentM
	@caller
end

#parentselectedObject

Returns the parent’s selected id, usualy the calling List row’s id



409
410
411
# File 'lib/FormHolder/Form/InputHolder.rb', line 409

def parentselected
	caller.parentselected
end

#querySQLObject

Returns the widget’s query SQL, if there is one



323
324
325
# File 'lib/FormHolder/Form/InputHolder.rb', line 323

def querySQL
	item['querysql']
end

#reattachObject

Reattaches the widget, useful on dynamic changing Forms and in the wysiwyg editor



457
458
459
# File 'lib/FormHolder/Form/InputHolder.rb', line 457

def reattach
	@caller.reattach(self)
end

#repack_rendererObject



113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
# File 'lib/FormHolder/Form/InputHolder.rb', line 113

def repack_renderer
	@item['wantnew']=target.to_i != -1
	@title=if ['gtk_toggle','qbuilder'].include?(@item['gtktype']) then nil; else @item['description'];end
	@widget.label_widget.each{|ch| @widget.label_widget.remove(ch)}
	if gtk_attribute("expander")||'false' == 'true'
		@widget.label_widget.pack_start(@expander.set_label(title))
		lw=@expander
		else
		@widget.label_widget.pack_start(Gtk::Label.new(title))
		lw=@widget.label_widget
	end
	#set the font
	if caller.runmode == 'info' then lw.modify_font(Pango::FontDescription.new(get_conf(0,0,"info-frame-font")))
		else lw.modify_font(Pango::FontDescription.new(get_conf(0,0,"form-frame-font")))
	end
	@widget.label_widget.pack_start(@frame_button) if frame_button
	@renderer.destroy if @renderer

	@renderer=case @item['gtktype']
		when 'gtk_hidden' then MyRendererHidden.new(self)
		when 'gtk_label' then MyRendererLabel.new(self)
		when 'gtk_text'
			if caller.runmode=="info" then MyRendererLabel.new(self)
				else MyRendererText.new(self)
			end
		when 'gtk_spinbutton'
			if caller.runmode=="info" then MyRendererLabel.new(self)
				else MyRendererSpin.new(self)
			end
		when 'gtk_duration' then MyRendererDuration.new(self)
		when 'gtk_hscale' then MyRendererHScale.new(self)
		when 'gtk_calendar' then MyRendererCalendar.new(self)
		when 'gtk_calendar_button' then MyRendererCalendarButton.new(self)
		when 'gtk_timestamp' then MyRendererTimeStamp.new(self)
		when 'gtk_timestamp_button' then MyRendererTimeStampButton.new(self)
		when 'gtk_toggle' then MyRendererToggle.new(self)
		when 'gtk_button' then MyRendererButton.new(self)
		when 'gtk_color_button' then MyRendererColorButton.new(self)
		when 'gtk_font_button' then MyRendererFontButton.new(self)
		when 'gtk_const_radio' then MyRendererRadioGroup.new(self)
		when 'gtk_password' then MyRendererPassword.new(self)
		when 'gtk_combo' then MyRendererCombo.new(self)
		when 'gtk_combo_wn' then MyRendererComboWithNew.new(self)
		when 'gtk_const_combo' then MyRendererConstCombo.new(self)
		when 'gtk_consttext' then MyRendererConstText.new(self)
		when 'gtk_field_combo' then FieldCombo.new(self)
		when 'gtk_field_list' then FieldList.new(self)
		when 'gtk_image' then FormImage.new(self)
		when 'gtk_multiline' then MyRendererMultiline.new(self)
		when 'gtk_source' then
		    begin
			MySourceView.new(self)
		    rescue =>err
		    einfo(err.message + "\n" + err.backtrace.join("\n"))
			MyRendererMultiline.new(self)
		    end
		when 'gtk_list' then MyRendererList.new(self)
		when 'gtk_editable_list' then  MyRendererEditableList.new(self)
		when 'fileload'
			@item['action']='load'
			MyFileChooserButton.new(self)
		when 'filesave'
			@item['action']='save'
			MyFileChooserButton.new(self)
		when 'qbuilder'
			QBuilder.new(self)
		else
			edebug("#{self} unknown renderer type: #{@item['gtktype']}","form","warning")
			nil
	end

	if @renderer then
		unless @renderer.class == MyRendererHidden
			if caller.runmode=="info"
				@renderer.modify_font(Pango::FontDescription.new(get_conf(0,0,"info-item-font")))
				else
				@renderer.modify_font(Pango::FontDescription.new(get_conf(0,0,"form-item-font")))
			end
			@renderer.set_height_request(@item['hrequest'].to_i) if @item['hrequest'].to_i>0
			@renderer.set_width_request(@item['wrequest'].to_i) if @item['wrequest'].to_i>0
			eventbox.add(@renderer)
		end
	end
	set_visible(@renderer.class != MyRendererHidden)
	#type_def parsing
	td=@item["type_def"]
	@type_def=Hash.new
	if @item["type_def"].length>3
		td.split("]").each{|t|
			if first=t.index("[")
				parts=t[first+1 .. t.length].split(":")
				hkey=parts[0]
				hval=parts[1]||""
				hdesc=parts[2]||""
				@type_def[hkey]=[hval,hdesc]
			end
		}
		set_default(-1) if parentM.runmode=="add"
		edebug("header keys: #{@type_def.inspect}","form-combo") 
	end
	if rel=gtk_attribute('relation')
		@relation=parentM.admin_qrow("select relations.* from relations where relations.id='#{rel}'").rehash
		if parentM.table == @relation["dst_table"]
			@relation["src_table"],@relation["src_field"]=@relation["dst_table"],@relation["dst_field"];
		end
		#overwrite querysql if relation attribute defined
		item['querysql']=case @item["gtktype"]
			when "gtk_combo","gtk_combo_wn","gtk_list" then "select * from `#{@relation["dst_table"]}`#{@relation["rel_custom"].length>2 ? " where #{@relation["rel_custom"]}" : ""}"
			else "select * from `#{@relation["dst_table"]}` where `#{@relation["dst_field"]}`='\#{default}'"
		end
		#add order by tree_key
		item["querysql"]="#{item['querysql']} order by #{gtk_attribute("tree_key")}" unless gtk_attribute("tree_key").nil?
		s=""
		@type_def.each_key{|key| s="#{s}, #{key}"}
		item['querysql']="#{item['querysql']} #{(gtk_attribute("tree_key").nil? ? "order by":",")} #{s[2..s.length]}" if s.length>0
		edebug("generated query:#{querySQL}","sql")
	end
	item['querysql']=add_where(item['querysql'],"#{guess_base(item['querysql'])}.id = '" + "#" +"{default}'") if caller.runmode == 'info' && item['querysql'].length>0
	self
end

#requiredObject

If the widget has no data and the Form is submitted by the user, a warning popup window will be presented to the user



380
381
382
# File 'lib/FormHolder/Form/InputHolder.rb', line 380

def required
	item['required'].to_s=='true'
end

#run_queryObject

Runs the item’s query sql and sets the item’s default to the returned value



440
441
442
443
444
445
446
447
448
449
450
451
# File 'lib/FormHolder/Form/InputHolder.rb', line 440

def run_query
	@query_result=Hash.new
	return false if item['querysql'].length<5
	sql=eeval("\"#{item['querysql']}\"")
	edebug("runnning query: #{sql}","sql")
	ret=if item['admin'].to_s == 'true' then parentM.admin_qrow(sql) else parentM.qrow(sql) end
	@query_result=ret.rehash if ret
	if @query_result.has_key?(short_data)
		edebug("new value: #{ret[short_data]}","form")
		item['default']=@query_result[short_data]
	end
end

#set_data(da) ⇒ Object

Sets the mysql field of this widget, the Form uses this



283
284
285
286
# File 'lib/FormHolder/Form/InputHolder.rb', line 283

def set_data(da)
	item['data']=da
	self
end

#set_default(new_value) ⇒ Object

Sets the default value, the Form uses this before update



263
264
265
266
267
# File 'lib/FormHolder/Form/InputHolder.rb', line 263

def set_default(new_value)
	item['default']=new_value
	@default_is_set=true
	self
end

#set_editable(ed = ) ⇒ Object



335
336
337
338
339
# File 'lib/FormHolder/Form/InputHolder.rb', line 335

def set_editable(ed=item['editable'])
	item['editable']=parentM.batch? ? ed.to_s.upcase=='TRUE' && batch? : ed.to_s
	renderer.set_sensitive(self.editable?)
	self
end

#set_expanded(exp) ⇒ Object

Sets if the widget is expanded



461
462
463
# File 'lib/FormHolder/Form/InputHolder.rb', line 461

def set_expanded(exp)
	@expander.set_expanded(exp)
end

#set_include_in_query_building(iqb = nil) ⇒ Object

Returns true if the widget will be included in the Form’s query buiding; will it be saved?



350
351
352
353
354
355
356
357
# File 'lib/FormHolder/Form/InputHolder.rb', line 350

def set_include_in_query_building(iqb=nil)
	if(iqb.nil?) then
		@include_in_query_building=nil
		else
		@include_in_query_building=(iqb.to_s.upcase=='TRUE')
	end
	self
end

#set_max(l_max) ⇒ Object

Sets the widget’s max value, used only if widget is SpinButton



365
366
367
368
# File 'lib/FormHolder/Form/InputHolder.rb', line 365

def set_max(l_max)
	item["max"]=l_max.to_s
	self
end

#set_min(l_min) ⇒ Object

Sets the widget’s min value, used only if widget is SpinButton



359
360
361
362
# File 'lib/FormHolder/Form/InputHolder.rb', line 359

def set_min(l_min)
	item["min"]=l_min.to_s
	self
end

#set_required(req) ⇒ Object

Sets the required’s value



384
385
386
387
# File 'lib/FormHolder/Form/InputHolder.rb', line 384

def set_required(req)
	item['required']=req.to_s
	self
end

#set_sensitive(sensi) ⇒ Object



341
342
343
344
# File 'lib/FormHolder/Form/InputHolder.rb', line 341

def set_sensitive(sensi)
	renderer.set_sensitive(sensi)
	self
end

#set_shadowObject

Sets the widget’s gtk shadow



234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
# File 'lib/FormHolder/Form/InputHolder.rb', line 234

def set_shadow
	shadow=case caller.runmode
		when "info" then Gtk::SHADOW_ETCHED_IN
		else Gtk::SHADOW_OUT
	end
	shadow=Gtk::SHADOW_NONE if ['gtk_button'].include?(item['gtktype'])
	attr_shadow=case gtk_attribute('border-shadow')
		when 'none' then Gtk::ShadowType::NONE
		when 'in' then Gtk::ShadowType::IN
		when 'out' then Gtk::ShadowType::OUT
		when 'etched-in' then Gtk::ShadowType::ETCHED_IN
		when 'etched-out' then Gtk::ShadowType::ETCHED_OUT
	end
	shadow=attr_shadow unless attr_shadow.nil?
	shadow=Gtk::ShadowType::NONE unless @expander.expanded?
	@widget.set_shadow_type(shadow) unless shadow.nil?
end

#set_target(new_target) ⇒ Object

Sets the widget’s target module item



405
406
407
# File 'lib/FormHolder/Form/InputHolder.rb', line 405

def set_target(new_target)
	item['to_call']=new_target
end

#set_visibility(vis) ⇒ Object

hides/unhides the widget



289
290
291
292
293
# File 'lib/FormHolder/Form/InputHolder.rb', line 289

def set_visibility(vis)
	@visibility=vis
	@widget.set_no_show_all(!@visibility)
	self
end

#set_visible(visibility = @visibility) ⇒ Object



294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
# File 'lib/FormHolder/Form/InputHolder.rb', line 294

def set_visible(visibility=@visibility)
	set_visibility(visibility)
	super(@visibilty)
	if @visibility
		@widget.show_all
	else
		@widget.hide
	end

	if @expander
		@renderer.set_visible(@expander.expanded? && visibility)
		@renderer.set_no_show_all(!(@expander.expanded? && visibility))
	end
	set_shadow
	self
end

#short_dataObject

Returns the item’s mysql field value



432
433
434
435
436
437
438
# File 'lib/FormHolder/Form/InputHolder.rb', line 432

def short_data
	if i=item['data'].rindex(".")
		item['data'][i+1 .. item['data'].length]
		else
		item['data']
	end
end

#targetObject

Returns the widget’s target module item



389
390
391
# File 'lib/FormHolder/Form/InputHolder.rb', line 389

def target
	item['to_call']
end

#target_moduleObject

Returns the widget’s target module



401
402
403
# File 'lib/FormHolder/Form/InputHolder.rb', line 401

def target_module
	item['modname']
end

#target_runmodeObject

Returns the widget’s target runmode



393
394
395
396
397
398
399
# File 'lib/FormHolder/Form/InputHolder.rb', line 393

def target_runmode
	case parentM.runmode 
		when "info" then "info"
		when "wysiwygf" then "wysiwygf"
		else (text.to_i == -1 || text.to_i == 0 ? "add" : "modify" )
	end
end

#textObject

Returns the current value of the input widget



253
254
255
# File 'lib/FormHolder/Form/InputHolder.rb', line 253

def text
	renderer.text if renderer
end

#to_sObject



468
469
470
# File 'lib/FormHolder/Form/InputHolder.rb', line 468

def to_s
	inspect
end

#typeObject

Returns the input widget type



311
312
313
# File 'lib/FormHolder/Form/InputHolder.rb', line 311

def type
	item['gtktype']
end

#unset_defaultObject



269
270
271
# File 'lib/FormHolder/Form/InputHolder.rb', line 269

def unset_default
	@default_is_set=false
end

#update(notifier = nil, new_value = ) ⇒ Object

Updates the widget



413
414
415
416
417
418
419
420
421
422
# File 'lib/FormHolder/Form/InputHolder.rb', line 413

def update(notifier=nil,new_value=item['default'])
	item['default']=new_value
	edebug("Update notification from #{notifier} for #{data} = [#{new_value}]","form","info")
	before=Time.now
	set_editable
	renderer.update(new_value) if renderer
	after=Time.now
	diff=after-before
	edebug("#{@item['gtktype']}:#{@item['data']} updated in #{diff.to_s}","time","info")
end