IDEMPIERE-2751:potential wrong status of info window
This commit is contained in:
parent
8413fcb7ff
commit
bdbed7806e
|
@ -118,13 +118,11 @@ public class InfoWindow extends InfoPanel implements ValueChangeListener, EventL
|
||||||
public static final int FIELDLENGTH = 20;
|
public static final int FIELDLENGTH = 20;
|
||||||
|
|
||||||
protected ColumnInfo[] columnInfos;
|
protected ColumnInfo[] columnInfos;
|
||||||
protected MInfoWindow infoWindow;
|
|
||||||
protected TableInfo[] tableInfos;
|
protected TableInfo[] tableInfos;
|
||||||
protected MInfoColumn[] infoColumns;
|
protected MInfoColumn[] infoColumns;
|
||||||
protected String queryValue;
|
protected String queryValue;
|
||||||
|
|
||||||
private List<GridField> gridFields;
|
private List<GridField> gridFields;
|
||||||
private int AD_InfoWindow_ID;
|
|
||||||
private Checkbox checkAND;
|
private Checkbox checkAND;
|
||||||
/**
|
/**
|
||||||
* Menu contail process menu item
|
* Menu contail process menu item
|
||||||
|
@ -170,7 +168,6 @@ public class InfoWindow extends InfoPanel implements ValueChangeListener, EventL
|
||||||
lookup);
|
lookup);
|
||||||
this.m_gridfield = field;
|
this.m_gridfield = field;
|
||||||
this.queryValue = queryValue;
|
this.queryValue = queryValue;
|
||||||
this.AD_InfoWindow_ID = AD_InfoWindow_ID;
|
|
||||||
|
|
||||||
//Xolali IDEMPIERE-1045
|
//Xolali IDEMPIERE-1045
|
||||||
contentPanel.addActionListener(new EventListener<Event>() {
|
contentPanel.addActionListener(new EventListener<Event>() {
|
||||||
|
@ -471,32 +468,38 @@ public class InfoWindow extends InfoPanel implements ValueChangeListener, EventL
|
||||||
isQueryByUser = false;
|
isQueryByUser = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected boolean loadInfoDefinition() {
|
@Override
|
||||||
String tableName = null;
|
protected MInfoWindow loadInfoWindowData (int ADInfoWindowID){
|
||||||
|
MInfoWindow infoWindow = null;
|
||||||
if (AD_InfoWindow_ID > 0) {
|
if (AD_InfoWindow_ID > 0) {
|
||||||
infoWindow = new MInfoWindow(Env.getCtx(), AD_InfoWindow_ID, null);
|
infoWindow = new MInfoWindow(Env.getCtx(), AD_InfoWindow_ID, null);
|
||||||
if (!infoWindow.isValid()) {
|
}else {
|
||||||
infoWindow = null;
|
|
||||||
} else {
|
|
||||||
tableName = MTable.getTableName(Env.getCtx(), infoWindow.getAD_Table_ID());
|
|
||||||
if (!tableName.equalsIgnoreCase(p_tableName)) {
|
|
||||||
throw new IllegalArgumentException("AD_InfoWindow.TableName <> TableName argument. ("+tableName + " <> " + p_tableName+")");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
infoWindow = MInfoWindow.get(p_tableName, (String)null);
|
infoWindow = MInfoWindow.get(p_tableName, (String)null);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!infoWindow.isValid()) {
|
||||||
|
infoWindow = null;
|
||||||
|
} else {
|
||||||
|
String tableName = MTable.getTableName(Env.getCtx(), infoWindow.getAD_Table_ID());
|
||||||
|
if (!tableName.equalsIgnoreCase(p_tableName)) {
|
||||||
|
throw new IllegalArgumentException("AD_InfoWindow.TableName <> TableName argument. ("+tableName + " <> " + p_tableName+")");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return infoWindow;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected boolean loadInfoDefinition() {
|
||||||
if (infoWindow != null) {
|
if (infoWindow != null) {
|
||||||
if (tableName == null)
|
if (p_tableName == null)
|
||||||
tableName = MTable.getTableName(Env.getCtx(), infoWindow.getAD_Table_ID());
|
p_tableName = MTable.getTableName(Env.getCtx(), infoWindow.getAD_Table_ID());
|
||||||
|
|
||||||
AccessSqlParser sqlParser = new AccessSqlParser("SELECT * FROM " + infoWindow.getFromClause());
|
AccessSqlParser sqlParser = new AccessSqlParser("SELECT * FROM " + infoWindow.getFromClause());
|
||||||
tableInfos = sqlParser.getTableInfo(0);
|
tableInfos = sqlParser.getTableInfo(0);
|
||||||
if (tableInfos[0].getSynonym() != null && tableInfos[0].getSynonym().trim().length() > 0) {
|
if (tableInfos[0].getSynonym() != null && tableInfos[0].getSynonym().trim().length() > 0) {
|
||||||
p_tableName = tableInfos[0].getSynonym().trim();
|
p_tableName = tableInfos[0].getSynonym().trim();
|
||||||
if (p_whereClause != null && p_whereClause.trim().length() > 0) {
|
if (p_whereClause != null && p_whereClause.trim().length() > 0) {
|
||||||
p_whereClause = p_whereClause.replace(tableName+".", p_tableName+".");
|
p_whereClause = p_whereClause.replace(p_tableName+".", p_tableName+".");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -148,7 +148,8 @@ public abstract class InfoPanel extends Window implements EventListener<Event>,
|
||||||
/** Window Width */
|
/** Window Width */
|
||||||
static final int INFO_WIDTH = 800;
|
static final int INFO_WIDTH = 800;
|
||||||
protected boolean m_lookup;
|
protected boolean m_lookup;
|
||||||
|
protected int AD_InfoWindow_ID;
|
||||||
|
|
||||||
/**************************************************
|
/**************************************************
|
||||||
* Detail Constructor
|
* Detail Constructor
|
||||||
* @param WindowNo WindowNo
|
* @param WindowNo WindowNo
|
||||||
|
@ -163,6 +164,13 @@ public abstract class InfoPanel extends Window implements EventListener<Event>,
|
||||||
this(WindowNo, tableName, keyColumn, multipleSelection, whereClause, true);
|
this(WindowNo, tableName, keyColumn, multipleSelection, whereClause, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected InfoPanel (int WindowNo,
|
||||||
|
String tableName, String keyColumn,boolean multipleSelection,
|
||||||
|
String whereClause, boolean lookup){
|
||||||
|
this(WindowNo, tableName, keyColumn, multipleSelection, whereClause,
|
||||||
|
lookup, 0);
|
||||||
|
}
|
||||||
|
|
||||||
/**************************************************
|
/**************************************************
|
||||||
* Detail Constructor
|
* Detail Constructor
|
||||||
* @param WindowNo WindowNo
|
* @param WindowNo WindowNo
|
||||||
|
@ -172,7 +180,7 @@ public abstract class InfoPanel extends Window implements EventListener<Event>,
|
||||||
*/
|
*/
|
||||||
protected InfoPanel (int WindowNo,
|
protected InfoPanel (int WindowNo,
|
||||||
String tableName, String keyColumn,boolean multipleSelection,
|
String tableName, String keyColumn,boolean multipleSelection,
|
||||||
String whereClause, boolean lookup)
|
String whereClause, boolean lookup, int ADInfoWindowID)
|
||||||
{
|
{
|
||||||
if (WindowNo <= 0) {
|
if (WindowNo <= 0) {
|
||||||
p_WindowNo = SessionManager.getAppDesktop().registerWindow(this);
|
p_WindowNo = SessionManager.getAppDesktop().registerWindow(this);
|
||||||
|
@ -182,11 +190,12 @@ public abstract class InfoPanel extends Window implements EventListener<Event>,
|
||||||
if (log.isLoggable(Level.INFO))
|
if (log.isLoggable(Level.INFO))
|
||||||
log.info("WinNo=" + WindowNo + " " + whereClause);
|
log.info("WinNo=" + WindowNo + " " + whereClause);
|
||||||
p_tableName = tableName;
|
p_tableName = tableName;
|
||||||
|
this.AD_InfoWindow_ID = ADInfoWindowID;
|
||||||
p_keyColumn = keyColumn;
|
p_keyColumn = keyColumn;
|
||||||
|
|
||||||
p_multipleSelection = multipleSelection;
|
p_multipleSelection = multipleSelection;
|
||||||
m_lookup = lookup;
|
m_lookup = lookup;
|
||||||
|
infoWindow = loadInfoWindowData(this.AD_InfoWindow_ID);
|
||||||
if (whereClause == null || whereClause.indexOf('@') == -1)
|
if (whereClause == null || whereClause.indexOf('@') == -1)
|
||||||
p_whereClause = whereClause == null ? "" : whereClause;
|
p_whereClause = whereClause == null ? "" : whereClause;
|
||||||
else
|
else
|
||||||
|
@ -208,7 +217,6 @@ public abstract class InfoPanel extends Window implements EventListener<Event>,
|
||||||
|
|
||||||
setWidgetAttribute(AdempiereWebUI.WIDGET_INSTANCE_NAME, "infopanel");
|
setWidgetAttribute(AdempiereWebUI.WIDGET_INSTANCE_NAME, "infopanel");
|
||||||
|
|
||||||
infoWindow = MInfoWindow.get(p_keyColumn.replace("_ID", ""), null);
|
|
||||||
addEventListener(WindowContainer.ON_WINDOW_CONTAINER_SELECTION_CHANGED_EVENT, this);
|
addEventListener(WindowContainer.ON_WINDOW_CONTAINER_SELECTION_CHANGED_EVENT, this);
|
||||||
addEventListener(ON_RUN_PROCESS, this);
|
addEventListener(ON_RUN_PROCESS, this);
|
||||||
addEventListener(Events.ON_CLOSE, this);
|
addEventListener(Events.ON_CLOSE, this);
|
||||||
|
@ -304,7 +312,7 @@ public abstract class InfoPanel extends Window implements EventListener<Event>,
|
||||||
/** PO Zoom Window */
|
/** PO Zoom Window */
|
||||||
private int m_PO_Window_ID = -1;
|
private int m_PO_Window_ID = -1;
|
||||||
|
|
||||||
private MInfoWindow infoWindow;
|
protected MInfoWindow infoWindow;
|
||||||
|
|
||||||
/** Logger */
|
/** Logger */
|
||||||
protected CLogger log = CLogger.getCLogger(getClass());
|
protected CLogger log = CLogger.getCLogger(getClass());
|
||||||
|
@ -1126,7 +1134,11 @@ public abstract class InfoPanel extends Window implements EventListener<Event>,
|
||||||
return sb.toString();
|
return sb.toString();
|
||||||
} // getSelectedSQL;
|
} // getSelectedSQL;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* query ADInfoWindow from ADInfoWindowID
|
||||||
|
* @param ADInfoWindowID
|
||||||
|
*/
|
||||||
|
protected MInfoWindow loadInfoWindowData (int ADInfoWindowID){return null;}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get Table name Synonym
|
* Get Table name Synonym
|
||||||
|
|
Loading…
Reference in New Issue