Examples of UIConfirmationEvent


Examples of net.sourceforge.javautil.ui.UIConfirmationEvent

  public void setAlertSeverityLimit(Severity severity) { this.severity = severity; }
 
  public <S, R extends UICommonResponse> R handle(UICommonEvent<S, R> evt) throws UIFailureException {
    if (evt instanceof UIConfirmationEvent) {
      try {
        UIConfirmationEvent confirm = (UIConfirmationEvent) evt;
       
        boolean trying = true;
        while (trying) {
          this.controller = null;
          this.controllingThread.interrupt();
         
          String options = null;
          if (confirm.getAnswer() == null) options = "[yes/no/cancel]";
          else {
            switch (confirm.getAnswer()) {
              case Yes: options = "[YES/no/cancel]"; break;
              case No: options = "[yes/NO/cancel]"; break;
              case Cancel: options = "[yes/no/CANCEL]"; break;
            }
            options += "  [only press ENTER for default]";
          }
         
          String[] results = this.captureCommand( confirm.getMessage() + " " + options + ": ");
          if (results.length > 0 && !"".equals(results[0].trim())) {
            if ("yes".equalsIgnoreCase( results[0] )) confirm.setAnswer(Answer.Yes);
            else if ("no".equalsIgnoreCase( results[1] )) confirm.setAnswer(Answer.No);
            else if ("cancel".equalsIgnoreCase( results[2] )) confirm.setAnswer(Answer.Cancel);
            else confirm.setAnswer(null);
          }
         
          if (confirm.getAnswer() != null) trying = false;
        }
       
        return (R) confirm;
      } finally {
        this.controller = this;
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.