|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Object
|
+--brf.j2me.dynaworks.ui.BasicWidget
|
+--brf.j2me.dynaworks.ui.Tree
Provides a class that does hierarchical layout of information.
It implements a Windows Explorer-like hiearchical tree type view of a Vector of TreeItems. When an item-specific event happens (ie. a double-click on an icon or label) an Event is generated, whose argument is the TreeItem affected.
BasicWidget,
UserWidget| Field Summary | |
static int |
COLLAPSE
Event sent when a drawer is closed. |
private TreeItem |
currItem
reference to currently active item. |
protected java.util.Vector |
displayedList
Items able to be displayed |
protected int |
displayNum
Default value for how many items we can display. |
private int |
dragState
current dragging mode |
private int |
dragX
we are dragging from here (x-coordinate). |
private int |
dragY
we are dragging from here (y-coordinate). |
static int |
EXPAND
Event sent when a drawer is opened. |
private int |
firstVisible
index of first visible tree item. |
private int |
height
height of a tree control. |
private ScrollBar |
hs
horizontal scrollbar. |
private static Bitmap |
minusSign
Bitmap "-" |
private static Bitmap |
plusSign
Bitmap "+" |
protected java.util.Vector |
rootItems
The items in this Tree. |
private int |
scrollX
horizontal scroll position. |
private int |
scrollXmax
maximum x-scroll value for current layout. |
private int |
scrollY
vertical scroll position. |
private int |
scrollYmax
maximum y-scroll value for current layout. |
static int |
SIMPLE
Style mode flags. |
private int |
syncState
status of synchronization: 0 = up-to-date |
private ScrollBar |
vs
vertical scrollbar. |
private int |
width
width of the tree canvas. |
| Fields inherited from class brf.j2me.dynaworks.ui.BasicWidget |
g, h, w, x, y |
| Constructor Summary | |
Tree(int x,
int y,
int w,
int h,
int style)
Creates an empty Tree. |
|
| Method Summary | |
(package private) static void |
|
void |
addRoot(TreeItem item)
Inserts the item as a root item in the tree. |
private int |
addToDisplayedList(TreeItem item,
int level)
add an item to the list of displayed list. |
void |
collapse(TreeItem item)
Collapses a branch. |
void |
expand(TreeItem item)
Makes the subtree visible |
private boolean |
expandIconClick(TreeItem item)
branch is expanding (true) or collapsing (false). |
TreeItem |
getSelectedItem()
Return the selected item in the tree, null if the tree is empty. |
ActionEvent |
handlePenDown(int xc,
int yc)
Handle a "pen down" event. |
ActionEvent |
handlePenMove(int xc,
int yc)
Handle a "pen move" event. |
ActionEvent |
handlePenUp(int xc,
int yc)
Handle a "pen up" event. |
private void |
initStyle(int style)
setup the style. |
void |
paint()
paint the graphics area. |
void |
removeAll()
deletes all items in the tree. |
boolean |
removeRoot(TreeItem item)
Deletes the item from the list of root items. |
void |
selectItem(TreeItem item)
selects the item |
protected void |
setHorizontalOffset(int offset)
Sets the horizontal offset for painting the tree anf can be used e.g. |
protected void |
setVerticalOffset(int offset)
Sets the vertical offset for painting the tree anf can be used e.g. |
private void |
sync()
synchronize inner state (list of displayed tree items. |
| Methods inherited from class brf.j2me.dynaworks.ui.BasicWidget |
contains, handleKeyDown, handleSysKeyDown, hasFocus, loseFocus, setFocus |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, registerNatives, toString, wait, wait, wait |
| Field Detail |
public static final int SIMPLE
public static final int EXPAND
public static final int COLLAPSE
private int width
private int height
private ScrollBar hs
private int scrollX
private int scrollXmax
private ScrollBar vs
private int scrollY
private int scrollYmax
private int dragState
private int dragX
private int dragY
protected java.util.Vector rootItems
private TreeItem currItem
private int firstVisible
protected java.util.Vector displayedList
protected int displayNum
private int syncState
private static Bitmap plusSign
private static Bitmap minusSign
| Constructor Detail |
public Tree(int x,
int y,
int w,
int h,
int style)
x - int - x-ccordinate of upper-left corner.y - int - y-coordinate of upper left corner.w - int - width of control.h - int - height of control.| Method Detail |
static void()
public void paint()
paint in class BasicWidgetprivate void initStyle(int style)
style - int - tree style to be used.public TreeItem getSelectedItem()
protected void setHorizontalOffset(int offset)
offset - int - use value as new horizontal offset.protected void setVerticalOffset(int offset)
offset - int - use value as new vertical offset.public void addRoot(TreeItem item)
item - TreeItem - item to be inserted.public boolean removeRoot(TreeItem item)
item - TreeItem - item to be removedpublic void removeAll()
public void expand(TreeItem item)
item - TreeItem - item to be expandedpublic void collapse(TreeItem item)
item - TreeItem - branch to collapse.public void selectItem(TreeItem item)
item - TreeItem - item to be selected
private int addToDisplayedList(TreeItem item,
int level)
item - TreeItem - item to be addedprivate void sync()
private boolean expandIconClick(TreeItem item)
item - TreeItem - toggle collapse/expand for this item.
public ActionEvent handlePenDown(int xc,
int yc)
handlePenDown in class BasicWidgetxc - int - x coordinate of pointyc - int - y coordinate of point
public ActionEvent handlePenMove(int xc,
int yc)
handlePenMove in class BasicWidgetxc - int - x coordinate of current pointyc - int - y coordinate of current point
public ActionEvent handlePenUp(int xc,
int yc)
handlePenUp in class BasicWidgetxc - int - x coordinate of current pointyc - int - y coordinate of current point
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||