IDEMPIERE-1057 Master/Detail toolbar shared problems with detail sort tabs. Fix based on patch from Richard Morales Herrera.

This commit is contained in:
Heng Sin Low 2013-06-20 14:44:26 +08:00
parent 1993840bdc
commit 0f2f5001fd
4 changed files with 60 additions and 58 deletions

View File

@ -479,7 +479,7 @@ public class ADSortTab extends Panel implements IADTabpanel
* Set tab change status. * Set tab change status.
* @param value * @param value
*/ */
private void setIsChanged(boolean value) { public void setIsChanged(boolean value) {
isChanged = value; isChanged = value;
if (adWindowPanel != null) { if (adWindowPanel != null) {
adWindowPanel.getToolbar().enableSave(value); adWindowPanel.getToolbar().enableSave(value);

View File

@ -1752,7 +1752,7 @@ public abstract class AbstractADWindowContent extends AbstractUIPart implements
boolean newrecod = adTabbox.getSelectedGridTab().isNew(); boolean newrecod = adTabbox.getSelectedGridTab().isNew();
if (dirtyTabpanel != null && dirtyTabpanel.getGridTab().isSortTab()) if (dirtyTabpanel != null && dirtyTabpanel.getGridTab().isSortTab())
{ {
dirtyTabpanel.refresh(); adTabbox.dataIgnore();
toolbar.enableIgnore(false); toolbar.enableIgnore(false);
} }
else else
@ -1828,53 +1828,30 @@ public abstract class AbstractADWindowContent extends AbstractUIPart implements
onSave0(onSaveEvent, onNavigationEvent, newRecord, wasChanged, callback); onSave0(onSaveEvent, onNavigationEvent, newRecord, wasChanged, callback);
return; return;
} }
if (dirtyTabpanel instanceof ADSortTab) if (!Util.isEmpty(dirtyTabpanel.getGridTab().getCommitWarning()) ||
{ (!Env.isAutoCommit(ctx, curWindowNo) && onNavigationEvent))
ADSortTab sortTab = (ADSortTab) dirtyTabpanel; {
sortTab.saveData(); FDialog.ask(curWindowNo, this.getComponent(), "SaveChanges?", dirtyTabpanel.getGridTab().getCommitWarning(), new Callback<Boolean>() {
if (!onNavigationEvent) @Override
{ public void onCallback(Boolean result)
toolbar.enableSave(sortTab.isChanged()); // set explicitly {
toolbar.enableIgnore(sortTab.isChanged()); if (result)
}
if (!sortTab.isChanged()) {
if (sortTab == adTabbox.getSelectedTabpanel()) {
statusBar.setStatusLine(Msg.getMsg(Env.getCtx(), "Saved"));
} else {
adTabbox.setDetailPaneStatusMessage(Msg.getMsg(Env.getCtx(), "Saved"), false);
}
}
if (callback != null)
callback.onCallback(true);
}
else
{
if (!Util.isEmpty(dirtyTabpanel.getGridTab().getCommitWarning()) ||
(!Env.isAutoCommit(ctx, curWindowNo) && onNavigationEvent))
{
FDialog.ask(curWindowNo, this.getComponent(), "SaveChanges?", dirtyTabpanel.getGridTab().getCommitWarning(), new Callback<Boolean>() {
@Override
public void onCallback(Boolean result)
{ {
if (result) onSave0(onSaveEvent, onNavigationEvent, newRecord, wasChanged, callback);
{
onSave0(onSaveEvent, onNavigationEvent, newRecord, wasChanged, callback);
}
else
{
if (callback != null)
callback.onCallback(false);
}
} }
}); else
} {
else if (callback != null)
{ callback.onCallback(false);
onSave0(onSaveEvent, onNavigationEvent, newRecord, wasChanged, callback); }
} }
} });
}
else
{
onSave0(onSaveEvent, onNavigationEvent, newRecord, wasChanged, callback);
}
} }
private void onSave0(boolean onSaveEvent, boolean navigationEvent, private void onSave0(boolean onSaveEvent, boolean navigationEvent,
@ -1888,7 +1865,7 @@ public abstract class AbstractADWindowContent extends AbstractUIPart implements
if (callback != null) if (callback != null)
callback.onCallback(false); callback.onCallback(false);
return; return;
} else if (!onSaveEvent && dirtyTabpanel != null) //need manual refresh } else if (!onSaveEvent && dirtyTabpanel != null && !(dirtyTabpanel instanceof ADSortTab)) //need manual refresh
{ {
dirtyTabpanel.getGridTab().setCurrentRow(dirtyTabpanel.getGridTab().getCurrentRow()); dirtyTabpanel.getGridTab().setCurrentRow(dirtyTabpanel.getGridTab().getCurrentRow());
} }
@ -1902,6 +1879,15 @@ public abstract class AbstractADWindowContent extends AbstractUIPart implements
if (dirtyTabpanel2 != null && dirtyTabpanel2 != dirtyTabpanel) { if (dirtyTabpanel2 != null && dirtyTabpanel2 != dirtyTabpanel) {
onSave(onSaveEvent, navigationEvent, callback); onSave(onSaveEvent, navigationEvent, callback);
return; return;
} else if (dirtyTabpanel instanceof ADSortTab) {
ADSortTab sortTab = (ADSortTab) dirtyTabpanel;
if (!sortTab.isChanged()) {
if (sortTab == adTabbox.getSelectedTabpanel()) {
statusBar.setStatusLine(Msg.getMsg(Env.getCtx(), "Saved"));
} else {
adTabbox.setDetailPaneStatusMessage(Msg.getMsg(Env.getCtx(), "Saved"), false);
}
}
} }
if (wasChanged) { if (wasChanged) {

View File

@ -686,9 +686,14 @@ public class CompositeADTabbox extends AbstractADTabbox
public void dataIgnore() { public void dataIgnore() {
IADTabpanel detailPanel = getSelectedDetailADTabpanel(); IADTabpanel detailPanel = getSelectedDetailADTabpanel();
if (detailPanel != null) { if (detailPanel != null) {
detailPanel.getGridTab().dataIgnore(); if (detailPanel instanceof ADSortTab) {
if (detailPanel.getGridTab().isSortTab()) detailPanel.refresh();
detailPanel.activate(true); if (((ADSortTab) detailPanel).isChanged()) {
((ADSortTab) detailPanel).setIsChanged(false);
}
} else {
detailPanel.getGridTab().dataIgnore();
}
} }
headerTab.getGridTab().dataIgnore(); headerTab.getGridTab().dataIgnore();
} }

View File

@ -767,6 +767,17 @@ div.wc-modal, div.wc-modal-none, div.wc-highlighted, div.wc-highlighted-none {
display: inline-block; display: inline-block;
} }
.adwindow-detailpane-toolbar .z-toolbar-body .docstatus-normal,
.adwindow-detailpane-toolbar .z-toolbar-body .docstatus-error {
padding-left: 4px;
margin-top: 2px;
}
.adwindow-detailpane-toolbar .z-toolbar-body .docstatus-normal .z-label,
.adwindow-detailpane-toolbar .z-toolbar-body .docstatus-error .z-label {
font-size: ${c:property('org.zkoss.zul.theme.fontSizeM')};
}
.adwindow-detailpane-message { .adwindow-detailpane-message {
float: right; float: right;
} }
@ -933,8 +944,8 @@ input:focus, textarea:focus, .z-combobox-inp:focus, z-datebox-inp:focus {
<%-- menu tree cell --%> <%-- menu tree cell --%>
.menu-treecell-cnt div { .menu-treecell-cnt div {
border: 0; margin: 0; padding: 0; border: 0; margin: 0; padding: 0;
font-family: ${fontFamilyC}; font-family: ${c:property('org.zkoss.zul.theme.fontFamilyC')};
font-size: ${fontSizeM}; font-size: ${c:property('org.zkoss.zul.theme.fontSizeM')};
font-weight: normal; font-weight: normal;
overflow-x: hidden; overflow-x: hidden;
white-space: nowrap; white-space: nowrap;
@ -1094,15 +1105,15 @@ span.z-tab-text {
div.z-tree-body td.menu-tree-cell { div.z-tree-body td.menu-tree-cell {
cursor: pointer; cursor: pointer;
padding: 0 2px; padding: 0 2px;
font-size: ${fontSizeM}; font-size: ${c:property('org.zkoss.zul.theme.fontSizeM')};
font-weight: normal; font-weight: normal;
overflow: visible; overflow: visible;
} }
div.menu-tree-cell-cnt { div.menu-tree-cell-cnt {
border: 0; margin: 0; padding: 0; border: 0; margin: 0; padding: 0;
font-family: ${fontFamilyC}; font-family: ${c:property('org.zkoss.zul.theme.fontFamilyC')};
font-size: ${fontSizeM}; font-weight: normal; font-size: ${c:property('org.zkoss.zul.theme.fontSizeM')}; font-weight: normal;
white-space:nowrap white-space:nowrap
} }
@ -1118,17 +1129,17 @@ td.menu-tree-cell-disd a:visited, td.menu-tree-cell-disd a:hover {
div.z-dottree-body td.menu-tree-cell { div.z-dottree-body td.menu-tree-cell {
cursor: pointer; padding: 0 2px; cursor: pointer; padding: 0 2px;
font-size: ${fontSizeM}; font-weight: normal; overflow: visible; font-size: ${c:property('org.zkoss.zul.theme.fontSizeM')}; font-weight: normal; overflow: visible;
} }
div.z-filetree-body td.menu-tree-cell { div.z-filetree-body td.menu-tree-cell {
cursor: pointer; padding: 0 2px; cursor: pointer; padding: 0 2px;
font-size: ${fontSizeM}; font-weight: normal; overflow: visible; font-size: ${c:property('org.zkoss.zul.theme.fontSizeM')}; font-weight: normal; overflow: visible;
} }
div.z-vfiletree-body td.menu-tree-cell { div.z-vfiletree-body td.menu-tree-cell {
cursor: pointer; padding: 0 2px; cursor: pointer; padding: 0 2px;
font-size: ${fontSizeM}; font-weight: normal; overflow: visible; font-size: ${c:property('org.zkoss.zul.theme.fontSizeM')}; font-weight: normal; overflow: visible;
} }
div.simileAjax-bubble-container { div.simileAjax-bubble-container {