com.borland.primetime.ide
Class MessageView

java.lang.Object
  |
  +--java.awt.Component
        |
        +--java.awt.Container
              |
              +--javax.swing.JComponent
                    |
                    +--javax.swing.JPanel
                          |
                          +--com.borland.primetime.ide.MessageView
All Implemented Interfaces:
javax.accessibility.Accessible, java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable

public class MessageView
extends javax.swing.JPanel

The MessageView (one instance per Browser) is a display mechanism for user messages. The MessageView displays com.borland.primetime.ide.Message objects on different tabs in a tree hierarchy. The tabs are defined by MessageCategory objects.

Custom UI can be displayed in the MessageView using the addCustomTab method, and passing custom UI.

See Also:
MessageCategory, Message, Serialized Form

Inner Class Summary
protected static class MessageView.ClipboardObserver
          Dummy clipboard interface to ignore lostOwnership().
 
Inner classes inherited from class javax.swing.JPanel
javax.swing.JPanel.AccessibleJPanel
 
Inner classes inherited from class javax.swing.JComponent
javax.swing.JComponent.AccessibleJComponent
 
Inner classes inherited from class java.awt.Container
java.awt.Container.AccessibleAWTContainer
 
Inner classes inherited from class java.awt.Component
java.awt.Component.AccessibleAWTComponent
 
Field Summary
 UpdateAction ACTION_CopyContent
          Action to copy all or selected portions of the MessageView content.
static BrowserAction ACTION_ExpandMessage
          Action to expand selected message in the MessageView.
static BrowserAction ACTION_NextMessage
          Action to move to the next message in the MessageView.
static BrowserAction ACTION_PriorMessage
          Action to move to the previous message in the MessageView.
static BrowserAction ACTION_TestMessageView
          The action 'TestMessageView' tests the MessageView by alternately adding messages to two tabs, the Log and Debug tab.
static BrowserAction ACTION_TestMessageView1
          Test Action which generates messages for the test category.
static BrowserAction ACTION_TestMessageView2
          Test Action which generates messages for the test category.
static BrowserAction ACTION_TestMessageView3
          Test Action which generates messages for the test category.
static MessageCategory CATEGORY_COMPILER
          Pre-defined MessageCategory for compiler tab.
static MessageCategory CATEGORY_DEBUG
          Pre-defined MessageCategory for debug tab.
static MessageCategory CATEGORY_ERROR
          Pre-defined MessageCategory for error tab.
static MessageCategory CATEGORY_EXCEPTION
          Pre-defined MessageCategory for exception tab.
static MessageCategory CATEGORY_LOG
          Pre-defined MessageCategory for log tab.
static MessageCategory CATEGORY_TEST
          Pre-defined MessageCategory for test tab.
 
Fields inherited from class javax.swing.JComponent
accessibleContext, listenerList, TOOL_TIP_TEXT_KEY, ui, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOW
 
Fields inherited from class java.awt.Component
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
 
Fields inherited from interface java.awt.image.ImageObserver
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
 
Method Summary
 void addContextAction(MessageCategory category, javax.swing.Action action)
          Adds an action to the local context menu of this tab.
 void addCustomTab(MessageCategory category, javax.swing.JComponent component)
          Adds a tab to this MessageView.
 Message addMessage(MessageCategory category, Message message)
          Adds a Message object to the specified tab in this MessageView.
 Message addMessage(MessageCategory category, Message message, boolean autoScroll)
          Adds a Message object to the specified tab in this MessageView.
 Message addMessage(MessageCategory category, Message parent, Message message)
          Adds a Message object as a child under the passed parent Message object on the specified tab.
 Message addMessage(MessageCategory category, Message parent, Message message, boolean autoScroll)
          Adds a Message object as a child under the passed parent Message object on the specified tab.
 Message addMessage(MessageCategory category, java.lang.String text)
          Adds a new Message object using the specified text to the specified tab in this MessageView.
 Message addMessage(MessageCategory category, java.lang.String text, java.awt.event.ActionListener messageAction)
          Adds a new Message object using the specified text and messageAction to the specified tab in this MessageView.
 Message addMessage(MessageCategory category, java.lang.String text, javax.swing.Icon icon)
          Adds a new Message object using the specified text and icon to the specified tab in this MessageView.
 Message addMessage(MessageCategory category, java.lang.String text, javax.swing.Icon icon, java.awt.event.ActionListener messageAction)
          Adds a new Message object using the specified text, icon, and messageAction to the specified tab in this MessageView.
 void addTab(MessageCategory category)
          Adds a tab to this MessageView.
 void clearMessages(MessageCategory category)
          Clears the Message objects from the passed category.
 void collapseMessage(MessageCategory category, Message parent)
          Collapses the given message treenode.
 void expandMessage(MessageCategory category, Message parent)
          Expands the given message treenode.
 void expandSelectedMessage()
          Expands the message currently selected in the MessageView.
 MessageCategory getActiveTab()
          Returns the current MessageCategory in this MessageView.
 java.awt.Dimension getMinimumSize()
           
 int getTabCount()
          Returns the count of tabs currently displayed in this MessageView.
 MessageCategory[] getTabs()
          Returns a MessageCategory array representing the existing tabs in this MessageView.
 boolean hasMessages(MessageCategory category)
          Returns whether or not any messages in the given MessageCategory.
 void removeChildren(MessageCategory category, Message parent)
          Removes a Message object's children in the passed category.
 void removeMessage(MessageCategory category, Message message)
          Removes a Message object (and its children) from the passed category.
 void removeTab(MessageCategory category)
          Removes the specified tab from the MessageView.
 void selectMessage(MessageCategory category, Message message)
          Select the identified message.
 void selectNextMessage()
          Selects the next message in the MessageView.
 void selectPriorMessage()
          Selects the prior message in the MessageView.
 void showTab(MessageCategory category)
          Shows (moves to front, or 'current') the specified tab in this MessageView.
 void updateUI()
          Override so that delegate the update to the proper component.
 
Methods inherited from class javax.swing.JPanel
getAccessibleContext, getUIClassID, paramString
 
Methods inherited from class javax.swing.JComponent
addAncestorListener, addNotify, addPropertyChangeListener, addPropertyChangeListener, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, fireVetoableChange, getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAutoscrolls, getBorder, getBounds, getClientProperty, getComponentGraphics, getConditionForKeyStroke, getDebugGraphicsOptions, getGraphics, getHeight, getInputMap, getInputMap, getInputVerifier, getInsets, getInsets, getListeners, getLocation, getMaximumSize, getNextFocusableComponent, getPreferredSize, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getToolTipText, getTopLevelAncestor, getVerifyInputWhenFocusTarget, getVisibleRect, getWidth, getX, getY, grabFocus, hasFocus, hide, isDoubleBuffered, isFocusCycleRoot, isFocusTraversable, isLightweightComponent, isManagingFocus, isMaximumSizeSet, isMinimumSizeSet, isOpaque, isOptimizedDrawingEnabled, isPaintingTile, isPreferredSizeSet, isRequestFocusEnabled, isValidateRoot, paint, paintBorder, paintChildren, paintComponent, paintImmediately, paintImmediately, print, printAll, printBorder, printChildren, printComponent, processComponentKeyEvent, processFocusEvent, processKeyBinding, processKeyEvent, processMouseMotionEvent, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeNotify, removePropertyChangeListener, removePropertyChangeListener, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, resetKeyboardActions, reshape, revalidate, scrollRectToVisible, setActionMap, setAlignmentX, setAlignmentY, setAutoscrolls, setBackground, setBorder, setDebugGraphicsOptions, setDoubleBuffered, setEnabled, setFont, setForeground, setInputMap, setInputVerifier, setMaximumSize, setMinimumSize, setNextFocusableComponent, setOpaque, setPreferredSize, setRequestFocusEnabled, setToolTipText, setUI, setVerifyInputWhenFocusTarget, setVisible, unregisterKeyboardAction, update
 
Methods inherited from class java.awt.Container
add, add, add, add, add, addContainerListener, addImpl, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getLayout, insets, invalidate, isAncestorOf, layout, list, list, locate, minimumSize, paintComponents, preferredSize, printComponents, processContainerEvent, processEvent, remove, remove, removeAll, removeContainerListener, setLayout, validate, validateTree
 
Methods inherited from class java.awt.Component
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, bounds, checkImage, checkImage, coalesceEvents, contains, createImage, createImage, disableEvents, dispatchEvent, enable, enableEvents, enableInputMethods, getBackground, getBounds, getColorModel, getComponentOrientation, getCursor, getDropTarget, getFont, getFontMetrics, getForeground, getGraphicsConfiguration, getInputContext, getInputMethodRequests, getLocale, getLocation, getLocationOnScreen, getName, getParent, getPeer, getSize, getToolkit, getTreeLock, gotFocus, handleEvent, imageUpdate, inside, isDisplayable, isEnabled, isLightweight, isShowing, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, postEvent, prepareImage, prepareImage, processComponentEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processMouseEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, repaint, repaint, repaint, resize, resize, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setLocale, setLocation, setLocation, setName, setSize, setSize, show, show, size, toString, transferFocus
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

CATEGORY_LOG

public static final MessageCategory CATEGORY_LOG
Pre-defined MessageCategory for log tab.

CATEGORY_DEBUG

public static final MessageCategory CATEGORY_DEBUG
Pre-defined MessageCategory for debug tab.

CATEGORY_ERROR

public static final MessageCategory CATEGORY_ERROR
Pre-defined MessageCategory for error tab.

CATEGORY_EXCEPTION

public static final MessageCategory CATEGORY_EXCEPTION
Pre-defined MessageCategory for exception tab.

CATEGORY_COMPILER

public static final MessageCategory CATEGORY_COMPILER
Pre-defined MessageCategory for compiler tab.

CATEGORY_TEST

public static final MessageCategory CATEGORY_TEST
Pre-defined MessageCategory for test tab.

ACTION_ExpandMessage

public static BrowserAction ACTION_ExpandMessage
Action to expand selected message in the MessageView.

ACTION_NextMessage

public static BrowserAction ACTION_NextMessage
Action to move to the next message in the MessageView.

ACTION_PriorMessage

public static BrowserAction ACTION_PriorMessage
Action to move to the previous message in the MessageView.

ACTION_TestMessageView

public static BrowserAction ACTION_TestMessageView
The action 'TestMessageView' tests the MessageView by alternately adding messages to two tabs, the Log and Debug tab. Item divisible by 3 have toolTipText. Items divisible by 5 have contextMenus. Items divisible by 7 have icons. This is just for testing purposes!

ACTION_TestMessageView1

public static BrowserAction ACTION_TestMessageView1
Test Action which generates messages for the test category.

ACTION_TestMessageView2

public static BrowserAction ACTION_TestMessageView2
Test Action which generates messages for the test category.

ACTION_TestMessageView3

public static BrowserAction ACTION_TestMessageView3
Test Action which generates messages for the test category.

ACTION_CopyContent

public UpdateAction ACTION_CopyContent
Action to copy all or selected portions of the MessageView content.
Method Detail

selectMessage

public void selectMessage(MessageCategory category,
                          Message message)
Select the identified message.
Parameters:
category - The category where the message is displayed.
message - The message to be selected.

addMessage

public Message addMessage(MessageCategory category,
                          Message parent,
                          Message message)
Adds a Message object as a child under the passed parent Message object on the specified tab. If the specified tab does not already exist in this MessageView, it will automatically be added. If the 'parent' parameter is null, or the parent message cannot be found on the specified tab in the MessageView, the passed message will be added as a root Message.
Parameters:
category - The message category to add the message to.
parent - The parent Message object to add this message as a child. If null, or if the specified parent cannot be found on the specified tab in the MessageView, the passed message will be added as a root.
message - The Message object to add to this MessageView.
Returns:
The same reference as in the 'message' parameter.

addMessage

public Message addMessage(MessageCategory category,
                          Message parent,
                          Message message,
                          boolean autoScroll)
Adds a Message object as a child under the passed parent Message object on the specified tab. If the specified tab does not already exist in this MessageView, it will automatically be added. If the 'parent' parameter is null, or the parent message cannot be found on the specified tab in the MessageView, the passed message will be added as a root Message.
Parameters:
category - The message category to add the message to.
parent - The parent Message object to add this message as a child. If null, or if the specified parent cannot be found on the specified tab in the MessageView, the passed message will be added as a root.
message - The Message object to add to this MessageView.
autoScroll - True if the messageView should automatically scroll to the new message
Returns:
The same reference as in the 'message' parameter.

addMessage

public Message addMessage(MessageCategory category,
                          Message message)
Adds a Message object to the specified tab in this MessageView. If the specified tab does not already exist in this MessageView, it will automatically be added.
Parameters:
category - The message category to add the message to.
message - The Message object to add to this MessageView.
Returns:
The same reference as in the 'message' parameter.

addMessage

public Message addMessage(MessageCategory category,
                          Message message,
                          boolean autoScroll)
Adds a Message object to the specified tab in this MessageView. If the specified tab does not already exist in this MessageView, it will automatically be added.
Parameters:
category - The message category to add the message to.
message - The Message object to add to this MessageView.
autoScroll - True if the messageView should automatically scroll to the new message
Returns:
The same reference as in the 'message' parameter.

addMessage

public Message addMessage(MessageCategory category,
                          java.lang.String text)
Adds a new Message object using the specified text to the specified tab in this MessageView. If the specified tab does not already exist in this MessageView, it will automatically be added.
Parameters:
category - The message category to add the message to.
text - The text to construct the Message object with that will be added to this MessageView.
Returns:
The constructed Message object that was added to this MessageView.

addMessage

public Message addMessage(MessageCategory category,
                          java.lang.String text,
                          javax.swing.Icon icon)
Adds a new Message object using the specified text and icon to the specified tab in this MessageView. If the specified tab does not already exist in this MessageView, it will automatically be added.
Parameters:
category - The message category to add the message to.
text - The text to construct the Message object with that will be added to this MessageView.
icon - The icon to construct the Message object with that will be added to this MessageView.
Returns:
The constructed Message object that was added to this MessageView.

addMessage

public Message addMessage(MessageCategory category,
                          java.lang.String text,
                          java.awt.event.ActionListener messageAction)
Adds a new Message object using the specified text and messageAction to the specified tab in this MessageView. If the specified tab does not already exist in this MessageView, it will automatically be added.
Parameters:
category - The message category to add the message to.
text - The text to construct the Message object with that will be added to this MessageView.
messageAction - The messageAction (ActionListener) to construct the Message object with that will be added to this MessageView.
Returns:
The constructed Message object that was added to this MessageView.

addMessage

public Message addMessage(MessageCategory category,
                          java.lang.String text,
                          javax.swing.Icon icon,
                          java.awt.event.ActionListener messageAction)
Adds a new Message object using the specified text, icon, and messageAction to the specified tab in this MessageView. If the specified tab does not already exist in this MessageView, it will automatically be added.
Parameters:
category - The message category to add the message to.
text - The text to construct the Message object with that will be added to this MessageView.
icon - The icon to construct the Message object with that will be added to this MessageView.
messageAction - The messageAction (ActionListener) to construct the Message object with that will be added to this MessageView.
Returns:
The constructed Message object that was added to this MessageView.

expandMessage

public void expandMessage(MessageCategory category,
                          Message parent)
Expands the given message treenode.
Parameters:
category - The message category containing the message to expand
parent - The message to expand

collapseMessage

public void collapseMessage(MessageCategory category,
                            Message parent)
Collapses the given message treenode.
Parameters:
category - The message category containing the message to collapse
parent - The message to collapse

removeMessage

public void removeMessage(MessageCategory category,
                          Message message)
Removes a Message object (and its children) from the passed category.
Parameters:
category - The message category containing the message to remove
message - The message to remove

removeChildren

public void removeChildren(MessageCategory category,
                           Message parent)
Removes a Message object's children in the passed category.
Parameters:
category - The message category containing the message to remove children from
parent - The message to strip of children

clearMessages

public void clearMessages(MessageCategory category)
Clears the Message objects from the passed category.
Parameters:
category - The message category to be cleared of Message objects.

addTab

public void addTab(MessageCategory category)
Adds a tab to this MessageView. If the specified tab already exists in this MessageView, this method is ignored. It is not necessary to add new tabs to the MessageView using this method. Any addMessage(...) call that specifies a previously non-existing tab will trigger the addition of a new tab.
Parameters:
tab - The message category to be added to this MessageView.

addCustomTab

public void addCustomTab(MessageCategory category,
                         javax.swing.JComponent component)
Adds a tab to this MessageView. If the specified tab already exists in this MessageView, this method is ignored.
Parameters:
category - The message category to be added to this MessageView.
component - The custom JComponent to display on the tab.

getTabCount

public int getTabCount()
Returns the count of tabs currently displayed in this MessageView.
Returns:
An int representing the total number of tabs currently displayed in this MessageView.

getTabs

public MessageCategory[] getTabs()
Returns a MessageCategory array representing the existing tabs in this MessageView.
Returns:
A MessageCategory array representing the existing tabs in this MessageView.

getActiveTab

public MessageCategory getActiveTab()
Returns the current MessageCategory in this MessageView.
Returns:
A MessageCategory representing the current tab in this MessageView.

removeTab

public void removeTab(MessageCategory category)
               throws VetoException
Removes the specified tab from the MessageView. If the tab does not exist on the MessageView, this method is ignored.
Parameters:
category - The message category representing the tab to remove from this MessageView.
Throws:
VetoException - Exception may be thrown if tab does not want to close.

showTab

public void showTab(MessageCategory category)
Shows (moves to front, or 'current') the specified tab in this MessageView. If the specified tab does not exist in this MessageView, it will be ADDED and set as the 'current' tab.
Parameters:
category - A message category defining a tab to display in this MessageView.

expandSelectedMessage

public void expandSelectedMessage()
Expands the message currently selected in the MessageView.

selectNextMessage

public void selectNextMessage()
Selects the next message in the MessageView.

selectPriorMessage

public void selectPriorMessage()
Selects the prior message in the MessageView.

updateUI

public void updateUI()
Override so that delegate the update to the proper component.
Overrides:
updateUI in class javax.swing.JPanel

getMinimumSize

public java.awt.Dimension getMinimumSize()
Overrides:
getMinimumSize in class javax.swing.JComponent

hasMessages

public boolean hasMessages(MessageCategory category)
Returns whether or not any messages in the given MessageCategory.
Parameters:
category - The category to be tested.
Returns:
True if any messages in 'category'.

addContextAction

public void addContextAction(MessageCategory category,
                             javax.swing.Action action)
Adds an action to the local context menu of this tab. This local context menu is displayed when the user right clicks on one of the message view tabs. It is up to the caller to insert dividers as needed between the menu items, and this function will accept a group of actions. Only add an action once to a category. Even if the tab of this category is cleared or removed, it still stays around. Tabs are only created once.
Parameters:
category - The category whose context menu should receive this action
action - The action or actiongroup that should be added to the context menu.