From f1dc9e783ce2e1024af08e3b5a3d66fb83cc0235 Mon Sep 17 00:00:00 2001 From: Carlos Ruiz Date: Thu, 16 Jun 2011 21:54:03 -0500 Subject: [PATCH] fixes #39 Unify format of datefields on forms http://bitbucket.org/idempiere/idempiere/issue/39 --- .../org/adempiere/webui/apps/form/WArchiveViewer.java | 2 -- .../src/org/adempiere/webui/component/Datebox.java | 11 ++++++++++- .../adempiere/webui/component/WListItemRenderer.java | 1 - .../src/org/adempiere/webui/editor/WDateEditor.java | 1 - .../org/adempiere/webui/editor/WDatetimeEditor.java | 1 - .../org/adempiere/webui/window/WAssignmentDialog.java | 2 +- 6 files changed, 11 insertions(+), 7 deletions(-) diff --git a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/apps/form/WArchiveViewer.java b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/apps/form/WArchiveViewer.java index 2338f4f98a..18bff82b75 100644 --- a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/apps/form/WArchiveViewer.java +++ b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/apps/form/WArchiveViewer.java @@ -304,9 +304,7 @@ public class WArchiveViewer extends Archive implements IFormController, EventLis div.appendChild(createdQLabel); row.appendChild(div); row.appendChild(createdQFrom); - createdQFrom.setWidth("100%"); row.appendChild(createdQTo); - createdQTo.setWidth("100%"); div = new Div(); div.setAlign("center"); diff --git a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/component/Datebox.java b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/component/Datebox.java index 16e2da427a..4945d9a062 100644 --- a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/component/Datebox.java +++ b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/component/Datebox.java @@ -17,6 +17,10 @@ package org.adempiere.webui.component; +import org.adempiere.webui.apps.AEnv; +import org.compiere.util.DisplayType; +import org.compiere.util.Env; + /** * * @author Ashley G Ramdass @@ -25,11 +29,16 @@ package org.adempiere.webui.component; */ public class Datebox extends org.zkoss.zul.Datebox { - /** + /** * */ private static final long serialVersionUID = -5890574778856946570L; + public Datebox() { + super(); + setFormat(DisplayType.getDateFormat(AEnv.getLanguage(Env.getCtx())).toPattern()); + } + public void setEnabled(boolean enabled) { this.setReadonly(!enabled); 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 e1d1a07a12..7523572a40 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 @@ -280,7 +280,6 @@ public class WListItemRenderer implements ListitemRenderer, EventListener, Listi if (isCellEditable) { Datebox datebox = new Datebox(); - datebox.setFormat(dateFormat.toPattern()); datebox.setValue(new Date(((Timestamp)field).getTime())); datebox.addEventListener(Events.ON_CHANGE, this); listcell.appendChild(datebox); diff --git a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/editor/WDateEditor.java b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/editor/WDateEditor.java index 367cac088c..60e27be363 100644 --- a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/editor/WDateEditor.java +++ b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/editor/WDateEditor.java @@ -106,7 +106,6 @@ public class WDateEditor extends WEditor implements ContextMenuListener private void init() { - getComponent().setFormat(DisplayType.getDateFormat(AEnv.getLanguage(Env.getCtx())).toPattern()); popupMenu = new WEditorPopupMenu(false, false, true); popupMenu.addMenuListener(this); if (gridField != null && gridField.getGridTab() != null) diff --git a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/editor/WDatetimeEditor.java b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/editor/WDatetimeEditor.java index 77ede77100..a3cd0ba3fd 100644 --- a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/editor/WDatetimeEditor.java +++ b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/editor/WDatetimeEditor.java @@ -98,7 +98,6 @@ public class WDatetimeEditor extends WEditor implements ContextMenuListener private void init() { - getComponent().setDateFormat(DisplayType.getDateFormat()); popupMenu = new WEditorPopupMenu(false, false, true); popupMenu.addMenuListener(this); if (gridField != null && gridField.getGridTab() != null) diff --git a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/window/WAssignmentDialog.java b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/window/WAssignmentDialog.java index 573f99f61f..7dd5121b23 100644 --- a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/window/WAssignmentDialog.java +++ b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/window/WAssignmentDialog.java @@ -174,7 +174,7 @@ public class WAssignmentDialog extends Window implements EventListener Div div = new Div(); div.appendChild(fDateFrom); div.appendChild(fTimeFrom); - fTimeFrom.setStyle("margin-left: 5px"); + fTimeFrom.setStyle("margin-left: 1px"); row.appendChild(div); rows.appendChild(row);