Implemented info factory as extension point for zk and swing client.

This commit is contained in:
Heng Sin Low 2010-11-23 18:01:11 +08:00
parent c321e8feb6
commit b9e40c4bf4
31 changed files with 1684 additions and 886 deletions

View File

@ -21,6 +21,8 @@
</factory> </factory>
</extension> </extension>
<extension <extension
id="org.adempiere.base.DefaultDocFactory"
name="Default Document Factory"
point="org.adempiere.base.IDocFactory"> point="org.adempiere.base.IDocFactory">
<factory <factory
class="org.adempiere.base.DefaultDocumentFactory" class="org.adempiere.base.DefaultDocumentFactory"

View File

@ -3,6 +3,7 @@
<plugin> <plugin>
<extension-point id="org.adempiere.osgi.IMenuAction" name="MenuAction" schema="schema/org.adempiere.osgi.IMenuAction.exsd"/> <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.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 <extension
id="RF" id="RF"
name="RF" name="RF"
@ -49,5 +50,14 @@
</property> </property>
</product> </product>
</extension> </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> </plugin>

View File

@ -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>

View File

@ -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;
}
}

View File

@ -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);
}

View File

@ -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;
}
}

View File

@ -40,6 +40,7 @@ import javax.swing.SwingUtilities;
import javax.swing.event.ListSelectionEvent; import javax.swing.event.ListSelectionEvent;
import javax.swing.event.ListSelectionListener; import javax.swing.event.ListSelectionListener;
import org.adempiere.osgi.InfoManager;
import org.compiere.apps.ADialog; import org.compiere.apps.ADialog;
import org.compiere.apps.AEnv; import org.compiere.apps.AEnv;
import org.compiere.apps.AWindow; import org.compiere.apps.AWindow;
@ -49,6 +50,15 @@ import org.compiere.apps.StatusBar;
import org.compiere.grid.ed.Calculator; import org.compiere.grid.ed.Calculator;
import org.compiere.minigrid.IDColumn; import org.compiere.minigrid.IDColumn;
import org.compiere.minigrid.MiniTable; 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.MQuery;
import org.compiere.model.MRole; import org.compiere.model.MRole;
import org.compiere.model.MSysConfig; import org.compiere.model.MSysConfig;
@ -75,7 +85,7 @@ import org.compiere.util.Msg;
* *
* @author Jorg Janke * @author Jorg Janke
* @version $Id: Info.java,v 1.2 2006/07/30 00:51:27 jjanke Exp $ * @version $Id: Info.java,v 1.2 2006/07/30 00:51:27 jjanke Exp $
* *
* @author Teo Sarca * @author Teo Sarca
* <li>FR [ 2846869 ] Info class - add more helper methods * <li>FR [ 2846869 ] Info class - add more helper methods
* https://sourceforge.net/tracker/?func=detail&atid=879335&aid=2846869&group_id=176962 * https://sourceforge.net/tracker/?func=detail&atid=879335&aid=2846869&group_id=176962
@ -88,10 +98,10 @@ public abstract class Info extends CDialog
implements ListSelectionListener implements ListSelectionListener
{ {
/** /**
* *
*/ */
private static final long serialVersionUID = -5606614040914295869L; private static final long serialVersionUID = -5606614040914295869L;
public static final String SYSCONFIG_INFO_DEFAULTSELECTED = "INFO_DEFAULTSELECTED"; public static final String SYSCONFIG_INFO_DEFAULTSELECTED = "INFO_DEFAULTSELECTED";
public static final String SYSCONFIG_INFO_DOUBLECLICKTOGGLESSELECTION = "INFO_DOUBLECLICKTOGGLESSELECTION"; public static final String SYSCONFIG_INFO_DOUBLECLICKTOGGLESSELECTION = "INFO_DOUBLECLICKTOGGLESSELECTION";
@ -112,39 +122,8 @@ public abstract class Info extends CDialog
String tableName, String keyColumn, String value, String tableName, String keyColumn, String value,
boolean multiSelection, String whereClause) boolean multiSelection, String whereClause)
{ {
Info info = null; Info info = InfoManager.create(frame, modal, WindowNo, tableName, keyColumn, value,
multiSelection, whereClause, true);
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);
// //
AEnv.positionCenterWindow(frame, info); AEnv.positionCenterWindow(frame, info);
return info; return info;
@ -157,8 +136,9 @@ public abstract class Info extends CDialog
*/ */
public static void showBPartner (Frame frame, int WindowNo) public static void showBPartner (Frame frame, int WindowNo)
{ {
Info info = new InfoBPartner (frame, false, WindowNo, "", Info info = InfoManager.create(frame, false, WindowNo,
!Env.getContext(Env.getCtx(),"IsSOTrx").equals("N"), false, ""); I_C_BPartner.Table_Name, I_C_BPartner.COLUMNNAME_C_BPartner_ID,
"", false, "", false);
AEnv.showCenterWindow(frame, info); AEnv.showCenterWindow(frame, info);
} // showBPartner } // showBPartner
@ -169,8 +149,9 @@ public abstract class Info extends CDialog
*/ */
public static void showAsset (Frame frame, int WindowNo) public static void showAsset (Frame frame, int WindowNo)
{ {
Info info = new InfoAsset (frame, false, WindowNo, Info info = InfoManager.create(frame, false, WindowNo,
0, "", false, ""); I_A_Asset.Table_Name, I_A_Asset.COLUMNNAME_A_Asset_ID,
"", false, "", false);
AEnv.showCenterWindow(frame, info); AEnv.showCenterWindow(frame, info);
} // showBPartner } // showBPartner
@ -181,11 +162,9 @@ public abstract class Info extends CDialog
*/ */
public static void showProduct (Frame frame, int WindowNo) public static void showProduct (Frame frame, int WindowNo)
{ {
Info info = new InfoProduct (frame, false, WindowNo, Info info = InfoManager.create(frame, false, WindowNo,
Env.getContextAsInt(Env.getCtx(), WindowNo, "M_Warehouse_ID"), I_M_Product.Table_Name, I_M_Product.COLUMNNAME_M_Product_ID,
Env.getContextAsInt(Env.getCtx(), WindowNo, "M_PriceList_ID"), "", false, "", false);
"", // value
false, "");
AEnv.showCenterWindow(frame, info); AEnv.showCenterWindow(frame, info);
} // showProduct } // showProduct
@ -197,8 +176,9 @@ public abstract class Info extends CDialog
*/ */
public static void showOrder (Frame frame, int WindowNo, String value) public static void showOrder (Frame frame, int WindowNo, String value)
{ {
Info info = new InfoOrder (frame, false, WindowNo, value, Info info = InfoManager.create(frame, false, WindowNo,
false, ""); I_C_Order.Table_Name, I_C_Order.COLUMNNAME_C_Order_ID,
"", false, "", false);
AEnv.showCenterWindow(frame, info); AEnv.showCenterWindow(frame, info);
} // showOrder } // showOrder
@ -210,8 +190,9 @@ public abstract class Info extends CDialog
*/ */
public static void showInvoice (Frame frame, int WindowNo, String value) public static void showInvoice (Frame frame, int WindowNo, String value)
{ {
Info info = new InfoInvoice (frame, false, WindowNo, value, Info info = InfoManager.create(frame, false, WindowNo,
false, ""); I_C_Invoice.Table_Name, I_C_Invoice.COLUMNNAME_C_Invoice_ID,
"", false, "", false);
AEnv.showCenterWindow(frame, info); AEnv.showCenterWindow(frame, info);
} // showInvoice } // showInvoice
@ -223,8 +204,9 @@ public abstract class Info extends CDialog
*/ */
public static void showInOut (Frame frame, int WindowNo, String value) public static void showInOut (Frame frame, int WindowNo, String value)
{ {
Info info = new InfoInOut (frame, false, WindowNo, value, Info info = InfoManager.create(frame, false, WindowNo,
false, ""); I_M_InOut.Table_Name, I_M_InOut.COLUMNNAME_M_InOut_ID,
"", false, "", false);
AEnv.showCenterWindow(frame, info); AEnv.showCenterWindow(frame, info);
} // showInOut } // showInOut
@ -236,8 +218,9 @@ public abstract class Info extends CDialog
*/ */
public static void showPayment (Frame frame, int WindowNo, String value) public static void showPayment (Frame frame, int WindowNo, String value)
{ {
Info info = new InfoPayment (frame, false, WindowNo, value, Info info = InfoManager.create(frame, false, WindowNo,
false, ""); I_C_Payment.Table_Name, I_C_Payment.COLUMNNAME_C_Payment_ID,
"", false, "", false);
AEnv.showCenterWindow(frame, info); AEnv.showCenterWindow(frame, info);
} // showPayment } // showPayment
@ -249,8 +232,9 @@ public abstract class Info extends CDialog
*/ */
public static void showCashLine (Frame frame, int WindowNo, String value) public static void showCashLine (Frame frame, int WindowNo, String value)
{ {
Info info = new InfoCashLine (frame, false, WindowNo, value, Info info = InfoManager.create(frame, false, WindowNo,
false, ""); I_C_CashLine.Table_Name, I_C_CashLine.COLUMNNAME_C_CashLine_ID,
"", false, "", false);
AEnv.showCenterWindow(frame, info); AEnv.showCenterWindow(frame, info);
} // showCashLine } // showCashLine
@ -262,8 +246,9 @@ public abstract class Info extends CDialog
*/ */
public static void showAssignment (Frame frame, int WindowNo, String value) public static void showAssignment (Frame frame, int WindowNo, String value)
{ {
Info info = new InfoAssignment (frame, false, WindowNo, value, Info info = InfoManager.create(frame, false, WindowNo,
false, ""); I_S_ResourceAssignment.Table_Name, I_S_ResourceAssignment.COLUMNNAME_S_ResourceAssignment_ID,
"", false, "", false);
AEnv.showCenterWindow(frame, info); AEnv.showCenterWindow(frame, info);
} // showAssignment } // showAssignment
@ -273,7 +258,9 @@ public abstract class Info extends CDialog
protected final int INFO_WIDTH = screensize.width > 1500 ? 1500 : screensize.width - 100; protected final int INFO_WIDTH = screensize.width > 1500 ? 1500 : screensize.width - 100;
protected final int SCREEN_HEIGHT = screensize.height; protected final int SCREEN_HEIGHT = screensize.height;
private boolean p_lookup;
/************************************************************************** /**************************************************************************
* Detail Constructor * Detail Constructor
* @param frame parent frame * @param frame parent frame
@ -287,6 +274,24 @@ public abstract class Info extends CDialog
protected Info (Frame frame, boolean modal, int WindowNo, protected Info (Frame frame, boolean modal, int WindowNo,
String tableName, String keyColumn, String tableName, String keyColumn,
boolean multiSelection, String whereClause) 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); super (frame, modal);
log.info("WinNo=" + p_WindowNo + " " + whereClause); log.info("WinNo=" + p_WindowNo + " " + whereClause);
@ -294,6 +299,7 @@ public abstract class Info extends CDialog
p_tableName = tableName; p_tableName = tableName;
p_keyColumn = keyColumn; p_keyColumn = keyColumn;
p_multiSelection = multiSelection; p_multiSelection = multiSelection;
p_lookup = lookup;
if (whereClause == null || whereClause.indexOf('@') == -1) if (whereClause == null || whereClause.indexOf('@') == -1)
p_whereClause = whereClause; p_whereClause = whereClause;
else else
@ -358,7 +364,7 @@ public abstract class Info extends CDialog
/** Worker */ /** Worker */
private Worker m_worker = null; private Worker m_worker = null;
/** Logger */ /** Logger */
protected CLogger log = CLogger.getCLogger(getClass()); protected CLogger log = CLogger.getCLogger(getClass());
@ -443,7 +449,7 @@ public abstract class Info extends CDialog
} // setStatusDB } // setStatusDB
/************************************************************************** /**************************************************************************
* Prepare Table, Construct SQL (m_m_sqlMain, m_sqlAdd) * Prepare Table, Construct SQL (m_m_sqlMain, m_sqlAdd)
* and size Window * and size Window
@ -472,13 +478,13 @@ public abstract class Info extends CDialog
if (layout[i].getColClass() == IDColumn.class) if (layout[i].getColClass() == IDColumn.class)
m_keyColumnIndex = i; m_keyColumnIndex = i;
} }
// Table Selection (Invoked before setting column class so that row selection is enabled) // Table Selection (Invoked before setting column class so that row selection is enabled)
p_table.setRowSelectionAllowed(true); p_table.setRowSelectionAllowed(true);
p_table.addMouseListener(this); p_table.addMouseListener(this);
p_table.setMultiSelection(p_multiSelection); p_table.setMultiSelection(p_multiSelection);
p_table.setShowTotals(true); p_table.setShowTotals(true);
// set editors (two steps) // set editors (two steps)
for (int i = 0; i < layout.length; i++) for (int i = 0; i < layout.length; i++)
p_table.setColumnClass(i, layout[i].getColClass(), layout[i].isReadOnly(), layout[i].getColHeader()); p_table.setColumnClass(i, layout[i].getColClass(), layout[i].isReadOnly(), layout[i].getColHeader());
@ -495,7 +501,7 @@ public abstract class Info extends CDialog
if (m_keyColumnIndex == -1) if (m_keyColumnIndex == -1)
log.log(Level.SEVERE, "No KeyColumn - " + sql); log.log(Level.SEVERE, "No KeyColumn - " + sql);
// Window Sizing // Window Sizing
parameterPanel.setPreferredSize(new Dimension (INFO_WIDTH, parameterPanel.getPreferredSize().height)); parameterPanel.setPreferredSize(new Dimension (INFO_WIDTH, parameterPanel.getPreferredSize().height));
//Begin - [FR 1823612 ] Product Info Screen Improvements //Begin - [FR 1823612 ] Product Info Screen Improvements
@ -503,7 +509,7 @@ public abstract class Info extends CDialog
//End - [FR 1823612 ] Product Info Screen Improvements //End - [FR 1823612 ] Product Info Screen Improvements
} // prepareTable } // prepareTable
/************************************************************************** /**************************************************************************
* Execute Query * Execute Query
*/ */
@ -534,7 +540,7 @@ public abstract class Info extends CDialog
if (dynWhere.length() > 0) if (dynWhere.length() > 0)
sql.append(dynWhere); // includes first AND sql.append(dynWhere); // includes first AND
String countSql = Msg.parseTranslation(Env.getCtx(), sql.toString()); // Variables String countSql = Msg.parseTranslation(Env.getCtx(), sql.toString()); // Variables
countSql = MRole.getDefault().addAccessSQL(countSql, getTableName(), countSql = MRole.getDefault().addAccessSQL(countSql, getTableName(),
MRole.SQL_FULLYQUALIFIED, MRole.SQL_RO); MRole.SQL_FULLYQUALIFIED, MRole.SQL_RO);
log.finer(countSql); log.finer(countSql);
PreparedStatement pstmt = null; PreparedStatement pstmt = null;
@ -559,12 +565,12 @@ public abstract class Info extends CDialog
} }
log.fine("#" + no + " - " + (System.currentTimeMillis()-start) + "ms"); log.fine("#" + no + " - " + (System.currentTimeMillis()-start) + "ms");
//Armen: add role checking (Patch #1694788 ) //Armen: add role checking (Patch #1694788 )
MRole role = MRole.getDefault(); MRole role = MRole.getDefault();
if (role.isQueryMax(no)) if (role.isQueryMax(no))
return ADialog.ask(p_WindowNo, this, "InfoHighRecordCount", String.valueOf(no)); return ADialog.ask(p_WindowNo, this, "InfoHighRecordCount", String.valueOf(no));
return true; return true;
} // testCount } // testCount
/** /**
* Save Selection - Called by dispose * Save Selection - Called by dispose
@ -620,7 +626,7 @@ public abstract class Info extends CDialog
return selectedDataList.get(0); return selectedDataList.get(0);
} }
} // getSelectedRowKey } // getSelectedRowKey
/** /**
* Get the keys of selected row/s based on layout defined in prepareTable * Get the keys of selected row/s based on layout defined in prepareTable
* @return IDs if selection present * @return IDs if selection present
@ -629,12 +635,12 @@ public abstract class Info extends CDialog
protected ArrayList<Integer> getSelectedRowKeys() protected ArrayList<Integer> getSelectedRowKeys()
{ {
ArrayList<Integer> selectedDataList = new ArrayList<Integer>(); ArrayList<Integer> selectedDataList = new ArrayList<Integer>();
if (m_keyColumnIndex == -1) if (m_keyColumnIndex == -1)
{ {
return selectedDataList; return selectedDataList;
} }
if (p_multiSelection) if (p_multiSelection)
{ {
int rows = p_table.getRowCount(); int rows = p_table.getRowCount();
@ -660,7 +666,7 @@ public abstract class Info extends CDialog
} }
} }
} }
if (selectedDataList.size() == 0) if (selectedDataList.size() == 0)
{ {
int row = p_table.getSelectedRow(); int row = p_table.getSelectedRow();
@ -673,7 +679,7 @@ public abstract class Info extends CDialog
selectedDataList.add((Integer)data); selectedDataList.add((Integer)data);
} }
} }
return selectedDataList; return selectedDataList;
} // getSelectedRowKeys } // getSelectedRowKeys
@ -722,7 +728,7 @@ public abstract class Info extends CDialog
Object[] keys = getSelectedKeys(); Object[] keys = getSelectedKeys();
if (keys == null || keys.length == 0) if (keys == null || keys.length == 0)
{ {
log.config("No Results - OK=" log.config("No Results - OK="
+ m_ok + ", Cancel=" + m_cancel); + m_ok + ", Cancel=" + m_cancel);
return ""; return "";
} }
@ -748,7 +754,7 @@ public abstract class Info extends CDialog
return sb.toString(); return sb.toString();
} // getSelectedSQL; } // getSelectedSQL;
/************************************************************************** /**************************************************************************
* (Button) Action Listener & Popup Menu * (Button) Action Listener & Popup Menu
* @param e event * @param e event
@ -891,7 +897,7 @@ public abstract class Info extends CDialog
return p_keyColumn; return p_keyColumn;
} // getKeyColumn } // getKeyColumn
/************************************************************************** /**************************************************************************
* Table Selection Changed * Table Selection Changed
* @param e event * @param e event
@ -913,21 +919,21 @@ public abstract class Info extends CDialog
{ {
boolean enable = (p_table.getSelectedRowCount() == 1); boolean enable = (p_table.getSelectedRowCount() == 1);
confirmPanel.getOKButton().setEnabled(p_table.getSelectedRowCount() > 0); confirmPanel.getOKButton().setEnabled(p_table.getSelectedRowCount() > 0);
if (hasHistory()) if (hasHistory())
confirmPanel.getHistoryButton().setEnabled(enable); confirmPanel.getHistoryButton().setEnabled(enable);
if (hasZoom()) if (hasZoom())
confirmPanel.getZoomButton().setEnabled(enable); confirmPanel.getZoomButton().setEnabled(enable);
} // enableButtons } // enableButtons
/************************************************************************** /**************************************************************************
* Get dynamic WHERE part of SQL * Get dynamic WHERE part of SQL
* To be overwritten by concrete classes * To be overwritten by concrete classes
* @return WHERE clause * @return WHERE clause
*/ */
protected abstract String getSQLWhere(); protected abstract String getSQLWhere();
/** /**
* Set Parameters for Query * Set Parameters for Query
* To be overwritten by concrete classes * To be overwritten by concrete classes
@ -935,7 +941,7 @@ public abstract class Info extends CDialog
* @param forCount for counting records * @param forCount for counting records
* @throws SQLException * @throws SQLException
*/ */
protected abstract void setParameters (PreparedStatement pstmt, boolean forCount) protected abstract void setParameters (PreparedStatement pstmt, boolean forCount)
throws SQLException; throws SQLException;
/** /**
@ -1028,34 +1034,34 @@ public abstract class Info extends CDialog
return m_PO_Window_ID; return m_PO_Window_ID;
return m_SO_Window_ID; return m_SO_Window_ID;
} // getAD_Window_ID } // getAD_Window_ID
/** /**
* *
* @return Index of Key Column * @return Index of Key Column
*/ */
protected int getKeyColumnIndex() protected int getKeyColumnIndex()
{ {
return m_keyColumnIndex; return m_keyColumnIndex;
} }
/** /**
* *
* @return true if OK button was pressed * @return true if OK button was pressed
*/ */
public boolean isOkPressed() public boolean isOkPressed()
{ {
return m_ok; return m_ok;
} }
/** /**
* *
* @return true if Cancel button was pressed * @return true if Cancel button was pressed
*/ */
public boolean isCancelPressed() public boolean isCancelPressed()
{ {
return m_cancel; return m_cancel;
} }
/** /**
* Specify if the records should be checked(selected) by default. * Specify if the records should be checked(selected) by default.
* (for multi-selection only) * (for multi-selection only)
@ -1065,7 +1071,7 @@ public abstract class Info extends CDialog
{ {
p_isDefaultSelected = value; p_isDefaultSelected = value;
} }
/** /**
* (for multi-selection only) * (for multi-selection only)
* @return true if records are selected by default * @return true if records are selected by default
@ -1074,7 +1080,7 @@ public abstract class Info extends CDialog
{ {
return p_isDefaultSelected; return p_isDefaultSelected;
} }
/** /**
* (for multi-selection only) * (for multi-selection only)
* @param value true if double click should toggle record selection * @param value true if double click should toggle record selection
@ -1083,7 +1089,7 @@ public abstract class Info extends CDialog
{ {
p_doubleClickTogglesSelection = value; p_doubleClickTogglesSelection = value;
} }
/** /**
* (for multi-selection only) * (for multi-selection only)
* @return true if double click should toggle record selection * @return true if double click should toggle record selection
@ -1093,6 +1099,16 @@ public abstract class Info extends CDialog
return p_doubleClickTogglesSelection; 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 * Mouse Clicked
@ -1107,7 +1123,7 @@ public abstract class Info extends CDialog
// Double click with selected row => exit/zoom // Double click with selected row => exit/zoom
if (e.getClickCount() > 1 && p_table.getSelectedRow() != -1) if (e.getClickCount() > 1 && p_table.getSelectedRow() != -1)
{ {
if (p_multiSelection && isDoubleClickTogglesSelection()) if (isLookup() && p_multiSelection && isDoubleClickTogglesSelection())
{ {
if (m_keyColumnIndex >= 0) if (m_keyColumnIndex >= 0)
{ {
@ -1121,7 +1137,17 @@ public abstract class Info extends CDialog
} }
} }
else else
dispose(true); {
if (isLookup())
{
dispose(true);
}
else
{
zoom();
}
}
} }
// Right Click => start Calculator // Right Click => start Calculator
else if (SwingUtilities.isRightMouseButton(e)) else if (SwingUtilities.isRightMouseButton(e))
@ -1138,7 +1164,7 @@ public abstract class Info extends CDialog
{ {
private PreparedStatement m_pstmt = null; private PreparedStatement m_pstmt = null;
private ResultSet m_rs = null; private ResultSet m_rs = null;
/** /**
* Do Work (load data) * Do Work (load data)
*/ */
@ -1157,7 +1183,7 @@ public abstract class Info extends CDialog
sql.append(dynWhere); // includes first AND sql.append(dynWhere); // includes first AND
sql.append(m_sqlOrder); sql.append(m_sqlOrder);
String dataSql = Msg.parseTranslation(Env.getCtx(), sql.toString()); // Variables String dataSql = Msg.parseTranslation(Env.getCtx(), sql.toString()); // Variables
dataSql = MRole.getDefault().addAccessSQL(dataSql, getTableName(), dataSql = MRole.getDefault().addAccessSQL(dataSql, getTableName(),
MRole.SQL_FULLYQUALIFIED, MRole.SQL_RO); MRole.SQL_FULLYQUALIFIED, MRole.SQL_RO);
log.finer(dataSql); log.finer(dataSql);
@ -1238,7 +1264,7 @@ public abstract class Info extends CDialog
p_table.requestFocus(); p_table.requestFocus();
} }
} // run } // run
/** /**
* Close ResultSet and Statement * Close ResultSet and Statement
*/ */
@ -1247,10 +1273,10 @@ public abstract class Info extends CDialog
m_rs = null; m_rs = null;
m_pstmt = null; m_pstmt = null;
} }
/** /**
* Interrupt this thread - cancel the query if still in execution * Interrupt this thread - cancel the query if still in execution
* Carlos Ruiz - globalqss - [2826660] - Info product performance BIG problem * Carlos Ruiz - globalqss - [2826660] - Info product performance BIG problem
*/ */
public void interrupt() { public void interrupt() {
if (m_pstmt != null) { if (m_pstmt != null) {

View File

@ -37,20 +37,19 @@ import org.compiere.util.Msg;
/** /**
* Asset Information * Asset Information
* *
* @author Jorg Janke * @author Jorg Janke
* @version $Id: InfoAsset.java,v 1.2 2006/07/30 00:51:27 jjanke Exp $ * @version $Id: InfoAsset.java,v 1.2 2006/07/30 00:51:27 jjanke Exp $
*/ */
public class InfoAsset extends Info public class InfoAsset extends Info
{ {
/** /**
* *
*/ */
private static final long serialVersionUID = 6014685562933753813L; private static final long serialVersionUID = 6014685562933753813L;
/** /**
* Standard Constructor * Standard Constructor
* @param frame frame * @param frame frame
* @param modal modal * @param modal modal
* @param WindowNo window no * @param WindowNo window no
@ -62,6 +61,24 @@ public class InfoAsset extends Info
public InfoAsset (Frame frame, boolean modal, int WindowNo, public InfoAsset (Frame frame, boolean modal, int WindowNo,
int A_Asset_ID, String value, int A_Asset_ID, String value,
boolean multiSelection, String whereClause) 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); super (frame, modal, WindowNo, "a", "A_Asset_ID", multiSelection, whereClause);
log.info(value + ", ID=" + A_Asset_ID + ", WHERE=" + whereClause); log.info(value + ", ID=" + A_Asset_ID + ", WHERE=" + whereClause);
@ -101,7 +118,7 @@ public class InfoAsset extends Info
new Info_Column(Msg.translate(Env.getCtx(), "GuaranteeDate"), "a.GuaranteeDate", Timestamp.class), new Info_Column(Msg.translate(Env.getCtx(), "GuaranteeDate"), "a.GuaranteeDate", Timestamp.class),
new Info_Column(Msg.translate(Env.getCtx(), "VersionNo"), "a.VersionNo", String.class) new Info_Column(Msg.translate(Env.getCtx(), "VersionNo"), "a.VersionNo", String.class)
}; };
// //
private CLabel labelValue = new CLabel(); private CLabel labelValue = new CLabel();
private CTextField fieldValue = new CTextField(10); private CTextField fieldValue = new CTextField(10);
@ -112,7 +129,7 @@ public class InfoAsset extends Info
private VLookup fBPartner_ID; private VLookup fBPartner_ID;
private CLabel lProduct_ID = new CLabel(Msg.translate(Env.getCtx(), "Product")); private CLabel lProduct_ID = new CLabel(Msg.translate(Env.getCtx(), "Product"));
private VLookup fProduct_ID; private VLookup fProduct_ID;
/** /**
* Static Setup - add fields to parameterPanel * Static Setup - add fields to parameterPanel
*/ */
@ -140,7 +157,7 @@ public class InfoAsset extends Info
parameterPanel.add(fieldValue, null); parameterPanel.add(fieldValue, null);
parameterPanel.add(lBPartner_ID, null); parameterPanel.add(lBPartner_ID, null);
parameterPanel.add(fBPartner_ID, null); parameterPanel.add(fBPartner_ID, null);
// //
parameterPanel.add(labelName, new ALayoutConstraint(1,0)); parameterPanel.add(labelName, new ALayoutConstraint(1,0));
parameterPanel.add(fieldName, null); parameterPanel.add(fieldName, null);
parameterPanel.add(lProduct_ID, null); parameterPanel.add(lProduct_ID, null);

View File

@ -48,7 +48,7 @@ import org.compiere.util.Msg;
public class InfoAssignment extends Info public class InfoAssignment extends Info
{ {
/** /**
* *
*/ */
private static final long serialVersionUID = 5017170699571459745L; private static final long serialVersionUID = 5017170699571459745L;
@ -63,9 +63,25 @@ public class InfoAssignment extends Info
*/ */
public InfoAssignment (Frame frame, boolean modal, int WindowNo, public InfoAssignment (Frame frame, boolean modal, int WindowNo,
String value, boolean multiSelection, String whereClause) 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", super (frame, modal, WindowNo, "ra", "S_ResourceAssigment_ID",
multiSelection, whereClause); multiSelection, whereClause, lookup);
log.info(value); log.info(value);
setTitle(Msg.getMsg(Env.getCtx(), "InfoAssignment")); setTitle(Msg.getMsg(Env.getCtx(), "InfoAssignment"));
// //

View File

@ -44,7 +44,7 @@ import org.compiere.util.Msg;
public class InfoBPartner extends Info public class InfoBPartner extends Info
{ {
/** /**
* *
*/ */
private static final long serialVersionUID = 5550733934685665946L; private static final long serialVersionUID = 5550733934685665946L;
@ -62,7 +62,25 @@ public class InfoBPartner extends Info
String value, boolean isSOTrx, String value, boolean isSOTrx,
boolean multiSelection, String whereClause) 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); log.info(value);
setTitle(Msg.getMsg(Env.getCtx(), "InfoBPartner")); setTitle(Msg.getMsg(Env.getCtx(), "InfoBPartner"));
m_isSOTrx = isSOTrx; m_isSOTrx = isSOTrx;
@ -92,9 +110,9 @@ public class InfoBPartner extends Info
/** From Clause */ /** From Clause */
private static String s_partnerFROM = "C_BPartner" private static String s_partnerFROM = "C_BPartner"
+ " LEFT OUTER JOIN C_BPartner_Location l ON (C_BPartner.C_BPartner_ID=l.C_BPartner_ID AND l.IsActive='Y')" + " LEFT OUTER JOIN C_BPartner_Location l ON (C_BPartner.C_BPartner_ID=l.C_BPartner_ID AND l.IsActive='Y')"
+ " LEFT OUTER JOIN AD_User c ON (C_BPartner.C_BPartner_ID=c.C_BPartner_ID AND (c.C_BPartner_Location_ID IS NULL OR c.C_BPartner_Location_ID=l.C_BPartner_Location_ID) AND c.IsActive='Y')" + " LEFT OUTER JOIN AD_User c ON (C_BPartner.C_BPartner_ID=c.C_BPartner_ID AND (c.C_BPartner_Location_ID IS NULL OR c.C_BPartner_Location_ID=l.C_BPartner_Location_ID) AND c.IsActive='Y')"
+ " LEFT OUTER JOIN C_Location a ON (l.C_Location_ID=a.C_Location_ID)"; + " LEFT OUTER JOIN C_Location a ON (l.C_Location_ID=a.C_Location_ID)";
/** Array of Column Info */ /** Array of Column Info */
private static Info_Column[] s_partnerLayout = { private static Info_Column[] s_partnerLayout = {
new Info_Column(" ", "C_BPartner.C_BPartner_ID", IDColumn.class), new Info_Column(" ", "C_BPartner.C_BPartner_ID", IDColumn.class),
@ -145,7 +163,7 @@ public class InfoBPartner extends Info
labelContact.setText(Msg.getMsg(Env.getCtx(), "Contact")); labelContact.setText(Msg.getMsg(Env.getCtx(), "Contact"));
fieldContact.setBackground(AdempierePLAF.getInfoBackground()); fieldContact.setBackground(AdempierePLAF.getInfoBackground());
fieldContact.addActionListener(this); fieldContact.addActionListener(this);
labelEMail.setText(Msg.getMsg(Env.getCtx(), "EMail")); labelEMail.setText(Msg.getMsg(Env.getCtx(), "EMail"));
fieldEMail.setBackground(AdempierePLAF.getInfoBackground()); fieldEMail.setBackground(AdempierePLAF.getInfoBackground());
fieldEMail.addActionListener(this); fieldEMail.addActionListener(this);
@ -180,7 +198,7 @@ public class InfoBPartner extends Info
parameterPanel.add(labelPhone, null); parameterPanel.add(labelPhone, null);
parameterPanel.add(fieldPhone, null); parameterPanel.add(fieldPhone, null);
parameterPanel.add(checkCustomer, null); parameterPanel.add(checkCustomer, null);
// //
parameterPanel.add(labelName, new ALayoutConstraint(1,0)); parameterPanel.add(labelName, new ALayoutConstraint(1,0));
parameterPanel.add(fieldName, null); parameterPanel.add(fieldName, null);
parameterPanel.add(labelEMail, null); parameterPanel.add(labelEMail, null);
@ -199,8 +217,8 @@ public class InfoBPartner extends Info
{ {
/** From /** From
C_BPartner C_BPartner
LEFT OUTER JOIN C_BPartner_Location l ON (C_BPartner.C_BPartner_ID=l.C_BPartner_ID AND l.IsActive='Y') LEFT OUTER JOIN C_BPartner_Location l ON (C_BPartner.C_BPartner_ID=l.C_BPartner_ID AND l.IsActive='Y')
LEFT OUTER JOIN AD_User c ON (C_BPartner.C_BPartner_ID=c.C_BPartner_ID AND (c.C_BPartner_Location_ID IS NULL OR c.C_BPartner_Location_ID=l.C_BPartner_Location_ID) AND c.IsActive='Y') LEFT OUTER JOIN AD_User c ON (C_BPartner.C_BPartner_ID=c.C_BPartner_ID AND (c.C_BPartner_Location_ID IS NULL OR c.C_BPartner_Location_ID=l.C_BPartner_Location_ID) AND c.IsActive='Y')
LEFT OUTER JOIN C_Location a ON (l.C_Location_ID=a.C_Location_ID) LEFT OUTER JOIN C_Location a ON (l.C_Location_ID=a.C_Location_ID)
**/ **/
@ -425,7 +443,7 @@ public class InfoBPartner extends Info
Integer C_BPartner_ID = getSelectedRowKey(); Integer C_BPartner_ID = getSelectedRowKey();
if (C_BPartner_ID == null) if (C_BPartner_ID == null)
return; return;
InvoiceHistory ih = new InvoiceHistory (this, C_BPartner_ID.intValue(), InvoiceHistory ih = new InvoiceHistory (this, C_BPartner_ID.intValue(),
0, 0, 0); 0, 0, 0);
ih.setVisible(true); ih.setVisible(true);
ih = null; ih = null;

View File

@ -46,14 +46,14 @@ import org.compiere.util.Util;
* *
* @author Jorg Janke * @author Jorg Janke
* @version $Id: InfoCashLine.java,v 1.2 2006/07/30 00:51:27 jjanke Exp $ * @version $Id: InfoCashLine.java,v 1.2 2006/07/30 00:51:27 jjanke Exp $
* *
* @author Teo Sarca, SC ARHIPAC SERVICE SRL * @author Teo Sarca, SC ARHIPAC SERVICE SRL
* <li>FR [ 1976044 ] Info Cash Line: search by Charge * <li>FR [ 1976044 ] Info Cash Line: search by Charge
*/ */
public class InfoCashLine extends Info public class InfoCashLine extends Info
{ {
/** /**
* *
*/ */
private static final long serialVersionUID = -3315036454469996930L; private static final long serialVersionUID = -3315036454469996930L;
@ -66,7 +66,7 @@ public class InfoCashLine extends Info
* @param multiSelection multiple selections * @param multiSelection multiple selections
* @param whereClause whwre clause * @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) boolean multiSelection, String whereClause)
{ {
super (frame, modal, WindowNo, "cl", "C_CashLine_ID", multiSelection, whereClause); super (frame, modal, WindowNo, "cl", "C_CashLine_ID", multiSelection, whereClause);
@ -244,7 +244,7 @@ public class InfoCashLine extends Info
return true; return true;
} // initInfo } // initInfo
/************************************************************************** /**************************************************************************
* Construct SQL Where Clause and define parameters * Construct SQL Where Clause and define parameters
* (setParameters needs to set parameters) * (setParameters needs to set parameters)

View File

@ -46,14 +46,14 @@ import org.compiere.util.Msg;
* <ul> * <ul>
* <li>2007-02-14 - teo_sarca - [ 1659737 ] InfoGeneral not working with virtual columns * <li>2007-02-14 - teo_sarca - [ 1659737 ] InfoGeneral not working with virtual columns
* </ul> * </ul>
* *
* @author Jorg Janke * @author Jorg Janke
* @version $Id: InfoGeneral.java,v 1.3 2006/10/06 00:42:38 jjanke Exp $ * @version $Id: InfoGeneral.java,v 1.3 2006/10/06 00:42:38 jjanke Exp $
*/ */
public class InfoGeneral extends Info public class InfoGeneral extends Info
{ {
/** /**
* *
*/ */
private static final long serialVersionUID = -7588425490485071820L; private static final long serialVersionUID = -7588425490485071820L;
@ -69,11 +69,31 @@ public class InfoGeneral extends Info
* @param multiSelection multiple selections * @param multiSelection multiple selections
* @param whereClause where clause * @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, String tableName, String keyColumn,
boolean multiSelection, String whereClause) 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); log.info(tableName + " - " + keyColumn + " - " + whereClause);
setTitle(Msg.getMsg(Env.getCtx(), "Info")); setTitle(Msg.getMsg(Env.getCtx(), "Info"));
// //
@ -81,7 +101,7 @@ public class InfoGeneral extends Info
p_loadedOK = initInfo (); p_loadedOK = initInfo ();
// //
int no = p_table.getRowCount(); int no = p_table.getRowCount();
setStatusLine(Integer.toString(no) + " " setStatusLine(Integer.toString(no) + " "
+ Msg.getMsg(Env.getCtx(), "SearchRows_EnterQuery"), false); + Msg.getMsg(Env.getCtx(), "SearchRows_EnterQuery"), false);
setStatusDB(Integer.toString(no)); setStatusDB(Integer.toString(no));
// Focus // Focus
@ -234,7 +254,7 @@ public class InfoGeneral extends Info
m_queryColumnsSql.add(columnSql); m_queryColumnsSql.add(columnSql);
else else
m_queryColumnsSql.add(rs.getString(1)); m_queryColumnsSql.add(rs.getString(1));
if (AD_Table_ID == 0) if (AD_Table_ID == 0)
{ {
AD_Table_ID = rs.getInt(2); AD_Table_ID = rs.getInt(2);
@ -259,7 +279,7 @@ public class InfoGeneral extends Info
log.log(Level.SEVERE, "No query columns found"); log.log(Level.SEVERE, "No query columns found");
return false; return false;
} }
log.finest("Table " + tableName + ", ID=" + AD_Table_ID log.finest("Table " + tableName + ", ID=" + AD_Table_ID
+ ", QueryColumns #" + m_queryColumns.size()); + ", QueryColumns #" + m_queryColumns.size());
// Only 4 Query Columns // Only 4 Query Columns
while (m_queryColumns.size() > 4) { while (m_queryColumns.size() > 4) {
@ -285,7 +305,7 @@ public class InfoGeneral extends Info
// + " (f.IsDisplayed='Y' AND f.IsEncrypted='N' AND f.ObscureType IS NULL)) " // + " (f.IsDisplayed='Y' AND f.IsEncrypted='N' AND f.ObscureType IS NULL)) "
+ " (f.IsEncrypted='N' AND f.ObscureType IS NULL)) " + " (f.IsEncrypted='N' AND f.ObscureType IS NULL)) "
+ "ORDER BY c.IsKey DESC, f.SeqNo"; + "ORDER BY c.IsKey DESC, f.SeqNo";
try try
{ {
pstmt = DB.prepareStatement(sql, null); pstmt = DB.prepareStatement(sql, null);
@ -367,7 +387,7 @@ public class InfoGeneral extends Info
log.log(Level.SEVERE, "No Info for AD_Table_ID=" + AD_Table_ID + " - " + sql); log.log(Level.SEVERE, "No Info for AD_Table_ID=" + AD_Table_ID + " - " + sql);
return false; return false;
} }
log.finest("InfoColumns #" + list.size()); log.finest("InfoColumns #" + list.size());
// Convert ArrayList to Array // Convert ArrayList to Array
m_generalLayout = new Info_Column[list.size()]; m_generalLayout = new Info_Column[list.size()];

View File

@ -48,7 +48,7 @@ import org.compiere.util.Util;
public class InfoInOut extends Info public class InfoInOut extends Info
{ {
/** /**
* *
*/ */
private static final long serialVersionUID = -2066307179999903184L; private static final long serialVersionUID = -2066307179999903184L;
@ -61,10 +61,26 @@ public class InfoInOut extends Info
* @param multiSelection multiple selections * @param multiSelection multiple selections
* @param whereClause where clause * @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) 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"); log.info( "InfoInOut");
setTitle(Msg.getMsg(Env.getCtx(), "InfoInOut")); setTitle(Msg.getMsg(Env.getCtx(), "InfoInOut"));
// //

View File

@ -46,14 +46,14 @@ import org.compiere.util.Util;
* *
* @author Jorg Janke * @author Jorg Janke
* @version $Id: InfoInvoice.java,v 1.2 2006/07/30 00:51:27 jjanke Exp $ * @version $Id: InfoInvoice.java,v 1.2 2006/07/30 00:51:27 jjanke Exp $
* *
* @author Teo Sarca, SC ARHIPAC SERVICE SRL * @author Teo Sarca, SC ARHIPAC SERVICE SRL
* FR [ 1926882 ] Info Invoice: display Due Date * FR [ 1926882 ] Info Invoice: display Due Date
*/ */
public class InfoInvoice extends Info public class InfoInvoice extends Info
{ {
/** /**
* *
*/ */
private static final long serialVersionUID = 2119484421367033632L; private static final long serialVersionUID = 2119484421367033632L;
@ -67,10 +67,27 @@ public class InfoInvoice extends Info
* @param multiSelection multiple selections * @param multiSelection multiple selections
* @param whereClause where clause * @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) 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")); setTitle(Msg.getMsg(Env.getCtx(), "InfoInvoice"));
// //
try try
@ -250,7 +267,7 @@ public class InfoInvoice extends Info
return true; return true;
} // initInfo } // initInfo
/************************************************************************** /**************************************************************************
* Construct SQL Where Clause and define parameters. * Construct SQL Where Clause and define parameters.
* (setParameters needs to set parameters) * (setParameters needs to set parameters)
@ -382,7 +399,7 @@ public class InfoInvoice extends Info
log.fine( "String=" + s); log.fine( "String=" + s);
return s; return s;
} // getSQLText } // getSQLText
/** /**
* Zoom * Zoom
*/ */
@ -430,6 +447,6 @@ public class InfoInvoice extends Info
else else
Env.setContext(Env.getCtx(), p_WindowNo, Env.TAB_INFO, "C_InvoicePaySchedule_ID", String.valueOf(C_InvoicePaySchedule_ID)); Env.setContext(Env.getCtx(), p_WindowNo, Env.TAB_INFO, "C_InvoicePaySchedule_ID", String.valueOf(C_InvoicePaySchedule_ID));
} // saveSelectionDetail } // saveSelectionDetail
} // InfoInvoice } // InfoInvoice

View File

@ -49,7 +49,7 @@ import org.compiere.util.Util;
public class InfoOrder extends Info public class InfoOrder extends Info
{ {
/** /**
* *
*/ */
private static final long serialVersionUID = 2246871771555208114L; private static final long serialVersionUID = 2246871771555208114L;
@ -62,10 +62,26 @@ public class InfoOrder extends Info
* @param multiSelection multiple selections * @param multiSelection multiple selections
* @param whereClause where clause * @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) 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"); log.info( "InfoOrder");
setTitle(Msg.getMsg(Env.getCtx(), "InfoOrder")); setTitle(Msg.getMsg(Env.getCtx(), "InfoOrder"));
// //
@ -228,7 +244,7 @@ public class InfoOrder extends Info
return true; return true;
} // initInfo } // initInfo
/************************************************************************** /**************************************************************************
* Construct SQL Where Clause and define parameters. * Construct SQL Where Clause and define parameters.
* (setParameters needs to set parameters) * (setParameters needs to set parameters)
@ -348,7 +364,7 @@ public class InfoOrder extends Info
log.fine("String=" + s); log.fine("String=" + s);
return s; return s;
} // getSQLText } // getSQLText
/** /**
* Zoom * Zoom
@ -374,5 +390,5 @@ public class InfoOrder extends Info
{ {
return true; return true;
} // hasZoom } // hasZoom
} // InfoOrder } // InfoOrder

View File

@ -49,7 +49,7 @@ import org.compiere.util.Util;
public class InfoPayment extends Info public class InfoPayment extends Info
{ {
/** /**
* *
*/ */
private static final long serialVersionUID = -2917241055484901704L; private static final long serialVersionUID = -2917241055484901704L;
@ -62,10 +62,26 @@ public class InfoPayment extends Info
* @param multiSelection multiple selections * @param multiSelection multiple selections
* @param whereClause whwre clause * @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) 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"); log.info( "InfoPayment");
setTitle(Msg.getMsg(Env.getCtx(), "InfoPayment")); setTitle(Msg.getMsg(Env.getCtx(), "InfoPayment"));
// //
@ -228,7 +244,7 @@ public class InfoPayment extends Info
return true; return true;
} // initInfo } // initInfo
/************************************************************************** /**************************************************************************
* Construct SQL Where Clause and define parameters * Construct SQL Where Clause and define parameters
* (setParameters needs to set parameters) * (setParameters needs to set parameters)
@ -340,7 +356,7 @@ public class InfoPayment extends Info
log.fine( "String=" + s); log.fine( "String=" + s);
return s; return s;
} // getSQLText } // getSQLText
/** /**
* Zoom * Zoom
*/ */
@ -365,5 +381,5 @@ public class InfoPayment extends Info
{ {
return true; return true;
} // hasZoom } // hasZoom
} // InfoPayment } // InfoPayment

View File

@ -73,14 +73,14 @@ import org.jdesktop.swingx.JXTaskPane;
* *
* @author Jorg Janke * @author Jorg Janke
* @version $Id: InfoProduct.java,v 1.4 2006/07/30 00:51:27 jjanke Exp $ * @version $Id: InfoProduct.java,v 1.4 2006/07/30 00:51:27 jjanke Exp $
* *
* @author Bogdan Ioan, SC ARHIPAC SERVICE SRL * @author Bogdan Ioan, SC ARHIPAC SERVICE SRL
* <li>FR [ 2012362 ] Info Product: Add Product Category * <li>FR [ 2012362 ] Info Product: Add Product Category
*/ */
public class InfoProduct extends Info implements ActionListener, ChangeListener public class InfoProduct extends Info implements ActionListener, ChangeListener
{ {
/** /**
* *
*/ */
private static final long serialVersionUID = 2076229793041196087L; private static final long serialVersionUID = 2076229793041196087L;
@ -99,7 +99,25 @@ public class InfoProduct extends Info implements ActionListener, ChangeListener
int M_Warehouse_ID, int M_PriceList_ID, String value, int M_Warehouse_ID, int M_PriceList_ID, String value,
boolean multiSelection, String whereClause) 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); log.info(value + ", Wh=" + M_Warehouse_ID + ", PL=" + M_PriceList_ID + ", WHERE=" + whereClause);
setTitle(Msg.getMsg(Env.getCtx(), "InfoProduct")); setTitle(Msg.getMsg(Env.getCtx(), "InfoProduct"));
// //
@ -117,7 +135,7 @@ public class InfoProduct extends Info implements ActionListener, ChangeListener
p_loadedOK = true; p_loadedOK = true;
// Focus // Focus
fieldValue.requestFocus(); fieldValue.requestFocus();
//Begin - fer_luck @ centuryon //Begin - fer_luck @ centuryon
mWindowNo = WindowNo; mWindowNo = WindowNo;
//End - fer_luck @ centuryon //End - fer_luck @ centuryon
@ -156,7 +174,7 @@ public class InfoProduct extends Info implements ActionListener, ChangeListener
private VComboBox pickProductCategory = new VComboBox(); private VComboBox pickProductCategory = new VComboBox();
private CLabel labelAS = new CLabel(); // @Trifon private CLabel labelAS = new CLabel(); // @Trifon
private VComboBox pickAS = new VComboBox(); // @Trifon private VComboBox pickAS = new VComboBox(); // @Trifon
//Begin - fer_luck @ centuryon //Begin - fer_luck @ centuryon
private CTextArea fieldDescription = new CTextArea(); private CTextArea fieldDescription = new CTextArea();
JXTaskPane warehouseStockPanel = new JXTaskPane(); JXTaskPane warehouseStockPanel = new JXTaskPane();
@ -194,7 +212,7 @@ public class InfoProduct extends Info implements ActionListener, ChangeListener
labelValue.setText(Msg.getMsg(Env.getCtx(), "Value")); labelValue.setText(Msg.getMsg(Env.getCtx(), "Value"));
fieldValue.setBackground(AdempierePLAF.getInfoBackground()); fieldValue.setBackground(AdempierePLAF.getInfoBackground());
fieldValue.addActionListener(this); fieldValue.addActionListener(this);
labelName.setText(Msg.getMsg(Env.getCtx(), "Name")); labelName.setText(Msg.getMsg(Env.getCtx(), "Name"));
fieldName.setBackground(AdempierePLAF.getInfoBackground()); fieldName.setBackground(AdempierePLAF.getInfoBackground());
fieldName.addActionListener(this); fieldName.addActionListener(this);
@ -206,24 +224,24 @@ public class InfoProduct extends Info implements ActionListener, ChangeListener
labelSKU.setText(Msg.translate(Env.getCtx(), "SKU")); labelSKU.setText(Msg.translate(Env.getCtx(), "SKU"));
fieldSKU.setBackground(AdempierePLAF.getInfoBackground()); fieldSKU.setBackground(AdempierePLAF.getInfoBackground());
fieldSKU.addActionListener(this); fieldSKU.addActionListener(this);
labelWarehouse.setText(Msg.getMsg(Env.getCtx(), "Warehouse")); labelWarehouse.setText(Msg.getMsg(Env.getCtx(), "Warehouse"));
pickWarehouse.setBackground(AdempierePLAF.getInfoBackground()); pickWarehouse.setBackground(AdempierePLAF.getInfoBackground());
labelPriceList.setText(Msg.getMsg(Env.getCtx(), "PriceListVersion")); labelPriceList.setText(Msg.getMsg(Env.getCtx(), "PriceListVersion"));
pickPriceList.setBackground(AdempierePLAF.getInfoBackground()); pickPriceList.setBackground(AdempierePLAF.getInfoBackground());
labelProductCategory.setText(Msg.translate(Env.getCtx(), "M_Product_Category_ID")); labelProductCategory.setText(Msg.translate(Env.getCtx(), "M_Product_Category_ID"));
pickProductCategory.setBackground(AdempierePLAF.getInfoBackground()); pickProductCategory.setBackground(AdempierePLAF.getInfoBackground());
// @Trifon // @Trifon
labelAS.setText(Msg.translate(Env.getCtx(), "M_AttributeSet_ID")); labelAS.setText(Msg.translate(Env.getCtx(), "M_AttributeSet_ID"));
pickAS.setBackground(AdempierePLAF.getInfoBackground()); pickAS.setBackground(AdempierePLAF.getInfoBackground());
m_InfoPAttributeButton.setMargin(new Insets(2,2,2,2)); m_InfoPAttributeButton.setMargin(new Insets(2,2,2,2));
m_InfoPAttributeButton.setToolTipText(Msg.getMsg(Env.getCtx(), "InfoPAttribute")); m_InfoPAttributeButton.setToolTipText(Msg.getMsg(Env.getCtx(), "InfoPAttribute"));
m_InfoPAttributeButton.addActionListener(this); m_InfoPAttributeButton.addActionListener(this);
labelVendor.setText(Msg.translate(Env.getCtx(), "Vendor")); labelVendor.setText(Msg.translate(Env.getCtx(), "Vendor"));
fieldVendor.setBackground(AdempierePLAF.getInfoBackground()); fieldVendor.setBackground(AdempierePLAF.getInfoBackground());
fieldVendor.addActionListener(this); fieldVendor.addActionListener(this);
@ -244,7 +262,7 @@ public class InfoProduct extends Info implements ActionListener, ChangeListener
parameterPanel.add(fieldSKU, null); parameterPanel.add(fieldSKU, null);
parameterPanel.add(labelVendor, null); parameterPanel.add(labelVendor, null);
parameterPanel.add(fieldVendor, null); parameterPanel.add(fieldVendor, null);
// Line 3 // Line 3
parameterPanel.add(labelPriceList, new ALayoutConstraint(2,0)); parameterPanel.add(labelPriceList, new ALayoutConstraint(2,0));
parameterPanel.add(pickPriceList, null); parameterPanel.add(pickPriceList, null);
@ -252,13 +270,13 @@ public class InfoProduct extends Info implements ActionListener, ChangeListener
parameterPanel.add(pickProductCategory, null); parameterPanel.add(pickProductCategory, null);
parameterPanel.add(labelAS, null); // @Trifon parameterPanel.add(labelAS, null); // @Trifon
parameterPanel.add(pickAS, null); // @Trifon parameterPanel.add(pickAS, null); // @Trifon
// Product Attribute Instance // Product Attribute Instance
m_PAttributeButton = ConfirmPanel.createPAttributeButton(true); m_PAttributeButton = ConfirmPanel.createPAttributeButton(true);
confirmPanel.addButton(m_PAttributeButton); confirmPanel.addButton(m_PAttributeButton);
m_PAttributeButton.addActionListener(this); m_PAttributeButton.addActionListener(this);
m_PAttributeButton.setEnabled(false); m_PAttributeButton.setEnabled(false);
//Begin - fer_luck @ centuryon //Begin - fer_luck @ centuryon
//add taskpane //add taskpane
fieldDescription.setBackground(AdempierePLAF.getInfoBackground()); fieldDescription.setBackground(AdempierePLAF.getInfoBackground());
@ -269,7 +287,7 @@ public class InfoProduct extends Info implements ActionListener, ChangeListener
warehouseStockPanel.setUI(new AdempiereTaskPaneUI()); warehouseStockPanel.setUI(new AdempiereTaskPaneUI());
warehouseStockPanel.getContentPane().setBackground(new ColorUIResource(251,248,241)); warehouseStockPanel.getContentPane().setBackground(new ColorUIResource(251,248,241));
warehouseStockPanel.getContentPane().setForeground(new ColorUIResource(251,0,0)); warehouseStockPanel.getContentPane().setForeground(new ColorUIResource(251,0,0));
ColumnInfo[] s_layoutWarehouse = new ColumnInfo[]{ ColumnInfo[] s_layoutWarehouse = new ColumnInfo[]{
new ColumnInfo(Msg.translate(Env.getCtx(), "Warehouse"), "Warehouse", String.class), new ColumnInfo(Msg.translate(Env.getCtx(), "Warehouse"), "Warehouse", String.class),
new ColumnInfo(Msg.translate(Env.getCtx(), "QtyAvailable"), "sum(QtyAvailable)", Double.class), new ColumnInfo(Msg.translate(Env.getCtx(), "QtyAvailable"), "sum(QtyAvailable)", Double.class),
@ -287,13 +305,13 @@ public class InfoProduct extends Info implements ActionListener, ChangeListener
warehouseTbl.getSelectionModel().addListSelectionListener(this); warehouseTbl.getSelectionModel().addListSelectionListener(this);
warehouseTbl.setShowTotals(true); warehouseTbl.setShowTotals(true);
warehouseTbl.autoSize(); warehouseTbl.autoSize();
ColumnInfo[] s_layoutSubstitute = new ColumnInfo[]{ ColumnInfo[] s_layoutSubstitute = new ColumnInfo[]{
new ColumnInfo(Msg.translate(Env.getCtx(), "Warehouse"), "orgname", String.class), new ColumnInfo(Msg.translate(Env.getCtx(), "Warehouse"), "orgname", String.class),
new ColumnInfo( new ColumnInfo(
Msg.translate(Env.getCtx(), "Value"), Msg.translate(Env.getCtx(), "Value"),
"(Select Value from M_Product p where p.M_Product_ID=M_PRODUCT_SUBSTITUTERELATED_V.Substitute_ID)", "(Select Value from M_Product p where p.M_Product_ID=M_PRODUCT_SUBSTITUTERELATED_V.Substitute_ID)",
String.class), String.class),
new ColumnInfo(Msg.translate(Env.getCtx(), "Name"), "Name", String.class), new ColumnInfo(Msg.translate(Env.getCtx(), "Name"), "Name", String.class),
new ColumnInfo(Msg.translate(Env.getCtx(), "QtyAvailable"), "QtyAvailable", Double.class), new ColumnInfo(Msg.translate(Env.getCtx(), "QtyAvailable"), "QtyAvailable", Double.class),
new ColumnInfo(Msg.translate(Env.getCtx(), "QtyOnHand"), "QtyOnHand", Double.class), new ColumnInfo(Msg.translate(Env.getCtx(), "QtyOnHand"), "QtyOnHand", Double.class),
@ -307,7 +325,7 @@ public class InfoProduct extends Info implements ActionListener, ChangeListener
substituteTbl.addMouseListener(this); substituteTbl.addMouseListener(this);
substituteTbl.getSelectionModel().addListSelectionListener(this); substituteTbl.getSelectionModel().addListSelectionListener(this);
substituteTbl.autoSize(); substituteTbl.autoSize();
ColumnInfo[] s_layoutRelated = new ColumnInfo[]{ ColumnInfo[] s_layoutRelated = new ColumnInfo[]{
new ColumnInfo(Msg.translate(Env.getCtx(), "Warehouse"), "orgname", String.class), new ColumnInfo(Msg.translate(Env.getCtx(), "Warehouse"), "orgname", String.class),
new ColumnInfo( new ColumnInfo(
@ -327,11 +345,11 @@ public class InfoProduct extends Info implements ActionListener, ChangeListener
relatedTbl.addMouseListener(this); relatedTbl.addMouseListener(this);
relatedTbl.getSelectionModel().addListSelectionListener(this); relatedTbl.getSelectionModel().addListSelectionListener(this);
relatedTbl.autoSize(); relatedTbl.autoSize();
//Available to Promise Tab //Available to Promise Tab
m_tableAtp.setRowSelectionAllowed(false); m_tableAtp.setRowSelectionAllowed(false);
m_tableAtp.setMultiSelection(false); m_tableAtp.setMultiSelection(false);
CTabbedPane jTab = new CTabbedPane(); CTabbedPane jTab = new CTabbedPane();
jTab.addTab(Msg.translate(Env.getCtx(), "Warehouse"), new JScrollPane(warehouseTbl)); jTab.addTab(Msg.translate(Env.getCtx(), "Warehouse"), new JScrollPane(warehouseTbl));
jTab.setPreferredSize(new Dimension(INFO_WIDTH, SCREEN_HEIGHT > 600 ? 250 : 105)); jTab.setPreferredSize(new Dimension(INFO_WIDTH, SCREEN_HEIGHT > 600 ? 250 : 105));
@ -341,12 +359,12 @@ public class InfoProduct extends Info implements ActionListener, ChangeListener
jTab.addTab (Msg.getMsg(Env.getCtx(), "ATP"), new JScrollPane(m_tableAtp)); jTab.addTab (Msg.getMsg(Env.getCtx(), "ATP"), new JScrollPane(m_tableAtp));
jTab.addChangeListener(this); jTab.addChangeListener(this);
tablePanel.setPreferredSize(new Dimension(INFO_WIDTH, SCREEN_HEIGHT > 600 ? 255 : 110)); tablePanel.setPreferredSize(new Dimension(INFO_WIDTH, SCREEN_HEIGHT > 600 ? 255 : 110));
tablePanel.add(jTab); tablePanel.add(jTab);
warehouseStockPanel.setCollapsed(true); warehouseStockPanel.setCollapsed(true);
warehouseStockPanel.add(tablePanel); warehouseStockPanel.add(tablePanel);
this.addonPanel.add(warehouseStockPanel); this.addonPanel.add(warehouseStockPanel);
this.p_table.addKeyListener(new KeyAdapter() { this.p_table.addKeyListener(new KeyAdapter() {
public void keyReleased(KeyEvent ke){ public void keyReleased(KeyEvent ke){
int row = ((MiniTable)ke.getSource()).getSelectedRow(); int row = ((MiniTable)ke.getSource()).getSelectedRow();
@ -358,7 +376,7 @@ public class InfoProduct extends Info implements ActionListener, ChangeListener
warehouseStockPanel.setCollapsed(false); warehouseStockPanel.setCollapsed(false);
} }
}); });
this.p_table.addMouseListener(new MouseAdapter() { this.p_table.addMouseListener(new MouseAdapter() {
public void mouseClicked(MouseEvent me) { public void mouseClicked(MouseEvent me) {
int row = ((MiniTable)me.getSource()).getSelectedRow(); int row = ((MiniTable)me.getSource()).getSelectedRow();
@ -407,7 +425,7 @@ public class InfoProduct extends Info implements ActionListener, ChangeListener
DB.close(rs, pstmt); DB.close(rs, pstmt);
rs = null; pstmt = null; rs = null; pstmt = null;
} }
try { try {
sql = "SELECT M_Product_ID FROM M_Product WHERE Value = ?"; sql = "SELECT M_Product_ID FROM M_Product WHERE Value = ?";
pstmt = DB.prepareStatement(sql, null); pstmt = DB.prepareStatement(sql, null);
@ -423,7 +441,7 @@ public class InfoProduct extends Info implements ActionListener, ChangeListener
DB.close(rs, pstmt); DB.close(rs, pstmt);
rs = null; pstmt = null; rs = null; pstmt = null;
} }
sql = m_sqlSubstitute; sql = m_sqlSubstitute;
log.finest(sql); log.finest(sql);
try { try {
@ -441,7 +459,7 @@ public class InfoProduct extends Info implements ActionListener, ChangeListener
DB.close(rs, pstmt); DB.close(rs, pstmt);
rs = null; pstmt = null; rs = null; pstmt = null;
} }
sql = m_sqlRelated; sql = m_sqlRelated;
log.finest(sql); log.finest(sql);
try { try {
@ -462,7 +480,7 @@ public class InfoProduct extends Info implements ActionListener, ChangeListener
initAtpTab(M_Warehouse_ID); initAtpTab(M_Warehouse_ID);
} // refresh } // refresh
//End - fer_luck @ centuryon //End - fer_luck @ centuryon
/** /**
* Dynamic Init * Dynamic Init
* *
@ -530,7 +548,7 @@ public class InfoProduct extends Info implements ActionListener, ChangeListener
SQL += " AND EXISTS (SELECT * FROM M_PriceList xp WHERE xp.M_PriceList_ID=" + M_PriceList_ID SQL += " AND EXISTS (SELECT * FROM M_PriceList xp WHERE xp.M_PriceList_ID=" + M_PriceList_ID
+ " AND pl.C_Currency_ID=xp.C_Currency_ID)"; + " AND pl.C_Currency_ID=xp.C_Currency_ID)";
// Add Access & Order // Add Access & Order
SQL = MRole.getDefault().addAccessSQL (SQL, "M_PriceList_Version", true, false) // fully qualidfied - RO SQL = MRole.getDefault().addAccessSQL (SQL, "M_PriceList_Version", true, false) // fully qualidfied - RO
+ " ORDER BY M_PriceList_Version.Name"; + " ORDER BY M_PriceList_Version.Name";
PreparedStatement pstmt = null; PreparedStatement pstmt = null;
ResultSet rs = null; ResultSet rs = null;
@ -563,7 +581,7 @@ public class InfoProduct extends Info implements ActionListener, ChangeListener
pickWarehouse.addItem(kn); pickWarehouse.addItem(kn);
} }
DB.close(rs, pstmt); DB.close(rs, pstmt);
// Product Category // Product Category
SQL = MRole.getDefault().addAccessSQL ( SQL = MRole.getDefault().addAccessSQL (
"SELECT M_Product_Category_ID, Value || ' - ' || Name FROM M_Product_Category WHERE IsActive='Y'", "SELECT M_Product_Category_ID, Value || ' - ' || Name FROM M_Product_Category WHERE IsActive='Y'",
@ -572,7 +590,7 @@ public class InfoProduct extends Info implements ActionListener, ChangeListener
for (KeyNamePair kn : DB.getKeyNamePairs(SQL, true)) { for (KeyNamePair kn : DB.getKeyNamePairs(SQL, true)) {
pickProductCategory.addItem(kn); pickProductCategory.addItem(kn);
} }
// Attribute Set - @Trifon // Attribute Set - @Trifon
SQL = MRole.getDefault().addAccessSQL ( SQL = MRole.getDefault().addAccessSQL (
"SELECT M_AttributeSet_ID, Name FROM M_AttributeSet WHERE IsActive='Y'", "SELECT M_AttributeSet_ID, Name FROM M_AttributeSet WHERE IsActive='Y'",
@ -642,7 +660,7 @@ public class InfoProduct extends Info implements ActionListener, ChangeListener
{ {
Timestamp priceDate = null; Timestamp priceDate = null;
// Sales Order Date // Sales Order Date
String dateStr = Env.getContext(Env.getCtx(), p_WindowNo, "DateOrdered"); String dateStr = Env.getContext(Env.getCtx(), p_WindowNo, "DateOrdered");
if (dateStr != null && dateStr.length() > 0) if (dateStr != null && dateStr.length() > 0)
priceDate = Env.getContextAsDate(Env.getCtx(), p_WindowNo, "DateOrdered"); priceDate = Env.getContextAsDate(Env.getCtx(), p_WindowNo, "DateOrdered");
else // Invoice Date else // Invoice Date
@ -652,7 +670,7 @@ public class InfoProduct extends Info implements ActionListener, ChangeListener
priceDate = Env.getContextAsDate(Env.getCtx(), p_WindowNo, "DateInvoiced"); priceDate = Env.getContextAsDate(Env.getCtx(), p_WindowNo, "DateInvoiced");
} }
// Today // Today
if (priceDate == null) if (priceDate == null)
priceDate = new Timestamp(System.currentTimeMillis()); priceDate = new Timestamp(System.currentTimeMillis());
// //
log.config("M_PriceList_ID=" + M_PriceList_ID + " - " + priceDate); log.config("M_PriceList_ID=" + M_PriceList_ID + " - " + priceDate);
@ -690,7 +708,7 @@ public class InfoProduct extends Info implements ActionListener, ChangeListener
return retValue; return retValue;
} // findPLV } // findPLV
/************************************************************************** /**************************************************************************
* Construct SQL Where Clause and define parameters * Construct SQL Where Clause and define parameters
* (setParameters needs to set parameters) * (setParameters needs to set parameters)
@ -700,7 +718,7 @@ public class InfoProduct extends Info implements ActionListener, ChangeListener
protected String getSQLWhere() protected String getSQLWhere()
{ {
StringBuffer where = new StringBuffer(); StringBuffer where = new StringBuffer();
// Optional PLV // Optional PLV
int M_PriceList_Version_ID = 0; int M_PriceList_Version_ID = 0;
KeyNamePair pl = (KeyNamePair)pickPriceList.getSelectedItem(); KeyNamePair pl = (KeyNamePair)pickPriceList.getSelectedItem();
@ -708,17 +726,17 @@ public class InfoProduct extends Info implements ActionListener, ChangeListener
M_PriceList_Version_ID = pl.getKey(); M_PriceList_Version_ID = pl.getKey();
if (M_PriceList_Version_ID != 0) if (M_PriceList_Version_ID != 0)
where.append(" AND pr.M_PriceList_Version_ID=?"); where.append(" AND pr.M_PriceList_Version_ID=?");
// Optional Product Category // Optional Product Category
if (getM_Product_Category_ID() > 0) { if (getM_Product_Category_ID() > 0) {
where.append(" AND p.M_Product_Category_ID=?"); where.append(" AND p.M_Product_Category_ID=?");
} }
// Optional Attribute Set // Optional Attribute Set
if (getM_AttributeSet_ID() > 0) { if (getM_AttributeSet_ID() > 0) {
where.append(" AND p.M_AttributeSet_ID=?"); where.append(" AND p.M_AttributeSet_ID=?");
} }
// Product Attribute Search // Product Attribute Search
if (m_pAttributeWhere != null) if (m_pAttributeWhere != null)
{ {
@ -749,7 +767,7 @@ public class InfoProduct extends Info implements ActionListener, ChangeListener
String vendor = fieldVendor.getText().toUpperCase(); String vendor = fieldVendor.getText().toUpperCase();
if (!(vendor.equals("") || vendor.equals("%"))) if (!(vendor.equals("") || vendor.equals("%")))
where.append(" AND UPPER(bp.Name) LIKE ? AND ppo.IsCurrentVendor='Y'"); where.append(" AND UPPER(bp.Name) LIKE ? AND ppo.IsCurrentVendor='Y'");
return where.toString(); return where.toString();
} // getSQLWhere } // getSQLWhere
@ -858,7 +876,7 @@ public class InfoProduct extends Info implements ActionListener, ChangeListener
} // setParameters } // setParameters
/************************************************************************** /**************************************************************************
* Action Listener * Action Listener
* @param e event * @param e event
@ -869,15 +887,15 @@ public class InfoProduct extends Info implements ActionListener, ChangeListener
if ((e.getSource() == pickWarehouse || e.getSource() == pickPriceList) if ((e.getSource() == pickWarehouse || e.getSource() == pickPriceList)
&& (fieldValue.getText().length() == 0 && fieldName.getText().length() == 0)) && (fieldValue.getText().length() == 0 && fieldName.getText().length() == 0))
return; return;
// Product Attribute Search // Product Attribute Search
if (e.getSource().equals(m_InfoPAttributeButton)) if (e.getSource().equals(m_InfoPAttributeButton))
{ {
cmd_InfoPAttribute(); cmd_InfoPAttribute();
return; return;
} }
m_pAttributeWhere = null; m_pAttributeWhere = null;
// Query Product Attribute Instance // Query Product Attribute Instance
int row = p_table.getSelectedRow(); int row = p_table.getSelectedRow();
if (e.getSource().equals(m_PAttributeButton) && row != -1) if (e.getSource().equals(m_PAttributeButton) && row != -1)
@ -888,13 +906,13 @@ public class InfoProduct extends Info implements ActionListener, ChangeListener
if (productInteger == null || productInteger.intValue() == 0 || warehouse == null) if (productInteger == null || productInteger.intValue() == 0 || warehouse == null)
return; return;
String title = warehouse.getName() + " - " + productName; String title = warehouse.getName() + " - " + productName;
PAttributeInstance pai = new PAttributeInstance (this, title, PAttributeInstance pai = new PAttributeInstance (this, title,
warehouse.getKey(), 0, productInteger.intValue(), m_C_BPartner_ID); warehouse.getKey(), 0, productInteger.intValue(), m_C_BPartner_ID);
m_M_AttributeSetInstance_ID = pai.getM_AttributeSetInstance_ID(); m_M_AttributeSetInstance_ID = pai.getM_AttributeSetInstance_ID();
m_M_Locator_ID = pai.getM_Locator_ID(); m_M_Locator_ID = pai.getM_Locator_ID();
if (m_M_AttributeSetInstance_ID != -1) if (m_M_AttributeSetInstance_ID != -1)
dispose(true); dispose(true);
return; return;
} }
// //
super.actionPerformed(e); super.actionPerformed(e);
@ -952,7 +970,7 @@ public class InfoProduct extends Info implements ActionListener, ChangeListener
if (m_M_AttributeSetInstance_ID < -1) // not selected if (m_M_AttributeSetInstance_ID < -1) // not selected
M_AttributeSetInstance_ID = 0; M_AttributeSetInstance_ID = 0;
// //
InvoiceHistory ih = new InvoiceHistory (this, 0, InvoiceHistory ih = new InvoiceHistory (this, 0,
M_Product_ID.intValue(), M_Warehouse_ID, M_AttributeSetInstance_ID); M_Product_ID.intValue(), M_Warehouse_ID, M_AttributeSetInstance_ID);
ih.setVisible(true); ih.setVisible(true);
ih = null; ih = null;
@ -978,7 +996,7 @@ public class InfoProduct extends Info implements ActionListener, ChangeListener
if (M_Product_ID == null) if (M_Product_ID == null)
return; return;
// AEnv.zoom(MProduct.Table_ID, M_Product_ID.intValue(), true); // SO // AEnv.zoom(MProduct.Table_ID, M_Product_ID.intValue(), true); // SO
MQuery query = new MQuery("M_Product"); MQuery query = new MQuery("M_Product");
query.addRestriction("M_Product_ID", MQuery.EQUAL, M_Product_ID); query.addRestriction("M_Product_ID", MQuery.EQUAL, M_Product_ID);
query.setRecordCount(1); query.setRecordCount(1);
@ -1032,9 +1050,9 @@ public class InfoProduct extends Info implements ActionListener, ChangeListener
} }
else else
{ {
Env.setContext(Env.getCtx(), p_WindowNo, Env.TAB_INFO, "M_AttributeSetInstance_ID", Env.setContext(Env.getCtx(), p_WindowNo, Env.TAB_INFO, "M_AttributeSetInstance_ID",
String.valueOf(m_M_AttributeSetInstance_ID)); String.valueOf(m_M_AttributeSetInstance_ID));
Env.setContext(Env.getCtx(), p_WindowNo, Env.TAB_INFO, "M_Locator_ID", Env.setContext(Env.getCtx(), p_WindowNo, Env.TAB_INFO, "M_Locator_ID",
String.valueOf(m_M_Locator_ID)); String.valueOf(m_M_Locator_ID));
} }
} // saveSelectionDetail } // saveSelectionDetail
@ -1078,51 +1096,51 @@ public class InfoProduct extends Info implements ActionListener, ChangeListener
} }
return s_productLayout; return s_productLayout;
} // getProductLayout } // getProductLayout
/** /**
* System has Unconfirmed records * System has Unconfirmed records
* @return true if unconfirmed * @return true if unconfirmed
*/ */
private boolean isUnconfirmed() private boolean isUnconfirmed()
{ {
int no = DB.getSQLValue(null, int no = DB.getSQLValue(null,
"SELECT COUNT(*) FROM M_InOutLineConfirm WHERE AD_Client_ID=?", "SELECT COUNT(*) FROM M_InOutLineConfirm WHERE AD_Client_ID=?",
Env.getAD_Client_ID(Env.getCtx())); Env.getAD_Client_ID(Env.getCtx()));
if (no > 0) if (no > 0)
return true; return true;
no = DB.getSQLValue(null, no = DB.getSQLValue(null,
"SELECT COUNT(*) FROM M_MovementLineConfirm WHERE AD_Client_ID=?", "SELECT COUNT(*) FROM M_MovementLineConfirm WHERE AD_Client_ID=?",
Env.getAD_Client_ID(Env.getCtx())); Env.getAD_Client_ID(Env.getCtx()));
return no > 0; return no > 0;
} // isUnconfirmed } // isUnconfirmed
/** /**
* Tab Changed * Tab Changed
* @param e event * @param e event
*/ */
public void stateChanged(ChangeEvent e) public void stateChanged(ChangeEvent e)
{ {
if(e.getSource() instanceof CTabbedPane) if(e.getSource() instanceof CTabbedPane)
{ {
CTabbedPane tab = (CTabbedPane) e.getSource(); CTabbedPane tab = (CTabbedPane) e.getSource();
if(tab.getSelectedIndex() == 4 & warehouseTbl.getRowCount() > 0) if(tab.getSelectedIndex() == 4 & warehouseTbl.getRowCount() > 0)
{ {
String value = (String)warehouseTbl.getValueAt(warehouseTbl.getSelectedRow(),0); String value = (String)warehouseTbl.getValueAt(warehouseTbl.getSelectedRow(),0);
int M_Warehouse_ID = DB.getSQLValue(null, "SELECT M_Warehouse_ID FROM M_Warehouse WHERE UPPER(Name) = UPPER(?) AND AD_Client_ID=?", new Object[] { value ,Env.getAD_Client_ID(Env.getCtx())}); int M_Warehouse_ID = DB.getSQLValue(null, "SELECT M_Warehouse_ID FROM M_Warehouse WHERE UPPER(Name) = UPPER(?) AND AD_Client_ID=?", new Object[] { value ,Env.getAD_Client_ID(Env.getCtx())});
initAtpTab(M_Warehouse_ID); initAtpTab(M_Warehouse_ID);
} }
} }
} // stateChanged } // stateChanged
/** /**
* Query ATP * Query ATP
*/ */
private void initAtpTab (int m_M_Warehouse_ID) private void initAtpTab (int m_M_Warehouse_ID)
{ {
// Header // Header
Vector<String> columnNames = new Vector<String>(); Vector<String> columnNames = new Vector<String>();
columnNames.add(Msg.translate(Env.getCtx(), "Date")); columnNames.add(Msg.translate(Env.getCtx(), "Date"));
@ -1155,7 +1173,7 @@ public class InfoProduct extends Info implements ActionListener, ChangeListener
if (!showDetail) if (!showDetail)
sql += " GROUP BY productAttribute(s.M_AttributeSetInstance_ID), w.Name, l.Value"; sql += " GROUP BY productAttribute(s.M_AttributeSetInstance_ID), w.Name, l.Value";
sql += " ORDER BY l.Value"; sql += " ORDER BY l.Value";
Vector<Vector<Object>> data = new Vector<Vector<Object>>(); Vector<Vector<Object>> data = new Vector<Vector<Object>>();
double qty = 0; double qty = 0;
PreparedStatement pstmt = null; PreparedStatement pstmt = null;
@ -1267,7 +1285,7 @@ public class InfoProduct extends Info implements ActionListener, ChangeListener
// Table // Table
MiniTable table = null; MiniTable table = null;
m_modelAtp = new DefaultTableModel(data, columnNames); m_modelAtp = new DefaultTableModel(data, columnNames);
m_tableAtp.setModel(m_modelAtp); m_tableAtp.setModel(m_modelAtp);
table = m_tableAtp; table = m_tableAtp;
// //
@ -1294,7 +1312,7 @@ public class InfoProduct extends Info implements ActionListener, ChangeListener
M_Product_Category_ID = pc.getKey(); M_Product_Category_ID = pc.getKey();
return M_Product_Category_ID; return M_Product_Category_ID;
} }
/** /**
* @return selected Attribute Set ID * @return selected Attribute Set ID
*/ */
@ -1305,4 +1323,11 @@ public class InfoProduct extends Info implements ActionListener, ChangeListener
M_AttributeSet_ID = as.getKey(); M_AttributeSet_ID = as.getKey();
return M_AttributeSet_ID; return M_AttributeSet_ID;
} }
@Override
public boolean isResetValue() {
return true;
}
} // InfoProduct } // InfoProduct

View File

@ -46,22 +46,16 @@ import javax.swing.KeyStroke;
import javax.swing.LookAndFeel; import javax.swing.LookAndFeel;
import javax.swing.SwingUtilities; import javax.swing.SwingUtilities;
import org.adempiere.osgi.InfoManager;
import org.compiere.apps.ADialog; import org.compiere.apps.ADialog;
import org.compiere.apps.AEnv; import org.compiere.apps.AEnv;
import org.compiere.apps.AWindow; import org.compiere.apps.AWindow;
import org.compiere.apps.FieldRecordInfo; import org.compiere.apps.FieldRecordInfo;
import org.compiere.apps.search.Info; 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.GridField;
import org.compiere.model.Lookup; import org.compiere.model.Lookup;
import org.compiere.model.MColumn;
import org.compiere.model.MInvoiceLine;
import org.compiere.model.MLookup; import org.compiere.model.MLookup;
import org.compiere.model.MLookupFactory; import org.compiere.model.MLookupFactory;
import org.compiere.model.MOrderLine;
import org.compiere.model.MProductPrice;
import org.compiere.model.MQuery; import org.compiere.model.MQuery;
import org.compiere.model.MRole; import org.compiere.model.MRole;
import org.compiere.swing.CButton; import org.compiere.swing.CButton;
@ -75,7 +69,6 @@ import org.compiere.util.Ini;
import org.compiere.util.Msg; import org.compiere.util.Msg;
import org.compiere.util.NamePair; import org.compiere.util.NamePair;
import org.compiere.util.ValueNamePair; import org.compiere.util.ValueNamePair;
import org.eevolution.model.I_PP_Product_BOMLine;
/** /**
* Lookup Visual Field. * Lookup Visual Field.
@ -96,7 +89,7 @@ import org.eevolution.model.I_PP_Product_BOMLine;
* <li>BF [ 1979213 ] VLookup.getDirectAccessSQL issue * <li>BF [ 1979213 ] VLookup.getDirectAccessSQL issue
* <li>BF [ 2552901 ] VLookup: TAB is not working OK * <li>BF [ 2552901 ] VLookup: TAB is not working OK
* @author Michael Judd (MultiSelect) * @author Michael Judd (MultiSelect)
* *
* @author hengsin, hengsin.low@idalica.com * @author hengsin, hengsin.low@idalica.com
* @see FR [2887701] https://sourceforge.net/tracker/?func=detail&atid=879335&aid=2887701&group_id=176962 * @see FR [2887701] https://sourceforge.net/tracker/?func=detail&atid=879335&aid=2887701&group_id=176962
* @sponsor www.metas.de * @sponsor www.metas.de
@ -141,8 +134,8 @@ public class VLookup extends JComponent
} // mouse Clicked } // mouse Clicked
} // VLookup_mouseAdapter } // VLookup_mouseAdapter
@Override @Override
protected boolean processKeyBinding(KeyStroke ks, KeyEvent e, protected boolean processKeyBinding(KeyStroke ks, KeyEvent e,
int condition, boolean pressed) { int condition, boolean pressed) {
@ -680,7 +673,7 @@ public class VLookup extends JComponent
if (m_mField != null if (m_mField != null
&& MRole.getDefault().isShowPreference()) && MRole.getDefault().isShowPreference())
ValuePreference.addMenu (this, popupMenu); ValuePreference.addMenu (this, popupMenu);
if (m_mField != null) if (m_mField != null)
FieldRecordInfo.addMenu(this, popupMenu); FieldRecordInfo.addMenu(this, popupMenu);
} // setField } // setField
@ -799,7 +792,7 @@ public class VLookup extends JComponent
{ {
// happens if VLookup is used outside of APanel/GridController (no property listener) // happens if VLookup is used outside of APanel/GridController (no property listener)
log.fine(m_columnName + " - Value explicitly set - new=" + updatedValue + ", old=" + m_value); log.fine(m_columnName + " - Value explicitly set - new=" + updatedValue + ", old=" + m_value);
// phib: the following check causes the update to fail on jre > 1.6.0_13 // phib: the following check causes the update to fail on jre > 1.6.0_13
// commenting out as it does not appear to be necessary // commenting out as it does not appear to be necessary
//if (getListeners(PropertyChangeListener.class).length <= 0) //if (getListeners(PropertyChangeListener.class).length <= 0)
@ -832,82 +825,30 @@ public class VLookup extends JComponent
boolean cancelled = false; boolean cancelled = false;
boolean multipleSelection = false; boolean multipleSelection = false;
// //
String col = m_lookup.getColumnName(); // fully qualified name
if (col.indexOf('.') != -1)
col = col.substring(col.indexOf('.')+1);
// Zoom / Validation // Zoom / Validation
String whereClause = getWhereClause(); String whereClause = getWhereClause();
// //
log.fine(col log.fine(m_lookup.getColumnName()
+ ", Zoom=" + m_lookup.getZoom() + ", Zoom=" + m_lookup.getZoom()
+ " (" + whereClause + ")"); + " (" + whereClause + ")");
// //
boolean resetValue = false; // reset value so that is always treated as new entry Info info = null;
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"))
{
// 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_mField != null) // Reset
{ resetTabInfo();
int AD_Table_ID = MColumn.getTable_ID(Env.getCtx(), m_mField.getAD_Column_ID(), null); if (m_tableName == null) // sets table name & key column
getDirectAccessSQL("*");
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); // Replace Value with name if no value exists
} if (queryValue.length() == 0 && m_text.getText().length() > 0)
// Show Info queryValue = m_text.getText();
InfoProduct ip = new InfoProduct (frame, true, m_lookup.getWindowNo(),
M_Warehouse_ID, M_PriceList_ID, queryValue, multipleSelection, whereClause); info = InfoManager.create(frame, true, m_lookup, m_mField, m_tableName, m_keyColumnName,
ip.setVisible(true); queryValue, multipleSelection, whereClause);
cancelled = ip.isCancelled();
result = ip.getSelectedKeys(); info.setVisible(true);
resetValue = true; cancelled = info.isCancelled();
} result = info.getSelectedKeys();
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();
}
// Result // Result
if (result != null && result.length > 0) 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() + ")"); log.config(m_columnName + " - Result = " + result.toString() + " (" + result.getClass().getName() + ")");
// make sure that value is in cache // make sure that value is in cache
m_lookup.getDirect(result[0], false, true); m_lookup.getDirect(result[0], false, true);
if (resetValue) if (info.isResetValue())
actionCombo (null); actionCombo (null);
// juddm added logic for multi-select handling // juddm added logic for multi-select handling
if (result.length > 1) if (result.length > 1)

View File

@ -30,10 +30,9 @@ import org.adempiere.webui.event.ContextMenuEvent;
import org.adempiere.webui.event.ContextMenuListener; import org.adempiere.webui.event.ContextMenuListener;
import org.adempiere.webui.event.ValueChangeEvent; import org.adempiere.webui.event.ValueChangeEvent;
import org.adempiere.webui.event.ValueChangeListener; import org.adempiere.webui.event.ValueChangeListener;
import org.adempiere.webui.factory.InfoManager;
import org.adempiere.webui.grid.WBPartner; import org.adempiere.webui.grid.WBPartner;
import org.adempiere.webui.panel.InfoBPartnerPanel;
import org.adempiere.webui.panel.InfoPanel; import org.adempiere.webui.panel.InfoPanel;
import org.adempiere.webui.panel.InfoProductPanel;
import org.adempiere.webui.window.WFieldRecordInfo; import org.adempiere.webui.window.WFieldRecordInfo;
import org.compiere.model.GridField; import org.compiere.model.GridField;
import org.compiere.model.Lookup; import org.compiere.model.Lookup;
@ -73,19 +72,19 @@ public class WSearchEditor extends WEditor implements ContextMenuListener, Value
super(new Searchbox(), gridField); super(new Searchbox(), gridField);
lookup = gridField.getLookup(); lookup = gridField.getLookup();
if (lookup != null) if (lookup != null)
columnName = lookup.getColumnName(); columnName = lookup.getColumnName();
init(); init();
} }
@Override @Override
public Searchbox getComponent() { public Searchbox getComponent() {
return (Searchbox) super.getComponent(); return (Searchbox) super.getComponent();
} }
@Override @Override
public boolean isReadWrite() { public boolean isReadWrite() {
return getComponent().isEnabled(); return getComponent().isEnabled();
@ -124,7 +123,7 @@ public class WSearchEditor extends WEditor implements ContextMenuListener, Value
} }
public WSearchEditor(String columnName, boolean mandatory, boolean readonly, boolean updateable, public WSearchEditor(String columnName, boolean mandatory, boolean readonly, boolean updateable,
Lookup lookup) Lookup lookup)
{ {
super(new Searchbox(), null, null, mandatory, readonly, updateable); super(new Searchbox(), null, null, mandatory, readonly, updateable);
@ -148,7 +147,7 @@ public class WSearchEditor extends WEditor implements ContextMenuListener, Value
{ {
columnName = this.getColumnName(); columnName = this.getColumnName();
if (columnName.equals("C_BPartner_ID")) if (columnName.equals("C_BPartner_ID"))
{ {
popupMenu = new WEditorPopupMenu(true, true, true, true, true); popupMenu = new WEditorPopupMenu(true, true, true, true, true);
@ -164,7 +163,7 @@ public class WSearchEditor extends WEditor implements ContextMenuListener, Value
popupMenu = new WEditorPopupMenu(true, true, true, false, false); popupMenu = new WEditorPopupMenu(true, true, true, false, false);
getComponent().setButtonImage("/images/PickOpen10.png"); getComponent().setButtonImage("/images/PickOpen10.png");
} }
getComponent().getTextbox().setContext(popupMenu.getId()); getComponent().getTextbox().setContext(popupMenu.getId());
if (gridField != null && gridField.getGridTab() != null) if (gridField != null && gridField.getGridTab() != null)
{ {
@ -234,7 +233,7 @@ public class WSearchEditor extends WEditor implements ContextMenuListener, Value
actionButton(""); actionButton("");
} }
} }
@Override @Override
public void propertyChange(PropertyChangeEvent evt) public void propertyChange(PropertyChangeEvent evt)
{ {
@ -405,14 +404,14 @@ public class WSearchEditor extends WEditor implements ContextMenuListener, Value
ValueChangeEvent evt = new ValueChangeEvent(this, this.getColumnName(), getValue(), value); ValueChangeEvent evt = new ValueChangeEvent(this, this.getColumnName(), getValue(), value);
// -> ADTabpanel - valuechange // -> ADTabpanel - valuechange
fireValueChange(evt); fireValueChange(evt);
// is the value updated ? // is the value updated ?
boolean updated = false; boolean updated = false;
if (value instanceof Object[] && ((Object[])value).length > 0) if (value instanceof Object[] && ((Object[])value).length > 0)
{ {
value = ((Object[])value)[0]; value = ((Object[])value)[0];
} }
if (value == null && getValue() == null) if (value == null && getValue() == null)
updated = true; updated = true;
else if (value != null && value.equals(getValue())) else if (value != null && value.equals(getValue()))
@ -427,12 +426,12 @@ public class WSearchEditor extends WEditor implements ContextMenuListener, Value
* Action - Special BPartner Screen * Action - Special BPartner Screen
* @param newRecord true if new record should be created * @param newRecord true if new record should be created
*/ */
private void actionBPartner (boolean newRecord) private void actionBPartner (boolean newRecord)
{ {
WBPartner vbp = new WBPartner (lookup.getWindowNo()); WBPartner vbp = new WBPartner (lookup.getWindowNo());
int BPartner_ID = 0; int BPartner_ID = 0;
// if update, get current value // if update, get current value
if (!newRecord) if (!newRecord)
{ {
@ -443,31 +442,31 @@ public class WSearchEditor extends WEditor implements ContextMenuListener, Value
} }
vbp.loadBPartner (BPartner_ID); vbp.loadBPartner (BPartner_ID);
vbp.setVisible(true); vbp.setVisible(true);
AEnv.showWindow(vbp); AEnv.showWindow(vbp);
// get result // get result
int result = vbp.getC_BPartner_ID(); int result = vbp.getC_BPartner_ID();
if (result == 0 // 0 = not saved if (result == 0 // 0 = not saved
&& result == BPartner_ID) // the same && result == BPartner_ID) // the same
return; return;
// Maybe new BPartner - put in cache // Maybe new BPartner - put in cache
lookup.getDirect(new Integer(result), false, true); lookup.getDirect(new Integer(result), false, true);
setValue(new Integer(result)); setValue(new Integer(result));
actionCombo (new Integer(result)); // data binding actionCombo (new Integer(result)); // data binding
//setValue(getValue()); //setValue(getValue());
} // actionBPartner } // actionBPartner
private void actionButton(String queryValue) private void actionButton(String queryValue)
{ {
if (lookup == null) if (lookup == null)
return; // leave button disabled return; // leave button disabled
/** /**
* Three return options: * Three return options:
* - Value Selected & OK pressed => store result => result has value * - Value Selected & OK pressed => store result => result has value
@ -475,97 +474,33 @@ public class WSearchEditor extends WEditor implements ContextMenuListener, Value
* - Window closed -> ignore => result == null && !cancalled * - Window closed -> ignore => result == null && !cancalled
*/ */
Object result[] = null; Object result[] = null;
boolean cancelled = false; boolean cancelled = false;
String col = lookup.getColumnName(); // fully qualified name
if (col.indexOf('.') != -1)
col = col.substring(col.indexOf('.')+1);
// Zoom / Validation // Zoom / Validation
String whereClause = getWhereClause(); 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 // boolean resetValue = false; // Reset value so that is always treated as new entry
if (col.equals("M_Product_ID")) // Replace Value with name if no value exists
{ if (queryValue.length() == 0 && getComponent().getText().length() > 0)
// Reset queryValue = getComponent().getText();
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 (m_tableName == null) // sets table name & key column
if (queryValue.length() == 0 && getComponent().getText().length() > 0) getDirectAccessSQL("*");
queryValue = "@" + getComponent().getText() + "@"; // Name indicator - otherwise Value
int M_Warehouse_ID = Env.getContextAsInt(Env.getCtx(), lookup.getWindowNo(), "M_Warehouse_ID"); InfoPanel ip = InfoManager.create(lookup, gridField, m_tableName, m_keyColumnName, queryValue, false, whereClause);
int M_PriceList_ID = Env.getContextAsInt(Env.getCtx(), lookup.getWindowNo(), "M_PriceList_ID"); ip.setVisible(true);
ip.setStyle("border: 2px");
// Show Info ip.setClosable(true);
InfoProductPanel ip = new InfoProductPanel (lookup.getWindowNo(), ip.setAttribute("mode", "modal");
M_Warehouse_ID, M_PriceList_ID, true, queryValue, whereClause); ip.addValueChangeListener(this);
infoPanel = ip;
ip.setVisible(true); AEnv.showWindow(ip);
ip.setTitle("Product Info"); cancelled = ip.isCancelled();
ip.setStyle("border: 2px"); result = ip.getSelectedKeys();
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 = null; infoPanel = null;
// Result // Result
@ -586,7 +521,7 @@ public class WSearchEditor extends WEditor implements ContextMenuListener, Value
{ {
log.config(getColumnName() + " - Result = null (not cancelled)"); log.config(getColumnName() + " - Result = null (not cancelled)");
} }
} }
/** /**
@ -601,7 +536,7 @@ public class WSearchEditor extends WEditor implements ContextMenuListener, Value
private String getDirectAccessSQL (String text) private String getDirectAccessSQL (String text)
{ {
String m_columnName = getColumnName(); String m_columnName = getColumnName();
StringBuffer sql = new StringBuffer(); StringBuffer sql = new StringBuffer();
m_tableName = m_columnName.substring(0, m_columnName.length()-3); m_tableName = m_columnName.substring(0, m_columnName.length()-3);
m_keyColumnName = m_columnName; m_keyColumnName = m_columnName;
@ -653,35 +588,35 @@ public class WSearchEditor extends WEditor implements ContextMenuListener, Value
{ {
sql.append("SELECT AD_User_ID FROM AD_User WHERE UPPER(Name) LIKE ") sql.append("SELECT AD_User_ID FROM AD_User WHERE UPPER(Name) LIKE ")
.append(DB.TO_STRING(text)); .append(DB.TO_STRING(text));
m_tableName = "AD_User"; m_tableName = "AD_User";
m_keyColumnName = "AD_User_ID"; m_keyColumnName = "AD_User_ID";
} }
// Predefined // Predefined
if (sql.length() > 0) if (sql.length() > 0)
{ {
String wc = getWhereClause(); String wc = getWhereClause();
if (wc != null && wc.length() > 0) if (wc != null && wc.length() > 0)
sql.append(" AND ").append(wc); sql.append(" AND ").append(wc);
sql.append(" AND IsActive='Y'"); sql.append(" AND IsActive='Y'");
// *** // ***
log.finest(m_columnName + " (predefined) " + sql.toString()); log.finest(m_columnName + " (predefined) " + sql.toString());
return MRole.getDefault().addAccessSQL(sql.toString(), return MRole.getDefault().addAccessSQL(sql.toString(),
m_tableName, MRole.SQL_NOTQUALIFIED, MRole.SQL_RO); m_tableName, MRole.SQL_NOTQUALIFIED, MRole.SQL_RO);
} }
// Check if it is a Table Reference // Check if it is a Table Reference
if (lookup != null && lookup instanceof MLookup) if (lookup != null && lookup instanceof MLookup)
{ {
int AD_Reference_ID = ((MLookup)lookup).getAD_Reference_Value_ID(); int AD_Reference_ID = ((MLookup)lookup).getAD_Reference_Value_ID();
if (AD_Reference_ID != 0) if (AD_Reference_ID != 0)
{ {
boolean isValueDisplayed = false; boolean isValueDisplayed = false;
@ -691,17 +626,17 @@ public class WSearchEditor extends WEditor implements ContextMenuListener, Value
+ " INNER JOIN AD_Column dc ON (rt.AD_Display=dc.AD_Column_ID)" + " INNER JOIN AD_Column dc ON (rt.AD_Display=dc.AD_Column_ID)"
+ " INNER JOIN AD_Table t ON (rt.AD_Table_ID=t.AD_Table_ID) " + " INNER JOIN AD_Table t ON (rt.AD_Table_ID=t.AD_Table_ID) "
+ "WHERE rt.AD_Reference_ID=?"; + "WHERE rt.AD_Reference_ID=?";
String displayColumnName = null; String displayColumnName = null;
PreparedStatement pstmt = null; PreparedStatement pstmt = null;
ResultSet rs = null; ResultSet rs = null;
try try
{ {
pstmt = DB.prepareStatement(query, null); pstmt = DB.prepareStatement(query, null);
pstmt.setInt(1, AD_Reference_ID); pstmt.setInt(1, AD_Reference_ID);
rs = pstmt.executeQuery(); rs = pstmt.executeQuery();
if (rs.next()) if (rs.next())
{ {
m_keyColumnName = rs.getString(1); m_keyColumnName = rs.getString(1);
@ -719,8 +654,8 @@ public class WSearchEditor extends WEditor implements ContextMenuListener, Value
{ {
DB.close(rs, pstmt); DB.close(rs, pstmt);
} }
if (displayColumnName != null) if (displayColumnName != null)
{ {
sql = new StringBuffer(); sql = new StringBuffer();
@ -735,24 +670,24 @@ public class WSearchEditor extends WEditor implements ContextMenuListener, Value
} }
sql.append(")"); sql.append(")");
sql.append(" AND IsActive='Y'"); sql.append(" AND IsActive='Y'");
String wc = getWhereClause(); String wc = getWhereClause();
if (wc != null && wc.length() > 0) if (wc != null && wc.length() > 0)
sql.append(" AND ").append(wc); sql.append(" AND ").append(wc);
// *** // ***
log.finest(m_columnName + " (Table) " + sql.toString()); log.finest(m_columnName + " (Table) " + sql.toString());
return MRole.getDefault().addAccessSQL(sql.toString(), return MRole.getDefault().addAccessSQL(sql.toString(),
m_tableName, MRole.SQL_NOTQUALIFIED, MRole.SQL_RO); m_tableName, MRole.SQL_NOTQUALIFIED, MRole.SQL_RO);
} }
} // Table Reference } // Table Reference
} // MLookup } // MLookup
/** Check Well Known Columns of Table - assumes TableDir **/ /** Check Well Known Columns of Table - assumes TableDir **/
String query = "SELECT t.TableName, c.ColumnName " String query = "SELECT t.TableName, c.ColumnName "
+ "FROM AD_Column c " + "FROM AD_Column c "
+ " INNER JOIN AD_Table t ON (c.AD_Table_ID=t.AD_Table_ID AND t.IsView='N') " + " INNER JOIN AD_Table t ON (c.AD_Table_ID=t.AD_Table_ID AND t.IsView='N') "
@ -760,26 +695,26 @@ public class WSearchEditor extends WEditor implements ContextMenuListener, Value
+ " AND c.AD_Reference_ID IN (10,14)" + " AND c.AD_Reference_ID IN (10,14)"
+ " AND EXISTS (SELECT * FROM AD_Column cc WHERE cc.AD_Table_ID=t.AD_Table_ID" + " AND EXISTS (SELECT * FROM AD_Column cc WHERE cc.AD_Table_ID=t.AD_Table_ID"
+ " AND cc.IsKey='Y' AND cc.ColumnName=?)"; + " AND cc.IsKey='Y' AND cc.ColumnName=?)";
m_keyColumnName = m_columnName; m_keyColumnName = m_columnName;
sql = new StringBuffer(); sql = new StringBuffer();
PreparedStatement pstmt = null; PreparedStatement pstmt = null;
try try
{ {
pstmt = DB.prepareStatement(query, null); pstmt = DB.prepareStatement(query, null);
pstmt.setString(1, m_keyColumnName); pstmt.setString(1, m_keyColumnName);
ResultSet rs = pstmt.executeQuery(); ResultSet rs = pstmt.executeQuery();
while (rs.next()) while (rs.next())
{ {
if (sql.length() != 0) if (sql.length() != 0)
sql.append(" OR "); sql.append(" OR ");
m_tableName = rs.getString(1); m_tableName = rs.getString(1);
sql.append("UPPER(").append(rs.getString(2)).append(") LIKE ").append(DB.TO_STRING(text)); sql.append("UPPER(").append(rs.getString(2)).append(") LIKE ").append(DB.TO_STRING(text));
} }
rs.close(); rs.close();
pstmt.close(); pstmt.close();
pstmt = null; pstmt = null;
@ -788,7 +723,7 @@ public class WSearchEditor extends WEditor implements ContextMenuListener, Value
{ {
log.log(Level.SEVERE, query, ex); log.log(Level.SEVERE, query, ex);
} }
try try
{ {
if (pstmt != null) if (pstmt != null)
@ -809,9 +744,9 @@ public class WSearchEditor extends WEditor implements ContextMenuListener, Value
.append(m_columnName).append(" FROM ").append(m_tableName) .append(m_columnName).append(" FROM ").append(m_tableName)
.append(" WHERE ").append(sql) .append(" WHERE ").append(sql)
.append(" AND IsActive='Y'"); .append(" AND IsActive='Y'");
String wc = getWhereClause(); String wc = getWhereClause();
if (wc != null && wc.length() > 0) if (wc != null && wc.length() > 0)
retValue.append(" AND ").append(wc); retValue.append(" AND ").append(wc);
// *** // ***
@ -819,7 +754,7 @@ public class WSearchEditor extends WEditor implements ContextMenuListener, Value
return MRole.getDefault().addAccessSQL(retValue.toString(), return MRole.getDefault().addAccessSQL(retValue.toString(),
m_tableName, MRole.SQL_NOTQUALIFIED, MRole.SQL_RO); m_tableName, MRole.SQL_NOTQUALIFIED, MRole.SQL_RO);
} }
private String getWhereClause() private String getWhereClause()
{ {
String whereClause = ""; String whereClause = "";
@ -888,7 +823,7 @@ public class WSearchEditor extends WEditor implements ContextMenuListener, Value
int AD_Column_ID = 3499; // C_Invoice.C_BPartner_ID int AD_Column_ID = 3499; // C_Invoice.C_BPartner_ID
try try
{ {
Lookup lookup = MLookupFactory.get (Env.getCtx(), windowNo, Lookup lookup = MLookupFactory.get (Env.getCtx(), windowNo,
0, AD_Column_ID, DisplayType.Search); 0, AD_Column_ID, DisplayType.Search);
return new WSearchEditor ("C_BPartner_ID", false, false, true, lookup); return new WSearchEditor ("C_BPartner_ID", false, false, true, lookup);
} }
@ -901,13 +836,13 @@ public class WSearchEditor extends WEditor implements ContextMenuListener, Value
/** /**
* @param windowNo * @param windowNo
* @return WSearchEditor * @return WSearchEditor
*/ */
public static WSearchEditor createProduct(int windowNo) { public static WSearchEditor createProduct(int windowNo) {
int AD_Column_ID = 3840; // C_InvoiceLine.M_Product_ID int AD_Column_ID = 3840; // C_InvoiceLine.M_Product_ID
try try
{ {
Lookup lookup = MLookupFactory.get (Env.getCtx(), windowNo, 0, Lookup lookup = MLookupFactory.get (Env.getCtx(), windowNo, 0,
AD_Column_ID, DisplayType.Search); AD_Column_ID, DisplayType.Search);
return new WSearchEditor("M_Product_ID", false, false, true, lookup); return new WSearchEditor("M_Product_ID", false, false, true, lookup);
} }

View File

@ -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;
}
}

View File

@ -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);
}

View File

@ -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;
}
}

View File

@ -57,29 +57,29 @@ import org.zkoss.zul.Vbox;
/** /**
* Based on InfoCashLine written by Jorg Janke * Based on InfoCashLine written by Jorg Janke
* *
* @author Niraj Sohun * @author Niraj Sohun
* Aug 03, 2007 * Aug 03, 2007
* *
* Zk Port * Zk Port
* @author Elaine * @author Elaine
* @version InfoCashLine.java Adempiere Swing UI 3.4.1 * @version InfoCashLine.java Adempiere Swing UI 3.4.1
*/ */
public class InfoCashLinePanel extends InfoPanel implements ValueChangeListener, EventListener public class InfoCashLinePanel extends InfoPanel implements ValueChangeListener, EventListener
{ {
/** /**
* *
*/ */
private static final long serialVersionUID = 3042929765363185887L; private static final long serialVersionUID = 3042929765363185887L;
private Textbox fName = new Textbox(); private Textbox fName = new Textbox();
private Textbox fAmtTo = new Textbox(); private Textbox fAmtTo = new Textbox();
private Textbox fAmtFrom = new Textbox(); private Textbox fAmtFrom = new Textbox();
private WEditor fCashBook_ID; private WEditor fCashBook_ID;
private WEditor fInvoice_ID; private WEditor fInvoice_ID;
private WEditor fBankAccount_ID; private WEditor fBankAccount_ID;
private Datebox fDateFrom = new Datebox(); private Datebox fDateFrom = new Datebox();
private Datebox fDateTo = new Datebox(); private Datebox fDateTo = new Datebox();
@ -88,7 +88,7 @@ public class InfoCashLinePanel extends InfoPanel implements ValueChangeListener,
private Label lName = new Label(Msg.translate(Env.getCtx(), "Name")); private Label lName = new Label(Msg.translate(Env.getCtx(), "Name"));
private Label lDateFrom = new Label(Msg.translate(Env.getCtx(), "StatementDate")); private Label lDateFrom = new Label(Msg.translate(Env.getCtx(), "StatementDate"));
private Label lDateTo = new Label("-"); private Label lDateTo = new Label("-");
private Label lAmtFrom = new Label(Msg.translate(Env.getCtx(), "Amount")); private Label lAmtFrom = new Label(Msg.translate(Env.getCtx(), "Amount"));
private Label lAmtTo = new Label("-"); private Label lAmtTo = new Label("-");
private Borderlayout layout; private Borderlayout layout;
private Vbox southBody; private Vbox southBody;
@ -124,18 +124,18 @@ public class InfoCashLinePanel extends InfoPanel implements ValueChangeListener,
/** /**
* Detail Protected Constructor * Detail Protected Constructor
* *
* @param WindowNo window no * @param WindowNo window no
* @param value query value * @param value query value
* @param multiSelection multiple selections * @param multiSelection multiple selections
* @param whereClause where clause * @param whereClause where clause
*/ */
protected InfoCashLinePanel( int WindowNo, String value, public InfoCashLinePanel( int WindowNo, String value,
boolean multiSelection, String whereClause) boolean multiSelection, String whereClause)
{ {
this(WindowNo, value, multiSelection, whereClause, true); this(WindowNo, value, multiSelection, whereClause, true);
} }
/** /**
* Detail Protected Constructor * Detail Protected Constructor
* *
@ -144,7 +144,7 @@ public class InfoCashLinePanel extends InfoPanel implements ValueChangeListener,
* @param multiSelection multiple selections * @param multiSelection multiple selections
* @param whereClause where clause * @param whereClause where clause
*/ */
protected InfoCashLinePanel( int WindowNo, String value, public InfoCashLinePanel( int WindowNo, String value,
boolean multiSelection, String whereClause, boolean lookup) boolean multiSelection, String whereClause, boolean lookup)
{ {
super (WindowNo, "cl", "C_CashLine_ID", multiSelection, whereClause, lookup); super (WindowNo, "cl", "C_CashLine_ID", multiSelection, whereClause, lookup);
@ -164,19 +164,19 @@ public class InfoCashLinePanel extends InfoPanel implements ValueChangeListener,
int no = contentPanel.getRowCount(); int no = contentPanel.getRowCount();
setStatusLine(Integer.toString(no) + " " + Msg.getMsg(Env.getCtx(), "SearchRows_EnterQuery"), false); setStatusLine(Integer.toString(no) + " " + Msg.getMsg(Env.getCtx(), "SearchRows_EnterQuery"), false);
setStatusDB(Integer.toString(no)); setStatusDB(Integer.toString(no));
if (value != null && value.length() > 0) if (value != null && value.length() > 0)
{ {
fName .setValue(value); fName .setValue(value);
executeQuery(); executeQuery();
} }
} // InfoCashLinePanel } // InfoCashLinePanel
/** /**
* Static Setup - add fields to parameterPanel * Static Setup - add fields to parameterPanel
* @throws Exception if Lookups cannot be created * @throws Exception if Lookups cannot be created
*/ */
private void statInit() throws Exception private void statInit() throws Exception
{ {
fName.setWidth("180px"); fName.setWidth("180px");
@ -184,38 +184,38 @@ public class InfoCashLinePanel extends InfoPanel implements ValueChangeListener,
fDateTo.setWidth("165px"); fDateTo.setWidth("165px");
fAmtFrom.setWidth("180px"); fAmtFrom.setWidth("180px");
fAmtTo.setWidth("180px"); fAmtTo.setWidth("180px");
fName.addEventListener(Events.ON_CHANGE, this); fName.addEventListener(Events.ON_CHANGE, this);
// 5249 - C_Cash.C_CashBook_ID // 5249 - C_Cash.C_CashBook_ID
fCashBook_ID = new WSearchEditor( fCashBook_ID = new WSearchEditor(
MLookupFactory.get (Env.getCtx(), p_WindowNo, 0, 5249, DisplayType.TableDir), MLookupFactory.get (Env.getCtx(), p_WindowNo, 0, 5249, DisplayType.TableDir),
Msg.translate(Env.getCtx(), "C_CashBook_ID"), "", false, false, true); Msg.translate(Env.getCtx(), "C_CashBook_ID"), "", false, false, true);
fCashBook_ID.addValueChangeListener(this); fCashBook_ID.addValueChangeListener(this);
// 5354 - C_CashLine.C_Invoice_ID // 5354 - C_CashLine.C_Invoice_ID
fInvoice_ID = new WSearchEditor( fInvoice_ID = new WSearchEditor(
MLookupFactory.get (Env.getCtx(), p_WindowNo, 0, 5354, DisplayType.Search), MLookupFactory.get (Env.getCtx(), p_WindowNo, 0, 5354, DisplayType.Search),
Msg.translate(Env.getCtx(), "C_Invoice_ID"), "", false, false, true); Msg.translate(Env.getCtx(), "C_Invoice_ID"), "", false, false, true);
fInvoice_ID.addValueChangeListener(this); fInvoice_ID.addValueChangeListener(this);
// 5295 - C_CashLine.C_BankAccount_ID // 5295 - C_CashLine.C_BankAccount_ID
fBankAccount_ID = new WSearchEditor( fBankAccount_ID = new WSearchEditor(
MLookupFactory.get (Env.getCtx(), p_WindowNo, 0, 5295, DisplayType.TableDir), MLookupFactory.get (Env.getCtx(), p_WindowNo, 0, 5295, DisplayType.TableDir),
Msg.translate(Env.getCtx(), "C_BankAccount_ID"), "", false, false, true); Msg.translate(Env.getCtx(), "C_BankAccount_ID"), "", false, false, true);
fBankAccount_ID.addValueChangeListener(this); fBankAccount_ID.addValueChangeListener(this);
// 5296 - C_CashLine.C_Charge_ID // 5296 - C_CashLine.C_Charge_ID
// 5291 - C_CashLine.C_Cash_ID // 5291 - C_CashLine.C_Cash_ID
cbAbsolute.setLabel(Msg.translate(Env.getCtx(), "AbsoluteAmt")); cbAbsolute.setLabel(Msg.translate(Env.getCtx(), "AbsoluteAmt"));
cbAbsolute.addEventListener(Events.ON_CHECK, this); cbAbsolute.addEventListener(Events.ON_CHECK, this);
Grid grid = GridFactory.newGridLayout(); Grid grid = GridFactory.newGridLayout();
Rows rows = new Rows(); Rows rows = new Rows();
grid.appendChild(rows); grid.appendChild(rows);
Row row = new Row(); Row row = new Row();
rows.appendChild(row); rows.appendChild(row);
row.appendChild(fCashBook_ID.getLabel().rightAlign()); row.appendChild(fCashBook_ID.getLabel().rightAlign());
@ -223,7 +223,7 @@ public class InfoCashLinePanel extends InfoPanel implements ValueChangeListener,
row.appendChild(lName.rightAlign()); row.appendChild(lName.rightAlign());
row.appendChild(fName); row.appendChild(fName);
row.appendChild(cbAbsolute); row.appendChild(cbAbsolute);
row = new Row(); row = new Row();
row.setSpans("1, 1, 1, 2"); row.setSpans("1, 1, 1, 2");
rows.appendChild(row); rows.appendChild(row);
@ -232,10 +232,10 @@ public class InfoCashLinePanel extends InfoPanel implements ValueChangeListener,
row.appendChild(lDateFrom.rightAlign()); row.appendChild(lDateFrom.rightAlign());
Hbox hbox = new Hbox(); Hbox hbox = new Hbox();
hbox.appendChild(fDateFrom); hbox.appendChild(fDateFrom);
hbox.appendChild(lDateTo); hbox.appendChild(lDateTo);
hbox.appendChild(fDateTo); hbox.appendChild(fDateTo);
row.appendChild(hbox); row.appendChild(hbox);
row = new Row(); row = new Row();
row.setSpans("1, 1, 1, 2"); row.setSpans("1, 1, 1, 2");
rows.appendChild(row); rows.appendChild(row);
@ -247,7 +247,7 @@ public class InfoCashLinePanel extends InfoPanel implements ValueChangeListener,
hbox.appendChild(lAmtTo); hbox.appendChild(lAmtTo);
hbox.appendChild(fAmtTo); hbox.appendChild(fAmtTo);
row.appendChild(hbox); row.appendChild(hbox);
layout = new Borderlayout(); layout = new Borderlayout();
layout.setWidth("100%"); layout.setWidth("100%");
layout.setHeight("100%"); layout.setHeight("100%");
@ -273,7 +273,7 @@ public class InfoCashLinePanel extends InfoPanel implements ValueChangeListener,
contentPanel.setVflex(true); contentPanel.setVflex(true);
div.setStyle("width :100%; height: 100%"); div.setStyle("width :100%; height: 100%");
center.appendChild(div); center.appendChild(div);
South south = new South(); South south = new South();
layout.appendChild(south); layout.appendChild(south);
southBody = new Vbox(); southBody = new Vbox();
@ -283,7 +283,7 @@ public class InfoCashLinePanel extends InfoPanel implements ValueChangeListener,
southBody.appendChild(new Separator()); southBody.appendChild(new Separator());
southBody.appendChild(statusBar); southBody.appendChild(statusBar);
} }
/** /**
* General Init * General Init
* @return true, if success * @return true, if success
@ -292,42 +292,42 @@ public class InfoCashLinePanel extends InfoPanel implements ValueChangeListener,
{ {
// Prepare table // Prepare table
StringBuffer where = new StringBuffer("cl.IsActive='Y'"); StringBuffer where = new StringBuffer("cl.IsActive='Y'");
if (p_whereClause.length() > 0) if (p_whereClause.length() > 0)
where.append(" AND ").append(Util.replace(p_whereClause, "C_CashLine.", "cl.")); where.append(" AND ").append(Util.replace(p_whereClause, "C_CashLine.", "cl."));
prepareTable ( s_cashLayout, "C_CashLine cl INNER JOIN C_Cash c ON (cl.C_Cash_ID=c.C_Cash_ID)", prepareTable ( s_cashLayout, "C_CashLine cl INNER JOIN C_Cash c ON (cl.C_Cash_ID=c.C_Cash_ID)",
where.toString(), "2,3,cl.Line"); where.toString(), "2,3,cl.Line");
return true; return true;
} // initInfo } // initInfo
/************************************************************************** /**************************************************************************
* Construct SQL Where Clause and define parameters * Construct SQL Where Clause and define parameters
* (setParameters needs to set parameters) * (setParameters needs to set parameters)
* Includes first AND * Includes first AND
* @return sql where clause * @return sql where clause
*/ */
protected String getSQLWhere() protected String getSQLWhere()
{ {
StringBuffer sql = new StringBuffer(); StringBuffer sql = new StringBuffer();
if (fName.getText().length() > 0) if (fName.getText().length() > 0)
sql.append(" AND UPPER(c.Name) LIKE ?"); sql.append(" AND UPPER(c.Name) LIKE ?");
if (fCashBook_ID.getDisplay() != "") if (fCashBook_ID.getDisplay() != "")
sql.append(" AND c.C_CashBook_ID=?"); sql.append(" AND c.C_CashBook_ID=?");
if (fInvoice_ID.getDisplay() != "") if (fInvoice_ID.getDisplay() != "")
sql.append(" AND cl.C_Invoice_ID=?"); sql.append(" AND cl.C_Invoice_ID=?");
if (fDateFrom.getValue() != null || fDateTo.getValue() != null) if (fDateFrom.getValue() != null || fDateTo.getValue() != null)
{ {
Date f = fDateFrom.getValue(); Date f = fDateFrom.getValue();
Timestamp from = new Timestamp(f.getTime()); Timestamp from = new Timestamp(f.getTime());
Date t = fDateTo.getValue(); Date t = fDateTo.getValue();
Timestamp to = new Timestamp(t.getTime()); Timestamp to = new Timestamp(t.getTime());
@ -343,7 +343,7 @@ public class InfoCashLinePanel extends InfoPanel implements ValueChangeListener,
{ {
BigDecimal from = isEmpty(fAmtFrom.getValue()) ? null : new BigDecimal(fAmtFrom.getValue()); BigDecimal from = isEmpty(fAmtFrom.getValue()) ? null : new BigDecimal(fAmtFrom.getValue());
BigDecimal to = isEmpty(fAmtTo.getValue()) ? null : new BigDecimal(fAmtTo.getValue()); BigDecimal to = isEmpty(fAmtTo.getValue()) ? null : new BigDecimal(fAmtTo.getValue());
if (cbAbsolute .isChecked()) if (cbAbsolute .isChecked())
sql.append(" AND ABS(cl.Amount)"); sql.append(" AND ABS(cl.Amount)");
else else
@ -377,7 +377,7 @@ public class InfoCashLinePanel extends InfoPanel implements ValueChangeListener,
* @param forCount for counting records * @param forCount for counting records
* @throws SQLException * @throws SQLException
*/ */
protected void setParameters(PreparedStatement pstmt, boolean forCount) throws SQLException protected void setParameters(PreparedStatement pstmt, boolean forCount) throws SQLException
{ {
int index = 1; int index = 1;
@ -402,12 +402,12 @@ public class InfoCashLinePanel extends InfoPanel implements ValueChangeListener,
{ {
Date f = fDateFrom.getValue(); Date f = fDateFrom.getValue();
Timestamp from = new Timestamp(f.getTime()); Timestamp from = new Timestamp(f.getTime());
Date t = fDateTo.getValue(); Date t = fDateTo.getValue();
Timestamp to = new Timestamp(t.getTime()); Timestamp to = new Timestamp(t.getTime());
log.fine("Date From=" + from + ", To=" + to); log.fine("Date From=" + from + ", To=" + to);
if (from == null && to != null) if (from == null && to != null)
pstmt.setTimestamp(index++, to); pstmt.setTimestamp(index++, to);
else if (from != null && to == null) else if (from != null && to == null)
@ -431,9 +431,9 @@ public class InfoCashLinePanel extends InfoPanel implements ValueChangeListener,
if (to != null) if (to != null)
to = to.abs(); to = to.abs();
} }
log.fine("Amt From=" + from + ", To=" + to + ", Absolute=" + cbAbsolute.isChecked()); log.fine("Amt From=" + from + ", To=" + to + ", Absolute=" + cbAbsolute.isChecked());
if (from == null && to != null) if (from == null && to != null)
pstmt.setBigDecimal(index++, to); pstmt.setBigDecimal(index++, to);
else if (from != null && to == null) else if (from != null && to == null)
@ -456,33 +456,33 @@ public class InfoCashLinePanel extends InfoPanel implements ValueChangeListener,
* @param f field * @param f field
* @return Upper case text with % at the end * @return Upper case text with % at the end
*/ */
private String getSQLText (Textbox f) private String getSQLText (Textbox f)
{ {
String s = f.getText().toUpperCase(); String s = f.getText().toUpperCase();
if (!s.endsWith("%")) if (!s.endsWith("%"))
s += "%"; s += "%";
log.fine( "String=" + s); log.fine( "String=" + s);
return s; return s;
} // getSQLText } // getSQLText
public void valueChange(ValueChangeEvent evt) public void valueChange(ValueChangeEvent evt)
{ {
} }
public void tableChanged(WTableModelEvent event) public void tableChanged(WTableModelEvent event)
{ {
} }
@Override @Override
protected void insertPagingComponent() protected void insertPagingComponent()
{ {
southBody.insertBefore(paging, southBody.getFirstChild()); southBody.insertBefore(paging, southBody.getFirstChild());
layout.invalidate(); layout.invalidate();
} }
} }

View File

@ -52,46 +52,51 @@ import org.zkoss.zul.Vbox;
/** /**
* Zk Port * Zk Port
* @author Elaine * @author Elaine
* @version InfoGeneral.java Adempiere Swing UI 3.4.1 * @version InfoGeneral.java Adempiere Swing UI 3.4.1
*/ */
public class InfoGeneralPanel extends InfoPanel implements EventListener public class InfoGeneralPanel extends InfoPanel implements EventListener
{ {
/** /**
* *
*/ */
private static final long serialVersionUID = -665127800885078238L; private static final long serialVersionUID = -665127800885078238L;
private Textbox txt1; private Textbox txt1;
private Textbox txt2; private Textbox txt2;
private Textbox txt3; private Textbox txt3;
private Textbox txt4; private Textbox txt4;
private Label lbl1; private Label lbl1;
private Label lbl2; private Label lbl2;
private Label lbl3; private Label lbl3;
private Label lbl4; private Label lbl4;
/** String Array of Column Info */ /** String Array of Column Info */
private ColumnInfo[] m_generalLayout; private ColumnInfo[] m_generalLayout;
/** list of query columns */ /** list of query columns */
private ArrayList<String> m_queryColumns = new ArrayList<String>(); private ArrayList<String> m_queryColumns = new ArrayList<String>();
/** list of query columns (SQL) */ /** list of query columns (SQL) */
private ArrayList<String> m_queryColumnsSql = new ArrayList<String>(); private ArrayList<String> m_queryColumnsSql = new ArrayList<String>();
private Borderlayout layout; private Borderlayout layout;
private Vbox southBody; private Vbox southBody;
public InfoGeneralPanel(String queryValue, int windowNo,String tableName,String keyColumn, boolean isSOTrx, String whereClause) 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); super(windowNo, tableName, keyColumn, false,whereClause);
setTitle(Msg.getMsg(Env.getCtx(), "Info")); setTitle(Msg.getMsg(Env.getCtx(), "Info"));
try try
{ {
init(); init();
initComponents(); initComponents();
if (queryValue != null && queryValue.length() > 0) if (queryValue != null && queryValue.length() > 0)
{ {
txt1.setValue(queryValue); txt1.setValue(queryValue);
@ -109,22 +114,22 @@ public class InfoGeneralPanel extends InfoPanel implements EventListener
setStatusLine(Integer.toString(no) + " " + Msg.getMsg(Env.getCtx(), "SearchRows_EnterQuery"), false); setStatusLine(Integer.toString(no) + " " + Msg.getMsg(Env.getCtx(), "SearchRows_EnterQuery"), false);
setStatusDB(Integer.toString(no)); setStatusDB(Integer.toString(no));
// //
if (queryValue != null && queryValue.length() > 0) if (queryValue != null && queryValue.length() > 0)
{ {
executeQuery(); executeQuery();
renderItems(); renderItems();
} }
} }
private void initComponents() private void initComponents()
{ {
Grid grid = GridFactory.newGridLayout(); Grid grid = GridFactory.newGridLayout();
Rows rows = new Rows(); Rows rows = new Rows();
grid.appendChild(rows); grid.appendChild(rows);
Row row = new Row(); Row row = new Row();
rows.appendChild(row); rows.appendChild(row);
row.appendChild(lbl1.rightAlign()); row.appendChild(lbl1.rightAlign());
@ -135,7 +140,7 @@ public class InfoGeneralPanel extends InfoPanel implements EventListener
row.appendChild(txt3); row.appendChild(txt3);
row.appendChild(lbl4.rightAlign()); row.appendChild(lbl4.rightAlign());
row.appendChild(txt4); row.appendChild(txt4);
layout = new Borderlayout(); layout = new Borderlayout();
layout.setWidth("100%"); layout.setWidth("100%");
layout.setHeight("100%"); layout.setHeight("100%");
@ -148,7 +153,7 @@ public class InfoGeneralPanel extends InfoPanel implements EventListener
North north = new North(); North north = new North();
layout.appendChild(north); layout.appendChild(north);
north.appendChild(grid); north.appendChild(grid);
Center center = new Center(); Center center = new Center();
layout.appendChild(center); layout.appendChild(center);
center.setFlex(true); center.setFlex(true);
@ -161,7 +166,7 @@ public class InfoGeneralPanel extends InfoPanel implements EventListener
contentPanel.setVflex(true); contentPanel.setVflex(true);
div.setStyle("width :100%; height: 100%"); div.setStyle("width :100%; height: 100%");
center.appendChild(div); center.appendChild(div);
South south = new South(); South south = new South();
layout.appendChild(south); layout.appendChild(south);
southBody = new Vbox(); southBody = new Vbox();
@ -178,30 +183,30 @@ public class InfoGeneralPanel extends InfoPanel implements EventListener
txt2 = new Textbox(); txt2 = new Textbox();
txt3 = new Textbox(); txt3 = new Textbox();
txt4 = new Textbox(); txt4 = new Textbox();
lbl1 = new Label(); lbl1 = new Label();
lbl2 = new Label(); lbl2 = new Label();
lbl3 = new Label(); lbl3 = new Label();
lbl4 = new Label(); lbl4 = new Label();
} }
private boolean initInfo () private boolean initInfo ()
{ {
if (!initInfoTable()) if (!initInfoTable())
return false; return false;
// Prepare table // Prepare table
StringBuffer where = new StringBuffer("IsActive='Y'"); StringBuffer where = new StringBuffer("IsActive='Y'");
if (p_whereClause.length() > 0) if (p_whereClause.length() > 0)
where.append(" AND ").append(p_whereClause); where.append(" AND ").append(p_whereClause);
prepareTable(m_generalLayout, p_tableName, where.toString(), "2"); prepareTable(m_generalLayout, p_tableName, where.toString(), "2");
// Set & enable Fields // Set & enable Fields
lbl1.setValue(Util.cleanAmp(Msg.translate(Env.getCtx(), m_queryColumns.get(0).toString()))); lbl1.setValue(Util.cleanAmp(Msg.translate(Env.getCtx(), m_queryColumns.get(0).toString())));
if (m_queryColumns.size() > 1) if (m_queryColumns.size() > 1)
{ {
lbl2.setValue(Msg.translate(Env.getCtx(), m_queryColumns.get(1).toString())); lbl2.setValue(Msg.translate(Env.getCtx(), m_queryColumns.get(1).toString()));
@ -211,7 +216,7 @@ public class InfoGeneralPanel extends InfoPanel implements EventListener
lbl2.setVisible(false); lbl2.setVisible(false);
txt2.setVisible(false); txt2.setVisible(false);
} }
if (m_queryColumns.size() > 2) if (m_queryColumns.size() > 2)
{ {
lbl3.setValue(Msg.translate(Env.getCtx(), m_queryColumns.get(2).toString())); lbl3.setValue(Msg.translate(Env.getCtx(), m_queryColumns.get(2).toString()));
@ -221,7 +226,7 @@ public class InfoGeneralPanel extends InfoPanel implements EventListener
lbl3.setVisible(false); lbl3.setVisible(false);
txt3.setVisible(false); txt3.setVisible(false);
} }
if (m_queryColumns.size() > 3) if (m_queryColumns.size() > 3)
{ {
lbl4.setValue(Msg.translate(Env.getCtx(), m_queryColumns.get(3).toString())); lbl4.setValue(Msg.translate(Env.getCtx(), m_queryColumns.get(3).toString()));
@ -237,7 +242,7 @@ public class InfoGeneralPanel extends InfoPanel implements EventListener
private boolean initInfoTable () private boolean initInfoTable ()
{ {
// Get Query Columns // Get Query Columns
String sql = "SELECT c.ColumnName, t.AD_Table_ID, t.TableName, c.ColumnSql " String sql = "SELECT c.ColumnName, t.AD_Table_ID, t.TableName, c.ColumnSql "
+ "FROM AD_Table t" + "FROM AD_Table t"
+ " INNER JOIN AD_Column c ON (t.AD_Table_ID=c.AD_Table_ID)" + " INNER JOIN AD_Column c ON (t.AD_Table_ID=c.AD_Table_ID)"
@ -248,26 +253,26 @@ public class InfoGeneralPanel extends InfoPanel implements EventListener
+ "WHERE f.AD_Column_ID=c.AD_Column_ID" + "WHERE f.AD_Column_ID=c.AD_Column_ID"
+ " AND f.IsDisplayed='Y' AND f.IsEncrypted='N' AND f.ObscureType IS NULL) " + " AND f.IsDisplayed='Y' AND f.IsEncrypted='N' AND f.ObscureType IS NULL) "
+ "ORDER BY c.IsIdentifier DESC, c.SeqNo"; + "ORDER BY c.IsIdentifier DESC, c.SeqNo";
int AD_Table_ID = 0; int AD_Table_ID = 0;
String tableName = null; String tableName = null;
try try
{ {
PreparedStatement pstmt = DB.prepareStatement(sql, null); PreparedStatement pstmt = DB.prepareStatement(sql, null);
pstmt.setString(1, p_tableName); pstmt.setString(1, p_tableName);
ResultSet rs = pstmt.executeQuery(); ResultSet rs = pstmt.executeQuery();
while (rs.next()) while (rs.next())
{ {
m_queryColumns.add(rs.getString(1)); m_queryColumns.add(rs.getString(1));
String columnSql = rs.getString(4); String columnSql = rs.getString(4);
if (columnSql != null && columnSql.length() > 0) if (columnSql != null && columnSql.length() > 0)
m_queryColumnsSql.add(columnSql); m_queryColumnsSql.add(columnSql);
else else
m_queryColumnsSql.add(rs.getString(1)); m_queryColumnsSql.add(rs.getString(1));
if (AD_Table_ID == 0) if (AD_Table_ID == 0)
{ {
AD_Table_ID = rs.getInt(2); AD_Table_ID = rs.getInt(2);
@ -282,34 +287,34 @@ public class InfoGeneralPanel extends InfoPanel implements EventListener
log.log(Level.SEVERE, sql, e); log.log(Level.SEVERE, sql, e);
return false; return false;
} }
// Miminum check // Miminum check
if (m_queryColumns.size() == 0) if (m_queryColumns.size() == 0)
{ {
log.log(Level.SEVERE, "No query columns found"); log.log(Level.SEVERE, "No query columns found");
return false; return false;
} }
log.finest("Table " + tableName + ", ID=" + AD_Table_ID log.finest("Table " + tableName + ", ID=" + AD_Table_ID
+ ", QueryColumns #" + m_queryColumns.size()); + ", QueryColumns #" + m_queryColumns.size());
// Only 4 Query Columns // Only 4 Query Columns
while (m_queryColumns.size() > 4) while (m_queryColumns.size() > 4)
{ {
m_queryColumns.remove(m_queryColumns.size()-1); m_queryColumns.remove(m_queryColumns.size()-1);
m_queryColumnsSql.remove(m_queryColumnsSql.size()-1); m_queryColumnsSql.remove(m_queryColumnsSql.size()-1);
} }
// Set Title // Set Title
String title = Msg.translate(Env.getCtx(), tableName + "_ID"); // best bet String title = Msg.translate(Env.getCtx(), tableName + "_ID"); // best bet
if (title.endsWith("_ID")) if (title.endsWith("_ID"))
title = Msg.translate(Env.getCtx(), tableName); // second best bet title = Msg.translate(Env.getCtx(), tableName); // second best bet
setTitle(getTitle() + " " + title); setTitle(getTitle() + " " + title);
// Get Display Columns // Get Display Columns
ArrayList<ColumnInfo> list = new ArrayList<ColumnInfo>(); ArrayList<ColumnInfo> list = new ArrayList<ColumnInfo>();
sql = "SELECT c.ColumnName, c.AD_Reference_ID, c.IsKey, f.IsDisplayed, c.AD_Reference_Value_ID, c.ColumnSql " sql = "SELECT c.ColumnName, c.AD_Reference_ID, c.IsKey, f.IsDisplayed, c.AD_Reference_Value_ID, c.ColumnSql "
+ "FROM AD_Column c" + "FROM AD_Column c"
@ -320,7 +325,7 @@ public class InfoGeneralPanel extends InfoPanel implements EventListener
+ " AND (c.IsKey='Y' OR " + " AND (c.IsKey='Y' OR "
+ " (f.IsEncrypted='N' AND f.ObscureType IS NULL)) " + " (f.IsEncrypted='N' AND f.ObscureType IS NULL)) "
+ "ORDER BY c.IsKey DESC, f.SeqNo"; + "ORDER BY c.IsKey DESC, f.SeqNo";
try try
{ {
PreparedStatement pstmt = DB.prepareStatement(sql, null); PreparedStatement pstmt = DB.prepareStatement(sql, null);
@ -337,11 +342,11 @@ public class InfoGeneralPanel extends InfoPanel implements EventListener
if (columnSql == null || columnSql.length() == 0) if (columnSql == null || columnSql.length() == 0)
columnSql = columnName; columnSql = columnName;
// Default // Default
StringBuffer colSql = new StringBuffer(columnSql); StringBuffer colSql = new StringBuffer(columnSql);
Class<?> colClass = null; Class<?> colClass = null;
if (isKey) if (isKey)
colClass = IDColumn.class; colClass = IDColumn.class;
else if (!isDisplayed) else if (!isDisplayed)
@ -390,24 +395,24 @@ public class InfoGeneralPanel extends InfoPanel implements EventListener
log.log(Level.SEVERE, sql, e); log.log(Level.SEVERE, sql, e);
return false; return false;
} }
if (list.size() == 0) if (list.size() == 0)
{ {
FDialog.error(p_WindowNo, this, "Error", "No Info Columns"); FDialog.error(p_WindowNo, this, "Error", "No Info Columns");
log.log(Level.SEVERE, "No Info for AD_Table_ID=" + AD_Table_ID + " - " + sql); log.log(Level.SEVERE, "No Info for AD_Table_ID=" + AD_Table_ID + " - " + sql);
return false; return false;
} }
log.finest("InfoColumns #" + list.size()); log.finest("InfoColumns #" + list.size());
// Convert ArrayList to Array // Convert ArrayList to Array
m_generalLayout = new ColumnInfo[list.size()]; m_generalLayout = new ColumnInfo[list.size()];
list.toArray(m_generalLayout); list.toArray(m_generalLayout);
return true; return true;
} }
@Override @Override
public String getSQLWhere() public String getSQLWhere()
{ {
StringBuffer sql = new StringBuffer(); StringBuffer sql = new StringBuffer();
addSQLWhere (sql, 0, txt1.getText().toUpperCase()); addSQLWhere (sql, 0, txt1.getText().toUpperCase());
@ -416,7 +421,7 @@ public class InfoGeneralPanel extends InfoPanel implements EventListener
addSQLWhere (sql, 3, txt4.getText().toUpperCase()); addSQLWhere (sql, 3, txt4.getText().toUpperCase());
return sql.toString(); return sql.toString();
} }
private void addSQLWhere(StringBuffer sql, int index, String value) private void addSQLWhere(StringBuffer sql, int index, String value)
{ {
if (!(value.equals("") || value.equals("%")) && index < m_queryColumns.size()) if (!(value.equals("") || value.equals("%")) && index < m_queryColumns.size())
@ -463,7 +468,7 @@ public class InfoGeneralPanel extends InfoPanel implements EventListener
public void tableChanged(WTableModelEvent event) public void tableChanged(WTableModelEvent event)
{ {
} }
@Override @Override
protected void insertPagingComponent() protected void insertPagingComponent()
{ {

View File

@ -57,10 +57,10 @@ import org.zkoss.zul.Vbox;
/** /**
* Based on InfoInOut written by Jorg Janke * Based on InfoInOut written by Jorg Janke
* *
* @author Niraj Sohun * @author Niraj Sohun
* Aug 03, 2007 * Aug 03, 2007
* *
* Zk Port * Zk Port
* @author Elaine * @author Elaine
* @version InfoInOut.java Adempiere Swing UI 3.4.1 * @version InfoInOut.java Adempiere Swing UI 3.4.1
@ -69,7 +69,7 @@ import org.zkoss.zul.Vbox;
public class InfoInOutPanel extends InfoPanel implements ValueChangeListener, EventListener public class InfoInOutPanel extends InfoPanel implements ValueChangeListener, EventListener
{ {
/** /**
* *
*/ */
private static final long serialVersionUID = -3927370377224858985L; private static final long serialVersionUID = -3927370377224858985L;
@ -109,18 +109,18 @@ public class InfoInOutPanel extends InfoPanel implements ValueChangeListener, Ev
/** /**
* Detail Protected Constructor * Detail Protected Constructor
* *
* @param WindowNo window no * @param WindowNo window no
* @param value query value * @param value query value
* @param multiSelection multiple selections * @param multiSelection multiple selections
* @param whereClause where clause * @param whereClause where clause
*/ */
protected InfoInOutPanel( int WindowNo, String value, public InfoInOutPanel( int WindowNo, String value,
boolean multiSelection, String whereClause) boolean multiSelection, String whereClause)
{ {
this(WindowNo, value, multiSelection, whereClause, true); this(WindowNo, value, multiSelection, whereClause, true);
} }
/** /**
* Detail Protected Constructor * Detail Protected Constructor
* *
@ -129,7 +129,7 @@ public class InfoInOutPanel extends InfoPanel implements ValueChangeListener, Ev
* @param multiSelection multiple selections * @param multiSelection multiple selections
* @param whereClause where clause * @param whereClause where clause
*/ */
protected InfoInOutPanel( int WindowNo, String value, public InfoInOutPanel( int WindowNo, String value,
boolean multiSelection, String whereClause, boolean lookup) boolean multiSelection, String whereClause, boolean lookup)
{ {
super (WindowNo, "i", "M_InOut_ID", multiSelection, whereClause, lookup); super (WindowNo, "i", "M_InOut_ID", multiSelection, whereClause, lookup);
@ -149,7 +149,7 @@ public class InfoInOutPanel extends InfoPanel implements ValueChangeListener, Ev
int no = contentPanel.getRowCount(); int no = contentPanel.getRowCount();
setStatusLine(Integer.toString(no) + " " + Msg.getMsg(Env.getCtx(), "SearchRows_EnterQuery"), false); setStatusLine(Integer.toString(no) + " " + Msg.getMsg(Env.getCtx(), "SearchRows_EnterQuery"), false);
setStatusDB(Integer.toString(no)); setStatusDB(Integer.toString(no));
if (value != null && value.length() > 0) if (value != null && value.length() > 0)
{ {
fDocumentNo.setValue(value); fDocumentNo.setValue(value);
@ -161,7 +161,7 @@ public class InfoInOutPanel extends InfoPanel implements ValueChangeListener, Ev
* Static Setup - add fields to parameterPanel * Static Setup - add fields to parameterPanel
* @throws Exception if Lookups cannot be initialized * @throws Exception if Lookups cannot be initialized
*/ */
private void statInit() throws Exception private void statInit() throws Exception
{ {
fDocumentNo.setWidth("100%"); fDocumentNo.setWidth("100%");
@ -169,7 +169,7 @@ public class InfoInOutPanel extends InfoPanel implements ValueChangeListener, Ev
fPOReference.setWidth("100%"); fPOReference.setWidth("100%");
fDateFrom.setWidth("165px"); fDateFrom.setWidth("165px");
fDateTo.setWidth("165px"); fDateTo.setWidth("165px");
fDocumentNo.addEventListener(Events.ON_CHANGE, this); fDocumentNo.addEventListener(Events.ON_CHANGE, this);
fDescription.addEventListener(Events.ON_CHANGE, this); fDescription.addEventListener(Events.ON_CHANGE, this);
fPOReference.addEventListener(Events.ON_CHANGE, this); fPOReference.addEventListener(Events.ON_CHANGE, this);
@ -177,17 +177,17 @@ public class InfoInOutPanel extends InfoPanel implements ValueChangeListener, Ev
fIsSOTrx.setLabel(Msg.translate(Env.getCtx(), "IsSOTrx")); fIsSOTrx.setLabel(Msg.translate(Env.getCtx(), "IsSOTrx"));
fIsSOTrx.setChecked(!"N".equals(Env.getContext(Env.getCtx(), p_WindowNo, "IsSOTrx"))); fIsSOTrx.setChecked(!"N".equals(Env.getContext(Env.getCtx(), p_WindowNo, "IsSOTrx")));
fIsSOTrx.addEventListener(Events.ON_CHECK, this); fIsSOTrx.addEventListener(Events.ON_CHECK, this);
fBPartner_ID = new WSearchEditor( fBPartner_ID = new WSearchEditor(
MLookupFactory.get (Env.getCtx(), p_WindowNo, 0, 3499, DisplayType.Search), MLookupFactory.get (Env.getCtx(), p_WindowNo, 0, 3499, DisplayType.Search),
Msg.translate(Env.getCtx(), "BPartner"), "", false, false, true); Msg.translate(Env.getCtx(), "BPartner"), "", false, false, true);
fBPartner_ID.addValueChangeListener(this); fBPartner_ID.addValueChangeListener(this);
Grid grid = GridFactory.newGridLayout(); Grid grid = GridFactory.newGridLayout();
Rows rows = new Rows(); Rows rows = new Rows();
grid.appendChild(rows); grid.appendChild(rows);
Row row = new Row(); Row row = new Row();
rows.appendChild(row); rows.appendChild(row);
row.appendChild(lDocumentNo.rightAlign()); row.appendChild(lDocumentNo.rightAlign());
@ -195,7 +195,7 @@ public class InfoInOutPanel extends InfoPanel implements ValueChangeListener, Ev
row.appendChild(fBPartner_ID.getLabel().rightAlign()); row.appendChild(fBPartner_ID.getLabel().rightAlign());
row.appendChild(fBPartner_ID.getComponent()); row.appendChild(fBPartner_ID.getComponent());
row.appendChild(fIsSOTrx); row.appendChild(fIsSOTrx);
row = new Row(); row = new Row();
row.setSpans("1, 1, 1, 2"); row.setSpans("1, 1, 1, 2");
rows.appendChild(row); rows.appendChild(row);
@ -207,14 +207,14 @@ public class InfoInOutPanel extends InfoPanel implements ValueChangeListener, Ev
hbox.appendChild(lDateTo); hbox.appendChild(lDateTo);
hbox.appendChild(fDateTo); hbox.appendChild(fDateTo);
row.appendChild(hbox); row.appendChild(hbox);
row = new Row(); row = new Row();
row.setSpans("1, 1, 3"); row.setSpans("1, 1, 3");
rows.appendChild(row); rows.appendChild(row);
row.appendChild(lPOReference.rightAlign()); row.appendChild(lPOReference.rightAlign());
row.appendChild(fPOReference); row.appendChild(fPOReference);
row.appendChild(new Label()); row.appendChild(new Label());
layout = new Borderlayout(); layout = new Borderlayout();
layout.setWidth("100%"); layout.setWidth("100%");
layout.setHeight("100%"); layout.setHeight("100%");
@ -223,11 +223,11 @@ public class InfoInOutPanel extends InfoPanel implements ValueChangeListener, Ev
layout.setStyle("position: absolute"); layout.setStyle("position: absolute");
} }
this.appendChild(layout); this.appendChild(layout);
North north = new North(); North north = new North();
layout.appendChild(north); layout.appendChild(north);
north.appendChild(grid); north.appendChild(grid);
Center center = new Center(); Center center = new Center();
layout.appendChild(center); layout.appendChild(center);
center.setFlex(true); center.setFlex(true);
@ -240,7 +240,7 @@ public class InfoInOutPanel extends InfoPanel implements ValueChangeListener, Ev
contentPanel.setVflex(true); contentPanel.setVflex(true);
div.setStyle("width :100%; height: 100%"); div.setStyle("width :100%; height: 100%");
center.appendChild(div); center.appendChild(div);
South south = new South(); South south = new South();
layout.appendChild(south); layout.appendChild(south);
southBody = new Vbox(); southBody = new Vbox();
@ -250,27 +250,27 @@ public class InfoInOutPanel extends InfoPanel implements ValueChangeListener, Ev
southBody.appendChild(new Separator()); southBody.appendChild(new Separator());
southBody.appendChild(statusBar); southBody.appendChild(statusBar);
} }
/** /**
* General Init * General Init
* @return true, if success * @return true, if success
*/ */
private boolean initInfo () private boolean initInfo ()
{ {
// Set Defaults // Set Defaults
String bp = Env.getContext(Env.getCtx(), p_WindowNo, "C_BPartner_ID"); String bp = Env.getContext(Env.getCtx(), p_WindowNo, "C_BPartner_ID");
if (bp != null && bp.length() != 0) if (bp != null && bp.length() != 0)
fBPartner_ID.setValue(new Integer(bp)); fBPartner_ID.setValue(new Integer(bp));
// Prepare table // Prepare table
StringBuffer where = new StringBuffer("i.IsActive='Y'"); StringBuffer where = new StringBuffer("i.IsActive='Y'");
if (p_whereClause.length() > 0) if (p_whereClause.length() > 0)
where.append(" AND ").append(Util.replace(p_whereClause, "M_InOut.", "i.")); where.append(" AND ").append(Util.replace(p_whereClause, "M_InOut.", "i."));
prepareTable(s_invoiceLayout, " M_InOut i", where.toString(), "2,3,4"); prepareTable(s_invoiceLayout, " M_InOut i", where.toString(), "2,3,4");
return true; return true;
@ -284,17 +284,17 @@ public class InfoInOutPanel extends InfoPanel implements ValueChangeListener, Ev
* Includes first AND * Includes first AND
* @return where clause * @return where clause
*/ */
protected String getSQLWhere() protected String getSQLWhere()
{ {
StringBuffer sql = new StringBuffer(); StringBuffer sql = new StringBuffer();
if (fDocumentNo.getText().length() > 0) if (fDocumentNo.getText().length() > 0)
sql.append(" AND UPPER(i.DocumentNo) LIKE ?"); sql.append(" AND UPPER(i.DocumentNo) LIKE ?");
if (fDescription.getText().length() > 0) if (fDescription.getText().length() > 0)
sql.append(" AND UPPER(i.Description) LIKE ?"); sql.append(" AND UPPER(i.Description) LIKE ?");
if (fPOReference.getText().length() > 0) if (fPOReference.getText().length() > 0)
sql.append(" AND UPPER(i.POReference) LIKE ?"); sql.append(" AND UPPER(i.POReference) LIKE ?");
@ -305,7 +305,7 @@ public class InfoInOutPanel extends InfoPanel implements ValueChangeListener, Ev
{ {
Date f = fDateFrom.getValue(); Date f = fDateFrom.getValue();
Timestamp from = new Timestamp(f.getTime()); Timestamp from = new Timestamp(f.getTime());
Date t = fDateTo.getValue(); Date t = fDateTo.getValue();
Timestamp to = new Timestamp(t.getTime()); Timestamp to = new Timestamp(t.getTime());
@ -328,17 +328,17 @@ public class InfoInOutPanel extends InfoPanel implements ValueChangeListener, Ev
* @param forCount for counting records * @param forCount for counting records
* @throws SQLException * @throws SQLException
*/ */
protected void setParameters(PreparedStatement pstmt, boolean forCount) throws SQLException protected void setParameters(PreparedStatement pstmt, boolean forCount) throws SQLException
{ {
int index = 1; int index = 1;
if (fDocumentNo.getText().length() > 0) if (fDocumentNo.getText().length() > 0)
pstmt.setString(index++, getSQLText(fDocumentNo)); pstmt.setString(index++, getSQLText(fDocumentNo));
if (fDescription.getText().length() > 0) if (fDescription.getText().length() > 0)
pstmt.setString(index++, getSQLText(fDescription)); pstmt.setString(index++, getSQLText(fDescription));
if (fPOReference.getText().length() > 0) if (fPOReference.getText().length() > 0)
pstmt.setString(index++, getSQLText(fPOReference)); pstmt.setString(index++, getSQLText(fPOReference));
@ -353,12 +353,12 @@ public class InfoInOutPanel extends InfoPanel implements ValueChangeListener, Ev
{ {
Date f = fDateFrom.getValue(); Date f = fDateFrom.getValue();
Timestamp from = new Timestamp(f.getTime()); Timestamp from = new Timestamp(f.getTime());
Date t = fDateTo.getValue(); Date t = fDateTo.getValue();
Timestamp to = new Timestamp(t.getTime()); Timestamp to = new Timestamp(t.getTime());
log.fine("Date From=" + from + ", To=" + to); log.fine("Date From=" + from + ", To=" + to);
if (from == null && to != null) if (from == null && to != null)
pstmt.setTimestamp(index++, to); pstmt.setTimestamp(index++, to);
else if (from != null && to == null) else if (from != null && to == null)
@ -377,14 +377,14 @@ public class InfoInOutPanel extends InfoPanel implements ValueChangeListener, Ev
* @param f field * @param f field
* @return sql part * @return sql part
*/ */
private String getSQLText (Textbox f) private String getSQLText (Textbox f)
{ {
String s = f.getText().toUpperCase(); String s = f.getText().toUpperCase();
if (!s.endsWith("%")) if (!s.endsWith("%"))
s += "%"; s += "%";
log.fine( "String=" + s); log.fine( "String=" + s);
return s; return s;
} // getSQLText } // getSQLText
@ -406,18 +406,18 @@ public class InfoInOutPanel extends InfoPanel implements ValueChangeListener, Ev
AEnv.zoom (AD_WindowNo, query); AEnv.zoom (AD_WindowNo, query);
} // zoom } // zoom
// //
/** /**
* Has Zoom * Has Zoom
* @return true * @return true
*/ */
protected boolean hasZoom() protected boolean hasZoom()
{ {
return true; return true;
} // hasZoom } // hasZoom
public void valueChange(ValueChangeEvent evt) public void valueChange(ValueChangeEvent evt)
{ {
if (fBPartner_ID.equals(evt.getSource())) if (fBPartner_ID.equals(evt.getSource()))
{ {
@ -425,9 +425,9 @@ public class InfoInOutPanel extends InfoPanel implements ValueChangeListener, Ev
} }
} }
public void tableChanged(WTableModelEvent event) public void tableChanged(WTableModelEvent event)
{ {
} }
@Override @Override

View File

@ -65,12 +65,12 @@ import org.zkoss.zul.Vbox;
* *
* Zk Port * Zk Port
* @author Elaine * @author Elaine
* @version InfoInvoice.java Adempiere Swing UI 3.4.1 * @version InfoInvoice.java Adempiere Swing UI 3.4.1
**/ **/
public class InfoInvoicePanel extends InfoPanel implements ValueChangeListener public class InfoInvoicePanel extends InfoPanel implements ValueChangeListener
{ {
/** /**
* *
*/ */
private static final long serialVersionUID = 5632526399922930978L; private static final long serialVersionUID = 5632526399922930978L;
@ -82,12 +82,12 @@ public class InfoInvoicePanel extends InfoPanel implements ValueChangeListener
* @param whereClause where clause * @param whereClause where clause
* *
*/ */
protected InfoInvoicePanel(int WindowNo, String value, public InfoInvoicePanel(int WindowNo, String value,
boolean multiSelection, String whereClause) boolean multiSelection, String whereClause)
{ {
this(WindowNo, value, multiSelection, whereClause, true); this(WindowNo, value, multiSelection, whereClause, true);
} }
/** /**
* Detail protected constructor * Detail protected constructor
* @param WindowNo window no * @param WindowNo window no
@ -96,16 +96,16 @@ public class InfoInvoicePanel extends InfoPanel implements ValueChangeListener
* @param whereClause where clause * @param whereClause where clause
* *
*/ */
protected InfoInvoicePanel(int WindowNo, String value, public InfoInvoicePanel(int WindowNo, String value,
boolean multiSelection, String whereClause, boolean lookup) boolean multiSelection, String whereClause, boolean lookup)
{ {
super ( WindowNo, "i", "C_Invoice_ID", multiSelection, whereClause, lookup); super ( WindowNo, "i", "C_Invoice_ID", multiSelection, whereClause, lookup);
setTitle(Msg.getMsg(Env.getCtx(), "InfoInvoice")); setTitle(Msg.getMsg(Env.getCtx(), "InfoInvoice"));
// //
initComponents(); initComponents();
init(); init();
p_loadedOK = initInfo (); p_loadedOK = initInfo ();
int no = contentPanel.getRowCount(); int no = contentPanel.getRowCount();
setStatusLine(Integer.toString(no) + " " + Msg.getMsg(Env.getCtx(), "SearchRows_EnterQuery"), false); setStatusLine(Integer.toString(no) + " " + Msg.getMsg(Env.getCtx(), "SearchRows_EnterQuery"), false);
@ -123,24 +123,24 @@ public class InfoInvoicePanel extends InfoPanel implements ValueChangeListener
private Label lblDescription; private Label lblDescription;
private Label lblDateInvoiced; private Label lblDateInvoiced;
private Label lblGrandTotal; private Label lblGrandTotal;
private Textbox txtDocumentNo; private Textbox txtDocumentNo;
private Textbox txtDescription; private Textbox txtDescription;
private Datebox dateFrom; private Datebox dateFrom;
private Datebox dateTo; private Datebox dateTo;
private NumberBox amountFrom; private NumberBox amountFrom;
private NumberBox amountTo; private NumberBox amountTo;
private WSearchEditor editorBPartner; private WSearchEditor editorBPartner;
private WSearchEditor editorOrder; private WSearchEditor editorOrder;
private Checkbox isSoTrx; private Checkbox isSoTrx;
private Checkbox isPaid; private Checkbox isPaid;
private Borderlayout layout; private Borderlayout layout;
private Vbox southBody; private Vbox southBody;
/** Array of Column Info */ /** Array of Column Info */
private static final ColumnInfo[] s_invoiceLayout = { private static final ColumnInfo[] s_invoiceLayout = {
new ColumnInfo(" ", "i.C_Invoice_ID", IDColumn.class), new ColumnInfo(" ", "i.C_Invoice_ID", IDColumn.class),
@ -157,25 +157,25 @@ public class InfoInvoicePanel extends InfoPanel implements ValueChangeListener
new ColumnInfo(Msg.translate(Env.getCtx(), "POReference"), "i.POReference", String.class), new ColumnInfo(Msg.translate(Env.getCtx(), "POReference"), "i.POReference", String.class),
new ColumnInfo("", "''", KeyNamePair.class, "i.C_InvoicePaySchedule_ID") new ColumnInfo("", "''", KeyNamePair.class, "i.C_InvoicePaySchedule_ID")
}; };
private static int INDEX_PAYSCHEDULE = s_invoiceLayout.length - 1; // last item private static int INDEX_PAYSCHEDULE = s_invoiceLayout.length - 1; // last item
private void initComponents() private void initComponents()
{ {
lblDocumentNo = new Label(Util.cleanAmp(Msg.translate(Env.getCtx(), "DocumentNo"))); lblDocumentNo = new Label(Util.cleanAmp(Msg.translate(Env.getCtx(), "DocumentNo")));
lblDescription = new Label(Msg.translate(Env.getCtx(), "Description")); lblDescription = new Label(Msg.translate(Env.getCtx(), "Description"));
lblDateInvoiced = new Label(Msg.translate(Env.getCtx(), "DateInvoiced")); lblDateInvoiced = new Label(Msg.translate(Env.getCtx(), "DateInvoiced"));
lblGrandTotal = new Label(Msg.translate(Env.getCtx(), "GrandTotal")); lblGrandTotal = new Label(Msg.translate(Env.getCtx(), "GrandTotal"));
txtDocumentNo = new Textbox(); txtDocumentNo = new Textbox();
txtDescription = new Textbox(); txtDescription = new Textbox();
dateFrom = new Datebox(); dateFrom = new Datebox();
dateTo= new Datebox(); dateTo= new Datebox();
amountFrom = new NumberBox(false); amountFrom = new NumberBox(false);
amountTo = new NumberBox(false); amountTo = new NumberBox(false);
isPaid = new Checkbox(); isPaid = new Checkbox();
isPaid.setLabel(Msg.translate(Env.getCtx(), "IsPaid")); isPaid.setLabel(Msg.translate(Env.getCtx(), "IsPaid"));
isPaid.setChecked(false); isPaid.setChecked(false);
@ -187,14 +187,14 @@ public class InfoInvoicePanel extends InfoPanel implements ValueChangeListener
editorBPartner = new WSearchEditor(lookupBP, Msg.translate( editorBPartner = new WSearchEditor(lookupBP, Msg.translate(
Env.getCtx(), "C_BPartner_ID"), "", false, false, true); Env.getCtx(), "C_BPartner_ID"), "", false, false, true);
editorBPartner.addValueChangeListener(this); editorBPartner.addValueChangeListener(this);
MLookup lookupOrder = MLookupFactory.get(Env.getCtx(), p_WindowNo, MLookup lookupOrder = MLookupFactory.get(Env.getCtx(), p_WindowNo,
0, 4247, DisplayType.Search); 0, 4247, DisplayType.Search);
editorOrder = new WSearchEditor(lookupOrder, Msg.translate( editorOrder = new WSearchEditor(lookupOrder, Msg.translate(
Env.getCtx(), "C_Order_ID"), "", false, false, true); Env.getCtx(), "C_Order_ID"), "", false, false, true);
editorOrder.addValueChangeListener(this); editorOrder.addValueChangeListener(this);
} }
private void init() private void init()
{ {
txtDocumentNo.setWidth("100%"); txtDocumentNo.setWidth("100%");
@ -203,12 +203,12 @@ public class InfoInvoicePanel extends InfoPanel implements ValueChangeListener
dateTo.setWidth("165px"); dateTo.setWidth("165px");
amountFrom.getDecimalbox().setWidth("155px"); amountFrom.getDecimalbox().setWidth("155px");
amountTo.getDecimalbox().setWidth("155px"); amountTo.getDecimalbox().setWidth("155px");
Grid grid = GridFactory.newGridLayout(); Grid grid = GridFactory.newGridLayout();
Rows rows = new Rows(); Rows rows = new Rows();
grid.appendChild(rows); grid.appendChild(rows);
Row row = new Row(); Row row = new Row();
rows.appendChild(row); rows.appendChild(row);
row.appendChild(lblDocumentNo.rightAlign()); row.appendChild(lblDocumentNo.rightAlign());
@ -217,7 +217,7 @@ public class InfoInvoicePanel extends InfoPanel implements ValueChangeListener
row.appendChild(editorBPartner.getComponent()); row.appendChild(editorBPartner.getComponent());
row.appendChild(isSoTrx); row.appendChild(isSoTrx);
row.appendChild(isPaid); row.appendChild(isPaid);
row = new Row(); row = new Row();
row.setSpans("1, 1, 1, 3"); row.setSpans("1, 1, 1, 3");
rows.appendChild(row); rows.appendChild(row);
@ -229,7 +229,7 @@ public class InfoInvoicePanel extends InfoPanel implements ValueChangeListener
hbox.appendChild(new Label("-")); hbox.appendChild(new Label("-"));
hbox.appendChild(dateTo); hbox.appendChild(dateTo);
row.appendChild(hbox); row.appendChild(hbox);
row = new Row(); row = new Row();
row.setSpans("1, 1, 1, 3"); row.setSpans("1, 1, 1, 3");
rows.appendChild(row); rows.appendChild(row);
@ -241,7 +241,7 @@ public class InfoInvoicePanel extends InfoPanel implements ValueChangeListener
hbox.appendChild(new Label("-")); hbox.appendChild(new Label("-"));
hbox.appendChild(amountTo); hbox.appendChild(amountTo);
row.appendChild(hbox); row.appendChild(hbox);
layout = new Borderlayout(); layout = new Borderlayout();
layout.setWidth("100%"); layout.setWidth("100%");
layout.setHeight("100%"); layout.setHeight("100%");
@ -267,7 +267,7 @@ public class InfoInvoicePanel extends InfoPanel implements ValueChangeListener
contentPanel.setVflex(true); contentPanel.setVflex(true);
div.setStyle("width :100%; height: 100%"); div.setStyle("width :100%; height: 100%");
center.appendChild(div); center.appendChild(div);
South south = new South(); South south = new South();
layout.appendChild(south); layout.appendChild(south);
southBody = new Vbox(); southBody = new Vbox();
@ -277,7 +277,7 @@ public class InfoInvoicePanel extends InfoPanel implements ValueChangeListener
southBody.appendChild(new Separator()); southBody.appendChild(new Separator());
southBody.appendChild(statusBar); southBody.appendChild(statusBar);
} }
/** /**
* General Init * General Init
* @return true, if success * @return true, if success
@ -299,7 +299,7 @@ public class InfoInvoicePanel extends InfoPanel implements ValueChangeListener
"2,3,4"); "2,3,4");
// //
return true; return true;
} // initInfo } // initInfo
@Override @Override
public String getSQLWhere() public String getSQLWhere()
@ -323,7 +323,7 @@ public class InfoInvoicePanel extends InfoPanel implements ValueChangeListener
} }
catch (WrongValueException e) catch (WrongValueException e)
{ {
} }
try try
{ {
@ -331,7 +331,7 @@ public class InfoInvoicePanel extends InfoPanel implements ValueChangeListener
} }
catch (WrongValueException e) catch (WrongValueException e)
{ {
} }
if (fromDate == null && toDate != null) if (fromDate == null && toDate != null)
{ {
@ -356,7 +356,7 @@ public class InfoInvoicePanel extends InfoPanel implements ValueChangeListener
} }
catch (NumberFormatException e) catch (NumberFormatException e)
{ {
} }
} }
if (!Util.isEmpty(amountTo.getText())) if (!Util.isEmpty(amountTo.getText()))
@ -367,7 +367,7 @@ public class InfoInvoicePanel extends InfoPanel implements ValueChangeListener
} }
catch (NumberFormatException e) catch (NumberFormatException e)
{ {
} }
} }
if (fromAmount == null && toAmount != null) if (fromAmount == null && toAmount != null)
@ -396,7 +396,7 @@ public class InfoInvoicePanel extends InfoPanel implements ValueChangeListener
pstmt.setString(index++, getSQLText(txtDocumentNo)); pstmt.setString(index++, getSQLText(txtDocumentNo));
if (txtDescription.getText().length() > 0) if (txtDescription.getText().length() > 0)
pstmt.setString(index++, getSQLText(txtDescription)); pstmt.setString(index++, getSQLText(txtDescription));
// //
if (editorBPartner.getValue() != null) if (editorBPartner.getValue() != null)
{ {
@ -425,7 +425,7 @@ public class InfoInvoicePanel extends InfoPanel implements ValueChangeListener
} }
catch (WrongValueException e) catch (WrongValueException e)
{ {
} }
try try
{ {
@ -437,9 +437,9 @@ public class InfoInvoicePanel extends InfoPanel implements ValueChangeListener
} }
catch (WrongValueException e) catch (WrongValueException e)
{ {
} }
log.fine("Date From=" + from + ", To=" + to); log.fine("Date From=" + from + ", To=" + to);
if (from == null && to != null) if (from == null && to != null)
{ {
@ -454,13 +454,13 @@ public class InfoInvoicePanel extends InfoPanel implements ValueChangeListener
pstmt.setTimestamp(index++, from); pstmt.setTimestamp(index++, from);
pstmt.setTimestamp(index++, to); pstmt.setTimestamp(index++, to);
} }
// //
BigDecimal fromBD = null; BigDecimal fromBD = null;
BigDecimal toBD = null; BigDecimal toBD = null;
Double fromAmt = null; Double fromAmt = null;
Double toAmt = null; Double toAmt = null;
if (!Util.isEmpty(amountFrom.getText())) if (!Util.isEmpty(amountFrom.getText()))
{ {
try try
@ -470,10 +470,10 @@ public class InfoInvoicePanel extends InfoPanel implements ValueChangeListener
} }
catch (Exception e) catch (Exception e)
{ {
} }
} }
if (!Util.isEmpty(amountTo.getText())) if (!Util.isEmpty(amountTo.getText()))
{ {
try try
@ -483,10 +483,10 @@ public class InfoInvoicePanel extends InfoPanel implements ValueChangeListener
} }
catch (Exception e) catch (Exception e)
{ {
} }
} }
if (fromBD == null && toBD != null) if (fromBD == null && toBD != null)
{ {
pstmt.setBigDecimal(index++, toBD); pstmt.setBigDecimal(index++, toBD);
@ -502,7 +502,7 @@ public class InfoInvoicePanel extends InfoPanel implements ValueChangeListener
} }
pstmt.setString(index++,isPaid.isChecked() ? "Y" : "N"); pstmt.setString(index++,isPaid.isChecked() ? "Y" : "N");
pstmt.setString(index++,isSoTrx.isChecked() ? "Y" : "N"); pstmt.setString(index++,isSoTrx.isChecked() ? "Y" : "N");
} }
/** /**
@ -518,7 +518,7 @@ public class InfoInvoicePanel extends InfoPanel implements ValueChangeListener
log.fine("String=" + s); log.fine("String=" + s);
return s; return s;
} // getSQLText } // getSQLText
// Elaine 2008/12/16 // Elaine 2008/12/16
/** /**
* Zoom * Zoom
@ -545,10 +545,10 @@ public class InfoInvoicePanel extends InfoPanel implements ValueChangeListener
return true; return true;
} // hasZoom } // hasZoom
// //
public void tableChanged(WTableModelEvent event) public void tableChanged(WTableModelEvent event)
{ {
} }
public void valueChange(ValueChangeEvent evt) public void valueChange(ValueChangeEvent evt)
{ {

View File

@ -59,10 +59,10 @@ import org.zkoss.zul.Vbox;
/** /**
* Search Order info and return selection * Search Order info and return selection
* Based on InfoOrder by Jorg Janke * Based on InfoOrder by Jorg Janke
* *
* @author Sendy Yagambrum * @author Sendy Yagambrum
* @date July 27, 2007 * @date July 27, 2007
* *
* Zk Port * Zk Port
* @author Elaine * @author Elaine
* @version InfoOrder.java Adempiere Swing UI 3.4.1 * @version InfoOrder.java Adempiere Swing UI 3.4.1
@ -70,7 +70,7 @@ import org.zkoss.zul.Vbox;
public class InfoOrderPanel extends InfoPanel implements ValueChangeListener public class InfoOrderPanel extends InfoPanel implements ValueChangeListener
{ {
/** /**
* *
*/ */
private static final long serialVersionUID = 8725276769956103867L; private static final long serialVersionUID = 8725276769956103867L;
private Label lblDocumentNo; private Label lblDocumentNo;
@ -78,23 +78,23 @@ public class InfoOrderPanel extends InfoPanel implements ValueChangeListener
private Label lblDateOrdered; private Label lblDateOrdered;
private Label lblOrderRef; private Label lblOrderRef;
private Label lblGrandTotal; private Label lblGrandTotal;
private Textbox txtDocumentNo; private Textbox txtDocumentNo;
private Textbox txtDescription; private Textbox txtDescription;
private Textbox txtOrderRef; private Textbox txtOrderRef;
private Datebox dateFrom; private Datebox dateFrom;
private Datebox dateTo; private Datebox dateTo;
private NumberBox amountFrom; private NumberBox amountFrom;
private NumberBox amountTo; private NumberBox amountTo;
private WSearchEditor editorBPartner; private WSearchEditor editorBPartner;
private Checkbox isSoTrx; private Checkbox isSoTrx;
private Borderlayout layout; private Borderlayout layout;
private Vbox southBody; private Vbox southBody;
/** Array of Column Info */ /** Array of Column Info */
private static final ColumnInfo[] s_invoiceLayout = { private static final ColumnInfo[] s_invoiceLayout = {
new ColumnInfo(" ", "o.C_Order_ID", IDColumn.class), new ColumnInfo(" ", "o.C_Order_ID", IDColumn.class),
@ -108,21 +108,21 @@ public class InfoOrderPanel extends InfoPanel implements ValueChangeListener
new ColumnInfo(Msg.translate(Env.getCtx(), "Description"), "o.Description", String.class), new ColumnInfo(Msg.translate(Env.getCtx(), "Description"), "o.Description", String.class),
new ColumnInfo(Msg.translate(Env.getCtx(), "POReference"), "o.POReference", String.class) 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) boolean multiSelection, String whereClause)
{ {
this(WindowNo, value, multiSelection, whereClause, true); this(WindowNo, value, multiSelection, whereClause, true);
} }
protected InfoOrderPanel(int WindowNo, String value, public InfoOrderPanel(int WindowNo, String value,
boolean multiSelection, String whereClause, boolean lookup) boolean multiSelection, String whereClause, boolean lookup)
{ {
super ( WindowNo, "o", "C_Order_ID", multiSelection, whereClause, lookup); super ( WindowNo, "o", "C_Order_ID", multiSelection, whereClause, lookup);
log.info( "InfoOrder"); log.info( "InfoOrder");
setTitle(Msg.getMsg(Env.getCtx(), "InfoOrder")); setTitle(Msg.getMsg(Env.getCtx(), "InfoOrder"));
// //
try try
{ {
initComponents(); initComponents();
@ -133,7 +133,7 @@ public class InfoOrderPanel extends InfoPanel implements ValueChangeListener
{ {
return; return;
} }
int no = contentPanel.getRowCount(); int no = contentPanel.getRowCount();
setStatusLine(Integer.toString(no) + " " + Msg.getMsg(Env.getCtx(), "SearchRows_EnterQuery"), false); setStatusLine(Integer.toString(no) + " " + Msg.getMsg(Env.getCtx(), "SearchRows_EnterQuery"), false);
setStatusDB(Integer.toString(no)); setStatusDB(Integer.toString(no));
@ -153,17 +153,17 @@ public class InfoOrderPanel extends InfoPanel implements ValueChangeListener
lblDateOrdered = new Label(Msg.translate(Env.getCtx(), "DateOrdered")); lblDateOrdered = new Label(Msg.translate(Env.getCtx(), "DateOrdered"));
lblOrderRef = new Label(Msg.translate(Env.getCtx(), "POReference")); lblOrderRef = new Label(Msg.translate(Env.getCtx(), "POReference"));
lblGrandTotal = new Label(Msg.translate(Env.getCtx(), "GrandTotal")); lblGrandTotal = new Label(Msg.translate(Env.getCtx(), "GrandTotal"));
txtDocumentNo = new Textbox(); txtDocumentNo = new Textbox();
txtDescription = new Textbox(); txtDescription = new Textbox();
txtOrderRef = new Textbox(); txtOrderRef = new Textbox();
dateFrom = new Datebox(); dateFrom = new Datebox();
dateTo= new Datebox(); dateTo= new Datebox();
amountFrom = new NumberBox(false); amountFrom = new NumberBox(false);
amountTo = new NumberBox(false); amountTo = new NumberBox(false);
isSoTrx = new Checkbox(); isSoTrx = new Checkbox();
isSoTrx.setLabel(Msg.translate(Env.getCtx(), "IsSOTrx")); isSoTrx.setLabel(Msg.translate(Env.getCtx(), "IsSOTrx"));
isSoTrx.setChecked(!"N".equals(Env.getContext(Env.getCtx(), p_WindowNo, "IsSOTrx"))); isSoTrx.setChecked(!"N".equals(Env.getContext(Env.getCtx(), p_WindowNo, "IsSOTrx")));
@ -172,9 +172,9 @@ public class InfoOrderPanel extends InfoPanel implements ValueChangeListener
editorBPartner = new WSearchEditor(lookupBP, Msg.translate( editorBPartner = new WSearchEditor(lookupBP, Msg.translate(
Env.getCtx(), "C_BPartner_ID"), "", true, false, true); Env.getCtx(), "C_BPartner_ID"), "", true, false, true);
editorBPartner.addValueChangeListener(this); editorBPartner.addValueChangeListener(this);
} }
public void init() public void init()
{ {
txtDocumentNo.setWidth("100%"); txtDocumentNo.setWidth("100%");
@ -184,12 +184,12 @@ public class InfoOrderPanel extends InfoPanel implements ValueChangeListener
dateTo.setWidth("165px"); dateTo.setWidth("165px");
amountFrom.getDecimalbox().setWidth("155px"); amountFrom.getDecimalbox().setWidth("155px");
amountTo.getDecimalbox().setWidth("155px"); amountTo.getDecimalbox().setWidth("155px");
Grid grid = GridFactory.newGridLayout(); Grid grid = GridFactory.newGridLayout();
Rows rows = new Rows(); Rows rows = new Rows();
grid.appendChild(rows); grid.appendChild(rows);
Row row = new Row(); Row row = new Row();
rows.appendChild(row); rows.appendChild(row);
row.appendChild(lblDocumentNo.rightAlign()); row.appendChild(lblDocumentNo.rightAlign());
@ -197,7 +197,7 @@ public class InfoOrderPanel extends InfoPanel implements ValueChangeListener
row.appendChild(editorBPartner.getLabel().rightAlign()); row.appendChild(editorBPartner.getLabel().rightAlign());
row.appendChild(editorBPartner.getComponent()); row.appendChild(editorBPartner.getComponent());
row.appendChild(isSoTrx); row.appendChild(isSoTrx);
row = new Row(); row = new Row();
row.setSpans("1, 1, 1, 2"); row.setSpans("1, 1, 1, 2");
rows.appendChild(row); rows.appendChild(row);
@ -209,7 +209,7 @@ public class InfoOrderPanel extends InfoPanel implements ValueChangeListener
hbox.appendChild(new Label("-")); hbox.appendChild(new Label("-"));
hbox.appendChild(dateTo); hbox.appendChild(dateTo);
row.appendChild(hbox); row.appendChild(hbox);
row = new Row(); row = new Row();
row.setSpans("1, 1, 1, 2"); row.setSpans("1, 1, 1, 2");
rows.appendChild(row); rows.appendChild(row);
@ -221,7 +221,7 @@ public class InfoOrderPanel extends InfoPanel implements ValueChangeListener
hbox.appendChild(new Label("-")); hbox.appendChild(new Label("-"));
hbox.appendChild(amountTo); hbox.appendChild(amountTo);
row.appendChild(hbox); row.appendChild(hbox);
layout = new Borderlayout(); layout = new Borderlayout();
layout.setWidth("100%"); layout.setWidth("100%");
layout.setHeight("100%"); layout.setHeight("100%");
@ -247,7 +247,7 @@ public class InfoOrderPanel extends InfoPanel implements ValueChangeListener
contentPanel.setVflex(true); contentPanel.setVflex(true);
div.setStyle("width :100%; height: 100%"); div.setStyle("width :100%; height: 100%");
center.appendChild(div); center.appendChild(div);
South south = new South(); South south = new South();
layout.appendChild(south); layout.appendChild(south);
southBody = new Vbox(); southBody = new Vbox();
@ -301,7 +301,7 @@ public class InfoOrderPanel extends InfoPanel implements ValueChangeListener
} }
catch (WrongValueException e) catch (WrongValueException e)
{ {
} }
try try
{ {
@ -309,7 +309,7 @@ public class InfoOrderPanel extends InfoPanel implements ValueChangeListener
} }
catch (WrongValueException e) catch (WrongValueException e)
{ {
} }
if (fromDate == null && toDate != null) if (fromDate == null && toDate != null)
{ {
@ -320,7 +320,7 @@ public class InfoOrderPanel extends InfoPanel implements ValueChangeListener
sql.append(" AND TRUNC(o.DateOrdered) >= ?"); sql.append(" AND TRUNC(o.DateOrdered) >= ?");
} }
else if (fromDate != null && toDate != null) else if (fromDate != null && toDate != null)
{ {
sql.append(" AND TRUNC(o.DateOrdered) BETWEEN ? AND ?"); sql.append(" AND TRUNC(o.DateOrdered) BETWEEN ? AND ?");
} }
// //
@ -334,7 +334,7 @@ public class InfoOrderPanel extends InfoPanel implements ValueChangeListener
} }
catch (NumberFormatException e) catch (NumberFormatException e)
{ {
} }
} }
if (amountTo.getText() != null && amountTo.getText().trim().length() > 0) if (amountTo.getText() != null && amountTo.getText().trim().length() > 0)
@ -345,7 +345,7 @@ public class InfoOrderPanel extends InfoPanel implements ValueChangeListener
} }
catch (NumberFormatException e) catch (NumberFormatException e)
{ {
} }
} }
if (fromAmount == null && toAmount != null) if (fromAmount == null && toAmount != null)
@ -384,7 +384,7 @@ public class InfoOrderPanel extends InfoPanel implements ValueChangeListener
log.fine("BPartner=" + bp); log.fine("BPartner=" + bp);
} }
// //
Date fromD = null; Date fromD = null;
Date toD = null; Date toD = null;
Timestamp from = null; Timestamp from = null;
@ -399,7 +399,7 @@ public class InfoOrderPanel extends InfoPanel implements ValueChangeListener
} }
catch (WrongValueException e) catch (WrongValueException e)
{ {
} }
try try
{ {
@ -411,9 +411,9 @@ public class InfoOrderPanel extends InfoPanel implements ValueChangeListener
} }
catch (WrongValueException e) catch (WrongValueException e)
{ {
} }
log.fine("Date From=" + from + ", To=" + to); log.fine("Date From=" + from + ", To=" + to);
if (from == null && to != null) if (from == null && to != null)
{ {
@ -428,13 +428,13 @@ public class InfoOrderPanel extends InfoPanel implements ValueChangeListener
pstmt.setTimestamp(index++, from); pstmt.setTimestamp(index++, from);
pstmt.setTimestamp(index++, to); pstmt.setTimestamp(index++, to);
} }
// //
BigDecimal fromBD = null; BigDecimal fromBD = null;
BigDecimal toBD = null; BigDecimal toBD = null;
Double fromAmt = null; Double fromAmt = null;
Double toAmt = null; Double toAmt = null;
if (amountFrom.getText() != null && amountFrom.getText().trim().length() > 0) if (amountFrom.getText() != null && amountFrom.getText().trim().length() > 0)
{ {
try try
@ -444,10 +444,10 @@ public class InfoOrderPanel extends InfoPanel implements ValueChangeListener
} }
catch (Exception e) catch (Exception e)
{ {
} }
} }
if (amountTo.getText() != null && amountTo.getText().trim().length() > 0) if (amountTo.getText() != null && amountTo.getText().trim().length() > 0)
{ {
try try
@ -457,10 +457,10 @@ public class InfoOrderPanel extends InfoPanel implements ValueChangeListener
} }
catch (Exception e) catch (Exception e)
{ {
} }
} }
if (fromBD == null && toBD != null) if (fromBD == null && toBD != null)
{ {
pstmt.setBigDecimal(index++, toBD); pstmt.setBigDecimal(index++, toBD);
@ -474,9 +474,9 @@ public class InfoOrderPanel extends InfoPanel implements ValueChangeListener
pstmt.setBigDecimal(index++, fromBD); pstmt.setBigDecimal(index++, fromBD);
pstmt.setBigDecimal(index++, toBD); pstmt.setBigDecimal(index++, toBD);
} }
pstmt.setString(index++, isSoTrx.isChecked() ? "Y" : "N"); pstmt.setString(index++, isSoTrx.isChecked() ? "Y" : "N");
} }
/** /**
@ -492,7 +492,7 @@ public class InfoOrderPanel extends InfoPanel implements ValueChangeListener
log.fine("String=" + s); log.fine("String=" + s);
return s; return s;
} // getSQLText } // getSQLText
// Elaine 2008/12/16 // Elaine 2008/12/16
/** /**
* Zoom * Zoom
@ -522,16 +522,16 @@ public class InfoOrderPanel extends InfoPanel implements ValueChangeListener
public void tableChanged(WTableModelEvent event) public void tableChanged(WTableModelEvent event)
{ {
} }
public void valueChange(ValueChangeEvent evt) public void valueChange(ValueChangeEvent evt)
{ {
if (editorBPartner.equals(evt.getSource())) if (editorBPartner.equals(evt.getSource()))
{ {
editorBPartner.setValue(evt.getNewValue()); editorBPartner.setValue(evt.getNewValue());
} }
} }
@Override @Override

View File

@ -41,10 +41,20 @@ import org.adempiere.webui.event.ValueChangeEvent;
import org.adempiere.webui.event.ValueChangeListener; import org.adempiere.webui.event.ValueChangeListener;
import org.adempiere.webui.event.WTableModelEvent; import org.adempiere.webui.event.WTableModelEvent;
import org.adempiere.webui.event.WTableModelListener; import org.adempiere.webui.event.WTableModelListener;
import org.adempiere.webui.factory.InfoManager;
import org.adempiere.webui.part.ITabOnSelectHandler; import org.adempiere.webui.part.ITabOnSelectHandler;
import org.adempiere.webui.session.SessionManager; import org.adempiere.webui.session.SessionManager;
import org.compiere.minigrid.ColumnInfo; import org.compiere.minigrid.ColumnInfo;
import org.compiere.minigrid.IDColumn; 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.MRole;
import org.compiere.model.MTable; import org.compiere.model.MTable;
import org.compiere.util.CLogger; import org.compiere.util.CLogger;
@ -67,71 +77,37 @@ import org.zkoss.zul.event.ZulEvents;
/** /**
* Search Information and return selection - Base Class. * Search Information and return selection - Base Class.
* Based on Info written by Jorg Janke * Based on Info written by Jorg Janke
* *
* @author Sendy Yagambrum * @author Sendy Yagambrum
* *
* Zk Port * Zk Port
* @author Elaine * @author Elaine
* @version Info.java Adempiere Swing UI 3.4.1 * @version Info.java Adempiere Swing UI 3.4.1
*/ */
public abstract class InfoPanel extends Window implements EventListener, WTableModelListener, ListModelExt public abstract class InfoPanel extends Window implements EventListener, WTableModelListener, ListModelExt
{ {
/** /**
* generated serial version ID * generated serial version ID
*/ */
private static final long serialVersionUID = 325050327514511004L; private static final long serialVersionUID = 325050327514511004L;
private final static int PAGE_SIZE = 100; private final static int PAGE_SIZE = 100;
public static InfoPanel create (int WindowNo, public static InfoPanel create (int WindowNo,
String tableName, String keyColumn, String value, String tableName, String keyColumn, String value,
boolean multiSelection, String whereClause) boolean multiSelection, String whereClause)
{ {
InfoPanel info = null; return InfoManager.create(WindowNo, tableName, keyColumn, value, multiSelection, whereClause, true);
}
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;
}
/** /**
* Show BPartner Info (non modal) * Show BPartner Info (non modal)
* @param WindowNo window no * @param WindowNo window no
*/ */
public static void showBPartner (int WindowNo) public static void showBPartner (int WindowNo)
{ {
InfoBPartnerPanel info = new InfoBPartnerPanel ( "", WindowNo, InfoPanel info = InfoManager.create(WindowNo, I_C_BPartner.Table_Name,
!Env.getContext(Env.getCtx(),"IsSOTrx").equals("N"),false, "", false); I_C_BPartner.COLUMNNAME_C_BPartner_ID, "", false, "", false);
AEnv.showWindow(info); AEnv.showWindow(info);
} // showBPartner } // showBPartner
@ -142,7 +118,8 @@ public abstract class InfoPanel extends Window implements EventListener, WTableM
*/ */
public static void showAsset (int WindowNo) 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); AEnv.showWindow(info);
} // showBPartner } // showBPartner
@ -153,13 +130,11 @@ public abstract class InfoPanel extends Window implements EventListener, WTableM
*/ */
public static void showProduct (int WindowNo) public static void showProduct (int WindowNo)
{ {
InfoPanel info = new InfoProductPanel(WindowNo, InfoPanel info = InfoManager.create(WindowNo,
Env.getContextAsInt(Env.getCtx(), WindowNo, "M_Warehouse_ID"), I_M_Product.Table_Name, I_M_Product.COLUMNNAME_M_Product_ID, "", false, "", false);
Env.getContextAsInt(Env.getCtx(), WindowNo, "M_PriceList_ID"),
false, "", "", false);
AEnv.showWindow(info); AEnv.showWindow(info);
} // showProduct } // showProduct
/** /**
* Show Order Info (non modal) * Show Order Info (non modal)
* @param frame Parent Frame * @param frame Parent Frame
@ -168,7 +143,8 @@ public abstract class InfoPanel extends Window implements EventListener, WTableM
*/ */
public static void showOrder (int WindowNo, String value) 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); AEnv.showWindow(info);
} // showOrder } // showOrder
@ -180,7 +156,8 @@ public abstract class InfoPanel extends Window implements EventListener, WTableM
*/ */
public static void showInvoice (int WindowNo, String value) 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); AEnv.showWindow(info);
} // showInvoice } // showInvoice
@ -192,8 +169,8 @@ public abstract class InfoPanel extends Window implements EventListener, WTableM
*/ */
public static void showInOut (int WindowNo, String value) public static void showInOut (int WindowNo, String value)
{ {
InfoPanel info = new InfoInOutPanel (WindowNo, value, InfoPanel info = InfoManager.create(WindowNo,
false, "", false); I_M_InOut.Table_Name, I_M_InOut.COLUMNNAME_M_InOut_ID, "", false, "", false);
AEnv.showWindow(info); AEnv.showWindow(info);
} // showInOut } // showInOut
@ -205,8 +182,8 @@ public abstract class InfoPanel extends Window implements EventListener, WTableM
*/ */
public static void showPayment (int WindowNo, String value) public static void showPayment (int WindowNo, String value)
{ {
InfoPanel info = new InfoPaymentPanel (WindowNo, value, InfoPanel info = InfoManager.create(WindowNo,
false, "", false); I_C_Payment.Table_Name, I_C_Payment.COLUMNNAME_C_Payment_ID, "", false, "", false);
AEnv.showWindow(info); AEnv.showWindow(info);
} // showPayment } // showPayment
@ -218,8 +195,8 @@ public abstract class InfoPanel extends Window implements EventListener, WTableM
*/ */
public static void showCashLine (int WindowNo, String value) public static void showCashLine (int WindowNo, String value)
{ {
InfoPanel info = new InfoCashLinePanel (WindowNo, value, InfoPanel info = InfoManager.create(WindowNo,
false, "", false); I_C_CashLine.Table_Name, I_C_CashLine.COLUMNNAME_C_CashLine_ID, "", false, "", false);
AEnv.showWindow(info); AEnv.showWindow(info);
} // showCashLine } // showCashLine
@ -231,8 +208,8 @@ public abstract class InfoPanel extends Window implements EventListener, WTableM
*/ */
public static void showAssignment (int WindowNo, String value) public static void showAssignment (int WindowNo, String value)
{ {
InfoPanel info = new InfoAssignmentPanel (WindowNo, value, InfoPanel info = InfoManager.create(WindowNo,
false, "", false); I_S_ResourceAssignment.Table_Name, I_S_ResourceAssignment.COLUMNNAME_S_ResourceAssignment_ID, "", false, "", false);
AEnv.showWindow(info); AEnv.showWindow(info);
} // showAssignment } // showAssignment
@ -241,10 +218,10 @@ public abstract class InfoPanel extends Window implements EventListener, WTableM
private boolean m_lookup; private boolean m_lookup;
/************************************************** /**************************************************
* Detail Constructor * Detail Constructor
* @param WindowNo WindowNo * @param WindowNo WindowNo
* @param tableName tableName * @param tableName tableName
* @param keyColumn keyColumn * @param keyColumn keyColumn
* @param whereClause whereClause * @param whereClause whereClause
*/ */
protected InfoPanel (int WindowNo, protected InfoPanel (int WindowNo,
@ -253,7 +230,7 @@ public abstract class InfoPanel extends Window implements EventListener, WTableM
{ {
this(WindowNo, tableName, keyColumn, multipleSelection, whereClause, true); this(WindowNo, tableName, keyColumn, multipleSelection, whereClause, true);
} }
/************************************************** /**************************************************
* Detail Constructor * Detail Constructor
* @param WindowNo WindowNo * @param WindowNo WindowNo
@ -272,7 +249,7 @@ public abstract class InfoPanel extends Window implements EventListener, WTableM
p_keyColumn = keyColumn; p_keyColumn = keyColumn;
p_multipleSelection = multipleSelection; p_multipleSelection = multipleSelection;
m_lookup = lookup; m_lookup = lookup;
if (whereClause == null || whereClause.indexOf('@') == -1) if (whereClause == null || whereClause.indexOf('@') == -1)
p_whereClause = whereClause; p_whereClause = whereClause;
else else
@ -282,14 +259,14 @@ public abstract class InfoPanel extends Window implements EventListener, WTableM
log.log(Level.SEVERE, "Cannot parse context= " + whereClause); log.log(Level.SEVERE, "Cannot parse context= " + whereClause);
} }
init(); init();
this.setAttribute(ITabOnSelectHandler.ATTRIBUTE_KEY, new ITabOnSelectHandler() { this.setAttribute(ITabOnSelectHandler.ATTRIBUTE_KEY, new ITabOnSelectHandler() {
public void onSelect() { public void onSelect() {
scrollToSelectedRow(); scrollToSelectedRow();
} }
}); });
} // InfoPanel } // InfoPanel
private void init() private void init()
{ {
if (isLookup()) if (isLookup())
@ -311,24 +288,24 @@ public abstract class InfoPanel extends Window implements EventListener, WTableM
setHeight("100%"); setHeight("100%");
setStyle("position: absolute"); setStyle("position: absolute");
} }
confirmPanel = new ConfirmPanel(true, true, false, true, true, true); // Elaine 2008/12/16 confirmPanel = new ConfirmPanel(true, true, false, true, true, true); // Elaine 2008/12/16
confirmPanel.addActionListener(Events.ON_CLICK, this); confirmPanel.addActionListener(Events.ON_CLICK, this);
confirmPanel.setStyle("border-top: 2px groove #444; padding-top: 4px"); confirmPanel.setStyle("border-top: 2px groove #444; padding-top: 4px");
// Elaine 2008/12/16 // Elaine 2008/12/16
confirmPanel.getButton(ConfirmPanel.A_CUSTOMIZE).setVisible(hasCustomize()); confirmPanel.getButton(ConfirmPanel.A_CUSTOMIZE).setVisible(hasCustomize());
confirmPanel.getButton(ConfirmPanel.A_HISTORY).setVisible(hasHistory()); confirmPanel.getButton(ConfirmPanel.A_HISTORY).setVisible(hasHistory());
confirmPanel.getButton(ConfirmPanel.A_ZOOM).setVisible(hasZoom()); confirmPanel.getButton(ConfirmPanel.A_ZOOM).setVisible(hasZoom());
// //
if (!isLookup()) if (!isLookup())
{ {
confirmPanel.getButton(ConfirmPanel.A_OK).setVisible(false); confirmPanel.getButton(ConfirmPanel.A_OK).setVisible(false);
} }
this.setSizable(true); this.setSizable(true);
this.setMaximizable(true); this.setMaximizable(true);
this.addEventListener(Events.ON_OK, this); this.addEventListener(Events.ON_OK, this);
contentPanel.setOddRowSclass(null); contentPanel.setOddRowSclass(null);
@ -353,7 +330,7 @@ public abstract class InfoPanel extends Window implements EventListener, WTableM
private boolean m_cancel = false; private boolean m_cancel = false;
/** Result IDs */ /** Result IDs */
private ArrayList<Integer> m_results = new ArrayList<Integer>(3); private ArrayList<Integer> m_results = new ArrayList<Integer>(3);
private ListModelTable model; private ListModelTable model;
/** Layout of Grid */ /** Layout of Grid */
protected ColumnInfo[] p_layout; protected ColumnInfo[] p_layout;
@ -375,7 +352,7 @@ public abstract class InfoPanel extends Window implements EventListener, WTableM
/** Logger */ /** Logger */
protected CLogger log = CLogger.getCLogger(getClass()); protected CLogger log = CLogger.getCLogger(getClass());
protected WListbox contentPanel = new WListbox(); protected WListbox contentPanel = new WListbox();
protected Paging paging; protected Paging paging;
protected int pageNo; protected int pageNo;
@ -384,7 +361,7 @@ public abstract class InfoPanel extends Window implements EventListener, WTableM
private int cacheEnd; private int cacheEnd;
private boolean m_useDatabasePaging = false; private boolean m_useDatabasePaging = false;
private BusyDialog progressWindow; private BusyDialog progressWindow;
private static final String[] lISTENER_EVENTS = {}; private static final String[] lISTENER_EVENTS = {};
/** /**
@ -415,9 +392,9 @@ public abstract class InfoPanel extends Window implements EventListener, WTableM
statusBar.setStatusDB(text); statusBar.setStatusDB(text);
} // setStatusDB } // setStatusDB
protected void prepareTable (ColumnInfo[] layout, protected void prepareTable (ColumnInfo[] layout,
String from, String from,
String where, String where,
String orderBy) String orderBy)
{ {
String sql =contentPanel.prepareTable(layout, from, String sql =contentPanel.prepareTable(layout, from,
@ -430,10 +407,10 @@ public abstract class InfoPanel extends Window implements EventListener, WTableM
m_sqlOrder = ""; m_sqlOrder = "";
m_sqlUserOrder = ""; m_sqlUserOrder = "";
if (orderBy != null && orderBy.length() > 0) if (orderBy != null && orderBy.length() > 0)
m_sqlOrder = " ORDER BY " + orderBy; m_sqlOrder = " ORDER BY " + orderBy;
} // prepareTable } // prepareTable
/************************************************************************** /**************************************************************************
* Execute Query * Execute Query
*/ */
@ -446,7 +423,7 @@ public abstract class InfoPanel extends Window implements EventListener, WTableM
testCount(); testCount();
m_useDatabasePaging = (m_count > 1000); m_useDatabasePaging = (m_count > 1000);
if (m_useDatabasePaging) if (m_useDatabasePaging)
{ {
return ; return ;
} }
else else
@ -454,7 +431,7 @@ public abstract class InfoPanel extends Window implements EventListener, WTableM
readLine(0, -1); readLine(0, -1);
} }
} }
private void readData(ResultSet rs) throws SQLException { private void readData(ResultSet rs) throws SQLException {
int colOffset = 1; // columns start with 1 int colOffset = 1; // columns start with 1
List<Object> data = new ArrayList<Object>(); List<Object> data = new ArrayList<Object>();
@ -466,7 +443,7 @@ public abstract class InfoPanel extends Window implements EventListener, WTableM
if (c == IDColumn.class) if (c == IDColumn.class)
{ {
value = new IDColumn(rs.getInt(colIndex)); value = new IDColumn(rs.getInt(colIndex));
} }
else if (c == Boolean.class) else if (c == Boolean.class)
value = new Boolean("Y".equals(rs.getString(colIndex))); value = new Boolean("Y".equals(rs.getString(colIndex)));
@ -494,14 +471,14 @@ public abstract class InfoPanel extends Window implements EventListener, WTableM
} }
line.add(data); line.add(data);
} }
protected void renderItems() protected void renderItems()
{ {
if (m_count > 0) if (m_count > 0)
{ {
if (m_count > PAGE_SIZE) if (m_count > PAGE_SIZE)
{ {
if (paging == null) if (paging == null)
{ {
paging = new Paging(); paging = new Paging();
paging.setPageSize(PAGE_SIZE); paging.setPageSize(PAGE_SIZE);
@ -520,12 +497,12 @@ public abstract class InfoPanel extends Window implements EventListener, WTableM
model.setSorter(this); model.setSorter(this);
model.addTableModelListener(this); model.addTableModelListener(this);
contentPanel.setData(model, null); contentPanel.setData(model, null);
pageNo = 0; pageNo = 0;
} }
else else
{ {
if (paging != null) if (paging != null)
{ {
paging.setTotalSize(m_count); paging.setTotalSize(m_count);
paging.setActivePage(0); paging.setActivePage(0);
@ -540,10 +517,10 @@ public abstract class InfoPanel extends Window implements EventListener, WTableM
int no = m_count; int no = m_count;
setStatusLine(Integer.toString(no) + " " + Msg.getMsg(Env.getCtx(), "SearchRows_EnterQuery"), false); setStatusLine(Integer.toString(no) + " " + Msg.getMsg(Env.getCtx(), "SearchRows_EnterQuery"), false);
setStatusDB(Integer.toString(no)); setStatusDB(Integer.toString(no));
addDoubleClickListener(); addDoubleClickListener();
} }
private List<Object> readLine(int start, int end) { private List<Object> readLine(int start, int end) {
//cacheStart & cacheEnd - 1 based index, start & end - 0 based index //cacheStart & cacheEnd - 1 based index, start & end - 0 based index
if (cacheStart >= 1 && cacheEnd > cacheStart) if (cacheStart >= 1 && cacheEnd > cacheStart)
@ -660,15 +637,15 @@ public abstract class InfoPanel extends Window implements EventListener, WTableM
} }
contentPanel.addEventListener(Events.ON_DOUBLE_CLICK, this); contentPanel.addEventListener(Events.ON_DOUBLE_CLICK, this);
} }
protected void insertPagingComponent() { protected void insertPagingComponent() {
contentPanel.getParent().insertBefore(paging, contentPanel.getNextSibling()); contentPanel.getParent().insertBefore(paging, contentPanel.getNextSibling());
} }
public Vector<String> getColumnHeader(ColumnInfo[] p_layout) public Vector<String> getColumnHeader(ColumnInfo[] p_layout)
{ {
Vector<String> columnHeader = new Vector<String>(); Vector<String> columnHeader = new Vector<String>();
for (ColumnInfo info: p_layout) for (ColumnInfo info: p_layout)
{ {
columnHeader.add(info.getColHeader()); columnHeader.add(info.getColHeader());
@ -684,25 +661,25 @@ public abstract class InfoPanel extends Window implements EventListener, WTableM
long start = System.currentTimeMillis(); long start = System.currentTimeMillis();
String dynWhere = getSQLWhere(); String dynWhere = getSQLWhere();
StringBuffer sql = new StringBuffer (m_sqlCount); StringBuffer sql = new StringBuffer (m_sqlCount);
if (dynWhere.length() > 0) if (dynWhere.length() > 0)
sql.append(dynWhere); // includes first AND sql.append(dynWhere); // includes first AND
String countSql = Msg.parseTranslation(Env.getCtx(), sql.toString()); // Variables String countSql = Msg.parseTranslation(Env.getCtx(), sql.toString()); // Variables
countSql = MRole.getDefault().addAccessSQL (countSql, getTableName(), countSql = MRole.getDefault().addAccessSQL (countSql, getTableName(),
MRole.SQL_FULLYQUALIFIED, MRole.SQL_RO); MRole.SQL_FULLYQUALIFIED, MRole.SQL_RO);
log.finer(countSql); log.finer(countSql);
m_count = -1; m_count = -1;
try try
{ {
PreparedStatement pstmt = DB.prepareStatement(countSql, null); PreparedStatement pstmt = DB.prepareStatement(countSql, null);
setParameters (pstmt, true); setParameters (pstmt, true);
ResultSet rs = pstmt.executeQuery(); ResultSet rs = pstmt.executeQuery();
if (rs.next()) if (rs.next())
m_count = rs.getInt(1); m_count = rs.getInt(1);
rs.close(); rs.close();
pstmt.close(); pstmt.close();
} }
@ -711,17 +688,17 @@ public abstract class InfoPanel extends Window implements EventListener, WTableM
log.log(Level.SEVERE, countSql, e); log.log(Level.SEVERE, countSql, e);
m_count = -2; m_count = -2;
} }
log.fine("#" + m_count + " - " + (System.currentTimeMillis()-start) + "ms"); log.fine("#" + m_count + " - " + (System.currentTimeMillis()-start) + "ms");
//Armen: add role checking (Patch #1694788 ) //Armen: add role checking (Patch #1694788 )
//MRole role = MRole.getDefault(); //MRole role = MRole.getDefault();
//if (role.isQueryMax(no)) //if (role.isQueryMax(no))
// return ADialog.ask(p_WindowNo, this, "InfoHighRecordCount", String.valueOf(no)); // return ADialog.ask(p_WindowNo, this, "InfoHighRecordCount", String.valueOf(no));
return true; return true;
} // testCount } // testCount
/** /**
* Save Selection - Called by dispose * Save Selection - Called by dispose
@ -733,7 +710,7 @@ public abstract class InfoPanel extends Window implements EventListener, WTableM
return; return;
log.config( "OK=" + m_ok); log.config( "OK=" + m_ok);
if (!m_ok) // did not press OK if (!m_ok) // did not press OK
{ {
m_results.clear(); m_results.clear();
@ -753,12 +730,12 @@ public abstract class InfoPanel extends Window implements EventListener, WTableM
if (data != null) if (data != null)
m_results.add(data); m_results.add(data);
} }
log.config(getSelectedSQL()); log.config(getSelectedSQL());
// Save Settings of detail info screens // Save Settings of detail info screens
saveSelectionDetail(); saveSelectionDetail();
} // saveSelection } // saveSelection
/** /**
@ -768,10 +745,10 @@ public abstract class InfoPanel extends Window implements EventListener, WTableM
protected Integer getSelectedRowKey() protected Integer getSelectedRowKey()
{ {
Integer key = contentPanel.getSelectedRowKey(); Integer key = contentPanel.getSelectedRowKey();
return key; return key;
} // getSelectedRowKey } // getSelectedRowKey
/** /**
* Get the keys of selected row/s based on layout defined in prepareTable * Get the keys of selected row/s based on layout defined in prepareTable
* @return IDs if selection present * @return IDs if selection present
@ -780,12 +757,12 @@ public abstract class InfoPanel extends Window implements EventListener, WTableM
protected ArrayList<Integer> getSelectedRowKeys() protected ArrayList<Integer> getSelectedRowKeys()
{ {
ArrayList<Integer> selectedDataList = new ArrayList<Integer>(); ArrayList<Integer> selectedDataList = new ArrayList<Integer>();
if (contentPanel.getKeyColumnIndex() == -1) if (contentPanel.getKeyColumnIndex() == -1)
{ {
return selectedDataList; return selectedDataList;
} }
if (p_multipleSelection) if (p_multipleSelection)
{ {
int[] rows = contentPanel.getSelectedIndices(); int[] rows = contentPanel.getSelectedIndices();
@ -803,7 +780,7 @@ public abstract class InfoPanel extends Window implements EventListener, WTableM
} }
} }
} }
if (selectedDataList.size() == 0) if (selectedDataList.size() == 0)
{ {
int row = contentPanel.getSelectedRow(); int row = contentPanel.getSelectedRow();
@ -816,7 +793,7 @@ public abstract class InfoPanel extends Window implements EventListener, WTableM
selectedDataList.add((Integer)data); selectedDataList.add((Integer)data);
} }
} }
return selectedDataList; return selectedDataList;
} // getSelectedRowKeys } // getSelectedRowKeys
@ -863,7 +840,7 @@ public abstract class InfoPanel extends Window implements EventListener, WTableM
Object[] keys = getSelectedKeys(); Object[] keys = getSelectedKeys();
if (keys == null || keys.length == 0) if (keys == null || keys.length == 0)
{ {
log.config("No Results - OK=" log.config("No Results - OK="
+ m_ok + ", Cancel=" + m_cancel); + m_ok + ", Cancel=" + m_cancel);
return ""; return "";
} }
@ -889,8 +866,8 @@ public abstract class InfoPanel extends Window implements EventListener, WTableM
return sb.toString(); return sb.toString();
} // getSelectedSQL; } // getSelectedSQL;
/** /**
* Get Table name Synonym * Get Table name Synonym
* @return table name * @return table name
@ -909,12 +886,12 @@ public abstract class InfoPanel extends Window implements EventListener, WTableM
return p_keyColumn; return p_keyColumn;
} // getKeyColumn } // getKeyColumn
public String[] getEvents() public String[] getEvents()
{ {
return InfoPanel.lISTENER_EVENTS; return InfoPanel.lISTENER_EVENTS;
} }
// Elaine 2008/11/28 // Elaine 2008/11/28
/** /**
* Enable OK, History, Zoom if row/s selected * Enable OK, History, Zoom if row/s selected
@ -926,21 +903,21 @@ public abstract class InfoPanel extends Window implements EventListener, WTableM
{ {
boolean enable = (contentPanel.getSelectedCount() == 1); boolean enable = (contentPanel.getSelectedCount() == 1);
confirmPanel.getOKButton().setEnabled(contentPanel.getSelectedCount() > 0); confirmPanel.getOKButton().setEnabled(contentPanel.getSelectedCount() > 0);
if (hasHistory()) if (hasHistory())
confirmPanel.getButton(ConfirmPanel.A_HISTORY).setEnabled(enable); confirmPanel.getButton(ConfirmPanel.A_HISTORY).setEnabled(enable);
if (hasZoom()) if (hasZoom())
confirmPanel.getButton(ConfirmPanel.A_ZOOM).setEnabled(enable); confirmPanel.getButton(ConfirmPanel.A_ZOOM).setEnabled(enable);
} // enableButtons } // enableButtons
// //
/************************************************************************** /**************************************************************************
* Get dynamic WHERE part of SQL * Get dynamic WHERE part of SQL
* To be overwritten by concrete classes * To be overwritten by concrete classes
* @return WHERE clause * @return WHERE clause
*/ */
protected abstract String getSQLWhere(); protected abstract String getSQLWhere();
/** /**
* Set Parameters for Query * Set Parameters for Query
* To be overwritten by concrete classes * To be overwritten by concrete classes
@ -948,7 +925,7 @@ public abstract class InfoPanel extends Window implements EventListener, WTableM
* @param forCount for counting records * @param forCount for counting records
* @throws SQLException * @throws SQLException
*/ */
protected abstract void setParameters (PreparedStatement pstmt, boolean forCount) protected abstract void setParameters (PreparedStatement pstmt, boolean forCount)
throws SQLException; throws SQLException;
/** /**
* notify to search editor of a value change in the selection info * notify to search editor of a value change in the selection info
@ -1034,7 +1011,7 @@ public abstract class InfoPanel extends Window implements EventListener, WTableM
return m_PO_Window_ID; return m_PO_Window_ID;
return m_SO_Window_ID; return m_SO_Window_ID;
} // getAD_Window_ID } // getAD_Window_ID
public void onEvent(Event event) public void onEvent(Event event)
{ {
if (event!=null) if (event!=null)
@ -1085,11 +1062,11 @@ public abstract class InfoPanel extends Window implements EventListener, WTableM
else if (event.getTarget() == paging) else if (event.getTarget() == paging)
{ {
int pgNo = paging.getActivePage(); int pgNo = paging.getActivePage();
if (pageNo != pgNo) if (pageNo != pgNo)
{ {
contentPanel.clearSelection(); contentPanel.clearSelection();
pageNo = pgNo; pageNo = pgNo;
int start = pageNo * PAGE_SIZE; int start = pageNo * PAGE_SIZE;
int end = start + PAGE_SIZE; int end = start + PAGE_SIZE;
@ -1100,7 +1077,7 @@ public abstract class InfoPanel extends Window implements EventListener, WTableM
model.setSorter(this); model.setSorter(this);
model.addTableModelListener(this); model.addTableModelListener(this);
contentPanel.setData(model, null); contentPanel.setData(model, null);
contentPanel.setSelectedIndex(0); contentPanel.setSelectedIndex(0);
} }
} }
@ -1145,15 +1122,15 @@ public abstract class InfoPanel extends Window implements EventListener, WTableM
hideBusyDialog(); hideBusyDialog();
} }
} }
private void onOk() private void onOk()
{ {
if (!contentPanel.getChildren().isEmpty() && contentPanel.getSelectedRowKey()!=null) if (!contentPanel.getChildren().isEmpty() && contentPanel.getSelectedRowKey()!=null)
{ {
dispose(true); dispose(true);
} }
} }
private void onDoubleClick() private void onDoubleClick()
{ {
if (isLookup()) if (isLookup())
@ -1171,7 +1148,7 @@ public abstract class InfoPanel extends Window implements EventListener, WTableM
{ {
enableButtons(); enableButtons();
} }
public void zoom() public void zoom()
{ {
if (listeners != null && listeners.size() > 0) if (listeners != null && listeners.size() > 0)
@ -1186,7 +1163,7 @@ public abstract class InfoPanel extends Window implements EventListener, WTableM
int AD_Table_ID = MTable.getTable_ID(p_tableName); int AD_Table_ID = MTable.getTable_ID(p_tableName);
if (AD_Table_ID <= 0) if (AD_Table_ID <= 0)
{ {
if (p_keyColumn.endsWith("_ID")) if (p_keyColumn.endsWith("_ID"))
{ {
AD_Table_ID = MTable.getTable_ID(p_keyColumn.substring(0, p_keyColumn.length() - 3)); AD_Table_ID = MTable.getTable_ID(p_keyColumn.substring(0, p_keyColumn.length() - 3));
} }
@ -1195,17 +1172,17 @@ public abstract class InfoPanel extends Window implements EventListener, WTableM
AEnv.zoom(AD_Table_ID, recordId); AEnv.zoom(AD_Table_ID, recordId);
} }
} }
public void addValueChangeListener(ValueChangeListener listener) public void addValueChangeListener(ValueChangeListener listener)
{ {
if (listener == null) if (listener == null)
{ {
return; return;
} }
listeners.add(listener); listeners.add(listener);
} }
public void fireValueChange(ValueChangeEvent event) public void fireValueChange(ValueChangeEvent event)
{ {
for (ValueChangeListener listener : listeners) for (ValueChangeListener listener : listeners)
@ -1232,7 +1209,7 @@ public abstract class InfoPanel extends Window implements EventListener, WTableM
else else
this.detach(); this.detach();
} // dispose } // dispose
public void sort(Comparator cmpr, boolean ascending) { public void sort(Comparator cmpr, boolean ascending) {
WListItemRenderer.ColumnComparator lsc = (WListItemRenderer.ColumnComparator) cmpr; WListItemRenderer.ColumnComparator lsc = (WListItemRenderer.ColumnComparator) cmpr;
if (m_useDatabasePaging) if (m_useDatabasePaging)

View File

@ -58,10 +58,10 @@ import org.zkoss.zul.Vbox;
/** /**
* Based on InfoPayment written by Jorg Janke * Based on InfoPayment written by Jorg Janke
* *
* @author Niraj Sohun * @author Niraj Sohun
* Aug, 02, 2007 * Aug, 02, 2007
* *
* Zk Port * Zk Port
* @author Elaine * @author Elaine
* @version InfoPayment.java Adempiere Swing UI 3.4.1 * @version InfoPayment.java Adempiere Swing UI 3.4.1
@ -70,7 +70,7 @@ import org.zkoss.zul.Vbox;
public class InfoPaymentPanel extends InfoPanel implements ValueChangeListener, EventListener public class InfoPaymentPanel extends InfoPanel implements ValueChangeListener, EventListener
{ {
/** /**
* *
*/ */
private static final long serialVersionUID = -7346527589727807179L; private static final long serialVersionUID = -7346527589727807179L;
private Textbox fDocumentNo = new Textbox(); private Textbox fDocumentNo = new Textbox();
@ -83,7 +83,7 @@ public class InfoPaymentPanel extends InfoPanel implements ValueChangeListener,
private Datebox fDateFrom = new Datebox(); private Datebox fDateFrom = new Datebox();
private Checkbox fIsReceipt = new Checkbox(); private Checkbox fIsReceipt = new Checkbox();
private Label lDocumentNo = new Label(Msg.translate(Env.getCtx(), "DocumentNo")); private Label lDocumentNo = new Label(Msg.translate(Env.getCtx(), "DocumentNo"));
private Label lDateFrom = new Label(Msg.translate(Env.getCtx(), "DateTrx")); private Label lDateFrom = new Label(Msg.translate(Env.getCtx(), "DateTrx"));
private Label lDateTo = new Label("-"); private Label lDateTo = new Label("-");
@ -118,22 +118,7 @@ public class InfoPaymentPanel extends InfoPanel implements ValueChangeListener,
new ColumnInfo(Msg.translate(Env.getCtx(), "IsAllocated"), new ColumnInfo(Msg.translate(Env.getCtx(), "IsAllocated"),
"p.IsAllocated", Boolean.class) "p.IsAllocated", Boolean.class)
}; };
/**
* Detail Protected Constructor
*
* @param modal modal
* @param WindowNo window no
* @param value query value
* @param multiSelection multiple selections
* @param whereClause where clause
*/
protected InfoPaymentPanel(int WindowNo, String value,
boolean multiSelection, String whereClause)
{
this(WindowNo, value, multiSelection, whereClause, true);
}
/** /**
* Detail Protected Constructor * Detail Protected Constructor
* *
@ -143,11 +128,26 @@ public class InfoPaymentPanel extends InfoPanel implements ValueChangeListener,
* @param multiSelection multiple selections * @param multiSelection multiple selections
* @param whereClause where clause * @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);
}
/**
* Detail Protected Constructor
*
* @param modal modal
* @param WindowNo window no
* @param value query value
* @param multiSelection multiple selections
* @param whereClause where clause
*/
public InfoPaymentPanel(int WindowNo, String value,
boolean multiSelection, String whereClause, boolean lookup) boolean multiSelection, String whereClause, boolean lookup)
{ {
super(WindowNo, "p", "C_Payment_ID", multiSelection, whereClause, lookup); super(WindowNo, "p", "C_Payment_ID", multiSelection, whereClause, lookup);
log.info( "InfoPaymentPanel"); log.info( "InfoPaymentPanel");
setTitle(Msg.getMsg(Env.getCtx(), "InfoPayment")); setTitle(Msg.getMsg(Env.getCtx(), "InfoPayment"));
@ -162,10 +162,10 @@ public class InfoPaymentPanel extends InfoPanel implements ValueChangeListener,
} }
int no = contentPanel.getRowCount(); int no = contentPanel.getRowCount();
setStatusLine(Integer.toString(no) + " " + Msg.getMsg(Env.getCtx(), "SearchRows_EnterQuery"), false); setStatusLine(Integer.toString(no) + " " + Msg.getMsg(Env.getCtx(), "SearchRows_EnterQuery"), false);
setStatusDB(Integer.toString(no)); setStatusDB(Integer.toString(no));
if (value != null && value.length() > 0) if (value != null && value.length() > 0)
{ {
fDocumentNo .setValue(value); fDocumentNo .setValue(value);
@ -177,7 +177,7 @@ public class InfoPaymentPanel extends InfoPanel implements ValueChangeListener,
* Static Setup - add fields to parameterPanel * Static Setup - add fields to parameterPanel
* @throws Exception if Lookups cannot be created * @throws Exception if Lookups cannot be created
*/ */
private void statInit() throws Exception private void statInit() throws Exception
{ {
fDocumentNo.setWidth("100%"); fDocumentNo.setWidth("100%");
@ -185,23 +185,23 @@ public class InfoPaymentPanel extends InfoPanel implements ValueChangeListener,
fDateTo.setWidth("165px"); fDateTo.setWidth("165px");
fAmtFrom.setWidth("180px"); fAmtFrom.setWidth("180px");
fAmtTo.setWidth("180px"); fAmtTo.setWidth("180px");
fDocumentNo.addEventListener(Events.ON_CHANGE, this); fDocumentNo.addEventListener(Events.ON_CHANGE, this);
fIsReceipt.setLabel(Msg.translate(Env.getCtx(), "IsReceipt")); fIsReceipt.setLabel(Msg.translate(Env.getCtx(), "IsReceipt"));
fIsReceipt.addEventListener(Events.ON_CHECK, this); fIsReceipt.addEventListener(Events.ON_CHECK, this);
fIsReceipt.setChecked(!"N".equals(Env.getContext(Env.getCtx(), p_WindowNo, "IsSOTrx"))); fIsReceipt.setChecked(!"N".equals(Env.getContext(Env.getCtx(), p_WindowNo, "IsSOTrx")));
fBPartner_ID = new WSearchEditor( fBPartner_ID = new WSearchEditor(
MLookupFactory.get(Env.getCtx(), p_WindowNo, 0, 3499, DisplayType.Search), MLookupFactory.get(Env.getCtx(), p_WindowNo, 0, 3499, DisplayType.Search),
Msg.translate(Env.getCtx(), "C_BPartner_ID"), "", false, false, true); Msg.translate(Env.getCtx(), "C_BPartner_ID"), "", false, false, true);
fBPartner_ID.addValueChangeListener(this); fBPartner_ID.addValueChangeListener(this);
Grid grid = GridFactory.newGridLayout(); Grid grid = GridFactory.newGridLayout();
Rows rows = new Rows(); Rows rows = new Rows();
grid.appendChild(rows); grid.appendChild(rows);
Row row = new Row(); Row row = new Row();
rows.appendChild(row); rows.appendChild(row);
row.appendChild(lDocumentNo.rightAlign()); row.appendChild(lDocumentNo.rightAlign());
@ -209,7 +209,7 @@ public class InfoPaymentPanel extends InfoPanel implements ValueChangeListener,
row.appendChild(fBPartner_ID.getLabel().rightAlign()); row.appendChild(fBPartner_ID.getLabel().rightAlign());
row.appendChild(fBPartner_ID.getComponent()); row.appendChild(fBPartner_ID.getComponent());
row.appendChild(fIsReceipt); row.appendChild(fIsReceipt);
row = new Row(); row = new Row();
row.setSpans("3, 2"); row.setSpans("3, 2");
rows.appendChild(row); rows.appendChild(row);
@ -219,7 +219,7 @@ public class InfoPaymentPanel extends InfoPanel implements ValueChangeListener,
hbox.appendChild(lDateTo); hbox.appendChild(lDateTo);
hbox.appendChild(fDateTo); hbox.appendChild(fDateTo);
row.appendChild(hbox); row.appendChild(hbox);
row = new Row(); row = new Row();
row.setSpans("3, 2"); row.setSpans("3, 2");
rows.appendChild(row); rows.appendChild(row);
@ -229,7 +229,7 @@ public class InfoPaymentPanel extends InfoPanel implements ValueChangeListener,
hbox.appendChild(lAmtTo); hbox.appendChild(lAmtTo);
hbox.appendChild(fAmtTo); hbox.appendChild(fAmtTo);
row.appendChild(hbox); row.appendChild(hbox);
layout = new Borderlayout(); layout = new Borderlayout();
layout.setWidth("100%"); layout.setWidth("100%");
layout.setHeight("100%"); layout.setHeight("100%");
@ -255,7 +255,7 @@ public class InfoPaymentPanel extends InfoPanel implements ValueChangeListener,
contentPanel.setVflex(true); contentPanel.setVflex(true);
div.setStyle("width :100%; height: 100%"); div.setStyle("width :100%; height: 100%");
center.appendChild(div); center.appendChild(div);
South south = new South(); South south = new South();
layout.appendChild(south); layout.appendChild(south);
southBody = new Vbox(); southBody = new Vbox();
@ -265,43 +265,43 @@ public class InfoPaymentPanel extends InfoPanel implements ValueChangeListener,
southBody.appendChild(new Separator()); southBody.appendChild(new Separator());
southBody.appendChild(statusBar); southBody.appendChild(statusBar);
} }
/** /**
* General Init * General Init
* @return true, if success * @return true, if success
*/ */
private boolean initInfo () private boolean initInfo ()
{ {
// Set Defaults // Set Defaults
String bp = Env.getContext(Env.getCtx(), p_WindowNo, "C_BPartner_ID"); String bp = Env.getContext(Env.getCtx(), p_WindowNo, "C_BPartner_ID");
if (bp != null && bp.length() != 0) if (bp != null && bp.length() != 0)
fBPartner_ID.setValue(new Integer(bp)); fBPartner_ID.setValue(new Integer(bp));
// Prepare table // Prepare table
StringBuffer where = new StringBuffer("p.IsActive='Y'"); StringBuffer where = new StringBuffer("p.IsActive='Y'");
if (p_whereClause.length() > 0) if (p_whereClause.length() > 0)
where.append(" AND ").append(Util.replace(p_whereClause, "C_Payment.", "p.")); where.append(" AND ").append(Util.replace(p_whereClause, "C_Payment.", "p."));
prepareTable(s_paymentLayout, " C_Payment_v p", where.toString(), "2,3,4"); prepareTable(s_paymentLayout, " C_Payment_v p", where.toString(), "2,3,4");
return true; return true;
} // initInfo } // initInfo
/************************************************************************** /**************************************************************************
* Construct SQL Where Clause and define parameters * Construct SQL Where Clause and define parameters
* (setParameters needs to set parameters) * (setParameters needs to set parameters)
* Includes first AND * Includes first AND
* @return sql where clause * @return sql where clause
*/ */
protected String getSQLWhere() protected String getSQLWhere()
{ {
StringBuffer sql = new StringBuffer(); StringBuffer sql = new StringBuffer();
if (fDocumentNo.getText().length() > 0) if (fDocumentNo.getText().length() > 0)
sql.append(" AND UPPER(p.DocumentNo) LIKE ?"); sql.append(" AND UPPER(p.DocumentNo) LIKE ?");
@ -312,7 +312,7 @@ public class InfoPaymentPanel extends InfoPanel implements ValueChangeListener,
{ {
Date f = fDateFrom.getValue(); Date f = fDateFrom.getValue();
Timestamp from = new Timestamp(f.getTime()); Timestamp from = new Timestamp(f.getTime());
Date t = fDateTo.getValue(); Date t = fDateTo.getValue();
Timestamp to = new Timestamp(t.getTime()); Timestamp to = new Timestamp(t.getTime());
@ -328,7 +328,7 @@ public class InfoPaymentPanel extends InfoPanel implements ValueChangeListener,
{ {
BigDecimal from = new BigDecimal(fAmtFrom.getValue()); BigDecimal from = new BigDecimal(fAmtFrom.getValue());
BigDecimal to = new BigDecimal(fAmtTo.getValue()); BigDecimal to = new BigDecimal(fAmtTo.getValue());
if (from == null && to != null) if (from == null && to != null)
sql.append(" AND p.PayAmt <= ?"); sql.append(" AND p.PayAmt <= ?");
else if (from != null && to == null) else if (from != null && to == null)
@ -336,7 +336,7 @@ public class InfoPaymentPanel extends InfoPanel implements ValueChangeListener,
else if (from != null && to != null) else if (from != null && to != null)
sql.append(" AND p.PayAmt BETWEEN ? AND ?"); sql.append(" AND p.PayAmt BETWEEN ? AND ?");
} }
sql.append(" AND p.IsReceipt=?"); sql.append(" AND p.IsReceipt=?");
log.fine(sql.toString()); log.fine(sql.toString());
@ -350,11 +350,11 @@ public class InfoPaymentPanel extends InfoPanel implements ValueChangeListener,
* @param forCount for counting records * @param forCount for counting records
* @throws SQLException * @throws SQLException
*/ */
protected void setParameters(PreparedStatement pstmt, boolean forCount) throws SQLException protected void setParameters(PreparedStatement pstmt, boolean forCount) throws SQLException
{ {
int index = 1; int index = 1;
if (fDocumentNo.getText().length() > 0) if (fDocumentNo.getText().length() > 0)
pstmt.setString(index++, getSQLText(fDocumentNo)); pstmt.setString(index++, getSQLText(fDocumentNo));
@ -369,12 +369,12 @@ public class InfoPaymentPanel extends InfoPanel implements ValueChangeListener,
{ {
Date f = fDateFrom.getValue(); Date f = fDateFrom.getValue();
Timestamp from = new Timestamp(f.getTime()); Timestamp from = new Timestamp(f.getTime());
Date t = fDateTo.getValue(); Date t = fDateTo.getValue();
Timestamp to = new Timestamp(t.getTime()); Timestamp to = new Timestamp(t.getTime());
log.fine("Date From=" + from + ", To=" + to); log.fine("Date From=" + from + ", To=" + to);
if (from == null && to != null) if (from == null && to != null)
pstmt.setTimestamp(index++, to); pstmt.setTimestamp(index++, to);
else if (from != null && to == null) else if (from != null && to == null)
@ -391,7 +391,7 @@ public class InfoPaymentPanel extends InfoPanel implements ValueChangeListener,
BigDecimal from = new BigDecimal(fAmtFrom.getValue()); BigDecimal from = new BigDecimal(fAmtFrom.getValue());
BigDecimal to = new BigDecimal(fAmtTo.getValue()); BigDecimal to = new BigDecimal(fAmtTo.getValue());
log.fine("Amt From=" + from + ", To=" + to); log.fine("Amt From=" + from + ", To=" + to);
if (from == null && to != null) if (from == null && to != null)
pstmt.setBigDecimal(index++, to); pstmt.setBigDecimal(index++, to);
else if (from != null && to == null) else if (from != null && to == null)
@ -402,7 +402,7 @@ public class InfoPaymentPanel extends InfoPanel implements ValueChangeListener,
pstmt.setBigDecimal(index++, to); pstmt.setBigDecimal(index++, to);
} }
} }
pstmt.setString(index++, fIsReceipt.isChecked() ? "Y" : "N"); pstmt.setString(index++, fIsReceipt.isChecked() ? "Y" : "N");
} // setParameters } // setParameters
@ -411,16 +411,16 @@ public class InfoPaymentPanel extends InfoPanel implements ValueChangeListener,
* @param f field * @param f field
* @return Upper case text with % at the end * @return Upper case text with % at the end
*/ */
private String getSQLText (Textbox f) private String getSQLText (Textbox f)
{ {
String s = f.getText().toUpperCase(); String s = f.getText().toUpperCase();
if (!s.endsWith("%")) if (!s.endsWith("%"))
s += "%"; s += "%";
log.fine( "String=" + s); log.fine( "String=" + s);
return s; return s;
} // getSQLText } // getSQLText
@ -441,17 +441,17 @@ public class InfoPaymentPanel extends InfoPanel implements ValueChangeListener,
AEnv.zoom (AD_WindowNo, query); AEnv.zoom (AD_WindowNo, query);
} // zoom } // zoom
// //
/** /**
* Has Zoom * Has Zoom
* @return true * @return true
*/ */
protected boolean hasZoom() protected boolean hasZoom()
{ {
return true; return true;
} // hasZoom } // hasZoom
public void valueChange(ValueChangeEvent evt) public void valueChange(ValueChangeEvent evt)
{ {
if (fBPartner_ID.equals(evt.getSource())) if (fBPartner_ID.equals(evt.getSource()))
@ -463,7 +463,7 @@ public class InfoPaymentPanel extends InfoPanel implements ValueChangeListener,
public void tableChanged(WTableModelEvent event) public void tableChanged(WTableModelEvent event)
{ {
} }
@Override @Override
protected void insertPagingComponent() protected void insertPagingComponent()
{ {

View File

@ -2,6 +2,7 @@
<?eclipse version="3.4"?> <?eclipse version="3.4"?>
<plugin> <plugin>
<extension-point id="org.adempiere.webui.Form" name="Web Form" schema="schema/org.adempiere.webui.Form.exsd"/> <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 <extension
point="org.compiere.print.ReportViewerProvider"> point="org.compiere.print.ReportViewerProvider">
<provider <provider
@ -26,5 +27,14 @@
class="org.compiere.interfaces.impl.StatusBean"> class="org.compiere.interfaces.impl.StatusBean">
</interface> </interface>
</extension> </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> </plugin>

View File

@ -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>