|
||||||||||
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.LwTracker
This is tracker component. The component is like slider component, but this is more complex:
addTrackerListener
and removeTrackerListener
to
register and remove the tracker listeners.
Field Summary | |
static int |
BUNDLE_1
Specifies type for leftmost and rightmost bundles. |
static int |
BUNDLE_2
Specifies type for bundles that are located between leftmost and rightmost bundles. |
static int |
INNER_SCALE
Specifies scale area that is placed between rightmost and left most bundles. |
static int |
OUTER_SCALE
Specifies scale area that is placed on the right and on the left of rightmost and left most bundles. |
static int |
ST_ONSURFACE
The ONSURFACE state. |
static int |
ST_OUTSURFACE
The OUTSURFACE state. |
static int |
ST_PRESSED
The PRESSED state. |
static int |
ST_REMOVING
The REMOVING state. |
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 | |
LwTracker()
Constructs the class instance. |
Method Summary | |
void |
addTrackerListener(LwTrackerListener l)
Adds the specified tracker listener. |
protected java.awt.Dimension |
calcPreferredSize()
Gets the "pure" preferred size for this component. |
boolean |
canHaveFocus()
Specifies if the component can have focus. |
void |
endDragged(LwMouseMotionEvent e)
Invoked when the mouse ends dragged. |
int |
findNearest(int x,
int y)
Finds nearest tracker value where a bundle can be moved by the specified location. |
int |
getBundleIndex(int x,
int y)
Returns a bundle element index by the specified location. |
int |
getBundles()
Gets a number of bundles elements. |
protected LwView |
getBundleView(int bundleIndex)
Gets a view for the specified bundle. |
int |
getMax()
Gets the maximal possible value. |
int |
getMax(int bundleIndex)
Gets the maximal possible value for the specified bundle. |
int |
getMin()
Gets a minimal possible value. |
int |
getMin(int bundleIndex)
Gets a minimal possible value for the specified bundle. |
java.awt.Color |
getScaleColor(int type)
Gets the scale color for the specified scale area. |
int |
getStep()
Gets the exact step. |
LwTextRender |
getTitleRender()
Gets the text render that is used to render the tracker titles. |
LwComponent |
getTooltip(int x,
int y)
Returns a component that should be used as a tooltip for the specified location of a target component. |
int |
getValue(int index)
Gets the specified bundle value. |
LwView |
getView(int id,
int state)
Gets a view that is associated with the given state for the specified bundle type. |
int |
insertBundle(int value)
Inserts a new bundle with the specified value. |
void |
invalidate()
Invalidates this component. |
int |
loc2value(int x)
Converts the specified location to a tracker value. |
void |
mouseClicked(LwMouseEvent e)
Invoked when the mouse button has been clicked on a light weight component. |
void |
mouseDragged(LwMouseMotionEvent e)
Invoked when a mouse button is pressed on a component and then dragged. |
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 |
mouseMoved(LwMouseMotionEvent e)
Invoked when the mouse pointer has been moved on a light weight component (with no buttons no down). |
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 |
paint(java.awt.Graphics g)
Paints this component. |
protected void |
perform(int bi,
int v,
int pv,
int id)
Performs a tracker event for the specified bundle with the specified event id and event parameters. |
protected void |
recalc()
Invoked with validate method only if the component is not valid. |
void |
removeBundle(int index)
Removes a bundle at the specified index. |
void |
removeTrackerListener(LwTrackerListener l)
Removes the specified tracker listener so it no longer receives tracker events from this component. |
void |
setScaleColor(int type,
java.awt.Color c)
Sets the scale color for the specified scale area. |
void |
setScaleStep(int s)
Sets the scale step. |
void |
setStep(int step)
Sets the specified exact step. |
void |
setTooltip(int index,
LwComponent c)
Sets the given component as tooltip for the specified bundle. |
void |
setValue(int index,
int value)
Sets the given value for the specified bundle. |
void |
setValues(int min,
int max,
int[] intervals,
int[] values,
int step)
Sets the tracker properties. |
void |
setView(int id,
int state,
LwView v)
Sets the given view for the given state and the specified bundle type. |
void |
showTitle(boolean b)
Sets the tracker title visibility. |
void |
startDragged(LwMouseMotionEvent e)
Invoked when the mouse starts dragged. |
int |
value2loc(int v)
Converts the specified tracker value to a location. |
Methods inherited from class org.zaval.lw.LwCanvas |
getBackground, getBounds, getHeight, getInsets, getLocation, getLwComponentAt, getLwParent, getOrigin, getPreferredSize, getSize, getViewMan, getVisiblePart, getWidth, getX, getY, hasFocus, isEnabled, isOpaque, isVisible, repaint, repaint, requestFocus, setBackground, setEnabled, setInsets, setLocation, setLwParent, setOpaque, 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.util.Validationable |
isValid |
Field Detail |
public static final int ST_ONSURFACE
public static final int ST_PRESSED
public static final int ST_OUTSURFACE
public static final int ST_REMOVING
public static final int BUNDLE_1
public static final int BUNDLE_2
public static final int OUTER_SCALE
public static final int INNER_SCALE
Constructor Detail |
public LwTracker()
Method Detail |
public boolean canHaveFocus()
LwComponent
canHaveFocus
in class LwCanvas
org.zaval.lw.LwComponent
true
if the component can have the focus.public void showTitle(boolean b)
b
- the tracker title visibility.public void setTooltip(int index, LwComponent c)
index
- the specified bundle index.c
- the specified component to be used as tooltip.public LwTextRender getTitleRender()
public LwView getView(int id, int state)
id
- the specified bundle type. Use BUNDLE_1 or BUNDLE_2 as the
argument value.state
- the bundle state. Depending on the bundle type the state
can be as follow:
public void setView(int id, int state, LwView v)
id
- the specified bundle type. Use BUNDLE_1 or BUNDLE_2 as the
argument value.state
- the bundle state. Depending on the bundle type the state
can be as follow:
v
- the specified view.public java.awt.Color getScaleColor(int type)
public void setScaleColor(int type, java.awt.Color c)
type
- the specified scale area. Use INNER_SCALE (scale area that is located
between leftmost and rightmost bundles) or OUTER_SCALE.
as the parameter value.c
- the scale color.public void setScaleStep(int s)
s
- the scale step.public void setValues(int min, int max, int[] intervals, int[] values, int step)
min
- the specified minimal possible value.max
- the specified maximal possible value.intervals
- the specified intervals sizes array.values
- the specified bundles values.step
- the specified step.public int getBundles()
public void removeBundle(int index)
index
- the specified index.public int insertBundle(int value)
value
- the specified bundle value.public int getMin()
public int getMin(int bundleIndex)
bundleIndex
- the specified bundle index.public int getMax()
public int getMax(int bundleIndex)
bundleIndex
- the specified bundle index.public void setValue(int index, int value)
index
- the specified bundle index.value
- the specified value.public int getValue(int index)
index
- the specified bundle index.public void addTrackerListener(LwTrackerListener l)
l
- the specified tracker listener.public void removeTrackerListener(LwTrackerListener l)
l
- the specified tracker listener.public void paint(java.awt.Graphics g)
LwCanvas
paint
in class LwCanvas
org.zaval.lw.LwCanvas
g
- the graphics context to be used for painting.public void startDragged(LwMouseMotionEvent e)
LwMouseMotionListener
startDragged
in interface LwMouseMotionListener
org.zaval.lw.event.LwMouseMotionListener
e
- the specified mouse motion event.public void endDragged(LwMouseMotionEvent e)
LwMouseMotionListener
endDragged
in interface LwMouseMotionListener
org.zaval.lw.event.LwMouseMotionListener
e
- the specified mouse motion event.public void mouseDragged(LwMouseMotionEvent e)
LwMouseMotionListener
mouseDragged
in interface LwMouseMotionListener
org.zaval.lw.event.LwMouseMotionListener
e
- the specified mouse motion 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 mouseMoved(LwMouseMotionEvent e)
LwMouseMotionListener
mouseMoved
in interface LwMouseMotionListener
org.zaval.lw.event.LwMouseMotionListener
e
- the specified mouse motion event.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 invalidate()
LwCanvas
invalidate
in class LwCanvas
public LwComponent getTooltip(int x, int y)
TooltipInfo
getTooltip
in interface TooltipInfo
org.zaval.lw.TooltipInfo
x
- the x coordinate of the location.y
- the y coordinate of the location.public int getBundleIndex(int x, int y)
x
- the specified x coordinate.y
- the specified y coordinate.-1
if there
is not any bundle that contains the location.public int findNearest(int x, int y)
x
- the specified x coordinate.y
- the specified y coordinate.public int value2loc(int v)
v
- the specified value.public int loc2value(int x)
x
- the specified location. The location is "x" coordinate.public void setStep(int step)
step
- the specified exact step.public int getStep()
protected java.awt.Dimension calcPreferredSize()
LwCanvas
getPreferredSize
method.calcPreferredSize
in class LwCanvas
org.zaval.lw.LwCanvas
protected LwView getBundleView(int bundleIndex)
bundleIndex
- the specified bundle index.protected void perform(int bi, int v, int pv, int id)
bi
- the specified bundle index.v
- the specified bundle value.pv
- the specified previous bundle value.id
- the specified tracker event id.protected void recalc()
LwCanvas
validate
method only if the component is not valid.
The method shoud be overrided 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.recalc
in class LwCanvas
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |