NetBeans Rich Client Platform



                  Branding & Internationalisation




NetBeans Rich Client Platform
Brand...
NetBeans Rich Client Platform



                                  Agenda




Internationalisation
     Branding
    Acces...
NetBeans Rich Client Platform



                                  Branding & Internationalisation


Internationalisable R...
NetBeans Rich Client Platform



                               Branding & Internationalisation


NbBundle:
 Similar to ja...
NetBeans Rich Client Platform



                                                  Branding & Internationalisation

Text c...
NetBeans Rich Client Platform



                                     Branding & Internationalisation

Externalize String ...
NetBeans Rich Client Platform



                                               Branding & Internationalisation

String va...
NetBeans Rich Client Platform



                         Branding & Internationalisation

Search order:
  Locale US:
    ...
NetBeans Rich Client Platform



                                                Branding & Internationalisation

Other Re...
NetBeans Rich Client Platform



                                               Branding & Internationalisation

nbresloc ...
NetBeans Rich Client Platform



                             Branding & Internationalisation

Bundling localization resou...
NetBeans Rich Client Platform



                                Branding & Internationalisation

Simplify Localization by...
NetBeans Rich Client Platform



                            Branding & Internationalisation

Localisation Bundles as Modu...
NetBeans Rich Client Platform



                             Branding & Internationalisation

  OmegaT Translation Tool:
...
NetBeans Rich Client Platform



                                         Branding & Internationalisation

 Change languag...
NetBeans Rich Client Platform



                                  Branding & Internationalisation

 Change language on-th...
NetBeans Rich Client Platform



                                   Branding & Internationalisation

  2. Possibility: For...
NetBeans Rich Client Platform



                                  Agenda




Internationalisation
     Branding
    Acces...
NetBeans Rich Client Platform



                     Einfaches Branding einer Anwendung
Properties Dialog:
NetBeans Rich Client Platform



                                  Basic Branding
Properties Dialog:
NetBeans Rich Client Platform



                                  Basic Branding

Properties Dialog:
NetBeans Rich Client Platform



                                                 Replacing Icons

Find Resources:
  Use „...
NetBeans Rich Client Platform



                                              Replacing Icons


Even Icons that don't exi...
NetBeans Rich Client Platform



                                               Replacing Icons

Picture Formats
  What to...
NetBeans Rich Client Platform



                          Branding von Texten

Branding token:
NetBeans Rich Client Platform



                                           Branding Strings

Branding token is used in ad...
NetBeans Rich Client Platform



                                                  Look & Feel

  Dynamically changing Swi...
NetBeans Rich Client Platform



                                  Agenda




Internationalisation
     Branding
    Acces...
NetBeans Rich Client Platform



                                               Accessibility

  Resources:
http://a11y.ne...
NetBeans Rich Client Platform



                Accessibility
Upcoming SlideShare
Loading in …5
×

Branding & Internationalization with the NetBeans Platform

11,092 views
10,806 views

Published on

How to brand and localize your NetBeans Platform application, including some tipps on how to change language on the fly and how to make your application accessible.

Published in: Technology, Business
0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total views
11,092
On SlideShare
0
From Embeds
0
Number of Embeds
275
Actions
Shares
0
Downloads
85
Comments
0
Likes
0
Embeds 0
No embeds

No notes for slide

Branding & Internationalization with the NetBeans Platform

  1. 1. NetBeans Rich Client Platform Branding & Internationalisation NetBeans Rich Client Platform Branding & Internationalisation Anton Epple Eppleton IT Consulting
  2. 2. NetBeans Rich Client Platform Agenda Internationalisation Branding Accessibility
  3. 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. 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. 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));
  6. 6. NetBeans Rich Client Platform Branding & Internationalisation Externalize String Constants to .properties Files • Tools → Internationalization → Internationalization Wizard
  7. 7. NetBeans Rich Client Platform Branding & Internationalisation String values in manifests Manifest file: Manifest-Version: 1.0 OpenIDE-Module: de.eppleton.language OpenIDE-Module-Localizing-Bundle: de/eppleton/language/Bundle.properties Bundle.properties: OpenIDE-Module-Name=Language Switch Bundle_de.properties Datei: OpenIDE-Module-Name=Sprach Wechsel
  8. 8. NetBeans Rich Client Platform Branding & Internationalisation Search order: Locale US: 1. Bundle_en_US.properties 2. Bundle_en.properties 3. Bundle.properties
  9. 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. 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. 11. NetBeans Rich Client Platform Branding & Internationalisation Bundling localization resources in Folder „locale“: Example NetBeans platform9 Modules:
  12. 12. NetBeans Rich Client Platform Branding & Internationalisation Simplify Localization by externalizing defaults: Translator sees only localizable resources:
  13. 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
  14. 14. NetBeans Rich Client Platform Branding & Internationalisation OmegaT Translation Tool: http://sf.net/projects/omegat/ http://translatedfiles.netbeans.org/docs/HOWTOs/How-to-trans
  15. 15. NetBeans Rich Client Platform Branding & Internationalisation Change language on-the-fly (1): MenuItems Not officially supported (but useful for Support → zh_CN) but most MenuItems react to changing Locale: public String getName() { return NbBundle.getMessage(SaveAction.class, "Save"); } Some don't (SaveAsAction): AbstractAction instance = Lookups.forPath("Actions/System").lookup(AbstractAction.class); instance.putValue(Action.NAME, NbBundle.getMessage(DataObject.class, "CTL_SaveAsAction"));
  16. 16. NetBeans Rich Client Platform Branding & Internationalisation Change language on-the-fly (2): Menus 1. Possibility: MenuBar Frame main = WindowManager.getDefault().getMainWindow(); assert main != null; if (main instanceof JFrame) { Component [] c = ((Jframe)main).getJMenuBar().getComponents(); [....](Jmenu)c[i].setText(„internationalisiert...“); } // Error-prone...
  17. 17. NetBeans Rich Client Platform Branding & Internationalisation 2. Possibility: Force Refresh FileSystem sfs = Repository.getDefault().getDefaultFileSystem(); FileObject menus = sfs.findResource("Menu"); FileObject[] children = menus.getChildren(); for (int i = 0; i < children.length; i++) { FileObject fileObject = children[i]; FileLock lock = null; try { lock = fileObject.lock(); String oldname= fileObject.getName(); fileObject.rename(lock, File.createTempFile("bla", "bla").getName(), null); fileObject.rename(lock, oldname, null); } catch (FileAlreadyLockedException es) { } lock.releaseLock();} Demo
  18. 18. NetBeans Rich Client Platform Agenda Internationalisation Branding Accessibility
  19. 19. NetBeans Rich Client Platform Einfaches Branding einer Anwendung Properties Dialog:
  20. 20. NetBeans Rich Client Platform Basic Branding Properties Dialog:
  21. 21. NetBeans Rich Client Platform Basic Branding Properties Dialog:
  22. 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. 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. 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
  25. 25. NetBeans Rich Client Platform Branding von Texten Branding token:
  26. 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. 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)
  28. 28. NetBeans Rich Client Platform Agenda Internationalisation Branding Accessibility
  29. 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
  30. 30. NetBeans Rich Client Platform Accessibility

×