Search in sources :

Example 1 with AuScript

use of org.zkoss.zk.au.out.AuScript in project adempiere by adempiere.

the class GridPanel method focusToRow.

private void focusToRow(org.zkoss.zul.Row row) {
    if (renderer.isEditing()) {
        if (columnOnClick != null && columnOnClick.trim().length() > 0) {
            setFocusToField(columnOnClick);
            columnOnClick = null;
        } else {
            renderer.setFocusToEditor();
        }
    } else {
        Component cmp = null;
        List<?> childs = row.getChildren();
        for (Object o : childs) {
            Component c = (Component) o;
            if (!c.isVisible())
                continue;
            c = c.getFirstChild();
            if (c == null)
                continue;
            if (c.getNextSibling() != null) {
                cmp = c.getNextSibling();
                break;
            }
        }
        if (cmp != null)
            Clients.response(new AuScript(null, "scrollToRow('" + cmp.getUuid() + "');"));
        if (columnOnClick != null && columnOnClick.trim().length() > 0) {
            List<?> list = row.getChildren();
            for (Object element : list) {
                if (element instanceof Div) {
                    Div div = (Div) element;
                    if (columnOnClick.equals(div.getAttribute("columnName"))) {
                        cmp = div.getFirstChild().getNextSibling();
                        Clients.response(new AuScript(null, "scrollToRow('" + cmp.getUuid() + "');"));
                        break;
                    }
                }
            }
            columnOnClick = null;
        }
    }
}
Also used : Div(org.zkoss.zul.Div) AbstractComponent(org.zkoss.zk.ui.AbstractComponent) Component(org.zkoss.zk.ui.Component) HtmlBasedComponent(org.zkoss.zk.ui.HtmlBasedComponent) AuScript(org.zkoss.zk.au.out.AuScript)

Example 2 with AuScript

use of org.zkoss.zk.au.out.AuScript in project adempiere by adempiere.

the class BrowserToken method save.

/**
	 * save session and user as client side token for future auto login
	 * @param session
	 * @param user
	 */
public static void save(MSession session, MUser user) {
    try {
        String home = getHomeToken();
        String hash = getPasswordHash(session, user);
        String script = "adempiere.saveUserToken('" + home + "', '" + hash + "', '" + session.getAD_Session_ID() + "');";
        AuScript aus = new AuScript(null, script);
        Clients.response("saveUserToken", aus);
    } catch (Exception e) {
        log.log(Level.WARNING, e.getLocalizedMessage(), e);
    }
}
Also used : NoSuchAlgorithmException(java.security.NoSuchAlgorithmException) UnsupportedEncodingException(java.io.UnsupportedEncodingException) AuScript(org.zkoss.zk.au.out.AuScript)

Example 3 with AuScript

use of org.zkoss.zk.au.out.AuScript in project adempiere by adempiere.

the class BrowserToken method remove.

/**
	 * remove client side token for auto login
	 */
public static void remove() {
    try {
        String home = getHomeToken();
        String script = "adempiere.removeUserToken('" + home + "');";
        AuScript aus = new AuScript(null, script);
        Clients.response("removeUserToken", aus);
    } catch (Exception e) {
        log.log(Level.WARNING, e.getLocalizedMessage(), e);
    }
}
Also used : NoSuchAlgorithmException(java.security.NoSuchAlgorithmException) UnsupportedEncodingException(java.io.UnsupportedEncodingException) AuScript(org.zkoss.zk.au.out.AuScript)

Example 4 with AuScript

use of org.zkoss.zk.au.out.AuScript in project adempiere by adempiere.

the class BrowserToken method load.

/**
	 * load stored client side token for auto login
	 * @param cmpid
	 */
public static void load(String cmpid) {
    //remember me
    try {
        String home = getHomeToken();
        String script = "adempiere.findUserToken('" + cmpid + "', '" + home + "');";
        AuScript aus = new AuScript(null, script);
        Clients.response("findUserToken", aus);
    } catch (Exception e) {
        log.log(Level.WARNING, e.getLocalizedMessage(), e);
    }
}
Also used : NoSuchAlgorithmException(java.security.NoSuchAlgorithmException) UnsupportedEncodingException(java.io.UnsupportedEncodingException) AuScript(org.zkoss.zk.au.out.AuScript)

Example 5 with AuScript

use of org.zkoss.zk.au.out.AuScript in project adempiere by adempiere.

the class ThemeUtils method sendDeferLayoutEvent.

/**
	 * @param layout
	 */
public static void sendDeferLayoutEvent(Borderlayout layout, int timeout) {
    StringBuilder content = new StringBuilder();
    content.append("ad_deferRenderBorderLayout('").append(layout.getUuid()).append("',").append(timeout).append(");");
    AuScript as = new AuScript(null, content.toString());
    Clients.response("deferRenderBorderLayout", as);
}
Also used : AuScript(org.zkoss.zk.au.out.AuScript)

Aggregations

AuScript (org.zkoss.zk.au.out.AuScript)12 UnsupportedEncodingException (java.io.UnsupportedEncodingException)3 NoSuchAlgorithmException (java.security.NoSuchAlgorithmException)3 ApplicationException (org.adempiere.webui.exception.ApplicationException)1 MSession (org.compiere.model.MSession)1 MUser (org.compiere.model.MUser)1 KeyNamePair (org.compiere.util.KeyNamePair)1 Language (org.compiere.util.Language)1 Login (org.compiere.util.Login)1 Text (org.zkoss.zhtml.Text)1 AbstractComponent (org.zkoss.zk.ui.AbstractComponent)1 Component (org.zkoss.zk.ui.Component)1 HtmlBasedComponent (org.zkoss.zk.ui.HtmlBasedComponent)1 Session (org.zkoss.zk.ui.Session)1 WrongValueException (org.zkoss.zk.ui.WrongValueException)1 Div (org.zkoss.zul.Div)1