|
Diamond Control Suite 3.0 | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object java.awt.Component java.awt.Container javax.swing.JComponent javax.swing.JTable diamondedge.swing.grid.DsTable
public class DsTable
A class which implements many common functions used in DsGrid and other tables
Nested Class Summary | |
---|---|
static class |
DsTable.BooleanEditor
|
static class |
DsTable.BooleanRenderer
|
static class |
DsTable.ComponentEditor
|
static class |
DsTable.ComponentRenderer
|
static class |
DsTable.DateEditor
|
static class |
DsTable.ListEditor
|
static class |
DsTable.TableEditor
|
Nested classes/interfaces inherited from class javax.swing.JTable |
---|
JTable.AccessibleJTable, JTable.DropLocation, JTable.PrintMode |
Nested classes/interfaces inherited from class javax.swing.JComponent |
---|
JComponent.AccessibleJComponent |
Nested classes/interfaces inherited from class java.awt.Container |
---|
Container.AccessibleAWTContainer |
Nested classes/interfaces inherited from class java.awt.Component |
---|
Component.AccessibleAWTComponent, Component.BaselineResizeBehavior, Component.BltBufferStrategy, Component.FlipBufferStrategy |
Field Summary | |
---|---|
protected boolean |
cellsEditable
|
protected boolean |
spannedCells
|
Fields inherited from class javax.swing.JComponent |
---|
accessibleContext, listenerList, TOOL_TIP_TEXT_KEY, ui, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOW |
Fields inherited from class java.awt.Component |
---|
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT |
Fields inherited from interface diamondedge.swing.DsConstants |
---|
ACCOUNTING, ALL, ASCENDING, ASCENDING_CASE, BORDER_BOTTOM, BORDER_LEFT, BORDER_NONE, BORDER_OUTLINE, BORDER_RIGHT, BORDER_TOP, CROSS_LINES, DASH, DASH_DOT, DASH_DOT_DOT, DEFAULT, DESCENDING, DESCENDING_CASE, DIAGONAL_CROSS_LINES, DOT, DOUBLE, DOUBLE_LINE, DOWNWARD_DIAGONAL_LINES, ETCHED, ETCHED_RAISED, FALSE, FIND_ALL, FIND_EQUALS, FIND_GT, FIND_GTE, FIND_LT, FIND_LTE, FIND_NE, FIND_PREFIX, FIND_REGEX, FIND_STRING, FIRST, FLAT, GRID_DASH, GRID_DASH_DOT, GRID_DASH_DOT_DOT, GRID_DOT, GRID_LINE, HIGHLIGHT_SELECTION_ALWAYS, HIGHLIGHT_SELECTION_NEVER, HIGHLIGHT_SELECTION_WITH_FOCUS, HORIZONTAL_LINES, LOWERED, LOWERED_LIGHT, NONE, RAISED, RAISED_LIGHT, SELECT_CELL, SELECT_NONE, SELECT_ROW, SINGLE, SINGLE_LINE, SOLID, STRETCH, TILE, TRANSPARENT, TRUE, UPWARD_DIAGONAL_LINES, VERTICAL_LINES |
Fields inherited from interface javax.swing.SwingConstants |
---|
BOTTOM, CENTER, EAST, HORIZONTAL, LEADING, LEFT, NEXT, NORTH, NORTH_EAST, NORTH_WEST, PREVIOUS, RIGHT, SOUTH, SOUTH_EAST, SOUTH_WEST, TOP, TRAILING, VERTICAL, WEST |
Fields inherited from interface java.awt.image.ImageObserver |
---|
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH |
Method Summary | |
---|---|
TableColumn |
addColumn()
Adds a column to the end. |
TableColumn |
addColumn(String columnName,
String id)
Adds a column to the end with the given name (HeaderValue) and identifier. |
void |
addColumn(TableColumn aColumn)
Appends aColumn to the end of the array of columns held by the column model. |
int |
calculateColumnWidthToFit(int column,
boolean fitName,
boolean fitData)
Returns the width of the column at the given index needed to fit the text for the name of the column and/or the data in cells in that column. |
int |
calculateWidthToFit(boolean fitColumnNames,
boolean fitColumnData)
Returns the total width of the table needed to fit the text for the name of the column and/or the data in cells in that column for each column in the table. |
int |
columnAtPoint(Point point)
|
void |
columnSelectionChanged(ListSelectionEvent e)
|
protected DsCell |
createCell()
Returns a new DsCell. |
void |
createDefaultColumnsFromModel()
|
protected void |
createDefaultEditors()
|
protected void |
createDefaultRenderers()
|
protected JTableHeader |
createDefaultTableHeader()
|
DsCell |
getCellAt(int row,
int col)
Returns the cell at the given row and column. |
protected int |
getCellColumnSpan(int row,
int column)
|
TableCellEditor |
getCellEditor(int row,
int column)
|
Rectangle |
getCellRect(int row,
int column,
boolean includeSpacing)
|
TableCellRenderer |
getCellRenderer(int row,
int column)
|
protected int |
getCellRowSpan(int row,
int column)
|
DsCellRange |
getCells(int firstRow,
int firstColumn,
int lastRow,
int lastColumn)
Returns a range of cells in between and including the specified cell corners. |
Object |
getCellValueAt(int row,
int col)
Returns the contents/object for the cell at the given row and column. |
TableColumn |
getColumn(int index)
Returns the TableColumn object for the column at the given position. |
TableColumn |
getColumn(String columnId)
|
int |
getColumnCount()
Returns the total number of columns. |
DsTableColumnHeader |
getColumnHeader()
Returns the column header. |
Color |
getColumnHeaderBackground()
Returns the background color of the column header. |
Font |
getColumnHeaderFont()
Returns the Font for the column headers |
Color |
getColumnHeaderForeground()
Returns the color used to draw text of the column header. |
int |
getColumnHeaderHeight()
Returns the height of the column header. |
int |
getColumnIndex(String columnId)
Returns the column index for the column that has the given identifier or column name. |
String |
getColumnName(int column)
Returns the object used to get the text displayed in the given column header. |
DsCellProperties |
getColumnProperties(int col)
Returns the default cell containing the default properties for the column. |
DsCellRange |
getColumns(int firstColumn,
int lastColumn)
Returns a range of cells that includes all cells in the specified columns. |
int |
getColumnWidth(int index)
Determines the width of the specified column in pixels. |
DsCellRange |
getRows(int firstRow,
int lastRow)
Returns a range of cells that includes all cells in the specified rows. |
protected static JScrollPane |
getScrollPane(JTable table)
|
String |
getToolTipText(MouseEvent event)
Overrides JComponent 's getToolTipText
method in order to allow the cell's tips to be used
if it has text set. |
void |
hideColumn(int index)
Removes from the view the column at the given position. |
boolean |
isCellEditable(int row,
int column)
Returns true if the cell at row and column is editable. |
boolean |
isColumnReorderingAllowed()
Returns true if the user is allowed to rearrange columns by dragging their headers, false otherwise. |
boolean |
isColumnResizingAllowed()
Returns true if the user is allowed to resize columns by dragging between their headers, false otherwise. |
boolean |
isEditable()
Returns whether any cell can be edited by the user. |
void |
removeSpan(int row,
int column)
Makes the cell at position row, column not span
across multiple rows and/or columns. |
int |
rowAtPoint(Point point)
|
void |
setColumnCount(int val)
Sets the total number of columns by adding new columns or removing existing ones. |
void |
setColumnHeaderBackground(Color val)
Sets the background color of the column header. |
void |
setColumnHeaderFont(Font f)
Sets the Font for the column headers |
void |
setColumnHeaderForeground(Color val)
Sets the color used to draw text of the column header. |
void |
setColumnHeaderHeight(int height)
Sets the height of the column header. |
void |
setColumnHorizontalAlignment(int column,
int align)
Sets the horizontal alignment of the text in the column header. |
void |
setColumnName(int column,
String val)
Sets the text displayed in the column header. |
void |
setColumnReorderingAllowed(boolean reorderingAllowed)
Shortcut to set whether the user can drag column headers to reorder columns. |
void |
setColumnResizingAllowed(boolean resizingAllowed)
Shortcut to set whether the user can resize columns by dragging between headers. |
void |
setColumnVerticalAlignment(int column,
int align)
Sets the vertical alignment of the text in the column header. |
void |
setColumnWidth(int index,
int width)
Sets the width of the column at the given index to width . |
void |
setColumnWidth(String columnId,
int width)
|
void |
setColumnWidthToFit(int column,
boolean fitName,
boolean fitData)
Sets the width of the column at the given index to fit the text for the name of the column and/or the data in cells in that column. |
void |
setEditable(boolean cellsCanBeEdited)
Set whether any cell can be edited by the user. |
boolean |
spanCells(int startRow,
int startColumn,
int rowsToSpan,
int columnsToSpan)
Makes the cell at position startRow, startColumn span
across rowsToSpan rows and columnsToSpan columns. |
void |
tableChanged(TableModelEvent e)
Invoked when this table's TableModel generates
a TableModelEvent . |
void |
updateUI()
|
void |
valueChanged(ListSelectionEvent e)
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
protected boolean cellsEditable
protected boolean spannedCells
Method Detail |
---|
public void updateUI()
updateUI
in class JTable
protected static JScrollPane getScrollPane(JTable table)
public final boolean isEditable()
public void setEditable(boolean cellsCanBeEdited)
public boolean isCellEditable(int row, int column)
isCellEditable
in class JTable
setEditable(boolean)
public DsCell getCellAt(int row, int col)
createCell()
protected DsCell createCell()
public Object getCellValueAt(int row, int col)
public DsCellRange getCells(int firstRow, int firstColumn, int lastRow, int lastColumn)
firstRow
- the first row in the range of cellsfirstColumn
- the first column in the range of cellslastRow
- the last row in the range of cellslastColumn
- the last column in the range of cellspublic DsCellRange getRows(int firstRow, int lastRow)
firstRow
- the first row in the range of cellslastRow
- the last row in the range of cells (inclusive)public DsCellRange getColumns(int firstColumn, int lastColumn)
firstColumn
- the first column in the range of cellslastColumn
- the last column in the range of cells (inclusive)public final DsTableColumnHeader getColumnHeader()
JTable.getTableHeader()
public final Font getColumnHeaderFont()
public void setColumnHeaderFont(Font f)
public final Color getColumnHeaderBackground()
public void setColumnHeaderBackground(Color val)
public final Color getColumnHeaderForeground()
public void setColumnHeaderForeground(Color val)
public final int getColumnHeaderHeight()
public void setColumnHeaderHeight(int height)
public void setColumnReorderingAllowed(boolean reorderingAllowed)
JTableHeader.setReorderingAllowed(boolean)
public final boolean isColumnReorderingAllowed()
JTableHeader.getReorderingAllowed()
public final void setColumnResizingAllowed(boolean resizingAllowed)
JTableHeader.setResizingAllowed(boolean)
public final boolean isColumnResizingAllowed()
JTableHeader.getResizingAllowed()
public DsCellProperties getColumnProperties(int col)
public String getColumnName(int column)
getColumnName
in class JTable
public void setColumnName(int column, String val)
public int getColumnWidth(int index)
public void setColumnWidth(int index, int width)
width
.
public void setColumnWidth(String columnId, int width)
public void setColumnWidthToFit(int column, boolean fitName, boolean fitData)
getColumnName(int)
,
setColumnWidth(int, int)
public int calculateColumnWidthToFit(int column, boolean fitName, boolean fitData)
getColumnName(int)
,
setColumnWidth(int, int)
,
setColumnWidthToFit(int, boolean, boolean)
public int calculateWidthToFit(boolean fitColumnNames, boolean fitColumnData)
public void setColumnHorizontalAlignment(int column, int align)
LEFT
CENTER
RIGHT
public void setColumnVerticalAlignment(int column, int align)
TOP
CENTER
BOTTOM
public int getColumnCount()
getColumnCount
in class JTable
public TableColumn getColumn(int index)
public TableColumn getColumn(String columnId)
public int getColumnIndex(String columnId)
public void createDefaultColumnsFromModel()
createDefaultColumnsFromModel
in class JTable
public TableColumn addColumn()
public TableColumn addColumn(String columnName, String id)
public void addColumn(TableColumn aColumn)
addColumn
in class JTable
public void hideColumn(int index)
public void setColumnCount(int val)
public boolean spanCells(int startRow, int startColumn, int rowsToSpan, int columnsToSpan)
startRow, startColumn
span
across rowsToSpan
rows and columnsToSpan
columns.
Note: Spanning cells will disable several features such as sorting, column reordering, and hiding columns.
startRow
- The row of the cell which will span multiple rows and/or columnsstartColumn
- The column of the cell which will span multiple rows and/or columnsrowsToSpan
- The number of rows to span.columnsToSpan
- The number of columns to span.removeSpan(int, int)
public void removeSpan(int row, int column)
row, column
not span
across multiple rows and/or columns.
row
- The row of the cell to remove the span from.column
- The column of the cell to remove the span from.spanCells(int, int, int, int)
protected int getCellRowSpan(int row, int column)
protected int getCellColumnSpan(int row, int column)
public String getToolTipText(MouseEvent event)
JComponent
's getToolTipText
method in order to allow the cell's tips to be used
if it has text set.
setToolTipText(null)
on the
DsGrid
no tips from the cells will display anymore.
getToolTipText
in class JTable
JComponent.getToolTipText()
public Rectangle getCellRect(int row, int column, boolean includeSpacing)
getCellRect
in class JTable
public int rowAtPoint(Point point)
rowAtPoint
in class JTable
public int columnAtPoint(Point point)
columnAtPoint
in class JTable
public void valueChanged(ListSelectionEvent e)
valueChanged
in interface ListSelectionListener
valueChanged
in class JTable
public void columnSelectionChanged(ListSelectionEvent e)
columnSelectionChanged
in interface TableColumnModelListener
columnSelectionChanged
in class JTable
public void tableChanged(TableModelEvent e)
TableModel
generates
a TableModelEvent
.
Application code will not use these methods explicitly, they
are used internally by JTable
.
tableChanged
in interface TableModelListener
tableChanged
in class JTable
protected JTableHeader createDefaultTableHeader()
createDefaultTableHeader
in class JTable
protected void createDefaultRenderers()
createDefaultRenderers
in class JTable
protected void createDefaultEditors()
createDefaultEditors
in class JTable
public TableCellRenderer getCellRenderer(int row, int column)
getCellRenderer
in class JTable
public TableCellEditor getCellEditor(int row, int column)
getCellEditor
in class JTable
|
Diamond Control Suite 3.0 | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |