Ejemplo n.º 1
0
  @Override
  public void actionPerformed(final ActionEvent e) {

    final Preferences pref = Preferences.userNodeForPackage(RunJavaScriptAction.class);

    JFileChooser chooser = new JFileChooser(pref.get(JAVASCRIPT_DIR, null));

    if (chooser.showOpenDialog(UIApplication.getFrame()) == JFileChooser.APPROVE_OPTION) {
      pref.put(JAVASCRIPT_DIR, chooser.getCurrentDirectory().getAbsolutePath());

      final String file = chooser.getSelectedFile().getAbsolutePath();

      EventQueue.invokeLater(
          new Runnable() {

            @Override
            public void run() {

              try (FileReader reader = new FileReader(file)) {
                new ScriptEngineManager().getEngineByName("JavaScript").eval(reader);
              } catch (IOException | ScriptException e) {
                Logger.getLogger(RunJavaScriptAction.class.getName())
                    .log(Level.SEVERE, e.toString(), e);
              }
            }
          });
    }
  }
Ejemplo n.º 2
0
  public ImportDialog() {
    super(UIApplication.getFrame());

    setTitle(rb.getString("Title.ImportTransactions"));

    addTaskPage(new ImportOne());
    addTaskPage(new ImportTwo());
    addTaskPage(new ImportSummary());

    DialogUtils.addBoundsListener(this);
  }
  /**
   * Creates new form AbstractDateChkNumberDialog
   *
   * @param a the account for the transaction. This can be null.
   * @param title Title for the dialog
   */
  DateChkNumberDialog(final Account a, final String title) {
    super(UIApplication.getFrame(), ModalityType.APPLICATION_MODAL);

    setTitle(title);

    setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);

    this.account = a;

    buildPanel();

    if (a != null) {
      numberCombo.setText(a.getNextTransactionNumber());
    }

    pack();
    setMinimumSize(getSize());

    DialogUtils.addBoundsListener(this);
  }
Ejemplo n.º 4
0
 public TransactionListDialog() {
   super(UIApplication.getFrame(), true);
   setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);
   layoutMainPanel();
   setLocationRelativeTo(UIApplication.getFrame());
 }
Ejemplo n.º 5
0
 public GenericCloseDialog(final JComponent panel, final String title) {
   this(UIApplication.getFrame(), panel, title);
 }