|
org.netbeans.swing.outline 1.7 | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectjava.awt.Component
java.awt.Container
javax.swing.JComponent
javax.swing.JTable
org.netbeans.swing.etable.ETable
public class ETable
Note: This API is still under development and may change even in incompatible way during its stabilization phase. The API will be finalized in NetBeans version 6.5.
| Nested Class Summary | |
|---|---|
static class |
ETable.RowMapping
Item to the collection when doing the sorting of table rows. |
| Nested classes/interfaces inherited from class javax.swing.JTable |
|---|
JTable.AccessibleJTable, 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.BltBufferStrategy, Component.FlipBufferStrategy |
| Field Summary | |
|---|---|
protected int[] |
inverseSortingPermutation
Inverse of the above |
protected int[] |
sortingPermutation
Array with size exactly same as the number of rows in the data model or null. |
| 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 java.awt.image.ImageObserver |
|---|
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH |
| Constructor Summary | |
|---|---|
ETable()
Constructs a default JTable that is initialized with a default
data model, a default column model, and a default selection
model. |
|
ETable(int numRows,
int numColumns)
Constructs a JTable with numRows
and numColumns of empty cells using
DefaultTableModel. |
|
ETable(Object[][] rowData,
Object[] columnNames)
Constructs a JTable to display the values in the two dimensional array,
rowData, with column names, columnNames. |
|
ETable(TableModel dm)
Constructs a JTable that is initialized with
dm as the data model, a default column model,
and a default selection model. |
|
ETable(TableModel dm,
TableColumnModel cm)
Constructs a JTable that is initialized with
dm as the data model, cm
as the column model, and a default selection model. |
|
ETable(TableModel dm,
TableColumnModel cm,
ListSelectionModel sm)
Constructs a JTable that is initialized with
dm as the data model, cm as the
column model, and sm as the selection model. |
|
ETable(Vector rowData,
Vector columnNames)
Constructs a JTable to display the values in the
Vector of Vectors, rowData,
with column names, columnNames. |
|
| Method Summary | |
|---|---|
protected boolean |
acceptByQuickFilter(TableModel model,
int row)
Determines whether the given row should be displayed or not. |
protected void |
configureEnclosingScrollPane()
Overriden to install special button into the upper right hand corner. |
int |
convertRowIndexToModel(int row)
Helper method converting the row index according to the active sorting columns. |
int |
convertRowIndexToView(int row)
Helper method converting the row index according to the active sorting columns. |
String |
convertValueToString(Object value)
Used when copying into clipboard. |
protected TableColumn |
createColumn(int modelIndex)
Allow to plug own TableColumn implementation. |
protected TableColumnModel |
createDefaultColumnModel()
Overriden to use ETableColumnModel as TableColumnModel. |
void |
createDefaultColumnsFromModel()
Overriden to use ETableColumns instead of the original TableColumns. |
void |
displaySearchField()
Shows the search field. |
void |
doLayout()
Overriden to place the search text field. |
boolean |
editCellAt(int row,
int column,
EventObject e)
Overriden to force requesting the focus after the user starts editing. |
String |
getColumnDisplayName(String columnName)
Allows subclasses to localize the column headers. |
TableColumnSelector |
getColumnSelector()
Allows to supply alternative implementation of the column selection functionality in ETable. |
static TableColumnSelector |
getDefaultColumnSelector()
Default column selector is used when columnSelector is null. |
int |
getQuickFilterColumn()
Get the column which is currently filtered by "quick-filter" object. |
JMenuItem |
getQuickFilterCompareItem(int column,
Object value,
String columnName,
String text,
boolean greater,
boolean equalsCounts)
Creates the menu item for setting the quick filter that filters the objects using Comparable interface. |
JMenuItem |
getQuickFilterEqualsItem(int column,
Object value,
String columnName,
String text,
boolean equals)
Creates the menu item for setting the quick filter that filters the objects using equality (or non-equality). |
String[] |
getQuickFilterFormatStrings()
Returns the quickFilterFormatStrings array. |
JMenuItem |
getQuickFilterNoFilterItem(String label)
Creates the menu item for resetting the quick filter (to no filter). |
Object |
getQuickFilterObject()
Get the "quick-filter" object that is currently active. |
JMenuItem |
getQuickFilterPopup(int column,
Object value,
String label)
Creates a menu item usable in a popup that will trigger QuickFilter functionality for given column and value of the cell it was invoked on (returned from transformValue(getValueAt(column, row))). |
int |
getRowCount()
If the quick-filter is applied the number of rows do not match the number of rows in the model. |
String |
getToolTipText(MouseEvent event)
Overriden to make a speed optimization. |
String |
getTransferDelimiter(boolean line)
Returns string used to delimit entries when copying into clipboard. |
Object |
getValueAt(int row,
int column)
Overriden to call convertRowIndexToModel(...). |
protected void |
initializeLocalVars()
Overriden to do additional initialization. |
boolean |
isCellEditable(int row,
int column)
Returns true if the cell at row and column
is editable. |
boolean |
isColumnHidingAllowed()
|
boolean |
isFullyEditable()
Returns true if ETable is fully editable. |
boolean |
isFullyNonEditable()
Returns true if ETable is fully non-editable. |
boolean |
isPopupUsedFromTheCorner()
The column selection corner can use either dialog or popup menu. |
protected boolean |
processKeyBinding(KeyStroke ks,
KeyEvent e,
int condition,
boolean pressed)
Overriden to implement CTRL-+ for resizing of all columns, CTRL-- for clearing the quick filter and CTRL-* for invoking the column selection dialog. |
void |
readSettings(Properties p,
String propertyPrefix)
Method allowing to read stored values. |
void |
removeEditor()
Overriden to track whether the remove request is in progress. |
void |
setCellBackground(Component renderer,
boolean isSelected,
int row,
int column)
Sets the table cell background colors accodring to NET UI guidelines. |
void |
setColumnHidingAllowed(boolean allowColumnHiding)
Turn column hiding on/off |
void |
setColumnSelector(TableColumnSelector columnSelector)
Allows to supply alternative implementation of the column selection functionality in ETable. |
void |
setColumnSorted(int columnIndex,
boolean ascending,
int rank)
Make the column sorted. |
static void |
setDefaultColumnSelector(TableColumnSelector aDefaultColumnSelector)
Allows to supply the deafult column selector for all instances of ETable. |
void |
setFullyEditable(boolean fullyEditable)
Sets all the cells in the ETable to be editable if
fullyEditable is true. |
void |
setFullyNonEditable(boolean fullyNonEditable)
Sets all the cells in the ETable to be non-editable if
fullyNonEditable is true. |
void |
setModel(TableModel dataModel)
Overriden to update the header listeners and also to adjust the preferred width of the collumns. |
void |
setPopupUsedFromTheCorner(boolean popupUsedFromTheCorner)
The column selection corner can use either dialog or popup menu. |
void |
setQuickFilter(int column,
Object filterObject)
Makes the table disply only the rows that match the given "quick-filter". |
void |
setQuickFilterFormatStrings(String[] newFormats)
Replaces the quickFilterFormatStrings by the given array. |
void |
setSelectVisibleColumnsLabel(String localizedLabel)
Allows customization of the text appearing in the column customization dialog. |
void |
setValueAt(Object aValue,
int row,
int column)
Overriden to call convertRowIndexToModel(...). |
protected void |
sortAndFilter()
Sorts the rows of the table. |
void |
tableChanged(TableModelEvent e)
If the table data model is changed we reset (and then recompute) the sorting permutation and the row count. |
Object |
transformValue(Object value)
Allows subclasses to transform the value (usually obtained by calling getValueAt(...)) to another object that is used for sorting, comparison via quick filters etc. |
void |
unsetQuickFilter()
Makes the table show all the rows, resetting the filter state (to no filter). |
void |
writeSettings(Properties p,
String propertyPrefix)
Method allowing to store customization values. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
protected transient int[] sortingPermutation
protected transient int[] inverseSortingPermutation
| Constructor Detail |
|---|
public ETable()
JTable that is initialized with a default
data model, a default column model, and a default selection
model.
JTable.createDefaultDataModel(),
createDefaultColumnModel(),
JTable.createDefaultSelectionModel()public ETable(TableModel dm)
JTable that is initialized with
dm as the data model, a default column model,
and a default selection model.
dm - the data model for the tablecreateDefaultColumnModel(),
JTable.createDefaultSelectionModel()
public ETable(TableModel dm,
TableColumnModel cm)
JTable that is initialized with
dm as the data model, cm
as the column model, and a default selection model.
dm - the data model for the tablecm - the column model for the tableJTable.createDefaultSelectionModel()
public ETable(TableModel dm,
TableColumnModel cm,
ListSelectionModel sm)
JTable that is initialized with
dm as the data model, cm as the
column model, and sm as the selection model.
If any of the parameters are null this method
will initialize the table with the corresponding default model.
The autoCreateColumnsFromModel flag is set to false
if cm is non-null, otherwise it is set to true
and the column model is populated with suitable
TableColumns for the columns in dm.
dm - the data model for the tablecm - the column model for the tablesm - the row selection model for the tableJTable.createDefaultDataModel(),
createDefaultColumnModel(),
JTable.createDefaultSelectionModel()
public ETable(int numRows,
int numColumns)
JTable with numRows
and numColumns of empty cells using
DefaultTableModel. The columns will have
names of the form "A", "B", "C", etc.
numRows - the number of rows the table holdsnumColumns - the number of columns the table holdsDefaultTableModel
public ETable(Vector rowData,
Vector columnNames)
JTable to display the values in the
Vector of Vectors, rowData,
with column names, columnNames. The
Vectors contained in rowData
should contain the values for that row. In other words,
the value of the cell at row 1, column 5 can be obtained
with the following code:
((Vector)rowData.elementAt(1)).elementAt(5);
rowData - the data for the new tablecolumnNames - names of each column
public ETable(Object[][] rowData,
Object[] columnNames)
JTable to display the values in the two dimensional array,
rowData, with column names, columnNames.
rowData is an array of rows, so the value of the cell at row 1,
column 5 can be obtained with the following code:
rowData[1][5];
All rows must be of the same length as columnNames.
rowData - the data for the new tablecolumnNames - names of each column| Method Detail |
|---|
public boolean isCellEditable(int row,
int column)
row and column
is editable. Otherwise, invoking setValueAt on the cell
will have no effect.
Returns true always if the ETable is fully editable.
Returns false always if the ETable is fully non-editable.
isCellEditable in class JTablerow - the row whose value is to be queriedcolumn - the column whose value is to be queried
setValueAt(java.lang.Object, int, int),
setFullyEditable(boolean),
setFullyNonEditable(boolean)public void setFullyEditable(boolean fullyEditable)
ETable to be editable if
fullyEditable is true.
if fullyEditable is false, sets the table cells into
their default state as in JTable.
fullyEditable - true if the table is meant to be fully editable.
false if the table is meant to take the defalut
state for editing.isFullyEditable()public void setFullyNonEditable(boolean fullyNonEditable)
ETable to be non-editable if
fullyNonEditable is true.
If fullyNonEditable is false, sets the table cells into
their default state as in JTable.
fullyNonEditable - true if the table is meant to be fully non-editable.
false if the table is meant to take the defalut
state for editing.isFullyNonEditable()public boolean isFullyEditable()
ETable is fully editable.
setFullyEditable(boolean)public boolean isFullyNonEditable()
ETable is fully non-editable.
setFullyNonEditable(boolean)
public void setCellBackground(Component renderer,
boolean isSelected,
int row,
int column)
This is needed in case where the user does not use the NET Look and Feel, but still wants to paint the cell background colors accoring to NET L&F.
This needs to be called also in case where the user has custom table cell
renderer (that is not a DefaultTableCellRenderer or a
sub-class of it) for a cell even though NET L&F package is used, if the
cell background colors need to be consistent for the custom renderer.
renderer - the custom cell renderer to be paintedisSelected - true if the custom cell is selectedrow - the row, the custom cell corresponds tocolumn - the column, the custom cell corresponds topublic void createDefaultColumnsFromModel()
createDefaultColumnsFromModel in class JTableJTable.createDefaultColumnModel()public String getTransferDelimiter(boolean line)
public String convertValueToString(Object value)
null
and value.toString() otherwise. The method
transformValue(value) is called prior
to the string conversion.
protected TableColumn createColumn(int modelIndex)
protected TableColumnModel createDefaultColumnModel()
createDefaultColumnModel in class JTableJTable.createDefaultColumnModel()
public Object getValueAt(int row,
int column)
getValueAt in class JTableJTable.getValueAt(int, int)
public void setValueAt(Object aValue,
int row,
int column)
setValueAt in class JTableJTable.setValueAt(Object, int, int)public int getRowCount()
getRowCount in class JTable
public void setQuickFilter(int column,
Object filterObject)
accept(Object)
of the QuickFilter is called to determine whether the
row will be shown
public Object getQuickFilterObject()
nullsetQuickFilter(int, java.lang.Object)public int getQuickFilterColumn()
-1setQuickFilter(int, java.lang.Object)public void unsetQuickFilter()
public void setModel(TableModel dataModel)
setModel in class JTableJTable.setModel(TableModel)public String getToolTipText(MouseEvent event)
getToolTipText in class JTablepublic boolean isColumnHidingAllowed()
public void setColumnHidingAllowed(boolean allowColumnHiding)
allowColumnHiding - false to turn column hiding offprotected void initializeLocalVars()
initializeLocalVars in class JTableJTable.initializeLocalVars()
protected boolean processKeyBinding(KeyStroke ks,
KeyEvent e,
int condition,
boolean pressed)
processKeyBinding in class JTableJTable.processKeyBinding(KeyStroke, KeyEvent, int, boolean)
public void setColumnSorted(int columnIndex,
boolean ascending,
int rank)
protected void configureEnclosingScrollPane()
configureEnclosingScrollPane in class JTableJTable.configureEnclosingScrollPane()public void tableChanged(TableModelEvent e)
tableChanged in interface TableModelListenertableChanged in class JTablepublic int convertRowIndexToModel(int row)
public int convertRowIndexToView(int row)
public void setSelectVisibleColumnsLabel(String localizedLabel)
public void setQuickFilterFormatStrings(String[] newFormats)
public String[] getQuickFilterFormatStrings()
public String getColumnDisplayName(String columnName)
public Object transformValue(Object value)
public JMenuItem getQuickFilterPopup(int column,
Object value,
String label)
Note: do not forget to call transformValue before passing the value to this method otherwise the quickfilters will not work.
The label should be localized version of the string the user will see in the popup menu, e.g. "Filter Column".
public JMenuItem getQuickFilterEqualsItem(int column,
Object value,
String columnName,
String text,
boolean equals)
public JMenuItem getQuickFilterNoFilterItem(String label)
public JMenuItem getQuickFilterCompareItem(int column,
Object value,
String columnName,
String text,
boolean greater,
boolean equalsCounts)
protected void sortAndFilter()
protected boolean acceptByQuickFilter(TableModel model,
int row)
public void readSettings(Properties p,
String propertyPrefix)
public void writeSettings(Properties p,
String propertyPrefix)
public void displaySearchField()
public void doLayout()
doLayout in class JTableJTable.doLayout()
public boolean editCellAt(int row,
int column,
EventObject e)
editCellAt in class JTableJTable.editCellAt(int, int, EventObject)public void removeEditor()
removeEditor in class JTableJTable.removeEditor()public TableColumnSelector getColumnSelector()
public void setColumnSelector(TableColumnSelector columnSelector)
public boolean isPopupUsedFromTheCorner()
public void setPopupUsedFromTheCorner(boolean popupUsedFromTheCorner)
public static TableColumnSelector getDefaultColumnSelector()
public static void setDefaultColumnSelector(TableColumnSelector aDefaultColumnSelector)
|
org.netbeans.swing.outline 1.7 | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||