: 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 LwWinProducer

java.lang.Object
  |
  +--org.zaval.lw.LwWinProducer
All Implemented Interfaces:
java.util.EventListener, LwActionListener, Switchable
Direct Known Subclasses:
LwBWinProducer

public abstract class LwWinProducer
extends java.lang.Object
implements Switchable, LwActionListener

This is abstract class that is supposed to be used for a window (LwWindow) component customization. To create a window producer you should go through the following steps:

  • Specify the window caption component by overriding the createCaption method.
  • Specify the window status bar component by overriding the createStatus method.
  • Specify the window root container by overriding the createRoot method. The root container is used by the window component to add any other component.
  • Provide ability to customize the icon, close button and sizing components by the setElement method.
  • Listen whenever the target window has been activated or deactivated by overriding the switched method.
  • Handle the window elements re-setting by overriding the addElement method.
  • Specify how to fetch the given element by overriding the fetchElement method.
  • Implement the setTitle and getTitle abstract method to manipulate the caption text.

The window component uses the border layout to place its elements. The caption component is added using the "north" constraint, the "south" constraint is used for the status bar component and the "center" constraint is used to place the root container.


Field Summary
static int CLOSE_BUTTON_EL
          The close button window element id.
static int ICON_EL
          The icon window element id.
static int SIZING_EL
          The sizing window element id.
 
Constructor Summary
LwWinProducer()
          Constructs the window producer.
 
Method Summary
 void actionPerformed(java.lang.Object src, java.lang.Object data)
          Invoked when an action event occurred.
protected  void addElement(int type, LwComponent el)
          Invoked to add the specified window element.
protected  LwContainer createCaption()
          Creates and returns the caption component.
protected  LwContainer createRoot()
          Creates and returns the root container.
protected  LwContainer createStatus()
          Creates and returns the status bar component.
protected  LwComponent fetchElement(int type)
           
 LwContainer getCaptionComp()
          Gets the caption component that should be used for the window.
 LwComponent getElement(int type)
          Gets the specified window element.
 int[] getElementTypes()
           
 LwContainer getRoot()
          Gets the root container that should be used for the window.
 LwContainer getStatusComp()
          Gets the status bar component that should be used for the window.
 LwComponent getTargetWin()
          Gets the target window.
abstract  java.lang.String getTitle()
          Gets the window title.
 void setElement(int type, LwComponent c)
          Sets the specified window element.
abstract  void setTitle(java.lang.String s)
          Sets the specified window title.
 void switched(boolean b)
          Invoked when the state of a switching component has been changed.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

ICON_EL

public static final int ICON_EL
The icon window element id.

CLOSE_BUTTON_EL

public static final int CLOSE_BUTTON_EL
The close button window element id.

SIZING_EL

public static final int SIZING_EL
The sizing window element id.
Constructor Detail

LwWinProducer

public LwWinProducer()
Constructs the window producer.
Method Detail

getTargetWin

public LwComponent getTargetWin()
Gets the target window. The target window is a window that uses the producer to customize its view.
Returns:
a target window.

getCaptionComp

public LwContainer getCaptionComp()
Gets the caption component that should be used for the window.
Returns:
a caption component.

getRoot

public LwContainer getRoot()
Gets the root container that should be used for the window.
Returns:
a root container.

getStatusComp

public LwContainer getStatusComp()
Gets the status bar component that should be used for the window.
Returns:
a status bar component.

getElement

public LwComponent getElement(int type)
Gets the specified window element. Use one of the following constants to define the element type:
  • CLOSE_BUTTON_EL - to get a component that is used as the close button.
  • SIZING_EL - to get a component that is used as the sizing element.
  • ICON_EL - to get a component that is used as the icon.
Parameters:
type - the specified element type.
Returns:
a window element.

setElement

public void setElement(int type,
                       LwComponent c)
Sets the specified window element. Use one of the following constants to define the element type:
  • CLOSE_BUTTON_EL - to get a component that is used as the close button.
  • SIZING_EL - to get a component that is used as the sizing element.
  • ICON_EL - to get a component that is used as the icon.
Parameters:
type - the specified element type.
c - the specified component to be used as the element. Use null value to remove the element.

actionPerformed

public void actionPerformed(java.lang.Object src,
                            java.lang.Object data)
Description copied from interface: LwActionListener
Invoked when an action event occurred.
Specified by:
actionPerformed in interface LwActionListener
Following copied from interface: org.zaval.lw.event.LwActionListener
Parameters:
src - the specified source where the event has been originated.
data - the event data.

getElementTypes

public int[] getElementTypes()

createStatus

protected LwContainer createStatus()
Creates and returns the status bar component. The method is executed one time during the window producer initialization. You should override the method to create own status bar component.
Returns:
a status bar component.

createRoot

protected LwContainer createRoot()
Creates and returns the root container. The method is executed one time during the window producer initialization. You should override the method to create own root container.
Returns:
a root container.

createCaption

protected LwContainer createCaption()
Creates and returns the caption component. The method is executed one time during the window producer initialization. You should override the method to create own caption component.
Returns:
a caption component.

addElement

protected void addElement(int type,
                          LwComponent el)
Invoked to add the specified window element. The method defines how and where the element should be added.
Parameters:
type - the specified element type.
el - the specified element component.

fetchElement

protected LwComponent fetchElement(int type)

switched

public void switched(boolean b)
Description copied from interface: Switchable
Invoked when the state of a switching component has been changed.
Specified by:
switched in interface Switchable
Following copied from interface: org.zaval.lw.Switchable
Parameters:
state - the component state. true if the component has "on" state and false if the component has "off" state.

getTitle

public abstract java.lang.String getTitle()
Gets the window title. The method defines the way how the window title should be fetched.
Returns:
a window title.

setTitle

public abstract void setTitle(java.lang.String s)
Sets the specified window title. The method "knows" how and where the specified title should be applied.
Parameters:
s - the specified title.


: up