TsBiff 1.3


ts.ui
Class WindowManager

java.lang.Object
  |
  +--ts.ui.WindowManager
All Implemented Interfaces:
java.util.EventListener, java.awt.event.MouseListener, java.awt.event.MouseMotionListener

public final class WindowManager
extends java.lang.Object
implements java.awt.event.MouseListener, java.awt.event.MouseMotionListener

A window manager singelton, that can handle any number of Windows. This manager handles window move and resize only. A window resize is conducted iff the mouse cursor is over the resize hotspot. This hotspot is always placed in the lower right corner by the manager, for every window it handles. A window move is conducted iff the mouse is pressed in the window, and then dragged (except in the hotspot area, of course). Be sure to leave some space in the window for the window itself, i.e. don't fill the window with components that grab mouse events.

The Windows managed by this class, should use lightweight components, at least in the area of the hotspot. If not, the peer component (e.g. a Panel) could grab the mouse event.

Version:
$Id: WindowManager.java,v 1.1 2001/08/13 12:04:15 hauk Exp $
Author:
Jan-Henrik Haukeland <hauk@tildeslash.com>

Field Summary
static int[] RESIZE_SPOT
          Window hotspot width and height.
 
Method Summary
static void deregister(java.awt.Window w)
          Remove listeners for a Window.
static WindowManager getInstance()
          Returns the instance of the window manager singleton.
 void mouseClicked(java.awt.event.MouseEvent e)
          Left empty.
 void mouseDragged(java.awt.event.MouseEvent e)
          Resize or reposition the window to a new size or a new location based on the difference between trackPoint and the current mouse coordinates.
 void mouseEntered(java.awt.event.MouseEvent e)
          Left empty.
 void mouseExited(java.awt.event.MouseEvent e)
          Left empty.
 void mouseMoved(java.awt.event.MouseEvent e)
          Change the mouse cursor if it's over a resize hotspot
 void mousePressed(java.awt.event.MouseEvent e)
          Sets trackPoint if the left mouse button was pressed.
 void mouseReleased(java.awt.event.MouseEvent e)
          Notify the layout manager in case we did a resize.
static void register(java.awt.Window w)
          Register listeners for a window.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

RESIZE_SPOT

public static final int[] RESIZE_SPOT
Window hotspot width and height. The spot is located in the South East corner of the window
Method Detail

getInstance

public static WindowManager getInstance()
Returns the instance of the window manager singleton.

register

public static void register(java.awt.Window w)
Register listeners for a window.
Parameters:
w - Window to register for.

deregister

public static void deregister(java.awt.Window w)
Remove listeners for a Window.
Parameters:
w - Window to deregister for.

mousePressed

public void mousePressed(java.awt.event.MouseEvent e)
Sets trackPoint if the left mouse button was pressed.
Specified by:
mousePressed in interface java.awt.event.MouseListener
Parameters:
e - The mouse event.

mouseDragged

public void mouseDragged(java.awt.event.MouseEvent e)
Resize or reposition the window to a new size or a new location based on the difference between trackPoint and the current mouse coordinates. Updates trackPoint to the new coordinates.
Specified by:
mouseDragged in interface java.awt.event.MouseMotionListener

mouseReleased

public void mouseReleased(java.awt.event.MouseEvent e)
Notify the layout manager in case we did a resize.
Specified by:
mouseReleased in interface java.awt.event.MouseListener

mouseMoved

public void mouseMoved(java.awt.event.MouseEvent e)
Change the mouse cursor if it's over a resize hotspot
Specified by:
mouseMoved in interface java.awt.event.MouseMotionListener

mouseClicked

public void mouseClicked(java.awt.event.MouseEvent e)
Left empty.
Specified by:
mouseClicked in interface java.awt.event.MouseListener

mouseEntered

public void mouseEntered(java.awt.event.MouseEvent e)
Left empty.
Specified by:
mouseEntered in interface java.awt.event.MouseListener

mouseExited

public void mouseExited(java.awt.event.MouseEvent e)
Left empty.
Specified by:
mouseExited in interface java.awt.event.MouseListener

TsBiff 1.3