All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class com.ibm.as400.ui.util.MessageViewer

java.lang.Object
   |
   +----com.ibm.as400.ui.util.MessageViewer

public class MessageViewer
extends Object
implements ListSelectionListener
Displays a set of messages.

MessageViewer allows you to do the following:

MessageViewer accepts as input on creation:

Examples

The following code constructs a newly-defined panel, adds messages, sets the style and instructional text, and displays the panel.

 import com.ibm.as400.ui.framework.java.*;
  
 MessageViewer mv = new MessageViewer("Sample Messages");
 mv.addMessage("Test error message number one", "ID 1", "Detail information about error message number one. Something is very bad.");
 mv.addMessage("Test error message number two", "ID 2", "Detail information about error message number two. Something is very very bad.");
 mv.setStyle(STYLE_OKCANCEL_DUAL);
 mv.setButtonTextOKDual( "Accept");
 mv.setButtonTextCancel( "Reject");
 mv.setInstructionText("This is sample Instruction Text.  Press a button, any button");
 mv.setExitOnClose(true);
 mv.setVisible(true);
 


Variable Index

 o STYLE_OK_SINGLE
Style which displays dual buttons, an OK and a Cancel, which can be relabelled, if desired.
 o STYLE_OKCANCEL_DUAL
Style which displays a single OK button, which can be relabelled.

Constructor Index

 o MessageViewer(String)
Constructs a MessageViewer panel.
 o MessageViewer(String, Frame)
Constructs a MessageViewer panel.
 o MessageViewer(String, PanelManager)
Constructs a MessageViewer panel.

Method Index

 o addActionListenerButtonCancel(ActionListener)
Adds an ActionListener to the CANCEL button of the STYLE_OKCANCEL_DUAL style
 o addActionListenerButtonOKDual(ActionListener)
Adds an ActionListener to the OK button of the STYLE_OKCANCEL_DUAL style
 o addActionListenerButtonOKSingle(ActionListener)
Adds an ActionListener to the OK button of the STYLE_OK_SINGLE style
 o addMessage(AS400Message)
Adds a message to be displayed.
 o addMessage(String)
Adds a simple message to be displayed.
 o addMessage(String, String, String)
Adds a message to be displayed.
 o addMessages(AS400Message[])
Adds a message to be displayed.
 o getButtonTextCancel()
Returns the label text of the CANCEL button in the STYLE_OKCANCEL_DUAL style.
 o getButtonTextOKDual()
Returns the label text of the OK button in the STYLE_OKCANCEL_DUAL style.
 o getButtonTextOKSingle()
Returns the label text of the OK button in the STYLE_OK_SINGLE style.
 o getExitOnClose()
Determines whether the application exits when this panel is closed.
 o getInstructionText()
Returns the panel instruction text.
 o getStyle()
Determines the display style of the panel.
 o getTitle()
Returns the panel's title.
 o setButtonTextCancel(String)
Sets the label text of the CANCEL button in the STYLE_OKCANCEL_DUAL style.
 o setButtonTextOKDual(String)
Sets the label text of the OK button in the STYLE_OKCANCEL_DUAL style.
 o setButtonTextOKSingle(String)
Sets the label text of the OK button in the STYLE_OK_SINGLE style.
 o setExitOnClose(boolean)
Controls whether the application exits when the panel is closed, based on the value of parameter bExit.
 o setInstructionText(String)
Changes the panel instruction text.
 o setStyle(int)
Changes style settings, such as the display of the OK button, on a MessageViewer panel.
 o setTitle(String)
Overrides the panel title defined at the creation of the panel.
 o setVisible(boolean)
Shows or hides the panel, depending on the value of bVisible<\code>.
 o valueChanged(ListSelectionEvent)

Variables

 o STYLE_OK_SINGLE
 public static final int STYLE_OK_SINGLE
Style which displays dual buttons, an OK and a Cancel, which can be relabelled, if desired. To be used when there is a need to make a choice based on the messages displayed.

See Also:
getStyle, setStyle
 o STYLE_OKCANCEL_DUAL
 public static final int STYLE_OKCANCEL_DUAL
Style which displays a single OK button, which can be relabelled. This is the default.

See Also:
getStyle, setStyle

Constructors

 o MessageViewer
 public MessageViewer(String strTitle)
Constructs a MessageViewer panel.

Parameters:
strTitle - the Title to be displayed with the messages. If none given, defaults to "Display Messages"
 o MessageViewer
 public MessageViewer(String strTitle,
                      Frame owner)
Constructs a MessageViewer panel.

Parameters:
strTitle - the Title to be displayed with the messages. If none given, defaults to "Display Messages"
owner - the owning frame
 o MessageViewer
 public MessageViewer(String strTitle,
                      PanelManager modalPanelManager)
Constructs a MessageViewer panel.

Parameters:
strTitle - the Title to be displayed with the messages. If none given, defaults to "Display Messages"
modalPanelManager - PanelManager object that controls the modality

Methods

 o setVisible
 public void setVisible(boolean bVisible)
Shows or hides the panel, depending on the value of bVisible<\code>.

Parameters:
bVisible - "true" causes the panel to display, "false" causes it to be hidden
 o setStyle
 public void setStyle(int iStyle)
Changes style settings, such as the display of the OK button, on a MessageViewer panel.
STYLE_OKCANCEL_DUAL
Displays dual buttons, an OK and a Cancel, which can be relabelled, if desired. To be used when there is a need to make a choice based on the messages displayed.

STYLE_OK_SINGLE
Displays a single OK button, which can be relabelled. This is the default.

Parameters:
iStyle - the style to apply
 o getStyle
 public int getStyle()
Determines the display style of the panel.

Returns:
the display style of the panel.
See Also:
setStyle
 o setExitOnClose
 public void setExitOnClose(boolean bExit)
Controls whether the application exits when the panel is closed, based on the value of parameter bExit. The default value is false.

This method has no effect if it is called after this panel is made visible, or if the application supplied the container to be managed.

Parameters:
bExit - If true, exit the application; otherwise, just hide the panel.
See Also:
getExitOnClose
 o getExitOnClose
 public boolean getExitOnClose()
Determines whether the application exits when this panel is closed.

Returns:
true if the application will be exited; false otherwise.
See Also:
setExitOnClose
 o setTitle
 public void setTitle(String strTitle)
Overrides the panel title defined at the creation of the panel.

Parameters:
strTitle - The title which should appear in the panel's title bar.
See Also:
getTitle
 o getTitle
 public String getTitle()
Returns the panel's title.

Returns:
The title which appears in the panel's title bar.
See Also:
setTitle
 o setInstructionText
 public void setInstructionText(String strInstruction)
Changes the panel instruction text.

The default instruction text is blank.

Parameters:
strInstruction - The intruction text which should appear on the panel above the OK or YES/NO buttons.
See Also:
getInstructionText
 o getInstructionText
 public String getInstructionText()
Returns the panel instruction text.

See Also:
setInstructionText
 o addActionListenerButtonOKDual
 public void addActionListenerButtonOKDual(ActionListener listener)
Adds an ActionListener to the OK button of the STYLE_OKCANCEL_DUAL style

Parameters:
listener - the listener to be added.
See Also:
addActionListenerButtonOKSingle, addActionListenerButtonCancel
 o addActionListenerButtonCancel
 public void addActionListenerButtonCancel(ActionListener listener)
Adds an ActionListener to the CANCEL button of the STYLE_OKCANCEL_DUAL style

Parameters:
listener - the listener to be added.
See Also:
addActionListenerButtonOKSingle, addActionListenerButtonOKDual
 o addActionListenerButtonOKSingle
 public void addActionListenerButtonOKSingle(ActionListener listener)
Adds an ActionListener to the OK button of the STYLE_OK_SINGLE style

Parameters:
listener - the listener to be added.
See Also:
addActionListenerButtonOKDual, addActionListenerButtonCancel
 o getButtonTextOKDual
 public String getButtonTextOKDual()
Returns the label text of the OK button in the STYLE_OKCANCEL_DUAL style.

See Also:
getButtonTextOKSingle, getButtonTextCancel, setButtonTextOKDual, setButtonTextOKSingle, setButtonTextCancel
 o getButtonTextOKSingle
 public String getButtonTextOKSingle()
Returns the label text of the OK button in the STYLE_OK_SINGLE style.

See Also:
getButtonTextOKDual, getButtonTextCancel, setButtonTextOKDual, setButtonTextOKSingle, setButtonTextCancel
 o getButtonTextCancel
 public String getButtonTextCancel()
Returns the label text of the CANCEL button in the STYLE_OKCANCEL_DUAL style.

See Also:
getButtonTextOKDual, getButtonTextOKSingle, setButtonTextOKDual, setButtonTextOKSingle, setButtonTextCancel
 o setButtonTextOKDual
 public void setButtonTextOKDual(String strButtonText)
Sets the label text of the OK button in the STYLE_OKCANCEL_DUAL style.

See Also:
getButtonTextOKDual, getButtonTextOKSingle, getButtonTextCancel, setButtonTextOKSingle, setButtonTextCancel
 o setButtonTextOKSingle
 public void setButtonTextOKSingle(String strButtonText)
Sets the label text of the OK button in the STYLE_OK_SINGLE style.

See Also:
getButtonTextOKDual, getButtonTextOKSingle, getButtonTextCancel, setButtonTextOKDual, setButtonTextCancel
 o setButtonTextCancel
 public void setButtonTextCancel(String strButtonText)
Sets the label text of the CANCEL button in the STYLE_OKCANCEL_DUAL style.

See Also:
getButtonTextOKDual, getButtonTextOKSingle, getButtonTextCancel, setButtonTextOKDual, setButtonTextOKSingle
 o valueChanged
 public void valueChanged(ListSelectionEvent e)
 o addMessage
 public void addMessage(String strMessage,
                        String strID,
                        String strDetail)
Adds a message to be displayed.

If strDetail has a value, the Details button will be enabled.

Parameters:
strMessage - the short message to be displayed in the MessageViewer
strID - an identifier for the message. Displayed on the MessageDetail panel.
strDetail - detail information about the message. Displayed on the MessageDetail panel.
 o addMessage
 public void addMessage(String strMessage)
Adds a simple message to be displayed.

Messages added with this method have no detail. The Details button remains disabled.

Parameters:
strMessage - the short message to be displayed in the MessageViewer
 o addMessage
 public void addMessage(AS400Message AS400msg)
Adds a message to be displayed.

Parameters:
AS400msg - an AS400 message object
 o addMessages
 public void addMessages(AS400Message AS400msgList[])
Adds a message to be displayed.

Parameters:
AS400msgList - an array AS400 message objects

All Packages  Class Hierarchy  This Package  Previous  Next  Index