org.zaval.lw
Class LwCombo

java.lang.Object
  |
  +--org.zaval.util.ValidationObject
        |
        +--org.zaval.lw.LwCanvas
              |
              +--org.zaval.lw.LwPanel
                    |
                    +--org.zaval.lw.LwCombo
All Implemented Interfaces:
Drawable, java.util.EventListener, Layoutable, LayoutContainer, LwActionListener, LwComponent, LwComposite, LwContainer, LwKeyListener, LwMouseListener, LwWinListener, Validationable

public class LwCombo
extends LwPanel
implements LwActionListener, LwWinListener, LwMouseListener, LwKeyListener, LwComposite

This is combobox component. The component bases on LwList component. Actually the usage of the combobox is the same of the light weight list component. To work with the list component use getList and setList methods. The sample below illustrates the component usage:

   ...
   LwCombo combo = new LwCombo();
   LwList  list  = combo.getList();
   list.add(new LwLabel("Item 1"));
   list.add(new LwLabel("Item 2"));
   list.add(new LwLabel("Item 3"));
   ...
 

The component uses the special pad window to show the combo list. The window height can be fixed by setMaxPadHeight. In this case, if the list cannot be placed inside the window wholly the scroll bar panel will be used.

The component uses folowing resources:


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
LwCombo()
          Constructs a combobox component with no items.
 
Method Summary
 void actionPerformed(LwActionEvent e)
          Invoked when an action event occured.
protected  java.awt.Dimension calcPreferredSize()
          Gets the "pure" preferred size for this component.
 boolean canHaveFocus()
          Specifies if the component can have focus.
 boolean catchInput(LwComponent child)
          Checks if input events for the specified child component should be caught.
 LwStButton getComboButton()
          Gets the combo button.
protected  LwLayout getDefaultLayout()
          Gets the default layout manager that is set with the container during initialization.
 LwList getList()
          Gets the list component that is used as popup window content of the combobox.
 int getMaxPadHeight()
          Gets the max pad height.
 void insert(int index, java.lang.Object constr, LwComponent c)
          Inserts the specified lightweight component with the specified constraints as a child of this container at the specified position in the container list.
 void keyPressed(LwKeyEvent e)
          Invoked when a key has been pressed.
 void keyReleased(LwKeyEvent e)
          Invoked when a key has been released.
 void keyTyped(LwKeyEvent e)
          Invoked when a key has been typed.
 void mouseClicked(LwMouseEvent e)
          Invoked when the mouse button has been clicked on a light weight component.
 void mouseEntered(LwMouseEvent e)
          Invoked when the mouse enters a light weight component.
 void mouseExited(LwMouseEvent e)
          Invoked when the mouse exits a light weight component.
 void mousePressed(LwMouseEvent e)
          Invoked when the mouse button has been pressed on a light weight component.
 void mouseReleased(LwMouseEvent e)
          Invoked when the mouse button has been released on a light weight component.
 void paintOnTop(java.awt.Graphics g)
          Paints additional elements (for example, marker) after the container and its child components have been rendered.
 void remove(int index)
          Removes the component, specified by the index, from this container.
 void removeAll()
          Removes all child components from this container.
 void setList(LwList l)
          Sets the specified list component that will be used as popup window content of the combobox.
 void setMaxPadHeight(int h)
          Sets the max pad height.
 void winActivated(LwWinEvent e)
          Invoked when the light weight window component has been activated.
 void winClosed(LwWinEvent e)
          Invoked when the light weight window component has been closed.
 void winDeactivated(LwWinEvent e)
          Invoked when the light weight window component has been deactivated.
 void winOpened(LwWinEvent e)
          Invoked when the light weight window component has been opened.
 
Methods inherited from class org.zaval.lw.LwPanel
add, add, count, get, getLayoutOffset, getLwComponentAt, getLwLayout, indexOf, insert, invalidate, recalc, remove, setBackground, setLwLayout, setOpaque, toFront, updateCashedPs
 
Methods inherited from class org.zaval.lw.LwCanvas
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, setLwLayout
 
Methods inherited from interface org.zaval.lw.LwComponent
getLwComponentAt, 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
invalidate, 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
 

Constructor Detail

LwCombo

public LwCombo()
Constructs a combobox component with no items.
Method Detail

canHaveFocus

public boolean canHaveFocus()
Description copied from interface: LwComponent
Specifies if the component can have focus.
Specified by:
canHaveFocus in interface LwComponent
Overrides:
canHaveFocus in class LwCanvas
Following copied from interface: org.zaval.lw.LwComponent
Returns:
true if the component can have the focus.

getComboButton

public LwStButton getComboButton()
Gets the combo button.
Returns:
a combo button.

insert

public void insert(int index,
                   java.lang.Object constr,
                   LwComponent c)
Description copied from interface: LwContainer
Inserts the specified lightweight component with the specified constraints as a child of this container at the specified position in the container list. The method should call componentAdded method its layout manager to inform the layout manager that the new child has been added with the given constraints.
Specified by:
insert in interface LwContainer
Overrides:
insert in class LwPanel
Following copied from interface: org.zaval.lw.LwContainer
Parameters:
i - the position in the container list at which to insert the component.
s - the object expressing layout contraints for this.
c - the lightweight component to be added.

remove

public void remove(int index)
Description copied from interface: LwContainer
Removes the component, specified by the index, from this container. The layout manager of this container should be informed by calling componentRemoved method of the manager.
Specified by:
remove in interface LwContainer
Overrides:
remove in class LwPanel
Following copied from interface: org.zaval.lw.LwContainer
Parameters:
index - the index of the component to be removed.

removeAll

public void removeAll()
Description copied from interface: LwContainer
Removes all child components from this container. The layout manager of this container should be informed by calling componentRemoved method of the manager for every child component that has been removed.
Specified by:
removeAll in interface LwContainer
Overrides:
removeAll in class LwPanel

getMaxPadHeight

public int getMaxPadHeight()
Gets the max pad height.
Returns:
a max pad height.

setMaxPadHeight

public void setMaxPadHeight(int h)
Sets the max pad height.
Parameters:
h - the max pad height.

getList

public LwList getList()
Gets the list component that is used as popup window content of the combobox. Use the list to modify the combobox content.
Returns:
a list component.

setList

public void setList(LwList l)
Sets the specified list component that will be used as popup window content of the combobox.
Parameters:
l - the specified list component.

keyPressed

public void keyPressed(LwKeyEvent e)
Description copied from interface: LwKeyListener
Invoked when a key has been pressed.
Specified by:
keyPressed in interface LwKeyListener
Following copied from interface: org.zaval.lw.event.LwKeyListener
Parameters:
e - the specified key event.

keyTyped

public void keyTyped(LwKeyEvent e)
Description copied from interface: LwKeyListener
Invoked when a key has been typed.
Specified by:
keyTyped in interface LwKeyListener
Following copied from interface: org.zaval.lw.event.LwKeyListener
Parameters:
e - the specified key event.

keyReleased

public void keyReleased(LwKeyEvent e)
Description copied from interface: LwKeyListener
Invoked when a key has been released.
Specified by:
keyReleased in interface LwKeyListener
Following copied from interface: org.zaval.lw.event.LwKeyListener
Parameters:
e - the specified key event.

actionPerformed

public void actionPerformed(LwActionEvent e)
Description copied from interface: LwActionListener
Invoked when an action event occured. The specified action event is passed to the method.
Specified by:
actionPerformed in interface LwActionListener
Following copied from interface: org.zaval.lw.event.LwActionListener
Parameters:
e - the specified action event.

winOpened

public void winOpened(LwWinEvent e)
Description copied from interface: LwWinListener
Invoked when the light weight window component has been opened.
Specified by:
winOpened in interface LwWinListener
Following copied from interface: org.zaval.lw.event.LwWinListener
Parameters:
e - the specified window event.

winClosed

public void winClosed(LwWinEvent e)
Description copied from interface: LwWinListener
Invoked when the light weight window component has been closed.
Specified by:
winClosed in interface LwWinListener
Following copied from interface: org.zaval.lw.event.LwWinListener
Parameters:
e - the specified window event.

winActivated

public void winActivated(LwWinEvent e)
Description copied from interface: LwWinListener
Invoked when the light weight window component has been activated.
Specified by:
winActivated in interface LwWinListener
Following copied from interface: org.zaval.lw.event.LwWinListener
Parameters:
e - the specified window event.

winDeactivated

public void winDeactivated(LwWinEvent e)
Description copied from interface: LwWinListener
Invoked when the light weight window component has been deactivated.
Specified by:
winDeactivated in interface LwWinListener
Following copied from interface: org.zaval.lw.event.LwWinListener
Parameters:
e - the specified window 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.

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.

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.

paintOnTop

public void paintOnTop(java.awt.Graphics g)
Description copied from interface: LwContainer
Paints additional elements (for example, marker) after the container and its child components have been rendered.
Specified by:
paintOnTop in interface LwContainer
Overrides:
paintOnTop in class LwPanel
Following copied from interface: org.zaval.lw.LwContainer
Parameters:
g - the graphics context.

catchInput

public boolean catchInput(LwComponent child)
Description copied from interface: LwComposite
Checks if input events for the specified child component should be caught.
Specified by:
catchInput in interface LwComposite
Following copied from interface: org.zaval.lw.LwComposite
Parameters:
child - the specified child component.
Returns:
true if input events for the child component should be caught by this component; false otherwise.

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.

calcPreferredSize

protected java.awt.Dimension calcPreferredSize()
Description copied from class: LwPanel
Gets the "pure" preferred size for this component. The method has not be overrided, because it determines the preferred size by the layout manager.
Overrides:
calcPreferredSize in class LwPanel
Following copied from class: org.zaval.lw.LwPanel
Returns:
a "pure" preferred size.


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