org.nuiton.widget
Class ApplicationMonitor

java.lang.Object
  extended by java.awt.Component
      extended by java.awt.Container
          extended by javax.swing.JComponent
              extended by javax.swing.JPanel
                  extended by org.nuiton.widget.ApplicationMonitor
All Implemented Interfaces:
ImageObserver, MenuContainer, Serializable, Accessible

public class ApplicationMonitor
extends JPanel

See Also:
Serialized Form

Nested Class Summary
protected  class ApplicationMonitor.LogListener
           
 
Nested classes/interfaces inherited from class javax.swing.JPanel
JPanel.AccessibleJPanel
 
Nested classes/interfaces inherited from class javax.swing.JComponent
JComponent.AccessibleJComponent
 
Nested classes/interfaces inherited from class java.awt.Container
Container.AccessibleAWTContainer
 
Nested classes/interfaces inherited from class java.awt.Component
Component.AccessibleAWTComponent, Component.BaselineResizeBehavior, Component.BltBufferStrategy, Component.FlipBufferStrategy
 
Field Summary
protected  JTextArea allStreamsTextArea
           
static int DEFAULT_FOOTER_LINE
          nombre de ligne a conserver en fin des logs ex: stack trace si egal a -1 en meme temps que DEFAULT_HEADER_LINE alors tout le log est conservé
static String DEFAULT_FROM_ADDRESS
           
static int DEFAULT_HEADER_LINE
          nombre de ligne a conserver au debut des logs ex: param de lancement si egal a -1 en meme temps que DEFAULT_FOOTER_LINE alors tout le log est conservé
static String DEFAULT_LOGGING_SYSTEM
           
static String DEFAULT_SMTP_SERVER
           
static String DEFAULT_TO_ADDRESS
           
protected  JTextArea errorStreamTextArea
           
protected  String from
           
protected  JPanel jPanel
           
protected  JPanel jPanel1
           
protected  JPanel jPanel2
           
protected  JPanel jPanel2bis
           
protected  JPanel jPanel3
           
protected  JPanel jPanel4
           
protected  JPanel jPanel5
           
protected  JPanel jPanel6
           
protected  JScrollPane jScrollPane
           
protected  JScrollPane jScrollPane1
           
protected  JScrollPane jScrollPane2
           
protected  JScrollPane jScrollPanebis
           
protected  JTabbedPane jTabbedPane
           
protected  String loggingSystem
           
protected  ApplicationMonitor.LogListener logListener
           
protected  JTextArea logStreamTextArea
           
protected  JTextArea outputStreamTextArea
           
protected  JButton resetButton
           
protected  JButton sendByEmailButton
           
protected  String smtpServer
           
protected  StatusBar statusBar
           
protected  PrintStream stderr
           
protected  PrintStream stdout
           
protected  String to
           
 
Fields inherited from class javax.swing.JComponent
accessibleContext, listenerList, TOOL_TIP_TEXT_KEY, ui, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOW
 
Fields inherited from class java.awt.Component
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
 
Fields inherited from interface java.awt.image.ImageObserver
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
 
Constructor Summary
ApplicationMonitor()
          This is the default constructor
ApplicationMonitor(String loggingSystem)
           
ApplicationMonitor(String loggingSystem, String smtpServer, String from, String to)
           
 
Method Summary
protected  void ensureLine(JTextArea target)
          ensure that the textarea does'nt have more than necessary line
protected  void finalize()
           
protected  JTextArea getAllStreamsTextArea()
          This method initializes allStreamsTextArea
protected  JTextArea getErrorStreamTextArea()
          This method initializes jTextArea1
protected  JPanel getJPanel()
          This method initializes jPanel
protected  JPanel getJPanel1()
          This method initializes jPanel1
protected  JPanel getJPanel2()
          This method initializes jPanel2
protected  JPanel getJPanel2bis()
          This method initializes jPanel2bis
protected  JPanel getJPanel3()
          This method initializes jPanel3
protected  JPanel getJPanel4()
          This method initializes jPanel4
protected  JPanel getJPanel5()
          This method initializes jPanel5
protected  JPanel getJPanel6()
          This method initializes jPanel6
protected  JScrollPane getJScrollPane()
          This method initializes jScrollPane
protected  JScrollPane getJScrollPane1()
          This method initializes jScrollPane1
protected  JScrollPane getJScrollPane2()
          This method initializes jScrollPane2
protected  JScrollPane getJScrollPanebis()
          This method initializes jScrollPanebis
protected  JTabbedPane getJTabbedPane()
          This method initializes jTabbedPane
protected  JTextArea getLogStreamTextArea()
          This method initializes jTextArea
protected  JTextArea getOutputStreamTextArea()
          This method initializes jTextArea
protected  JButton getResetButton()
          This method initializes jButton
protected  JButton getSendByEmailButton()
          This method initializes jButton1
protected  StatusBar getStatusBar()
           
protected  void initialize()
           
protected  void initializeLoggingHandler()
          Set a logging handler up
protected  void initializeRedirect()
          Sets new OutputStreams for System.out and System.err
protected  void initializeUI()
          This method initializes UI
static void main(String[] args)
           
 void resetConsoleContent()
           
protected  void send(String smtpServer, String to, String from, String subject, String body)
          Send an email using the given informations (stmpServer, toAddress, fromAddress, subject and body).
 void sendConsoleContentByMail()
           
 void setEmailFrom(String from)
           
 void setEmailTo(String to)
           
 void setSmtpServer(String smtpServer)
           
 
Methods inherited from class javax.swing.JPanel
getAccessibleContext, getUI, getUIClassID, paramString, setUI, updateUI
 
Methods inherited from class javax.swing.JComponent
addAncestorListener, addNotify, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, fireVetoableChange, getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAncestorListeners, getAutoscrolls, getBaseline, getBaselineResizeBehavior, getBorder, getBounds, getClientProperty, getComponentGraphics, getComponentPopupMenu, getConditionForKeyStroke, getDebugGraphicsOptions, getDefaultLocale, getFontMetrics, getGraphics, getHeight, getInheritsPopupMenu, getInputMap, getInputMap, getInputVerifier, getInsets, getInsets, getListeners, getLocation, getMaximumSize, getMinimumSize, getNextFocusableComponent, getPopupLocation, getPreferredSize, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getToolTipText, getTopLevelAncestor, getTransferHandler, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, isDoubleBuffered, isLightweightComponent, isManagingFocus, isOpaque, isOptimizedDrawingEnabled, isPaintingForPrint, isPaintingTile, isRequestFocusEnabled, isValidateRoot, paint, paintBorder, paintChildren, paintComponent, paintImmediately, paintImmediately, print, printAll, printBorder, printChildren, printComponent, processComponentKeyEvent, processKeyBinding, processKeyEvent, processMouseEvent, processMouseMotionEvent, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeNotify, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resetKeyboardActions, reshape, revalidate, scrollRectToVisible, setActionMap, setAlignmentX, setAlignmentY, setAutoscrolls, setBackground, setBorder, setComponentPopupMenu, setDebugGraphicsOptions, setDefaultLocale, setDoubleBuffered, setEnabled, setFocusTraversalKeys, setFont, setForeground, setInheritsPopupMenu, setInputMap, setInputVerifier, setMaximumSize, setMinimumSize, setNextFocusableComponent, setOpaque, setPreferredSize, setRequestFocusEnabled, setToolTipText, setTransferHandler, setUI, setVerifyInputWhenFocusTarget, setVisible, unregisterKeyboardAction, update
 
Methods inherited from class java.awt.Container
add, add, add, add, add, addContainerListener, addImpl, addPropertyChangeListener, addPropertyChangeListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalKeys, getFocusTraversalPolicy, getLayout, getMousePosition, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, printComponents, processContainerEvent, processEvent, remove, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusCycleRoot, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setLayout, transferFocusBackward, transferFocusDownCycle, validate, validateTree
 
Methods inherited from class java.awt.Component
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, coalesceEvents, contains, createImage, createImage, createVolatileImage, createVolatileImage, disableEvents, dispatchEvent, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBackground, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getForeground, getGraphicsConfiguration, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocale, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getToolkit, getTreeLock, gotFocus, handleEvent, hasFocus, hide, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isPreferredSizeSet, isShowing, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, postEvent, prepareImage, prepareImage, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processMouseWheelEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, resize, resize, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setFocusable, setFocusTraversalKeysEnabled, setIgnoreRepaint, setLocale, setLocation, setLocation, setName, setSize, setSize, show, show, size, toString, transferFocus, transferFocusUpCycle
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

DEFAULT_HEADER_LINE

public static int DEFAULT_HEADER_LINE
nombre de ligne a conserver au debut des logs ex: param de lancement si egal a -1 en meme temps que DEFAULT_FOOTER_LINE alors tout le log est conservé


DEFAULT_FOOTER_LINE

public static int DEFAULT_FOOTER_LINE
nombre de ligne a conserver en fin des logs ex: stack trace si egal a -1 en meme temps que DEFAULT_HEADER_LINE alors tout le log est conservé


DEFAULT_LOGGING_SYSTEM

public static final String DEFAULT_LOGGING_SYSTEM
See Also:
Constant Field Values

DEFAULT_SMTP_SERVER

public static final String DEFAULT_SMTP_SERVER
See Also:
Constant Field Values

DEFAULT_FROM_ADDRESS

public static final String DEFAULT_FROM_ADDRESS
See Also:
Constant Field Values

DEFAULT_TO_ADDRESS

public static final String DEFAULT_TO_ADDRESS
See Also:
Constant Field Values

loggingSystem

protected String loggingSystem

smtpServer

protected String smtpServer

to

protected String to

from

protected String from

stdout

protected PrintStream stdout

stderr

protected PrintStream stderr

logListener

protected ApplicationMonitor.LogListener logListener

jPanel

protected JPanel jPanel

jPanel1

protected JPanel jPanel1

resetButton

protected JButton resetButton

sendByEmailButton

protected JButton sendByEmailButton

jTabbedPane

protected JTabbedPane jTabbedPane

jPanel2

protected JPanel jPanel2

jPanel2bis

protected JPanel jPanel2bis

jPanel3

protected JPanel jPanel3

jScrollPane

protected JScrollPane jScrollPane

jScrollPanebis

protected JScrollPane jScrollPanebis

outputStreamTextArea

protected JTextArea outputStreamTextArea

allStreamsTextArea

protected JTextArea allStreamsTextArea

jScrollPane1

protected JScrollPane jScrollPane1

errorStreamTextArea

protected JTextArea errorStreamTextArea

statusBar

protected StatusBar statusBar

jPanel4

protected JPanel jPanel4

jScrollPane2

protected JScrollPane jScrollPane2

logStreamTextArea

protected JTextArea logStreamTextArea

jPanel5

protected JPanel jPanel5

jPanel6

protected JPanel jPanel6
Constructor Detail

ApplicationMonitor

public ApplicationMonitor()
This is the default constructor


ApplicationMonitor

public ApplicationMonitor(String loggingSystem)

ApplicationMonitor

public ApplicationMonitor(String loggingSystem,
                          String smtpServer,
                          String from,
                          String to)
Method Detail

resetConsoleContent

public void resetConsoleContent()

sendConsoleContentByMail

public void sendConsoleContentByMail()

setSmtpServer

public void setSmtpServer(String smtpServer)
Parameters:
smtpServer - the smtpServer to set

setEmailTo

public void setEmailTo(String to)
Parameters:
to - the to to set

setEmailFrom

public void setEmailFrom(String from)
Parameters:
from - the from to set

initialize

protected void initialize()

initializeRedirect

protected void initializeRedirect()
Sets new OutputStreams for System.out and System.err


finalize

protected void finalize()
                 throws Throwable
Overrides:
finalize in class Object
Throws:
Throwable

initializeLoggingHandler

protected void initializeLoggingHandler()
Set a logging handler up


send

protected void send(String smtpServer,
                    String to,
                    String from,
                    String subject,
                    String body)
             throws javax.mail.internet.AddressException,
                    javax.mail.MessagingException
Send an email using the given informations (stmpServer, toAddress, fromAddress, subject and body).

Parameters:
smtpServer -
to -
from -
subject -
body -
Throws:
javax.mail.MessagingException
javax.mail.internet.AddressException

initializeUI

protected void initializeUI()
This method initializes UI


getJPanel

protected JPanel getJPanel()
This method initializes jPanel

Returns:
javax.swing.JPanel

getJPanel1

protected JPanel getJPanel1()
This method initializes jPanel1

Returns:
javax.swing.JPanel

getResetButton

protected JButton getResetButton()
This method initializes jButton

Returns:
javax.swing.JButton

getSendByEmailButton

protected JButton getSendByEmailButton()
This method initializes jButton1

Returns:
javax.swing.JButton

getJTabbedPane

protected JTabbedPane getJTabbedPane()
This method initializes jTabbedPane

Returns:
javax.swing.JTabbedPane

getJPanel2bis

protected JPanel getJPanel2bis()
This method initializes jPanel2bis

Returns:
javax.swing.JPanel

getJPanel2

protected JPanel getJPanel2()
This method initializes jPanel2

Returns:
javax.swing.JPanel

getJPanel3

protected JPanel getJPanel3()
This method initializes jPanel3

Returns:
javax.swing.JPanel

getJScrollPanebis

protected JScrollPane getJScrollPanebis()
This method initializes jScrollPanebis

Returns:
javax.swing.JScrollPane

getJScrollPane

protected JScrollPane getJScrollPane()
This method initializes jScrollPane

Returns:
javax.swing.JScrollPane

getAllStreamsTextArea

protected JTextArea getAllStreamsTextArea()
This method initializes allStreamsTextArea

Returns:
javax.swing.JTextArea

getOutputStreamTextArea

protected JTextArea getOutputStreamTextArea()
This method initializes jTextArea

Returns:
javax.swing.JTextArea

getJScrollPane1

protected JScrollPane getJScrollPane1()
This method initializes jScrollPane1

Returns:
javax.swing.JScrollPane

getErrorStreamTextArea

protected JTextArea getErrorStreamTextArea()
This method initializes jTextArea1

Returns:
javax.swing.JTextArea

getJPanel4

protected JPanel getJPanel4()
This method initializes jPanel4

Returns:
javax.swing.JPanel

getJScrollPane2

protected JScrollPane getJScrollPane2()
This method initializes jScrollPane2

Returns:
javax.swing.JScrollPane

getLogStreamTextArea

protected JTextArea getLogStreamTextArea()
This method initializes jTextArea

Returns:
javax.swing.JTextArea

getJPanel5

protected JPanel getJPanel5()
This method initializes jPanel5

Returns:
javax.swing.JPanel

getJPanel6

protected JPanel getJPanel6()
This method initializes jPanel6

Returns:
javax.swing.JPanel

getStatusBar

protected StatusBar getStatusBar()

ensureLine

protected void ensureLine(JTextArea target)
ensure that the textarea does'nt have more than necessary line

Parameters:
target -

main

public static void main(String[] args)


Copyright © 2004-2010 CodeLutin. All Rights Reserved.