コード例 #1
0
  void importB_actionPerformed(ActionEvent e) {
    // Fix until Sun's JVM supports more locales...
    UIManager.put("FileChooser.lookInLabelText", Local.getString("Look in:"));
    UIManager.put("FileChooser.upFolderToolTipText", Local.getString("Up One Level"));
    UIManager.put("FileChooser.newFolderToolTipText", Local.getString("Create New Folder"));
    UIManager.put("FileChooser.listViewButtonToolTipText", Local.getString("List"));
    UIManager.put("FileChooser.detailsViewButtonToolTipText", Local.getString("Details"));
    UIManager.put("FileChooser.fileNameLabelText", Local.getString("File Name:"));
    UIManager.put("FileChooser.filesOfTypeLabelText", Local.getString("Files of Type:"));
    UIManager.put("FileChooser.openButtonText", Local.getString("Open"));
    UIManager.put("FileChooser.openButtonToolTipText", Local.getString("Open selected file"));
    UIManager.put("FileChooser.cancelButtonText", Local.getString("Cancel"));
    UIManager.put("FileChooser.cancelButtonToolTipText", Local.getString("Cancel"));

    JFileChooser chooser = new JFileChooser();
    chooser.setFileHidingEnabled(false);
    chooser.setDialogTitle(Local.getString("Insert file"));
    chooser.setAcceptAllFileFilterUsed(false);
    chooser.setFileSelectionMode(JFileChooser.FILES_ONLY);
    chooser.addChoosableFileFilter(new AllFilesFilter(AllFilesFilter.HTML));
    chooser.setPreferredSize(new Dimension(550, 375));
    String lastSel = (String) Context.get("LAST_SELECTED_IMPORT_FILE");
    if (lastSel != null) chooser.setCurrentDirectory(new java.io.File(lastSel));
    if (chooser.showOpenDialog(this) != JFileChooser.APPROVE_OPTION) return;

    Context.put("LAST_SELECTED_IMPORT_FILE", chooser.getSelectedFile().getPath());

    File f = chooser.getSelectedFile();
    new HTMLFileImport(f, editor);
  }
コード例 #2
0
 public static boolean check_activeOnly() {
   Object o = Context.get("SHOW_ACTIVE_TASKS_ONLY");
   if (o == null) return false;
   return o.toString().equals("true");
 }
コード例 #3
0
  void exportB_actionPerformed(ActionEvent e) {
    // Fix until Sun's JVM supports more locales...
    UIManager.put("FileChooser.lookInLabelText", Local.getString("Save in:"));
    UIManager.put("FileChooser.upFolderToolTipText", Local.getString("Up One Level"));
    UIManager.put("FileChooser.newFolderToolTipText", Local.getString("Create New Folder"));
    UIManager.put("FileChooser.listViewButtonToolTipText", Local.getString("List"));
    UIManager.put("FileChooser.detailsViewButtonToolTipText", Local.getString("Details"));
    UIManager.put("FileChooser.fileNameLabelText", Local.getString("File Name:"));
    UIManager.put("FileChooser.filesOfTypeLabelText", Local.getString("Files of Type:"));
    UIManager.put("FileChooser.saveButtonText", Local.getString("Save"));
    UIManager.put("FileChooser.saveButtonToolTipText", Local.getString("Save selected file"));
    UIManager.put("FileChooser.cancelButtonText", Local.getString("Cancel"));
    UIManager.put("FileChooser.cancelButtonToolTipText", Local.getString("Cancel"));

    JFileChooser chooser = new JFileChooser();
    chooser.setFileHidingEnabled(false);
    chooser.setDialogTitle(Local.getString("Export note"));
    chooser.setAcceptAllFileFilterUsed(false);
    chooser.setFileSelectionMode(JFileChooser.FILES_ONLY);
    chooser.addChoosableFileFilter(new AllFilesFilter(AllFilesFilter.XHTML));
    chooser.addChoosableFileFilter(new AllFilesFilter(AllFilesFilter.HTML));
    // chooser.addChoosableFileFilter(new
    // AllFilesFilter(AllFilesFilter.RTF));
    String lastSel = (String) Context.get("LAST_SELECTED_EXPORT_FILE");
    if (lastSel != null) chooser.setCurrentDirectory(new File(lastSel));

    FileExportDialog dlg =
        new FileExportDialog(App.getFrame(), Local.getString("Export note"), chooser);
    String enc = (String) Context.get("EXPORT_FILE_ENCODING");
    if (enc != null) dlg.encCB.setSelectedItem(enc);
    String templ = (String) Context.get("EXPORT_TEMPLATE");
    if (templ != null) dlg.templF.setText(templ);
    String xhtml = (String) Context.get("EXPORT_XHTML");
    if ((xhtml != null) && (xhtml.equalsIgnoreCase("YES"))) dlg.xhtmlChB.setSelected(true);
    String num = (String) Context.get("EXPORT_NUMENT");
    if ((num != null) && (num.equalsIgnoreCase("YES"))) dlg.numentChB.setSelected(true);
    Dimension dlgSize = new Dimension(550, 475);
    dlg.setSize(dlgSize);
    Dimension frmSize = App.getFrame().getSize();
    Point loc = App.getFrame().getLocation();
    dlg.setLocation(
        (frmSize.width - dlgSize.width) / 2 + loc.x, (frmSize.height - dlgSize.height) / 2 + loc.y);
    dlg.setVisible(true);
    if (dlg.CANCELLED) return;

    Context.put("LAST_SELECTED_EXPORT_FILE", chooser.getSelectedFile().getPath());
    Context.put("EXPORT_FILE_ENCODING", dlg.encCB.getSelectedItem());
    Context.put("EXPORT_NUMENT", dlg.numentChB.isSelected() ? "YES" : "NO");
    Context.put("EXPORT_XHTML", dlg.xhtmlChB.isSelected() ? "YES" : "NO");
    String template = null;
    if (dlg.usetemplChB.isSelected() && dlg.templF.getText().length() > 0) {
      template = dlg.templF.getText();
      Context.put("EXPORT_TEMPLATE", template);
    }
    /*
     * if (chooser.getFileFilter().getDescription().equals("Rich Text
     * Format")) new RTFFileExport(chooser.getSelectedFile(),
     * editor.document); else
     */
    int ei = dlg.encCB.getSelectedIndex();
    enc = null;
    if (ei == 1) enc = "UTF-8";
    File f = chooser.getSelectedFile();
    new HTMLFileExport(
        f,
        editor.document,
        CurrentNote.get(),
        enc,
        dlg.numentChB.isSelected(),
        template,
        dlg.xhtmlChB.isSelected());
  }