Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
33 commits
Select commit Hold shift + click to select a range
3c6026c
#2716 Main changes to client-side Entity Centre / Master conversions …
jhou-pro Apr 25, 2026
615392d
#2716 Remove unused imports.
jhou-pro Apr 27, 2026
a7ea864
#2716 Correct computation of moment for concrete-time-zone date prope…
jhou-pro Apr 27, 2026
5bd4840
#2716 Adjust chart decker / scatter plot date value accessors as per …
jhou-pro Apr 27, 2026
757ddce
#2716 Allow surrogate prop objects without timeZone / isDependentTime…
jhou-pro Apr 27, 2026
0c3b158
#2716 Adjust web tests.
jhou-pro Apr 27, 2026
7352823
#2716 Add property-level marker annotation.
jhou-pro Apr 27, 2026
ed2bc61
#2716 Proliferate property-level marker annotation to criteria entity…
jhou-pro Apr 27, 2026
80ac207
#2716 Ship marker annotation to UI entity type properties ('isDepende…
jhou-pro Apr 27, 2026
4aa4eda
#2716 Simplify date widgets generation by removing time-zone. The tim…
jhou-pro Apr 27, 2026
b6e8c96
#2716 Further simplify chart decker / scatter plot by removing unused…
jhou-pro Apr 27, 2026
3dca6ed
#2716 Adjust / extend documentation.
jhou-pro Apr 27, 2026
327d38c
#2716 Use constants instead of variables.
jhou-pro Apr 27, 2026
ee83f48
#2716 Reduce code duplication; document.
jhou-pro Apr 27, 2026
afd93cf
#2716 Unify date value conversions in chart deckers.
jhou-pro Apr 30, 2026
1734f75
#2716 Simplify chart decker / scatter plot further by removing unused…
jhou-pro Apr 30, 2026
ad2efe9
#2716 Remove unused import of low level date conversion function.
jhou-pro Apr 30, 2026
ba59ed4
#2716 Cover independent time-zone mode with web tests. Includes tests…
jhou-pro Apr 30, 2026
dee751a
#2716 Empower API method to use datePortion from EntityTypeProp, but …
jhou-pro Apr 30, 2026
658d48b
#2716 Add missing docs. Simplify code, make it safer.
jhou-pro Apr 30, 2026
c1a5da1
#2716 Further improvements and re-factoring.
jhou-pro Apr 30, 2026
e3e6f92
#2716 Simplify date widgets generation further by removing date-porti…
jhou-pro Apr 30, 2026
fd7f427
Merge branch 'develop' into Issue-#2716-independent-from-#2224
jhou-pro Jun 1, 2026
d571005
#2716 Convert JS docs to MarkDown style.
jhou-pro Jun 1, 2026
39c6381
#2716 Adjust web tests (refs #2737).
jhou-pro Jun 2, 2026
4cf873e
Merge branch 'develop' into Issue-#2716-independent-from-#2224
01es Jun 3, 2026
b266e6d
Merge branch 'develop' into Issue-#2716-independent-from-#2224
jhou-pro Jun 5, 2026
c7d5011
#2716 Remove 'collection' parameter from 'tg_toString' API in favour …
jhou-pro Jun 6, 2026
4e3062e
#2716 Reduce duplication and cognitive load through optional chaining.
jhou-pro Jun 6, 2026
8196058
#2716 Add support for server tz Date representation in tooltips of @D…
jhou-pro Jun 6, 2026
a64cfe4
#2716 Ensure that tooltip conversions are proceeded gracefully even o…
jhou-pro Jun 6, 2026
ffb414f
#2716 Correct column type condition for special tooltip logic.
jhou-pro Jun 6, 2026
3ce116f
#2716 Correct tooltip value boldness for dates in EGI.
jhou-pro Jun 6, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ public TgEntityWithTimeZoneDatesDao(final IFilter filter) {

@Override
protected IFetchProvider<TgEntityWithTimeZoneDates> createFetchProvider() {
return super.createFetchProvider().with("key", "dateProp", "datePropUtc");
return super.createFetchProvider().with("key", "dateProp", "datePropUtc", "datePropDependent");
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -215,24 +215,21 @@ private static List<NewProperty> generateCriteriaProperties(final Class<? extend
return generatedProperties;
}

/**
* Copies date-related property annotations.
*
* @param managedType
* @param propertyName
* @return
*/
/// Copies date-related property annotations.
///
private static List<Annotation> copyDateAnnotations(final Class<?> managedType, final String propertyName) {
return of(DateOnly.class, TimeOnly.class, PersistentType.class)
return of(DateOnly.class, TimeOnly.class, PersistentType.class, DependentTimeZoneMode.class)
.map(annotationType -> getPropertyAnnotationOptionally(annotationType, managedType, propertyName))
.flatMap(annotation -> annotation.isPresent() ? of(annotation.get()) : empty())
.map(annotation -> {
if (annotation instanceof DateOnly) {
return newDateOnlyAnnotation();
} else if (annotation instanceof TimeOnly) {
return newTimeOnlyAnnotation();
} else {
} else if (annotation instanceof PersistentType) {
return newUtcAnnotation();
} else {
return newDependentTimeZoneModeAnnotation();
}
})
.collect(toList());
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
package ua.com.fielden.platform.entity.annotation;

import ua.com.fielden.platform.utils.IDates;

import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
import java.util.Date;

/// An annotation for properties of type [java.util.Date] to enforce dependent time-zone mode in Web UI logic.
///
/// Please note, that appropriate [IDates#now()] and [IDates#zoned(Date)] method variations are required in server-side logic.
/// I.e. it may not be sufficient to annotate the properties with this annotation.
///
/// ```java
///static DateTime now(final IDates dates) {
/// return new DateTime(getTimeZone(dates));
///}
///static DateTime zoned(final Date date, fina IDates dates) {
/// return new DateTime(date, getTimeZone(dates));
///}
///private static DateTimeZone getTimeZone(final IDates dates) {
/// if (dates.requestTimeZone().isEmpty()) {
/// throw failure(ERR_TIME_ZONE_IS_MISSING);
/// }
/// return dates.requestTimeZone().get();
///}
/// ```
///
@Retention(RetentionPolicy.RUNTIME)
@Target({ ElementType.FIELD })
public @interface DependentTimeZoneMode {

}
Original file line number Diff line number Diff line change
@@ -1,25 +1,19 @@
package ua.com.fielden.platform.entity.annotation.factory;

import java.lang.annotation.Annotation;

import ua.com.fielden.platform.entity.annotation.DateOnly;
import ua.com.fielden.platform.entity.annotation.DependentTimeZoneMode;
import ua.com.fielden.platform.entity.annotation.PersistentType;
import ua.com.fielden.platform.entity.annotation.TimeOnly;
import ua.com.fielden.platform.types.markers.IUtcDateTimeType;

/**
* Factory for date annotations.
*
* @author TG Team
*
*/
import java.lang.annotation.Annotation;

/// Factory for date annotations.
///
public class DateAnnotations {

/**
* Instantiates {@link DateOnly} annotation.
*
* @return
*/
/// Instantiates [DateOnly] annotation.
///
public static DateOnly newDateOnlyAnnotation() {
return new DateOnly() {
@Override
Expand All @@ -29,11 +23,8 @@ public Class<? extends Annotation> annotationType() {
};
}

/**
* Instantiates {@link TimeOnly} annotation.
*
* @return
*/
/// Instantiates [TimeOnly] annotation.
///
public static TimeOnly newTimeOnlyAnnotation() {
return new TimeOnly() {
@Override
Expand All @@ -43,11 +34,8 @@ public Class<? extends Annotation> annotationType() {
};
}

/**
* Instantiates marker annotation for UTC date properties.
*
* @return
*/
/// Instantiates marker annotation for UTC date properties.
///
public static PersistentType newUtcAnnotation() {
return new PersistentType() {
@Override
Expand All @@ -66,5 +54,16 @@ public Class userType() {
}
};
}


/// Instantiates [DependentTimeZoneMode] annotation.
///
public static DependentTimeZoneMode newDependentTimeZoneModeAnnotation() {
return new DependentTimeZoneMode() {
@Override
public Class<? extends Annotation> annotationType() {
return DependentTimeZoneMode.class;
}
};
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

import ua.com.fielden.platform.entity.AbstractPersistentEntity;
import ua.com.fielden.platform.entity.annotation.CompanionObject;
import ua.com.fielden.platform.entity.annotation.DependentTimeZoneMode;
import ua.com.fielden.platform.entity.annotation.IsProperty;
import ua.com.fielden.platform.entity.annotation.KeyTitle;
import ua.com.fielden.platform.entity.annotation.KeyType;
Expand Down Expand Up @@ -41,6 +42,22 @@ public class TgEntityWithTimeZoneDates extends AbstractPersistentEntity<String>
@AfterChange(UtcDatesToLocalDefiner.class)
private Date datePropUtc;

@IsProperty
@MapTo
@Title("Date Prop Dependent")
@DependentTimeZoneMode
private Date datePropDependent;

@Observable
public TgEntityWithTimeZoneDates setDatePropDependent(final Date datePropDependent) {
this.datePropDependent = datePropDependent;
return this;
}

public Date getDatePropDependent() {
return datePropDependent;
}

@Observable
public TgEntityWithTimeZoneDates setDatePropUtc(final Date datePropUtc) {
this.datePropUtc = datePropUtc;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,19 +1,5 @@
package ua.com.fielden.platform.serialisation.jackson;

import static java.lang.Boolean.FALSE;
import static java.util.Optional.empty;
import static java.util.Optional.of;
import static ua.com.fielden.platform.entity.annotation.IsProperty.DEFAULT_DISPLAY_AS;
import static ua.com.fielden.platform.entity.annotation.IsProperty.DEFAULT_LENGTH;
import static ua.com.fielden.platform.entity.annotation.IsProperty.DEFAULT_PRECISION;
import static ua.com.fielden.platform.entity.annotation.IsProperty.DEFAULT_SCALE;
import static ua.com.fielden.platform.entity.annotation.IsProperty.DEFAULT_TRAILING_ZEROS;
import static ua.com.fielden.platform.reflection.TitlesDescsGetter.getDefaultEntityTitleAndDesc;
import static ua.com.fielden.platform.types.tuples.T2.t2;
import static ua.com.fielden.platform.utils.EntityUtils.equalsEx;

import java.util.Optional;

import ua.com.fielden.platform.entity.AbstractEntity;
import ua.com.fielden.platform.entity.annotation.DateOnly;
import ua.com.fielden.platform.entity.annotation.PersistentType;
Expand All @@ -26,15 +12,24 @@
import ua.com.fielden.platform.types.markers.IUtcDateTimeType;
import ua.com.fielden.platform.types.tuples.T2;

/**
* A set of utilities to determine if the value of some property or meta-info is default. It is used internally for Jackson entity serialiser to significantly reduce the amount of
* the information to be serialised.
*
* @author TG Team
*
*/
import java.util.Optional;

import static java.lang.Boolean.FALSE;
import static java.util.Optional.empty;
import static java.util.Optional.of;
import static ua.com.fielden.platform.entity.annotation.IsProperty.*;
import static ua.com.fielden.platform.reflection.AnnotationReflector.isPropertyAnnotationPresent;
import static ua.com.fielden.platform.reflection.TitlesDescsGetter.getDefaultEntityTitleAndDesc;
import static ua.com.fielden.platform.types.tuples.T2.t2;
import static ua.com.fielden.platform.utils.EntityUtils.equalsEx;

/// A set of utilities to determine if the value of some property or meta-info is default.
/// It is used internally for Jackson entity serialiser to significantly reduce the amount of the information to be serialised.
///
public class DefaultValueContract {
private static final String UTC = "UTC";
public static final String DATE_ONLY = "DATE";
public static final String TIME_ONLY = "TIME";

private DefaultValueContract() {
}
Expand Down Expand Up @@ -134,18 +129,14 @@ public static boolean isUtc(final Class<?> entityType, final String propertyName
return UTC.equals(getTimeZone(entityType, propertyName));
}

/**
* Returns the value that indicates what portion of date property to display.
*
* @param entityType
* @param propertyName
* @return
*/
/// Returns the value that indicates which portion of date property to display.
///
public static String getTimePortionToDisplay(final Class<?> entityType, final String propertyName) {
if (AnnotationReflector.isPropertyAnnotationPresent(DateOnly.class, entityType, propertyName)) {
return "DATE";
} else if (AnnotationReflector.isPropertyAnnotationPresent(TimeOnly.class, entityType, propertyName)) {
return "TIME";
if (isPropertyAnnotationPresent(DateOnly.class, entityType, propertyName)) {
return DATE_ONLY;
}
else if (isPropertyAnnotationPresent(TimeOnly.class, entityType, propertyName)) {
return TIME_ONLY;
}
return null;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -199,12 +199,16 @@ private static <T extends AbstractEntity<?>> EntityType createEntityTypeInfo(fin
if (!isIgnoreDefault(ignore)) {
entityTypeProp.set_ignore(ignore);
}
if (isPropertyAnnotationPresent(DateOnly.class, type, name)) {
final var timePortion = getTimePortionToDisplay(type, name);
if (DATE_ONLY.equals(timePortion)) {
entityTypeProp.set_date(TRUE);
}
if (isPropertyAnnotationPresent(TimeOnly.class, type, name)) {
else if (TIME_ONLY.equals(timePortion)) {
entityTypeProp.set_time(TRUE);
}
if (isPropertyAnnotationPresent(DependentTimeZoneMode.class, type, name)) {
entityTypeProp.set_dependentTimeZoneMode(TRUE);
}
final IsProperty isPropertyAnnotation = AnnotationReflector.getPropertyAnnotation(IsProperty.class, type, name);
if (isPropertyAnnotation != null) {
final Long length = Long.valueOf(isPropertyAnnotation.length());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,10 @@ public class EntityTypeProp extends AbstractEntity<String> {
@Title(value = "TimeZone", desc = "TimeZone of date-typed property.")
private String _timeZone;

@IsProperty
@Title(value = "Dependent Time-zone Mode", desc = "Dependent Time-zone Mode of date-typed property.")
private Boolean _dependentTimeZoneMode;

@IsProperty
@Title(value = "Is Date Only?", desc = "Should display only date portion?")
private Boolean _date;
Expand Down Expand Up @@ -156,6 +160,16 @@ public Boolean get_date() {
return _date;
}

@Observable
public EntityTypeProp set_dependentTimeZoneMode(final Boolean _dependentTimeZoneMode) {
this._dependentTimeZoneMode = _dependentTimeZoneMode;
return this;
}

public Boolean get_dependentTimeZoneMode() {
return _dependentTimeZoneMode;
}

@Observable
public EntityTypeProp set_timeZone(final String _timeZone) {
this._timeZone = _timeZone;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,19 +68,21 @@ private EntityCentre<TgEntityWithTimeZoneDates> createCentre(final Injector inje
.withSummary("total_count_", "COUNT(SELF)", "Count:The total number of matching TgEntityWithTimeZoneDates.")
.withAction(standardEditAction).also()
.addProp("dateProp").minWidth(100).also()
.addProp("datePropUtc").minWidth(100)
.addProp("datePropUtc").minWidth(100).also()
.addProp("datePropDependent").minWidth(100)
.addPrimaryAction(standardEditAction)
.build();

final EntityCentre<TgEntityWithTimeZoneDates> entityCentre = new EntityCentre<>(MiTgEntityWithTimeZoneDates.class, "MiTgEntityWithTimeZoneDates", ecc, injector, null);
return entityCentre;
}
private EntityMaster<TgEntityWithTimeZoneDates> createMaster(final Injector injector) {
final String layout = LayoutComposer.mkGridForMaster(640, 1, 2);
final String layout = LayoutComposer.mkGridForMaster(960, 1, 3);

final IMaster<TgEntityWithTimeZoneDates> masterConfig = new SimpleMasterBuilder<TgEntityWithTimeZoneDates>().forEntity(TgEntityWithTimeZoneDates.class)
.addProp("dateProp").asDateTimePicker().also()
.addProp("datePropUtc").asDateTimePicker().also()
.addProp("datePropDependent").asDateTimePicker().also()
.addAction(MasterActions.REFRESH).shortDesc("Cancel").longDesc("Cancel action")
.addAction(MasterActions.SAVE)
.setActionBarLayoutFor(Device.DESKTOP, Optional.empty(), LayoutComposer.mkActionLayoutForMaster())
Expand Down
Original file line number Diff line number Diff line change
@@ -1,41 +1,29 @@
package ua.com.fielden.platform.web.centre.api.crit.impl;

import java.util.Map;

import ua.com.fielden.platform.entity.AbstractEntity;
import ua.com.fielden.platform.serialisation.jackson.DefaultValueContract;
import ua.com.fielden.platform.web.view.master.api.widgets.datetimepicker.impl.DateTimePickerWidget;

/**
* An implementation for date double-editor criterion.
*
* @author TG Team
*
*/
import java.util.Map;

/// An implementation for date double-editor criterion.
///
public class DateCriterionWidget extends AbstractRangeCriterionWidget {

/**
* Creates an instance of {@link DateCriterionWidget} for specified entity type and property name.
*
* @param criteriaType
* @param propertyName
*/
/// Creates an instance of [DateCriterionWidget] for specified entity type and property name.
///
public DateCriterionWidget(final Class<? extends AbstractEntity<?>> root, final Class<?> managedType, final String propertyName) {
super(root, "centre/criterion/multi/range/tg-date-range-criterion", propertyName,
new DateTimePickerWidget(
AbstractCriterionWidget.generateTitleDesc(root, managedType, propertyName).getKey(),
AbstractCriterionWidget.generateNames(root, managedType, propertyName).getKey(),
false,
DefaultValueContract.getTimeZone(managedType, propertyName),
DefaultValueContract.getTimePortionToDisplay(managedType, propertyName)
),
new DateTimePickerWidget(
AbstractCriterionWidget.generateTitleDesc(root, managedType, propertyName).getValue(),
AbstractCriterionWidget.generateNames(root, managedType, propertyName).getValue(),
true,
DefaultValueContract.getTimeZone(managedType, propertyName),
DefaultValueContract.getTimePortionToDisplay(managedType, propertyName)
));
new DateTimePickerWidget(
generateTitleDesc(root, managedType, propertyName).getKey(),
generateNames(root, managedType, propertyName).getKey(),
false
),
new DateTimePickerWidget(
generateTitleDesc(root, managedType, propertyName).getValue(),
generateNames(root, managedType, propertyName).getValue(),
true
)
);
}

@Override
Expand Down
Loading
Loading