X

The blog for hints & tips about Oracle Application Development Framework and Mobile Application Framework

  • ADFv
    November 18, 2010

How-to define localized access keys for command components

Frank Nimphius
Master Principal Product Manager

Command components in ADF Faces have a "textAndAccessKey"
property that developers can use to specify access keys, a character that when
pressed in combination with the alt-key invokes the component action.

Similar,
input components have a "labelAndAccessKey" property defined to specify
an access key that puts the focus onto the component when used. To define an
access key, you use "&" within the label or text string, just
in front of the character to become the access key character.

For example, "&Ok" defines the access key
to be alt+o. "Su&bmit", defines alt+b as the access key for a
command button with the text string Submit.

The same notation "&" can be used when
the text or label is read from a resource properties file, in which case the
entry is

mypage.command.submitKey=&Submit;

mypage.command.cancelKey=&Cancel;

If you created a German translation of this resource file,
the key definition may look as shown below

mypage.command. submitKey =&Bestaetigung;

mypage.command.cancelKey=&Abbrechen;

Note the difference however. The "C" in Cancel
does not show in "Abbrechen". Therefore the access key will change
for the translation. To ensure consistent access keys to be used, the only
option developers have is to choose characters as access keys that exist in all
translations.

If the internationalized strings and labels are read from a
Java resource bundle, then, to define the access key, you use the ampersand "&"
character only. The "&" string needs to be used in properties
files only, not in Java.

Be the first to comment

Comments ( 0 )
Please enter your name.Please provide a valid email address.Please enter a comment.CAPTCHA challenge response provided was incorrect. Please try again.