IDEMPIERE-688 Zk: Current row highlight lost after moving back from child to parent.

This commit is contained in:
Heng Sin Low 2013-03-06 11:38:01 +08:00
parent 739cc580e9
commit 494fdca8ce
1 changed files with 16 additions and 3 deletions

View File

@ -45,6 +45,8 @@ 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.zk.ui.util.Clients;
import org.zkoss.zul.Menuitem; import org.zkoss.zul.Menuitem;
import org.zkoss.zul.Row;
import org.zkoss.zul.RowRenderer;
import org.zkoss.zul.Vlayout; import org.zkoss.zul.Vlayout;
/** /**
@ -210,7 +212,7 @@ public class CompositeADTabbox extends AbstractADTabbox
layout.addEventListener(ON_POST_TAB_SELECTION_CHANGED_EVENT, new EventListener<Event>() { layout.addEventListener(ON_POST_TAB_SELECTION_CHANGED_EVENT, new EventListener<Event>() {
@Override @Override
public void onEvent(Event event) throws Exception { public void onEvent(Event event) throws Exception {
onPostTabSelectionChanged(); onPostTabSelectionChanged((Boolean)event.getData());
} }
}); });
@ -435,10 +437,10 @@ public class CompositeADTabbox extends AbstractADTabbox
headerTab.setDetailPaneMode(false); headerTab.setDetailPaneMode(false);
getBreadCrumb().getFirstChild().setVisible(false); getBreadCrumb().getFirstChild().setVisible(false);
Events.echoEvent(new Event(ON_POST_TAB_SELECTION_CHANGED_EVENT, layout)); Events.echoEvent(new Event(ON_POST_TAB_SELECTION_CHANGED_EVENT, layout, oldIndex > newIndex));
} }
private void onPostTabSelectionChanged() { private void onPostTabSelectionChanged(Boolean back) {
if (headerTab instanceof ADTabpanel) { if (headerTab instanceof ADTabpanel) {
DetailPane detailPane = headerTab.getDetailPane(); DetailPane detailPane = headerTab.getDetailPane();
if (detailPane == null) { if (detailPane == null) {
@ -488,6 +490,17 @@ public class CompositeADTabbox extends AbstractADTabbox
adwindow.getADWindowContent().getToolbar().enableTabNavigation(getBreadCrumb().hasParentLink(), adwindow.getADWindowContent().getToolbar().enableTabNavigation(getBreadCrumb().hasParentLink(),
headerTab.getDetailPane() != null && headerTab.getDetailPane().getTabcount() > 0); headerTab.getDetailPane() != null && headerTab.getDetailPane().getTabcount() > 0);
} }
//indicator and row highlight lost after navigate back from child to parent
if (back != null && back.booleanValue()) {
if (headerTab.isGridView()) {
RowRenderer<Object[]> renderer = headerTab.getGridView().getListbox().getRowRenderer();
GridTabRowRenderer gtr = (GridTabRowRenderer)renderer;
Row row = gtr.getCurrentRow();
if (row != null)
gtr.setCurrentRow(row);
}
}
} }
private void updateBreadCrumb() { private void updateBreadCrumb() {