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
public void run() {
ComponentPresetChooserDialog dialog = ComponentPresetChooserDialog dialog =
new ComponentPresetChooserDialog( SwingUtilities.getWindowAncestor(PresetModel.this.parent), new ComponentPresetChooserDialog( SwingUtilities.getWindowAncestor(PresetModel.this.parent),
PresetModel.this.component); PresetModel.this.component);
dialog.setVisible(true); dialog.setVisible(true);
ComponentPreset preset = dialog.getSelectedComponentPreset(); ComponentPreset preset = dialog.getSelectedComponentPreset();
setSelectedItem(preset); setSelectedItem(preset);
}
});
} else { } else {
// FIXME: Add undo point here // FIXME: Add undo point here
component.loadPreset((ComponentPreset) item); component.loadPreset((ComponentPreset) item);