Package org.zkoss.zk.ui

Examples of org.zkoss.zk.ui.Execution


      }
    }
  }

  private void doModal(Page page, String url) {
    final Execution exec = Executions.getCurrent();
    final Object[] urls = parseUrl(url);
      final Component modalwin = exec.createComponents((String)urls[0], null, (Map)urls[1]);
      if (!(modalwin instanceof Window)) {
        throw new UiException("The page must enclosed with a Window component. Check url definition: "+url);
      }
      modalwin.setPage(page);
      try {
View Full Code Here


    //fetch old Event stored in Session and post again
    final Component comp = event.getTarget();
   
    final Page page = comp.getPage();
    final String url = (String) event.getData();
    final Execution exec = Executions.getCurrent();
    try {
      doModal(page, url);
      } finally {
      if (comp.isListenerAvailable(event.getName(), true)) {
        EventListener listener = (EventListener) comp.getAttribute(event.getName());
View Full Code Here

      }
    }
  }

  private void doModal(Page page, String url) {
    final Execution exec = Executions.getCurrent();
    final Object[] urls = parseUrl(url);
      final Component modalwin = exec.createComponents((String)urls[0], null, (Map)urls[1]);
      if (!(modalwin instanceof Window)) {
        throw new UiException("The page must enclosed with a Window component. Check url definition: "+url);
      }
      modalwin.setPage(page);
      try {
View Full Code Here

   *
   * <p>Note: it doesn't invoke {@link ExecutionCtrl#onActivate}
   */
  public void setup() {
    SessionsCtrl.setCurrent(_desktop.getSession());
    final Execution exec = _desktop.getExecution();
    ExecutionsCtrl.setCurrent(exec);
    ((ExecutionCtrl)exec).setCurrentPage(getPage());
  }
View Full Code Here

   */
  /* package */ static SessionFactory initSessionFactory(WebApp app) {
    if (_factory == null) {
      //read hibernate.config preference
      if (app == null) {
        final Execution exec = Executions.getCurrent();
        if (exec != null) {
          final Desktop desktop = exec.getDesktop();
          if (desktop != null) {
            app = desktop.getWebApp();
          }
        }
      }
View Full Code Here

    if (impls == null)
      _implicits.set(impls = new LinkedList());
    final Implicit impl = new Implicit();
    impls.add(0, impl);

    final Execution exec = Executions.getCurrent();
    impl.setImplicit("arg", exec != null ? exec.getArg(): null);

    push(scope);

    return impl;
  }
View Full Code Here

      nss != null && !nss.isEmpty() ? (Scope)nss.get(0): null;
    if (scope != null)
      return scope;

    if (page == null) {
      final Execution exec = Executions.getCurrent();
      if (exec != null)
        page = ((ExecutionCtrl)exec).getCurrentPage();
    }
    return page;
  }
View Full Code Here

  public void redraw(java.io.Writer out) throws java.io.IOException {
    final StringWriter bufout = new StringWriter();
    super.redraw(bufout);

    final StringBuffer buf = bufout.getBuffer();
    final Execution exec = Executions.getCurrent();
    if (exec != null)
      Utils.addAllZkTags(exec, getPage(), buf, "body");

    out.write(buf.toString());
    out.write('\n');
View Full Code Here

      return;
     
    _context = SecurityContextHolder.getContext(); //get threadLocal from event thread

    //handle Acegi Exception occured within Event handling
    final Execution exec = Executions.getCurrent();
    if (errs != null && !errs.isEmpty() && errs.size() == 1) {
      Throwable ex = (Throwable) errs.get(0);
      if (ex != null) {
        ex = Exceptions.findCause(ex, AcegiSecurityException.class);
        if (ex instanceof AcegiSecurityException) {
          //ZK massage the exception to visual message (not an exception), so
          //we remember the exception in request attribute and let ZkEventExceptionFilter
          //to rethrow the exception so Acegi's ExcepitonTranslationFilter can
          //catch that and show login window.

          //to avoid show the massaged visula message
          errs.clear();

          exec.setAttribute(ZkEventExceptionFilter.EXCEPTION, ex);
          exec.setAttribute(ZkEventExceptionFilter.COMPONENT, comp);
          exec.setAttribute(ZkEventExceptionFilter.EVENT, evt);
        }
      }
    }

    //there was other exception, no need to go thru acegi filter chain.
    if (errs != null && !errs.isEmpty()) return;
   
    //carry the current event that would be used by the filter chain.
    exec.setAttribute(ZkAuthenticationProcessingFilter.CURRENT_EVENT, evt);
   
    Filter filter = (Filter) SpringUtil.getBean("zkFilterChainProxy");
    if (filter != null) {
      ServletRequest request = (ServletRequest) exec.getNativeRequest();
      ServletResponse response = (ServletResponse) exec.getNativeResponse();
      ServletResponse resp = BufferedResponse.getInstance(response, new NullWriter());
      try {
        filter.doFilter(request, resp, new NullFilterChain());
      } catch(Exception ex1) {
        throw UiException.Aide.wrap(ex1); //should never occur
View Full Code Here

public class SpringUtil {
  /**
   * Get the spring application context.
   */
  public static ApplicationContext getApplicationContext() {
    Execution exec = Executions.getCurrent();
    if (exec == null) {
      throw new UiException("SpringUtil can be called only under ZK environment!");
    }
   
    return WebApplicationContextUtils.getRequiredWebApplicationContext(
        (ServletContext)exec.getDesktop().getWebApp().getNativeContext());
  }
View Full Code Here

TOP

Related Classes of org.zkoss.zk.ui.Execution

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.