IDEMPIERE-369 Master Detail layout improvements. 1) Fixed selected tab in detailpane is wrong when navigate to parent tab that is more than 1 level up. 2) Fixed changes in sort tab not auto save when user navigate to another tab. 3) Fixed double click on sort tab doesn't maximized it.
This commit is contained in:
parent
1214a9a6c6
commit
b3d3d04a51
|
@ -139,6 +139,7 @@ public class ADSortTab extends Panel implements IADTabpanel
|
|||
private boolean uiCreated;
|
||||
private boolean active = false;
|
||||
private boolean isChanged;
|
||||
private boolean detailPaneMode;
|
||||
|
||||
/**
|
||||
* Dynamic Init
|
||||
|
@ -698,15 +699,6 @@ public class ADSortTab extends Panel implements IADTabpanel
|
|||
}
|
||||
} // saveData
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.compiere.grid.APanelTab#unregisterPanel()
|
||||
*/
|
||||
public void unregisterPanel ()
|
||||
{
|
||||
saveData();
|
||||
adWindowPanel = null;
|
||||
} // dispose
|
||||
|
||||
/**
|
||||
* List Item
|
||||
* @author Teo Sarca
|
||||
|
@ -929,12 +921,32 @@ public class ADSortTab extends Panel implements IADTabpanel
|
|||
|
||||
@Override
|
||||
public void setDetailPaneMode(boolean detailMode, boolean vflex) {
|
||||
this.detailPaneMode = detailMode;
|
||||
this.setVflex(Boolean.toString(vflex));
|
||||
}
|
||||
|
||||
public boolean isDetailPaneMode() {
|
||||
return this.detailPaneMode;
|
||||
}
|
||||
|
||||
@Override
|
||||
public GridView getGridView() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean needSave(boolean rowChange, boolean onlyRealChange) {
|
||||
return isChanged();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean dataSave(boolean onSaveEvent) {
|
||||
if (isChanged()) {
|
||||
saveData();
|
||||
return isChanged() == false;
|
||||
} else {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
} //ADSortTab
|
||||
|
||||
|
|
|
@ -159,6 +159,8 @@ DataStatusListener, IADTabpanel
|
|||
|
||||
private Component detailPane;
|
||||
|
||||
private boolean detailPaneMode;
|
||||
|
||||
public static final String ON_TOGGLE_EVENT = "onToggle";
|
||||
|
||||
public ADTabpanel()
|
||||
|
@ -1187,6 +1189,7 @@ DataStatusListener, IADTabpanel
|
|||
|
||||
@Override
|
||||
public void setDetailPaneMode(boolean detailPaneMode, boolean vflex) {
|
||||
this.detailPaneMode = detailPaneMode;
|
||||
if (detailPaneMode) {
|
||||
detailPane = null;
|
||||
this.setVflex("true");
|
||||
|
@ -1216,5 +1219,20 @@ DataStatusListener, IADTabpanel
|
|||
}
|
||||
return buttonList;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean needSave(boolean rowChange, boolean onlyRealChange) {
|
||||
return getGridTab().needSave(rowChange, onlyRealChange);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean dataSave(boolean onSaveEvent) {
|
||||
return getGridTab().dataSave(onSaveEvent);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isDetailPaneMode() {
|
||||
return this.detailPaneMode;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1627,10 +1627,8 @@ public abstract class AbstractADWindowContent extends AbstractUIPart implements
|
|||
if (dirtyTabpanel != null && dirtyTabpanel instanceof ADSortTab)
|
||||
{
|
||||
ADSortTab sortTab = (ADSortTab) dirtyTabpanel;
|
||||
if (onNavigationEvent)
|
||||
sortTab.unregisterPanel();
|
||||
else
|
||||
sortTab.saveData();
|
||||
|
||||
if (!onNavigationEvent)
|
||||
{
|
||||
toolbar.enableSave(sortTab.isChanged()); // set explicitly
|
||||
|
|
|
@ -230,7 +230,7 @@ public class CompositeADTabbox extends AbstractADTabbox
|
|||
int oldIndex = (Integer) event.getData();
|
||||
if (oldIndex != detailPane.getSelectedIndex()) {
|
||||
IADTabpanel prevTabPanel = detailPane.getADTabpanel(oldIndex);
|
||||
if (prevTabPanel != null && prevTabPanel.getGridTab().needSave(true, true)) {
|
||||
if (prevTabPanel != null && prevTabPanel.needSave(true, true)) {
|
||||
final int newIndex = detailPane.getSelectedIndex();
|
||||
detailPane.setSelectedIndex(oldIndex);
|
||||
adWindowPanel.saveAndNavigate(new Callback<Boolean>() {
|
||||
|
@ -243,6 +243,7 @@ public class CompositeADTabbox extends AbstractADTabbox
|
|||
}
|
||||
});
|
||||
} else {
|
||||
detailPane.setSelectedIndex(detailPane.getSelectedIndex());
|
||||
onActivateDetail(tabPanel);
|
||||
}
|
||||
} else {
|
||||
|
@ -571,13 +572,13 @@ public class CompositeADTabbox extends AbstractADTabbox
|
|||
|
||||
@Override
|
||||
public boolean needSave(boolean rowChange, boolean onlyRealChange) {
|
||||
boolean b = headerTab.getGridTab().needSave(rowChange, onlyRealChange);
|
||||
boolean b = headerTab.needSave(rowChange, onlyRealChange);
|
||||
if (b)
|
||||
return b;
|
||||
|
||||
IADTabpanel detailPanel = getSelectedDetailADTabpanel();
|
||||
if (detailPanel != null) {
|
||||
b = detailPanel.getGridTab().needSave(rowChange, onlyRealChange);
|
||||
b = detailPanel.needSave(rowChange, onlyRealChange);
|
||||
}
|
||||
|
||||
return b;
|
||||
|
@ -601,14 +602,14 @@ public class CompositeADTabbox extends AbstractADTabbox
|
|||
@Override
|
||||
public boolean dataSave(boolean onSaveEvent) {
|
||||
IADTabpanel detail = getSelectedDetailADTabpanel();
|
||||
if (detail != null && !detail.getGridTab().isSortTab() && detail.getGridTab().needSave(true, true)) {
|
||||
if (detail != null && detail.needSave(true, true)) {
|
||||
Execution execution = Executions.getCurrent();
|
||||
if (execution != null) {
|
||||
execution.setAttribute(getClass().getName()+".dataAction", detail.getUuid());
|
||||
}
|
||||
return detail.getGridTab().dataSave(onSaveEvent);
|
||||
return detail.dataSave(onSaveEvent);
|
||||
}
|
||||
return headerTab.getGridTab().isSortTab() ? true : headerTab.getGridTab().dataSave(onSaveEvent);
|
||||
return headerTab.dataSave(onSaveEvent);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -619,13 +620,9 @@ public class CompositeADTabbox extends AbstractADTabbox
|
|||
@Override
|
||||
public IADTabpanel getDirtyADTabpanel() {
|
||||
IADTabpanel detail = getSelectedDetailADTabpanel();
|
||||
if (detail != null && detail.getGridTab().needSave(true, true)) {
|
||||
if (detail != null && detail.needSave(true, true)) {
|
||||
return detail;
|
||||
} else if (detail != null && detail instanceof ADSortTab && ((ADSortTab)detail).isChanged()) {
|
||||
return detail;
|
||||
} else if (headerTab.getGridTab().needSave(true, true)) {
|
||||
return headerTab;
|
||||
} else if (headerTab instanceof ADSortTab && ((ADSortTab)headerTab).isChanged()) {
|
||||
} else if (headerTab.needSave(true, true)) {
|
||||
return headerTab;
|
||||
}
|
||||
|
||||
|
@ -678,7 +675,7 @@ public class CompositeADTabbox extends AbstractADTabbox
|
|||
IADTabpanel adtab = detailPane.getADTabpanel(i);
|
||||
int index = (Integer) adtab.getAttribute(ADTAB_INDEX_ATTRIBUTE);
|
||||
if (index == tabIndex) {
|
||||
if (!detailPane.isTabVisible(i)) {
|
||||
if (!detailPane.isTabVisible(i) || !detailPane.isTabEnabled(i)) {
|
||||
return;
|
||||
}
|
||||
if (i != detailPane.getSelectedIndex()) {
|
||||
|
|
|
@ -151,15 +151,14 @@ public class DetailPane extends Panel implements EventListener<Event> {
|
|||
if (!tab.isSelected())
|
||||
return;
|
||||
org.zkoss.zul.Tabpanel zkTabpanel = tab.getLinkedPanel();
|
||||
ADTabpanel adtab = null;
|
||||
IADTabpanel adtab = null;
|
||||
for(Component c : zkTabpanel.getChildren()) {
|
||||
if (c instanceof ADTabpanel) {
|
||||
adtab = (ADTabpanel) c;
|
||||
if (c instanceof IADTabpanel) {
|
||||
adtab = (IADTabpanel) c;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (adtab != null && adtab.getGridView() != null
|
||||
&& adtab.getGridView().isDetailPaneMode()) {
|
||||
if (adtab != null && adtab.isDetailPaneMode()) {
|
||||
onEdit();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -121,5 +121,11 @@ public interface IADTabpanel extends Component, Evaluatee {
|
|||
|
||||
public void setDetailPaneMode(boolean detailMode, boolean vflex);
|
||||
|
||||
public boolean isDetailPaneMode();
|
||||
|
||||
public abstract GridView getGridView();
|
||||
|
||||
public boolean needSave(boolean rowChange, boolean onlyRealChange);
|
||||
|
||||
public boolean dataSave(boolean onSaveEvent);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue