pb.add(mShowRemovedDlg, cc.xyw(2,27,7));
pb.addSeparator(DefaultMarkingPrioritySelectionPanel.getTitle(), cc.xyw(1,29,10));
pb.add(mMarkingsPanel = DefaultMarkingPrioritySelectionPanel.createPanel(ReminderPlugin.getInstance().getMarkPriority(),false,false),cc.xyw(2,31,9));
mReminderWindowChB.addItemListener(new ItemListener() {
public void itemStateChanged(ItemEvent e) {
mShowAlwaysOnTop.setEnabled(e.getStateChange() == ItemEvent.SELECTED);
c.setEnabled(e.getStateChange() == ItemEvent.SELECTED);
secondsLabel.setEnabled(e.getStateChange() == ItemEvent.SELECTED && mCloseOnTime.isSelected());
mCloseOnEnd.setEnabled(e.getStateChange() == ItemEvent.SELECTED);
mCloseNever.setEnabled(e.getStateChange() == ItemEvent.SELECTED);
mCloseOnTime.setEnabled(e.getStateChange() == ItemEvent.SELECTED);
mShowTimeCounter.setEnabled(e.getStateChange() == ItemEvent.SELECTED && !mCloseNever.isSelected());
mAutoCloseReminderTimeSp.setEnabled(e.getStateChange() == ItemEvent.SELECTED && mCloseOnTime.isSelected());
}
});
soundTestBt.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent evt) {
if(evt.getActionCommand().compareTo(mLocalizer.msg("test", "Test")) == 0) {
mTestSound = ReminderPlugin.playSound(mSoundFileChB.getTextField().getText());
if(mTestSound != null) {
soundTestBt.setText(mLocalizer.msg("stop", "Stop"));
}
if(mTestSound != null) {
if(mTestSound instanceof SourceDataLine) {
((SourceDataLine)mTestSound).addLineListener(new LineListener() {
public void update(LineEvent event) {
if(event.getType() == Type.CLOSE) {
soundTestBt.setText(mLocalizer.msg("test", "Test"));
}
}
});
}
else if(mTestSound instanceof Sequencer) {
new Thread("Test MIDI sound") {
public void run() {
setPriority(Thread.MIN_PRIORITY);
while(((Sequencer)mTestSound).isRunning()) {
try {
Thread.sleep(100);
}catch(Exception ee) {}
}
soundTestBt.setText(mLocalizer.msg("test", "Test"));
}
}.start();
}
}
}
else if(mTestSound != null) {
if(mTestSound instanceof SourceDataLine && ((SourceDataLine)mTestSound).isRunning()) {
((SourceDataLine)mTestSound).stop();
} else if(mTestSound instanceof Sequencer && ((Sequencer)mTestSound).isRunning()) {
((Sequencer)mTestSound).stop();
}
}
}
});
mSoundFileChB.getCheckBox().addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
soundTestBt.setEnabled(mSoundFileChB.isSelected());
}
});
mSoundFileChB.getTextField().addKeyListener(new KeyAdapter() {
public void keyReleased(KeyEvent e) {
String text = mSoundFileChB.getTextField().getText();
if((new File(text)).isFile()) {
boolean notFound = true;
for (String extension : extArr) {
if(text.toLowerCase().endsWith(extension)) {
notFound = false;
break;
}
}
if(notFound) {
soundTestBt.setEnabled(false);
} else {
soundTestBt.setEnabled(true);
}
} else {
soundTestBt.setEnabled(false);
}
}
});
mSoundFileChB.getTextField().getKeyListeners()[0].keyReleased(null);
mExecChB.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
mExecFileDialogBtn.setEnabled(mExecChB.isSelected());
if (mExecFileDialogBtn.isEnabled()) {
showFileSettingsDialog();
}
}
});
mExecFileDialogBtn.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
showFileSettingsDialog();
}
});
ItemListener autoCloseListener = new ItemListener() {
public void itemStateChanged(ItemEvent e) {
mAutoCloseReminderTimeSp.setEnabled(mCloseOnTime.isSelected());
secondsLabel.setEnabled(mCloseOnTime.isSelected());
mShowTimeCounter.setEnabled(mCloseOnTime.isSelected() || mCloseOnEnd.isSelected());
}
};
mCloseOnEnd.addItemListener(autoCloseListener);
mCloseOnTime.addItemListener(autoCloseListener);
mCloseOnTime.addItemListener(new ItemListener() {
public void itemStateChanged(ItemEvent e) {
mShowTimeCounter.setEnabled(e.getStateChange() == ItemEvent.SELECTED);
}
});