edu.mit.ai.psg.ui.outliner
Class OutlineMouseListener

java.lang.Object
  |
  +--java.awt.event.MouseAdapter
        |
        +--edu.mit.ai.psg.ui.outliner.OutlineMouseListener

public class OutlineMouseListener
extends MouseAdapter
implements MouseListener

OutlineMouseListener listens for and reacts to mouse events on an Outline.

Note: if MouseEvent.isPopupTrigger() isn't working on your platform, set eventIsPopupTriggerIsImplemented to false; then it will popup on any button besides simple button-1 press, or any modified (shift, alt, etc.) button.


Field Summary
static int dbgLev
          For debugging popup menu items: if dbgLev > 0, traces popup related events on System.err
 boolean eventIsPopupTriggerIsImplemented
          set this to false if MouseEvent.isPopupTrigger() isn't working
 
Constructor Summary
OutlineMouseListener(JTree jTree)
           
 
Method Summary
static void dbgOut(String s)
           
 boolean isPopupTrigger(MouseEvent event)
          true if event.isPopupTrigger() is true, or if event.isPopupTrigger() has never been true, then true if mouse press is modified (button 2 or 3, or pressed with shift, control, meta, or alt).
 void mouseClicked(MouseEvent event)
           
 void mousePressed(MouseEvent event)
           
 void mouseReleased(MouseEvent event)
           
 void popup(MouseEvent event)
          If triggered over a OutlineNode display, creates empty PopupMenu, calls OutlineRenderer.addPopupMenuTitle(java.awt.PopupMenu, edu.mit.ai.psg.ui.outliner.OutlineNode, javax.swing.tree.TreePath, javax.swing.JTree) and OutlineRenderer.addPopupMenuItems(java.awt.PopupMenu, edu.mit.ai.psg.ui.outliner.OutlineNode, javax.swing.tree.TreePath, javax.swing.JTree) to give it a title and component-specific menu items (otherwise, title is just outlineNode.toString()).
 
Methods inherited from class java.awt.event.MouseAdapter
mouseEntered, mouseExited
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

eventIsPopupTriggerIsImplemented

public boolean eventIsPopupTriggerIsImplemented
set this to false if MouseEvent.isPopupTrigger() isn't working

dbgLev

public static int dbgLev
For debugging popup menu items: if dbgLev > 0, traces popup related events on System.err
Constructor Detail

OutlineMouseListener

public OutlineMouseListener(JTree jTree)
Method Detail

mouseClicked

public void mouseClicked(MouseEvent event)
Specified by:
mouseClicked in interface MouseListener
Overrides:
mouseClicked in class MouseAdapter

mouseReleased

public void mouseReleased(MouseEvent event)
Specified by:
mouseReleased in interface MouseListener
Overrides:
mouseReleased in class MouseAdapter

mousePressed

public void mousePressed(MouseEvent event)
Specified by:
mousePressed in interface MouseListener
Overrides:
mousePressed in class MouseAdapter

isPopupTrigger

public boolean isPopupTrigger(MouseEvent event)
true if event.isPopupTrigger() is true, or if event.isPopupTrigger() has never been true, then true if mouse press is modified (button 2 or 3, or pressed with shift, control, meta, or alt). (MouseEvent.isPopupTrigger isn't been implemented correctly on some platforms)

popup

public void popup(MouseEvent event)
If triggered over a OutlineNode display, creates empty PopupMenu, calls OutlineRenderer.addPopupMenuTitle(java.awt.PopupMenu, edu.mit.ai.psg.ui.outliner.OutlineNode, javax.swing.tree.TreePath, javax.swing.JTree) and OutlineRenderer.addPopupMenuItems(java.awt.PopupMenu, edu.mit.ai.psg.ui.outliner.OutlineNode, javax.swing.tree.TreePath, javax.swing.JTree) to give it a title and component-specific menu items (otherwise, title is just outlineNode.toString()). Then calls OutlineMaker.addPopupMenuItems(java.awt.PopupMenu, edu.mit.ai.psg.ui.outliner.OutlineNode, javax.swing.tree.TreePath, javax.swing.JTree) on renderer's OutlineMaker to add system-specific menu items. Finally, pops up the menu.

dbgOut

public static void dbgOut(String s)

Copyright (c) 1996-1999
Massachusetts Institute of Technology

Feedback: jeva-feedback@ai.mit.edu