mirror of
https://github.com/mistergibson/gxg-web-client.git
synced 2026-08-15 03:26:00 -07:00
App info in init now
This commit is contained in:
parent
7dd91a2018
commit
736390876a
6 changed files with 177 additions and 105 deletions
|
|
@ -438,6 +438,10 @@ module GxG
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
#
|
#
|
||||||
|
def menu_item_select(data=nil)
|
||||||
|
# override this in your object script.
|
||||||
|
end
|
||||||
|
#
|
||||||
def run(data={})
|
def run(data={})
|
||||||
# override this in your object script.
|
# override this in your object script.
|
||||||
if data.is_a?(::Hash)
|
if data.is_a?(::Hash)
|
||||||
|
|
|
||||||
|
|
@ -235,7 +235,31 @@ module GxG
|
||||||
def download_file(the_vfs_path="", error_handler=nil, &the_handler)
|
def download_file(the_vfs_path="", error_handler=nil, &the_handler)
|
||||||
if self.open?
|
if self.open?
|
||||||
if the_vfs_path.is_a?(::String) && the_handler
|
if the_vfs_path.is_a?(::String) && the_handler
|
||||||
self.pull_data({:download_file => {:path => the_vfs_path}},error_handler, &the_handler)
|
the_message = new_message({:download_file => {:path => the_vfs_path}})
|
||||||
|
the_message[:sender] = @uuid
|
||||||
|
the_message[:to] = @remote_uuid
|
||||||
|
if error_handler.respond_to?(:call)
|
||||||
|
the_message.on(:fail,&error_handler)
|
||||||
|
end
|
||||||
|
the_message.on(:success) do |response|
|
||||||
|
if response.is_a?(::Hash)
|
||||||
|
file_name = response[:result][:file_name].to_s
|
||||||
|
file_data = response[:result][:file_data].decode64
|
||||||
|
%x{
|
||||||
|
const streamSaver = window.streamSaver
|
||||||
|
const fileStream = streamSaver.createWriteStream(#{file_name}, {})
|
||||||
|
const writer = fileStream.getWriter()
|
||||||
|
const uInt8 = new TextEncoder().encode(#{file_data})
|
||||||
|
writer.write(uInt8)
|
||||||
|
writer.close()
|
||||||
|
}
|
||||||
|
the_handler.call(true)
|
||||||
|
else
|
||||||
|
the_handler.call(false)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
GxG::CONNECTION.pull(the_message)
|
||||||
|
#
|
||||||
true
|
true
|
||||||
else
|
else
|
||||||
false
|
false
|
||||||
|
|
@ -321,7 +345,9 @@ module GxG
|
||||||
if response_code < 300
|
if response_code < 300
|
||||||
begin
|
begin
|
||||||
the_message.succeed(::JSON.parse(`#{the_xhr}.response`,{:symbolize_names => true}))
|
the_message.succeed(::JSON.parse(`#{the_xhr}.response`,{:symbolize_names => true}))
|
||||||
|
# log_info "got data"
|
||||||
rescue Exception => the_error
|
rescue Exception => the_error
|
||||||
|
# log_warn "Parse Error"
|
||||||
log_error({:error => the_error, :parameters => `#{the_xhr}.response`})
|
log_error({:error => the_error, :parameters => `#{the_xhr}.response`})
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
|
|
|
||||||
|
|
@ -1523,6 +1523,13 @@ module GxG
|
||||||
::GxG::Gui::register_component_class(:"org.gxg.gui.dropdown.menu", ::GxG::Gui::DropdownMenu)
|
::GxG::Gui::register_component_class(:"org.gxg.gui.dropdown.menu", ::GxG::Gui::DropdownMenu)
|
||||||
#
|
#
|
||||||
class MenuBar < ::GxG::Gui::DropdownMenu
|
class MenuBar < ::GxG::Gui::DropdownMenu
|
||||||
|
def set_application(the_application=nil)
|
||||||
|
@application = the_application
|
||||||
|
end
|
||||||
|
#
|
||||||
|
def application()
|
||||||
|
@application
|
||||||
|
end
|
||||||
end
|
end
|
||||||
::GxG::Gui::register_component_class(:"org.gxg.gui.menu.bar", ::GxG::Gui::MenuBar)
|
::GxG::Gui::register_component_class(:"org.gxg.gui.menu.bar", ::GxG::Gui::MenuBar)
|
||||||
#
|
#
|
||||||
|
|
@ -1536,15 +1543,19 @@ module GxG
|
||||||
end
|
end
|
||||||
#
|
#
|
||||||
def add_menu_item(label=nil, data=nil)
|
def add_menu_item(label=nil, data=nil)
|
||||||
the_item = ::GxG::Database::DetachedHash.new
|
the_item = new_component(:"org.gxg.gui.menu.item")
|
||||||
the_item[:component] = "org.gxg.gui.menu.item"
|
|
||||||
the_item[:settings] = {:label => label, :data => data}
|
the_item[:settings] = {:label => label, :data => data}
|
||||||
the_item[:options] = {}
|
|
||||||
the_item[:script] = ""
|
|
||||||
the_item[:content] = []
|
|
||||||
page.build_components(self, [(the_item)])
|
page.build_components(self, [(the_item)])
|
||||||
true
|
true
|
||||||
end
|
end
|
||||||
|
#
|
||||||
|
def set_application(the_application=nil)
|
||||||
|
@application = the_application
|
||||||
|
end
|
||||||
|
#
|
||||||
|
def application()
|
||||||
|
@application
|
||||||
|
end
|
||||||
end
|
end
|
||||||
::GxG::Gui::register_component_class(:"org.gxg.gui.menu", ::GxG::Gui::Menu)
|
::GxG::Gui::register_component_class(:"org.gxg.gui.menu", ::GxG::Gui::Menu)
|
||||||
#
|
#
|
||||||
|
|
@ -1562,23 +1573,15 @@ module GxG
|
||||||
#
|
#
|
||||||
def cascade
|
def cascade
|
||||||
#
|
#
|
||||||
label = ::GxG::Database::DetachedHash.new
|
label = new_component(:"org.gxg.gui.link.anchor")
|
||||||
label.title = "label #{@uuid.to_s}"
|
label.title = "label #{@uuid.to_s}"
|
||||||
label[:component] = "anchor"
|
|
||||||
label[:settings] = {}
|
|
||||||
# label[:options] = {:href => "#0", :content => (@settings[:label] || "Untitled").to_s}
|
# label[:options] = {:href => "#0", :content => (@settings[:label] || "Untitled").to_s}
|
||||||
label[:options] = {:content => (@settings[:label] || "Untitled").to_s}
|
label[:options] = {:content => (@settings[:label] || "Untitled").to_s}
|
||||||
label[:script] = "
|
label[:script] = "
|
||||||
on(:mouseup) do |event|
|
on(:mouseup) do |event|
|
||||||
menu_item = self.find_parent_type(::GxG::Gui::MenuItem)
|
@parent.selecct()
|
||||||
if menu_item
|
|
||||||
unless menu_item.get_state(:disabled) == true
|
|
||||||
menu_item.select()
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
"
|
"
|
||||||
label[:content] = []
|
|
||||||
#
|
#
|
||||||
page.build_components(self, [(label)])
|
page.build_components(self, [(label)])
|
||||||
the_object = page.find_object_by("label #{@uuid.to_s}")
|
the_object = page.find_object_by("label #{@uuid.to_s}")
|
||||||
|
|
@ -1599,7 +1602,10 @@ module GxG
|
||||||
end
|
end
|
||||||
#
|
#
|
||||||
def select(data=nil)
|
def select(data=nil)
|
||||||
# override in object script
|
application = @parent.application()
|
||||||
|
if application
|
||||||
|
application.menu_item_select(@settings[:data])
|
||||||
|
end
|
||||||
end
|
end
|
||||||
#
|
#
|
||||||
end
|
end
|
||||||
|
|
@ -2034,7 +2040,7 @@ module GxG
|
||||||
@tab_content = self.add_child({:component => "org.gxg.gui.block", :title => ("tab_content" + @uuid.to_s), :settings => {}, :options => {:"data-tabs-content" => (@tabs.uuid.to_s), :states => ["tabs-content"]}, :script =>"", :content => []})
|
@tab_content = self.add_child({:component => "org.gxg.gui.block", :title => ("tab_content" + @uuid.to_s), :settings => {}, :options => {:"data-tabs-content" => (@tabs.uuid.to_s), :states => ["tabs-content"]}, :script =>"", :content => []})
|
||||||
`$(document).foundation()`
|
`$(document).foundation()`
|
||||||
end
|
end
|
||||||
def add_child(options={})
|
def add_child(options={}, other_data={})
|
||||||
new_child = nil
|
new_child = nil
|
||||||
if options[:component].to_s.downcase.to_sym == :tab_content
|
if options[:component].to_s.downcase.to_sym == :tab_content
|
||||||
new_child = @tab_content.add_child(options)
|
new_child = @tab_content.add_child(options)
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,54 @@
|
||||||
module GxG
|
module GxG
|
||||||
module Gui
|
module Gui
|
||||||
|
class ApplicationViewport < ::GxG::Gui::Vdom::BaseElement
|
||||||
|
#
|
||||||
|
def _before_create
|
||||||
|
@domtype = :div
|
||||||
|
super()
|
||||||
|
end
|
||||||
|
#
|
||||||
|
def set_application(the_application)
|
||||||
|
@application = the_application
|
||||||
|
end
|
||||||
|
#
|
||||||
|
def application()
|
||||||
|
@application
|
||||||
|
end
|
||||||
|
#
|
||||||
|
def find_child(the_reference=nil)
|
||||||
|
result = nil
|
||||||
|
if the_reference
|
||||||
|
search_queue = [(self)]
|
||||||
|
while search_queue.size > 0 do
|
||||||
|
entry = search_queue.shift
|
||||||
|
if entry
|
||||||
|
if GxG::valid_uuid?(the_reference)
|
||||||
|
if entry.children[(object_source.uuid())]
|
||||||
|
result = entry.children[(object_source.uuid())]
|
||||||
|
break
|
||||||
|
else
|
||||||
|
entry.each_child do |the_child|
|
||||||
|
search_queue << the_child
|
||||||
|
end
|
||||||
|
end
|
||||||
|
else
|
||||||
|
entry.each_child do |the_child|
|
||||||
|
if the_child.title == the_reference
|
||||||
|
result = the_child
|
||||||
|
break
|
||||||
|
else
|
||||||
|
search_queue << the_child
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
result
|
||||||
|
end
|
||||||
|
end
|
||||||
|
::GxG::Gui::register_component_class(:"org.gxg.gui.application.viewport", ::GxG::Gui::ApplicationViewport)
|
||||||
|
#
|
||||||
class Tree < ::GxG::Gui::Vdom::BaseElement
|
class Tree < ::GxG::Gui::Vdom::BaseElement
|
||||||
#
|
#
|
||||||
alias :original_add_child :add_child
|
alias :original_add_child :add_child
|
||||||
|
|
@ -68,13 +117,9 @@ module GxG
|
||||||
#
|
#
|
||||||
def cascade()
|
def cascade()
|
||||||
#
|
#
|
||||||
interior_component = ::GxG::Database::DetachedHash.new
|
interior_component = new_component(:"org.gxg.gui.list")
|
||||||
interior_component.title = "content #{@uuid.to_s}"
|
interior_component.title = "content #{@uuid.to_s}"
|
||||||
interior_component[:component] = "org.gxg.gui.list"
|
|
||||||
interior_component[:settings] = {}
|
|
||||||
interior_component[:options] = {:style => {:"white-space" => "nowrap", :width => "auto", :height => "auto", :"list-style" => "none", :margin => "0px", :padding => "0px"}}
|
interior_component[:options] = {:style => {:"white-space" => "nowrap", :width => "auto", :height => "auto", :"list-style" => "none", :margin => "0px", :padding => "0px"}}
|
||||||
interior_component[:script] = ""
|
|
||||||
interior_component[:content] = []
|
|
||||||
#
|
#
|
||||||
@content = nil
|
@content = nil
|
||||||
page.build_components(self,[(interior_component)])
|
page.build_components(self,[(interior_component)])
|
||||||
|
|
@ -86,7 +131,7 @@ module GxG
|
||||||
#
|
#
|
||||||
end
|
end
|
||||||
#
|
#
|
||||||
def update_appearance()
|
def update_appearance(data=nil)
|
||||||
# TODO ??
|
# TODO ??
|
||||||
end
|
end
|
||||||
# Selection / Processing:
|
# Selection / Processing:
|
||||||
|
|
@ -272,7 +317,7 @@ module GxG
|
||||||
result
|
result
|
||||||
end
|
end
|
||||||
#
|
#
|
||||||
def update_appearance()
|
def update_appearance(data=nil)
|
||||||
if @appearance.is_any?(::Hash, ::GxG::Database::DetachedHash)
|
if @appearance.is_any?(::Hash, ::GxG::Database::DetachedHash)
|
||||||
#
|
#
|
||||||
# TODO: update icon and label if different ??
|
# TODO: update icon and label if different ??
|
||||||
|
|
@ -325,24 +370,16 @@ module GxG
|
||||||
end
|
end
|
||||||
#
|
#
|
||||||
def cascade()
|
def cascade()
|
||||||
|
# ???
|
||||||
|
node_frame = new_component(:"org.gxg.gui.block.table")
|
||||||
|
# FIXME: can app access node settings ??
|
||||||
|
node_frame[:settings][:nodepath] = self.node_path()
|
||||||
|
# node_frame[:options] = {:nodepath => (self.node_path()), :style => {}}
|
||||||
#
|
#
|
||||||
node_frame = ::GxG::Database::DetachedHash.new
|
frame_row_one = new_component(:"org.gxg.gui.block.table")
|
||||||
node_frame[:component] = "org.gxg.gui.block.table"
|
|
||||||
node_frame[:settings] = {}
|
|
||||||
node_frame[:options] = {:nodepath => (self.node_path()), :style => {}}
|
|
||||||
node_frame[:script] = ""
|
|
||||||
#
|
#
|
||||||
frame_row_one = ::GxG::Database::DetachedHash.new
|
expander = new_component(:"org.gxg.gui.image")
|
||||||
frame_row_one[:component] = "org.gxg.gui.block.table"
|
|
||||||
frame_row_one[:settings] = {}
|
|
||||||
frame_row_one[:options] = {}
|
|
||||||
frame_row_one[:script] = ""
|
|
||||||
frame_row_one[:content] = []
|
|
||||||
#
|
|
||||||
expander = ::GxG::Database::DetachedHash.new
|
|
||||||
expander.title = "expander #{@uuid.to_s}"
|
expander.title = "expander #{@uuid.to_s}"
|
||||||
expander[:component] = "org.gxg.gui.image"
|
|
||||||
expander[:settings] = {}
|
|
||||||
expander[:options] = {:src=>(theme_widget("collapse.svg")), :width=>32, :height=>32, :style => {:clear => "both", :'vertical-align' => 'middle'}}
|
expander[:options] = {:src=>(theme_widget("collapse.svg")), :width=>32, :height=>32, :style => {:clear => "both", :'vertical-align' => 'middle'}}
|
||||||
expander[:script] = "
|
expander[:script] = "
|
||||||
on(:mouseup) do |event|
|
on(:mouseup) do |event|
|
||||||
|
|
@ -362,19 +399,14 @@ module GxG
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
"
|
"
|
||||||
expander[:content] = []
|
|
||||||
#
|
#
|
||||||
node_expander_cell = ::GxG::Database::DetachedHash.new
|
node_expander_cell = ::GxG::Database::DetachedHash.new
|
||||||
node_expander_cell[:component] = "org.gxg.gui.block.table.cell"
|
node_expander_cell = new_component(:"org.gxg.gui.block.table.cell")
|
||||||
node_expander_cell[:settings] = {}
|
|
||||||
node_expander_cell[:options] = {:style => {:float => "left", :width => "32px", :'vertical-align' => 'middle'}}
|
node_expander_cell[:options] = {:style => {:float => "left", :width => "32px", :'vertical-align' => 'middle'}}
|
||||||
node_expander_cell[:script] = ""
|
node_expander_cell[:content] << expander
|
||||||
node_expander_cell[:content] = [(expander)]
|
|
||||||
#
|
#
|
||||||
icon = ::GxG::Database::DetachedHash.new
|
icon = new_component(:"org.gxg.gui.block.table.cell")
|
||||||
icon.title = "icon #{@uuid.to_s}"
|
icon.title = "icon #{@uuid.to_s}"
|
||||||
icon[:component] = "org.gxg.gui.image"
|
|
||||||
icon[:settings] = {}
|
|
||||||
icon[:options] = {:src=>@appearance[:icon], :style => {:clear => "both", :width=>"32px", :height=>"32px", :'vertical-align' => 'middle'}}
|
icon[:options] = {:src=>@appearance[:icon], :style => {:clear => "both", :width=>"32px", :height=>"32px", :'vertical-align' => 'middle'}}
|
||||||
icon[:script] = "
|
icon[:script] = "
|
||||||
on(:mouseup) do |event|
|
on(:mouseup) do |event|
|
||||||
|
|
@ -387,19 +419,14 @@ module GxG
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
"
|
"
|
||||||
icon[:content] = []
|
|
||||||
#
|
#
|
||||||
node_icon_cell = ::GxG::Database::DetachedHash.new
|
node_icon_cell = ::GxG::Database::DetachedHash.new
|
||||||
node_icon_cell[:component] = "org.gxg.gui.block.table.cell"
|
node_icon_cell = new_component(:"org.gxg.gui.block.table.cell")
|
||||||
node_icon_cell[:settings] = {}
|
|
||||||
node_icon_cell[:options] = {:style => {:float => "left", :width => "32px", :'vertical-align' => 'middle'}}
|
node_icon_cell[:options] = {:style => {:float => "left", :width => "32px", :'vertical-align' => 'middle'}}
|
||||||
node_icon_cell[:script] = ""
|
node_icon_cell[:content] << icon
|
||||||
node_icon_cell[:content] = [(icon)]
|
|
||||||
#
|
#
|
||||||
the_title = ::GxG::Database::DetachedHash.new
|
the_title = new_component(:"org.gxg.gui.label")
|
||||||
the_title.title = "title #{@uuid.to_s}"
|
the_title.title = "title #{@uuid.to_s}"
|
||||||
the_title[:component] = "org.gxg.gui.label"
|
|
||||||
the_title[:settings] = {}
|
|
||||||
the_title[:options] = {:content => @appearance[:label], :style => {:float => "left", :'font-size' => '16px', :'vertical-align' => 'middle', :'text-align' => 'left', :margin => "2px", :padding => "2px"}}
|
the_title[:options] = {:content => @appearance[:label], :style => {:float => "left", :'font-size' => '16px', :'vertical-align' => 'middle', :'text-align' => 'left', :margin => "2px", :padding => "2px"}}
|
||||||
the_title[:script] = "
|
the_title[:script] = "
|
||||||
on(:mouseup) do |event|
|
on(:mouseup) do |event|
|
||||||
|
|
@ -412,19 +439,12 @@ module GxG
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
"
|
"
|
||||||
the_title[:content] = []
|
|
||||||
#
|
#
|
||||||
node_label_cell = ::GxG::Database::DetachedHash.new
|
node_label_cell = new_component(:"org.gxg.gui.block.table.cell")
|
||||||
node_label_cell[:component] = "org.gxg.gui.block.table.cell"
|
|
||||||
node_label_cell[:settings] = {}
|
|
||||||
node_label_cell[:options] = {:style => {:float => "left", :'vertical-align' => 'middle'}}
|
node_label_cell[:options] = {:style => {:float => "left", :'vertical-align' => 'middle'}}
|
||||||
node_label_cell[:script] = ""
|
node_label_cell[:content] << the_title
|
||||||
node_label_cell[:content] = [(the_title)]
|
|
||||||
#
|
#
|
||||||
frame_row_one = ::GxG::Database::DetachedHash.new
|
frame_row_one = new_component(:"org.gxg.gui.block.table.row")
|
||||||
frame_row_one[:component] = "org.gxg.gui.block.table.row"
|
|
||||||
frame_row_one[:settings] = {}
|
|
||||||
frame_row_one[:options] = {}
|
|
||||||
frame_row_one[:script] = "
|
frame_row_one[:script] = "
|
||||||
on(:mouseenter) do |event|
|
on(:mouseenter) do |event|
|
||||||
the_node = self.tree_node()
|
the_node = self.tree_node()
|
||||||
|
|
@ -439,31 +459,22 @@ module GxG
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
"
|
"
|
||||||
frame_row_one[:content] = [(node_expander_cell), (node_icon_cell), (node_label_cell)]
|
frame_row_one[:content] << node_expander_cell
|
||||||
|
frame_row_one[:content] << node_icon_cell
|
||||||
|
frame_row_one[:content] << node_label_cell
|
||||||
#
|
#
|
||||||
sublist = ::GxG::Database::DetachedHash.new
|
sublist = new_component(:"org.gxg.gui.list" )
|
||||||
sublist.title = "content #{@uuid.to_s}"
|
sublist.title = "content #{@uuid.to_s}"
|
||||||
sublist[:component] = "list"
|
|
||||||
sublist[:settings] = {}
|
|
||||||
sublist[:options] = {:width => "100%", :height => "100%", :style => {:"list-style" => "none"}}
|
sublist[:options] = {:width => "100%", :height => "100%", :style => {:"list-style" => "none"}}
|
||||||
sublist[:script] = ""
|
|
||||||
sublist[:content] = []
|
|
||||||
#
|
#
|
||||||
subnodes_frame_cell = ::GxG::Database::DetachedHash.new
|
subnodes_frame_cell = new_component(:"org.gxg.gui.block.table.cell" )
|
||||||
subnodes_frame_cell[:component] = "org.gxg.gui.block.table.cell"
|
subnodes_frame_cell[:content] << sublist
|
||||||
subnodes_frame_cell[:settings] = {}
|
|
||||||
subnodes_frame_cell[:options] = {}
|
|
||||||
subnodes_frame_cell[:script] = ""
|
|
||||||
subnodes_frame_cell[:content] = [(sublist)]
|
|
||||||
#
|
#
|
||||||
frame_row_two = ::GxG::Database::DetachedHash.new
|
frame_row_two = new_component(:"org.gxg.gui.block.table.row" )
|
||||||
frame_row_two[:component] = "org.gxg.gui.block.table.row"
|
frame_row_two[:content] << subnodes_frame_cell
|
||||||
frame_row_two[:settings] = {}
|
|
||||||
frame_row_two[:options] = {}
|
|
||||||
frame_row_two[:script] = ""
|
|
||||||
frame_row_two[:content] = [(subnodes_frame_cell)]
|
|
||||||
#
|
#
|
||||||
node_frame[:content] = [(frame_row_one),(frame_row_two)]
|
node_frame[:content] << frame_row_one
|
||||||
|
node_frame[:content] << frame_row_two
|
||||||
#
|
#
|
||||||
@content = nil
|
@content = nil
|
||||||
page.build_components(self, [(node_frame)])
|
page.build_components(self, [(node_frame)])
|
||||||
|
|
@ -506,7 +517,7 @@ module GxG
|
||||||
@content.show(transition_parameters)
|
@content.show(transition_parameters)
|
||||||
self.set_state(:expanded, true)
|
self.set_state(:expanded, true)
|
||||||
if @expander
|
if @expander
|
||||||
@expander.set_attribute(:src,GxG::DISPLAY_DETAILS[:object].theme_widget("expand.svg"))
|
@expander.set_attribute(:src, page.theme_widget("expand.svg"))
|
||||||
end
|
end
|
||||||
the_tree = self.tree()
|
the_tree = self.tree()
|
||||||
if the_tree
|
if the_tree
|
||||||
|
|
@ -518,7 +529,7 @@ module GxG
|
||||||
@content.hide(transition_parameters)
|
@content.hide(transition_parameters)
|
||||||
self.set_state(:expanded, false)
|
self.set_state(:expanded, false)
|
||||||
if @expander
|
if @expander
|
||||||
@expander.set_attribute(:src,GxG::DISPLAY_DETAILS[:object].theme_widget("collapse.svg"))
|
@expander.set_attribute(:src, page.theme_widget("collapse.svg"))
|
||||||
end
|
end
|
||||||
the_tree = self.tree()
|
the_tree = self.tree()
|
||||||
if the_tree
|
if the_tree
|
||||||
|
|
@ -1045,7 +1056,7 @@ module GxG
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
#
|
#
|
||||||
def update_appearance()
|
def update_appearance(data=nil)
|
||||||
the_window = self.find_parent_type(::GxG::Gui::DialogBox)
|
the_window = self.find_parent_type(::GxG::Gui::DialogBox)
|
||||||
if the_window
|
if the_window
|
||||||
dialog_type = (the_window.settings[:type] || :folder)
|
dialog_type = (the_window.settings[:type] || :folder)
|
||||||
|
|
|
||||||
|
|
@ -350,14 +350,14 @@ module GxG
|
||||||
# Recognized keys are:
|
# Recognized keys are:
|
||||||
# prepend Prepend the new element before this DOM element
|
# prepend Prepend the new element before this DOM element
|
||||||
# content Add the value of content as a textnode to the DOM element
|
# content Add the value of content as a textnode to the DOM element
|
||||||
def add_child(options={})
|
def add_child(options={},other_data={})
|
||||||
new_child = nil
|
new_child = nil
|
||||||
if options[:component].to_s.downcase.to_sym == :unknown
|
if options[:component].to_s.downcase.to_sym == :unknown
|
||||||
raise "Unknown Component Type"
|
raise "Unknown Component Type"
|
||||||
else
|
else
|
||||||
element_class = GxG::Gui::component_class(options[:component].to_s.downcase.to_sym)
|
element_class = GxG::Gui::component_class(options[:component].to_s.downcase.to_sym)
|
||||||
if element_class.is_a?(::Class)
|
if element_class.is_a?(::Class)
|
||||||
new_child = element_class.new(self,options)
|
new_child = element_class.new(self,options,other_data)
|
||||||
@children[(new_child.title.to_s.to_sym)] = new_child
|
@children[(new_child.title.to_s.to_sym)] = new_child
|
||||||
# Register Object with Page
|
# Register Object with Page
|
||||||
::GxG::DISPLAY_DETAILS[:object].register_object(new_child.title, new_child)
|
::GxG::DISPLAY_DETAILS[:object].register_object(new_child.title, new_child)
|
||||||
|
|
@ -1916,25 +1916,44 @@ module GxG
|
||||||
#
|
#
|
||||||
# @param [String] parent The parent Ruby element
|
# @param [String] parent The parent Ruby element
|
||||||
# @param [Hash] options Any options for the creation process
|
# @param [Hash] options Any options for the creation process
|
||||||
def initialize(parent, options = {})
|
def initialize(parent, options={}, other_data={})
|
||||||
if options.is_a?(GxG::Database::DetachedHash)
|
if options.is_a?(GxG::Database::DetachedHash)
|
||||||
@uuid = options.uuid.to_s.to_sym
|
@uuid = options.uuid.to_s.to_sym
|
||||||
@title = options.title.to_s
|
if options[:title].to_s.size > 0
|
||||||
|
@title = options[:title].to_s
|
||||||
|
else
|
||||||
|
@title = options.title.to_s
|
||||||
|
end
|
||||||
else
|
else
|
||||||
@uuid = (options[:uuid] || ::GxG::uuid_generate()).to_s.to_sym
|
@uuid = (options[:uuid] || ::GxG::uuid_generate()).to_s.to_sym
|
||||||
@title = (options[:title] || "Untitled Component #{@uuid.to_s}").to_s
|
@title = (options[:title] || "Untitled Component #{@uuid.to_s}").to_s
|
||||||
end
|
end
|
||||||
@component = (options[:component] || :unknown).to_s.downcase.to_sym
|
@component = (options[:component] || :unknown).to_s.downcase.to_sym
|
||||||
@parent = parent
|
@parent = parent
|
||||||
@settings = options[:settings]
|
#
|
||||||
|
if options[:settings].is_a?(GxG::Database::DetachedHash)
|
||||||
|
@settings = options[:settings].unpersist
|
||||||
|
else
|
||||||
|
if options[:settings].is_a?(::Hash)
|
||||||
|
@settings = options[:settings]
|
||||||
|
else
|
||||||
|
@settings = {}
|
||||||
|
end
|
||||||
|
end
|
||||||
|
#
|
||||||
|
if other_data[:application]
|
||||||
|
@application = other_data[:application]
|
||||||
|
else
|
||||||
|
@application = nil
|
||||||
|
end
|
||||||
@children = {}
|
@children = {}
|
||||||
@element = nil
|
@element = nil
|
||||||
@domtype = :div
|
@domtype = :div
|
||||||
# ### CSS states
|
# ### CSS states
|
||||||
@states = {}
|
@states = {}
|
||||||
@states[(@component.to_s.gsub(".","-").to_sym)] = true
|
@states[(@component.to_s.gsub(".","-").to_sym)] = true
|
||||||
if options[:options].is_a?(::Hash, GxG::Database::DetachedHash)
|
if options[:options].is_any?(::Hash, GxG::Database::DetachedHash)
|
||||||
if options[:options][:states].is_a?(::Array, GxG::Database::DetachedArray)
|
if options[:options][:states].is_any?(::Array, GxG::Database::DetachedArray)
|
||||||
options[:options][:states].each do |the_state|
|
options[:options][:states].each do |the_state|
|
||||||
@states[(the_state.to_s.to_sym)] = true
|
@states[(the_state.to_s.to_sym)] = true
|
||||||
end
|
end
|
||||||
|
|
@ -2294,26 +2313,32 @@ module GxG
|
||||||
record = build_queue.shift
|
record = build_queue.shift
|
||||||
if record
|
if record
|
||||||
record[:content].each do |the_entry|
|
record[:content].each do |the_entry|
|
||||||
new_object = record[:parent].add_child(the_entry)
|
new_object = record[:parent].add_child(the_entry, options)
|
||||||
if the_entry[:content].size > 0
|
if the_entry[:content].size > 0
|
||||||
build_queue << {:parent => new_object, :content => the_entry[:content]}
|
build_queue << {:parent => new_object, :content => the_entry[:content]}
|
||||||
end
|
end
|
||||||
# Embed new object settings
|
|
||||||
# new_object.set_settings(the_entry[:settings])
|
|
||||||
# Link viewport to provided application
|
# Link viewport to provided application
|
||||||
if the_entry[:component].to_s.downcase.to_sym == :application_viewport && options[:application]
|
if the_entry[:component].to_s.downcase.to_sym == :"org.gxg.gui.application.viewport" && options[:application]
|
||||||
new_object.set_application(options[:application])
|
new_object.set_application(options[:application])
|
||||||
unless options[:application].get_viewport(new_object.uuid)
|
unless options[:application].get_viewport(new_object.uuid)
|
||||||
options[:application].link_viewport(new_object)
|
options[:application].link_viewport(new_object)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
# Link window to provided application
|
# Link window to provided application
|
||||||
if the_entry[:component].to_s.downcase.to_sym == :window && options[:application]
|
if the_entry[:component].to_s.downcase.to_sym == :"org.gxg.gui.window" && options[:application]
|
||||||
options[:application].link_window(new_object)
|
options[:application].link_window(new_object)
|
||||||
new_object.set_application(options[:application])
|
new_object.set_application(options[:application])
|
||||||
end
|
end
|
||||||
# Link dialog_box to provided application
|
# Link dialog_box to provided application
|
||||||
if the_entry[:component].to_s.downcase.to_sym == :dialog_box && options[:application]
|
if the_entry[:component].to_s.downcase.to_sym == :"org.gxg.gui.window.dialog" && options[:application]
|
||||||
|
new_object.set_application(options[:application])
|
||||||
|
end
|
||||||
|
# Link org.gxg.gui.menu.bar to provided application
|
||||||
|
if the_entry[:component].to_s.downcase.to_sym == :"org.gxg.gui.menu.bar" && options[:application]
|
||||||
|
new_object.set_application(options[:application])
|
||||||
|
end
|
||||||
|
# Link org.gxg.gui.menu to provided application
|
||||||
|
if the_entry[:component].to_s.downcase.to_sym == :"org.gxg.gui.menu" && options[:application]
|
||||||
new_object.set_application(options[:application])
|
new_object.set_application(options[:application])
|
||||||
end
|
end
|
||||||
# Window Content Tracking
|
# Window Content Tracking
|
||||||
|
|
|
||||||
|
|
@ -349,7 +349,7 @@ module GxG
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
# Initialization and Setup
|
# Initialization and Setup
|
||||||
def initialize(the_parent,the_options)
|
def initialize(the_parent,the_options,other_data={})
|
||||||
# FIXME: work around for strange bug in layout_refresh
|
# FIXME: work around for strange bug in layout_refresh
|
||||||
::GxG::DISPLAY_DETAILS[:object].layout_refresh
|
::GxG::DISPLAY_DETAILS[:object].layout_refresh
|
||||||
bounds = GxG::DISPLAY_DETAILS[:object].layout_content_area()
|
bounds = GxG::DISPLAY_DETAILS[:object].layout_content_area()
|
||||||
|
|
@ -468,7 +468,7 @@ module GxG
|
||||||
@menu_margin = 0
|
@menu_margin = 0
|
||||||
end
|
end
|
||||||
#
|
#
|
||||||
super(the_parent,the_options)
|
super(the_parent,the_options, other_data)
|
||||||
#
|
#
|
||||||
# self.gxg_set_attribute(:draggable,true)
|
# self.gxg_set_attribute(:draggable,true)
|
||||||
#
|
#
|
||||||
|
|
@ -1367,7 +1367,7 @@ module GxG
|
||||||
end
|
end
|
||||||
#
|
#
|
||||||
# Initialization and Setup
|
# Initialization and Setup
|
||||||
def initialize(the_parent, the_options)
|
def initialize(the_parent, the_options, other_data={})
|
||||||
# FIXME: work around for strange bug in layout_refresh
|
# FIXME: work around for strange bug in layout_refresh
|
||||||
# ::GxG::DISPLAY_DETAILS[:object].layout_refresh
|
# ::GxG::DISPLAY_DETAILS[:object].layout_refresh
|
||||||
# bounds = GxG::DISPLAY_DETAILS[:object].layout_content_area()
|
# bounds = GxG::DISPLAY_DETAILS[:object].layout_content_area()
|
||||||
|
|
@ -1466,7 +1466,7 @@ module GxG
|
||||||
@responder = nil
|
@responder = nil
|
||||||
@data = {}
|
@data = {}
|
||||||
#
|
#
|
||||||
super(the_parent, the_options)
|
super(the_parent, the_options,other_data)
|
||||||
#
|
#
|
||||||
self.set_attribute(:draggable,false)
|
self.set_attribute(:draggable,false)
|
||||||
#
|
#
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue