public void configurationActived(TetradLoggerEvent evt) { TetradLoggerConfig config = evt.getTetradLoggerConfig(); // if logging is actually turned on, then open display. if (TetradLogger.getInstance().isLogging() && config.isActive() && TetradLogger.getInstance().isDisplayLogEnabled()) { // if the log display isn't already up, open it. if (!isDisplayLogging() && allowAutomaticLogPopup()) { setDisplayLogging(true); } } }
/** * States whether the log display should be automatically displayed, if there is no value in the * user's prefs then it will display a prompt asking the user whether they would like to disable * automatic popups. */ private boolean allowAutomaticLogPopup() { Boolean allowed = TetradLogger.getInstance().isAutomaticLogDisplayEnabled(); // ask the user whether they way the feature etc. if (allowed == null) { String message = "<html>Whenever Tetrad's logging features are active any generated log <br>" + "output will be automatically display in Tetrad's log display. Would you like Tetrad<br>" + "to continue to automatically open the log display window whenever there is logging output?</html>"; int option = JOptionPane.showConfirmDialog( this, message, "Automatic Logging", JOptionPane.YES_NO_OPTION); if (option == JOptionPane.NO_OPTION) { JOptionPane.showMessageDialog( this, "This feature can be enabled later by going to Logging>Setup Logging."); } TetradLogger.getInstance().setAutomaticLogDisplayEnabled(option == JOptionPane.YES_OPTION); // return true, so that opens this time, in the future the user's pref will be used. return true; } return allowed; }
/** * Sets whether the display log output should be displayed or not. If true then a text area * roughly 20% of the screen size will appear on the bottom and will display any log output, * otherwise just the standard tetrad workbend is shown. * * @param displayLogging */ public void setDisplayLogging(boolean displayLogging) { if (displayLogging) { this.logArea = new TetradLogArea(this); } else { if (this.logArea != null) { TetradLogger.getInstance().removeOutputStream(this.logArea.getOutputStream()); } this.logArea = null; } setupDesktop(); revalidate(); repaint(); }
/** Constructs a new desktop. */ public TetradDesktop() { setBackground(new Color(204, 204, 204)); sessionNodeKeys = new ArrayList(); // Create the desktop pane. this.desktopPane = new JDesktopPane(); // Do layout. setLayout(new BorderLayout()); desktopPane.setDesktopManager(new DefaultDesktopManager()); desktopPane.setBorder(new BevelBorder(BevelBorder.LOWERED)); desktopPane.addPropertyChangeListener(this); this.setupDesktop(); TetradLogger.getInstance().addTetradLoggerListener(new LoggerListener()); }