Package org.internna.iwebmvc.model.core

Examples of org.internna.iwebmvc.model.core.Locale


    @Test
    public void setAsText() {
        I18nTextBinder binder = new I18nTextBinder(new ContextHolder() {
            @Override
            public List<Locale> getAvailableLocales() {
                Locale l = new Locale();
                l.setDescription("English");
                l.setLocale("en");
                List<Locale> list = new ArrayList<Locale>(1);
                list.add(l);
                return list;
            }
        });
View Full Code Here


        this.dao = dao;
    }

    @Override
    public void setAsText(String text) throws IllegalArgumentException {
        Locale l = (Locale) getValue();
        if (StringUtils.hasText(text)) {
            Map<String, Object> parameters = new HashMap<String, Object>(1);
            parameters.put("locale", text);
            l = (Locale) dao.findByNamedQuery(Locale.FIND_BY_LOCALE, 0, 1, parameters).get(0);
        }
View Full Code Here

        this.dao = dao;
    }

    @Override
    public void setAsText(String text) throws IllegalArgumentException {
        Locale l = (Locale) getValue();
        if (StringUtils.hasText(text)) {
            Map<String, Object> parameters = new HashMap<String, Object>(1);
            parameters.put("locale", text);
            l = (Locale) dao.findByNamedQuery(Locale.FIND_BY_LOCALE, 0, 1, parameters).get(0);
        }
View Full Code Here

        Map<String, Object> parameters = new HashMap<String, Object>(1);
        for (String locale : applicationLocales.keySet()) {
            parameters.put("locale", locale);
            List<Locale> l = dao.findByNamedQuery(Locale.FIND_BY_LOCALE, 0, 1, parameters);
            if ((l == null) || (l.size() == 0)) {
                Locale newLocale = getLocale(locale, applicationLocales.get(locale));
                dao.create(newLocale);
            }
        }
    }
View Full Code Here

            securityDAO.createUser(user);
        }
    }

    protected Locale getLocale(String locale, String description) {
        return new Locale(locale, description);
    }
View Full Code Here

    public static void setUpPersistence() throws Exception {
        managerImpl = new RemoteEntityManagerImpl();
        managerImpl.context = new ContextHolder() {
            @Override
            public List<Locale> getAvailableLocales() {
                Locale l = new Locale();
                l.setDescription("English");
                l.setLocale("en");
                Locale le = new Locale();
                le.setDescription("Spanish");
                le.setLocale("es");
                List<Locale> list = new ArrayList<Locale>(1);
                list.add(l);
                list.add(le);
                return list;
            }
        };
        crypto = new DES3CiphererDecipherer();
        crypto.init();
        managerImpl.decipherer = crypto;
        managerImpl.dao = new AbstractDAO() {
            @Override
            protected EntityManager getEntityManager() {
                return RemoteEntityManagerImplTest.entityManager;
            }
        };
        factory = Persistence.createEntityManagerFactory("MODEL");
        entityManager = factory.createEntityManager();
        entityManager.getTransaction().begin();
        Locale en = new Locale("en", "English");
        managerImpl.dao.create(en);
        Locale es = new Locale("es", "Spanish");
        managerImpl.dao.create(es);
        Classification c = new Classification();
        c.setColor(new Color());
        c.getColor().setRed(100);c.getColor().setGreen(100);c.getColor().setBlue(20);
        c.setLetter("A");
View Full Code Here

        f.setAccessible(true);
        f.set(validator.validator, new ValidationVisitor());
        holder = new ContextHolder() {
            @Override
            public List<Locale> getAvailableLocales() {
                Locale l = new Locale();
                l.setDescription("English");
                l.setLocale("en");
                List<Locale> list = new ArrayList<Locale>(1);
                list.add(l);
                return list;
            }
        };
View Full Code Here

        Field contextField = ClassUtils.getField(EntityController.class, "context");
        contextField.setAccessible(true);
        contextField.set(controller, new ContextHolder() {
            @Override
            public List<Locale> getAvailableLocales() {
                Locale l = new Locale();
                l.setDescription("English");
                l.setLocale("en");
                List<Locale> list = new ArrayList<Locale>(1);
                list.add(l);
                return list;
            }
        });
View Full Code Here

TOP

Related Classes of org.internna.iwebmvc.model.core.Locale

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.