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
This commit is contained in:
Carlos Ruiz 2020-11-05 13:58:51 +01:00 committed by GitHub
parent d454b03407
commit ffd05346f9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 51 additions and 6 deletions

View File

@ -17,7 +17,6 @@ import java.util.Calendar;
import java.util.Date; import java.util.Date;
import org.zkoss.zk.ui.event.EventListener; import org.zkoss.zk.ui.event.EventListener;
import org.zkoss.zul.Timebox;
/** /**
* *

View File

@ -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());
}
}
}

View File

@ -29,6 +29,7 @@ import org.adempiere.webui.component.Label;
import org.adempiere.webui.component.Row; import org.adempiere.webui.component.Row;
import org.adempiere.webui.component.Rows; import org.adempiere.webui.component.Rows;
import org.adempiere.webui.component.Textbox; import org.adempiere.webui.component.Textbox;
import org.adempiere.webui.component.Timebox;
import org.adempiere.webui.component.Window; import org.adempiere.webui.component.Window;
import org.adempiere.webui.editor.WTableDirEditor; import org.adempiere.webui.editor.WTableDirEditor;
import org.adempiere.webui.theme.ThemeManager; 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.zk.ui.event.Events;
import org.zkoss.zul.Center; import org.zkoss.zul.Center;
import org.zkoss.zul.South; import org.zkoss.zul.South;
import org.zkoss.zul.Timebox;
/** /**
* *
@ -245,13 +245,13 @@ public class RequestWindow extends Window implements EventListener<Event> {
rows.appendChild(row); rows.appendChild(row);
row.appendChild(lblStartTime.rightAlign()); row.appendChild(lblStartTime.rightAlign());
row.appendChild(tbxStartTime); row.appendChild(tbxStartTime);
ZKUpdateUtil.setWidth(tbxStartTime, "40%"); ZKUpdateUtil.setWidth(tbxStartTime, "50%");
row = new Row(); row = new Row();
rows.appendChild(row); rows.appendChild(row);
row.appendChild(lblEndTime.rightAlign()); row.appendChild(lblEndTime.rightAlign());
row.appendChild(tbxEndTime); row.appendChild(tbxEndTime);
ZKUpdateUtil.setWidth(tbxEndTime, "40%"); ZKUpdateUtil.setWidth(tbxEndTime, "50%");
Borderlayout borderlayout = new Borderlayout(); Borderlayout borderlayout = new Borderlayout();
this.appendChild(borderlayout); this.appendChild(borderlayout);

View File

@ -18,6 +18,7 @@ import java.util.Date;
import java.util.logging.Level; import java.util.logging.Level;
import org.adempiere.webui.ValuePreference; import org.adempiere.webui.ValuePreference;
import org.adempiere.webui.component.Timebox;
import org.adempiere.webui.event.ContextMenuEvent; import org.adempiere.webui.event.ContextMenuEvent;
import org.adempiere.webui.event.ContextMenuListener; import org.adempiere.webui.event.ContextMenuListener;
import org.adempiere.webui.event.ValueChangeEvent; import org.adempiere.webui.event.ValueChangeEvent;
@ -26,7 +27,6 @@ import org.compiere.model.GridField;
import org.compiere.util.CLogger; import org.compiere.util.CLogger;
import org.zkoss.zk.ui.event.Event; import org.zkoss.zk.ui.event.Event;
import org.zkoss.zk.ui.event.Events; import org.zkoss.zk.ui.event.Events;
import org.zkoss.zul.Timebox;
/** /**
* *

View File

@ -42,6 +42,7 @@ import org.adempiere.webui.component.NumberBox;
import org.adempiere.webui.component.Row; import org.adempiere.webui.component.Row;
import org.adempiere.webui.component.Rows; import org.adempiere.webui.component.Rows;
import org.adempiere.webui.component.Textbox; import org.adempiere.webui.component.Textbox;
import org.adempiere.webui.component.Timebox;
import org.adempiere.webui.component.Window; import org.adempiere.webui.component.Window;
import org.adempiere.webui.theme.ThemeManager; import org.adempiere.webui.theme.ThemeManager;
import org.adempiere.webui.util.ZKUpdateUtil; 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.zk.ui.event.Events;
import org.zkoss.zul.Div; import org.zkoss.zul.Div;
import org.zkoss.zul.Listitem; import org.zkoss.zul.Listitem;
import org.zkoss.zul.Timebox;
/** /**
* Resource Assignment Dialog * Resource Assignment Dialog