Settings.propProgramTableCutTitleLines.getInt(), 1, 3, 1));
mSettingsPn.add(mCutLongTitlesSelection, cc.xy(4, currentRow));
mCutLongTitlesLabel = new JLabel(mLocalizer.msg("lines", "Lines"));
mSettingsPn.add(mCutLongTitlesLabel, cc.xy(6, currentRow));
mCutLongTitlesCB.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
mCutLongTitlesSelection.setEnabled(mCutLongTitlesCB.isSelected());
mCutLongTitlesLabel.setEnabled(mCutLongTitlesCB.isSelected());
}
});
mCutLongTitlesCB.getActionListeners()[0].actionPerformed(null);
// Short descriptions N lines
mDescriptionLines = new JSpinner(new SpinnerNumberModel(
Settings.propProgramPanelMaxLines.getInt(), 1, 5, 1));
mSettingsPn.add(new JLabel(mLocalizer.msg("shortDescription",
"Short description")), cc.xyw(2, currentRow += 2, 2));
mSettingsPn.add(mDescriptionLines, cc.xy(4, currentRow));
mSettingsPn.add(new JLabel(mLocalizer.msg("lines", "Lines")), cc.xy(6,
currentRow));
// Short programs no description
mShortProgramsCB = new JCheckBox(mLocalizer.msg("shortPrograms",
"If duration less than"),
Settings.propProgramPanelShortDurationActive.getBoolean());
mSettingsPn.add(mShortProgramsCB, cc.xyw(2, (currentRow += 2), 2));
mShortProgramsMinutes = new JSpinner(new SpinnerNumberModel(
Settings.propProgramPanelShortDurationMinutes.getInt(), 1, 30, 1));
mSettingsPn.add(mShortProgramsMinutes, cc.xy(4, currentRow));
mShortProgramsLabel = new JLabel(mLocalizer.msg("shortPrograms2",
"minutes, then hide description"));
mSettingsPn.add(mShortProgramsLabel, cc.xy(6, currentRow));
mShortProgramsCB.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
mShortProgramsMinutes.setEnabled(mShortProgramsCB.isSelected());
mShortProgramsLabel.setEnabled(mShortProgramsCB.isSelected());
}
});
mShortProgramsCB.getActionListeners()[0].actionPerformed(null);
// Column Rows ***************************************
layout.appendRow(RowSpec.decode("pref"));
layout.appendRow(RowSpec.decode("5dlu"));
layout.appendRow(RowSpec.decode("pref"));
layout.appendRow(RowSpec.decode("10dlu"));
mSettingsPn.add(DefaultComponentFactory.getInstance().createSeparator(
mLocalizer.msg("columnwidth", "column width")), cc.xyw(1,
(currentRow += 2), 8));
// column width
int width = Settings.propColumnWidth.getInt();
if (width > Settings.MAX_COLUMN_WIDTH) {
width = Settings.MAX_COLUMN_WIDTH;
}
if (width < Settings.MIN_COLUMN_WIDTH) {
width = Settings.MIN_COLUMN_WIDTH;
}
mColWidth = new JSpinner(new SpinnerNumberModel(
width, Settings.MIN_COLUMN_WIDTH, Settings.MAX_COLUMN_WIDTH, 1));
mSettingsPn.add(new JLabel(mLocalizer.msg("widthInPixels", "Width in Pixels")), cc.xy(2, (currentRow += 2)));
mSettingsPn.add(mColWidth, cc.xy(4, currentRow));
mDefaultBtn = new JButton(Localizer.getLocalization(Localizer.I18N_DEFAULT));
mDefaultBtn.addActionListener(this);
mSettingsPn.add(mDefaultBtn, cc.xy(6, currentRow));
// Column Rows ***************************************
layout.appendRow(RowSpec.decode("pref"));
layout.appendRow(RowSpec.decode("5dlu"));
layout.appendRow(RowSpec.decode("pref"));
layout.appendRow(RowSpec.decode("3dlu"));
layout.appendRow(RowSpec.decode("pref"));
layout.appendRow(RowSpec.decode("10dlu"));
mSettingsPn.add(DefaultComponentFactory.getInstance().createSeparator(
mLocalizer.msg("range", "Range")), cc.xyw(1, (currentRow += 2), 8));
mSettingsPn.add(new JLabel(mLocalizer.msg("startOfDay", "Start of day")),
cc.xy(2, (currentRow += 2)));
TwoSpinnerDateModel startModel = new TwoSpinnerDateModel();
mStartOfDayTimeSp = new JSpinner(startModel);
startModel.setMe(mStartOfDayTimeSp);
JSpinner.DateEditor dateEditor = new JSpinner.DateEditor(mStartOfDayTimeSp, Settings.getTimePattern());
mStartOfDayTimeSp.setEditor(dateEditor);
mSettingsPn.add(mStartOfDayTimeSp, cc.xy(4, currentRow));
mSettingsPn.add(new JLabel("("
+ Localizer.getLocalization(Localizer.I18N_TODAY) + ")"), cc.xy(6,
currentRow));
CaretPositionCorrector.createCorrector(dateEditor.getTextField(), new char[] {':'}, -1);
mSettingsPn.add(new JLabel(mLocalizer.msg("endOfDay", "End of day")), cc
.xy(2, (currentRow += 2)));
TwoSpinnerDateModel endModel = new TwoSpinnerDateModel();
mEndOfDayTimeSp = new JSpinner(endModel);
endModel.setMe(mEndOfDayTimeSp);
dateEditor = new JSpinner.DateEditor(mEndOfDayTimeSp, Settings.getTimePattern());
mEndOfDayTimeSp.setEditor(dateEditor);
mSettingsPn.add(mEndOfDayTimeSp, cc.xy(4, currentRow));
mSettingsPn.add(new JLabel("(" + mLocalizer.msg("nextDay", "next day")
+ ")"), cc.xy(6, currentRow));
CaretPositionCorrector.createCorrector(dateEditor.getTextField(), new char[] {':'}, -1);
int minutes;
Calendar cal = Calendar.getInstance();
minutes = Settings.propProgramTableStartOfDay.getInt();
cal.set(Calendar.HOUR_OF_DAY, minutes / 60);
cal.set(Calendar.MINUTE, minutes % 60);
mStartOfDayTimeSp.setValue(cal.getTime());
minutes = Settings.propProgramTableEndOfDay.getInt();
cal.set(Calendar.HOUR_OF_DAY, minutes / 60);
cal.set(Calendar.MINUTE, minutes % 60);
mEndOfDayTimeSp.setValue(cal.getTime());
// Table Background ***************************************
layout.appendRow(RowSpec.decode("pref"));
layout.appendRow(RowSpec.decode("5dlu"));
layout.appendRow(RowSpec.decode("pref"));
layout.appendRow(RowSpec.decode("10dlu"));
mSettingsPn.add(DefaultComponentFactory.getInstance().createSeparator(
mLocalizer.msg("tableBackground", "Table background")), cc.xyw(1,
(currentRow += 2), 8));
mSettingsPn.add(new JLabel(mLocalizer.msg("tableBackgroundStyle",
"Table background style")), cc.xy(2, (currentRow += 2)));
TableBackgroundStyle[] styles = getTableBackgroundStyles();
mBackgroundStyleCB = new JComboBox(styles);
String style = Settings.propTableBackgroundStyle.getString();
for (int i = 0; i < styles.length; i++) {
if (styles[i].getSettingsString().equals(style)) {
mBackgroundStyleCB.setSelectedIndex(i);
break;
}
}
mBackgroundStyleCB.addItemListener(new ItemListener() {
public void itemStateChanged(ItemEvent e) {
updateBackgroundStyleConfigureButton();
}
});
mSettingsPn.add(mBackgroundStyleCB, cc.xy(4, currentRow));
mConfigBackgroundStyleBt = new JButton(mLocalizer.ellipsisMsg("configure", "Configure"));
mConfigBackgroundStyleBt.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
ConfigureBackgroundStyleDialog dlg = new ConfigureBackgroundStyleDialog(mBackgroundStyleCB,
(TableBackgroundStyle) mBackgroundStyleCB.getSelectedItem());
dlg.show();
}
});
mSettingsPn.add(mConfigBackgroundStyleBt, cc.xy(6, currentRow));
// Foreground color
layout.appendRow(RowSpec.decode("pref"));
layout.appendRow(RowSpec.decode("5dlu"));
layout.appendRow(RowSpec.decode("pref"));
layout.appendRow(RowSpec.decode("5dlu"));
mForegroundColorLb = new ColorLabel(Settings.propProgramPanelForegroundColor.getColor());
mForegroundColorLb.setStandardColor(Settings.propProgramPanelForegroundColor.getDefaultColor());
ColorButton programPanelForegroundColorChangeBtn = new ColorButton(mForegroundColorLb);
mSettingsPn.add(DefaultComponentFactory.getInstance().createSeparator(
mLocalizer.msg("foreground", "Foreground")), cc.xyw(1,
(currentRow += 2), 8));
mSettingsPn.add(new JLabel(mLocalizer.msg("fontColor", "Font color")), cc
.xy(2,
(currentRow += 2)));
mSettingsPn.add(mForegroundColorLb, cc.xy(4, currentRow));
mSettingsPn.add(programPanelForegroundColorChangeBtn, cc.xy(6, currentRow));
// Miscellaneous *********************************************
layout.appendRow(RowSpec.decode("pref"));
layout.appendRow(RowSpec.decode("5dlu"));
layout.appendRow(RowSpec.decode("pref"));
layout.appendRow(RowSpec.decode("3dlu"));
layout.appendRow(RowSpec.decode("pref"));
mSettingsPn.add(DefaultComponentFactory.getInstance().createSeparator(
mLocalizer.msg("mouse", "Mouse")), cc.xyw(1,
(currentRow += 2), 8));
mMouseOverCb = new JCheckBox(mLocalizer.msg("MouseOver", "Mouse-Over-Effect"));
mMouseOverCb.setSelected(Settings.propProgramTableMouseOver.getBoolean());
mSettingsPn.add(mMouseOverCb, cc.xy(2, (currentRow += 2)));
mMouseOverColorLb = new ColorLabel(Settings.propProgramTableMouseOverColor.getColor());
mMouseOverColorLb.setStandardColor(Settings.propProgramTableMouseOverColor.getDefaultColor());
final ColorButton mouseOverColorChangeBtn = new ColorButton(mMouseOverColorLb);
mMouseOverCb.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
boolean enabled = mMouseOverCb.isSelected();
mMouseOverColorLb.setEnabled(enabled);
mouseOverColorChangeBtn.setEnabled(enabled);
}