IDEMPIERE-1230 Detail pane always created for level 1 tab even when there's no child tab. Further optimization and fixed a event ordering bug in my previous revision for this ticket.
This commit is contained in:
parent
92580221f7
commit
e32e543324
|
@ -446,7 +446,7 @@ public class CompositeADTabbox extends AbstractADTabbox
|
||||||
headerTab.setDetailPaneMode(false);
|
headerTab.setDetailPaneMode(false);
|
||||||
getBreadCrumb().getFirstChild().setVisible(false);
|
getBreadCrumb().getFirstChild().setVisible(false);
|
||||||
|
|
||||||
Events.postEvent(new Event(ON_POST_TAB_SELECTION_CHANGED_EVENT, layout, oldIndex > newIndex));
|
Events.sendEvent(new Event(ON_POST_TAB_SELECTION_CHANGED_EVENT, layout, oldIndex > newIndex));
|
||||||
}
|
}
|
||||||
|
|
||||||
private void onPostTabSelectionChanged(Boolean back) {
|
private void onPostTabSelectionChanged(Boolean back) {
|
||||||
|
@ -460,19 +460,13 @@ public class CompositeADTabbox extends AbstractADTabbox
|
||||||
int tabLevel = tabPanel.getTabLevel();
|
int tabLevel = tabPanel.getTabLevel();
|
||||||
ADTabListModel.ADTabLabel tabLabel = tabLabelList.get(i);
|
ADTabListModel.ADTabLabel tabLabel = tabLabelList.get(i);
|
||||||
if ((tabLevel - currentLevel) == 1 || (tabLevel == 0 && currentLevel == 0)) {
|
if ((tabLevel - currentLevel) == 1 || (tabLevel == 0 && currentLevel == 0)) {
|
||||||
if (tabPanel.isActivated() && !tabPanel.isGridView()) {
|
|
||||||
tabPanel.switchRowPresentation();
|
|
||||||
}
|
|
||||||
if (tabPanel.getParent() != null) tabPanel.detach();
|
|
||||||
tabIndex++;
|
tabIndex++;
|
||||||
Object[] value = new Object[]{tabIndex, tabPanel, tabLabel, Boolean.TRUE};
|
Object[] value = new Object[]{tabIndex, tabPanel, tabLabel, Boolean.TRUE};
|
||||||
list.add(value);
|
list.add(value);
|
||||||
tabPanel.setDetailPaneMode(true);
|
|
||||||
} else if (tabLevel > currentLevel ){
|
} else if (tabLevel > currentLevel ){
|
||||||
tabIndex++;
|
tabIndex++;
|
||||||
Object[] value = new Object[]{tabIndex, tabPanel, tabLabel, Boolean.FALSE};
|
Object[] value = new Object[]{tabIndex, tabPanel, tabLabel, Boolean.FALSE};
|
||||||
list.add(value);
|
list.add(value);
|
||||||
tabPanel.setDetailPaneMode(true);
|
|
||||||
} else {
|
} else {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -481,22 +475,14 @@ public class CompositeADTabbox extends AbstractADTabbox
|
||||||
if (!list.isEmpty()) {
|
if (!list.isEmpty()) {
|
||||||
DetailPane detailPane = headerTab.getDetailPane();
|
DetailPane detailPane = headerTab.getDetailPane();
|
||||||
if (detailPane == null) {
|
if (detailPane == null) {
|
||||||
detailPane = createDetailPane();
|
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);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
detailPane.setAttribute("detailpane.tablist", list);
|
||||||
|
|
||||||
|
detailPane.setVflex("true");
|
||||||
|
if (headerTab.getDetailPane() == null) {
|
||||||
|
headerTab.setDetailPane(detailPane);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Events.echoEvent(new Event(ON_TAB_SELECTION_CHANGED_ECHO_EVENT, layout, back));
|
Events.echoEvent(new Event(ON_TAB_SELECTION_CHANGED_ECHO_EVENT, layout, back));
|
||||||
|
@ -507,8 +493,30 @@ public class CompositeADTabbox extends AbstractADTabbox
|
||||||
if (headerTab instanceof ADTabpanel) {
|
if (headerTab instanceof ADTabpanel) {
|
||||||
DetailPane detailPane = headerTab.getDetailPane();
|
DetailPane detailPane = headerTab.getDetailPane();
|
||||||
|
|
||||||
if (detailPane != null && detailPane.getTabcount() > 0) {
|
if (detailPane != null) {
|
||||||
activateDetailIfVisible();
|
@SuppressWarnings("unchecked")
|
||||||
|
List<Object[]> list = (List<Object[]>) detailPane.removeAttribute("detailpane.tablist");
|
||||||
|
if (list != null && !list.isEmpty()) {
|
||||||
|
int currentLevel = headerTab.getTabLevel();
|
||||||
|
for (Object[] value : list) {
|
||||||
|
int tabIndex = (Integer) value[0];
|
||||||
|
IADTabpanel tabPanel = (IADTabpanel) value[1];
|
||||||
|
ADTabLabel tabLabel = (ADTabLabel) value[2] ;
|
||||||
|
Boolean enable = (Boolean) value[3];
|
||||||
|
|
||||||
|
int tabLevel = tabPanel.getTabLevel();
|
||||||
|
if ((tabLevel - currentLevel) == 1 || (tabLevel == 0 && currentLevel == 0)) {
|
||||||
|
if (tabPanel.isActivated() && !tabPanel.isGridView()) {
|
||||||
|
tabPanel.switchRowPresentation();
|
||||||
|
}
|
||||||
|
if (tabPanel.getParent() != null) tabPanel.detach();
|
||||||
|
}
|
||||||
|
tabPanel.setDetailPaneMode(true);
|
||||||
|
detailPane.setADTabpanel(tabIndex, tabPanel, tabLabel, enable.booleanValue());
|
||||||
|
}
|
||||||
|
detailPane.setSelectedIndex(0);
|
||||||
|
activateDetailIfVisible();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
updateBreadCrumb();
|
updateBreadCrumb();
|
||||||
|
|
Loading…
Reference in New Issue