*/
public void setResponseAction(RunResponse action)
{
- dialog.response(action);
+ dialog.addResponse(action);
}
/**
MessageManager.getString("label.load_jalview_annotations"));
chooser.setToolTipText(
MessageManager.getString("label.load_jalview_annotations"));
- chooser.response(new RunResponse(JalviewFileChooser.APPROVE_OPTION)
+ chooser.addResponse(new RunResponse(JalviewFileChooser.APPROVE_OPTION)
{
@Override
chooser.setToolTipText(
MessageManager.getString("label.load_tree_file"));
- chooser.response(new jalview.util.dialogrunner.RunResponse(
+ chooser.addResponse(new jalview.util.dialogrunner.RunResponse(
JalviewFileChooser.APPROVE_OPTION)
{
@Override
chooser.setDialogTitle(MessageManager.getString("label.load_vcf_file"));
chooser.setToolTipText(MessageManager.getString("label.load_vcf_file"));
final AlignFrame us = this;
- chooser.response(new RunResponse(JalviewFileChooser.APPROVE_OPTION)
+ chooser.addResponse(new RunResponse(JalviewFileChooser.APPROVE_OPTION)
{
@Override
public void run()
* in reverse order)
*/
JvOptionPane dialog = JvOptionPane.newOptionDialog(Desktop.desktop)
- .response(new RunResponse(0)
+ .addResponse(new RunResponse(0)
{
@Override
public void run()
{
addDataToAlignment(al);
}
- }).response(new RunResponse(1)
+ }).addResponse(new RunResponse(1)
{
@Override
public void run()
{
us.openLinkedAlignmentAs(al, title, true);
}
- }).response(new RunResponse(2)
+ }).addResponse(new RunResponse(2)
{
@Override
public void run()
MessageManager.getString("label.open_local_file"));
chooser.setToolTipText(MessageManager.getString("action.open"));
- chooser.response(new RunResponse(JalviewFileChooser.APPROVE_OPTION)
+ chooser.addResponse(new RunResponse(JalviewFileChooser.APPROVE_OPTION)
{
@Override
}};
String dialogOption = MessageManager
.getString("label.input_alignment_from_url");
- JvOptionPane.newOptionDialog(desktop).response(action)
+ JvOptionPane.newOptionDialog(desktop).addResponse(action)
.showInternalDialog(panel, dialogOption,
JvOptionPane.YES_NO_CANCEL_OPTION,
JvOptionPane.PLAIN_MESSAGE, null, options,
"Jalview Project");
chooser.setFileView(new JalviewFileView());
chooser.setDialogTitle(MessageManager.getString("label.restore_state"));
- chooser.response(new RunResponse(JalviewFileChooser.APPROVE_OPTION)
+ chooser.addResponse(new RunResponse(JalviewFileChooser.APPROVE_OPTION)
{
@Override
public void run()
{
Object[] options = new Object[] { MessageManager.getString("action.ok"),
MessageManager.getString("action.cancel") };
- JvOptionPane.newOptionDialog(parent).response(action)
+ JvOptionPane.newOptionDialog(parent).addResponse(action)
.showInternalDialog(panel, title,
JvOptionPane.YES_NO_CANCEL_OPTION,
JvOptionPane.PLAIN_MESSAGE, null, options,
* also for Delete if applicable (when amending features)
*/
JvOptionPane dialog = JvOptionPane.newOptionDialog(Desktop.desktop)
- .response(okAction).response(cancelAction);
+ .addResponse(okAction).addResponse(cancelAction);
if (!forCreate)
{
- dialog.response(getDeleteAction());
+ dialog.addResponse(getDeleteAction());
}
String title = null;
chooser.setDialogTitle(
MessageManager.getString("label.load_feature_colours"));
chooser.setToolTipText(MessageManager.getString("action.load"));
- chooser.response(new RunResponse(JalviewFileChooser.APPROVE_OPTION){
+ chooser.addResponse(new RunResponse(JalviewFileChooser.APPROVE_OPTION){
@Override
public void run() {
{
switch (messageType)
{
- default:
- case JvOptionPane.INFORMATION_MESSAGE:
- prefix = "Note: ";
- break;
case JvOptionPane.WARNING_MESSAGE:
prefix = "WARNING! ";
break;
case JvOptionPane.ERROR_MESSAGE:
- prefix = "ERRROR! ";
+ prefix = "ERROR! ";
break;
+ default:
+ prefix = "Note: ";
}
}
return prefix;
{
parent = parentComponent;
}
- ;
ourOptions = Arrays.asList(options);
int response;
}
@Override
- public JvOptionPane response(RunResponse action)
+ public JvOptionPane addResponse(RunResponse action)
{
- runner.response(action);
+ runner.addResponse(action);
return this;
}
*/
public void setResponseAction(RunResponse action)
{
- dialog.response(action);
+ dialog.addResponse(action);
}
/**
restoreInitialSettings();
}
};
- JvOptionPane.newOptionDialog(alignPanel).response(action)
+ JvOptionPane.newOptionDialog(alignPanel).addResponse(action)
.showInternalDialog(bigpanel, title,
JvOptionPane.YES_NO_CANCEL_OPTION,
JvOptionPane.PLAIN_MESSAGE, null, options,
chooser.setDialogTitle(
MessageManager.getString("label.load_colour_scheme"));
chooser.setToolTipText(MessageManager.getString("action.load"));
- chooser.response(new RunResponse(JalviewFileChooser.APPROVE_OPTION) {
+ chooser.addResponse(new RunResponse(JalviewFileChooser.APPROVE_OPTION) {
@Override
public void run() {
File choice = chooser.getSelectedFile();
}
@Override
- public JalviewFileChooser response(RunResponse action)
+ public JalviewFileChooser addResponse(RunResponse action)
{
- return runner.response(action);
+ return runner.addResponse(action);
}
}
}
@Override
- public T response(RunResponse action)
+ public T addResponse(RunResponse action)
{
return addResponse(false, action);
}
{
/**
- * define a new response for this dialog. eg. dialog.response(new
- * RunResponse(OK_PRessed) { run()...}).response(new RunResponse(CANCEL_PRESSED)
- * { ... });
+ * Adds a new response for this dialog, and returns the dialog (this), to allow chaining, eg.
+ * <pre>
+ * dialog.addResponse(newRunResponse(OK_PRessed) { run()...})
+ * .addResponse(new RunResponse(CANCEL_PRESSED);
+ * </pre>
*
* @param action
* @return the dialog
*/
- T response(RunResponse action);
+ T addResponse(RunResponse action);
}
ourTrigger = new Response(trigger);
}
- public RunResponse(Response trigger)
- {
- ourTrigger = trigger;
- }
-
public void reset()
{
wasRun = false;