OutputMessage Class
- public class OutputMessage
extends Object
implements ActionListener
Each line in the output window is represented by an OutputMessage.
To associate a "file open" action with your output messages, create a derived class that
implement getURI() and getLine(). To associate a custom
action, override the actionPerformed() method.
Note, every message that is 'clickable' should have an associated icon.
Related Topics
OutputSvc
-
Hierarchy
-
Object
OutputMessage
-
All Implemented Interfaces
-
ActionListener, EventListener
-
Direct Known Subclasses
-
DefaultFileMessage
public void |
-
actionPerformed(ActionEvent e)
- Override this method for custom action behavior.
|
public Color |
-
getColor()
- Color used to diplay the Icon to be displayed.
|
public int |
-
getColumn()
getLine() and getColumn() are used
in conjunction with getURI() to indicate where
to position cursor when the document is opened.
|
public Rectangle |
-
getHitArea()
- Returns the hotspot region for the action hyperlink.
|
public Icon |
-
getIcon()
- Icon to be displayed, can be over-ridden to delay compute the desired icon.
|
public int |
-
getLine()
getLine() and getColumn() are used
in conjunction with getURI() to indicate where
to position cursor when the document is opened.
|
public String |
-
getText()
- Simple text of this message.
|
public URI |
-
getURI()
getURI is used by the default implementation of
actionPerformed.
|
public Object |
-
getUserObject()
- Returns the underlying user object whose toString() method is used to generate the text for this message
|
public boolean |
-
hasAction()
- This method indicates a messages that has an action.
|
public void |
-
setHitArea(Rectangle hitArea)
- Sets the hotspot region for the action hyperlink
|
public static void |
-
setShowIcons(boolean show)
- Hint whether to show icons (e.g. font is really small -> don't show)
|
public void |
-
setText(String text)
- Set the text for this message
|
public static Color |
-
StandardColor(String token)
- Some colors are used over and over again in different output windows.
|
public String |
-
toString()
- Formats the string for this message.
|
public boolean |
-
useFixedCellHeight()
- Controls the appearance of this message in the output window
|
_color
protected Color _color
_hitArea
protected Rectangle _hitArea
_icon
protected Icon _icon
_obj
protected Object _obj
_res
protected static final ResourceSvc.IResourcePkg _res
_showIcons
protected static boolean _showIcons
COLOR_DEFAULT
public static final String COLOR_DEFAULT
- color constant used to indicate the default color
COLOR_ERROR
public static final String COLOR_ERROR
- color constant used to indicate the error color
COLOR_IGNORE
public static final String COLOR_IGNORE
- color constant used to indicate the color for messages that should be hidden
COLOR_INFO
public static final String COLOR_INFO
- color constant used to indicate the information color
COLOR_WARNING
public static final String COLOR_WARNING
- color constant used to indicate the warning color
OutputMessage
protected OutputMessage()
- Create OutputMessage with empty text, default color and no icon.
OutputMessage
public OutputMessage(Object userObject,
Color color,
Icon icon)
- Create OutputMessage with icon. The displayed text will be userObject.toString()
unless a subclass overrides
getText()
OutputMessage
public OutputMessage(Object userObject)
- Create OutputMessage with default color and no icon.
actionPerformed(ActionEvent) Method
public void actionPerformed(ActionEvent e)
Override this method for custom action behavior. Override getURI()/getLine()/getColumn()
for the default open file behavior.
getColor() Method
public Color getColor()
Color used to diplay the Icon to be displayed.
getColumn() Method
public int getColumn()
getLine() and getColumn() are used
in conjunction with getURI() to indicate where
to position cursor when the document is opened.
getHitArea() Method
public Rectangle getHitArea()
Returns the hotspot region for the action hyperlink.
getIcon() Method
public Icon getIcon()
Icon to be displayed, can be over-ridden to delay compute the desired icon.
getLine() Method
public int getLine()
getLine() and getColumn() are used
in conjunction with getURI() to indicate where
to position cursor when the document is opened.
getText() Method
public String getText()
Simple text of this message. Usually obtained by calling toString() on the underlying object passed in during
the constructor or set using setText().
Returns
- string containing the text of this message
getURI() Method
public URI getURI()
getURI is used by the default implementation of
actionPerformed.
Returns
- non-null return value indicates file to open if the
user double-clicks this message
getUserObject() Method
public Object getUserObject()
Returns the underlying user object whose toString() method is used to generate the text for this message
hasAction() Method
public boolean hasAction()
This method indicates a messages that has an action.
this return value is used to find messages for the
"open next/prev message" actions.
setHitArea(Rectangle) Method
public void setHitArea(Rectangle hitArea)
Sets the hotspot region for the action hyperlink
setShowIcons(boolean) Method
public static void setShowIcons(boolean show)
Hint whether to show icons (e.g. font is really small -> don't show)
setText(String) Method
public void setText(String text)
Set the text for this message
Parameters
-
text
- string to use as the text for this message
StandardColor(String) Method
public static Color StandardColor(String token)
Some colors are used over and over again in different output windows.
This is an effort to offer some standardization to those colors.
toString() Method
public String toString()
Formats the string for this message. The text is obtained from the user object provided, but this method adds
additional formatting compared with OutputMessage.getText(). If the color for the message is the same as the Standard
error color, or standard warning color, an appropriate internationalized string is prepended to the text. (eg. in
English, "ERROR:" and "WARNING:")
-
Overrides
-
Object.toString()
Returns
- formatted string representing this message
useFixedCellHeight() Method
public boolean useFixedCellHeight()
Controls the appearance of this message in the output window