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:ca.uhn.hunit.swing.ui.util.BeanDefinitionForm.java

/** This method is called from within the constructor to
 * initialize the form.//from   ww w  .j a v  a  2s.co  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() {
    jLabel5 = new javax.swing.JLabel();
    jLabel1 = new javax.swing.JLabel();
    myConnectionFactoryTextBox = new javax.swing.JTextField();
    jLabel2 = new javax.swing.JLabel();
    jLabel4 = new javax.swing.JLabel();
    myConstructorArgsScrollBox = new javax.swing.JScrollPane();
    myConstructorArgsTable = new javax.swing.JTable();
    myConstructorComboBox = new javax.swing.JComboBox();

    jLabel5.setHorizontalAlignment(javax.swing.SwingConstants.TRAILING);
    jLabel5.setText("Username");

    jLabel1.setHorizontalAlignment(javax.swing.SwingConstants.TRAILING);

    java.util.ResourceBundle bundle = java.util.ResourceBundle.getBundle("ca/uhn/hunit/l10n/UiStrings"); // NOI18N
    jLabel1.setText(bundle.getString("beandef.classname")); // NOI18N

    myConnectionFactoryTextBox.setText("jTextField2");

    jLabel2.setHorizontalAlignment(javax.swing.SwingConstants.TRAILING);
    jLabel2.setText(bundle.getString("beandef.constructor")); // NOI18N

    jLabel4.setHorizontalAlignment(javax.swing.SwingConstants.TRAILING);
    jLabel4.setText("Constructor Args");

    myConstructorArgsTable.setModel(new javax.swing.table.DefaultTableModel(
            new Object[][] { { null, null }, { null, null }, { null, null }, { null, null } },
            new String[] { "Value", "Type" }));
    myConstructorArgsScrollBox.setViewportView(myConstructorArgsTable);

    myConstructorComboBox.setModel(
            new javax.swing.DefaultComboBoxModel(new String[] { "Item 1", "Item 2", "Item 3", "Item 4" }));

    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, false)
                            .addComponent(jLabel4, javax.swing.GroupLayout.DEFAULT_SIZE, 131, Short.MAX_VALUE)
                            .addComponent(jLabel1, javax.swing.GroupLayout.DEFAULT_SIZE, 131, Short.MAX_VALUE)
                            .addComponent(jLabel2, javax.swing.GroupLayout.PREFERRED_SIZE, 131,
                                    javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                    .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                            .addGroup(layout.createSequentialGroup()
                                    .addComponent(myConstructorArgsScrollBox,
                                            javax.swing.GroupLayout.DEFAULT_SIZE, 251, Short.MAX_VALUE)
                                    .addContainerGap())
                            .addGroup(javax.swing.GroupLayout.Alignment.LEADING,
                                    layout.createSequentialGroup()
                                            .addComponent(myConnectionFactoryTextBox,
                                                    javax.swing.GroupLayout.DEFAULT_SIZE, 227, Short.MAX_VALUE)
                                            .addGap(34, 34, 34))
                            .addGroup(javax.swing.GroupLayout.Alignment.LEADING,
                                    layout.createSequentialGroup()
                                            .addComponent(myConstructorComboBox, 0, 251, Short.MAX_VALUE)
                                            .addContainerGap()))));
    layout.setVerticalGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                    .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(myConnectionFactoryTextBox, javax.swing.GroupLayout.PREFERRED_SIZE,
                                    21, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(jLabel1, javax.swing.GroupLayout.PREFERRED_SIZE, 22,
                                    javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                    .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(myConstructorComboBox, javax.swing.GroupLayout.PREFERRED_SIZE,
                                    javax.swing.GroupLayout.DEFAULT_SIZE,
                                    javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(jLabel2))
                    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                    .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(myConstructorArgsScrollBox, javax.swing.GroupLayout.PREFERRED_SIZE,
                                    78, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(jLabel4))
                    .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)));
}

From source file:edu.ucsb.nceas.metacat.lsid.LSIDAuthorityMetaData.java

/**
 * There's no metadata for this document
 *///from w  ww  .  j av a  2s  .  c o  m
private ByteArrayInputStream noMetaDataResponse(LSID theLSID) {
    ResourceBundle rb = ResourceBundle.getBundle("metacat-lsid");
    String metadataLabels = rb.getString("metadatalabels");

    String result = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n"
            + "<rdf:RDF xmlns:rdf=\"http://www.w3.org/1999/02/22-rdf-syntax-ns#\" \n"
            + "   xmlns:dc=\"http://purl.org/dc/elements/1.1/\" \n"
            + "   xmlns:pred=\"urn:lsid:i3c.org:predicates:\" xmlns=\"urn:lsid:" + metadataLabels
            + ":predicates:\"> \n" + "<rdf:Description rdf:about=\"" + theLSID.getLsid() + "\"> \n"
            + "   <pred:title xmlns:pred=\"http://purl.org/dc/elements/1.1/\">There is no metadata for this LSID.</pred:title>\n"
            + "</rdf:Description>\n" + "</rdf:RDF>\n";

    return new ByteArrayInputStream(result.getBytes());
}

From source file:es.pode.administracion.presentacion.descargas.crear.CrearDescargaControllerImpl.java

public void guardarDescarga(ActionMapping mapping, GuardarDescargaForm form, HttpServletRequest request,
        HttpServletResponse response) throws Exception {
    ResourceBundle resources = ResourceBundle.getBundle(applicationResources,
            (Locale) request.getSession().getAttribute(ConstantesAgrega.DEFAULT_LOCALE));
    if (resources.getString("comun.aceptar").equals(form.getAction())) {
        ConfigurarDescargaSession sesion = getConfigurarDescargaSession(request);
        List<DescDescargaVO> descripciones = new ArrayList<DescDescargaVO>();
        boolean alMenosUna = false;

        String desc;/* w w  w . ja  v a  2 s .  c o  m*/
        String titulo;
        String idioma;

        desc = compruebaDescripcion(form.getDescripcion_es(), request);
        titulo = compruebaTitulo(form.getTitulo_es(), request);
        idioma = "es";
        alMenosUna = addDescripcion(descripciones, alMenosUna, desc, titulo, idioma);

        desc = compruebaDescripcion(form.getDescripcion_ca(), request);
        titulo = compruebaTitulo(form.getTitulo_ca(), request);
        idioma = "ca";
        alMenosUna = addDescripcion(descripciones, alMenosUna, desc, titulo, idioma);

        desc = compruebaDescripcion(form.getDescripcion_en(), request);
        titulo = compruebaTitulo(form.getTitulo_en(), request);
        idioma = "en";
        alMenosUna = addDescripcion(descripciones, alMenosUna, desc, titulo, idioma);

        desc = compruebaDescripcion(form.getDescripcion_eu(), request);
        titulo = compruebaTitulo(form.getTitulo_eu(), request);
        idioma = "eu";
        alMenosUna = addDescripcion(descripciones, alMenosUna, desc, titulo, idioma);

        desc = compruebaDescripcion(form.getDescripcion_gl(), request);
        titulo = compruebaTitulo(form.getTitulo_gl(), request);
        idioma = "gl";
        alMenosUna = addDescripcion(descripciones, alMenosUna, desc, titulo, idioma);

        desc = compruebaDescripcion(form.getDescripcion_va(), request);
        titulo = compruebaTitulo(form.getTitulo_va(), request);
        idioma = "va";
        alMenosUna = addDescripcion(descripciones, alMenosUna, desc, titulo, idioma);

        if (!alMenosUna) {
            throw new ValidatorException("{crearDescarga.noDescripcion.exception}");
        }

        String path = "";
        if (sesion.getPath() == null || !sesion.getPath().equals(form.getPath())) {
            path = form.getPath();
        }

        Long identificador = sesion.getIdentificador() != null ? sesion.getIdentificador() : null;

        identificador = getSrvDescargas().modificarDescarga(identificador, path, sesion.getActiva(),
                descripciones.toArray(new DescDescargaVO[] {}));
        if (identificador == null) {
            throw new ValidatorException("{crearDescarga.noFichero.exception}");
        }
        form.setIdModificada(identificador);
    }
    removeConfigurarDescargaSession(request);

}

From source file:com.dimdim.conference.application.portal.PortalServerAdapter.java

private String getActionName(ResourceBundle rb, String key, String defaultAction) {
    String ret = defaultAction;//w w  w . j  a  v a 2s  . co  m
    try {
        ret = rb.getString(key);
    } catch (Exception e) {
        ret = defaultAction;
    }
    return ret;
}

From source file:es.pode.empaquetador.presentacion.agregar.personales.AgregarPersonalesControllerImpl.java

/**
 * @see es.pode.empaquetador.presentacion.agregar.personales.AgregarPersonalesController#selectAction(org.apache.struts.action.ActionMapping, es.pode.empaquetador.presentacion.agregar.personales.SelectActionForm, javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse)
 *///from   w  w  w . j a  v a  2s  .com
public final java.lang.String selectAction(ActionMapping mapping,
        es.pode.empaquetador.presentacion.agregar.personales.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"))) {
        result = "Cancelar";
    } else {

        Logger.getLogger(this.getClass())
                .error("El valor del submit no es correcto (actionSubmit = " + actionSubmit + ");");
    }

    return result;
}

From source file:org.gitana.platform.client.Gitana.java

/**
 * Creates a Gitana instance bound to a given client on an environment.
 *
 * @param environmentId//from ww  w .  jav  a  2 s  .  c o m
 * @param clientKey
 * @param clientSecret
 */
public Gitana(String environmentId, String clientKey, String clientSecret) {
    if (environmentId == null) {
        environmentId = Environment.DEFAULT;
    }

    this.environmentId = environmentId;

    // load environment properties
    ResourceBundle bundle = readBundle("gitana-environments");
    this.baseUrl = bundle.getString("gitana.environment." + environmentId + ".uri");

    // load client properties if not provided
    if (clientKey == null && clientSecret == null) {
        bundle = readBundle("gitana");

        if (bundle.containsKey("gitana.clientKey")) {
            this.clientKey = bundle.getString("gitana.clientKey");
        }

        // legacy support
        if (this.clientKey == null && bundle.containsKey("gitana.clientId")) {
            this.clientKey = bundle.getString("gitana.clientId");
        }

        this.clientSecret = bundle.getString("gitana.clientSecret");
    } else {
        this.clientKey = clientKey;
        this.clientSecret = clientSecret;
    }
}

From source file:es.pode.modificador.presentacion.configurar.modificacion.ConfigurarModificacionControllerImpl.java

/**
* @see es.pode.modificador.presentacion.configurar.modificacion.ConfigurarModificacionController#submitBotones(org.apache.struts.action.ActionMapping,
*      es.pode.modificador.presentacion.configurar.modificacion.SubmitBotonesForm,
*      javax.servlet.http.HttpServletRequest,
*      javax.servlet.http.HttpServletResponse)
*//*from w  w w.ja va  2  s .  co  m*/
public final String submitBotones(ActionMapping mapping,
        es.pode.modificador.presentacion.configurar.modificacion.SubmitBotonesForm form,
        HttpServletRequest request, HttpServletResponse response) throws Exception {
    java.util.Locale locale = (java.util.Locale) request.getSession()
            .getAttribute(ConstantesAgrega.DEFAULT_LOCALE);
    ResourceBundle i18n = ResourceBundle.getBundle("application-resources", locale);
    String accion = form.getAction();
    if (accion.equals(i18n.getString("configurarModificacion.objetos.volver"))) {
        return "Volver";

    } else if (accion.equals(i18n.getString("configurarModificacion.objetos.cancelar"))) {
        return "Cancelar";
    } else {
        return "Guardar";
    }
}

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

@Override
public String getAsString(FacesContext facesContext, UIComponent uiComponent, Object value) {
    ResourceBundle resourceBundle = ResourceBundle.getBundle("Messages",
            new Locale(FacesUtil.getSessionAttribute(HRMConstant.BAHASA_ACTIVE).toString()));
    String messages = StringUtils.EMPTY;
    String data = (String) value;
    switch (data) {
    case HRMConstant.REIMBURSEMENT:
        messages = resourceBundle.getString("reimbursment.reimbursment");
        break;//from  w  ww  .j a v a  2  s . c o  m
    case HRMConstant.RECRUIT_MPP_APPLY:
        messages = resourceBundle.getString("approvaldefinition.recruit_mpp_apply");
        break;
    case HRMConstant.LEAVE:
        messages = resourceBundle.getString("global.leave");
        break;
    case HRMConstant.OVERTIME:
        messages = resourceBundle.getString("global.overtime");
        break;
    case HRMConstant.RECRUITMENT_REQUEST:
        messages = resourceBundle.getString("recruitment.recruitment_request");
        break;
    case HRMConstant.EMP_CORRECTION_ATTENDANCE:
        messages = resourceBundle.getString("emp_correction_attendance.correction_attendance");
        break;
    case HRMConstant.LOAN:
        messages = resourceBundle.getString("loan.loan");
        break;
    case HRMConstant.SHIFT_SCHEDULE:
        messages = resourceBundle.getString("global.schedule_shift");
        break;
    case HRMConstant.BUSINESS_TRAVEL:
        messages = resourceBundle.getString("businesstravel.business_travel");
        break;
    case HRMConstant.PERMIT:
        messages = resourceBundle.getString("global.permit");
        break;
    case HRMConstant.EMPLOYEE_CAREER_TRANSITION:
        messages = resourceBundle.getString("emp_career_transition.career_transition");
        break;
    case HRMConstant.EMPLOYEE_ELIMINATION:
        messages = resourceBundle.getString("approvaldefinition.process_request_career_elimination");
        break;
    case HRMConstant.APPROVAL_PROCESS:
        messages = resourceBundle.getString("approvaldefinition.approval_process");
        break;
    case HRMConstant.APPROVAL_TYPE_POSITION:
        messages = resourceBundle.getString("position.position");
        break;
    case HRMConstant.APPROVAL_TYPE_DEPARTMENT:
        messages = resourceBundle.getString("department.department");
        break;
    case HRMConstant.APPROVAL_TYPE_INDIVIDUAL:
        messages = resourceBundle.getString("global.individual");
        break;
    default:
        messages = data;
        break;
    }

    return messages;

}

From source file:io.github.swagger2markup.internal.document.builder.MarkupDocumentBuilder.java

MarkupDocumentBuilder(Swagger2MarkupConverter.Context globalContext,
        Swagger2MarkupExtensionRegistry extensionRegistry, Path outputPath) {
    this.globalContext = globalContext;
    this.extensionRegistry = extensionRegistry;
    this.config = globalContext.getConfig();
    this.outputPath = outputPath;

    this.markupDocBuilder = MarkupDocBuilders
            .documentBuilder(config.getMarkupLanguage(), config.getLineSeparator())
            .withAnchorPrefix(config.getAnchorPrefix());

    ResourceBundle labels = ResourceBundle.getBundle("io/github/swagger2markup/lang/labels",
            config.getOutputLanguage().toLocale());
    DEFAULT_COLUMN = labels.getString("default_column");
    EXAMPLE_COLUMN = labels.getString("example_column");
    FLAGS_COLUMN = labels.getString("flags.column");
    FLAGS_REQUIRED = labels.getString("flags.required");
    FLAGS_OPTIONAL = labels.getString("flags.optional");
    FLAGS_READ_ONLY = labels.getString("flags.read_only");
    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 a v  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:com.gcrm.action.system.EditUserAction.java

/**
 * Gets the entity./*from w  w  w.j  a va 2s . com*/
 * 
 * @return the SUCCESS result
 */
public String get() throws Exception {
    if (this.getId() != null) {
        user = baseService.getEntityById(User.class, this.getId());
        UserStatus status = user.getStatus();
        if (status != null) {
            statusID = status.getId();
        }
        User reportTo = user.getReport_to();
        if (reportTo != null) {
            reportToID = reportTo.getId();
        }
        Set<Role> roles = user.getRoles();

        ArrayList<GrantedAuthority> authorities = new ArrayList<GrantedAuthority>();
        for (Role role : roles) {
            SimpleGrantedAuthority grantedAuthority = new SimpleGrantedAuthority(role.getName());
            authorities.add(grantedAuthority);
            try {
                UserUtil.setAccessValue(role, user);
            } catch (Exception e) {
                throw new RuntimeException("Failed to set the Access value");
            }
        }

        ResourceBundle rb = CommonUtil.getResourceBundle();
        Map<Integer, String> scopeMap = new HashMap<Integer, String>();
        scopeMap.put(0, rb.getString("access.notSet.value"));
        scopeMap.put(1, rb.getString("access.all.value"));
        scopeMap.put(2, rb.getString("access.owner.value"));
        user.setScopeMap(scopeMap);
        Map<Integer, String> accessMap = new HashMap<Integer, String>();
        accessMap.put(0, rb.getString("access.notSet.value"));
        accessMap.put(1, rb.getString("access.enabled.value"));
        accessMap.put(2, rb.getString("access.disabled.value"));
        user.setAccessMap(accessMap);
        this.getBaseInfo(user, User.class.getSimpleName(), Constant.SYSTEM_NAMESPACE);
    }
    return SUCCESS;
}