List of usage examples for java.util ResourceBundle getString
public final String getString(String key)
From source file:com.ivli.roim.controls.VOILUTPanel.java
/** * This method is called from within the constructor to initialize the form. * WARNING: Do NOT modify this code. The content of this method is always * regenerated by the Form Editor./*from ww w .j a v a2s. c o m*/ */ @SuppressWarnings("unchecked") // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents private void initComponents() { buttonGroup1 = new javax.swing.ButtonGroup(); jPanel1 = new javax.swing.JPanel(); jPanel2 = new javax.swing.JPanel(); jLabel1 = new javax.swing.JLabel(); jLabel2 = new javax.swing.JLabel(); iLabelMin = new javax.swing.JLabel(); iLabelMax = new javax.swing.JLabel(); jPanel1.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(0, 0, 0))); jPanel1.setVerifyInputWhenFocusTarget(false); javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1); jPanel1.setLayout(jPanel1Layout); jPanel1Layout.setHorizontalGroup(jPanel1Layout .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING).addGap(0, 350, Short.MAX_VALUE)); jPanel1Layout.setVerticalGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGap(0, 278, Short.MAX_VALUE)); jPanel2.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(240, 240, 240))); jPanel2.setPreferredSize(new java.awt.Dimension(32, 255)); jPanel2.setVerifyInputWhenFocusTarget(false); javax.swing.GroupLayout jPanel2Layout = new javax.swing.GroupLayout(jPanel2); jPanel2.setLayout(jPanel2Layout); jPanel2Layout.setHorizontalGroup(jPanel2Layout .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING).addGap(0, 30, Short.MAX_VALUE)); jPanel2Layout.setVerticalGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGap(0, 254, Short.MAX_VALUE)); java.util.ResourceBundle bundle = java.util.ResourceBundle.getBundle("com/ivli/roim/Bundle"); // NOI18N jLabel1.setText(bundle.getString("VOILUTPANEL.LABEL_MIN")); // NOI18N jLabel2.setText(bundle.getString("VOILUTPANEL.LABEL_MAX")); // NOI18N iLabelMin.setText("jLabel3"); iLabelMax.setText("jLabel4"); javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this); this.setLayout(layout); layout.setHorizontalGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(layout.createSequentialGroup() .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(layout.createSequentialGroup().addContainerGap() .addComponent(jPanel1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) .addComponent( jPanel2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) .addGroup(layout.createSequentialGroup().addGap(18, 18, 18).addGroup( layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false) .addComponent(jLabel1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent(jLabel2, javax.swing.GroupLayout.DEFAULT_SIZE, 70, Short.MAX_VALUE)) .addGap(18, 18, 18) .addGroup(layout .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(iLabelMin).addComponent(iLabelMax)))) .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))); layout.setVerticalGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(layout.createSequentialGroup().addContainerGap() .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(jPanel2, javax.swing.GroupLayout.PREFERRED_SIZE, 256, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(jPanel1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) .addGap(18, 18, 18) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(jLabel1).addComponent(iLabelMin)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(jLabel2).addComponent(iLabelMax)) .addContainerGap(43, Short.MAX_VALUE))); }
From source file:es.mityc.firmaJava.policy.ConfigFacturae.java
public ConfigFacturae(ResourceBundle props, String prefix) throws ConfigFacturaeException { String prep = ""; if ((prefix != null) && (!"".equals(prefix.trim()))) prep = prefix + "."; // carga los datos de identidad try {//from w w w . j a va 2 s . c om policyIdXades = new URI(props.getString(prep + ConstantesFacturaePolicy.PROPNAME_POLICY_ID)); policyIdValidador = props.getString(prep + ConstantesFacturaePolicy.PROPNAME_POLICY_ID_VALIDADOR); } catch (MissingResourceException ex) { logger.fatal("Error en la carga de la configuracin del validador de facturae"); throw new ConfigFacturaeException("Error en la configuracin", ex); } catch (URISyntaxException ex) { logger.fatal("Identificador de la policy indicada invlido"); throw new ConfigFacturaeException("Error en la configuracin", ex); } // carga la descripcion de la policy try { policyDescription = props.getString(prep + ConstantesFacturaePolicy.PROPNAME_POLICY_ID_VALIDADOR); } catch (MissingResourceException ex) { if (logger.isTraceEnabled()) logger.trace("No hay descripcin para esta policy: " + prep); } // Carga la huellas huellas = new ArrayList<DigestAlgAndValueType>(); int i = 0; while (true) { try { huellas.add(new SigPolicyHash(null, props.getString(prep + ConstantesFacturaePolicy.PROPNAME_HASH_ID + i), props.getString(prep + ConstantesFacturaePolicy.PROPNAME_HASH_VALUE + i))); i++; } catch (MissingResourceException ex) { break; } } // carga el nmero de hash que se utilizar en el escritor try { policyWriterId = Integer .parseInt(props.getString(prep + ConstantesFacturaePolicy.PROPNAME_WRITER_HASH)); if (policyWriterId >= huellas.size()) { policyWriterId = -1; logger.error("Error al indicar nmero de hash a escribir"); } } catch (MissingResourceException ex) { if (logger.isTraceEnabled()) logger.trace("No hay indicado hash para el escritor: " + prep); } catch (NumberFormatException ex) { logger.error("Error al indicar nmero de hash a escribir", ex); } }
From source file:datasoul.util.OnlinePublishFrame.java
/** This method is called from within the constructor to * initialize the form./* w w w . j a v a 2 s . c om*/ * 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() { buttonGroup1 = new javax.swing.ButtonGroup(); btnClose = new javax.swing.JButton(); jLabel1 = new javax.swing.JLabel(); btnPublish = new javax.swing.JButton(); jLabel3 = new javax.swing.JLabel(); txtDescription = new javax.swing.JTextField(); lblUrl = new javax.swing.JLabel(); jLabel2 = new javax.swing.JLabel(); txtTitle = new javax.swing.JTextField(); setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE); java.util.ResourceBundle bundle = java.util.ResourceBundle.getBundle("datasoul/internationalize"); // NOI18N setTitle(bundle.getString("PUBLISH SERVICE PLAN ONLINE")); // NOI18N setResizable(false); btnClose.setIcon(new javax.swing.ImageIcon(getClass().getResource("/datasoul/icons/v2/window-close.png"))); // NOI18N btnClose.setText(bundle.getString("CLOSE")); // NOI18N btnClose.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { btnCloseActionPerformed(evt); } }); jLabel1.setFont(new java.awt.Font("DejaVu Sans", 1, 13)); jLabel1.setText(bundle.getString("PUBLISH SERVICE PLAN ONLINE")); // NOI18N btnPublish.setIcon(new javax.swing.ImageIcon(getClass().getResource("/datasoul/icons/v2/web-browser.png"))); // NOI18N btnPublish.setText(bundle.getString("PUBLISH")); // NOI18N btnPublish.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { btnPublishActionPerformed(evt); } }); jLabel3.setText(bundle.getString("DESCRIPTION")); // NOI18N lblUrl.setText(" "); jLabel2.setText(bundle.getString("TITLE")); // NOI18N txtTitle.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { txtTitleActionPerformed(evt); } }); javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane()); getContentPane().setLayout(layout); layout.setHorizontalGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(layout.createSequentialGroup().addContainerGap() .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(layout.createSequentialGroup().addComponent(jLabel1).addContainerGap()) .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup().addComponent(lblUrl) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 394, Short.MAX_VALUE) .addComponent(btnPublish) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(btnClose).addContainerGap()) .addGroup(layout.createSequentialGroup().addGap(12, 12, 12) .addGroup(layout .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(jLabel3).addComponent(jLabel2)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addGroup(layout .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(txtTitle, javax.swing.GroupLayout.DEFAULT_SIZE, 464, Short.MAX_VALUE) .addComponent(txtDescription, javax.swing.GroupLayout.DEFAULT_SIZE, 464, Short.MAX_VALUE)) .addContainerGap())))); layout.setVerticalGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(layout.createSequentialGroup().addContainerGap().addComponent(jLabel1) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(jLabel2).addComponent(txtTitle, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(jLabel3).addComponent(txtDescription, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(btnClose).addComponent(btnPublish).addComponent(lblUrl)) .addContainerGap())); pack(); }
From source file:py.una.pol.karaku.util.I18nHelper.java
protected String getStringOrNull(String key) { if (bundles == null) { initialize();// w w w. java2 s .c o m } for (ResourceBundle bundle : getBundles()) { if (bundle.containsKey(key)) { return bundle.getString(key); } } return null; }
From source file:com.flexive.faces.beans.MessageBean.java
/** * Returns the resource translation in the given locale. * * @param key resource key//w w w . j a va2s . co m * @param locale the requested locale * @return the resource translation * @since 3.2.0 */ public String getResource(String key, Locale locale) { if (!initialized) { initialize(); } final FxSharedUtils.MessageKey messageKey = new FxSharedUtils.MessageKey(locale, key); String cachedMessage = cachedMessages.get(messageKey); if (cachedMessage != null) { return cachedMessage; } for (FxSharedUtils.BundleReference bundleReference : resourceBundles) { try { final ResourceBundle bundle = getResources(bundleReference, locale); String message = bundle.getString(key); cachedMessage = cachedMessages.putIfAbsent(messageKey, message); return cachedMessage != null ? cachedMessage : message; } catch (MissingResourceException e) { // continue with next bundle } } if (!locale.equals(Locale.ENGLISH)) { //try to find the locale in english as last resort //this is a fix for using PropertyResourceBundles which can only handle one locale (have to use them thanks to JBoss 5...) for (FxSharedUtils.BundleReference bundleReference : resourceBundles) { try { final ResourceBundle bundle = getResources(bundleReference, Locale.ENGLISH); String message = bundle.getString(key); cachedMessage = cachedMessages.putIfAbsent(messageKey, message); return cachedMessage != null ? cachedMessage : message; } catch (MissingResourceException e) { // continue with next bundle } } } throw new MissingResourceException("Resource not found", "MessageBean", key); }
From source file:com.agimatec.validation.jsr303.DefaultMessageInterpolator.java
private String resolveParameter(String parameterName, ResourceBundle bundle, Locale locale, boolean recurse) { String parameterValue;/*from ww w.j av a 2 s.c om*/ try { if (bundle != null) { parameterValue = bundle.getString(removeCurlyBrace(parameterName)); if (recurse) { parameterValue = replaceVariables(parameterValue, bundle, locale, recurse); } } else { parameterValue = parameterName; } } catch (MissingResourceException e) { // return parameter itself parameterValue = parameterName; } return parameterValue; }
From source file:es.pode.empaquetador.presentacion.avanzado.organizaciones.crear.CrearOrganizacionControllerImpl.java
public final java.lang.String selectAction(ActionMapping mapping, es.pode.empaquetador.presentacion.avanzado.organizaciones.crear.SelectActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception { /*//from www . j av a 2 s. com * 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_crearOrganizaciones.aceptar"))) { result = "Aceptar"; } else if (actionSubmit.equals(i18n.getString("portal_empaquetado_crearOrganizaciones.cancelar"))) { result = "Cancelar"; } else if (actionSubmit.equals(i18n.getString("portal_empaquetado_crearOrganizaciones.metadatos"))) { result = "Metadatos"; } Logger.getLogger(this.getClass()) .error("El valor del submit no es correcto (actionSubmit = " + actionSubmit + ";"); return result; }
From source file:Unicode.java
/** Convenience routine to make a Button */ public JButton mkButton(ResourceBundle b, String name) { String label;//from w w w . j a va 2 s. com try { label = b.getString(name + ".label"); } catch (MissingResourceException e) { label = name; } return new JButton(label); }
From source file:es.pode.modificador.presentacion.configurar.objetos.resultados.ResultadosBuscarObjetoControllerImpl.java
public void eliminar(ActionMapping mapping, EliminarForm form, HttpServletRequest request, HttpServletResponse response) throws Exception { String path = form.getPath(); if (!vacia(path)) { BusquedaSession sesion = getBusquedaSession(request); List resultados = sesion.getResultados(); List seleccionados = sesion.getSeleccionados(); for (Iterator iterator = resultados.iterator(); iterator.hasNext();) { DocVO element = (DocVO) iterator.next(); if (element.getLocalizadorODE().equals(path)) { seleccionados.remove(element); }/*w w w. j a va 2s . c o m*/ } } else { java.util.Locale locale = (java.util.Locale) request.getSession() .getAttribute(ConstantesAgrega.DEFAULT_LOCALE); ResourceBundle i18n = ResourceBundle.getBundle("application-resources", locale); throw new ValidatorException(i18n.getString("resultadosObjetos.noHaySeleccion")); } }
From source file:dpfmanager.shell.modules.messages.MessagesModule.java
private void askForClosePeriodical() { ResourceBundle bundle = DPFManagerProperties.getBundle(); Platform.runLater(new Runnable() { @Override//from w w w.j a v a 2s. c o m public void run() { Alert alert = AlertsManager.createAskAlert(bundle.getString("askAlertPeriodical"), bundle.getString("askAlertPeriodicalContent")); Optional<ButtonType> result = alert.showAndWait(); if (result.get().getButtonData().equals(ButtonBar.ButtonData.YES)) { closeNow(); } } }); }