IDEMPIERE-1230 Detail pane always created for level 1 tab even when there's no child tab. Further optimization and fixed problem with sortTab.

This commit is contained in:
Heng Sin Low 2013-08-01 23:28:17 +08:00
parent 31426fbf60
commit 2952930ab4
3 changed files with 43 additions and 16 deletions

View File

@ -2423,7 +2423,7 @@ public class GridTab implements DataStatusListener, Evaluatee, Serializable
// Table Open?
if (!m_mTable.isOpen())
{
log.severe ("Table not open");
log.log (Level.SEVERE, "Table not open", new Exception("Table not open"));
return -1;
}
// Row Count

View File

@ -92,6 +92,7 @@ import org.zkoss.zul.Cell;
import org.zkoss.zul.Center;
import org.zkoss.zul.DefaultTreeNode;
import org.zkoss.zul.Div;
import org.zkoss.zul.RowRenderer;
import org.zkoss.zul.Separator;
import org.zkoss.zul.South;
import org.zkoss.zul.Space;
@ -177,7 +178,7 @@ DataStatusListener, IADTabpanel, IdSpace, IFieldEditorContainer
private GridTabDataBinder dataBinder;
private boolean activated = false;
protected boolean activated = false;
private Group currentGroup;
@ -1517,9 +1518,15 @@ DataStatusListener, IADTabpanel, IdSpace, IFieldEditorContainer
}
} else if (tabPanel != null && !tabPanel.getGridTab().isCurrent()) {
tabPanel.activate(true);
} else if (tabPanel != null && tabPanel.isGridView()) {
//ensure row indicator is not lost
RowRenderer<Object[]> renderer = tabPanel.getGridView().getListbox().getRowRenderer();
GridTabRowRenderer gtr = (GridTabRowRenderer)renderer;
org.zkoss.zul.Row row = gtr.getCurrentRow();
if (row != null)
gtr.setCurrentRow(row);
}
}
}
/**

View File

@ -189,7 +189,9 @@ public class CompositeADTabbox extends AbstractADTabbox
headerTab.switchRowPresentation();
}
if (!headerTab.getGridTab().isSortTab())
headerTab.getGridTab().setCurrentRow(row, true);
if (headerTab.isGridView()) {
if (headerTab.getGridTab().isNew() || headerTab.needSave(true, false)) {
headerTab.getGridView().onEditCurrentRow();
@ -451,7 +453,6 @@ public class CompositeADTabbox extends AbstractADTabbox
private void onPostTabSelectionChanged(Boolean back) {
if (headerTab instanceof ADTabpanel && !headerTab.getGridTab().isSortTab()) {
List<Object[]> list = new ArrayList<Object[]>();
int tabIndex = -1;
int currentLevel = headerTab.getTabLevel();
@ -484,9 +485,8 @@ public class CompositeADTabbox extends AbstractADTabbox
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));
}
private void onTabSelectionChangedEcho(Boolean back) {
@ -514,8 +514,22 @@ public class CompositeADTabbox extends AbstractADTabbox
tabPanel.setDetailPaneMode(true);
detailPane.setADTabpanel(tabIndex, tabPanel, tabLabel, enable.booleanValue());
}
if (back == null || !back.booleanValue()) {
detailPane.setSelectedIndex(0);
activateDetailIfVisible();
} else {
if (((ADTabpanel) headerTab).isDetailVisible()) {
IADTabpanel selectDetailPanel = detailPane.getSelectedADTabpanel();
if (!selectDetailPanel.isVisible()) {
selectDetailPanel.setVisible(true);
}
if (!selectDetailPanel.isGridView()) {
selectDetailPanel.switchRowPresentation();
}
if (selectDetailPanel instanceof ADTabpanel)
((ADTabpanel)selectDetailPanel).activated = true;
}
}
}
}
}
@ -780,8 +794,9 @@ public class CompositeADTabbox extends AbstractADTabbox
} else {
tabPanel.query(false, 0, 0);
}
if (!tabPanel.isVisible())
if (!tabPanel.isVisible()) {
tabPanel.setVisible(true);
}
if (!tabPanel.isGridView()) {
tabPanel.switchRowPresentation();
}
@ -791,6 +806,11 @@ public class CompositeADTabbox extends AbstractADTabbox
headerTab.getDetailPane().updateToolbar(false, true);
} else {
tabPanel.dynamicDisplay(0);
RowRenderer<Object[]> renderer = tabPanel.getGridView().getListbox().getRowRenderer();
GridTabRowRenderer gtr = (GridTabRowRenderer)renderer;
Row row = gtr.getCurrentRow();
if (row != null)
gtr.setCurrentRow(row);
}
}