IDEMPIERE-3966 cph::erp menu shortcut and use enter
This commit is contained in:
parent
042740a2dc
commit
a2fcb2f550
|
@ -250,7 +250,7 @@ public class AdempiereWebUI extends Window implements EventListener<Event>, IWeb
|
|||
|
||||
keyListener = new Keylistener();
|
||||
keyListener.setPage(this.getPage());
|
||||
keyListener.setCtrlKeys("@a@c@d@e@f@h@n@o@p@r@s@t@z@x@#left@#right@#up@#down@#home@#end#enter^u@u@#pgdn@#pgup");
|
||||
keyListener.setCtrlKeys("@a@c@d@e@f@h@m@n@o@p@r@s@t@z@x@#left@#right@#up@#down@#home@#end#enter^u@u@#pgdn@#pgup");
|
||||
keyListener.setAutoBlur(false);
|
||||
|
||||
//create new desktop
|
||||
|
|
|
@ -99,7 +99,7 @@ public abstract class AbstractMenuPanel extends Panel implements EventListener<E
|
|||
menuTree.setId("mnuMain");
|
||||
ZKUpdateUtil.setVflex(menuTree, "1");
|
||||
menuTree.setSizedByContent(false);
|
||||
menuTree.setPageSize(-1); // Due to bug in the new paging functionality
|
||||
menuTree.setPageSize(-1); // Due to bug in the new paging functionality
|
||||
}
|
||||
|
||||
private void initMenu(MTreeNode rootNode)
|
||||
|
@ -165,7 +165,6 @@ public abstract class AbstractMenuPanel extends Panel implements EventListener<E
|
|||
treeRow.appendChild(treeCell);
|
||||
A link = new A();
|
||||
treeCell.appendChild(link);
|
||||
|
||||
if (mChildNode.isReport())
|
||||
{
|
||||
if (ThemeManager.isUseFontIconForImage())
|
||||
|
@ -218,11 +217,11 @@ public abstract class AbstractMenuPanel extends Panel implements EventListener<E
|
|||
treeCell.appendChild(newBtn);
|
||||
newBtn.addEventListener(Events.ON_CLICK, this);
|
||||
}
|
||||
treeitem.addEventListener(Events.ON_OK, this);
|
||||
link.setLabel(mChildNode.getName());
|
||||
|
||||
link.addEventListener(Events.ON_CLICK, this);
|
||||
link.setSclass("menu-href");
|
||||
|
||||
treeitem.getTreerow().setDraggable("favourite"); // Elaine 2008/07/24
|
||||
treeitem.setAttribute(MenuSearchController.M_TREE_NODE_ATTR, mChildNode);
|
||||
}
|
||||
|
@ -245,7 +244,7 @@ public abstract class AbstractMenuPanel extends Panel implements EventListener<E
|
|||
{
|
||||
Component comp = event.getTarget();
|
||||
String eventName = event.getName();
|
||||
if (eventName.equals(Events.ON_CLICK))
|
||||
if ((eventName.equals(Events.ON_CLICK)) || (eventName.equals(Events.ON_OK)))
|
||||
{
|
||||
doOnClick(comp, event.getData());
|
||||
}
|
||||
|
@ -262,6 +261,21 @@ public abstract class AbstractMenuPanel extends Panel implements EventListener<E
|
|||
} else if (eventData != null && eventData instanceof Boolean) {
|
||||
newRecord = (Boolean)eventData;
|
||||
}
|
||||
if (comp instanceof Treeitem)
|
||||
{
|
||||
Treeitem selectedItem = (Treeitem) comp;
|
||||
if(selectedItem.getValue() != null)
|
||||
{
|
||||
if (newRecord)
|
||||
{
|
||||
onNewRecord(selectedItem);
|
||||
}
|
||||
else
|
||||
{
|
||||
fireMenuSelectedEvent(selectedItem);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (comp instanceof Treerow)
|
||||
{
|
||||
Treeitem selectedItem = (Treeitem) comp.getParent();
|
||||
|
|
|
@ -22,6 +22,7 @@ import org.adempiere.webui.LayoutUtils;
|
|||
import org.adempiere.webui.apps.GlobalSearch;
|
||||
import org.adempiere.webui.apps.MenuSearchController;
|
||||
import org.adempiere.webui.component.Panel;
|
||||
import org.adempiere.webui.session.SessionManager;
|
||||
import org.adempiere.webui.theme.ThemeManager;
|
||||
import org.adempiere.webui.util.ZKUpdateUtil;
|
||||
import org.adempiere.webui.window.AboutWindow;
|
||||
|
@ -33,6 +34,7 @@ import org.zkoss.zk.ui.Page;
|
|||
import org.zkoss.zk.ui.event.Event;
|
||||
import org.zkoss.zk.ui.event.EventListener;
|
||||
import org.zkoss.zk.ui.event.Events;
|
||||
import org.zkoss.zk.ui.event.KeyEvent;
|
||||
import org.zkoss.zk.ui.event.OpenEvent;
|
||||
import org.zkoss.zul.Image;
|
||||
import org.zkoss.zul.Popup;
|
||||
|
@ -82,6 +84,7 @@ public class HeaderPanel extends Panel implements EventListener<Event>
|
|||
LayoutUtils.addSclass("mobile", this);
|
||||
ClientInfo.onClientInfo(this, this::onClientInfo);
|
||||
}
|
||||
SessionManager.getSessionApplication().getKeylistener().addEventListener(Events.ON_CTRL_KEY, this);
|
||||
}
|
||||
|
||||
protected void createPopupMenu() {
|
||||
|
@ -126,6 +129,17 @@ public class HeaderPanel extends Panel implements EventListener<Event>
|
|||
}
|
||||
} else if (Events.ON_CREATE.equals(event.getName())) {
|
||||
onCreate();
|
||||
}else if (event instanceof KeyEvent)
|
||||
{
|
||||
//alt+m for the menu
|
||||
KeyEvent ke = (KeyEvent) event;
|
||||
if (ke.getKeyCode() == 77)
|
||||
{
|
||||
popMenu.open(btnMenu, "after_start");
|
||||
popMenu.setFocus(true);
|
||||
}else if (ke.getKeyCode() == 27) {
|
||||
popMenu.close();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue