Esempio n. 1
0
 private void process(final boolean parallel) {
   if (sim != null) {
     sim.stopAndWait();
   }
   try {
     sim = null;
     final Future<Result<T>> fenv = EnvironmentBuilder.build(new FileInputStream(xml));
     final IEnvironment<T> env = fenv.get().getEnvironment();
     rand = fenv.get().getRandomEngine();
     sim = new Simulation<>(env, new DoubleTime(Double.POSITIVE_INFINITY), parallel);
     bar.setSimulation(sim);
     scp.setSimulation(sim);
     final Thread simThread = new Thread(sim);
     createMonitor();
     simThread.start();
     final TimeStepMonitor<T> tm = bar.getTimeMonitor();
     sim.addOutputMonitor(tm);
     bar.setRandom(rand.getSeed());
     bar.setFileOK(true);
     bar.setProcessOK(true);
     effectsTab.setEnabled(true);
     status.setOK();
     status.setText(r(Res.FILE_PROCESSED) + ": " + xml.getAbsolutePath());
   } catch (Exception e) {
     processError(e);
   }
 }
Esempio n. 2
0
  /** Builds a new SAPERE perspective. */
  public Perspective() {
    super();
    setLayout(new BorderLayout());

    bar = new UpperBar(scp);
    add(bar, BorderLayout.NORTH);
    bar.addActionListener(this);
    bar.addChangeListener(this);

    status = new StatusBar();
    status.setText(r(Res.SAPERE_PERSPECTIVE));
    add(status, BorderLayout.SOUTH);

    effectsTab = new JEffectsTab<>();
    effectsTab.addLinksToggleActionListener(this);
    effectsTab.setEnabled(false);

    bar.registerTab(effectsTab);

    setMainDisplay(new Generic2DDisplay<T>());
  }