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
           
protected  java.awt.Color background
           
protected  javax.swing.Action contextAction
           
protected  java.awt.Font font
           
protected  java.awt.Color foreground
           
protected  javax.swing.Action helpAction
           
protected  javax.swing.Icon icon
           
protected  boolean lazyFetchChildren
           
protected  java.awt.event.ActionListener messageAction
           
protected  javax.swing.tree.TreeCellRenderer renderer
           
protected  java.awt.event.ActionListener selectAction
           
protected  java.lang.String text
           
protected  java.lang.String toolTipText
           
 
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()
           
 javax.swing.tree.TreeCellRenderer getCellRenderer()
           
 javax.swing.Action getContextAction()
           
 java.awt.Font getFont()
           
 java.awt.Color getForeground()
           
 javax.swing.Action getHelpAction()
           
 javax.swing.Icon getIcon()
           
 java.awt.event.ActionListener getMessageAction()
           
 java.awt.event.ActionListener getSelectAction()
           
 java.lang.String getText()
           
 java.lang.String getToolTipText()
           
 boolean isLazyFetchChildren()
           
 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()
           
 
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

icon

protected javax.swing.Icon icon

background

protected java.awt.Color background

foreground

protected java.awt.Color foreground

font

protected java.awt.Font font

toolTipText

protected java.lang.String toolTipText

renderer

protected javax.swing.tree.TreeCellRenderer renderer

lazyFetchChildren

protected boolean lazyFetchChildren

contextAction

protected javax.swing.Action contextAction

actionEvent

protected java.awt.event.ActionEvent actionEvent

selectAction

protected java.awt.event.ActionListener selectAction

messageAction

protected java.awt.event.ActionListener messageAction

helpAction

protected javax.swing.Action helpAction
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.

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.

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.

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.

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.

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.
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. The default text is null ("").

getText

public java.lang.String getText()

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).

getIcon

public javax.swing.Icon getIcon()

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.

getBackground

public java.awt.Color getBackground()

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.

getForeground

public java.awt.Color getForeground()

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.

getFont

public java.awt.Font getFont()

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. The default toolTipText is null ("").

getToolTipText

public java.lang.String getToolTipText()

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.

getCellRenderer

public javax.swing.tree.TreeCellRenderer getCellRenderer()

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).


getContextAction

public javax.swing.Action getContextAction()

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).

This is typically used to show context help (or something) while the user scrolls though messages.


getSelectAction

public java.awt.event.ActionListener getSelectAction()

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.


getMessageAction

public java.awt.event.ActionListener getMessageAction()

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.

getHelpAction

public javax.swing.Action getHelpAction()

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.


isLazyFetchChildren

public boolean isLazyFetchChildren()

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.


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.

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.

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object