IDEMPIERE-325 Complete AD based info window ( AD_InfoWindow ) implementation / Several fixes:

- Fix problem when the window doesn't have info columns (i.e. info window for Sales Order Line)
- Fix swing problem rendering the total line
- Add search to text fields additionally to string fields (allows to search also for Sales Order Line)
This commit is contained in:
Carlos Ruiz 2013-04-16 13:37:39 -05:00
parent 388d87e2dd
commit 964c2cdaf5
6 changed files with 31 additions and 10 deletions

View File

@ -120,10 +120,15 @@ public class DefaultInfoFactory implements IInfoFactory {
else if (tableName.equals("S_ResourceAssigment"))
info = new InfoAssignment (frame, modal, WindowNo, value,
multiSelection, whereClause, lookup);
else
else {
info = new InfoGeneral (frame, modal, WindowNo, value,
tableName, keyColumn,
multiSelection, whereClause, lookup);
tableName, keyColumn,
multiSelection, whereClause, lookup);
if (!info.loadedOK()) {
info.dispose(false);
info = null;
}
}
//
return info;
}

View File

@ -100,6 +100,8 @@ public class InfoGeneral extends Info
//
statInit();
p_loadedOK = initInfo ();
if (!p_loadedOK)
return;
//
int no = p_table.getRowCount();
setStatusLine(Integer.toString(no) + " "
@ -233,14 +235,14 @@ public class InfoGeneral extends Info
String sql = "SELECT c.ColumnName, t.AD_Table_ID, t.TableName, c.ColumnSql "
+ "FROM AD_Table t"
+ " INNER JOIN AD_Column c ON (t.AD_Table_ID=c.AD_Table_ID)"
+ "WHERE c.AD_Reference_ID=10"
+ "WHERE c.AD_Reference_ID IN (10,14)"
+ " AND t.TableName=?" // #1
// Displayed in Window
+ " AND EXISTS (SELECT * FROM AD_Field f "
+ "WHERE f.AD_Column_ID=c.AD_Column_ID"
+ " 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.AD_Reference_ID, c.SeqNo";
int AD_Table_ID = 0;
String tableName = null;
PreparedStatement pstmt = null;
@ -278,6 +280,7 @@ public class InfoGeneral extends Info
// Miminum check
if (m_queryColumns.size() == 0)
{
ADialog.error(p_WindowNo, this, "Error", "No query columns found");
log.log(Level.SEVERE, "No query columns found");
return false;
}

View File

@ -21,6 +21,7 @@ import java.awt.Component;
import java.awt.Insets;
import java.text.DecimalFormat;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.logging.Level;
import javax.swing.JCheckBox;
@ -204,10 +205,16 @@ public final class VCellRenderer extends DefaultTableCellRenderer
;
// Number
else if (DisplayType.isNumeric(m_displayType))
retValue = m_numberFormat.format(value);
if (value instanceof Number)
retValue = m_numberFormat.format(value);
else
retValue = value.toString();
// Date
else if (DisplayType.isDate(m_displayType))
retValue = m_dateFormat.format(value);
if (value instanceof Date)
retValue = m_dateFormat.format(value);
else
retValue = value.toString();
// Row ID
else if (m_displayType == DisplayType.RowID)
retValue = "";

View File

@ -549,7 +549,8 @@ public class WSearchEditor extends WEditor implements ContextMenuListener, Value
getDirectAccessSQL("*");
final InfoPanel ip = InfoManager.create(lookup, gridField, m_tableName, m_keyColumnName, queryValue, false, whereClause);
showInfoPanel(ip);
if (ip != null)
showInfoPanel(ip);
}

View File

@ -108,6 +108,10 @@ public class DefaultInfoFactory implements IInfoFactory {
info = new InfoGeneralPanel (value, WindowNo,
tableName, keyColumn,
multiSelection, whereClause, lookup);
if (!info.loadedOK()) {
info.dispose(false);
info = null;
}
}
}
//

View File

@ -259,13 +259,13 @@ public class InfoGeneralPanel extends InfoPanel implements EventListener<Event>
String sql = "SELECT c.ColumnName, t.AD_Table_ID, t.TableName, c.ColumnSql "
+ "FROM AD_Table t"
+ " INNER JOIN AD_Column c ON (t.AD_Table_ID=c.AD_Table_ID)"
+ "WHERE c.AD_Reference_ID=10"
+ "WHERE c.AD_Reference_ID IN (10,14)"
+ " AND t.TableName=?" // #1
// Displayed in Window
+ " AND EXISTS (SELECT * FROM AD_Field f "
+ "WHERE f.AD_Column_ID=c.AD_Column_ID"
+ " 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.AD_Reference_ID, c.SeqNo";
int AD_Table_ID = 0;
String tableName = null;
@ -310,6 +310,7 @@ public class InfoGeneralPanel extends InfoPanel implements EventListener<Event>
// Miminum check
if (m_queryColumns.size() == 0)
{
FDialog.error(p_WindowNo, this, "Error", "No query columns found");
log.log(Level.SEVERE, "No query columns found");
return false;
}