|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectewe.ui.TableModel
| Nested Class Summary | |
class |
TableModel.CellControl
This class is used to contain and control a Control that is used to edit data within a Cell in the TableModel. |
static class |
TableModel.ControlProxy
|
| Field Summary | |
TableModel.CellControl |
activeCellControl
|
boolean |
allColumnsSameSize
This will result in an adjustment to one column affecting all columns. |
boolean |
allRowsSameSize
This will result in an adjustment to one row affecting all row. |
boolean |
canHScroll
Specifies whether the table can scroll horizontally. |
boolean |
canVScroll
Specifies whether the table can scroll vertically. |
Insets |
cellInsets
Set this to be the default insets for each cell. |
int |
charHeight
This is set to the height of the Font of the table once the control has been made. |
int |
charWidth
This is set to the width of the 'X' character of the Font of the table once the control has been made. |
boolean |
clipData
If this is true then the data will be clipped to fit into the cells. |
protected static TableModel.ControlProxy |
controlProxy
|
Dimension |
cursorSize
This specifies the size of the cursor, in cells. |
boolean |
fillToEqualHeights
Specifies whether the table should have all cell heights equal and fit exactly in the display area. |
boolean |
fillToEqualWidths
Specifies whether the table should have all cell widths equal and fit exactly in the display area. |
int |
gap
This is the gap (in pixels) between the data in a cell and its borders. |
boolean |
hasColumnHeaders
Specifies whether the table has column headers. |
boolean |
hasPreferredSize
Specifies whether the table has a preferred size. |
boolean |
hasRowHeaders
Specifies whether the table has row headers. |
boolean |
hasSpanningColumns
This must be set true if you have data in columns which span across multiple columns. |
boolean |
hasSpanningRows
This must be set true if you have data in rows which span across multiple rows. |
int |
horizontalScrollUnit
This specifies how many columns you can scroll as a unit. |
protected Insets |
insets
|
int |
numCols
The number of columns in the table. |
int |
numRows
The number of rows in the table. |
int |
preferredCols
|
int |
preferredRows
|
protected Rect |
rect
|
boolean |
selectRowWhenEditing
This tells the model to select the row of a cell whenever that cell is edited. |
boolean |
shadeAlternateRows
This will shade every other row. |
protected TableControl |
table
This is the table which contains the model. |
protected TableCellAttributes |
tca
|
int |
verticalScrollUnit
This specifies how many rows you can scroll as a unit. |
| Fields inherited from interface ewe.ui.UIConstants |
BDR_DOTTED, BDR_INNER, BDR_NOBORDER, BDR_OUTER, BDR_OUTLINE, BDR_RAISEDINNER, BDR_RAISEDOUTER, BDR_SUNKENINNER, BDR_SUNKENOUTER, 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 |
| Fields inherited from interface ewe.ui.CellConstants |
BORDER, BOTTOM, CELLFLAG, CELLMASK, CENTER, CONTROLMASK, DONTCHANGE, DONTFILL, DONTSTRETCH, EAST, FILL, FIXEDSIZE, GROW, HCENTER, HCONTRACT, HEXPAND, HFILL, HGROW, HSHRINK, HSTRETCH, INITIALLY_CLOSED, INITIALLY_MINIMIZED, INITIALLY_PREFERRED_SIZE, INSETS, LEFT, MAXIMUMSIZE, MINIMUMSIZE, NORTH, NORTHEAST, NORTHWEST, PREFERREDSIZE, RECT, RIGHT, SHRINK, SOUTH, SOUTHEAST, SOUTHWEST, SPAN, STRETCH, TEXTSIZE, TOP, VCENTER, VCONTRACT, VEXPAND, VFILL, VGROW, VSHRINK, VSTRETCH, WEST |
| Fields inherited from interface ewe.ui.ControlConstants |
All, AlwaysEnabled, AlwaysRecalculateSizes, ByDeferredMouse, ByDeferredPen, ByFrameChange, ByKeyboard, ByMouse, ByPen, ByRequest, CalculatedSizes, Disabled, DisablePopupMenu, DisplayOnly, Down, DrawFlat, Flag, ForceResize, HasData, Invisible, KeepImage, KeepSIP, Left, MakeMenuAtLeastAsWide, Maximize, Minimize, MouseSensitive, NoFocus, NotAnEditor, NotEditable, PaintDataOnly, PaintOutsideOnly, PenTransparent, PreferredSizeOnly, Right, SendUpKeyEvents, SendUpPenEvents, ShowSIP, ShrinkToNothing, SmallControl, SpecialBackground, TakeControlEvents, TakesKeyFocus, Transparent, Up, WantDrag, WantHoldDown |
| Constructor Summary | |
TableModel()
|
|
| Method Summary | |
int |
calculateColWidth(int col)
This returns the full width of the column. |
int |
calculateRowHeight(int row)
This returns the full height of the row. |
protected int |
calculateTextCharsInColumn(int col)
This is called by calculateColWidth(). |
protected int |
calculateTextLinesInRow(int row)
This is called by calculateColWidth(). |
boolean |
canScreenScroll()
This is used to report whether a quick pixel scroll can be done on the table. |
boolean |
canSelect(int row,
int col)
This should return whether or not a particular cell may be selected. |
protected boolean |
checkControlFor(Point onTable,
Point cell,
int how)
|
void |
clearCellAdjustments()
|
boolean |
closeActiveControl()
This tells the model to close any active control. |
protected void |
deferPaintTableCell(TableControl tc,
Graphics g,
int row,
int col)
|
boolean |
doHotKey(KeyEvent ev)
|
void |
findCellsInArea(Rect area,
boolean onlyCompletely)
This finds the range of cells in the given area. |
protected int |
fixBorder(int style,
int row,
int col,
boolean flat)
|
TableCellAttributes |
getCellAttributes(int row,
int col,
boolean isSelected,
TableCellAttributes ta)
Get the attributes for a cell. |
protected TableModel.CellControl |
getCellControlFor(Point cell)
Get a Control to edit data within a particular cell within a CellControl object. |
Object |
getCellData(int row,
int col)
This may return any object. |
Insets |
getCellInsets(int row,
int col,
Insets insets)
Get the insets of the data in the specified cell. |
Dimension |
getCellPreferredSize(int row,
int col,
FontMetrics fm,
Dimension dest)
|
boolean |
getCellRect(int row,
int col,
Rect dest)
Get the bounds of the specified cell within the table - with 0,0 being the upper left corner of cell(table.firstRow,table.firstCol) - Note that the headers are considered outside of the table in this case (header indexes are -1). |
Object |
getCellText(int row,
int col)
This may return a String or an array of Strings (for multiline text) or it may return null. |
int |
getColWidth(int col)
Do not override this. |
protected Control |
getControlFor(int row,
int col)
This is called by getCellControlFor() and is used to return a Control to allow editing of a cell's contents. |
protected String[] |
getLinesFor(Object obj)
|
protected int |
getMaxColWidth(int col)
If this returns -1 there will be no maximum. |
protected int |
getMaxRowHeight(int row)
If this returns -1 there will be no maximum. |
Menu |
getMenuFor(int row,
int col)
|
Menu |
getMenuOutsideCells(Point screenPoint)
|
protected int |
getMinColWidth(int col)
|
protected int |
getMinRowHeight(int row)
|
Dimension |
getPreferredSize(Dimension dest)
In order for this to do anything you must set "hasPreferredSize" to true. |
int |
getRowHeight(int row)
Do not override this. |
Object |
getToolTip(int x,
int y)
Return a Tool Tip for the x,y position (in pixels) on the table. |
boolean |
hasActiveControls()
|
protected void |
inset(int row,
int col,
Rect rect)
|
boolean |
isActiveCellControl(int row,
int column)
Returns if there is an active CellControl at the specified row and column. |
void |
made()
This is called after the TableControl has been made. |
protected void |
notifyDataChange(Point cell)
This is called by a CellControl when it gets a DataChanged event from its Control. |
void |
onEvent(Event ev)
|
boolean |
onKeyEvent(KeyEvent ev)
This is called by the TableControl before it processes the event. |
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. |
protected void |
paintTableCellData(TableControl tc,
Graphics g,
int row,
int col,
TableCellAttributes tca,
Rect r,
Object data)
Paint the data within the cell. |
protected void |
paintTableCellText(TableControl tc,
Graphics g,
int row,
int col,
TableCellAttributes tca,
Rect r,
Object text)
Paint the data within the cell. |
boolean |
penPressed(Point onTable,
Point cell)
If this returns true, then the TableControl will not process a pen press any further. |
boolean |
popupMenuEvent(MenuEvent ev)
|
protected void |
remapColumns(int[] oldPositions)
|
void |
resized(int width,
int height)
This is called after the TableControl has been resized. |
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 row,
int col,
boolean selectOn)
This is called by the table to tell the model that it wants to select a particular cell. |
protected void |
show(TableModel.CellControl cc,
int how)
|
protected void |
startedEditing(Point cell)
|
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, toString |
| Field Detail |
public int gap
public boolean clipData
public int numRows
public int numCols
public boolean hasColumnHeaders
public boolean hasRowHeaders
public boolean fillToEqualWidths
public boolean fillToEqualHeights
public boolean hasPreferredSize
public boolean canHScroll
public boolean canVScroll
protected TableControl table
public int horizontalScrollUnit
public int verticalScrollUnit
public boolean hasSpanningColumns
public boolean hasSpanningRows
public boolean shadeAlternateRows
public boolean allColumnsSameSize
public boolean allRowsSameSize
public int charWidth
public int charHeight
public int preferredRows
public int preferredCols
public Dimension cursorSize
public Insets cellInsets
protected TableCellAttributes tca
protected Rect rect
protected Insets insets
public TableModel.CellControl activeCellControl
public boolean selectRowWhenEditing
protected static TableModel.ControlProxy controlProxy
| Constructor Detail |
public TableModel()
| Method Detail |
public boolean hasActiveControls()
public void onEvent(Event ev)
onEvent in interface EventListener
public void select(int row,
int col,
boolean selectOn)
public boolean canScreenScroll()
public int scrollTo(int current,
int requested,
int scrollAction,
boolean horizontal)
protected final void remapColumns(int[] oldPositions)
public void clearCellAdjustments()
protected int getMinColWidth(int col)
protected int getMaxColWidth(int col)
protected int getMaxRowHeight(int row)
protected int getMinRowHeight(int row)
public final int getColWidth(int col)
public final int getRowHeight(int row)
protected int calculateTextCharsInColumn(int col)
protected int calculateTextLinesInRow(int row)
public int calculateColWidth(int col)
public int calculateRowHeight(int row)
public Insets getCellInsets(int row,
int col,
Insets insets)
public boolean getCellRect(int row,
int col,
Rect dest)
row - col - dest -
public Object getCellData(int row,
int col)
public Object getCellText(int row,
int col)
public Dimension getCellPreferredSize(int row,
int col,
FontMetrics fm,
Dimension dest)
public Dimension getPreferredSize(Dimension dest)
protected int fixBorder(int style,
int row,
int col,
boolean flat)
public boolean isActiveCellControl(int row,
int column)
public TableCellAttributes getCellAttributes(int row,
int col,
boolean isSelected,
TableCellAttributes ta)
public boolean canSelect(int row,
int col)
public void findCellsInArea(Rect area,
boolean onlyCompletely)
protected void inset(int row,
int col,
Rect rect)
public void paintTableCell(TableControl tc,
Graphics g,
int row,
int col)
protected void deferPaintTableCell(TableControl tc,
Graphics g,
int row,
int col)
public void paintTableCell(TableControl tc,
Graphics g,
Rect cells)
protected String[] getLinesFor(Object obj)
protected void paintTableCellData(TableControl tc,
Graphics g,
int row,
int col,
TableCellAttributes tca,
Rect r,
Object data)
protected void paintTableCellText(TableControl tc,
Graphics g,
int row,
int col,
TableCellAttributes tca,
Rect r,
Object text)
public void made()
public void resized(int width,
int height)
public Object getToolTip(int x,
int y)
Point cell = table.cellAtPoint(x,y,null);
if (cell == null) return null; //Not on a cell.
// Now cell.x will have the column and cell.y will have the row
// of the cell the mouse is over and you can then display a tool tip for that cell.
x - The x co-ordinate in pixels of the mouse.y - The y co-ordinate in pixels of the mouse.
public Menu getMenuFor(int row,
int col)
public Menu getMenuOutsideCells(Point screenPoint)
public boolean popupMenuEvent(MenuEvent ev)
public boolean penPressed(Point onTable,
Point cell)
public boolean closeActiveControl()
protected void startedEditing(Point cell)
public boolean onKeyEvent(KeyEvent ev)
public boolean doHotKey(KeyEvent ev)
protected final boolean checkControlFor(Point onTable,
Point cell,
int how)
protected final void show(TableModel.CellControl cc,
int how)
protected TableModel.CellControl getCellControlFor(Point cell)
cell - the cell the CellControl is for.
protected Control getControlFor(int row,
int col)
row - the row of the cell.col - the column of the cell.
protected void notifyDataChange(Point cell)
cell - the cell containing the Control. By default this will call notifyDataChange()
in the containing TableControl with the cause field being set to the Point indicating
the cell that the data was changed in.
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||