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"));
}
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);
}
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());
}
}
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);
}
Aggregations