3.5.2.1.48. TimeField

TimeField is a field for displaying and entering time.

gui timeField

XML-name of the component: timeField.

  • To create a time field associated with data, dataContainer and property attributes should be used:

    <data>
        <instance id="orderDc" class="com.company.sales.entity.Order" view="_local">
            <loader/>
        </instance>
    </data>
    <layout>
        <timeField dataContainer="orderDc" property="deliveryTime"/>
    </layout>

    As you can see in the example above, the screen defines the orderDc data container for Order entity, which has deliveryTime attribute. The dataContainer attribute of the time input component contains a link to the container, and the property attribute – the name of the entity attribute displayed in the field.

    Related entity attribute should have java.util.Date or java.sql.Time type.

  • If the field is not connected to an entity attribute (i.e. the data container and attribute name are not set), you can set the data type using the datatype attribute. TimeField uses the following data types:

    • localTime

    • offsetTime

    • time

  • The time format is defined by the time datatype and is specified in the main localized messages pack in the timeFormat key.

  • The time format can also be specified in the timeFormat attribute. It can be either a format string, or a key in a message pack (with the msg:// prefix).

  • Regardless of the mentioned above format display of seconds can be controlled using showSeconds attribute. By default, seconds are displayed if the format contains ss.

    <timeField dataContainer="orderDc" property="createTs" showSeconds="true"/>
    gui timeFieldSec