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

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.DefaultTimelineObjectRenderer
                      extended by com.dlsc.flexgantt.swing.layer.timeline.DefaultActivityObjectRenderer
All Implemented Interfaces:
ITimelineObjectRenderer, java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable, javax.accessibility.Accessible

public class DefaultActivityObjectRenderer
extends DefaultTimelineObjectRenderer

A renderer for timeline objects that implement the IActivityObject interface. These activities have an attribute called 'percentage complete' that expresses how much of an activity has been completed. The renderer reads this attribute and fills the background of a standard representation of a timeline object with a special color. The amount filled represents the percentage complete value.

Since:
1.0
Author:
Dirk Lemmermann
See Also:
LayerContainer.setTimelineObjectRenderer(Class, ITimelineObjectRenderer), 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
DefaultActivityObjectRenderer()
          Constructs a new renderer and sets its (text) foreground color to BLACK and its font to "Helvetica, BOLD, 9".
 
Method Summary
protected  IActivityObject getActivityObject()
          Returns the activity object that is currently being rendered.
 java.awt.Color getPercentageFillColor1()
          Returns the first fill color used for drawing a gradient in the background of the activity object.
 java.awt.Color getPercentageFillColor2()
          Returns the second fill color used for drawing a gradient in the background of the activity object.
 java.awt.Component getTimelineObjectRendererComponent(TimelineObjectLayer layer, java.lang.Object node, java.lang.Object timelineObject, boolean selected, boolean hasFocus, boolean highlighted, int row)
          Returns a component that will be used to renderer the given timeline object.
protected  void paintActivityContent(java.awt.Graphics g)
          Overrides the super method in order to fill the background of the bar with a special fill color based on the percentage complete value of the activity timeline object.
protected  void paintActivityFocus(java.awt.Graphics g)
          Adds visual feedback to an activity if it owns the focus.
 void setPercentageFillColor1(java.awt.Color color)
          Sets the first fill color used for drawing a gradient in the background of the activity object.
 void setPercentageFillColor2(java.awt.Color color)
          Sets the second fill color used for drawing a gradient in the background of the activity object.
 
Methods inherited from class com.dlsc.flexgantt.swing.layer.timeline.DefaultTimelineObjectRenderer
firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getActivityFillColor1, getActivityFillColor2, getActivityLineColor, getBarHeight, getDiamondSize, getEventFillColor1, getEventFillColor2, getEventLineColor, getFocusFillColor1, getFocusFillColor2, getFocusLineColor, getHighlightFillColor1, getHighlightFillColor2, getHighlightLineColor, getModel, getNode, getParentFillColor1, getParentFillColor2, getParentLineColor, getPastFillColor1, getPastFillColor2, getResizeHandleColor, getSelectionFillColor1, getSelectionFillColor2, getSelectionLineColor, getShadowColor, getShadowOffsetX, getShadowOffsetY, getShadowOpacity, getTimelineObject, getTimelineObjectLayer, getTimelineObjectRendererInsets, hasFocus, invalidate, isDurationChangeable, isEvent, isHighlighted, isParent, isRoundedCorners, isSelected, isStartTimeChangeable, isVisualizingPastTime, paintActivityBorder, paintActivityShadow, paintComponent, paintEvent, paintParent, repaint, repaint, repaint, revalidate, setActivityFillColor1, setActivityFillColor2, setActivityLineColor, setBarHeight, setDiamondSize, setEventFillColor1, setEventFillColor2, setEventLineColor, setFocusFillColor1, setFocusFillColor2, setFocusLineColor, setHighlightFillColor1, setHighlightFillColor2, setHighlightLineColor, setParentFillColor1, setParentFillColor2, setParentLineColor, setPastFillColor1, setPastFillColor2, setResizeHandleColor, setRoundedCorners, setSelectionFillColor1, setSelectionFillColor2, setSelectionLineColor, setShadowColor, setShadowOffsetX, setShadowOffsetY, setShadowOpacity, setVisualizingPastTime, validate
 
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, 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, 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, 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, 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, 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, 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, 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, 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

DefaultActivityObjectRenderer

public DefaultActivityObjectRenderer()
Constructs a new renderer and sets its (text) foreground color to BLACK and its font to "Helvetica, BOLD, 9".

Since:
1.0
Method Detail

getTimelineObjectRendererComponent

public java.awt.Component getTimelineObjectRendererComponent(TimelineObjectLayer layer,
                                                             java.lang.Object node,
                                                             java.lang.Object timelineObject,
                                                             boolean selected,
                                                             boolean hasFocus,
                                                             boolean highlighted,
                                                             int row)
Description copied from interface: ITimelineObjectRenderer
Returns a component that will be used to renderer the given timeline object.

Specified by:
getTimelineObjectRendererComponent in interface ITimelineObjectRenderer
Overrides:
getTimelineObjectRendererComponent in class DefaultTimelineObjectRenderer
Parameters:
layer - the layer in which the timeline object will be rendered
node - the tree node that 'owns' the timeline object
timelineObject - the actual timeline object that requires visualization
selected - if TRUE the object is currently selected and the rendering needs to express that
hasFocus - if TRUE the focus is currently on the timeline object and the rendering needs to express that
highlighted - if TRUE the timeline object is highlighted and its appearance needs to vary from its normal appearance (causing a blinking effect)
row - the row in which the object gets drawn
Returns:
the component used for rendering the given object

paintActivityContent

protected void paintActivityContent(java.awt.Graphics g)
Overrides the super method in order to fill the background of the bar with a special fill color based on the percentage complete value of the activity timeline object.

Overrides:
paintActivityContent in class DefaultTimelineObjectRenderer
Parameters:
g - the graphics context into which to draw
Since:
1.0
See Also:
DefaultTimelineObjectRenderer.paintActivityBorder(Graphics), DefaultTimelineObjectRenderer.paintActivityShadow(Graphics)

paintActivityFocus

protected void paintActivityFocus(java.awt.Graphics g)
Description copied from class: DefaultTimelineObjectRenderer
Adds visual feedback to an activity if it owns the focus.

Overrides:
paintActivityFocus in class DefaultTimelineObjectRenderer
Parameters:
g - the graphics context into which to draw

getPercentageFillColor1

public java.awt.Color getPercentageFillColor1()
Returns the first fill color used for drawing a gradient in the background of the activity object. The amount of the background that will be filled is based on the percentage complete value of the activity object.

Returns:
the first color used for filling the background with a gradient
Since:
1.0

setPercentageFillColor1

public void setPercentageFillColor1(java.awt.Color color)
Sets the first fill color used for drawing a gradient in the background of the activity object. The amount of the background that will be filled is based on the percentage complete value of the activity object.

Parameters:
color - the first color used for filling the background with a gradient
Since:
1.0

getPercentageFillColor2

public java.awt.Color getPercentageFillColor2()
Returns the second fill color used for drawing a gradient in the background of the activity object. The amount of the background that will be filled is based on the percentage complete value of the activity object.

Returns:
the second color used for filling the background with a gradient
Since:
1.0

setPercentageFillColor2

public void setPercentageFillColor2(java.awt.Color color)
Sets the second fill color used for drawing a gradient in the background of the activity object. The amount of the background that will be filled is based on the percentage complete value of the activity object.

Parameters:
color - the second color used for filling the background with a gradient
Since:
1.0

getActivityObject

protected IActivityObject getActivityObject()
Returns the activity object that is currently being rendered.

Returns:
the rendered activity object
Since:
1.0