예제 #1
0
  private void newView() {
    Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();
    int width = screenSize.width;
    int height = screenSize.height - 80;
    frame = new TerminalFrame(this);

    frame.setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));

    frame.setSize(width, height);
    frame.centerFrame();
    frames.add(frame);
  }
예제 #2
0
  protected synchronized SessionPanel newSession(String sel, String[] args) {

    Properties sesProps = new Properties();

    String propFileName = null;
    String session = args[0];

    // Start loading properties
    sesProps.put(TN5250jConstants.SESSION_HOST, session);

    if (isSpecified("-e", args)) sesProps.put(TN5250jConstants.SESSION_TN_ENHANCED, "1");

    if (isSpecified("-p", args)) {
      sesProps.put(TN5250jConstants.SESSION_HOST_PORT, getParm("-p", args));
    }

    if (isSpecified("-f", args)) propFileName = getParm("-f", args);

    //  TODO: remove default codepage behavior and replace it with 870

    if (isSpecified("-cp", args))
      sesProps.put(TN5250jConstants.SESSION_CODE_PAGE, getParm("-cp", args));

    sesProps.put(TN5250jConstants.SESSION_USE_GUI, "1");

    if (isSpecified("-t", args)) sesProps.put(TN5250jConstants.SESSION_TERM_NAME_SYSTEM, "1");

    sesProps.put(TN5250jConstants.SESSION_SCREEN_SIZE, TN5250jConstants.SCREEN_SIZE_24X80_STR);

    //  TODO: are we to use a ssl and if we are what type
    sesProps.put(TN5250jConstants.SSL_TYPE, TN5250jConstants.SSL_TYPE_TLS);

    // check if device name is specified
    if (isSpecified("-dn=hostname", args)) {
      String dnParam;

      // use IP address as device name
      try {
        dnParam = InetAddress.getLocalHost().getHostName();
      } catch (UnknownHostException uhe) {
        dnParam = "UNKNOWN_HOST";
      }

      sesProps.put(TN5250jConstants.SESSION_DEVICE_NAME, dnParam);
    } else if (isSpecified("-dn", args)) {

      sesProps.put(TN5250jConstants.SESSION_DEVICE_NAME, getParm("-dn", args));
    }

    if (isSpecified("-hb", args)) sesProps.put(TN5250jConstants.SESSION_HEART_BEAT, "1");

    int sessionCount = manager.getSessions().getCount();

    // here we open a new 5250 session on the current session manager
    Session5250 s2 = manager.openSession(sesProps, propFileName, sel);
    // ... and a panel containing it
    SessionPanel s = new SessionPanel(s2);

    newView();
    frame.setVisible(true);
    frame.setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR));

    if (isSpecified("-t", args)) frame.addSessionView(sel, s);
    else frame.addSessionView(session, s);

    s.connect();

    s.addEmulatorActionListener(this);

    return s;
  }