net.sourceforge.java.feednread.frontend.components.tabbar
Class MessagePanel

java.lang.Object
  extended byorg.eclipse.swt.widgets.Widget
      extended byorg.eclipse.swt.widgets.Control
          extended byorg.eclipse.swt.widgets.Scrollable
              extended byorg.eclipse.swt.widgets.Composite
                  extended bynet.sourceforge.java.feednread.frontend.components.tabbar.MessagePanel
All Implemented Interfaces:
Drawable, EventListener, ILanguageResourceChangeListener

public class MessagePanel
extends Composite
implements ILanguageResourceChangeListener

Panel to display user defined messages. It is also capable of displaying an Exception including the stack trace.

Author:
Sebastian Machhausen

Field Summary
private  Label exceptionInfoLabel
           
private  String message
           
private  Composite messageArea
           
private  Label messageInfoLabel
           
private  String origin
           
private  Label originInfoLabel
           
private  Throwable throwable
           
private  String title
           
private  int type
           
private  Label typeInfoLabel
           
 
Fields inherited from class org.eclipse.swt.widgets.Composite
 
Fields inherited from class org.eclipse.swt.widgets.Scrollable
 
Fields inherited from class org.eclipse.swt.widgets.Control
handle
 
Fields inherited from class org.eclipse.swt.widgets.Widget
 
Constructor Summary
MessagePanel(Composite parent, String title, String message, String origin, int type)
           Creates a new MessagePanel instance.
MessagePanel(Composite parent, String title, Throwable throwable)
           Creates a new MessagePanel instance which displays a Throwable including its stack trace.
 
Method Summary
private  void createComponents(Composite parent)
           Creates all components of this MessagePanel.
private  void createExceptionArea()
           Creates the exception area Composite.
private  void createMessageArea(Composite parent, Label headerLabel)
           Creates the message area of this MessagePanel.
 void defaultLanguageChanged(LanguageResourceChangeEvent lrce)
           Called whenever the default language changes.
 void dispose()
           Disposes all resource claimed by this MessagePanel.
private static void setShellImage(Shell shell, int type)
           Sets the Shell Image depending on the specified type.
static void showAsShell(Display display, String title, String message, String origin, int type)
           Displays a MessagePanel in a Shell.
static void showAsShell(Display display, String title, Throwable throwable)
           Displays a MessagePanel in a Shell.
 
Methods inherited from class org.eclipse.swt.widgets.Composite
changed, checkSubclass, computeSize, getBackgroundMode, getChildren, getLayout, getLayoutDeferred, getTabList, isLayoutDeferred, layout, layout, layout, layout, setBackgroundMode, setFocus, setLayout, setLayoutDeferred, setTabList
 
Methods inherited from class org.eclipse.swt.widgets.Scrollable
computeTrim, getClientArea, getHorizontalBar, getVerticalBar
 
Methods inherited from class org.eclipse.swt.widgets.Control
addControlListener, addFocusListener, addHelpListener, addKeyListener, addMouseListener, addMouseMoveListener, addMouseTrackListener, addPaintListener, addTraverseListener, computeSize, forceFocus, getAccessible, getBackground, getBackgroundImage, getBorderWidth, getBounds, getEnabled, getFont, getForeground, getLayoutData, getLocation, getMenu, getMonitor, getParent, getShell, getSize, getToolTipText, getVisible, internal_dispose_GC, internal_new_GC, isEnabled, isFocusControl, isReparentable, isVisible, moveAbove, moveBelow, pack, pack, redraw, redraw, removeControlListener, removeFocusListener, removeHelpListener, removeKeyListener, removeMouseListener, removeMouseMoveListener, removeMouseTrackListener, removePaintListener, removeTraverseListener, setBackground, setBackgroundImage, setBounds, setBounds, setCapture, setCursor, setEnabled, setFont, setForeground, setLayoutData, setLocation, setLocation, setMenu, setParent, setRedraw, setSize, setSize, setToolTipText, setVisible, toControl, toControl, toDisplay, toDisplay, traverse, update
 
Methods inherited from class org.eclipse.swt.widgets.Widget
addDisposeListener, addListener, checkWidget, getData, getData, getDisplay, getStyle, isDisposed, isListening, notifyListeners, removeDisposeListener, removeListener, removeListener, setData, setData, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

messageArea

private Composite messageArea

typeInfoLabel

private Label typeInfoLabel

originInfoLabel

private Label originInfoLabel

messageInfoLabel

private Label messageInfoLabel

exceptionInfoLabel

private Label exceptionInfoLabel

title

private String title

message

private String message

type

private int type

origin

private String origin

throwable

private Throwable throwable
Constructor Detail

MessagePanel

public MessagePanel(Composite parent,
                    String title,
                    String message,
                    String origin,
                    int type)

Creates a new MessagePanel instance.

Parameters:
parent - the parent Composite to embed the MessagePanel in
title - the message title
message - the message
origin - the origin of the message
type - one of the following message types:

MessagePanel

public MessagePanel(Composite parent,
                    String title,
                    Throwable throwable)

Creates a new MessagePanel instance which displays a Throwable including its stack trace. This can be used for debugging purpose.

Parameters:
parent - the parent Composite to embed the MessagePanel in
title - the message title
throwable - a Throwable
Method Detail

showAsShell

public static void showAsShell(Display display,
                               String title,
                               Throwable throwable)

Displays a MessagePanel in a Shell.

Parameters:
display - the Display to create the Shell in
title - the message title
throwable - a Throwable

showAsShell

public static void showAsShell(Display display,
                               String title,
                               String message,
                               String origin,
                               int type)

Displays a MessagePanel in a Shell.

Parameters:
display - the Display to create the Shell in
title - the message title
message - the message
origin - the origin of the message
type - one of the following message types:

dispose

public void dispose()

Disposes all resource claimed by this MessagePanel.


defaultLanguageChanged

public void defaultLanguageChanged(LanguageResourceChangeEvent lrce)

Called whenever the default language changes.

Specified by:
defaultLanguageChanged in interface ILanguageResourceChangeListener
Parameters:
lrce - the triggered LanguageResourceChangeEvent

createComponents

private void createComponents(Composite parent)

Creates all components of this MessagePanel.

Parameters:
parent - the parent Composite to embed the MessagePanel components in

createMessageArea

private void createMessageArea(Composite parent,
                               Label headerLabel)

Creates the message area of this MessagePanel.

Parameters:
parent - the parent Composite
headerLabel - the header Label

createExceptionArea

private void createExceptionArea()

Creates the exception area Composite.


setShellImage

private static void setShellImage(Shell shell,
                                  int type)

Sets the Shell Image depending on the specified type.

Parameters:
shell - the Shell to set the Image for
type - one of the following message types: