use of java.text.DateFormatSymbols in project Lucee by lucee.
the class MonthAsString method call.
protected static String call(double month, Locale locale, boolean _short) throws ExpressionException {
int m = (int) month;
if (m >= 1 && m <= 12) {
DateFormatSymbols dfs = new DateFormatSymbols(locale);
String[] months = _short ? dfs.getShortMonths() : dfs.getMonths();
return months[m - 1];
}
throw new ExpressionException("invalid month definition in function monthAsString, must be between 1 and 12 now [" + month + "]");
}
use of java.text.DateFormatSymbols in project processdash by dtuma.
the class TimeCardDialog method buildTopPanel.
private Component buildTopPanel() {
Box result = Box.createHorizontalBox();
result.add(new JLabel(resources.getString("Time_Card.Month_Label") + " "));
// We have to build our own month name array because the "official"
// one contains 13 month names, the last one empty for Gregorian
// Calendars
String[] monthNames = new String[12];
String[] officialMonthNames = (new DateFormatSymbols()).getMonths();
for (int i = 12; i-- > 0; ) monthNames[i] = officialMonthNames[i];
monthField = new JComboBox(monthNames);
dontGrow(monthField);
monthField.setSelectedIndex(model.getMonth() - Calendar.JANUARY);
monthField.setMaximumRowCount(12);
result.add(monthField);
monthField.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
recalc();
}
});
yearField = new JTextField(5);
dontGrow(yearField);
yearField.setText(Integer.toString(model.getYear()));
result.add(yearField);
yearField.getDocument().addDocumentListener(new DocumentListener() {
public void insertUpdate(DocumentEvent e) {
recalc();
}
public void removeUpdate(DocumentEvent e) {
recalc();
}
public void changedUpdate(DocumentEvent e) {
recalc();
}
});
result.add(Box.createHorizontalGlue());
result.add(new JLabel(resources.getString("Time_Format.Label") + " "));
formatType = new JComboBox();
formatType.addItem(format(75, HOURS_MINUTES));
formatType.addItem(format(75, HOURS));
formatType.addItem(format(75, MINUTES));
dontGrow(formatType);
result.add(formatType);
formatType.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
redraw();
}
});
result.add(Box.createHorizontalGlue());
hideColumns = new JCheckBox();
result.add(new JLabel(" " + resources.getString("Time_Card.Hide_Empty_Columns_Label") + " "));
result.add(hideColumns);
hideColumns.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
resizeColumns();
}
});
result.add(Box.createHorizontalGlue());
JButton closeButton = new JButton(resources.getString("Close"));
dontGrow(closeButton);
result.add(Box.createVerticalStrut(closeButton.getPreferredSize().height + 4));
result.add(closeButton);
closeButton.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
frame.setVisible(false);
}
});
return result;
}
use of java.text.DateFormatSymbols in project processdash by dtuma.
the class TimeLogEditor method createWeekFilterStartDaySubmenu.
private JMenuItem createWeekFilterStartDaySubmenu() {
int filterStartDay = getWeekFilterStartDay(Calendar.getInstance());
String[] dayNames = new DateFormatSymbols().getWeekdays();
JMenu submenu = new JMenu();
for (int day = 1; day <= 7; day++) submenu.add(new WeekFilterStartDayOption(submenu, dayNames, day, filterStartDay));
submenu.setFont(submenu.getFont().deriveFont(submenu.getFont().getSize2D() * 0.8f));
return submenu;
}
use of java.text.DateFormatSymbols in project opennms by OpenNMS.
the class CalendarTableBuilder method calendarTableInit.
private void calendarTableInit(int month) {
m_calTable = new CalendarTable();
m_days = new Day[42];
int dayInLastMonth;
int dayInThisMonth;
int dayInNextMonth;
int firstDayOfWeek;
String[] monthNames = new DateFormatSymbols(m_locale).getMonths();
m_calTable.setMonth(monthNames[month]);
String[] dayNames = new DateFormatSymbols(m_locale).getShortWeekdays();
DaysOfWeek titleDays = new DaysOfWeek();
int dayOfWeek;
/* SetUp Title days for calendar */
firstDayOfWeek = m_workingCalendar.getFirstDayOfWeek();
for (int i = 0; i < 7; i++) {
dayOfWeek = (firstDayOfWeek + i) < 8 ? (firstDayOfWeek + i) : 1;
titleDays.addDayName(dayNames[dayOfWeek]);
}
m_calTable.setDaysOfWeek(titleDays);
m_workingCalendar.set(Calendar.DAY_OF_MONTH, 1);
m_firstDay = m_workingCalendar.get(Calendar.DAY_OF_WEEK) - firstDayOfWeek;
if (m_firstDay < 0) {
m_firstDay += 7;
}
for (dayInLastMonth = 0; dayInLastMonth < m_firstDay; dayInLastMonth++) {
m_days[dayInLastMonth] = new Day();
m_days[dayInLastMonth].setVisible(false);
m_days[dayInLastMonth].setPctValue(0.0);
}
/**
* get the first day in the next month
*/
m_workingCalendar.add(Calendar.MONTH, 1);
Date firstDayInNextMonth = m_workingCalendar.getTime();
m_workingCalendar.add(Calendar.MONTH, -1);
Date day = m_workingCalendar.getTime();
dayInThisMonth = dayInLastMonth;
int date = 1;
while (day.before(firstDayInNextMonth)) {
m_days[dayInThisMonth] = new Day();
m_days[dayInThisMonth].setDate(date);
m_days[dayInThisMonth].setVisible(true);
m_days[dayInThisMonth].setPctValue(0.0);
dayInThisMonth++;
date++;
m_workingCalendar.add(Calendar.DATE, 1);
day = m_workingCalendar.getTime();
}
// TODO: Is the number 42 correct?
for (dayInNextMonth = dayInThisMonth; dayInNextMonth < 42; dayInNextMonth++) {
m_days[dayInNextMonth] = new Day();
m_days[dayInNextMonth].setVisible(false);
m_days[dayInNextMonth].setPctValue(0.0);
}
}
use of java.text.DateFormatSymbols in project datetimepicker by flavienlaurent.
the class AmPmCirclesView method initialize.
public void initialize(Context context, int amOrPm) {
if (mIsInitialized) {
Log.e(TAG, "AmPmCirclesView may only be initialized once.");
return;
}
Resources res = context.getResources();
mWhite = res.getColor(R.color.white);
mAmPmTextColor = res.getColor(R.color.ampm_text_color);
mBlue = res.getColor(R.color.blue);
String typefaceFamily = res.getString(R.string.sans_serif);
Typeface tf = Typeface.create(typefaceFamily, Typeface.NORMAL);
mPaint.setTypeface(tf);
mPaint.setAntiAlias(true);
mPaint.setTextAlign(Align.CENTER);
mCircleRadiusMultiplier = Float.parseFloat(res.getString(R.string.circle_radius_multiplier));
mAmPmCircleRadiusMultiplier = Float.parseFloat(res.getString(R.string.ampm_circle_radius_multiplier));
String[] amPmTexts = new DateFormatSymbols().getAmPmStrings();
mAmText = amPmTexts[0];
mPmText = amPmTexts[1];
setAmOrPm(amOrPm);
mAmOrPmPressed = -1;
mIsInitialized = true;
}
Aggregations