From ffd05346f9cb27a0d3adaa3e9bf5d3de287c5569 Mon Sep 17 00:00:00 2001 From: Carlos Ruiz Date: Thu, 5 Nov 2020 13:58:51 +0100 Subject: [PATCH] IDEMPIERE-3921 DateTimeBox assigned Time format. (#354) * IDEMPIERE-3921 DateTimeBox assigned Time format. Use time pattern defined in language for time fields * IDEMPIERE-3921 DateTimeBox assigned Time format. Move setting format to constructor --- .../webui/component/DatetimeBox.java | 1 - .../adempiere/webui/component/Timebox.java | 46 +++++++++++++++++++ .../webui/dashboard/RequestWindow.java | 6 +-- .../adempiere/webui/editor/WTimeEditor.java | 2 +- .../webui/window/WAssignmentDialog.java | 2 +- 5 files changed, 51 insertions(+), 6 deletions(-) create mode 100644 org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/component/Timebox.java diff --git a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/component/DatetimeBox.java b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/component/DatetimeBox.java index f5d4d28382..4a2377f2dd 100644 --- a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/component/DatetimeBox.java +++ b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/component/DatetimeBox.java @@ -17,7 +17,6 @@ import java.util.Calendar; import java.util.Date; import org.zkoss.zk.ui.event.EventListener; -import org.zkoss.zul.Timebox; /** * diff --git a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/component/Timebox.java b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/component/Timebox.java new file mode 100644 index 0000000000..4e9bd170b2 --- /dev/null +++ b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/component/Timebox.java @@ -0,0 +1,46 @@ +/*********************************************************************** + * This file is part of iDempiere ERP Open Source * + * http://www.idempiere.org * + * * + * Copyright (C) Contributors * + * * + * This program is free software; you can redistribute it and/or * + * modify it under the terms of the GNU General Public License * + * as published by the Free Software Foundation; either version 2 * + * of the License, or (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program; if not, write to the Free Software * + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, * + * MA 02110-1301, USA. * + * * + * Contributors: * + * - Carlos Ruiz - globalqss * + **********************************************************************/ +package org.adempiere.webui.component; + +import org.compiere.model.MLanguage; +import org.compiere.util.Env; +import org.compiere.util.Language; + +public class Timebox extends org.zkoss.zul.Timebox +{ + /** + * + */ + private static final long serialVersionUID = 3904468791491496039L; + + public Timebox() { + super(); + MLanguage mlang = MLanguage.get(Env.getCtx(), Language.getLoginLanguage()); + if (mlang != null && mlang.get_ID() > 0 && mlang.getTimePattern() != null) { + setFormat(mlang.getTimePattern()); + } + } + +} diff --git a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/dashboard/RequestWindow.java b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/dashboard/RequestWindow.java index 47141eb347..964125b552 100644 --- a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/dashboard/RequestWindow.java +++ b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/dashboard/RequestWindow.java @@ -29,6 +29,7 @@ import org.adempiere.webui.component.Label; import org.adempiere.webui.component.Row; import org.adempiere.webui.component.Rows; import org.adempiere.webui.component.Textbox; +import org.adempiere.webui.component.Timebox; import org.adempiere.webui.component.Window; import org.adempiere.webui.editor.WTableDirEditor; import org.adempiere.webui.theme.ThemeManager; @@ -50,7 +51,6 @@ import org.zkoss.zk.ui.event.EventListener; import org.zkoss.zk.ui.event.Events; import org.zkoss.zul.Center; import org.zkoss.zul.South; -import org.zkoss.zul.Timebox; /** * @@ -245,13 +245,13 @@ public class RequestWindow extends Window implements EventListener { rows.appendChild(row); row.appendChild(lblStartTime.rightAlign()); row.appendChild(tbxStartTime); - ZKUpdateUtil.setWidth(tbxStartTime, "40%"); + ZKUpdateUtil.setWidth(tbxStartTime, "50%"); row = new Row(); rows.appendChild(row); row.appendChild(lblEndTime.rightAlign()); row.appendChild(tbxEndTime); - ZKUpdateUtil.setWidth(tbxEndTime, "40%"); + ZKUpdateUtil.setWidth(tbxEndTime, "50%"); Borderlayout borderlayout = new Borderlayout(); this.appendChild(borderlayout); diff --git a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/editor/WTimeEditor.java b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/editor/WTimeEditor.java index 90ba1caf67..85b3110feb 100644 --- a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/editor/WTimeEditor.java +++ b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/editor/WTimeEditor.java @@ -18,6 +18,7 @@ import java.util.Date; import java.util.logging.Level; import org.adempiere.webui.ValuePreference; +import org.adempiere.webui.component.Timebox; import org.adempiere.webui.event.ContextMenuEvent; import org.adempiere.webui.event.ContextMenuListener; import org.adempiere.webui.event.ValueChangeEvent; @@ -26,7 +27,6 @@ import org.compiere.model.GridField; import org.compiere.util.CLogger; import org.zkoss.zk.ui.event.Event; import org.zkoss.zk.ui.event.Events; -import org.zkoss.zul.Timebox; /** * 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 c0cff66c1d..093c0ac359 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 @@ -42,6 +42,7 @@ import org.adempiere.webui.component.NumberBox; import org.adempiere.webui.component.Row; import org.adempiere.webui.component.Rows; import org.adempiere.webui.component.Textbox; +import org.adempiere.webui.component.Timebox; import org.adempiere.webui.component.Window; import org.adempiere.webui.theme.ThemeManager; import org.adempiere.webui.util.ZKUpdateUtil; @@ -59,7 +60,6 @@ import org.zkoss.zk.ui.event.EventListener; import org.zkoss.zk.ui.event.Events; import org.zkoss.zul.Div; import org.zkoss.zul.Listitem; -import org.zkoss.zul.Timebox; /** * Resource Assignment Dialog