Return-Path: Delivered-To: apmail-logging-general-archive@www.apache.org Received: (qmail 78420 invoked from network); 13 Jul 2007 04:01:29 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 13 Jul 2007 04:01:29 -0000 Received: (qmail 18430 invoked by uid 500); 13 Jul 2007 04:01:32 -0000 Delivered-To: apmail-logging-general-archive@logging.apache.org Received: (qmail 18379 invoked by uid 500); 13 Jul 2007 04:01:31 -0000 Mailing-List: contact general-help@logging.apache.org; run by ezmlm Precedence: bulk list-help: list-unsubscribe: List-Post: Reply-To: "Logging General" List-Id: Delivered-To: mailing list general@logging.apache.org Received: (qmail 18364 invoked by uid 99); 13 Jul 2007 04:01:31 -0000 Received: from herse.apache.org (HELO herse.apache.org) (140.211.11.133) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 12 Jul 2007 21:01:31 -0700 X-ASF-Spam-Status: No, hits=-99.5 required=10.0 tests=ALL_TRUSTED,NO_REAL_NAME X-Spam-Check-By: apache.org Received: from [140.211.11.3] (HELO eris.apache.org) (140.211.11.3) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 12 Jul 2007 21:01:28 -0700 Received: by eris.apache.org (Postfix, from userid 65534) id 0D8DD1A981A; Thu, 12 Jul 2007 21:01:08 -0700 (PDT) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r555864 - in /logging/chainsaw/trunk/src: changes/changes.xml main/java/org/apache/log4j/chainsaw/LogUI.java Date: Fri, 13 Jul 2007 04:01:07 -0000 To: general@logging.apache.org From: psmith@apache.org X-Mailer: svnmailer-1.1.0 Message-Id: <20070713040108.0D8DD1A981A@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org Author: psmith Date: Thu Jul 12 21:01:07 2007 New Revision: 555864 URL: http://svn.apache.org/viewvc?view=rev&rev=555864 Log: Bug 42833 Added ability to hide Welcome and Drag and Drop panels. Patch supplied by Isuru Suriarachchi Modified: logging/chainsaw/trunk/src/changes/changes.xml logging/chainsaw/trunk/src/main/java/org/apache/log4j/chainsaw/LogUI.java Modified: logging/chainsaw/trunk/src/changes/changes.xml URL: http://svn.apache.org/viewvc/logging/chainsaw/trunk/src/changes/changes.xml?view=diff&rev=555864&r1=555863&r2=555864 ============================================================================== --- logging/chainsaw/trunk/src/changes/changes.xml (original) +++ logging/chainsaw/trunk/src/changes/changes.xml Thu Jul 12 21:01:07 2007 @@ -21,12 +21,16 @@ - + Added support for remembering filter expressions for each LogPanel - + Added 'Go To Line' feature to navigate to a particular event # + + Added ability to hide Welcome and Drag and Drop panels. + + Modified: logging/chainsaw/trunk/src/main/java/org/apache/log4j/chainsaw/LogUI.java URL: http://svn.apache.org/viewvc/logging/chainsaw/trunk/src/main/java/org/apache/log4j/chainsaw/LogUI.java?view=diff&rev=555864&r1=555863&r2=555864 ============================================================================== --- logging/chainsaw/trunk/src/main/java/org/apache/log4j/chainsaw/LogUI.java (original) +++ logging/chainsaw/trunk/src/main/java/org/apache/log4j/chainsaw/LogUI.java Thu Jul 12 21:01:07 2007 @@ -456,16 +456,7 @@ }}); - final JLabel lbl = new JLabel(); - lbl.setEnabled(false); - final String dndTitle = "Drag & Drop XML log files here"; - SwingUtilities.invokeLater(new Runnable() { - public void run() { - ensureWelcomePanelVisible(); - getTabbedPane().addANewTab(dndTitle,lbl,null, "You can Drag & Drop XML log files onto the Tabbed Pane and they will be loaded into Chainsaw" ); - getTabbedPane().setEnabledAt(getTabbedPane().indexOfTab(dndTitle), false); - } - }); + addDragDropPanel(); applicationPreferenceModelPanel = new ApplicationPreferenceModelPanel(applicationPreferenceModel); applicationPreferenceModelPanel.setOkCancelActionListener( new ActionListener() { @@ -478,6 +469,23 @@ } + private void addDragDropPanel(){ + final JLabel lbl = new JLabel(); + lbl.setEnabled(false); + final String dndTitle = "Drag & Drop XML log files here"; + SwingUtilities.invokeLater(new Runnable() { + public void run() { + ensureWelcomePanelVisible(); + getTabbedPane().addANewTab(dndTitle,lbl,null, "You can Drag & Drop XML log files onto the Tabbed Pane and they will be loaded into Chainsaw" ); + getTabbedPane().setEnabledAt(getTabbedPane().indexOfTab(dndTitle), false); + if (!getPanelMap().containsKey(dndTitle)) { + getPanelMap().put(dndTitle, lbl); + } + } + }); + } + + private void initPlugins(PluginRegistry pluginRegistry) { pluginRegistry.addPluginListener( new PluginListener() { @@ -804,15 +812,28 @@ final Action hideCurrentTabAction = new AbstractAction("Hide") { public void actionPerformed(ActionEvent e) { - displayPanel(getCurrentLogPanel().getIdentifier(), false); - tbms.stateChange(); + Component selectedComp = getTabbedPane().getSelectedComponent(); + if (selectedComp instanceof LogPanel) { + displayPanel(getCurrentLogPanel().getIdentifier(), false); + tbms.stateChange(); + } else { + getTabbedPane().remove(selectedComp); + } } }; final Action hideOtherTabsAction = new AbstractAction("Hide Others") { public void actionPerformed(ActionEvent e) { - String currentName = getCurrentLogPanel().getIdentifier(); + Component selectedComp = getTabbedPane().getSelectedComponent(); + String currentName; + if (selectedComp instanceof LogPanel) { + currentName = getCurrentLogPanel().getIdentifier(); + } else if (selectedComp instanceof WelcomePanel) { + currentName = "Welcome"; + } else { + currentName = "Drag & Drop XML log files here"; + } int count = getTabbedPane().getTabCount(); int index = 0; @@ -871,28 +892,6 @@ final PopupListener tabPopupListener = new PopupListener(tabPopup); getTabbedPane().addMouseListener(tabPopupListener); - final ChangeListener actionEnabler = - new ChangeListener() { - public void stateChanged(ChangeEvent arg0) { - boolean enabled = getCurrentLogPanel() != null; - hideCurrentTabAction.setEnabled(enabled); - hideOtherTabsAction.setEnabled(enabled); - } - }; - - getTabbedPane().addChangeListener(actionEnabler); - - getTabbedPane().addContainerListener( - new ContainerListener() { - public void componentAdded(ContainerEvent arg0) { - actionEnabler.stateChanged(null); - } - - public void componentRemoved(ContainerEvent arg0) { - actionEnabler.stateChanged(null); - } - }); - this.handler.addPropertyChangeListener( "dataRate", new PropertyChangeListener() { @@ -1418,6 +1417,7 @@ "Welcome", new ImageIcon(ChainsawIcons.ABOUT),welcomePanel, "Welcome/Help", 0); getTabbedPane().setSelectedComponent(welcomePanel); + getPanelMap().put("Welcome", welcomePanel); } void removeWelcomePanel() { @@ -1451,9 +1451,14 @@ while (iter.hasNext()) { Map.Entry entry = (Map.Entry) iter.next(); - m.put( - entry.getKey(), - new Boolean(((DockablePanel) entry.getValue()).isDocked())); + Object o = entry.getValue(); + boolean valueToSend; + if (o instanceof LogPanel){ + valueToSend = ((DockablePanel) entry.getValue()).isDocked(); + } else { + valueToSend = true; + } + m.put(entry.getKey(), new Boolean(valueToSend)); } return m; @@ -1461,21 +1466,31 @@ void displayPanel(String panelName, boolean display) { Object o = getPanelMap().get(panelName); + Component p = null; if (o instanceof LogPanel) { - LogPanel p = (LogPanel) o; + p = (LogPanel) o; + } else if (o instanceof WelcomePanel) { + p = (WelcomePanel) o; + } else if (o instanceof JLabel) { + p = (JLabel) o; + } int index = getTabbedPane().indexOfTab(panelName); if ((index == -1) && display) { - getTabbedPane().addTab(panelName, p); + if (panelName.equals("Drag & Drop XML log files here")){ + addDragDropPanel(); + } else { + getTabbedPane().addTab(panelName, p); + } } if ((index > -1) && !display) { getTabbedPane().removeTabAt(index); } - } - } + } + /** * Shutsdown by ensuring the Appender gets a chance to close.