11_enhancing the application's usability

Upload: suresh1130

Post on 30-May-2018

217 views

Category:

Documents


0 download

TRANSCRIPT

  • 8/14/2019 11_Enhancing the Application's Usability

    1/24

    11Copyright 2007, Oracle. All rights reserved.

    Enhancing the Applications Usability

  • 8/14/2019 11_Enhancing the Application's Usability

    2/24

    11-2 Copyright 2007, Oracle. All rights reserved.

    Objectives

    After completing this lesson, you should be able to do

    the following:

    Internationalize an application by using resource

    bundles Use the JSF loadBundle tag to reference a

    resource bundle

    Use Application Development Framework (ADF)

    declarative validators

    Use ADF control hints

  • 8/14/2019 11_Enhancing the Application's Usability

    3/24

    11-3 Copyright 2007, Oracle. All rights reserved.

    Internationalization

    Internationalization is the support for multiple

    locales (i18n).

    Localization is the process in which support for a

    specific locale is added. ADF Faces supports internationalization and

    provides localization support for English, German,

    Spanish, French, and more.

  • 8/14/2019 11_Enhancing the Application's Usability

    4/24

    11-4 Copyright 2007, Oracle. All rights reserved.

    Resource Bundles

    Resource bundles contain locale-specific strings

    used in an application.

    Translation strings can include parameters.

    sr.browserTitle=SRDemo Beispielanwendungsr.about=ber dieses Beispielsr.copyright=\u00a9 Oracle Corp, 2006sr.contact=Kontakt

    UIResources_de.properties

    sr.browserTitle=SRDemo Sample Applicationsr.about=About this samplesr.copyright=\u00a9 Oracle Corp, 2006sr.contact=Contact Us

    UIResources.properties

  • 8/14/2019 11_Enhancing the Application's Usability

    5/24

    11-5 Copyright 2007, Oracle. All rights reserved.

  • 8/14/2019 11_Enhancing the Application's Usability

    6/24

  • 8/14/2019 11_Enhancing the Application's Usability

    7/2411-7 Copyright 2007, Oracle. All rights reserved.

    Using Resource Bundles

    Useto reference the resourcebundle.

    Only the name of the default resource bundle

    needs to be specified. Translations are looked upby appending_to the name.

    Translatable strings are referenced by their key in

    the resource bundle.

  • 8/14/2019 11_Enhancing the Application's Usability

    8/2411-8 Copyright 2007, Oracle. All rights reserved.

    Handling Error Messages

    Use a property resource bundle to replace standard

    error-message texts:

    Create a resource bundle containing key-value pairs

    for replacement of error-message texts.

    In faces-config.xml, click the Overview tab. Click Application.

    In Message Bundle,add the path to the

    message resourcebundle.

    Use h:messagestag to displaymessages.

  • 8/14/2019 11_Enhancing the Application's Usability

    9/2411-9 Copyright 2007, Oracle. All rights reserved.

  • 8/14/2019 11_Enhancing the Application's Usability

    10/2411-10 Copyright 2007, Oracle. All rights reserved.

    Control Hints and Validation

    Declarative validation rules for data controls andbindings:

    Provide a consistent

    user experience

    Are extensible for complexapplication validation

    Are metadata based

    Control hints for data controls

    and bindings include: Labels

    Date and currency

    formatting

  • 8/14/2019 11_Enhancing the Application's Usability

    11/2411-11 Copyright 2007, Oracle. All rights reserved.

    Using Control Hints

    Centralize UI settings across clients

    Reduce coding

    Increase consistency

    Hints include: Label Text

    Tooltip Text

    Format mask

    Display Height and Display Width

  • 8/14/2019 11_Enhancing the Application's Usability

    12/2411-12 Copyright 2007, Oracle. All rights reserved.

    Accessing Control Hints

    Part of the ADF Model

    Set at the Entity Metadata level

  • 8/14/2019 11_Enhancing the Application's Usability

    13/2411-13 Copyright 2007, Oracle. All rights reserved.

    Control Hint Properties

  • 8/14/2019 11_Enhancing the Application's Usability

    14/2411-14 Copyright 2007, Oracle. All rights reserved.

  • 8/14/2019 11_Enhancing the Application's Usability

    15/2411-15 Copyright 2007, Oracle. All rights reserved.

    ADF Declarative Validation

    Declarative rules are enforced in the model.

    The standard set of rules include:

    Compare

    List Range

    Length

    Expression

    Error messages are returned through the message

    bundle mechanism.

    The message bundle can be internationalized.

  • 8/14/2019 11_Enhancing the Application's Usability

    16/2411-16 Copyright 2007, Oracle. All rights reserved.

    Adding Validation

  • 8/14/2019 11_Enhancing the Application's Usability

    17/2411-17 Copyright 2007, Oracle. All rights reserved.

    Internationalizing Control Hints

  • 8/14/2019 11_Enhancing the Application's Usability

    18/2411-18 Copyright 2007, Oracle. All rights reserved.

    Internationalizing the Message Bundle

    (Control Hints)

    1. Right-click the message bundle class.

    2. Select refactor and duplicate the class.

    3. Append the language identifier to the class name:

    ServiceRequestsMsgBundle.java ServiceRequestsMsgBundle_fr.java

    4. Make language (or locale) changes in the new

    class.

  • 8/14/2019 11_Enhancing the Application's Usability

    19/2411-19 Copyright 2007, Oracle. All rights reserved.

    Internationalizing the Message Bundle

    (Control Hints): Example

    static final Object[][] sMessageStrings ={

    { "assignedDate_TOOLTIP", "The date the service requests wasassigned" },{ "assignedDate_LABEL", "Assignment Date:" },{ "assignedDate_FMT_FORMATTER","oracle.jbo.format.DefaultDateFormatter" },{ "assignedDate_FMT_FORMAT", "MM-dd-yyyy" }};

    static final Object[][] sMessageStrings ={

    { "assignedDate_TOOLTIP", Date laquelle la demande a t

    assigne" },{ "assignedDate_LABEL", Date dassignation" },{ "assignedDate_FMT_FORMATTER","oracle.jbo.format.DefaultDateFormatter" },{ "assignedDate_FMT_FORMAT", "MM-dd-yyyy" }};

  • 8/14/2019 11_Enhancing the Application's Usability

    20/2411-20 Copyright 2007, Oracle. All rights reserved.

    Internationalizing the Message Bundle

    (Control Hints)

  • 8/14/2019 11_Enhancing the Application's Usability

    21/2411-21 Copyright 2007, Oracle. All rights reserved.

    Internationalized Error Messages

  • 8/14/2019 11_Enhancing the Application's Usability

    22/2411-22 Copyright 2007, Oracle. All rights reserved.

    Summary

    In this lesson, you should have learned how to:

    Internationalize an application by using resource

    bundles

    Use the JSF loadBundle tag to reference aresource bundle

    Add ADF declarative validators to an application

    Use ADF control hints

  • 8/14/2019 11_Enhancing the Application's Usability

    23/2411-23 Copyright 2007, Oracle. All rights reserved.

    Practice Overview:

    Internationalizing an Application

    This practice covers the following topics:

    Adding declarative validation to the model

    Using the resource bundle to internationalize the

    application Using a message bundle to internationalize a

    message

  • 8/14/2019 11_Enhancing the Application's Usability

    24/24