Package org.zkoss.zk.ui.event

Examples of org.zkoss.zk.ui.event.Event


      return;
    }
   
    CellEvent event = new StopEditingEvent(org.zkoss.zss.ui.event.Events.ON_STOP_EDITING, comp, sheet,row,col,value);
    Events.postEvent(event);
    Events.postEvent(new Event("onStopEditingImpl", comp, new Object[]{token,event}));
  }
View Full Code Here


    public void setSendZkEventAfterSuccessfulAuthentication(boolean b) {
        _resendZkEvent = b;
    }

    protected boolean requiresAuthentication(HttpServletRequest request, HttpServletResponse response) {
      final Event evt = (Event) request.getAttribute(CURRENT_EVENT);
      return Objects.equals(getFilterProcessesUrl(), request.getAttribute("j_loginurl")) &&
        ZkAuthenticationEntryPoint.ON_ACEGILOGIN.equals(evt.getName());
          //must check the event name otherwise authentication would be called twice.
          //1st the login model window's button click event
          //2nd the resumed onAcegiLogin thread resume and "cleanup".
          //we now check only on 2nd event
    }
View Full Code Here

  protected void sendRedirect(HttpServletRequest request, HttpServletResponse response, String url)
    throws IOException {
      if (url == null) {
        return; //skip
      }
    final Event evt = (Event) ((HttpServletRequest)request).getSession().getAttribute(ZkEventExceptionFilter.EVENT);
    final Component comp = evt.getTarget();
    final String updateURI = comp.getDesktop().getUpdateURI(null);
      if (url.indexOf(updateURI) >= 0) { //saved request
        Events.postEvent(new Event(ON_LOGIN_OK, comp, null)); //post onLoginOK event
        if (_resendZkEvent) {
        ((HttpServletRequest)request).getSession().removeAttribute(ZkEventExceptionFilter.EVENT);
          Events.postEvent(evt);
        }
        return;
      }

    //must redirect
        if (url.startsWith("http://") || url.startsWith("https://")) {
            Executions.getCurrent().sendRedirect(url);
            return;
        }

    //other url, assume login fail
    if (!comp.isListenerAvailable(ZkAuthenticationEntryPoint.ON_ACEGILOGIN, true)) {
      final EventListener listener = new ShowWindowEventListener();
      comp.setAttribute(ZkAuthenticationEntryPoint.ON_ACEGILOGIN, listener);
      comp.addEventListener(ZkAuthenticationEntryPoint.ON_ACEGILOGIN, listener);
    }
   
      Events.postEvent(new Event(ZkAuthenticationEntryPoint.ON_ACEGILOGIN, comp, url));
  }
View Full Code Here

      final EventListener listener = new ShowWindowEventListener();
      comp.setAttribute(ON_ACCESSDENIED, listener);
      comp.addEventListener(ON_ACCESSDENIED, listener);
    }
    final String url = getErrorPage();
      Events.postEvent(new Event(ON_ACCESSDENIED, comp, url != null ? url : "~./accessDenied.zul"));
    }
View Full Code Here

  public void commence(ServletRequest request, ServletResponse response, AuthenticationException authException)
    throws IOException, ServletException {
      final Component comp = (Component) request.getAttribute(ZkEventExceptionFilter.COMPONENT);
     
      //remember the original event that cause the security login in session
      final Event evt = (Event) request.getAttribute(ZkEventExceptionFilter.EVENT);
    ((HttpServletRequest)request).getSession().setAttribute(ZkEventExceptionFilter.EVENT, evt);         

    if (!comp.isListenerAvailable(ON_ACEGILOGIN, true)) {
      final EventListener listener = new ShowWindowEventListener();
      comp.setAttribute(ON_ACEGILOGIN, listener);
      comp.addEventListener(ON_ACEGILOGIN, listener);
    }
    final String url = getLoginFormUrl();
      Events.postEvent(new Event(ON_ACEGILOGIN, comp, url != null ? url : "~./acegilogin.zul"));
    }
View Full Code Here

    //Copy first since event thread clean up them, when completed
    final Configuration config =
      _proc.getDesktop().getWebApp().getConfiguration();
    final Component comp = getComponent();
    final Event event = getEvent();
    try {
      _evtThdResumes = config.newEventThreadResumes(comp, event);

      //Spec: locking mutex is optional for app developers
      //so we have to lock it first
View Full Code Here

         
        }
      }
     
      //fire onValidate for target component
      Events.sendEvent(new Event("onBindingValidate", target));
     
      //saveAttribute for each binding
      Component loadOnSaveProxy = null;
      Component dataTarget = null;
      DataBinder binder = null;
      final List loadOnSaveInfos = new ArrayList(tmplist.size());
      for(final Iterator it = tmplist.iterator();it.hasNext();) {
        final BindingInfo bi = (BindingInfo) it.next();
        dataTarget = bi.getComponent();
        final Binding binding = bi.getBinding();
        if (binder == null) {
          binder = binding.getBinder();
        }
        final Object[] vals = bi.getAttributeValues();
        binding.saveAttributeValue(dataTarget, vals, loadOnSaveInfos, triggerEventName);
        if (loadOnSaveProxy == null && dataTarget.isListenerAvailable("onLoadOnSave", true)) {
          loadOnSaveProxy = dataTarget;
        }
      }
     
      //bug #1895856 : data binding LoadOnSave works only on the last save-when component
      //do loadOnSave
      //if (dataTarget != null) {
      //    Events.postEvent(new Event("onLoadOnSave", dataTarget, loadOnSaveInfos));
      //  }
     
      // (use first working dataTarget as proxy)
      //feature#2990932, allow disable load-on-save mechanism
      if (loadOnSaveProxy != null && binder.isLoadOnSave()) {
        Events.postEvent(new Event("onLoadOnSave", loadOnSaveProxy, loadOnSaveInfos));
      }
     
    }
View Full Code Here

      new Object[] {this, currentNode, binding, (refChanged ? val : bean), Boolean.valueOf(refChanged), nodes, comp, triggerEventName};
    if (loadOnSaveInfos != null) {
      loadOnSaveInfos.add(loadOnSaveInfo);
    } else if (isLoadOnSave()) { //feature#2990932, allow disable load-on-save mechanism
      //do loadOnSave immediately
      Events.postEvent(new Event("onLoadOnSave", comp, loadOnSaveInfo));
    }
  }
View Full Code Here

   */
  public void service(AuRequest request, boolean everError) {
    final String cmd = request.getCommand();
    if ("echo".equals(cmd)) {
      final List data2 = (List)request.getData().get("");
      Events.postEvent(new Event((String)data2.get(0), this,
        data2.size() > 1 ? AuEcho.getData(this, data2.get(1)): null));
    } else if ("setAttr".equals(cmd)) {
      final List data2 = (List)request.getData().get("");
      updateByClient((String)data2.get(0), data2.get(1));
    } else
View Full Code Here

  }

  //Override//
  public void onClose() {
    if (_listener != null) {
      final Event evt = new Event(Events.ON_CLOSE, this, new Integer(-1));
      try {
        _listener.onEvent(evt);
        if (!evt.isPropagatable())
          return; //no more processing
      } catch (Exception ex) {
        throw UiException.Aide.wrap(ex);
      }
    }
View Full Code Here

TOP

Related Classes of org.zkoss.zk.ui.event.Event

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.