1 19 20 package org.netbeans.modules.welcome.content; 21 22 import java.text.MessageFormat ; 23 import javax.swing.JComponent ; 24 import org.openide.util.NbBundle; 25 26 public class BundleSupport { 27 28 private static final String BUNDLE_NAME = "org.netbeans.modules.welcome.resources.Bundle"; 30 private static final String LABEL_PREFIX = "LBL_"; private static final String URL_PREFIX = "URL_"; private static final String CATEGORY_PREFIX = "CATEGORY_"; private static final String TEMPLATE_PREFIX = "TEMPLATE_"; private static final String ACN_PREFIX = "ACN_"; private static final String ACD_PREFIX = "ACD_"; private static final String MNM_PREFIX = "MNM_"; 38 public static String getLabel(String bundleKey) { 39 return NbBundle.getBundle(BUNDLE_NAME).getString(LABEL_PREFIX + bundleKey); 40 } 41 42 public static String getURL(String bundleKey) { 43 return NbBundle.getBundle(BUNDLE_NAME).getString(URL_PREFIX + bundleKey); 44 } 45 46 public static char getMnemonic(String bundleKey) { 47 return NbBundle.getBundle(BUNDLE_NAME).getString(MNM_PREFIX + bundleKey).charAt(0); 48 } 49 50 public static String getSampleCategory(String bundleKey) { 51 return NbBundle.getBundle(BUNDLE_NAME).getString(CATEGORY_PREFIX + bundleKey); 52 } 53 54 public static String getSampleTemplate(String bundleKey) { 55 return NbBundle.getBundle(BUNDLE_NAME).getString(TEMPLATE_PREFIX + bundleKey); 56 } 57 58 public static String getAccessibilityName(String bundleKey) { 59 return NbBundle.getBundle(BUNDLE_NAME).getString(ACN_PREFIX + bundleKey); 60 } 61 62 public static String getAccessibilityName(String bundleKey, String param) { 63 return MessageFormat.format( NbBundle.getBundle(BUNDLE_NAME).getString(ACN_PREFIX + bundleKey), param ); 64 } 65 66 public static String getAccessibilityDescription(String bundleKey, String param) { 67 return MessageFormat.format( NbBundle.getBundle(BUNDLE_NAME).getString(ACD_PREFIX + bundleKey), param ); 68 } 69 70 public static void setAccessibilityProperties(JComponent component, String bundleKey) { 71 String aName = NbBundle.getBundle(BUNDLE_NAME).getString(ACN_PREFIX + bundleKey); 72 String aDescr = NbBundle.getBundle(BUNDLE_NAME).getString(ACD_PREFIX + bundleKey); 73 74 component.getAccessibleContext().setAccessibleName(aName); 75 component.getAccessibleContext().setAccessibleDescription(aDescr); 76 } 77 } 78 | Popular Tags |