com.alee.extended.progress
Class WebStepProgress

java.lang.Object
  extended by java.awt.Component
      extended by java.awt.Container
          extended by javax.swing.JComponent
              extended by com.alee.extended.progress.WebStepProgress
All Implemented Interfaces:
ShapeProvider, SizeMethods<WebStepProgress>, SwingMethods, java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable, javax.swing.SwingConstants

public class WebStepProgress
extends javax.swing.JComponent
implements javax.swing.SwingConstants, ShapeProvider, SizeMethods<WebStepProgress>

Custom progress display component.

Progress display is based on two main things: selected step and progress value. Selected step determines which step from the list of added steps is currently selected. Progress determines the progress value acomplished to reach next step.

Author:
Mikle Garin
See Also:
How to use WebStepProgress, Serialized Form

Nested Class Summary
protected  class WebStepProgress.ProgressLayout
          Custom WebStepProgress layout that places progress labels properly.
protected  class WebStepProgress.ProgressMouseAdapter
          Custom mouse adapter that handles steps and progress changes.
 
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.BaselineResizeBehavior, java.awt.Component.BltBufferStrategy, java.awt.Component.FlipBufferStrategy
 
Field Summary
protected  java.awt.Shape borderShape
           
protected  java.awt.Color disabledProgressColor
           
protected  boolean displayLabels
           
protected  java.awt.LinearGradientPaint fillPaint
           
protected  java.awt.Shape fillShape
           
protected  int labelsPosition
           
protected  java.awt.Insets margin
          Style and other settings.
protected  int orientation
           
protected  int pathFillWidth
           
protected  int pathWidth
           
protected  float progress
           
protected  java.awt.Color progressColor
           
protected  int selectedStep
           
protected  boolean selecting
          Runtime variables.
protected  boolean selectionEnabled
           
protected  StepSelectionMode selectionMode
           
protected  int shadeWidth
           
protected  int sideWidth
           
protected  int spacing
           
protected  int stepControlFillRound
           
protected  int stepControlFillWidth
           
protected  int stepControlRound
           
protected  int stepControlWidth
           
protected  java.util.List<StepData> steps
          Progress data.
protected  int stepsSpacing
           
 
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 javax.swing.SwingConstants
BOTTOM, CENTER, EAST, HORIZONTAL, LEADING, LEFT, NEXT, NORTH, NORTH_EAST, NORTH_WEST, PREVIOUS, RIGHT, SOUTH, SOUTH_EAST, SOUTH_WEST, TOP, TRAILING, VERTICAL, WEST
 
Fields inherited from interface java.awt.image.ImageObserver
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
 
Constructor Summary
WebStepProgress()
          Constructs new WebStepProgress with three default steps.
WebStepProgress(java.awt.Component... labels)
          Constructs new WebStepProgress with steps using specified labels.
WebStepProgress(int amount)
          Constructs new WebStepProgress with the specified amount of default steps.
WebStepProgress(java.util.List<StepData> steps)
          Constructs new WebStepProgress with the specified steps.
WebStepProgress(StepData... steps)
          Constructs new WebStepProgress with the specified steps.
WebStepProgress(java.lang.String... names)
          Constructs new WebStepProgress with steps using specified names in labels.
 
Method Summary
 void addSteps(java.awt.Component... steps)
          Adds steps with the specified label components.
 void addSteps(java.util.List<StepData> steps)
          Adds new steps.
 void addSteps(java.lang.String... steps)
          Adds new steps with the specified names.
protected  void clearStep(StepData step)
          Clears specified step.
protected  void clearSteps()
          Clears steps.
protected  java.awt.Shape createBorderShape()
          Creates and returns border shape.
static java.util.List<StepData> createDefaultData(int amount)
          Returns specified amount of default steps with empty label components.
protected  java.awt.LinearGradientPaint createFillPaint()
          Creates and returns fill paint.
protected  java.awt.Shape createFillShape()
          Creates and returns progress shape.
static java.util.List<StepData> createSteps(java.awt.Component... labels)
          Returns steps with the specified label components.
static java.util.List<StepData> createSteps(java.lang.String... names)
          Returns steps with WebLabel components using the specified step names.
 WebStepProgress.ProgressLayout getActualLayout()
          Returns actual component layout.
protected  java.awt.Shape getBorderShape()
          Returns border shape.
 java.awt.Color getDisabledProgressColor()
          Returns disabled progress fill color.
protected  java.awt.LinearGradientPaint getFillPaint()
          Returns fill paint.
 int getLabelsPosition()
          Returns labels position relative to progress.
 java.awt.Insets getMargin()
          Returns sides margin.
 int getMaximumHeight()
          Returns component maximum height.
 int getMaximumWidth()
          Returns component maximum width.
 int getMinimumHeight()
          Returns component minimum height.
 int getMinimumWidth()
          Returns component minimum width.
 int getOrientation()
          Returns progress orientation.
protected  java.awt.Point getPathEnd()
          Returns path end point.
protected  java.awt.Shape getPathFillShape()
          Creates and returns path fill shape.
 int getPathFillWidth()
          Returns path fill width.
protected  int getPathLength()
          Returns path length.
protected  java.awt.Shape getPathShape()
          Creates and returns path shape.
protected  java.awt.Point getPathStart()
          Returns path start point.
 int getPathWidth()
          Returns path width.
 int getPreferredHeight()
          Returns component preferred height.
 java.awt.Dimension getPreferredSize()
          Returns component preferred size.
 int getPreferredWidth()
          Returns component preferred width.
 float getProgress()
          Returns progress value.
 java.awt.Color getProgressColor()
          Returns progress fill color.
protected  java.awt.Shape getProgressShape()
          Returns progress shape.
 StepData getSelectedStep()
          Returns selected step.
 int getSelectedStepIndex()
          Returns selected step index.
 StepSelectionMode getSelectionMode()
          Returns progress selection mode.
 int getShadeWidth()
          Returns decoration shade width.
 int getSpacing()
          Returns spacing between labels and progress.
 StepData getStep(int index)
          Returns step at the specified index.
protected  java.awt.Shape getStepBorderShape(int step)
          Creates and returns step border shape.
protected  java.awt.Point getStepCenter(int step)
          Returns step center point.
 int getStepControlFillRound()
          Returns step control fill round.
 int getStepControlFillWidth()
          Returns step control fill width.
 int getStepControlRound()
          Returns step control round.
 int getStepControlWidth()
          Returns step control width.
protected  java.awt.Shape getStepFillShape(int step)
          Creates and returns step fill shape.
 java.util.List<StepData> getSteps()
          Returns list of existing steps.
 int getStepsAmount()
          Returns amount of steps.
 int getStepShapeIndexAt(java.awt.Point point)
          Returns step shape index at the specified point or -1 if none found.
 int getStepsSpacing()
          Returns spacing between step labels.
 float getTotalProgress()
          Returns total progress.
 float getTotalProgressAt(java.awt.Point point)
          Returns total progress for the specified point on progress component.
 boolean isDisplayLabels()
          Returns whether step labels should be displayed or not.
 boolean isSelectionEnabled()
          Returns whether progress selection is allowed or not.
protected  void paintComponent(java.awt.Graphics g)
          
 java.awt.Shape provideShape()
          Returns component shape.
 void removeStep(int index)
          Removes step under the specified index.
 void removeStep(StepData stepData)
          Removes specified step.
 void setDisabledProgressColor(java.awt.Color color)
          Sets disabled progress fill color.
 void setDisplayLabels(boolean displayLabels)
          Sets whether step labels should be displayed or not.
 void setLabelsPosition(int position)
          Sets labels position relative to progress.
 void setMargin(java.awt.Insets margin)
          Sets sides margin.
 void setMargin(int spacing)
          Sets sides margin.
 void setMargin(int top, int left, int bottom, int right)
          Sets sides margin.
 WebStepProgress setMaximumHeight(int maximumHeight)
          Sets component maximum height.
 WebStepProgress setMaximumWidth(int maximumWidth)
          Sets component maximum width.
 WebStepProgress setMinimumHeight(int minimumHeight)
          Sets component minimum height.
 WebStepProgress setMinimumWidth(int minimumWidth)
          Sets component minimum width.
 void setOrientation(int orientation)
          Sets progress orientation.
 void setPathFillWidth(int width)
          Sets path fill width.
 void setPathWidth(int width)
          Sets path width.
 WebStepProgress setPreferredHeight(int preferredHeight)
          Sets component preferred height.
 WebStepProgress setPreferredSize(int width, int height)
          Sets component preferred size.
 WebStepProgress setPreferredWidth(int preferredWidth)
          Sets component preferred width.
 void setProgress(float progress)
          Sets progress value.
 void setProgressColor(java.awt.Color color)
          Sets progress fill color.
 void setSelectedStep(StepData step)
          Sets selected step.
 void setSelectedStepIndex(int index)
          Sets selected step index.
 void setSelectionEnabled(boolean enabled)
          Sets whether progress selection is allowed or not.
 void setSelectionMode(StepSelectionMode mode)
          Sets progress selection mode.
 void setShadeWidth(int shadeWidth)
          Sets decoration shade width.
 void setSpacing(int spacing)
          Sets spacing between labels and progress.
 void setStepControlFillRound(int round)
          Sets step control fill round.
 void setStepControlFillWidth(int width)
          Sets step control fill width.
 void setStepControlRound(int round)
          Sets step control round.
 void setStepControlWidth(int width)
          Sets step control width.
 void setSteps(java.awt.Component... labels)
          Sets steps with the specified label components.
 void setSteps(int amount)
          Sets specified amount of new default steps with empty label components.
 void setSteps(java.util.List<StepData> steps)
          Sets new steps.
 void setSteps(java.lang.String... names)
          Sets new steps with the specified names.
 void setStepsSpacing(int spacing)
          Sets spacing between step labels.
 void setTotalProgress(float progress)
          Sets total progress.
protected  void updateBorderShape()
          Updates border shape.
protected  void updateFillShape()
          Updates fill shape.
protected  void updateShapes()
          Updates all shapes.
protected  void validateSelectedStep()
          Revalidates selected step.
 
Methods inherited from class javax.swing.JComponent
addAncestorListener, addNotify, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, fireVetoableChange, getAccessibleContext, 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, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getToolTipText, getTopLevelAncestor, getTransferHandler, getUIClassID, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, isDoubleBuffered, isLightweightComponent, isManagingFocus, isOpaque, isOptimizedDrawingEnabled, isPaintingForPrint, isPaintingTile, isRequestFocusEnabled, isValidateRoot, paint, paintBorder, paintChildren, paintImmediately, paintImmediately, paramString, 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, updateUI
 
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
 

Field Detail

margin

protected java.awt.Insets margin
Style and other settings.


shadeWidth

protected int shadeWidth

stepControlWidth

protected int stepControlWidth

stepControlRound

protected int stepControlRound

stepControlFillWidth

protected int stepControlFillWidth

stepControlFillRound

protected int stepControlFillRound

pathWidth

protected int pathWidth

pathFillWidth

protected int pathFillWidth

progressColor

protected java.awt.Color progressColor

disabledProgressColor

protected java.awt.Color disabledProgressColor

displayLabels

protected boolean displayLabels

orientation

protected int orientation

labelsPosition

protected int labelsPosition

spacing

protected int spacing

stepsSpacing

protected int stepsSpacing

selectionEnabled

protected boolean selectionEnabled

selectionMode

protected StepSelectionMode selectionMode

steps

protected final java.util.List<StepData> steps
Progress data.


selectedStep

protected int selectedStep

progress

protected float progress

selecting

protected boolean selecting
Runtime variables.


sideWidth

protected int sideWidth

borderShape

protected java.awt.Shape borderShape

fillPaint

protected java.awt.LinearGradientPaint fillPaint

fillShape

protected java.awt.Shape fillShape
Constructor Detail

WebStepProgress

public WebStepProgress()
Constructs new WebStepProgress with three default steps.


WebStepProgress

public WebStepProgress(int amount)
Constructs new WebStepProgress with the specified amount of default steps.

Parameters:
amount - amount of default steps

WebStepProgress

public WebStepProgress(java.lang.String... names)
Constructs new WebStepProgress with steps using specified names in labels.

Parameters:
names - label names

WebStepProgress

public WebStepProgress(java.awt.Component... labels)
Constructs new WebStepProgress with steps using specified labels.

Parameters:
labels - step labels

WebStepProgress

public WebStepProgress(StepData... steps)
Constructs new WebStepProgress with the specified steps.

Parameters:
steps - steps

WebStepProgress

public WebStepProgress(java.util.List<StepData> steps)
Constructs new WebStepProgress with the specified steps.

Parameters:
steps - steps
Method Detail

getMargin

public java.awt.Insets getMargin()
Returns sides margin.

Returns:
sides margin

setMargin

public void setMargin(java.awt.Insets margin)
Sets sides margin.

Parameters:
margin - new sides margin

setMargin

public void setMargin(int top,
                      int left,
                      int bottom,
                      int right)
Sets sides margin.

Parameters:
top - top side margin
left - left side margin
bottom - bottom side margin
right - right side margin

setMargin

public void setMargin(int spacing)
Sets sides margin.

Parameters:
spacing - sides margin

getShadeWidth

public int getShadeWidth()
Returns decoration shade width.

Returns:
decoration shade width

setShadeWidth

public void setShadeWidth(int shadeWidth)
Sets decoration shade width.

Parameters:
shadeWidth - decoration shade width

getStepControlWidth

public int getStepControlWidth()
Returns step control width.

Returns:
step control width

setStepControlWidth

public void setStepControlWidth(int width)
Sets step control width.

Parameters:
width - step control width

getStepControlRound

public int getStepControlRound()
Returns step control round.

Returns:
step control round

setStepControlRound

public void setStepControlRound(int round)
Sets step control round.

Parameters:
round - step control round

getStepControlFillWidth

public int getStepControlFillWidth()
Returns step control fill width.

Returns:
step control fill width

setStepControlFillWidth

public void setStepControlFillWidth(int width)
Sets step control fill width.

Parameters:
width - new step control fill width

getStepControlFillRound

public int getStepControlFillRound()
Returns step control fill round.

Returns:
step control fill round

setStepControlFillRound

public void setStepControlFillRound(int round)
Sets step control fill round.

Parameters:
round - new step control fill round

getPathWidth

public int getPathWidth()
Returns path width.

Returns:
path width

setPathWidth

public void setPathWidth(int width)
Sets path width.

Parameters:
width - new path width

getPathFillWidth

public int getPathFillWidth()
Returns path fill width.

Returns:
path fill width

setPathFillWidth

public void setPathFillWidth(int width)
Sets path fill width.

Parameters:
width - new path fill width

getProgressColor

public java.awt.Color getProgressColor()
Returns progress fill color.

Returns:
progress fill color

setProgressColor

public void setProgressColor(java.awt.Color color)
Sets progress fill color.

Parameters:
color - new progress fill color

getDisabledProgressColor

public java.awt.Color getDisabledProgressColor()
Returns disabled progress fill color.

Returns:
disabled progress fill color

setDisabledProgressColor

public void setDisabledProgressColor(java.awt.Color color)
Sets disabled progress fill color.

Parameters:
color - new disabled progress fill color

isDisplayLabels

public boolean isDisplayLabels()
Returns whether step labels should be displayed or not.

Returns:
true if step labels should be displayed, false otherwise

setDisplayLabels

public void setDisplayLabels(boolean displayLabels)
Sets whether step labels should be displayed or not.

Parameters:
displayLabels - whether step labels should be displayed or not

getOrientation

public int getOrientation()
Returns progress orientation.

Returns:
progress orientation

setOrientation

public void setOrientation(int orientation)
Sets progress orientation.

Parameters:
orientation - new progress orientation

getLabelsPosition

public int getLabelsPosition()
Returns labels position relative to progress.

Returns:
labels position relative to progress

setLabelsPosition

public void setLabelsPosition(int position)
Sets labels position relative to progress.

Parameters:
position - new labels position relative to progress

getSpacing

public int getSpacing()
Returns spacing between labels and progress.

Returns:
spacing between labels and progress

setSpacing

public void setSpacing(int spacing)
Sets spacing between labels and progress.

Parameters:
spacing - new spacing between labels and progress

getStepsSpacing

public int getStepsSpacing()
Returns spacing between step labels.

Returns:
spacing between step labels

setStepsSpacing

public void setStepsSpacing(int spacing)
Sets spacing between step labels.

Parameters:
spacing - new spacing between step labels

isSelectionEnabled

public boolean isSelectionEnabled()
Returns whether progress selection is allowed or not.

Returns:
true if progress selection is allowed, false otherwise

setSelectionEnabled

public void setSelectionEnabled(boolean enabled)
Sets whether progress selection is allowed or not.

Parameters:
enabled - whether progress selection is allowed or not

getSelectionMode

public StepSelectionMode getSelectionMode()
Returns progress selection mode.

Returns:
progress selection mode
See Also:
StepSelectionMode

setSelectionMode

public void setSelectionMode(StepSelectionMode mode)
Sets progress selection mode.

Parameters:
mode - new progress selection mode
See Also:
StepSelectionMode

getStepsAmount

public int getStepsAmount()
Returns amount of steps.

Returns:
amount of steps

getSteps

public java.util.List<StepData> getSteps()
Returns list of existing steps.

Returns:
list of existing steps

getStep

public StepData getStep(int index)
Returns step at the specified index.

Parameters:
index - step index
Returns:
step at the specified index

setSteps

public void setSteps(java.lang.String... names)
Sets new steps with the specified names.

Parameters:
names - new steps names

setSteps

public void setSteps(java.awt.Component... labels)
Sets steps with the specified label components.

Parameters:
labels - new steps label components

setSteps

public void setSteps(java.util.List<StepData> steps)
Sets new steps.

Parameters:
steps - new steps

addSteps

public void addSteps(java.lang.String... steps)
Adds new steps with the specified names.

Parameters:
steps - new steps names

addSteps

public void addSteps(java.awt.Component... steps)
Adds steps with the specified label components.

Parameters:
steps - new steps label components

addSteps

public void addSteps(java.util.List<StepData> steps)
Adds new steps.

Parameters:
steps - new steps

removeStep

public void removeStep(int index)
Removes step under the specified index.

Parameters:
index - step index

removeStep

public void removeStep(StepData stepData)
Removes specified step.

Parameters:
stepData - step to remove

setSteps

public void setSteps(int amount)
Sets specified amount of new default steps with empty label components.

Parameters:
amount - default steps amount

clearSteps

protected void clearSteps()
Clears steps.


clearStep

protected void clearStep(StepData step)
Clears specified step.

Parameters:
step - step to clear

getSelectedStep

public StepData getSelectedStep()
Returns selected step.

Returns:
selected step

setSelectedStep

public void setSelectedStep(StepData step)
Sets selected step.

Parameters:
step - new selected step

getSelectedStepIndex

public int getSelectedStepIndex()
Returns selected step index.

Returns:
selected step index

setSelectedStepIndex

public void setSelectedStepIndex(int index)
Sets selected step index.

Parameters:
index - new selected step index

validateSelectedStep

protected void validateSelectedStep()
Revalidates selected step. In case selected step doesn't exist selection will be corrected.


getProgress

public float getProgress()
Returns progress value. This is only progress between currently selected and next steps. This value is always between 0.0 and 1.0.

Returns:
progress value

setProgress

public void setProgress(float progress)
Sets progress value. This is only progress between currently selected and next steps. Value itself should be always between 0.0 and 1.0 but you can specify lesser or greater value to affect selected steps. For instance - if you provide 1.5 this will select next available step after currently selected and set progress to 0.5.

Parameters:
progress - new progress value

getTotalProgress

public float getTotalProgress()
Returns total progress. This method combines currently selected step index and progress and returns total progress.

Returns:
total progress

getTotalProgressAt

public float getTotalProgressAt(java.awt.Point point)
Returns total progress for the specified point on progress component.

Parameters:
point - point to retrive total progress for
Returns:
total progress for the specified point on progress component

setTotalProgress

public void setTotalProgress(float progress)
Sets total progress. Progress value must be between 0.0 and 1.0. It will set both - selected step and step progress values.

Parameters:
progress - total progress

paintComponent

protected void paintComponent(java.awt.Graphics g)

Overrides:
paintComponent in class javax.swing.JComponent

provideShape

public java.awt.Shape provideShape()
Returns component shape.

Specified by:
provideShape in interface ShapeProvider
Returns:
component shape

updateBorderShape

protected void updateBorderShape()
Updates border shape.


updateFillShape

protected void updateFillShape()
Updates fill shape.


updateShapes

protected void updateShapes()
Updates all shapes.


getBorderShape

protected java.awt.Shape getBorderShape()
Returns border shape. If shape is null it will be created.

Returns:
border shape

createBorderShape

protected java.awt.Shape createBorderShape()
Creates and returns border shape.

Returns:
newly created border shape

getStepBorderShape

protected java.awt.Shape getStepBorderShape(int step)
Creates and returns step border shape.

Parameters:
step - step index
Returns:
newly created step border shape

getFillPaint

protected java.awt.LinearGradientPaint getFillPaint()
Returns fill paint. If paint is null it will be created.

Returns:
fill paint

createFillPaint

protected java.awt.LinearGradientPaint createFillPaint()
Creates and returns fill paint.

Returns:
newly created fill paint

getProgressShape

protected java.awt.Shape getProgressShape()
Returns progress shape. If shape is null it will be created.

Returns:
progress shape

createFillShape

protected java.awt.Shape createFillShape()
Creates and returns progress shape.

Returns:
newly created progress shape

getStepFillShape

protected java.awt.Shape getStepFillShape(int step)
Creates and returns step fill shape.

Returns:
newly created step fill shape

getPathShape

protected java.awt.Shape getPathShape()
Creates and returns path shape.

Returns:
newly created path shape

getPathFillShape

protected java.awt.Shape getPathFillShape()
Creates and returns path fill shape.

Returns:
newly created path fill shape

getPathStart

protected java.awt.Point getPathStart()
Returns path start point.

Returns:
path start point

getPathEnd

protected java.awt.Point getPathEnd()
Returns path end point.

Returns:
path end point

getStepCenter

protected java.awt.Point getStepCenter(int step)
Returns step center point.

Parameters:
step - step index
Returns:
step center point

getPathLength

protected int getPathLength()
Returns path length.

Returns:
path length

getStepShapeIndexAt

public int getStepShapeIndexAt(java.awt.Point point)
Returns step shape index at the specified point or -1 if none found.

Parameters:
point - point to retrive shape index for
Returns:
step shape index at the specified point or -1 if none found

getPreferredWidth

public int getPreferredWidth()
Returns component preferred width.

Specified by:
getPreferredWidth in interface SizeMethods<WebStepProgress>
Returns:
component preferred width

setPreferredWidth

public WebStepProgress setPreferredWidth(int preferredWidth)
Sets component preferred width. Pass -1 to let component choose preferred width on its own.

Specified by:
setPreferredWidth in interface SizeMethods<WebStepProgress>
Parameters:
preferredWidth - new component preferred width
Returns:
modified component

getPreferredHeight

public int getPreferredHeight()
Returns component preferred height.

Specified by:
getPreferredHeight in interface SizeMethods<WebStepProgress>
Returns:
component preferred height

setPreferredHeight

public WebStepProgress setPreferredHeight(int preferredHeight)
Sets component preferred height. Pass -1 to let component choose preferred height on its own.

Specified by:
setPreferredHeight in interface SizeMethods<WebStepProgress>
Parameters:
preferredHeight - new component preferred height
Returns:
modified component

getMinimumWidth

public int getMinimumWidth()
Returns component minimum width.

Specified by:
getMinimumWidth in interface SizeMethods<WebStepProgress>
Returns:
component minimum width

setMinimumWidth

public WebStepProgress setMinimumWidth(int minimumWidth)
Sets component minimum width. Pass -1 to let component choose minimum width on its own.

Specified by:
setMinimumWidth in interface SizeMethods<WebStepProgress>
Parameters:
minimumWidth - new component minimum width
Returns:
modified component

getMinimumHeight

public int getMinimumHeight()
Returns component minimum height.

Specified by:
getMinimumHeight in interface SizeMethods<WebStepProgress>
Returns:
component minimum height

setMinimumHeight

public WebStepProgress setMinimumHeight(int minimumHeight)
Sets component minimum height. Pass -1 to let component choose minimum height on its own.

Specified by:
setMinimumHeight in interface SizeMethods<WebStepProgress>
Parameters:
minimumHeight - new component minimum height
Returns:
modified component

getMaximumWidth

public int getMaximumWidth()
Returns component maximum width.

Specified by:
getMaximumWidth in interface SizeMethods<WebStepProgress>
Returns:
component maximum width

setMaximumWidth

public WebStepProgress setMaximumWidth(int maximumWidth)
Sets component maximum width. Pass -1 to let component choose maximum width on its own.

Specified by:
setMaximumWidth in interface SizeMethods<WebStepProgress>
Parameters:
maximumWidth - new component maximum width
Returns:
modified component

getMaximumHeight

public int getMaximumHeight()
Returns component maximum height.

Specified by:
getMaximumHeight in interface SizeMethods<WebStepProgress>
Returns:
component maximum height

setMaximumHeight

public WebStepProgress setMaximumHeight(int maximumHeight)
Sets component maximum height. Pass -1 to let component choose maximum height on its own.

Specified by:
setMaximumHeight in interface SizeMethods<WebStepProgress>
Parameters:
maximumHeight - new component maximum height
Returns:
modified component

getPreferredSize

public java.awt.Dimension getPreferredSize()
Returns component preferred size.

Specified by:
getPreferredSize in interface SizeMethods<WebStepProgress>
Overrides:
getPreferredSize in class javax.swing.JComponent
Returns:
component preferred size

setPreferredSize

public WebStepProgress setPreferredSize(int width,
                                        int height)
Sets component preferred size. This method is a simple bridge for JComponent#setPreferredSize method.

Specified by:
setPreferredSize in interface SizeMethods<WebStepProgress>
Parameters:
width - component preferred width
height - component preferred height
Returns:
modified component

getActualLayout

public WebStepProgress.ProgressLayout getActualLayout()
Returns actual component layout.

Returns:
actual component layout

createSteps

public static java.util.List<StepData> createSteps(java.lang.String... names)
Returns steps with WebLabel components using the specified step names.

Parameters:
names - step names
Returns:
steps with WebLabel components using the specified step names

createSteps

public static java.util.List<StepData> createSteps(java.awt.Component... labels)
Returns steps with the specified label components.

Parameters:
labels - label components
Returns:
steps with the specified label components

createDefaultData

public static java.util.List<StepData> createDefaultData(int amount)
Returns specified amount of default steps with empty label components.

Parameters:
amount - steps amount
Returns:
specified amount of default steps with empty label components