IDEMPIERE-406 Whole page block after drag and drop duplicated menu item into Favourites Portlet. Note that you might need to clear your browser cache to get the updated css fix.

This commit is contained in:
Heng Sin Low 2012-08-29 13:14:14 +08:00
parent 95e992bbe2
commit e34cbee678
2 changed files with 49 additions and 72 deletions

View File

@ -15,7 +15,6 @@ package org.adempiere.webui.dashboard;
import java.util.Enumeration;
import org.adempiere.exceptions.DBException;
import org.adempiere.webui.apps.AEnv;
import org.adempiere.webui.event.TouchEventHelper;
import org.adempiere.webui.exception.ApplicationException;
@ -28,7 +27,6 @@ import org.compiere.model.MQuery;
import org.compiere.model.MTree;
import org.compiere.model.MTreeNode;
import static org.compiere.model.SystemIDs.*;
import org.compiere.util.CLogger;
import org.compiere.util.DB;
import org.compiere.util.Env;
import org.compiere.util.Msg;
@ -130,18 +128,26 @@ public class DPFavourites extends DashboardPanel implements EventListener<Event>
{
MTreeNode nd = (MTreeNode)en.nextElement();
if (nd.isOnBar()) {
addNode(nd.getNode_ID(), nd.toString().trim(), nd.getDescription(), getIconFile(nd), nd.isWindow());
}
}
}
lblMsg = new Label("(Drag and drop menu item here)");
if(bxFav.getChildren().isEmpty()) bxFav.appendChild(lblMsg);
}
protected void addNode(int nodeId, String label, String description, String imageSrc, boolean addNewBtn) {
Hbox hbox = new Hbox();
hbox.setSpacing("0px");
bxFav.appendChild(hbox);
String label = nd.toString().trim();
A btnFavItem = new A();
btnFavItem.setAttribute(NODE_ID_ATTR, String.valueOf(nd.getNode_ID()));
btnFavItem.setAttribute(NODE_ID_ATTR, String.valueOf(nodeId));
hbox.appendChild(btnFavItem);
btnFavItem.setLabel(label);
btnFavItem.setTooltiptext(nd.getDescription());
btnFavItem.setImage(getIconFile(nd));
btnFavItem.setTooltiptext(description);
btnFavItem.setImage(imageSrc);
btnFavItem.setDraggable(DELETE_FAV_DROPPABLE);
btnFavItem.addEventListener(Events.ON_CLICK, this);
btnFavItem.addEventListener(Events.ON_DROP, this);
@ -160,22 +166,16 @@ public class DPFavourites extends DashboardPanel implements EventListener<Event>
}
}
if (nd.isWindow())
if (addNewBtn)
{
Toolbarbutton newBtn = new Toolbarbutton(null, "/images/New10.png");
newBtn.setAttribute(NODE_ID_ATTR, String.valueOf(nd.getNode_ID()));
newBtn.setAttribute(NODE_ID_ATTR, String.valueOf(nodeId));
hbox.appendChild(newBtn);
newBtn.addEventListener(Events.ON_CLICK, this);
newBtn.setSclass("fav-new-btn");
newBtn.setTooltiptext(Util.cleanAmp(Msg.getMsg(Env.getCtx(), "New")));
}
}
}
}
lblMsg = new Label("(Drag and drop menu item here)");
if(bxFav.getChildren().isEmpty()) bxFav.appendChild(lblMsg);
}
/**
* Make Bar add/remove persistent
@ -338,10 +338,6 @@ public class DPFavourites extends DashboardPanel implements EventListener<Event>
String menuType = (String) treeitem.getAttribute("menu.type");
boolean isWindow = menuType != null && menuType.equals("window");
Hbox hbox = new Hbox();
hbox.setSpacing("0px");
bxFav.appendChild(hbox);
String label = null;
String image = null;
if (treeitem.getLabel() != null && treeitem.getLabel().trim().length() > 0)
@ -355,32 +351,9 @@ public class DPFavourites extends DashboardPanel implements EventListener<Event>
label = link.getLabel();
image = link.getImage();
}
A btnFavItem = new A();
hbox.appendChild(btnFavItem);
btnFavItem.setAttribute(NODE_ID_ATTR, String.valueOf(Node_ID));
btnFavItem.setLabel(label);
btnFavItem.setImage(image);
btnFavItem.setDraggable(DELETE_FAV_DROPPABLE);
btnFavItem.addEventListener(Events.ON_CLICK, this);
btnFavItem.addEventListener(Events.ON_DROP, this);
btnFavItem.setSclass("menu-href");
if (AEnv.isTablet()) {
TouchEventHelper.addOnTapEventListener(btnFavItem, this);
}
if (isWindow)
{
Toolbarbutton newBtn = new Toolbarbutton(null, "/images/New10.png");
newBtn.setAttribute(NODE_ID_ATTR, String.valueOf(Node_ID));
newBtn.setStyle("margin-bottom:5px");
hbox.appendChild(newBtn);
newBtn.addEventListener(Events.ON_CLICK, this);
}
bxFav.removeChild(lblMsg);
bxFav.invalidate();
addNode(Node_ID, label, treeitem.getTooltiptext(), image, isWindow);
} else {
if (DBException.isUniqueContraintError(CLogger.retrieveException()))
FDialog.error(0, this, "BookmarkExist", null);
}
}

View File

@ -876,6 +876,10 @@ div.simileAjax-bubble-container {
background-image: none;
}
.z-window-highlighted {
z-index: 1900 !important;
}
.grid-layout {
border: none !important;
margin: 0 !important;