...
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 |
---|
0 | info.magnolia.ui.workbench.container.Refreshable |
---|
rangeHigherVersion | 5.7 |
---|
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
Javadoc |
---|
0 | info.magnolia.ui.workbench.container.Refreshable |
---|
|
is optional but recommended.
Concrete Vaadin Containers
rangeHigherVersion | 5.7 |
---|
className | info.magnolia.ui.workbench.container.Refreshable |
---|
renderType | asynchronous |
---|
|
is optional but recommended.
Concrete Vaadin Containers
Vaadin offers some concrete Containers. Use IndexedContainerVaadin offers some concrete Containers. Use IndexedContainer for a list and HierarchicalContainer for a tree. The hierarchical Container extends the list. Both extend AbstractInMemoryContainer.
...
- 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 ContentConnector. For example, JcrItemId is a plain
Javadoc resource link |
---|
rangeHigherVersion | 5.7 |
---|
className | info.magnolia.ui.vaadin.integration.contentconnector.ContentConnector |
---|
renderType | asynchronous |
---|
|
. For example, JcrItemId is a plain Java object that carries two properties: uuid
and workspace
. 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 ContentConnectorof
Javadoc resource link |
---|
rangeHigherVersion | 5.7 |
---|
className | info.magnolia.ui.vaadin.integration.contentconnector.ContentConnector |
---|
renderType | asynchronous |
---|
|
.
What is a good ItemId? String or POJO?
...
Javadoc |
---|
0 | info.magnolia.ui.workbench.ContentPresenter |
---|
rangeHigherVersion | 5.7 |
---|
className | info.magnolia.ui.workbench.ContentPresenter |
---|
renderType | asynchronous |
---|
|
implementation Javadoc |
---|
0 | info.magnolia.ui.workbench.definition.ConfiguredContentPresenterDefinition |
---|
rangeHigherVersion | 5.7 |
---|
className | info.magnolia.ui.workbench.definition.ConfiguredContentPresenterDefinition |
---|
renderType | asynchronous |
---|
|
implementation
A content view is rendered by the content presenter which must be configured separately for each view. The data rendered on the view is provided by the Container. The presenter instantiates a suitable Container.
...
ContentPresenter
for every content view in a content app.
class
propertycolumns
node for configuring columns
Javadoc |
---|
0 | info.magnolia.ui.workbench.definition.ContentPresenterDefinition |
---|
rangeHigherVersion | 5.7 |
---|
className | info.magnolia.ui.workbench.definition.ContentPresenterDefinition |
---|
renderType | asynchronous |
---|
|
to set the implementation class of the custom content presenter.ContentPresenter
that extends Javadoc |
---|
0 | info.magnolia.ui.workbench.AbstractContentPresenterBase |
---|
rangeHigherVersion | 5.7 |
---|
className | info.magnolia.ui.workbench.AbstractContentPresenterBase |
---|
renderType | asynchronous |
---|
|
or one of its subclasses. Connected to a Container. Must implement the AbstractContentPresenterBase#initializeContainer
method.- Container that is bound to the content presenter.
...
Localtab Group |
---|
Localtab |
---|
| Advanced Tables - Table Plus |
---|
heading | 0 |
---|
multiple | false |
---|
enableHeadingAttributes | false |
---|
enableSorting | false |
---|
class | m5-configuration-tree |
---|
enableHighlighting | false |
---|
| Node name | Value |
---|
| |
| |
| |
| | info.magnolia.flickr.app.contentview.FlickrBrowserItemColumnDefinition | | info.magnolia.flickr.app.contentview.FlickrBrowserItemColumnFormatter | | title |
|
|
Localtab |
---|
| Code Block |
---|
| contentViews:
columns:
- name: title
class: info.magnolia.flickr.app.contentview.FlickrBrowserItemColumnDefinition
formatterClass: info.magnolia.flickr.app.contentview.FlickrBrowserItemColumnFormatter
propertyName: title |
|
|
...
<column name> | required The name of a column is arbitrary, however, it makes sense to use the same or similar name as the propertyName . |
class
| required A definition class which must extend Javadoc |
---|
0 | info.magnolia.ui.workbench.column.definition.AbstractColumnDefinition |
---|
rangeHigherVersion | 5.7 |
---|
className | info.magnolia.ui.workbench.column.definition.AbstractColumnDefinition |
---|
renderType | asynchronous |
---|
|
. |
formatterClass
| required A formatter class which must extend Javadoc |
---|
0 | info.magnolia.ui.workbench.column.AbstractColumnFormatter |
---|
rangeHigherVersion | 5.7 |
---|
className | info.magnolia.ui.workbench.column.AbstractColumnFormatter |
---|
renderType | asynchronous |
---|
| . |
propertyName
| required Must be | propertyName
| required Must be equal to a Container property ID. |
...
When the user selects an item in a content app a
Javadoc |
---|
0 | info.magnolia.ui.workbench.event.SelectionChangedEvent |
---|
rangeHigherVersion | 5.7 |
---|
className | info.magnolia.ui.workbench.event.SelectionChangedEvent |
---|
renderType | asynchronous |
---|
|
is fired. The event carries the ID of the selected item. The event leads to a change in the
Javadoc |
---|
0 | info.magnolia.ui.contentapp.browser.BrowserLocation |
---|
|
object rangeHigherVersion | 5.7 |
---|
className | info.magnolia.ui.contentapp.browser.BrowserLocation |
---|
renderType | asynchronous |
---|
|
object of the subapp. That's why the URL fragment methods are required.
...
Info |
---|
icon | false |
---|
title | Best practice |
---|
|
Multiexcerpt |
---|
MultiExcerptName | Make Container instance available in ContentConnector |
---|
| Make the Container instance available in your ContentConnector. This makes it easier to implement item and itemId related methods. This works only if you have only one Container per subapp. If you need more Containers you must decouple the Container and the ContentConnector. |
|
Configure and register a ContentConnector
...
- Implement
Javadoc |
---|
0 | info.magnolia.ui.vaadin.integration.contentconnector.ContentConnector |
---|
rangeHigherVersion | 5.7 |
---|
|
Create an interface which extends |
Javadoc |
---|
0 | info.magnolia.ui.vaadin.integration.contentconnector.ContentConnectorDefinition |
---|
|
, for example FlickrBrowserContentConnectorDefinition
ContentConnector | renderType | asynchronous |
---|
|
. - Create an interface which extends
Javadoc resource link |
---|
0 | info.magnolia.ui.vaadin.integration.contentconnector.ContentConnectorDefinition |
---|
rangeHigherVersion | 5.7 |
---|
className | info.magnolia.ui.vaadin.integration.contentconnector.ContentConnectorDefinition |
---|
renderType | asynchronous |
---|
|
, for example FlickrBrowserContentConnectorDefinition
. - Create a class which implements your interface and extends
Javadoc resource link |
---|
0 | info.magnolia.ui.vaadin.integration.contentconnector.ConfiguredContentConnectorDefinition |
---|
rangeHigherVersion | 5.7 |
---|
className |
---|
|
a class which implements your interface and extends Javadoc |
---|
0 | info.magnolia.ui.vaadin.integration.contentconnector.ConfiguredContentConnectorDefinition |
---|
renderType | asynchronous |
---|
|
. Set the implementation class. Configure the connector in the subapp:
Localtab Group |
---|
Localtab |
---|
| Advanced Tables - Table Plus |
---|
heading | 0 |
---|
multiple | false |
---|
enableHeadingAttributes | false |
---|
enableSorting | false |
---|
class | m5-configuration-tree |
---|
enableHighlighting | false |
---|
| Node name | Value |
---|
| |
| |
| | info.magnolia.flickr.app.contentconnector.FlickrBrowserContentConnectorDefinition | |
|
Localtab |
---|
| Code Block |
---|
| <subapp>:
contentConnector:
class: class: info.magnolia.flickr.app.contentconnector.FlickrBrowserContentConnectorDefinition |
|
|
Injecting the ContentConnector
Javadoc resource link |
---|
0 | ContentConnectorProvider |
---|
rangeHigherVersion | 5.7 |
---|
className | info.magnolia. |
---|
|
...
...
contentapp.contentconnector. |
|
...
Injecting the ContentConnector
Javadoc |
---|
0 | ContentConnectorProvider |
---|
|
creates one instance of the type of connector you set in
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 Javadoc |
---|
0 | info.magnolia.ui.contentapp.browser.BrowserSubApp |
---|
rangeHigherVersion | 5.7 |
---|
className | info.magnolia.ui.contentapp.browser.BrowserSubApp |
---|
renderType | asynchronous |
---|
| or a subclass, your subapp already injects the ContentConnector. |