From 3b1bf465428c42d2189b06c4092c9b1239d0c11b Mon Sep 17 00:00:00 2001 From: "Redhuan D. Oon" Date: Mon, 9 Jul 2018 19:24:07 +0200 Subject: [PATCH] IDEMPIERE-3631 InfoWindow : Reference Date+Time only displays Date in grid --- .../webui/component/WListItemRenderer.java | 13 ++++++++++--- .../src/org/adempiere/webui/component/WListbox.java | 10 +++++++--- .../org/adempiere/webui/component/WTableColumn.java | 10 ++++++++++ .../src/org/adempiere/webui/info/InfoWindow.java | 1 + .../src/org/compiere/minigrid/ColumnInfo.java | 9 +++++++++ 5 files changed, 37 insertions(+), 6 deletions(-) diff --git a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/component/WListItemRenderer.java b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/component/WListItemRenderer.java index e8e9931174..82c49fdc5d 100644 --- a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/component/WListItemRenderer.java +++ b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/component/WListItemRenderer.java @@ -294,8 +294,11 @@ public class WListItemRenderer implements ListitemRenderer, 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, 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, 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; diff --git a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/component/WListbox.java b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/component/WListbox.java index ef04eaffbc..7969600657 100644 --- a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/component/WListbox.java +++ b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/component/WListbox.java @@ -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; diff --git a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/component/WTableColumn.java b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/component/WTableColumn.java index 05a34d4289..24b6753a9a 100644 --- a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/component/WTableColumn.java +++ b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/component/WTableColumn.java @@ -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; + } } diff --git a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/info/InfoWindow.java b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/info/InfoWindow.java index ba93dd4d12..b2a8b53bb2 100644 --- a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/info/InfoWindow.java +++ b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/info/InfoWindow.java @@ -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); diff --git a/org.adempiere.ui/src/org/compiere/minigrid/ColumnInfo.java b/org.adempiere.ui/src/org/compiere/minigrid/ColumnInfo.java index ec416b191d..9fd98b7d42 100644 --- a/org.adempiere.ui/src/org/compiere/minigrid/ColumnInfo.java +++ b/org.adempiere.ui/src/org/compiere/minigrid/ColumnInfo.java @@ -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