public void actionPerformed(ActionEvent e) {
int sel = tblStyles.getSelectionModel().getLeadSelectionIndex();
if (sel < 0 || sel >= model.getRowCount())
return;
final StyleSource s = model.getRow(sel);
ExtendedDialog info = new ExtendedDialog(Main.parent, tr("Map Style info"), new String[] {tr("Close")});
info.setPreferredSize(new Dimension(600, 400));
info.setButtonIcons(new String[] {"ok.png"});
final JTabbedPane tabs = new JTabbedPane();
tabs.add("Info", buildInfoPanel(s));
JLabel lblInfo = new JLabel(tr("Info"));
lblInfo.setFont(lblInfo.getFont().deriveFont(Font.PLAIN));
tabs.setTabComponentAt(0, lblInfo);
final JPanel pErrors = new JPanel(new GridBagLayout());
tabs.add("Errors", pErrors);
JLabel lblErrors;
if (s.getErrors().isEmpty()) {
lblErrors = new JLabel(tr("Errors"));
lblErrors.setFont(lblInfo.getFont().deriveFont(Font.PLAIN));
lblErrors.setEnabled(false);
tabs.setTabComponentAt(1, lblErrors);
tabs.setEnabledAt(1, false);
} else {
lblErrors = new JLabel(tr("Errors"), ImageProvider.get("misc", "error"), JLabel.HORIZONTAL);
tabs.setTabComponentAt(1, lblErrors);
}
final JPanel pSource = new JPanel(new GridBagLayout());
tabs.addTab("Source", pSource);
JLabel lblSource = new JLabel(tr("Source"));
lblSource.setFont(lblSource.getFont().deriveFont(Font.PLAIN));
tabs.setTabComponentAt(2, lblSource);
tabs.getModel().addChangeListener(new ChangeListener() {
@Override
public void stateChanged(ChangeEvent e) {
if (!errorsTabLoaded && ((SingleSelectionModel) e.getSource()).getSelectedIndex() == 1) {
errorsTabLoaded = true;
buildErrorsPanel(s, pErrors);
}
if (!sourceTabLoaded && ((SingleSelectionModel) e.getSource()).getSelectedIndex() == 2) {
sourceTabLoaded = true;
buildSourcePanel(s, pSource);
}
}
});
info.setContent(tabs, false);
info.showDialog();
}