Class ProgressBar
setProgress(float) in [0..1]); setIndeterminate(boolean) switches
to an animated sweeping pill (frame-clock ticker) for unknown-duration work.
The determinate fill eases from the previous value to the new one through a
shared Transition. A rounded track and fill, both from the Theme.
The bar follows the ControlSize resolved on it through exactly one token,
progressThickness (4 / 6 / 8 / 10 / 12): every other quantity it paints already
derives from Widget.height(): the pill radius, the minimum determinate fill, the
indeterminate pill length and its travel. The long axis is free: 220 pt at
every step, deliberately equal to Slider's so a bar and a slider
stacked in a form line up, and a parent normally overrides it anyway.
setThickness(float) and setPreferredWidth(float) latch: an explicit value beats
the step and survives every later step change, and a negative value (UNSET) hands
the dimension back to the step.
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final floatMarks a dimension as "follow the step", theSizedBox.UNSETidiom. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbooleanWhether the bar animates instead of showing a fraction.protected voidCalled when this widget enters a scene (attached to the tree).protected voidCalled when this widget leaves the scene (detached from the tree).protected SizeonMeasure(Constraints constraints) Reports the size this widget wants withinconstraints.protected voidWidget's own background/content, in local coordinates.floatprogress()Completion in[0,1]; meaningless whileisIndeterminate().setIndeterminate(boolean value) Switches to (or from) the animated indeterminate sweep.setPreferredWidth(float width) Overrides the 220 pt free axis;UNSET(any negative value) restores it.setProgress(float value) Sets the determinate progress, clamped to[0..1]; the fill eases to it.setThickness(float value) Pins the bar's thickness, overriding the step'sprogressThickness;UNSET(any negative value) hands it back to the step.withControlSize(ControlSize size) Methods inherited from class limn.scene.Widget
acceptsTextInput, add, baselineOffset, baselineOffsetOf, caretRect, children, clipboard, clipsChildren, controlSize, cursor, declaredControlSize, declaredLayoutDirection, declaredLocale, focusArrivedByTraversal, height, hitTest, imageCursor, invalidate, invalidate, isEnabled, isFocusable, isFocused, isShowing, isVisible, layoutBox, layoutDirection, locale, localToSceneX, localToSceneY, markNeedsContainedLayout, markNeedsLayout, measure, moveChild, neutralBase, onCharTyped, onFileDrop, onFocusGained, onFocusLost, onKeyEvent, onLayout, onMouseEvent, onPaintOverlay, onPreedit, overlayPassesPointer, paintChildren, paintOutset, paintWidget, parent, remove, requestFocus, revealInView, scene, sceneToLocalX, sceneToLocalY, setControlSize, setCursor, setEnabled, setFocusable, setImageCursor, setInheritanceHost, setLayoutDirection, setLocale, setTooltip, setTooltip, setVisible, shapeText, textRuler, tooltip, width, x, y
-
Field Details
-
UNSET
public static final float UNSETMarks a dimension as "follow the step", theSizedBox.UNSETidiom. Both dimensions start here, so a bar that was never explicitly sized tracks itsControlSize; anything>= 0is an author's pin and wins.- See Also:
-
-
Constructor Details
-
ProgressBar
public ProgressBar()
-
-
Method Details
-
setProgress
Sets the determinate progress, clamped to[0..1]; the fill eases to it. -
progress
public float progress()Completion in[0,1]; meaningless whileisIndeterminate(). -
isIndeterminate
public boolean isIndeterminate()Whether the bar animates instead of showing a fraction. -
setIndeterminate
Switches to (or from) the animated indeterminate sweep. -
setPreferredWidth
Overrides the 220 pt free axis;UNSET(any negative value) restores it. -
setThickness
Pins the bar's thickness, overriding the step'sprogressThickness;UNSET(any negative value) hands it back to the step. A pinned value latches: a latersetControlSizedoes not disturb it. -
withControlSize
-
onAttached
protected void onAttached()Description copied from class:WidgetCalled when this widget enters a scene (attached to the tree).Widget.scene()is the scene it just joined. Fires top-down, so a parent runs before its children. Default no-op.- Overrides:
onAttachedin classWidget
-
onDetached
protected void onDetached()Description copied from class:WidgetCalled when this widget leaves the scene (detached from the tree).Widget.scene()still answers the scene being left, and becomesnullonce this returns, so releasing something the scene owns needs no field of your own to remember it by. Fires bottom-up, so children run before their parent, and every one of them can still reach the scene.Release resources here, but GPU resources must be handed to
Scene.disposeLater(limn.graphics.GpuSurface)(disposal needs the owning GL context, which is only current inside a frame). Not called onWidget.setVisible(boolean). Default no-op.- Overrides:
onDetachedin classWidget
-
onMeasure
Description copied from class:WidgetReports the size this widget wants withinconstraints. Called once per layout pass, and the result is cached against the constraints and the resolved axes (size step, layout direction, locale), so it must be a pure function of them and of this widget's own state.Resolve the
ControlSizeand theLayoutDirectiononce each here and thread them down; never read either in a constructor. The locale needs no threading: it is in scope, andI18n.locale()answers it wherever text is resolved. -
onPaint
Description copied from class:WidgetWidget's own background/content, in local coordinates.
-