Class ValidatedTablePanel<T>

  • Type Parameters:
    T - class of the beans in the ValidatedBeanListTableModel
    All Implemented Interfaces:
    java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable, javax.accessibility.Accessible

    public abstract class ValidatedTablePanel<T>
    extends ValidatedPanel
    A ValidatedPanel that displays a DecoratedTable (for a ValidatedBeanListTableModel) and a TableSummaryPanel. The following actions are added to a toolbar on the frame's menu bar. The actions are initialized using the specified resources from the resource bundle.
    ActionDescriptionResource Bundle Keys
    Addadd a new row to the table resourceGroup.action.new.mnemonicAndName
    resourceGroup.action.new.iconImage
    resourceGroup.action.new.accelerator (optional)
    Deletemark a row as pending deletion resourceGroup.action.delete.mnemonicAndName
    resourceGroup.action.delete.iconImage
    resourceGroup.action.delete.accelerator (optional)
    Savesave pending changes
    Reloadreload the table data and discard pending changes resourceGroup.action.reload.mnemonicAndName
    resourceGroup.action.reload.iconImage
    resourceGroup.action.reload.accelerator (optional)
    resourceGroup.action.reload.status.initialize (optional)

    If the resource bundle contains the key resourceGroup.menu.mnemonicAndName then the actions are also added to the specified menu on the frame's menu bar.

    This panel includes a table model listener that enables/disables the save action and that notifies an ancestor container that implements UnsavedChangesIndicator (e.g. a StatusFrame).

    See Also:
    Serialized Form
    • Nested Class Summary

      • Nested classes/interfaces inherited from class javax.swing.JPanel

        javax.swing.JPanel.AccessibleJPanel
      • Nested classes/interfaces inherited from class javax.swing.JComponent

        javax.swing.JComponent.AccessibleJComponent
      • Nested classes/interfaces inherited from class java.awt.Container

        java.awt.Container.AccessibleAWTContainer
      • Nested classes/interfaces inherited from class java.awt.Component

        java.awt.Component.AccessibleAWTComponent, java.awt.Component.BaselineResizeBehavior, java.awt.Component.BltBufferStrategy, java.awt.Component.FlipBufferStrategy
    • Field Summary

      Fields 
      Modifier and Type Field Description
      protected java.util.ResourceBundle bundle  
      protected java.lang.String resourceGroup  
      • 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
    • Method Summary

      All Methods Instance Methods Abstract Methods Concrete Methods 
      Modifier and Type Method Description
      protected void addActions​(javax.swing.JMenu menu)
      Adds the add, delete, save and reload actions to the menu.
      protected void addActions​(javax.swing.JToolBar toolbar)
      Adds the add, delete, save and reload actions to the toolbar.
      void addSummaries​(TableSummary tableSummary)
      Add an item to the summary panel.
      protected abstract java.util.List<T> confirmDelete​(java.util.List<T> items)
      Override to confirm deleting items from the table.
      protected abstract javax.swing.Action createSaveAction()  
      protected javax.swing.JToolBar createToolBar()
      Creates the toolbar to add to the frame's menu bar.
      protected ChangeBuffer getChangeBuffer()  
      protected javax.swing.table.TableRowSorter<ValidatedBeanListTableModel<T>> getRowSorter()  
      T getSelectedBean()  
      protected java.util.List<T> getSelectionMinusPendingDeletes()  
      protected DecoratedTable<T,​? extends ValidatedBeanListTableModel<T>> getTable()  
      protected abstract java.util.List<T> getTableData()
      Override to return the table data.
      ValidatedBeanListTableModel<T> getTableModel()  
      protected void initializeMenu​(javax.swing.JMenuBar menuBar)
      Adds a menu and toolbar to the frame's menu bar.
      protected boolean isDeleteEnabled​(java.util.List<T> selectionMinusPendingDeletes)  
      protected boolean isSingleRowSelected()  
      protected abstract T newBean()
      Override to create a bean for a new row in the table.
      protected void tableSelectionChanged()
      Updates the enabled state of actions.
      • Methods inherited from class javax.swing.JPanel

        getAccessibleContext, getUI, getUIClassID, paramString, setUI, updateUI
      • 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, 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, update
      • Methods inherited from class java.awt.Container

        add, 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, 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
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
    • Field Detail

      • bundle

        protected final java.util.ResourceBundle bundle
      • resourceGroup

        protected final java.lang.String resourceGroup
    • Constructor Detail

      • ValidatedTablePanel

        protected ValidatedTablePanel​(java.util.ResourceBundle bundle,
                                      DecoratedTable<T,​? extends ValidatedBeanListTableModel<T>> table,
                                      java.lang.String resourceGroup)
        Constructs a new ValidatedTablePanel using resources from bundle.
        Parameters:
        bundle - the resource bundle to use for UI components
        table - the table to include on the panel
        resourceGroup - a string used to look up component resources
    • Method Detail

      • createSaveAction

        protected abstract javax.swing.Action createSaveAction()
      • addSummaries

        public void addSummaries​(TableSummary tableSummary)
        Add an item to the summary panel.
        Parameters:
        tableSummary - the summary item
      • newBean

        protected abstract T newBean()
        Override to create a bean for a new row in the table.
        Returns:
        the new bean
      • confirmDelete

        protected abstract java.util.List<T> confirmDelete​(java.util.List<T> items)
        Override to confirm deleting items from the table. The input list can be modified and used as the return value. Only items in the returned list will actually be deleted.
        Parameters:
        items - the items selected for deletion.
        Returns:
        the items that have been confirmed for deletion
      • isDeleteEnabled

        protected boolean isDeleteEnabled​(java.util.List<T> selectionMinusPendingDeletes)
      • getSelectionMinusPendingDeletes

        protected java.util.List<T> getSelectionMinusPendingDeletes()
      • createToolBar

        protected javax.swing.JToolBar createToolBar()
        Creates the toolbar to add to the frame's menu bar.
        Returns:
        the new toolbar
        See Also:
        addActions(JToolBar)
      • addActions

        protected void addActions​(javax.swing.JToolBar toolbar)
        Adds the add, delete, save and reload actions to the toolbar.
        Parameters:
        toolbar - the toolbar on the frame's menu bar
      • addActions

        protected void addActions​(javax.swing.JMenu menu)
        Adds the add, delete, save and reload actions to the menu.
        Parameters:
        menu - the menu from the frame's menu bar
      • isSingleRowSelected

        protected boolean isSingleRowSelected()
      • getSelectedBean

        public T getSelectedBean()
      • getTableData

        protected abstract java.util.List<T> getTableData()
        Override to return the table data.
      • tableSelectionChanged

        protected void tableSelectionChanged()
        Updates the enabled state of actions. May be overridden to handle changes to table selection.