Package com.adito.navigation.forms

Examples of com.adito.navigation.forms.ConfirmForm


    String subtitle = resources.getMessage(locale, propertyPrefix + ".subtitle");
    String message = resources
        .getMessage(locale, propertyPrefix + ".message", arg0);

    // Initialise the form
    ConfirmForm confirmForm = (ConfirmForm) form;
    confirmForm.initialize(type, title, subtitle, message, options,
        decorated, align, arg0);

    // If this confirmation is the result on an exception then build up the
    // exception text
    Throwable exception = type.equals(ConfirmForm.TYPE_EXCEPTION) ? (Throwable) request
        .getSession().getAttribute(Constants.EXCEPTION)
        : null;
    request.getSession().removeAttribute(Constants.EXCEPTION);
    if (exception != null) {
      StringBuffer mesgBuf = new StringBuffer();
      StringBuffer traceBuf = new StringBuffer();
      Throwable ex = exception;
      while (ex != null) {
        String mesg = ex.getMessage();
        if (mesg != null) {
          mesg = mesg.trim();
          if (!mesg.endsWith(".")) {
            mesg += ".";
          }
          if (mesgBuf.length() == 0) {
            mesgBuf.append('\n');
          }
          mesgBuf.append(mesg);
        }
        StringWriter sw = new StringWriter();
        ex.printStackTrace(new PrintWriter(sw));
        if (traceBuf.length() == 0) {
          traceBuf.append("\n");
        }
        traceBuf.append(sw.toString());
        ex = ex.getCause();
      }

      // If this is a code exception we can get the localised messages
      if (exception instanceof CoreException) {
        CoreException ce = (CoreException) exception;
        MessageResources mr = CoreUtil.getMessageResources(request
            .getSession(), ce.getBundle());
        if (mr != null) {
          mesgBuf.append(" ");
          mesgBuf.append(mr.getMessage((Locale) request
              .getSession().getAttribute(Globals.LOCALE_KEY), ce
              .getBundleActionMessage().getKey(), ce
              .getBundleActionMessage().getArg0(), ce
              .getBundleActionMessage().getArg1(), ce
              .getBundleActionMessage().getArg2(), ce
              .getBundleActionMessage().getArg3()));

        }
      }

      confirmForm.setExceptionMessage(mesgBuf.toString());
      confirmForm.setTraceMessage(traceBuf.toString());
    }

    return mapping.findForward("success");
  }
View Full Code Here

TOP

Related Classes of com.adito.navigation.forms.ConfirmForm

Copyright © 2018 www.massapicom. 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.