Tobago Demo

Menu

Root Dummy Intro Search Getting Started Docker What's New Migration Compatibility FAQ API Download Server Info Logging Info In Suggest Textarea Date Range Group 5 Star Rating File Upload Out Label Badge Image Figure Progress Object Checkbox Toggle Dropdown Radio Listbox SelectOneList Multi Checkbox Multi Listbox Shuttle SelectManyList Button and Link Default Command Button Group Customizer Link Group Box Panel Separator Section Header and Footer Bar Popup Popover Toast Basic example Tab Client Tab Ajax Tab Server Basic example Sheet Sorting Paginator Sheet Column Selector Sheet Selectionchange Sheet Event Sheet Action Sheet Markup Sheet Style Empty Sheet Column Bar Sheet Filter Sheet Static Header Sheet Multi Header Sheet Tree Column Panel Sheet Editable Sheet Lazy Sheet Nested Basic example Tree Command Types Tree Select Tree Editor Tree Menu Tree Listbox Intro TinyMCE CKEditor Flow Layout Flex Layout Segment Layout Label Layout Grid Layout Split Layout Message-layout Overview Collapsible Box Collapsible Popup Collapsible Panel Collapsible Section Content Validation JSR 303 Severity Messages Content Security Policy Sanitize Roles Form AccessKey Focus Exception Handler Style Tag Bootstrap Theme Icons Partial Ajax Behavior WebSocket Transition Non Faces Request Conversion Error Handling For Each ConversationScoped Download Configuration Format Locale DataAttribute Meta
Root Dummy Intro Search Getting Started Docker What's New Migration Compatibility FAQ API Download Server Info Logging Info In Suggest Textarea Date Range Group 5 Star Rating File Upload Out Label Badge Image Figure Progress Object Checkbox Toggle Dropdown Radio Listbox SelectOneList Multi Checkbox Multi Listbox Shuttle SelectManyList Button and Link Default Command Button Group Customizer Link Group Box Panel Separator Section Header and Footer Bar Popup Popover Toast Basic example Tab Client Tab Ajax Tab Server Basic example Sheet Sorting Paginator Sheet Column Selector Sheet Selectionchange Sheet Event Sheet Action Sheet Markup Sheet Style Empty Sheet Column Bar Sheet Filter Sheet Static Header Sheet Multi Header Sheet Tree Column Panel Sheet Editable Sheet Lazy Sheet Nested Basic example Tree Command Types Tree Select Tree Editor Tree Menu Tree Listbox Intro TinyMCE CKEditor Flow Layout Flex Layout Segment Layout Label Layout Grid Layout Split Layout Message-layout Overview Collapsible Box Collapsible Popup Collapsible Panel Collapsible Section Content Validation JSR 303 Severity Messages Content Security Policy Sanitize Roles Form AccessKey Focus Exception Handler Style Tag Bootstrap Theme Icons Partial Ajax Behavior WebSocket Transition Non Faces Request Conversion Error Handling For Each ConversationScoped Download Configuration Format Locale DataAttribute Meta

Migration

Migration from Tobago 5.0 to 6.0

The code of Tobago 5 and Tobago 6 is almost identical. The difference is, that Tobago 5 uses Jakarta EE 8 and Tobago 6 uses Jakarta EE 10. There is no Jakarta EE 9 version.

Jakarta EE 10 dependencies

Upgrade the dependencies to Jakarta EE 10.

In any case, JSF must be update to Faces 4.0. Depending on the implementation the new dependency could be:

  • org.apache.myfaces.core:myfaces-api:2.x -> org.apache.myfaces.core:myfaces-api:4.x
  • org.glassfish:jakarta.faces:2.x -> org.glassfish:jakarta.faces:4.x
  • javax.faces:javax.faces-api:2.x -> jakarta.faces:jakarta.faces-api:4.x

There are probably other dependencies that need to be updated. For example, Servlet 6.0 and CDI 4.0.

Jakarta namespace

Since Jakarta EE 9 the namespace has been changed from "javax" to "jakarta".

  • Java imports: import javax.* must be replaced by import jakarta.*
  • XHTML header: <ui:composition xmlns:f="http://xmlns.jcp.org/jsf/core" xmlns:ui="http://xmlns.jcp.org/jsf/facelets">
    must be replaced by
    <ui:composition xmlns:f="jakarta.faces.core" xmlns:ui="jakarta.faces.facelets">
  • web.xml context parameter names: javax.faces.* must be replaced by jakarta.faces.*

XML header

With a new Jakarta EE version, some XML headers need to be updated.

<faces-config xmlns="http://xmlns.jcp.org/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee http://xmlns.jcp.org/xml/ns/javaee/web-facesconfig_2_3.xsd" version="2.3">
must be replaced by
<faces-config xmlns="https://jakarta.ee/xml/ns/jakartaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="https://jakarta.ee/xml/ns/jakartaee https://jakarta.ee/xml/ns/jakartaee/web-facesconfig_4_0.xsd" version="4.0">

For Servlet 6.0
<web-app xmlns="http://xmlns.jcp.org/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee http://xmlns.jcp.org/xml/ns/javaee/web-app_4_0.xsd" version="4.0">
must be replaced by
<web-app xmlns="https://jakarta.ee/xml/ns/jakartaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="https://jakarta.ee/xml/ns/jakartaee https://jakarta.ee/xml/ns/jakartaee/web-app_6_0.xsd" version="6.0">

If using CDI:
<beans xmlns="http://xmlns.jcp.org/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee http://xmlns.jcp.org/xml/ns/javaee/beans_2_0.xsd" version="2.0">
must be replaced by
<beans xmlns="https://jakarta.ee/xml/ns/jakartaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="https://jakarta.ee/xml/ns/jakartaee https://jakarta.ee/xml/ns/jakartaee/beans_4_0.xsd" version="4.0">

Migration from Tobago 4.0 to 5.0

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

Theme Building

Resource Bundles

Java Class to Migrate from XML to properties

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

import java.io.FileInputStream; import java.io.FileOutputStream; import java.io.InputStream; import java.io.OutputStream; import java.util.Collections; import java.util.Enumeration; import java.util.Properties; import java.util.TreeSet; public class ConvertXmlToProperties { public static void main(String[] args) throws Exception { final String inXmlFile = args[0]; final InputStream inStream = new FileInputStream(inXmlFile); final Properties properties = new Properties(); properties.loadFromXML(inStream); final String outPropertiesFile = inXmlFile.replace(".xml", ".properties"); final OutputStream outStream = new FileOutputStream(outPropertiesFile); final Properties sorted = new Properties() { @Override public synchronized Enumeration<Object> keys() { return Collections.enumeration(new TreeSet<Object>(super.keySet())); } }; sorted.putAll(properties); sorted.store(outStream, "Converted from '" + inXmlFile + "'"); System.out.println("Converted items: " + properties.size()); } }

TobagoContext: ResourceBundle Changes

TobagoContext.getResourceBundle() now returns ResourceBundle
TobagoContext.getMessageBundle() now returns ResourceBundle

UI Components

Suggest

For local menu for the suggest box use localMenu="true" in <tc:suggest> instead of markup="localMenu" in the <tc:in>.

File Upload

The attribute placeholder in <tc:file> has been removed, because it's not supported with Bootstrap 5.

Application Icon

The attribute applicationIcon in <tc:page> has been removed. Please use the <tc:metaLink> tag instead.

Date Input

  • Completely refactored
  • Support for HTML input types: date, time, datetime-local
  • Dropped support for java.util.Calendar
  • Replace <tc:convertDateTime> with <f:convertDateTime>

Form Components

On form components labelLayout='skip' could be used in Tobago 4 to remove the bottom margin. The new attribute autoSpacing replace this. By default, it's 'true' and a bottom margin is set on form components. Use autoSpacing='false' to remove the margin.

Markups

Custom markups are no longer supported in Tobago 5. The markup attribute have to be replaced by <tc:style customClass="..."/>.

Java API

Icons

Using Bootstrap Icons and drop FontAwesome. The constants in enum org.apache.myfaces.tobago.renderkit.css.Icons has been changed to the names used by Bootstrap Icons.

JavaScript API

Listener Registration Removed

Tobago.registerListener(Demo.init, Tobago.Phase.DOCUMENT_READY); Tobago.registerListener(Demo.init, Tobago.Phase.AFTER_UPDATE);

Migration from Tobago 3.0 to 4.0

There are some migration steps to take, 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 as 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 paths 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 separated 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 separated. 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.

#! /bin/bash
# Script to replace the layout attribute syntax from Tobago 3.0 to 4.0
# (not very fast and might be optimized, but need only to run one time per project)
# usage: run this file "migrate-layout.sh" in the project parent directory.
# it will process all files in all subfolder with suffix .xhtml
# The sed command syntax works with macOS.
# For Windows (MinGW) or Linux you'll need to remove the "" behind all sed -i commands.
# For Windows (MinGW) you may need to call unix2dos at the end.
function replace_segment_one {
sed -i "" -E "s/(extraSmall|small|medium|large|extraLarge)=\"([^\"^ ]*)([0-9]+);([0-9]+)/\1=\"\2\3seg \4/g" $1
}
function replace_segment_last {
sed -i "" -E "s/(extraSmall|small|medium|large|extraLarge)=\"([^\"]*)([0-9]+)\"/\1=\"\2\3seg\"/g" $1
}
function replace_columns_rows {
sed -i "" -E "s/(columns|rows)=\"([^\"]*)([0-9]+)\*/\1=\"\2\3fr/g" $1
}
function replace_columns_rows_one {
sed -i "" -E "s/(columns|rows)=\"([^\"]*)\*/\1=\"\21fr/g" $1
}
function replace_columns_rows_fixed {
sed -i "" -E "s/(columns|rows)=\"([^\"]*)fixed/\1=\"\2auto/g" $1
}
function replace_columns_rows_semicolon {
sed -i "" -E "s/(columns|rows)=\"([^\"]*);/\1=\"\2 /g" $1
}
find . -name "*.xhtml" | while read file; do
echo "Processing file $file"
for i in `seq 1 11`;
do
replace_segment_one $file
done
replace_segment_last $file
for i in `seq 1 20`;
do
replace_columns_rows $file
done
for i in `seq 1 20`;
do
replace_columns_rows_one $file
done
for i in `seq 1 20`;
do
replace_columns_rows_fixed $file
done
for i in `seq 1 40`;
do
replace_columns_rows_semicolon $file
done
# Windows only
# unix2dos -q $file
done

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 Servlet 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>

Migration from Tobago 2.0 to 3.0

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

  • Tag library
  • Java API
  • CSS
  • JavaScript
  • External components (for Java, CSS, Javascript)

Most of these steps are relatively simple to carry out. Just replace "this" with "that" and so on. Some of them can be done with regular expressions.

Tag Library

JSP

JavaServer Pages are no longer supported. You need to migrate to Facelets as VDL. You may do that before migrating to Tobago 3.

Replacing tx with tc

<tx:in label="a" fieldId="b" id="c" /> will be transformed to <tc:in label="a" id="c" />. The id of the input element in HTML is id="c::field".

There is a little conflict between the "label" attribute used in the JSF spec. and the Tobago tx: label: Tobago means it should be displayed, and JSF spec. means that this should be used to display messages. In most cases there is no issue for that. But for the case that the application need a message label, but should not be displayed we need a new attribute:

(preliminary) "labelPosition" or "labelLayout" with value "none" With this attribute we may advise the renderer also the position of the label. Or, using an attribute "renderLable"...

<tc:time> -> <tc:date>

You need to set the <f:convertDateTime type="time"\/> inside the <tc:date/>.

<tc:cell>

Replace all <tc:cell/> with <tc:panel/>. Dependent of the used layout manager, these tags may be dropped completely.

Layout manager no longer as facet.

The layout managers are no longer a facet of a container. They are in the tree hierarchy explicitly.

Old:

<tc:panel> <f:facet name="layout"> <tc:flowLayout/> </f:facet> ... content ... </tc:panel>

New:

<tc:flowLayout> ... content ... </tc:flowLayout>

<tc:image>

<tc:image/> has no longer the attributes width and height, please use a <tc:style/>child tag instead.

<tc:sheet>

tc:column with f:facet name="dropDownBox" can now easily and much more flexible implemented with the header facet of the tc:sheet. Example: Sheet Filter

Menu

The Menu tags tc:menu, tc:menuBar, tc:menuCommand and tc:menuSeparator are no longer available and needs to be migrated to tc:links or tc:bar or tc:buttons with tc:link and tc:separator inside.

Popup

The popup was implemented new, using a general concept of collapsible in Tobago.
<tc:popupReference>
This tag is removed.
<tc:popup>
The tc:popup tag is no longer a facet of a command. The tag can be put anywhere on the page. The open/close commands now can be used flexible
Example: popup

facets

action
Replace <f:facet name="action"> with <tc:event event="load">
change
The <f:facet name="change"> and the attribute renderedPartially are replaced by <f:ajax>, use <tc:event> instead of <tc:command>

Java API

ActionListenerImpl

Class is no longer present, you should use a JSF 2 exception handler instead.

Renderer classes

The API of the RendererBase class has changed a bit. Also the automatic renderer selection has been dropped. If you write your own renderer for existing classes, you now need to register it in the faces-config.xml as usual in JSF.

Typesafety

To have typesafe code many Java classes to provide constants are migrated to Java enums, e.g. org.apache.myfaces.tobago.component.Attributes.

CSS

Bootstrap

Tobago 3 uses the great Bootstrap CSS library. Currently in version 4.0.0-alpha.5.

Class names

Because of the use of the Bootstrap lib, some Tobago CSS classes are no longer needed, and has been

box-sizing

Changed from content-box to border-box.

JavaScript

External components and dependencies

File upload

Servlet API 3.0
Tobago 3 requires Servlet API 3.0. Tought the file upload uses javax.servlet.http.Part instead of org.apache.commons.fileupload.FileItem.
Filter
You no long need to define a TobagoMultipartFormdataFilter in the web.xml.
Dependencies

There is no longer a tobago-fileupload.jar.

Remove the dependency to commons-fileupload.jar in your web app, if there is any.

FacesServlet Configuration
If using JSF 2.0 or 2.1 you will need to add a tag <multipart-config> Tag to the FacesServlet config in the web.xml. Since JSF 2.2 this is not needed.
Example: File Upload

  TODO:

    Because of the changed layout model (no longer on the server, but with browser CSS) there a some
    classes, methods and parameters removed.


    * AbstractUIPage.getActionPosition()

    * AbstractUIPage.setActionPosition()

    * class Box

    * class Dimension

    * class Position

    * ClientProperties.pageWidth

    * ClientProperties.pageHeight

    * <tc:gridLayoutConstraint> -> <tc:span> (only for attributes columnSpan and rowSpan)

    * <tc:gridLayoutConstraint> -> <tc:style> (all other attributes)

    * <tc:toolBar> -> <tc:buttons>
    * <tc:toolBarCommand> -> <tc:button>

    * If using <tc:page> with the attributes state, width, height: remove the attributes

    * TODO: use ExternalContext.redirect instead of AjaxUtils.redirect

    * Replace AjaxUtils.getRequestPartialIds() with
    FacesContext.getPartialViewContext().getExecuteIds() or
    FacesContext.getPartialViewContext().getRenderIds() respectively.

    * TODO: Move data from ClientProperties to TobagoContext

    * TODO: Replace <tc:columnEvent> with <tc:row>

    <tc:mediator> removed

    If you need a Tobago component to set e.g. some style in a renderer as a replacement,
    use a simple <tc:panel>.

    Tango Icons

    Tango icon lib is no longer part of Tobago. Replaced by Font Awesome. If you need it, please
    include it in the application.

    Dependencies to JS/CSS libs: jQuery UI

    Tobago uses the jQuery UI library. The library is customizable to limit the amount of JS and CSS content.
    You will find the used modules in the header of each jQuery UI file.

    * E.g. Tobago 2.0.10 contains jQuery UI 1.10.4 with these contents:

    * jquery.ui.core.js

    * jquery.ui.widget.js

    * jquery.ui.mouse.js

    * jquery.ui.position.js

    * jquery.ui.draggable.js

    * jquery.ui.datepicker.js

    * jquery.ui.slider.js

    * jquery.ui.core.css

    * jquery.ui.datepicker.css

    * jquery.ui.slider.css

    * jquery.ui.theme.css

    * Tobago 3.0.0 contains jQuery UI 1.12.1 with this component:

    * widget.js

    If you are using jQuery UI directly, you may add the required resources via the tobago-config.xml
      and exclude the jQuery UI resource that comes with Tobago.

Migration from Tobago 1.5 to 2.0

Tobago 2.0 has some API changes compared to Tobago 1.5.

The most changes are in the tree API, which is more easy to use, but also more flexible.

Artifacts (JAR-Files)

The following JAR files are no longer needed. They have to be removed from the project (depends on your build system).

  • tobago-taglib-extension-<version>.jar
  • tobago-facelets-<version>.jar

CSP

Tobago supports Content Security Policy (CSP) to prevent cross-site scripting (XSS) and related attacks. It is specified by W3C. In short: The HTML page doesn't contain any JavaScript or CSS information. All allowed sources for JavaScript, CSS and other resources have to be declared in special header. If you have own renderers or own JavaScript in your application, this code also needs to support CSP, to use this feature.

Warning:

CSP requires a different handling of JavaScript and other resources. If you use own JavaScript in the HTML page or including resources from other sites you may need to adapt your application, (or turn this feature off).

Configuration

To add sites to the CSP headers, add <directive> tags to <content-security-policy> in the tobago-config.xml.

To turn off CSP, add an empty <content-security-policy mode="off"> tag in the configuration. For development, you may also use mode="report-only", which sets the appropriate header.

Clickjacking

By default, it no longer possible to use a Tobago application in an HTML frame or iframe. This is to protect against Clickjacking. To disable this feature consult the tobago-config.xml and set <prevent-frame-attacks>false</prevent-frame-attacks>.

Java-API

The class org.apache.myfaces.tobago.model.TreeState which has been deprecated in 1.5.x is used in 2.0.x with a changed API. Please check the occurrences.

Class org.apache.myfaces.tobago.component.UIFileInput has been renamed to org.apache.myfaces.tobago.component.UIFile.

Renderer classes

The set of existing renderers has been repacked from org.apache.myfaces.tobago.renderkit.html.scarborough.standard.tag to org.apache.myfaces.tobago.renderkit.html.standard.standard.tag.

If you have an own theme with own renderer classes implemented, which are extending the Tobago renderer classes, you will need to adapt the package name of the base classes.

Facelets

Tobago 2.0.x is using Facelets 2.0. When still using Facelets 1.1 in the current application, this must be removed:

  • Remove facelets JAR (e.g. jsf-facelets-1.1.14.jar) from the library.
  • Remove <view-handler> org.apache.myfaces.tobago.internal.application.ViewHandlerImpl </view-handler> from the faces-config.xml file.
  • Remove the parameter javax.faces.DISABLE_FACELET_JSF_VIEWHANDLER from the web.xml file.
  • Remove or replace the facelets.* entries from the web.xml file.
  • Rename all JSTL declarations from xmlns:c="http://java.sun.com/jstl/core" to xmlns:c="http://java.sun.com/jsp/jstl/core" in the Facelets.
  • Ensure the version of the faces-config tag in the faces-config.xml is at least 2.0.

Deprecated

There are also @Deprecated annotations in the code and some logging warning when using deprecated code via the Deprecation logging category. Before and after migrating you should check your application about that.

For the migration phase you may add the tobago-deprecation.jar as dependency to your project. It contains classes that has been moved (e.g. to the new internal package) or removed. So you can resolve any migration steps step by step. It is not recommended to use the tobago-deprecation.jar for production.

Internal

The package org.apache.myfaces.tobago.internal contains classes that should not be used directly in an application. This classes may change in minor revisions without announcement. Classes in the package org.apache.myfaces.tobago.renderkit are handled in the same manner.

Tag Library

The main changes in the tag library are that the deprecated facets "resizeAction" and "menupopup" has been removed.

Suggest

Please use the new <tc:suggest> tag instead of using the inline attribute inside of <tc:in>.

deprecated: <tc:in suggestMethod="#{bean.method}"/> replacement: <tc:in> <tc:suggest suggestMethod="#{bean.method}"/> </tc:in> deprecated: <tx:in suggestMethod="#{bean.method}"/> replacement: <tx:in> <tc:suggest suggestMethod="#{bean.method}"/> </tx:in>

Tree

  • The Tree now extends a UIData.
  • The <tc:treeData> tag shouldn't longer be used.
  • The <tc:treeNode> has no longer the attributes: "selected", "expanded", "marked", "treeMarkedListener", "treeExpansionListener"
  • The class org.apache.myfaces.tobago.model.TreeState is no longer deprecated, but the functionality has slightly been changed.

Date/Time

The date and time input controls have been refactored. The old (deprecated) functionality can be activated via tobago-config.xml.

If using the new: <tc:date> can do the job of <tc:time>. You only need to set the <f:convertDateTime type="time"> inside the <tc:date>.

ToolBar with dropDownMenu facet

Usually you need to set omit="true" in the <tc:toolBarCommand>, to avoid a submit.

Configuration

To define an own theme, please use now a file tobago-config.xml instead of tobago-theme.xml. The content of tobago-theme.xml is a subset of the tobago-config.xml, you have only to change the root node.

Please use the tobago-config-2.0.xsd to validate the configuration.

JavaScript

Date/Time/Calendar components: The JavaScript for this components has been refactored. All method have now a namespace and are using jQuery. JavaScript code has been removed from the renderers. For data the HTML5 data attribute is used instead of directly coding it into the event handler, or using hidden input fields.

CSS

The class tobago-sheet-outer is renamed to tobago-sheet.
The class tobago-sheet-headerSpacerOuter is renamed to tobago-sheet-headerResize.
The class tobago-sheet-headerSpacer is no longer needed.
The class tobago-sheet-headerSpacer-markup-resizable is no longer needed.

Internal

The facet name of the picker popup is now named "popup" instead of "pickerPopup".

Migration from Tobago 1.0 to 1.5

Tobago 1.5 has a lot of changes compared to Tobago 1.0.

The good news: Most of these changes are made internally in Tobago. If you use Tobago, you don't have to change too much.

The amount of things you have to change in your application depends on how do you use it. On the Tobago Tag Library are very few changes made. On the Tobago Java Classes and the Themes are more changes. Here you can see which changes has been made.

Deprecated

There are also @Deprecated annotations in the code and some logging warning when using deprecated code via the Deprecation logging category. Before migrating you should check your application about that.

For the migration phase you may add the tobago-deprecation.jar as dependency to your project. It contains classes that has been moved (e.g. to the new internal package) or removed. So you can resolve any migration steps step by step. It is not recommended to use the tobago-deprecation.jar for production.

Internal

The new internal package contains classes that should not be used directly in an application. This classes may change in minor revisions without announcement. Classes in the renderkit package a handled in the same manner.

Tag Library

The main changes in the tag library are

deprecated
replacement
<tc:menuCheckbox>
<tx:menuCheckbox>
<tc:menuItem>
<tc:menuCommand>
<tc:message>
<tc:messages>

In <tc:sheet> the default for rows has been changed from 100 to 0, which means "unlimited".

For JSP and the tx: library all id attributes have to be renamed to fieldId. This is to adjust the JSP library to the Facelet library.

The tree tag <tc:tree> has changed comprehensive. Please check the documentation and demo examples.

The type attribute of commands has been removed. It is no longer needed, when using action, onclick or link.

Layout Manager

On of the basic changes in Tobago 1.5 is the reimplementation of the layout manager. The usage if it, has only been changed a bit. The most important is that the constraints will be set with the <tc:gridLayoutConstraint> tag. The <tc:cell> tag is deprecated now. Spans can be set directly into the component with the <tc:gridLayoutConstraint> tag.

The keyword "fixed" has been renamed to "auto".

UIComponent Classes

Some of the UIComponent classes has been renamed or restructured, to get a consistent naming schema. The used UIComponents where generated and have super classes with an "Abstract" as prefix. All getters and setters are generated in the UIComponent classes. The following code will not work in 1.5 uiComponent.getAttributes().remove("attributeName"). Please set the value to null.

old name: org.apache.myfaces.tobago.component.UISelectOne
new name: org.apache.myfaces.tobago.internal.component.AbstractUISelectOneBase

Naming Container

UITab is now a naming container, so you may have to change ids of AJAX calls in your application.

Other API Classes

The class org.apache.myfaces.tobago.OnComponentCreated is moved to org.apache.myfaces.tobago.component.OnComponentCreated.
The class org.apache.myfaces.tobago.component.ComponentUtil is moved to org.apache.myfaces.tobago.util.ComponentUtils.
The class org.apache.myfaces.tobago.renderkit.RenderUtil is moved to org.apache.myfaces.tobago.renderkit.util.RenderUtils.
The class org.apache.myfaces.tobago.renderkit.html.HtmlRendererUtil is renamed to org.apache.myfaces.tobago.renderkit.html.util.HtmlRendererUtils.

Themes and CSS

Note: This effects your application only, when you've written your own theme, or using this classes in a separate style file.

The basic changes in CSS are:

  • Using CSS 2.1 compliant content box model instead of Quirks mode border box model.
  • Changed HTML structure for some components.

The CSS class name schema has been revised. See the JavaDoc of the Classes class to check the naming schema.

old name
new name
tobago-[tagName]-default
tobago-[tagName]
tobago-[tagName]-error
tobago-[tagName]-markup-error
tobago-[tagName]-required
tobago-[tagName]-markup-required
tobago-[tagName]-readonly
tobago-[tagName]-markup-readonly
tobago-[tagName]-disabled
tobago-[tagName]-markup-disabled
tree-junction
tobago-treeNode-junction
tree-*
tobago-treeNode-*
tobago-input-picker
tobago-datePicker-icon
tobago-popup-iframe
tobago-popup-ie6bugfix
tobago-textArea-*
tobago-textarea-*
tobago-progress-color1-*
tobago-progress-value-*

The class tobago-progress-color2-* is deleted.

JavaScript

The JavaScript API has been refactored. Most application do not use the Tobago JavaScript API directly. But if it does, you have to apply some changes.

The most important things, is the additional first parameter on the submitting functions to compute the position of the action element.

If you are using submitAction() in the old code, you have to add the action element or just null. If you are using submitAction2() in the old code, you have to rename it to submitAction().

added first parameter and put all parameters after the second to an options map

submitAction()

renamed

submitAction2()

submitAction()

added first parameter

openPopupWithAction()

renamed

openPopupWithAction2()

openPopupWithAction()

added first parameter

reloadComponent()

renamed

reloadComponent2()

reloadComponent()

added first parameter

Updater.update()

renamed

Updater.update2()

Updater.update()

added first parameter

Sheet.reloadWithAction()

renamed

Sheet.reloadWithAction2()

Sheet.reloadWithAction()

added first parameter

TabGroup.reloadWithAction()

renamed

TabGroup.reloadWithAction2()

TabGroup.reloadWithAction()

Configuration

To define an own theme, please use now a file tobago-config.xml instead of tobago-theme.xml. The content of tobago-theme.xml is a subset of the tobago-config.xml, you have only to change the root node.

Please use the tobago-config-1.5.xsd to validate the configuration.

Own Components and Renderers

The renderers must now declared inside the faces-config.xml.

For the Tobago classes, this will be generated at compile time from annotations like in e.g. org.apache.myfaces.tobago.internal.taglib.component.BoxTagDeclaration.

© 2005-2025 Apache Software Foundation, Licensed under the Apache License, Version 2.0.