in src/main/java/org/apache/log4j/chainsaw/LogUI.java [1631:1708]
private void buildLogPanel(
boolean customExpression, final String ident, final List<ChainsawLoggingEvent> events, final ChainsawReceiver rx)
throws IllegalArgumentException {
final LogPanel thisPanel = new LogPanel(getStatusBar(), ident, cyclicBufferSize, allColorizers, applicationPreferenceModel, globalRuleColorizer);
if( !customExpression && rx != null ){
thisPanel.setReceiver(rx);
}
/**
* Now add the panel as a batch listener so it can handle it's own
* batchs
*/
if (customExpression) {
// handler.addCustomEventBatchListener(ident, thisPanel);
} else {
identifierPanels.add(thisPanel);
// handler.addEventBatchListener(thisPanel);
}
TabIconHandler iconHandler = new TabIconHandler(ident);
thisPanel.addEventCountListener(iconHandler);
tabbedPane.addChangeListener(iconHandler);
PropertyChangeListener toolbarMenuUpdateListener =
evt -> tbms.stateChange();
thisPanel.addPropertyChangeListener(toolbarMenuUpdateListener);
thisPanel.addPreferencePropertyChangeListener(toolbarMenuUpdateListener);
thisPanel.addPropertyChangeListener(
"docked",
evt -> {
LogPanel logPanel = (LogPanel) evt.getSource();
if (logPanel.isDocked()) {
getPanelMap().put(logPanel.getIdentifier(), logPanel);
getTabbedPane().addANewTab(
logPanel.getIdentifier(), logPanel, null,
true);
getTabbedPane().setSelectedTab(getTabbedPane().indexOfTab(logPanel.getIdentifier()));
} else {
getTabbedPane().remove(logPanel);
}
});
logger.debug("adding logpanel to tabbed pane: " + ident);
//NOTE: tab addition is a very fragile process - if you modify this code,
//verify the frames in the individual log panels initialize to their
//correct sizes
getTabbedPane().add(ident, thisPanel);
getPanelMap().put(ident, thisPanel);
/**
* Let the new LogPanel receive this batch
*/
SwingUtilities.invokeLater(
() -> {
getTabbedPane().addANewTab(
ident,
thisPanel,
new ImageIcon(ChainsawIcons.ANIM_RADIO_TOWER),
false);
thisPanel.layoutComponents();
getTabbedPane().addANewTab(ChainsawTabbedPane.ZEROCONF,
m_zeroConf,
null,
false);
});
String msg = "added tab " + ident;
logger.debug(msg);
}