Tuesday, March 17, 2015

ADF BC Property Set to Group Attribute Hints

There is one ADF BC component not mentioned often - Property Set. This is a bag of properties/hints, it can be applied for EO/VO attributes. Frequently used hints can be defined in Property Set once, without repeating the same for each attribute. This simplifies maintenance, if there will be a change required in the future - much easier to change it in single place. I will show below a practical example, where Property Set is applied for EO attribute to define a date type.

You can create Property Set with ADF BC wizard:

Property Set creation is really simple - provide a name and package:

It comes with a section to define Custom Properties. I will add two properties required to set date format - FMR_FORMAT and FMT_FORMATTER. I will be using EU format for the date (dd-MM-yyyy). The advantage of Property Set - you can define multiple sets for different date formats and apply them when required:

Select EO/VO attribute and choose Property Set, it will appear in the choice list:

Attribute is assigned with domain, pointing to the Property Set:

This is how it looks on UI - Hire Date field is correctly formatted, based on the format mask defined in Property Set:

Download sample application - PropertySetApp.zip.


Anonymous said...

Andrejus, It is very helpful. But I have an issue while modifying the date as calendar flicker is showing current date not the date which is in input field. Example I set the property as to date as "MM/dd/yyyy" ( 12/10/2014), it is displaying properly fine, but when click on the calendar flicker to modify it is displaying the current date ( 03/27/2015) not the input field date.

Andrejus Baranovskis said...

Same happens even when running my sample app?