IDEMPIERE-537 Zk: Dynamic Validation Rule for Advanced Query
This commit is contained in:
parent
f8fa9e9a71
commit
679b9ca1f9
|
@ -72,7 +72,7 @@ import org.compiere.util.Evaluator;
|
||||||
* @version $Id: GridField.java,v 1.5 2006/07/30 00:51:02 jjanke Exp $
|
* @version $Id: GridField.java,v 1.5 2006/07/30 00:51:02 jjanke Exp $
|
||||||
*/
|
*/
|
||||||
public class GridField
|
public class GridField
|
||||||
implements Serializable, Evaluatee
|
implements Serializable, Evaluatee, Cloneable
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|
||||||
|
@ -1987,5 +1987,17 @@ public class GridField
|
||||||
{
|
{
|
||||||
return m_vo.displayType == DisplayType.Button && m_vo.IsToolbarButton;
|
return m_vo.displayType == DisplayType.Button && m_vo.IsToolbarButton;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public GridField clone(Properties ctx)
|
||||||
|
{
|
||||||
|
try {
|
||||||
|
GridField field = (GridField) super.clone();
|
||||||
|
field.m_vo.ctx = ctx;
|
||||||
|
field.m_vo.lookupInfo = null;
|
||||||
|
return field;
|
||||||
|
} catch (CloneNotSupportedException e) {
|
||||||
|
throw new IllegalStateException(e.getLocalizedMessage(), e);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
} // MField
|
} // MField
|
||||||
|
|
|
@ -32,6 +32,7 @@ import java.util.Comparator;
|
||||||
import java.util.Hashtable;
|
import java.util.Hashtable;
|
||||||
import java.util.Iterator;
|
import java.util.Iterator;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Properties;
|
||||||
import java.util.Vector;
|
import java.util.Vector;
|
||||||
import java.util.logging.Level;
|
import java.util.logging.Level;
|
||||||
import java.util.regex.Pattern;
|
import java.util.regex.Pattern;
|
||||||
|
@ -199,6 +200,8 @@ public class FindWindow extends Window implements EventListener<Event>, ValueCha
|
||||||
private static final String HISTORY_SEPARATOR = "<#>";
|
private static final String HISTORY_SEPARATOR = "<#>";
|
||||||
|
|
||||||
private Combobox historyCombo = new Combobox();
|
private Combobox historyCombo = new Combobox();
|
||||||
|
|
||||||
|
private Properties m_findCtx;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -227,6 +230,7 @@ public class FindWindow extends Window implements EventListener<Event>, ValueCha
|
||||||
m_minRecords = minRecords;
|
m_minRecords = minRecords;
|
||||||
m_isCancel = true;
|
m_isCancel = true;
|
||||||
//
|
//
|
||||||
|
m_findCtx = new Properties(Env.getCtx());
|
||||||
|
|
||||||
this.setBorder("normal");
|
this.setBorder("normal");
|
||||||
this.setShadow(false);
|
this.setShadow(false);
|
||||||
|
@ -1613,16 +1617,27 @@ public class FindWindow extends Window implements EventListener<Event>, ValueCha
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
//lookupinfo is null for invisible field
|
//reload lookupinfo for find window
|
||||||
if (DisplayType.isLookup(field.getDisplayType()) && field.getLookup() == null) {
|
if (DisplayType.isLookup(field.getDisplayType()) )
|
||||||
field.loadLookupNoValidate();
|
{
|
||||||
|
GridField findField = (GridField) field.clone(m_findCtx);
|
||||||
|
findField.loadLookupNoValidate();
|
||||||
|
|
||||||
|
editor = WebEditorFactory.getEditor(findField, true);
|
||||||
|
findField.addPropertyChangeListener(editor);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
editor = WebEditorFactory.getEditor(field, true);
|
||||||
|
field.addPropertyChangeListener(editor);
|
||||||
}
|
}
|
||||||
editor = WebEditorFactory.getEditor(field, true);
|
|
||||||
}
|
}
|
||||||
if (editor == null)
|
if (editor == null)
|
||||||
|
{
|
||||||
editor = new WStringEditor(field);
|
editor = new WStringEditor(field);
|
||||||
|
field.addPropertyChangeListener(editor);
|
||||||
field.addPropertyChangeListener(editor);
|
}
|
||||||
|
|
||||||
editor.addValueChangeListener(this);
|
editor.addValueChangeListener(this);
|
||||||
editor.setValue(null);
|
editor.setValue(null);
|
||||||
editor.setReadWrite(enabled);
|
editor.setReadWrite(enabled);
|
||||||
|
@ -2079,6 +2094,14 @@ public class FindWindow extends Window implements EventListener<Event>, ValueCha
|
||||||
Component component = editor.getComponent();
|
Component component = editor.getComponent();
|
||||||
ListCell listcell = (ListCell)component.getParent();
|
ListCell listcell = (ListCell)component.getParent();
|
||||||
listcell.setAttribute("value", evt.getNewValue());
|
listcell.setAttribute("value", evt.getNewValue());
|
||||||
|
if (evt.getNewValue() == null)
|
||||||
|
Env.setContext(m_findCtx, m_targetWindowNo, editor.getColumnName(), "");
|
||||||
|
else if (evt.getNewValue() instanceof Boolean)
|
||||||
|
Env.setContext(m_findCtx, m_targetWindowNo, editor.getColumnName(), (Boolean)evt.getNewValue());
|
||||||
|
else if (evt.getNewValue() instanceof Timestamp)
|
||||||
|
Env.setContext(m_findCtx, m_targetWindowNo, editor.getColumnName(), (Timestamp)evt.getNewValue());
|
||||||
|
else
|
||||||
|
Env.setContext(m_findCtx, m_targetWindowNo, editor.getColumnName(), evt.getNewValue().toString());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue