Search in sources :

Example 1 with Menupopup

use of org.zkoss.zul.Menupopup 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)

Example 2 with Menupopup

use of org.zkoss.zul.Menupopup in project adempiere by adempiere.

the class WReport method showPopup.

//	getPrintFormats
private void showPopup() {
    m_popup = new Menupopup();
    for (int i = 0; i < m_list.size(); i++) {
        KeyNamePair pp = (KeyNamePair) m_list.get(i);
        Menuitem menuitem = new Menuitem(pp.getName());
        menuitem.setValue(i + "");
        menuitem.addEventListener(Events.ON_CLICK, this);
        m_popup.appendChild(menuitem);
    }
    m_popup.setPage(parent.getPage());
    m_popup.open(parent);
}
Also used : Menupopup(org.zkoss.zul.Menupopup) Menuitem(org.zkoss.zul.Menuitem) KeyNamePair(org.compiere.util.KeyNamePair)

Example 3 with Menupopup

use of org.zkoss.zul.Menupopup in project adempiere by adempiere.

the class ADTreeOnDropListener method moveNode.

/**
	 *	Move TreeNode
	 *	@param	movingNode	The node to be moved
	 *	@param	toNode		The target node
	 */
private void moveNode(DefaultTreeNode movingNode, DefaultTreeNode toNode) {
    log.info(movingNode.toString() + " to " + toNode.toString());
    if (movingNode == toNode)
        return;
    MTreeNode toMNode = (MTreeNode) toNode.getData();
    DefaultTreeNode newParent;
    int index;
    if (//	drop on a child node
    !toMNode.isSummary()) {
        moveNode(movingNode, toNode, false);
    } else //	drop on a summary node
    {
        //prompt user to select insert after or drop into the summary node
        int[] path = treeModel.getPath(toNode);
        Treeitem toItem = tree.renderItemByPath(path);
        tree.setSelectedItem(toItem);
        Events.sendEvent(tree, new Event(Events.ON_SELECT, tree));
        MenuListener listener = new MenuListener(movingNode, toNode);
        //TODO: translation
        Menupopup popup = new Menupopup();
        Menuitem menuItem = new Menuitem("Insert After");
        menuItem.setValue("InsertAfter");
        menuItem.setParent(popup);
        menuItem.addEventListener(Events.ON_CLICK, listener);
        menuItem = new Menuitem("Move Into");
        menuItem.setValue("MoveInto");
        menuItem.setParent(popup);
        menuItem.addEventListener(Events.ON_CLICK, listener);
        popup.setPage(tree.getPage());
        popup.open(toItem.getTreerow());
    }
}
Also used : MTreeNode(org.compiere.model.MTreeNode) Treeitem(org.zkoss.zul.Treeitem) Menupopup(org.zkoss.zul.Menupopup) Menuitem(org.zkoss.zul.Menuitem) DefaultTreeNode(org.zkoss.zul.DefaultTreeNode) Event(org.zkoss.zk.ui.event.Event) DropEvent(org.zkoss.zk.ui.event.DropEvent)

Example 4 with Menupopup

use of org.zkoss.zul.Menupopup in project collect by openforis.

the class SchemaVM method refreshSelectedTreeNode.

protected void refreshSelectedTreeNode(Component view) {
    Treeitem selectedItem = nodesTree.getSelectedItem();
    SchemaTreeNode treeNode = selectedItem.getValue();
    SchemaNodeData data = treeNode.getData();
    // update context menu
    Menupopup popupMenu = getPopupMenu(data);
    selectedItem.setContext(popupMenu);
}
Also used : Treeitem(org.zkoss.zul.Treeitem) SchemaTreeNode(org.openforis.collect.designer.component.SchemaTreeModel.SchemaTreeNode) Menupopup(org.zkoss.zul.Menupopup) SchemaNodeData(org.openforis.collect.designer.component.SchemaTreeModel.SchemaNodeData)

Aggregations

Menupopup (org.zkoss.zul.Menupopup)4 Menuitem (org.zkoss.zul.Menuitem)3 Event (org.zkoss.zk.ui.event.Event)2 Treeitem (org.zkoss.zul.Treeitem)2 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 MTreeNode (org.compiere.model.MTreeNode)1 KeyNamePair (org.compiere.util.KeyNamePair)1 SchemaNodeData (org.openforis.collect.designer.component.SchemaTreeModel.SchemaNodeData)1 SchemaTreeNode (org.openforis.collect.designer.component.SchemaTreeModel.SchemaTreeNode)1 DropEvent (org.zkoss.zk.ui.event.DropEvent)1 EventListener (org.zkoss.zk.ui.event.EventListener)1 DefaultTreeNode (org.zkoss.zul.DefaultTreeNode)1