IDEMPIERE 369 - Master Detail Improvements. Mouse over to show the menu for sibling tabs.

This commit is contained in:
Heng Sin Low 2012-12-06 18:24:45 +08:00
parent 529089a426
commit f0c67833e7
1 changed files with 21 additions and 7 deletions

View File

@ -56,7 +56,7 @@ import org.zkoss.zul.Space;
* @author hengsin * @author hengsin
* *
*/ */
public class BreadCrumb extends Div implements EventListener<Event>{ public class BreadCrumb extends Div implements EventListener<Event> {
private static final String INFO_INDICATOR_IMAGE = "/images/InfoIndicator16.png"; private static final String INFO_INDICATOR_IMAGE = "/images/InfoIndicator16.png";
@ -75,6 +75,7 @@ public class BreadCrumb extends Div implements EventListener<Event>{
private LinkedHashMap<String, String> links; private LinkedHashMap<String, String> links;
@SuppressWarnings("unused")
private int windowNo; private int windowNo;
private HashMap<String, ToolBarButton> buttons = new HashMap<String, ToolBarButton>(); private HashMap<String, ToolBarButton> buttons = new HashMap<String, ToolBarButton>();
@ -100,6 +101,8 @@ public class BreadCrumb extends Div implements EventListener<Event>{
private Caption msgPopupCaption; private Caption msgPopupCaption;
protected Menupopup linkPopup;
/** /**
* *
*/ */
@ -192,21 +195,30 @@ public class BreadCrumb extends Div implements EventListener<Event>{
this.links = links; this.links = links;
final Label pathLabel = (Label) layout.getChildren().get(layout.getChildren().size()-2); final Label pathLabel = (Label) layout.getChildren().get(layout.getChildren().size()-2);
pathLabel.setStyle("cursor: pointer; font-weight: bold"); pathLabel.setStyle("cursor: pointer; font-weight: bold");
pathLabel.addEventListener(Events.ON_CLICK, new EventListener<Event>() { EventListener<Event> listener = new EventListener<Event>() {
@Override @Override
public void onEvent(Event event) throws Exception { public void onEvent(Event event) throws Exception {
Menupopup popup = new Menupopup(); if (linkPopup != null ) {
System.out.println(linkPopup.getPage());
if (linkPopup.getPage() != null && linkPopup.isVisible()) {
return;
}
}
linkPopup = new Menupopup();
for(Map.Entry<String, String>entry : BreadCrumb.this.links.entrySet()) { for(Map.Entry<String, String>entry : BreadCrumb.this.links.entrySet()) {
final Menuitem item = new Menuitem(); final Menuitem item = new Menuitem();
item.setLabel(entry.getValue()); item.setLabel(entry.getValue());
item.setValue(entry.getKey()); item.setValue(entry.getKey());
item.addEventListener(Events.ON_CLICK, BreadCrumb.this); item.addEventListener(Events.ON_CLICK, BreadCrumb.this);
popup.appendChild(item); linkPopup.appendChild(item);
} }
popup.setPage(pathLabel.getPage()); linkPopup.setPage(pathLabel.getPage());
popup.open(pathLabel); linkPopup.open(pathLabel);
} }
}); };
pathLabel.addEventListener(Events.ON_CLICK, listener);
pathLabel.addEventListener(Events.ON_MOUSE_OVER, listener);
} }
@Override @Override
@ -443,6 +455,8 @@ public class BreadCrumb extends Div implements EventListener<Event>{
super.onPageDetached(page); super.onPageDetached(page);
if (msgPopup != null) if (msgPopup != null)
msgPopup.detach(); msgPopup.detach();
if (linkPopup != null)
linkPopup.detach();
} }
public void setNavigationToolbarVisibility(boolean visible) { public void setNavigationToolbarVisibility(boolean visible) {