Class: HelloCustomShell

Inherits:
Object
  • Object
show all
Includes:
Glimmer
Defined in:
lib/glimmer-dsl-opal/samples/hello/hello_custom_shell.rb

Defined Under Namespace

Classes: Email, EmailSystem

Instance Method Summary collapse

Constructor Details

#initializeHelloCustomShell

Returns a new instance of HelloCustomShell.



95
96
97
98
99
100
101
102
103
104
105
106
# 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" <[email protected]>', 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" <[email protected]>', 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" <[email protected]>', 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" <[email protected]>', 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" <[email protected]>', 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" <[email protected]>', message: "Team,\n\nWe are upgrading to Glimmer version 98.0.\n\nEveryone pull the latest code!\n\nRegards,\n\nRobert McGabbins"),
    ]
  )
end

Instance Method Details

#launchObject



108
109
110
111
112
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
# 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