org.zaval.lw
Class LwWinLayer

java.lang.Object
  |
  +--org.zaval.util.ValidationObject
        |
        +--org.zaval.lw.LwCanvas
              |
              +--org.zaval.lw.LwPanel
                    |
                    +--org.zaval.lw.LwBaseLayer
                          |
                          +--org.zaval.lw.LwWinLayer
All Implemented Interfaces:
Drawable, 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.


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, height, insets, parent, psHeight, psWidth, skins, width, x, y
 
Fields inherited from class org.zaval.util.ValidationObject
isValidFlag
 
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.
 java.awt.Dimension calcPreferredSize(LayoutContainer target)
          Calculates the preferred size dimension for the layout container.
 void childPerformed(LwAWTEvent e)
          Invoked whenever an event has been performed.
 void componentAdded(java.lang.Object id, Layoutable lw, int index)
          Invoked when the specified layoutable component is added to the layout container (that uses the layout manager).
 void componentRemoved(Layoutable lw, int index)
          Invoked when the specified layoutable component is removed from the layout container, that uses the layout manager.
 LwComponent getActive()
           
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.
 void invalidate()
          Invalidates this object.
 boolean isActive()
          Gets the current window that has been activated.
 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.
 
Methods inherited from class org.zaval.lw.LwBaseLayer
getID, releaseFocus, setupFocus
 
Methods inherited from class org.zaval.lw.LwPanel
add, add, calcPreferredSize, count, get, getLayoutOffset, getLwLayout, indexOf, insert, insert, paintOnTop, recalc, remove, remove, removeAll, setBackground, setLwLayout, setOpaque, toFront, updateCashedPs
 
Methods inherited from class org.zaval.lw.LwCanvas
canHaveFocus, getBackground, getBounds, getHeight, getInsets, getLocation, getLwParent, getOrigin, getPreferredSize, getSize, getViewMan, getVisiblePart, getWidth, getX, getY, hasFocus, isEnabled, isOpaque, isVisible, paint, repaint, repaint, requestFocus, setEnabled, setInsets, setLocation, setLwParent, setPSSize, setSize, setViewMan, setVisible, toString, update, validate, viewManChanged, vrp
 
Methods inherited from class org.zaval.util.ValidationObject
isValid
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface org.zaval.lw.LwContainer
add, add, getLwLayout, indexOf, insert, paintOnTop, remove, removeAll, setLwLayout
 
Methods inherited from interface org.zaval.lw.LwComponent
canHaveFocus, getLwParent, getViewMan, getVisiblePart, setBackground, setEnabled, setLwParent, setViewMan, setVisible
 
Methods inherited from interface org.zaval.lw.Drawable
getBackground, getOrigin, isEnabled, isOpaque, paint, repaint, repaint, setOpaque, update
 
Methods inherited from interface org.zaval.util.Validationable
isValid, validate
 
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.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

childPerformed

public void childPerformed(LwAWTEvent e)
Description copied from interface: LwChildrenListener
Invoked whenever an 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 is 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 is 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 an insets of the container should not be considered.
Specified by:
calcPreferredSize in interface LwLayout
Following copied from interface: org.zaval.lw.LwLayout
Parameters:
target - the layout container.
Returns:
a "pure" preferred size.

invalidate

public void invalidate()
Description copied from interface: Validationable
Invalidates this object.
Overrides:
invalidate in class LwPanel

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 that needs to be laid out.

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()

isActive

public boolean isActive()
Gets the current window that has been activated.
Overrides:
isActive in class LwBaseLayer
Returns:
a current active window.

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 "layout.raster" key.
Overrides:
getDefaultLayout in class LwPanel
Following copied from class: org.zaval.lw.LwPanel
Returns:
a layout manager.


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