Extension SDK 10.1.2

oracle.ide.log
Class DefaultLogPage

java.lang.Object
  extended byoracle.ide.addin.AbstractView
      extended byoracle.ide.log.AbstractLogPage
          extended byoracle.ide.log.DefaultLogPage
All Implemented Interfaces:
ControllerProvider, Helpable, LogPage, View
Direct Known Subclasses:
CompilerPage, UIEditorLogPage

public class DefaultLogPage
extends AbstractLogPage

This implementation of LogPage supports the logging of simple text messages as well as Collection message objects. When logging a simple text message, it is written to a JTextArea displayed within a JScrollPane. When logging a message which is a Collection, each element within the Collection is displayed as a node within a JTree which itself is displayed within a JScrollPane. No assumptions are made with respect to implementation of the TreeModel interface set as model for the JTree. Subclasses may easily extend this class to display any TreeModel implementation within the JTree or to support any additional GUI displays over and above the JTextArea and JTree defined at this class level.


Field Summary
protected static int FIX_SOURCE_CMD_ID
           
protected static int GOTO_SOURCE_CMD_ID
          Go To Source command identifier.
static int HIDE_ALL_MENUS
           
static int HIDE_COPY_MENU
           
static int HIDE_FIX_SOURCE_MENU
           
static int HIDE_GOTO_SOURCE_MENU
           
static int HIDE_NO_MENUS
          Use these constants to indicate which popup menu items are hidden.
static int HIDE_SAVE_AS_MENU
           
protected  java.awt.event.KeyAdapter keyAdapter
           
protected  java.awt.event.MouseAdapter mouseAdapter
           
protected static java.lang.String PAGE_ID
           
 
Fields inherited from class oracle.ide.addin.AbstractView
owner, SEPARATOR, viewListeners, viewSelectionListeners
 
Fields inherited from interface oracle.ide.addin.View
PROJECT_PROP, VISIBLE_PROP, WORKSPACE_PROP
 
Constructor Summary
protected DefaultLogPage(ViewId id, javax.swing.Icon icon, boolean addPage)
           
protected DefaultLogPage(ViewId id, javax.swing.Icon icon, boolean addPage, int menuOptions)
          Constructor.
 
Method Summary
protected  void activateObject(java.lang.Object obj)
          Respond to a message object activation originating from the GUI.
 void addKeyListener(java.awt.event.KeyListener listener)
          Add a KeyListener to the GUI.
 void addMouseListener(java.awt.event.MouseListener listener)
          Add a MouseListener to the GUI.
protected  boolean canFixObject(javax.swing.tree.DefaultMutableTreeNode node)
          Return true if the violation associated with the node can be fixed.
 void clearAll()
          Remove all messages from the GUI.
protected  void copy(java.lang.Object treeNode)
          Copy the contents of the object to the clipboard.
protected  void fixObject(java.lang.Object obj)
          Respond to a the fix command originating from the GUI.
 ContextMenu getContextMenu()
          Gets the ContextMenu object, if any, managed by this instance.
 Controller getController()
          Get the Controller associated with this view.
protected  java.awt.Component getCurrentView()
          Get the object currently being displayed within the JScrollPane.
 java.awt.Component getGUI()
          Get the GUI to be used to display the state of this page.
protected  javax.swing.tree.DefaultMutableTreeNode getSelectedTreeNode()
           
protected  javax.swing.JTextArea getTextArea()
          Get the JTextArea used for display.
 java.lang.String getTitleName()
          Get the title to be displayed in the log window hosting this page.
protected  javax.swing.JTree getTree()
          Get the JTree used for display.
protected  void logMsg(java.lang.Object msg)
          Display a message in the GUI.
protected  void logText(java.lang.String msg)
          Display a String message in the GUI.
 void removeKeyListener(java.awt.event.KeyListener listener)
          Remove a KeyListener from the GUI.
 void removeMouseListener(java.awt.event.MouseListener listener)
          Remove a MouseListener from the GUI.
protected  void saveToFile(Context context)
           
protected  void setCurrentView(java.awt.Component view)
          Set the object to be currently displayed within the JScrollPane.
protected  void setModel(javax.swing.tree.TreeModel model)
          Set the tree model.
protected  void updateTreeModel(java.util.Collection message)
          Update the model of the JTree based on the new Collection message object.
 
Methods inherited from class oracle.ide.log.AbstractLogPage
checkCommands, close, getContext, getTabIcon, getTabName, getToolTip, isVisible, log, requestShow, setOwner, show
 
Methods inherited from class oracle.ide.addin.AbstractView
activate, addViewListener, addViewSelectionListener, deactivate, fireViewActivated, fireViewClosed, fireViewDeactivated, fireViewSelectionChanged, getContext, getHelpInfo, getId, getSelection, getToolbar, loadToolbar, loadToolbar, newId, owner, removeViewListener, removeViewSelectionListener, setId, setOwner, setToolbarVisible, updateTitle, updateToolbarActions, updateVisibleActions, updateVisibleActions
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface oracle.ide.addin.View
activate, addViewListener, addViewSelectionListener, deactivate, getContext, getId, getSelection, getToolbar, owner, removeViewListener, removeViewSelectionListener, setToolbarVisible, updateTitle, updateVisibleActions
 
Methods inherited from interface oracle.ide.help.Helpable
getHelpInfo
 

Field Detail

HIDE_NO_MENUS

public static int HIDE_NO_MENUS
Use these constants to indicate which popup menu items are hidden.


HIDE_COPY_MENU

public static int HIDE_COPY_MENU

HIDE_SAVE_AS_MENU

public static int HIDE_SAVE_AS_MENU

HIDE_GOTO_SOURCE_MENU

public static int HIDE_GOTO_SOURCE_MENU

HIDE_FIX_SOURCE_MENU

public static int HIDE_FIX_SOURCE_MENU

HIDE_ALL_MENUS

public static int HIDE_ALL_MENUS

GOTO_SOURCE_CMD_ID

protected static final int GOTO_SOURCE_CMD_ID
Go To Source command identifier.


FIX_SOURCE_CMD_ID

protected static final int FIX_SOURCE_CMD_ID

PAGE_ID

protected static final java.lang.String PAGE_ID
See Also:
Constant Field Values

mouseAdapter

protected java.awt.event.MouseAdapter mouseAdapter

keyAdapter

protected java.awt.event.KeyAdapter keyAdapter
Constructor Detail

DefaultLogPage

protected DefaultLogPage(ViewId id,
                         javax.swing.Icon icon,
                         boolean addPage,
                         int menuOptions)
Constructor. Initializes the JTextArea and the JTree. The JTree is set to single selection and its display root node is set to false. A default MouseAdapter and KeyAdapter are added as listeners which calls the activateObject method whenever the user double clicks or type enter on a TreeNode in the JTree. Use the menuOptions parameter to indicate which popup menu items should be hidded. By default only the Fix Source menu item is not available.

See Also:
activateObject(java.lang.Object)

DefaultLogPage

protected DefaultLogPage(ViewId id,
                         javax.swing.Icon icon,
                         boolean addPage)
Method Detail

setModel

protected void setModel(javax.swing.tree.TreeModel model)
Set the tree model. This method should be called after the tree has been created.


getTitleName

public java.lang.String getTitleName()
Description copied from interface: LogPage
Get the title to be displayed in the log window hosting this page.

Specified by:
getTitleName in interface LogPage
Overrides:
getTitleName in class AbstractLogPage

getGUI

public java.awt.Component getGUI()
Get the GUI to be used to display the state of this page.


getSelectedTreeNode

protected javax.swing.tree.DefaultMutableTreeNode getSelectedTreeNode()

copy

protected void copy(java.lang.Object treeNode)
Copy the contents of the object to the clipboard.


saveToFile

protected void saveToFile(Context context)

getController

public Controller getController()
Description copied from interface: ControllerProvider
Get the Controller associated with this view.

Specified by:
getController in interface ControllerProvider
Overrides:
getController in class AbstractLogPage

getContextMenu

public ContextMenu getContextMenu()
Gets the ContextMenu object, if any, managed by this instance.

Specified by:
getContextMenu in interface View
Overrides:
getContextMenu in class AbstractView
Returns:
the ContextMenu, if any.

clearAll

public void clearAll()
Remove all messages from the GUI.

Specified by:
clearAll in interface LogPage
Overrides:
clearAll in class AbstractLogPage

addMouseListener

public void addMouseListener(java.awt.event.MouseListener listener)
Add a MouseListener to the GUI.

Specified by:
addMouseListener in interface LogPage
Overrides:
addMouseListener in class AbstractLogPage

removeMouseListener

public void removeMouseListener(java.awt.event.MouseListener listener)
Remove a MouseListener from the GUI.

Specified by:
removeMouseListener in interface LogPage
Overrides:
removeMouseListener in class AbstractLogPage

addKeyListener

public void addKeyListener(java.awt.event.KeyListener listener)
Add a KeyListener to the GUI.


removeKeyListener

public void removeKeyListener(java.awt.event.KeyListener listener)
Remove a KeyListener from the GUI.


logMsg

protected void logMsg(java.lang.Object msg)
Display a message in the GUI. If the message provided is a Collection, the JTree will be set as the current view and updateTreeModel will be called to allow the setting of a new TreeModel. Otherwise, logText will be called with the result of the message's toString() method.

Overrides:
logMsg in class AbstractLogPage
Parameters:
msg - the message to display.
See Also:
updateTreeModel(java.util.Collection), logText(java.lang.String)

logText

protected void logText(java.lang.String msg)
Display a String message in the GUI. The JTextArea will be set as the current view and the message provided will be appended to it.


getCurrentView

protected final java.awt.Component getCurrentView()
Get the object currently being displayed within the JScrollPane.


setCurrentView

protected final void setCurrentView(java.awt.Component view)
Set the object to be currently displayed within the JScrollPane.


getTree

protected final javax.swing.JTree getTree()
Get the JTree used for display.


getTextArea

protected final javax.swing.JTextArea getTextArea()
Get the JTextArea used for display.


activateObject

protected void activateObject(java.lang.Object obj)
Respond to a message object activation originating from the GUI. Default implementation does nothing.


fixObject

protected void fixObject(java.lang.Object obj)
Respond to a the fix command originating from the GUI. Default implementation does nothing.


canFixObject

protected boolean canFixObject(javax.swing.tree.DefaultMutableTreeNode node)
Return true if the violation associated with the node can be fixed. Default return value is false.


updateTreeModel

protected void updateTreeModel(java.util.Collection message)
Update the model of the JTree based on the new Collection message object. Default implementation creates and invokes a Runnable to construct a new DefaultTreeModel containing DefaultMutableTreeNode instances for each element in the Collection where the Collection element is set as the user data of the DefaultMutableTreeNode instance.


Extension SDK

 

Copyright © 1997, 2004, Oracle. All rights reserved.