com.dlsc.flexgantt.swing

## Class AbstractRowHeader<T extends IRowHeaderRenderer>

- java.lang.Object
- - java.awt.Component
  - - java.awt.Container
    - - javax.swing.JComponent
      - - javax.swing.JPanel
        - - com.dlsc.flexgantt.swing.GanttChartControl
          - - com.dlsc.flexgantt.swing.AbstractRowHeader<T>

- Type Parameters:
    `T` - the object type of the renderer used by the row header
  All Implemented Interfaces:
    ICommandStackListener, ITreeTableModelListener, MouseListener, MouseMotionListener, ImageObserver, MenuContainer, PropertyChangeListener, Serializable, EventListener, Accessible, TreeExpansionListener, TreeModelListener, TreeSelectionListener
  Direct Known Subclasses:
    LayerContainerRowHeader, TreeTableRowHeader

      public class AbstractRowHeader<T extends IRowHeaderRenderer>
      extends GanttChartControl
      implements ITreeTableModelListener, ICommandStackListener, TreeExpansionListener, MouseListener, MouseMotionListener, PropertyChangeListener, TreeSelectionListener

  A component used for displaying row numbers and expand / collapse icons on the left-hand side of the tree table.
  Since:
    1.0
  Version:
    $Revision: 1.26 $
  Author:
    Dirk Lemmermann
  See Also:
    Serialized Form

- - ### Nested Class Summary

    - ### Nested classes/interfaces inherited from class javax.swing.JPanel

      `JPanel.AccessibleJPanel`

    - ### 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

    - ### 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

    Constructors
    Modifier | Constructor and Description
    --- | ---
    `protected` | `AbstractRowHeader(TreeTable table)` Constructs a new row header.

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `commandStackChanged(CommandStackEvent evt)` Gets called whenever the command stack changed.
    `Color` | `getGridColor()` Returns the color used by the row header to draw its grid lines.
    `IRowHeaderMenuProvider` | `getMenuProvider()` Returns the menu provider used by the row header to lookup a popup menu based on the location and context of the popup trigger event.
    `Map<Class,T>` | `getRendererMap()` Returns the map, which is storing the mappings between row header value types and row header renderers.
    `T` | `getRowHeaderRenderer(Class cl)` Returns a row header renderer for an object type.
    `TreeTable` | `getTreeTable()` Returns the tree table to which the row header belongs.
    `protected boolean` | `isFocused(int row)` Calculates whether the given row is currently focused.
    `boolean` | `isFocusEnabled()` Determines whether the focus feature is turned on or off.
    `protected boolean` | `maybeShowPopup(MouseEvent evt)` Determines whether a popup menu needs to be shown based on the given event.
    `void` | `mouseClicked(MouseEvent e)`
    `void` | `mouseDragged(MouseEvent e)`
    `void` | `mouseEntered(MouseEvent e)`
    `void` | `mouseExited(MouseEvent e)`
    `void` | `mouseMoved(MouseEvent e)`
    `void` | `mousePressed(MouseEvent e)`
    `void` | `mouseReleased(MouseEvent e)`
    `protected void` | `paintComponent(Graphics g)`
    `protected void` | `paintUnusedRow(Graphics g, int y, int width, int height, int row)` Draws additional visual feedback for unused rows.
    `protected void` | `paintUnusedRows(Graphics g, Rectangle clip, int y, int row)` Draws visual feedback for rows that are not being used, which means that they do not contain a hierarchy / tree node.
    `void` | `propertyChange(PropertyChangeEvent evt)`
    `void` | `setFocusEnabled(boolean enabled)` Enables / disables the focus feature.
    `void` | `setGridColor(Color color)` Sets the color used by the row header to draw its grid lines.
    `void` | `setMenuProvider(IRowHeaderMenuProvider provider)` Sets the menu provider used by the row header to lookup a popup menu based on the location and context of the popup trigger event.
    `void` | `setRendererMap(Map<Class,T> map)` Sets the map, which is storing the mappings between row header value types and row header renderers.
    `void` | `setRowHeaderRenderer(Class objectType, T renderer)` Maps the implementation of a row header renderer to a class definition.
    `void` | `treeCollapsed(TreeExpansionEvent event)`
    `void` | `treeExpanded(TreeExpansionEvent event)`
    `void` | `treeNodeKeyChanged(TreeTableModelEvent e)` Callback method that gets invoked if the user edited the key value of a tree table node.
    `void` | `treeNodesChanged(TreeModelEvent e)`
    `void` | `treeNodesInserted(TreeModelEvent e)`
    `void` | `treeNodesRemoved(TreeModelEvent e)`
    `void` | `treeNodeValueChanged(TreeTableModelEvent e)` Callback method that gets invoked if the user edited a column value of a tree table node.
    `void` | `treeStructureChanged(TreeModelEvent e)`
    `void` | `valueChanged(TreeSelectionEvent e)`

    - ### Methods inherited from class com.dlsc.flexgantt.swing.GanttChartControl

      `getGanttChart, print, printBorder`

    - ### Methods inherited from class javax.swing.JPanel

      `getAccessibleContext, getUI, getUIClassID, paramString, setUI, updateUI`

    - ### Methods inherited from class javax.swing.JComponent

      `addAncestorListener, 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, paintImmediately, paintImmediately, printAll, 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, 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, transferFocusUpCycle`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

- - ### Constructor Detail

    - #### AbstractRowHeader

          protected AbstractRowHeader(TreeTable table)

      Constructs a new row header.
      Parameters:
        `table` - the table that is associated with / controlled by the row header
      Since:
        1.0

  - ### Method Detail

    - #### setFocusEnabled

          public void setFocusEnabled(boolean enabled)

      Enables / disables the focus feature. A cell inside the row header has the focus when the mouse cursor hovers on top of it.
      Parameters:
        `enabled` - if TRUE the row header cell under the mouse cursor will change color (default is FALSE)
      Since:
        2.0

    - #### isFocusEnabled

          public boolean isFocusEnabled()

      Determines whether the focus feature is turned on or off. A cell inside the row header has the focus when the mouse cursor hovers on top of it.
      Returns:
        TRUE if the focus feature is enabled
      Since:
        2.0

    - #### getTreeTable

          public TreeTable getTreeTable()

      Returns the tree table to which the row header belongs.
      Returns:
        the row header's tree table
      Since:
        1.0

    - #### paintComponent

          protected void paintComponent(Graphics g)

      Overrides:
        `paintComponent` in class `JComponent`

    - #### paintUnusedRows

          protected void paintUnusedRows(Graphics g,
                                         Rectangle clip,
                                         int y,
                                         int row)

      Draws visual feedback for rows that are not being used, which means that they do not contain a hierarchy / tree node. These rows also require a horizontal grid line so that the row header looks consistent. This method calls `paintUnusedRow(Graphics, int, int, int, int)` in which additional rendering can be performed for each unused row.
      Parameters:
        `g` - the graphics context into which to draw
        `clip` - the current drawing clip
        `y` - the vertical location of the unused row
        `row` - the row index
      Since:
        1.0

    - #### paintUnusedRow

          protected void paintUnusedRow(Graphics g,
                                        int y,
                                        int width,
                                        int height,
                                        int row)

      Draws additional visual feedback for unused rows. The default implementation of this method does nothing. Subclasses can choose to override this method to perform extra rendering operations. This method gets invoked by `paintUnusedRows(Graphics, Rectangle, int, int)`.
      Parameters:
        `g` - the graphics context into which to draw
        `y` - the current drawing clip
        `width` - the width of the cell
        `height` - the height of the cell
        `row` - the row index
      Since:
        1.0

    - #### isFocused

          protected boolean isFocused(int row)

      Calculates whether the given row is currently focused. This method returns TRUE if the row equals the focused row or if the row is located within the drag start and drag end coordinates during a drag row selection.
      Parameters:
        `row` - the row to check for focus
      Returns:
        TRUE if the given row is the focus owner
      Since:
        1.0

    - #### mouseClicked

          public void mouseClicked(MouseEvent e)

      Specified by:
        `mouseClicked` in interface `MouseListener`

    - #### mousePressed

          public void mousePressed(MouseEvent e)

      Specified by:
        `mousePressed` in interface `MouseListener`

    - #### mouseReleased

          public void mouseReleased(MouseEvent e)

      Specified by:
        `mouseReleased` in interface `MouseListener`

    - #### mouseEntered

          public void mouseEntered(MouseEvent e)

      Specified by:
        `mouseEntered` in interface `MouseListener`

    - #### mouseExited

          public void mouseExited(MouseEvent e)

      Specified by:
        `mouseExited` in interface `MouseListener`

    - #### mouseDragged

          public void mouseDragged(MouseEvent e)

      Specified by:
        `mouseDragged` in interface `MouseMotionListener`

    - #### mouseMoved

          public void mouseMoved(MouseEvent e)

      Specified by:
        `mouseMoved` in interface `MouseMotionListener`

    - #### treeExpanded

          public void treeExpanded(TreeExpansionEvent event)

      Specified by:
        `treeExpanded` in interface `TreeExpansionListener`

    - #### treeCollapsed

          public void treeCollapsed(TreeExpansionEvent event)

      Specified by:
        `treeCollapsed` in interface `TreeExpansionListener`

    - #### commandStackChanged

          public void commandStackChanged(CommandStackEvent evt)

      Description copied from interface: `ICommandStackListener`
      Gets called whenever the command stack changed. The event object that is passed to this method contains information about the type of event and a reference to the command that caused the event.
      Specified by:
        `commandStackChanged` in interface `ICommandStackListener`
      Parameters:
        `evt` - the event issued by the command stack

    - #### treeNodeKeyChanged

          public void treeNodeKeyChanged(TreeTableModelEvent e)

      Description copied from interface: `ITreeTableModelListener`
      Callback method that gets invoked if the user edited the key value of a tree table node.
      Specified by:
        `treeNodeKeyChanged` in interface `ITreeTableModelListener`
      Parameters:
        `e` - the event fired by the tree table model
      See Also:
        `ITreeTableModelListener.treeNodeValueChanged(TreeTableModelEvent)`

    - #### treeNodeValueChanged

          public void treeNodeValueChanged(TreeTableModelEvent e)

      Description copied from interface: `ITreeTableModelListener`
      Callback method that gets invoked if the user edited a column value of a tree table node.
      Specified by:
        `treeNodeValueChanged` in interface `ITreeTableModelListener`
      Parameters:
        `e` - the event fired by the tree table model
      See Also:
        `ITreeTableModelListener.treeNodeKeyChanged(TreeTableModelEvent)`

    - #### treeNodesChanged

          public void treeNodesChanged(TreeModelEvent e)

      Specified by:
        `treeNodesChanged` in interface `TreeModelListener`

    - #### treeNodesInserted

          public void treeNodesInserted(TreeModelEvent e)

      Specified by:
        `treeNodesInserted` in interface `TreeModelListener`

    - #### treeNodesRemoved

          public void treeNodesRemoved(TreeModelEvent e)

      Specified by:
        `treeNodesRemoved` in interface `TreeModelListener`

    - #### treeStructureChanged

          public void treeStructureChanged(TreeModelEvent e)

      Specified by:
        `treeStructureChanged` in interface `TreeModelListener`

    - #### propertyChange

          public void propertyChange(PropertyChangeEvent evt)

      Specified by:
        `propertyChange` in interface `PropertyChangeListener`
      Overrides:
        `propertyChange` in class `GanttChartControl`

    - #### valueChanged

          public void valueChanged(TreeSelectionEvent e)

      Specified by:
        `valueChanged` in interface `TreeSelectionListener`

    - #### getGridColor

          public Color getGridColor()

      Returns the color used by the row header to draw its grid lines.
      Returns:
        the grid line color
      Since:
        1.0

    - #### setGridColor

          public void setGridColor(Color color)

      Sets the color used by the row header to draw its grid lines.
      Parameters:
        `color` - the grid line color
      Since:
        1.0

    - #### setRowHeaderRenderer

          public void setRowHeaderRenderer(Class objectType,
                                           T renderer)

      Maps the implementation of a row header renderer to a class definition.
      Parameters:
        `objectType` - the type of those row values that will be rendered with the given renderer
        `renderer` - an implementation that will be used to renderer instances of the given object type
      Since:
        1.0
      See Also:
        `DefaultTreeTableRowHeaderRenderer`, `getRowHeaderRenderer(Class)`

    - #### getRowHeaderRenderer

          public T getRowHeaderRenderer(Class cl)

      Returns a row header renderer for an object type. The lookup of the renderer is based on the object type of the given object.
      Parameters:
        `cl` - the type of the object in need of rendering
      Returns:
        a matching row header renderer implementation
      Since:
        1.0
      See Also:
        `setRowHeaderRenderer(Class, IRowHeaderRenderer)`

    - #### getMenuProvider

          public IRowHeaderMenuProvider getMenuProvider()

      Returns the menu provider used by the row header to lookup a popup menu based on the location and context of the popup trigger event.
      Returns:
        the table's menu provider
      Since:
        1.0

    - #### setMenuProvider

          public void setMenuProvider(IRowHeaderMenuProvider provider)

      Sets the menu provider used by the row header to lookup a popup menu based on the location and context of the popup trigger event.
      Parameters:
        `provider` - the table's menu provider
      Since:
        1.0

    - #### maybeShowPopup

          protected boolean maybeShowPopup(MouseEvent evt)

      Determines whether a popup menu needs to be shown based on the given event.
      Parameters:
        `evt` - the mouse event to check
      Returns:
        TRUE if the given mouse event triggers a popup menu to be shown
      Since:
        1.0

    - #### getRendererMap

          public Map<Class,T> getRendererMap()

      Returns the map, which is storing the mappings between row header value types and row header renderers.
      Returns:
        the renderer map
      Since:
        1.0

    - #### setRendererMap

          public void setRendererMap(Map<Class,T> map)

      Sets the map, which is storing the mappings between row header value types and row header renderers.
      Parameters:
        `map` - the renderer map
      Since:
        1.0

Copyright © 2006–2020 Dirk Lemmermann Software & Consulting. All rights reserved.