Package com.portal.pfc.ui
Class JTreeTable
java.lang.Object
java.awt.Component
java.awt.Container
javax.swing.JComponent
javax.swing.JTable
com.portal.pfc.ui.JTreeTable
- All Implemented Interfaces:
ImageObserver
,MenuContainer
,Serializable
,EventListener
,Accessible
,CellEditorListener
,ListSelectionListener
,RowSorterListener
,TableColumnModelListener
,TableModelListener
,Scrollable
- Direct Known Subclasses:
BalanceGroupTreeTable
,ItemChargesTreeTable
,PostPaidChargesTreeTable
,PRemoveBillInProgressTreeTable
,PRemovePaymentSetupTreeTable
original JTreeTable component taken from:
Sun Microsystems, Inc.
Copyright 1997, 1998 by Sun Microsystems, Inc.
- Author:
- lruslen
- See Also:
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionclass
TreeTableCellEditor implementation.class
A TreeCellRenderer that displays a JTree.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
FieldsModifier and TypeFieldDescriptionprotected TreeTableModel
The data model for the tree tableprotected JTreeTable.TreeTableCellRenderer
Renderer for table cells, which since this IS a JTreeTable, should be a tree.Fields inherited from class javax.swing.JTable
AUTO_RESIZE_ALL_COLUMNS, AUTO_RESIZE_LAST_COLUMN, AUTO_RESIZE_NEXT_COLUMN, AUTO_RESIZE_OFF, AUTO_RESIZE_SUBSEQUENT_COLUMNS, autoCreateColumnsFromModel, autoResizeMode, cellEditor, cellSelectionEnabled, columnModel, dataModel, defaultEditorsByColumnClass, defaultRenderersByColumnClass, editingColumn, editingRow, editorComp, gridColor, preferredViewportSize, rowHeight, rowMargin, rowSelectionAllowed, selectionBackground, selectionForeground, selectionModel, showHorizontalLines, showVerticalLines, tableHeader
Fields inherited from class javax.swing.JComponent
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
accessibleContext, 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
ConstructorsConstructorDescriptionCreates a new JTreeTable with a dummy TreeTableModel All beans must have a default no-args constructorJTreeTable
(TreeTableModel treeTableModel) Creates a new JTreeTable.JTreeTable
(TreeTableNode root, boolean asksAllowsChildren, Object[] columnNames) Returns a JTreeTable with the specified TreeTableNode as its root and the specified column names and which decides whether a node is a leaf node in the specified manner.JTreeTable
(TreeTableNode root, boolean asksAllowsChildren, ArrayList columnNames) Returns a JTreeTable with the specified TreeTableNode as its root and the specified column names and which decides whether a node is a leaf node in the specified manner.JTreeTable
(TreeTableNode root, Object[] columnNames) Returns a JTreeTable with the specified TreeTableNode as its root and the specified column names.JTreeTable
(TreeTableNode root, ArrayList columnNames) Returns a JTreeTable with the specified TreeTableNode as its root and the specified column names. -
Method Summary
Modifier and TypeMethodDescriptionvoid
Notify the given listener when the table row data changesvoid
void
void
fireTreeTableDataChanged
(Object pValue, Object aValue, int row, int column) int
Workaround for BasicTableUI anomaly.boolean
Returns whether the tree table is sorted in ascending order.int
Which column was used to sort the tree table.getTree()
Returns the tree that is being shared between the model.void
Add a listener to the table header and sort the table whenever a column is clicked.void
Don't notify the given listener when the table row data changesvoid
setAscendingIcon
(Icon icon) Set the icon used to indicate that a column is sorted in ascending order.void
setDescendingIcon
(Icon icon) Set the icon used to indicate that a column is sorted in descending order.void
setHandleVisibility
(boolean b) Sets the handles on the tree visible, or not.void
setModel
(TreeTableModel newModel) Sets the data model for this component to newModel.void
setRowHeight
(int rowHeight) Overridden to pass the new rowHeight to the tree.void
void
setValueAt
(Object aValue, int row, int column) Whenever data is updated to the tree table,it will fire TreeTableDataChange eventvoid
Handle events from the TreeTableModelAdaptervoid
updateUI()
Overridden to message super and forward the method to the tree.Methods inherited from class javax.swing.JTable
addColumn, addColumnSelectionInterval, addNotify, addRowSelectionInterval, changeSelection, clearSelection, columnAdded, columnAtPoint, columnMarginChanged, columnMoved, columnRemoved, columnSelectionChanged, configureEnclosingScrollPane, convertColumnIndexToModel, convertColumnIndexToView, convertRowIndexToModel, convertRowIndexToView, createDefaultColumnModel, createDefaultColumnsFromModel, createDefaultDataModel, createDefaultEditors, createDefaultRenderers, createDefaultSelectionModel, createDefaultTableHeader, createScrollPaneForTable, doLayout, editCellAt, editCellAt, editingCanceled, editingStopped, getAccessibleContext, getAutoCreateColumnsFromModel, getAutoCreateRowSorter, getAutoResizeMode, getCellEditor, getCellEditor, getCellRect, getCellRenderer, getCellSelectionEnabled, getColumn, getColumnClass, getColumnCount, getColumnModel, getColumnName, getColumnSelectionAllowed, getDefaultEditor, getDefaultRenderer, getDragEnabled, getDropLocation, getDropMode, getEditingColumn, getEditorComponent, getFillsViewportHeight, getGridColor, getIntercellSpacing, getModel, getPreferredScrollableViewportSize, getPrintable, getRowCount, getRowHeight, getRowHeight, getRowMargin, getRowSelectionAllowed, getRowSorter, getScrollableBlockIncrement, getScrollableTracksViewportHeight, getScrollableTracksViewportWidth, getScrollableUnitIncrement, getSelectedColumn, getSelectedColumnCount, getSelectedColumns, getSelectedRow, getSelectedRowCount, getSelectedRows, getSelectionBackground, getSelectionForeground, getSelectionModel, getShowHorizontalLines, getShowVerticalLines, getSurrendersFocusOnKeystroke, getTableHeader, getToolTipText, getUI, getUIClassID, getUpdateSelectionOnSort, getValueAt, initializeLocalVars, isCellEditable, isCellSelected, isColumnSelected, isEditing, isRowSelected, moveColumn, paramString, prepareEditor, prepareRenderer, print, print, print, print, print, processKeyBinding, removeColumn, removeColumnSelectionInterval, removeEditor, removeNotify, removeRowSelectionInterval, resizeAndRepaint, rowAtPoint, selectAll, setAutoCreateColumnsFromModel, setAutoCreateRowSorter, setAutoResizeMode, setCellEditor, setCellSelectionEnabled, setColumnModel, setColumnSelectionAllowed, setColumnSelectionInterval, setDefaultEditor, setDefaultRenderer, setDragEnabled, setDropMode, setEditingColumn, setEditingRow, setFillsViewportHeight, setGridColor, setIntercellSpacing, setModel, setPreferredScrollableViewportSize, setRowHeight, setRowMargin, setRowSelectionAllowed, setRowSelectionInterval, setRowSorter, setSelectionBackground, setSelectionForeground, setSelectionMode, setSelectionModel, setShowGrid, setShowHorizontalLines, setShowVerticalLines, setSurrendersFocusOnKeystroke, setTableHeader, setUI, setUpdateSelectionOnSort, sizeColumnsToFit, sizeColumnsToFit, sorterChanged, unconfigureEnclosingScrollPane, valueChanged
Methods inherited from class javax.swing.JComponent
addAncestorListener, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, fireVetoableChange, getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAncestorListeners, getAutoscrolls, getBaseline, getBaselineResizeBehavior, getBorder, getBounds, getClientProperty, getComponentGraphics, getComponentPopupMenu, getConditionForKeyStroke, getDebugGraphicsOptions, getDefaultLocale, getFontMetrics, getGraphics, getHeight, getInheritsPopupMenu, getInputMap, getInputMap, getInputVerifier, getInsets, getInsets, getListeners, getLocation, getMaximumSize, getMinimumSize, getNextFocusableComponent, getPopupLocation, getPreferredSize, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getTopLevelAncestor, getTransferHandler, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, hide, isDoubleBuffered, isLightweightComponent, isManagingFocus, isOpaque, isOptimizedDrawingEnabled, isPaintingForPrint, isPaintingOrigin, isPaintingTile, isRequestFocusEnabled, isValidateRoot, paint, paintBorder, paintChildren, paintComponent, paintImmediately, paintImmediately, print, printAll, printBorder, printChildren, printComponent, processComponentKeyEvent, processKeyEvent, processMouseEvent, processMouseMotionEvent, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resetKeyboardActions, reshape, revalidate, scrollRectToVisible, setActionMap, setAlignmentX, setAlignmentY, setAutoscrolls, setBackground, setBorder, setComponentPopupMenu, setDebugGraphicsOptions, setDefaultLocale, setDoubleBuffered, setEnabled, setFocusTraversalKeys, setFont, setForeground, setInheritsPopupMenu, setInputMap, setInputVerifier, setMaximumSize, setMinimumSize, setNextFocusableComponent, setOpaque, setPreferredSize, setRequestFocusEnabled, setToolTipText, setTransferHandler, setUI, setVerifyInputWhenFocusTarget, setVisible, unregisterKeyboardAction, update
Methods inherited from class java.awt.Container
add, add, add, add, add, addContainerListener, addImpl, addPropertyChangeListener, addPropertyChangeListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, findComponentAt, findComponentAt, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalKeys, getFocusTraversalPolicy, getLayout, getMousePosition, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, printComponents, processContainerEvent, processEvent, remove, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusCycleRoot, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setLayout, transferFocusDownCycle, validate, validateTree
Methods inherited from class java.awt.Component
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, coalesceEvents, contains, createImage, createImage, createVolatileImage, createVolatileImage, disableEvents, dispatchEvent, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBackground, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getForeground, getGraphicsConfiguration, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocale, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getToolkit, getTreeLock, gotFocus, handleEvent, hasFocus, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isPreferredSizeSet, isShowing, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, postEvent, prepareImage, prepareImage, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processMouseWheelEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, requestFocus, requestFocus, requestFocusInWindow, resize, resize, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setFocusable, setFocusTraversalKeysEnabled, setIgnoreRepaint, setLocale, setLocation, setLocation, setMixingCutoutShape, setName, setSize, setSize, show, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCycle
-
Field Details
-
mSelSup
-
tree
Renderer for table cells, which since this IS a JTreeTable, should be a tree. -
mModel
The data model for the tree table
-
-
Constructor Details
-
JTreeTable
public JTreeTable()Creates a new JTreeTable with a dummy TreeTableModel All beans must have a default no-args constructor- See Also:
-
JTreeTable
Returns a JTreeTable with the specified TreeTableNode as its root and the specified column names. By default, the tree defines a leaf node as any node without children. -
JTreeTable
Returns a JTreeTable with the specified TreeTableNode as its root and the specified column names. By default, the tree defines a leaf node as any node without children. -
JTreeTable
Returns a JTreeTable with the specified TreeTableNode as its root and the specified column names and which decides whether a node is a leaf node in the specified manner.- Parameters:
root
- - a TreeNode objectasksAllowsChildren
- - if false, any node without children is a leaf node; if true, only nodes that do not allow children are leaf nodescolumnNames
- - names of each column
-
JTreeTable
Returns a JTreeTable with the specified TreeTableNode as its root and the specified column names and which decides whether a node is a leaf node in the specified manner.- Parameters:
root
- - a TreeNode objectasksAllowsChildren
- - if false, any node without children is a leaf node; if true, only nodes that do not allow children are leaf nodescolumnNames
- - names of each column
-
JTreeTable
Creates a new JTreeTable.- Type Parameters:
em
- treeTableModel data that will be used for component- See Also:
-
-
Method Details
-
setHandleVisibility
public void setHandleVisibility(boolean b) Sets the handles on the tree visible, or not. Not visible by default.- Parameters:
vis
- - set to true to display handles; false for no handles
-
expandAll
public void expandAll() -
collapseAll
public void collapseAll() -
setTreeRenderer
-
setModel
Sets the data model for this component to newModel.- Type Parameters:
em
- newModel data that will be used for component- See Also:
-
getTreeTableModel
- Returns:
- the tree table model for this tree table.
-
updateUI
public void updateUI()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. -
getEditingRow
public int getEditingRow()Workaround for BasicTableUI anomaly. Make sure the UI never tries to paint the editor. The UI currently uses different techniques to paint the renderers and editors and overriding setBounds() below is not the right thing to do for an editor. Returning -1 for the editing row in this case, ensures the editor is never painted.- Overrides:
getEditingRow
in classJTable
-
setRowHeight
public void setRowHeight(int rowHeight) Overridden to pass the new rowHeight to the tree.- Overrides:
setRowHeight
in classJTable
-
getTree
Returns the tree that is being shared between the model. -
tableChanged
Handle events from the TreeTableModelAdapter- Specified by:
tableChanged
in interfaceTableModelListener
- Overrides:
tableChanged
in classJTable
- Parameters:
e
-
-
makeSortable
public void makeSortable()Add a listener to the table header and sort the table whenever a column is clicked.- Throws:
IllegalArgumentException
- if the model is not sortable
-
setAscendingIcon
Set the icon used to indicate that a column is sorted in ascending order.- Parameters:
icon
-
-
setDescendingIcon
Set the icon used to indicate that a column is sorted in descending order.- Parameters:
icon
-
-
getSortColumn
public int getSortColumn()Which column was used to sort the tree table. Returns -1 if the tree table has not been sorted. -
getSortAscending
public boolean getSortAscending()Returns whether the tree table is sorted in ascending order. -
setValueAt
Whenever data is updated to the tree table,it will fire TreeTableDataChange event- Overrides:
setValueAt
in classJTable
- Parameters:
aValue
- Objectrow
- intcolumn
- int
-
addTreeTableDataListener
Notify the given listener when the table row data changes- Parameters:
l
- The selection listener
-
removeTreeTableDataListener
Don't notify the given listener when the table row data changes- Parameters:
l
- The selection listener
-
fireTreeTableDataChanged
-