T - the pdo typepublic class PdoNavigationPanel<T extends PersistentDomainObject<T>> extends FormPanel implements KeyListener
The PdoNavigationPanel provides object navigation in a tree
and a table in parallel. The user switches between the tree- and the
table view. The tree view is primarily for navigation through object
relations and operations on objects by means of a context-driven popup menu.
The table view is for sorting, building sums, cutting the list
and a table popup to export to spreadsheet, xml or print the table.
Furthermore, other navigation panels may be created on-the-fly,
for example to sum up the details (childs) of a given type for
some object within a tree.
| Modifier and Type | Class and Description |
|---|---|
static class |
PdoNavigationPanel.ViewMode
The view mode.
|
JPanel.AccessibleJPanelJComponent.AccessibleJComponentContainer.AccessibleAWTContainerComponent.AccessibleAWTComponent, Component.BaselineResizeBehavior, Component.BltBufferStrategy, Component.FlipBufferStrategy| Modifier and Type | Field and Description |
|---|---|
static String |
ACTION_CANCEL
"cancel" action
|
static String |
ACTION_CLOSE
"close" action
|
static String |
ACTION_SELECT
"select" action
|
static int |
SHOW_BUTTONS
show default buttons: cancel and select
|
static int |
SHOW_CANCEL
show cancel button
|
static int |
SHOW_CLOSE
show close button
|
static int |
SHOW_NOBUTTON
don't show any button
|
static int |
SHOW_SELECT
show select button
|
listenerList, TOOL_TIP_TEXT_KEY, ui, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOWaccessibleContext, BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENTABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH| Constructor and Description |
|---|
PdoNavigationPanel()
Creates an empty navigation panel.
This constructor makes it a bean. |
PdoNavigationPanel(List<T> list)
Creates a navigation panel.
The preferences table name is determined by the first object. |
PdoNavigationPanel(List<T> list,
SelectionFilter selectionFilter)
Creates a navigation panel.
The preferences table name is determined by the first object. |
PdoNavigationPanel(List<T> list,
SelectionFilter selectionFilter,
int buttonMode,
boolean showTable)
Creates a navigation panel.
The preferences table name is determined by the first object. |
PdoNavigationPanel(List<T> list,
SelectionFilter selectionFilter,
int buttonMode,
boolean showTable,
String tableName)
Creates a navigation panel.
|
PdoNavigationPanel(T obj)
Creates a navigation panel for a single object.
The preferences table name is determined by the object. |
PdoNavigationPanel(T obj,
SelectionFilter selectionFilter)
Creates a navigation panel for a single object.
The preferences table name is determined by the object. |
PdoNavigationPanel(T obj,
SelectionFilter selectionFilter,
int buttonMode,
boolean showTable)
Creates a navigation panel for a single object.
The preferences table name is determined by the object. |
PdoNavigationPanel(T obj,
SelectionFilter selectionFilter,
int buttonMode,
boolean showTable,
String tableName)
Creates a navigation panel for a single object.
|
| Modifier and Type | Method and Description |
|---|---|
void |
addListSelectionListener(ListSelectionListener listener)
Adds a selection changed listener.
|
void |
addSelectionInterval(int firstIndex,
int lastIndex)
Adds a selection for a given range of objects.
|
void |
clearSelection()
Clears the selections.
|
FormTableModel<T> |
createFormTableModel(FormTableEntry<T> template)
Creates the formtable model for a given object.
|
FormTable<T> |
createTable()
Creates the navigation table.
|
PdoTree |
createTree()
Creates the navigation tree.
|
protected void |
editObjectInTable(boolean changeable)
Edits the object currently selected in table.
|
int |
getButtonMode()
Gets the button mode.
|
FormButton |
getCancelButton()
Gives access to cancel button (to modify the text, i.e.)
|
protected int |
getModelIndex(int viewRow)
Gets the model row if navisorter and/or rowsorter is installed.
|
FormTable<T> |
getNaviTable()
Gives access to the table list.
|
PdoTree |
getNaviTree()
Gives access to the navigation tree.
|
List<T> |
getObjects()
Gets the current list of objects shown.
|
FormButton |
getSelectButton()
Gives access to select button (to modify the text, i.e.)
|
PersistentDomainObject<?> |
getSelectedObject()
Gets the selected object.
|
List<PersistentDomainObject<?>> |
getSelectedObjects()
Gets all selected objects.
|
SelectionFilter |
getSelectionFilter()
Gets the selection filter.
|
Class<T> |
getTableClass()
Gets the class of objects which is shown in the table.
|
String |
getTableIntro()
Gets the table intro text.
|
String |
getTableTitle()
Gets the table's title.
|
T |
getTemplateProvider()
Returns the optional tempalte provider.
|
org.tentackle.misc.ObjectFilter<T> |
getTreeFilter()
Gets the tree filter.
|
protected int |
getViewIndex(int modelRow)
Gets the view row if navisorter and/or rowsorter is installed.
|
PdoNavigationPanel.ViewMode |
getViewMode()
Gets the current viewmode
|
boolean |
isAutoPack()
Gets the pack mode.
|
boolean |
isCancelButtonVisible()
Gets the visibility of the cancel button.
|
boolean |
isCloseButtonVisible()
Gets the visibility of the select button.
|
boolean |
isDisposeKeyEnabled()
Returns whether the dispose key is enabled.
|
protected boolean |
isObjectEditedModal()
Determines whether the object should be edited modal or non-modal.
|
boolean |
isPopupEnabled()
Returns whether popup menu is allowed in the tree view.
|
boolean |
isSelectButtonVisible()
Gets the visibility of the select button.
|
boolean |
isViewModeButtonsVisible()
Gets the visibility of the tree- and table view buttons.
|
void |
keyPressed(KeyEvent e) |
void |
keyReleased(KeyEvent e) |
void |
keyTyped(KeyEvent e) |
void |
listUpdated()
Notifies the navigation panel that the list of objects or objects
within the list have changed and the view needs to be updated.
|
void |
removeListSelectionListener(ListSelectionListener listener)
Removes a selection changed listener.
|
void |
removeSelectionInterval(int firstIndex,
int lastIndex)
Removes a selection for a given range of objects.
|
void |
requestFocusForFirstItem()
Requests the focus for the first object,
whether list- or tree-view.
|
void |
scrollToFirstItem()
Scrolls to the first object, whether
list- or tree-view.
|
void |
scrollToIndex(int index)
Scrolls to object at given index.
|
void |
setAutoPack(boolean autoPack)
Sets the pack mode.
|
void |
setButtonMode(int buttonMode)
Sets the button mode.
|
void |
setCancelButtonVisible(boolean visible)
Sets the visibility of the cancel button.
|
void |
setCloseButtonVisible(boolean visible)
Sets the visibility of the select button.
|
void |
setDisposeKeyEnabled(boolean enabled)
Sets whether the cancel/dispose-key is enabled.
If this key is pressed when tree or table has the focus the enclosing window is disposed. |
void |
setListSelectionMode(int mode)
Sets the list selection mode.
|
void |
setObjects(List<T> list)
Replaces the current list of objects and updates the view.
|
void |
setObjects(List<T> list,
boolean rebuildView)
Replaces the current list of objects and updates the view.
|
void |
setObjects(List<T> list,
PdoNavigationPanel.ViewMode viewMode)
Replaces the current list of objects and updates the view.
|
void |
setPopupEnabled(boolean enabled)
Allow/disallow popup-menu in the tree view.
|
void |
setSelectButtonVisible(boolean visible)
Sets the visibility of the select button.
|
void |
setTableIntro(String tableIntro)
Sets the table's intro-text that appears on the first page of the printout,
usually the selection criteria from a search parameter.
|
void |
setTableTitle(String tableTitle)
Sets the table's title-text that appears on the printout.
|
void |
setTemplateProvider(T templateProvider)
Sets the optional template provider.
|
void |
setTreeFilter(org.tentackle.misc.ObjectFilter<T> treeFilter)
Sets the tree filter.
Optional filter to reduce the root objects visible in the tree view. |
void |
setTreeSelectionMode(int mode)
Sets the tree selection mode.
|
void |
setup(List<T> list,
SelectionFilter selectionFilter,
int buttonMode,
boolean showTable,
String tableName)
setup panel
|
void |
setViewModeButtonsVisible(boolean visible)
Sets the visibility of the tree- and table view buttons.
|
addActionListener, areValuesChanged, componentAdded, componentRemoved, createBinder, fireActionPerformed, getBinder, getFormValues, getHelpURL, getParentWindow, getPropertyGroup, getTitle, invalidateParentInfo, isAutoUpdate, isBindable, isChangeable, isHonourChangeable, isTriggerValuesChangedEnabled, removeActionListener, saveValues, setAutoUpdate, setBindable, setChangeable, setFormValues, setFormValuesKeepChanged, setHelpURL, setHonourChangeable, setPropertyGroup, setTitle, setTriggerValuesChangedEnabled, showHelp, triggerValuesChangedgetAccessibleContext, getUI, getUIClassID, paramString, setUI, updateUIaddAncestorListener, addNotify, 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, 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, processKeyBinding, processKeyEvent, processMouseEvent, processMouseMotionEvent, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeNotify, 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, updateadd, add, add, add, add, addContainerListener, addImpl, addPropertyChangeListener, addPropertyChangeListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, 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, validateTreeaction, 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, getPeer, 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, resize, resize, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setFocusable, setFocusTraversalKeysEnabled, setIgnoreRepaint, setLocale, setLocation, setLocation, setName, setSize, setSize, show, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCyclepublic static final int SHOW_CANCEL
public static final int SHOW_SELECT
public static final int SHOW_CLOSE
public static final int SHOW_BUTTONS
public static final int SHOW_NOBUTTON
public static final String ACTION_SELECT
public static final String ACTION_CANCEL
public static final String ACTION_CLOSE
public PdoNavigationPanel(List<T> list, SelectionFilter selectionFilter, int buttonMode, boolean showTable, String tableName)
list - the list of objectsselectionFilter - filter selectable objects, null if nothing selectablebuttonMode - the visibility of buttons, one of SHOW_...showTable - true if initially show the table view, false = tree viewtableName - the preferences tablename, null if preferences by getFormTableName() from 1st object in listpublic PdoNavigationPanel(List<T> list, SelectionFilter selectionFilter, int buttonMode, boolean showTable)
list - the list of objectsselectionFilter - filter selectable objects, null if nothing selectablebuttonMode - the visibility of buttons, one of SHOW_...showTable - true if initially show the table view, false = tree viewpublic PdoNavigationPanel(List<T> list, SelectionFilter selectionFilter)
list - the list of objectsselectionFilter - filter selectable objects, null if nothing selectablepublic PdoNavigationPanel(List<T> list)
list - the list of objectspublic PdoNavigationPanel(T obj, SelectionFilter selectionFilter, int buttonMode, boolean showTable, String tableName)
obj - the database objectselectionFilter - filter selectable objects, null if nothing selectablebuttonMode - the visibility of buttons, one of SHOW_...showTable - true if initially show the table view, false = tree viewtableName - the preferences tablename, null if preferences objectpublic PdoNavigationPanel(T obj, SelectionFilter selectionFilter, int buttonMode, boolean showTable)
obj - the database objectselectionFilter - filter selectable objects, null if nothing selectablebuttonMode - the visibility of buttons, one of SHOW_...showTable - true if initially show the table view, false = tree viewpublic PdoNavigationPanel(T obj, SelectionFilter selectionFilter)
obj - the database objectselectionFilter - filter selectable objects, null if nothing selectablepublic PdoNavigationPanel(T obj)
obj - the database objectpublic PdoNavigationPanel()
public void setTableIntro(String tableIntro)
tableIntro - the table intro text, null if nonepublic String getTableIntro()
public void setTableTitle(String tableTitle)
tableTitle - the table title, null if nonepublic String getTableTitle()
public Class<T> getTableClass()
public SelectionFilter getSelectionFilter()
public void setTreeFilter(org.tentackle.misc.ObjectFilter<T> treeFilter)
treeFilter - filter for tree, null for nonepublic org.tentackle.misc.ObjectFilter<T> getTreeFilter()
public void setPopupEnabled(boolean enabled)
enabled - true if allow popup menu (default)public boolean isPopupEnabled()
public void setViewModeButtonsVisible(boolean visible)
The default is visible.
visible - true if visiblepublic boolean isViewModeButtonsVisible()
public void requestFocusForFirstItem()
public void scrollToFirstItem()
public List<T> getObjects()
public void setObjects(List<T> list, PdoNavigationPanel.ViewMode viewMode)
list - the list of objectsviewMode - is null to keep current view, else the new PdoNavigationPanel.ViewMode
to rebuild the view as a tree or tablepublic void setObjects(List<T> list, boolean rebuildView)
list - the list of objectsrebuildView - is true to rebuild the view, false if keep itpublic void setObjects(List<T> list)
list - the list of objectspublic T getTemplateProvider()
public void setTemplateProvider(T templateProvider)
templateProvider - The optional tempalte provider to setprotected int getModelIndex(int viewRow)
viewRow - the table's rowprotected int getViewIndex(int modelRow)
modelRow - the model's rowpublic PdoNavigationPanel.ViewMode getViewMode()
public boolean isAutoPack()
public void setAutoPack(boolean autoPack)
autoPack - true to pack the parent window if view is updated, default is falsepublic void setButtonMode(int buttonMode)
buttonMode - sets the buttons (see SHOW_... above)public int getButtonMode()
SHOW_... above)public void setCancelButtonVisible(boolean visible)
visible - is true if visible, false if notpublic boolean isCancelButtonVisible()
public void setSelectButtonVisible(boolean visible)
visible - is true if visible, false if notpublic boolean isSelectButtonVisible()
public void setCloseButtonVisible(boolean visible)
visible - is true if visible, false if notpublic boolean isCloseButtonVisible()
public PdoTree createTree()
public void setup(List<T> list, SelectionFilter selectionFilter, int buttonMode, boolean showTable, String tableName)
list - is the initial list of objects to be shownselectionFilter - are the classes allowed to be selectedbuttonMode - tells what buttons are visible/invisible (one of SHOW_...)showTable - is true if initially show the table view, false = tree viewtableName - is != null if preferences not by getFormTableName() from 1st object in listpublic FormButton getCancelButton()
public FormButton getSelectButton()
public void setListSelectionMode(int mode)
mode - the list selection mode from ListSelectionModelListSelectionModel,
TreeSelectionModelpublic void setTreeSelectionMode(int mode)
mode - the list selection mode from TreeSelectionModelListSelectionModel,
TreeSelectionModelpublic PdoTree getNaviTree()
public FormTable<T> getNaviTable()
public void clearSelection()
public void listUpdated()
public void addSelectionInterval(int firstIndex,
int lastIndex)
firstIndex - the index of the first object in the current list of objectslastIndex - the index of the last object in the current list of objectspublic void removeSelectionInterval(int firstIndex,
int lastIndex)
firstIndex - the index of the first object in the current list of objectslastIndex - the index of the last object in the current list of objectspublic void scrollToIndex(int index)
index - the index of the object in the current list of objectspublic void setDisposeKeyEnabled(boolean enabled)
enabled - true to enable, false to disablepublic boolean isDisposeKeyEnabled()
public void addListSelectionListener(ListSelectionListener listener)
listener - the listener to addpublic void removeListSelectionListener(ListSelectionListener listener)
listener - the listener to removepublic PersistentDomainObject<?> getSelectedObject()
public List<PersistentDomainObject<?>> getSelectedObjects()
protected boolean isObjectEditedModal()
protected void editObjectInTable(boolean changeable)
changeable - true if edit, false if show onlypublic FormTableModel<T> createFormTableModel(FormTableEntry<T> template)
The default implementation just creates the model and binds it.
template - the formtable entrypublic void keyTyped(KeyEvent e)
keyTyped in interface KeyListenerpublic void keyPressed(KeyEvent e)
keyPressed in interface KeyListenerpublic void keyReleased(KeyEvent e)
keyReleased in interface KeyListenerTentackle - distributed, domain- and model-driven