org.zaval.awt.gdp
Class DgnController


java.lang.Object

  |

  +--org.zaval.awt.gdp.Controller

        |

        +--org.zaval.awt.gdp.DgnController

All Implemented Interfaces:
java.util.EventListener, java.awt.event.MouseListener

public class DgnController
extends Controller
implements java.awt.event.MouseListener

This designer controller class that can be used to control size and location for the specified target component. The controller works as follow:

If a mouse button has been pressed on the target component than the controller tries to activate the controller. The process is described below:

Starting from the moment it is possible to resize and move the target component using the mouse.

Use addDgnControllerListener and removeDgnControllerListener methods to register or un-register DgnControllerListener. Using the interface it is possible to listen when the designer controller has been activated or deactivated.


Constructor Summary
DgnController(java.awt.Component target)
           Constructs a new designer controller with the specified target component.
 
Method Summary
 void addDgnControllerListener(DgnControllerListener l)
           Adds the specified designer controller listener.
static DgnController getCurrentDgn()
           Returns current active designer controller.
 java.awt.Container getDgnContainer()
           Gets the designer container that is used with the controller.
 void mouseClicked(java.awt.event.MouseEvent e)
           Invoked when the mouse has been clicked on a component.
 void mouseEntered(java.awt.event.MouseEvent e)
           Invoked when the mouse enters a component.
 void mouseExited(java.awt.event.MouseEvent e)
           Invoked when the mouse exits a component.
 void mousePressed(java.awt.event.MouseEvent e)
           Invoked when a mouse button has been pressed on a component.
 void mouseReleased(java.awt.event.MouseEvent e)
           Invoked when a mouse button has been released on a component.
 void moveTarget(int x, int y)
           Moves the target to the new loaction.
protected  void perform(int id)
           Performs the designer event with the specified event id.
 void removeDgnControllerListener(DgnControllerListener l)
           Removes the specified designer controller listener.
 void resizeTarget(int w, int h)
           Resizes the target to the specified width and height.
static void stopCurrentDgn()
           Deactivates current active designer controller, if it is exist.
protected  void targetWasChanged(java.awt.Component n, java.awt.Component o)
           The method is called whenever the target component has been changed.
 
Methods inherited from class org.zaval.awt.gdp.Controller
getTarget, setTarget
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DgnController


public DgnController(java.awt.Component target)
Constructs a new designer controller with the specified target component.
Parameters:
target - the specified target component.
Method Detail

addDgnControllerListener


public void addDgnControllerListener(DgnControllerListener l)
Adds the specified designer controller listener.
Parameters:
l - the specified designer controller listener.

removeDgnControllerListener


public void removeDgnControllerListener(DgnControllerListener l)
Removes the specified designer controller listener.
Parameters:
l - the specified designer controller listener.

perform


protected void perform(int id)
Performs the designer event with the specified event id.
Parameters:
id - the specified event id.

mouseReleased


public void mouseReleased(java.awt.event.MouseEvent e)
Invoked when a mouse button has been released on a component.
Specified by:
mouseReleased in interface java.awt.event.MouseListener

mouseClicked


public void mouseClicked(java.awt.event.MouseEvent e)
Invoked when the mouse has been clicked on a component.
Specified by:
mouseClicked in interface java.awt.event.MouseListener

mouseEntered


public void mouseEntered(java.awt.event.MouseEvent e)
Invoked when the mouse enters a component.
Specified by:
mouseEntered in interface java.awt.event.MouseListener

mouseExited


public void mouseExited(java.awt.event.MouseEvent e)
Invoked when the mouse exits a component.
Specified by:
mouseExited in interface java.awt.event.MouseListener

mousePressed


public void mousePressed(java.awt.event.MouseEvent e)
Invoked when a mouse button has been pressed on a component.
Specified by:
mousePressed in interface java.awt.event.MouseListener

moveTarget


public void moveTarget(int x,
                       int y)
Moves the target to the new loaction.
Parameters:
x - the new x coordinate of the target.
y - the new y coordinate of the target.

resizeTarget


public void resizeTarget(int w,
                         int h)
Resizes the target to the specified width and height.
Parameters:
w - the new x coordinate of the target.
h - the new y coordinate of the target.

getDgnContainer


public java.awt.Container getDgnContainer()
Gets the designer container that is used with the controller.
Returns:
designer container.

stopCurrentDgn


public static void stopCurrentDgn()
Deactivates current active designer controller, if it is exist.

getCurrentDgn


public static DgnController getCurrentDgn()
Returns current active designer controller.
Returns:
an active designer controller.

targetWasChanged


protected void targetWasChanged(java.awt.Component n,
                                java.awt.Component o)
The method is called whenever the target component has been changed. The method implementation removes mouse listener for the old target and registers the listener for the new target component.
Overrides:
targetWasChanged in class Controller
Parameters:
n - the specified new target component.
o - the specified old target component.


Copyright © Zaval Creative Engineering Group, 2000-2005
http://www.zaval.org