Example usage for java.util Locale JAPANESE

List of usage examples for java.util Locale JAPANESE

Introduction

In this page you can find the example usage for java.util Locale JAPANESE.

Prototype

Locale JAPANESE

To view the source code for java.util Locale JAPANESE.

Click Source Link

Document

Useful constant for language.

Usage

From source file:com.yojiokisoft.yumekanow.activity.MakeCardActivity.java

/**
 * ?????/*from ww  w . j  av  a  2 s .  co  m*/
 */
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
    super.onActivityResult(requestCode, resultCode, data);
    if (requestCode != INTENT_REQUEST_PICTURE || resultCode != RESULT_OK) {
        return;
    }

    // ???
    InputStream in = null;
    BitmapFactory.Options options = null;
    try {
        in = getContentResolver().openInputStream(data.getData());
        options = new BitmapFactory.Options();
        options.inJustDecodeBounds = true;
        BitmapFactory.decodeStream(in, null, options);
    } catch (FileNotFoundException e) {
        MyDialog.Builder.newInstance(this).setTitle(getString(R.string.error))
                .setMessage(getString(R.string.file_not_found)).show();
    } finally {
        if (in != null) {
            try {
                in.close();
            } catch (IOException e) {
                MyUncaughtExceptionHandler.sendBugReport(this, e);
            }
        }
    }
    if (options == null) {
        return;
    }

    // Display??????
    Pair<Integer, Integer> size = MyImage.getScreenWidthAndHeight(this);
    int sampleSize = MyImage.calculateInSampleSize(options, size.first, size.second);
    options.inSampleSize = sampleSize;
    options.inJustDecodeBounds = false;
    Bitmap bitmap = null;
    in = null;
    try {
        in = getContentResolver().openInputStream(data.getData());
        bitmap = BitmapFactory.decodeStream(in, null, options);
    } catch (FileNotFoundException e) {
        MyDialog.Builder.newInstance(this).setTitle(getString(R.string.error))
                .setMessage(getString(R.string.file_not_found)).show();
    } finally {
        if (in != null) {
            try {
                in.close();
            } catch (IOException e) {
                MyUncaughtExceptionHandler.sendBugReport(this, e);
            }
        }
    }
    if (bitmap == null) {
        return;
    }

    //??  
    Date today = new Date();
    SimpleDateFormat dateFormat = new SimpleDateFormat("yyyyMMdd_HHmmss", Locale.JAPANESE);
    String filename = "img_" + dateFormat.format(today) + ".jpg";
    String path = MyFile.pathCombine(MyConst.getBackImagePath(), filename);
    File file = new File(path);
    try {
        MyImage.saveImage(file, bitmap);
    } catch (IOException e) {
        e.printStackTrace();
    }
    // ??
    MyImage_ myImage = MyImage_.getInstance_(App.getInstance().getAppContext());
    myImage.ReductionImage(path);
    // ????
    List<BackImageEntity> list = mBackImageDao.queryForAll();
    mPagerAdapter.setItems(list);
    mPagerAdapter.notifyDataSetChanged();
    setBackImageList(list);
    setPagerCurrentItem(0);
}

From source file:jp.terasoluna.fw.web.struts.form.FieldChecksExTest09.java

/**
 * testValidateDateRange03()/*  w ww. j  a v a2  s .  c  o m*/
 * <br><br>
 *
 * (?n)
 * <br>
 * _?FF
 * <br><br>
 * l?F(?) bean:"abc"<br>
 *         (?) va:not null<br>
 *         (?) field:not null<br>
 *                var:datePattern=null<br>
 *                var:datePatternStrict=null<br>
 *                Msg("message","message")<br>
 *         (?) errors:not null<br>
 *                ActionMessage("testMessage")<br>
 *         (?) validator:not null<br>
 *         (?) request:not null<br>
 *                Locale=JAPANESE<br>
 *
 * <br>
 * l?F(l) boolean:false<br>
 *         (?) errors:ActionMessage("testMessage")<br>
 *                    ActionMessage("message")<br>
 *
 * <br>
 * datePattern?AdatePatternStrictw?A
 * ?beanDate???A
 * G?[?bZ?[WfalsepmF?B
 * <br>
 *
 * @throws Exception ?\bh?O
 */
public void testValidateDateRange03() throws Exception {
    //eXgf?[^?
    // ++++ beanIuWFNg ++++
    String bean = "abc";
    // ++++ ??IuWFNg
    ValidatorAction va = new ValidatorAction();
    va.setName("message");
    // ++++ ?tB?[h?
    Field field = new Field();
    Var var = new Var();
    var.setName("datePattern");
    var.setValue(null);
    field.addVar(var);
    var = new Var();
    var.setName("datePatternStrict");
    var.setValue(null);
    field.addVar(var);
    // ?bZ?[W?
    Msg msg = new Msg();
    msg.setKey("message");
    msg.setName("message");
    msg.setResource(false);
    field.addMsg(msg);
    // G?[?
    ActionMessages errors = new ActionMessages();
    ActionMessage error = new ActionMessage("testMessage");
    errors.add(Globals.ERROR_KEY, error);
    // [HTTPNGXg
    MockHttpServletRequest request = new MockHttpServletRequest();
    request.setLocale(Locale.JAPANESE);
    // ValidatorResourcesCX^X
    ValidatorResources validatorResources = new ValidatorResources();
    // ValidatorCX^X
    Validator validator = new Validator(validatorResources);

    // eXg?s
    boolean result = FieldChecksEx.validateDateRange(bean, va, field, errors, validator, request);
    // eXgmF
    // falsep?B
    assertFalse(result);
    // G?[?2??B
    assertEquals(2, errors.size());

    // ?bZ?[WIuWFNgmF
    Iterator it = errors.get();
    List<String> list = new ArrayList<String>();
    while (it.hasNext()) {
        ActionMessage message = (ActionMessage) it.next();
        list.add(message.getKey());
    }
    assertTrue(list.contains("message"));
    assertTrue(list.contains("testMessage"));
}

From source file:org.terasoluna.gfw.web.codelist.CodeListInterceptorTest.java

/**
 * [getLocalizedCodeListMap] Case of define localized CodeList.
 * <p>/*from   w w  w  .  ja v  a 2 s . c om*/
 * [Expected Result]
 * <ol>
 * <li>get localized code list map.</li>
 * </ol>
 * </p>
 * @throws Exception
 */
@Test
public void testGetLocalizedCodeListMap_define_localized_odeList() {

    // do setup.
    SimpleI18nCodeList codeList = new SimpleI18nCodeList();
    Map<Locale, Map<String, String>> rows = Maps.newLinkedHashMap();
    Map<String, String> enMap = Collections.singletonMap("01", "XXX");
    Map<String, String> jaMap = Collections.singletonMap("01", "YYY");
    rows.put(Locale.ENGLISH, enMap);
    rows.put(Locale.JAPANESE, jaMap);
    codeList.setRows(rows);

    // do test.
    Map<String, String> actualEnMap = testTarget.getLocalizedCodeMap(codeList, Locale.ENGLISH);
    Map<String, String> actualJaMap = testTarget.getLocalizedCodeMap(codeList, Locale.JAPANESE);

    // do assert.
    assertThat(actualEnMap, is(enMap));
    assertThat(actualJaMap, is(jaMap));

}

From source file:org.terasoluna.gfw.web.codelist.CodeListInterceptorTest.java

/**
 * [getLocalizedCodeListMap] Case of match fall back locale.
 * <p>/*from  w w  w  . j a  v a  2 s  . co  m*/
 * [Expected Result]
 * <ol>
 * <li>get localized code list map by fall back locale.</li>
 * </ol>
 * </p>
 * @throws Exception
 */
@Test
public void testGetLocalizedCodeListMap_match_fall_back_locale() {

    // do setup.
    testTarget.setFallbackTo(Locale.ENGLISH);

    SimpleI18nCodeList codeList = new SimpleI18nCodeList();
    Map<Locale, Map<String, String>> rows = Maps.newLinkedHashMap();
    Map<String, String> enMap = Collections.singletonMap("01", "XXX");
    rows.put(Locale.ENGLISH, enMap);
    codeList.setRows(rows);

    // do test.
    Map<String, String> actualMap = testTarget.getLocalizedCodeMap(codeList, Locale.JAPANESE);

    // do assert.
    assertThat(actualMap, is(enMap));
}

From source file:jp.terasoluna.fw.web.struts.form.FieldChecksExTest09.java

/**
 * testValidateDateRange04()//www  . jav a2  s. c om
 * <br><br>
 *
 * (??n)
 * <br>
 * _?FF
 * <br><br>
 * l?F(?) bean:"abc"<br>
 *         (?) va:not null<br>
 *         (?) field:not null<br>
 *                var:datePattern=""<br>
 *                var:datePatternStrict=""<br>
 *                Msg("message","message")<br>
 *         (?) errors:not null<br>
 *                (vf)<br>
 *         (?) validator:not null<br>
 *         (?) request:not null<br>
 *                Locale=JAPANESE<br>
 *
 * <br>
 * l?F(l) boolean:false<br>
 *         (?) errors:ActionMessage("message")<br>
 *
 * <br>
 * datePattern?AdatePatternStrictw?A
 * ?beanDate???A
 * G?[?bZ?[WfalsepmF?B
 * <br>
 *
 * @throws Exception ?\bh?O
 */
public void testValidateDateRange04() throws Exception {
    //eXgf?[^?
    // ++++ beanIuWFNg ++++
    String bean = "abc";
    // ++++ ??IuWFNg
    ValidatorAction va = new ValidatorAction();
    va.setName("message");
    // ++++ ?tB?[h?
    Field field = new Field();
    Var var = new Var();
    var.setName("datePattern");
    var.setValue("");
    field.addVar(var);
    var = new Var();
    var.setName("datePatternStrict");
    var.setValue("");
    field.addVar(var);
    // ?bZ?[W?
    Msg msg = new Msg();
    msg.setKey("message");
    msg.setName("message");
    msg.setResource(false);
    field.addMsg(msg);
    // G?[?
    ActionMessages errors = new ActionMessages();
    // [HTTPNGXg
    MockHttpServletRequest request = new MockHttpServletRequest();
    request.setLocale(Locale.JAPANESE);
    // ValidatorResourcesCX^X
    ValidatorResources validatorResources = new ValidatorResources();
    // ValidatorCX^X
    Validator validator = new Validator(validatorResources);

    // eXg?s
    boolean result = FieldChecksEx.validateDateRange(bean, va, field, errors, validator, request);
    // eXgmF
    // falsep?B
    assertFalse(result);
    // G?[?1??B
    assertEquals(1, errors.size());

    // ?bZ?[WIuWFNgmF
    Iterator it = errors.get();
    ActionMessage message = (ActionMessage) it.next();
    assertEquals("message", message.getKey());
}

From source file:org.terasoluna.gfw.web.codelist.CodeListInterceptorTest.java

/**
 * [getLocalizedCodeListMap] Case of not define.
 * <p>//from   w w  w.  j  ava  2  s . c  o m
 * [Expected Result]
 * <ol>
 * <li>get empty map.</li>
 * <li>output warn log.</li>
 * </ol>
 * </p>
 * @throws Exception
 */
@Test
public void testGetLocalizedCodeListMap_not_define() {

    // do setup.
    testTarget.setFallbackTo(Locale.ENGLISH);

    SimpleI18nCodeList codeList = new SimpleI18nCodeList();
    Map<Locale, Map<String, String>> rows = Maps.newLinkedHashMap();
    codeList.setRows(rows);

    // do test.
    Map<String, String> actualMap = testTarget.getLocalizedCodeMap(codeList, Locale.JAPANESE);

    // do assert.
    assertThat(actualMap.isEmpty(), is(true));

    verifyLogging("could not fall back to 'en'.", Level.WARN);

}

From source file:jp.terasoluna.fw.web.struts.form.FieldChecksExTest09.java

/**
 * testValidateDateRange05()/*from  ww w.j a  v a 2s .c o m*/
 * <br><br>
 *
 * (??n)
 * <br>
 * _?FF
 * <br><br>
 * l?F(?) bean:"abc"<br>
 *         (?) va:not null<br>
 *         (?) field:not null<br>
 *                var:datePattern=null<br>
 *                var:datePatternStrict="yyyy/MM/dd"<br>
 *                Msg("message","message")<br>
 *         (?) errors:not null<br>
 *                (vf)<br>
 *         (?) validator:not null<br>
 *         (?) request:not null<br>
 *                Locale=JAPANESE<br>
 *
 * <br>
 * l?F(l) boolean:false<br>
 *         (?) errors:ActionMessage("message")<br>
 *
 * <br>
 * datePatternw?AdatePatternStrict??ttH?[}bg
 * w?A?beanDate???A
 * G?[?bZ?[WfalsepmF?B
 * <br>
 *
 * @throws Exception ?\bh?O
 */
public void testValidateDateRange05() throws Exception {
    //eXgf?[^?
    // ++++ beanIuWFNg ++++
    String bean = "abc";
    // ++++ ??IuWFNg
    ValidatorAction va = new ValidatorAction();
    va.setName("message");
    // ++++ ?tB?[h?
    Field field = new Field();
    Var var = new Var();
    var.setName("datePattern");
    var.setValue(null);
    field.addVar(var);
    var = new Var();
    var.setName("datePatternStrict");
    var.setValue("yyyy/MM/dd");
    field.addVar(var);
    // ?bZ?[W?
    Msg msg = new Msg();
    msg.setKey("message");
    msg.setName("message");
    msg.setResource(false);
    field.addMsg(msg);
    // G?[?
    ActionMessages errors = new ActionMessages();
    // [HTTPNGXg
    MockHttpServletRequest request = new MockHttpServletRequest();
    request.setLocale(Locale.JAPANESE);
    // ValidatorResourcesCX^X
    ValidatorResources validatorResources = new ValidatorResources();
    // ValidatorCX^X
    Validator validator = new Validator(validatorResources);

    // eXg?s
    boolean result = FieldChecksEx.validateDateRange(bean, va, field, errors, validator, request);
    // eXgmF
    // falsep?B
    assertFalse(result);
    // G?[?1??B
    assertEquals(1, errors.size());

    // ?bZ?[WIuWFNgmF
    Iterator it = errors.get();
    ActionMessage message = (ActionMessage) it.next();
    assertEquals("message", message.getKey());
}

From source file:jp.terasoluna.fw.web.struts.form.FieldChecksExTest09.java

/**
 * testValidateDateRange06()//w  ww  .j  a va2s.c  o  m
 * <br><br>
 *
 * (?n)
 * <br>
 * _?FC
 * <br><br>
 * l?F(?) bean:"2005/10/24"<br>
 *         (?) va:not null<br>
 *         (?) field:not null<br>
 *                var:datePattern=null<br>
 *                var:datePatternStrict="abc"<br>
 *                Msg("message","message")<br>
 *         (?) errors:not null<br>
 *                (vf)<br>
 *         (?) validator:not null<br>
 *         (?) request:not null<br>
 *                Locale=JAPANESE<br>
 *
 * <br>
 * l?F(l) boolean:false<br>
 *         (?) ?O:?Ox?F<br>
 *                    G?[<br>
 *                    ?bZ?[W?F<br>
 *                    Illegal pattern character 'b'<br>
 *                    O?F<br>
 *                    IllegalArgumentException<br>
 *         (?) errors:ActionMessage("message")<br>
 *
 * <br>
 * ?bean??t\?AdatePatternw?A
 * datePatternStricts?ttH?[}bgw???A
 * G?[?bZ?[WfalsepmF?B
 * <br>
 *
 * @throws Exception ?\bh?O
 */
public void testValidateDateRange06() throws Exception {
    //eXgf?[^?
    // ++++ beanIuWFNg ++++
    String bean = "2005/10/24";
    // ++++ ??IuWFNg
    ValidatorAction va = new ValidatorAction();
    va.setName("message");
    // ++++ ?tB?[h?
    Field field = new Field();
    Var var = new Var();
    var.setName("datePattern");
    var.setValue(null);
    field.addVar(var);
    var = new Var();
    var.setName("datePatternStrict");
    var.setValue("abc");
    field.addVar(var);
    // ?bZ?[W?
    Msg msg = new Msg();
    msg.setKey("message");
    msg.setName("message");
    msg.setResource(false);
    field.addMsg(msg);
    // G?[?
    ActionMessages errors = new ActionMessages();
    // [HTTPNGXg
    MockHttpServletRequest request = new MockHttpServletRequest();
    request.setLocale(Locale.JAPANESE);
    // ValidatorResourcesCX^X
    ValidatorResources validatorResources = new ValidatorResources();
    // ValidatorCX^X
    Validator validator = new Validator(validatorResources);

    // eXg?s
    boolean result = FieldChecksEx.validateDateRange(bean, va, field, errors, validator, request);
    // eXgmF
    // falsep?B
    assertFalse(result);
    // G?[?1??B
    assertEquals(1, errors.size());

    // ?bZ?[WIuWFNgmF
    Iterator it = errors.get();
    ActionMessage message = (ActionMessage) it.next();
    assertEquals("message", message.getKey());

    // G?[?O`FbN
    assertTrue(LogUTUtil.checkError("Illegal pattern character 'b'", new IllegalArgumentException()));
}

From source file:jp.terasoluna.fw.web.struts.form.FieldChecksExTest09.java

/**
 * testValidateDateRange07()//  w  ww  . j a  va2 s.co  m
 * <br><br>
 *
 * (??n)
 * <br>
 * _?FF
 * <br><br>
 * l?F(?) bean:"2005/02/29"<br>
 *         (?) va:not null<br>
 *         (?) field:not null<br>
 *                var:datePattern=null<br>
 *                var:datePatternStrict="yyyy/MM/dd"<br>
 *                Msg("message","message")<br>
 *         (?) errors:not null<br>
 *                (vf)<br>
 *         (?) validator:not null<br>
 *         (?) request:not null<br>
 *                Locale=JAPANESE<br>
 *
 * <br>
 * l?F(l) boolean:false<br>
 *         (?) errors:ActionMessage("message")<br>
 *
 * <br>
 * ?bean?t\?AdatePatternw?A
 * datePatternStricts?ttH?[}bgw???A
 * G?[?bZ?[WfalsepmF?B
 * <br>
 *
 * @throws Exception ?\bh?O
 */
public void testValidateDateRange07() throws Exception {
    //eXgf?[^?
    // ++++ beanIuWFNg ++++
    String bean = "2005/02/29";
    // ++++ ??IuWFNg
    ValidatorAction va = new ValidatorAction();
    va.setName("message");
    // ++++ ?tB?[h?
    Field field = new Field();
    Var var = new Var();
    var.setName("datePattern");
    var.setValue(null);
    field.addVar(var);
    var = new Var();
    var.setName("datePatternStrict");
    var.setValue("yyyy/MM/dd");
    field.addVar(var);
    // ?bZ?[W?
    Msg msg = new Msg();
    msg.setKey("message");
    msg.setName("message");
    msg.setResource(false);
    field.addMsg(msg);
    // G?[?
    ActionMessages errors = new ActionMessages();
    // [HTTPNGXg
    MockHttpServletRequest request = new MockHttpServletRequest();
    request.setLocale(Locale.JAPANESE);
    // ValidatorResourcesCX^X
    ValidatorResources validatorResources = new ValidatorResources();
    // ValidatorCX^X
    Validator validator = new Validator(validatorResources);

    // eXg?s
    boolean result = FieldChecksEx.validateDateRange(bean, va, field, errors, validator, request);
    // eXgmF
    // falsep?B
    assertFalse(result);
    // G?[?1??B
    assertEquals(1, errors.size());

    // ?bZ?[WIuWFNgmF
    Iterator it = errors.get();
    ActionMessage message = (ActionMessage) it.next();
    assertEquals("message", message.getKey());
}

From source file:org.openmrs.module.auditlog.CollectionsAuditLogBehaviorTest.java

@Test
@NotTransactional//from www.ja v a2  s.  c o m
public void shouldNotLinkTheLogsOfCollectionItemsToThatOfTheUpdatedParentIfCascadeOptionIsNotDeleteOrphan()
        throws Exception {
    //TODO Add check that the cascade options is not delete option
    Concept concept = conceptService.getConcept(7);
    assertEquals(0, getAllLogs(concept.getId(), Concept.class, Collections.singletonList(UPDATED)).size());
    int originalDescriptionCount = concept.getDescriptions().size();
    assertTrue(originalDescriptionCount > 3);

    startAuditing(ConceptDescription.class);
    concept = conceptService.saveConcept(concept);
    //Ensure that no log will be created unless we actually perform an update
    assertEquals(0, getAllLogs(concept.getId(), Concept.class, Collections.singletonList(UPDATED)).size());
    assertTrue(auditLogService.isAudited(ConceptDescription.class));
    Iterator<ConceptDescription> it = concept.getDescriptions().iterator();
    //update some existing descriptions
    ConceptDescription cd1 = it.next();
    cd1.setDescription("another descr1");
    ConceptDescription cd2 = it.next();
    cd2.setDescription("another descr2");
    //remove the next 2
    ConceptDescription cd3 = it.next();
    it.remove();
    ConceptDescription cd4 = it.next();
    it.remove();
    ConceptDescription cd5 = new ConceptDescription("yes in japanese", Locale.JAPANESE);
    cd5.setUuid("6e9226f4-999d-11e2-a6ac-b499bae1ce4e");
    cd5.setDateCreated(new Date());
    cd5.setCreator(Context.getAuthenticatedUser());
    ConceptDescription cd6 = new ConceptDescription("yes in chinese", Locale.CHINESE);
    cd6.setUuid("781f01b0-999d-11e2-a6ac-b499bae1ce4e");
    cd6.setDateCreated(new Date());
    cd6.setCreator(Context.getAuthenticatedUser());
    concept.addDescription(cd5);
    concept.addDescription(cd6);
    concept = conceptService.saveConcept(concept);
    assertEquals(originalDescriptionCount, concept.getDescriptions().size());
    List<AuditLog> descriptionAuditLogs1 = getAllLogs(cd1.getId(), ConceptDescription.class,
            Collections.singletonList(UPDATED));
    assertEquals(1, descriptionAuditLogs1.size());
    AuditLog descriptionAuditLog1 = descriptionAuditLogs1.get(0);
    assertNotNull(descriptionAuditLog1.getParentAuditLog());

    List<AuditLog> descriptionAuditLogs2 = getAllLogs(cd2.getId(), ConceptDescription.class,
            Collections.singletonList(UPDATED));
    assertEquals(1, descriptionAuditLogs2.size());
    AuditLog descriptionAuditLog2 = descriptionAuditLogs2.get(0);
    assertNotNull(descriptionAuditLog2.getParentAuditLog());

    List<AuditLog> descriptionAuditLogs3 = getAllLogs(cd3.getId(), ConceptDescription.class,
            Collections.singletonList(DELETED));
    //This is because concept.descriptions cascade option doesn't say delete-orphan
    assertEquals(0, descriptionAuditLogs3.size());

    List<AuditLog> descriptionAuditLogs4 = getAllLogs(cd4.getId(), ConceptDescription.class,
            Collections.singletonList(DELETED));
    assertEquals(0, descriptionAuditLogs4.size());//same here

    List<AuditLog> descriptionAuditLogs5 = getAllLogs(cd5.getId(), ConceptDescription.class,
            Collections.singletonList(CREATED));
    assertEquals(1, descriptionAuditLogs5.size());
    AuditLog descriptionAuditLog5 = descriptionAuditLogs5.get(0);
    assertNotNull(descriptionAuditLog5.getParentAuditLog());

    List<AuditLog> descriptionAuditLogs6 = getAllLogs(cd6.getId(), ConceptDescription.class,
            Collections.singletonList(CREATED));
    assertEquals(1, descriptionAuditLogs6.size());
    AuditLog descriptionAuditLog6 = descriptionAuditLogs6.get(0);
    assertNotNull(descriptionAuditLog6.getParentAuditLog());

    List<AuditLog> conceptAuditLogs = getAllLogs(concept.getId(), Concept.class,
            Collections.singletonList(UPDATED));
    assertEquals(1, conceptAuditLogs.size());
    assertEquals(4, conceptAuditLogs.get(0).getChildAuditLogs().size());

    assertEquals(conceptAuditLogs.get(0), descriptionAuditLog1.getParentAuditLog());
    assertEquals(conceptAuditLogs.get(0), descriptionAuditLog2.getParentAuditLog());
}