OpenFlow GUI Extension - User Interaction

From OpenFlow Wiki

Jump to: navigation, search

Contents

Handling User Input (Mouse)

An object can request to be notified of user interactions via the mouse and keyboards by registering for a callback with PZManager and implementing the DrawableEventListener interface. Thus whenever an event occurs, the method void drawableEvent(Drawable d, String event) is called. d indicates which object was clicked while event is some identifier which describes the event. The default identifiers include:

  • mouse_released - fired when the user has clicked on some Drawable.
  • Other hooks will be added later.

When an object is dragged, its drag() method is called. This method could be overridden on Drawables in order to provide custom handling for drag events.


Handling User Input (Keyboard)

The PZWindow class registers the Swing event listeners. If you wish to add new keyboard shortcuts, you currently must add a hook in that class.


Default Responses to User Input

Window Closing

If the window is closed, then the PZManager will issue a callback pzClosing(PZManager) to all listeners which registered with the method addClosingListener(PZClosing).

Window Resizing

If the window is resized, then the PZManager receives a callback on the method windowResized(PZWindow window). By default, this will modify the area used by the topology to fit in the new window size. If PZLayoutManager is being used, then this will also trigger the layout to be redone.

Keyboard Shortcuts

Shortcut Effect
Dragmove a node
Arrow Keys pan the topology view
Alt + Arrow Keys
Mouse Wheel
zoom in/out
Page Up take a screenshot (saved to the GUI folder)
Escape exit
V reset the view to the default