/*
This file is part of the software framework JStatCom,
a library for building applications for data based analysis.
Copyright (C) 2000-2005 Markus Kraetzig
This library is free software; you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as
published by the Free Software Foundation; either version 2.1 of the
License, or (at your option) any later version.
This library is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
USA
*/
package com.jstatcom.component;
import java.net.URL;
import javax.swing.ImageIcon;
import javax.swing.JFrame;
import javax.swing.JPanel;
import org.apache.log4j.Logger;
import com.jstatcom.io.RedirectReceiver;
/**
* Frame that can be used as a log area for various kinds of messages.
*
* @author Markus Kraetzig
*/
public final class LogFrame extends JFrame implements RedirectReceiver {
private static final Logger log = Logger.getLogger(LogFrame.class);
private JPanel ivjJFrameContentPane = null;
private ResultField ivjResultField = null;
/**
* Creates a LogFrame.
*/
public LogFrame() {
super();
initialize();
}
/**
* Appends text to the log that is made visible in a text area, where it can
* be cleared or saved.
*
* @param text
* String
*/
public void append(String text) {
getResultField().append(text);
}
/**
* Return the JFrameContentPane property value.
*
* @return javax.swing.JPanel
*/
/* WARNING: THIS METHOD WILL BE REGENERATED. */
private javax.swing.JPanel getJFrameContentPane() {
if (ivjJFrameContentPane == null) {
try {
ivjJFrameContentPane = new javax.swing.JPanel();
ivjJFrameContentPane.setName("JFrameContentPane");
ivjJFrameContentPane.setLayout(new javax.swing.BoxLayout(
getJFrameContentPane(), javax.swing.BoxLayout.X_AXIS));
ivjJFrameContentPane.add(getResultField(), null);
// user code end
} catch (Throwable ivjExc) {
// user code begin {2}
// user code end
handleException(ivjExc);
}
}
return ivjJFrameContentPane;
}
/**
* Return the ResultField property value.
*
* @return ResultField
*/
/* WARNING: THIS METHOD WILL BE REGENERATED. */
private com.jstatcom.component.ResultField getResultField() {
if (ivjResultField == null) {
try {
ivjResultField = new com.jstatcom.component.ResultField();
ivjResultField.setName("ResultField");
// user code begin {1}
// user code end
} catch (Throwable ivjExc) {
// user code begin {2}
// user code end
handleException(ivjExc);
}
}
return ivjResultField;
}
/**
* Called whenever the part throws an exception.
*
* @param exception
* Exception
*/
private void handleException(Throwable exception) {
log.error("Unhandled Exception", exception);
}
/**
* Initialize the class.
*/
/* WARNING: THIS METHOD WILL BE REGENERATED. */
private void initialize() {
try {
// user code begin {1}
// user code end
setName("LogFrame");
setDefaultCloseOperation(javax.swing.WindowConstants.HIDE_ON_CLOSE);
setSize(800, 500);
setTitle("Logs");
setContentPane(getJFrameContentPane());
} catch (Throwable ivjExc) {
handleException(ivjExc);
}
URL url = getClass().getResource("/images/log.gif");
if (url != null)
setIconImage(new ImageIcon(url).getImage());
}
}
Ads help maintain this website.