TimeField

TimeField is a field for displaying and entering time. It is part of the DateField component, but you can also use it separately.

time field

Component’s XML-name: timeField.

Basics

To create a TimeField associated with data, you should use the dataContainer and property attributes:

@JmixEntity
@Table(name = "UIEX1_ORDER")
@Entity(name = "uiex1_Order")
public class Order {
    @JmixGeneratedValue
    @Column(name = "ID", nullable = false)
    @Id
    private UUID id;

    @Column(name = "DELIVERY_TIME")
    @Temporal(TemporalType.TIME)
    private Date deliveryTime;
}
<data>
    <instance id="orderDc"
              class="ui.ex1.entity.Order">
        <fetchPlan extends="_base"/>
        <loader/>
    </instance>
</data>
<layout>
    <timeField dataContainer="orderDc"
               property="deliveryTime"
               caption="Delivery time"/>
</layout>

In the example above, the screen has the orderDc data container for the Order entity, which has the deliveryTime property. The reference to the data container is specified in the dataContainer attribute. The name of the entity attribute which value should be displayed in the field, is set in the property attribute.

Related entity attribute should have java.util.Date, java.time.LocalTime or java.time.OffsetTime type.

Time Format

  • You can define the time format by the time datatype and specify it in the localized messages pack in the timeFormat key.

  • You can also set the time format in the timeFormat attribute:

    <timeField timeFormat="mm/HH"/>

Attributes

resolution

The resolution attribute allows you to define time accuracy. Accepts the following values:

  • SEC

  • MIN - default value, to within a minute.

  • HOUR

<timeField resolution="SEC"/>

timeMode

The timeMode attribute allows you to choose the format for displaying the time 12-hour clock or 24-hour clock, with the corresponding values:

  • H_12

  • H_24 - by default

Events and Handlers

To generate a handler stub in Jmix Studio, select the component in the screen descriptor XML or in the Jmix UI hierarchy panel and use the Handlers tab of the Jmix UI inspector panel.

Alternatively, you can use the Generate Handler button in the top panel of the screen controller.

ContextHelpIconClickHandler

Validator

See Validator.

ValueChangeEvent

TimeField XML Attributes

TimeField XML Element