View Javadoc
1   /*
2    * Licensed to the Apache Software Foundation (ASF) under one or more
3    * contributor license agreements.  See the NOTICE file distributed with
4    * this work for additional information regarding copyright ownership.
5    * The ASF licenses this file to You under the Apache License, Version 2.0
6    * (the "License"); you may not use this file except in compliance with
7    * the License.  You may obtain a copy of the License at
8    * 
9    *      http://www.apache.org/licenses/LICENSE-2.0
10   * 
11   * Unless required by applicable law or agreed to in writing, software
12   * distributed under the License is distributed on an "AS IS" BASIS,
13   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14   * See the License for the specific language governing permissions and
15   * limitations under the License.
16   */
17  
18  package org.apache.log4j.chainsaw;
19  
20  import java.awt.Color;
21  import java.net.URL;
22  
23  /**
24   * 
25   * Constants used throught Chainsaw.
26   * 
27   * @author Paul Smith <psmith@apache.org>
28   * @author Scott Deboy <sdeboy@apache.org>
29   * 
30   */
31  public class ChainsawConstants {
32    private ChainsawConstants(){}
33    
34    public static final int MILLIS_DELTA_RENDERING_HEIGHT_MAX = 50;
35    public static final float MILLIS_DELTA_RENDERING_FACTOR = .002F;
36  
37    public static final String DEFAULT_COLOR_RULE_NAME = "Default";
38    public static final Color COLOR_DEFAULT_BACKGROUND = new Color(255,255,255);
39    public static final Color COLOR_DEFAULT_FOREGROUND = Color.BLACK;
40  
41    //top, bottom left and right border are all 2
42    public static final int TABLE_BORDER_WIDTH = 2;
43    //JTable defines its default height as 16, plus top & bottom borders
44    public static final int DEFAULT_ROW_HEIGHT = 16 + (TABLE_BORDER_WIDTH * 2);
45    public static final Color FIND_LOGGER_BACKGROUND = new Color(213, 226, 235);
46    public static final Color FIND_LOGGER_FOREGROUND = Color.BLACK;
47  
48    public static final Color INVALID_EXPRESSION_BACKGROUND = new Color(251, 186, 186);
49  
50    public static final Color COLOR_ODD_ROW_BACKGROUND = new Color(227, 227, 227);
51    public static final Color COLOR_ODD_ROW_FOREGROUND = Color.BLACK;
52  
53    public static final Color COLOR_EVEN_ROW_BACKGROUND = COLOR_DEFAULT_BACKGROUND;
54    public static final Color COLOR_EVEN_ROW_FOREGROUND = Color.BLACK;
55  
56    public static final URL WELCOME_URL = ChainsawConstants.class.getClassLoader().getResource(
57    "org/apache/log4j/chainsaw/WelcomePanel.html");
58  
59    public static final URL EXAMPLE_CONFIG_URL = 
60            ChainsawConstants.class.getClassLoader().getResource("org/apache/log4j/chainsaw/log4j-receiver-sample.xml");
61  
62    public static final URL TUTORIAL_URL =
63            ChainsawConstants.class.getClassLoader().getResource("org/apache/log4j/chainsaw/help/tutorial.html");
64    public static final URL RELEASE_NOTES_URL =
65            ChainsawConstants.class.getClassLoader().getResource("org/apache/log4j/chainsaw/help/release-notes.html");
66          
67    static final String MAIN_PANEL = "panel";
68    static final String LOWER_PANEL = "lower";
69    static final String UPPER_PANEL = "upper";
70    static final String EMPTY_STRING = "";
71    static final String FILTERS_EXTENSION = ".filters";
72    static final String SETTINGS_EXTENSION = ".settings";
73  
74    //COLUMN NAMES
75    static final String LOGGER_COL_NAME = "LOGGER";
76    static final String LOG4J_MARKER_COL_NAME_LOWERCASE = "marker";
77    static final String TIMESTAMP_COL_NAME = "TIMESTAMP";
78    static final String LEVEL_COL_NAME = "LEVEL";
79    static final String THREAD_COL_NAME = "THREAD";
80    static final String MESSAGE_COL_NAME = "MESSAGE";
81    static final String NDC_COL_NAME = "NDC";
82    static final String THROWABLE_COL_NAME = "THROWABLE";
83    static final String CLASS_COL_NAME = "CLASS";
84    static final String METHOD_COL_NAME = "METHOD";
85    static final String FILE_COL_NAME = "FILE";
86    static final String LINE_COL_NAME = "LINE";
87    static final String PROPERTIES_COL_NAME = "PROPERTIES";
88    static final String MILLIS_DELTA_COL_NAME_LOWERCASE = "millisdelta";
89    static final String ID_COL_NAME = "ID";
90  
91    //none is not a real column name, but is used by filters as a way to apply no filter for colors or display
92    static final String NONE_COL_NAME = "None";
93    static final String LOG4J_REMOTEHOST_KEY = "log4j.remoteSourceInfo";
94    static final String UNKNOWN_TAB_NAME = "Unknown";
95    static final String GLOBAL_MATCH = "*";
96    public static final String DETAIL_CONTENT_TYPE = "text/html";
97  
98    static final String LEVEL_DISPLAY = "level.display";
99    static final String LEVEL_DISPLAY_ICONS = "icons";
100   static final String LEVEL_DISPLAY_TEXT = "text";
101 
102 
103   static final String DATETIME_FORMAT = "EEE MMM dd HH:mm:ss z yyyy";
104   
105 //  TODO come up with a better page not found url
106   public static final URL URL_PAGE_NOT_FOUND = WELCOME_URL;
107 
108 }