: Download: FAQ: Licensing: Support: Contact ME
LwVCL Home
Introduction
Overview
On-line Demo
Further Plans
Docs
API
FAQ
Download
Latest version

Home > GDP > API

Overview  Package   Class  Tree  Deprecated  Index  Help 

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.


Fields inherited from class org.zaval.lw.gdp.Controller
target
 
Constructor Summary
DgnController(LwComponent 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 activated designer controller.
 LwContainer getDgnContainer()
          Gets the designer container that is used by the controller.
 void mouseClicked(LwMouseEvent e)
           
 void mouseEntered(LwMouseEvent e)
           
 void mouseExited(LwMouseEvent e)
           
 void mousePressed(LwMouseEvent e)
           
 void mouseReleased(LwMouseEvent e)
           
 void moveTarget(int x, int y)
          Moves the target component to the new location.
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 component to have the specified width and height.
static void stopCurrentDgn()
          Deactivates current activated designer controller.
protected  void targetWasChanged(LwComponent n, LwComponent o)
          The method is called whenever the target component has been changed.
 
Methods inherited from class org.zaval.lw.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(LwComponent 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(LwMouseEvent e)
Specified by:
mouseReleased in interface LwMouseListener

mouseClicked

public void mouseClicked(LwMouseEvent e)
Specified by:
mouseClicked in interface LwMouseListener

mouseEntered

public void mouseEntered(LwMouseEvent e)
Specified by:
mouseEntered in interface LwMouseListener

mouseExited

public void mouseExited(LwMouseEvent e)
Specified by:
mouseExited in interface LwMouseListener

mousePressed

public void mousePressed(LwMouseEvent e)
Specified by:
mousePressed in interface LwMouseListener

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.


: up