All Packages Class Hierarchy This Package Previous Next Index
Interface com.micronova.mnfc.IGridDef
- public interface IGridDef
IGridDef defines a 'grid' (rows and columns of 'cell's). A grid is defined
by specifying the following:
M: Number of 'cell's in X-direction
N: Number of 'cell's in Y-direction
x[0] < x[1] < ... < x[M]: (M + 1) boundary points in X-direction
y[0] < y[1] < ... < y[N]: (N + 1) boundary points in Y-direction
Each cell is indicated by its 'index' (i, j) (i = 0, 1, ..., M - 1; j = 0, 1, ..., N - 1). The cell at (i, j) is bounded by the rectangle (x, y, width, height) = (x[i], y[j], x[i + 1] - x[i], y[j + 1] - y[j]). This pixel rectangle is called the 'cell rectangle'.
A 'subgrid' is a rectangular subset of cells; e.g., a subgrid (0, 0, 2, 3) (based at (0, 0), width 2, height 3) indicates the set of 6 cells at (0, 0), (1, 0), (0, 1), (1, 1), (0, 2), (1, 2).
A subgrid can be made into a single cell by extendCell().
For each cell, IGridDef specifies how to draw it and/or put a subview
(called a 'cell view') there in drawCell().
An instance of IGridPane
actually draws a subgrid (called a 'pane') of IGridDef. Each IGridPane has
an index to indicate which subgrid it draws, and calls IGridDef's
getPaneRect() to find out which subgrid to draw.
IGridDef can also handle various events (MouseDown, etc.) happening
in each IGridPane displaying it.
- Version:
- 1.0
- Author:
- Makoto Nagata, MicroNova
-
delegatePane(int, IGridPane)
- Method delegation from each IGridPane displaying this IGridDef (see IView).
-
drawCell(IGridPane)
- Draws a cell.
-
extendCell(Rect)
- Extends a cell to have multiple row/column spans.
-
getPaneSubGrid(int)
- Defines the pane subgrid for each paneIndex.
-
getXCount()
- Number of cells in X direction.
-
getXPosition(int)
- Position of xIndex-th boundary point (0 <= xIndex <= getXCount()).
-
getYCount()
- Number of cells in Y direction.
-
getYPosition(int)
- Position of yIndex-th boundary point (0 <= yIndex <= getYCount()).
getXCount
public abstract int getXCount()
- Number of cells in X direction.
getYCount
public abstract int getYCount()
- Number of cells in Y direction.
getXPosition
public abstract int getXPosition(int xIndex)
- Position of xIndex-th boundary point (0 <= xIndex <= getXCount()).
getYPosition
public abstract int getYPosition(int yIndex)
- Position of yIndex-th boundary point (0 <= yIndex <= getYCount()).
extendCell
public abstract boolean extendCell(Rect subGrid)
- Extends a cell to have multiple row/column spans. This method is called for each cell (i, j) with subGrid = (i, j, 1, 1). In order to make a subgrid (x, y, w, h) into a single cell, set the subGrid to (w, y, w, h) for each cell (i, j) in the subgrid and return true. For non-spanned cells, simply return false without modifying the subGrid.
drawCell
public abstract View drawCell(IGridPane iGridPane)
- Draws a cell. If this returns a non-null View, it is added to the IGridPane as a subview. The following variables of iGridPane are set before this method is called:
- __g: Graphics object for drawing.
- __index: (i, j) if the cell to be drawn is at index (i, j)
- __subGrid: subgrid for index (i, j). This is usually (i, j, 1, 1), but
can be different if the cell is extended. (see extendCell()).
- __cellRect: pixel rectangle for the cell (in IGridPane's coordinates)
- __cellView: current cell view for this index. null if no cellView has
been created.
To have a cell view, check __cellView. If __cellView is not null,
simply update the view, size it according to __cellRect, and return it.
If __cellView is null, create a new View, size it according to __cellRect,
and return it. If you don't want a cell view at the cell
(regardless of current __cellView), return null.
getPaneSubGrid
public abstract Rect getPaneSubGrid(int paneIndex)
- Defines the pane subgrid for each paneIndex. IGridView defines 9 paneIndex values (IGridView.TOPLEFT ... IGridView.BOTTOMRIGHT).
delegatePane
public abstract void delegatePane(int command,
IGridPane iGridPane)
- Method delegation from each IGridPane displaying this IGridDef (see IView). For MOUSE_XXX delegation, __index is set to the cell index under mouse.
All Packages Class Hierarchy This Package Previous Next Index