protected ToolDisplayHandler() { ToolMessage.displayInfo("creating new display and handler: %s", this); display = new ToolDisplay(); listener = new TitleListener(); setupUtilitiesTab(); setupControlTab(); setupLogsTab(); setupLogDisplay(); setupFooter(); Center.listen(Events.LogsFound.class, this, true); Center.listen(Events.LogRefsFound.class, this, true); Center.listen(Events.GroupAdded.class, this, true); final String boundsKey = this.toString(); Center.listen( new NBToolShutdownListener() { @Override public void nbtoolShutdownCallback() { DisplaySettings end = new DisplaySettings( display.getBounds(), viewProfile, display.topLevelSplit.getDividerLocation()); UserSettings.BOUNDS_MAP.put(boundsKey, end); } }); DisplaySettings ds = UserSettings.BOUNDS_MAP.get(boundsKey); if (ds != null) { display.setBounds(ds.bounds); display.topLevelSplit.setDividerLocation(ds.splitLocation); viewProfile = ds.profile == null ? ViewProfile.DEFAULT_PROFILE : ds.profile; } display.setTitle("nbtool v" + ToolSettings.VERSION + "." + ToolSettings.MINOR_VERSION); display.setMinimumSize(MIN_SIZE); if (id == 0) { display.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); } else { display.setDefaultCloseOperation(JFrame.HIDE_ON_CLOSE); } setupKeyBindings(); display.topLevelSplit.setContinuousLayout(false); display.topLevelSplit.setAutoscrolls(false); Dimension min = ToolSettings.DEFAULT_BOUNDS.getSize(); min.width = 0; display.leftSideTabs.setMinimumSize(min); display.displayTabs.setMinimumSize(min); display.topLevelSplit.requestFocus(); }
private void controlLoadAction() { if (robot == null) { Path selected = (Path) display.pathBox.getSelectedItem(); if (selected == null) { Debug.error("null path"); ToolMessage.display("load action: null path", Color.RED); return; } if (FileIO.isValidLogFolder(selected)) { updateComboBoxAndSettings(display.pathBox, UserSettings.loadPathes, selected); lastGroup = Group.groupFromPath(selected); LogReference[] added; try { added = FileIO.readAllRefsFromPath(selected, true); } catch (Throwable e) { ToolMessage.displayError( "error {%s} (see below) reading Log refs from %s", e.getMessage(), selected); e.printStackTrace(); return; } lastGroup.add(added); // Log[] addedLogs = new Log[added.length]; // for (int i = 0; i < added.length; ++i) // addedLogs[i] = added[i].get(); ToolMessage.displayInfo("loaded %d logs into %s", added.length, lastGroup); Events.GGroupAdded.generate(this, lastGroup); Events.GLogRefsFound.generate(this, added); // Events.GLogsFound.generate(this, addedLogs); display.leftSideTabs.setSelectedComponent(display.logTab); } else { Debug.error("invalid Log folder: " + selected.toString()); ToolMessage.display("invalid Log folder: " + selected.toString(), Color.RED); return; } } else { Debug.error("cannot load session while streaming (%s)", robot); ToolMessage.display("cannot load session while streaming", Color.ORANGE); } }