Example usage for java.text DateFormat MEDIUM

List of usage examples for java.text DateFormat MEDIUM

Introduction

In this page you can find the example usage for java.text DateFormat MEDIUM.

Prototype

int MEDIUM

To view the source code for java.text DateFormat MEDIUM.

Click Source Link

Document

Constant for medium style pattern.

Usage

From source file:com.appeaser.sublimepicker.SublimePickerFragment.java

public SublimePickerFragment() {
    // Initialize formatters
    mDateFormatter = DateFormat.getDateInstance(DateFormat.MEDIUM, Locale.getDefault());
    mTimeFormatter = DateFormat.getTimeInstance(DateFormat.SHORT, Locale.getDefault());
    mTimeFormatter.setTimeZone(TimeZone.getTimeZone("GMT+0"));
}

From source file:com.jaeksoft.searchlib.ClientCatalogItem.java

public String getLastModifiedString() {
    Date dt = getLastModifiedDate();
    if (dt == null)
        return null;
    return DateFormat.getDateTimeInstance(DateFormat.SHORT, DateFormat.MEDIUM).format(dt);
}

From source file:com.flexive.war.JsonWriter.java

public JsonWriter(Writer out, Locale locale) {
    this.out = out;
    this.dateFormat = DateFormat.getDateInstance(DateFormat.MEDIUM, locale);
}

From source file:org.openvpms.report.openoffice.OpenOfficeIMReportTestCase.java

/**
 * Tests reporting.// w  w  w .  j  ava  2s  .c o  m
 *
 * @throws IOException for any I/O error
 */
@Test
public void testReport() throws IOException {
    Document doc = getDocument("src/test/reports/act.customerEstimation.odt", DocFormats.ODT_TYPE);

    Functions functions = applicationContext.getBean(Functions.class);
    IMReport<IMObject> report = new OpenOfficeIMReport<IMObject>(doc, getArchetypeService(), getLookupService(),
            getHandlers(), functions);
    Map<String, Object> fields = new HashMap<String, Object>();
    Party practice = (Party) create(PracticeArchetypes.PRACTICE);
    practice.setName("Vets R Us");
    fields.put("OpenVPMS.practice", practice);

    Party party = createCustomer();
    ActBean act = createAct("act.customerEstimation");
    Date startTime = Date.valueOf("2006-08-04");
    act.setValue("startTime", startTime);
    act.setValue("lowTotal", new BigDecimal("100"));
    act.setParticipant("participation.customer", party);

    List<IMObject> objects = Arrays.asList((IMObject) act.getAct());
    Document result = report.generate(objects, null, fields, DocFormats.ODT_TYPE);
    Map<String, String> userFields = getUserFields(result);
    String expectedStartTime = DateFormat.getDateInstance(DateFormat.MEDIUM).format(startTime);
    assertEquals(expectedStartTime, userFields.get("startTime"));
    assertEquals("$100.00", userFields.get("lowTotal"));
    assertEquals("J", userFields.get("firstName"));
    assertEquals("Zoo", userFields.get("lastName"));
    assertEquals("2.00", userFields.get("expression"));
    assertEquals("1234 Foo St\nMelbourne VIC 3001", userFields.get("address"));
    assertEquals("Vets R Us", userFields.get("practiceName"));
    assertEquals("Invalid property name: invalid", userFields.get("invalid"));
}

From source file:com.robestone.hudson.compactcolumns.CompactColumnsTest.java

public void testDateFormats() {
    doTestDateFormats(Locale.US, DateFormat.SHORT, "6/24/10");
    doTestDateFormats(Locale.US, DateFormat.MEDIUM, "Jun 24, 2010");
    doTestDateFormats(Locale.GERMAN, DateFormat.SHORT, "24.06.10");
}

From source file:cec.easyshop.facades.process.email.context.ConsignmentCollectionReminderEmailContext.java

@Override
public void init(final ConsignmentProcessModel consignmentProcessModel, final EmailPageModel emailPageModel) {
    super.init(consignmentProcessModel, emailPageModel);
    orderCode = consignmentProcessModel.getConsignment().getOrder().getCode();
    orderGuid = consignmentProcessModel.getConsignment().getOrder().getGuid();
    consignmentData = getConsignmentConverter().convert(consignmentProcessModel.getConsignment());
    guest = CustomerType.GUEST.equals(getCustomer(consignmentProcessModel).getType());
    final DateFormat dateFormat = getFormatFactory().createDateTimeFormat(DateFormat.MEDIUM, -1);
    pickUpDate = dateFormat/*from ww w  . j  av  a2  s  . c  om*/
            .format(DateUtils.addHours(consignmentProcessModel.getConsignment().getShippingDate(),
                    getCustomerServiceUncollectedConsignmentStrategy().getTimeThreshold().intValue()));
    orderData = getOrderConverter().convert((OrderModel) consignmentProcessModel.getConsignment().getOrder());
}

From source file:com.ctc.facades.process.email.context.ConsignmentCollectionReminderEmailContext.java

@Override
public void init(final ConsignmentProcessModel consignmentProcessModel, final EmailPageModel emailPageModel) {
    super.init(consignmentProcessModel, emailPageModel);
    orderCode = consignmentProcessModel.getConsignment().getOrder().getCode();
    orderGuid = consignmentProcessModel.getConsignment().getOrder().getGuid();
    consignmentData = getConsignmentConverter().convert(consignmentProcessModel.getConsignment());
    guest = CustomerType.GUEST.equals(getCustomer(consignmentProcessModel).getType());
    final DateFormat dateFormat = getFormatFactory().createDateTimeFormat(DateFormat.MEDIUM, -1);
    pickUpDate = dateFormat//from w  w  w  .ja v  a  2 s  . co  m
            .format(DateUtils.addHours(consignmentProcessModel.getConsignment().getShippingDate(),
                    getCustomerServiceUncollectedConsignmentStrategy().getTimeThreshold().intValue()));
    orderData = getOrderConverter().convert((OrderModel) consignmentProcessModel.getConsignment().getOrder());
    if (LOG.isDebugEnabled()) {
        LOG.debug("Initialized with order code " + orderCode);
    }
}

From source file:org.eclipse.mylyn.internal.reviews.ui.editors.parts.AbstractCommentPart.java

@Override
protected String getSectionHeaderText() {
    IUser author = comment.getAuthor();/*from w  w w  .j a va 2  s.  c  o m*/
    return NLS.bind(Messages.AbstractCommentPart_Section_header, //
            author != null ? author.getDisplayName() : Messages.AbstractCommentPart_No_author, //
            DateFormat.getDateTimeInstance(DateFormat.MEDIUM, DateFormat.SHORT)
                    .format(comment.getCreationDate()) // 
    );
}

From source file:DateUtil.java

/**
 * Parses given string according to specified locale and <code>DateFormat.MEDIUM</code> style
 *
 * @param source Source string to parse date from
 * @param locale Locale to use for parsing date
 * @return Date object corresponding to representation given in source string
 * @throws ParseException if given string could not be properly parsed according to given locale and <code>DateFormat.MEDIUM</code> style
 * @see java.text.DateFormat/*from www  . j  a v  a 2 s .co  m*/
 * @see java.text.DateFormat#MEDIUM
 */
public static Date parseDate(String source, Locale locale) throws ParseException {
    return parseDate(source, locale, DateFormat.MEDIUM);
}

From source file:pl.exsio.ca.module.config.events.EventsDataTable.java

@Override
protected void doInit() {
    super.doInit();
    Converter dateConverter = new StringToDateConverter() {
        @Override//from  w  w w  .  j av a 2  s  . c om
        protected DateFormat getFormat(Locale locale) {
            return DateFormat.getDateInstance(DateFormat.MEDIUM, locale);
        }
    };

    this.dataComponent.setConverter("startDate", dateConverter);
    this.dataComponent.setConverter("endDate", dateConverter);
    this.dataComponent.sort(new Object[] { "startDate" }, new boolean[] { false });
}