Skip to content
Permalink
Branch: master
Find file Copy path
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
141 lines (125 sloc) 4.59 KB
title review details labels confluence tree_item_index history
HOWTO: Override a Seam Component - JSF UI
comment date status
2019-10-21
ok
howto
excerpt level tool topics
Learn how to override a seam component.
Advanced
Nuxeo CLI, code
JSF UI, Seam JSF Webapp
content-review-lts2016
seam
howto
seam-jsf-component
atchertchian
excerpt
content-review-lts2017
jsf-ui
ajs-parent-page-id ajs-parent-page-title ajs-space-key ajs-space-name canonical canonical_source page_id shortlink shortlink_source source_link
19235681
Transversal How-Tos
NXDOC
Nuxeo Platform Developer Documentation
How+to+Override+a+Seam+Component
19236447
X4YlAQ
/display/NXDOC/How+to+Override+a+Seam+Component
1100
author date message version
Anahide Tchertchian
2015-12-08 11:16
9
author date message version
Gildas Lefevre
2014-11-04 18:15
8
author date message version
Manon Lumeau
2014-09-19 15:58
7
author date message version
Manon Lumeau
2014-09-19 15:57
6
author date message version
Manon Lumeau
2014-09-18 17:21
5
author date message version
Solen Guitter
2014-06-27 15:06
4
author date message version
Solen Guitter
2014-06-27 12:09
3
author date message version
Thierry Martins
2014-05-26 17:59
2
author date message version
Thierry Martins
2014-05-26 17:50
1

{{{multiexcerpt 'JSF-UI-required' page='generic-multi-excerpts'}}}

{{! excerpt}} This how-to considers you master the creation of the Java plug-in, and you know where to create a Java class. Otherwise please refer to the page [How to create an empty bundle]({{page page='how-to-create-an-empty-bundle'}}) or use [Nuxeo CLI]({{page page='nuxeo-cli'}}). {{! /excerpt}}

The main steps to override a Seam component are:

  1. Look for the name of the Seam component you want to override. The name is the value of the annotation @name.

  2. Add an empty file named seam.properties under the folder src/main/resources of your plug-in.

  3. Create a Java class in your plug-in. It's recommended to use a custom name for your own classes, to avoid having duplicated files in your IDE for instance. But it's not mandatory providing the package containing your class is different from the default one.

  4. Overriding the default Seam component now implies three actions:

    • Reuse the same name you found in the @name annotation,
    • Reuse the same scope, unless you know what you are doing,
    • Indicate that your component will be loaded after the default one: this is done with the annotation @Install and the value Install.DEPLOYMENT (because the default component should have no value for this annotation, or value Install.FRAMEWORK).

    You should get a class structured like below:

    package org.nuxeo.sample.howto;
    
    import org.jboss.seam.annotations.Install;
    import org.jboss.seam.annotations.Name;
    import org.nuxeo.ecm.core.api.ClientException;
    import org.nuxeo.ecm.webapp.helpers.StartupHelper;
    
    @Name("startupHelper")
    @Scope(SESSION)
    @Install(precedence = Install.DEPLOYMENT)
    public class MyStartupHelper extends StartupHelper {
        private static final long serialVersionUID = 1L;
        @Override
        public String initServerAndFindStartupPage() throws ClientException {
            return super.initServerAndFindStartupPage();
        }
    }

In this example, we overrode the startupHelper component to write our own version of the method initServerAndFindStartupPage.


{{#> panel heading='Related How-Tos'}}
  • [How-To Index]({{page page='how-to-index'}})

{{/panel}}

{{#> panel heading='Related Documentation'}}
  • [JSF UI Limitations]({{page page='jsf-ui-limitations'}})
  • [JSF UI Framework]({{page page='jsf-ui-framework'}}) {{/panel}}
You can’t perform that action at this time.