Skip to content

TimeTextIndicator JSON

roosit edited this page Oct 16, 2026 · 1 revision

TimeTextIndicator JSON

Up | Code | Русский

Purpose

This page describes the persisted format of the timeText indicator in a project, a Mixel and templates. For the user guide on editing .vttp by hand, see Time Text JSON.

Two save modes

The indicator is saved in two modes:

  • toJSON(false) is the real Mixel state: it contains the selected reference source (sourceId), the current property values, and the layer size and position.
  • toJSON(true) is the template state: it contains maket instead of size and positionInParent; the reference source is not fixed (referenceSource is written as an empty object).

Common indicator wrapper

The layer identifier is built from the plugin uid and the indicator name:

{
  "name": "com.velitask.plagin.official.timeText",
  "data": {
    "properties": {}
  }
}

Stable parts:

Part Value
plugin uid com.velitask.plagin.official
indicator name timeText

Real mixel state

In a real Mixel, the layer size and position are stored next to properties. The exact shape of the State fields depends on the current runtime, so an abbreviated structure is shown for them; properties are shown in the form that the property code writes.

{
  "name": "com.velitask.plagin.official.timeText",
  "data": {
    "size": { "...": "layer size state" },
    "positionInParent": { "...": "layer position state" },
    "properties": {
      "referenceSource": {
        "sourceId": { "value": 3 }
      },
      "font": {"name":"Dialog","style":0,"size":48,"color":{"r":255,"g":255,"b":255,"a":255}},
      "textAlign": {"value":4},
      "timeZone": {"value":""},
      "timeFormat": {"value":"dd.MM.yyyy HH:mm:ss"},
      "durationFormat": {"value":"HH:mm:ss"},
      "textTemplate": {"template":"Time {curr} / passed {passed}","vars":{"curr":"%s","tzid":"%s","passed":"%s","left":"%s"}}
    }
  }
}

Template state

A template uses maket, and referenceSource stays an empty object: when the indicator is added to a project, the runtime picks the source with the longest duration (LongestDurationStrategy).

{
  "name": "com.velitask.plagin.official.timeText",
  "data": {
    "maket": { "preset": "auto" },
    "properties": {
      "referenceSource": {},
      "font": {"name":"Dialog","style":0,"size":48,"color":{"r":255,"g":255,"b":255,"a":255}},
      "textAlign": {"value":4},
      "timeZone": {"value":""},
      "timeFormat": {"value":"dd.MM.yyyy HH:mm:ss"},
      "durationFormat": {"value":"HH:mm:ss"},
      "textTemplate": {"template":"Time {curr} / passed {passed}","vars":{"curr":"%s","tzid":"%s","passed":"%s","left":"%s"}}
    }
  }
}

An empty timeZone value ("") means the system time zone; in a real state a zone identifier is usually recorded.

Properties

JSON key Java property SDK type User meaning Default
referenceSource mReferenceSource SourceProperty The source whose start and end are used to compute {passed} and {left}. The source with the longest duration; with no selection, the project period.
font mFont FontColorProperty Text font and color. Dialog, style 0, size 48, white.
textAlign mTextAlign TextAlignProperty Text alignment in the layer. 4 (center). Allowed 0..8.
timeZone mTimeZone TimeZoneProperty The time zone for {curr}. The system time zone.
timeFormat mTimeFormat StringProperty Date and time format (DateTimeFormatter). dd.MM.yyyy HH:mm:ss.
durationFormat mDurationFormat StringProperty Duration format (Duration.format). HH:mm:ss.
textTemplate mTemplate TextTemplateProperty Text with the variables curr, tzid, passed, left. The localized Time {curr} / passed {passed}.

State format:

  • referenceSource in a real state: {"sourceId":{"value":<id>}}; in a template {}. When reading, the sourceId key is optional: without it the binding does not change.
  • font: a flat object name (string), style (number: 0 plain, 1 bold, 2 italic), size (number 1..999) and color (r, g, b, a).
  • textAlign: {"value":N}, indexes 0 TOP_LEFT, 1 TOP_CENTER, 2 TOP_RIGHT, 3 CENTER_LEFT, 4 CENTER, 5 CENTER_RIGHT, 6 BOTTOM_LEFT, 7 BOTTOM_CENTER, 8 BOTTOM_RIGHT. An out-of-range value is read as CENTER_LEFT.
  • timeZone, timeFormat, durationFormat: {"value":"<string>"}. An empty string and a missing value mean the default value. An unknown zone identifier is replaced with the system zone.
  • textTemplate: template is a string with variables in curly braces, vars is an object "variable name → format". All four formats are %s, because the values are passed as strings.

The indicator skins (compact, withZone) substitute only textTemplate.template: {curr} and {curr} ({tzid}).

Examples

A compact "time left" label in a format with days, time in UTC:

{
  "name": "com.velitask.plagin.official.timeText",
  "data": {
    "maket": { "preset": "auto" },
    "properties": {
      "referenceSource": {},
      "font": {"name":"Dialog","style":1,"size":64,"color":{"r":255,"g":255,"b":255,"a":255}},
      "textAlign": {"value":4},
      "timeZone": {"value":"UTC"},
      "timeFormat": {"value":"HH:mm"},
      "durationFormat": {"value":"d 'd' HH:mm:ss"},
      "textTemplate": {"template":"{curr} UTC / {left} left","vars":{"curr":"%s","tzid":"%s","passed":"%s","left":"%s"}}
    }
  }
}

Duration.format tokens: d, H, m, s (a doubled token adds a leading zero); literals go in single quotes; negative values are treated as zero. The H token gives the hour within the day (0–23), and days are output by the d token.

Compatibility

  • VelitaskPlagin.getUID() (com.velitask.plagin.official) must not be changed without a migration of saved projects.
  • Indicator.getName() (timeText) must not be changed without a migration.
  • Property names (referenceSource, font, textAlign, timeZone, timeFormat, durationFormat, textTemplate) must not be renamed without a migration.
  • The order of properties mostly affects the UI, while loading of the persisted state goes by name; renaming is more dangerous than reordering.
  • Template variable names (curr, tzid, passed, left) are used in saved template strings, so they must not be renamed either.

Clone this wiki locally