protected void logEventSelected(LogView4JEvent event) { Object eventObj = event.get(LogView4JEventKey.LOGGING_EVENT); markerButton.setEnabled(false); if (eventObj == null) { markerButton.setEnabled(false); } else { LogView4JLoggingEvent[] events = (LogView4JLoggingEvent[]) eventObj; if (events.length > 0) { markerButton.setEnabled(true); } } }
/** Registers listeners on the buttons */ protected void registerListeners() { LevelChangeActionListener levelChangeListener = new LevelChangeActionListener(); debugButton.addActionListener(levelChangeListener); infoButton.addActionListener(levelChangeListener); warnButton.addActionListener(levelChangeListener); errorButton.addActionListener(levelChangeListener); fatalButton.addActionListener(levelChangeListener); playButton.addActionListener(new PlayPauseActionListener()); deleteButton.addActionListener(new ClearEventsActionListener()); quickFilterTextField.getDocument().addDocumentListener(new QuickFilterDocumentListener()); markerButton.addActionListener(new EventMarkerAction()); prevMarkedButton.addActionListener(new PrevMarkedAction()); nextMarkedButton.addActionListener(new NextMarkedAction()); regularExpressionCheckBox.addActionListener(new RegexToggleListener()); LogView4JEventManager.getInstance().register(this); }
/** Initializes the toolbar buttons */ protected void init() { super.init(); markerButton.setEnabled(false); quickFilterTextField.setMaximumSize(new Dimension(250, 20)); quickFilterTextField.setToolTipText("Quick filter"); regularExpressionCheckBox.setOpaque(false); regularExpressionCheckBox.setToolTipText("Treat the filter text as a regular expression"); add(quickFilterTextField); add(regularExpressionCheckBox); addDividerButton(); add(debugButton); add(infoButton); add(warnButton); add(errorButton); add(fatalButton); addDividerButton(); add(markerButton); add(prevMarkedButton); add(nextMarkedButton); addDividerButton(); add(playButton); add(deleteButton); registerListeners(); }