* merge revision 6136 bug fix from branches/adempiere341

This commit is contained in:
Heng Sin Low 2008-08-16 09:03:15 +00:00
parent d14217a6ee
commit 125da4ab35
2 changed files with 18 additions and 10 deletions

View File

@ -3,8 +3,9 @@ package org.adempiere.webui.component;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
import org.adempiere.webui.LayoutUtils;
import org.adempiere.webui.component.ADTabListModel.ADTabLabel; import org.adempiere.webui.component.ADTabListModel.ADTabLabel;
import org.zkoss.zhtml.Button;
import org.zkoss.zhtml.Text;
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;
@ -30,25 +31,29 @@ public class ADButtonTabList extends Panel implements IADTabList, EventListener
int i = 0; int i = 0;
for (ADTabLabel tabLabel : listItems) { for (ADTabLabel tabLabel : listItems) {
Button button = new Button(); Button button = new Button();
button.setLabel(tabLabel.label); Text text = new Text(tabLabel.label);
button.appendChild(text);
int s = tabbox.getSelectedIndex(); int s = tabbox.getSelectedIndex();
if ( s == i) if ( s == i) {
LayoutUtils.addSclass("adwindow-navbtn-sel", button); button.setSclass("adwindow-navbtn-sel");
else { button.setDynamicProperty("disabled", null);
if (!tabbox.canNavigateTo(s, i)) {
button.setDisabled(true);
LayoutUtils.addSclass("adwindow-navbtn-dis", button);
} else { } else {
LayoutUtils.addSclass("adwindow-navbtn-uns", button); if (!tabbox.canNavigateTo(s, i)) {
button.setDynamicProperty("disabled", "disabled");
button.setSclass("adwindow-navbtn-dis");
} else {
button.setDynamicProperty("disabled", null);
button.setSclass("adwindow-navbtn-uns");
} }
} }
String style = "margin-left:" + (tabLabel.tabLevel*15+5) + "px"; String style = "margin-left:" + (tabLabel.tabLevel*15+5) + "px";
String width = (195 - tabLabel.tabLevel*15)+"px";
style = style + "; width:" + width;
button.setStyle(style); button.setStyle(style);
button.setParent(this); button.setParent(this);
button.setWidth((195 - tabLabel.tabLevel*15)+"px");
button.addEventListener(Events.ON_CLICK, this); button.addEventListener(Events.ON_CLICK, this);
i++; i++;
} }
@ -84,7 +89,8 @@ public class ADButtonTabList extends Panel implements IADTabList, EventListener
Button button = (Button) event.getTarget(); Button button = (Button) event.getTarget();
int i = 0; int i = 0;
for (ADTabLabel tabLabel : listItems) { for (ADTabLabel tabLabel : listItems) {
if (tabLabel.label.equals(button.getLabel())) { Text text = (Text) button.getFirstChild();
if (tabLabel.label.equals(text.getValue())) {
break; break;
} }
i++; i++;

View File

@ -169,12 +169,14 @@ tr.tab-desktop-tb-m {
background-color: #9CBDFF; background-color: #9CBDFF;
font-weight: bold; font-weight: bold;
color: #274D5F; color: #274D5F;
cursor: pointer;
} }
.adwindow-navbtn-uns { .adwindow-navbtn-uns {
background-color: #C4DCFB; background-color: #C4DCFB;
font-weight: normal; font-weight: normal;
color: #274D5F; color: #274D5F;
cursor: pointer;
} }
.adwindow-navbtn-dis { .adwindow-navbtn-dis {