Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Migration of unmigrated content due to installation of a new plugin

...

This is a custom Vaadin UIProvider. It gets the MagnoliaConfigurationProperties via injection, and checks for property values when queried for widgetset or theme. Vaadin's DefaultUIProvider can only resolve widgetsets and themes either from servlet parameters or via annotation.

Property Most magnolia property keys are mostly defined as constants in the SystemProperty (info.magnolia.cms.core) deprecated  deprecated class. In want of a better location for generic magnolia_ui properties (MagnoliaUiProperties?), the widgetset and theme properties keys are defined hereFor these new properties, we keep the keys where we use them, i.e. in the AdmincentralUIProvider.

Code Block
languagejava
titleAdmincentralUIProvider.java
public static final String MAGNOLIAWIDGETSET_UIPROPERTY_VAADIN_WIDGETSETKEY = "magnolia.ui.vaadin.widgetset";
public static final String MAGNOLIATHEME_UIPROPERTY_VAADIN_THEMEKEY = "magnolia.ui.vaadin.theme";

...

Code Block
languagejava
titleAdmincentralUIProvider.java
public static final String DEFAULT_WIDGETSET_NAME = "info.magnolia.ui.vaadin.gwt.MagnoliaWidgetSet";
public static final String DEFAULT_THEME_NAME = "admincentral";

 

Custom widgetset

1. Widgetset fundaments

In order to add custom widgets or Vaadin addons to your Magnolia app, you need to provide a new Widgetset.

Like for any GWT application, there can be only one Widgetset, therefore it should inherit all the Widgetsets you intend to use; in particular it must always inherit Magnolia's default widgetset (identified as info.magnolia.ui.vaadin.gwt.MagnoliaWidgetSet).

Finally, a widgetset must always be GWT-compiled before you run your Web application, and it will have to be recompiled every time the client-side code changes, or when you add that fancy Vaadin addon.

For further information about Vaadin client-side development, or about ways to compile the Widgetset,GWT compilation, please refer to the Book of Vaadin, or the GWT project website.

2. Using a custom widgetset in Magnolia

Once your widgetset is compiled, you may now tell magnolia to use it by editing your webapp's magnolia properties, and setting the key magnolia.ui.vaadin.widgetset.

The expected value is a widgetset qualified name as Vaadin expects it, without the .gwt.xml extension, e.g. some.vaadin.package.SomeWidgetset.

 

Custom app styles

1. Vaadin themes

Module styles are provided as Vaadin themes, generally using Sass.

Like for any Vaadin application, there can be only one Vaadin theme per Vaadin UI (i.e. Magnolia's AdmincentralUI). Therefore it should include all the other themes you intend to use; in particular it must always include Magnolia's default admincentral theme.

Sass themes offer the advantage of being composed from several other Vaadin themes, through Sass mixins. They are ultimately compiled and served as one big chunk of CSS.

For more information on Vaadin themes or Sass, you may refer to the Book of Vaadin or the Sass website.

 

2. Using custom styles in your Magnolia app

You can already use custom styles in your Magnolia app, by adding a theme property to your app descriptor, see App theme. However in some cases, you need the styles to be loaded without starting the app (e.g. custom dialog, custom message view).

In that case, once you have your Sass theme ready (includes the admincentralmixin and your custom styles), you may now tell magnolia to use it by editing your webapp's magnolia properties, and setting the key magnolia.ui.vaadin.theme.

The expected value is a theme name as Vaadin expects it, i.e. the name of the theme folder under src/main/resources/VAADIN/themes.