示例#1
0
 /**
  * The only constructor of the review dialog, which initialises the dates, sets the outer layout,
  * runs the analyser, creates rows for the results, and displays the window.
  *
  * @param main A link to the parent component.
  * @param config A link to the configuration object.
  */
 ReviewDialog(Main main, Config config) {
   super(main, "Review & Save");
   this.main = main;
   this.config = config;
   // layout date components
   GridBagLayout gbl = new GridBagLayout();
   setLayout(gbl);
   GridBagConstraints gbc = new GridBagConstraints();
   gbc.fill = GridBagConstraints.BOTH;
   gbc.insets = new Insets(0, 0, 5, 0);
   gbc.ipadx = 10;
   gbc.gridx = 0;
   gbc.gridy = 0;
   gbl.setConstraints(yearLabel, gbc);
   gbc.gridx = 1;
   gbl.setConstraints(yearCB, gbc);
   gbc.gridx = 0;
   gbc.gridy = 1;
   gbl.setConstraints(weekLabel, gbc);
   gbc.gridx = 1;
   gbl.setConstraints(weekCB, gbc);
   gbc.gridx = 0;
   gbc.gridy = 2;
   gbl.setConstraints(fromLabel, gbc);
   gbc.weightx = 1;
   gbc.gridx = 1;
   gbl.setConstraints(fromDate, gbc);
   gbc.insets = new Insets(0, 0, 0, 0);
   gbc.weightx = 0;
   gbc.gridx = 0;
   gbc.gridy = 3;
   gbl.setConstraints(toLabel, gbc);
   gbc.weightx = 1;
   gbc.gridx = 1;
   gbl.setConstraints(toDate, gbc);
   gbc.gridx = 0;
   gbc.gridy = 4;
   gbc.gridwidth = 2;
   gbc.insets = new Insets(10, 5, 10, 5);
   gbc.weighty = 1;
   JScrollPane scrollReviewPanel = new JScrollPane(reviewPanel);
   gbl.setConstraints(scrollReviewPanel, gbc);
   gbc.insets = new Insets(0, 0, 0, 0);
   gbc.gridy = 5;
   gbc.weighty = 0;
   gbl.setConstraints(saveToFileButton, gbc);
   gbc.gridy = 6;
   gbl.setConstraints(copyToClipboardButton, gbc);
   add(yearLabel);
   add(yearCB);
   add(weekLabel);
   add(weekCB);
   add(fromLabel);
   add(fromDate);
   add(toLabel);
   add(toDate);
   add(scrollReviewPanel);
   add(saveToFileButton);
   add(copyToClipboardButton);
   // layout results
   updateYearWeekDates();
   setVisible(true);
   setLocation(main.getLocation());
 }