Tobago Demo

Menu

2.0 to 3.0

Migration from Tobago 2.0 to 3.0

There are several migration steps to do, 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 ususal 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.

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