Tobago Demo

Menu

3.0 to 4.0

Migration from Tobago 3.0 to 4.0

There are some migration steps to do, dependent on the application you want to migrate. The steps can be classified by

Tag Library

ViewId over attribute "link"

Using the link attribute of <tc:link>, <tc:button>, <tc:treeCommand> or <tc:event> in Tobago 3 has three cases:

  1. External link to an URL e. g. link="http://www.apache.com"

    Here is nothing to do.

  2. Internal link to a resource e. g. link="image/alps.png"

    Here you need to add the contextPath which might not be an empty string: link="#{request.contextPath}/image/alps.png". So, this is now the same like resources used over other attributes.

  3. Internal link to a viewId e. g. link="/intro.xhtml"

    In this case you need to use the new attribute outcome="/intro.xhtml". Please use only full pathes here! This this, the GET parameter will be respected. This is needed e. g. for the windowId of DeltaSpike.

<tc:bar>

The content of <tc:bar> needs to be checked. The layout inside of the bar has been changed by CSS.

There is a new after-facet for right side content. Old code which uses <tc:flowLayout align=right> probably doesn't work correctly.

Replace the following code...

<tc:bar> <tc:flowLayout textAlign="right"> // right side content </tc:flowLayout> </tc:bar>

... with this:

<tc:bar> <f:facet name="after"> <tc:flexLayout columns="1fr auto"> // right side content </tc:flexLayout> </f:facet> </tc:bar>

Also new markups are added to change collapse/expand behavior and color scheme. For more information have a look at tc:bar

Markups

Markups are now space separated. Instead of markupOne, markupTwo you can write markupOne markupTwo. Comma seperated markups are deprecated but still possible.

Default markups are removed. The default markups had rendered specific CSS classes for required/readonly/disabled components.

  • .tobago-[componentName]-markup-required
  • .tobago-[componentName]-markup-readonly
  • .tobago-[componentName]-markup-disabled

Layout Manager

<tc:flexLayout>

Column/row attribute values are now space separated. The '*' character is replaced by 'fr'.

Instead of <tc:flexLayout column="200px;auto;1*;2*;10rem"> you can write <tc:flexLayout column="200px auto 1fr 2fr 10rem">.

The old syntax is deprecated but still possible.

<tc:segmentLayout>

Attribute values are now space seperated. Integer values now have the unit 'seg'.

The old syntax is deprecated but still possible.

The 12 columns of a segment layout are no longer filled up.

Explained on the example medium="3seg 4seg":

  • Result in Tobago3: The first child of the segment layout spans 3 columns, the second 4 columns, the third 5 columns (filled up) and the fourth 3 columns again.
  • Result in Tobago4: The first child spans 3 columns, the second 4 columns, the third 3 columns again and the fourth 4 columns.

There are also two new 'auto' and '1fr' attribute values. For more information see tc:segmentLayout.

<tc:gridLayout>

The attribute syntax for columns and rows has also been changed. See script below.

<tc:sheet>

The attribute syntax for columns has also been changed. See script below.

Migration script for layout attributes

Here is a simple migration script, that may help you to change the layout attributes in the facelets XHTML files.

CSS / Bootstrap

The included Bootstrap CSS library has been updated from v4.0.0-alpha.5 to v4.0.0-beta.2. Thought some changes need to be made, if you use Bootstrap classes directly.

Some of the generated HTML code has been changed, mostly in these tags:

  • <tc:menu>
  • <tc:box>
  • <tc:bar>
  • <tc:segmentLayout>

Here you may need modifications only, if you have own CSS with are related with these tags.

Theme building

Building a theme is in general compatible, but if using the build mechanism of Tobago (defined in the pom.xml of tobago-theme) it can be better automated. The build mechanism now uses _tobago.scss from tobago-core to generated the CSS file, the is no longer a manual copy needed.

CRLF in textarea

CRLF in textarea will be converted to LF automatically to avoid inconsistencies with length validation. If you need the old behavior, set <decode-line-feed>false</decode-line-feed> in the tobago-config.xml.

Removed class: MetaInfResourcesClasspathResourceResolver

The deprecated class org.apache.myfaces.tobago.facelets.MetaInfResourcesClasspathResourceResolver has been removed, because it was no longer needed since Servelt 3.0. You may remove this context parameter in your web.xml.

<context-param> <param-name>javax.faces.FACELETS_RESOURCE_RESOLVER</param-name> <param-value>org.apache.myfaces.tobago.facelets.MetaInfResourcesClasspathResourceResolver</param-value> </context-param>
© 2005-2023 Apache Software Foundation, Licensed under the Apache License, Version 2.0.