3. NetBeans Rich Client Platform
Branding & Internationalisation
Internationalisable Resources:
String values in source files
String values in manifest
Help pages
Graphics
Files
Layer.xml ( e.g. Folders)
4. NetBeans Rich Client Platform
Branding & Internationalisation
NbBundle:
Similar to java.util.PropertyResourceBundle
Extends the functionality of the default Java resource
support
Better Integration with Module System (multiple
classloaders)
nbresloc protocol for localized files
5. NetBeans Rich Client Platform
Branding & Internationalisation
Text constants in Source Files:
Special ResourceBundle: NbBundle
Bundle.properties File in package:
CTL_MyTopComponent = My Window
Nachricht_Parameter = This is my {0}. Window
Call from Java:
ResourceBundle bundle = NbBundle.getBundle(MyTopComponent.class);
String msg = bundle.getString(„CTL_MyTopComponent“);
// oder
String msg = NbBundle.getMessage(MyTopComponent.class, „CTL_MyTopComponent“);
// bis zu 3 Einzel Parameter
String msg = NbBundle.getMessage(MyTopComponent.class, „Nachricht_Parameter“,
New Integer(3));
9. NetBeans Rich Client Platform
Branding & Internationalisation
Other Resources:
Help Pages: Attach locale-extension ( _de ) to
resources (html files, etc.)
Load graphics via localised String, or use extension
(icon.gif, icon_de.gif):
Image img = Utilities.loadImage(„resources/icon.gif“, true);
• System FileSystem (Menu):
Folder Attribute
SystemFileSystem.localizingBundle
10. NetBeans Rich Client Platform
Branding & Internationalisation
nbresloc Protocol
Load localized Version of File:
URL u = new URL(„nbresloc:/de/eppleton/netbeans/modules/icon.png“);
ImageIcon icon = newImageIcon(u);
Can load resources from all Modules:
also be used to reduce redundancy e.g.
central repository for icons
11. NetBeans Rich Client Platform
Branding & Internationalisation
Bundling localization resources in Folder „locale“:
Example NetBeans platform9 Modules:
12. NetBeans Rich Client Platform
Branding & Internationalisation
Simplify Localization by externalizing defaults:
Translator sees only localizable resources:
13. NetBeans Rich Client Platform
Branding & Internationalisation
Localisation Bundles as Modules:
Localization can also be packaged as installable
Plugin
User can install Language pack for his Locale:
http://www.sepix.de/blogs/blogrittner/blog/archive/2008/augu
http://blogs.kiyut.com/tonny/2008/08/06/netbeans-platform-lo
22. NetBeans Rich Client Platform
Replacing Icons
Find Resources:
Use „This layer in context“ to find module of an Action
Identify Icon Path in Source Files
Put in Suite's branding Folder
in a folder named like the module
JAR, under the same package:
23. NetBeans Rich Client Platform
Replacing Icons
Even Icons that don't exist in the original can be „replaced“
for a better Look & Feel
Example add rollover or disabled icons:
24. NetBeans Rich Client Platform
Replacing Icons
Picture Formats
What to do when your Icon collection has different Picture
Format (e.g. gif instead png required)?
Rename your image.png to image.gif
No conversion needed
26. NetBeans Rich Client Platform
Branding Strings
Branding token is used in addition to locale
Resources stored in „locale“ folder
Search order example, Locale US:
1. Bundle_token_en_US.properties
– Bundle_token_en.properties
– Bundle_token.properties
4. Bundle_en_US.properties
5. Bundle_en.properties
6. Bundle.properties
27. NetBeans Rich Client Platform
Look & Feel
Dynamically changing Swing L&F at Runtime
Need to get Hold of Application Frame:
UIManager.setLookAndFeel(new MetalLookAndFeel());
Frame frame =
WindowManager.getDefault().getMainWindow();
SwingUtilities.updateComponentTreeUI(frame);
frame.pack();
UIDelegates need (e.g. Tabs) to be available or created for
Third-party L&F (e.g. Synthetica, Substance)
29. NetBeans Rich Client Platform
Accessibility
Resources:
http://a11y.netbeans.org/
a11y Checker Module:
This module checks designed forms online, in
design time.
Provides sortable error list
Highlights affected components
Assists with fixes
Cooperates with i18n