IDEMPIERE-5923 Info Window should use key and display columns setting from lookup (#2108)
This commit is contained in:
parent
ce48a8835e
commit
6f484ee701
|
@ -56,6 +56,13 @@ public class DefaultInfoFactory implements IInfoFactory {
|
|||
value, multiSelection, whereClause, AD_InfoWindow_ID, lookup, null, null);
|
||||
}
|
||||
|
||||
@Override
|
||||
public InfoPanel create(int WindowNo, String tableName, String keyColumn, String value, boolean multiSelection,
|
||||
String whereClause, int AD_InfoWindow_ID, Lookup lookup) {
|
||||
return create(WindowNo, tableName, keyColumn,
|
||||
value, multiSelection, whereClause, AD_InfoWindow_ID, (lookup != null), null, null, lookup);
|
||||
}
|
||||
|
||||
@Override
|
||||
public InfoPanel create(int WindowNo, String tableName, String keyColumn,
|
||||
String value, boolean multiSelection, String whereClause, int AD_InfoWindow_ID, boolean lookup, GridField field) {
|
||||
|
@ -79,17 +86,37 @@ public class DefaultInfoFactory implements IInfoFactory {
|
|||
*/
|
||||
public InfoPanel create(int WindowNo, String tableName, String keyColumn,
|
||||
String value, boolean multiSelection, String whereClause, int AD_InfoWindow_ID, boolean lookup, String predefinedContextVariables, GridField field) {
|
||||
return create(WindowNo, tableName, keyColumn, value, multiSelection, whereClause, AD_InfoWindow_ID, lookup, predefinedContextVariables, field,
|
||||
(field != null ? field.getLookup() : null));
|
||||
}
|
||||
|
||||
/**
|
||||
* @param WindowNo
|
||||
* @param tableName
|
||||
* @param keyColumn
|
||||
* @param value
|
||||
* @param multiSelection
|
||||
* @param whereClause
|
||||
* @param AD_InfoWindow_ID
|
||||
* @param lookup
|
||||
* @param predefinedContextVariables
|
||||
* @param field
|
||||
* @param lookupModel
|
||||
* @return InfoPanel
|
||||
*/
|
||||
public InfoPanel create(int WindowNo, String tableName, String keyColumn,
|
||||
String value, boolean multiSelection, String whereClause, int AD_InfoWindow_ID, boolean lookup, String predefinedContextVariables, GridField field, Lookup lookupModel) {
|
||||
InfoPanel info = null;
|
||||
setSOTrxBasedOnDocType(WindowNo);
|
||||
|
||||
if (tableName.equals("C_BPartner")) {
|
||||
info = new InfoBPartnerWindow(WindowNo, tableName, keyColumn, value, multiSelection, whereClause, AD_InfoWindow_ID, lookup, field, predefinedContextVariables);
|
||||
info = new InfoBPartnerWindow(WindowNo, tableName, keyColumn, value, multiSelection, whereClause, AD_InfoWindow_ID, lookup, field, predefinedContextVariables, lookupModel);
|
||||
if (!info.loadedOK()) {
|
||||
info = new InfoBPartnerPanel (value,WindowNo, !Env.getContext(Env.getCtx(), WindowNo, "IsSOTrx").equals("N"),
|
||||
multiSelection, whereClause, lookup);
|
||||
}
|
||||
} else if (tableName.equals("M_Product")) {
|
||||
info = new InfoProductWindow(WindowNo, tableName, keyColumn, value, multiSelection, whereClause, AD_InfoWindow_ID, lookup, field, predefinedContextVariables);
|
||||
info = new InfoProductWindow(WindowNo, tableName, keyColumn, value, multiSelection, whereClause, AD_InfoWindow_ID, lookup, field, predefinedContextVariables, lookupModel);
|
||||
if (!info.loadedOK()) {
|
||||
info = new InfoProductPanel ( WindowNo,
|
||||
Env.getContextAsInt(Env.getCtx(), WindowNo, "M_Warehouse_ID"),
|
||||
|
@ -97,31 +124,31 @@ public class DefaultInfoFactory implements IInfoFactory {
|
|||
multiSelection, value,whereClause, lookup);
|
||||
}
|
||||
} else if (tableName.equals("C_Invoice")) {
|
||||
info = new InfoInvoiceWindow(WindowNo, tableName, keyColumn, value, multiSelection, whereClause, AD_InfoWindow_ID, lookup, field, predefinedContextVariables);
|
||||
info = new InfoInvoiceWindow(WindowNo, tableName, keyColumn, value, multiSelection, whereClause, AD_InfoWindow_ID, lookup, field, predefinedContextVariables, lookupModel);
|
||||
if (!info.loadedOK()) {
|
||||
info = new InfoInvoicePanel ( WindowNo, value,
|
||||
multiSelection, whereClause, lookup);
|
||||
}
|
||||
} else if (tableName.equals("A_Asset")) {
|
||||
info = new InfoAssetWindow(WindowNo, tableName, keyColumn, value, multiSelection, whereClause, AD_InfoWindow_ID, lookup, field, predefinedContextVariables);
|
||||
info = new InfoAssetWindow(WindowNo, tableName, keyColumn, value, multiSelection, whereClause, AD_InfoWindow_ID, lookup, field, predefinedContextVariables, lookupModel);
|
||||
if (!info.loadedOK()) {
|
||||
info = new InfoAssetPanel (WindowNo, 0, value,
|
||||
multiSelection, whereClause, lookup);
|
||||
}
|
||||
} else if (tableName.equals("C_Order")) {
|
||||
info = new InfoOrderWindow(WindowNo, tableName, keyColumn, value, multiSelection, whereClause, AD_InfoWindow_ID, lookup, field, predefinedContextVariables);
|
||||
info = new InfoOrderWindow(WindowNo, tableName, keyColumn, value, multiSelection, whereClause, AD_InfoWindow_ID, lookup, field, predefinedContextVariables, lookupModel);
|
||||
if (!info.loadedOK()) {
|
||||
info = new InfoOrderPanel ( WindowNo, value,
|
||||
multiSelection, whereClause, lookup);
|
||||
}
|
||||
} else if (tableName.equals("M_InOut")) {
|
||||
info = new InfoInOutWindow(WindowNo, tableName, keyColumn, value, multiSelection, whereClause, AD_InfoWindow_ID, lookup, field, predefinedContextVariables);
|
||||
info = new InfoInOutWindow(WindowNo, tableName, keyColumn, value, multiSelection, whereClause, AD_InfoWindow_ID, lookup, field, predefinedContextVariables, lookupModel);
|
||||
if (!info.loadedOK()) {
|
||||
info = new InfoInOutPanel (WindowNo, value,
|
||||
multiSelection, whereClause, lookup);
|
||||
}
|
||||
} else if (tableName.equals("C_Payment")) {
|
||||
info = new InfoPaymentWindow(WindowNo, tableName, keyColumn, value, multiSelection, whereClause, AD_InfoWindow_ID, lookup, field, predefinedContextVariables);
|
||||
info = new InfoPaymentWindow(WindowNo, tableName, keyColumn, value, multiSelection, whereClause, AD_InfoWindow_ID, lookup, field, predefinedContextVariables, lookupModel);
|
||||
if (!info.loadedOK()) {
|
||||
info = new InfoPaymentPanel (WindowNo, value, multiSelection, whereClause, lookup);
|
||||
}
|
||||
|
@ -129,13 +156,13 @@ public class DefaultInfoFactory implements IInfoFactory {
|
|||
info = new InfoCashLinePanel (WindowNo, value,
|
||||
multiSelection, whereClause, lookup);
|
||||
} else if (tableName.equals("S_ResourceAssignment")) {
|
||||
info = new InfoAssignmentWindow(WindowNo, tableName, keyColumn, value, multiSelection, whereClause, AD_InfoWindow_ID, lookup, field, predefinedContextVariables);
|
||||
info = new InfoAssignmentWindow(WindowNo, tableName, keyColumn, value, multiSelection, whereClause, AD_InfoWindow_ID, lookup, field, predefinedContextVariables, lookupModel);
|
||||
if (!info.loadedOK()) {
|
||||
info = new InfoAssignmentPanel (WindowNo, value,
|
||||
multiSelection, whereClause, lookup);
|
||||
}
|
||||
} else {
|
||||
info = new InfoWindow(WindowNo, tableName, keyColumn, value, multiSelection, whereClause, AD_InfoWindow_ID, lookup, field, predefinedContextVariables);
|
||||
info = new InfoWindow(WindowNo, tableName, keyColumn, value, multiSelection, whereClause, AD_InfoWindow_ID, lookup, field, predefinedContextVariables, lookupModel);
|
||||
if (!info.loadedOK()) {
|
||||
info = new InfoGeneralPanel (value, WindowNo,
|
||||
tableName, keyColumn,
|
||||
|
@ -164,7 +191,7 @@ public class DefaultInfoFactory implements IInfoFactory {
|
|||
|
||||
if (col.equals("M_Product_ID"))
|
||||
{
|
||||
InfoWindow infoWindow = new InfoProductWindow(lookup.getWindowNo(), tableName, keyColumn, queryValue, multiSelection, whereClause, AD_InfoWindow_ID, true, field);
|
||||
InfoWindow infoWindow = new InfoProductWindow(lookup.getWindowNo(), tableName, keyColumn, queryValue, multiSelection, whereClause, AD_InfoWindow_ID, true, field, null, lookup);
|
||||
if (infoWindow.loadedOK())
|
||||
return infoWindow;
|
||||
|
||||
|
@ -195,7 +222,7 @@ public class DefaultInfoFactory implements IInfoFactory {
|
|||
String tempIsSOTrx = ("Y".equals(originalIsSOTrx) ? "N" : "Y");
|
||||
Env.setContext(Env.getCtx(), lookup.getWindowNo(), "IsSOTrx", tempIsSOTrx);
|
||||
}
|
||||
InfoWindow infoWindow = new InfoBPartnerWindow(lookup.getWindowNo(), tableName, keyColumn, queryValue, multiSelection, whereClause, AD_InfoWindow_ID, true, field);
|
||||
InfoWindow infoWindow = new InfoBPartnerWindow(lookup.getWindowNo(), tableName, keyColumn, queryValue, multiSelection, whereClause, AD_InfoWindow_ID, true, field, null, lookup);
|
||||
if (infoWindow.loadedOK())
|
||||
return infoWindow;
|
||||
} finally {
|
||||
|
@ -213,7 +240,7 @@ public class DefaultInfoFactory implements IInfoFactory {
|
|||
}
|
||||
else // General Info
|
||||
{
|
||||
info = create(lookup.getWindowNo(), tableName, keyColumn, queryValue, multiSelection, whereClause, AD_InfoWindow_ID, true, field);
|
||||
info = create(lookup.getWindowNo(), tableName, keyColumn, queryValue, multiSelection, whereClause, AD_InfoWindow_ID, true, (String)null, field, lookup);
|
||||
}
|
||||
return info;
|
||||
}
|
||||
|
|
|
@ -40,6 +40,22 @@ public interface IInfoFactory {
|
|||
String tableName, String keyColumn, String value,
|
||||
boolean multiSelection, String whereClause, int AD_InfoWindow_ID, boolean lookup);
|
||||
|
||||
/**
|
||||
*
|
||||
* @param WindowNo
|
||||
* @param tableName
|
||||
* @param keyColumn
|
||||
* @param value
|
||||
* @param multiSelection
|
||||
* @param whereClause
|
||||
* @param AD_InfoWindow_ID
|
||||
* @param lookup
|
||||
* @return {@link InfoPanel}
|
||||
*/
|
||||
public InfoPanel create (int WindowNo,
|
||||
String tableName, String keyColumn, String value,
|
||||
boolean multiSelection, String whereClause, int AD_InfoWindow_ID, Lookup lookup);
|
||||
|
||||
/**
|
||||
*
|
||||
* @param lookup
|
||||
|
|
|
@ -25,6 +25,7 @@
|
|||
package org.adempiere.webui.info;
|
||||
|
||||
import org.compiere.model.GridField;
|
||||
import org.compiere.model.Lookup;
|
||||
import org.compiere.model.MAsset;
|
||||
import org.compiere.util.Env;
|
||||
|
||||
|
@ -91,6 +92,26 @@ public class InfoAssetWindow extends InfoWindow {
|
|||
whereClause, AD_InfoWindow_ID, lookup, field, predefinedContextVariables);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param WindowNo
|
||||
* @param tableName
|
||||
* @param keyColumn
|
||||
* @param queryValue
|
||||
* @param multipleSelection
|
||||
* @param whereClause
|
||||
* @param AD_InfoWindow_ID
|
||||
* @param lookup
|
||||
* @param field
|
||||
* @param predefinedContextVariables
|
||||
* @param lookupModel
|
||||
*/
|
||||
public InfoAssetWindow(int WindowNo, String tableName, String keyColumn, String queryValue,
|
||||
boolean multipleSelection, String whereClause, int AD_InfoWindow_ID, boolean lookup, GridField field,
|
||||
String predefinedContextVariables, Lookup lookupModel) {
|
||||
super(WindowNo, tableName, keyColumn, queryValue, multipleSelection, whereClause, AD_InfoWindow_ID, lookup, field,
|
||||
predefinedContextVariables, lookupModel);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void saveSelectionDetail() {
|
||||
int row = contentPanel.getSelectedRow();
|
||||
|
|
|
@ -25,6 +25,7 @@
|
|||
package org.adempiere.webui.info;
|
||||
|
||||
import org.compiere.model.GridField;
|
||||
import org.compiere.model.Lookup;
|
||||
|
||||
/**
|
||||
* Info window for S_ResourceAssignment
|
||||
|
@ -89,4 +90,25 @@ public class InfoAssignmentWindow extends InfoWindow {
|
|||
super(WindowNo, tableName, keyColumn, queryValue, multipleSelection,
|
||||
whereClause, AD_InfoWindow_ID, lookup, field, predefinedContextVariables);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param WindowNo
|
||||
* @param tableName
|
||||
* @param keyColumn
|
||||
* @param queryValue
|
||||
* @param multipleSelection
|
||||
* @param whereClause
|
||||
* @param AD_InfoWindow_ID
|
||||
* @param lookup
|
||||
* @param field
|
||||
* @param predefinedContextVariables
|
||||
* @param lookupModel
|
||||
*/
|
||||
public InfoAssignmentWindow(int WindowNo, String tableName, String keyColumn, String queryValue,
|
||||
boolean multipleSelection, String whereClause, int AD_InfoWindow_ID, boolean lookup, GridField field,
|
||||
String predefinedContextVariables, Lookup lookupModel) {
|
||||
super(WindowNo, tableName, keyColumn, queryValue, multipleSelection, whereClause, AD_InfoWindow_ID, lookup, field,
|
||||
predefinedContextVariables, lookupModel);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -28,6 +28,7 @@ import java.util.logging.Level;
|
|||
|
||||
import org.adempiere.webui.panel.InvoiceHistory;
|
||||
import org.compiere.model.GridField;
|
||||
import org.compiere.model.Lookup;
|
||||
import org.compiere.model.MBPartner;
|
||||
import org.compiere.util.Env;
|
||||
|
||||
|
@ -95,6 +96,26 @@ public class InfoBPartnerWindow extends InfoWindow {
|
|||
whereClause, AD_InfoWindow_ID, lookup, field, predefinedContextVariables);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param WindowNo
|
||||
* @param tableName
|
||||
* @param keyColumn
|
||||
* @param queryValue
|
||||
* @param multipleSelection
|
||||
* @param whereClause
|
||||
* @param AD_InfoWindow_ID
|
||||
* @param lookup
|
||||
* @param field
|
||||
* @param predefinedContextVariables
|
||||
* @param lookupModel
|
||||
*/
|
||||
public InfoBPartnerWindow(int WindowNo, String tableName, String keyColumn, String queryValue,
|
||||
boolean multipleSelection, String whereClause, int AD_InfoWindow_ID, boolean lookup, GridField field,
|
||||
String predefinedContextVariables, Lookup lookupModel) {
|
||||
super(WindowNo, tableName, keyColumn, queryValue, multipleSelection, whereClause, AD_InfoWindow_ID, lookup, field,
|
||||
predefinedContextVariables, lookupModel);
|
||||
}
|
||||
|
||||
/**
|
||||
* Has History
|
||||
* @return true
|
||||
|
|
|
@ -25,6 +25,7 @@
|
|||
package org.adempiere.webui.info;
|
||||
|
||||
import org.compiere.model.GridField;
|
||||
import org.compiere.model.Lookup;
|
||||
|
||||
/**
|
||||
* Info window for M_InOut
|
||||
|
@ -88,4 +89,25 @@ public class InfoInOutWindow extends InfoWindow {
|
|||
super(WindowNo, tableName, keyColumn, queryValue, multipleSelection,
|
||||
whereClause, AD_InfoWindow_ID, lookup, field, predefinedContextVariables);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param WindowNo
|
||||
* @param tableName
|
||||
* @param keyColumn
|
||||
* @param queryValue
|
||||
* @param multipleSelection
|
||||
* @param whereClause
|
||||
* @param AD_InfoWindow_ID
|
||||
* @param lookup
|
||||
* @param field
|
||||
* @param predefinedContextVariables
|
||||
* @param lookupModel
|
||||
*/
|
||||
public InfoInOutWindow(int WindowNo, String tableName, String keyColumn, String queryValue,
|
||||
boolean multipleSelection, String whereClause, int AD_InfoWindow_ID, boolean lookup, GridField field,
|
||||
String predefinedContextVariables, Lookup lookupModel) {
|
||||
super(WindowNo, tableName, keyColumn, queryValue, multipleSelection, whereClause, AD_InfoWindow_ID, lookup, field,
|
||||
predefinedContextVariables, lookupModel);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -25,6 +25,7 @@
|
|||
package org.adempiere.webui.info;
|
||||
|
||||
import org.compiere.model.GridField;
|
||||
import org.compiere.model.Lookup;
|
||||
import org.compiere.model.MInvoice;
|
||||
import org.compiere.util.Env;
|
||||
|
||||
|
@ -91,6 +92,26 @@ public class InfoInvoiceWindow extends InfoWindow {
|
|||
whereClause, AD_InfoWindow_ID, lookup, field, predefinedContextVariables);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param WindowNo
|
||||
* @param tableName
|
||||
* @param keyColumn
|
||||
* @param queryValue
|
||||
* @param multipleSelection
|
||||
* @param whereClause
|
||||
* @param AD_InfoWindow_ID
|
||||
* @param lookup
|
||||
* @param field
|
||||
* @param predefinedContextVariables
|
||||
* @param lookupModel
|
||||
*/
|
||||
public InfoInvoiceWindow(int WindowNo, String tableName, String keyColumn, String queryValue,
|
||||
boolean multipleSelection, String whereClause, int AD_InfoWindow_ID, boolean lookup, GridField field,
|
||||
String predefinedContextVariables, Lookup lookupModel) {
|
||||
super(WindowNo, tableName, keyColumn, queryValue, multipleSelection, whereClause, AD_InfoWindow_ID, lookup, field,
|
||||
predefinedContextVariables, lookupModel);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void saveSelectionDetail() {
|
||||
int row = contentPanel.getSelectedRow();
|
||||
|
|
|
@ -25,6 +25,7 @@
|
|||
package org.adempiere.webui.info;
|
||||
|
||||
import org.compiere.model.GridField;
|
||||
import org.compiere.model.Lookup;
|
||||
|
||||
/**
|
||||
* Info window for C_Order
|
||||
|
@ -89,4 +90,24 @@ public class InfoOrderWindow extends InfoWindow {
|
|||
whereClause, AD_InfoWindow_ID, lookup, field, predefinedContextVariables);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param WindowNo
|
||||
* @param tableName
|
||||
* @param keyColumn
|
||||
* @param queryValue
|
||||
* @param multipleSelection
|
||||
* @param whereClause
|
||||
* @param AD_InfoWindow_ID
|
||||
* @param lookup
|
||||
* @param field
|
||||
* @param predefinedContextVariables
|
||||
* @param lookupModel
|
||||
*/
|
||||
public InfoOrderWindow(int WindowNo, String tableName, String keyColumn, String queryValue,
|
||||
boolean multipleSelection, String whereClause, int AD_InfoWindow_ID, boolean lookup, GridField field,
|
||||
String predefinedContextVariables, Lookup lookupModel) {
|
||||
super(WindowNo, tableName, keyColumn, queryValue, multipleSelection, whereClause, AD_InfoWindow_ID, lookup, field,
|
||||
predefinedContextVariables, lookupModel);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -25,6 +25,7 @@
|
|||
package org.adempiere.webui.info;
|
||||
|
||||
import org.compiere.model.GridField;
|
||||
import org.compiere.model.Lookup;
|
||||
|
||||
/**
|
||||
* Info window for C_Payment
|
||||
|
@ -89,4 +90,24 @@ public class InfoPaymentWindow extends InfoWindow {
|
|||
whereClause, AD_InfoWindow_ID, lookup, field, predefinedContextVariables);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param WindowNo
|
||||
* @param tableName
|
||||
* @param keyColumn
|
||||
* @param queryValue
|
||||
* @param multipleSelection
|
||||
* @param whereClause
|
||||
* @param AD_InfoWindow_ID
|
||||
* @param lookup
|
||||
* @param field
|
||||
* @param predefinedContextVariables
|
||||
* @param lookupModel
|
||||
*/
|
||||
public InfoPaymentWindow(int WindowNo, String tableName, String keyColumn, String queryValue,
|
||||
boolean multipleSelection, String whereClause, int AD_InfoWindow_ID, boolean lookup, GridField field,
|
||||
String predefinedContextVariables, Lookup lookupModel) {
|
||||
super(WindowNo, tableName, keyColumn, queryValue, multipleSelection, whereClause, AD_InfoWindow_ID, lookup, field,
|
||||
predefinedContextVariables, lookupModel);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -55,6 +55,7 @@ import org.adempiere.webui.util.ZKUpdateUtil;
|
|||
import org.compiere.minigrid.ColumnInfo;
|
||||
import org.compiere.minigrid.EmbedWinInfo;
|
||||
import org.compiere.model.GridField;
|
||||
import org.compiere.model.Lookup;
|
||||
import org.compiere.model.MDocType;
|
||||
import org.compiere.model.MInfoWindow;
|
||||
import org.compiere.model.MProduct;
|
||||
|
@ -182,6 +183,26 @@ public class InfoProductWindow extends InfoWindow {
|
|||
whereClause, AD_InfoWindow_ID, lookup, field, predefinedContextVariables);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param WindowNo
|
||||
* @param tableName
|
||||
* @param keyColumn
|
||||
* @param queryValue
|
||||
* @param multipleSelection
|
||||
* @param whereClause
|
||||
* @param AD_InfoWindow_ID
|
||||
* @param lookup
|
||||
* @param field
|
||||
* @param predefinedContextVariables
|
||||
* @param lookupModel
|
||||
*/
|
||||
public InfoProductWindow(int WindowNo, String tableName, String keyColumn, String queryValue,
|
||||
boolean multipleSelection, String whereClause, int AD_InfoWindow_ID, boolean lookup, GridField field,
|
||||
String predefinedContextVariables, Lookup lookupModel) {
|
||||
super(WindowNo, tableName, keyColumn, queryValue, multipleSelection, whereClause, AD_InfoWindow_ID, lookup, field,
|
||||
predefinedContextVariables, lookupModel);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String getSQLWhere() {
|
||||
/**
|
||||
|
|
|
@ -31,7 +31,6 @@ import java.util.HashMap;
|
|||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Map.Entry;
|
||||
import java.util.function.Consumer;
|
||||
import java.util.Properties;
|
||||
import java.util.TreeMap;
|
||||
import java.util.logging.Level;
|
||||
|
@ -226,6 +225,10 @@ public class InfoWindow extends InfoPanel implements ValueChangeListener, EventL
|
|||
/** true to auto collapse parameter panel after execution of query */
|
||||
private boolean autoCollapsedParameterPanel = false;
|
||||
|
||||
protected Lookup lookupModel = null;
|
||||
|
||||
private ArrayList<String> lookupIdentifiers;
|
||||
|
||||
/**
|
||||
* @param WindowNo
|
||||
* @param tableName
|
||||
|
@ -285,6 +288,25 @@ public class InfoWindow extends InfoPanel implements ValueChangeListener, EventL
|
|||
*/
|
||||
public InfoWindow(int WindowNo, String tableName, String keyColumn, String queryValue,
|
||||
boolean multipleSelection, String whereClause, int AD_InfoWindow_ID, boolean lookup, GridField field, String predefinedContextVariables) {
|
||||
this(WindowNo, tableName, keyColumn, queryValue, multipleSelection, whereClause, AD_InfoWindow_ID, lookup, field, predefinedContextVariables,
|
||||
(field != null ? field.getLookup() : null));
|
||||
}
|
||||
|
||||
/**
|
||||
* @param WindowNo
|
||||
* @param tableName
|
||||
* @param keyColumn
|
||||
* @param queryValue
|
||||
* @param multipleSelection
|
||||
* @param whereClause
|
||||
* @param AD_InfoWindow_ID
|
||||
* @param lookup
|
||||
* @param field
|
||||
* @param predefinedContextVariables
|
||||
* @param lookupModel
|
||||
*/
|
||||
public InfoWindow(int WindowNo, String tableName, String keyColumn, String queryValue,
|
||||
boolean multipleSelection, String whereClause, int AD_InfoWindow_ID, boolean lookup, GridField field, String predefinedContextVariables, Lookup lookupModel) {
|
||||
super(WindowNo, tableName, keyColumn, multipleSelection, whereClause,
|
||||
lookup, AD_InfoWindow_ID, queryValue);
|
||||
this.m_gridfield = field;
|
||||
|
@ -315,6 +337,14 @@ public class InfoWindow extends InfoPanel implements ValueChangeListener, EventL
|
|||
|
||||
Env.setPredefinedVariables(Env.getCtx(), getWindowNo(), predefinedContextVariables);
|
||||
infoContext = new Properties(Env.getCtx());
|
||||
if (lookupModel != null) {
|
||||
this.lookupModel = lookupModel;
|
||||
if (lookupModel instanceof MLookup mLookup) {
|
||||
if (mLookup.getLookupInfo().lookupDisplayColumnNames != null && mLookup.getLookupInfo().lookupDisplayColumnNames.size() > 0) {
|
||||
this.lookupIdentifiers = new ArrayList<String>(mLookup.getLookupInfo().lookupDisplayColumnNames);
|
||||
}
|
||||
}
|
||||
}
|
||||
p_loadedOK = loadInfoDefinition();
|
||||
|
||||
// make process button only in window mode
|
||||
|
@ -705,57 +735,12 @@ public class InfoWindow extends InfoPanel implements ValueChangeListener, EventL
|
|||
}
|
||||
|
||||
protected void testQueryForSplit(String [] values) {
|
||||
// store identifiers on info window, sort to follow identifier on m_table
|
||||
List<WEditor> fillIdentifiers = new ArrayList<>();
|
||||
// store query value, ignore value for identifier not exists on info window
|
||||
// this list is sync with fillIdentifiers (size and order)
|
||||
List<String> fillValues = new ArrayList<>();
|
||||
|
||||
List<String> tableIdentifiers = null;
|
||||
if (m_gridfield != null && m_gridfield.getLookup() != null
|
||||
&& m_gridfield.getLookup() instanceof MLookup) {
|
||||
|
||||
MLookup mLookup = (MLookup)m_gridfield.getLookup();
|
||||
if (mLookup.getLookupInfo().lookupDisplayColumnNames.size() > 0)
|
||||
tableIdentifiers = mLookup.getLookupInfo().lookupDisplayColumnNames;
|
||||
}
|
||||
|
||||
if (tableIdentifiers != null) {
|
||||
for (int i = 0; i < tableIdentifiers.size(); i++) {
|
||||
// final local variable to access inside lambda expression
|
||||
int indexFinal = i;
|
||||
List<String> tableIdentifiersFinal = tableIdentifiers;
|
||||
|
||||
// sort identifiers of info window to follow m_table
|
||||
// ignore identifiers exists on m_table but not exists on info window
|
||||
identifiers.forEach((Consumer<WEditor>)(identifierEditor) -> {
|
||||
if (identifierEditor.getColumnName().equals(tableIdentifiersFinal.get(indexFinal))) {
|
||||
fillIdentifiers.add(identifierEditor);
|
||||
fillValues.add(values[indexFinal]);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
// case not exists mLookup.getLookupInfo().lookupDisplayColumnNames
|
||||
// or no identifiers on info window exists on m_table
|
||||
// fall back to old logic and just set values to identifiers
|
||||
if (fillIdentifiers.size() == 0) {
|
||||
// do fill value to editor
|
||||
for(int i = 0; i < values.length && i < identifiers.size(); i++) {
|
||||
fillIdentifiers.add(identifiers.get(i));
|
||||
fillValues.add(values[i]);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
// do fill value to editor (for both corrected order and fall back)
|
||||
for(int i = 0; i < fillIdentifiers.size(); i++) {
|
||||
WEditor editor = fillIdentifiers.get(i);
|
||||
editor.setValue(fillValues.get(i).trim());
|
||||
WEditor editor = identifiers.get(i);
|
||||
editor.setValue(values[i].trim());
|
||||
}
|
||||
testCount(false);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -1887,6 +1872,20 @@ public class InfoWindow extends InfoPanel implements ValueChangeListener, EventL
|
|||
|
||||
if (!isAutoComplete)
|
||||
dynamicDisplay(null);
|
||||
|
||||
//if using lookupIdentifiers, sort identifiers in the order of lookupIdentifiers
|
||||
if (lookupIdentifiers != null && lookupIdentifiers.size() > 0 && identifiers.size() > 0) {
|
||||
List<WEditor> list = new ArrayList<WEditor>();
|
||||
for(String columnName : lookupIdentifiers) {
|
||||
for(WEditor editor : identifiers) {
|
||||
if (columnName.equals(editor.getColumnName())) {
|
||||
list.add(editor);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
identifiers = list;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -1982,7 +1981,12 @@ public class InfoWindow extends InfoPanel implements ValueChangeListener, EventL
|
|||
|
||||
editor.showMenu();
|
||||
|
||||
if (infoColumn.isIdentifier()) {
|
||||
//if MLookup is available, use display columns of MLookup instead of InfoColumn's IsIdentifier flag
|
||||
if (lookupIdentifiers != null && lookupIdentifiers.size() > 0) {
|
||||
if (lookupIdentifiers.contains(infoColumn.getColumnName()) ) {
|
||||
identifiers.add(editor);
|
||||
}
|
||||
} else if (infoColumn.isIdentifier()) {
|
||||
identifiers.add(editor);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue