Replace 'search' in the UI with 'find' Syncing addition & removal of entries in the refine focus & find combo boxes
Project: http://git-wip-us.apache.org/repos/asf/logging-chainsaw/repo Commit: http://git-wip-us.apache.org/repos/asf/logging-chainsaw/commit/34497133 Tree: http://git-wip-us.apache.org/repos/asf/logging-chainsaw/tree/34497133 Diff: http://git-wip-us.apache.org/repos/asf/logging-chainsaw/diff/34497133 Branch: refs/heads/master Commit: 344971335cfdf8005de1d920a3b21d748ef120d3 Parents: 622fc25 Author: Scott Deboy <[email protected]> Authored: Mon Oct 25 05:00:03 2010 +0000 Committer: Scott Deboy <[email protected]> Committed: Mon Oct 25 05:00:03 2010 +0000 ---------------------------------------------------------------------- .../log4j/chainsaw/ChainsawStatusBar.java | 4 +- .../log4j/chainsaw/ChainsawToolBarAndMenus.java | 8 ++-- .../org/apache/log4j/chainsaw/LogPanel.java | 48 +++++++++++++------- .../log4j/chainsaw/LogPanelPreferencePanel.java | 4 +- .../log4j/chainsaw/LoggerNameTreePanel.java | 10 ++-- .../apache/log4j/chainsaw/color/ColorPanel.java | 2 +- .../log4j/chainsaw/help/release-notes.html | 6 +-- .../apache/log4j/chainsaw/help/tutorial.html | 12 ++--- 8 files changed, 54 insertions(+), 40 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/logging-chainsaw/blob/34497133/src/main/java/org/apache/log4j/chainsaw/ChainsawStatusBar.java ---------------------------------------------------------------------- diff --git a/src/main/java/org/apache/log4j/chainsaw/ChainsawStatusBar.java b/src/main/java/org/apache/log4j/chainsaw/ChainsawStatusBar.java index 55d9f29..ddaaf73 100644 --- a/src/main/java/org/apache/log4j/chainsaw/ChainsawStatusBar.java +++ b/src/main/java/org/apache/log4j/chainsaw/ChainsawStatusBar.java @@ -104,7 +104,7 @@ public class ChainsawStatusBar extends JPanel { searchMatchLabel.setToolTipText("<# viewable events>:<# total events>"); searchMatchLabel.setMinimumSize( new Dimension( - searchMatchLabel.getFontMetrics(eventCountLabel.getFont()).stringWidth("Search matches: 999999999999") + 5, + searchMatchLabel.getFontMetrics(eventCountLabel.getFont()).stringWidth("Find matches: 999999999999") + 5, (int) searchMatchLabel.getPreferredSize().getHeight())); receivedConnectionlabel.setBorder(statusBarComponentBorder); @@ -273,7 +273,7 @@ public class ChainsawStatusBar extends JPanel { if (searchMatchCount == 0) { searchMatchLabel.setText(""); } else { - searchMatchLabel.setText("Search matches: " + searchMatchCount); + searchMatchLabel.setText("Find matches: " + searchMatchCount); } } } http://git-wip-us.apache.org/repos/asf/logging-chainsaw/blob/34497133/src/main/java/org/apache/log4j/chainsaw/ChainsawToolBarAndMenus.java ---------------------------------------------------------------------- diff --git a/src/main/java/org/apache/log4j/chainsaw/ChainsawToolBarAndMenus.java b/src/main/java/org/apache/log4j/chainsaw/ChainsawToolBarAndMenus.java index 9f5165a..ffe9543 100644 --- a/src/main/java/org/apache/log4j/chainsaw/ChainsawToolBarAndMenus.java +++ b/src/main/java/org/apache/log4j/chainsaw/ChainsawToolBarAndMenus.java @@ -274,7 +274,7 @@ class ChainsawToolBarAndMenus implements ChangeListener { } }; - action.putValue(Action.SHORT_DESCRIPTION, "Searches for the next marker from the current location"); + action.putValue(Action.SHORT_DESCRIPTION, "Find the next marker from the current location"); action.putValue("enabled", Boolean.TRUE); action.putValue(Action.MNEMONIC_KEY, new Integer(KeyEvent.VK_N)); action.putValue(Action.ACCELERATOR_KEY, KeyStroke.getKeyStroke("F2")); @@ -292,7 +292,7 @@ class ChainsawToolBarAndMenus implements ChangeListener { } }; - action.putValue(Action.SHORT_DESCRIPTION, "Searches for the previous marker from the current location"); + action.putValue(Action.SHORT_DESCRIPTION, "Find the previous marker from the current location"); action.putValue("enabled", Boolean.TRUE); action.putValue(Action.MNEMONIC_KEY, new Integer(KeyEvent.VK_P)); action.putValue(Action.ACCELERATOR_KEY, KeyStroke.getKeyStroke(KeyEvent.VK_F2, InputEvent.SHIFT_MASK)); @@ -892,7 +892,7 @@ class ChainsawToolBarAndMenus implements ChangeListener { } } }; - action.putValue(Action.SHORT_DESCRIPTION, "Searches for the next colorized event from the current location"); + action.putValue(Action.SHORT_DESCRIPTION, "Find the next colorized event from the current location"); action.putValue("enabled", Boolean.TRUE); action.putValue(Action.MNEMONIC_KEY, new Integer(KeyEvent.VK_N)); action.putValue(Action.ACCELERATOR_KEY, KeyStroke.getKeyStroke(KeyEvent.VK_N, Toolkit.getDefaultToolkit().getMenuShortcutKeyMask())); @@ -911,7 +911,7 @@ class ChainsawToolBarAndMenus implements ChangeListener { } } }; - action.putValue(Action.SHORT_DESCRIPTION, "Searches for the next colorized event from the current location"); + action.putValue(Action.SHORT_DESCRIPTION, "Find the next colorized event from the current location"); action.putValue("enabled", Boolean.TRUE); action.putValue(Action.MNEMONIC_KEY, new Integer(KeyEvent.VK_P)); action.putValue(Action.ACCELERATOR_KEY, KeyStroke.getKeyStroke(KeyEvent.VK_P, Toolkit.getDefaultToolkit().getMenuShortcutKeyMask())); http://git-wip-us.apache.org/repos/asf/logging-chainsaw/blob/34497133/src/main/java/org/apache/log4j/chainsaw/LogPanel.java ---------------------------------------------------------------------- diff --git a/src/main/java/org/apache/log4j/chainsaw/LogPanel.java b/src/main/java/org/apache/log4j/chainsaw/LogPanel.java index ea80971..d2bc5e3 100644 --- a/src/main/java/org/apache/log4j/chainsaw/LogPanel.java +++ b/src/main/java/org/apache/log4j/chainsaw/LogPanel.java @@ -79,6 +79,7 @@ import javax.swing.Box; import javax.swing.BoxLayout; import javax.swing.ButtonGroup; import javax.swing.ComboBoxEditor; +import javax.swing.ComboBoxModel; import javax.swing.ImageIcon; import javax.swing.JButton; import javax.swing.JCheckBoxMenuItem; @@ -288,12 +289,13 @@ public class LogPanel extends DockablePanel implements EventBatchListener, Profi String prototypeValue = "1231231231231231231231"; filterCombo = new AutoFilterComboBox(); + findCombo = new AutoFilterComboBox(); + filterCombo.setPrototypeDisplayValue(prototypeValue); - buildCombo(filterCombo, true); + buildCombo(filterCombo, true, findCombo.model); - findCombo = new AutoFilterComboBox(); findCombo.setPrototypeDisplayValue(prototypeValue); - buildCombo(findCombo, false); + buildCombo(findCombo, false, filterCombo.model); final Map columnNameKeywordMap = new HashMap(); columnNameKeywordMap.put(ChainsawConstants.CLASS_COL_NAME, LoggingEventFieldResolver.CLASS_FIELD); @@ -1105,20 +1107,28 @@ public class LogPanel extends DockablePanel implements EventBatchListener, Profi upperPanel.add(filterCombo); upperPanel.add(Box.createHorizontalStrut(3)); + final JTextField filterText =(JTextField) filterCombo.getEditor().getEditorComponent(); + final JTextField findText =(JTextField) findCombo.getEditor().getEditorComponent(); + + //Adding a button to clear filter expressions which are currently remembered by Chainsaw... final JButton removeFilterButton = new JButton(" Remove "); - final JTextField filterText =(JTextField) filterCombo.getEditor().getEditorComponent(); + removeFilterButton.setToolTipText("Click here to remove the selected expression from the list"); removeFilterButton.addActionListener( new AbstractAction() { public void actionPerformed(ActionEvent e){ Object selectedItem = filterCombo.getSelectedItem(); if (e.getSource() == removeFilterButton && selectedItem != null && !selectedItem.toString().trim().equals("")){ - //don't just remove the entry from the store, clear the field - int index = filterCombo.getSelectedIndex(); - filterText.setText(null); - filterCombo.setSelectedIndex(-1); - filterCombo.removeItemAt(index); + //don't just remove the entry from the store, clear the field + int index = filterCombo.getSelectedIndex(); + filterText.setText(null); + filterCombo.setSelectedIndex(-1); + filterCombo.removeItemAt(index); + if (!(findCombo.getSelectedItem() != null && findCombo.getSelectedItem().equals(selectedItem))) { + //now remove the entry from the other model + ((AutoFilterComboBox.AutoFilterComboBoxModel)findCombo.getModel()).removeElement(selectedItem); + } } } } @@ -1162,18 +1172,21 @@ public class LogPanel extends DockablePanel implements EventBatchListener, Profi //Adding a button to clear filter expressions which are currently remembered by Chainsaw... final JButton removeFindButton = new JButton(" Remove "); - final JTextField findText =(JTextField) findCombo.getEditor().getEditorComponent(); removeFindButton.setToolTipText("Click here to remove the selected expression from the list"); removeFindButton.addActionListener( new AbstractAction() { public void actionPerformed(ActionEvent e){ Object selectedItem = findCombo.getSelectedItem(); if (e.getSource() == removeFindButton && selectedItem != null && !selectedItem.toString().trim().equals("")){ - //don't just remove the entry from the store, clear the field - int index = findCombo.getSelectedIndex(); - findText.setText(null); - findCombo.setSelectedIndex(-1); - findCombo.removeItemAt(index); + //don't just remove the entry from the store, clear the field + int index = findCombo.getSelectedIndex(); + findText.setText(null); + findCombo.setSelectedIndex(-1); + findCombo.removeItemAt(index); + if (!(filterCombo.getSelectedItem() != null && filterCombo.getSelectedItem().equals(selectedItem))) { + //now remove the entry from the other model if it wasn't selected + ((AutoFilterComboBox.AutoFilterComboBoxModel)filterCombo.getModel()).removeElement(selectedItem); + } } } } @@ -1796,7 +1809,7 @@ public class LogPanel extends DockablePanel implements EventBatchListener, Profi class ClearSearch extends AbstractAction { public ClearSearch() { - super("Clear search field"); + super("Clear find field"); } public void actionPerformed(ActionEvent e) { findCombo.setSelectedItem(null); @@ -1959,7 +1972,7 @@ public class LogPanel extends DockablePanel implements EventBatchListener, Profi return action; } - private void buildCombo(final JComboBox combo, boolean isFiltering) { + private void buildCombo(final AutoFilterComboBox combo, boolean isFiltering, final AutoFilterComboBox.AutoFilterComboBoxModel otherModel) { //add (hopefully useful) default filters combo.addItem("LEVEL == TRACE"); combo.addItem("LEVEL >= DEBUG"); @@ -1987,6 +2000,7 @@ public class LogPanel extends DockablePanel implements EventBatchListener, Profi ExpressionRule.getRule(item.toString()); //add entry as first row of the combo box combo.insertItemAt(item, 0); + otherModel.insertElementAt(item, 0); } //valid expression, reset background color in case we were previously an invalid expression filterText.setBackground(UIManager.getColor("TextField.background")); http://git-wip-us.apache.org/repos/asf/logging-chainsaw/blob/34497133/src/main/java/org/apache/log4j/chainsaw/LogPanelPreferencePanel.java ---------------------------------------------------------------------- diff --git a/src/main/java/org/apache/log4j/chainsaw/LogPanelPreferencePanel.java b/src/main/java/org/apache/log4j/chainsaw/LogPanelPreferencePanel.java index 254b59c..6967785 100644 --- a/src/main/java/org/apache/log4j/chainsaw/LogPanelPreferencePanel.java +++ b/src/main/java/org/apache/log4j/chainsaw/LogPanelPreferencePanel.java @@ -531,8 +531,8 @@ public class LogPanelPreferencePanel extends AbstractPreferencePanel private final JCheckBox loggerTreePanel = new JCheckBox("Show Logger Tree"); private final JCheckBox wrapMessage = new JCheckBox("Wrap message field (display multi-line rows) "); - private final JCheckBox searchResultsVisible = new JCheckBox("Display search results in details panel "); - private final JCheckBox highlightSearchMatchText = new JCheckBox("Highlight search match text "); + private final JCheckBox searchResultsVisible = new JCheckBox("Display find results in details panel "); + private final JCheckBox highlightSearchMatchText = new JCheckBox("Highlight find match text "); private final JCheckBox scrollToBottom = new JCheckBox("Scroll to bottom (view tracks with new events)"); private final JCheckBox showMillisDeltaAsGap = http://git-wip-us.apache.org/repos/asf/logging-chainsaw/blob/34497133/src/main/java/org/apache/log4j/chainsaw/LoggerNameTreePanel.java ---------------------------------------------------------------------- diff --git a/src/main/java/org/apache/log4j/chainsaw/LoggerNameTreePanel.java b/src/main/java/org/apache/log4j/chainsaw/LoggerNameTreePanel.java index 64fe415..f5ac429 100644 --- a/src/main/java/org/apache/log4j/chainsaw/LoggerNameTreePanel.java +++ b/src/main/java/org/apache/log4j/chainsaw/LoggerNameTreePanel.java @@ -829,7 +829,7 @@ final class LoggerNameTreePanel extends JPanel implements LoggerNameListener action.putValue(Action.NAME, "Find next"); action.putValue( Action.SHORT_DESCRIPTION, - "Search using the selected node"); + "Find using the selected node"); action.setEnabled(false); return action; @@ -941,10 +941,10 @@ final class LoggerNameTreePanel extends JPanel implements LoggerNameListener } }; - action.putValue(Action.NAME, "Clear search field"); + action.putValue(Action.NAME, "Clear find field"); action.putValue( Action.SHORT_DESCRIPTION, - "Clear the search field"); + "Clear the find field"); action.setEnabled(false); return action; @@ -1238,7 +1238,7 @@ final class LoggerNameTreePanel extends JPanel implements LoggerNameListener { focusOnAction.putValue(Action.NAME, "Focus On..."); hideAction.putValue(Action.NAME, "Ignore..."); - findNextAction.putValue(Action.NAME, "Search for..."); + findNextAction.putValue(Action.NAME, "Find..."); setRefineFocusAction.putValue(Action.NAME, "Set refine focus field"); updateRefineFocusAction.putValue(Action.NAME, "Add to refine focus field"); defineColorRuleForLoggerAction.putValue(Action.NAME, "Define color rule"); @@ -1247,7 +1247,7 @@ final class LoggerNameTreePanel extends JPanel implements LoggerNameListener { focusOnAction.putValue(Action.NAME, "Focus On '" + logger + "'"); hideAction.putValue(Action.NAME, "Ignore '" + logger + "'"); - findNextAction.putValue(Action.NAME, "Search for '" + logger + "'"); + findNextAction.putValue(Action.NAME, "Find '" + logger + "'"); setRefineFocusAction.putValue(Action.NAME, "Set refine focus field to '" + logger + "'"); updateRefineFocusAction.putValue(Action.NAME, "Add '" + logger + "' to 'refine focus' field"); defineColorRuleForLoggerAction.putValue(Action.NAME, "Define color rule for '" + logger + "'"); http://git-wip-us.apache.org/repos/asf/logging-chainsaw/blob/34497133/src/main/java/org/apache/log4j/chainsaw/color/ColorPanel.java ---------------------------------------------------------------------- diff --git a/src/main/java/org/apache/log4j/chainsaw/color/ColorPanel.java b/src/main/java/org/apache/log4j/chainsaw/color/ColorPanel.java index 184ace4..7dc0911 100644 --- a/src/main/java/org/apache/log4j/chainsaw/color/ColorPanel.java +++ b/src/main/java/org/apache/log4j/chainsaw/color/ColorPanel.java @@ -303,7 +303,7 @@ public class ColorPanel extends JPanel JPanel panel = new JPanel(); panel.setLayout(new BoxLayout(panel, BoxLayout.X_AXIS)); - JLabel defineSearchColorsLabel = new JLabel("Search colors"); + JLabel defineSearchColorsLabel = new JLabel("Find colors"); panel.add(defineSearchColorsLabel); http://git-wip-us.apache.org/repos/asf/logging-chainsaw/blob/34497133/src/main/resources/org/apache/log4j/chainsaw/help/release-notes.html ---------------------------------------------------------------------- diff --git a/src/main/resources/org/apache/log4j/chainsaw/help/release-notes.html b/src/main/resources/org/apache/log4j/chainsaw/help/release-notes.html index 3457d51..ed61f2c 100644 --- a/src/main/resources/org/apache/log4j/chainsaw/help/release-notes.html +++ b/src/main/resources/org/apache/log4j/chainsaw/help/release-notes.html @@ -17,7 +17,7 @@ </ul> <h2>13 Oct 2010</h2> <ul> -<li>Added log panel preference to display search results in the detail panel. When the preference is enabled and a search is performed, the matching rows are displayed in a table in the details panel. Clicking on a row in that table selects the row in the main event table.</li> +<li>Added log panel preference to display find results in the detail panel. When the preference is enabled and a search is performed, the matching rows are displayed in a table in the details panel. Clicking on a row in that table selects the row in the main event table.</li> </ul> <h2>22 Sep 2010</h2> <ul> @@ -25,9 +25,9 @@ </ul> <h2>15 Sep 2010</h2> <ul> -<li>New feature: Clickable thumbnail bar on the left shows time delta to prior displayed event if the time delta is > 1 second (behaves similarly to the thumbnail bar on the right which shows colors and search matches, but represents the time delta between events). A bigger delta is represented as a wider line.</li> +<li>New feature: Clickable thumbnail bar on the left shows time delta to prior displayed event if the time delta is > 1 second (behaves similarly to the thumbnail bar on the right which shows colors and find matches, but represents the time delta between events). A bigger delta is represented as a wider line.</li> <li>Updated table rendering logic when in line-wrap mode</li> -<li>Updated row selection logic (goto/search) to make sure event is on the screen</li> +<li>Updated row selection logic (goto/find) to make sure event is on the screen</li> <li>Capped the event time delta rendering in the table to a max of 50 pixels tall</li> </ul> <h2>13 Sep 2010</h2> http://git-wip-us.apache.org/repos/asf/logging-chainsaw/blob/34497133/src/main/resources/org/apache/log4j/chainsaw/help/tutorial.html ---------------------------------------------------------------------- diff --git a/src/main/resources/org/apache/log4j/chainsaw/help/tutorial.html b/src/main/resources/org/apache/log4j/chainsaw/help/tutorial.html index 79374fe..0f54454 100644 --- a/src/main/resources/org/apache/log4j/chainsaw/help/tutorial.html +++ b/src/main/resources/org/apache/log4j/chainsaw/help/tutorial.html @@ -216,16 +216,16 @@ Example: to display only events which are greater than or equal to level INFO, u <tr><td>To display events occurring at 23:55:12 on the 19th of June (all events generated during that second, regardless of millisecond value)</td><td><b>TIMESTAMP == '2004/06/19 23:55:12'</b></td></tr> </table> -<A NAME="search"><h3>Search</h3> +<A NAME="search"><h3>Find</h3> <p> -<b>How to search:</b></p> +<b>How to find:</b></p> <ul> -<li><b>Enter an expression</b> in the text field of the main Chainsaw toolbar (a log panel must be selected)</li> -<li>Click the <b>down arrow icon</b> or press <b>F3</b> to search forward</li> -<li>Click the <b>up arrow icon</b> or press <b>Shift+F3</b> to search backward</li> +<li><b>Enter an expression</b> in the Find field</li> +<li>Click the <b>down arrow icon</b> or press <b>F3</b> or <b>enter</b> to search forward from the currently selected row</li> +<li>Click the <b>up arrow icon</b> or press <b>Shift+F3</b> to search backward from the currently selected row</li> <li>The first matching row becomes selected, with matching rows displayed with white text on a black background</li> <li>Subsequent forward or backward searches will navigate to the next match</li> -<li>To <b>clear the search highlighting</b>, clear the text field and press <b>F3</b>)</li> +<li>To <b>clear the find highlighting</b>, clear the text field and press <b>F3</b> or <b>enter</b></li> </ul> <p> <A NAME="display_filter"><h3>Display filters (refine focus)</h3>
