Search in sources :

Example 1 with WRecordAccessDialog

use of org.adempiere.webui.window.WRecordAccessDialog in project adempiere by adempiere.

the class AbstractADWindowPanel method onLock.

/**
	 *	@see ToolbarListener#onLock()
	 */
public void onLock() {
    if (!toolbar.isPersonalLock)
        return;
    final int record_ID = curTab.getRecord_ID();
    if (//	No Key
    record_ID == -1)
        return;
    if (m_popup == null) {
        m_popup = new Menupopup();
        m_lock = new Menuitem(Msg.translate(Env.getCtx(), "Lock"));
        m_popup.appendChild(m_lock);
        m_lock.addEventListener(Events.ON_CLICK, new EventListener() {

            public void onEvent(Event event) throws Exception {
                curTab.lock(Env.getCtx(), curTab.getRecord_ID(), !toolbar.getButton("Lock").isPressed());
                //	reload
                curTab.loadAttachments();
                toolbar.lock(curTab.isLocked());
            }
        });
        m_access = new Menuitem(Msg.translate(Env.getCtx(), "RecordAccessDialog"));
        m_popup.appendChild(m_access);
        m_access.addEventListener(Events.ON_CLICK, new EventListener() {

            public void onEvent(Event event) throws Exception {
                new WRecordAccessDialog(null, curTab.getAD_Table_ID(), curTab.getRecord_ID());
                toolbar.lock(curTab.isLocked());
            }
        });
        m_popup.setPage(toolbar.getButton("Lock").getPage());
    }
    m_popup.open(toolbar.getButton("Lock"));
}
Also used : Menupopup(org.zkoss.zul.Menupopup) Menuitem(org.zkoss.zul.Menuitem) DataStatusEvent(org.compiere.model.DataStatusEvent) Event(org.zkoss.zk.ui.event.Event) ActionEvent(org.adempiere.webui.event.ActionEvent) EventListener(org.zkoss.zk.ui.event.EventListener) WRecordAccessDialog(org.adempiere.webui.window.WRecordAccessDialog) ApplicationException(org.adempiere.webui.exception.ApplicationException)

Aggregations

ActionEvent (org.adempiere.webui.event.ActionEvent)1 ApplicationException (org.adempiere.webui.exception.ApplicationException)1 WRecordAccessDialog (org.adempiere.webui.window.WRecordAccessDialog)1 DataStatusEvent (org.compiere.model.DataStatusEvent)1 Event (org.zkoss.zk.ui.event.Event)1 EventListener (org.zkoss.zk.ui.event.EventListener)1 Menuitem (org.zkoss.zul.Menuitem)1 Menupopup (org.zkoss.zul.Menupopup)1