use of java.time.format.TextStyle in project jphp by jphp-compiler.
the class DateTimeParserTest method justMonth.
@Test
public void justMonth() {
Locale l = Locale.US;
for (Month month : Month.values()) {
for (TextStyle value : Arrays.asList(TextStyle.FULL, TextStyle.SHORT)) {
String monthName = month.getDisplayName(value, l);
ZonedDateTime now = now();
ZonedDateTime expected = now.withMonth(month.getValue()).truncatedTo(DAYS);
assertThat(parse(monthName, now)).isEqualToIgnoringSeconds(expected);
assertThat(parse(monthName.toLowerCase(), now)).isEqualToIgnoringSeconds(expected);
assertThat(parse(monthName.toUpperCase(), now)).isEqualToIgnoringSeconds(expected);
}
}
}
use of java.time.format.TextStyle in project portfolio by buchen.
the class PerformanceHeatmapWidget method addHeaderRow.
private void addHeaderRow() {
// Top Left is empty
// $NON-NLS-1$
new Cell(table, () -> "");
// no harm in hardcoding the year as each year has the same months
for (LocalDate m = LocalDate.of(2016, 1, 1); m.getYear() == 2016; m = m.plusMonths(1)) {
Month month = m.getMonth();
Cell cell = new Cell(table, () -> {
int numColumns = getDashboardData().getDashboard().getColumns().size();
TextStyle textStyle;
if (numColumns == 1)
textStyle = TextStyle.FULL;
else if (numColumns == 2)
textStyle = TextStyle.SHORT;
else
textStyle = TextStyle.NARROW;
return month.getDisplayName(textStyle, Locale.getDefault());
});
GridDataFactory.fillDefaults().grab(true, false).align(SWT.FILL, SWT.FILL).applyTo(cell);
}
}