com.borland.primetime.ide
Class Message

java.lang.Object
  |
  +--com.borland.primetime.ide.Message
Direct Known Subclasses:
SearchManager.FindAllMessage, SearchManager.SearchPathResultMessage

public class Message
extends java.lang.Object

The Message class represents a single message line in the MessageView. The MessageView displays the text of the Message object using the font, background, and foreground settings in the message object (defaults if none are set).

When a message is single-clicked on (or the user scrolls to it with the keyboard) the selectAction() method is called (subclasses can override this). The default behavior of the selectAction method is to call the actionPerformed method of the selectAction (ActionListener) property. Use the selectAction to drive a view of the 'current' message if you want one.

When a message is double-clicked on (or the user hits ENTER on it), the messageAction() method is called (subclasses can override this). The default behavior of the messageAction method is to call the actionPerformed method of the messageAction (ActionListener) property. This is the event that is the effective 'trigger' of the message.

When a user hits F1 with focus on a message in the MessageView, the helpAction method is called. The default behavior of the helpAction method is to call the actionPerformed method of the helpAction (ActionListener) property.

When the user right-clicks on the MessageView, a context JPopupMenu is displayed. The 'contextAction' property holds the ActionGroup of actions to be displayed in the context popup.

See Also:
MessageView, MessageCategory, ActionGroup

Field Summary
protected  java.awt.event.ActionEvent actionEvent
          Internal cache for default Action created when needed to use instead of supplied selectAction or messageAction.
protected  java.awt.Color background
          The background color to use when drawing this message with the default TreeCellRenderer.
protected  javax.swing.Action contextAction
          The Action to use for the message popup or null to use the default.
protected  java.awt.Font font
          The font to use when drawing this message with the default TreeCellRenderer.
protected  java.awt.Color foreground
          The foreground color to use when drawing this message with the default TreeCellRenderer.
protected  javax.swing.Action helpAction
          Override of default Action on help event or null for default.
protected  javax.swing.Icon icon
          The Message icon or null if one is not defined.
protected  boolean lazyFetchChildren
          True if not to fetch any children of this message until its tree node is expanded.
protected  java.awt.event.ActionListener messageAction
          Override of default Action on action event or null for default.
protected  javax.swing.tree.TreeCellRenderer renderer
          The renderer to use when drawing this message or null to use the default.
protected  java.awt.event.ActionListener selectAction
          Override of default Action on select event or null for default.
protected  java.lang.String text
          The Message text.
protected  java.lang.String toolTipText
          The text to use when displaying a tooltip.
 
Constructor Summary
Message()
          Constructs a new Message object with all default property settings.
Message(java.lang.String text)
          Constructs a new Message object with the 'text' property set to the passed value.
Message(java.lang.String text, java.awt.event.ActionListener messageAction)
          Constructs a new Message object with the 'text' and 'messageAction' properties set to the passed values.
Message(java.lang.String text, javax.swing.Icon icon)
          Constructs a new Message object with the 'text' and 'icon' properties set to the passed values.
Message(java.lang.String text, javax.swing.Icon icon, java.awt.event.ActionListener messageAction)
          Constructs a new Message object with the 'text', 'icon', and 'messageAction' properties set to the passed values.
Message(java.lang.String text, javax.swing.Icon icon, java.lang.String toolTipText)
          Constructs a new Message object with the 'text', 'icon', and 'toolTipText' properties set to the passed values.
Message(java.lang.String text, javax.swing.Icon icon, java.lang.String toolTipText, java.awt.event.ActionListener messageAction)
          Constructs a new Message object with the 'text', 'icon', 'toolTipText', and 'messageAction' properties set to the passed values.
 
Method Summary
 void fetchChildren(Browser browser)
           Subclasses should override this method if they wish to add a single parent Message to the MessageView and display it as expandable (with a "+" box).
 java.awt.Color getBackground()
          The 'background' property is the background color for the message item.
 javax.swing.tree.TreeCellRenderer getCellRenderer()
          The 'cellRenderer' property stores the optional cell renderer to do the actual drawing of the message item.
 javax.swing.Action getContextAction()
           The 'contextAction' is the Action (or ActionGroup) that defines a popup menu that is displayed when a user right-clicks on a message item in the MessageView.
 java.awt.Font getFont()
          The 'font' property is the font used for this message item in the MessageView.
 java.awt.Color getForeground()
          The 'foreground' property is the foreground color for the message item.
 javax.swing.Action getHelpAction()
          The 'helpAction' property is the Action whose actionPerformed method gets called when the user hits F1 or selects help on a particular messageItem.
 javax.swing.Icon getIcon()
          The 'icon' property is the icon to be displayed with the message in the MessageView.
 java.awt.event.ActionListener getMessageAction()
           The 'messageAction' is the ActionListener whose actionPerformed method gets called when the message item is double-clicked or ENTER is hit on the item.
 java.awt.event.ActionListener getSelectAction()
           The 'selectAction' property is the ActionListener whose actionPerformed method gets called when the user hits selects a particular messageItem (first click with the mouse or scrolls to it using the keyboard).
 java.lang.String getText()
          The 'text' property is the String to be displayed as a message in the MessageView.
 java.lang.String getToolTipText()
          The 'toolTipText' property is the additional text that is displayed when the mouse is floated over this message item.
 boolean isLazyFetchChildren()
           The 'lazyFetchChildren' property allows hierarchical message structures to "lazy load" their children when the user clicks on the "+" by the message item in the MessageView.
 void messageAction(Browser browser)
          Subclasses should override this method to add custom functionality when the message item is double-clicked or if the user hits ENTER.
 void selectAction(Browser browser)
          Subclasses should override this method to add custom functionality when the message item is single-clicked on or if the user scrolls to the particular message item.
 void setBackground(java.awt.Color background)
          The 'background' property is the background color for the message item.
 void setCellRenderer(javax.swing.tree.TreeCellRenderer renderer)
          The 'cellRenderer' property stores the optional cell renderer to do the actual drawing of the message item.
 void setContextAction(javax.swing.Action contextAction)
           The 'contextAction' is the Action (or ActionGroup) that defines a popup menu that is displayed when a user right-clicks on a message item in the MessageView.
 void setFont(java.awt.Font font)
          The 'font' property is the font used for this message item in the MessageView.
 void setForeground(java.awt.Color foreground)
          The 'foreground' property is the foreground color for the message item.
 void setHelpAction(javax.swing.Action helpAction)
          The 'helpAction' property is the Action whose actionPerformed method gets called when the user hits F1 or selects help on a particular messageItem.
 void setIcon(javax.swing.Icon icon)
          The 'icon' property is the icon to be displayed with the message in the MessageView.
 void setLazyFetchChildren(boolean lazyFetch)
           The 'lazyFetchChildren' property allows hierarchical message structures to "lazy load" their children when the user clicks on the "+" by the message item in the MessageView.
 void setMessageAction(java.awt.event.ActionListener messageAction)
           The 'messageAction' is the ActionListener whose actionPerformed method gets called when the message item is double-clicked or ENTER is hit on the item.
 void setSelectAction(java.awt.event.ActionListener selectAction)
           The 'selectAction' property is the ActionListener whose actionPerformed method gets called when the user hits selects a particular messageItem (first click with the mouse or scrolls to it using the keyboard).
 void setText(java.lang.String text)
          The 'text' property is the String to be displayed as a message in the MessageView.
 void setToolTipText(java.lang.String toolTipText)
          The 'toolTipText' property is the additional text that is displayed when the mouse is floated over this message item.
 java.lang.String toString()
          Override to show message text.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

text

protected java.lang.String text
The Message text.

icon

protected javax.swing.Icon icon
The Message icon or null if one is not defined.

background

protected java.awt.Color background
The background color to use when drawing this message with the default TreeCellRenderer.

foreground

protected java.awt.Color foreground
The foreground color to use when drawing this message with the default TreeCellRenderer.

font

protected java.awt.Font font
The font to use when drawing this message with the default TreeCellRenderer.

toolTipText

protected java.lang.String toolTipText
The text to use when displaying a tooltip.

renderer

protected javax.swing.tree.TreeCellRenderer renderer
The renderer to use when drawing this message or null to use the default.

lazyFetchChildren

protected boolean lazyFetchChildren
True if not to fetch any children of this message until its tree node is expanded. Default is false.

contextAction

protected javax.swing.Action contextAction
The Action to use for the message popup or null to use the default.

actionEvent

protected java.awt.event.ActionEvent actionEvent
Internal cache for default Action created when needed to use instead of supplied selectAction or messageAction.

selectAction

protected java.awt.event.ActionListener selectAction
Override of default Action on select event or null for default.

messageAction

protected java.awt.event.ActionListener messageAction
Override of default Action on action event or null for default.

helpAction

protected javax.swing.Action helpAction
Override of default Action on help event or null for default.
Constructor Detail

Message

public Message()
Constructs a new Message object with all default property settings.

Message

public Message(java.lang.String text)
Constructs a new Message object with the 'text' property set to the passed value. All other properties use default settings.
Parameters:
text - Text to display.

Message

public Message(java.lang.String text,
               javax.swing.Icon icon)
Constructs a new Message object with the 'text' and 'icon' properties set to the passed values. All other properties use default settings.
Parameters:
text - Text to display.
icon - Icon to use or null.

Message

public Message(java.lang.String text,
               javax.swing.Icon icon,
               java.lang.String toolTipText)
Constructs a new Message object with the 'text', 'icon', and 'toolTipText' properties set to the passed values. All other properties use default settings.
Parameters:
text - Text to display.
icon - Icon to use or null.
toolTipText - Tooltip text to display.

Message

public Message(java.lang.String text,
               java.awt.event.ActionListener messageAction)
Constructs a new Message object with the 'text' and 'messageAction' properties set to the passed values. All other properties use default settings.
Parameters:
text - Text to display.
messageAction - Double-click action to invoke or null.

Message

public Message(java.lang.String text,
               javax.swing.Icon icon,
               java.awt.event.ActionListener messageAction)
Constructs a new Message object with the 'text', 'icon', and 'messageAction' properties set to the passed values. All other properties use default settings.
Parameters:
text - Text to display.
icon - Icon to use or null.
messageAction - Double-click action to invoke or null.

Message

public Message(java.lang.String text,
               javax.swing.Icon icon,
               java.lang.String toolTipText,
               java.awt.event.ActionListener messageAction)
Constructs a new Message object with the 'text', 'icon', 'toolTipText', and 'messageAction' properties set to the passed values. All other properties use default settings.
Parameters:
text - Text to display.
icon - Icon to use or null.
toolTipText - Tooltip text to display.
messageAction - Double-click action to invoke or null.
Method Detail

setText

public void setText(java.lang.String text)
The 'text' property is the String to be displayed as a message in the MessageView.
Parameters:
text - The text to display.

getText

public java.lang.String getText()
The 'text' property is the String to be displayed as a message in the MessageView.
Returns:
The text to display.

setIcon

public void setIcon(javax.swing.Icon icon)
The 'icon' property is the icon to be displayed with the message in the MessageView. The default icon is null (none).
Parameters:
icon - The icon to use or null.

getIcon

public javax.swing.Icon getIcon()
The 'icon' property is the icon to be displayed with the message in the MessageView. The default icon is null (none).
Returns:
The icon to use or null.

setBackground

public void setBackground(java.awt.Color background)
The 'background' property is the background color for the message item. The default background is the appropriate color in the current LookAndFeel.
Parameters:
background - The background color to use.

getBackground

public java.awt.Color getBackground()
The 'background' property is the background color for the message item. The default background is the appropriate color in the current LookAndFeel.
Returns:
The background color to use.

setForeground

public void setForeground(java.awt.Color foreground)
The 'foreground' property is the foreground color for the message item. The default foreground is the appropriate color in the current LookAndFeel.
Parameters:
foreground - The foreground color to use.

getForeground

public java.awt.Color getForeground()
The 'foreground' property is the foreground color for the message item. The default foreground is the appropriate color in the current LookAndFeel.
Returns:
The foreground color to use.

setFont

public void setFont(java.awt.Font font)
The 'font' property is the font used for this message item in the MessageView. The default font is the appropriate font in the current LookAndFeel.
Parameters:
font - The font to use.

getFont

public java.awt.Font getFont()
The 'font' property is the font used for this message item in the MessageView. The default font is the appropriate font in the current LookAndFeel.
Returns:
The font to use.

setToolTipText

public void setToolTipText(java.lang.String toolTipText)
The 'toolTipText' property is the additional text that is displayed when the mouse is floated over this message item.
Parameters:
tooltipText - The tooltip text to use.

getToolTipText

public java.lang.String getToolTipText()
The 'toolTipText' property is the additional text that is displayed when the mouse is floated over this message item.
Returns:
The tooltip text to use.

setCellRenderer

public void setCellRenderer(javax.swing.tree.TreeCellRenderer renderer)
The 'cellRenderer' property stores the optional cell renderer to do the actual drawing of the message item.
Parameters:
renderer - The renderer to use.

getCellRenderer

public javax.swing.tree.TreeCellRenderer getCellRenderer()
The 'cellRenderer' property stores the optional cell renderer to do the actual drawing of the message item.
Returns:
The renderer to use.

setContextAction

public void setContextAction(javax.swing.Action contextAction)

The 'contextAction' is the Action (or ActionGroup) that defines a popup menu that is displayed when a user right-clicks on a message item in the MessageView.

By default, there is no contextAction for the individual message items, but a short list of context actions for the MessageView itself. If a contextAction (or ActionGroup) is provided, the context items for the messageView will be displayed before the contextAction (with a separator).

Parameters:
contextAction - The Action or ActionGroup or null to use for a popup.

getContextAction

public javax.swing.Action getContextAction()

The 'contextAction' is the Action (or ActionGroup) that defines a popup menu that is displayed when a user right-clicks on a message item in the MessageView.

By default, there is no contextAction for the individual message items, but a short list of context actions for the MessageView itself. If a contextAction (or ActionGroup) is provided, the context items for the messageView will be displayed before the contextAction (with a separator).

Returns:
The Action or ActionGroup or null to use for a popup.

setSelectAction

public void setSelectAction(java.awt.event.ActionListener selectAction)

The 'selectAction' property is the ActionListener whose actionPerformed method gets called when the user hits selects a particular messageItem (first click with the mouse or scrolls to it using the keyboard).

Parameters:
selectAction - The Action to invoke on a simple navigation or null.

getSelectAction

public java.awt.event.ActionListener getSelectAction()

The 'selectAction' property is the ActionListener whose actionPerformed method gets called when the user hits selects a particular messageItem (first click with the mouse or scrolls to it using the keyboard).

Returns:
The Action to invoke on a simple navigation or null.

setMessageAction

public void setMessageAction(java.awt.event.ActionListener messageAction)

The 'messageAction' is the ActionListener whose actionPerformed method gets called when the message item is double-clicked or ENTER is hit on the item.

An example messageAction would be for a compiler error message to respond to a messageAction by loading the appropriate file into the browser, displaying it in the editor, and highlighting the appropriate error line.

Parameters:
messageAction - The Action to invoke when user activates.

getMessageAction

public java.awt.event.ActionListener getMessageAction()

The 'messageAction' is the ActionListener whose actionPerformed method gets called when the message item is double-clicked or ENTER is hit on the item.

An example messageAction would be for a compiler error message to respond to a messageAction by loading the appropriate file into the browser, displaying it in the editor, and highlighting the appropriate error line.

Returns:
The Action to invoke when user activates.

setHelpAction

public void setHelpAction(javax.swing.Action helpAction)
The 'helpAction' property is the Action whose actionPerformed method gets called when the user hits F1 or selects help on a particular messageItem.
Parameters:
helpAction - The Action or null to invoke on help.

getHelpAction

public javax.swing.Action getHelpAction()
The 'helpAction' property is the Action whose actionPerformed method gets called when the user hits F1 or selects help on a particular messageItem.
Returns:
helpAction The Action or null to invoke on help.

setLazyFetchChildren

public void setLazyFetchChildren(boolean lazyFetch)

The 'lazyFetchChildren' property allows hierarchical message structures to "lazy load" their children when the user clicks on the "+" by the message item in the MessageView. When the "+" is first clicked on, the fetchChildren() method is called on the message object, which is expected to populate the MessageView with new child messages parented by this Message object.

By default, Messages are not set to lazy fetch their children.

Parameters:
lazyFetch - True is want lazy fetch.

isLazyFetchChildren

public boolean isLazyFetchChildren()

The 'lazyFetchChildren' property allows hierarchical message structures to "lazy load" their children when the user clicks on the "+" by the message item in the MessageView. When the "+" is first clicked on, the fetchChildren() method is called on the message object, which is expected to populate the MessageView with new child messages parented by this Message object.

By default, Messages are not set to lazy fetch their children.

Returns:
lazyFetch True is want lazy fetch.

fetchChildren

public void fetchChildren(Browser browser)

Subclasses should override this method if they wish to add a single parent Message to the MessageView and display it as expandable (with a "+" box). When the message is expanded the first time, this method is called. The message is expected to then add child messages to this parent message via the passed Browser's MessageView.

NOTE: The boolean 'lazyFetchChildren' property MUST be set to true for this method to ever be called.

Parameters:
browser - The Browser owning the MessageView.

selectAction

public void selectAction(Browser browser)
Subclasses should override this method to add custom functionality when the message item is single-clicked on or if the user scrolls to the particular message item. A user of this Message class could also just plug in a selectAction (ActionListener) without subclassing the Message class.
Parameters:
browser - The Browser owning the MessageView.

messageAction

public void messageAction(Browser browser)
Subclasses should override this method to add custom functionality when the message item is double-clicked or if the user hits ENTER. A user of this Message class could also just plug in a messageAction (ActionListener) without subclassing the Message class.
Parameters:
browser - The Browser owning the MessageView.

toString

public java.lang.String toString()
Override to show message text.
Overrides:
toString in class java.lang.Object
Returns:
The message text.