class HelloCustomShell

Constants

Email
EmailSystem

Public Class Methods

new() click to toggle source
# File lib/glimmer-dsl-opal/samples/hello/hello_custom_shell.rb, line 95
def initialize
  @email_system = EmailSystem.new(
    emails: [
      Email.new(date: DateTime.new(2029, 10, 22, 11, 3, 0).strftime('%F %I:%M %p'), subject: '3rd Week Report', from: '"Dianne Tux" <dianne.tux@example.com>', message: "Hello,\n\nI was wondering if you'd like to go over the weekly report sometime this afternoon.\n\nDianne"),
      Email.new(date: DateTime.new(2029, 10, 21, 8, 1, 0).strftime('%F %I:%M %p'), subject: 'Glimmer Upgrade v100.0', from: '"Robert McGabbins" <robert.mcgabbins@example.com>', message: "Team,\n\nWe are upgrading to Glimmer version 100.0.\n\nEveryone pull the latest code!\n\nRegards,\n\nRobert McGabbins"),
      Email.new(date: DateTime.new(2029, 10, 19, 16, 58, 0).strftime('%F %I:%M %p'), subject: 'Christmas Party', from: '"Lisa Ferreira" <lisa.ferreira@example.com>', message: "Merry Christmas,\n\nAll office Christmas Party arrangements have been set\n\nMake sure to bring a Secret Santa gift\n\nBest regards,\n\nLisa Ferreira"),
      Email.new(date: DateTime.new(2029, 10, 16, 9, 43, 0).strftime('%F %I:%M %p'), subject: 'Glimmer Upgrade v99.0', from: '"Robert McGabbins" <robert.mcgabbins@example.com>', message: "Team,\n\nWe are upgrading to Glimmer version 99.0.\n\nEveryone pull the latest code!\n\nRegards,\n\nRobert McGabbins"),
      Email.new(date: DateTime.new(2029, 10, 15, 11, 2, 0).strftime('%F %I:%M %p'), subject: '2nd Week Report', from: '"Dianne Tux" <dianne.tux@example.com>', message: "Hello,\n\nI was wondering if you'd like to go over the weekly report sometime this afternoon.\n\nDianne"),
      Email.new(date: DateTime.new(2029, 10, 2, 10, 34, 0).strftime('%F %I:%M %p'), subject: 'Glimmer Upgrade v98.0', from: '"Robert McGabbins" <robert.mcgabbins@example.com>', message: "Team,\n\nWe are upgrading to Glimmer version 98.0.\n\nEveryone pull the latest code!\n\nRegards,\n\nRobert McGabbins"),
    ]
  )
end

Public Instance Methods

launch() click to toggle source
# File lib/glimmer-dsl-opal/samples/hello/hello_custom_shell.rb, line 108
def launch
  shell { |shell_proxy|
    grid_layout
    
    text 'Hello, Custom Shell!'
    
    label {
      font height: 24, style: :bold
      text 'Emails:'
    }
    
    label {
      font height: 18
      text 'Click an email to view its message'
    }
    
    table {
      layout_data :fill, :fill, true, true
    
      table_column {
        text 'Date:'
        width 180
      }
      table_column {
        text 'Subject:'
        width 180
      }
      table_column {
        text 'From:'
        width 360
      }
      
      items <=> [@email_system, :emails, column_attributes: [:date, :subject, :from]]
      
      on_mouse_up { |event|
        email = event.table_item.get_data
        
        # open a custom email shell
        email_shell(
          parent_shell: shell_proxy,
          date: email.date,
          subject: email.subject,
          from: email.from,
          message: email.message
        ).open
      }
    }
  }.open
end