Esempio n. 1
0
 protected void closeSessionInternal(SessionPanel sesspanel) {
   TerminalViewInterface f = getParentView(sesspanel);
   if (f == null) {
     return;
   }
   Sessions sessions = manager.getSessions();
   if ((sessions.item(sesspanel.getSession())) != null) {
     f.removeSessionView(sesspanel);
     manager.closeSession(sesspanel);
   }
   if (manager.getSessions().getCount() < 1) {
     closingDown(f);
   }
 }
Esempio n. 2
0
  public SessionPanel startNewSession() {
    String sel = "";
    if (containsNotOnlyNullValues(sessionArgs) && !sessionArgs[0].startsWith("-")) {
      sel = sessionArgs[0];
    } else {
      sel = getDefaultSession();
    }

    Sessions sess = manager.getSessions();

    if (sel != null && sess.getCount() == 0 && sessions.containsKey(sel)) {
      sessionArgs = new String[TN5250jConstants.NUM_PARMS];
      parseArgs(sessions.getProperty(sel), sessionArgs);
    }

    return newSession(sel, sessionArgs);
  }
Esempio n. 3
0
  protected void closingDown(TerminalViewInterface view) {

    Sessions sess = manager.getSessions();

    if (log.isDebugEnabled()) {
      log.debug("number of active sessions is " + sess.getCount());
    }

    if (viewNamesForNextStartBuilder == null) {
      // preserve sessions for next boot
      viewNamesForNextStartBuilder = new StringBuilder();
    }
    while (view.getSessionViewCount() > 0) {
      SessionPanel sesspanel = view.getSessionAt(0);
      viewNamesForNextStartBuilder.append("-s ").append(sesspanel.getSessionName()).append(" ");
      closeSessionInternal(sesspanel);
    }

    sessions.setProperty(
        "emul.frame" + view.getFrameSequence(),
        view.getX() + "," + view.getY() + "," + view.getWidth() + "," + view.getHeight());

    frames.remove(view);
    view.dispose();

    log.debug("number of active sessions we have after shutting down " + sess.getCount());

    log.info("view settings " + viewNamesForNextStartBuilder);
    if (sess.getCount() == 0) {

      sessions.setProperty("emul.width", Integer.toString(view.getWidth()));
      sessions.setProperty("emul.height", Integer.toString(view.getHeight()));
      sessions.setProperty("emul.view", viewNamesForNextStartBuilder.toString());

      // save off the session settings before closing down
      ConfigureFactory.getInstance()
          .saveSettings(
              ConfigureFactory.SESSIONS, ConfigureFactory.SESSIONS, "------ Defaults --------");
      if (controller != null) {
        controller.interrupt();
      }
      System.exit(0);
    }
  }