com.bluemarsh.jswat.panel
Class BreakPanel

java.lang.Object
  |
  +--com.bluemarsh.jswat.panel.JSwatPanel
        |
        +--com.bluemarsh.jswat.panel.BreakPanel
All Implemented Interfaces:
BreakpointListener, java.util.EventListener, GroupListener, SessionListener

public class BreakPanel
extends JSwatPanel
implements BreakpointListener, GroupListener

Class BreakPanel is responsible for displaying all known breakpoints in a tree structure. The root node of the tree is the "Default" breakpoint group, which may contain other groups and/or breakpoints.

It will keep itself up to date with changes in the breakpoints, by listening to the breakpoint manager.

Author:
Nathan Fiedler

Inner Class Summary
protected  class BreakPanel.BasicTreeNode
          Class BasicTreeNode is the base class for both breakpoint nodes and breakpoint group nodes.
protected  class BreakPanel.BreakpointNode
          Class BreakpointNode represents a breakpoint in the tree.
protected  class BreakPanel.GroupNode
          Class GroupNode represents a breakpoint group in the tree.
protected static interface BreakPanel.NodeProcessor
          Interface NodeProcessor defines methods necessary for a class that wishes to process nodes in a tree.
 
Field Summary
protected  Session owningSession
          Session that we are listening to.
protected  javax.swing.JComponent uiComponent
          Containing component object.
protected  javax.swing.JTree uiTree
          Tree representing the breakoint groups and breakpoints.
 
Fields inherited from class com.bluemarsh.jswat.panel.JSwatPanel
swat
 
Constructor Summary
BreakPanel()
          Constructs a BreakPanel.
 
Method Summary
 void activate(Session session)
          Called when the Session is about to begin an active debugging session.
 void breakpointAdded(BreakpointEvent e)
          Invoked when a breakpoint has been added.
 void breakpointModified(BreakpointEvent e)
          Invoked when a breakpoint has been modified.
 void breakpointRemoved(BreakpointEvent e)
          Invoked when a breakpoint has been removed.
protected  void buildGroupNode(BreakpointGroup brkgrp, javax.swing.tree.MutableTreeNode node)
          Fill in the given tree node with the breakpoint's contents.
protected  javax.swing.JComponent buildUI(javax.swing.JComponent tree)
          Build the interface components for this panel (buttons mostly).
 void close(Session session)
          Called when the Session is closing down this panel, generally just after the panel has been removed from the Session.
 void deactivate(Session session)
          Called when the Session is about to end an active debugging session.
protected  void deleteSelections()
          Deletes the currently selected breakpoints and groups.
protected  void disableSelections()
          Disables the currently selected breakpoints and groups.
protected  void editBreakpoint(Breakpoint bp)
          Show the given breakpoint's properties.
protected  void enableSelections()
          Enables the currently selected breakpoints and groups.
 Breakpoint getSelectedBreakpoint()
          Returns the first currently selected breakpoint in the panel, if any.
 javax.swing.JComponent getUI()
          Returns a reference to the UI component.
 void groupAdded(GroupEvent event)
          Invoked when a group has been added.
 void groupDisabled(GroupEvent event)
          Invoked when a group has been disabled.
 void groupEnabled(GroupEvent event)
          Invoked when a group has been enabled.
 void groupRemoved(GroupEvent event)
          Invoked when a group has been removed.
 void init(Session session)
          Called when the Session is ready to initialize this panel, generally just after the panel has been added to the Session.
protected  void processSelections(BreakPanel.NodeProcessor processor)
          Perform some action on the set of selected breakpoints and breakpoint groups.
 void refresh(Session session)
          Update the display on the screen.
protected  void showSource()
          Show the source code for the first selected breakpoint, if the breakpoint is indeed locatable.
 
Methods inherited from class com.bluemarsh.jswat.panel.JSwatPanel
getParentWindow
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

uiTree

protected javax.swing.JTree uiTree
Tree representing the breakoint groups and breakpoints.

uiComponent

protected javax.swing.JComponent uiComponent
Containing component object.

owningSession

protected Session owningSession
Session that we are listening to.
Constructor Detail

BreakPanel

public BreakPanel()
Constructs a BreakPanel.
Method Detail

activate

public void activate(Session session)
Called when the Session is about to begin an active debugging session. That is, JSwat is about to debug a debuggee VM. Panels are not activated in any particular order.
Overrides:
activate in class JSwatPanel
Parameters:
session - Session being activated.

breakpointAdded

public void breakpointAdded(BreakpointEvent e)
Invoked when a breakpoint has been added.
Specified by:
breakpointAdded in interface BreakpointListener
Parameters:
e - breakpoint change event

breakpointModified

public void breakpointModified(BreakpointEvent e)
Invoked when a breakpoint has been modified.
Specified by:
breakpointModified in interface BreakpointListener
Parameters:
e - breakpoint change event

breakpointRemoved

public void breakpointRemoved(BreakpointEvent e)
Invoked when a breakpoint has been removed.
Specified by:
breakpointRemoved in interface BreakpointListener
Parameters:
e - breakpoint change event

buildUI

protected javax.swing.JComponent buildUI(javax.swing.JComponent tree)
Build the interface components for this panel (buttons mostly).
Parameters:
tree - breakpoints tree component.
Returns:
new containing component for all of the ui.

buildGroupNode

protected void buildGroupNode(BreakpointGroup brkgrp,
                              javax.swing.tree.MutableTreeNode node)
Fill in the given tree node with the breakpoint's contents.
Parameters:
brkpgrp - breakpoint group to build out.
node - tree node to fill in.

close

public void close(Session session)
Called when the Session is closing down this panel, generally just after the panel has been removed from the Session.
Overrides:
close in class JSwatPanel
Parameters:
session - Session closing the panel.

deactivate

public void deactivate(Session session)
Called when the Session is about to end an active debugging session. That is, JSwat is about to terminate the connection with the debuggee VM. Panels are not deactivated in any particular order.
Overrides:
deactivate in class JSwatPanel
Parameters:
session - Session being deactivated.

deleteSelections

protected void deleteSelections()
Deletes the currently selected breakpoints and groups. The selection is based on the nodes selected in the tree.

disableSelections

protected void disableSelections()
Disables the currently selected breakpoints and groups. The selection is based on the nodes selected in the tree.

editBreakpoint

protected void editBreakpoint(Breakpoint bp)
Show the given breakpoint's properties.
Parameters:
bp - breakpoint to edit.

enableSelections

protected void enableSelections()
Enables the currently selected breakpoints and groups. The selection is based on the nodes selected in the tree.

getSelectedBreakpoint

public Breakpoint getSelectedBreakpoint()
Returns the first currently selected breakpoint in the panel, if any.
Returns:
first selected breakpoint, or null if none selected.

getUI

public javax.swing.JComponent getUI()
Returns a reference to the UI component. This is the object that is placed within the program user interface. It wraps the peer component inside a scrollable view.
Overrides:
getUI in class JSwatPanel
Returns:
ui component object

groupAdded

public void groupAdded(GroupEvent event)
Invoked when a group has been added.
Specified by:
groupAdded in interface GroupListener
Parameters:
event - group change event

groupDisabled

public void groupDisabled(GroupEvent event)
Invoked when a group has been disabled.
Specified by:
groupDisabled in interface GroupListener
Parameters:
event - group change event

groupEnabled

public void groupEnabled(GroupEvent event)
Invoked when a group has been enabled.
Specified by:
groupEnabled in interface GroupListener
Parameters:
event - group change event

groupRemoved

public void groupRemoved(GroupEvent event)
Invoked when a group has been removed.
Specified by:
groupRemoved in interface GroupListener
Parameters:
event - group change event

init

public void init(Session session)
Called when the Session is ready to initialize this panel, generally just after the panel has been added to the Session.
Overrides:
init in class JSwatPanel
Parameters:
session - Session initializing this panel.

processSelections

protected void processSelections(BreakPanel.NodeProcessor processor)
Perform some action on the set of selected breakpoints and breakpoint groups.
Parameters:
processor - node processor.

refresh

public void refresh(Session session)
Update the display on the screen. Use the given Session to fetch the desired data.
Overrides:
refresh in class JSwatPanel
Parameters:
session - debugging Session object.

showSource

protected void showSource()
Show the source code for the first selected breakpoint, if the breakpoint is indeed locatable.