public class Stopwatch
extends org.zkoss.zul.Label
setDisplayDays(boolean)setDaysDelimiter(String)setDisplayEmptyHours(boolean)setTimeDelimiter(String)
If getStartTime() and getStopTime() are set and stopwatch is not started then it displays
difference between these two points in time.
| Modifier and Type | Field and Description |
|---|---|
static String |
DAYS_DELIMITER |
static String |
DISPLAY_DAYS |
static String |
DISPLAY_EMPTY_HOURS |
static String |
LABEL_RESET |
static String |
LABEL_RUNNING |
static String |
START_TIME |
static String |
STOP_TIME |
static String |
TIME_DELIMITER |
static int |
TIME_NOT_SET |
AFTER_PAGE_ATTACHED, AFTER_PAGE_DETACHED| Constructor and Description |
|---|
Stopwatch() |
| Modifier and Type | Method and Description |
|---|---|
protected long |
getCurrentTime() |
Supplier<Long> |
getCurrentTimeSupplier() |
String |
getDaysDelimiter() |
long |
getStartTime() |
long |
getStopTime() |
String |
getTimeDelimiter() |
boolean |
isDisplayDays() |
boolean |
isDisplayEmptyHours() |
boolean |
isRunning()
Tells if stopwatch is running.
|
protected void |
renderProperties(org.zkoss.zk.ui.sys.ContentRenderer renderer) |
void |
reset()
Stops timer and resets start and stop time
|
void |
setCurrentTimeSupplier(Supplier<Long> timeSupplier)
Sets current time supplier which will be used to obtain current time in milliseconds.
|
void |
setDaysDelimiter(String daysDelimiter)
Defines delimiter between number of days and hours (default:'d' defined in global label stopwatch.delimiter.days)
|
void |
setDisplayDays(boolean displayDays)
Defines if hours should be rounded to 23 and days displayed (default:false)
|
void |
setDisplayEmptyHours(boolean displayEmptyHours)
Defines if empty hours should be displayed (default:false).
|
void |
setStartTime(long startTime) |
void |
setStopTime(long stopTime) |
void |
setTimeDelimiter(String timeDelimiter)
Defines delimiter between hours, minutes and seconds (default:':' defined in global label stopwatch.delimiter.time)
|
void |
start()
Starts stopwatch - if
getStartTime() is set then it will count elapsed time from that moment. |
void |
stop()
Stops timer (counting elapsed time in the UI) and sets current time as stop time.
|
clone, getMaxlength, getPropertyAccess, getValue, getZclass, isChildable, isHyphen, isMultiline, isPre, setHyphen, setMaxlength, setMultiline, setPre, setValuegetContext, getCtrlKeys, getPopup, getTooltip, setContext, setContext, setContextAttributes, setCtrlKeys, setPopup, setPopup, setPopupAttributes, setTooltip, setTooltip, setTooltipAttributesfocus, getAction, getDraggable, getDroppable, getExtraCtrl, getHeight, getHflex, getLeft, getRenderdefer, getSclass, getStyle, getTabindex, getTabindexInteger, getTooltiptext, getTop, getVflex, getWidth, getZindex, getZIndex, service, setAction, setClass, setDraggable, setDroppable, setFocus, setHeight, setHeight0, setHeightDirectly, setHflex, setHflex0, setHflexDirectly, setLeft, setLeftDirectly, setRenderdefer, setSclass, setStyle, setTabindex, setTabindex, setTooltiptext, setTop, setTopDirectly, setVflex, setVflex0, setVflexDirectly, setWidth, setWidth0, setWidthDirectly, setZclass, setZindex, setZIndex, setZIndexDirectlyaddAnnotation, addAnnotation, addCallback, addClientEvent, addEventHandler, addEventListener, addEventListener, addForward, addForward, addForward, addForward, addMoved, addRedrawCallback, addScopeListener, addShadowRoot, addShadowRootBefore, addSharedEventHandlerMap, appendChild, applyProperties, beforeChildAdded, beforeChildRemoved, beforeParentChanged, detach, didActivate, didActivate, didDeserialize, didDeserialize, disableBindingAnnotation, disableClientUpdate, enableBindingAnnotation, equals, getAnnotatedProperties, getAnnotatedPropertiesBy, getAnnotation, getAnnotation, getAnnotations, getAnnotations, getAnnotations, getAttribute, getAttribute, getAttribute, getAttributeOrFellow, getAttributes, getAttributes, getAuService, getAutag, getCallback, getChildren, getClientAttribute, getClientDataAttribute, getClientEvents, getDefaultMold, getDefinition, getDesktop, getEventHandler, getEventHandlerNames, getEventListenerMap, getEventListeners, getFellow, getFellow, getFellowIfAny, getFellowIfAny, getFellows, getFirstChild, getId, getLastChild, getListenerIterator, getMold, getNextSibling, getPage, getParent, getPreviousSibling, getRedrawCallback, getRoot, getShadowFellowIfAny, getShadowRoots, getShadowVariable, getShadowVariable, getShadowVariable0, getSpaceOwner, getSpecialRendererOutput, getStubonly, getSubBindingAnnotationCount, getTemplate, getTemplateNames, getUuid, getWidgetAttribute, getWidgetAttributeNames, getWidgetClass, getWidgetListener, getWidgetListenerNames, getWidgetOverride, getWidgetOverrideNames, hasAttribute, hasAttribute, hasAttribute, hasAttributeOrFellow, hasBindingAnnotation, hasFellow, hasFellow, hasSubBindingAnnotation, insertBefore, invalidate, isInvalidated, isListenerAvailable, isVisible, onChildAdded, onChildRemoved, onPageAttached, onPageDetached, onWrongValue, query, queryAll, redraw, redrawChildren, removeAttribute, removeAttribute, removeAttribute, removeCallback, removeChild, removeEventListener, removeForward, removeForward, removeRedrawCallback, removeScopeListener, removeShadowRoot, render, render, render, replace, response, response, response, service, sessionDidActivate, sessionWillPassivate, setAttribute, setAttribute, setAttribute, setAuService, setAutag, setClientAttribute, setClientDataAttribute, setDefinition, setDefinition, setId, setMold, setPage, setPageBefore, setParent, setStubonly, setStubonly, setSubBindingAnnotationCount, setTemplate, setVisible, setVisibleDirectly, setWidgetAttribute, setWidgetClass, setWidgetListener, setWidgetOverride, smartUpdate, smartUpdate, smartUpdate, smartUpdate, smartUpdate, smartUpdate, smartUpdate, smartUpdate, smartUpdate, smartUpdateWidgetListener, smartUpdateWidgetOverride, toString, updateByClient, updateSubBindingAnnotationCount, willPassivate, willPassivate, willSerialize, willSerializepublic static final int TIME_NOT_SET
public static final String START_TIME
public static final String STOP_TIME
public static final String LABEL_RUNNING
public static final String DISPLAY_EMPTY_HOURS
public static final String DISPLAY_DAYS
public static final String TIME_DELIMITER
public static final String DAYS_DELIMITER
public static final String LABEL_RESET
public long getStopTime()
public void start()
getStartTime() is set then it will count elapsed time from that moment. If
getStopTime() was set then it will be removed.public void stop()
public void reset()
public boolean isRunning()
public long getStartTime()
public void setStartTime(long startTime)
public void setStopTime(long stopTime)
public boolean isDisplayDays()
public void setDisplayDays(boolean displayDays)
displayDays - - true if days should be displayed.public String getTimeDelimiter()
public void setTimeDelimiter(String timeDelimiter)
timeDelimiter - - timeDelimiter.public String getDaysDelimiter()
public void setDaysDelimiter(String daysDelimiter)
daysDelimiter - - days delimiter.public boolean isDisplayEmptyHours()
public void setDisplayEmptyHours(boolean displayEmptyHours)
displayEmptyHours - if true then 00:45:26 or 45:26 when false.protected long getCurrentTime()
public void setCurrentTimeSupplier(Supplier<Long> timeSupplier)
timeSupplier - the supplierprotected void renderProperties(org.zkoss.zk.ui.sys.ContentRenderer renderer)
throws IOException
renderProperties in class org.zkoss.zul.LabelIOExceptionCopyright © 2018. All rights reserved.