FR [2931852] - Show dialog box on Add to Bar for already existig window

http://sourceforge.net/support/tracker.php?aid=2931852
This commit is contained in:
Carlos Ruiz 2011-03-26 01:18:02 -05:00
parent e8d6370699
commit 9687466c7f
2 changed files with 10 additions and 3 deletions

View File

@ -62,6 +62,7 @@ import javax.swing.plaf.basic.BasicSplitPaneUI;
import javax.swing.tree.DefaultTreeSelectionModel;
import javax.swing.tree.TreePath;
import org.adempiere.exceptions.DBException;
import org.adempiere.plaf.AdempierePLAF;
import org.adempiere.plaf.AdempiereTaskPaneUI;
import org.compiere.apps.ADialog;
@ -811,7 +812,7 @@ public final class VTreePanel extends CPanel
MTreeNode nd = (MTreeNode)tree.getSelectionPath().getLastPathComponent();
if (barDBupdate(true, nd.getNode_ID()))
addToBar(nd,getParentToolBar(nd), false);
else if (CLogger.retrieveException().getMessage().indexOf("ORA-00001")!=-1)
else if (DBException.isUniqueContraintError(CLogger.retrieveException()))
ADialog.error(0, this, "BookmarkExist", null);
} // barAdd

View File

@ -15,10 +15,13 @@ package org.adempiere.webui.dashboard;
import java.util.Enumeration;
import org.adempiere.exceptions.DBException;
import org.adempiere.webui.component.ToolBarButton;
import org.adempiere.webui.session.SessionManager;
import org.adempiere.webui.window.FDialog;
import org.compiere.model.MTree;
import org.compiere.model.MTreeNode;
import org.compiere.util.CLogger;
import org.compiere.util.DB;
import org.compiere.util.Env;
import org.zkoss.zk.ui.Component;
@ -101,11 +104,11 @@ public class DPFavourites extends DashboardPanel implements EventListener {
MTree vTree = new MTree(Env.getCtx(), AD_Tree_ID, false, true, null);
MTreeNode m_root = vTree.getRoot();
Enumeration enTop = m_root.children();
Enumeration<?> enTop = m_root.children();
while(enTop.hasMoreElements())
{
MTreeNode ndTop = (MTreeNode)enTop.nextElement();
Enumeration en = ndTop.preorderEnumeration();
Enumeration<?> en = ndTop.preorderEnumeration();
while (en.hasMoreElements())
{
MTreeNode nd = (MTreeNode)en.nextElement();
@ -247,6 +250,9 @@ public class DPFavourites extends DashboardPanel implements EventListener {
bxFav.appendChild(btnFavItem);
bxFav.removeChild(lblMsg);
bxFav.invalidate();
} else {
if (DBException.isUniqueContraintError(CLogger.retrieveException()))
FDialog.error(0, this, "BookmarkExist", null);
}
}
}