public void dispose() { bClosed = true; try { if (getOwner() == invisibleSharedFrame) referenceCounter--; super.dispose(); if (referenceCounter == 0 && invisibleSharedFrame != null) invisibleSharedFrame.dispose(); if (frameList != null) frameList.remove(this); if (localeSelector != null) localeSelector.removeLocaleChangeListener(this); } catch (Exception ex) { ex.printStackTrace(); } }
private void service(RaplaContext context) throws RaplaException { this.context = context; i18n = context.lookup(RaplaResources.class); RaplaImages images = context.lookup(RaplaImages.class); if (useDefaultOptions) { if (buttons.length > 1) { getButton(0).setText(i18n.getString("ok")); getButton(1).setIcon(images.getIconFromKey("icon.abort")); getButton(1).setText(i18n.getString("abort")); } else { getButton(0).setText(i18n.getString("ok")); } } localeSelector = (ServerBundleManager) context.lookup(BundleManager.class); localeSelector.addLocaleChangeListener(this); frameList = context.lookup(FrameControllerList.class); frameList.add(this); }
// @Test public void testJreLocales() { final Locale[] availableLocales = Locale.getAvailableLocales(); for (Locale locale : availableLocales) { final String localeString = locale.toString(); if (!localeString.trim().isEmpty()) { try { final I18nLocaleFormats format = bundleManager.getFormats(locale); Assert.assertNotNull(format.getFormatDateLong()); Assert.assertNotNull(format.isAmPmFormat()); Assert.assertNotNull(format.getAmPmFormat()); Assert.assertNotNull(format.getFormatDateShort()); Assert.assertNotNull(format.getFormatHour()); Assert.assertNotNull(format.getFormatMonthYear()); Assert.assertNotNull(format.getFormatTime()); Assert.assertNotNull(format.getMonths()); Assert.assertNotNull(format.getWeekdays()); } catch (Exception e) { System.out.println("Missing properties for " + localeString); } } } }
@Test public void testEncoding() throws Exception { final I18nLocaleFormats formats = bundleManager.getFormats(Locale.GERMANY); final String month = formats.getMonths()[2]; Assert.assertEquals("M�rz", month); }