org.zaval.lw
Class LwList
java.lang.Object
|
+--org.zaval.lw.LwCanvas
|
+--org.zaval.lw.LwPanel
|
+--org.zaval.lw.LwAList
|
+--org.zaval.lw.LwList
- All Implemented Interfaces:
- java.util.EventListener, Layoutable, LayoutContainer, LwComponent, LwContainer, LwKeyListener, LwMouseListener, LwMouseMotionListener, LwViewProvider, PosInfo, PosListener, ScrollObj, Validationable
- public class LwList
- extends LwAList
- implements LwViewProvider
This is more light-weight list component implementation in comparison with LwCompList
The list component uses the view provider to customize how the item should be
rendered. The default implementation uses LwTextRender to paint the list items
in a case if the item doesn't inherits the LwView class. Use the setViewProvider
and getViewProvider methods to work with items view provider.
| 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 |
LwList()
Constructs the list component and use standard mode as the default. |
LwList(boolean b)
Constructs the list component with the given mode. |
|
Method Summary |
protected java.awt.Dimension |
calcPreferredSize()
Gets the "pure" preferred size for this component. |
protected void |
drawPosMarker(java.awt.Graphics g,
int x,
int y,
int w,
int h)
Invoked to paint the list position marker for the specified rectangular area. |
protected void |
drawSelMarker(java.awt.Graphics g,
int x,
int y,
int w,
int h)
Invoked to paint the list selection marker for the specified rectangular area. |
java.lang.Object |
getItem(int index)
Gets the item at the specified index. |
int |
getItemIdxAt(int x,
int y)
Gets an item index that is located at the given location. |
LwView |
getItemView(int index)
Gets the view for the list item at the specified position. |
int |
getItemX(int i)
Gets the item x coordinate. |
int |
getItemY(int index)
Gets the item y coordinate. |
LwViewProvider |
getVewProvider()
Gets the view provider. |
LwView |
getView(LwComponent c,
java.lang.Object item)
Gets the view for the specified object of the specified component. |
void |
insertItem(int index,
java.lang.Object o)
Inserts the given item at the specified index. |
void |
invalidate()
Invalidates this object. |
int |
itemCount()
Gets the number of items that has been added in the list. |
protected int |
itemH(int i)
Fetches the item height The method should fetches the item
height from the an internal structure without performing any
list validation. |
protected int |
itemW(int i)
Fetches the item width. |
protected void |
iVisibility()
Invalidates the list items visibility. |
java.awt.Dimension |
maxItemSize()
Gets the maximal possible item size. |
void |
paint(java.awt.Graphics g)
Paints this component. |
protected void |
recalc()
Invoked with validate method only if the component is not valid.
|
void |
removeAllItems()
Removes all items from the list. |
void |
removeItem(int index)
Removes an item at the specified index. |
protected void |
repaint(int p,
int n)
Repaints the area that includes two specified list items. |
void |
setSOLocation(int x,
int y)
Sets the specified scroll object location. |
void |
setViewProvider(LwViewProvider v)
Sets the specified view provider. |
protected void |
vVisibility()
Validates the list items visibility if it is necessary. |
| Methods inherited from class org.zaval.lw.LwAList |
addItem, addSelectionListener, canHaveFocus, correctPM, endDragged, getColor, getItemGaps, getItemH, getItemW, getLines, getLineSize, getMaxOffset, getPosController, getSelected, getSelectedIndex, getSOLocation, getSOSize, isComboMode, isSelected, keyPressed, keyReleased, keyTyped, mouseClicked, mouseDragged, mouseEntered, mouseExited, mouseMoved, mousePressed, mouseReleased, moveContent, notifyScrollMan, pageSize, paintOnTop, perform, posChanged, removeSelectionListener, select, setColor, setPosController, setScrollMan, startDragged |
| Methods inherited from class org.zaval.lw.LwPanel |
add, add, count, get, getDefaultLayout, getLayoutOffset, getLwComponentAt, getLwLayout, getPreferredSize, indexOf, insert, insert, isInvalidatedByChild, laidout, remove, remove, removeAll, setBackground, setLwLayout, setOpaque, setSize, toFront, updateCashedPs, validate |
| Methods inherited from class org.zaval.lw.LwCanvas |
calcInsets, 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, 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.LwComponent |
getBackground, getLwParent, getOrigin, getViewMan, getVisiblePart, isEnabled, isOpaque, repaint, repaint, repaint, setEnabled, setInsets, setLwParent, setViewMan, setVisible, update |
LwList
public LwList()
- Constructs the list component and use standard mode as the default.
LwList
public LwList(boolean b)
- Constructs the list component with the given mode.
- Parameters:
b - the specified mode. Use true value to have the list
in combo mode. In this case the position changing doesn't bring to the item
selection.
setViewProvider
public void setViewProvider(LwViewProvider v)
- Sets the specified view provider. The provider is used to define a view that
will be used to paint the list item.
- Parameters:
v - the specified view provider.
getVewProvider
public LwViewProvider getVewProvider()
- Gets the view provider.
- Returns:
- a view provider.
drawSelMarker
protected void drawSelMarker(java.awt.Graphics g,
int x,
int y,
int w,
int h)
- Description copied from class:
LwAList
- Invoked to paint the list selection marker for the specified rectangular area.
- Overrides:
drawSelMarker in class LwAList
- Following copied from class:
org.zaval.lw.LwAList
- Parameters:
g - the graphics context to be used for painting.x - the x coordinate of the rectangular area.y - the y coordinate of the rectangular area.w - the width of the rectangular area.h - the height of the rectangular area.
drawPosMarker
protected void drawPosMarker(java.awt.Graphics g,
int x,
int y,
int w,
int h)
- Description copied from class:
LwAList
- Invoked to paint the list position marker for the specified rectangular area.
- Overrides:
drawPosMarker in class LwAList
- Following copied from class:
org.zaval.lw.LwAList
- Parameters:
g - the graphics context to be used for painting.x - the x coordinate of the rectangular area.y - the y coordinate of the rectangular area.w - the width of the rectangular area.h - the height of the rectangular area.
getView
public LwView getView(LwComponent c,
java.lang.Object item)
- Description copied from interface:
LwViewProvider
- Gets the view for the specified object of the specified component.
- Specified by:
getView in interface LwViewProvider
- Following copied from interface:
org.zaval.lw.LwViewProvider
- Parameters:
d - the specified component.obj - the specified object.- Returns:
- a view.
insertItem
public void insertItem(int index,
java.lang.Object o)
- Description copied from class:
LwAList
- Inserts the given item at the specified index.
- Overrides:
insertItem in class LwAList
- Following copied from class:
org.zaval.lw.LwAList
- Parameters:
index - the specified item index.o - the specified item.
removeItem
public void removeItem(int index)
- Description copied from class:
LwAList
- Removes an item at the specified index.
- Overrides:
removeItem in class LwAList
- Following copied from class:
org.zaval.lw.LwAList
- Parameters:
i - the specified item index.
removeAllItems
public void removeAllItems()
- Description copied from class:
LwAList
- Removes all items from the list.
- Overrides:
removeAllItems in class LwAList
getItem
public java.lang.Object getItem(int index)
- Description copied from class:
LwAList
- Gets the item at the specified index.
- Overrides:
getItem in class LwAList
- Following copied from class:
org.zaval.lw.LwAList
- Parameters:
i - the specified item index.- Returns:
- an item.
itemCount
public int itemCount()
- Description copied from class:
LwAList
- Gets the number of items that has been added in the list.
- Overrides:
itemCount in class LwAList
- Following copied from class:
org.zaval.lw.LwAList
- Returns:
- an number of the list items.
getItemView
public LwView getItemView(int index)
- Description copied from class:
LwAList
- Gets the view for the list item at the specified position.
- Overrides:
getItemView in class LwAList
- Following copied from class:
org.zaval.lw.LwAList
- Parameters:
index - the item position.- Returns:
- a view.
paint
public void paint(java.awt.Graphics g)
- Description copied from interface:
LwComponent
- Paints this component.
- Overrides:
paint in class LwCanvas
- Following copied from interface:
org.zaval.lw.LwComponent
- Parameters:
g - the graphics context to be used for painting.
invalidate
public void invalidate()
- Description copied from interface:
Validationable
- Invalidates this object.
- Overrides:
invalidate in class LwPanel
recalc
protected void recalc()
- Description copied from class:
LwCanvas
- Invoked with
validate method only if the component is not valid.
The method should be overridden to calculate metrical characteristics of the component to
minimize computation time of the preferred size for the component. For example, you can
calculate a preferred size inside the method and just return it by
calcPreferredSize method.
- Overrides:
recalc in class LwCanvas
maxItemSize
public java.awt.Dimension maxItemSize()
- Description copied from class:
LwAList
- Gets the maximal possible item size.
- Overrides:
maxItemSize in class LwAList
- Following copied from class:
org.zaval.lw.LwAList
- Returns:
- a maximal possible item size.
calcPreferredSize
protected java.awt.Dimension calcPreferredSize()
- Description copied from class:
LwPanel
- Gets the "pure" preferred size for this component. The method has not be overridden,
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.
setSOLocation
public void setSOLocation(int x,
int y)
- Description copied from interface:
ScrollObj
- Sets the specified scroll object location. The method defines a mechanism that will be used to
scrool the object.
- Overrides:
setSOLocation in class LwAList
- Following copied from interface:
org.zaval.misc.ScrollObj
- Parameters:
x - the specified x coordinate.y - the specified y coordinate.
getItemIdxAt
public int getItemIdxAt(int x,
int y)
- Description copied from class:
LwAList
- Gets an item index that is located at the given location.
- Overrides:
getItemIdxAt in class LwAList
- Following copied from class:
org.zaval.lw.LwAList
- Parameters:
x - the x coordinate of the given location.y - the y coordinate of the given location.- Returns:
- an item index that is located at the given location.
getItemY
public int getItemY(int index)
- Description copied from class:
LwAList
- Gets the item y coordinate.
- Overrides:
getItemY in class LwAList
- Following copied from class:
org.zaval.lw.LwAList
- Parameters:
index - the specified item index.- Returns:
- the item y coordinate.
getItemX
public int getItemX(int i)
- Description copied from class:
LwAList
- Gets the item x coordinate.
- Overrides:
getItemX in class LwAList
- Following copied from class:
org.zaval.lw.LwAList
- Parameters:
index - the specified item index.- Returns:
- the item x coordinate.
itemW
protected int itemW(int i)
- Description copied from class:
LwAList
- Fetches the item width. The method should fetches the item
width from the an internal structure without performing any
list validation.
- Overrides:
itemW in class LwAList
- Following copied from class:
org.zaval.lw.LwAList
- Parameters:
index - the specified item index.- Returns:
- the item width.
itemH
protected int itemH(int i)
- Description copied from class:
LwAList
- Fetches the item height The method should fetches the item
height from the an internal structure without performing any
list validation.
- Overrides:
itemH in class LwAList
- Following copied from class:
org.zaval.lw.LwAList
- Parameters:
index - the specified item index.- Returns:
- the item height.
vVisibility
protected void vVisibility()
- Validates the list items visibility if it is necessary.
iVisibility
protected void iVisibility()
- Invalidates the list items visibility.
repaint
protected void repaint(int p,
int n)
- Description copied from class:
LwAList
- Repaints the area that includes two specified list items.
- Overrides:
repaint in class LwAList
- Following copied from class:
org.zaval.lw.LwAList
- Parameters:
p - the first specified list item index.n - the first specified list item index.
|