IDEMPIERE-192 Zk6: Fixed alignment issue for the application menu tree panel
This commit is contained in:
parent
acedf65ff7
commit
88aadea54d
|
@ -22,6 +22,7 @@ import java.util.Enumeration;
|
||||||
import java.util.Properties;
|
import java.util.Properties;
|
||||||
|
|
||||||
import org.adempiere.webui.component.Checkbox;
|
import org.adempiere.webui.component.Checkbox;
|
||||||
|
import org.adempiere.webui.component.ToolBarButton;
|
||||||
import org.adempiere.webui.event.MenuListener;
|
import org.adempiere.webui.event.MenuListener;
|
||||||
import org.adempiere.webui.exception.ApplicationException;
|
import org.adempiere.webui.exception.ApplicationException;
|
||||||
import org.adempiere.webui.session.SessionManager;
|
import org.adempiere.webui.session.SessionManager;
|
||||||
|
@ -31,10 +32,12 @@ import org.compiere.model.MTreeNode;
|
||||||
import org.compiere.util.DB;
|
import org.compiere.util.DB;
|
||||||
import org.compiere.util.Env;
|
import org.compiere.util.Env;
|
||||||
import org.compiere.util.Msg;
|
import org.compiere.util.Msg;
|
||||||
|
import org.compiere.util.Util;
|
||||||
import org.zkoss.zk.ui.Component;
|
import org.zkoss.zk.ui.Component;
|
||||||
import org.zkoss.zk.ui.event.Event;
|
import org.zkoss.zk.ui.event.Event;
|
||||||
import org.zkoss.zk.ui.event.EventListener;
|
import org.zkoss.zk.ui.event.EventListener;
|
||||||
import org.zkoss.zk.ui.event.Events;
|
import org.zkoss.zk.ui.event.Events;
|
||||||
|
import org.zkoss.zk.ui.util.Clients;
|
||||||
import org.zkoss.zul.Panel;
|
import org.zkoss.zul.Panel;
|
||||||
import org.zkoss.zul.Panelchildren;
|
import org.zkoss.zul.Panelchildren;
|
||||||
import org.zkoss.zul.Toolbar;
|
import org.zkoss.zul.Toolbar;
|
||||||
|
@ -53,7 +56,8 @@ import org.zkoss.zul.Treerow;
|
||||||
*/
|
*/
|
||||||
public class MenuPanel extends Panel implements EventListener
|
public class MenuPanel extends Panel implements EventListener
|
||||||
{
|
{
|
||||||
/**
|
private static final String ON_EXPAND_MENU_EVENT = "onExpandMenu";
|
||||||
|
/**
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
private static final long serialVersionUID = -593280866781665891L;
|
private static final long serialVersionUID = -593280866781665891L;
|
||||||
|
@ -62,7 +66,7 @@ public class MenuPanel extends Panel implements EventListener
|
||||||
private Tree menuTree;
|
private Tree menuTree;
|
||||||
private ArrayList<MenuListener> menuListeners = new ArrayList<MenuListener>();
|
private ArrayList<MenuListener> menuListeners = new ArrayList<MenuListener>();
|
||||||
|
|
||||||
private Checkbox chkExpand; // Elaine 2009/02/27 - expand tree
|
private ToolBarButton expandToggle;
|
||||||
|
|
||||||
public MenuPanel()
|
public MenuPanel()
|
||||||
{
|
{
|
||||||
|
@ -92,7 +96,7 @@ public class MenuPanel extends Panel implements EventListener
|
||||||
menuTree.setId("mnuMain");
|
menuTree.setId("mnuMain");
|
||||||
menuTree.setWidth("100%");
|
menuTree.setWidth("100%");
|
||||||
menuTree.setVflex(true);
|
menuTree.setVflex(true);
|
||||||
menuTree.setFixedLayout(false);
|
menuTree.setSizedByContent(true);
|
||||||
menuTree.setPageSize(-1); // Due to bug in the new paging functionality
|
menuTree.setPageSize(-1); // Due to bug in the new paging functionality
|
||||||
|
|
||||||
menuTree.setStyle("border: none");
|
menuTree.setStyle("border: none");
|
||||||
|
@ -100,6 +104,7 @@ public class MenuPanel extends Panel implements EventListener
|
||||||
pnlSearch = new TreeSearchPanel(menuTree);
|
pnlSearch = new TreeSearchPanel(menuTree);
|
||||||
|
|
||||||
Toolbar toolbar = new Toolbar();
|
Toolbar toolbar = new Toolbar();
|
||||||
|
toolbar.setMold("panel");
|
||||||
toolbar.appendChild(pnlSearch);
|
toolbar.appendChild(pnlSearch);
|
||||||
this.appendChild(toolbar);
|
this.appendChild(toolbar);
|
||||||
|
|
||||||
|
@ -109,11 +114,16 @@ public class MenuPanel extends Panel implements EventListener
|
||||||
|
|
||||||
// Elaine 2009/02/27 - expand tree
|
// Elaine 2009/02/27 - expand tree
|
||||||
toolbar = new Toolbar();
|
toolbar = new Toolbar();
|
||||||
chkExpand = new Checkbox();
|
toolbar.setStyle("verticle-align: middle; padding: 2px");
|
||||||
chkExpand.setText(Msg.getMsg(Env.getCtx(), "ExpandTree"));
|
expandToggle = new ToolBarButton();
|
||||||
chkExpand.addEventListener(Events.ON_CHECK, this);
|
expandToggle.setLabel(Util.cleanAmp(Msg.getMsg(Env.getCtx(), "ExpandTree")));
|
||||||
toolbar.appendChild(chkExpand);
|
expandToggle.setMode("toggle");
|
||||||
|
expandToggle.addEventListener(Events.ON_CHECK, this);
|
||||||
|
toolbar.appendChild(expandToggle);
|
||||||
|
toolbar.setMold("panel");
|
||||||
this.appendChild(toolbar);
|
this.appendChild(toolbar);
|
||||||
|
|
||||||
|
this.addEventListener(ON_EXPAND_MENU_EVENT, this);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void initMenu(MTreeNode rootNode)
|
private void initMenu(MTreeNode rootNode)
|
||||||
|
@ -214,9 +224,15 @@ public class MenuPanel extends Panel implements EventListener
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// Elaine 2009/02/27 - expand tree
|
// Elaine 2009/02/27 - expand tree
|
||||||
else if (eventName.equals(Events.ON_CHECK) && event.getTarget() == chkExpand)
|
else if (eventName.equals(Events.ON_CHECK) && event.getTarget() == expandToggle)
|
||||||
|
{
|
||||||
|
Clients.showBusy(null);
|
||||||
|
Events.echoEvent(ON_EXPAND_MENU_EVENT, this, null);
|
||||||
|
}
|
||||||
|
else if (eventName.equals(ON_EXPAND_MENU_EVENT))
|
||||||
{
|
{
|
||||||
expandOnCheck();
|
expandOnCheck();
|
||||||
|
Clients.clearBusy();
|
||||||
}
|
}
|
||||||
//
|
//
|
||||||
}
|
}
|
||||||
|
@ -251,8 +267,8 @@ public class MenuPanel extends Panel implements EventListener
|
||||||
*/
|
*/
|
||||||
public void expandAll()
|
public void expandAll()
|
||||||
{
|
{
|
||||||
if (!chkExpand.isChecked())
|
if (!expandToggle.isChecked())
|
||||||
chkExpand.setChecked(true);
|
expandToggle.setChecked(true);
|
||||||
|
|
||||||
TreeUtils.expandAll(menuTree);
|
TreeUtils.expandAll(menuTree);
|
||||||
}
|
}
|
||||||
|
@ -262,8 +278,8 @@ public class MenuPanel extends Panel implements EventListener
|
||||||
*/
|
*/
|
||||||
public void collapseAll()
|
public void collapseAll()
|
||||||
{
|
{
|
||||||
if (chkExpand.isChecked())
|
if (expandToggle.isChecked())
|
||||||
chkExpand.setChecked(false);
|
expandToggle.setChecked(false);
|
||||||
|
|
||||||
TreeUtils.collapseAll(menuTree);
|
TreeUtils.collapseAll(menuTree);
|
||||||
}
|
}
|
||||||
|
@ -273,7 +289,7 @@ public class MenuPanel extends Panel implements EventListener
|
||||||
*/
|
*/
|
||||||
private void expandOnCheck()
|
private void expandOnCheck()
|
||||||
{
|
{
|
||||||
if (chkExpand.isChecked())
|
if (expandToggle.isChecked())
|
||||||
expandAll();
|
expandAll();
|
||||||
else
|
else
|
||||||
collapseAll();
|
collapseAll();
|
||||||
|
|
|
@ -37,6 +37,7 @@ import org.zkoss.zk.ui.event.Events;
|
||||||
import org.zkoss.zk.ui.util.Clients;
|
import org.zkoss.zk.ui.util.Clients;
|
||||||
import org.zkoss.zul.Div;
|
import org.zkoss.zul.Div;
|
||||||
import org.zkoss.zul.DefaultTreeNode;
|
import org.zkoss.zul.DefaultTreeNode;
|
||||||
|
import org.zkoss.zul.Hlayout;
|
||||||
import org.zkoss.zul.Tree;
|
import org.zkoss.zul.Tree;
|
||||||
import org.zkoss.zul.Treeitem;
|
import org.zkoss.zul.Treeitem;
|
||||||
import org.zkoss.zul.event.TreeDataEvent;
|
import org.zkoss.zul.event.TreeDataEvent;
|
||||||
|
@ -105,17 +106,11 @@ public class TreeSearchPanel extends Panel implements EventListener, TreeDataLis
|
||||||
|
|
||||||
private void init()
|
private void init()
|
||||||
{
|
{
|
||||||
Div div = new Div();
|
Hlayout hLayout = new Hlayout();
|
||||||
|
hLayout.setValign("middle");
|
||||||
lblSearch = new Label();
|
lblSearch = new Label();
|
||||||
lblSearch.setValue(Msg.getMsg(Env.getCtx(),"TreeSearch").replaceAll("&", "") + ":");
|
lblSearch.setValue(Msg.getMsg(Env.getCtx(),"TreeSearch").replaceAll("&", "") + ":");
|
||||||
lblSearch.setTooltiptext(Msg.getMsg(Env.getCtx(),"TreeSearchText"));
|
lblSearch.setTooltiptext(Msg.getMsg(Env.getCtx(),"TreeSearchText"));
|
||||||
div.appendChild(lblSearch);
|
|
||||||
String divStyle = "height: 20px; vertical-align: middle;";
|
|
||||||
if (!AEnv.isInternetExplorer())
|
|
||||||
{
|
|
||||||
divStyle += "margin-bottom: 10px; display: inline-block;";
|
|
||||||
}
|
|
||||||
div.setStyle(divStyle);
|
|
||||||
|
|
||||||
cmbSearch = new AutoComplete();
|
cmbSearch = new AutoComplete();
|
||||||
cmbSearch.setAutodrop(true);
|
cmbSearch.setAutodrop(true);
|
||||||
|
@ -127,12 +122,10 @@ public class TreeSearchPanel extends Panel implements EventListener, TreeDataLis
|
||||||
cmbSearch.setWidth("200px");
|
cmbSearch.setWidth("200px");
|
||||||
}
|
}
|
||||||
|
|
||||||
this.appendChild(div);
|
hLayout.appendChild(lblSearch);
|
||||||
this.appendChild(cmbSearch);
|
hLayout.appendChild(cmbSearch);
|
||||||
if (!AEnv.isInternetExplorer())
|
this.appendChild(hLayout);
|
||||||
{
|
this.setStyle("padding: 2px");
|
||||||
this.setStyle("height: 20px;");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void addTreeItem(Treeitem treeItem)
|
private void addTreeItem(Treeitem treeItem)
|
||||||
|
|
Loading…
Reference in New Issue