use of org.openecard.gui.message.MessageDialogResult in project open-ecard by ecsec.
the class RunMessageBox method showInputDialog2.
@Test(enabled = !true)
public void showInputDialog2() {
MessageDialog messageBox = uc.obtainMessageDialog();
MessageDialogResult result = messageBox.showInputDialog("Press ok!", "initialValue");
Assert.assertEquals(result.getReturnValue(), ReturnType.OK);
Assert.assertEquals(result.getUserInput(), "initialValue");
}
use of org.openecard.gui.message.MessageDialogResult in project open-ecard by ecsec.
the class RunMessageBox method showInputDialog4.
@Test(enabled = !true)
public void showInputDialog4() throws IOException {
MessageDialog messageBox = uc.obtainMessageDialog();
MessageDialogResult result;
result = messageBox.showInputDialog("Press ok!", TITLE, DialogType.ERROR_MESSAGE, iconData, 2, options);
Assert.assertEquals(result.getReturnValue(), ReturnType.OK);
Assert.assertEquals(result.getUserInput(), "three");
}
use of org.openecard.gui.message.MessageDialogResult in project open-ecard by ecsec.
the class SwingMessageDialog method showOptionDialog.
@Override
public MessageDialogResult showOptionDialog(String msg, String title, OptionType optionType, DialogType msgType, byte[] iconData, String... options) {
msg = formatMessage(msg);
if (options.length == 0) {
throw new IllegalArgumentException("List of options must be given.");
}
ImageIcon icon = null;
if (iconData != null) {
icon = new ImageIcon(iconData);
}
JOptionPane jop;
jop = new JOptionPane(msg, convertDialogType(msgType), convertOptionType(optionType), icon, options);
JDialog dialog = jop.createDialog(title);
dialog.setIconImage(FRAME_ICON);
if (SwingDialogWrapper.needsFullscreen()) {
dialog.setAlwaysOnTop(true);
}
dialog.setVisible(true);
dialog.toFront();
Object returnValue = jop.getValue();
if (returnValue == null) {
return new MessageDialogResult(ReturnType.CANCEL);
}
return new MessageDialogResult((String) returnValue);
}
use of org.openecard.gui.message.MessageDialogResult in project open-ecard by ecsec.
the class SwingMessageDialog method showInputDialog.
@Override
public MessageDialogResult showInputDialog(String msg, String title, DialogType msgType, String initialValue) {
msg = formatMessage(msg);
JOptionPane jop = new JOptionPane(msg, convertDialogType(msgType), JOptionPane.OK_CANCEL_OPTION);
JDialog dialog = jop.createDialog(title);
dialog.setIconImage(FRAME_ICON);
jop.setInitialSelectionValue(initialValue);
jop.setWantsInput(true);
if (SwingDialogWrapper.needsFullscreen()) {
dialog.setAlwaysOnTop(true);
}
dialog.setVisible(true);
dialog.toFront();
Object returnValue = jop.getInputValue();
if (returnValue == null) {
return new MessageDialogResult((String) null);
} else {
return new MessageDialogResult((String) returnValue);
}
}
use of org.openecard.gui.message.MessageDialogResult in project open-ecard by ecsec.
the class RunMessageBox method showOptionDialog.
@Test(enabled = !true)
public void showOptionDialog() throws IOException {
MessageDialog messageBox = uc.obtainMessageDialog();
MessageDialogResult result = messageBox.showOptionDialog("Press the one button!", TITLE, OptionType.OK_CANCEL_OPTION, DialogType.ERROR_MESSAGE, iconData, options);
Assert.assertEquals(result.getReturnValue(), ReturnType.OK);
Assert.assertEquals(result.getUserInput(), "one");
}
Aggregations