Example usage for java.util ResourceBundle getString

List of usage examples for java.util ResourceBundle getString

Introduction

In this page you can find the example usage for java.util ResourceBundle getString.

Prototype

public final String getString(String key) 

Source Link

Document

Gets a string for the given key from this resource bundle or one of its parents.

Usage

From source file:org.jw.service.gui.StatisticsDialog.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.//w ww.  ja  v a  2s . c om
 */
@SuppressWarnings("unchecked")
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
private void initComponents() {

    taskMonitorPanel = new org.jw.service.gui.component.TaskMonitorPanel();
    closeRefreshPanel = new org.jw.service.gui.component.CloseRefreshPanel();
    statisticsTabbedPane = new javax.swing.JTabbedPane();
    contactDistributionTab = new javax.swing.JPanel();
    ageGroupDistributionTab = new javax.swing.JPanel();
    civilStatusDistributionTab = new javax.swing.JPanel();

    setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);
    java.util.ResourceBundle bundle = java.util.ResourceBundle
            .getBundle("org/jw/service/gui/resources/properties/dialog_titles"); // NOI18N
    setTitle(bundle.getString("statistics.dialog.title")); // NOI18N
    setResizable(false);

    javax.swing.GroupLayout contactDistributionTabLayout = new javax.swing.GroupLayout(contactDistributionTab);
    contactDistributionTab.setLayout(contactDistributionTabLayout);
    contactDistributionTabLayout.setHorizontalGroup(contactDistributionTabLayout
            .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING).addGap(0, 592, Short.MAX_VALUE));
    contactDistributionTabLayout.setVerticalGroup(contactDistributionTabLayout
            .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING).addGap(0, 366, Short.MAX_VALUE));

    statisticsTabbedPane.addTab("Contact Distribution", contactDistributionTab);

    javax.swing.GroupLayout ageGroupDistributionTabLayout = new javax.swing.GroupLayout(
            ageGroupDistributionTab);
    ageGroupDistributionTab.setLayout(ageGroupDistributionTabLayout);
    ageGroupDistributionTabLayout.setHorizontalGroup(ageGroupDistributionTabLayout
            .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING).addGap(0, 592, Short.MAX_VALUE));
    ageGroupDistributionTabLayout.setVerticalGroup(ageGroupDistributionTabLayout
            .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING).addGap(0, 366, Short.MAX_VALUE));

    statisticsTabbedPane.addTab("Age Distribution", ageGroupDistributionTab);

    javax.swing.GroupLayout civilStatusDistributionTabLayout = new javax.swing.GroupLayout(
            civilStatusDistributionTab);
    civilStatusDistributionTab.setLayout(civilStatusDistributionTabLayout);
    civilStatusDistributionTabLayout.setHorizontalGroup(civilStatusDistributionTabLayout
            .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING).addGap(0, 592, Short.MAX_VALUE));
    civilStatusDistributionTabLayout.setVerticalGroup(civilStatusDistributionTabLayout
            .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING).addGap(0, 366, Short.MAX_VALUE));

    statisticsTabbedPane.addTab("Civil Status Distribution", civilStatusDistributionTab);

    javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
    getContentPane().setLayout(layout);
    layout.setHorizontalGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(taskMonitorPanel, javax.swing.GroupLayout.Alignment.TRAILING,
                    javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
            .addGroup(layout.createSequentialGroup().addContainerGap()
                    .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(closeRefreshPanel, javax.swing.GroupLayout.DEFAULT_SIZE,
                                    javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                            .addComponent(statisticsTabbedPane))
                    .addContainerGap()));
    layout.setVerticalGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING).addGroup(
            javax.swing.GroupLayout.Alignment.TRAILING,
            layout.createSequentialGroup().addContainerGap().addComponent(statisticsTabbedPane)
                    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                    .addComponent(closeRefreshPanel, javax.swing.GroupLayout.PREFERRED_SIZE,
                            javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                    .addComponent(taskMonitorPanel, javax.swing.GroupLayout.PREFERRED_SIZE,
                            javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)));

    pack();
}

From source file:com.svds.geolocationservice.services.KafkaProducerService.java

/**
 * Create a producer connection to Kafka
 *///w w w. j  a  v a2  s.  c  o m
public KafkaProducerService() {
    LOG.info("KafkaProducerService - start");
    long starttime = System.currentTimeMillis();

    try {
        Properties kafkaProducerProps = new Properties();
        ResourceBundle kafkaProducerBundle = ResourceBundle.getBundle(KafkaProducerService.KAFKA_CONFIG);

        Enumeration<String> keys = kafkaProducerBundle.getKeys();
        while (keys.hasMoreElements()) {
            String key = keys.nextElement();
            kafkaProducerProps.put(key, kafkaProducerBundle.getString(key));
        }

        kafkaProducerConfig = new ProducerConfig(kafkaProducerProps);
        setKafkaProducer(new Producer<String, String>(kafkaProducerConfig));

    } catch (Exception e) {
        LOG.error(e.getMessage(), e);
    }
    long endtime = System.currentTimeMillis() - starttime;
    LOG.info("KafkaProducerService : " + endtime);
}

From source file:es.pode.empaquetador.presentacion.agregar.local.AgregarLocalControllerImpl.java

/**
 * @see es.pode.empaquetador.presentacion.agregar.local.AgregarLocalController#submit(org.apache.struts.action.ActionMapping, es.pode.empaquetador.presentacion.agregar.local.SubmitForm, javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse)
 *///from   w  w  w.  j  a  va2  s .c om
public final void submit(ActionMapping mapping, es.pode.empaquetador.presentacion.agregar.local.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();
    FormFile archivos = form.getArchivo();
    if (accion.equals(i18n.getString("portal_empaquetado_gestorSubman_agregarLocal.aceptar"))) {
        if ((archivos == null) || (archivos.getFileSize() == 0)) {
            throw new ValidatorException("{exportar.subirArchivo}");
        }

    }
}

From source file:eu.dety.burp.joseph.gui.DecoderPanel.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.
 *///w w  w  .  j  a va2s .  c  o m
@SuppressWarnings("unchecked")
// <editor-fold defaultstate="collapsed"
// desc="Generated Code">//GEN-BEGIN:initComponents
private void initComponents() {

    formatButtonGroup = new javax.swing.ButtonGroup();
    jScrollPane1 = new javax.swing.JScrollPane();
    inputTextarea = new javax.swing.JTextArea();
    encodeButton = new javax.swing.JButton();
    decodeButton = new javax.swing.JButton();
    jScrollPane2 = new javax.swing.JScrollPane();
    outputTextarea = new javax.swing.JTextArea();
    formatText = new javax.swing.JRadioButton();
    formatHex = new javax.swing.JRadioButton();

    inputTextarea.setColumns(20);
    inputTextarea.setRows(5);
    jScrollPane1.setViewportView(inputTextarea);

    java.util.ResourceBundle bundle = java.util.ResourceBundle.getBundle("JOSEPH"); // NOI18N
    encodeButton.setText(bundle.getString("ENCODE_B64")); // NOI18N
    encodeButton.addActionListener(new java.awt.event.ActionListener() {
        public void actionPerformed(java.awt.event.ActionEvent evt) {
            encodeButtonActionPerformed(evt);
        }
    });

    decodeButton.setText(bundle.getString("DECODE_B64")); // NOI18N
    decodeButton.addActionListener(new java.awt.event.ActionListener() {
        public void actionPerformed(java.awt.event.ActionEvent evt) {
            decodeButtonActionPerformed(evt);
        }
    });

    outputTextarea.setColumns(20);
    outputTextarea.setRows(5);
    jScrollPane2.setViewportView(outputTextarea);

    formatButtonGroup.add(formatText);
    formatText.setSelected(true);
    formatText.setText(bundle.getString("TEXT")); // NOI18N
    formatText.addActionListener(new java.awt.event.ActionListener() {
        public void actionPerformed(java.awt.event.ActionEvent evt) {
            formatTextActionPerformed(evt);
        }
    });

    formatButtonGroup.add(formatHex);
    formatHex.setText(bundle.getString("HEX")); // NOI18N
    formatHex.addActionListener(new java.awt.event.ActionListener() {
        public void actionPerformed(java.awt.event.ActionEvent evt) {
            formatHexActionPerformed(evt);
        }
    });

    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)
                    .addComponent(jScrollPane2, javax.swing.GroupLayout.Alignment.TRAILING)
                    .addGroup(layout.createSequentialGroup().addContainerGap()
                            .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                    .addComponent(jScrollPane1)
                                    .addGroup(layout.createSequentialGroup().addComponent(encodeButton)
                                            .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                            .addComponent(decodeButton)
                                            .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED,
                                                    46, Short.MAX_VALUE)
                                            .addComponent(formatText)
                                            .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                            .addComponent(formatHex)))))
                    .addContainerGap()));
    layout.setVerticalGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup().addContainerGap()
                    .addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 200,
                            javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                    .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                                    .addComponent(formatText).addComponent(formatHex))
                            .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                                    .addComponent(encodeButton).addComponent(decodeButton)))
                    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                    .addComponent(jScrollPane2, javax.swing.GroupLayout.PREFERRED_SIZE, 200,
                            javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)));
}

From source file:es.pode.empaquetador.presentacion.avanzado.submanifiestos.gestor.GestorSubmanifiestosControllerImpl.java

public final java.lang.String selectAction(ActionMapping mapping,
        es.pode.empaquetador.presentacion.avanzado.submanifiestos.gestor.SelectActionForm form,
        HttpServletRequest request, HttpServletResponse response) throws Exception {
    /*/*from w  ww  .j a v  a  2s .  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(EXCEPTION);
    }

    else if (actionSubmit.equals(i18n.getString(AGREGAR))) {
        result = "Agregar";
    } else if (actionSubmit.equals(i18n.getString(DESAGREGAR))) {
        result = "Desagregar";
    } else if (actionSubmit.equals(i18n.getString(ELIMINAR))) {
        result = "Eliminar";
    } else {
        logger.error("El valor del submit no es correcto (actionSubmit = " + actionSubmit + ")");
    }

    return result;
}

From source file:io.github.robwin.swagger2markup.builder.document.MarkupDocument.java

MarkupDocument(Swagger2MarkupConfig swagger2MarkupConfig, String outputDirectory) {
    this.swagger = swagger2MarkupConfig.getSwagger();
    this.markupLanguage = swagger2MarkupConfig.getMarkupLanguage();
    this.markupDocBuilder = MarkupDocBuilders.documentBuilder(markupLanguage)
            .withAnchorPrefix(swagger2MarkupConfig.getAnchorPrefix());
    this.separatedDefinitionsEnabled = swagger2MarkupConfig.isSeparatedDefinitions();
    this.separatedDefinitionsFolder = swagger2MarkupConfig.getSeparatedDefinitionsFolder();
    this.definitionsDocument = swagger2MarkupConfig.getDefinitionsDocument();
    this.outputDirectory = outputDirectory;
    this.useInterDocumentCrossReferences = swagger2MarkupConfig.isInterDocumentCrossReferences();
    this.interDocumentCrossReferencesPrefix = swagger2MarkupConfig.getInterDocumentCrossReferencesPrefix();
    this.propertyOrdering = swagger2MarkupConfig.getPropertyOrdering();

    ResourceBundle labels = ResourceBundle.getBundle("lang/labels",
            swagger2MarkupConfig.getOutputLanguage().toLocale());
    DEFAULT_COLUMN = labels.getString("default_column");
    EXAMPLE_COLUMN = labels.getString("example_column");
    REQUIRED_COLUMN = labels.getString("required_column");
    SCHEMA_COLUMN = labels.getString("schema_column");
    NAME_COLUMN = labels.getString("name_column");
    DESCRIPTION_COLUMN = labels.getString("description_column");
    SCOPES_COLUMN = labels.getString("scopes_column");
    DESCRIPTION = DESCRIPTION_COLUMN;//from  w ww.  j av a  2 s  . c  o m
    PRODUCES = labels.getString("produces");
    CONSUMES = labels.getString("consumes");
    TAGS = labels.getString("tags");
    NO_CONTENT = labels.getString("no_content");
}

From source file:au.org.ala.delta.model.format.AttributeFormatter.java

private void initCaptions() {
    ResourceBundle bundle = ResourceBundle.getBundle("au/org/ala/delta/resources/delta-common");
    _orMoreCaption = bundle.getString("AttributeFormatter.OrMore");
    _orLessCaption = bundle.getString("AttributeFormatter.OrLess");
    _notRecordedCaption = bundle.getString("AttributeFormatter.NotRecorded");
    _notApplicableCaption = bundle.getString("AttributeFormatter.NotApplicable");
    _orWord = bundle.getString("AttributeFormatter.DefaultOrWord");
}

From source file:com.inkubator.hrm.web.converter.PaySalaryComponentConverter.java

@Override
public String getAsString(FacesContext context, UIComponent component, Object value) {
    ResourceBundle resourceBundle = ResourceBundle.getBundle("Messages",
            new Locale(FacesUtil.getSessionAttribute(HRMConstant.BAHASA_ACTIVE).toString()));

    String messages = StringUtils.EMPTY;
    Integer data = (Integer) value;
    if (Objects.equals(data, HRMConstant.PAY_SALARY_COMPONENT_TUNJANGAN)) {
        messages = resourceBundle.getString("paySalaryComponent.paySalaryComponent_tunjangan");
    } else if (Objects.equals(data, HRMConstant.PAY_SALARY_COMPONENT_POTONGAN)) {
        messages = resourceBundle.getString("paySalaryComponent.paySalaryComponent_potongan");
    } else if (Objects.equals(data, HRMConstant.PAY_SALARY_COMPONENT_SUBSIDI)) {
        messages = resourceBundle.getString("paySalaryComponent.paySalaryComponent_subsidi");
    }//from   w w  w  .  j  a va 2s.  co m
    return messages;
}

From source file:es.pode.catalogadorWeb.presentacion.importar.ImportarControllerImpl.java

public String submitAdvertencia(ActionMapping mapping, SubmitAdvertenciaForm form, HttpServletRequest request,
        HttpServletResponse response) throws Exception {
    String resultado = "";
    String action = form.getAccion();

    //String idiomaLocale=((Locale)request.getSession().getAttribute(ConstantesAgrega.DEFAULT_LOCALE)).getLanguage();
    ResourceBundle i18n = I18n.getInstance().getResource("application-resources",
            (Locale) request.getSession().getAttribute(ConstantesAgrega.DEFAULT_LOCALE));

    if (action != null) {
        if (action.equals(i18n.getString("catalogadorAvanzado.importar.advertencia.aceptar"))) {
            resultado = "Aceptar";
        } else {//ww  w.  j a v  a2 s  .c o  m
            resultado = "Cancelar";
            this.getCatalogadorAvSession(request).setLomesImportado(null);
        }
    }
    return resultado;
}

From source file:com.autentia.tnt.tracking.mail.TrackChangesMailService.java

/**
 * Get a configuration property by name.
 * /*w w  w.j  ava  2  s. c o m*/
 * @param propertyName
 *            property name
 * @return a named property
 */
private String getProperty(String propertyName, String defaultValue) {
    ResourceBundle bundle = null;
    String ret = null;
    try {
        bundle = ResourceBundle.getBundle("com.autentia.tnt.resources.messages",
                AuthenticationManager.getDefault().getCurrentPrincipal().getLocale());
        ret = bundle.getString(propertyName);
    } catch (Exception e) {
        //Si se produce un error al recuperar los textos lo registramos en el log
        //y lo dejamos
        log.error("Could not retrieve text message.", e);
    }
    if (ret == null)
        ret = defaultValue;
    return ret;
}