List of usage examples for java.util ResourceBundle getString
public final String getString(String key)
From source file:eu.apenet.dpt.standalone.gui.APETabbedPane.java
public void changeLanguage(ResourceBundle labels) { setTitleAt(TAB_CONVERSION, labels.getString("conversion")); setTitleAt(TAB_EDITION, labels.getString("edition")); setTitleAt(TAB_SUMMARY, labels.getString("summary")); setTitleAt(TAB_VALIDATION, labels.getString("validation")); setTitleAt(TAB_EDM, labels.getString("eseConversion")); convertBtn.setText(labels.getString("convert")); validateBtn.setText(labels.getString("validate")); convertAndValidateBtn.setText(labels.getString("convertAndValidate")); convertEdmBtn.setText(labels.getString("summary.convertEdm.button")); validationReportBtn.setText(labels.getString("dataquality.report.download")); stylesheetLabel.setText(labels.getString("summary.stylesheets.label") + ":"); schemaLabel.setText(labels.getString("summary.schemas.label") + ":"); }
From source file:com.googlecode.noweco.webmail.lotus.LotusWebmailConnection.java
@SuppressWarnings("unchecked") public LotusWebmailConnection(final HttpClient httpclient, final HttpHost host, final String prefix) throws IOException { this.prefix = prefix; HttpGet httpGet;/*w w w . j a va2s . co m*/ HttpResponse rsp; HttpEntity entity; String baseName = getClass().getPackage().getName().replace('.', '/') + "/lotus"; ResourceBundle bundleBrowser = null; for (Header header : (Collection<Header>) httpclient.getParams() .getParameter(ClientPNames.DEFAULT_HEADERS)) { if (header.getName().equals("Accept-Language")) { Matcher matcher = LANGUAGE_PATTERN.matcher(header.getValue()); if (matcher.find()) { String region = matcher.group(2); if (region != null && region.length() != 0) { bundleBrowser = ResourceBundle.getBundle(baseName, new Locale(matcher.group(1), region)); } else { bundleBrowser = ResourceBundle.getBundle(baseName, new Locale(matcher.group(1))); } } } } ResourceBundle bundleEnglish = ResourceBundle.getBundle(baseName, new Locale("en")); String deletePattern = "(?:" + Pattern.quote(bundleEnglish.getString("Delete")); if (bundleBrowser != null) { deletePattern = deletePattern + "|" + Pattern.quote(bundleBrowser.getString("Delete")) + ")"; } String emptyTrashPattern = "(?:" + Pattern.quote(bundleEnglish.getString("EmptyTrash")); if (bundleBrowser != null) { emptyTrashPattern = emptyTrashPattern + "|" + Pattern.quote(bundleBrowser.getString("EmptyTrash")) + ")"; } deleteDeletePattern = Pattern.compile( "_doClick\\('([^/]*/\\$V\\d+ACTIONS/[^']*)'[^>]*>" + deletePattern + "\\\\" + deletePattern); deleteEmptyTrashPattern = Pattern.compile( "_doClick\\('([^/]*/\\$V\\d+ACTIONS/[^']*)'[^>]*>" + deletePattern + "\\\\" + emptyTrashPattern); httpGet = new HttpGet(prefix + "/($Inbox)?OpenView"); rsp = httpclient.execute(host, httpGet); entity = rsp.getEntity(); String string = EntityUtils.toString(entity); if (entity != null) { LOGGER.trace("inbox content : {}", string); EntityUtils.consume(entity); } Matcher matcher = MAIN_PAGE_PATTERN.matcher(string); if (!matcher.find()) { throw new IOException("Unable to parse main page"); } pagePrefix = matcher.group(1); this.httpclient = httpclient; this.host = host; }
From source file:de.ingrid.portal.portlets.mdek.MdekEntryPortlet.java
public void doView(javax.portlet.RenderRequest request, javax.portlet.RenderResponse response) throws PortletException, IOException { Context context = getContext(request); ResourceBundle resourceBundle = getPortletConfig().getResourceBundle(request.getLocale()); context.put("MESSAGES", resourceBundle); PortletPreferences prefs = request.getPreferences(); String myTitleKey = prefs.getValue("titleKey", "mdek.title.entry"); response.setTitle(resourceBundle.getString(myTitleKey)); String userName = request.getRemoteUser(); UserData userData = null;//from w ww . java 2s . c om try { userData = getUserData(userName); if (hasUserAccessToMdekAdmin(userName)) { context.put("showMdekAdmin", true); } else { context.put("showMdekAdmin", false); if (userData == null) { context.put("noBackendUser", true); } } } catch (SecurityException e) { log.debug(e); } // check conflicts between IGE frontend and backend ! try { if (userData != null) { MdekPortletUtils.checkIGCCompatibility(userData.getPlugId(), mdekCallerCatalog); } } catch (Throwable e) { String errMsg = "Error fetching values from the iPlug with id '" + userData.getPlugId() + "'. \n" + e.getMessage(); PortletException exc = new PortletException(errMsg, e); log.error("Problems fetching data from catalog.", exc); throw exc; } // get auto startup parameter from request String nodeType = request.getParameter("nodeType"); String nodeId = request.getParameter("nodeId"); String autoStartQueryString = ""; if (nodeType != null && nodeType.length() > 0) { autoStartQueryString = "nodeType=" + nodeType; } if (nodeId != null && nodeId.length() > 0) { if (autoStartQueryString.length() > 0) { autoStartQueryString = autoStartQueryString + "&"; } autoStartQueryString = autoStartQueryString + "nodeId=" + nodeId; } context.put("autoStartQueryString", autoStartQueryString); context.put("language", request.getLocale().getLanguage()); setDefaultViewPage(TEMPLATE_START); super.doView(request, response); }
From source file:esmska.gui.AboutFrame.java
/** This method is called from within the constructor to * initialize the form./*w w w. j av a 2s .c o m*/ * WARNING: Do NOT modify this code. The content of this method is * always regenerated by the Form Editor. */ // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents private void initComponents() { jLabel1 = new JLabel(); jLabel2 = new JLabel(); jLabel3 = new JLabel(); creditsButton = new JButton(); closeButton = new JButton(); licenseButton = new JButton(); jLabel5 = new JLabel(); jLabel4 = new JLabel(); jLabel6 = new JLabel(); jLabel7 = new JLabel(); jLabel8 = new JLabel(); homeHyperlink = new JXHyperlink(); supportHyperlink = new JXHyperlink(); setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE); ResourceBundle bundle = ResourceBundle.getBundle("esmska/resources/l10n"); // NOI18N setTitle(bundle.getString("AboutFrame.title")); // NOI18N setLocationByPlatform(true); jLabel1.setHorizontalAlignment(SwingConstants.CENTER); jLabel1.setIcon(new ImageIcon(getClass().getResource("/esmska/resources/esmska.png"))); // NOI18N jLabel1.setFocusable(false); jLabel2.setFont(jLabel2.getFont().deriveFont(jLabel2.getFont().getStyle() | Font.BOLD, jLabel2.getFont().getSize() + 22)); jLabel2.setHorizontalAlignment(SwingConstants.CENTER); Mnemonics.setLocalizedText(jLabel2, "Esmska " + config.getLatestVersion()); jLabel2.setFocusable(false); jLabel3.setHorizontalAlignment(SwingConstants.CENTER); Mnemonics.setLocalizedText(jLabel3, bundle.getString("AboutFrame.jLabel3.text")); // NOI18N jLabel3.setFocusable(false); creditsButton.setIcon(new ImageIcon(getClass().getResource("/esmska/resources/about-22.png"))); // NOI18N Mnemonics.setLocalizedText(creditsButton, bundle.getString("AboutFrame.creditsButton.text")); creditsButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { creditsButtonActionPerformed(evt); } }); closeButton.setIcon(new ImageIcon(getClass().getResource("/esmska/resources/close-22.png"))); // NOI18N Mnemonics.setLocalizedText(closeButton, bundle.getString("Close_")); closeButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { closeButtonActionPerformed(evt); } }); Mnemonics.setLocalizedText(licenseButton, bundle.getString("AboutFrame.licenseButton.text")); licenseButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { licenseButtonActionPerformed(evt); } }); jLabel5.setFont(jLabel5.getFont().deriveFont(jLabel5.getFont().getSize() - 2f)); jLabel5.setHorizontalAlignment(SwingConstants.CENTER); jLabel5.setIcon(new ImageIcon(getClass().getResource("/esmska/resources/copyleft-12.png"))); // NOI18N Mnemonics.setLocalizedText(jLabel5, bundle.getString("AboutFrame.jLabel5.text")); // NOI18N jLabel5.setFocusable(false); setURI(homeHyperlink, Links.getURI(Links.HOMEPAGE)); Mnemonics.setLocalizedText(homeHyperlink, l10n.getString("AboutFrame.homeHyperlink.text")); homeHyperlink.setToolTipText(l10n.getString("AboutFrame.homeHyperlink.toolTipText")); // NOI18N setURI(supportHyperlink, Links.getURI(Links.DONATE)); Mnemonics.setLocalizedText(supportHyperlink, l10n.getString("AboutFrame.supportHyperlink.text")); supportHyperlink.setToolTipText(l10n.getString("AboutFrame.supportHyperlink.toolTipText")); // NOI18N GroupLayout layout = new GroupLayout(getContentPane()); getContentPane().setLayout(layout); layout.setHorizontalGroup(layout.createParallelGroup(Alignment.LEADING).addGroup(layout .createSequentialGroup().addContainerGap() .addGroup(layout.createParallelGroup(Alignment.LEADING) .addComponent(jLabel5, Alignment.CENTER, GroupLayout.DEFAULT_SIZE, 451, Short.MAX_VALUE) .addComponent(homeHyperlink, Alignment.CENTER, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE) .addComponent(supportHyperlink, Alignment.CENTER, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE) .addComponent(jLabel3, Alignment.CENTER, GroupLayout.DEFAULT_SIZE, 451, Short.MAX_VALUE) .addComponent(jLabel2, Alignment.CENTER, GroupLayout.DEFAULT_SIZE, 451, Short.MAX_VALUE) .addComponent(jLabel1, Alignment.CENTER, GroupLayout.DEFAULT_SIZE, 451, Short.MAX_VALUE) .addGroup(layout.createSequentialGroup().addComponent(creditsButton) .addPreferredGap(ComponentPlacement.RELATED).addComponent(licenseButton) .addPreferredGap(ComponentPlacement.RELATED, 151, Short.MAX_VALUE) .addComponent(closeButton)) .addGroup(layout.createSequentialGroup() .addComponent(jLabel4, GroupLayout.DEFAULT_SIZE, 171, Short.MAX_VALUE) .addGap(108, 108, 108) .addComponent(jLabel6, GroupLayout.DEFAULT_SIZE, 172, Short.MAX_VALUE)) .addGroup(layout.createSequentialGroup() .addComponent(jLabel8, GroupLayout.DEFAULT_SIZE, 157, Short.MAX_VALUE) .addGap(138, 138, 138) .addComponent(jLabel7, GroupLayout.DEFAULT_SIZE, 156, Short.MAX_VALUE))) .addContainerGap())); layout.linkSize(SwingConstants.HORIZONTAL, new Component[] { closeButton, creditsButton, licenseButton }); layout.setVerticalGroup( layout.createParallelGroup(Alignment.LEADING).addGroup(Alignment.TRAILING, layout.createSequentialGroup().addContainerGap().addComponent(jLabel1).addGap(18, 18, 18) .addComponent(jLabel2).addPreferredGap(ComponentPlacement.RELATED) .addComponent(jLabel3).addPreferredGap(ComponentPlacement.UNRELATED) .addComponent(jLabel5).addGap(18, 18, 18) .addGroup(layout.createParallelGroup(Alignment.LEADING) .addGroup(layout.createSequentialGroup() .addGroup(layout.createParallelGroup(Alignment.BASELINE) .addComponent(jLabel4).addComponent(jLabel6)) .addPreferredGap(ComponentPlacement.RELATED) .addGroup(layout.createParallelGroup(Alignment.BASELINE) .addComponent(jLabel7).addComponent(jLabel8))) .addComponent(homeHyperlink, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)) .addPreferredGap(ComponentPlacement.UNRELATED) .addComponent(supportHyperlink, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE) .addPreferredGap(ComponentPlacement.RELATED, 48, Short.MAX_VALUE) .addGroup(layout.createParallelGroup(Alignment.BASELINE).addComponent(creditsButton) .addComponent(closeButton).addComponent(licenseButton)) .addContainerGap())); layout.linkSize(SwingConstants.VERTICAL, new Component[] { jLabel4, jLabel6 }); layout.linkSize(SwingConstants.VERTICAL, new Component[] { closeButton, creditsButton, licenseButton }); pack(); }
From source file:ca.uhn.hunit.swing.ui.iface.JmsInterfaceForm.java
/** This method is called from within the constructor to * initialize the form.//from w w w .java 2s .c o m * WARNING: Do NOT modify this code. The content of this method is * always regenerated by the Form Editor. */ @SuppressWarnings("unchecked") // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents private void initComponents() { jLabel5 = new javax.swing.JLabel(); jPanel1 = new javax.swing.JPanel(); myQueueNameTextBox = new javax.swing.JTextField(); myQueueTopicCombo = new javax.swing.JComboBox(); jLabel2 = new javax.swing.JLabel(); myUsernameTextBox = new javax.swing.JTextField(); jLabel3 = new javax.swing.JLabel(); myPasswordTextBox = new javax.swing.JTextField(); jPanel2 = new javax.swing.JPanel(); myConnectionFactoryBeanEditor = new ca.uhn.hunit.swing.ui.util.BeanDefinitionForm(); jLabel5.setHorizontalAlignment(javax.swing.SwingConstants.TRAILING); jLabel5.setText("Username"); setPreferredSize(new java.awt.Dimension(401, 300)); java.util.ResourceBundle bundle = java.util.ResourceBundle.getBundle("ca/uhn/hunit/l10n/UiStrings"); // NOI18N jPanel1.setBorder( javax.swing.BorderFactory.createTitledBorder(bundle.getString("interface.jms.jms_properties"))); // NOI18N myQueueNameTextBox.setText("jTextField1"); myQueueTopicCombo.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Queue", "Topic" })); jLabel2.setHorizontalAlignment(javax.swing.SwingConstants.TRAILING); jLabel2.setText("Username"); myUsernameTextBox.setText("jTextField1"); jLabel3.setHorizontalAlignment(javax.swing.SwingConstants.TRAILING); jLabel3.setText("Password"); myPasswordTextBox.setText("jTextField1"); javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1); jPanel1.setLayout(jPanel1Layout); jPanel1Layout.setHorizontalGroup(jPanel1Layout .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel1Layout.createSequentialGroup().addGroup(jPanel1Layout .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel1Layout.createSequentialGroup().addContainerGap() .addComponent(myQueueTopicCombo, javax.swing.GroupLayout.PREFERRED_SIZE, 120, javax.swing.GroupLayout.PREFERRED_SIZE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(myQueueNameTextBox, javax.swing.GroupLayout.DEFAULT_SIZE, 286, Short.MAX_VALUE)) .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel1Layout.createSequentialGroup().addGap(35, 35, 35) .addComponent(jLabel2, javax.swing.GroupLayout.PREFERRED_SIZE, 95, javax.swing.GroupLayout.PREFERRED_SIZE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(myUsernameTextBox, javax.swing.GroupLayout.PREFERRED_SIZE, 95, javax.swing.GroupLayout.PREFERRED_SIZE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(jLabel3) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(myPasswordTextBox, javax.swing.GroupLayout.DEFAULT_SIZE, 139, Short.MAX_VALUE))) .addContainerGap())); jPanel1Layout.setVerticalGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel1Layout.createSequentialGroup().addGroup(jPanel1Layout .createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(myQueueTopicCombo, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(myQueueNameTextBox, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(jLabel2, javax.swing.GroupLayout.PREFERRED_SIZE, 14, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(myUsernameTextBox, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(jLabel3, javax.swing.GroupLayout.DEFAULT_SIZE, 20, Short.MAX_VALUE) .addComponent(myPasswordTextBox, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) .addContainerGap())); jPanel2.setBorder(javax.swing.BorderFactory .createTitledBorder(bundle.getString("interface.jms.conn_factory_properties"))); // NOI18N javax.swing.GroupLayout jPanel2Layout = new javax.swing.GroupLayout(jPanel2); jPanel2.setLayout(jPanel2Layout); jPanel2Layout.setHorizontalGroup(jPanel2Layout .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING).addGap(0, 432, Short.MAX_VALUE) .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING).addComponent( myConnectionFactoryBeanEditor, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, 432, Short.MAX_VALUE))); jPanel2Layout.setVerticalGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGap(0, 167, Short.MAX_VALUE) .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel2Layout .createSequentialGroup().addComponent(myConnectionFactoryBeanEditor, javax.swing.GroupLayout.DEFAULT_SIZE, 156, Short.MAX_VALUE) .addContainerGap()))); javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this); this.setLayout(layout); layout.setHorizontalGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(jPanel1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent(jPanel2, 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(jPanel1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(jPanel2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))); }
From source file:dk.teachus.backend.bean.impl.VelocityNotificationBean.java
public synchronized void sendTeacherNotificationMail() { log.info("Start sending notification mails to the teachers"); List<Teacher> teachers = personDAO.getPersons(Teacher.class); for (Teacher teacher : teachers) { List<PupilBooking> pupilBookings = bookingDAO.getTeacherNotificationBookings(teacher); if (pupilBookings.isEmpty() == false) { if (log.isDebugEnabled()) { log.debug("Sending mails with booking count: " + pupilBookings.size() + " for teacher: " + teacher.getName()); }//from w w w .java 2 s . co m // Create message to the teacher MailMessage message = new MailMessage(); // Sender and recipient message.setSender(teacher); message.setRecipient(teacher); // The locale Locale locale = teacher.getLocale(); // Build up bookingslist and format date List<FormattedPupilBooking> pupilBookingList = new ArrayList<FormattedPupilBooking>(); for (PupilBooking pupilBooking : pupilBookings) { FormattedPupilBooking formattedPupilBooking = new FormattedPupilBooking(); formattedPupilBooking.setPupilBooking(pupilBooking); DateTimeFormatter dateFormat = DATE_TIME_FORMAT.withLocale(locale); formattedPupilBooking.setFormattedDate(dateFormat.print(pupilBooking.getDate())); pupilBookingList.add(formattedPupilBooking); } // Load properties ResourceBundle bundle = ResourceBundle.getBundle( ClassUtils.getAsResourceBundlePath(VelocityNotificationBean.class, "NewBookingsMail"), locale); // Subject message.setSubject(bundle.getString("subject")); // Parse the template Map<String, Object> model = new HashMap<String, Object>(); model.put("followingPupilsHasBookings", bundle.getString("followingPupilsHasBookings")); model.put("pupilHeader", bundle.getString("pupilHeader")); model.put("dateHeader", bundle.getString("dateHeader")); model.put("pupilBookingList", pupilBookingList); String template = ""; try { template = velocityBean.mergeTemplate( ClassUtils.getAsResourcePath(VelocityNotificationBean.class, "NewBookingsMail.vm"), model); } catch (VelocityException e) { throw new RuntimeException(e); } // Text message.setBody(template); message.setType(Type.HTML); message.setState(MessageState.FINAL); messageDAO.save(message); } // Send mails bookingDAO.teacherNotificationMailSent(pupilBookings); } }
From source file:dk.teachus.backend.bean.impl.VelocityNotificationBean.java
public synchronized void sendPupilNotificationMail() { log.info("Start sending notification mails to the pupil"); Map<Pupil, List<PupilBooking>> pupilNotificationBookings = bookingDAO.getPupilNotificationBookings(); if (pupilNotificationBookings.isEmpty() == false) { for (Pupil pupil : pupilNotificationBookings.keySet()) { List<PupilBooking> bookings = pupilNotificationBookings.get(pupil); if (log.isDebugEnabled()) { log.debug("Sending mail with booking count: " + bookings.size() + " for pupil: " + pupil.getName()); }/*from w w w . jav a 2 s . c o m*/ // Create message to the teacher MailMessage message = new MailMessage(); // Sender and recipient message.setSender(pupil.getTeacher()); message.setRecipient(pupil); // The locale Locale locale = pupil.getTeacher().getLocale(); // Build up bookingslist and format date List<FormattedBooking> bookingList = new ArrayList<FormattedBooking>(); for (PupilBooking pupilBooking : bookings) { FormattedBooking formattedBooking = new FormattedBooking(); formattedBooking.setLocation(pupilBooking.getPeriod().getLocation()); DateTimeFormatter dateFormat = DATE_TIME_FORMAT.withLocale(locale); formattedBooking.setFormattedDate(dateFormat.print(pupilBooking.getDate())); bookingList.add(formattedBooking); } // Load properties ResourceBundle bundle = ResourceBundle.getBundle( ClassUtils.getAsResourceBundlePath(VelocityNotificationBean.class, "NewBookingsMail"), locale); // Subject message.setSubject(bundle.getString("subject")); // Parse the template Map<String, Object> model = new HashMap<String, Object>(); model.put("newBookings", bundle.getString("newBookings")); model.put("locationHeader", bundle.getString("locationHeader")); model.put("dateHeader", bundle.getString("dateHeader")); model.put("bookingList", bookingList); model.put("regard", bundle.getString("regard")); model.put("from", pupil.getTeacher().getName()); String template = ""; try { template = velocityBean.mergeTemplate(ClassUtils .getAsResourcePath(VelocityNotificationBean.class, "PupilNotificationMail.vm"), model); } catch (VelocityException e) { throw new RuntimeException(e); } // Text message.setBody(template); message.setType(Type.HTML); message.setState(MessageState.FINAL); messageDAO.save(message); } bookingDAO.pupilNotificationMailSent(pupilNotificationBookings); } }
From source file:be.fgov.minfin.webForm.backing.MasterCdcbean.java
public void checkDigit(FacesContext context, UIComponent component, Object value) throws ValidatorException { Application app = FacesContext.getCurrentInstance().getApplication(); ResourceBundle bundle = app.getResourceBundle(FacesContext.getCurrentInstance(), "CdcMessages"); IBANCheckDigit ibancheck = new IBANCheckDigit(); String numComptAValider1 = (String) value; String numComptAValider = numComptAValider1.replaceAll(" ", "").trim(); if (ibancheck.isValid(numComptAValider) == false) { throw new ValidatorException(new FacesMessage(FacesMessage.SEVERITY_ERROR, bundle.getString("liquiacte.numcompte.error"), "")); }/*from ww w . j a v a 2s . c o m*/ }
From source file:es.pode.empaquetador.presentacion.basico.asociar.AsociarControllerImpl.java
/** * @see es.pode.empaquetador.presentacion.basico.asociar.AsociarController#seleccionar(org.apache.struts.action.ActionMapping, es.pode.empaquetador.presentacion.basico.asociar.SeleccionarForm, javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse) *//* w w w . jav a 2 s . co m*/ public final java.lang.String seleccionar(ActionMapping mapping, es.pode.empaquetador.presentacion.basico.asociar.SeleccionarForm 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(); String tipo = form.getTipo(); String resultado = null; if (accion.equals(i18n.getString("portalempaquetado.Continuar"))) { if ("Archivos".equals(tipo)) { resultado = "Archivos"; } else if ("Object".equals(tipo)) { resultado = "Object"; } else if ("URL".equals(tipo)) { resultado = "Url"; } } else { resultado = "Cancelar"; } return resultado; }
From source file:es.pode.empaquetador.presentacion.avanzado.submanifiestos.desagregar.DesagregarSubmanifiestoControllerImpl.java
public String selectAction(ActionMapping mapping, SelectActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception { /*//w w w . j a v a2s . c o m * Metodo de decision para el action. Analiza los parametros * actionSubmit (value de los botones submit) para redirigir al caso de uso * correspondiente. El actionSubmit llegara * internacionalizado, por lo que es necesario acceder al ResouceBundle * para obtener el valor correcto en la comparacion. */ String result = null; String actionSubmit = form.getDestino(); 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 (form.getAction().equals("Cancelar")) { return "Cancelar"; } //Cancelar else if (actionSubmit .equals(i18n.getString("portal_empaquetado_gestorSubmanifiestos.desagregar.repositorio"))) { result = "personales"; } //Aceptar else if (actionSubmit.equals(i18n.getString("portal_empaquetado_gestorSubmanifiestos.desagregar.local"))) { result = "local"; } return result; }