org.zaval.lw.gdp
Class DgnController
java.lang.Object
|
+--org.zaval.lw.gdp.Controller
|
+--org.zaval.lw.gdp.DgnController
- All Implemented Interfaces:
- java.util.EventListener, LwMouseListener
- public class DgnController
- extends Controller
- implements LwMouseListener
This is designer controller class to be used to control size and location for the
specified target component. The controller works as follow:
-
The controller registers itself as a mouse listener for the target
component.
-
Creates designer container. The designer container is a lightweight container
that is used to paint border around the target component.
-
Registers shape controller and uses the designer container as its target.
The shape controller allows you to control the container size and location
using mouse.
If a mouse button has been pressed on the target component, the controller
is activated. The process use-case is described below:
-
Checks if there is another designer controller that has been activated.
If it is true, the found active controller will be de-activated.
-
Initiates the designer container and adds the target component
as the container content.
-
Adds the designer container to the parent of the target component.
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(LwComponent target)
Constructs a new designer controller with the specified target component. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
DgnController
public DgnController(LwComponent target)
- Constructs a new designer controller with the specified target component.
- Parameters:
target - the specified target component.
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(LwMouseEvent e)
- Description copied from interface:
LwMouseListener
- Invoked when the mouse button has been released on a light weight component.
- Specified by:
mouseReleased in interface LwMouseListener
- Following copied from interface:
org.zaval.lw.event.LwMouseListener
- Parameters:
e - the specified mouse event.
mouseClicked
public void mouseClicked(LwMouseEvent e)
- Description copied from interface:
LwMouseListener
- Invoked when the mouse button has been clicked on a light weight component.
- Specified by:
mouseClicked in interface LwMouseListener
- Following copied from interface:
org.zaval.lw.event.LwMouseListener
- Parameters:
e - the specified mouse event.
mouseEntered
public void mouseEntered(LwMouseEvent e)
- Description copied from interface:
LwMouseListener
- Invoked when the mouse enters a light weight component.
- Specified by:
mouseEntered in interface LwMouseListener
- Following copied from interface:
org.zaval.lw.event.LwMouseListener
- Parameters:
e - the specified mouse event.
mouseExited
public void mouseExited(LwMouseEvent e)
- Description copied from interface:
LwMouseListener
- Invoked when the mouse exits a light weight component.
- Specified by:
mouseExited in interface LwMouseListener
- Following copied from interface:
org.zaval.lw.event.LwMouseListener
- Parameters:
e - the specified mouse event.
mousePressed
public void mousePressed(LwMouseEvent e)
- Description copied from interface:
LwMouseListener
- Invoked when the mouse button has been pressed on a light weight component.
- Specified by:
mousePressed in interface LwMouseListener
- Following copied from interface:
org.zaval.lw.event.LwMouseListener
- Parameters:
e - the specified mouse event.
moveTarget
public void moveTarget(int x,
int y)
- Moves the target component to the new location.
- Parameters:
x - the new x coordinate of the target component.y - the new y coordinate of the target component.
resizeTarget
public void resizeTarget(int w,
int h)
- Resizes the target component to have the specified width and height.
- Parameters:
w - the new width of the target component.h - the new height of the target component.
getDgnContainer
public LwContainer getDgnContainer()
- Gets the designer container that is used by the controller.
- Returns:
- a designer container.
stopCurrentDgn
public static void stopCurrentDgn()
- Deactivates current activated designer controller.
getCurrentDgn
public static DgnController getCurrentDgn()
- Returns current activated designer controller.
- Returns:
- an activated designer controller.
targetWasChanged
protected void targetWasChanged(LwComponent n,
LwComponent 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.
|