IDEMPIERE-127 Implement Recent Items dashboard

http://jira.idempiere.com/browse/IDEMPIERE-127
when a detail record is modified add header to recent items
This commit is contained in:
Carlos Ruiz 2012-02-01 16:54:51 -05:00
parent 97a7bfc7b9
commit 7d1dca6e32
1 changed files with 46 additions and 13 deletions

View File

@ -1231,11 +1231,22 @@ public abstract class AbstractADWindowPanel extends AbstractUIPart implements To
toolbar.enableIgnore(changed && !readOnly); toolbar.enableIgnore(changed && !readOnly);
if (changed && !readOnly && !toolbar.isSaveEnable() ) { if (changed && !readOnly && !toolbar.isSaveEnable() ) {
if (curTabIndex == 0 && curTab.getRecord_ID() > 0) { if (curTab.getRecord_ID() > 0) {
MRecentItem.addModifiedField(ctx, curTab.getAD_Table_ID(), if (curTabIndex == 0) {
curTab.getRecord_ID(), Env.getAD_User_ID(ctx), MRecentItem.addModifiedField(ctx, curTab.getAD_Table_ID(),
Env.getAD_Role_ID(ctx), curTab.getAD_Window_ID(), curTab.getRecord_ID(), Env.getAD_User_ID(ctx),
curTab.getAD_Tab_ID()); Env.getAD_Role_ID(ctx), curTab.getAD_Window_ID(),
curTab.getAD_Tab_ID());
} else {
/* when a detail record is modified add header to recent items */
GridTab mainTab = gridWindow.getTab(0);
if (mainTab != null) {
MRecentItem.addModifiedField(ctx, mainTab.getAD_Table_ID(),
mainTab.getRecord_ID(), Env.getAD_User_ID(ctx),
Env.getAD_Role_ID(ctx), mainTab.getAD_Window_ID(),
mainTab.getAD_Tab_ID());
}
}
} }
} }
@ -1520,6 +1531,7 @@ public abstract class AbstractADWindowPanel extends AbstractUIPart implements To
private boolean onSave(boolean onSaveEvent) private boolean onSave(boolean onSaveEvent)
{ {
boolean newRecord = (curTab.getRecord_ID() <= 0); boolean newRecord = (curTab.getRecord_ID() <= 0);
boolean wasChanged = toolbar.isSaveEnable();
if (curTab.isSortTab()) if (curTab.isSortTab())
{ {
((ADSortTab)curTabpanel).saveData(); ((ADSortTab)curTabpanel).saveData();
@ -1550,14 +1562,35 @@ public abstract class AbstractADWindowPanel extends AbstractUIPart implements To
curTabpanel.dynamicDisplay(0); curTabpanel.dynamicDisplay(0);
curTabpanel.afterSave(onSaveEvent); curTabpanel.afterSave(onSaveEvent);
if (newRecord) { if (wasChanged) {
MRecentItem.addModifiedField(ctx, curTab.getAD_Table_ID(), if (newRecord) {
curTab.getRecord_ID(), Env.getAD_User_ID(ctx), if (curTabIndex == 0) {
Env.getAD_Role_ID(ctx), curTab.getAD_Window_ID(), MRecentItem.addModifiedField(ctx, curTab.getAD_Table_ID(),
curTab.getAD_Tab_ID()); curTab.getRecord_ID(), Env.getAD_User_ID(ctx),
} else { Env.getAD_Role_ID(ctx), curTab.getAD_Window_ID(),
MRecentItem.touchUpdatedRecord(ctx, curTab.getAD_Table_ID(), curTab.getAD_Tab_ID());
curTab.getRecord_ID(), Env.getAD_User_ID(ctx)); } else {
/* when a detail record is modified add header to recent items */
GridTab mainTab = gridWindow.getTab(0);
if (mainTab != null) {
MRecentItem.addModifiedField(ctx, mainTab.getAD_Table_ID(),
mainTab.getRecord_ID(), Env.getAD_User_ID(ctx),
Env.getAD_Role_ID(ctx), mainTab.getAD_Window_ID(),
mainTab.getAD_Tab_ID());
}
}
} else {
if (curTabIndex == 0) {
MRecentItem.touchUpdatedRecord(ctx, curTab.getAD_Table_ID(),
curTab.getRecord_ID(), Env.getAD_User_ID(ctx));
} else {
GridTab mainTab = gridWindow.getTab(0);
if (mainTab != null) {
MRecentItem.touchUpdatedRecord(ctx, mainTab.getAD_Table_ID(),
mainTab.getRecord_ID(), Env.getAD_User_ID(ctx));
}
}
}
} }
return true; return true;