logging-general mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sde...@apache.org
Subject svn commit: r954712 - in /logging/chainsaw/trunk/src/main/java/org/apache/log4j/chainsaw: ChainsawToolBarAndMenus.java LogPanel.java LoggerNameTreePanel.java
Date Tue, 15 Jun 2010 05:39:57 GMT
Author: sdeboy
Date: Tue Jun 15 05:39:57 2010
New Revision: 954712

URL: http://svn.apache.org/viewvc?rev=954712&view=rev
Log:
Center windows, change custom expression logpanel text field to a textarea

Modified:
    logging/chainsaw/trunk/src/main/java/org/apache/log4j/chainsaw/ChainsawToolBarAndMenus.java
    logging/chainsaw/trunk/src/main/java/org/apache/log4j/chainsaw/LogPanel.java
    logging/chainsaw/trunk/src/main/java/org/apache/log4j/chainsaw/LoggerNameTreePanel.java

Modified: logging/chainsaw/trunk/src/main/java/org/apache/log4j/chainsaw/ChainsawToolBarAndMenus.java
URL: http://svn.apache.org/viewvc/logging/chainsaw/trunk/src/main/java/org/apache/log4j/chainsaw/ChainsawToolBarAndMenus.java?rev=954712&r1=954711&r2=954712&view=diff
==============================================================================
--- logging/chainsaw/trunk/src/main/java/org/apache/log4j/chainsaw/ChainsawToolBarAndMenus.java
(original)
+++ logging/chainsaw/trunk/src/main/java/org/apache/log4j/chainsaw/ChainsawToolBarAndMenus.java
Tue Jun 15 05:39:57 2010
@@ -48,6 +48,7 @@ import javax.swing.JMenuBar;
 import javax.swing.JMenuItem;
 import javax.swing.JPanel;
 import javax.swing.JRadioButtonMenuItem;
+import javax.swing.JTextArea;
 import javax.swing.JTextField;
 import javax.swing.JToolBar;
 import javax.swing.KeyStroke;
@@ -650,7 +651,7 @@ class ChainsawToolBarAndMenus implements
     Action createExpressionPanel =
       new AbstractAction("", ChainsawIcons.ICON_HELP) {
         public void actionPerformed(ActionEvent arg0) {
-          dialog.setVisible(true);
+            LogPanel.centerAndSetVisible(dialog);
         }
       };
 
@@ -1051,10 +1052,10 @@ class ChainsawToolBarAndMenus implements
     panel.add(
       new JLabel("Enter expression for new tab:  "), BorderLayout.NORTH);
 
-    final JTextField textField = new JTextField();
-    textField.addKeyListener(
-      new ExpressionRuleContext(new FilterModel(), textField));
-    panel.add(textField, BorderLayout.CENTER);
+    final JTextArea textArea = new JTextArea(4, 75);
+    textArea.addKeyListener(
+      new ExpressionRuleContext(new FilterModel(), textArea));
+    panel.add(textArea, BorderLayout.CENTER);
 
     JButton ok = new JButton("OK");
     JButton close = new JButton("Close");
@@ -1067,7 +1068,7 @@ class ChainsawToolBarAndMenus implements
     ok.addActionListener(
       new AbstractAction() {
         public void actionPerformed(ActionEvent evt) {
-          logui.createCustomExpressionLogPanel(textField.getText());
+          logui.createCustomExpressionLogPanel(textArea.getText());
           SwingUtilities.getAncestorOfClass(JDialog.class, panel).setVisible(
             false);
         }

Modified: logging/chainsaw/trunk/src/main/java/org/apache/log4j/chainsaw/LogPanel.java
URL: http://svn.apache.org/viewvc/logging/chainsaw/trunk/src/main/java/org/apache/log4j/chainsaw/LogPanel.java?rev=954712&r1=954711&r2=954712&view=diff
==============================================================================
--- logging/chainsaw/trunk/src/main/java/org/apache/log4j/chainsaw/LogPanel.java (original)
+++ logging/chainsaw/trunk/src/main/java/org/apache/log4j/chainsaw/LogPanel.java Tue Jun 15
05:39:57 2010
@@ -29,6 +29,7 @@ import java.awt.FontMetrics;
 import java.awt.Graphics;
 import java.awt.Point;
 import java.awt.Toolkit;
+import java.awt.Window;
 import java.awt.event.ActionEvent;
 import java.awt.event.ActionListener;
 import java.awt.event.FocusEvent;
@@ -1931,7 +1932,15 @@ public class LogPanel extends DockablePa
      * Display the panel preferences frame
      */
   void showPreferences() {
-    logPanelPreferencesFrame.setVisible(true);
+      //don't pack this frame
+      centerAndSetVisible(logPanelPreferencesFrame);
+  }
+
+  public static void centerAndSetVisible(Window window) {
+    Dimension screenDimension = Toolkit.getDefaultToolkit().getScreenSize();
+    window.setLocation(new Point((screenDimension.width / 2) - (window.getSize().width /
2),
+      (screenDimension.height / 2) - (window.getSize().height / 2)));
+    window.setVisible(true);
   }
 
   /**
@@ -1940,7 +1949,7 @@ public class LogPanel extends DockablePa
   void showColorPreferences() {
     colorPanel.loadLogPanelColorizers();
     colorFrame.pack();
-    colorFrame.setVisible(true);
+    centerAndSetVisible(colorFrame);
   }
 
   /**

Modified: logging/chainsaw/trunk/src/main/java/org/apache/log4j/chainsaw/LoggerNameTreePanel.java
URL: http://svn.apache.org/viewvc/logging/chainsaw/trunk/src/main/java/org/apache/log4j/chainsaw/LoggerNameTreePanel.java?rev=954712&r1=954711&r2=954712&view=diff
==============================================================================
--- logging/chainsaw/trunk/src/main/java/org/apache/log4j/chainsaw/LoggerNameTreePanel.java
(original)
+++ logging/chainsaw/trunk/src/main/java/org/apache/log4j/chainsaw/LoggerNameTreePanel.java
Tue Jun 15 05:39:57 2010
@@ -321,13 +321,13 @@ final class LoggerNameTreePanel extends 
     
     Action showIgnoreDialogAction = new AbstractAction("...") {
         public void actionPerformed(ActionEvent e) {
-            ignoreDialog.setVisible(true);
+            LogPanel.centerAndSetVisible(ignoreDialog);
         }
     };
 
     Action showIgnoreExpressionDialogAction = new AbstractAction("...") {
       public void actionPerformed(ActionEvent e) {
-        ignoreExpressionDialog.setVisible(true);
+          LogPanel.centerAndSetVisible(ignoreExpressionDialog);
       }
     };
     showIgnoreDialogAction.putValue(Action.SHORT_DESCRIPTION, "Click to view and manage your
hidden/ignored loggers");



Mime
View raw message