IDEMPIERE-3631 InfoWindow : Reference Date+Time only displays Date in grid

This commit is contained in:
Redhuan D. Oon 2018-07-09 19:24:07 +02:00
parent 3f1026519f
commit 3b1bf46542
5 changed files with 37 additions and 6 deletions

View File

@ -294,8 +294,11 @@ public class WListItemRenderer implements ListitemRenderer<Object>, EventListene
}
else if (field instanceof Timestamp)
{
SimpleDateFormat dateFormat = DisplayType.getDateFormat(DisplayType.Date, AEnv.getLanguage(Env.getCtx()));
if (m_tableColumns.get(columnIndex).getAD_Reference_ID()==DisplayType.DateTime) {
dateFormat = DisplayType.getDateFormat(DisplayType.DateTime, AEnv.getLanguage(Env.getCtx()),"dd/M/yyyy hh:mm");
}
listcell.setValue(dateFormat.format((Timestamp)field));
if (isCellEditable)
{
@ -396,7 +399,10 @@ public class WListItemRenderer implements ListitemRenderer<Object>, EventListene
{
addColumn(header, null);
}
public void addColumn(String header, String description)
{
addColumn(header, description, 0);
}
/**
* Add Table Column.
* after adding a column, you need to set the column classes again
@ -405,13 +411,14 @@ public class WListItemRenderer implements ListitemRenderer<Object>, EventListene
* @param header The header text for the column
* @param description
*/
public void addColumn(String header, String description)
public void addColumn(String header, String description, int AD_Reference_ID)
{
WTableColumn tableColumn;
tableColumn = new WTableColumn();
tableColumn.setHeaderValue(Util.cleanAmp(header));
tableColumn.setTooltipText(description);
tableColumn.setAD_Reference_ID(AD_Reference_ID);
m_tableColumns.add(tableColumn);
return;

View File

@ -371,7 +371,7 @@ public class WListbox extends Listbox implements IMiniTable, TableValueChangeLis
}
// add to model
addColumn(layout[columnIndex].getColHeader(), layout[columnIndex].getColDescription());
addColumn(layout[columnIndex].getColHeader(), layout[columnIndex].getColDescription(), layout[columnIndex].getAD_Reference_ID());
// set the colour column
if (layout[columnIndex].isColorColumn())
@ -438,16 +438,20 @@ public class WListbox extends Listbox implements IMiniTable, TableValueChangeLis
addColumn(header, null);
}
public void addColumn (String header, String description)
{
addColumn(header, description, 0);
}
/**
* Add Table Column and specify the column header.
*
* @param header name of column header
* @param description
*/
public void addColumn (String header, String description)
public void addColumn (String header, String description, int AD_Reference_ID)
{
WListItemRenderer renderer = (WListItemRenderer)getItemRenderer();
renderer.addColumn(Util.cleanAmp(header), description);
renderer.addColumn(Util.cleanAmp(header), description, AD_Reference_ID);
getModel().addColumn();
return;

View File

@ -45,6 +45,8 @@ public class WTableColumn
protected String tooltipText;
private int AD_Reference_ID;
/**
* Cover method, using a default width of 75
* @see #WTableColumn(int)
@ -288,4 +290,12 @@ public class WTableColumn
public void setTooltipText(String tooltipText) {
this.tooltipText = tooltipText;
}
public int getAD_Reference_ID() {
return AD_Reference_ID;
}
public void setAD_Reference_ID(int AD_Reference_ID) {
this.AD_Reference_ID=AD_Reference_ID;
}
}

View File

@ -710,6 +710,7 @@ public class InfoWindow extends InfoPanel implements ValueChangeListener, EventL
columnInfo = new ColumnInfo(infoColumn.get_Translation("Name"), colSQL, DisplayType.getClass(infoColumn.getAD_Reference_ID(), true));
}
columnInfo.setColDescription(infoColumn.get_Translation("Description"));
columnInfo.setAD_Reference_ID(infoColumn.getAD_Reference_ID());
columnInfo.setGridField(gridFields.get(i));
list.add(columnInfo);

View File

@ -82,6 +82,7 @@ public class ColumnInfo
private GridField m_gridField;
private String colDescription;
private int AD_Reference_ID;
/**
* Get Col Class
@ -214,4 +215,12 @@ public class ColumnInfo
public void setColDescription(String colDescription) {
this.colDescription = colDescription;
}
public int getAD_Reference_ID() {
return AD_Reference_ID;
}
public void setAD_Reference_ID(int AD_Reference_ID) {
this.AD_Reference_ID = AD_Reference_ID;
}
} // infoColumn