com.dlsc.flexgantt.swing.timeline

## Class AbstractTimelineControlPanel<T extends IGranularity>

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

- Type Parameters:
    `T` - the type of the granularity used by the dateline model
  All Implemented Interfaces:
    IDatelineModelListener, ActionListener, ImageObserver, MenuContainer, Serializable, EventListener, Accessible, ChangeListener
  Direct Known Subclasses:
    SimpleGranularityTimelineControlPanel, TimeGranularityTimelineControlPanel

      public abstract class AbstractTimelineControlPanel<T extends IGranularity>
      extends JPanel
      implements ChangeListener, ActionListener, IDatelineModelListener

  A panel used for controlling the time span and the granularity displayed by the timeline.
  Since:
    1.0
  Version:
    $Revision: 1.6 $
  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` | `AbstractTimelineControlPanel(Timeline timeline, boolean showGranularity)` Constructs a new control panel.

  - ### Method Summary

    All Methods Instance Methods Abstract Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `actionPerformed(ActionEvent evt)`
    `protected abstract void` | `applySettings()` Applies the settings made in the control panel to the timeline.
    `protected abstract SpinnerModel` | `createEndTimeModel()` Creates the model for the end time spinner.
    `protected abstract ComboBoxModel` | `createGranularityModel()` Creates the model for the granularity combo box.
    `protected abstract SpinnerModel` | `createStartTimeModel()` Creates the model for the start time spinner.
    `protected Border` | `createTitledBorder(String title)` Constructs the titled border for the panel.
    `void` | `datelineModelChanged(DatelineModelEvent evt)` The listener's callback method that gets invoked when the model's time span or time zone changes.
    `void` | `datelineModelWillChange(DatelineModelEvent evt)` The listener's callback method that gets invoked when the model's time span or time zone will change.
    `JButton` | `getApplyButton()` Returns the button used for applying the settings to the timeline.
    `SpinnerModel` | `getEndTimeModel()` Returns the spinner model used for the end time.
    `JSpinner` | `getEndTimeSpinner()` Returns the spinner used for editing the end time.
    `JLabel` | `getFromLabel()` Returns the label used for labelling the from spiner.
    `T` | `getGranularity()` Returns the granularity shown in the combo box (not the one used by the timeline).
    `JComboBox` | `getGranularityBox()` Returns the combo box used for selecting the granularity.
    `JLabel` | `getGranularityLabel()` Returns the label used for labelling the granularity combo box.
    `ComboBoxModel` | `getGranularityModel()` Returns the combo box model used by the granularity combo box.
    `SpinnerModel` | `getStartTimeModel()` Returns the spinner model used for the start time.
    `JSpinner` | `getStartTimeSpinner()` Returns the spinner used for editing the start time.
    `Timeline` | `getTimeline()` Returns the timeline that is being controlled by the panel.
    `abstract ITimeSpan` | `getTimeSpan()` Returns the time span shown by the panel (not the timeline)
    `JLabel` | `getToLabel()` Returns the label used for labelling the to spiner.
    `abstract boolean` | `isValidSettings()` Checks whether the current settings are valid (end time is larger or equal to start time).
    `void` | `setGranularity(T value)` Sets a granularity to be shown in the granularity selector / combo box.
    `protected abstract void` | `setTimeSpan(ITimeSpan span)` Sets the time span shown by the panel (not on the timeline, updates the start and end spinner).
    `void` | `stateChanged(ChangeEvent evt)`
    `abstract void` | `updateControlPanel()` Updates the control panel to reflect the current settings of the timeline.

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

    - #### AbstractTimelineControlPanel

          protected AbstractTimelineControlPanel(Timeline timeline,
                                                 boolean showGranularity)

      Constructs a new control panel.
      Parameters:
        `timeline` - the timeline controlled by the panel
        `showGranularity` - if TRUE the controls for changing the granularity will be shown
      Since:
        1.0

  - ### Method Detail

    - #### datelineModelChanged

          public void datelineModelChanged(DatelineModelEvent evt)

      Description copied from interface: `IDatelineModelListener`
      The listener's callback method that gets invoked when the model's time span or time zone changes.
      Specified by:
        `datelineModelChanged` in interface `IDatelineModelListener`
      Parameters:
        `evt` - the event that occured on the dateline

    - #### datelineModelWillChange

          public void datelineModelWillChange(DatelineModelEvent evt)

      Description copied from interface: `IDatelineModelListener`
      The listener's callback method that gets invoked when the model's time span or time zone will change.
      Specified by:
        `datelineModelWillChange` in interface `IDatelineModelListener`
      Parameters:
        `evt` - the event that occured on the dateline

    - #### updateControlPanel

          public abstract void updateControlPanel()

      Updates the control panel to reflect the current settings of the timeline.
      Since:
        1.0

    - #### createStartTimeModel

          protected abstract SpinnerModel createStartTimeModel()

      Creates the model for the start time spinner.
      Returns:
        a spinner model
      Since:
        1.0

    - #### createEndTimeModel

          protected abstract SpinnerModel createEndTimeModel()

      Creates the model for the end time spinner.
      Returns:
        a spinner model
      Since:
        1.0

    - #### createGranularityModel

          protected abstract ComboBoxModel createGranularityModel()

      Creates the model for the granularity combo box.
      Returns:
        a combo box model
      Since:
        1.0

    - #### setTimeSpan

          protected abstract void setTimeSpan(ITimeSpan span)

      Sets the time span shown by the panel (not on the timeline, updates the start and end spinner).
      Parameters:
        `span` - the timeline's time span
      Since:
        1.0

    - #### getTimeSpan

          public abstract ITimeSpan getTimeSpan()

      Returns the time span shown by the panel (not the timeline)
      Returns:
        the panel's time span
      Since:
        1.0

    - #### isValidSettings

          public abstract boolean isValidSettings()

      Checks whether the current settings are valid (end time is larger or equal to start time).
      Returns:
        TRUE if the current settings made in the panel are consistent / valid
      Since:
        1.0

    - #### setGranularity

          public void setGranularity(T value)

      Sets a granularity to be shown in the granularity selector / combo box.
      Parameters:
        `value` - the value to show in the combo box
      Since:
        1.0

    - #### getGranularity

          public T getGranularity()

      Returns the granularity shown in the combo box (not the one used by the timeline).
      Returns:
        the current granularity selected in the combo box
      Since:
        1.0

    - #### stateChanged

          public void stateChanged(ChangeEvent evt)

      Specified by:
        `stateChanged` in interface `ChangeListener`

    - #### actionPerformed

          public void actionPerformed(ActionEvent evt)

      Specified by:
        `actionPerformed` in interface `ActionListener`

    - #### applySettings

          protected abstract void applySettings()

      Applies the settings made in the control panel to the timeline.
      Since:
        1.0

    - #### getEndTimeModel

          public SpinnerModel getEndTimeModel()

      Returns the spinner model used for the end time.
      Returns:
        the end time spinner model
      Since:
        1.0

    - #### getEndTimeSpinner

          public JSpinner getEndTimeSpinner()

      Returns the spinner used for editing the end time.
      Returns:
        the end time spinner
      Since:
        1.0

    - #### getStartTimeModel

          public SpinnerModel getStartTimeModel()

      Returns the spinner model used for the start time.
      Returns:
        the start time spinner model
      Since:
        1.0

    - #### getStartTimeSpinner

          public JSpinner getStartTimeSpinner()

      Returns the spinner used for editing the start time.
      Returns:
        the start time spinner
      Since:
        1.0

    - #### getGranularityBox

          public JComboBox getGranularityBox()

      Returns the combo box used for selecting the granularity.
      Returns:
        the granularity combo box
      Since:
        1.0

    - #### getGranularityModel

          public ComboBoxModel getGranularityModel()

      Returns the combo box model used by the granularity combo box.
      Returns:
        the granularity combo box model
      Since:
        1.0

    - #### getTimeline

          public Timeline getTimeline()

      Returns the timeline that is being controlled by the panel.
      Returns:
        the controlled timeline
      Since:
        1.0

    - #### getApplyButton

          public JButton getApplyButton()

      Returns the button used for applying the settings to the timeline.
      Returns:
        the apply button
      Since:
        1.0

    - #### getFromLabel

          public JLabel getFromLabel()

      Returns the label used for labelling the from spiner.
      Returns:
        the label for the from spinner
      Since:
        1.0

    - #### getGranularityLabel

          public JLabel getGranularityLabel()

      Returns the label used for labelling the granularity combo box.
      Returns:
        the label for the granularity combo box
      Since:
        1.0

    - #### getToLabel

          public JLabel getToLabel()

      Returns the label used for labelling the to spiner.
      Returns:
        the label for the to spinner
      Since:
        1.0

    - #### createTitledBorder

          protected Border createTitledBorder(String title)

      Constructs the titled border for the panel.
      Parameters:
        `title` - the title to be shown to the user
      Returns:
        a border with a title
      Since:
        2.0

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