Bug 26640 - RFE: One-line API call to set text, mnemonics & mnemonic index
RFE: One-line API call to set text, mnemonics & mnemonic index
Status: VERIFIED FIXED
Product: platform
Classification: Unclassified
Component: -- Other --
3.x
All All
: P2 (vote)
: 3.x
Assigned To: Jesse Glick
issues@platform
: API, I18N
: 29676 30885 (view as bug list)
Depends on: 26678 31004 31093
Blocks: 27009 30885 31147
  Show dependency treegraph
 
Reported: 2002-08-20 15:42 UTC by _ mihmax
Modified: 2008-12-22 23:55 UTC (History)
6 users (show)

See Also:
Issue Type: ENHANCEMENT
:


Attachments
Mnemonics v4 (4.10 KB, application/octet-stream)
2003-02-09 20:56 UTC, _ mihmax
Details
v4 with \n only (4.08 KB, application/octet-stream)
2003-02-09 21:18 UTC, _ mihmax
Details

Note You need to log in before you can comment on or make changes to this bug.
Description _ mihmax 2002-08-20 15:42:16 UTC
I found a very serious bug in localized Netbeans:

When I translate, e.g. "&File" menu name into Russian, I 
have "&<SOME RUSSIAN SYMBOL>...", 
but then the key combination Alt+<SOME RUSSIAN SYMBOL> 
doesn't work!

All other menus and submenus, buttons, etc. are also 
affected.

I'd like this fixed for Netbeans 3.4, please.

Of course, the user may use the mouse, but the Keyboard is 
also handy thing ;)

And I do not like the way, used by Localizators of Mozilla 
(which also has the same bug), who just translated the 
menu name, but left the English key combination.
So "&File" menu would look like 
"<RUSSIAN TRANSLATION> (&F)" - this is not very attractive 
anyway.
Comment 1 _ mihmax 2002-08-20 15:46:46 UTC
In order to simulate, download Russian L10N module from 
Daily Autoupdate or http://translatedfiles.netbeans.org 
(Files section),
and add "-locale ru" into ide.cfg or command line of runide
Comment 2 Jesse Glick 2002-08-20 18:49:09 UTC
As mentioned on nbdev, there is no better way of doing this known to
us... you can use the Mozilla-style technique in NetBeans with no code
change. See Javadoc for Actions.{setMenuText,cutAmpersand} for
details, or Japanese bundles for examples.

If you know of a better solution which works with at least some
languages not using Roman script, please investigate, and reopen with
a patch. Properly testing such things requires knowledge of the kinds
of keyboards used by people working in such locales, for example.
Japanese localizers concluded that the current system was best for
Japanese - I don't know details.
Comment 3 _ mihmax 2002-09-04 14:33:48 UTC
As the resolution of issue
http://www.netbeans.org/issues/show_bug.cgi?id=26678
stated, 

this can be fixed,
I'll prepare the setLabelText method patch, and hope that all of
Netbeans developers will use the setLabelText instead of setText &
setDisplayedMnemonic separately.
Comment 4 _ mihmax 2002-09-04 14:38:41 UTC
See also RFE http://www.netbeans.org/issues/show_bug.cgi?id=27009
to module form.

I'd like that the form module use both setButtonText & setLabelText
from org.openide.awt.Actions.
Comment 5 Jaroslav Tulach 2002-09-04 16:41:35 UTC
I suggest to move the method from Actions class to Utilities class.
The reason is that Utilities are part of openide-util separate bundle
while Actions class is included just in the whole NetBeans
distribution. This could be useful for form editor users that could
bundle openide-util.jar (build by cd openide; ant libs) with their
applications.

public static void Utilities.setLocalizedText (AbstractButton b,
String text);
public static void Utilities.setLocalizedText (JLabel l, String text)

The Action.setXXX method would just delegate to Utilities.setLocalizedText
Comment 6 _ mihmax 2002-09-04 20:05:27 UTC
I've created patches for the form module, that fix this issue for all
AbstractButton's children.
Comment 7 _ mihmax 2002-09-04 20:31:55 UTC
Good idea, Jaroslav!!!
(or Jarda is better?)

> I suggest to move the method from Actions class to 
> Utilities class.

I'd suggest to create two separate files ??? and ???14 which will
contain only these pieces of code.
And put them into separate jar.

The reason:
Bundle for user-applications will be as small as possible.

> The Action.setXXX method would just delegate to 
> ???.setLocalizedText
No problem

Where's the right place for two new files?
I mean full path: module/src/.../ ;)
 (because, I didn't get the location you mention ;))

Comment 8 _ mihmax 2002-09-10 10:48:06 UTC
I suggest org.openide.awt.Mnemonic.java & org.openide.awt.Mnemonic14.java
Comment 9 _ mihmax 2002-09-11 10:18:33 UTC
> I suggest to move the method from Actions class to Utilities class.

the openide-util.jar is also rather big for redistributing it with
user-apps

My proposal:
    org/openide/mnemonic/Mnemonic.java 
    - setLocalizedText (AbstractButton b, String text);
    - setLocalizedText (JLabel b, String text);

Any other thoughts?
Comment 10 Jesse Glick 2002-09-11 16:18:19 UTC
Issue #27009 is the proper place to discuss whether & how
Mnemonic.java could be redistributed to users. That question should be
handled by the form module developers. For example, they can easily
package any particular class from openide/src/ into a dedicated
redistributable JAR file without help from openide developers (simple
form/build.xml patch I guess).
Comment 11 _ mihmax 2002-10-21 20:52:00 UTC
Final proposal: 
1. This functionality is mainly for developing Netbeans using
Netbeans, hence it will be advertised as such to users ("Don't use it
unless you know what you're doing" ;) ).
2. It goes into 4.0
3. Names:
   Class is org.openide.awt.Mnemonic.java (+ *14.java) 
   Methods are:
     public static void setLocalizedLabel(AbstractButton b, String text);
     public static void setLocalizedLabel(JLabel l, String text);
=======================================================
If no feedback in 48 hours, I start coding & asking everybody on the
Earth to put my code into CVS, then to change all their code to use
mine ;-)

Sincere, Maxym
Comment 12 _ ttran 2003-01-29 10:15:08 UTC
IMO, this issue turned into an ENHANCEMENT, and it's for the form
module, not core/openide anymore.

I am reassinging it to the form module for further actions
Comment 13 Jesse Glick 2003-01-29 15:24:06 UTC
In fact it is intended to be an openide API addition with devel-time
support from form, plus numerous updates to actual uses of mnemonics
in various places throughout the NB UI.
Comment 14 _ ttran 2003-01-29 15:37:23 UTC
Hmm taking back to openide, but making this ENHANCEMENT
Comment 15 _ mihmax 2003-02-09 20:34:02 UTC
*** Issue 29676 has been marked as a duplicate of this issue. ***
Comment 16 _ mihmax 2003-02-09 20:50:13 UTC
I'm trying to order these two issues: 26640 and 27009.

This issue should be openide Enchancement to allow setting label and
mnemonics by a single API call.
That's why I change issue summary (was: I18N - Alt+Symbol doesn't work
for localized Menus, Buttons & Labels), and mark 27009 depend on this
issue.

Issue 27009 will be the change in form module to use this RFE in
NetBeans developing NetBeans.

Comment 17 _ mihmax 2003-02-09 20:56:14 UTC
Created attachment 8857 [details]
Mnemonics v4
Comment 18 _ mihmax 2003-02-09 21:00:30 UTC
The v4 attachment is a remake of v3 from issue 27009, changed upon
Jesse' suggestions.
Another thing Jesse suggested is to reassign this issue to him, so
please take it ;-)

// Don't forget that I'm using Windows, so change \r\n -> \n before
commiting in on Unix, because weird things happen then //
Comment 19 _ mihmax 2003-02-09 21:18:46 UTC
Created attachment 8858 [details]
v4 with \n only
Comment 20 Jesse Glick 2003-02-10 18:05:01 UTC
*** Issue 30885 has been marked as a duplicate of this issue. ***
Comment 21 Jesse Glick 2003-02-10 19:55:43 UTC
Done; Maxym please review & verify esp. using Russian locale.

committed   * Up-To-Date  1.102       openide/openide-spec-vers.properties
committed   * Up-To-Date  1.137      
openide/api/doc/changes/apichanges.xml
committed   * Up-To-Date  1.80       
openide/src/org/openide/awt/Actions.java
removed     * Up-To-Date  1.1        
openide/src/org/openide/awt/Actions14.java
added       * Up-To-Date  1.1        
openide/src/org/openide/awt/Mnemonics.java
added       * Up-To-Date  1.1        
openide/src/org/openide/awt/Mnemonics.properties
Comment 22 _ mihmax 2003-02-17 13:48:56 UTC
With (or even w/o) #31004,
in Russian locale the API gives the possibility to get the 
nice-looking underlined menus, buttons and labels under 
JDK1.4, now we need to replace:
- btn.setText(...);
- btn.setMnemonic(...);
to
- Mnemonics.setLocalizedText(btn,...);

all around NetBeans code... Allot places out there, so I 
filed a separate Task #31147 as an umbrella ;-)


By use of this website, you agree to the NetBeans Policies and Terms of Use. © 2012, Oracle Corporation and/or its affiliates. Sponsored by Oracle logo