[ 1892335 ] Define custom info class at ad_column or ad_field
This commit is contained in:
parent
ac741f0218
commit
8da616ddfd
|
@ -0,0 +1,22 @@
|
|||
package org.compiere.apps.search;
|
||||
|
||||
import java.awt.Frame;
|
||||
|
||||
public interface InfoFactory {
|
||||
|
||||
/**
|
||||
* Factory Constructor
|
||||
* @param frame parent frame
|
||||
* @param modal new window is modal
|
||||
* @param WindowNo window no
|
||||
* @param tableName table name of the search
|
||||
* @param keyColumn key column of the search
|
||||
* @param value query value
|
||||
* @param multiSelection allow to select more than one row
|
||||
* @param whereClause fully qualified where clause for the search
|
||||
* @return special or general Info Window
|
||||
*/
|
||||
public Info create (Frame frame, boolean modal, int WindowNo,
|
||||
String tableName, String keyColumn, String value,
|
||||
boolean multiSelection, String whereClause);
|
||||
}
|
|
@ -724,8 +724,25 @@ public class VLookup extends JComponent
|
|||
+ ", Zoom=" + m_lookup.getZoom()
|
||||
+ " (" + whereClause + ")");
|
||||
//
|
||||
boolean resetValue = false; // reset value so that is always treated as new entry
|
||||
if (col.equals("M_Product_ID"))
|
||||
boolean resetValue = false; // reset value so that is always treated as new entry
|
||||
String infoFactoryClass = m_lookup.getInfoFactoryClass();
|
||||
if (infoFactoryClass != null && infoFactoryClass.trim().length() > 0)
|
||||
{
|
||||
try {
|
||||
Class<InfoFactory> clazz = (Class<InfoFactory>)this.getClass().getClassLoader().loadClass(infoFactoryClass);
|
||||
InfoFactory factory = clazz.newInstance();
|
||||
if (m_tableName == null) // sets table name & key column
|
||||
getDirectAccessSQL("*");
|
||||
Info ig = factory.create (frame, true, m_lookup.getWindowNo(),
|
||||
m_tableName, m_keyColumnName, queryValue, false, whereClause);
|
||||
ig.setVisible(true);
|
||||
cancelled = ig.isCancelled();
|
||||
result = ig.getSelectedKey();
|
||||
} catch (Exception e) {
|
||||
log.log(Level.SEVERE, "Failed to load custom InfoFactory - " + e.getLocalizedMessage(), e);
|
||||
}
|
||||
}
|
||||
else if (col.equals("M_Product_ID"))
|
||||
{
|
||||
// Reset
|
||||
Env.setContext(Env.getCtx(), Env.WINDOW_INFO, Env.TAB_INFO, "M_Product_ID", "0");
|
||||
|
|
Loading…
Reference in New Issue