require_relative "contact_manager/contact_manager_presenter" class ContactManager include Glimmer::UI::CustomShell before_body { @contact_manager_presenter = ContactManagerPresenter.new @contact_manager_presenter.list } body { shell { text "Contact Manager" composite { group { grid_layout(2, false) { margin_width 0 margin_height 0 } layout_data :fill, :center, true, false text 'Lookup Contacts' font height: 24 label { layout_data :right, :center, false, false text "First &Name: " font height: 16 } text { layout_data :fill, :center, true, false text <=> [@contact_manager_presenter, :first_name] on_key_pressed {|key_event| @contact_manager_presenter.find if key_event.keyCode == swt(:cr) } } label { layout_data :right, :center, false, false text "&Last Name: " font height: 16 } text { layout_data :fill, :center, true, false text <=> [@contact_manager_presenter, :last_name] on_key_pressed {|key_event| @contact_manager_presenter.find if key_event.keyCode == swt(:cr) } } label { layout_data :right, :center, false, false text "&Email: " font height: 16 } text { layout_data :fill, :center, true, false text <=> [@contact_manager_presenter, :email] on_key_pressed {|key_event| @contact_manager_presenter.find if key_event.keyCode == swt(:cr) } } composite { row_layout { margin_width 0 margin_height 0 } layout_data(:right, :center, false, false) { horizontal_span 2 } button { text "&Find" on_widget_selected { @contact_manager_presenter.find } on_key_pressed {|key_event| @contact_manager_presenter.find if key_event.keyCode == swt(:cr) } } button { text "&List All" on_widget_selected { @contact_manager_presenter.list } on_key_pressed {|key_event| @contact_manager_presenter.list if key_event.keyCode == swt(:cr) } } } } table(:editable, :multi) { |table_proxy| layout_data { horizontal_alignment :fill vertical_alignment :fill grab_excess_horizontal_space true grab_excess_vertical_space true height_hint 200 } table_column { text "First Name" width 80 } table_column { text "Last Name" width 80 } table_column { text "Email" width 200 } items <=> [@contact_manager_presenter, :results, column_attributes: [:first_name, :last_name, :email]] on_mouse_up { |event| table_proxy.edit_table_item(event.table_item, event.column_index) } } } } } end ContactManager.launch