Fix the problem where the PresetModel drop down was not closing when the ComponentPresetChooserDialog is opened.

This commit is contained in:
Kevin Ruland 2012-04-12 04:12:45 +00:00
parent f92034db56
commit ef8499e6a8

View File

@ -65,14 +65,18 @@ public class PresetModel extends AbstractListModel implements ComboBoxModel, Com
} else if (item.equals(NONE_SELECTED)) { } else if (item.equals(NONE_SELECTED)) {
component.clearPreset(); component.clearPreset();
} else if (item.equals(SELECT_DATABASE)) { } else if (item.equals(SELECT_DATABASE)) {
// FIXME - when the dialog first appears, the preset drop down still is open and has focus. SwingUtilities.invokeLater( new Runnable() {
// we need to force focus to the new dialog. @Override
ComponentPresetChooserDialog dialog = public void run() {
new ComponentPresetChooserDialog( SwingUtilities.getWindowAncestor(PresetModel.this.parent), ComponentPresetChooserDialog dialog =
PresetModel.this.component); new ComponentPresetChooserDialog( SwingUtilities.getWindowAncestor(PresetModel.this.parent),
dialog.setVisible(true); PresetModel.this.component);
ComponentPreset preset = dialog.getSelectedComponentPreset(); dialog.setVisible(true);
setSelectedItem(preset); ComponentPreset preset = dialog.getSelectedComponentPreset();
setSelectedItem(preset);
}
});
} else { } else {
// FIXME: Add undo point here // FIXME: Add undo point here
component.loadPreset((ComponentPreset) item); component.loadPreset((ComponentPreset) item);