You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@logging.apache.org by rg...@apache.org on 2021/12/23 16:27:42 UTC
[logging-log4j1] 01/01: This commit was manufactured by cvs2svn to create tag 'v_1_1b6'.
This is an automated email from the ASF dual-hosted git repository.
rgoers pushed a commit to annotated tag v_1_1b6
in repository https://gitbox.apache.org/repos/asf/logging-log4j1.git
commit c954838f5935130780ccf2fb178db8f5ae8404e3
Author: No Author <de...@apache.org>
AuthorDate: Thu Apr 26 17:31:06 2001 +0000
This commit was manufactured by cvs2svn to create tag 'v_1_1b6'.
git-svn-id: https://svn.apache.org/repos/asf/logging/log4j/tags/v_1_1b6@309131 13f79535-47bb-0310-9956-ffa450edef68
---
contribs/SvenReimers/gui/JListView.java | 355 ---------------------
contribs/SvenReimers/gui/JTableAppender.java | 227 -------------
contribs/SvenReimers/gui/Makefile | 28 --
contribs/SvenReimers/gui/TextPaneAppender.java | 345 --------------------
contribs/SvenReimers/gui/examples/Makefile | 26 --
.../gui/examples/TextPaneAppenderExample.java | 101 ------
6 files changed, 1082 deletions(-)
diff --git a/contribs/SvenReimers/gui/JListView.java b/contribs/SvenReimers/gui/JListView.java
deleted file mode 100644
index 42ce7ff..0000000
--- a/contribs/SvenReimers/gui/JListView.java
+++ /dev/null
@@ -1,355 +0,0 @@
-/*
- * Copyright (C) The Apache Software Foundation. All rights reserved.
- *
- * This software is published under the terms of the Apache Software
- * License version 1.1, a copy of which has been included with this
- * distribution in the LICENSE.APL file. */
-
-
-package org.apache.log4j.gui;
-
-import org.apache.log4j.helpers.CyclicBuffer;
-import org.apache.log4j.helpers.LogLog;
-import org.apache.log4j.Priority;
-import org.apache.log4j.Category;
-import org.apache.log4j.Layout;
-import org.apache.log4j.PatternLayout;
-import org.apache.log4j.spi.LoggingEvent;
-
-import javax.swing.JList;
-import javax.swing.AbstractListModel;
-import javax.swing.JFrame;
-import javax.swing.JButton;
-import javax.swing.JLabel;
-import javax.swing.JPanel;
-import javax.swing.JTextArea;
-import javax.swing.JScrollPane;
-import javax.swing.ListCellRenderer;
-import java.awt.Component;
-import java.awt.FlowLayout;
-import java.awt.GridLayout;
-import javax.swing.BoxLayout;
-
-import java.awt.BorderLayout;
-import java.awt.Dimension;
-import java.awt.event.ActionListener;
-import java.awt.event.ActionEvent;
-import java.awt.Container;
-import javax.swing.ImageIcon;
-import java.awt.Image;
-import java.awt.Toolkit;
-import java.net.URL;
-import java.awt.Rectangle;
-
-public class JListView extends JList {
-
-
- static Category cat = Category.getInstance(JListView.class.getName());
-
-
- //JListViewModel model;
- PatternLayout layout;
-
- static LoggingEvent proto = new LoggingEvent("x", cat, Priority.ERROR,
- "Message ", new Throwable());
-
- public
- JListView(JListViewModel model) {
- super(model);
- layout = new PatternLayout("%r %p %c [%t] - %m");
- //this.setModel(model);
- this.setCellRenderer(new MyCellRenderer());
- // setFixedCellWidth(10);
- //setFixedCellHeight(20);
-
- }
-
- public
- void add(LoggingEvent event) {
- ((JListViewModel)getModel()).add(event);
- }
-
- /*
- public
- Dimension getPreferredSize() {
- System.out.println("getPreferredSize() called");
- return super.getPreferredSize();
- }
-
-
- public
- int getScrollableUnitIncrement(Rectangle visibleRect, int orientation,
- int direction) {
- System.out.println("getScrollableUnitIncrement called with " + visibleRect +
- "orientation: "+orientation+", direction: "+direction);
- return super.getScrollableUnitIncrement(visibleRect, orientation,
- direction);
- }
-
- public
- int getScrollableBlockIncrement(Rectangle visibleRect, int orientation,
- int direction) {
- System.out.println("getScrollableBlockIncrement called with " +
- visibleRect + "orientation: "+orientation+
- ", direction: "+direction);
- return super.getScrollableBlockIncrement(visibleRect, orientation,
- direction);
- }
- */
-
- //public
- //boolean getScrollableTracksViewportWidth() {
- //System.out.println("getScrollableTracksViewportWidth called.");
- //return true;
- //boolean b = super.getScrollableTracksViewportWidth();
- //System.out.println("result is: "+b);
- //return b;
- //}
-
- //public
- //boolean getScrollableTracksViewportHeight() {
- // System.out.println("getScrollableTracksViewportHeight called.");
- // return true;
- //boolean b = super.getScrollableTracksViewportHeight();
- //System.out.println("result is: "+b);
- //return b;
- //}
-
- //public
- //int getFirstVisibleIndex() {
- //int r = getFirstVisibleIndex();
- // System.out.println("----------getFirstVisibleIndex called, result: "+r);
- //return r;
- //}
-
- //public
- //Object getPrototypeCellValue() {
- //return proto;
- //}
-
-
-
- static public void main(String[] args) {
-
- JFrame frame = new JFrame("JListView test");
- Container container = frame.getContentPane();
-
- JListView view = new JListView(new JListViewModel(Integer.parseInt(args[0])));
-
-
- JScrollPane sp = new JScrollPane(view);
- sp.setPreferredSize(new Dimension(250, 80));
-
- container.setLayout(new BoxLayout(container, BoxLayout.X_AXIS));
- //container.add(view);
- container.add(sp);
-
- JButton b1 = new JButton("Add 1");
- JButton b10 = new JButton("Add 10");
- JButton b100 = new JButton("Add 100");
- JButton b1000 = new JButton("Add 1000");
- JButton b10000 = new JButton("Add 10000");
-
- JPanel panel = new JPanel(new GridLayout(0,1));
- container.add(panel);
-
- panel.add(b1);
- panel.add(b10);
- panel.add(b100);
- panel.add(b1000);
- panel.add(b10000);
-
-
- AddAction a1 = new AddAction(view, 1);
- AddAction a10 = new AddAction(view, 10);
- AddAction a100 = new AddAction(view, 100);
- AddAction a1000 = new AddAction(view, 1000);
- AddAction a10000 = new AddAction(view, 10000);
-
- b1.addActionListener(a1);
- b10.addActionListener(a10);
- b100.addActionListener(a100);
- b1000.addActionListener(a1000);
- b10000.addActionListener(a10000);
-
- frame.setVisible(true);
- frame.setSize(new Dimension(700,700));
-
- long before = System.currentTimeMillis();
-
- int RUN = 1000;
- int i = 0;
- while(i++ < RUN) {
- LoggingEvent event0 = new LoggingEvent("x", cat, Priority.ERROR,
- "Message "+i, null);
-
- Throwable t = new Exception("hello "+i);
- LoggingEvent event1 = new LoggingEvent("x", cat, Priority.ERROR,
- "Message "+i, t);
-
-
- if(i % 10 == 0) {
- event1.getThreadName();
- view.add(event1);
- } else {
- event0.getThreadName();
- view.add(event0);
- }
- }
-
- long after = System.currentTimeMillis();
- System.out.println("Time taken :"+ ((after-before)*1000/RUN));
-
- }
-
- class MyCellRenderer extends JTextArea implements ListCellRenderer {
-
- Object o = new Object();
- int i = 0;
- final ImageIcon longIcon = new ImageIcon("RedFlag.gif");
-
- public
- MyCellRenderer() {
- System.out.println("----------------------");
-
- }
-
-
-
- public
- int getTabSize() {
- return 2;
- }
-
- public Image loadIcon ( String path ) {
- Image img = null;
- try {
- URL url = ClassLoader.getSystemResource(path);
- img = (Image) (Toolkit.getDefaultToolkit()).getImage(url);
- } catch (Exception e) {
- System.out.println("Exception occured: " + e.getMessage() +
- " - " + e );
- }
- return (img);
- }
-
- public Component getListCellRendererComponent(JList list,
- Object value,
- int index, // cell index
- boolean isSelected,
- boolean cellHasFocus) {
-
- // System.out.println(o + " ============== " + i++);
- //LogLog.error("=======", new Exception());
- //setIcon(longIcon);
- if(value instanceof LoggingEvent) {
- LoggingEvent event = (LoggingEvent) value;
- String str = layout.format(event);
- String t = event.getThrowableInformation();
-
- if(t != null) {
- setText(str + Layout.LINE_SEP + t);
- } else {
- setText(str);
- }
-
- } else {
- setText(value.toString());
- }
-
-
- return this;
- }
- }
-}
-
-
-
-class JListViewModel extends AbstractListModel {
-
- CyclicBuffer cb;
-
- JListViewModel(int size) {
- cb = new CyclicBuffer(size);
- }
-
- public
- void add(LoggingEvent event) {
- //System.out.println("JListViewModel.add called");
- cb.add(event);
- int j = cb.length();
- fireContentsChanged(this, 0, j);
- }
-
-
-
- public
- Object getElementAt(int index) {
- return cb.get(index);
- }
-
- public
- int getSize() {
- return cb.length();
- }
-
-}
-
-class AddAction implements ActionListener {
-
- Thread t;
-
- static int counter = 0;
-
- public
- AddAction(JListView view, int burst) {
- this.t = new AddThread(view, burst);
- t.start();
- }
-
- public
- void actionPerformed(ActionEvent e) {
- System.out.println("Action occured");
- synchronized(t) {
- t.notify();
- }
- }
-
- class AddThread extends Thread {
- int burst;
- JListView view;
-
- Category cat = Category.getInstance("x");
-
- AddThread(JListView view, int burst) {
- super();
- this.burst = burst;
- this.view = view;
- setName("AddThread"+burst);
- }
-
- public
- void run() {
-
- while(true) {
- synchronized(this) {
- try {
- this.wait();
- } catch(Exception e) {
- }
- }
- for(int i = 0; i < burst; i++) {
- LoggingEvent event = new LoggingEvent("x", cat, Priority.DEBUG,
- "Message "+counter, null);
-
- event.getThreadName();
- if(counter % 50 == 0) {
- //event.throwable = new Exception("hello "+counter);
- }
- counter++;
- view.add(event);
- }
- }
- }
- }
-}
diff --git a/contribs/SvenReimers/gui/JTableAppender.java b/contribs/SvenReimers/gui/JTableAppender.java
deleted file mode 100644
index 3197a1d..0000000
--- a/contribs/SvenReimers/gui/JTableAppender.java
+++ /dev/null
@@ -1,227 +0,0 @@
-/*
- * Copyright (C) The Apache Software Foundation. All rights reserved.
- *
- * This software is published under the terms of the Apache Software
- * License version 1.1, a copy of which has been included with this
- * distribution in the LICENSE.APL file. */
-
-
-package org.apache.log4j.gui;
-
-import org.apache.log4j.helpers.CyclicBuffer;
-import org.apache.log4j.helpers.LogLog;
-import org.apache.log4j.Priority;
-import org.apache.log4j.Category;
-import org.apache.log4j.Layout;
-import org.apache.log4j.PatternLayout;
-import org.apache.log4j.spi.LoggingEvent;
-
-import javax.swing.JList;
-import javax.swing.AbstractListModel;
-import javax.swing.JFrame;
-import javax.swing.JButton;
-import javax.swing.JLabel;
-import javax.swing.JTable;
-import javax.swing.JTextArea;
-import javax.swing.table.AbstractTableModel;
-import javax.swing.table.TableCellRenderer;
-import javax.swing.JScrollPane;
-import javax.swing.ListCellRenderer;
-import java.awt.Component;
-import java.awt.FlowLayout;
-import javax.swing.BoxLayout;
-
-import java.awt.BorderLayout;
-import java.awt.Dimension;
-import java.awt.event.ActionListener;
-import java.awt.event.ActionEvent;
-import java.awt.Container;
-import javax.swing.ImageIcon;
-import java.awt.Image;
-import java.awt.Toolkit;
-import java.net.URL;
-import java.awt.Rectangle;
-
-public class JTableAppender extends JTable {
-
-
- static Category cat = Category.getInstance(JTableAppender.class.getName());
-
- PatternLayout layout;
-
- public
- JTableAppender() {
- layout = new PatternLayout("%r %p %c [%t] - %m");
- this.setDefaultRenderer(Object.class, new Renderer());
-
- }
-
- public
- void add(LoggingEvent event) {
- ((JTableAppenderModel)getModel()).add(event);
- }
-
- public
- Dimension getPreferredSize() {
- System.out.println("getPreferredSize() called");
- return super.getPreferredSize();
- }
-
- static public void main(String[] args) {
-
- JFrame frame = new JFrame("JListView test");
- Container container = frame.getContentPane();
-
- JTableAppender appender = new JTableAppender();
-
- JTableAppenderModel model = new
- JTableAppenderModel(Integer.parseInt(args[0]));
- appender.setModel(model);
- //appender.createDefaultColumnsFromModel();
-
-
- JScrollPane sp = new JScrollPane(appender);
- sp.setPreferredSize(new Dimension(250, 80));
-
- container.setLayout(new BoxLayout(container, BoxLayout.X_AXIS));
- //container.add(view);
- container.add(sp);
-
- JButton button = new JButton("ADD");
- container.add(button);
-
-
- button.addActionListener(new JTableAddAction(appender));
-
- frame.setVisible(true);
- frame.setSize(new Dimension(700,700));
-
- long before = System.currentTimeMillis();
-
- int RUN = 10000;
- int i = 0;
- while(i++ < RUN) {
- LoggingEvent event = new LoggingEvent("x", cat, Priority.ERROR,
- "Message "+i, null);
- event.getThreadName();
- if(i % 10 == 0) {
- //event.throwable = new Exception("hello "+i);
- }
- appender.add(event);
- }
-
- long after = System.currentTimeMillis();
- System.out.println("Time taken :"+ ((after-before)*1000/RUN));
-
- }
-
- class Renderer extends JTextArea implements TableCellRenderer {
-
- Object o = new Object();
- int i = 0;
-
- public
- Renderer() {
- System.out.println("Render() called ----------------------");
- }
-
- public Component getTableCellRendererComponent(JTable table,
- Object value,
- boolean isSelected,
- boolean hasFocus,
- int row,
- int column) {
-
- System.out.println(o + " ============== " + i++);
- //LogLog.error("=======", new Exception());
- //setIcon(longIcon);
- if(value instanceof LoggingEvent) {
- LoggingEvent event = (LoggingEvent) value;
- String str = layout.format(event);
- String t = event.getThrowableInformation();
-
- if(t != null) {
- System.out.println("eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee");
- setText(str + Layout.LINE_SEP + t);
- } else {
- setText(str);
- }
-
- } else {
- setText(value.toString());
- }
-
-
- return this;
- }
- }
-}
-
-
-
-class JTableAppenderModel extends AbstractTableModel {
-
- CyclicBuffer cb;
-
- JTableAppenderModel(int size) {
- cb = new CyclicBuffer(size);
- }
-
- public
- void add(LoggingEvent event) {
- //System.out.println("JListViewModel.add called");
- cb.add(event);
- int j = cb.length();
-
- fireTableDataChanged();
-
- }
- public
- int getColumnCount() {
- return 1;
- }
-
- public int getRowCount() {
- return cb.length();
- }
-
- //public
- //Class getColumnClass(int index) {
- // System.out.println("getColumnClass called " + index);
- // return LoggingEvent.class;
- //}
-
- public
- Object getValueAt(int row, int col) {
- return cb.get(row);
- }
-}
-
-
-class JTableAddAction implements ActionListener {
-
- int j;
- JTableAppender appender;
-
- Category cat = Category.getInstance("x");
-
- public
- JTableAddAction(JTableAppender appender) {
- this.appender = appender;
- j = 0;
- }
-
- public
- void actionPerformed(ActionEvent e) {
- System.out.println("Action occured");
-
- LoggingEvent event = new LoggingEvent("x", cat, Priority.DEBUG,
- "Message "+j, null);
-
- if(j % 5 == 0) {
- //event.throwable = new Exception("hello "+j);
- }
- j++;
- appender.add(event);
- }
-}
diff --git a/contribs/SvenReimers/gui/Makefile b/contribs/SvenReimers/gui/Makefile
deleted file mode 100644
index 5ab9d0e..0000000
--- a/contribs/SvenReimers/gui/Makefile
+++ /dev/null
@@ -1,28 +0,0 @@
-
-PKG_DIR :=org/apache/log4j/gui
-DEPTH :=../../../../../..
-JSOURCES:= TextPaneAppender.java\
- JListView.java\
- JTableAppender.java\
-
-ifdef FULL
- JSOURCES:=$(JSOURCES)
-endif
-
-TSOURCES:=
-
-
-SUBDIRS := examples
-
-ifdef FULL
- SUBDIRS := $(SUBDIRS)
-endif
-
-# include master-rule file
-include $(DEPTH)/make/make.inc
-
-
-
-
-
-
diff --git a/contribs/SvenReimers/gui/TextPaneAppender.java b/contribs/SvenReimers/gui/TextPaneAppender.java
deleted file mode 100644
index 117c354..0000000
--- a/contribs/SvenReimers/gui/TextPaneAppender.java
+++ /dev/null
@@ -1,345 +0,0 @@
-/*
- * Copyright (C) The Apache Software Foundation. All rights reserved.
- *
- * This software is published under the terms of the Apache Software
- * License version 1.1, a copy of which has been included with this
- * distribution in the LICENSE.APL file. */
-
-package org.apache.log4j.gui;
-
-
-import java.awt.Color;
-import java.awt.Image;
-import java.awt.Toolkit;
-import java.io.*;
-import java.net.URL;
-import java.util.Enumeration;
-import java.util.StringTokenizer;
-import java.util.Hashtable;
-
-import javax.swing.Icon;
-import javax.swing.ImageIcon;
-import javax.swing.JTextPane;
-import javax.swing.text.AttributeSet;
-import javax.swing.text.BadLocationException;
-import javax.swing.text.MutableAttributeSet;
-import javax.swing.text.SimpleAttributeSet;
-import javax.swing.text.StyleConstants;
-import javax.swing.text.StyledDocument;
-import javax.swing.text.TabSet;
-import javax.swing.text.TabStop;
-
-import org.apache.log4j.*;
-
-import org.apache.log4j.spi.LoggingEvent;
-import org.apache.log4j.helpers.Loader;
-import org.apache.log4j.helpers.QuietWriter;
-import org.apache.log4j.helpers.TracerPrintWriter;
-import org.apache.log4j.helpers.OptionConverter;
-
-
-/**
- * <b>Experimental</b> TextPaneAppender. <br>
- *
- *
- * Created: Sat Feb 26 18:50:27 2000 <br>
- *
- * @author Sven Reimers
- */
-
-public class TextPaneAppender extends AppenderSkeleton {
-
- JTextPane textpane;
- StyledDocument doc;
- TracerPrintWriter tp;
- StringWriter sw;
- QuietWriter qw;
- Hashtable attributes;
- Hashtable icons;
-
- private String label;
-
- private boolean fancy;
-
- final String LABEL_OPTION = "Label";
- final String COLOR_OPTION_FATAL = "Color.Emerg";
- final String COLOR_OPTION_ERROR = "Color.Error";
- final String COLOR_OPTION_WARN = "Color.Warn";
- final String COLOR_OPTION_INFO = "Color.Info";
- final String COLOR_OPTION_DEBUG = "Color.Debug";
- final String COLOR_OPTION_BACKGROUND = "Color.Background";
- final String FANCY_OPTION = "Fancy";
- final String FONT_NAME_OPTION = "Font.Name";
- final String FONT_SIZE_OPTION = "Font.Size";
-
- public static Image loadIcon ( String path ) {
- Image img = null;
- try {
- URL url = ClassLoader.getSystemResource(path);
- img = (Image) (Toolkit.getDefaultToolkit()).getImage(url);
- } catch (Exception e) {
- System.out.println("Exception occured: " + e.getMessage() +
- " - " + e );
- }
- return (img);
- }
-
- public TextPaneAppender(Layout layout, String name) {
- this();
- this.layout = layout;
- this.name = name;
- setTextPane(new JTextPane());
- createAttributes();
- createIcons();
- }
-
- public TextPaneAppender() {
- super();
- setTextPane(new JTextPane());
- createAttributes();
- createIcons();
- this.label="";
- this.sw = new StringWriter();
- this.qw = new QuietWriter(sw, errorHandler);
- this.tp = new TracerPrintWriter(qw);
- this.fancy =true;
- }
-
- public
- void close() {
-
- }
-
- private void createAttributes() {
- Priority prio[] = Priority.getAllPossiblePriorities();
-
- attributes = new Hashtable();
- for (int i=0; i<prio.length;i++) {
- MutableAttributeSet att = new SimpleAttributeSet();
- attributes.put(prio[i], att);
- StyleConstants.setFontSize(att,14);
- }
- StyleConstants.setForeground((MutableAttributeSet)attributes.get(Priority.ERROR),Color.red);
- StyleConstants.setForeground((MutableAttributeSet)attributes.get(Priority.WARN),Color.orange);
- StyleConstants.setForeground((MutableAttributeSet)attributes.get(Priority.INFO),Color.gray);
- StyleConstants.setForeground((MutableAttributeSet)attributes.get(Priority.DEBUG),Color.black);
- }
-
- private void createIcons() {
- Priority prio[] = Priority.getAllPossiblePriorities();
-
- icons = new Hashtable();
- for (int i=0; i<prio.length;i++) {
- if (prio[i].equals(Priority.FATAL))
- icons.put(prio[i],new ImageIcon(loadIcon("icons/RedFlag.gif")));
- if (prio[i].equals(Priority.ERROR))
- icons.put(prio[i],new ImageIcon(loadIcon("icons/RedFlag.gif")));
- if (prio[i].equals(Priority.WARN))
- icons.put(prio[i],new ImageIcon(loadIcon("icons/BlueFlag.gif")));
- if (prio[i].equals(Priority.INFO))
- icons.put(prio[i],new ImageIcon(loadIcon("icons/GreenFlag.gif")));
- if (prio[i].equals(Priority.DEBUG))
- icons.put(prio[i],new ImageIcon(loadIcon("icons/GreenFlag.gif")));
- }
- }
-
- public void append(LoggingEvent event) {
- String text = this.layout.format(event);
- String trace="";
- // Print Stacktrace
- // Quick Hack maybe there is a better/faster way?
- if (event.throwable!=null) {
- event.throwable.printStackTrace(tp);
- for (int i=0; i< sw.getBuffer().length(); i++) {
- if (sw.getBuffer().charAt(i)=='\t')
- sw.getBuffer().replace(i,i+1," ");
- }
- trace = sw.toString();
- sw.getBuffer().delete(0,sw.getBuffer().length());
- }
- try {
- if (fancy) {
- textpane.setEditable(true);
- textpane.insertIcon((ImageIcon)icons.get(event.priority));
- textpane.setEditable(false);
- }
- doc.insertString(doc.getLength(),text+trace,
- (MutableAttributeSet)attributes.get(event.priority));
- }
- catch (BadLocationException badex) {
- System.err.println(badex);
- }
- textpane.setCaretPosition(doc.getLength());
- }
-
- public
- JTextPane getTextPane() {
- return textpane;
- }
-
- private
- static
- Color parseColor (String v) {
- StringTokenizer st = new StringTokenizer(v,",");
- int val[] = {255,255,255,255};
- int i=0;
- while (st.hasMoreTokens()) {
- val[i]=Integer.parseInt(st.nextToken());
- i++;
- }
- return new Color(val[0],val[1],val[2],val[3]);
- }
-
- private
- static
- String colorToString(Color c) {
- // alpha component emitted only if not default (255)
- String res = ""+c.getRed()+","+c.getGreen()+","+c.getBlue();
- return c.getAlpha() >= 255 ? res : res + ","+c.getAlpha();
- }
-
- public
- void setLayout(Layout layout) {
- this.layout=layout;
- }
-
- public
- void setName(String name) {
- this.name = name;
- }
-
-
- public
- void setTextPane(JTextPane textpane) {
- this.textpane=textpane;
- textpane.setEditable(false);
- textpane.setBackground(Color.lightGray);
- this.doc=textpane.getStyledDocument();
- }
-
- private
- void setColor(Priority p, String v) {
- StyleConstants.setForeground(
- (MutableAttributeSet)attributes.get(p),parseColor(v));
- }
-
- private
- String getColor(Priority p) {
- Color c = StyleConstants.getForeground(
- (MutableAttributeSet)attributes.get(p));
- return c == null ? null : colorToString(c);
- }
-
- /////////////////////////////////////////////////////////////////////
- // option setters and getters
-
- public
- void setLabel(String label) {
- this.label = label;
- }
- public
- String getLabel() {
- return label;
- }
-
- public
- void setColorEmerg(String color) {
- setColor(Priority.FATAL, color);
- }
- public
- String getColorEmerg() {
- return getColor(Priority.FATAL);
- }
-
- public
- void setColorError(String color) {
- setColor(Priority.ERROR, color);
- }
- public
- String getColorError() {
- return getColor(Priority.ERROR);
- }
-
- public
- void setColorWarn(String color) {
- setColor(Priority.WARN, color);
- }
- public
- String getColorWarn() {
- return getColor(Priority.WARN);
- }
-
- public
- void setColorInfo(String color) {
- setColor(Priority.INFO, color);
- }
- public
- String getColorInfo() {
- return getColor(Priority.INFO);
- }
-
- public
- void setColorDebug(String color) {
- setColor(Priority.DEBUG, color);
- }
- public
- String getColorDebug() {
- return getColor(Priority.DEBUG);
- }
-
- public
- void setColorBackground(String color) {
- textpane.setBackground(parseColor(color));
- }
- public
- String getColorBackground() {
- return colorToString(textpane.getBackground());
- }
-
- public
- void setFancy(boolean fancy) {
- this.fancy = fancy;
- }
- public
- boolean getFancy() {
- return fancy;
- }
-
- public
- void setFontSize(int size) {
- Enumeration e = attributes.elements();
- while (e.hasMoreElements()) {
- StyleConstants.setFontSize((MutableAttributeSet)e.nextElement(),size);
- }
- return;
- }
-
- public
- int getFontSize() {
- AttributeSet attrSet = (AttributeSet) attributes.get(Priority.INFO);
- return StyleConstants.getFontSize(attrSet);
- }
-
- public
- void setFontName(String name) {
- Enumeration e = attributes.elements();
- while (e.hasMoreElements()) {
- StyleConstants.setFontFamily((MutableAttributeSet)e.nextElement(),name);
- }
- return;
- }
-
- public
- String getFontName() {
- AttributeSet attrSet = (AttributeSet) attributes.get(Priority.INFO);
- return StyleConstants.getFontFamily(attrSet);
- }
-
- public
- boolean requiresLayout() {
- return true;
- }
-} // TextPaneAppender
-
-
-
diff --git a/contribs/SvenReimers/gui/examples/Makefile b/contribs/SvenReimers/gui/examples/Makefile
deleted file mode 100644
index 9ab213f..0000000
--- a/contribs/SvenReimers/gui/examples/Makefile
+++ /dev/null
@@ -1,26 +0,0 @@
-
-PKG_DIR :=org/apache/log4j/gui/examples
-DEPTH :=../../../../../../..
-JSOURCES:= TextPaneAppenderExample.java\
-
-ifdef FULL
- JSOURCES:=$(JSOURCES)
-endif
-
-TSOURCES:=
-
-
-SUBDIRS :=
-
-ifdef FULL
- SUBDIRS := $(SUBDIRS)
-endif
-
-# include master-rule file
-include $(DEPTH)/make/make.inc
-
-
-
-
-
-
diff --git a/contribs/SvenReimers/gui/examples/TextPaneAppenderExample.java b/contribs/SvenReimers/gui/examples/TextPaneAppenderExample.java
deleted file mode 100644
index 2c297fd..0000000
--- a/contribs/SvenReimers/gui/examples/TextPaneAppenderExample.java
+++ /dev/null
@@ -1,101 +0,0 @@
-/*
- * Copyright (C) The Apache Software Foundation. All rights reserved.
- *
- * This software is published under the terms of the Apache Software
- * License version 1.1, a copy of which has been included with this
- * distribution in the LICENSE.APL file. */
-
-package org.apache.log4j.gui.examples;
-
-import java.awt.BorderLayout;
-import java.awt.event.*;
-import javax.swing.*;
-import org.apache.log4j.*;
-import org.apache.log4j.gui.*;
-
-
-
-public class TextPaneAppenderExample implements ActionListener {
-
- JFrame mainframe;
- ButtonGroup priorities;
- TextPaneAppender tpa;
- Category gui;
- Priority prio[];
- JTabbedPane logview;
-
-
- public TextPaneAppenderExample () {
- mainframe = new JFrame("Testing the TextPaneAppender...");
- mainframe.setSize(300,300);
- logview = new JTabbedPane();
- createLogger();
- createMenuBar();
- mainframe.setVisible(true);
- mainframe.getContentPane().add(logview);
- }
-
- public void createLogger() {
- tpa = new TextPaneAppender(new PatternLayout("%-5p %d [%t]: %m%n"),"Debug");
- logview.addTab("Events ...",new JScrollPane(tpa.getTextPane()));
- gui = Category.getInstance(this.getClass().getName());
- gui.addAppender(tpa);
- }
-
- public void createMenuBar() {
- JMenu file = new JMenu("File");
- JMenuItem exit = new JMenuItem("Exit");
- exit.addActionListener(new ActionListener() {
- public void actionPerformed(ActionEvent ae) {
- System.exit(0);
- }
- });
- file.add(exit);
- JMenuBar mb = new JMenuBar();
- mb.add(file);
-
- JMenu logevent = new JMenu("LoggingEvents");
- JMenu selectprio = new JMenu("Priority");
-
- prio = Priority.getAllPossiblePriorities();
- JRadioButtonMenuItem priority[]= new JRadioButtonMenuItem[prio.length];
- priorities = new ButtonGroup();
-
- for (int i=0; i<prio.length;i++) {
- if (i==0)
- priority[i] = new JRadioButtonMenuItem(prio[i].toString(),true);
- else
- priority[i] = new JRadioButtonMenuItem(prio[i].toString());
- priority[i].setActionCommand(prio[i].toString());
- selectprio.add(priority[i]);
- priorities.add(priority[i]);
-
- }
-
- logevent.add(selectprio);
-
- JMenuItem lognow = new JMenuItem("LogIt!");
- lognow.addActionListener(this);
- logevent.add(lognow);
-
- mb.add(logevent);
-
- mainframe.setJMenuBar(mb);
-
- }
-
- public void actionPerformed(ActionEvent ae){
- String logtext = JOptionPane.showInputDialog("Text to log");
- if (logtext == null) logtext="NO Input";
- int i=0;
- String name = priorities.getSelection().getActionCommand();
- while (!prio[i].toString().equals(name))
- i=i+1;
- gui.log(prio[i],logtext);
- }
-
- static public void main(String args[]) {
- TextPaneAppenderExample tpex = new TextPaneAppenderExample();
- }
-
-}