public String getTitle() {
return mLocalizer.msg("general", "General");
}
private JPanel createRefreshPanel() {
PanelBuilder refreshSettings = new PanelBuilder(new FormLayout("5dlu, 9dlu, pref, 3dlu, pref, fill:3dlu:grow, 3dlu",
"pref, 5dlu, pref, 3dlu, pref, pref, 3dlu, pref, 5dlu, pref, 3dlu, pref"));
CellConstraints cc = new CellConstraints();
refreshSettings.addSeparator(mLocalizer.msg("titleRefresh", "Startup"), cc.xyw(
1, 1, 6));
mAutoDownload = new JCheckBox(mLocalizer.msg("autoUpdate","Update TV listings automatically"));
mStartDownload = new JRadioButton(mLocalizer.msg("onStartUp", "Only on TV-Browser startup"));
mRecurrentDownload = new JRadioButton(mLocalizer.msg("recurrent","Recurrent"));
ButtonGroup bg = new ButtonGroup();
bg.add(mStartDownload);
bg.add(mRecurrentDownload);
refreshSettings.add(mAutoDownload, cc.xyw(2, 3, 5));
refreshSettings.add(mStartDownload, cc.xyw(3, 5, 4));
refreshSettings.add(mRecurrentDownload, cc.xyw(3, 6, 4));
mAutoDownloadCombo = new JComboBox(AUTO_DOWNLOAD_MSG_ARR);
String dlType = Settings.propAutoDownloadType.getString();
if (dlType.equals("daily")) {
mAutoDownloadCombo.setSelectedIndex(0);
} else if (dlType.equals("every3days")) {
mAutoDownloadCombo.setSelectedIndex(1);
} else if (dlType.equals("weekly")) {
mAutoDownloadCombo.setSelectedIndex(2);
}
JPanel panel = new JPanel(new FormLayout("10dlu, pref, 3dlu, pref", "pref, 3dlu, pref, 3dlu, pref, 5dlu, pref"));
mStartDownload.setSelected(!dlType.equals("never") && !Settings.propAutoDataDownloadEnabled.getBoolean());
mRecurrentDownload.setSelected(Settings.propAutoDataDownloadEnabled.getBoolean());
mAutoDownload.setSelected(mStartDownload.isSelected() || mRecurrentDownload.isSelected());
mStartDownload.setSelected(!mAutoDownload.isSelected() || mStartDownload.isSelected());
mStartDownload.setEnabled(mAutoDownload.isSelected());
mRecurrentDownload.setEnabled(mAutoDownload.isSelected());
mHowOften = new JLabel(mLocalizer.msg("autoDownload.howOften", "How often?"));
panel.add(mHowOften, cc.xy(2, 1));
panel.add(mAutoDownloadCombo, cc.xy(4, 1));
mAskBeforeDownloadRadio = new JRadioButton(mLocalizer.msg("autoDownload.ask", "Ask before downloading"));
mAutoDownloadPeriodCB = new JComboBox(PeriodItem.getPeriodItems());
int autoDLPeriod = Settings.propAutoDownloadPeriod.getInt();
PeriodItem pi = new PeriodItem(autoDLPeriod);
mAutoDownloadPeriodCB.setSelectedItem(pi);
panel.add(mAskBeforeDownloadRadio, cc.xyw(2, 3, 3));
mAskTimeRadio = new JRadioButton(mLocalizer.msg("autoDownload.duration", "Automatically refresh for"));
panel.add(mAskTimeRadio, cc.xy(2, 5));
panel.add(mAutoDownloadPeriodCB, cc.xy(4, 5));
ButtonGroup group = new ButtonGroup();
group.add(mAskBeforeDownloadRadio);
group.add(mAskTimeRadio);
mAskBeforeDownloadRadio.setSelected(Settings.propAskForAutoDownload.getBoolean());
mAskTimeRadio.setSelected(!Settings.propAskForAutoDownload.getBoolean());
mAutoDownloadWaitingTime = new JCheckBox(mLocalizer.msg("autoDownload.waiting","Delay auto update for"),Settings.propAutoDownloadWaitingEnabled.getBoolean());
mAutoDownloadWaitingTimeSp = new JSpinner(new SpinnerNumberModel(
Settings.propAutoDownloadWaitingTime.getShort(), 1, 60, 1));
mSecondsLabel = new JLabel(mLocalizer.msg("autoDownload.seconds","seconds"));
mAutoDownload.addItemListener(new ItemListener() {
public void itemStateChanged(ItemEvent e) {
setAutoDownloadEnabled(e.getStateChange() == ItemEvent.SELECTED);
}
});
mAskBeforeDownloadRadio.addItemListener(new ItemListener() {
public void itemStateChanged(ItemEvent e) {
setAutoDownloadEnabled(mAutoDownload.isSelected());
}
});
mAskTimeRadio.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
setAutoDownloadEnabled(mAskTimeRadio.isSelected());
};
});
mAutoDownloadWaitingTime.addItemListener(new ItemListener() {
public void itemStateChanged(ItemEvent e) {
mAutoDownloadWaitingTimeSp.setEnabled(e.getStateChange() == ItemEvent.SELECTED);
}
});
JPanel waitingPanel = new JPanel(new FormLayout("pref,2dlu,pref,2dlu,pref","pref"));
waitingPanel.add(mAutoDownloadWaitingTime, cc.xy(1, 1));
waitingPanel.add(mAutoDownloadWaitingTimeSp, cc.xy(3, 1));
waitingPanel.add(mSecondsLabel, cc.xy(5,1));