public void bootOptionsReceived(BootEvent bootEvent) { log.info(" boot options received " + bootEvent.getNewSessionOptions()); // reload setting, to ensure correct bootstraps ConfigureFactory.getInstance().reloadSettings(); // If the options are not equal to the string 'null' then we have boot options if (!bootEvent.getNewSessionOptions().equals("null")) { // check if a session parameter is specified on the command line String[] args = new String[TN5250jConstants.NUM_PARMS]; parseArgs(bootEvent.getNewSessionOptions(), args); if (isSpecified("-s", args)) { String sd = getParm("-s", args); if (sessions.containsKey(sd)) { parseArgs(sessions.getProperty(sd), args); final String[] args2 = args; final String sd2 = sd; SwingUtilities.invokeLater(() -> newSession(sd2, args2)); } } else { if (args[0].startsWith("-")) { SwingUtilities.invokeLater(() -> startNewSession()); } else { final String[] args2 = args; final String sd2 = args[0]; SwingUtilities.invokeLater(() -> newSession(sd2, args2)); } } } else { SwingUtilities.invokeLater(() -> startNewSession()); } }
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); } }
private static void loadSessions() { sessions = (ConfigureFactory.getInstance()).getProperties(ConfigureFactory.SESSIONS); }
public static void loadMacros(SessionPanel session, JMenu menu) { final SessionPanel ses = session; Vector mv = new Vector(); Action action; menu.addSeparator(); String[] macrosList = Macronizer.getMacroList(); for (int x = 0; x < macrosList.length; x++) { mv.add(macrosList[x]); } Collections.sort(mv); for (int x = 0; x < mv.size(); x++) { action = new AbstractAction((String) mv.get(x)) { private static final long serialVersionUID = 1L; public void actionPerformed(ActionEvent e) { ses.executeMacro(e); } }; JMenuItem mi = menu.add(action); mi.addMouseListener( new MouseAdapter() { public void mouseReleased(MouseEvent e) { if (SwingUtilities.isRightMouseButton(e)) { doOptionsPopup(e, ses); } } public void mousePressed(MouseEvent e) { if (SwingUtilities.isRightMouseButton(e)) { doOptionsPopup(e, ses); } } public void mouseClicked(MouseEvent e) { if (SwingUtilities.isRightMouseButton(e)) { doOptionsPopup(e, ses); } } }); } scriptDir("scripts", menu, session); String conPath = ""; String conPath2 = ""; try { conPath = new File("scripts").getCanonicalPath(); conPath2 = new File( ConfigureFactory.getInstance().getProperty("emulator.settingsDirectory") + "scripts") .getCanonicalPath(); } catch (IOException ioe) { } // lets not load the menu again if they point to the same place if (!conPath.equals(conPath2)) scriptDir( ConfigureFactory.getInstance().getProperty("emulator.settingsDirectory") + "scripts", menu, session); }