com.dlsc.flexgantt.swing.layer.timeline
Class AbstractTimelineObjectEditor

java.lang.Object
  extended by java.awt.Component
      extended by java.awt.Container
          extended by javax.swing.JComponent
              extended by javax.swing.JPanel
                  extended by com.dlsc.flexgantt.swing.layer.timeline.AbstractTimelineObjectEditor
All Implemented Interfaces:
ITimelineObjectEditor, java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable, javax.accessibility.Accessible, javax.swing.border.Border
Direct Known Subclasses:
DefaultActivityObjectEditor, DefaultTimelineObjectEditor

public abstract class AbstractTimelineObjectEditor
extends javax.swing.JPanel
implements ITimelineObjectEditor, javax.swing.border.Border

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
Author:
Dirk Lemmermann
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.BltBufferStrategy, java.awt.Component.FlipBufferStrategy
 
Field Summary
 
Fields inherited from class javax.swing.JComponent
accessibleContext, 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
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
protected AbstractTimelineObjectEditor(javax.swing.JComponent content)
          Constructs a new editor, which will wrap itself around the given content.
 
Method Summary
 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  void createButtonBar()
          Creates the button bar at the bottom of the editor (ok, cancel).
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.
 java.awt.Insets getBorderInsets(java.awt.Component c)
           
 javax.swing.JComponent getContent()
          Returns the wrapped content / editor
 java.lang.Object getTimelineObject()
          Returns the currently edited timeline object.
 java.awt.Component getTimelineObjectEditorComponent(EditingLayer layer, java.lang.Object treeNode, java.lang.Object timelineObject)
          Returns the actual editor component for the given tree node and timeline object.
 boolean isBorderOpaque()
           
 void paintBorder(java.awt.Component c, java.awt.Graphics g, int x, int y, int width, int height)
           
 void removeTimelineObjectEditorListener(ITimelineObjectEditorListener l)
          Removes a listener from 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, 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, isDoubleBuffered, isLightweightComponent, isManagingFocus, isOpaque, isOptimizedDrawingEnabled, 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, transferFocusBackward, 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, hide, 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, transferFocusUpCycle
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

AbstractTimelineObjectEditor

protected AbstractTimelineObjectEditor(javax.swing.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

createButtonBar

protected void createButtonBar()
Creates the button bar at the bottom of the editor (ok, cancel).

Since:
1.0

getTimelineObjectEditorComponent

public java.awt.Component getTimelineObjectEditorComponent(EditingLayer layer,
                                                           java.lang.Object treeNode,
                                                           java.lang.Object timelineObject)
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
treeNode - the owner of the timeline object
timelineObject - 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()

getBorderInsets

public java.awt.Insets getBorderInsets(java.awt.Component c)
Specified by:
getBorderInsets in interface javax.swing.border.Border

isBorderOpaque

public boolean isBorderOpaque()
Specified by:
isBorderOpaque in interface javax.swing.border.Border

paintBorder

public void paintBorder(java.awt.Component c,
                        java.awt.Graphics g,
                        int x,
                        int y,
                        int width,
                        int height)
Specified by:
paintBorder in interface javax.swing.border.Border

getTimelineObject

public java.lang.Object getTimelineObject()
Returns the currently edited timeline object.

Returns:
the currently edited timeline object
Since:
1.0

getContent

public javax.swing.JComponent getContent()
Returns the wrapped content / editor

Returns:
the wrapped content / editor
Since:
1.0