IDEMPIERE-1230 Detail pane always created for level 1 tab even when there's no child tab.
This commit is contained in:
parent
a4007bf19d
commit
92580221f7
|
@ -62,6 +62,8 @@ public class CompositeADTabbox extends AbstractADTabbox
|
|||
|
||||
private static final String ON_POST_TAB_SELECTION_CHANGED_EVENT = "onPostTabSelectionChanged";
|
||||
|
||||
private static final String ON_TAB_SELECTION_CHANGED_ECHO_EVENT = "onTabSelectionChangedEcho";
|
||||
|
||||
public static final String ON_SELECTION_CHANGED_EVENT = "onSelectionChanged";
|
||||
|
||||
/** Logger */
|
||||
|
@ -216,6 +218,13 @@ public class CompositeADTabbox extends AbstractADTabbox
|
|||
}
|
||||
});
|
||||
|
||||
layout.addEventListener(ON_TAB_SELECTION_CHANGED_ECHO_EVENT, new EventListener<Event>() {
|
||||
@Override
|
||||
public void onEvent(Event event) throws Exception {
|
||||
onTabSelectionChangedEcho((Boolean)event.getData());
|
||||
}
|
||||
});
|
||||
|
||||
BreadCrumb breadCrumb = getBreadCrumb();
|
||||
breadCrumb.addEventListener(Events.ON_CLICK, new EventListener<Event>() {
|
||||
@Override
|
||||
|
@ -437,16 +446,13 @@ public class CompositeADTabbox extends AbstractADTabbox
|
|||
headerTab.setDetailPaneMode(false);
|
||||
getBreadCrumb().getFirstChild().setVisible(false);
|
||||
|
||||
Events.echoEvent(new Event(ON_POST_TAB_SELECTION_CHANGED_EVENT, layout, oldIndex > newIndex));
|
||||
Events.postEvent(new Event(ON_POST_TAB_SELECTION_CHANGED_EVENT, layout, oldIndex > newIndex));
|
||||
}
|
||||
|
||||
private void onPostTabSelectionChanged(Boolean back) {
|
||||
if (headerTab instanceof ADTabpanel) {
|
||||
DetailPane detailPane = headerTab.getDetailPane();
|
||||
if (detailPane == null) {
|
||||
detailPane = createDetailPane();
|
||||
}
|
||||
if (headerTab instanceof ADTabpanel && !headerTab.getGridTab().isSortTab()) {
|
||||
|
||||
List<Object[]> list = new ArrayList<Object[]>();
|
||||
int tabIndex = -1;
|
||||
int currentLevel = headerTab.getTabLevel();
|
||||
for (int i = selectedIndex + 1; i< tabPanelList.size(); i++) {
|
||||
|
@ -459,27 +465,52 @@ public class CompositeADTabbox extends AbstractADTabbox
|
|||
}
|
||||
if (tabPanel.getParent() != null) tabPanel.detach();
|
||||
tabIndex++;
|
||||
detailPane.setADTabpanel(tabIndex, tabPanel, tabLabel);
|
||||
Object[] value = new Object[]{tabIndex, tabPanel, tabLabel, Boolean.TRUE};
|
||||
list.add(value);
|
||||
tabPanel.setDetailPaneMode(true);
|
||||
} else if (tabLevel > currentLevel ){
|
||||
tabIndex++;
|
||||
detailPane.setADTabpanel(tabIndex, tabPanel, tabLabel, false);
|
||||
Object[] value = new Object[]{tabIndex, tabPanel, tabLabel, Boolean.FALSE};
|
||||
list.add(value);
|
||||
tabPanel.setDetailPaneMode(true);
|
||||
} else {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (detailPane.getTabcount() > 0 && !headerTab.getGridTab().isSortTab()) {
|
||||
if (!list.isEmpty()) {
|
||||
DetailPane detailPane = headerTab.getDetailPane();
|
||||
if (detailPane == null) {
|
||||
detailPane = createDetailPane();
|
||||
}
|
||||
for (Object[] value : list) {
|
||||
Boolean b = (Boolean) value[3];
|
||||
if (b.booleanValue())
|
||||
detailPane.setADTabpanel((Integer)value[0], (IADTabpanel)value[1], (ADTabLabel)value[2]);
|
||||
else
|
||||
detailPane.setADTabpanel((Integer)value[0], (IADTabpanel)value[1], (ADTabLabel)value[2], false);
|
||||
}
|
||||
if (detailPane.getTabcount() > 0) {
|
||||
detailPane.setVflex("true");
|
||||
detailPane.setSelectedIndex(0);
|
||||
if (headerTab.getDetailPane() == null) {
|
||||
headerTab.setDetailPane(detailPane);
|
||||
}
|
||||
activateDetailIfVisible();
|
||||
}
|
||||
}
|
||||
|
||||
Events.echoEvent(new Event(ON_TAB_SELECTION_CHANGED_ECHO_EVENT, layout, back));
|
||||
}
|
||||
}
|
||||
|
||||
private void onTabSelectionChangedEcho(Boolean back) {
|
||||
if (headerTab instanceof ADTabpanel) {
|
||||
DetailPane detailPane = headerTab.getDetailPane();
|
||||
|
||||
if (detailPane != null && detailPane.getTabcount() > 0) {
|
||||
activateDetailIfVisible();
|
||||
}
|
||||
}
|
||||
updateBreadCrumb();
|
||||
getBreadCrumb().getFirstChild().setVisible(true);
|
||||
|
||||
|
|
Loading…
Reference in New Issue