class MyNotebook
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
list_count[R]
list_id[RW]
notifier[RW]
parentM[RW]
Public Class Methods
new(parentM)
click to toggle source
Calls superclass method
# File lib/mynotebook.rb, line 9 def initialize(parentM) @parentM=parentM @list_id=nil @mypages=Array.new @list_count=0 super() set_enable_popup(false) set_scrollable(true) # set_show_border(false) # set_tab_border(0) parentM.list.add_observer(self) end
Public Instance Methods
lists() { |submoditem| ... }
click to toggle source
yield child ListHolders
# File lib/mynotebook.rb, line 113 def lists each{|submoditem| yield submoditem if submoditem.class.name == "Mylist::MyListHolder" } end
moditem_by_id(mid)
click to toggle source
# File lib/mynotebook.rb, line 100 def moditem_by_id(mid) found_item=nil each{|submoditem| case submoditem.class.name when "Mylist::MyListHolder" then found_item=submoditem.list if submoditem.list.get_id.to_i == mid.to_i when "MyFormHolder" then found_item=submoditem.form if submoditem.form.get_id.to_i == mid.to_i else edebug("unknown submoditem: #{submoditem.class.name}","notebook","warning") end } found_item end
my()
click to toggle source
# File lib/mynotebook.rb, line 124 def my @@my end
to_s()
click to toggle source
# File lib/mynotebook.rb, line 127 def to_s "Notebook of #{@parentM}" end
update(notifier)
click to toggle source
# File lib/mynotebook.rb, line 24 def update(notifier) set_conf(notifier.list_id,0,"page",self.page) if self.page>-1 =begin # set_conf(list_id,0,"position",@parentM.widget.position) if @parentM.widget.position > 0 if (position=get_conf(notifier.list_id,0,"position")||0) !=0 ecode("#{position}=>#{parentM.widget.position}") parentM.widget.set_position(position.to_i) parentM.widget.set_position_set(true) end =end if @list_id != notifier.list_id wipe @mypages=Array.new @list_count=0 case (notifier.class.name) when 'MyEditableList' parentid=notifier.get_id edebug("notifier changed: #{notifier}, repacking","sub-list","debug") else edebug("unknown routing: "+notifier.class.name,"sub-list","warning") end if parentid notifier.list_model.drbmodel.childs.each{|moditem| case moditem['modname'] when 'listing' submoditem_holder=Mylist::MyListHolder.new(self) submoditem_holder.set_parentM(notifier) submoditem=submoditem_holder.list submoditem.set_id(moditem['id']) submoditem_holder.update(notifier) @list_count+=1 when 'form' submoditem_holder=Myform::MyFormHolder.new("embedded",self,"modify",moditem['id']).holder submoditem_holder.holder.set_parentM(notifier) submoditem=submoditem_holder.form # submoditem.title=moditem['display'] # submoditem.set_id(moditem['id']) submoditem.update(notifier,parentid) end @mypages.push(submoditem_holder) submoditem.is_embedded=submoditem.embedd? if submoditem.is_embedded insert_page(submoditem.moditem["oid"].to_i,submoditem_holder,Gtk::Label.new(submoditem.title)) end } end show_all if n_pages > 0 set_page(get_conf(notifier.list_id,0,"page").to_i) if get_conf(notifier.list_id,0,"page") @list_id=notifier.list_id else edebug("notifier: #{notifier}, calling update in childs","sub-list","info") @mypages.each{|submoditem_holder| case submoditem_holder.class.name when "Mylist::MyListHolder" then submoditem=submoditem_holder.list submoditem.update(notifier) when "Myform::MyFormHolder::EmbeddedFormHolder" then submoditem=submoditem_holder.form submoditem_holder.update(notifier,notifier.get_cursor_id) else edebug("unknown subitem: "+submoditem_holder.class.name,"sub-list","warning") end if submoditem if submoditem.embedd? != submoditem.is_embedded if submoditem.embedd? insert_page(submoditem.moditem["oid"].to_i,submoditem_holder,Gtk::Label.new(submoditem.title)) else remove_page(page_num(submoditem_holder)) end submoditem.is_embedded=submoditem.embedd? end end } show_all end end
wipe()
click to toggle source
# File lib/mynotebook.rb, line 119 def wipe @mypages.each{|sublist| sublist.destroy} while n_pages>0 do remove_page(-1) end end