IDEMPIERE-1448 Import File Loader window is showing columnnames. Peer review and commit patch from Carlos Ruiz.

This commit is contained in:
Heng Sin Low 2013-12-13 20:27:59 +08:00
parent dc1ac23175
commit ed0d30fd31
4 changed files with 29 additions and 5 deletions

View File

@ -305,7 +305,7 @@ public final class ImpFormat
private static void loadRows (ImpFormat format, int ID) private static void loadRows (ImpFormat format, int ID)
{ {
String sql = "SELECT f.SeqNo,c.ColumnName,f.StartNo,f.EndNo,f.DataType,c.FieldLength," // 1..6 String sql = "SELECT f.SeqNo,c.ColumnName,f.StartNo,f.EndNo,f.DataType,c.FieldLength," // 1..6
+ "f.DataFormat,f.DecimalPoint,f.DivideBy100,f.ConstantValue,f.Callout " // 7..11 + "f.DataFormat,f.DecimalPoint,f.DivideBy100,f.ConstantValue,f.Callout,f.Name " // 7..12
+ "FROM AD_ImpFormat_Row f,AD_Column c " + "FROM AD_ImpFormat_Row f,AD_Column c "
+ "WHERE f.AD_ImpFormat_ID=? AND f.AD_Column_ID=c.AD_Column_ID AND f.IsActive='Y'" + "WHERE f.AD_ImpFormat_ID=? AND f.AD_Column_ID=c.AD_Column_ID AND f.IsActive='Y'"
+ "ORDER BY f.SeqNo"; + "ORDER BY f.SeqNo";
@ -319,7 +319,7 @@ public final class ImpFormat
while (rs.next()) while (rs.next())
{ {
ImpFormatRow row = new ImpFormatRow (rs.getInt(1), ImpFormatRow row = new ImpFormatRow (rs.getInt(1),
rs.getString(2), rs.getInt(3), rs.getInt(4), rs.getString(5), rs.getInt(6)); rs.getString(2), rs.getInt(3), rs.getInt(4), rs.getString(5), rs.getInt(6), rs.getString(12));
// //
row.setFormatInfo(rs.getString(7), rs.getString(8), row.setFormatInfo(rs.getString(7), rs.getString(8),
rs.getString(9).equals("Y"), rs.getString(9).equals("Y"),

View File

@ -52,11 +52,13 @@ public final class ImpFormatRow
* @param endNo and no * @param endNo and no
* @param dataType data type - see constants DATATYPE_ * @param dataType data type - see constants DATATYPE_
* @param maxLength if String it is the maximum length (truncated) * @param maxLength if String it is the maximum length (truncated)
* @param name column label
*/ */
public ImpFormatRow(int seqNo, String columnName, int startNo, int endNo, String dataType, int maxLength) public ImpFormatRow(int seqNo, String columnName, int startNo, int endNo, String dataType, int maxLength, String name)
{ {
m_seqNo = seqNo; m_seqNo = seqNo;
setColumnName(columnName); setColumnName(columnName);
setName(name);
m_startNo = startNo; m_startNo = startNo;
m_endNo = endNo; m_endNo = endNo;
setDataType (dataType); setDataType (dataType);
@ -80,6 +82,7 @@ public final class ImpFormatRow
private int m_seqNo; private int m_seqNo;
private String m_columnName; private String m_columnName;
private String m_name;
private int m_startNo = 0; private int m_startNo = 0;
private int m_endNo = 0; private int m_endNo = 0;
private String m_dataType; private String m_dataType;
@ -173,6 +176,27 @@ public final class ImpFormatRow
return m_columnName; return m_columnName;
} // getColumnName } // getColumnName
/**
* Name
* @param Name name
*/
public void setName (String name)
{
if (name == null || name.length() == 0)
throw new IllegalArgumentException("Name must be at least 1 char");
else
m_name = name;
} // setName
/**
* Get Name
* @return Name
*/
public String getName()
{
return m_name;
} // getName
/** /**
* Data Type * Data Type
* @param dataType data type - see constants DATATYPE_ * @param dataType data type - see constants DATATYPE_

View File

@ -391,7 +391,7 @@ public class VFileImport extends CPanel
for (int i = 0; i < size; i++) for (int i = 0; i < size; i++)
{ {
ImpFormatRow row = m_format.getRow(i); ImpFormatRow row = m_format.getRow(i);
m_labels[i] = new JLabel (row.getColumnName()); m_labels[i] = new JLabel (row.getName());
previewPanel.add(m_labels[i], new GridBagConstraints(i, 0, 1, 1, 1.0, 1.0, previewPanel.add(m_labels[i], new GridBagConstraints(i, 0, 1, 1, 1.0, 1.0,
GridBagConstraints.CENTER, GridBagConstraints.NONE, new Insets(2, 2, 2, 2), 0, 0)); GridBagConstraints.CENTER, GridBagConstraints.NONE, new Insets(2, 2, 2, 2), 0, 0));
// //

View File

@ -480,7 +480,7 @@ public class WFileImport extends ADForm implements EventListener<Event>
{ {
ImpFormatRow row = m_format.getRow(i); ImpFormatRow row = m_format.getRow(i);
m_labels[i] = new Label(row.getColumnName()); m_labels[i] = new Label(row.getName());
Hbox hbox = new Hbox(); Hbox hbox = new Hbox();
hbox.setWidth("100%"); hbox.setWidth("100%");