Home » openjdk-7 » javax » swing » text » [javadoc | source]
abstract public class: TableView [javadoc | source]

All Implemented Interfaces:

Direct Known Subclasses:

Implements View interface for a table, that is composed of an element structure where the child elements of the element this view is responsible for represent rows and the child elements of the row elements are cells. The cell elements can have an arbitrary element structure under them, which will be built with the ViewFactory returned by the getViewFactory method.


This is implemented as a hierarchy of boxes, the table itself is a vertical box, the rows are horizontal boxes, and the cells are vertical boxes. The cells are allowed to span multiple columns and rows. By default, the table can be thought of as being formed over a grid (i.e. somewhat like one would find in gridbag layout), where table cells can request to span more than one grid cell. The default horizontal span of table cells will be based upon this grid, but can be changed by reimplementing the requested span of the cell (i.e. table cells can have independant spans if desired).

Nested Class Summary:
public class  TableView.TableRow  View of a row in a row-centric table. 
public class  TableView.TableCell   
Field Summary
 int[] columnSpans     
 int[] columnOffsets     
 SizeRequirements[] columnRequirements     
 Vector<TableRow> rows     
 boolean gridValid     
Fields inherited from javax.swing.text.BoxView:
majorAxis,  majorSpan,  minorSpan,  majorReqValid,  minorReqValid,  majorRequest,  minorRequest,  majorAllocValid,  majorOffsets,  majorSpans,  minorAllocValid,  minorOffsets,  minorSpans,  tempRect
Fields inherited from javax.swing.text.View:
BadBreakWeight,  GoodBreakWeight,  ExcellentBreakWeight,  ForcedBreakWeight,  X_AXIS,  Y_AXIS,  sharedBiasReturn
 public TableView(Element elem) 
    Constructs a TableView for the given element.
    elem - the element that this view is responsible for
Method from javax.swing.text.TableView Summary:
addFill,   calculateColumnRequirements,   calculateMinorAxisRequirements,   checkMultiColumnCell,   checkSingleColumnCell,   createTableCell,   createTableRow,   forwardUpdate,   getColumnCount,   getColumnSpan,   getColumnsOccupied,   getRow,   getRowCount,   getRowSpan,   getRowsOccupied,   getViewAtPosition,   invalidateGrid,   layoutColumns,   layoutMinorAxis,   replace,   updateGrid
Methods from javax.swing.text.BoxView:
baselineLayout,   baselineRequirements,   calculateMajorAxisRequirements,   calculateMinorAxisRequirements,   checkRequests,   childAllocation,   flipEastAndWestAtEnds,   forwardUpdate,   getAlignment,   getAxis,   getChildAllocation,   getHeight,   getMaximumSpan,   getMinimumSpan,   getOffset,   getPreferredSpan,   getResizeWeight,   getSpan,   getSpanOnAxis,   getViewAtPoint,   getWidth,   isAfter,   isAllocationValid,   isBefore,   isLayoutValid,   layout,   layoutChanged,   layoutMajorAxis,   layoutMinorAxis,   modelToView,   paint,   paintChild,   preferenceChanged,   replace,   setAxis,   setSize,   setSpanOnAxis,   updateChildSizes,   updateLayoutArray,   viewToModel
Methods from javax.swing.text.CompositeView:
childAllocation,   flipEastAndWestAtEnds,   getBottomInset,   getChildAllocation,   getInsideAllocation,   getLeftInset,   getNextEastWestVisualPositionFrom,   getNextNorthSouthVisualPositionFrom,   getNextVisualPositionFrom,   getRightInset,   getTopInset,   getView,   getViewAtPoint,   getViewAtPosition,   getViewCount,   getViewIndex,   getViewIndexAtPosition,   isAfter,   isBefore,   loadChildren,   modelToView,   modelToView,   replace,   setInsets,   setParagraphInsets,   setParent,   viewToModel
Methods from javax.swing.text.View:
append,   breakView,   changedUpdate,   createFragment,   forwardUpdate,   forwardUpdateToView,   getAlignment,   getAttributes,   getBreakWeight,   getChildAllocation,   getContainer,   getDocument,   getElement,   getEndOffset,   getGraphics,   getMaximumSpan,   getMinimumSpan,   getNextVisualPositionFrom,   getParent,   getPreferredSpan,   getResizeWeight,   getStartOffset,   getToolTipText,   getView,   getViewCount,   getViewFactory,   getViewIndex,   getViewIndex,   insert,   insertUpdate,   isVisible,   modelToView,   modelToView,   modelToView,   paint,   preferenceChanged,   remove,   removeAll,   removeUpdate,   replace,   setParent,   setSize,   updateChildren,   updateLayout,   viewToModel,   viewToModel
Methods from java.lang.Object:
clone,   equals,   finalize,   getClass,   hashCode,   notify,   notifyAll,   toString,   wait,   wait,   wait
Method from javax.swing.text.TableView Detail:
  void addFill(int row,
    int col) 
    Mark a grid location as filled in for a cells overflow.
  void calculateColumnRequirements(int axis) 
    Calculate the requirements for each column. The calculation is done as two passes over the table. The table cells that occupy a single column are scanned first to determine the maximum of minimum, preferred, and maximum spans along the give axis. Table cells that span multiple columns are excluded from the first pass. A second pass is made to determine if the cells that span multiple columns are satisfied. If the column requirements are not satisified, the needs of the multi-column cell is mixed into the existing column requirements. The calculation of the multi-column distribution is based upon the proportions of the existing column requirements and taking into consideration any constraining maximums.
 protected SizeRequirements calculateMinorAxisRequirements(int axis,
    SizeRequirements r) 
    Calculate the requirements for the minor axis. This is called by the superclass whenever the requirements need to be updated (i.e. a preferenceChanged was messaged through this view).

    This is implemented to calculate the requirements as the sum of the requirements of the columns.

  void checkMultiColumnCell(int axis,
    int col,
    int ncols,
    View v) 
    check the requirements of a table cell that spans multiple columns.
  void checkSingleColumnCell(int axis,
    int col,
    View v) 
    check the requirements of a table cell that spans a single column.
 protected TableCell createTableCell(Element elem) 
Deprecated! Table - cells can now be any arbitrary View implementation and should be produced by the ViewFactory rather than the table.

 protected TableRow createTableRow(Element elem) 
    Creates a new table row.
 protected  void forwardUpdate(ElementChange ec,
    DocumentEvent e,
    Shape a,
    ViewFactory f) 
 int getColumnCount() 
    The number of columns in the table.
 int getColumnSpan(int col) 
    Fetches the span (width) of the given column. This is used by the nested cells to query the sizes of grid locations outside of themselves.
 int getColumnsOccupied(View v) 
    Determines the number of columns occupied by the table cell represented by given element.
 TableRow getRow(int row) 
 int getRowCount() 
    The number of rows in the table.
 int getRowSpan(int row) 
    Fetches the span (height) of the given row.
 int getRowsOccupied(View v) 
    Determines the number of rows occupied by the table cell represented by given element.
 protected View getViewAtPosition(int pos,
    Rectangle a) 
    Fetches the child view that represents the given position in the model. This is implemented to walk through the children looking for a range that contains the given position. In this view the children do not necessarily have a one to one mapping with the child elements.
  void invalidateGrid() 
 protected  void layoutColumns(int targetSpan,
    int[] offsets,
    int[] spans,
    SizeRequirements[] reqs) 
    Lays out the columns to fit within the given target span. Returns the results through {@code offsets} and {@code spans}.
 protected  void layoutMinorAxis(int targetSpan,
    int axis,
    int[] offsets,
    int[] spans) 
    Perform layout for the minor axis of the box (i.e. the axis orthoginal to the axis that it represents). The results of the layout should be placed in the given arrays which represent the allocations to the children along the minor axis. This is called by the superclass whenever the layout needs to be updated along the minor axis.

    This is implemented to call the layoutColumns method, and then forward to the superclass to actually carry out the layout of the tables rows.

 public  void replace(int offset,
    int length,
    View[] views) 
    Change the child views. This is implemented to provide the superclass behavior and invalidate the grid so that rows and columns will be recalculated.
  void updateGrid() 
    Fill in the grid locations that are placeholders for multi-column, multi-row, and missing grid locations.