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.
* @param value
*/
private void setIsChanged(boolean value) {
public void setIsChanged(boolean value) {
isChanged = value;
if (adWindowPanel != null) {
adWindowPanel.getToolbar().enableSave(value);

View File

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

View File

@ -686,9 +686,14 @@ public class CompositeADTabbox extends AbstractADTabbox
public void dataIgnore() {
IADTabpanel detailPanel = getSelectedDetailADTabpanel();
if (detailPanel != null) {
detailPanel.getGridTab().dataIgnore();
if (detailPanel.getGridTab().isSortTab())
detailPanel.activate(true);
if (detailPanel instanceof ADSortTab) {
detailPanel.refresh();
if (((ADSortTab) detailPanel).isChanged()) {
((ADSortTab) detailPanel).setIsChanged(false);
}
} else {
detailPanel.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;
}
.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 {
float: right;
}
@ -933,8 +944,8 @@ input:focus, textarea:focus, .z-combobox-inp:focus, z-datebox-inp:focus {
<%-- menu tree cell --%>
.menu-treecell-cnt div {
border: 0; margin: 0; padding: 0;
font-family: ${fontFamilyC};
font-size: ${fontSizeM};
font-family: ${c:property('org.zkoss.zul.theme.fontFamilyC')};
font-size: ${c:property('org.zkoss.zul.theme.fontSizeM')};
font-weight: normal;
overflow-x: hidden;
white-space: nowrap;
@ -1094,15 +1105,15 @@ span.z-tab-text {
div.z-tree-body td.menu-tree-cell {
cursor: pointer;
padding: 0 2px;
font-size: ${fontSizeM};
font-size: ${c:property('org.zkoss.zul.theme.fontSizeM')};
font-weight: normal;
overflow: visible;
}
div.menu-tree-cell-cnt {
border: 0; margin: 0; padding: 0;
font-family: ${fontFamilyC};
font-size: ${fontSizeM}; font-weight: normal;
font-family: ${c:property('org.zkoss.zul.theme.fontFamilyC')};
font-size: ${c:property('org.zkoss.zul.theme.fontSizeM')}; font-weight: normal;
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 {
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 {
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 {
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 {