Class: Studium::GUI::ShowUpcomingExams

Inherits:
JFrame
  • Object
show all
Includes:
ShowUpcomingExamsModule, SwingParadise::BaseModule
Defined in:
lib/studium/gui/jruby/show_upcoming_exams/show_upcoming_exams.rb

Constant Summary

Constants included from ShowUpcomingExamsModule

Studium::GUI::ShowUpcomingExamsModule::HEIGHT, Studium::GUI::ShowUpcomingExamsModule::LARGER_FONT, Studium::GUI::ShowUpcomingExamsModule::SMALLER_FONT, Studium::GUI::ShowUpcomingExamsModule::TITLE, Studium::GUI::ShowUpcomingExamsModule::USE_THESE_CSS_RULES, Studium::GUI::ShowUpcomingExamsModule::USE_THIS_FONT, Studium::GUI::ShowUpcomingExamsModule::USE_THIS_FONT_FOR_THE_TREE_VIEW, Studium::GUI::ShowUpcomingExamsModule::USE_THIS_MONOSPACED_FONT, Studium::GUI::ShowUpcomingExamsModule::WIDTH

Instance Method Summary collapse

Methods included from ShowUpcomingExamsModule

#border_size?, #do_all_startup_related_actions, #favicon?, #padding?, #remove_german_weekdays, #reset_the_shared_module, #smaller_font?

Constructor Details

#initialize(run_already = true) ⇒ ShowUpcomingExams

#

initialize

#


23
24
25
26
27
28
# File 'lib/studium/gui/jruby/show_upcoming_exams/show_upcoming_exams.rb', line 23

def initialize(
    run_already = true
  )
  reset
  run if run_already
end

Instance Method Details

#resetObject

#

reset

#


33
34
35
# File 'lib/studium/gui/jruby/show_upcoming_exams/show_upcoming_exams.rb', line 33

def reset
  reset_the_shared_module
end

#runObject

#

run

#


40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
# File 'lib/studium/gui/jruby/show_upcoming_exams/show_upcoming_exams.rb', line 40

def run
  frame = frame(TITLE)
  panel = JPanel.new # This is an instance of Java::JavaxSwing::JPanel.
  panel.set_font(Font.new 'Sans serif', Font::PLAIN, 85)
  frame.getContentPane.add(panel)
  panel.setLayout(BoxLayout.new(panel, BoxLayout::PAGE_AXIS)) # FlowLayout.new)

  panel.hint = 'A quit button example'
  
  m = defaul_table_model(nil, ['#','Name of the course','Exam Date'].to_java)
  index = 0
  @dataset.each {|the_name_of_the_course, inner_hash| index += 1
    name_of_the_course = the_name_of_the_course
    exam_date = inner_hash['exams'] # Obtain the next exam date here.
    if exam_date.is_a? Array
      exam_date = exam_date.first
    end
    exam_date.squeeze!(' ')
    m.add_row([index.to_s, name_of_the_course, exam_date].to_java)
  }

  table = JTable.new(m)
  table.use_this_font = :mono_18

  # ======================================================================= #
  # Put the editor pane in a scroll pane.
  # ======================================================================= #
  scroll_pane = scroll_pane(table)
  scroll_pane.vertical_scrollbar_always
  scroll_pane.min_size(820, 700)

  panel << table
  panel << quit_button

  frame.set_font(Font.new 'Sans serif', Font::PLAIN, 85)
  frame.exit_on_close
  frame.set_size(1250, 500)
  frame.setLocationRelativeTo(nil)
  frame.show_all
end