: Download: FAQ: Licensing: Support: Contact ME
LwVCL Home
Introduction
Overview
Screen Shots
On-line Demos
Requirements
Further Plans
Docs
Tutorial
How-to (PDF)
API
FAQ
Download
Latest version

Home > J2SE > API

Overview  Package   Class  Tree  Deprecated  Index  Help 

org.zaval.lw
Class LwWinLayer

java.lang.Object
  |
  +--org.zaval.lw.LwCanvas
        |
        +--org.zaval.lw.LwPanel
              |
              +--org.zaval.lw.LwBaseLayer
                    |
                    +--org.zaval.lw.LwWinLayer
All Implemented Interfaces:
Layoutable, LayoutContainer, LwChildrenListener, LwComponent, LwContainer, LwLayer, LwLayout, Validationable

public class LwWinLayer
extends LwBaseLayer
implements LwLayout, LwChildrenListener

This is housekeeping layer implementation that is used by LwRoot class as the internal windows container. To add an internal window you should use the layer like any other lightweight container. Pay attention that you can specify the window type by the layer container constraints. It is possible to show the following window types:

  • MODAL_WIN - modal window. The window blocks any input and interaction with any other components except the window components.
  • MDI_WIN - MDI window. The window allows user to interacts with any other components.
  • INFO_WIN - information window. The window is used just to show some information. and doesn't participate in any events handling. It is event opaque.
The sample below illustrates how to show a modal window:
    ...
    LwLayer  winLayer = LwToolkit.getLayer(LwWinLayer.ID);
    LwWindow win      = new LwWindow("Modal Window");
    win.setSize (200, 200);
    win.setLocation (20, 20);
    winLayer.add (LwWinLayer.MODAL_WIN, win);
    ...
 

Use the LwEventManager instance (you can get it by the LwToolkit.getEventManager() method) to register window events listener.


Field Summary
static java.lang.Object ID
          The layer id.
static java.lang.Integer INFO_WIN
          The information window type.
static java.lang.Integer MDI_WIN
          The MDI window type.
static java.lang.Integer MODAL_WIN
          The modal window type.
 
Fields inherited from class org.zaval.lw.LwPanel
children
 
Fields inherited from class org.zaval.lw.LwCanvas
bits, bottom, height, isValidValue, left, parent, psHeight, psWidth, right, skins, temporary, top, width, x, y
 
Constructor Summary
LwWinLayer()
          Constructs the layer.
 
Method Summary
 void activate(LwComponent c)
          Activates (deactivates) the specified window.
 void add(LwComponent c, LwWinListener l, java.lang.Integer type)
          Adds the new window with the specified window listener and the given window type.
 void addWinListener(LwWinListener l)
          Adds the specified window listener to receive window events.
 java.awt.Dimension calcPreferredSize(LayoutContainer target)
          Calculates the preferred size dimension for the layout container.
 void childPerformed(LwVCLEvent e)
          Invoked whenever the child event has been performed.
 void componentAdded(java.lang.Object id, Layoutable lw, int index)
          Invoked when the specified layoutable component was added to the layout container (that uses the layout manager).
 void componentRemoved(Layoutable lw, int index)
          Invoked when the specified layoutable component was removed from the layout container, that uses the layout manager.
 LwComponent getActive()
          Gets the current active window component.
protected  LwLayout getDefaultLayout()
          Gets the default layout manager that is set with the container during initialization.
 LwComponent getFocusRoot()
          Gets if the focus root component.
 LwComponent getLwComponentAt(int x, int y)
          Determines if the component or an immediate child component contains the (x, y) location in its visible part and if so, returns the component.
 boolean isActive()
          Tests if the layer is active.
 boolean isActiveAt(int x, int y)
          Tests if the layer is active at the specified location.
 void keyPressed(int keyCode, int mask)
          Invoked whenever a key has been pressed.
 void layout(LayoutContainer target)
          Lays out the child layoutable components inside the layout container.
 void mousePressed(int x, int y, int mask)
          Invoked whenever a mouse button has been pressed.
 void removeWinListener(LwWinListener l)
          Removes the specified window listener so it no longer receives window events.
 
Methods inherited from class org.zaval.lw.LwBaseLayer
activate, getID
 
Methods inherited from class org.zaval.lw.LwPanel
add, add, calcPreferredSize, count, get, getLayoutOffset, getLwLayout, getPreferredSize, indexOf, insert, insert, invalidate, isInvalidatedByChild, laidout, paintOnTop, remove, remove, removeAll, setBackground, setLwLayout, setOpaque, setSize, toFront, updateCashedPs, validate
 
Methods inherited from class org.zaval.lw.LwCanvas
calcInsets, canHaveFocus, customize, cvp, getBackground, getBottom, getBounds, getHeight, getInsets, getLeft, getLocation, getLwParent, getOrigin, getPSImpl, getRight, getSize, getTop, getViewMan, getVisiblePart, getWidth, getX, getY, hasFocus, isEnabled, isOpaque, isValid, isVisible, paint, recalc, repaint, repaint, repaint, requestFocus, setEnabled, setInsets, setLocation, setLwParent, setPSSize, setViewMan, setVisible, update, viewManChanged, vrp
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.zaval.lw.LwContainer
add, add, getLwLayout, indexOf, insert, isInvalidatedByChild, paintOnTop, remove, removeAll, setLwLayout
 
Methods inherited from interface org.zaval.lw.LwComponent
canHaveFocus, getBackground, getLwParent, getOrigin, getViewMan, getVisiblePart, isEnabled, isOpaque, paint, repaint, repaint, repaint, setBackground, setEnabled, setInsets, setLwParent, setOpaque, setViewMan, setVisible, update
 
Methods inherited from interface org.zaval.lw.Layoutable
getBounds, getHeight, getInsets, getLocation, getPreferredSize, getSize, getWidth, getX, getY, isVisible, setLocation, setSize
 
Methods inherited from interface org.zaval.util.Validationable
invalidate, isValid, validate
 
Methods inherited from interface org.zaval.lw.LayoutContainer
count, get, getLayoutOffset
 

Field Detail

ID

public static final java.lang.Object ID
The layer id.

MODAL_WIN

public static final java.lang.Integer MODAL_WIN
The modal window type.

MDI_WIN

public static final java.lang.Integer MDI_WIN
The MDI window type.

INFO_WIN

public static final java.lang.Integer INFO_WIN
The information window type.
Constructor Detail

LwWinLayer

public LwWinLayer()
Constructs the layer.
Method Detail

addWinListener

public void addWinListener(LwWinListener l)
Adds the specified window listener to receive window events.
Parameters:
l - the specified window listener.

removeWinListener

public void removeWinListener(LwWinListener l)
Removes the specified window listener so it no longer receives window events.
Parameters:
l - the specified window listener.

childPerformed

public void childPerformed(LwVCLEvent e)
Description copied from interface: LwChildrenListener
Invoked whenever the child event has been performed.
Specified by:
childPerformed in interface LwChildrenListener
Following copied from interface: org.zaval.lw.event.LwChildrenListener
Parameters:
e - the child event.

add

public void add(LwComponent c,
                LwWinListener l,
                java.lang.Integer type)
Adds the new window with the specified window listener and the given window type. The window listener can be null. If the window type is MODAL_WIN than the window will be activated automatically.
Parameters:
c - the specified window.
l - the specified window listner that wants to handle the window event.
type - the specified window type.

componentAdded

public void componentAdded(java.lang.Object id,
                           Layoutable lw,
                           int index)
Description copied from interface: LwLayout
Invoked when the specified layoutable component was added to the layout container (that uses the layout manager). The specified constraints, layoutable component and child index are passed as arguments into the method.
Specified by:
componentAdded in interface LwLayout
Following copied from interface: org.zaval.lw.LwLayout
Parameters:
id - the layoutable component constraints.
lw - the layoutable component that has been added.
index - the child index.

componentRemoved

public void componentRemoved(Layoutable lw,
                             int index)
Description copied from interface: LwLayout
Invoked when the specified layoutable component was removed from the layout container, that uses the layout manager.
Specified by:
componentRemoved in interface LwLayout
Following copied from interface: org.zaval.lw.LwLayout
Parameters:
lw - the layoutable component that has been removed.
index - the child component index.

getLwComponentAt

public LwComponent getLwComponentAt(int x,
                                    int y)
Description copied from interface: LwComponent
Determines if the component or an immediate child component contains the (x, y) location in its visible part and if so, returns the component.
Overrides:
getLwComponentAt in class LwPanel
Following copied from interface: org.zaval.lw.LwComponent
Parameters:
x - the x coordinate.
y - the y coordinate.
Returns:
the component or subcomponent that contains the (x, y) location; null if the location is outside this component.

calcPreferredSize

public java.awt.Dimension calcPreferredSize(LayoutContainer target)
Description copied from interface: LwLayout
Calculates the preferred size dimension for the layout container. The method has to calculate "pure" preferred size, it means that container insets should not be taken into account.
Specified by:
calcPreferredSize in interface LwLayout
Following copied from interface: org.zaval.lw.LwLayout
Parameters:
target - the layout container.
Returns:
a "pure" preferred size.

mousePressed

public void mousePressed(int x,
                         int y,
                         int mask)
Description copied from interface: LwLayer
Invoked whenever a mouse button has been pressed.
Overrides:
mousePressed in class LwBaseLayer
Following copied from interface: org.zaval.lw.LwLayer
Parameters:
x - the x coordinate of the mouse pointer.
y - the y coordinate of the mouse pointer.
mask - the mask that specifies mouse buttons states.

layout

public void layout(LayoutContainer target)
Description copied from interface: LwLayout
Lays out the child layoutable components inside the layout container.
Specified by:
layout in interface LwLayout
Following copied from interface: org.zaval.lw.LwLayout
Parameters:
target - the layout container.

activate

public void activate(LwComponent c)
Activates (deactivates) the specified window. If the specified window is null and the current active window is not null than the current active window will be deactivated. The method will perform IllegalArgumentException if the window is not MDI_WIN or has not been opened before.
Parameters:
c - the specified window to be activated.

keyPressed

public void keyPressed(int keyCode,
                       int mask)
Description copied from interface: LwLayer
Invoked whenever a key has been pressed.
Overrides:
keyPressed in class LwBaseLayer
Following copied from interface: org.zaval.lw.LwLayer
Parameters:
keyCode - the key code.
mask - the keyboard trigger keys states.

getActive

public LwComponent getActive()
Gets the current active window component.
Returns:
a current active window.

isActive

public boolean isActive()
Description copied from interface: LwLayer
Tests if the layer is active.
Overrides:
isActive in class LwBaseLayer
Following copied from interface: org.zaval.lw.LwLayer
Returns:
true if the layer is active.

isActiveAt

public boolean isActiveAt(int x,
                          int y)
Description copied from interface: LwLayer
Tests if the layer is active at the specified location. As rule the method is called when a mouse (pointer) event happened.
Overrides:
isActiveAt in class LwBaseLayer
Following copied from interface: org.zaval.lw.LwLayer
Parameters:
x - the x coordinate.
y - the y coordinate.
Returns:
true if the layer is active.

getFocusRoot

public LwComponent getFocusRoot()
Description copied from interface: LwLayer
Gets if the focus root component.
Overrides:
getFocusRoot in class LwBaseLayer
Following copied from interface: org.zaval.lw.LwLayer
Returns:
a focus root component.

getDefaultLayout

protected LwLayout getDefaultLayout()
Description copied from class: LwPanel
Gets the default layout manager that is set with the container during initialization. This implementation of the method returns LwRastLayout as the default layout manager, the layout manager is got as a static object by "def.lay" key.
Overrides:
getDefaultLayout in class LwPanel
Following copied from class: org.zaval.lw.LwPanel
Returns:
a layout manager.


: up