This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.
Summary: | RFE: One-line API call to set text, mnemonics & mnemonic index | ||
---|---|---|---|
Product: | platform | Reporter: | _ mihmax <mihmax> |
Component: | -- Other -- | Assignee: | Jesse Glick <jglick> |
Status: | VERIFIED FIXED | ||
Severity: | blocker | CC: | hmichel, jf4jbug, jglick, jtulach, raccah, ttran |
Priority: | P2 | Keywords: | API, I18N |
Version: | 3.x | ||
Hardware: | All | ||
OS: | All | ||
Issue Type: | ENHANCEMENT | Exception Reporter: | |
Bug Depends on: | 26678, 31004, 31093 | ||
Bug Blocks: | 27009, 30885, 31147 | ||
Attachments: |
Mnemonics v4
v4 with \n only |
Description
_ mihmax
2002-08-20 15:42:16 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 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. 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. 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. 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 I've created patches for the form module, that fix this issue for all AbstractButton's children. 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 ;)) I suggest org.openide.awt.Mnemonic.java & org.openide.awt.Mnemonic14.java > 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?
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). 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 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 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. Hmm taking back to openide, but making this ENHANCEMENT *** Issue 29676 has been marked as a duplicate of this issue. *** 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. Created attachment 8857 [details]
Mnemonics v4
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 // Created attachment 8858 [details]
v4 with \n only
*** Issue 30885 has been marked as a duplicate of this issue. *** 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 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 ;-) |