📜 ⬆️ ⬇️

What's new in CUBA Platform 6.4

CUBA Generic UI templates


We recently released a new release of the CUBA Platform and CUBA Studio. If in version 6.3 we focused on architectural and technical innovations, then this release added many features to the platform, with which the development process became faster and more convenient. We added new visual components of the universal user interface, a centralized data validation mechanism, an engine for generating an alternative front-end based on Google Polymer and other important improvements. Details - under the cut.


Disclaimer: The article is primarily addressed to developers already familiar with the CUBA platform .



Studio Templates


Previously, Studio offered a choice of several fixed screen templates. Now, a whole set of customizable and extensible templates is available for creating screens of a universal user interface and an alternative interface on Polymer.


The list of Generic UI templates, as in the screenshot above, can be opened by clicking New on the Generic UI tab of the navigator. Another way is to select an entity, click New, and then the Generic UI screen . In the second case, the list of templates will be filtered and will display only the templates of the screens for viewing and editing entities.


You cannot edit the templates that came with Studio, but you can copy and modify them as you like. To create a custom template, select the base template and click Copy template . Now you can change the properties of the new template, write the code for the XML descriptor and the screen controller, and set localized messages. The content of the template is stored in the project folder studio-templates, where you can commit it to the repository with the source code.


This also applies to templates for Polymer UI, the only difference is that the template will contain an HTML file with a Polymer component.


Screen Layout Controls



With the help of a visual layout designer, you can set the size of the canvas or move the lines that indicate the borders of the components. If an absolute canvas size is set, for example, 1600x900, and the content does not fit in it, scroll bars will be displayed on the canvas.


Lookup Type



When creating reference attributes, you can now immediately specify how this link should behave in the UI. By default, the links open through the lookup screen, you can also select the DROPDOWN value so that the links open as a drop-down list, and specify which actions should be displayed in the PickerField component. What this selection affects:



Please note that the Lookup type parameter must be set BEFORE generating the entity editing screen.


View type settings are saved in code using the @LookupType annotation for the entity attribute.


Value datasources



Regular data sources designed to work with a collection of entity instances can load only whole entities, which is required for CRUD operations. But sometimes it becomes necessary to display arbitrary data containing single attributes and aggregated values. Previously, this had to create non-persistent entities, write services to fill them, and add returned instances to the screen controller's data source. Now you can use value datasources to execute JPQL queries, return scalar and aggregate results, and display them in standard data-aware components.


Value datasources contain instances of the KeyValueEntity special entity, which does not have a predefined structure. You define the structure yourself in the data source immediately, creating attributes in accordance with the fields returned in your query.


Bean validation


The bean validation mechanism allows you to add constraints to entities that need to be verified by other platform mechanisms, such as visual data-aware components, editing screens and REST API. You can also validate the parameters of the service methods and return their values.


Bean validation is based on the JSR 349 ​​specification - Bean Validation 1.1 and its reference implementation: Hibernate Validator.


Cross-Datastore References



It became possible to create relationships between entities from different data stores. For example, if the Order entity is stored in the main datastore, and Customer is in the additional one, Studio will offer to create the Order.customer attribute association with the many-to-one relationship. This attribute will be non-persistent, and a new additional attribute with the Customer’s primary key will be automatically added to the Order entity. Now it is enough to include the customer attribute in views and connect it to visual components and their data sources, and the corresponding instance of the Customer entity will be saved and loaded from an additional datastor.


Transaction listeners


Transaction sheets allow you to write code that will be executed when the transaction is completed. You can use them instead of entity listeners that monitor the life cycle events of entity instances when you need to make calculations using different types of entities. In these cases, it is convenient to combine all the logic in one place for better performance.


Side menu



SideMenu is a visual component that can be used in the main screen of the application to display the side menu. Rich API allows you to programmatically add menu items, dynamically install icons and labels.


To use the side menu in a project, create a Generic UI screen in Studio using the Side menu template main window .


Data grid


The DataGrid visual component is designed as an alternative to the Table component. It greatly benefits in performance, especially when working with large data sets, and allows you to display dynamic content in different ways. DataGrid is a wrapper for the Grid component of Vaadin. We support all of its native features, while ensuring compatibility with CUBA mechanisms and adding missing Table functionality, for example, grouping.


Pivot table



PivotTable is a visual component for data analysis. It can display a dataset as a chart or pivot table, and also allows the user to change the data structure using drag-n-drop. PivotTable is based on the github.com/nicolaskruchten/pivottable JavaScript library, you can declare it in an XML screen descriptor and connect it to a data source. PivotTable comes with a premium Chart and Maps add-on.


Polymer UI



Polymer UI is a new way to quickly create front-end portals with a mobile-first responsive web interface. We recommend using this technology to create adaptive interfaces that people will use from mobile devices; or custom external portals. Administrative and back office interface is proposed to create as before using the Generic UI platform, as the fastest and most efficient way to develop.


Polymer UI is based on the Google Polymer framework and works with the CUBA middle layer through the standard REST API. The Polymer assembly system is fully integrated into the project build system. To create portals with Polymer UI, the platform provides a set of web components for working with middleware, as well as an extensive and extensible set of templates for generating components that work with data model entities.


Conclusion


As you can see, there are really many new features in this release. In addition to them, we have embodied a number of proposals and ideas of the CUBA community, posted on our forum . The list of such changes can be viewed in the platform's bug tracker .


A complete list of changes can be found in the corresponding release notes (in English):


platform-6.4-release
studio-6.4-release


In conclusion, we want to thank the active members of our community for their contribution to the development of the platform and testing the release candidate versions.


')

Source: https://habr.com/ru/post/321400/


All Articles