3.5.4. Facets
Facets are screen elements that are not added to the screen layout, unlike visual components. Instead, they add supplementary behavior to the screen or one of its components.
Facets defined in the facets
element of the XML descriptor. The framework provides the following facets:
The application or an add-on can provide its own facets. In order to create a custom facet, follow the steps below:
-
Create an interface extending
com.haulmont.cuba.gui.components.Facet
. -
Create implementation class based on
com.haulmont.cuba.web.gui.WebAbstractFacet
. -
Create a Spring bean implementing the
com.haulmont.cuba.gui.xml.FacetProvider
interface parameterized by the type of your facet. -
Create an XSD to be used in screens XML.
-
Optionally, mark facet interface and its methods with metadata annotations to add support for the facet in the Screen Designer of the CUBA Studio.
Classes ClipboardTrigger
, WebClipboardTrigger
and ClipboardTriggerFacetProvider
of the framework can be a good example of creating a facet.