IDEMPIERE-1378:Info Windows : add a button to reset all criteria

This commit is contained in:
hieplq 2014-07-03 04:21:00 +07:00
parent c5757678d2
commit 0d9069512f
10 changed files with 91 additions and 29 deletions

View File

@ -78,9 +78,12 @@ public class InfoBPartnerWindow extends InfoWindow {
ih = null;
} // showHistory
/**
* {@inheritDoc}
* set value of checkbox IsVendor and IsCustomer by IsSOTrx flag
*/
@Override
protected void createParameterPanel() {
super.createParameterPanel();
protected void initParameters() {
String isSOTrx = Env.getContext(Env.getCtx(), p_WindowNo, "IsSOTrx");
if (!isLookup() && Util.isEmpty(isSOTrx)) {
isSOTrx = "Y";
@ -88,6 +91,7 @@ public class InfoBPartnerWindow extends InfoWindow {
if (!Util.isEmpty(isSOTrx)) {
if ("Y".equals(isSOTrx)) {
// set value of IsCustomer checkbox
for (WEditor editor : editors) {
if (editor.getGridField() != null && editor.getGridField().getColumnName().equals("IsCustomer")) {
editor.setValue("Y");
@ -95,6 +99,7 @@ public class InfoBPartnerWindow extends InfoWindow {
}
}
} else if ("N".equals(isSOTrx)) {
// set value of IsVendor checkbox
for (WEditor editor : editors) {
if (editor.getGridField() != null && editor.getGridField().getColumnName().equals("IsVendor")) {
editor.setValue("Y");
@ -103,7 +108,6 @@ public class InfoBPartnerWindow extends InfoWindow {
}
}
}
dynamicDisplay(null);
}
@Override

View File

@ -51,14 +51,18 @@ public class InfoInOutWindow extends InfoWindow {
whereClause, AD_InfoWindow_ID, lookup);
}
/**
* {@inheritDoc}
* set value of checkbox isSoTrx
*/
@Override
protected void createParameterPanel() {
super.createParameterPanel();
protected void initParameters() {
String isSOTrx = Env.getContext(Env.getCtx(), p_WindowNo, "IsSOTrx");
if (!isLookup() && Util.isEmpty(isSOTrx)) {
isSOTrx = "Y";
}
// set value of isSoTrx checkbox by env
if (!Util.isEmpty(isSOTrx)) {
for (WEditor editor : editors) {
if (editor.getGridField() != null && editor.getGridField().getColumnName().equals("IsSOTrx")) {
@ -67,6 +71,6 @@ public class InfoInOutWindow extends InfoWindow {
}
}
}
dynamicDisplay(null);
}
}

View File

@ -50,9 +50,11 @@ public class InfoInvoiceWindow extends InfoWindow {
whereClause, AD_InfoWindow_ID, lookup);
}
/**
* {@inheritDoc}
*/
@Override
protected void createParameterPanel() {
super.createParameterPanel();
protected void initParameters() {
String isSOTrx = Env.getContext(Env.getCtx(), p_WindowNo, "IsSOTrx");
if (!isLookup() && Util.isEmpty(isSOTrx)) {
isSOTrx = "Y";
@ -77,7 +79,6 @@ public class InfoInvoiceWindow extends InfoWindow {
}
}
}
dynamicDisplay(null);
}
@Override

View File

@ -51,9 +51,11 @@ public class InfoOrderWindow extends InfoWindow {
whereClause, AD_InfoWindow_ID, lookup);
}
/**
* {@inheritDoc}
*/
@Override
protected void createParameterPanel() {
super.createParameterPanel();
protected void initParameters() {
String isSOTrx = Env.getContext(Env.getCtx(), p_WindowNo, "IsSOTrx");
if (!isLookup() && Util.isEmpty(isSOTrx)) {
isSOTrx = "Y";
@ -78,6 +80,5 @@ public class InfoOrderWindow extends InfoWindow {
}
}
}
dynamicDisplay(null);
}
}

View File

@ -46,7 +46,7 @@ public class InfoPAttributeInstanceWindow extends InfoWindow {
String whereClause, int AD_InfoWindow_ID, boolean lookup) {
super(WindowNo, tableName, keyColumn, queryValue, multipleSelection,
whereClause, AD_InfoWindow_ID, lookup);
// TODO Auto-generated constructor stub
}
}

View File

@ -28,7 +28,7 @@ public class InfoPAttributeWindow extends InfoWindow {
String whereClause, int AD_InfoWindow_ID) {
super(WindowNo, tableName, keyColumn, queryValue, multipleSelection,
whereClause, AD_InfoWindow_ID);
// TODO Auto-generated constructor stub
}
/**
@ -46,7 +46,7 @@ public class InfoPAttributeWindow extends InfoWindow {
String whereClause, int AD_InfoWindow_ID, boolean lookup) {
super(WindowNo, tableName, keyColumn, queryValue, multipleSelection,
whereClause, AD_InfoWindow_ID, lookup);
// TODO Auto-generated constructor stub
}
}

View File

@ -51,9 +51,11 @@ public class InfoPaymentWindow extends InfoWindow {
whereClause, AD_InfoWindow_ID, lookup);
}
/**
* {@inheritDoc}
*/
@Override
protected void createParameterPanel() {
super.createParameterPanel();
protected void initParameters() {
String isSOTrx = Env.getContext(Env.getCtx(), p_WindowNo, "IsSOTrx");
if (!isLookup() && Util.isEmpty(isSOTrx)) {
isSOTrx = "Y";
@ -67,6 +69,5 @@ public class InfoPaymentWindow extends InfoWindow {
}
}
}
dynamicDisplay(null);
}
}

View File

@ -136,15 +136,6 @@ public class InfoProductWindow extends InfoWindow {
return prevWhereClause;
}
@Override
protected void createParameterPanel() {
super.createParameterPanel();
initParameters();
dynamicDisplay(null);
// update display of mandatory field
validateParameters();
}
@Override
protected void renderWindow() {
super.renderWindow();
@ -445,7 +436,11 @@ public class InfoProductWindow extends InfoWindow {
return 0;
}
private void initParameters() {
/**
* {@inheritDoc}
*/
@Override
protected void initParameters() {
int M_Warehouse_ID = Env.getContextAsInt(Env.getCtx(), p_WindowNo, "M_Warehouse_ID");
int M_PriceList_ID = Env.getContextAsInt(Env.getCtx(), p_WindowNo, "M_PriceList_ID");

View File

@ -1096,6 +1096,8 @@ public class InfoWindow extends InfoPanel implements ValueChangeListener, EventL
}
}
evalDisplayLogic();
initParameters();
dynamicDisplay(null);
}
private void evalDisplayLogic() {
@ -1362,6 +1364,8 @@ public class InfoWindow extends InfoPanel implements ValueChangeListener, EventL
{
if (otherEditor == editor)
continue;
// reset value of WInfoPAttributeEditor to null when change M_AttributeSet_ID
if (asiChanged && otherEditor instanceof WInfoPAttributeEditor)
((WInfoPAttributeEditor)otherEditor).clearWhereClause();
@ -1404,6 +1408,38 @@ public class InfoWindow extends InfoPanel implements ValueChangeListener, EventL
}
}
/**
* {@inheritDoc-}
*/
@Override
protected void resetParameters() {
// reset value of parameter to null, just reset display parameter
for (WEditor editor : editors) {
GridField gField = editor.getGridField();
if (gField == null || !gField.isDisplayed()) {
continue;
}
// just reset to default Field set explicit DefaultValue
Object resetValue = null;
if (! Util.isEmpty(gField.getVO().DefaultValue, true)) {
resetValue = gField.getDefault();
}
Object oldValue = gField.getValue();
gField.setValue(resetValue, true);
// call valueChange to update env
ValueChangeEvent changeEvent = new ValueChangeEvent (editor, "", oldValue, resetValue);
valueChange (changeEvent);
}
// init again parameter
initParameters();
// filter dynamic value
dynamicDisplay(null);
}
@Override
public void onPageAttached(Page newpage, Page oldpage) {
super.onPageAttached(newpage, oldpage);

View File

@ -226,7 +226,7 @@ public abstract class InfoPanel extends Window implements EventListener<Event>,
setStyle("position: absolute");
}
confirmPanel = new ConfirmPanel(true, true, false, true, true, true); // Elaine 2008/12/16
confirmPanel = new ConfirmPanel(true, true, true, true, true, true); // Elaine 2008/12/16
confirmPanel.addActionListener(Events.ON_CLICK, this);
confirmPanel.setHflex("1");
@ -1142,6 +1142,9 @@ public abstract class InfoPanel extends Window implements EventListener<Event>,
m_cancel = true;
dispose(false);
}
else if (event.getTarget().equals(confirmPanel.getButton(ConfirmPanel.A_RESET))) {
resetParameters ();
}
// Elaine 2008/12/16
else if (event.getTarget().equals(confirmPanel.getButton(ConfirmPanel.A_HISTORY)))
{
@ -1256,6 +1259,23 @@ public abstract class InfoPanel extends Window implements EventListener<Event>,
return true;
}
/**
* Call after load parameter panel to set init value can call when reset
* parameter implement this method at inheritance class
* with each parameter, remember call Env.setContext to set new value to env
*/
protected void initParameters() {
}
/**
* Reset parameter to default value or to empty value? implement at
* inheritance class when reset parameter maybe need init again parameter,
* reset again default value
*/
protected void resetParameters() {
}
void preRunProcess (Integer processId){
// disable all control button when run process
enableButtons(false);