Beispiel #1
0
 /** Save a file. Called when the user goes to File -> Save */
 public void saveFile() {
   try {
     calendar.saveCal(calendar.getSettings().getFilename());
   } catch (IOException e) {
     System.out.println(e.getMessage());
   }
 }
Beispiel #2
0
 /** Save a file as something else. Called when the user goes to File -> Save As */
 public void saveFileAs() {
   JFileChooser chooser = new JFileChooser();
   chooser.addChoosableFileFilter(new CakeFileChooser());
   chooser.setDialogType(JFileChooser.SAVE_DIALOG);
   chooser.showSaveDialog(window);
   File f = chooser.getSelectedFile();
   if (f == null) return;
   try {
     if (calendar.getSettings().getName() == CakeCal.UNTITLED) {
       calendar.getSettings().setName(f.getName());
       parent.updateGUI(CakeCal.UNTITLED);
     }
     calendar.saveCal(f.getPath());
   } catch (IOException e) {
     System.out.println(e.getMessage());
   }
   calendar.getSettings().setFilename(f.getPath());
   // save.setEnabled(calendar.modified);
 }
Beispiel #3
0
  /** Open a file. Called when user goes to File -> Open */
  public void openFile() {

    openState = true;

    JFileChooser chooser = new JFileChooser();
    chooser.addChoosableFileFilter(new CakeFileChooser());

    chooser.showOpenDialog(window);
    File f = chooser.getSelectedFile();
    if (f == null) {
      return;
    }
    calendar.loadCal(f.getPath());
    calendar.getSettings().setFilename(f.getPath());

    this.updateCurrentEvents();
    this.updateDays();
    mview.updateDays();
    dayView.updateDay();
  }
Beispiel #4
0
 /**
  * Return the settings used by this calendar.
  *
  * @return The settings used by this calendar.
  */
 public CalendarSettings getSettings() {
   return calendar.getSettings();
 }