List of usage examples for java.util ResourceBundle getString
public final String getString(String key)
From source file:org.shredzone.cilla.admin.header.HeaderBean.java
/** * Commits the changes to the selected or newly created {@link HeaderDto}. *///from www . j av a 2 s . c o m public String commit() throws CillaServiceException { if (header.getId() == 0) { FacesContext ctx = FacesContext.getCurrentInstance(); Locale loc = ctx.getViewRoot().getLocale(); ResourceBundle bundle = ResourceBundle.getBundle(ctx.getApplication().getMessageBundle(), loc); boolean missing = false; if (header.getUploadHeaderFile() == null) { FacesMessage message = new FacesMessage(FacesMessage.SEVERITY_ERROR, bundle.getString("header.edit.error.image"), null); ctx.addMessage("editForm:headerPicture", message); missing = true; } if (header.getUploadFullFile() == null) { FacesMessage message = new FacesMessage(FacesMessage.SEVERITY_ERROR, bundle.getString("header.edit.error.full"), null); ctx.addMessage("editForm:headerFullPicture", message); missing = true; return null; } if (missing) { // at least one file was missing, abort... return null; } } setHeader(headerWs.commit(header)); return "/admin/header/list.xhtml"; }
From source file:com.sunrun.crportal.util.CRPortalUtil.java
public static String getTestAccounts() { String testAccounts = null;//from w w w.jav a2 s . c o m ResourceBundle rb = ResourceBundle.getBundle("content/CRPortal"); testAccounts = rb.getString("test-accounts"); return testAccounts; }
From source file:es.pode.empaquetador.presentacion.avanzado.recursos.gestor.GestorRecursosControllerImpl.java
public final java.lang.String selectAction(ActionMapping mapping, es.pode.empaquetador.presentacion.avanzado.recursos.gestor.SelectActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception { /*/*from w w w . java 2 s . co m*/ * Metodo de decision para el action. Analiza los parametros * actionSubmit (value de los botones submit) para redirigir al caso de uso * correspondiente. El actionSubmit llegara * internacionalizado, por lo que es necesario acceder al ResouceBundle * para obtener el valor correcto en la comparacion. */ String result = null; String actionSubmit = form.getAction(); java.util.Locale locale = (Locale) request.getSession().getAttribute(ConstantesAgrega.DEFAULT_LOCALE); ResourceBundle i18n = ResourceBundle.getBundle("application-resources", locale); if (form.getAction() == (null)) { throw new ValidatorException("{comunes.error.generico}"); } else if (actionSubmit.equals(i18n.getString("presentacion.avanzado.recursos.gestor.submit.crear"))) { result = "Crear"; } else if (actionSubmit.equals(i18n.getString("presentacion.avanzado.recursos.gestor.submit.importar"))) { result = "Importar"; } else if (actionSubmit.equals(i18n.getString("presentacion.avanzado.recursos.gestor.submit.exportar"))) { result = "Exportar"; } else if (actionSubmit.equals(i18n.getString("presentacion.avanzado.recursos.gestor.submit.eliminar"))) { result = "Eliminar"; } else { Logger.getLogger(this.getClass()) .error("El valor del submit no es correcto (actionSubmit = " + actionSubmit + ";"); } return result; }
From source file:com.dimdim.conference.application.portal.PortalServerAdapter.java
private PortalServerAdapter() { this.httpClient = new HttpClient(); try {/*from ww w . java2 s . c o m*/ ResourceBundle rb = ResourceBundle.getBundle("resources.portal"); try { String s = rb.getString("MakeCallbacksForAllMeetings"); MakeCallbacksForAllMeetings = Boolean.parseBoolean(s); } catch (Exception e) { MakeCallbacksForAllMeetings = false; } portalServerHost = rb.getString("PortalServerHost"); portalServerPortNumber = rb.getString("PortalServerPortNumber"); portalServerSecurePortNumber = rb.getString("PortalServerSecurePortNumber"); portalServerWebappName = rb.getString("PortalServerWebappName"); portalServerInternalHost = rb.getString("PortalServerInternalHost"); portalServerInternalPortNumber = rb.getString("PortalServerInternalPortNumber"); portalServerInternalSecurePortNumber = rb.getString("PortalServerInternalSecurePortNumber"); String baseUrl = "http://" + this.portalServerInternalHost + ":" + this.portalServerInternalPortNumber + "/" + this.portalServerWebappName + "/"; this.meetingStartedUrl = baseUrl + getActionName(rb, "MeetingStartedAction", "MeetingStarted.action"); this.meetingClosedUrl = baseUrl + getActionName(rb, "MeetingClosedAction", "MeetingClosed.action"); this.nonPortalMeetingClosedUrl = baseUrl + getActionName(rb, "NonPortalMeetingClosedAction", "NonPortalMeetingClosed.action"); this.userJoinedUrl = baseUrl + getActionName(rb, "UserJoinedAction", "UserJoined.action"); this.userLeftUrl = baseUrl + getActionName(rb, "UserLeftAction", "UserLeft.action"); this.consoleLoadedUrl = baseUrl + getActionName(rb, "ConsoleLoadedAction", "ConsoleLoaded.action"); urlQueue = new Vector(); TimerService.getService().addUser(this); } catch (Exception e) { // e.printStackTrace(); } }
From source file:es.pode.empaquetador.presentacion.agregar.local.AgregarLocalControllerImpl.java
/** * @see es.pode.empaquetador.presentacion.agregar.local.AgregarLocalController#selectAction(org.apache.struts.action.ActionMapping, es.pode.empaquetador.presentacion.agregar.local.SelectActionForm, javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse) *///from ww w . jav a 2 s . c o m public final java.lang.String selectAction(ActionMapping mapping, es.pode.empaquetador.presentacion.agregar.local.SelectActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception { /* * Metodo de decision para el action. Analiza los parametros * actionSubmit (value de los botones submit) para redirigir al caso de uso * correspondiente. El actionSubmit llegara * internacionalizado, por lo que es necesario acceder al ResouceBundle * para obtener el valor correcto en la comparacion. */ String result = null; String actionSubmit = form.getAction(); java.util.Locale locale = (Locale) request.getSession().getAttribute(ConstantesAgrega.DEFAULT_LOCALE); ResourceBundle i18n = ResourceBundle.getBundle("application-resources", locale); if (form.getAction() == (null)) { throw new ValidatorException("{portal_empaquetado.exception}"); } else if (actionSubmit.equals(i18n.getString("portal_empaquetado_gestorSubman_agregarLocal.aceptar"))) { result = "Aceptar"; } else if (actionSubmit.equals(i18n.getString("portal_empaquetado_gestorSubman_agregarLocal.cancelar"))) { // En la version offline, se vuelve a CancelarOfflineAvanzado o CancelarOfflineBasico if (DecisorOffline.esOffline()) { if ("avanzado".equalsIgnoreCase(gs.tipoEmpaquetador(this.getEmpaquetadorSession(request)))) { result = "CancelarOfflineAvanzado"; } else { result = "CancelarOfflineBasico"; } } else { result = "Cancelar"; } } Logger.getLogger(this.getClass()) .error("El valor del submit no es correcto (actionSubmit = " + actionSubmit + ";"); return result; }
From source file:es.pode.empaquetador.presentacion.salir.SalirControllerImpl.java
public final String selectAction(ActionMapping mapping, SelectActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception { String result = null;/*from ww w . j a va 2s.c o m*/ String actionSubmit = form.getAction(); java.util.Locale locale = (Locale) request.getSession().getAttribute(ConstantesAgrega.DEFAULT_LOCALE); ResourceBundle i18n = ResourceBundle.getBundle("application-resources", locale); if (form.getAction() == (null)) { throw new ValidatorException("{portal_empaquetado.exception}"); } else if (actionSubmit.equals(i18n.getString("empaquetador.presentacion.salir.BotonCancelar"))) { result = "Cancelar"; } else if (actionSubmit.equals(i18n.getString("empaquetador.presentacion.salir.BotonSi"))) { result = "Guardar"; } else if (actionSubmit.equals(i18n.getString("empaquetador.presentacion.salir.BotonNo"))) { result = "Salir"; } Logger.getLogger(this.getClass()) .error("El valor del submit no es correcto (actionSubmit = " + actionSubmit + ";"); return result; }
From source file:es.pode.empaquetador.presentacion.avanzado.recursos.crear.archivos.CrearRecursoAvanzadoArchivosControllerImpl.java
public final void submit(ActionMapping mapping, es.pode.empaquetador.presentacion.avanzado.recursos.crear.archivos.SubmitForm form, HttpServletRequest request, HttpServletResponse response) throws Exception { CrearRecursoAvanzadoSession sesRecurs = this.getCrearRecursoAvanzadoSession(request); 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("presentacion.avanzado.recursos.crear.archivos.submit.seleccionar")))) { List archivosARecuperar = new ArrayList(); List elementos = form.getNombreRowSelection(); if (elementos != null && elementos.size() > 0) { /**//from w w w.java 2 s. c om * voy a recorrer la lista recuperando los nombres * para recuperar los ArchivosVO */ for (int i = 0; i < elementos.size(); i++) { String nombre = (String) elementos.get(i); //hijos del ultimo elemento del path List path = sesRecurs.getPathArchivos(); //obtengo el ultimo elemento ArchivoVO ultimoElemento = (ArchivoVO) path.get(path.size() - 1); ArchivoVO[] hijosUltimoElemento = ultimoElemento.getContenidos(); //comparo los nombres de los archivosVO y si es =, lo inserto en la lista "archivosARecuperar" boolean cortar = false; for (int j = 0; j < hijosUltimoElemento.length && cortar == false; j++) { if (hijosUltimoElemento[j].getNombre().equals(nombre)) { archivosARecuperar.add(hijosUltimoElemento[j]); cortar = true; } } } //fin_for (int i=0; i<elementos.size();i++) //inserto la lista de ArchivosVO que he recuperado form.setArchivosSeleccionados(archivosARecuperar); //todo: pasar archivos seleccionados al objeto de session } //fin_if (elementos!=null && elementos.size()!=0) else { throw new ValidatorException( "{presentacion.avanzado.recursos.crear.archivos.error.seleccionar.archivos}"); } } }
From source file:br.com.renatoccosta.regexrenamer.view.FrmAbout.java
/** This method is called from within the constructor to * initialize the form.//from w ww . ja va 2 s . c o m * WARNING: Do NOT modify this code. The content of this method is * always regenerated by the Form Editor. */ @SuppressWarnings("unchecked") // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents private void initComponents() { imgLogo = new javax.swing.JLabel(); lblTitle = new javax.swing.JLabel(); lblSubtitle = new javax.swing.JLabel(); pnlDescription = new javax.swing.JScrollPane(); txtDescription = new javax.swing.JTextPane(); txtDeveloper = new javax.swing.JLabel(); txtHomepage = new javax.swing.JLabel(); txtBlog = new javax.swing.JLabel(); pnlInfo = new javax.swing.JScrollPane(); txtInfo = new javax.swing.JTextArea(); btnOk = new javax.swing.JButton(); setResizable(false); addWindowListener(new java.awt.event.WindowAdapter() { public void windowClosing(java.awt.event.WindowEvent evt) { closeDialog(evt); } }); imgLogo.setIcon(new javax.swing.ImageIcon(getClass().getResource("/icon_48.png"))); // NOI18N lblTitle.setFont(new java.awt.Font("Arial", 0, 36)); // NOI18N lblTitle.setForeground(new java.awt.Color(102, 102, 102)); java.util.ResourceBundle bundle = java.util.ResourceBundle .getBundle("br/com/renatoccosta/regexrenamer/i18n/Messages"); // NOI18N lblTitle.setText(bundle.getString("FrmAbout.lblTitle.text")); // NOI18N lblSubtitle.setFont(new java.awt.Font("Tahoma", 0, 14)); // NOI18N lblSubtitle.setText(bundle.getString("FrmAbout.lblSubtitle.text")); // NOI18N pnlDescription.setBorder(null); pnlDescription.setOpaque(false); txtDescription.setContentType(bundle.getString("FrmAbout.txtDescription.contentType")); // NOI18N txtDescription.setText(bundle.getString("FrmAbout.txtDescription.text")); // NOI18N txtDescription.setOpaque(false); pnlDescription.setViewportView(txtDescription); txtDeveloper.setFont(new java.awt.Font("Tahoma", 0, 14)); // NOI18N txtDeveloper.setText(bundle.getString("FrmAbout.txtDeveloper.text")); // NOI18N txtHomepage.setFont(new java.awt.Font("Tahoma", 0, 14)); // NOI18N txtHomepage.setText(bundle.getString("FrmAbout.txtHomepage.text")); // NOI18N txtBlog.setFont(new java.awt.Font("Tahoma", 0, 14)); // NOI18N txtBlog.setText(bundle.getString("FrmAbout.txtBlog.text")); // NOI18N pnlInfo.setHorizontalScrollBarPolicy(javax.swing.ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER); pnlInfo.setVerticalScrollBarPolicy(javax.swing.ScrollPaneConstants.VERTICAL_SCROLLBAR_NEVER); txtInfo.setColumns(20); txtInfo.setRows(3); txtInfo.setText(bundle.getString("FrmAbout.txtInfo.text")); // NOI18N pnlInfo.setViewportView(txtInfo); btnOk.setText(bundle.getString("FrmAbout.btnOk.text")); // NOI18N btnOk.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { btnOkActionPerformed(evt); } }); javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane()); getContentPane().setLayout(layout); layout.setHorizontalGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING).addGroup( javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup().addContainerGap().addGroup(layout .createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING) .addComponent(pnlDescription, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, 464, Short.MAX_VALUE) .addComponent(pnlInfo, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, 464, Short.MAX_VALUE) .addGroup(javax.swing.GroupLayout.Alignment.LEADING, layout.createSequentialGroup() .addComponent(imgLogo).addGap(18, 18, 18) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(lblTitle).addComponent(lblSubtitle))) .addComponent(btnOk, javax.swing.GroupLayout.PREFERRED_SIZE, 67, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(txtBlog, javax.swing.GroupLayout.Alignment.LEADING) .addComponent(txtHomepage, javax.swing.GroupLayout.Alignment.LEADING) .addComponent(txtDeveloper, javax.swing.GroupLayout.Alignment.LEADING)).addContainerGap())); layout.setVerticalGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(layout.createSequentialGroup() .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(layout.createSequentialGroup().addContainerGap().addComponent(lblTitle) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(lblSubtitle)) .addGroup(layout.createSequentialGroup().addGap(21, 21, 21).addComponent(imgLogo))) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 48, Short.MAX_VALUE) .addComponent(pnlDescription, javax.swing.GroupLayout.PREFERRED_SIZE, 130, javax.swing.GroupLayout.PREFERRED_SIZE) .addGap(18, 18, 18).addComponent(txtDeveloper) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(txtHomepage) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED).addComponent(txtBlog) .addGap(18, 18, 18) .addComponent(pnlInfo, javax.swing.GroupLayout.PREFERRED_SIZE, 84, javax.swing.GroupLayout.PREFERRED_SIZE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED).addComponent(btnOk) .addContainerGap())); java.awt.Dimension screenSize = java.awt.Toolkit.getDefaultToolkit().getScreenSize(); setBounds((screenSize.width - 488) / 2, (screenSize.height - 514) / 2, 488, 514); }
From source file:es.pode.administracion.presentacion.planificador.eliminarTrabajoEjecutado.EliminarTrabajoControllerImpl.java
/** * metodo que elimina los trabajos seleccionados *//*from w ww. j av a 2s. c o m*/ public final void eliminarTrabajoEjecutado(ActionMapping mapping, EliminarTrabajoEjecutadoForm form, HttpServletRequest request, HttpServletResponse response) throws Exception { Long[] trabajosIDs = null; Boolean resultado; String resultadoString = null; String mensaje = null; String listaID = form.getListaIds(); if (log.isDebugEnabled()) log.debug("los nombres de tareas que se quieren eliminar son " + listaID); String[] cadenaIds = listaID.split("#"); trabajosIDs = new Long[cadenaIds.length]; for (int i = 0; i < cadenaIds.length; i++) { trabajosIDs[i] = new Long(cadenaIds[i]); } ResourceBundle ficheroRecursos = null; try { Locale locale = request.getLocale(); ficheroRecursos = this.getFicheroRecursos(locale); resultado = this.getSrvPlanificadorService().eliminarTrabajoEjecutado(trabajosIDs); if (resultado.booleanValue() == true) { mensaje = ficheroRecursos.getString("eliminarTareasPendientes.tareasEliminadasOk"); resultadoString = ficheroRecursos.getString("tareas.OK"); } else if (resultado.booleanValue() == false) { mensaje = ficheroRecursos.getString("eliminarTareasPendientes.tareasEliminadasError"); resultadoString = ficheroRecursos.getString("tareas.ERROR"); } form.setDescripcionBaja(mensaje); form.setResultado(resultadoString); } catch (Exception e) { log.error("Error: " + e); throw new ValidatorException("{tareas.error}"); } }
From source file:edu.ucsb.nceas.metacat.lsid.LSIDAuthorityMetaData.java
private ByteArrayInputStream doMetadataRequest(LSID lsid) throws LSIDServerException { logger.debug("getting metadata for lsid " + lsid.getLsid()); try {/* w w w .j av a 2 s . co m*/ LSIDDataLookup myLookup = new LSIDDataLookup(); InputStream content = myLookup.lsidData(lsid); InputStream content2 = myLookup.lsidData(lsid); if (!isEML(content2)) { content = getEML(lsid); } content2.close(); setCurrentLSID(lsid); // based on the doctype choose the appropriate stylesheet String styleSheetName = null; String _docType = myLookup.getDocType(lsid); try { ResourceBundle rb = ResourceBundle.getBundle("metacat-lsid"); styleSheetName = rb.getString(_docType.replaceAll(":", "")); } catch (java.util.MissingResourceException mre) { logger.warn("there is no style corresponding to: '" + _docType + "' -- using default"); styleSheetName = this.DEFAULT_STYLESHEET; mre.getMessage(); } InputStream styleSheet = getClass().getResourceAsStream(styleSheetName); TransformerFactory factory = TransformerFactory.newInstance(); Transformer transformer = factory.newTransformer(new StreamSource(styleSheet)); ByteArrayOutputStream out = new ByteArrayOutputStream(); transformer.transform(new StreamSource(content), new StreamResult(out)); content.close(); clearState(); return new ByteArrayInputStream(out.toByteArray()); } catch (Exception e) { throw new LSIDServerException(e, "Error transforming XML for: " + lsid); } }