Class: PdfParadise::GUI::Jruby::DeleteTheFirstOrTheLastPageOfThisPdfFile

Inherits:
JFrame
  • Object
show all
Includes:
DeleteTheFirstorTheLastPageOfThisPdfFileModule, SwingParadise::BaseModule
Defined in:
lib/pdf_paradise/gui/jruby/delete_the_first_or_the_last_page_of_this_pdf_file/delete_the_first_or_the_last_page_of_this_pdf_file.rb

Overview

PdfParadise::GUI::Jruby::DeleteTheFirstOrTheLastPageOfThisPdfFile

Constant Summary collapse

HEIGHT =
#

HEIGHT

#
450

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(commandline_arguments = nil, run_already = true) ⇒ DeleteTheFirstOrTheLastPageOfThisPdfFile

#

initialize

#


42
43
44
45
46
47
48
49
50
51
52
# File 'lib/pdf_paradise/gui/jruby/delete_the_first_or_the_last_page_of_this_pdf_file/delete_the_first_or_the_last_page_of_this_pdf_file.rb', line 42

def initialize(
    commandline_arguments = nil,
    run_already           = true
  )
  super('Delete the first or the last page of this pdf file')
  reset
  set_commandline_arguments(
    commandline_arguments
  )
  run if run_already
end

Class Method Details

.[](i = ARGV) ⇒ Object

#

PdfParadise::GUI::DeleteTheFirstOrTheLastPageOfThisPdfFile[]

#


148
149
150
# File 'lib/pdf_paradise/gui/jruby/delete_the_first_or_the_last_page_of_this_pdf_file/delete_the_first_or_the_last_page_of_this_pdf_file.rb', line 148

def self.[](i = ARGV)
  new(i)
end

Instance Method Details

#create_the_skeletonObject

#

create_the_skeleton (skeleton tag, create tag)

#


97
98
99
100
101
102
103
# File 'lib/pdf_paradise/gui/jruby/delete_the_first_or_the_last_page_of_this_pdf_file/delete_the_first_or_the_last_page_of_this_pdf_file.rb', line 97

def create_the_skeleton
  create_the_entries
  create_the_buttons
  create_the_labels
  create_the_text_above_the_main_entry
  create_the_checkboxes
end

#open_file_chooser_dialogObject

#

open_file_chooser_dialog (open tag)

#


79
80
81
82
83
84
85
86
87
88
89
90
91
92
# File 'lib/pdf_paradise/gui/jruby/delete_the_first_or_the_last_page_of_this_pdf_file/delete_the_first_or_the_last_page_of_this_pdf_file.rb', line 79

def open_file_chooser_dialog
  current_directory = return_pwd
  file_chooser = JFileChooser.new
  # file_chooser.setFileSelectionMode(JFileChooser::DIRECTORIES_ONLY)

  result = file_chooser.showOpenDialog(nil)
  case result
  when JFileChooser::APPROVE_OPTION
    this_file = file_chooser.getSelectedFile.getAbsoluteFile.to_s
    # this_file = File.absolute_path(this_file)
    main_entry?.set_text(this_file)
  end

end

#resetObject

#

reset (reset tag)

#


57
58
59
60
61
# File 'lib/pdf_paradise/gui/jruby/delete_the_first_or_the_last_page_of_this_pdf_file/delete_the_first_or_the_last_page_of_this_pdf_file.rb', line 57

def reset
  super() if respond_to?(:super)
  reset_the_internal_hash
  infer_the_namespace
end

#return_right_frameObject

#

return_right_frame

#


66
67
68
69
70
71
72
73
74
# File 'lib/pdf_paradise/gui/jruby/delete_the_first_or_the_last_page_of_this_pdf_file/delete_the_first_or_the_last_page_of_this_pdf_file.rb', line 66

def return_right_frame
  right_side = create_vbox # right tag
  right_side.add(@button_remove_the_first_page_of_the_pdf_file)
  right_side.add(@button_remove_the_last_page_of_the_pdf_file)
  right_side.add(@button_remove_the_specified_page_of_the_pdf_file)
  right_side.add(@button_pdf_viewer)
  right_side.add(@button_file_chooser)
  return right_side
end

#runObject

#

run (run tag)

#


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
# File 'lib/pdf_paradise/gui/jruby/delete_the_first_or_the_last_page_of_this_pdf_file/delete_the_first_or_the_last_page_of_this_pdf_file.rb', line 108

def run
  create_the_skeleton
  set_size(1200, HEIGHT)
  panel = new_boxlayout(:new_panel)
  panel.set_font(Font.new('Calibri', Font::PLAIN, 50))
  panel.setBorder(BorderFactory.createEmptyBorder(10, 10, 10, 10))

  entry1 = top_entry?
  entry1.setAlignmentX(Component::CENTER_ALIGNMENT)
  
  @text_above_the_main_entry.set_font(Font.new('Arial', Font::PLAIN, FONT_SIZE_LARGE))
  _ = text(DENOTE_WHICH_PDF_PAGE_IS_TO_BE_REMOVED)
  _.set_font(Font.new('Arial', Font::PLAIN, FONT_SIZE_LARGE))
  
  mini_hbox = create_hbox
  mini_hbox.add(@entry_remove_this_pdf_page)
  mini_hbox.add(@button_remove_the_specified_page)

  panel.batch_add( # left tag
    @text_above_the_main_entry,
    entry1,
    _,
    mini_hbox,
    checkbox_shall_we_overwrite_the_original_pdf_file?,
    create_and_then_return_the_label_that_shows_how_many_pages_are_in_the_given_pdf_file,
    text_for_notifications?
  )

  panel_containing_two_child_widgets = create_boxlayout(:new_panel, BoxLayout::X_AXIS)
  panel_containing_two_child_widgets.add(panel)
  panel_containing_two_child_widgets.add(return_right_frame) # and this is the right tag
  panel_containing_two_child_widgets.set_font(Font.new('Calibri', Font::PLAIN, FONT_SIZE_LARGE))
add(panel_containing_two_child_widgets, BorderLayout::NORTH)
do_parse_the_commandline_arguments
default_close
end