IDEMPIERE-325 AD_InfoWindow / fix problem found with ASI - enable the usage of ASI button without AS selected

This commit is contained in:
Carlos Ruiz 2013-02-15 11:08:05 -05:00
parent 1f7318235b
commit 5fdb396059
2 changed files with 14 additions and 2 deletions

View File

@ -23,6 +23,7 @@ import org.adempiere.webui.component.Label;
import org.adempiere.webui.component.Row;
import org.adempiere.webui.component.Rows;
import org.adempiere.webui.editor.WEditor;
import org.adempiere.webui.editor.WTableDirEditor;
import org.adempiere.webui.editor.WebEditorFactory;
import org.adempiere.webui.event.ValueChangeEvent;
import org.adempiere.webui.event.ValueChangeListener;
@ -610,6 +611,7 @@ public class InfoWindow extends InfoPanel implements ValueChangeListener, EventL
if (mField.getDisplayType() == DisplayType.PAttribute)
{
editor = new WInfoPAttributeEditor(infoContext, p_WindowNo, mField);
editor.setReadWrite(true);
}
else
{
@ -798,6 +800,7 @@ public class InfoWindow extends InfoPanel implements ValueChangeListener, EventL
if (evt != null && evt.getSource() instanceof WEditor)
{
WEditor editor = (WEditor)evt.getSource();
boolean asiChanged = false;
if (evt.getNewValue() == null) {
Env.setContext(infoContext, p_WindowNo, editor.getColumnName(), "");
Env.setContext(infoContext, p_WindowNo, Env.TAB_INFO, editor.getColumnName(), "");
@ -811,11 +814,16 @@ public class InfoWindow extends InfoPanel implements ValueChangeListener, EventL
Env.setContext(infoContext, p_WindowNo, editor.getColumnName(), evt.getNewValue().toString());
Env.setContext(infoContext, p_WindowNo, Env.TAB_INFO, editor.getColumnName(), evt.getNewValue().toString());
}
// if attribute set changed (from any value to any value) clear the attribute set instance m_pAttributeWhere
if (editor instanceof WTableDirEditor && editor.getColumnName().equals("M_AttributeSet_ID"))
asiChanged = true;
for(WEditor otherEditor : editors)
{
if (otherEditor == editor)
continue;
if (asiChanged && otherEditor instanceof WInfoPAttributeEditor)
((WInfoPAttributeEditor)otherEditor).clearWhereClause();
otherEditor.dynamicDisplay();
}

View File

@ -109,6 +109,10 @@ public class WInfoPAttributeEditor extends WEditor implements IWhereClauseEditor
return m_pAttributeWhere;
}
public void clearWhereClause() {
m_pAttributeWhere = null;
}
/**
* Query per Product Attribute.
* <code>
@ -138,7 +142,7 @@ public class WInfoPAttributeEditor extends WEditor implements IWhereClauseEditor
@Override
public void dynamicDisplay() {
int attributeSetId = Env.getContextAsInt(ctx, windowNo, Env.TAB_INFO, "M_AttributeSet_ID");
setReadWrite(attributeSetId > 0);
// int attributeSetId = Env.getContextAsInt(ctx, windowNo, Env.TAB_INFO, "M_AttributeSet_ID");
// setReadWrite(attributeSetId > 0);
}
}