String soundFName=mSettings.getProperty("soundfile","/");
String msg = mLocalizer.msg("soundFileFilter", "Sound file ({0})",
"*.wav, *.aif, *.rmf, *.au, *.mid");
mReminderWindowChB = new JCheckBox(mLocalizer.msg("reminderWindow", "Reminder window"), mSettings.getProperty("usemsgbox","false").equalsIgnoreCase("true"));
mShowAlwaysOnTop = new JCheckBox(mLocalizer.msg("alwaysOnTop","Show always on top"), mSettings.getProperty("alwaysOnTop","true").equalsIgnoreCase("true"));
mShowAlwaysOnTop.setEnabled(mReminderWindowChB.isSelected());
JPanel reminderWindowCfg = new JPanel(new FormLayout("12dlu,default:grow","pref,1dlu,pref"));
reminderWindowCfg.add(mReminderWindowChB, cc.xyw(1,1,2));
reminderWindowCfg.add(mShowAlwaysOnTop, cc.xy(2,3));
mSoundFileChB = new FileCheckBox(mLocalizer.msg("playlingSound", "Play sound"), new File(soundFName), 0, false);
JFileChooser soundChooser=new JFileChooser((String)null);
soundChooser.setFileFilter(new ExtensionFileFilter(extArr, msg));
mSoundFileChB.setFileChooser(soundChooser);
mSoundFileChB.setSelected(mSettings.getProperty("usesound","false").equals("true"));
mBeep = new JCheckBox(mLocalizer.msg("beep", "Speaker sound"), mSettings.getProperty("usebeep","true").equalsIgnoreCase("true"));
mExecFileStr = mSettings.getProperty("execfile", "");
mExecParamStr = mSettings.getProperty("execparam", "");
final JButton soundTestBt = new JButton(mLocalizer.msg("test", "Test"));
mExecChB = new JCheckBox(mLocalizer.msg("executeProgram", "Execute program"));
mExecChB.setSelected(mSettings.getProperty("useexec","false").equals("true"));
mExecFileDialogBtn = new JButton(mLocalizer.msg("executeConfig", "Configure"));
mExecFileDialogBtn.setEnabled(mExecChB.isSelected());
mPluginLabel = new JLabel();
JButton choose = new JButton(mLocalizer.msg("selectPlugins","Choose Plugins"));
mClientPluginTargets = ReminderPlugin.getInstance().getClientPluginsTargets();
handlePluginSelection();
choose.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {try{
Window parent = UiUtilities.getLastModalChildOf(MainFrame
.getInstance());
PluginChooserDlg chooser = null;
chooser = new PluginChooserDlg(parent, mClientPluginTargets, null,
ReminderPluginProxy.getInstance());
chooser.setLocationRelativeTo(parent);
chooser.setVisible(true);
if(chooser.getReceiveTargets() != null) {
mClientPluginTargets = chooser.getReceiveTargets();
}
handlePluginSelection();}catch(Exception ee) {ee.printStackTrace();}
}
});
int autoCloseReminderTime = 10;
try {
String asString = mSettings.getProperty("autoCloseReminderTime", "10");
autoCloseReminderTime = Integer.parseInt(asString);
if(autoCloseReminderTime == 0) {
autoCloseReminderTime = 10;
}
} catch (Exception exc) {
// ignore
}
mCloseOnEnd = new JRadioButton(mLocalizer.msg("autoCloseReminderAtProgramEnd","Program end"), mSettings.getProperty("autoCloseBehaviour","onEnd").equals("onEnd"));
mCloseOnEnd.setEnabled(mReminderWindowChB.isSelected());
mCloseNever = new JRadioButton(mLocalizer.msg("autoCloseNever","Never close"), mSettings.getProperty("autoCloseBehaviour","onEnd").equals("never"));
mCloseNever.setEnabled(mReminderWindowChB.isSelected());
mCloseOnTime = new JRadioButton(mLocalizer.ellipsisMsg("autoCloseAfterTime","After time"), mSettings.getProperty("autoCloseBehaviour","onEnd").equals("onTime"));
mCloseOnTime.setEnabled(mReminderWindowChB.isSelected());
ButtonGroup bg = new ButtonGroup();
bg.add(mCloseOnEnd);
bg.add(mCloseNever);
bg.add(mCloseOnTime);
mAutoCloseReminderTimeSp = new JSpinner(new SpinnerNumberModel(autoCloseReminderTime,autoCloseReminderTime < 5 ? 1 : 5,600,1));
mAutoCloseReminderTimeSp.setEnabled(mCloseOnTime.isSelected() && mReminderWindowChB.isSelected());
mShowTimeCounter = new JCheckBox(mLocalizer.msg("showTimeCounter","Show time counter"),mSettings.getProperty("showTimeCounter","false").compareTo("true") == 0);
mShowTimeCounter.setEnabled(!mCloseNever.isSelected() && mReminderWindowChB.isSelected());
PanelBuilder autoClosePanel = new PanelBuilder(new FormLayout("12dlu,default,2dlu,default:grow","pref,2dlu,pref,2dlu,pref,2dlu,pref,10dlu,pref"));
autoClosePanel.add(mCloseOnEnd, cc.xyw(1,1,4));
autoClosePanel.add(mCloseNever, cc.xyw(1,3,4));
autoClosePanel.add(mCloseOnTime, cc.xyw(1,5,4));
autoClosePanel.add(mAutoCloseReminderTimeSp, cc.xy(2,7));
final JLabel secondsLabel = autoClosePanel.addLabel(mLocalizer.msg("seconds", "seconds (0 = off)"), cc.xy(4,7));
autoClosePanel.add(mShowTimeCounter, cc.xyw(1,9,4));
secondsLabel.setEnabled(mCloseOnTime.isSelected() && mReminderWindowChB.isSelected());
String defaultReminderEntryStr = (String)mSettings.get("defaultReminderEntry");
mDefaultReminderEntryList =new JComboBox(ReminderDialog.SMALL_REMIND_MSG_ARR);
if (defaultReminderEntryStr != null) {
try {
int inx = Integer.parseInt(defaultReminderEntryStr);
if (inx < ReminderDialog.SMALL_REMIND_MSG_ARR.length) {
mDefaultReminderEntryList.setSelectedIndex(inx);
}
}catch(NumberFormatException e) {
// ignore
}
}
mShowTimeSelectionDlg = new JCheckBox(mLocalizer.msg("showTimeSelectionDialog","Show time selection dialog"));
mShowTimeSelectionDlg.setSelected(mSettings.getProperty("showTimeSelectionDialog","true").compareTo("true") == 0);
mShowRemovedDlg = new JCheckBox(mLocalizer.msg("showRemovedDialog","Show removed reminders after data update"));
mShowRemovedDlg.setSelected(mSettings.getProperty("showRemovedDialog","true").compareTo("true") == 0);
pb.addSeparator(mLocalizer.msg("remindBy", "Remind me by"), cc.xyw(1,1,10));
pb.add(reminderWindowCfg, cc.xyw(2,3,4));