public class TreeTableModel extends TableModel
Modifier and Type | Class and Description |
---|---|
static class |
TreeTableModel.Column |
TableModel.CellControl, TableModel.ControlProxy
Modifier and Type | Field and Description |
---|---|
static int |
CanExpand
A Node status.
|
static IImage |
closedFolder |
static IIcon |
closedFolderIcon |
Vector |
cutNodes |
protected static int |
DepthMask |
boolean |
dontAdjustColumns |
boolean |
dynamicCanExpand
If this is true then the "canExpand" state of a node will be queried every time it is displayed.
|
IIcon[] |
expandControlIcons
If this is set it should be an array of 3 IIcon objects.
|
static IImage |
expandingIcon |
static IIcon |
expandingIconIcon |
Vector |
expandingNodes |
int |
expansionLevel
This is the default number of levels to expand to when the tree is newly displayed.
|
protected static int |
FlagMask |
static int |
HasChildren
A Node status.
|
boolean |
hasControls
This is used to indicate that nodes can have different sizes.
|
static int |
HasMoreSiblings
A Node status.
|
boolean |
hideRoot
Set this true to hide the Root node.
|
static int |
IsExpanded
A Node status.
|
static int |
IsNode
A Node status.
|
protected long[] |
matrix |
boolean |
multiSelectOneMustBeSelected |
static int |
NODE_SCREEN_STATUS_DRAW_AFTER_TEXT_ONLY |
static int |
NODE_SCREEN_STATUS_EXPANDING |
static int |
NODE_SCREEN_STATUS_MOUSE_OVER |
static int |
NODE_SCREEN_STATUS_SELECTED |
boolean |
noLines
If this is true then no lines connecting nodes will be drawn.
|
static IImage |
openFolder |
static IIcon |
openFolderIcon |
static IImage |
page |
static IIcon |
pageIcon |
protected static int |
PatternMask |
Vector |
ranges |
protected TreeNode |
rootObject |
Color |
selectedColor |
int |
selectedLine |
RangeList |
selectedLines |
boolean |
selectExpanded
If this is true then expanding/collapsing a node will automatically select that node.
|
boolean |
selectHighlightEntireLine |
boolean |
showWaitCursor
If this is true then the wait cursor will be shown when expanding node.
|
int |
slowExpansionWaitTime
If this is set to a non-negative value, then slow expansion will be used where the value of slowExpansionWaitTime
will be the number of milliseconds to wait on an expansion before displaying the expanding symbol.
|
String |
treeColumnHeader |
int |
treeWidth
This is only used if numExtraColumns is used and it specifies
the width of the are allocated to the tree.
|
activeCellControl, allColumnsSameSize, allRowsSameSize, canHScroll, canMoveColumnHeaders, canVScroll, cellInsets, charHeight, charWidth, clipData, colAdjustments, controlProxy, cursorSize, fillToEqualHeights, fillToEqualWidths, gap, hasColumnHeaders, hasPreferredSize, hasRowHeaders, hasSpanningColumns, hasSpanningRows, horizontalScrollUnit, keepSIP, mouseIsOverCell, numCols, numRows, preferredCols, preferredRows, selectRowWhenEditing, shadeAlternateRows, shadeColor, table, verticalScrollUnit
BDR_DOTTED, BDR_INNER, BDR_NOBORDER, BDR_OUTER, BDR_OUTLINE, BDR_RAISEDINNER, BDR_RAISEDOUTER, BDR_SUNKENINNER, BDR_SUNKENOUTER, BF_ABUT_ANY, BF_ABUT_BOTTOM, BF_ABUT_LEFT, BF_ABUT_RIGHT, BF_ABUT_TOP, BF_BOTTOM, BF_BOTTOMLEFT, BF_BOTTOMRIGHT, BF_BUTTON, BF_DIAGONAL, BF_DIAGONAL_ENDBOTTOMLEFT, BF_DIAGONAL_ENDBOTTOMRIGHT, BF_DIAGONAL_ENDTOPLEFT, BF_DIAGONAL_ENDTOPRIGHT, BF_EXACT, BF_FLAT, BF_LEFT, BF_MIDDLE, BF_MONO, BF_PALM, BF_RECT, BF_RIGHT, BF_SOFT, BF_SQUARE, BF_TOP, BF_TOPLEFT, BF_TOPRIGHT, EDGE_BUMP, EDGE_ETCHED, EDGE_RAISED, EDGE_SUNKEN
ALWAYS_STRETCHABLE, BOTTOM, CELLFLAG, CELLMASK, CENTER, CONTROLMASK, DONTCHANGE, DONTFILL, DONTSTRETCH, EAST, FILL, GROW, HCENTER, HCONTRACT, HEXPAND, HFILL, HGROW, HSHRINK, HSTRETCH, INITIALLY_CLOSED, INITIALLY_HIDDEN, INITIALLY_MINIMIZED, INITIALLY_PREFERRED_SIZE, INSETS, LEFT, MAXIMUMSIZE, MINIMUMSIZE, NORTH, NORTHEAST, NORTHWEST, PREFERREDSIZE, RECT, RIGHT, SHRINK, SOUTH, SOUTHEAST, SOUTHWEST, SPAN, STRETCH, TAG_BACKGROUND_IMAGE, TAG_BUSY_DISPLAY, TAG_COLORS, TAG_CONTROL_PAINTER, TAG_EXPOSE_GROUP, TAG_FIXEDSIZE, TAG_GRAY_BACKGROUND, TAG_HIDE_CONTROL_OBJECT, TAG_HIDE_PARENT, TAG_INNER_TEXT_INSETS, TAG_INPUT_STACK_PARENT, TAG_INSETS, TAG_MAKE_VISIBLE, TAG_MAXIMUMSIZE, TAG_MINIMUMSIZE, TAG_PAINT_CONTROL_LIST, TAG_PREFERRED_TEXT_SIZE, TAG_PREFERRED_TEXT_SIZE_HEIGHT, TAG_PREFERRED_TEXT_SIZE_WIDTH, TAG_PREFERREDSIZE, TAG_RECT, TAG_SHADOW_INSETS, TAG_SPAN, TAG_SWIPER, TAG_TEMPORARY_ERROR, TAG_TEXT_INSETS, TAG_TEXTSIZE, TEXTSIZE, TOP, VCENTER, VCONTRACT, VEXPAND, VFILL, VGROW, VSHRINK, VSTRETCH, WEST
All, AlwaysEnabled, AlwaysRecalculateSizes, ByDeferredMouse, ByDeferredPen, ByFrameChange, ByKeyboard, ByMouse, ByPen, ByRequest, CalculatedSizes, ContainerDontPaintChildren, Disabled, DisablePopupMenu, DisplayOnly, DontBuffer, Down, DrawFlat, Flag, ForceResize, HasData, Invisible, KeepImage, KeepSIP, Left, MakeMenuAtLeastAsWide, Maximize, Minimize, ModifiersInheritedFromWindow, MouseSensitive, NoFocus, NotAnEditor, NotEditable, PaintDataOnly, PaintOutsideOnly, PenTransparent, PreferredSizeOnly, Right, SendUpUIEvents, ShowSIP, ShrinkToNothing, SmallControl, TakeChildUIEvents, TakeControlEvents, TakesKeyFocus, Transparent, Up, WantDrag, WantHoldDown
Constructor and Description |
---|
TreeTableModel() |
Modifier and Type | Method and Description |
---|---|
TreeTableModel |
addExtraColumn(double startPercent,
String field,
String header,
int textWidth) |
int[] |
addressOf(int line)
Find the address of the line.
|
int[] |
addressOf(TreeNode tn)
Return the address of the TreeNode relative to the root TreeNode.
|
int |
calculateColWidth(int col)
This returns the full width of the column.
|
protected int |
calculateExtraColWidth(int extraColIndex) |
int |
calculateRowHeight(int row)
This returns the full height of the row.
|
void |
calculateSizes()
This is called after the TableControl has been made.
|
boolean |
canDoCollapse(int index)
Returns if the item at the specified index can be collapsed.
|
boolean |
canDoExpand(int index)
Returns if the item at the specified index can be expanded.
|
boolean |
canScreenScroll(boolean horizontally)
This is used to report whether a quick pixel scroll can be done on the table.
|
void |
clicked(Point where) |
int |
collapse(int whichIndex)
Collapse the index.
|
protected int |
collapseMatrix(int parent) |
protected void |
collapsing(TreeNode node) |
int |
columnOf(int index)
Returns the column which contains the '+'/'-' box of the entry at
the following index.
|
int |
countChildren(int parent)
Return the number of children for a node at the specified index.
|
int |
countSelectedLines() |
int |
countTotalChildNodes(int parent)
Count all child nodes of a parent, including children of its children and so on.
|
int |
delete(int line,
int length)
Remove a set of entries.
|
boolean |
deleted(TreeNode parent,
int previousIndexOfDeletedChild)
This assumes you are using TreeNode objects with the control.
|
int |
doCollapse(int whichIndex) |
int |
doExpand(int whichIndex) |
int |
doExpand(int whichIndex,
TreeNode node)
Override this to do expansion.
|
void |
doubleClicked(int line)
By default this will call notifyAction() if the line is already selected.
|
void |
doubleClicked(Point where) |
void |
drawNodeData(FontMetrics fm,
Graphics g,
int line,
Rect where,
Rect whereInTable,
TreeNode node) |
void |
drawNodeLine(Graphics g,
Rect r,
boolean nextTo,
int flags,
int row,
TreeNode node) |
int |
expand(int whichIndex,
long[] with,
byte[] flags)
Expand the index with the list of object references and the list
of flags.
|
protected void |
expanding(TreeNode node) |
protected void |
expandMatrix(int afterIndex,
int length) |
static void |
expandSlowNode(TreeNode node,
int waitBeforeThrowing) |
int |
expandTo(int[] address)
This will expand down the tree until the address specified is displayed.
|
int |
expandTo(int[] address,
boolean selectIt)
This will expand down the tree until the address specified is displayed.
|
void |
expandToLevel(int level)
This expands the tree a specified number of levels deep, below the root.
|
int |
findChild(int parent,
int whichChild)
Find the child within the parent.
|
int |
findNextSibling(int where)
Find the next sibling.
|
int |
findParent(int where)
Find the parent.
|
protected int |
findParentOrPreviousSibling(int where,
boolean parent) |
int |
findPreviousSibling(int where)
Find the previous sibling.
|
void |
fireSelection() |
int |
flagsAt(int line)
Returns the flags of the line.
|
protected void |
freeReusedIcon(Icon r) |
void |
fullExpandCollapse(int line)
This will either expand or collapse a node depending on its current state.
|
int |
getColumnCount()
Return the number of extra columns.
|
Vector |
getColumns()
Return the extra columns, if any, associated with the tree control.
|
Object |
getDataObjectAt(int line)
This returns getTreeNodeAt(line).
|
boolean |
getDataToDragAndDrop(DragContext dc) |
Object |
getDataToTransfer() |
int |
getDataWidth(int line) |
int |
getDepthOf(int line) |
int |
getDisplayStatus(int forLine)
Get the display status for the specified line.
|
String |
getDisplayString(int forLine,
TreeNode node) |
protected int |
getDrawOptions(int line,
TreeNode node) |
protected TableCellAttributes |
getExtraColumnHeader(int extraIndex,
boolean isSelected,
TableCellAttributes ta) |
byte |
getFlags(int forLine,
TreeNode node) |
Color |
getFontColor(int forLine,
TreeNode node,
int lineOptions) |
int |
getHeightOfObject(Object obj) |
IImage |
getIcon(int forLine,
TreeNode node) |
Menu |
getMenuFor(int line) |
Color |
getNodeBackgroundColor(int forLine,
TreeNode node,
int lineOptions)
If this value is set then it is used for painting nodes.
|
protected TreeNode |
getNodeToCollapse(int whichIndex)
This is called by the default doExpand().
|
protected TreeNode |
getNodeToExpand(int whichIndex)
This is called by the default doExpand().
|
protected Icon |
getReusedIcon() |
TreeNode |
getRootObject() |
int[] |
getSelectedLines() |
RangeList |
getSelectedRanges() |
Rect |
getTextRect(int index,
Rect dest) |
Object |
getToolTip(int line)
This is called by getToolTip(x,y) and should return a ToolTip for the specified line.
|
Object |
getToolTip(int x,
int y)
This will call getToolTip(int line) if it determines that the x and y
point are on a displayed node/leaf.
|
protected TableCellAttributes |
getTreeColumnHeader(boolean isSelected,
TableCellAttributes ta) |
protected TreeModelHandler |
getTreeModelHandler()
If the rootObject implements TreeModelHandler, this will return it,
otherwise it returns null.
|
TreeNode |
getTreeNodeAt(int index) |
int |
indexOf(int[] address)
Finds the index of the address specified.
|
int |
indexOf(TreeNode node)
Return the line of the specified node IF it is displayed.
|
void |
init(long rootObjectRef,
byte flags) |
int |
insert(int parent,
int asChild,
long[] what,
byte[] flags)
This will only insert IF there are already children.
|
boolean |
inserted(TreeNode parent,
TreeNode child,
boolean selectChild)
This assumes you are using TreeNode objects with the control.
|
boolean |
isCut(TreeNode node) |
boolean |
isSelected(int index) |
void |
made() |
protected void |
modify(int start,
int length,
int on,
int off) |
protected void |
mouseOverChanged(Point was,
Point isNow) |
long |
objectAt(int line)
Find the object reference number of the line.
|
void |
paintColumnHeader(TableControl tc,
Graphics g,
TreeTableModel.Column c,
int height) |
protected void |
paintColumnHeaders(TableControl tc,
Graphics g,
Rect cells)
This paints a matrix of cells that will only include the column header row (-1).
|
protected void |
paintEntireColumnHeaders(TableControl tc,
Graphics g,
int width,
int height) |
void |
paintLine(int line) |
void |
paintLine(TableControl tc,
Graphics gr,
int line) |
void |
paintTableCell(TableControl tc,
Graphics g,
int row,
int col)
The real biz.
|
void |
paintTableCell(TableControl tc,
Graphics g,
Rect cells)
This paints a matrix of cells.
|
void |
pressed(Point whichCell) |
void |
pressed(Point pixelPointOnTable,
Point whichCell) |
void |
reExpandNode(int index)
This will cause the selected Node to be collapsed and then expanded again.
|
void |
reExpandSelectedNode()
This will cause the selected Node to be collapsed and then expanded again.
|
void |
released(Point where) |
protected int |
removeEntries(int start,
int toRemove)
If you override this to react to a remove, then make sure you call this.
|
void |
scrolled(TableControl table,
int newFirstRow,
int newFirstCol,
int oldFirstRow,
int oldFirstCol) |
int |
scrollTo(int current,
int requested,
int scrollAction,
boolean horizontal)
This is called by the table to tell the model that it wants to scroll either
vertically or horizontally.
|
void |
select(int line)
Selects the specified line.
|
void |
select(int index,
boolean selected) |
void |
select(TreeNode node)
This will select a specific tree node, expanding the tree if necessary to display the node.
|
void |
selectAll(boolean selectOn)
This either clears the selection or selects all.
|
void |
selectOnly(int line)
Select an item - this does not fire a selection event.
|
void |
setRootObject(TreeNode root) |
void |
setSelectedLines(int[] all) |
protected int |
shrunk(int byHowMany) |
byte |
toFlags(TreeNode what)
This determines from the TreeNode whether it is a leaf and whether it can expand.
|
long |
toReference(TreeNode what)
Creates a reference for the TreeNode.
|
void |
update()
Call this if you have changed the tree data structure -
this updates the TreeControl containing this model with an automatic
repaint.
|
void |
updateFlags(int line,
byte newFlags)
This changes the flags for the node on a line.
|
acceptColumnMoved, calculatePreferredColWidth, calculatePreferredRowHeight, calculatePreferredSize, calculateTextCharsInColumn, calculateTextLinesInRow, canSelect, checkControlFor, clearCellAdjustments, clearColumnWidthAdjustments, clearSelectionOnClick, closeActiveControl, columnMoved, deferPaintTableCell, doHotKey, editNow, editNow, endEditing, findCellsInArea, fixBorder, freezeUpdate, getCellAttributes, getCellControlFor, getCellData, getCellInsets, getCellPreferredSize, getCellRect, getCellText, getCellText, getColWidth, getColXPointInTable, getControlFor, getLock, getMaxColWidth, getMaxRowHeight, getMenuFor, getMenuOutsideCells, getMinColWidth, getMinRowHeight, getPreferredSize, getRowHeight, getRowYPointInTable, getTable, handleEvent, hasActiveControls, hasCellControlFor, inset, isActiveCellControl, makeActiveControlVisible, mouseMoving, notifyDataChange, onEvent, onKeyEvent, paintTableCellData, paintTableCellText, penClicked, penPressed, popupMenuEvent, positionCellControl, remapColumns, resized, restoreColumnWidthAdjustments, saveColumnWidthAdjustments, select, setColAdjust, setColWidth, show, showingMenuFor, sizeColumnToFitData, startedEditing, updateControls
public int treeWidth
protected long[] matrix
protected TreeNode rootObject
public IIcon[] expandControlIcons
public boolean noLines
public boolean selectExpanded
public boolean showWaitCursor
public boolean dynamicCanExpand
public boolean hasControls
public int expansionLevel
public boolean hideRoot
public boolean selectHighlightEntireLine
public int slowExpansionWaitTime
public static IImage expandingIcon
public static IIcon expandingIconIcon
public int selectedLine
public RangeList selectedLines
public Vector ranges
public Vector cutNodes
public Vector expandingNodes
public static final int IsNode
public static final int CanExpand
public static final int HasMoreSiblings
public static final int IsExpanded
public static final int HasChildren
protected static final int FlagMask
protected static final int DepthMask
protected static final int PatternMask
public static IImage openFolder
public static IImage closedFolder
public static IImage page
public static IIcon openFolderIcon
public static IIcon closedFolderIcon
public static IIcon pageIcon
public Color selectedColor
public static final int NODE_SCREEN_STATUS_SELECTED
public static final int NODE_SCREEN_STATUS_MOUSE_OVER
public static final int NODE_SCREEN_STATUS_EXPANDING
public static final int NODE_SCREEN_STATUS_DRAW_AFTER_TEXT_ONLY
public String treeColumnHeader
public boolean multiSelectOneMustBeSelected
public boolean dontAdjustColumns
public boolean canScreenScroll(boolean horizontally)
TableModel
canScreenScroll
in class TableModel
horizontally
- true if a check on horizontal scrolling is being done, false
if a check on vertical scrolling is being done.public void scrolled(TableControl table, int newFirstRow, int newFirstCol, int oldFirstRow, int oldFirstCol)
scrolled
in class TableModel
public byte toFlags(TreeNode what)
public long toReference(TreeNode what)
protected TreeModelHandler getTreeModelHandler()
public void setRootObject(TreeNode root)
public TreeNode getRootObject()
public int scrollTo(int current, int requested, int scrollAction, boolean horizontal)
scrollTo
in class TableModel
protected void expandMatrix(int afterIndex, int length)
public int countChildren(int parent)
public int countTotalChildNodes(int parent)
protected int removeEntries(int start, int toRemove)
protected int collapseMatrix(int parent)
public void init(long rootObjectRef, byte flags)
protected int shrunk(int byHowMany)
protected void modify(int start, int length, int on, int off)
public int findNextSibling(int where)
public int findPreviousSibling(int where)
public int findParent(int where)
public int findChild(int parent, int whichChild)
public int indexOf(int[] address)
public int[] addressOf(TreeNode tn)
public int columnOf(int index)
public int expandTo(int[] address)
public void expandToLevel(int level)
level
- The number of levels below the root to display.public int expandTo(int[] address, boolean selectIt)
public void select(TreeNode node)
node
- the node to select.protected int findParentOrPreviousSibling(int where, boolean parent)
public int collapse(int whichIndex)
public int expand(int whichIndex, long[] with, byte[] flags)
public int delete(int line, int length)
public int insert(int parent, int asChild, long[] what, byte[] flags)
public long objectAt(int line)
public int flagsAt(int line)
public void updateFlags(int line, byte newFlags)
public int[] addressOf(int line)
public static void expandSlowNode(TreeNode node, int waitBeforeThrowing) throws SlowTaskException
SlowTaskException
protected TreeNode getNodeToExpand(int whichIndex)
protected TreeNode getNodeToCollapse(int whichIndex)
public boolean canDoExpand(int index)
public boolean canDoCollapse(int index)
protected void expanding(TreeNode node) throws SlowTaskException
SlowTaskException
protected void collapsing(TreeNode node)
public int doExpand(int whichIndex)
public int doExpand(int whichIndex, TreeNode node)
public TreeNode getTreeNodeAt(int index)
public int indexOf(TreeNode node)
public int doCollapse(int whichIndex)
public boolean deleted(TreeNode parent, int previousIndexOfDeletedChild)
public boolean inserted(TreeNode parent, TreeNode child, boolean selectChild)
public int getDisplayStatus(int forLine)
forLine
- public byte getFlags(int forLine, TreeNode node)
public int calculateRowHeight(int row)
TableModel
calculateRowHeight
in class TableModel
public int getHeightOfObject(Object obj)
protected int calculateExtraColWidth(int extraColIndex)
public int calculateColWidth(int col)
TableModel
calculateColWidth
in class TableModel
public boolean isCut(TreeNode node)
protected int getDrawOptions(int line, TreeNode node)
public int getDataWidth(int line)
protected Icon getReusedIcon()
protected void freeReusedIcon(Icon r)
public Color getNodeBackgroundColor(int forLine, TreeNode node, int lineOptions)
public void drawNodeData(FontMetrics fm, Graphics g, int line, Rect where, Rect whereInTable, TreeNode node)
public void drawNodeLine(Graphics g, Rect r, boolean nextTo, int flags, int row, TreeNode node)
public void paintTableCell(TableControl tc, Graphics g, int row, int col)
TableModel
paintTableCell
in class TableModel
public void paintLine(int line)
public void paintLine(TableControl tc, Graphics gr, int line)
public int getDepthOf(int line)
public void paintColumnHeader(TableControl tc, Graphics g, TreeTableModel.Column c, int height)
protected void paintEntireColumnHeaders(TableControl tc, Graphics g, int width, int height)
protected void paintColumnHeaders(TableControl tc, Graphics g, Rect cells)
tc
- The TableControl for the TableModel.g
- the Graphics to draw on.cells
- the x and y value of this specifies the column and row co-ordinate
of the first cell to paint. The width and height give the width and height in
pixels that should be painted.public void paintTableCell(TableControl tc, Graphics g, Rect cells)
TableModel
paintTableCell
in class TableModel
tc
- The TableControl for the TableModel.g
- the Graphics to draw on.cells
- the x and y value of this specifies the column and row co-ordinate
of the first cell to paint. The width and height give the width and height in
pixels that should be painted.public void fullExpandCollapse(int line)
public Object getDataObjectAt(int line)
public Object getDataToTransfer()
public boolean getDataToDragAndDrop(DragContext dc)
public void clicked(Point where)
public Object getToolTip(int x, int y)
getToolTip
in class TableModel
x
- The x co-ordinate in pixels of the mouse.y
- The y co-ordinate in pixels of the mouse.public Object getToolTip(int line)
line
- the line the mouse is over.public void selectOnly(int line)
line
- the index of the line to select.public void released(Point where)
public void pressed(Point whichCell)
public void doubleClicked(int line)
line
- the line that is double clicked.public void doubleClicked(Point where)
public void fireSelection()
public void select(int index, boolean selected)
public int countSelectedLines()
public RangeList getSelectedRanges()
public int[] getSelectedLines()
public boolean isSelected(int index)
public void selectAll(boolean selectOn)
public void setSelectedLines(int[] all)
public void select(int line)
public void update()
public void calculateSizes()
TableModel
calculateSizes
in class TableModel
public void made()
made
in class TableModel
public void reExpandSelectedNode()
public void reExpandNode(int index)
public Menu getMenuFor(int line)
protected void mouseOverChanged(Point was, Point isNow)
mouseOverChanged
in class TableModel
protected TableCellAttributes getExtraColumnHeader(int extraIndex, boolean isSelected, TableCellAttributes ta)
protected TableCellAttributes getTreeColumnHeader(boolean isSelected, TableCellAttributes ta)
public Vector getColumns()
public int getColumnCount()
public TreeTableModel addExtraColumn(double startPercent, String field, String header, int textWidth)