List of usage examples for java.util ResourceBundle getString
public final String getString(String key)
From source file:org.codehaus.mojo.chronos.chart.SummaryThroughputChartSource.java
private XYPlot createThroughputPlot(ResourceBundle bundle, ReportConfig config) { TimeSeriesCollection dataset1 = createThroughputDataset(bundle, config); XYPlot throughputPlot = ChartUtil.newPlot(dataset1, bundle.getString("chronos.label.throughput.requests"), true);/*from w w w. ja v a2s . c o m*/ throughputPlot.setRangeAxisLocation(AxisLocation.BOTTOM_OR_LEFT); throughputPlot.getRenderer().setSeriesPaint(0, Color.GREEN); throughputPlot.getRenderer().setSeriesPaint(1, Color.BLUE); throughputPlot.setSeriesRenderingOrder(SeriesRenderingOrder.FORWARD); double maxAvgThroughput = samples.getMaxAverageThroughput(config.getAverageduration(), config.getResponsetimedivider()); String maxThroughputLabel = bundle.getString("chronos.label.maxaveragethroughput"); ChartUtil.addRangeMarker(throughputPlot, maxThroughputLabel, maxAvgThroughput); return throughputPlot; }
From source file:ispok.valid.EmployeeValidator.java
@Override public void validate(FacesContext fc, UIComponent uic, Object o) throws ValidatorException { ResourceBundle rb = ResourceBundle.getBundle("ispok/pres/inter/ispok", fc.getViewRoot().getLocale()); if (employeeService.employeeExist(o.toString())) { throw new ValidatorException(new FacesMessage(FacesMessage.SEVERITY_ERROR, rb.getString("employee_invalid_exist"), rb.getString("employee_invalid_exist"))); }/*from w w w . j a va 2 s . co m*/ }
From source file:org.accelerators.activiti.admin.AdminApp.java
@Override public void init() { // Set theme/* ww w .j av a2s .co m*/ setTheme(Consts.THEME); // Set default locale setLocale(new Locale("en")); // Init resource bundle final ResourceBundle i18n = ResourceBundle.getBundle(Messages.class.getName(), getLocale()); // Add title mainWindow = new Window(i18n.getString(Messages.AppTitle)); // Set window to full size mainWindow.setSizeFull(); // Set as main window setMainWindow(mainWindow); // Add window to view manager viewManager = new ViewManager(mainWindow); // Create the login screen viewManager.switchScreen(LoginView.class.getName(), new LoginView(this)); }
From source file:es.pode.empaquetador.presentacion.avanzado.recursos.exportar.ExportarRecursosControllerImpl.java
public final void exportar(ActionMapping mapping, es.pode.empaquetador.presentacion.avanzado.recursos.exportar.ExportarForm form, HttpServletRequest request, HttpServletResponse response) throws Exception { java.util.Locale locale = (Locale) request.getSession().getAttribute(ConstantesAgrega.DEFAULT_LOCALE); ResourceBundle i18n = ResourceBundle.getBundle("application-resources", locale); String opcion = form.getAction(); if (opcion.equals(i18n.getString("presentacion.avanzado.recursos.exportar.aceptar"))) { String nombre = form.getNombre(); GestorSesion gs = new GestorSesion(); gs.validarNombreFichero(nombre); List recursosVO = this.getExportarRecursosSession(request).getRecursosVO(); if (logger.isDebugEnabled()) logger.debug("Recursos recuperados de la sesion " + recursosVO); List recursosList = new ArrayList(); String identificadorRec = ""; String[] recursos = new String[recursosVO.size()]; for (int i = 0; i < recursosVO.size(); i++) { identificadorRec = ((RecursoVO) recursosVO.get(i)).getIdentifier(); recursosList.add(i, identificadorRec); recursos[i] = identificadorRec; }// ww w .jav a 2 s .co m // String[] recursos=(String[]) recursosList.toArray(); EmpaquetadorSession sesEmpaq = this.getEmpaquetadorSession(request); List listSubmPath = sesEmpaq.getSubmanifestPath(); //cojo el primer elemento que dedberia ser el padre String identificador = sesEmpaq.getIdLocalizador(); DataHandler dh = null; if (listSubmPath.size() == 1) { dh = this.getSrvGestorManifestService().exportarRecursos(identificador, recursos, null, nombre); } else if (listSubmPath.size() > 1) { OdeVO odeultim = (OdeVO) listSubmPath.get(listSubmPath.size() - 1); String submanifestId = odeultim.getIdentifier(); dh = this.getSrvGestorManifestService().exportarRecursos(identificador, recursos, submanifestId, nombre); } // Introducir el Datahandler en el response para la descarga try { (new GestorSesion()).iniciarDescargaFichero(dh, response, nombre + ".zip"); } catch (Exception e) { logger.error("Error en la descarga de recursos exportados"); if (logger.isDebugEnabled()) logger.debug(e); throw new ValidatorException("{presentacion.avanzado.recursos.exportar.error}"); } } }
From source file:com.balero.controllers.UsersController.java
@RequestMapping(value = "/register", method = RequestMethod.POST) public String register(RedirectAttributes redirectAttributes, @RequestParam("username") String username, @RequestParam("password") String password, @RequestParam("name") String lastname, @RequestParam("email") String email) { UsersDAO.register(username, password, lastname, email, "user"); ResourceBundle bundle = ResourceBundle.getBundle("messages"); redirectAttributes.addFlashAttribute("message", bundle.getString("label.login.registerok")); return "redirect:/"; }
From source file:org.pmp.budgeto.app.SwaggerDispatcherConfigTest.java
@Test public void customImplementation() throws Exception { ResourceBundle bundle = ResourceBundle.getBundle("i18n/common", Locale.ENGLISH); Mockito.when(translatorTools.get("app.title")).thenReturn(bundle.getString("app.title")); Mockito.when(translatorTools.get("app.description")).thenReturn(bundle.getString("app.description")); Mockito.when(translatorTools.get("app.terms")).thenReturn(bundle.getString("app.terms")); Mockito.when(translatorTools.get("app.contact")).thenReturn(bundle.getString("app.contact")); Mockito.when(translatorTools.get("app.licence")).thenReturn(bundle.getString("app.licence")); Mockito.when(translatorTools.get("app.licence.url")).thenReturn(bundle.getString("app.licence.url")); SwaggerSpringMvcPlugin swaggerSpringMvcPlugin = swaggerDispatcherConfig.customImplementation(); Assertions.assertThat(swaggerSpringMvcPlugin).isNotNull(); Assertions.assertThat(/*from www .j a v a 2 s . c om*/ TestTools.getField(swaggerSpringMvcPlugin, "springSwaggerConfig", SpringSwaggerConfig.class)) .isEqualTo(springSwaggerConfig); Assertions.assertThat(TestTools.getField(swaggerSpringMvcPlugin, "apiInfo", ApiInfo.class).getTitle()) .isEqualTo("Budgeto api"); Assertions.assertThat(TestTools.getField(swaggerSpringMvcPlugin, "apiInfo", ApiInfo.class).getDescription()) .isEqualTo("Rest services for budgeto"); Assertions .assertThat( TestTools.getField(swaggerSpringMvcPlugin, "apiInfo", ApiInfo.class).getTermsOfServiceUrl()) .isEqualTo(""); Assertions.assertThat(TestTools.getField(swaggerSpringMvcPlugin, "apiInfo", ApiInfo.class).getContact()) .isEqualTo("pmpinson@gmail.com"); Assertions.assertThat(TestTools.getField(swaggerSpringMvcPlugin, "apiInfo", ApiInfo.class).getLicense()) .isEqualTo("no"); Assertions.assertThat(TestTools.getField(swaggerSpringMvcPlugin, "apiInfo", ApiInfo.class).getLicenseUrl()) .isEqualTo(""); }
From source file:es.pode.empaquetador.presentacion.avanzado.organizaciones.crear.CrearOrganizacionControllerImpl.java
public final void submit(ActionMapping mapping, es.pode.empaquetador.presentacion.avanzado.organizaciones.crear.SubmitForm form, HttpServletRequest request, HttpServletResponse response) throws Exception { CrearOrganizacionSession sesOrga = this.getCrearOrganizacionSession(request); String titulo = form.getTitle(); titulo = titulo.trim();/*w ww .j a v a 2s . co m*/ java.util.Locale locale = (Locale) request.getSession().getAttribute(ConstantesAgrega.DEFAULT_LOCALE); ResourceBundle i18n = ResourceBundle.getBundle("application-resources", locale); String action = form.getAction(); if (action.equals(i18n.getString("portal_empaquetado_crearOrganizaciones.aceptar"))) { if ((titulo == null) || (titulo.equals(""))) { throw new ValidatorException("{portal_empaquetado.exception}"); } } sesOrga.setTitle(titulo); }
From source file:eu.apenet.dpt.standalone.gui.dateconversion.DateConversionRulesDialog.java
public DateConversionRulesDialog(ResourceBundle labels, RetrieveFromDb retrieveFromDb) { super.setTitle(labels.getString("dateConversionListTitle")); super.setModalityType(ModalityType.APPLICATION_MODAL); xmlFilehandler = new DateConversionXMLFilehandler(); this.labels = labels; this.retrieveFromDb = retrieveFromDb; createDataConversionRulesList();//ww w . j a v a2 s . co m }
From source file:es.pode.empaquetador.presentacion.avanzado.submanifiestos.gestor.GestorSubmanifiestosControllerImpl.java
/** * @see es.pode.empaquetador.presentacion.avanzado.submanifiestos.gestor.GestorSubmanifiestosController#submit(org.apache.struts.action.ActionMapping, * es.pode.empaquetador.presentacion.avanzado.submanifiestos.gestor.SubmitForm, * javax.servlet.http.HttpServletRequest, * javax.servlet.http.HttpServletResponse) *//*from ww w . ja v a 2s . com*/ public final void submit(ActionMapping mapping, es.pode.empaquetador.presentacion.avanzado.submanifiestos.gestor.SubmitForm form, HttpServletRequest request, HttpServletResponse response) throws Exception { java.util.Locale locale = (Locale) request.getSession().getAttribute(ConstantesAgrega.DEFAULT_LOCALE); ResourceBundle i18n = ResourceBundle.getBundle(APPLICATION_RESOURCES, locale); String accion = form.getAction(); if ((accion.equals(i18n.getString(ELIMINAR))) || (accion.equals(i18n.getString(DESAGREGAR)))) { if (form.getIdentifierRowSelection() != null && form.getIdentifierRowSelection().size() > 0) { form.setIdentificadores(form.getIdentifierRowSelection()); } else { throw new ValidatorException("{exportar.subirArchivo}"); } } }
From source file:com.gettextresourcebundle.GettextResourceBundleControlTest.java
/** * test that the controls picks up PO files by locale * from the classpath//from w ww . ja v a 2s . co m */ @Test public void testClasspathReads() { ResourceBundle en_US = ResourceBundle.getBundle("locale", Locale.US, GettextResourceBundleControl.getControl("test")); assertEquals("The locale key should be en_US for the en_US locale", en_US.getString("locale"), "en_US"); ResourceBundle en_CA = ResourceBundle.getBundle("locale", Locale.CANADA, GettextResourceBundleControl.getControl("test")); assertEquals("The locale key should be en_CA for the en_CA locale", en_CA.getString("locale"), "en_CA"); }