message = lines;
}
}
Column messageColumn = new Column();
if (message.getClass().isArray()) {
Object[] messageList = (Object[]) message;
for (int i = 0; i < messageList.length; i++) {
messageColumn.add(new Label(messageList[i].toString()));
}
} else {
messageColumn.add(new Label(message.toString()));
}
final int labelCount = messageColumn.getComponentCount();
JbsButton btnDetails = null;
if (exception!=null) {
btnDetails = new JbsButton("Details...");
btnDetails.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent arg0) {
showException(exception);
}
});
}
Row topRow = new Row();
topRow.setCellSpacing(new JbsExtent(DIALOG_INSETS));
topRow.add(iconLabel);
topRow.add(messageColumn);
KeyStrokeListener ks = new KeyStrokeListener();
ArrayList<JbsButton> buttons = new ArrayList<JbsButton>();
if (optionType == DEFAULT_OPTION) {
buttons.add(defaultButton = createButton(JbsL10N.getString("Generic.ok"), OK_OPTION));
ks.addKeyCombination(KeyStrokeListener.VK_RETURN, OK_OPTION);
} else if (optionType == YES_NO_OPTION) {
buttons.add(defaultButton = createButton(JbsL10N.getString("Generic.yes"), YES_OPTION));
ks.addKeyCombination(KeyStrokeListener.VK_RETURN, YES_OPTION);
buttons.add(createButton(JbsL10N.getString("Generic.no"), NO_OPTION));
ks.addKeyCombination(KeyStrokeListener.VK_ESCAPE, NO_OPTION);
} else if (optionType == YES_NO_CANCEL_OPTION) {
buttons.add(defaultButton = createButton(JbsL10N.getString("Generic.yes"), YES_OPTION));
ks.addKeyCombination(KeyStrokeListener.VK_RETURN, YES_OPTION);
buttons.add(createButton(JbsL10N.getString("Generic.no"), NO_OPTION));
buttons.add(createButton(JbsL10N.getString("Generic.cancel"), CANCEL_OPTION));
ks.addKeyCombination(KeyStrokeListener.VK_ESCAPE, CANCEL_OPTION);
} else if (optionType == OK_CANCEL_OPTION) {
buttons.add(defaultButton = createButton(JbsL10N.getString("Generic.ok"), OK_OPTION));
ks.addKeyCombination(KeyStrokeListener.VK_RETURN, OK_OPTION);
buttons.add(createButton(JbsL10N.getString("Generic.cancel"), CANCEL_OPTION));
ks.addKeyCombination(KeyStrokeListener.VK_ESCAPE, CANCEL_OPTION);
}
if (btnDetails!=null)
buttons.add(btnDetails);
ks.addActionListener(this);
topRow.add(ks);
ButtonPanel buttonPanel = new ButtonPanel();
ColumnLayoutData buttonPanelLayout = new ColumnLayoutData();
buttonPanelLayout.setAlignment(new Alignment(Alignment.CENTER, Alignment.TOP));
buttonPanel.setLayoutData(buttonPanelLayout);
for (int i = 0; i < buttons.size(); i++) {
buttonPanel.add((AbstractButton) buttons.get(i));
}
Column mainColumn = new Column();
mainColumn.setCellSpacing(new JbsExtent(COMMAND_SEPARATION));
mainColumn.add(topRow);
mainColumn.add(buttonPanel);
add(mainColumn);
int dialogHeight = /*titleHeight*/ 60 + DIALOG_INSETS * 2 +
Math.max(LABEL_HEIGHT * labelCount, iconHeight) +