Advertisement
alex_khryst

UI annotations example

Nov 2nd, 2021
1,731
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
DCL 5.95 KB | None | 0 0
  1. // defines the layer, where annotation will be implemented
  2. @Metadata.layer: #CORE
  3.  
  4. // annotation belonging to UI.headerinfo describe an entity, its title and other
  5. @UI.headerInfo:{
  6.     // represents the title of the object page
  7.   typeName: 'Parking',
  8.  
  9.   // represents a list title
  10.   typeNamePlural: 'Parkings',
  11.  
  12.   // this annotation is mandatory and are used to represent the title of an item on the header of an item's object page
  13.   title:{
  14.   // defines exactly what type of hierarchy is used
  15.   // STANDARD maps to standart DataField without any functionality
  16.     type: #STANDARD,
  17.     // defines the value of the title
  18.     value: 'ParkID'
  19.   },
  20.   // describes another property of ui type DataFieldAbstract
  21.   description:{
  22.   // type of hierarchy with datafield
  23.     type: #STANDARD,
  24.     //path to the element with value
  25.     value: 'ParkName'
  26.   },
  27.   // represents path to an element with URL to an image which represents the object
  28.   imageUrl: 'imageUrl'
  29. }
  30.  
  31. // defines how the result of a quiried commection of entitites is shaped and how this result is displayed
  32. @UI.presentationVariant: [
  33. {
  34. // use this annotation to group and identify this group by it's value
  35.   qualifier: 'ParkTable',
  36.  
  37. // represent a collection of visualization types that can be selected for UI
  38.   visualizations: [{
  39.   // which type of visualiztion is selected
  40.     type:#AS_LINEITEM
  41.   }],
  42.   // this annotation represents a collection of sorting parameters for instances
  43.   sortOrder: [{
  44.   // defines y which property collection can be sorted
  45.     by: 'ParkName',
  46.     // Ascending sorting direction
  47.     direction: #ASC
  48.   }],
  49.     // defines the collection of properties that must be included in the result of selection
  50.   requestAtLeast: [ 'ParkID', 'ParkName', 'Capacity', 'CarsCount' ]
  51. }]
  52. annotate view zkhr_cc_c_park with
  53. {
  54.   @UI.hidden: true
  55.  
  56.   // defines properties for representing instances in a table or a list
  57.   @UI.lineItem:
  58.       [
  59.         // specifies what type of mapping is used, determines which CDS elements are required of available
  60.         // FOR_ACTION maps to DataForAction, in other words links action to the button
  61.         // dataAction defines an action which we want to bind to the button ( must define it 'cause we are using FOR_ACTION' )
  62.         // label represents value of the button text
  63.       { type: #FOR_ACTION, position: 1, dataAction: 'BOPF:CHANGESTATUS', label: 'Make park nice' }
  64.       ]
  65.      // represents collection of specific data fields which with headerinfo identifies an entity to the end user
  66.      // position defines place on UI on order of other elements
  67.      // importance describe if element should be displayed on every device
  68.      // type defines type if maping ( to what kind of object we are binding this element of UI )
  69.      // label obvioslyy
  70.   @UI.identification: [{ position: 10, importance: #HIGH, type: #FOR_ACTION, dataAction: 'BOPF:CHANGESTATUS', label: 'Make park nice'} ]
  71.   ParkUUID;
  72.   @UI.lineItem: [{
  73.      position: 10,
  74.      type: #STANDARD,
  75.      importance: #HIGH,
  76.      //refers to the action on the semantic object
  77.      // i guess display means that when we clicking on any instance from the table
  78.      semanticObjectAction: 'display'
  79.    }]
  80.    // defines how text and code will be placed
  81.    // TEXT_LAST means that code is displayed in front of the text for ex. EN ( English )
  82.   @UI.textArrangement: #TEXT_LAST
  83.   // this annotation consist of different settings for representing parts of an object in a form
  84.   @UI.fieldGroup: [{
  85.   // like an id for a group
  86.     qualifier: 'Parking',
  87.     // should we display it?
  88.     importance: #HIGH,
  89.     position: 10
  90.   }]
  91.   // allowing filtering data by this element
  92.   @UI.selectionField: [{
  93.   position: 10
  94.   }]
  95.   @EndUserText.quickInfo: 'Park ID'
  96.   @EndUserText.label: 'Park ID'
  97.   ParkID;
  98.   @UI.lineItem: [{
  99.    position: 20,
  100.    type: #STANDARD,
  101.    importance: #HIGH
  102.    }]
  103.   @EndUserText.quickInfo: 'Park Name'
  104.   @UI.fieldGroup: [{
  105.      qualifier: 'Parking',
  106.      importance: #HIGH,
  107.      position: 20
  108.      }]
  109.   @UI.selectionField: [{
  110.   position: 15
  111.   }]
  112.   @EndUserText.label: 'Park Name'
  113.   ParkName;
  114.   @UI.fieldGroup: [{
  115.    qualifier: 'Parking',
  116.    importance: #HIGH,
  117.    position: 30
  118.    }]
  119.   @EndUserText.quickInfo: 'Park Capacity'
  120.   @EndUserText.label: 'Park Capacity'
  121.   @UI.lineItem: [{
  122.   position: 30,
  123.   type: #STANDARD,
  124.   importance: #HIGH
  125.   }]
  126.   Capacity;
  127.  
  128.   @UI.lineItem: [{
  129.     label : 'Car Count',
  130.     position: 25,
  131.     type: #AS_DATAPOINT,
  132.     importance: #HIGH,
  133.     criticality: 'CapacityCriticality'
  134.   }]
  135.   @UI.dataPoint:{
  136.     title: 'Cars Count',
  137.     visualization: #PROGRESS,
  138.     targetValueElement: 'Capacity',
  139.       criticality: 'CapacityCriticality'
  140.   }
  141.   @UI.fieldGroup: [{
  142.      qualifier: 'Parking',
  143.      importance: #HIGH,
  144.      position: 20
  145.      }]
  146.     @EndUserText.label: 'Amount of cars'
  147.   CarsCount;
  148.  
  149.   @UI.lineItem: [{
  150.    position: 50,
  151.    type: #STANDARD,
  152.    importance: #HIGH,
  153.    criticality: 'CapacityCriticality'
  154.    }]
  155.   @UI.textArrangement: #TEXT_LAST
  156.   @UI.dataPoint: {
  157.     description: 'Park Status',
  158.     title: 'Park Status',
  159.     criticality: 'CapacityCriticality'
  160.   }
  161.   @UI.selectionField: [{
  162.     position: 25
  163.   }]
  164.   @EndUserText.label: 'Park Status'
  165.   ParkStatus;
  166.   @UI.lineItem: [{
  167.    position: 60,
  168.    type: #STANDARD,
  169.    importance: #HIGH
  170.    }]
  171.   @UI.fieldGroup: [{
  172.         qualifier: 'ParkAdmin',
  173.         importance: #HIGH,
  174.         position: 10
  175.         }]
  176.   @EndUserText.quickInfo: 'Created ON'
  177.   @EndUserText.label: 'Creation Date/Time'
  178.   crea_date_time;
  179.   @UI.fieldGroup: [{
  180.    qualifier: 'ParkAdmin',
  181.    importance: #HIGH,
  182.    position: 20,
  183.    type: #AS_CONTACT
  184.    }]
  185.   @UI.lineItem: [{
  186.   position: 70,
  187.   type: #STANDARD,
  188.   importance: #HIGH
  189.   }]
  190.   @EndUserText.quickInfo: 'Created BY'
  191.   @EndUserText.label: 'Created by'
  192.   crea_uname;
  193.   @UI.fieldGroup: [{
  194.    qualifier: 'ParkAdmin',
  195.    importance: #HIGH,
  196.    position: 30
  197.    }]
  198.    @EndUserText.label: 'Last change'
  199.   lchg_date_time;
  200.  
  201. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement