Implemented info factory as extension point for zk and swing client.
This commit is contained in:
parent
c321e8feb6
commit
b9e40c4bf4
|
@ -21,6 +21,8 @@
|
|||
</factory>
|
||||
</extension>
|
||||
<extension
|
||||
id="org.adempiere.base.DefaultDocFactory"
|
||||
name="Default Document Factory"
|
||||
point="org.adempiere.base.IDocFactory">
|
||||
<factory
|
||||
class="org.adempiere.base.DefaultDocumentFactory"
|
||||
|
|
|
@ -3,6 +3,7 @@
|
|||
<plugin>
|
||||
<extension-point id="org.adempiere.osgi.IMenuAction" name="MenuAction" schema="schema/org.adempiere.osgi.IMenuAction.exsd"/>
|
||||
<extension-point id="org.adempiere.apps.Form" name="Form" schema="schema/org.adempiere.apps.Form.exsd"/>
|
||||
<extension-point id="org.adempiere.osgi.IInfoFactory" name="Info Factory extension" schema="schema/org.adempiere.osgi.IInfoFactory.exsd"/>
|
||||
<extension
|
||||
id="RF"
|
||||
name="RF"
|
||||
|
@ -49,5 +50,14 @@
|
|||
</property>
|
||||
</product>
|
||||
</extension>
|
||||
<extension
|
||||
id="org.adempiere.osgi.DefaultInfoFactory"
|
||||
name="Default Info Factory"
|
||||
point="org.adempiere.osgi.IInfoFactory">
|
||||
<factory
|
||||
class="org.adempiere.osgi.DefaultInfoFactory"
|
||||
priority="0">
|
||||
</factory>
|
||||
</extension>
|
||||
|
||||
</plugin>
|
||||
|
|
|
@ -0,0 +1,109 @@
|
|||
<?xml version='1.0' encoding='UTF-8'?>
|
||||
<!-- Schema file written by PDE -->
|
||||
<schema targetNamespace="org.adempiere.ui.swing" xmlns="http://www.w3.org/2001/XMLSchema">
|
||||
<annotation>
|
||||
<appinfo>
|
||||
<meta.schema plugin="org.adempiere.ui.swing" id="org.adempiere.osgi.IInfoFactory" name="Info Factory extension"/>
|
||||
</appinfo>
|
||||
<documentation>
|
||||
[Enter description of this extension point.]
|
||||
</documentation>
|
||||
</annotation>
|
||||
|
||||
<element name="extension">
|
||||
<annotation>
|
||||
<appinfo>
|
||||
<meta.element />
|
||||
</appinfo>
|
||||
</annotation>
|
||||
<complexType>
|
||||
<choice>
|
||||
<element ref="factory"/>
|
||||
</choice>
|
||||
<attribute name="point" type="string" use="required">
|
||||
<annotation>
|
||||
<documentation>
|
||||
|
||||
</documentation>
|
||||
</annotation>
|
||||
</attribute>
|
||||
<attribute name="id" type="string">
|
||||
<annotation>
|
||||
<documentation>
|
||||
|
||||
</documentation>
|
||||
</annotation>
|
||||
</attribute>
|
||||
<attribute name="name" type="string">
|
||||
<annotation>
|
||||
<documentation>
|
||||
|
||||
</documentation>
|
||||
<appinfo>
|
||||
<meta.attribute translatable="true"/>
|
||||
</appinfo>
|
||||
</annotation>
|
||||
</attribute>
|
||||
</complexType>
|
||||
</element>
|
||||
|
||||
<element name="factory">
|
||||
<complexType>
|
||||
<attribute name="priority" type="string" use="required">
|
||||
<annotation>
|
||||
<documentation>
|
||||
numeric priority value. bigger number have higher priority.
|
||||
</documentation>
|
||||
</annotation>
|
||||
</attribute>
|
||||
<attribute name="class" type="string" use="required">
|
||||
<annotation>
|
||||
<documentation>
|
||||
|
||||
</documentation>
|
||||
<appinfo>
|
||||
<meta.attribute kind="java" basedOn=":org.adempiere.osgi.IInfoFactory"/>
|
||||
</appinfo>
|
||||
</annotation>
|
||||
</attribute>
|
||||
</complexType>
|
||||
</element>
|
||||
|
||||
<annotation>
|
||||
<appinfo>
|
||||
<meta.section type="since"/>
|
||||
</appinfo>
|
||||
<documentation>
|
||||
[Enter the first release in which this extension point appears.]
|
||||
</documentation>
|
||||
</annotation>
|
||||
|
||||
<annotation>
|
||||
<appinfo>
|
||||
<meta.section type="examples"/>
|
||||
</appinfo>
|
||||
<documentation>
|
||||
[Enter extension point usage example here.]
|
||||
</documentation>
|
||||
</annotation>
|
||||
|
||||
<annotation>
|
||||
<appinfo>
|
||||
<meta.section type="apiinfo"/>
|
||||
</appinfo>
|
||||
<documentation>
|
||||
[Enter API information here.]
|
||||
</documentation>
|
||||
</annotation>
|
||||
|
||||
<annotation>
|
||||
<appinfo>
|
||||
<meta.section type="implementation"/>
|
||||
</appinfo>
|
||||
<documentation>
|
||||
[Enter information about supplied implementation of this extension point.]
|
||||
</documentation>
|
||||
</annotation>
|
||||
|
||||
|
||||
</schema>
|
|
@ -0,0 +1,145 @@
|
|||
/******************************************************************************
|
||||
* Product: Adempiere ERP & CRM Smart Business Solution *
|
||||
* Copyright (C) 2010 Heng Sin Low *
|
||||
* This program is free software; you can redistribute it and/or modify it *
|
||||
* under the terms version 2 of the GNU General Public License as published *
|
||||
* by the Free Software Foundation. This program is distributed in the hope *
|
||||
* that it will be useful, but WITHOUT ANY WARRANTY; without even the implied *
|
||||
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. *
|
||||
* See the GNU General Public License for more details. *
|
||||
* You should have received a copy of the GNU General Public License along *
|
||||
* with this program; if not, write to the Free Software Foundation, Inc., *
|
||||
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. *
|
||||
*****************************************************************************/
|
||||
package org.adempiere.osgi;
|
||||
|
||||
import java.awt.Frame;
|
||||
import java.util.logging.Level;
|
||||
|
||||
import org.compiere.apps.search.Info;
|
||||
import org.compiere.apps.search.InfoAsset;
|
||||
import org.compiere.apps.search.InfoAssignment;
|
||||
import org.compiere.apps.search.InfoBPartner;
|
||||
import org.compiere.apps.search.InfoCashLine;
|
||||
import org.compiere.apps.search.InfoFactory;
|
||||
import org.compiere.apps.search.InfoGeneral;
|
||||
import org.compiere.apps.search.InfoInOut;
|
||||
import org.compiere.apps.search.InfoInvoice;
|
||||
import org.compiere.apps.search.InfoOrder;
|
||||
import org.compiere.apps.search.InfoPayment;
|
||||
import org.compiere.apps.search.InfoProduct;
|
||||
import org.compiere.model.GridField;
|
||||
import org.compiere.model.Lookup;
|
||||
import org.compiere.model.MColumn;
|
||||
import org.compiere.model.MInvoiceLine;
|
||||
import org.compiere.model.MOrderLine;
|
||||
import org.compiere.model.MProductPrice;
|
||||
import org.compiere.util.CLogger;
|
||||
import org.compiere.util.Env;
|
||||
import org.eevolution.model.I_PP_Product_BOMLine;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author hengsin
|
||||
*
|
||||
*/
|
||||
public class DefaultInfoFactory implements IInfoFactory {
|
||||
|
||||
private final static CLogger log = CLogger.getCLogger(DefaultInfoFactory.class);
|
||||
|
||||
@Override
|
||||
public Info create(Frame frame, boolean modal, Lookup lookup,
|
||||
GridField field, String tableName, String keyColumn, String queryValue,
|
||||
boolean multiSelection, String whereClause) {
|
||||
Info info = null;
|
||||
String col = lookup.getColumnName(); // fully qualified name
|
||||
if (col.indexOf('.') != -1)
|
||||
col = col.substring(col.indexOf('.')+1);
|
||||
boolean multipleSelection = false;
|
||||
String infoFactoryClass = lookup.getInfoFactoryClass();
|
||||
if (infoFactoryClass != null && infoFactoryClass.trim().length() > 0)
|
||||
{
|
||||
try {
|
||||
@SuppressWarnings("unchecked")
|
||||
Class<InfoFactory> clazz = (Class<InfoFactory>)this.getClass().getClassLoader().loadClass(infoFactoryClass);
|
||||
InfoFactory factory = clazz.newInstance();
|
||||
info = factory.create (frame, true, lookup.getWindowNo(),
|
||||
tableName, keyColumn, queryValue, false, whereClause);
|
||||
} catch (Exception e) {
|
||||
log.log(Level.SEVERE, "Failed to load custom InfoFactory - " + e.getLocalizedMessage(), e);
|
||||
}
|
||||
}
|
||||
else if (col.equals("M_Product_ID"))
|
||||
{
|
||||
int M_Warehouse_ID = Env.getContextAsInt(Env.getCtx(), lookup.getWindowNo(), "M_Warehouse_ID");
|
||||
int M_PriceList_ID = Env.getContextAsInt(Env.getCtx(), lookup.getWindowNo(), "M_PriceList_ID");
|
||||
|
||||
if(field != null)
|
||||
{
|
||||
int AD_Table_ID = MColumn.getTable_ID(Env.getCtx(), field.getAD_Column_ID(), null);
|
||||
multipleSelection = (MOrderLine.Table_ID == AD_Table_ID) || (MInvoiceLine.Table_ID == AD_Table_ID) || (I_PP_Product_BOMLine.Table_ID == AD_Table_ID) || (MProductPrice.Table_ID == AD_Table_ID);
|
||||
}
|
||||
// Show Info
|
||||
info = new InfoProduct (frame, true, lookup.getWindowNo(),
|
||||
M_Warehouse_ID, M_PriceList_ID, queryValue, multipleSelection, whereClause);
|
||||
}
|
||||
else if (col.equals("C_BPartner_ID"))
|
||||
{
|
||||
boolean isSOTrx = true; // default
|
||||
if (Env.getContext(Env.getCtx(), lookup.getWindowNo(), "IsSOTrx").equals("N"))
|
||||
isSOTrx = false;
|
||||
info = new InfoBPartner (frame, true, lookup.getWindowNo(),
|
||||
queryValue, isSOTrx, multipleSelection, whereClause);
|
||||
}
|
||||
else // General Info
|
||||
{
|
||||
info = create (frame, true, lookup.getWindowNo(),
|
||||
tableName, keyColumn, queryValue, multipleSelection, whereClause, true);
|
||||
}
|
||||
return info;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Info create(Frame frame, boolean modal, int WindowNo,
|
||||
String tableName, String keyColumn, String value,
|
||||
boolean multiSelection, String whereClause, boolean lookup) {
|
||||
Info info = null;
|
||||
|
||||
if (tableName.equals("C_BPartner"))
|
||||
info = new InfoBPartner (frame, modal, WindowNo, value, !Env.getContext(Env.getCtx(),"IsSOTrx").equals("N"),
|
||||
multiSelection, whereClause, lookup);
|
||||
else if (tableName.equals("M_Product"))
|
||||
info = new InfoProduct (frame, modal, WindowNo,
|
||||
Env.getContextAsInt(Env.getCtx(), WindowNo, "M_Warehouse_ID"),
|
||||
Env.getContextAsInt(Env.getCtx(), WindowNo, "M_PriceList_ID"),
|
||||
value, multiSelection, whereClause, lookup);
|
||||
else if (tableName.equals("C_Invoice"))
|
||||
info = new InfoInvoice (frame, modal, WindowNo, value,
|
||||
multiSelection, whereClause, lookup);
|
||||
else if (tableName.equals("A_Asset"))
|
||||
info = new InfoAsset (frame, modal, WindowNo, 0, value,
|
||||
multiSelection, whereClause, lookup);
|
||||
else if (tableName.equals("C_Order"))
|
||||
info = new InfoOrder (frame, modal, WindowNo, value,
|
||||
multiSelection, whereClause, lookup);
|
||||
else if (tableName.equals("M_InOut"))
|
||||
info = new InfoInOut (frame, modal, WindowNo, value,
|
||||
multiSelection, whereClause, lookup);
|
||||
else if (tableName.equals("C_Payment"))
|
||||
info = new InfoPayment (frame, modal, WindowNo, value,
|
||||
multiSelection, whereClause, lookup);
|
||||
else if (tableName.equals("C_CashLine"))
|
||||
info = new InfoCashLine (frame, modal, WindowNo, value,
|
||||
multiSelection, whereClause);
|
||||
else if (tableName.equals("S_ResourceAssigment"))
|
||||
info = new InfoAssignment (frame, modal, WindowNo, value,
|
||||
multiSelection, whereClause, lookup);
|
||||
else
|
||||
info = new InfoGeneral (frame, modal, WindowNo, value,
|
||||
tableName, keyColumn,
|
||||
multiSelection, whereClause, lookup);
|
||||
//
|
||||
return info;
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,62 @@
|
|||
/******************************************************************************
|
||||
* Product: Adempiere ERP & CRM Smart Business Solution *
|
||||
* Copyright (C) 2010 Heng Sin Low *
|
||||
* This program is free software; you can redistribute it and/or modify it *
|
||||
* under the terms version 2 of the GNU General Public License as published *
|
||||
* by the Free Software Foundation. This program is distributed in the hope *
|
||||
* that it will be useful, but WITHOUT ANY WARRANTY; without even the implied *
|
||||
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. *
|
||||
* See the GNU General Public License for more details. *
|
||||
* You should have received a copy of the GNU General Public License along *
|
||||
* with this program; if not, write to the Free Software Foundation, Inc., *
|
||||
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. *
|
||||
*****************************************************************************/
|
||||
package org.adempiere.osgi;
|
||||
|
||||
import java.awt.Frame;
|
||||
|
||||
import org.compiere.apps.search.Info;
|
||||
import org.compiere.model.GridField;
|
||||
import org.compiere.model.Lookup;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author hengsin
|
||||
*
|
||||
*/
|
||||
public interface IInfoFactory {
|
||||
|
||||
/**
|
||||
* Factory Constructor
|
||||
* @param frame parent frame
|
||||
* @param modal new window is modal
|
||||
* @param lookup Lookup
|
||||
* @param field Grid field
|
||||
* @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, Lookup lookup, GridField field,
|
||||
String tableName, String keyColumn, String value,
|
||||
boolean multiSelection, String whereClause);
|
||||
|
||||
/**
|
||||
* 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
|
||||
* @param lookup
|
||||
* @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, boolean lookup);
|
||||
}
|
|
@ -0,0 +1,90 @@
|
|||
/******************************************************************************
|
||||
* Product: Adempiere ERP & CRM Smart Business Solution *
|
||||
* Copyright (C) 2010 Heng Sin Low *
|
||||
* This program is free software; you can redistribute it and/or modify it *
|
||||
* under the terms version 2 of the GNU General Public License as published *
|
||||
* by the Free Software Foundation. This program is distributed in the hope *
|
||||
* that it will be useful, but WITHOUT ANY WARRANTY; without even the implied *
|
||||
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. *
|
||||
* See the GNU General Public License for more details. *
|
||||
* You should have received a copy of the GNU General Public License along *
|
||||
* with this program; if not, write to the Free Software Foundation, Inc., *
|
||||
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. *
|
||||
*****************************************************************************/
|
||||
package org.adempiere.osgi;
|
||||
|
||||
import java.awt.Frame;
|
||||
import java.util.List;
|
||||
|
||||
import org.adempiere.base.Service;
|
||||
import org.compiere.apps.search.Info;
|
||||
import org.compiere.model.GridField;
|
||||
import org.compiere.model.Lookup;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author hengsin
|
||||
*
|
||||
*/
|
||||
public class InfoManager
|
||||
{
|
||||
/**
|
||||
* Factory Constructor
|
||||
* @param frame parent frame
|
||||
* @param modal new window is modal
|
||||
* @param lookup Lookup
|
||||
* @param field Grid field
|
||||
* @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 static Info create(Frame frame, boolean modal, Lookup lookup,
|
||||
GridField field, String tableName, String keyColumn, String queryValue,
|
||||
boolean multiSelection, String whereClause)
|
||||
{
|
||||
Info info = null;
|
||||
List<IInfoFactory> factoryList = Service.list(IInfoFactory.class);
|
||||
for(IInfoFactory factory : factoryList)
|
||||
{
|
||||
info = factory.create(frame, true, lookup, field, tableName, keyColumn,
|
||||
queryValue, multiSelection, whereClause);
|
||||
if (info != null)
|
||||
break;
|
||||
}
|
||||
return info;
|
||||
}
|
||||
|
||||
/**
|
||||
* 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
|
||||
* @param lookup
|
||||
* @return special or general Info Window
|
||||
*/
|
||||
public static Info create(Frame frame, boolean modal, int WindowNo,
|
||||
String tableName, String keyColumn, String value,
|
||||
boolean multiSelection, String whereClause, boolean lookup)
|
||||
{
|
||||
Info info = null;
|
||||
|
||||
List<IInfoFactory> factoryList = Service.list(IInfoFactory.class);
|
||||
for(IInfoFactory factory : factoryList)
|
||||
{
|
||||
info = factory.create(frame, modal, WindowNo, tableName, keyColumn, value,
|
||||
multiSelection, whereClause, lookup);
|
||||
if (info != null)
|
||||
break;
|
||||
}
|
||||
//
|
||||
return info;
|
||||
}
|
||||
}
|
|
@ -40,6 +40,7 @@ import javax.swing.SwingUtilities;
|
|||
import javax.swing.event.ListSelectionEvent;
|
||||
import javax.swing.event.ListSelectionListener;
|
||||
|
||||
import org.adempiere.osgi.InfoManager;
|
||||
import org.compiere.apps.ADialog;
|
||||
import org.compiere.apps.AEnv;
|
||||
import org.compiere.apps.AWindow;
|
||||
|
@ -49,6 +50,15 @@ import org.compiere.apps.StatusBar;
|
|||
import org.compiere.grid.ed.Calculator;
|
||||
import org.compiere.minigrid.IDColumn;
|
||||
import org.compiere.minigrid.MiniTable;
|
||||
import org.compiere.model.I_A_Asset;
|
||||
import org.compiere.model.I_C_BPartner;
|
||||
import org.compiere.model.I_C_CashLine;
|
||||
import org.compiere.model.I_C_Invoice;
|
||||
import org.compiere.model.I_C_Order;
|
||||
import org.compiere.model.I_C_Payment;
|
||||
import org.compiere.model.I_M_InOut;
|
||||
import org.compiere.model.I_M_Product;
|
||||
import org.compiere.model.I_S_ResourceAssignment;
|
||||
import org.compiere.model.MQuery;
|
||||
import org.compiere.model.MRole;
|
||||
import org.compiere.model.MSysConfig;
|
||||
|
@ -112,39 +122,8 @@ public abstract class Info extends CDialog
|
|||
String tableName, String keyColumn, String value,
|
||||
boolean multiSelection, String whereClause)
|
||||
{
|
||||
Info info = null;
|
||||
|
||||
if (tableName.equals("C_BPartner"))
|
||||
info = new InfoBPartner (frame, modal, WindowNo, value, !Env.getContext(Env.getCtx(),"IsSOTrx").equals("N"),
|
||||
multiSelection, whereClause);
|
||||
else if (tableName.equals("M_Product"))
|
||||
info = new InfoProduct (frame, modal, WindowNo, 0,0, value,
|
||||
multiSelection, whereClause);
|
||||
else if (tableName.equals("C_Invoice"))
|
||||
info = new InfoInvoice (frame, modal, WindowNo, value,
|
||||
multiSelection, whereClause);
|
||||
else if (tableName.equals("A_Asset"))
|
||||
info = new InfoAsset (frame, modal, WindowNo, 0, value,
|
||||
multiSelection, whereClause);
|
||||
else if (tableName.equals("C_Order"))
|
||||
info = new InfoOrder (frame, modal, WindowNo, value,
|
||||
multiSelection, whereClause);
|
||||
else if (tableName.equals("M_InOut"))
|
||||
info = new InfoInOut (frame, modal, WindowNo, value,
|
||||
multiSelection, whereClause);
|
||||
else if (tableName.equals("C_Payment"))
|
||||
info = new InfoPayment (frame, modal, WindowNo, value,
|
||||
multiSelection, whereClause);
|
||||
else if (tableName.equals("C_CashLine"))
|
||||
info = new InfoCashLine (frame, modal, WindowNo, value,
|
||||
multiSelection, whereClause);
|
||||
else if (tableName.equals("S_ResourceAssigment"))
|
||||
info = new InfoAssignment (frame, modal, WindowNo, value,
|
||||
multiSelection, whereClause);
|
||||
else
|
||||
info = new InfoGeneral (frame, modal, WindowNo, value,
|
||||
tableName, keyColumn,
|
||||
multiSelection, whereClause);
|
||||
Info info = InfoManager.create(frame, modal, WindowNo, tableName, keyColumn, value,
|
||||
multiSelection, whereClause, true);
|
||||
//
|
||||
AEnv.positionCenterWindow(frame, info);
|
||||
return info;
|
||||
|
@ -157,8 +136,9 @@ public abstract class Info extends CDialog
|
|||
*/
|
||||
public static void showBPartner (Frame frame, int WindowNo)
|
||||
{
|
||||
Info info = new InfoBPartner (frame, false, WindowNo, "",
|
||||
!Env.getContext(Env.getCtx(),"IsSOTrx").equals("N"), false, "");
|
||||
Info info = InfoManager.create(frame, false, WindowNo,
|
||||
I_C_BPartner.Table_Name, I_C_BPartner.COLUMNNAME_C_BPartner_ID,
|
||||
"", false, "", false);
|
||||
AEnv.showCenterWindow(frame, info);
|
||||
} // showBPartner
|
||||
|
||||
|
@ -169,8 +149,9 @@ public abstract class Info extends CDialog
|
|||
*/
|
||||
public static void showAsset (Frame frame, int WindowNo)
|
||||
{
|
||||
Info info = new InfoAsset (frame, false, WindowNo,
|
||||
0, "", false, "");
|
||||
Info info = InfoManager.create(frame, false, WindowNo,
|
||||
I_A_Asset.Table_Name, I_A_Asset.COLUMNNAME_A_Asset_ID,
|
||||
"", false, "", false);
|
||||
AEnv.showCenterWindow(frame, info);
|
||||
} // showBPartner
|
||||
|
||||
|
@ -181,11 +162,9 @@ public abstract class Info extends CDialog
|
|||
*/
|
||||
public static void showProduct (Frame frame, int WindowNo)
|
||||
{
|
||||
Info info = new InfoProduct (frame, false, WindowNo,
|
||||
Env.getContextAsInt(Env.getCtx(), WindowNo, "M_Warehouse_ID"),
|
||||
Env.getContextAsInt(Env.getCtx(), WindowNo, "M_PriceList_ID"),
|
||||
"", // value
|
||||
false, "");
|
||||
Info info = InfoManager.create(frame, false, WindowNo,
|
||||
I_M_Product.Table_Name, I_M_Product.COLUMNNAME_M_Product_ID,
|
||||
"", false, "", false);
|
||||
AEnv.showCenterWindow(frame, info);
|
||||
} // showProduct
|
||||
|
||||
|
@ -197,8 +176,9 @@ public abstract class Info extends CDialog
|
|||
*/
|
||||
public static void showOrder (Frame frame, int WindowNo, String value)
|
||||
{
|
||||
Info info = new InfoOrder (frame, false, WindowNo, value,
|
||||
false, "");
|
||||
Info info = InfoManager.create(frame, false, WindowNo,
|
||||
I_C_Order.Table_Name, I_C_Order.COLUMNNAME_C_Order_ID,
|
||||
"", false, "", false);
|
||||
AEnv.showCenterWindow(frame, info);
|
||||
} // showOrder
|
||||
|
||||
|
@ -210,8 +190,9 @@ public abstract class Info extends CDialog
|
|||
*/
|
||||
public static void showInvoice (Frame frame, int WindowNo, String value)
|
||||
{
|
||||
Info info = new InfoInvoice (frame, false, WindowNo, value,
|
||||
false, "");
|
||||
Info info = InfoManager.create(frame, false, WindowNo,
|
||||
I_C_Invoice.Table_Name, I_C_Invoice.COLUMNNAME_C_Invoice_ID,
|
||||
"", false, "", false);
|
||||
AEnv.showCenterWindow(frame, info);
|
||||
} // showInvoice
|
||||
|
||||
|
@ -223,8 +204,9 @@ public abstract class Info extends CDialog
|
|||
*/
|
||||
public static void showInOut (Frame frame, int WindowNo, String value)
|
||||
{
|
||||
Info info = new InfoInOut (frame, false, WindowNo, value,
|
||||
false, "");
|
||||
Info info = InfoManager.create(frame, false, WindowNo,
|
||||
I_M_InOut.Table_Name, I_M_InOut.COLUMNNAME_M_InOut_ID,
|
||||
"", false, "", false);
|
||||
AEnv.showCenterWindow(frame, info);
|
||||
} // showInOut
|
||||
|
||||
|
@ -236,8 +218,9 @@ public abstract class Info extends CDialog
|
|||
*/
|
||||
public static void showPayment (Frame frame, int WindowNo, String value)
|
||||
{
|
||||
Info info = new InfoPayment (frame, false, WindowNo, value,
|
||||
false, "");
|
||||
Info info = InfoManager.create(frame, false, WindowNo,
|
||||
I_C_Payment.Table_Name, I_C_Payment.COLUMNNAME_C_Payment_ID,
|
||||
"", false, "", false);
|
||||
AEnv.showCenterWindow(frame, info);
|
||||
} // showPayment
|
||||
|
||||
|
@ -249,8 +232,9 @@ public abstract class Info extends CDialog
|
|||
*/
|
||||
public static void showCashLine (Frame frame, int WindowNo, String value)
|
||||
{
|
||||
Info info = new InfoCashLine (frame, false, WindowNo, value,
|
||||
false, "");
|
||||
Info info = InfoManager.create(frame, false, WindowNo,
|
||||
I_C_CashLine.Table_Name, I_C_CashLine.COLUMNNAME_C_CashLine_ID,
|
||||
"", false, "", false);
|
||||
AEnv.showCenterWindow(frame, info);
|
||||
} // showCashLine
|
||||
|
||||
|
@ -262,8 +246,9 @@ public abstract class Info extends CDialog
|
|||
*/
|
||||
public static void showAssignment (Frame frame, int WindowNo, String value)
|
||||
{
|
||||
Info info = new InfoAssignment (frame, false, WindowNo, value,
|
||||
false, "");
|
||||
Info info = InfoManager.create(frame, false, WindowNo,
|
||||
I_S_ResourceAssignment.Table_Name, I_S_ResourceAssignment.COLUMNNAME_S_ResourceAssignment_ID,
|
||||
"", false, "", false);
|
||||
AEnv.showCenterWindow(frame, info);
|
||||
} // showAssignment
|
||||
|
||||
|
@ -274,6 +259,8 @@ public abstract class Info extends CDialog
|
|||
protected final int INFO_WIDTH = screensize.width > 1500 ? 1500 : screensize.width - 100;
|
||||
protected final int SCREEN_HEIGHT = screensize.height;
|
||||
|
||||
private boolean p_lookup;
|
||||
|
||||
/**************************************************************************
|
||||
* Detail Constructor
|
||||
* @param frame parent frame
|
||||
|
@ -287,6 +274,24 @@ public abstract class Info extends CDialog
|
|||
protected Info (Frame frame, boolean modal, int WindowNo,
|
||||
String tableName, String keyColumn,
|
||||
boolean multiSelection, String whereClause)
|
||||
{
|
||||
this(frame,modal,WindowNo,tableName,keyColumn,multiSelection,whereClause,true);
|
||||
}
|
||||
|
||||
/**************************************************************************
|
||||
* Detail Constructor
|
||||
* @param frame parent frame
|
||||
* @param modal modal
|
||||
* @param WindowNo window no
|
||||
* @param tableName table name
|
||||
* @param keyColumn key column name
|
||||
* @param multiSelection multiple selection
|
||||
* @param whereClause where clause
|
||||
* @param lookup
|
||||
*/
|
||||
protected Info (Frame frame, boolean modal, int WindowNo,
|
||||
String tableName, String keyColumn,
|
||||
boolean multiSelection, String whereClause, boolean lookup)
|
||||
{
|
||||
super (frame, modal);
|
||||
log.info("WinNo=" + p_WindowNo + " " + whereClause);
|
||||
|
@ -294,6 +299,7 @@ public abstract class Info extends CDialog
|
|||
p_tableName = tableName;
|
||||
p_keyColumn = keyColumn;
|
||||
p_multiSelection = multiSelection;
|
||||
p_lookup = lookup;
|
||||
if (whereClause == null || whereClause.indexOf('@') == -1)
|
||||
p_whereClause = whereClause;
|
||||
else
|
||||
|
@ -1093,6 +1099,16 @@ public abstract class Info extends CDialog
|
|||
return p_doubleClickTogglesSelection;
|
||||
}
|
||||
|
||||
// reset value so that is always treated as new entry
|
||||
public boolean isResetValue()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
public boolean isLookup()
|
||||
{
|
||||
return p_lookup;
|
||||
}
|
||||
|
||||
/**************************************************************************
|
||||
* Mouse Clicked
|
||||
|
@ -1107,7 +1123,7 @@ public abstract class Info extends CDialog
|
|||
// Double click with selected row => exit/zoom
|
||||
if (e.getClickCount() > 1 && p_table.getSelectedRow() != -1)
|
||||
{
|
||||
if (p_multiSelection && isDoubleClickTogglesSelection())
|
||||
if (isLookup() && p_multiSelection && isDoubleClickTogglesSelection())
|
||||
{
|
||||
if (m_keyColumnIndex >= 0)
|
||||
{
|
||||
|
@ -1121,8 +1137,18 @@ public abstract class Info extends CDialog
|
|||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (isLookup())
|
||||
{
|
||||
dispose(true);
|
||||
}
|
||||
else
|
||||
{
|
||||
zoom();
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
// Right Click => start Calculator
|
||||
else if (SwingUtilities.isRightMouseButton(e))
|
||||
{
|
||||
|
|
|
@ -50,7 +50,6 @@ public class InfoAsset extends Info
|
|||
|
||||
/**
|
||||
* Standard Constructor
|
||||
|
||||
* @param frame frame
|
||||
* @param modal modal
|
||||
* @param WindowNo window no
|
||||
|
@ -62,6 +61,24 @@ public class InfoAsset extends Info
|
|||
public InfoAsset (Frame frame, boolean modal, int WindowNo,
|
||||
int A_Asset_ID, String value,
|
||||
boolean multiSelection, String whereClause)
|
||||
{
|
||||
this(frame, modal, WindowNo, A_Asset_ID, value, multiSelection, whereClause, true);
|
||||
}
|
||||
|
||||
/**
|
||||
* Standard Constructor
|
||||
* @param frame frame
|
||||
* @param modal modal
|
||||
* @param WindowNo window no
|
||||
* @param A_Asset_ID asset
|
||||
* @param value Query Value or Name if enclosed in @
|
||||
* @param multiSelection multiple selections
|
||||
* @param whereClause where clause
|
||||
* @param lookup
|
||||
*/
|
||||
public InfoAsset (Frame frame, boolean modal, int WindowNo,
|
||||
int A_Asset_ID, String value,
|
||||
boolean multiSelection, String whereClause, boolean lookup)
|
||||
{
|
||||
super (frame, modal, WindowNo, "a", "A_Asset_ID", multiSelection, whereClause);
|
||||
log.info(value + ", ID=" + A_Asset_ID + ", WHERE=" + whereClause);
|
||||
|
|
|
@ -63,9 +63,25 @@ public class InfoAssignment extends Info
|
|||
*/
|
||||
public InfoAssignment (Frame frame, boolean modal, int WindowNo,
|
||||
String value, boolean multiSelection, String whereClause)
|
||||
{
|
||||
this(frame, modal, WindowNo, value, multiSelection, whereClause, true);
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
* @param frame frame
|
||||
* @param modal modal
|
||||
* @param WindowNo WindowNo
|
||||
* @param value Query value Name or Value if contains numbers
|
||||
* @param multiSelection multiple selection
|
||||
* @param whereClause where clause
|
||||
* @param lookup
|
||||
*/
|
||||
public InfoAssignment (Frame frame, boolean modal, int WindowNo,
|
||||
String value, boolean multiSelection, String whereClause, boolean lookup)
|
||||
{
|
||||
super (frame, modal, WindowNo, "ra", "S_ResourceAssigment_ID",
|
||||
multiSelection, whereClause);
|
||||
multiSelection, whereClause, lookup);
|
||||
log.info(value);
|
||||
setTitle(Msg.getMsg(Env.getCtx(), "InfoAssignment"));
|
||||
//
|
||||
|
|
|
@ -62,7 +62,25 @@ public class InfoBPartner extends Info
|
|||
String value, boolean isSOTrx,
|
||||
boolean multiSelection, String whereClause)
|
||||
{
|
||||
super (frame, modal, WindowNo, "C_BPartner", "C_BPartner_ID", multiSelection, whereClause);
|
||||
this(frame, modal, WindowNo, value, isSOTrx, multiSelection, whereClause, true);
|
||||
}
|
||||
|
||||
/**
|
||||
* Standard Constructor
|
||||
* @param frame frame
|
||||
* @param modal modal
|
||||
* @param WindowNo WindowNo
|
||||
* @param value Query value Name or Value if contains numbers
|
||||
* @param isSOTrx if false, query vendors only
|
||||
* @param multiSelection multiple selection
|
||||
* @param whereClause where clause
|
||||
* @param lookup
|
||||
*/
|
||||
public InfoBPartner(Frame frame, boolean modal, int WindowNo,
|
||||
String value, boolean isSOTrx,
|
||||
boolean multiSelection, String whereClause, boolean lookup)
|
||||
{
|
||||
super (frame, modal, WindowNo, "C_BPartner", "C_BPartner_ID", multiSelection, whereClause, lookup);
|
||||
log.info(value);
|
||||
setTitle(Msg.getMsg(Env.getCtx(), "InfoBPartner"));
|
||||
m_isSOTrx = isSOTrx;
|
||||
|
|
|
@ -66,7 +66,7 @@ public class InfoCashLine extends Info
|
|||
* @param multiSelection multiple selections
|
||||
* @param whereClause whwre clause
|
||||
*/
|
||||
protected InfoCashLine(Frame frame, boolean modal, int WindowNo, String value,
|
||||
public InfoCashLine(Frame frame, boolean modal, int WindowNo, String value,
|
||||
boolean multiSelection, String whereClause)
|
||||
{
|
||||
super (frame, modal, WindowNo, "cl", "C_CashLine_ID", multiSelection, whereClause);
|
||||
|
|
|
@ -69,11 +69,31 @@ public class InfoGeneral extends Info
|
|||
* @param multiSelection multiple selections
|
||||
* @param whereClause where clause
|
||||
*/
|
||||
protected InfoGeneral (Frame frame, boolean modal, int WindowNo, String value,
|
||||
public InfoGeneral (Frame frame, boolean modal, int WindowNo, String value,
|
||||
String tableName, String keyColumn,
|
||||
boolean multiSelection, String whereClause)
|
||||
{
|
||||
super (frame, modal, WindowNo, tableName, keyColumn, multiSelection, whereClause);
|
||||
this(frame, modal, WindowNo, value, tableName, keyColumn, multiSelection, whereClause, true);
|
||||
}
|
||||
|
||||
/**
|
||||
* Detail Protected Constructor.
|
||||
*
|
||||
* @param frame parent
|
||||
* @param modal modal
|
||||
* @param WindowNo window no
|
||||
* @param value QueryValue
|
||||
* @param tableName table name
|
||||
* @param keyColumn key column (ignored)
|
||||
* @param multiSelection multiple selections
|
||||
* @param whereClause where clause
|
||||
* @param lookup
|
||||
*/
|
||||
public InfoGeneral (Frame frame, boolean modal, int WindowNo, String value,
|
||||
String tableName, String keyColumn,
|
||||
boolean multiSelection, String whereClause, boolean lookup)
|
||||
{
|
||||
super (frame, modal, WindowNo, tableName, keyColumn, multiSelection, whereClause, lookup);
|
||||
log.info(tableName + " - " + keyColumn + " - " + whereClause);
|
||||
setTitle(Msg.getMsg(Env.getCtx(), "Info"));
|
||||
//
|
||||
|
|
|
@ -61,10 +61,26 @@ public class InfoInOut extends Info
|
|||
* @param multiSelection multiple selections
|
||||
* @param whereClause where clause
|
||||
*/
|
||||
protected InfoInOut(Frame frame, boolean modal, int WindowNo, String value,
|
||||
public InfoInOut(Frame frame, boolean modal, int WindowNo, String value,
|
||||
boolean multiSelection, String whereClause)
|
||||
{
|
||||
super (frame, modal, WindowNo, "i", "M_InOut_ID", multiSelection, whereClause);
|
||||
this(frame, modal, WindowNo, value, multiSelection, whereClause, true);
|
||||
}
|
||||
|
||||
/**
|
||||
* Detail Protected Contructor
|
||||
* @param frame parent frame
|
||||
* @param modal modal
|
||||
* @param WindowNo window no
|
||||
* @param value query value
|
||||
* @param multiSelection multiple selections
|
||||
* @param whereClause where clause
|
||||
* @param lookup
|
||||
*/
|
||||
public InfoInOut(Frame frame, boolean modal, int WindowNo, String value,
|
||||
boolean multiSelection, String whereClause, boolean lookup)
|
||||
{
|
||||
super (frame, modal, WindowNo, "i", "M_InOut_ID", multiSelection, whereClause, lookup);
|
||||
log.info( "InfoInOut");
|
||||
setTitle(Msg.getMsg(Env.getCtx(), "InfoInOut"));
|
||||
//
|
||||
|
|
|
@ -67,10 +67,27 @@ public class InfoInvoice extends Info
|
|||
* @param multiSelection multiple selections
|
||||
* @param whereClause where clause
|
||||
*/
|
||||
protected InfoInvoice(Frame frame, boolean modal, int WindowNo, String value,
|
||||
public InfoInvoice(Frame frame, boolean modal, int WindowNo, String value,
|
||||
boolean multiSelection, String whereClause)
|
||||
{
|
||||
super (frame, modal, WindowNo, "i", "C_Invoice_ID", multiSelection, whereClause);
|
||||
this(frame, modal, WindowNo, value, multiSelection, whereClause, true);
|
||||
}
|
||||
|
||||
/**
|
||||
* Detail Protected Contructor
|
||||
*
|
||||
* @param frame parent frame
|
||||
* @param modal modal
|
||||
* @param WindowNo window no
|
||||
* @param value query value
|
||||
* @param multiSelection multiple selections
|
||||
* @param whereClause where clause
|
||||
* @param lookup
|
||||
*/
|
||||
public InfoInvoice(Frame frame, boolean modal, int WindowNo, String value,
|
||||
boolean multiSelection, String whereClause, boolean lookup)
|
||||
{
|
||||
super (frame, modal, WindowNo, "i", "C_Invoice_ID", multiSelection, whereClause, lookup);
|
||||
setTitle(Msg.getMsg(Env.getCtx(), "InfoInvoice"));
|
||||
//
|
||||
try
|
||||
|
|
|
@ -62,10 +62,26 @@ public class InfoOrder extends Info
|
|||
* @param multiSelection multiple selections
|
||||
* @param whereClause where clause
|
||||
*/
|
||||
protected InfoOrder(Frame frame, boolean modal, int WindowNo, String value,
|
||||
public InfoOrder(Frame frame, boolean modal, int WindowNo, String value,
|
||||
boolean multiSelection, String whereClause)
|
||||
{
|
||||
super (frame, modal, WindowNo, "o", "C_Order_ID", multiSelection, whereClause);
|
||||
this(frame, modal, WindowNo, value, multiSelection, whereClause, true);
|
||||
}
|
||||
|
||||
/**
|
||||
* Detail Protected Contructor
|
||||
* @param frame parent frame
|
||||
* @param modal modal
|
||||
* @param WindowNo window no
|
||||
* @param value query value
|
||||
* @param multiSelection multiple selections
|
||||
* @param whereClause where clause
|
||||
* @param lookup
|
||||
*/
|
||||
public InfoOrder(Frame frame, boolean modal, int WindowNo, String value,
|
||||
boolean multiSelection, String whereClause, boolean lookup)
|
||||
{
|
||||
super (frame, modal, WindowNo, "o", "C_Order_ID", multiSelection, whereClause, lookup);
|
||||
log.info( "InfoOrder");
|
||||
setTitle(Msg.getMsg(Env.getCtx(), "InfoOrder"));
|
||||
//
|
||||
|
|
|
@ -62,10 +62,26 @@ public class InfoPayment extends Info
|
|||
* @param multiSelection multiple selections
|
||||
* @param whereClause whwre clause
|
||||
*/
|
||||
protected InfoPayment(Frame frame, boolean modal, int WindowNo, String value,
|
||||
public InfoPayment(Frame frame, boolean modal, int WindowNo, String value,
|
||||
boolean multiSelection, String whereClause)
|
||||
{
|
||||
super (frame, modal, WindowNo, "p", "C_Payment_ID", multiSelection, whereClause);
|
||||
this(frame, modal, WindowNo, value, multiSelection, whereClause, true);
|
||||
}
|
||||
|
||||
/**
|
||||
* Detail Protected Contructor
|
||||
* @param frame parent frame
|
||||
* @param modal modal
|
||||
* @param WindowNo window no
|
||||
* @param value query value
|
||||
* @param multiSelection multiple selections
|
||||
* @param whereClause whwre clause
|
||||
* @param lookup
|
||||
*/
|
||||
public InfoPayment(Frame frame, boolean modal, int WindowNo, String value,
|
||||
boolean multiSelection, String whereClause, boolean lookup)
|
||||
{
|
||||
super (frame, modal, WindowNo, "p", "C_Payment_ID", multiSelection, whereClause, lookup);
|
||||
log.info( "InfoPayment");
|
||||
setTitle(Msg.getMsg(Env.getCtx(), "InfoPayment"));
|
||||
//
|
||||
|
|
|
@ -99,7 +99,25 @@ public class InfoProduct extends Info implements ActionListener, ChangeListener
|
|||
int M_Warehouse_ID, int M_PriceList_ID, String value,
|
||||
boolean multiSelection, String whereClause)
|
||||
{
|
||||
super (frame, modal, WindowNo, "p", "M_Product_ID", multiSelection, whereClause);
|
||||
this(frame, modal, WindowNo, M_Warehouse_ID, M_PriceList_ID, value, multiSelection, whereClause, true);
|
||||
}
|
||||
|
||||
/**
|
||||
* Standard Constructor
|
||||
* @param frame frame
|
||||
* @param modal modal
|
||||
* @param WindowNo window no
|
||||
* @param M_Warehouse_ID warehouse
|
||||
* @param M_PriceList_ID price list
|
||||
* @param value Query Value or Name if enclosed in @
|
||||
* @param multiSelection multiple selections
|
||||
* @param whereClause where clause
|
||||
*/
|
||||
public InfoProduct(Frame frame, boolean modal, int WindowNo,
|
||||
int M_Warehouse_ID, int M_PriceList_ID, String value,
|
||||
boolean multiSelection, String whereClause, boolean lookup)
|
||||
{
|
||||
super (frame, modal, WindowNo, "p", "M_Product_ID", multiSelection, whereClause, lookup);
|
||||
log.info(value + ", Wh=" + M_Warehouse_ID + ", PL=" + M_PriceList_ID + ", WHERE=" + whereClause);
|
||||
setTitle(Msg.getMsg(Env.getCtx(), "InfoProduct"));
|
||||
//
|
||||
|
@ -1305,4 +1323,11 @@ public class InfoProduct extends Info implements ActionListener, ChangeListener
|
|||
M_AttributeSet_ID = as.getKey();
|
||||
return M_AttributeSet_ID;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isResetValue() {
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
} // InfoProduct
|
||||
|
|
|
@ -46,22 +46,16 @@ import javax.swing.KeyStroke;
|
|||
import javax.swing.LookAndFeel;
|
||||
import javax.swing.SwingUtilities;
|
||||
|
||||
import org.adempiere.osgi.InfoManager;
|
||||
import org.compiere.apps.ADialog;
|
||||
import org.compiere.apps.AEnv;
|
||||
import org.compiere.apps.AWindow;
|
||||
import org.compiere.apps.FieldRecordInfo;
|
||||
import org.compiere.apps.search.Info;
|
||||
import org.compiere.apps.search.InfoBPartner;
|
||||
import org.compiere.apps.search.InfoFactory;
|
||||
import org.compiere.apps.search.InfoProduct;
|
||||
import org.compiere.model.GridField;
|
||||
import org.compiere.model.Lookup;
|
||||
import org.compiere.model.MColumn;
|
||||
import org.compiere.model.MInvoiceLine;
|
||||
import org.compiere.model.MLookup;
|
||||
import org.compiere.model.MLookupFactory;
|
||||
import org.compiere.model.MOrderLine;
|
||||
import org.compiere.model.MProductPrice;
|
||||
import org.compiere.model.MQuery;
|
||||
import org.compiere.model.MRole;
|
||||
import org.compiere.swing.CButton;
|
||||
|
@ -75,7 +69,6 @@ import org.compiere.util.Ini;
|
|||
import org.compiere.util.Msg;
|
||||
import org.compiere.util.NamePair;
|
||||
import org.compiere.util.ValueNamePair;
|
||||
import org.eevolution.model.I_PP_Product_BOMLine;
|
||||
|
||||
/**
|
||||
* Lookup Visual Field.
|
||||
|
@ -832,82 +825,30 @@ public class VLookup extends JComponent
|
|||
boolean cancelled = false;
|
||||
boolean multipleSelection = false;
|
||||
//
|
||||
String col = m_lookup.getColumnName(); // fully qualified name
|
||||
if (col.indexOf('.') != -1)
|
||||
col = col.substring(col.indexOf('.')+1);
|
||||
// Zoom / Validation
|
||||
String whereClause = getWhereClause();
|
||||
//
|
||||
log.fine(col
|
||||
log.fine(m_lookup.getColumnName()
|
||||
+ ", Zoom=" + m_lookup.getZoom()
|
||||
+ " (" + whereClause + ")");
|
||||
//
|
||||
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.getSelectedKeys();
|
||||
} catch (Exception e) {
|
||||
log.log(Level.SEVERE, "Failed to load custom InfoFactory - " + e.getLocalizedMessage(), e);
|
||||
}
|
||||
}
|
||||
else if (col.equals("M_Product_ID"))
|
||||
{
|
||||
Info info = null;
|
||||
|
||||
// Reset
|
||||
resetTabInfo();
|
||||
// Replace Value with name if no value exists
|
||||
if (queryValue.length() == 0 && m_text.getText().length() > 0)
|
||||
queryValue = "@" + m_text.getText() + "@"; // Name indicator - otherwise Value
|
||||
int M_Warehouse_ID = Env.getContextAsInt(Env.getCtx(), m_lookup.getWindowNo(), "M_Warehouse_ID");
|
||||
int M_PriceList_ID = Env.getContextAsInt(Env.getCtx(), m_lookup.getWindowNo(), "M_PriceList_ID");
|
||||
if (m_tableName == null) // sets table name & key column
|
||||
getDirectAccessSQL("*");
|
||||
|
||||
if(m_mField != null)
|
||||
{
|
||||
int AD_Table_ID = MColumn.getTable_ID(Env.getCtx(), m_mField.getAD_Column_ID(), null);
|
||||
|
||||
multipleSelection = (MOrderLine.Table_ID == AD_Table_ID) || (MInvoiceLine.Table_ID == AD_Table_ID) || (I_PP_Product_BOMLine.Table_ID == AD_Table_ID) || (MProductPrice.Table_ID == AD_Table_ID);
|
||||
}
|
||||
// Show Info
|
||||
InfoProduct ip = new InfoProduct (frame, true, m_lookup.getWindowNo(),
|
||||
M_Warehouse_ID, M_PriceList_ID, queryValue, multipleSelection, whereClause);
|
||||
ip.setVisible(true);
|
||||
cancelled = ip.isCancelled();
|
||||
result = ip.getSelectedKeys();
|
||||
resetValue = true;
|
||||
}
|
||||
else if (col.equals("C_BPartner_ID"))
|
||||
{
|
||||
// Replace Value with name if no value exists
|
||||
if (queryValue.length() == 0 && m_text.getText().length() > 0)
|
||||
queryValue = m_text.getText();
|
||||
boolean isSOTrx = true; // default
|
||||
if (Env.getContext(Env.getCtx(), m_lookup.getWindowNo(), "IsSOTrx").equals("N"))
|
||||
isSOTrx = false;
|
||||
InfoBPartner ip = new InfoBPartner (frame, true, m_lookup.getWindowNo(),
|
||||
queryValue, isSOTrx, multipleSelection, whereClause);
|
||||
ip.setVisible(true);
|
||||
cancelled = ip.isCancelled();
|
||||
result = ip.getSelectedKeys();
|
||||
}
|
||||
else // General Info
|
||||
{
|
||||
if (m_tableName == null) // sets table name & key column
|
||||
getDirectAccessSQL("*");
|
||||
Info ig = Info.create (frame, true, m_lookup.getWindowNo(),
|
||||
m_tableName, m_keyColumnName, queryValue, multipleSelection, whereClause);
|
||||
ig.setVisible(true);
|
||||
cancelled = ig.isCancelled();
|
||||
result = ig.getSelectedKeys();
|
||||
}
|
||||
|
||||
info = InfoManager.create(frame, true, m_lookup, m_mField, m_tableName, m_keyColumnName,
|
||||
queryValue, multipleSelection, whereClause);
|
||||
|
||||
info.setVisible(true);
|
||||
cancelled = info.isCancelled();
|
||||
result = info.getSelectedKeys();
|
||||
|
||||
// Result
|
||||
if (result != null && result.length > 0)
|
||||
|
@ -915,7 +856,7 @@ public class VLookup extends JComponent
|
|||
log.config(m_columnName + " - Result = " + result.toString() + " (" + result.getClass().getName() + ")");
|
||||
// make sure that value is in cache
|
||||
m_lookup.getDirect(result[0], false, true);
|
||||
if (resetValue)
|
||||
if (info.isResetValue())
|
||||
actionCombo (null);
|
||||
// juddm added logic for multi-select handling
|
||||
if (result.length > 1)
|
||||
|
|
|
@ -30,10 +30,9 @@ import org.adempiere.webui.event.ContextMenuEvent;
|
|||
import org.adempiere.webui.event.ContextMenuListener;
|
||||
import org.adempiere.webui.event.ValueChangeEvent;
|
||||
import org.adempiere.webui.event.ValueChangeListener;
|
||||
import org.adempiere.webui.factory.InfoManager;
|
||||
import org.adempiere.webui.grid.WBPartner;
|
||||
import org.adempiere.webui.panel.InfoBPartnerPanel;
|
||||
import org.adempiere.webui.panel.InfoPanel;
|
||||
import org.adempiere.webui.panel.InfoProductPanel;
|
||||
import org.adempiere.webui.window.WFieldRecordInfo;
|
||||
import org.compiere.model.GridField;
|
||||
import org.compiere.model.Lookup;
|
||||
|
@ -478,94 +477,30 @@ public class WSearchEditor extends WEditor implements ContextMenuListener, Value
|
|||
Object result[] = null;
|
||||
boolean cancelled = false;
|
||||
|
||||
String col = lookup.getColumnName(); // fully qualified name
|
||||
|
||||
if (col.indexOf('.') != -1)
|
||||
col = col.substring(col.indexOf('.')+1);
|
||||
|
||||
// Zoom / Validation
|
||||
String whereClause = getWhereClause();
|
||||
|
||||
log.fine(col + ", Zoom=" + lookup.getZoom() + " (" + whereClause + ")");
|
||||
log.fine(lookup.getColumnName() + ", Zoom=" + lookup.getZoom() + " (" + whereClause + ")");
|
||||
|
||||
// boolean resetValue = false; // Reset value so that is always treated as new entry
|
||||
|
||||
if (col.equals("M_Product_ID"))
|
||||
{
|
||||
// Reset
|
||||
Env.setContext(Env.getCtx(), lookup.getWindowNo(), Env.TAB_INFO, "M_Product_ID", "0");
|
||||
Env.setContext(Env.getCtx(), lookup.getWindowNo(), Env.TAB_INFO, "M_AttributeSetInstance_ID", "0");
|
||||
Env.setContext(Env.getCtx(), lookup.getWindowNo(), Env.TAB_INFO, "M_Lookup_ID", "0");
|
||||
|
||||
// Replace Value with name if no value exists
|
||||
if (queryValue.length() == 0 && getComponent().getText().length() > 0)
|
||||
queryValue = "@" + getComponent().getText() + "@"; // Name indicator - otherwise Value
|
||||
|
||||
int M_Warehouse_ID = Env.getContextAsInt(Env.getCtx(), lookup.getWindowNo(), "M_Warehouse_ID");
|
||||
int M_PriceList_ID = Env.getContextAsInt(Env.getCtx(), lookup.getWindowNo(), "M_PriceList_ID");
|
||||
|
||||
// Show Info
|
||||
InfoProductPanel ip = new InfoProductPanel (lookup.getWindowNo(),
|
||||
M_Warehouse_ID, M_PriceList_ID, true, queryValue, whereClause);
|
||||
|
||||
ip.setVisible(true);
|
||||
ip.setTitle("Product Info");
|
||||
ip.setStyle("border: 2px");
|
||||
ip.setClosable(true);
|
||||
ip.setAttribute("mode", "modal");
|
||||
ip.addValueChangeListener(this);
|
||||
infoPanel = ip;
|
||||
AEnv.showWindow(ip);
|
||||
|
||||
cancelled = ip.isCancelled();
|
||||
result = ip.getSelectedKeys();
|
||||
}
|
||||
else if (col.equals("C_BPartner_ID"))
|
||||
{
|
||||
// Replace Value with name if no value exists
|
||||
if (queryValue.length() == 0 && getComponent().getText().length() > 0)
|
||||
queryValue = getComponent().getText();
|
||||
|
||||
boolean isSOTrx = true; // default
|
||||
|
||||
if (Env.getContext(Env.getCtx(), lookup.getWindowNo(), "IsSOTrx").equals("N"))
|
||||
isSOTrx = false;
|
||||
|
||||
InfoBPartnerPanel ip = new InfoBPartnerPanel(queryValue, lookup.getWindowNo(), isSOTrx,false, whereClause);
|
||||
|
||||
ip.setVisible(true);
|
||||
ip.setTitle("Business Partner Info");
|
||||
ip.setStyle("border: 2px");
|
||||
ip.setClosable(true);
|
||||
ip.setAttribute("mode", "modal");
|
||||
ip.addValueChangeListener(this);
|
||||
infoPanel = ip;
|
||||
AEnv.showWindow(ip);
|
||||
|
||||
cancelled = ip.isCancelled();
|
||||
result = ip.getSelectedKeys();
|
||||
}
|
||||
else // General Info
|
||||
{
|
||||
if (m_tableName == null) // sets table name & key column
|
||||
getDirectAccessSQL("*");
|
||||
|
||||
if (queryValue.length() == 0 && getComponent().getText().length() > 0)
|
||||
queryValue = getComponent().getText();
|
||||
|
||||
InfoPanel ig = InfoPanel.create(lookup.getWindowNo(), m_tableName,m_keyColumnName,queryValue, false, whereClause);
|
||||
ig.setVisible(true);
|
||||
ig.setStyle("border: 2px");
|
||||
ig.setClosable(true);
|
||||
ig.setAttribute("mode", "modal");
|
||||
ig.addValueChangeListener(this);
|
||||
infoPanel = ig;
|
||||
AEnv.showWindow(ig);
|
||||
|
||||
cancelled = ig.isCancelled();
|
||||
result = ig.getSelectedKeys();
|
||||
|
||||
}
|
||||
InfoPanel ip = InfoManager.create(lookup, gridField, m_tableName, m_keyColumnName, queryValue, false, whereClause);
|
||||
ip.setVisible(true);
|
||||
ip.setStyle("border: 2px");
|
||||
ip.setClosable(true);
|
||||
ip.setAttribute("mode", "modal");
|
||||
ip.addValueChangeListener(this);
|
||||
infoPanel = ip;
|
||||
AEnv.showWindow(ip);
|
||||
cancelled = ip.isCancelled();
|
||||
result = ip.getSelectedKeys();
|
||||
|
||||
infoPanel = null;
|
||||
// Result
|
||||
|
|
|
@ -0,0 +1,121 @@
|
|||
/******************************************************************************
|
||||
* Product: Adempiere ERP & CRM Smart Business Solution *
|
||||
* Copyright (C) 2010 Heng Sin Low *
|
||||
* This program is free software; you can redistribute it and/or modify it *
|
||||
* under the terms version 2 of the GNU General Public License as published *
|
||||
* by the Free Software Foundation. This program is distributed in the hope *
|
||||
* that it will be useful, but WITHOUT ANY WARRANTY; without even the implied *
|
||||
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. *
|
||||
* See the GNU General Public License for more details. *
|
||||
* You should have received a copy of the GNU General Public License along *
|
||||
* with this program; if not, write to the Free Software Foundation, Inc., *
|
||||
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. *
|
||||
*****************************************************************************/
|
||||
package org.adempiere.webui.factory;
|
||||
|
||||
import org.adempiere.webui.panel.InfoAssetPanel;
|
||||
import org.adempiere.webui.panel.InfoAssignmentPanel;
|
||||
import org.adempiere.webui.panel.InfoBPartnerPanel;
|
||||
import org.adempiere.webui.panel.InfoCashLinePanel;
|
||||
import org.adempiere.webui.panel.InfoGeneralPanel;
|
||||
import org.adempiere.webui.panel.InfoInOutPanel;
|
||||
import org.adempiere.webui.panel.InfoInvoicePanel;
|
||||
import org.adempiere.webui.panel.InfoOrderPanel;
|
||||
import org.adempiere.webui.panel.InfoPanel;
|
||||
import org.adempiere.webui.panel.InfoPaymentPanel;
|
||||
import org.adempiere.webui.panel.InfoProductPanel;
|
||||
import org.compiere.model.GridField;
|
||||
import org.compiere.model.Lookup;
|
||||
import org.compiere.util.Env;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author hengsin
|
||||
*
|
||||
*/
|
||||
public class DefaultInfoFactory implements IInfoFactory {
|
||||
|
||||
@Override
|
||||
public InfoPanel create(int WindowNo, String tableName, String keyColumn,
|
||||
String value, boolean multiSelection, String whereClause, boolean lookup) {
|
||||
InfoPanel info = null;
|
||||
|
||||
if (tableName.equals("C_BPartner"))
|
||||
info = new InfoBPartnerPanel (value,WindowNo, !Env.getContext(Env.getCtx(),"IsSOTrx").equals("N"),
|
||||
multiSelection, whereClause, lookup);
|
||||
else if (tableName.equals("M_Product"))
|
||||
info = new InfoProductPanel ( WindowNo,
|
||||
Env.getContextAsInt(Env.getCtx(), WindowNo, "M_Warehouse_ID"),
|
||||
Env.getContextAsInt(Env.getCtx(), WindowNo, "M_PriceList_ID"),
|
||||
multiSelection, value,whereClause, lookup);
|
||||
else if (tableName.equals("C_Invoice"))
|
||||
info = new InfoInvoicePanel ( WindowNo, value,
|
||||
multiSelection, whereClause, lookup);
|
||||
else if (tableName.equals("A_Asset"))
|
||||
info = new InfoAssetPanel (WindowNo, 0, value,
|
||||
multiSelection, whereClause, lookup);
|
||||
else if (tableName.equals("C_Order"))
|
||||
info = new InfoOrderPanel ( WindowNo, value,
|
||||
multiSelection, whereClause, lookup);
|
||||
else if (tableName.equals("M_InOut"))
|
||||
info = new InfoInOutPanel (WindowNo, value,
|
||||
multiSelection, whereClause, lookup);
|
||||
else if (tableName.equals("C_Payment"))
|
||||
info = new InfoPaymentPanel (WindowNo, value, multiSelection, whereClause, lookup);
|
||||
else if (tableName.equals("C_CashLine"))
|
||||
info = new InfoCashLinePanel (WindowNo, value,
|
||||
multiSelection, whereClause, lookup);
|
||||
else if (tableName.equals("S_ResourceAssigment"))
|
||||
info = new InfoAssignmentPanel (WindowNo, value,
|
||||
multiSelection, whereClause, lookup);
|
||||
else
|
||||
info = new InfoGeneralPanel (value, WindowNo,
|
||||
tableName, keyColumn,
|
||||
multiSelection, whereClause, lookup);
|
||||
//
|
||||
return info;
|
||||
}
|
||||
|
||||
@Override
|
||||
public InfoPanel create(Lookup lookup, GridField field, String tableName,
|
||||
String keyColumn, String queryValue, boolean multiSelection,
|
||||
String whereClause) {
|
||||
InfoPanel info = null;
|
||||
String col = lookup.getColumnName(); // fully qualified name
|
||||
|
||||
if (col.indexOf('.') != -1)
|
||||
col = col.substring(col.indexOf('.')+1);
|
||||
if (col.equals("M_Product_ID"))
|
||||
{
|
||||
// Reset
|
||||
Env.setContext(Env.getCtx(), lookup.getWindowNo(), Env.TAB_INFO, "M_Product_ID", "0");
|
||||
Env.setContext(Env.getCtx(), lookup.getWindowNo(), Env.TAB_INFO, "M_AttributeSetInstance_ID", "0");
|
||||
Env.setContext(Env.getCtx(), lookup.getWindowNo(), Env.TAB_INFO, "M_Lookup_ID", "0");
|
||||
|
||||
int M_Warehouse_ID = Env.getContextAsInt(Env.getCtx(), lookup.getWindowNo(), "M_Warehouse_ID");
|
||||
int M_PriceList_ID = Env.getContextAsInt(Env.getCtx(), lookup.getWindowNo(), "M_PriceList_ID");
|
||||
|
||||
// Show Info
|
||||
info = new InfoProductPanel (lookup.getWindowNo(),
|
||||
M_Warehouse_ID, M_PriceList_ID, true, queryValue, whereClause);
|
||||
|
||||
info.setTitle("Product Info");
|
||||
}
|
||||
else if (col.equals("C_BPartner_ID"))
|
||||
{
|
||||
boolean isSOTrx = true; // default
|
||||
|
||||
if (Env.getContext(Env.getCtx(), lookup.getWindowNo(), "IsSOTrx").equals("N"))
|
||||
isSOTrx = false;
|
||||
|
||||
info = new InfoBPartnerPanel(queryValue, lookup.getWindowNo(), isSOTrx,false, whereClause);
|
||||
info.setTitle("Business Partner Info");
|
||||
}
|
||||
else // General Info
|
||||
{
|
||||
info = create(lookup.getWindowNo(), tableName, keyColumn, queryValue, false, whereClause, true);
|
||||
}
|
||||
return info;
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,34 @@
|
|||
/******************************************************************************
|
||||
* Product: Adempiere ERP & CRM Smart Business Solution *
|
||||
* Copyright (C) 2010 Heng Sin Low *
|
||||
* This program is free software; you can redistribute it and/or modify it *
|
||||
* under the terms version 2 of the GNU General Public License as published *
|
||||
* by the Free Software Foundation. This program is distributed in the hope *
|
||||
* that it will be useful, but WITHOUT ANY WARRANTY; without even the implied *
|
||||
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. *
|
||||
* See the GNU General Public License for more details. *
|
||||
* You should have received a copy of the GNU General Public License along *
|
||||
* with this program; if not, write to the Free Software Foundation, Inc., *
|
||||
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. *
|
||||
*****************************************************************************/
|
||||
package org.adempiere.webui.factory;
|
||||
|
||||
import org.adempiere.webui.panel.InfoPanel;
|
||||
import org.compiere.model.GridField;
|
||||
import org.compiere.model.Lookup;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author hengsin
|
||||
*
|
||||
*/
|
||||
public interface IInfoFactory {
|
||||
|
||||
public InfoPanel create (int WindowNo,
|
||||
String tableName, String keyColumn, String value,
|
||||
boolean multiSelection, String whereClause, boolean lookup);
|
||||
|
||||
public InfoPanel create (Lookup lookup, GridField field,
|
||||
String tableName, String keyColumn, String value,
|
||||
boolean multiSelection, String whereClause);
|
||||
}
|
|
@ -0,0 +1,61 @@
|
|||
/******************************************************************************
|
||||
* Product: Adempiere ERP & CRM Smart Business Solution *
|
||||
* Copyright (C) 2010 Heng Sin Low *
|
||||
* This program is free software; you can redistribute it and/or modify it *
|
||||
* under the terms version 2 of the GNU General Public License as published *
|
||||
* by the Free Software Foundation. This program is distributed in the hope *
|
||||
* that it will be useful, but WITHOUT ANY WARRANTY; without even the implied *
|
||||
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. *
|
||||
* See the GNU General Public License for more details. *
|
||||
* You should have received a copy of the GNU General Public License along *
|
||||
* with this program; if not, write to the Free Software Foundation, Inc., *
|
||||
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. *
|
||||
*****************************************************************************/
|
||||
package org.adempiere.webui.factory;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.adempiere.base.Service;
|
||||
import org.adempiere.webui.panel.InfoPanel;
|
||||
import org.compiere.model.GridField;
|
||||
import org.compiere.model.Lookup;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author hengsin
|
||||
*
|
||||
*/
|
||||
public class InfoManager
|
||||
{
|
||||
public static InfoPanel create (int WindowNo,
|
||||
String tableName, String keyColumn, String value,
|
||||
boolean multiSelection, String whereClause, boolean lookup)
|
||||
{
|
||||
InfoPanel info = null;
|
||||
|
||||
List<IInfoFactory> factoryList = Service.list(IInfoFactory.class);
|
||||
for(IInfoFactory factory : factoryList)
|
||||
{
|
||||
info = factory.create(WindowNo, tableName, keyColumn, value, multiSelection, whereClause, lookup);
|
||||
if (info != null)
|
||||
break;
|
||||
}
|
||||
//
|
||||
return info;
|
||||
}
|
||||
|
||||
public static InfoPanel create(Lookup lookup, GridField field, String tableName,
|
||||
String keyColumn, String queryValue, boolean multiSelection,
|
||||
String whereClause)
|
||||
{
|
||||
InfoPanel ip = null;
|
||||
List<IInfoFactory> factoryList = Service.list(IInfoFactory.class);
|
||||
for(IInfoFactory factory : factoryList)
|
||||
{
|
||||
ip = factory.create(lookup, field, tableName, keyColumn, queryValue, false, whereClause);
|
||||
if (ip != null)
|
||||
break;
|
||||
}
|
||||
return ip;
|
||||
}
|
||||
}
|
|
@ -130,7 +130,7 @@ public class InfoCashLinePanel extends InfoPanel implements ValueChangeListener,
|
|||
* @param multiSelection multiple selections
|
||||
* @param whereClause where clause
|
||||
*/
|
||||
protected InfoCashLinePanel( int WindowNo, String value,
|
||||
public InfoCashLinePanel( int WindowNo, String value,
|
||||
boolean multiSelection, String whereClause)
|
||||
{
|
||||
this(WindowNo, value, multiSelection, whereClause, true);
|
||||
|
@ -144,7 +144,7 @@ public class InfoCashLinePanel extends InfoPanel implements ValueChangeListener,
|
|||
* @param multiSelection multiple selections
|
||||
* @param whereClause where clause
|
||||
*/
|
||||
protected InfoCashLinePanel( int WindowNo, String value,
|
||||
public InfoCashLinePanel( int WindowNo, String value,
|
||||
boolean multiSelection, String whereClause, boolean lookup)
|
||||
{
|
||||
super (WindowNo, "cl", "C_CashLine_ID", multiSelection, whereClause, lookup);
|
||||
|
|
|
@ -82,6 +82,11 @@ public class InfoGeneralPanel extends InfoPanel implements EventListener
|
|||
private Vbox southBody;
|
||||
|
||||
public InfoGeneralPanel(String queryValue, int windowNo,String tableName,String keyColumn, boolean isSOTrx, String whereClause)
|
||||
{
|
||||
this(queryValue, windowNo, tableName, keyColumn, isSOTrx, whereClause, true);
|
||||
}
|
||||
|
||||
public InfoGeneralPanel(String queryValue, int windowNo,String tableName,String keyColumn, boolean isSOTrx, String whereClause, boolean lookup)
|
||||
{
|
||||
super(windowNo, tableName, keyColumn, false,whereClause);
|
||||
|
||||
|
|
|
@ -115,7 +115,7 @@ public class InfoInOutPanel extends InfoPanel implements ValueChangeListener, Ev
|
|||
* @param multiSelection multiple selections
|
||||
* @param whereClause where clause
|
||||
*/
|
||||
protected InfoInOutPanel( int WindowNo, String value,
|
||||
public InfoInOutPanel( int WindowNo, String value,
|
||||
boolean multiSelection, String whereClause)
|
||||
{
|
||||
this(WindowNo, value, multiSelection, whereClause, true);
|
||||
|
@ -129,7 +129,7 @@ public class InfoInOutPanel extends InfoPanel implements ValueChangeListener, Ev
|
|||
* @param multiSelection multiple selections
|
||||
* @param whereClause where clause
|
||||
*/
|
||||
protected InfoInOutPanel( int WindowNo, String value,
|
||||
public InfoInOutPanel( int WindowNo, String value,
|
||||
boolean multiSelection, String whereClause, boolean lookup)
|
||||
{
|
||||
super (WindowNo, "i", "M_InOut_ID", multiSelection, whereClause, lookup);
|
||||
|
|
|
@ -82,7 +82,7 @@ public class InfoInvoicePanel extends InfoPanel implements ValueChangeListener
|
|||
* @param whereClause where clause
|
||||
*
|
||||
*/
|
||||
protected InfoInvoicePanel(int WindowNo, String value,
|
||||
public InfoInvoicePanel(int WindowNo, String value,
|
||||
boolean multiSelection, String whereClause)
|
||||
{
|
||||
this(WindowNo, value, multiSelection, whereClause, true);
|
||||
|
@ -96,7 +96,7 @@ public class InfoInvoicePanel extends InfoPanel implements ValueChangeListener
|
|||
* @param whereClause where clause
|
||||
*
|
||||
*/
|
||||
protected InfoInvoicePanel(int WindowNo, String value,
|
||||
public InfoInvoicePanel(int WindowNo, String value,
|
||||
boolean multiSelection, String whereClause, boolean lookup)
|
||||
{
|
||||
super ( WindowNo, "i", "C_Invoice_ID", multiSelection, whereClause, lookup);
|
||||
|
|
|
@ -109,13 +109,13 @@ public class InfoOrderPanel extends InfoPanel implements ValueChangeListener
|
|||
new ColumnInfo(Msg.translate(Env.getCtx(), "POReference"), "o.POReference", String.class)
|
||||
};
|
||||
|
||||
protected InfoOrderPanel(int WindowNo, String value,
|
||||
public InfoOrderPanel(int WindowNo, String value,
|
||||
boolean multiSelection, String whereClause)
|
||||
{
|
||||
this(WindowNo, value, multiSelection, whereClause, true);
|
||||
}
|
||||
|
||||
protected InfoOrderPanel(int WindowNo, String value,
|
||||
public InfoOrderPanel(int WindowNo, String value,
|
||||
boolean multiSelection, String whereClause, boolean lookup)
|
||||
{
|
||||
super ( WindowNo, "o", "C_Order_ID", multiSelection, whereClause, lookup);
|
||||
|
|
|
@ -41,10 +41,20 @@ import org.adempiere.webui.event.ValueChangeEvent;
|
|||
import org.adempiere.webui.event.ValueChangeListener;
|
||||
import org.adempiere.webui.event.WTableModelEvent;
|
||||
import org.adempiere.webui.event.WTableModelListener;
|
||||
import org.adempiere.webui.factory.InfoManager;
|
||||
import org.adempiere.webui.part.ITabOnSelectHandler;
|
||||
import org.adempiere.webui.session.SessionManager;
|
||||
import org.compiere.minigrid.ColumnInfo;
|
||||
import org.compiere.minigrid.IDColumn;
|
||||
import org.compiere.model.I_A_Asset;
|
||||
import org.compiere.model.I_C_BPartner;
|
||||
import org.compiere.model.I_C_CashLine;
|
||||
import org.compiere.model.I_C_Invoice;
|
||||
import org.compiere.model.I_C_Order;
|
||||
import org.compiere.model.I_C_Payment;
|
||||
import org.compiere.model.I_M_InOut;
|
||||
import org.compiere.model.I_M_Product;
|
||||
import org.compiere.model.I_S_ResourceAssignment;
|
||||
import org.compiere.model.MRole;
|
||||
import org.compiere.model.MTable;
|
||||
import org.compiere.util.CLogger;
|
||||
|
@ -87,41 +97,7 @@ public abstract class InfoPanel extends Window implements EventListener, WTableM
|
|||
String tableName, String keyColumn, String value,
|
||||
boolean multiSelection, String whereClause)
|
||||
{
|
||||
InfoPanel info = null;
|
||||
|
||||
if (tableName.equals("C_BPartner"))
|
||||
info = new InfoBPartnerPanel (value,WindowNo, !Env.getContext(Env.getCtx(),"IsSOTrx").equals("N"),
|
||||
multiSelection, whereClause);
|
||||
else if (tableName.equals("M_Product"))
|
||||
info = new InfoProductPanel ( WindowNo, 0,0,
|
||||
multiSelection, value,whereClause);
|
||||
else if (tableName.equals("C_Invoice"))
|
||||
info = new InfoInvoicePanel ( WindowNo, value,
|
||||
multiSelection, whereClause);
|
||||
else if (tableName.equals("A_Asset"))
|
||||
info = new InfoAssetPanel (WindowNo, 0, value,
|
||||
multiSelection, whereClause);
|
||||
else if (tableName.equals("C_Order"))
|
||||
info = new InfoOrderPanel ( WindowNo, value,
|
||||
multiSelection, whereClause);
|
||||
else if (tableName.equals("M_InOut"))
|
||||
info = new InfoInOutPanel (WindowNo, value,
|
||||
multiSelection, whereClause);
|
||||
else if (tableName.equals("C_Payment"))
|
||||
info = new InfoPaymentPanel (WindowNo, value, multiSelection, whereClause);
|
||||
else if (tableName.equals("C_CashLine"))
|
||||
info = new InfoCashLinePanel (WindowNo, value,
|
||||
multiSelection, whereClause);
|
||||
else if (tableName.equals("S_ResourceAssigment"))
|
||||
info = new InfoAssignmentPanel (WindowNo, value,
|
||||
multiSelection, whereClause);
|
||||
else
|
||||
info = new InfoGeneralPanel (value, WindowNo,
|
||||
tableName, keyColumn,
|
||||
multiSelection, whereClause);
|
||||
//
|
||||
return info;
|
||||
|
||||
return InfoManager.create(WindowNo, tableName, keyColumn, value, multiSelection, whereClause, true);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -130,8 +106,8 @@ public abstract class InfoPanel extends Window implements EventListener, WTableM
|
|||
*/
|
||||
public static void showBPartner (int WindowNo)
|
||||
{
|
||||
InfoBPartnerPanel info = new InfoBPartnerPanel ( "", WindowNo,
|
||||
!Env.getContext(Env.getCtx(),"IsSOTrx").equals("N"),false, "", false);
|
||||
InfoPanel info = InfoManager.create(WindowNo, I_C_BPartner.Table_Name,
|
||||
I_C_BPartner.COLUMNNAME_C_BPartner_ID, "", false, "", false);
|
||||
AEnv.showWindow(info);
|
||||
} // showBPartner
|
||||
|
||||
|
@ -142,7 +118,8 @@ public abstract class InfoPanel extends Window implements EventListener, WTableM
|
|||
*/
|
||||
public static void showAsset (int WindowNo)
|
||||
{
|
||||
InfoPanel info = new InfoAssetPanel (WindowNo, 0, "", false, "", false);
|
||||
InfoPanel info = InfoManager.create(WindowNo,
|
||||
I_A_Asset.Table_Name, I_A_Asset.COLUMNNAME_A_Asset_ID, "", false, "", false);
|
||||
AEnv.showWindow(info);
|
||||
} // showBPartner
|
||||
|
||||
|
@ -153,10 +130,8 @@ public abstract class InfoPanel extends Window implements EventListener, WTableM
|
|||
*/
|
||||
public static void showProduct (int WindowNo)
|
||||
{
|
||||
InfoPanel info = new InfoProductPanel(WindowNo,
|
||||
Env.getContextAsInt(Env.getCtx(), WindowNo, "M_Warehouse_ID"),
|
||||
Env.getContextAsInt(Env.getCtx(), WindowNo, "M_PriceList_ID"),
|
||||
false, "", "", false);
|
||||
InfoPanel info = InfoManager.create(WindowNo,
|
||||
I_M_Product.Table_Name, I_M_Product.COLUMNNAME_M_Product_ID, "", false, "", false);
|
||||
AEnv.showWindow(info);
|
||||
} // showProduct
|
||||
|
||||
|
@ -168,7 +143,8 @@ public abstract class InfoPanel extends Window implements EventListener, WTableM
|
|||
*/
|
||||
public static void showOrder (int WindowNo, String value)
|
||||
{
|
||||
InfoPanel info = new InfoOrderPanel(WindowNo, "", false, "", false);
|
||||
InfoPanel info = InfoManager.create(WindowNo,
|
||||
I_C_Order.Table_Name, I_C_Order.COLUMNNAME_C_Order_ID, "", false, "", false);
|
||||
AEnv.showWindow(info);
|
||||
} // showOrder
|
||||
|
||||
|
@ -180,7 +156,8 @@ public abstract class InfoPanel extends Window implements EventListener, WTableM
|
|||
*/
|
||||
public static void showInvoice (int WindowNo, String value)
|
||||
{
|
||||
InfoPanel info = new InfoInvoicePanel(WindowNo, "", false, "", false);
|
||||
InfoPanel info = InfoManager.create(WindowNo,
|
||||
I_C_Invoice.Table_Name, I_C_Invoice.COLUMNNAME_C_Invoice_ID, "", false, "", false);
|
||||
AEnv.showWindow(info);
|
||||
} // showInvoice
|
||||
|
||||
|
@ -192,8 +169,8 @@ public abstract class InfoPanel extends Window implements EventListener, WTableM
|
|||
*/
|
||||
public static void showInOut (int WindowNo, String value)
|
||||
{
|
||||
InfoPanel info = new InfoInOutPanel (WindowNo, value,
|
||||
false, "", false);
|
||||
InfoPanel info = InfoManager.create(WindowNo,
|
||||
I_M_InOut.Table_Name, I_M_InOut.COLUMNNAME_M_InOut_ID, "", false, "", false);
|
||||
AEnv.showWindow(info);
|
||||
} // showInOut
|
||||
|
||||
|
@ -205,8 +182,8 @@ public abstract class InfoPanel extends Window implements EventListener, WTableM
|
|||
*/
|
||||
public static void showPayment (int WindowNo, String value)
|
||||
{
|
||||
InfoPanel info = new InfoPaymentPanel (WindowNo, value,
|
||||
false, "", false);
|
||||
InfoPanel info = InfoManager.create(WindowNo,
|
||||
I_C_Payment.Table_Name, I_C_Payment.COLUMNNAME_C_Payment_ID, "", false, "", false);
|
||||
AEnv.showWindow(info);
|
||||
} // showPayment
|
||||
|
||||
|
@ -218,8 +195,8 @@ public abstract class InfoPanel extends Window implements EventListener, WTableM
|
|||
*/
|
||||
public static void showCashLine (int WindowNo, String value)
|
||||
{
|
||||
InfoPanel info = new InfoCashLinePanel (WindowNo, value,
|
||||
false, "", false);
|
||||
InfoPanel info = InfoManager.create(WindowNo,
|
||||
I_C_CashLine.Table_Name, I_C_CashLine.COLUMNNAME_C_CashLine_ID, "", false, "", false);
|
||||
AEnv.showWindow(info);
|
||||
} // showCashLine
|
||||
|
||||
|
@ -231,8 +208,8 @@ public abstract class InfoPanel extends Window implements EventListener, WTableM
|
|||
*/
|
||||
public static void showAssignment (int WindowNo, String value)
|
||||
{
|
||||
InfoPanel info = new InfoAssignmentPanel (WindowNo, value,
|
||||
false, "", false);
|
||||
InfoPanel info = InfoManager.create(WindowNo,
|
||||
I_S_ResourceAssignment.Table_Name, I_S_ResourceAssignment.COLUMNNAME_S_ResourceAssignment_ID, "", false, "", false);
|
||||
AEnv.showWindow(info);
|
||||
} // showAssignment
|
||||
|
||||
|
|
|
@ -128,7 +128,7 @@ public class InfoPaymentPanel extends InfoPanel implements ValueChangeListener,
|
|||
* @param multiSelection multiple selections
|
||||
* @param whereClause where clause
|
||||
*/
|
||||
protected InfoPaymentPanel(int WindowNo, String value,
|
||||
public InfoPaymentPanel(int WindowNo, String value,
|
||||
boolean multiSelection, String whereClause)
|
||||
{
|
||||
this(WindowNo, value, multiSelection, whereClause, true);
|
||||
|
@ -143,7 +143,7 @@ public class InfoPaymentPanel extends InfoPanel implements ValueChangeListener,
|
|||
* @param multiSelection multiple selections
|
||||
* @param whereClause where clause
|
||||
*/
|
||||
protected InfoPaymentPanel(int WindowNo, String value,
|
||||
public InfoPaymentPanel(int WindowNo, String value,
|
||||
boolean multiSelection, String whereClause, boolean lookup)
|
||||
{
|
||||
super(WindowNo, "p", "C_Payment_ID", multiSelection, whereClause, lookup);
|
||||
|
|
|
@ -2,6 +2,7 @@
|
|||
<?eclipse version="3.4"?>
|
||||
<plugin>
|
||||
<extension-point id="org.adempiere.webui.Form" name="Web Form" schema="schema/org.adempiere.webui.Form.exsd"/>
|
||||
<extension-point id="org.adempiere.webui.factory.IInfoFactory" name="Info Factory extension" schema="schema/org.adempiere.webui.factory.IInfoFactory.exsd"/>
|
||||
<extension
|
||||
point="org.compiere.print.ReportViewerProvider">
|
||||
<provider
|
||||
|
@ -26,5 +27,14 @@
|
|||
class="org.compiere.interfaces.impl.StatusBean">
|
||||
</interface>
|
||||
</extension>
|
||||
<extension
|
||||
id="org.adempiere.webui.factory.DefaultInfoFactory"
|
||||
name="Default Info Factory"
|
||||
point="org.adempiere.webui.factory.IInfoFactory">
|
||||
<factory
|
||||
class="org.adempiere.webui.factory.DefaultInfoFactory"
|
||||
priority="0">
|
||||
</factory>
|
||||
</extension>
|
||||
|
||||
</plugin>
|
||||
|
|
|
@ -0,0 +1,109 @@
|
|||
<?xml version='1.0' encoding='UTF-8'?>
|
||||
<!-- Schema file written by PDE -->
|
||||
<schema targetNamespace="org.adempiere.ui.zk" xmlns="http://www.w3.org/2001/XMLSchema">
|
||||
<annotation>
|
||||
<appinfo>
|
||||
<meta.schema plugin="org.adempiere.ui.zk" id="org.adempiere.webui.factory.IInfoFactory" name="Info Factory extension"/>
|
||||
</appinfo>
|
||||
<documentation>
|
||||
[Enter description of this extension point.]
|
||||
</documentation>
|
||||
</annotation>
|
||||
|
||||
<element name="extension">
|
||||
<annotation>
|
||||
<appinfo>
|
||||
<meta.element />
|
||||
</appinfo>
|
||||
</annotation>
|
||||
<complexType>
|
||||
<choice>
|
||||
<element ref="factory"/>
|
||||
</choice>
|
||||
<attribute name="point" type="string" use="required">
|
||||
<annotation>
|
||||
<documentation>
|
||||
|
||||
</documentation>
|
||||
</annotation>
|
||||
</attribute>
|
||||
<attribute name="id" type="string">
|
||||
<annotation>
|
||||
<documentation>
|
||||
|
||||
</documentation>
|
||||
</annotation>
|
||||
</attribute>
|
||||
<attribute name="name" type="string">
|
||||
<annotation>
|
||||
<documentation>
|
||||
|
||||
</documentation>
|
||||
<appinfo>
|
||||
<meta.attribute translatable="true"/>
|
||||
</appinfo>
|
||||
</annotation>
|
||||
</attribute>
|
||||
</complexType>
|
||||
</element>
|
||||
|
||||
<element name="factory">
|
||||
<complexType>
|
||||
<attribute name="priority" type="string" use="required">
|
||||
<annotation>
|
||||
<documentation>
|
||||
numeric priority value. bigger number have higher priority.
|
||||
</documentation>
|
||||
</annotation>
|
||||
</attribute>
|
||||
<attribute name="class" type="string" use="required">
|
||||
<annotation>
|
||||
<documentation>
|
||||
|
||||
</documentation>
|
||||
<appinfo>
|
||||
<meta.attribute kind="java" basedOn=":org.adempiere.webui.factory.IInfoFactory"/>
|
||||
</appinfo>
|
||||
</annotation>
|
||||
</attribute>
|
||||
</complexType>
|
||||
</element>
|
||||
|
||||
<annotation>
|
||||
<appinfo>
|
||||
<meta.section type="since"/>
|
||||
</appinfo>
|
||||
<documentation>
|
||||
[Enter the first release in which this extension point appears.]
|
||||
</documentation>
|
||||
</annotation>
|
||||
|
||||
<annotation>
|
||||
<appinfo>
|
||||
<meta.section type="examples"/>
|
||||
</appinfo>
|
||||
<documentation>
|
||||
[Enter extension point usage example here.]
|
||||
</documentation>
|
||||
</annotation>
|
||||
|
||||
<annotation>
|
||||
<appinfo>
|
||||
<meta.section type="apiinfo"/>
|
||||
</appinfo>
|
||||
<documentation>
|
||||
[Enter API information here.]
|
||||
</documentation>
|
||||
</annotation>
|
||||
|
||||
<annotation>
|
||||
<appinfo>
|
||||
<meta.section type="implementation"/>
|
||||
</appinfo>
|
||||
<documentation>
|
||||
[Enter information about supplied implementation of this extension point.]
|
||||
</documentation>
|
||||
</annotation>
|
||||
|
||||
|
||||
</schema>
|
Loading…
Reference in New Issue