| javax.swing.JTable com.xoetrope.swing.XTreeTable
XTreeTable | public class XTreeTable extends JTable implements XModelHolder,XRowSelector,XAttributedComponent,XStyleComponent,XListenerHelper(Code) | | This example shows how to create a simple XTreeTable component,
by using a JTree as a renderer (and editor) for the cells in a
particular column in the JTable.
Copyright (c) Xoetrope Ltd., 2001-2006, This software is licensed under
the GNU Public License (GPL), please see license.txt for more details. If
you make commercial use of this software you must purchase a commercial
license from Xoetrope.
$Revision: 1.22 $
|
Method Summary | |
public void | addHandler(Object page, String handlerType, String methodName) | public void | addRenderer(int column, TableCellRenderer renderer) | public void | displayAsColorField(int column, Hashtable colors) | public void | displayAsNumericField(int column, Format format) | public TableCellRenderer | getCellRenderer(int row, int column) | public int | getEditingRow() | public String | getFieldValue(int fieldIdx) | public String | getFieldValue(int rowIdx, int fieldIdx) | public String | getHeadingStyle() | public int | getSelectedRow() | public String | getSelectionStyle() | public JTree | getTree() Returns the tree that is being shared between the model. | public boolean | getUpdateModelSelection() | public Object | getValue(int fieldIdx) | public Object | getValue(int rowIdx, int fieldIdx) | public void | reload() | protected void | reload(Object node) Invoked to reload the children of a particular node. | public void | setAlignment(int column, int alignment) | public void | setAltStyle(String style) | public void | setAltUnselectedColors(Color frgd, Color bkgd) | public int | setAttribute(String attribName, Object attribValue) Set one or more attributes of the component. | public void | setBorderStyle(String style) | public void | setColumnWidth(int columnIdx, int width) Set the column width. | public void | setEnabled(boolean b) | public void | setHeaderRenderer() Set a header renderer for thetable. | public void | setHeadingStyle(String style) | public void | setModel(XModel _xmodel) | public void | setModel(XModel _xmodel, TableModel delegModel) | public void | setRowHeight(int rowHeight) Overridden to pass the new rowHeight to the tree. | public void | setSelectedRow(int rowIdx) | public void | setSelection(int rowIdx) Select the nth visible row one level down from the parent. | public void | setSelectionStyle(String style) | public void | setStyle(String style) | public void | setUpdateModelSelection(boolean doUpdate) | public void | update() | public void | updateTable() | public void | updateUI() Overridden to message super and forward the method to the tree. |
altUnselectedBackground | protected Color altUnselectedBackground(Code) | | |
altUnselectedForeground | protected Color altUnselectedForeground(Code) | | |
invoker | protected XHandlerInvoker invoker(Code) | | |
tree | protected TreeTableCellRenderer tree(Code) | | A subclass of JTree.
|
updateModelSelection | protected boolean updateModelSelection(Code) | | |
xmodel | protected XModel xmodel(Code) | | |
XTreeTable | public XTreeTable()(Code) | | Create a new XTreeTable
|
addHandler | public void addHandler(Object page, String handlerType, String methodName) throws NoSuchMethodException(Code) | | Add an event handler response method to a component such that the page's
response method is invoked when the event occurs
Parameters: page - the page containing the method Parameters: handlerType - the type of event handler Parameters: methodName - the method to invoke throws: NoSuchMethodException - cannot add the handler |
addRenderer | public void addRenderer(int column, TableCellRenderer renderer)(Code) | | Add a cell renderer for the specified column
Parameters: column - the column or field index |
displayAsColorField | public void displayAsColorField(int column, Hashtable colors)(Code) | | Display the field formatted with a background color from the hashtable such
that the field value acts as a key into the hashtable of colors
Parameters: column - the column or field index Parameters: colors - the color hashtable |
displayAsNumericField | public void displayAsNumericField(int column, Format format)(Code) | | Display the field as a numeric value
Parameters: column - the column or field index Parameters: format - format the number format to use in displaying the field |
getEditingRow | public int getEditingRow()(Code) | | |
getFieldValue | public String getFieldValue(int fieldIdx)(Code) | | Gets a field value as a string from the currently selected row
Parameters: fieldIdx - the field offset the value |
getFieldValue | public String getFieldValue(int rowIdx, int fieldIdx)(Code) | | Gets a field value as a string from the specified row
Parameters: rowIdx - the row offset Parameters: fieldIdx - the field offset the value |
getHeadingStyle | public String getHeadingStyle()(Code) | | Set the style of the header data
the header styles |
getSelectedRow | public int getSelectedRow()(Code) | | |
getSelectionStyle | public String getSelectionStyle()(Code) | | Get the style of the selected row
the selected style |
getTree | public JTree getTree()(Code) | | Returns the tree that is being shared between the model.
|
getUpdateModelSelection | public boolean getUpdateModelSelection()(Code) | | Get the model selection update flag
|
getValue | public Object getValue(int fieldIdx)(Code) | | Gets a field value object from the currently selected row
Parameters: fieldIdx - the field offset the value |
getValue | public Object getValue(int rowIdx, int fieldIdx)(Code) | | Gets a field value object from the specified row
Parameters: rowIdx - the row offset Parameters: fieldIdx - the field offset the value |
reload | public void reload()(Code) | | |
reload | protected void reload(Object node)(Code) | | Invoked to reload the children of a particular node. This will
also restart the timer.
|
setAlignment | public void setAlignment(int column, int alignment)(Code) | | Set the alignment of a column
Parameters: column - the column index Parameters: alignment - the SwingContants aliignment constant |
setAltStyle | public void setAltStyle(String style)(Code) | | Set the style of the alternate rows
Parameters: style - XStyle |
setAltUnselectedColors | public void setAltUnselectedColors(Color frgd, Color bkgd)(Code) | | Set the colors for alternate ( odd ) row colors
Parameters: frgd - the foreground color Parameters: bkgd - the background color |
setAttribute | public int setAttribute(String attribName, Object attribValue)(Code) | | Set one or more attributes of the component. Currently this handles the
attributes
- headingStyle, value=the table header style
- selectionStyle, value=the selected row style
- updateModel, value=true|false update the underlying model selection (the selected row)
- border, 0 to turn off the border
Parameters: attribName - the attribute name Parameters: attribValue - the attribute value 0 for success, non zero otherwise |
setBorderStyle | public void setBorderStyle(String style)(Code) | | Set the style of the border
Parameters: style - XStyle |
setColumnWidth | public void setColumnWidth(int columnIdx, int width)(Code) | | Set the column width. Sets the maximum width as a workaround for a Swing problem
Parameters: columnIdx - the column index Parameters: width - the new width |
setEnabled | public void setEnabled(boolean b)(Code) | | Set the enabled state
Parameters: b - true to enable |
setHeaderRenderer | public void setHeaderRenderer()(Code) | | Set a header renderer for thetable.
|
setHeadingStyle | public void setHeadingStyle(String style)(Code) | | Set the style of the header data
Parameters: style - XStyle |
setModel | public void setModel(XModel _xmodel)(Code) | | |
setModel | public void setModel(XModel _xmodel, TableModel delegModel)(Code) | | Set the XModel which we will be generating the table from
Parameters: _xmodel - The XModel of data |
setRowHeight | public void setRowHeight(int rowHeight)(Code) | | Overridden to pass the new rowHeight to the tree.
|
setSelectedRow | public void setSelectedRow(int rowIdx)(Code) | | Set the row selection index
Parameters: rowIdx - the new row selection index (zero based) |
setSelection | public void setSelection(int rowIdx)(Code) | | Select the nth visible row one level down from the parent.
Parameters: rowIdx - the row index |
setSelectionStyle | public void setSelectionStyle(String style)(Code) | | Set the style of the selected row
Parameters: style - XStyle |
setStyle | public void setStyle(String style)(Code) | | Set the general style of the XTable
Parameters: style - XStyle |
setUpdateModelSelection | public void setUpdateModelSelection(boolean doUpdate)(Code) | | Tie the model selection to this table's selection
Parameters: doUpdate - true to tie the selections together, false to ignore |
update | public void update()(Code) | | Update the table's model
|
updateTable | public void updateTable()(Code) | | Force the table to update itself
|
updateUI | public void updateUI()(Code) | | Overridden to message super and forward the method to the tree.
Since the tree is not actually in the component hieachy it will
never receive this unless we forward it in this manner.
|
Methods inherited from javax.swing.JTable | public void addColumn(TableColumn aColumn)(Code)(Java Doc) public void addColumnSelectionInterval(int index0, int index1)(Code)(Java Doc) public void addNotify()(Code)(Java Doc) public void addRowSelectionInterval(int index0, int index1)(Code)(Java Doc) public void changeSelection(int rowIndex, int columnIndex, boolean toggle, boolean extend)(Code)(Java Doc) public void clearSelection()(Code)(Java Doc) public void columnAdded(TableColumnModelEvent e)(Code)(Java Doc) public int columnAtPoint(Point point)(Code)(Java Doc) public void columnMarginChanged(ChangeEvent e)(Code)(Java Doc) public void columnMoved(TableColumnModelEvent e)(Code)(Java Doc) public void columnRemoved(TableColumnModelEvent e)(Code)(Java Doc) public void columnSelectionChanged(ListSelectionEvent e)(Code)(Java Doc) protected void configureEnclosingScrollPane()(Code)(Java Doc) public int convertColumnIndexToModel(int viewColumnIndex)(Code)(Java Doc) public int convertColumnIndexToView(int modelColumnIndex)(Code)(Java Doc) public int convertRowIndexToModel(int viewRowIndex)(Code)(Java Doc) public int convertRowIndexToView(int modelRowIndex)(Code)(Java Doc) protected TableColumnModel createDefaultColumnModel()(Code)(Java Doc) public void createDefaultColumnsFromModel()(Code)(Java Doc) protected TableModel createDefaultDataModel()(Code)(Java Doc) protected void createDefaultEditors()(Code)(Java Doc) protected void createDefaultRenderers()(Code)(Java Doc) protected ListSelectionModel createDefaultSelectionModel()(Code)(Java Doc) protected JTableHeader createDefaultTableHeader()(Code)(Java Doc) public static JScrollPane createScrollPaneForTable(JTable aTable)(Code)(Java Doc) public void doLayout()(Code)(Java Doc) public boolean editCellAt(int row, int column)(Code)(Java Doc) public boolean editCellAt(int row, int column, EventObject e)(Code)(Java Doc) public void editingCanceled(ChangeEvent e)(Code)(Java Doc) public void editingStopped(ChangeEvent e)(Code)(Java Doc) public AccessibleContext getAccessibleContext()(Code)(Java Doc) public boolean getAutoCreateColumnsFromModel()(Code)(Java Doc) public boolean getAutoCreateRowSorter()(Code)(Java Doc) public int getAutoResizeMode()(Code)(Java Doc) public TableCellEditor getCellEditor()(Code)(Java Doc) public TableCellEditor getCellEditor(int row, int column)(Code)(Java Doc) public Rectangle getCellRect(int row, int column, boolean includeSpacing)(Code)(Java Doc) public TableCellRenderer getCellRenderer(int row, int column)(Code)(Java Doc) public boolean getCellSelectionEnabled()(Code)(Java Doc) public TableColumn getColumn(Object identifier)(Code)(Java Doc) public Class> getColumnClass(int column)(Code)(Java Doc) public int getColumnCount()(Code)(Java Doc) public TableColumnModel getColumnModel()(Code)(Java Doc) public String getColumnName(int column)(Code)(Java Doc) public boolean getColumnSelectionAllowed()(Code)(Java Doc) public TableCellEditor getDefaultEditor(Class> columnClass)(Code)(Java Doc) public TableCellRenderer getDefaultRenderer(Class> columnClass)(Code)(Java Doc) public boolean getDragEnabled()(Code)(Java Doc) final public DropLocation getDropLocation()(Code)(Java Doc) final public DropMode getDropMode()(Code)(Java Doc) public int getEditingColumn()(Code)(Java Doc) public int getEditingRow()(Code)(Java Doc) public Component getEditorComponent()(Code)(Java Doc) public boolean getFillsViewportHeight()(Code)(Java Doc) public Color getGridColor()(Code)(Java Doc) public Dimension getIntercellSpacing()(Code)(Java Doc) public TableModel getModel()(Code)(Java Doc) public Dimension getPreferredScrollableViewportSize()(Code)(Java Doc) public Printable getPrintable(PrintMode printMode, MessageFormat headerFormat, MessageFormat footerFormat)(Code)(Java Doc) public int getRowCount()(Code)(Java Doc) public int getRowHeight()(Code)(Java Doc) public int getRowHeight(int row)(Code)(Java Doc) public int getRowMargin()(Code)(Java Doc) public boolean getRowSelectionAllowed()(Code)(Java Doc) public RowSorter<? extends TableModel> getRowSorter()(Code)(Java Doc) public int getScrollableBlockIncrement(Rectangle visibleRect, int orientation, int direction)(Code)(Java Doc) public boolean getScrollableTracksViewportHeight()(Code)(Java Doc) public boolean getScrollableTracksViewportWidth()(Code)(Java Doc) public int getScrollableUnitIncrement(Rectangle visibleRect, int orientation, int direction)(Code)(Java Doc) public int getSelectedColumn()(Code)(Java Doc) public int getSelectedColumnCount()(Code)(Java Doc) public int[] getSelectedColumns()(Code)(Java Doc) public int getSelectedRow()(Code)(Java Doc) public int getSelectedRowCount()(Code)(Java Doc) public int[] getSelectedRows()(Code)(Java Doc) public Color getSelectionBackground()(Code)(Java Doc) public Color getSelectionForeground()(Code)(Java Doc) public ListSelectionModel getSelectionModel()(Code)(Java Doc) public boolean getShowHorizontalLines()(Code)(Java Doc) public boolean getShowVerticalLines()(Code)(Java Doc) public boolean getSurrendersFocusOnKeystroke()(Code)(Java Doc) public JTableHeader getTableHeader()(Code)(Java Doc) public String getToolTipText(MouseEvent event)(Code)(Java Doc) public TableUI getUI()(Code)(Java Doc) public String getUIClassID()(Code)(Java Doc) public boolean getUpdateSelectionOnSort()(Code)(Java Doc) public Object getValueAt(int row, int column)(Code)(Java Doc) protected void initializeLocalVars()(Code)(Java Doc) public boolean isCellEditable(int row, int column)(Code)(Java Doc) public boolean isCellSelected(int row, int column)(Code)(Java Doc) public boolean isColumnSelected(int column)(Code)(Java Doc) public boolean isEditing()(Code)(Java Doc) public boolean isRowSelected(int row)(Code)(Java Doc) public void moveColumn(int column, int targetColumn)(Code)(Java Doc) protected String paramString()(Code)(Java Doc) public Component prepareEditor(TableCellEditor editor, int row, int column)(Code)(Java Doc) public Component prepareRenderer(TableCellRenderer renderer, int row, int column)(Code)(Java Doc) public boolean print() throws PrinterException(Code)(Java Doc) public boolean print(PrintMode printMode) throws PrinterException(Code)(Java Doc) public boolean print(PrintMode printMode, MessageFormat headerFormat, MessageFormat footerFormat) throws PrinterException(Code)(Java Doc) public boolean print(PrintMode printMode, MessageFormat headerFormat, MessageFormat footerFormat, boolean showPrintDialog, PrintRequestAttributeSet attr, boolean interactive) throws PrinterException, HeadlessException(Code)(Java Doc) public boolean print(PrintMode printMode, MessageFormat headerFormat, MessageFormat footerFormat, boolean showPrintDialog, PrintRequestAttributeSet attr, boolean interactive, PrintService service) throws PrinterException, HeadlessException(Code)(Java Doc) protected boolean processKeyBinding(KeyStroke ks, KeyEvent e, int condition, boolean pressed)(Code)(Java Doc) public void removeColumn(TableColumn aColumn)(Code)(Java Doc) public void removeColumnSelectionInterval(int index0, int index1)(Code)(Java Doc) public void removeEditor()(Code)(Java Doc) public void removeNotify()(Code)(Java Doc) public void removeRowSelectionInterval(int index0, int index1)(Code)(Java Doc) protected void resizeAndRepaint()(Code)(Java Doc) public int rowAtPoint(Point point)(Code)(Java Doc) public void selectAll()(Code)(Java Doc) public void setAutoCreateColumnsFromModel(boolean autoCreateColumnsFromModel)(Code)(Java Doc) public void setAutoCreateRowSorter(boolean autoCreateRowSorter)(Code)(Java Doc) public void setAutoResizeMode(int mode)(Code)(Java Doc) public void setCellEditor(TableCellEditor anEditor)(Code)(Java Doc) public void setCellSelectionEnabled(boolean cellSelectionEnabled)(Code)(Java Doc) public void setColumnModel(TableColumnModel columnModel)(Code)(Java Doc) public void setColumnSelectionAllowed(boolean columnSelectionAllowed)(Code)(Java Doc) public void setColumnSelectionInterval(int index0, int index1)(Code)(Java Doc) public void setDefaultEditor(Class> columnClass, TableCellEditor editor)(Code)(Java Doc) public void setDefaultRenderer(Class> columnClass, TableCellRenderer renderer)(Code)(Java Doc) public void setDragEnabled(boolean b)(Code)(Java Doc) final public void setDropMode(DropMode dropMode)(Code)(Java Doc) public void setEditingColumn(int aColumn)(Code)(Java Doc) public void setEditingRow(int aRow)(Code)(Java Doc) public void setFillsViewportHeight(boolean fillsViewportHeight)(Code)(Java Doc) public void setGridColor(Color gridColor)(Code)(Java Doc) public void setIntercellSpacing(Dimension intercellSpacing)(Code)(Java Doc) public void setModel(TableModel dataModel)(Code)(Java Doc) public void setPreferredScrollableViewportSize(Dimension size)(Code)(Java Doc) public void setRowHeight(int rowHeight)(Code)(Java Doc) public void setRowHeight(int row, int rowHeight)(Code)(Java Doc) public void setRowMargin(int rowMargin)(Code)(Java Doc) public void setRowSelectionAllowed(boolean rowSelectionAllowed)(Code)(Java Doc) public void setRowSelectionInterval(int index0, int index1)(Code)(Java Doc) public void setRowSorter(RowSorter<? extends TableModel> sorter)(Code)(Java Doc) public void setSelectionBackground(Color selectionBackground)(Code)(Java Doc) public void setSelectionForeground(Color selectionForeground)(Code)(Java Doc) public void setSelectionMode(int selectionMode)(Code)(Java Doc) public void setSelectionModel(ListSelectionModel newModel)(Code)(Java Doc) public void setShowGrid(boolean showGrid)(Code)(Java Doc) public void setShowHorizontalLines(boolean showHorizontalLines)(Code)(Java Doc) public void setShowVerticalLines(boolean showVerticalLines)(Code)(Java Doc) public void setSurrendersFocusOnKeystroke(boolean surrendersFocusOnKeystroke)(Code)(Java Doc) public void setTableHeader(JTableHeader tableHeader)(Code)(Java Doc) public void setUI(TableUI ui)(Code)(Java Doc) public void setUpdateSelectionOnSort(boolean update)(Code)(Java Doc) public void setValueAt(Object aValue, int row, int column)(Code)(Java Doc) public void sizeColumnsToFit(boolean lastColumnOnly)(Code)(Java Doc) public void sizeColumnsToFit(int resizingColumn)(Code)(Java Doc) public void sorterChanged(RowSorterEvent e)(Code)(Java Doc) public void tableChanged(TableModelEvent e)(Code)(Java Doc) protected void unconfigureEnclosingScrollPane()(Code)(Java Doc) public void updateUI()(Code)(Java Doc) public void valueChanged(ListSelectionEvent e)(Code)(Java Doc)
|
|
|