com.dlsc.flexgantt.swing.layer.timeline

## Class AbstractTimelineObjectEditor

- java.lang.Object
- - java.awt.Component
  - - java.awt.Container
    - - javax.swing.JComponent
      - - javax.swing.JPanel
        - - com.dlsc.flexgantt.swing.layer.timeline.AbstractTimelineObjectEditor

- All Implemented Interfaces:
    ITimelineObjectEditor, MouseListener, MouseMotionListener, ImageObserver, MenuContainer, Serializable, EventListener, Accessible
  Direct Known Subclasses:
    DefaultActivityObjectEditor, DefaultTimelineObjectEditor

      public abstract class AbstractTimelineObjectEditor
      extends JPanel
      implements ITimelineObjectEditor, MouseListener, MouseMotionListener

  An abstract timeline object editor implementation, which provides functionality common to most editors. The abstract editor wraps around any kind of component that is used for the actual editing of a timeline object. Additionally a semi-transparent border gets drawn around the wrapped content with controls to stop or cancel the editing. Listener support is also provided by this abstract editor implementation.
  Since:
    1.0
  Version:
    $Revision: 1.4 $
  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` | `AbstractTimelineObjectEditor(JComponent content)` Constructs a new editor, which will wrap itself around the given content.
    `protected` | `AbstractTimelineObjectEditor(String title, JComponent content)` Constructs a new editor, which will wrap itself around the given content.

  - ### Method Summary

    All Methods Instance Methods Abstract Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `addTimelineObjectEditorListener(ITimelineObjectEditorListener l)` Adds a listener to the editor that will be informed if the user stopped or canceled the editing from within the editor component.
    `abstract void` | `cancelEditing()` Callback method for the timeline layer to indicate to the editor that the user has canceled the editing of the timeline object.
    `protected JPanel` | `createButtonBar()` Creates the button bar at the bottom of the editor (ok, cancel).
    `protected JComponent` | `createHeader()` Creates and returns the component used as the header of the editor.
    `protected void` | `fireEditingCanceled()` Fires an event to all listeners informing them that the editing has been cancelled.
    `protected void` | `fireEditingStopped()` Fires an event to all listeners informing them that the editing has stopped.
    `JPanel` | `getButtonBar()` Returns the button bar panel used for displaying the buttons at the bottom of the panel.
    `JLabel` | `getCloseLabel()` Returns the label, which is responsible for showing the "close" icon.
    `JComponent` | `getContent()` Returns the wrapped content / editor
    `JLabel` | `getPackLabel()` Returns the label, which is responsible for showing the "pack / minimize" icon.
    `Object` | `getTimelineObject()` Returns the currently edited timeline object.
    `Component` | `getTimelineObjectEditorComponent(EditingLayer layer, TimelineObjectPath path)` Returns the actual editor component for the given tree node and timeline object.
    `Object` | `getTimelineObjectPath()` Returns the path to the currently edited timeline object.
    `String` | `getTitle()` Returns the title shown by the editor.
    `JLabel` | `getTitleLabel()` Returns the label, which is responsible for showing the title.
    `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)`
    `void` | `removeTimelineObjectEditorListener(ITimelineObjectEditorListener l)` Removes a listener from the editor.
    `void` | `setTitle(String title)` Sets a new title on the editor.
    `abstract boolean` | `stopEditing()` Callback method for the timeline layer to indicate to the editor that the user has finished the editing of the timeline object.

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

    - #### AbstractTimelineObjectEditor

          protected AbstractTimelineObjectEditor(String title,
                                                 JComponent content)

      Constructs a new editor, which will wrap itself around the given content. The UI components inside the content component are the ones used for the actual editing of a timeline object.
      Parameters:
        `title` - the title shown inside the header of the editor
        `content` - the wrapped content / editor
      Since:
        1.1

    - #### AbstractTimelineObjectEditor

          protected AbstractTimelineObjectEditor(JComponent content)

      Constructs a new editor, which will wrap itself around the given content. The UI components inside the content component are the ones used for the actual editing of a timeline object.
      Parameters:
        `content` - the wrapped content / editor
      Since:
        1.0

  - ### Method Detail

    - #### paintComponent

          protected void paintComponent(Graphics g)

      Overrides:
        `paintComponent` in class `JComponent`

    - #### createButtonBar

          protected JPanel createButtonBar()

      Creates the button bar at the bottom of the editor (ok, cancel).
      Returns:
        the panel that contains the buttons
      Since:
        1.0

    - #### createHeader

          protected JComponent createHeader()

      Creates and returns the component used as the header of the editor. The default implementation of this method creates a panel, which displays the pack / minimize icon on its left (west) position, the title label in its middle (center) position, and the close label on its right (east) position.
      Returns:
        a panel containing the pack, close, and title labels
      Since:
        1.1
      See Also:
        `getTitleLabel()`, `getPackLabel()`, `getCloseLabel()`

    - #### getTimelineObjectEditorComponent

          public Component getTimelineObjectEditorComponent(EditingLayer layer,
                                                            TimelineObjectPath path)

      Description copied from interface: `ITimelineObjectEditor`
      Returns the actual editor component for the given tree node and timeline object.
      Specified by:
        `getTimelineObjectEditorComponent` in interface `ITimelineObjectEditor`
      Parameters:
        `layer` - the layer that will display the editor
        `path` - the path to the timeline object that will be edited
      Returns:
        a component that can be used to edit the given timeline object

    - #### addTimelineObjectEditorListener

          public void addTimelineObjectEditorListener(ITimelineObjectEditorListener l)

      Description copied from interface: `ITimelineObjectEditor`
      Adds a listener to the editor that will be informed if the user stopped or canceled the editing from within the editor component.
      Specified by:
        `addTimelineObjectEditorListener` in interface `ITimelineObjectEditor`
      Parameters:
        `l` - the listener to add

    - #### removeTimelineObjectEditorListener

          public void removeTimelineObjectEditorListener(ITimelineObjectEditorListener l)

      Description copied from interface: `ITimelineObjectEditor`
      Removes a listener from the editor.
      Specified by:
        `removeTimelineObjectEditorListener` in interface `ITimelineObjectEditor`
      Parameters:
        `l` - the listener to remove

    - #### fireEditingStopped

          protected void fireEditingStopped()

      Fires an event to all listeners informing them that the editing has stopped. This is the case when the `stopEditing()` method has been called.
      Since:
        1.0
      See Also:
        `stopEditing()`, `fireEditingCanceled()`

    - #### fireEditingCanceled

          protected void fireEditingCanceled()

      Fires an event to all listeners informing them that the editing has been cancelled. This is the case when the `cancelEditing()` method has been called.
      Since:
        1.0
      See Also:
        `stopEditing()`, `fireEditingStopped()`

    - #### cancelEditing

          public abstract void cancelEditing()

      Description copied from interface: `ITimelineObjectEditor`
      Callback method for the timeline layer to indicate to the editor that the user has canceled the editing of the timeline object.
      Specified by:
        `cancelEditing` in interface `ITimelineObjectEditor`
      See Also:
        `ITimelineObjectEditor.stopEditing()`

    - #### stopEditing

          public abstract boolean stopEditing()

      Description copied from interface: `ITimelineObjectEditor`
      Callback method for the timeline layer to indicate to the editor that the user has finished the editing of the timeline object.
      Specified by:
        `stopEditing` in interface `ITimelineObjectEditor`
      Returns:
        TRUE if the new values for the timline object could be used, FALSE otherwise
      See Also:
        `ITimelineObjectEditor.cancelEditing()`

    - #### getTimelineObject

          public Object getTimelineObject()

      Returns the currently edited timeline object.
      Returns:
        the currently edited timeline object
      Since:
        1.0

    - #### getTimelineObjectPath

          public Object getTimelineObjectPath()

      Returns the path to the currently edited timeline object.
      Returns:
        the path to the currently edited timeline object
      Since:
        1.1

    - #### getContent

          public JComponent getContent()

      Returns the wrapped content / editor
      Returns:
        the wrapped content / editor
      Since:
        1.0

    - #### getButtonBar

          public JPanel getButtonBar()

      Returns the button bar panel used for displaying the buttons at the bottom of the panel.
      Returns:
        the button bar
      Since:
        1.1

    - #### mouseClicked

          public void mouseClicked(MouseEvent e)

      Specified by:
        `mouseClicked` 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`

    - #### mousePressed

          public void mousePressed(MouseEvent e)

      Specified by:
        `mousePressed` in interface `MouseListener`

    - #### mouseReleased

          public void mouseReleased(MouseEvent e)

      Specified by:
        `mouseReleased` 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`

    - #### getTitle

          public String getTitle()

      Returns the title shown by the editor.
      Returns:
        the title shown by the editor
      Since:
        1.1

    - #### setTitle

          public void setTitle(String title)

      Sets a new title on the editor.
      Parameters:
        `title` - the new title
      Since:
        1.1

    - #### getTitleLabel

          public JLabel getTitleLabel()

      Returns the label, which is responsible for showing the title.
      Returns:
        the title label
      Since:
        1.1

    - #### getCloseLabel

          public JLabel getCloseLabel()

      Returns the label, which is responsible for showing the "close" icon.
      Returns:
        the close label
      Since:
        1.1

    - #### getPackLabel

          public JLabel getPackLabel()

      Returns the label, which is responsible for showing the "pack / minimize" icon.
      Returns:
        the pack / minimize label
      Since:
        1.1

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