IUX slot configuration in the browser subapp
At a technical level, the IUX slot is an extension panel in the browser subapp.
The panel allows you to configure a list of extension views in the workbench - see extensionViews
for configuration and properties.
Any view implementing UiFrameworkView
could be inserted into the slot.
You can create a view for displaying data that would benefit from value context and can switch data whenever the selected item changes.
The following is an example view for displaying page titles, with valueContext.observe
triggering an update whenever selection changes.
package info.magnolia.ui.framework.app.extension;
import info.magnolia.ui.contentapp.browser.context.ValueContext;
import info.magnolia.ui.framework.ConfiguredViewDefinition;
import info.magnolia.ui.framework.UiFrameworkView;
import javax.inject.Inject;
import javax.jcr.Node;
import com.machinezoo.noexception.Exceptions;
import com.vaadin.ui.Composite;
import com.vaadin.ui.Label;
/**
* Complex data view :).
*/
public class DataView extends Composite implements UiFrameworkView {
@Inject
public DataView(ValueContext<Node> valueContext) {
Label pageTitle = new Label();
valueContext.observe(() -> {
Node node = valueContext.getSingleOrThrow();
pageTitle.setValue(Exceptions.wrap().get(node::getName));
});
setCompositionRoot(pageTitle);
}
private static class Definition extends ConfiguredViewDefinition<DataView> {
public Definition() {
setImplementationClass(DataView.class);
}
}
}