|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--org.zaval.util.ValidationObject | +--org.zaval.lw.LwCanvas | +--org.zaval.lw.LwPanel | +--org.zaval.lw.LwList
This is list component. The main features of the component are shown in the list below:
add
, remove
, insert
methods to manipulate
the list component content. For example, if it is necessary to add following three
text items: "Item 1", "Item 2", "Item 3", you can use LwLabel component as it is shown
below:
... LwList list = new LwList(); list.add(new LwLabel("Item 1")); list.add(new LwLabel("Item 2")); list.add(new LwLabel("Item 3")); ...The class has method
add
that get string as input argument. The method
creates LwLabel object with the string argument as a title. In this case the sample
above can be simplify as follow:
... LwList list = new LwList(); list.add("Item 1"); list.add("Item 2"); list.add("Item 3"); ...
getPosController
method. To control selection use select
,
getSelected
, getSelectedIndex
, isSelected
methods.
To listen when an item component has been selected use addSelectionListener
and removeSelectionListener
methods.
addSelectionListener
and removeSelectionListener
methods
to listen whenever the selected item has been changed. The selection event is represented
by the LwActionEvent where getData
method returns the selected item index.
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 | |
LwList()
Constructs a list component with no items. |
Method Summary | |
void |
add(java.lang.String s)
Adds an item to the list. |
void |
addSelectionListener(LwActionListener l)
Adds the specified selection listener to receive selection events from this list 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. |
protected void |
drawPosMarker(java.awt.Graphics g)
Invoked to paint position marker. |
protected void |
drawSelMarker(java.awt.Graphics g)
Invoked to paint selection marker. |
void |
focusGained(LwFocusEvent e)
Invoked when the light weight component gained focus. |
void |
focusLost(LwFocusEvent e)
Invoked when the light weight component lost focus. |
protected LwLayout |
getDefaultLayout()
Gets the default layout manager that is set with the container during initialization. |
java.awt.Point |
getLayoutOffset()
Returns the offset. |
PosController |
getPosController()
Gets the position controller. |
java.awt.Color |
getPosRectColor()
Gets the position rectangle color. |
java.awt.Color |
getSelectColor()
Gets the selection marker color. |
LwComponent |
getSelected()
Gets the selected item component. |
int |
getSelectedIndex()
Gets the selected item index. |
java.awt.Point |
getSOLocation()
Gets the scroll object location. |
java.awt.Dimension |
getSOSize()
Gets the scroll object size. |
void |
insert(int i,
java.lang.Object s,
LwComponent d)
Inserts the specified lightweight component with the specified constraints as a child of this container at the specified position in the container list. |
boolean |
isSelected(int i)
Tests if the item with the specified index is selected or not. |
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. |
boolean |
moveContent()
Tests if the scroll component performs scrolling by changing its location or moving view. |
protected boolean |
notifyScrollMan(int index)
Notifies the scroll manager that an item component at the specified index should be fully visible. |
protected int |
pageSize(int d)
Returns the page size for the specified direction. |
void |
paintOnTop(java.awt.Graphics g)
Paints this component. |
protected void |
perform(int from)
Creates and fires appropriate selection event for list of selection listeners. |
void |
posChanged(PosEvent e)
Invoked when a virtual position has been changed. |
void |
remove(int i)
Removes the component, specified by the index, from this container. |
void |
removeAll()
Removes all child components from this container. |
void |
removeSelectionListener(LwActionListener l)
Removes the specified selection listener so it no longer receives selection events from this list component. |
void |
select(int index)
Selects the item by the specified index. |
void |
setLwLayout(LwLayout l)
Sets the layout manager for this container. |
void |
setPosController(PosController c)
Sets the specified position controller. |
void |
setPosRectColor(java.awt.Color c)
Sets the color for a position rectangle. |
void |
setScrollMan(ScrollMan m)
Sets the specified scroll manager for the scroll object. |
void |
setSelectColor(java.awt.Color c)
Sets the selection marker color. |
void |
setSOLocation(int x,
int y)
Sets the specified scroll object location. |
Methods inherited from class org.zaval.lw.LwPanel |
add, add, calcPreferredSize, count, get, getLwComponentAt, getLwLayout, indexOf, insert, invalidate, recalc, remove, setBackground, 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 |
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 |
Constructor Detail |
public LwList()
Method Detail |
public boolean canHaveFocus()
LwComponent
canHaveFocus
in interface LwComponent
canHaveFocus
in class LwCanvas
org.zaval.lw.LwComponent
true
if the component can have the focus.public void setPosController(PosController c)
c
- the specified position controller.public void setLwLayout(LwLayout l)
setLwLayout
in interface LwContainer
setLwLayout
in class LwPanel
l
- the specified layout manager.public PosController getPosController()
public java.awt.Color getSelectColor()
public void setSelectColor(java.awt.Color c)
c
- the selection marker color.public java.awt.Color getPosRectColor()
public void setPosRectColor(java.awt.Color c)
c
- the color.public void add(java.lang.String s)
s
- the specified label.public void select(int index)
index
- the specified item index.public int getSelectedIndex()
public boolean isSelected(int i)
true
if the item with the specified index is selected; otherwise
false
.public void addSelectionListener(LwActionListener l)
getData
method returns Integer
object that is selection index.l
- the specified listener.public void removeSelectionListener(LwActionListener l)
l
- the specified listener.public void paintOnTop(java.awt.Graphics g)
paintOnTop
in interface LwContainer
paintOnTop
in class LwPanel
g
- the graphics context to be used for painting.protected void drawSelMarker(java.awt.Graphics g)
g
- the graphics context to be used for painting.protected void drawPosMarker(java.awt.Graphics g)
g
- the graphics context to be used for painting.public void mouseClicked(LwMouseEvent e)
LwMouseListener
mouseClicked
in interface LwMouseListener
org.zaval.lw.event.LwMouseListener
e
- the specified mouse event.public void mouseEntered(LwMouseEvent e)
LwMouseListener
mouseEntered
in interface LwMouseListener
org.zaval.lw.event.LwMouseListener
e
- the specified mouse event.public void mouseExited(LwMouseEvent e)
LwMouseListener
mouseExited
in interface LwMouseListener
org.zaval.lw.event.LwMouseListener
e
- the specified mouse event.public void mousePressed(LwMouseEvent e)
LwMouseListener
mousePressed
in interface LwMouseListener
org.zaval.lw.event.LwMouseListener
e
- the specified mouse event.public void mouseReleased(LwMouseEvent e)
LwMouseListener
mouseReleased
in interface LwMouseListener
org.zaval.lw.event.LwMouseListener
e
- the specified mouse event.public void keyPressed(LwKeyEvent e)
LwKeyListener
keyPressed
in interface LwKeyListener
org.zaval.lw.event.LwKeyListener
e
- the specified key event.public void keyReleased(LwKeyEvent e)
LwKeyListener
keyReleased
in interface LwKeyListener
org.zaval.lw.event.LwKeyListener
e
- the specified key event.public void keyTyped(LwKeyEvent e)
LwKeyListener
keyTyped
in interface LwKeyListener
org.zaval.lw.event.LwKeyListener
e
- the specified key event.public void focusGained(LwFocusEvent e)
LwFocusListener
focusGained
in interface LwFocusListener
org.zaval.lw.event.LwFocusListener
e
- the specified focus event.public void focusLost(LwFocusEvent e)
LwFocusListener
focusLost
in interface LwFocusListener
org.zaval.lw.event.LwFocusListener
e
- the specified focus event.public boolean catchInput(LwComponent child)
LwComposite
catchInput
in interface LwComposite
org.zaval.lw.LwComposite
child
- the specified child component.true
if input events for the child component should be caught by this
component; false
otherwise.public void posChanged(PosEvent e)
PosListener
posChanged
in interface PosListener
org.zaval.misc.event.PosListener
e
- the specified pos event.public void insert(int i, java.lang.Object s, LwComponent d)
LwContainer
componentAdded
method its layout manager to inform the layout manager
that the new child has been added with the given constraints.insert
in interface LwContainer
insert
in class LwPanel
org.zaval.lw.LwContainer
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.public void remove(int i)
LwContainer
componentRemoved
method of the manager.remove
in interface LwContainer
remove
in class LwPanel
org.zaval.lw.LwContainer
index
- the index of the component to be removed.public void removeAll()
LwContainer
componentRemoved
method of the manager for every child component
that has been removed.removeAll
in interface LwContainer
removeAll
in class LwPanel
public java.awt.Point getSOLocation()
ScrollObj
getSOLocation
in interface ScrollObj
org.zaval.misc.ScrollObj
public void setSOLocation(int x, int y)
ScrollObj
setSOLocation
in interface ScrollObj
org.zaval.misc.ScrollObj
x
- the specified x coordinate.y
- the specified y coordinate.public java.awt.Dimension getSOSize()
ScrollObj
getSOSize
in interface ScrollObj
org.zaval.misc.ScrollObj
public void setScrollMan(ScrollMan m)
ScrollObj
setScrollMan
in interface ScrollObj
org.zaval.misc.ScrollObj
m
- the specified scroll manager.public boolean moveContent()
ScrollObj
moveContent
in interface ScrollObj
org.zaval.misc.ScrollObj
true
if the scroll component organizes scrolling by moving
its view; otherwise false
.public java.awt.Point getLayoutOffset()
LayoutContainer
x
is offset for x-coordinates and y
is offset for y-coordinates. The ability to offset child components with a layout manager
is used with the library to organize scrolling.getLayoutOffset
in interface LayoutContainer
getLayoutOffset
in class LwPanel
org.zaval.lw.LayoutContainer
public LwComponent getSelected()
protected void perform(int from)
from
- the selected item index.protected boolean notifyScrollMan(int index)
index
- the specified index.true
if the item component has not been fully visible; false
otherwise.protected int pageSize(int d)
d
- the specified direction. Use -1
value to specify bottom-up direction and
1
value to specify up-bottom direction.protected LwLayout getDefaultLayout()
LwPanel
getDefaultLayout
in class LwPanel
org.zaval.lw.LwPanel
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |