1. Domino UI
  2. Components
  3. Counters Pro
Top Simple Auto Date Docs

Counters

The CountCircle class represents a circular counter component that can display and animate a numerical value within specified limits. The counter's appearance can be customized with various styles, sizes, and colors. It also provides methods to increment and decrement the value, as well as to set limits and respond to value changes.

Implements:

The DateCountDown class is a component that displays a countdown to a specific target date. It breaks down the time remaining into years, months, days, hours, minutes, and seconds, updating in real-time at one-second intervals.

The countdown supports various ways to initialize via factory methods that calculate target dates based on the current time plus the specified duration. Counters for each time unit are instances of CountCircle and can be selectively shown or hidden.

Examples

Simple counter Counters like progress bar with manual/auto control

Auto counter Update counter based on custom intervals

Date count down Special counter to countdown dates

API Docs: CountCircle

Constructors

public void CountCircle(int start, int end)
Constructs a CountCircle with the specified start and end limits for the counter. Initializes the UI elements and sets up the default configuration.

start

the initial value of the counter

end

the maximum value of the counter

Static methods

public static CountCircle create(int start, int end)
Factory method to create a new CountCircle with specified start and end values.

start

the initial value of the counter

end

the maximum value of the counter



Returns:

a new instance of CountCircle

Public methods

public CountCircle setSize(double radius, double thickness)
Sets the size of the counter circle with the specified radius and thickness.

radius

the radius of the circle

thickness

the thickness of the counter ring



Returns:

the current instance for method chaining

public CountCircle setCounterColors(String startColor, String stopColor)
Sets the start and stop colors for the count circle's gradient.

startColor

the start color for the count circle gradient

stopColor

the stop color for the count circle gradient



Returns:

the current instance for method chaining

public CountCircle setLimits(int start, int end)
Sets the start and end limits of the counter. If the start value is greater than the end, an IllegalArgumentException is thrown.

start

the starting value of the counter

end

the end value of the counter



Returns:

the current instance for method chaining

@throws IllegalArgumentException if start is greater than end
public CountCircle countUp(int increment)
Increments the current counter value by the specified increment.

increment

the value to increment the counter by



Returns:

the current instance for method chaining

public CountCircle countDown(int decrement)
Decrements the current counter value by the specified decrement.

decrement

the value to decrement the counter by



Returns:

the current instance for method chaining

public void setValue(Integer value)
Check super implementation documentation.

Sets the value of the counter. If the new value is null , the counter is set to the start value. If the new value is outside the bounds of start and end , it is capped at those limits. Triggers change listeners if they are not paused.

value

the new value to set the counter to

public Integer getValue()
Check super implementation documentation.

Retrieves the current value of the counter.

public String getTextExpression()
Gets the current text expression that is displayed on the counter. Defaults to "${value}" .

Returns:

the current text expression

public CountCircle setTextExpression(String textExpression)
Sets the text expression for the counter. The expression can include placeholders, e.g., "${value}" .

textExpression

the text expression to set



Returns:

the current instance for method chaining

public CountCircle pauseChangeListeners()
Check super implementation documentation.

Pauses the change listeners so that they do not fire when the counter's value changes.

public CountCircle resumeChangeListeners()
Check super implementation documentation.

Resumes the change listeners so that they will fire when the counter's value changes.

public CountCircle togglePauseChangeListeners(boolean toggle)
Check super implementation documentation.

Toggles the pause state of the change listeners.

toggle

if true, pauses the change listeners; if false, resumes them



Returns:

the current instance for method chaining

public Set<ChangeListener<? super Integer>> getChangeListeners()
Check super implementation documentation.

Retrieves the set of change listeners that are registered on the counter.

public boolean isChangeListenersPaused()
Check super implementation documentation.

Checks if the change listeners are currently paused.

public CountCircle triggerChangeListeners(Integer oldValue, Integer newValue)
Check super implementation documentation.

Triggers the change listeners with the old and new values.

oldValue

the old value of the counter

newValue

the new value of the counter



Returns:

the current instance for method chaining

public CountCircle withMainContainer(ChildHandler<CountCircle, DivElement> handler)
Applies a custom handler to the main container of the counter. This allows for additional customization and control over the main container element.

handler

a ChildHandler functional interface to apply to the main container



Returns:

the current instance for method chaining

public CountCircle withOuterContainer(ChildHandler<CountCircle, DivElement> handler)
Applies a custom handler to the outer container of the counter. This allows for additional customization and control over the outer container element.

handler

a ChildHandler functional interface to apply to the outer container



Returns:

the current instance for method chaining

public CountCircle withInnerContainer(ChildHandler<CountCircle, DivElement> handler)
Applies a custom handler to the inner container of the counter. This allows for additional customization and control over the inner container element.

handler

a ChildHandler functional interface to apply to the inner container



Returns:

the current instance for method chaining

public CountCircle withSvgElement(ChildHandler<CountCircle, SvgElement> handler)
Applies a custom handler to the SVG element of the counter. This allows for additional customization and control over the SVG element.

handler

a ChildHandler functional interface to apply to the SVG element



Returns:

the current instance for method chaining

public CountCircle withSvgCircleElement(ChildHandler<CountCircle, CircleElement> handler)
Applies a custom handler to the SVG circle element of the counter. This allows for additional customization and control over the SVG circle element.

handler

a ChildHandler functional interface to apply to the SVG circle element



Returns:

the current instance for method chaining

public CountCircle withTextElement(ChildHandler<CountCircle, SpanElement> handler)
Applies a custom handler to the text element of the counter. This allows for additional customization and control over the text element.

handler

a ChildHandler functional interface to apply to the text element



Returns:

the current instance for method chaining

public CountCircle withValue(Integer value)
Check super implementation documentation.

Sets the value of the counter, respecting whether change listeners are currently paused.

value

the new value



Returns:

this instance for method chaining

public CountCircle withValue(Integer value, boolean silent)
Check super implementation documentation.

Sets the value of the counter with an option to notify change listeners. If silent is true, change listeners will not be notified.

value

the new value to set the counter to

silent

if true, change listeners are not notified; if false, they are notified



Returns:

the current instance for method chaining

public HTMLDivElement element()
Check super implementation documentation.

Retrieves the root HTMLDivElement for the counter. This is the main container element of the counter UI.

Returns:

the root HTMLDivElement

API Docs: DateCountDown

Constructors

public void DateCountDown()
Default constructor which initializes the countdown component with default settings.

Sets up counters for seconds, minutes, hours, days, months, and years, attaching corresponding change listeners to handle transitions (e.g., when seconds roll over to decrement minutes).

A Timer is also created to update the seconds counter every second.

Static methods

public static DateCountDown create()
Factory method to create a new instance of DateCountDown . This method initializes the countdown with default settings (six counters for seconds, minutes, hours, days, months, and years).

Returns:

a new instance of DateCountDown

Public methods

public DateCountDown start(int minutes, int seconds)
Starts the countdown timer for a duration specified in minutes and seconds from the current time. The start method calculates the target end time based on the current date and time plus the given duration.

minutes

the number of minutes to count down from the current time

seconds

the number of seconds to count down in addition to the minutes



Returns:

The current DateCountDown instance for chaining method calls

public DateCountDown start(int hours, int minutes, int seconds)
Starts the countdown timer for a duration specified in hours, minutes, and seconds from the current time. The start method calculates the target end time based on the current date and time plus the given duration.

hours

the number of hours to count down from the current time

minutes

the number of minutes to count down in addition to the hours

seconds

the number of seconds to count down in addition to the hours and minutes



Returns:

The current DateCountDown instance for chaining method calls

public DateCountDown start(int days, int hours, int minutes, int seconds)
Starts the countdown timer for a duration specified in days, hours, minutes, and seconds from the current time. The start method calculates the target end time based on the current date and time plus the given duration.

days

the number of days to count down from the current time

hours

the number of hours to count down in addition to the days

minutes

the number of minutes to count down in addition to the days and hours

seconds

the number of seconds to count down in addition to the days, hours, and minutes



Returns:

The current DateCountDown instance for chaining method calls

public DateCountDown start(Date targetDate)
Starts the countdown to a specified date. The counters are initialized and the timer begins counting down every second.

targetDate

the date to count down to



Returns:

The current DateCountDown instance for chaining method calls

public DateCountDown stop()
Stops the countdown timer.

Returns:

The current DateCountDown instance for chaining method calls

public DateCountDown withYearCounter(ChildHandler<DateCountDown, CountCircle> handler)
Applies a custom handler to the year counter component. Allows additional styling or behavior to be applied.

handler

a ChildHandler functional interface to apply to the year counter



Returns:

The current DateCountDown instance for chaining method calls

public DateCountDown withMonthsCounter(ChildHandler<DateCountDown, CountCircle> handler)
Applies a custom handler to the months counter component. Allows additional styling or behavior to be applied.

handler

a ChildHandler functional interface to apply to the months counter



Returns:

The current DateCountDown instance for chaining method calls

public DateCountDown withDaysCounter(ChildHandler<DateCountDown, CountCircle> handler)
Applies a custom handler to the days counter component. Allows additional styling or behavior to be applied.

handler

a ChildHandler functional interface to apply to the days counter



Returns:

The current DateCountDown instance for chaining method calls

public DateCountDown withHoursCounter(ChildHandler<DateCountDown, CountCircle> handler)
Applies a custom handler to the hours counter component. Allows additional styling or behavior to be applied.

handler

a ChildHandler functional interface to apply to the hours counter



Returns:

The current DateCountDown instance for chaining method calls

public DateCountDown withMinutesCounter(ChildHandler<DateCountDown, CountCircle> handler)
Applies a custom handler to the minutes counter component. Allows additional styling or behavior to be applied.

handler

a ChildHandler functional interface to apply to the minutes counter



Returns:

The current DateCountDown instance for chaining method calls

public DateCountDown withSecondsCounter(ChildHandler<DateCountDown, CountCircle> handler)
Applies a custom handler to the seconds counter component. Allows additional styling or behavior to be applied.

handler

a ChildHandler functional interface to apply to the seconds counter



Returns:

The current DateCountDown instance for chaining method calls

public CountCircle getSecondsCounter()
Retrieves the seconds counter component.

Returns:

the CountCircle for seconds

public CountCircle getMinutesCounter()
Retrieves the minutes counter component.

Returns:

the CountCircle for minutes

public CountCircle getHoursCounter()
Retrieves the hours counter component.

Returns:

the CountCircle for hours

public CountCircle getDaysCounter()
Retrieves the days counter component.

Returns:

the CountCircle for days

public CountCircle getMonthsCounter()
Retrieves the months counter component.

Returns:

the CountCircle for months

public CountCircle getYearsCounter()
Retrieves the years counter component.

Returns:

the CountCircle for years

public DateCountDown showCounters()
Shows all the counters (years, months, days, hours, minutes, seconds).

Returns:

The current DateCountDown instance for chaining method calls

public DateCountDown hideCounters()
Hides all the counters (years, months, days, hours, minutes, seconds).

Returns:

The current DateCountDown instance for chaining method calls

public DateCountDown showCounters(DateCountDown.CounterUnits[] units)
Shows only the specified counters.

units

the time units whose counters should be shown



Returns:

The current DateCountDown instance for chaining method calls

public DateCountDown hideCounters(DateCountDown.CounterUnits[] units)
Hides the specified counters.

units

the time units whose counters should be hidden



Returns:

The current DateCountDown instance for chaining method calls

public DateCountDown showCounter(CounterUnits unit)
Shows the counter for a specific time unit.

unit

the time unit whose counter should be shown



Returns:

The current DateCountDown instance for chaining method calls

public DateCountDown hideCounter(CounterUnits unit)
Hides the counter for a specific time unit.

unit

the time unit whose counter should be hidden



Returns:

The current DateCountDown instance for chaining method calls

public HTMLDivElement element()
Check super implementation documentation.

Retrieves the root element of the countdown timer as an HTMLDivElement . This is the primary element that contains all the visual components of the countdown timer.

We are a group of passionate people who love what we do

Donate & Support Us