public class UiConfigurationDefault extends AbstractUiConfiguration
UiConfiguration
.DEFAULT_THEME
Constructor and Description |
---|
UiConfigurationDefault()
The constructor.
|
Modifier and Type | Method and Description |
---|---|
NlsMessageLookup |
getLabelLookup()
This method gets the instance of
NlsMessageLookup used to
lookup
labels automatically by
property titles via
UiDataBinding . |
String |
getTheme()
This method gets the path for the current theme.
|
public String getTheme()
public NlsMessageLookup getLabelLookup()
NlsMessageLookup
used to
lookup
labels
automatically by
property titles
via
UiDataBinding
. So you can highly customize your labels for your
custom defined properties and have full I18N/l10n support with little effort. For rapid development you
can also ignore all this and just live with the
property title
that is used as fallback if
lookup fails. NlsBundleWithLookup
. For further details look at
NlsBundle
. For each
property title
such as
lastName
you define an according method in your bundle (NlsBundleMyLabelsRoot):public interface NlsBundleMyLabelsRoot extendsE.g. for German localization you defineNlsBundleWithLookup
{ @NlsBundleMessage
("Last name")NlsMessage
lastName(); ... }
NlsBundleMyLabels_de.properties
in the same package
with this content:
lastName = Nachname ...Now we assume you have a business object like this:
public interface Partner {you can useTypedProperty
<String> PROPERTY_LAST_NAME = newTypedProperty
<>("lastName", String.class); }
createAndBind
(Partner.PROPERTY_LAST_NAME) to create an input field widget and the label will be set
automatically to your localized label text ("Last Name", "Vorname", or whatever). lastName
gets renamed to surename
and you want to keep your NLS/I18N properties stable, you can change your declaration to
public interface Partner {And maybe also rename it toTypedProperty
<String> PROPERTY_LAST_NAME = newTypedProperty
<>("surename", String.class, "lastName"); }
PROPERTY_SURENAME
. property title
if you want to have a different label for surename in a different business object e.g.
Address
. You only need to ensure that the
property title
matches the method name and
therefore key in your NlsBundleWithLookup
. You can also use
"Partner.surename" with the following trick:
@NlsBundleKey
("Partner.surename") @NlsBundleMessage
("Last name")NlsMessage
PartnerSurename();
property type
in your TypedProperty
constant. However, this is
technically not required and you may also omit it. This might cause a little performance overhead as the
property type has to be reflected then. Also you need to be careful not to pick the wrong constructor for
this purpose such as TypedProperty.TypedProperty(String, String)
. NlsMessageLookup
instance for automatic label creation. You should typically use
NlsMessageLookupProxy
in your custom implementation of this
method.UiDataBinding
Copyright © 2001–2016 mmm-Team. All rights reserved.