Page History
...
float | right |
---|---|
class | menu decimal |
On this page we explain the building blocks of the content app framework and provide some guidelines.
...
- Container wraps the data of the data source. It provides methods to get items by their ID, to get all Items, to get all itemIds and so on. Every Container must implement at least the Container interface.
ItemId
is the key to get an item. Vaadin doesn't type the itemId. It is just an object. A simple itemId could be a string. In some cases an itemId is a POJO with its own properties, for example
. itemIds are sent by events.Javadoc resource link 0 info.magnolia.ui.vaadin.integration.jcr.JcrItemId rangeHigherVersion 56.70 className info.magnolia.ui.vaadin.integration.jcr.JcrItemId renderType asynchronous Item
is comparable to a row in a database table; it must implement the Vaadin Item interface. An item contains a set of properties and offers methods to add, modify and remove the properties.
Every property is identified by a property ID. The property ID is not typed either, it is just an object, usually a string. Use the property ID to configure columns in the content view.- Property is the Vaadin interface for a item property. A property has a value and a type.
...
Write methods of the Container interface are not required when running in the content app.
- If you want to manipulate data - add, edit, delete - do not manipulate Container items. Instead, create actions that interact directly with the data source. After an action is executed, the view and its underlying Container are refreshed automatically if the Container implements
.Javadoc resource link 0 info.magnolia.ui.workbench.container.Refreshable rangeHigherVersion 56.70 className info.magnolia.ui.workbench.container.Refreshable renderType asynchronous - Create a fully customized Container or extend a concrete implementation provided by Vaadin or Magnolia.
When creating a fully custom Container, implement "empty" write methods, they are not required.
Expand title Click to see the example of an "empty" method Code Block @Override public Object addItem() throws UnsupportedOperationException { throw new UnsupportedOperationException("addItem is not supported!"); }
...
- The
Container
interface is mandatory. - A Container of a tree view additionally requires at least Container.Hierarchical. Implementing Collapsible is not mandatory but helpful in a custom tree Container.
- For lazy loading behavior implement also Container.Indexed.
- Implementing
is optional but recommended.Javadoc resource link 0 info.magnolia.ui.workbench.container.Refreshable rangeHigherVersion 56.70 className info.magnolia.ui.workbench.container.Refreshable renderType asynchronous
...
- An ItemId must be unique within a Container.
- The itemId must carry enough information to fetch data from the data source to instantiate its corresponding Item. This is required in the context of
. For example, JcrItemId is a plain Java object that carries two properties:Javadoc resource link rangeHigherVersion 56.70 className info.magnolia.ui.vaadin.integration.contentconnector.ContentConnector renderType asynchronous uuid
andworkspace
. These two properties are sufficient to get data from a JCR repository given that there is access to a Session. - It must be possible to get an ItemId by a given Item in the context of
.Javadoc resource link rangeHigherVersion 56.70 className info.magnolia.ui.vaadin.integration.contentconnector.ContentConnector renderType asynchronous
...
implementationJavadoc resource link 0 info.magnolia.ui.workbench.ContentPresenter rangeHigherVersion 56.70 className info.magnolia.ui.workbench.ContentPresenter renderType asynchronous
implementationJavadoc resource link 0 info.magnolia.ui.workbench.definition.ConfiguredContentPresenterDefinition rangeHigherVersion 56.70 className info.magnolia.ui.workbench.definition.ConfiguredContentPresenterDefinition renderType asynchronous
...
ContentPresenter
for every content view in a content app.class
propertycolumns
node for configuring columns
to set the implementation class of the custom content presenter.Javadoc resource link 0 info.magnolia.ui.workbench.definition.ContentPresenterDefinition rangeHigherVersion 56.70 className info.magnolia.ui.workbench.definition.ContentPresenterDefinition renderType asynchronous ContentPresenter
that extends
or one of its subclasses. Connected to a Container. Must implement theJavadoc resource link 0 info.magnolia.ui.workbench.AbstractContentPresenterBase rangeHigherVersion 56.70 className info.magnolia.ui.workbench.AbstractContentPresenterBase renderType asynchronous AbstractContentPresenterBase#initializeContainer
method.- Container that is bound to the content presenter.
...
<column name> | required The name of a column is arbitrary, however, it makes sense to use the same or similar name as the | ||||||||||
| required A definition class which must extend
| ||||||||||
| required A formatter class which must extend
| ||||||||||
| required Must be equal to a Container property ID. |
...
When the user selects an item in a content app a
Javadoc resource link | ||||||||
---|---|---|---|---|---|---|---|---|
|
Javadoc resource link | ||||||||
---|---|---|---|---|---|---|---|---|
|
...
- Implement
.Javadoc resource link 0 info.magnolia.ui.vaadin.integration.contentconnector.ContentConnector rangeHigherVersion 56.70 className info.magnolia.ui.vaadin.integration.contentconnector.ContentConnector renderType asynchronous - Create an interface which extends
, for exampleJavadoc resource link 0 info.magnolia.ui.vaadin.integration.contentconnector.ContentConnectorDefinition rangeHigherVersion 56.70 className info.magnolia.ui.vaadin.integration.contentconnector.ContentConnectorDefinition renderType asynchronous FlickrBrowserContentConnectorDefinition
. - Create a class which implements your interface and extends
. Set the implementation class.Javadoc resource link 0 info.magnolia.ui.vaadin.integration.contentconnector.ConfiguredContentConnectorDefinition rangeHigherVersion 56.70 className info.magnolia.ui.vaadin.integration.contentconnector.ConfiguredContentConnectorDefinition renderType asynchronous Configure the connector in the subapp:
Localtab Group Localtab active true title JCR node Advanced Tables - Table Plus heading 0 multiple false enableHeadingAttributes false enableSorting false class m5-configuration-tree enableHighlighting false Node name Value
<subapp>Mgnl n
contentConnectorMgnl n
classMgnl n info.magnolia.flickr.app.contentconnector.FlickrBrowserContentConnectorDefinition Localtab title YAML Code Block language js <subapp>: contentConnector: class: info.magnolia.flickr.app.contentconnector.FlickrBrowserContentConnectorDefinition
...
Javadoc resource link | ||||||||
---|---|---|---|---|---|---|---|---|
|
ConfiguredContentConnectorDefinition
. You can inject your ContentConnector into different classes wherever it is required. You will always get the same instance....
Note | ||||||||||
---|---|---|---|---|---|---|---|---|---|---|
Since your subapp implementation class is either
|