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:es.pode.administracion.presentacion.adminusuarios.bajaUsuario.BajaUsuarioControllerImpl.java

/**
 * @see es.pode.administracion.presentacion.adminusuarios.bajaUsuario.BajaUsuarioController#bajaUsuario(org.apache.struts.action.ActionMapping,
 *      es.pode.administracion.presentacion.adminusuarios.bajaUsuario.BajaUsuarioForm,
 *      javax.servlet.http.HttpServletRequest,
 *      javax.servlet.http.HttpServletResponse)
 *//*ww  w  .j  ava  2  s .  c  o m*/
public final void bajaUsuario(ActionMapping mapping,
        es.pode.administracion.presentacion.adminusuarios.bajaUsuario.BajaUsuarioForm form,
        HttpServletRequest request, HttpServletResponse response) throws Exception {

    String listaId = request.getParameter("listaId");
    if (log.isDebugEnabled())
        log.debug("los ids de usuario que se quieren eliminar son " + listaId);
    Object[] objeto = listaId.split(" ");

    ResourceBundle ficheroRecursos = null;
    try {

        String login = LdapUserDetailsUtils.getLogin();
        SrvAdminUsuariosService srvAdminUsuariosService = this.getSrvAdminUsuariosService();
        UsuarioVO emailAdmin = srvAdminUsuariosService.obtenerDatosUsuario(login);
        ValidaBajaUsuarioVO validaBaja = srvAdminUsuariosService.bajaUsuario(obtenerIds(objeto), emailAdmin);
        Locale locale = request.getLocale();
        ficheroRecursos = this.getFicherRecursos(locale);
        form.setUsuariosDeleted(validaBaja.getItemsDeleted());
        form.setDescripcionBaja(ficheroRecursos.getString(validaBaja.getDescripcion()));
        form.setUsuariosDeleted(validaBaja.getItemsDeleted());

    } catch (Exception e) {
        log.error("Se ha producido un error al eliminar el usuario " + e);
        throw new ValidatorException("{errors.borrarUsuario}");
    }

}

From source file:com.axelor.meta.service.MetaGroupMenuAssistantService.java

private void addMenuRows(MetaGroupMenuAssistant groupMenuAssistant, List<String[]> rows) {

    String language = groupMenuAssistant.getLanguage();
    language = language != null ? language : "en";
    ResourceBundle bundle = I18n.getBundle(new Locale(language));

    List<String> names = new ArrayList<String>();
    String[] groupRow = rows.get(0);
    rows.remove(0);/*from  w  w w . j  a  v  a2s .c o m*/

    for (String[] row : rows) {
        names.add(row[0]);
    }

    for (MetaMenu metaMenu : groupMenuAssistant.getMenuSet()) {

        String title = metaMenu.getTitle();
        String translation = bundle.getString(title);

        if (!Strings.isNullOrEmpty(translation)) {
            title = translation;
        }

        String name = metaMenu.getName();
        if (!names.contains(name)) {
            String[] menu = new String[groupRow.length];
            menu[0] = name;
            menu[1] = title;
            rows.add(menu);
        }
    }

    Collections.sort(rows, new Comparator<String[]>() {

        @Override
        public int compare(String[] first, String[] second) {
            return first[0].compareTo(second[0]);
        }

    });

    rows.add(0, groupRow);

}

From source file:at.alladin.rmbt.controlServer.TestResultDetailResource.java

/**
 * // w  w w  . j  a va  2  s.co m
 * @param test
 * @param settings
 * @param conn
 * @return
 * @throws JSONException
 */
public static JSONObject getGeoLocation(Settings sett, Test test, ResourceBundle settings, Connection conn,
        ResourceBundle labels) throws JSONException {
    JSONObject json = new JSONObject();
    // geo-location
    final Field latField = test.getField("geo_lat"); //csv 6
    final Field longField = test.getField("geo_long"); //csv 7
    final Field accuracyField = test.getField("geo_accuracy");
    final Field providerField = test.getField("geo_provider"); //csv 8
    if (!(latField.isNull() || longField.isNull() || accuracyField.isNull())) {
        final double accuracy = accuracyField.doubleValue();
        if (accuracy < Double.parseDouble(sett.getSetting("rmbt_geo_accuracy_detail_limit"))) {
            final StringBuilder geoString = new StringBuilder(
                    Helperfunctions.geoToString(latField.doubleValue(), longField.doubleValue()));

            geoString.append(" (");
            if (!providerField.isNull()) {
                String provider = providerField.toString().toUpperCase(Locale.US);

                switch (provider) {
                case "NETWORK":
                    provider = labels.getString("key_geo_source_network");
                    break;
                case "GPS":
                    provider = labels.getString("key_geo_source_gps");
                    break;
                }

                geoString.append(provider);
                geoString.append(", ");
            }
            geoString.append(String.format(Locale.US, "+/- %.0f m", accuracy));
            geoString.append(")");
            json.put("location", geoString.toString());

            //also try getting the distance during the test
            final Date clientDate = ((TimestampField) test.getField("client_time")).getDate();
            final long clientTime = clientDate.getTime();
            try {
                OpenTestResource.LocationGraph locGraph = new OpenTestResource.LocationGraph(test.getUid(),
                        clientTime, conn);
                if ((locGraph.getTotalDistance() > 0) && locGraph.getTotalDistance() <= Double
                        .parseDouble(sett.getSetting("rmbt_geo_distance_detail_limit"))) {
                    json.put("motion", Math.round(locGraph.getTotalDistance()) + " m");
                }

            } catch (SQLException ex) {
                //cannot happen since the test uid has to exist in here
                ex.printStackTrace();
            }
        }

        // country derived from location
        final Field countryLocationField = test.getField("country_location");
        if (!countryLocationField.isNull()) {
            json.put("country_location", countryLocationField.toString());
        }
    }

    return json;
}

From source file:org.xmlactions.action.config.ExecContext.java

public String getLocalizedString(String resource, String key) {
    Validate.notEmpty(resource,//ww w . j  a va2 s.  co m
            "No Resource (locale file) has been set for call to getLocalIzedString(resource, [" + key + "]);");
    try {
        ResourceBundle res = ResourceBundle.getBundle(resource);
        return res.getString(key);
    } catch (Exception ex) {
        // ignore the exception
        return "[" + key + "] " + "error[" + ex.getMessage() + "]";
    }
}

From source file:com.inkubator.hrm.web.payroll.PaySalaryExecuteController.java

public void onCompleteCalculatePayroll() {
    if (jobExecution != null) {
        setProgress(0);//w w w. j  a  v  a2 s .  c o m
        if (jobExecution.getStatus() == BatchStatus.COMPLETED) {
            MessagesResourceUtil.setMessagesFlas(FacesMessage.SEVERITY_INFO, "global.information",
                    "salaryCalculation.calculation_process_succesfully",
                    FacesUtil.getSessionAttribute(HRMConstant.BAHASA_ACTIVE).toString());

            /** cek jika ada karyawan yang total income nya di bawah minimum (25.000), maka kasih warning info */
            try {
                List<PayTempKalkulasi> incomes = payTempKalkulasiService
                        .getAllDataByTotalIncomeBelow(new BigDecimal(25000));
                if (incomes.size() > 0) {
                    StringBuffer allNik = new StringBuffer();
                    for (PayTempKalkulasi income : incomes) {
                        if (StringUtils.isNotEmpty(allNik)) {
                            allNik.append(", ");
                        }
                        allNik.append(income.getEmpData().getNik());
                    }
                    Object[] parameters = new Object[1];
                    parameters[0] = allNik.toString();

                    ResourceBundle bundle = ResourceBundle.getBundle("Messages",
                            new Locale(FacesUtil.getSessionAttribute(HRMConstant.BAHASA_ACTIVE).toString()));
                    String message = MessageFormat.format(
                            bundle.getString("salaryCalculation.warning_income_below_minimum"), parameters);
                    FacesMessage msg = new FacesMessage(FacesMessage.SEVERITY_WARN,
                            bundle.getString("global.information"), message);
                    FacesUtil.getFacesContext().addMessage(null, msg);
                }
            } catch (Exception ex) {
                LOGGER.error("Error ", ex);
            }

        } else {
            final List<Throwable> exceptions = jobExecution.getAllFailureExceptions();
            for (final Throwable throwable : exceptions) {
                if (throwable instanceof BussinessException) {
                    BussinessException bussinessException = (BussinessException) throwable;
                    ResourceBundle messages = ResourceBundle.getBundle("Messages",
                            new Locale(FacesUtil.getSessionAttribute(HRMConstant.BAHASA_ACTIVE).toString()));
                    FacesMessage msg = new FacesMessage(FacesMessage.SEVERITY_ERROR,
                            messages.getString("global.error"), bussinessException.getMessage());
                    FacesUtil.getFacesContext().addMessage(null, msg);

                } else if (throwable.getCause() instanceof BussinessException) {
                    BussinessException bussinessException = (BussinessException) throwable.getCause();
                    ResourceBundle messages = ResourceBundle.getBundle("Messages",
                            new Locale(FacesUtil.getSessionAttribute(HRMConstant.BAHASA_ACTIVE).toString()));
                    FacesMessage msg = new FacesMessage(FacesMessage.SEVERITY_ERROR,
                            messages.getString("global.error"), bussinessException.getMessage());
                    FacesUtil.getFacesContext().addMessage(null, msg);

                } else if (throwable.getCause().getCause() instanceof BussinessException) {
                    BussinessException bussinessException = (BussinessException) throwable.getCause()
                            .getCause();
                    ResourceBundle messages = ResourceBundle.getBundle("Messages",
                            new Locale(FacesUtil.getSessionAttribute(HRMConstant.BAHASA_ACTIVE).toString()));
                    FacesMessage msg = new FacesMessage(FacesMessage.SEVERITY_ERROR,
                            messages.getString("global.error"), bussinessException.getMessage());
                    FacesUtil.getFacesContext().addMessage(null, msg);

                }
            }

            MessagesResourceUtil.setMessagesFlas(FacesMessage.SEVERITY_ERROR, "global.error",
                    "salaryCalculation.calculation_process_failed",
                    FacesUtil.getSessionAttribute(HRMConstant.BAHASA_ACTIVE).toString());
            FacesContext.getCurrentInstance().validationFailed();
        }
        jobExecution = null;
    }
}

From source file:eu.dety.burp.joseph.attacks.bleichenbacher_pkcs1.gui.BleichenbacherPkcs1DecryptionAttackPanel.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 v a  2s  . c om
@SuppressWarnings("unchecked")
// <editor-fold defaultstate="collapsed"
// desc="Generated Code">//GEN-BEGIN:initComponents
private void initComponents() {

    cekFormatButtonGroup = new javax.swing.ButtonGroup();
    startAttackButton = new javax.swing.JButton();
    cancelAttackButton = new javax.swing.JButton();
    jSeparator1 = new javax.swing.JSeparator();
    timeElapsedLabel = new javax.swing.JLabel();
    amountRequestsLabel = new javax.swing.JLabel();
    currentSLabel = new javax.swing.JLabel();
    resultKeyLabel = new javax.swing.JLabel();
    cekFormatHex = new javax.swing.JRadioButton();
    cekFormatB64 = new javax.swing.JRadioButton();
    attackDescription = new javax.swing.JLabel();
    timeElapsedValue = new javax.swing.JLabel();
    amountRequestsValue = new javax.swing.JLabel();
    jScrollPane1 = new javax.swing.JScrollPane();
    currentSValue = new javax.swing.JTextArea();
    jScrollPane2 = new javax.swing.JScrollPane();
    resultContentValue = new javax.swing.JTextArea();
    resultContentLabel = new javax.swing.JLabel();
    jScrollPane3 = new javax.swing.JScrollPane();
    resultKeyValue = new javax.swing.JTextArea();

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

    cancelAttackButton.setText(bundle.getString("CANCELATTACKBUTTON")); // NOI18N
    cancelAttackButton.setEnabled(false);
    cancelAttackButton.addActionListener(new java.awt.event.ActionListener() {
        public void actionPerformed(java.awt.event.ActionEvent evt) {
            cancelAttackButtonActionPerformed(evt);
        }
    });

    timeElapsedLabel.setText(bundle.getString("TIME_ELAPSED")); // NOI18N

    amountRequestsLabel.setText(bundle.getString("AMOUNT_REQUESTS")); // NOI18N

    currentSLabel.setText(bundle.getString("FOUND_S")); // NOI18N

    resultKeyLabel.setFont(new java.awt.Font("Lucida Grande", 1, 13)); // NOI18N
    resultKeyLabel.setText(bundle.getString("RESULT_CEK")); // NOI18N

    cekFormatButtonGroup.add(cekFormatHex);
    cekFormatHex.setSelected(true);
    cekFormatHex.setText(bundle.getString("HEX")); // NOI18N
    cekFormatHex.addActionListener(new java.awt.event.ActionListener() {
        public void actionPerformed(java.awt.event.ActionEvent evt) {
            cekFormatHexActionPerformed(evt);
        }
    });

    cekFormatButtonGroup.add(cekFormatB64);
    cekFormatB64.setText(bundle.getString("BASE64URL")); // NOI18N
    cekFormatB64.addActionListener(new java.awt.event.ActionListener() {
        public void actionPerformed(java.awt.event.ActionEvent evt) {
            cekFormatB64ActionPerformed(evt);
        }
    });

    attackDescription.setText(
            "<html><em>Note: This attack will take several minutes and performs thousands of requests to the server!</em><br />This attack is only successful, if the valid oracle responses are correctly marked.</html>");

    timeElapsedValue.setText("00:00:00");
    timeElapsedValue.setHorizontalTextPosition(javax.swing.SwingConstants.RIGHT);

    amountRequestsValue.setText("0");
    amountRequestsValue.setHorizontalTextPosition(javax.swing.SwingConstants.RIGHT);

    jScrollPane1.setBackground(new java.awt.Color(251, 251, 251));
    jScrollPane1.setBorder(null);
    jScrollPane1.setForeground(new java.awt.Color(0, 0, 0));

    currentSValue.setEditable(false);
    currentSValue.setBackground(new java.awt.Color(251, 251, 251));
    currentSValue.setColumns(20);
    currentSValue.setForeground(new java.awt.Color(0, 0, 0));
    currentSValue.setLineWrap(true);
    currentSValue.setRows(4);
    currentSValue.setTabSize(4);
    currentSValue.setText("0");
    currentSValue.setWrapStyleWord(true);
    currentSValue.setBorder(null);
    jScrollPane1.setViewportView(currentSValue);

    jScrollPane2.setHorizontalScrollBarPolicy(javax.swing.ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER);

    resultContentValue.setEditable(false);
    resultContentValue.setColumns(20);
    resultContentValue.setLineWrap(true);
    resultContentValue.setRows(5);
    resultContentValue.setWrapStyleWord(true);
    resultContentValue.setBorder(null);
    jScrollPane2.setViewportView(resultContentValue);

    resultContentLabel.setFont(new java.awt.Font("Lucida Grande", 1, 13)); // NOI18N
    resultContentLabel.setText(bundle.getString("RESULT_CONTENT")); // NOI18N

    jScrollPane3.setHorizontalScrollBarPolicy(javax.swing.ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER);

    resultKeyValue.setEditable(false);
    resultKeyValue.setColumns(20);
    resultKeyValue.setLineWrap(true);
    resultKeyValue.setRows(5);
    resultKeyValue.setWrapStyleWord(true);
    resultKeyValue.setBorder(null);
    jScrollPane3.setViewportView(resultKeyValue);

    javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
    this.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().addGroup(layout
                            .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(attackDescription, javax.swing.GroupLayout.Alignment.TRAILING,
                                    javax.swing.GroupLayout.DEFAULT_SIZE, 922, Short.MAX_VALUE)
                            .addComponent(jSeparator1)
                            .addGroup(layout.createSequentialGroup().addGroup(layout
                                    .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                    .addGroup(layout.createSequentialGroup().addComponent(startAttackButton)
                                            .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                            .addComponent(cancelAttackButton))
                                    .addGroup(layout.createSequentialGroup().addComponent(cekFormatHex)
                                            .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                            .addComponent(cekFormatB64))
                                    .addComponent(resultKeyLabel)
                                    .addGroup(layout.createSequentialGroup().addGroup(layout
                                            .createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING,
                                                    false)
                                            .addComponent(currentSLabel,
                                                    javax.swing.GroupLayout.Alignment.LEADING,
                                                    javax.swing.GroupLayout.DEFAULT_SIZE,
                                                    javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                                            .addComponent(amountRequestsLabel,
                                                    javax.swing.GroupLayout.Alignment.LEADING,
                                                    javax.swing.GroupLayout.DEFAULT_SIZE,
                                                    javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                                            .addComponent(timeElapsedLabel,
                                                    javax.swing.GroupLayout.Alignment.LEADING,
                                                    javax.swing.GroupLayout.DEFAULT_SIZE,
                                                    javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
                                            .addPreferredGap(
                                                    javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                                            .addGroup(layout
                                                    .createParallelGroup(
                                                            javax.swing.GroupLayout.Alignment.TRAILING, false)
                                                    .addComponent(timeElapsedValue,
                                                            javax.swing.GroupLayout.Alignment.LEADING,
                                                            javax.swing.GroupLayout.DEFAULT_SIZE, 576,
                                                            Short.MAX_VALUE)
                                                    .addComponent(amountRequestsValue,
                                                            javax.swing.GroupLayout.Alignment.LEADING,
                                                            javax.swing.GroupLayout.DEFAULT_SIZE,
                                                            javax.swing.GroupLayout.DEFAULT_SIZE,
                                                            Short.MAX_VALUE)
                                                    .addComponent(jScrollPane1,
                                                            javax.swing.GroupLayout.Alignment.LEADING)))
                                    .addComponent(resultContentLabel)).addGap(0, 0, Short.MAX_VALUE)))
                            .addContainerGap())
                    .addGroup(layout.createSequentialGroup().addGap(6, 6, 6)
                            .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                                    .addComponent(jScrollPane3, javax.swing.GroupLayout.PREFERRED_SIZE, 700,
                                            javax.swing.GroupLayout.PREFERRED_SIZE)
                                    .addComponent(jScrollPane2, javax.swing.GroupLayout.PREFERRED_SIZE, 700,
                                            javax.swing.GroupLayout.PREFERRED_SIZE))
                            .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)))));
    layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(layout.createSequentialGroup().addContainerGap()
                            .addComponent(attackDescription, javax.swing.GroupLayout.PREFERRED_SIZE, 52,
                                    javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                            .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                                    .addComponent(startAttackButton).addComponent(cancelAttackButton))
                            .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                            .addComponent(jSeparator1, javax.swing.GroupLayout.PREFERRED_SIZE, 10,
                                    javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                            .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                                    .addComponent(timeElapsedLabel).addComponent(timeElapsedValue))
                            .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                            .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                                    .addComponent(amountRequestsLabel).addComponent(amountRequestsValue))
                            .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                            .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                    .addComponent(currentSLabel).addComponent(jScrollPane1,
                                            javax.swing.GroupLayout.PREFERRED_SIZE, 82,
                                            javax.swing.GroupLayout.PREFERRED_SIZE))
                            .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                            .addComponent(resultKeyLabel)
                            .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                            .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                                    .addComponent(cekFormatHex).addComponent(cekFormatB64))
                            .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                            .addComponent(jScrollPane3, javax.swing.GroupLayout.PREFERRED_SIZE, 110,
                                    javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                            .addComponent(resultContentLabel)
                            .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                            .addComponent(jScrollPane2, javax.swing.GroupLayout.PREFERRED_SIZE, 110,
                                    javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addContainerGap(68, Short.MAX_VALUE)));
}

From source file:com.balero.controllers.PageController.java

@RequestMapping(value = "/page/edit/{id}", method = RequestMethod.POST)
public String editPage(@PathVariable int id, @RequestParam String pagename, @RequestParam String pageslug,
        @RequestParam String pagebody, @RequestParam String pagelocale,
        @CookieValue(value = "baleroAdmin") String baleroAdmin, RedirectAttributes redirectAttributes,
        Locale locale, HttpServletRequest request) {

    // Security//from w ww . ja v a2 s .  com
    UsersAuth security = new UsersAuth();
    security.setCredentials(baleroAdmin, UsersDAO);
    if (security.auth(baleroAdmin, security.getLocalUsername(), security.getLocalPassword()) == false)
        return "hacking";

    if (pagename.isEmpty()) {
        pagename = "(No Title)";
    }

    // Slugify
    String newSlug = InitSlugifyTag.getSlugify().slugify(pageslug);

    ResourceBundle messages = ResourceBundle.getBundle("messages", locale);

    String view = null;
    try {
        if (pageslug.isEmpty()) {
            throw new Exception("Slug is empty!");
        }
        StaticPagesDAO.updatePage(id, pagename, pagebody, newSlug, pagelocale);
        view = "redirect:/page/" + newSlug;
    } catch (Exception e) {
        logger.debug(e.getMessage());
        redirectAttributes.addFlashAttribute("message", messages.getString("label.page.slugerror"));
        String referer = request.getHeader("Referer");
        view = "redirect:" + referer;
    }

    return view;

}

From source file:com.vgi.mafscaling.Rescale.java

private String usage() {
    ResourceBundle bundle;
    bundle = ResourceBundle.getBundle("com.vgi.mafscaling.rescale");
    return bundle.getString("usage");
}

From source file:com.cmsoftware.keyron.vista.Login.java

@SuppressWarnings("unchecked")
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
private void initComponents() {

    panelContenido = new javax.swing.JPanel();
    logo = new javax.swing.JLabel();
    separador = new javax.swing.JLabel();
    mensajeAcceso = new javax.swing.JLabel();
    labelUsuario = new javax.swing.JLabel();
    labelClave = new javax.swing.JLabel();
    usuario = new javax.swing.JTextField();
    acceder = new javax.swing.JButton();
    cerrar = new javax.swing.JLabel();
    clave = new javax.swing.JPasswordField();
    panelMensajes = new javax.swing.JPanel();
    labelError = new javax.swing.JLabel();

    setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
    java.util.ResourceBundle bundle = java.util.ResourceBundle
            .getBundle("com/cmsoftware/keyron/vista/idioma/idioma"); // NOI18N
    setTitle(bundle.getString("iniciar_sesion")); // NOI18N
    setName("Login"); // NOI18N
    setUndecorated(true);//w  ww  .j a  v  a 2s  . c  o  m
    setResizable(false);

    panelContenido.setBackground(new java.awt.Color(246, 246, 246));
    panelContenido.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(119, 41, 83)));
    panelContenido.setMaximumSize(new java.awt.Dimension(382, 318));
    panelContenido.setMinimumSize(new java.awt.Dimension(382, 318));
    panelContenido.addMouseListener(new java.awt.event.MouseAdapter() {
        public void mouseClicked(java.awt.event.MouseEvent evt) {
            panelContenidoMouseClicked(evt);
        }

        public void mousePressed(java.awt.event.MouseEvent evt) {
            panelContenidoMousePressed(evt);
        }

        public void mouseReleased(java.awt.event.MouseEvent evt) {
            panelContenidoMouseReleased(evt);
        }
    });
    panelContenido.addMouseMotionListener(new java.awt.event.MouseMotionAdapter() {
        public void mouseDragged(java.awt.event.MouseEvent evt) {
            panelContenidoMouseDragged(evt);
        }

        public void mouseMoved(java.awt.event.MouseEvent evt) {
            panelContenidoMouseMoved(evt);
        }
    });

    logo.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
    logo.setIcon(new javax.swing.ImageIcon(
            getClass().getResource("/com/cmsoftware/keyron/recursos/encabezado.png"))); // NOI18N

    separador.setForeground(new java.awt.Color(119, 41, 83));
    separador.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
    separador.setText("______________________________________________________________");

    mensajeAcceso.setFont(new java.awt.Font("Arial", 1, 14)); // NOI18N
    mensajeAcceso.setForeground(new java.awt.Color(89, 89, 89));
    mensajeAcceso.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
    mensajeAcceso.setText(Configuracion.getInstancia().getBundle().getString("mensaje_acceso")); // NOI18N

    labelUsuario.setFont(new java.awt.Font("Arial", 1, 14)); // NOI18N
    labelUsuario.setForeground(new java.awt.Color(89, 89, 89));
    labelUsuario.setText(Configuracion.getInstancia().getBundle().getString("campo_usuario")); // NOI18N

    labelClave.setFont(new java.awt.Font("Arial", 1, 14)); // NOI18N
    labelClave.setForeground(new java.awt.Color(89, 89, 89));
    labelClave.setText(Configuracion.getInstancia().getBundle().getString("campo_clave")); // NOI18N

    usuario.setFont(com.cmsoftware.keyron.controlador.Optimizacion.getInstancia().getFuente().MyFont(0, 14f));
    usuario.setForeground(new java.awt.Color(89, 89, 89));
    usuario.addKeyListener(new java.awt.event.KeyAdapter() {
        public void keyTyped(java.awt.event.KeyEvent evt) {
            usuarioKeyTyped(evt);
        }
    });

    acceder.setFont(new java.awt.Font("Arial", 1, 14)); // NOI18N
    acceder.setForeground(new java.awt.Color(89, 89, 89));
    acceder.setText(Configuracion.getInstancia().getBundle().getString("boton_acceder")); // NOI18N
    acceder.setCursor(new java.awt.Cursor(java.awt.Cursor.HAND_CURSOR));
    acceder.setMargin(new java.awt.Insets(6, 14, 6, 14));
    acceder.addActionListener(new java.awt.event.ActionListener() {
        public void actionPerformed(java.awt.event.ActionEvent evt) {
            accederActionPerformed(evt);
        }
    });

    cerrar.setFont(new java.awt.Font("Arial", 1, 11)); // NOI18N
    cerrar.setText("X");
    cerrar.setCursor(new java.awt.Cursor(java.awt.Cursor.HAND_CURSOR));
    cerrar.addMouseListener(new java.awt.event.MouseAdapter() {
        public void mouseClicked(java.awt.event.MouseEvent evt) {
            cerrarMouseClicked(evt);
        }

        public void mouseEntered(java.awt.event.MouseEvent evt) {
            cerrarMouseEntered(evt);
        }

        public void mouseExited(java.awt.event.MouseEvent evt) {
            cerrarMouseExited(evt);
        }
    });

    clave.setFont(new java.awt.Font("Tahoma", 0, 13)); // NOI18N
    clave.setForeground(new java.awt.Color(89, 89, 89));
    clave.addKeyListener(new java.awt.event.KeyAdapter() {
        public void keyTyped(java.awt.event.KeyEvent evt) {
            claveKeyTyped(evt);
        }
    });

    javax.swing.GroupLayout panelContenidoLayout = new javax.swing.GroupLayout(panelContenido);
    panelContenido.setLayout(panelContenidoLayout);
    panelContenidoLayout.setHorizontalGroup(panelContenidoLayout
            .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, panelContenidoLayout.createSequentialGroup()
                    .addContainerGap()
                    .addGroup(panelContenidoLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.CENTER)
                            .addComponent(logo, javax.swing.GroupLayout.Alignment.LEADING,
                                    javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE,
                                    Short.MAX_VALUE)
                            .addComponent(separador, javax.swing.GroupLayout.Alignment.TRAILING,
                                    javax.swing.GroupLayout.PREFERRED_SIZE, 384,
                                    javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addGap(0, 0, 0).addComponent(cerrar).addGap(8, 8, 8))
            .addGroup(panelContenidoLayout.createSequentialGroup().addGap(25, 25, 25)
                    .addGroup(panelContenidoLayout
                            .createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                            .addComponent(acceder)
                            .addGroup(panelContenidoLayout
                                    .createSequentialGroup()
                                    .addGroup(panelContenidoLayout
                                            .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                            .addComponent(labelUsuario).addComponent(labelClave))
                                    .addGap(29, 29, 29)
                                    .addGroup(panelContenidoLayout
                                            .createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                                            .addComponent(usuario, javax.swing.GroupLayout.PREFERRED_SIZE, 262,
                                                    javax.swing.GroupLayout.PREFERRED_SIZE)
                                            .addComponent(clave, javax.swing.GroupLayout.PREFERRED_SIZE, 262,
                                                    javax.swing.GroupLayout.PREFERRED_SIZE))))
                    .addGap(0, 0, Short.MAX_VALUE))
            .addComponent(mensajeAcceso, javax.swing.GroupLayout.DEFAULT_SIZE,
                    javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE));
    panelContenidoLayout.setVerticalGroup(
            panelContenidoLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(panelContenidoLayout.createSequentialGroup()
                            .addGroup(panelContenidoLayout
                                    .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                    .addGroup(panelContenidoLayout.createSequentialGroup().addContainerGap()
                                            .addComponent(logo))
                                    .addComponent(cerrar))
                            .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                            .addComponent(separador)
                            .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                            .addComponent(mensajeAcceso).addGap(18, 18, 18)
                            .addGroup(panelContenidoLayout
                                    .createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                                    .addComponent(labelUsuario).addComponent(usuario,
                                            javax.swing.GroupLayout.PREFERRED_SIZE,
                                            javax.swing.GroupLayout.DEFAULT_SIZE,
                                            javax.swing.GroupLayout.PREFERRED_SIZE))
                            .addGap(18, 18, 18)
                            .addGroup(panelContenidoLayout
                                    .createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                                    .addComponent(labelClave).addComponent(clave,
                                            javax.swing.GroupLayout.PREFERRED_SIZE,
                                            javax.swing.GroupLayout.DEFAULT_SIZE,
                                            javax.swing.GroupLayout.PREFERRED_SIZE))
                            .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                            .addComponent(acceder)
                            .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)));

    panelContenidoLayout.linkSize(javax.swing.SwingConstants.VERTICAL,
            new java.awt.Component[] { clave, usuario });

    panelMensajes.setBackground(new java.awt.Color(119, 41, 83));

    labelError.setFont(new java.awt.Font("Tahoma", 0, 12)); // NOI18N
    labelError.setForeground(new java.awt.Color(255, 255, 255));
    labelError.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);

    javax.swing.GroupLayout panelMensajesLayout = new javax.swing.GroupLayout(panelMensajes);
    panelMensajes.setLayout(panelMensajesLayout);
    panelMensajesLayout.setHorizontalGroup(
            panelMensajesLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(labelError, javax.swing.GroupLayout.DEFAULT_SIZE, 426, Short.MAX_VALUE));
    panelMensajesLayout.setVerticalGroup(panelMensajesLayout
            .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(panelMensajesLayout.createSequentialGroup().addComponent(labelError,
                    javax.swing.GroupLayout.PREFERRED_SIZE, 38, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addGap(0, 0, Short.MAX_VALUE)));

    javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
    getContentPane().setLayout(layout);
    layout.setHorizontalGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(panelMensajes, javax.swing.GroupLayout.DEFAULT_SIZE,
                    javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
            .addComponent(panelContenido, javax.swing.GroupLayout.DEFAULT_SIZE,
                    javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE));
    layout.setVerticalGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                    .addComponent(panelContenido, javax.swing.GroupLayout.PREFERRED_SIZE,
                            javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addGap(0, 0, Short.MAX_VALUE)
                    .addComponent(panelMensajes, javax.swing.GroupLayout.PREFERRED_SIZE,
                            javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addGap(0, 0, 0)));

    pack();
}

From source file:cz.incad.kramerius.pdf.impl.FirstPagePDFServiceImpl.java

void pagesInParentPdf(PreparedDocument rdoc, ResourceBundle resourceBundle, List<DetailItem> details) {
    // tistene stranky
    List<AbstractPage> pages = rdoc.getPages();
    if (pages.size() == 1) {
        details.add(new DetailItem(resourceBundle.getString("pdf.fp.page"), pages.get(0).getPageNumber()));
    } else if (pages.size() > 1) {
        details.add(new DetailItem(resourceBundle.getString("pdf.fp.pages"),
                "" + pages.get(0).getPageNumber() + " - " + pages.get(pages.size() - 1).getPageNumber()));
    }//from   w ww.ja  v a  2 s . c  o  m
}