From ce7121ae85f8ab18623eb4f9bace2968ae1bd58d Mon Sep 17 00:00:00 2001 From: Diego Ruiz Date: Mon, 20 Jan 2020 18:33:22 +0100 Subject: [PATCH] IDEMPIERE-4151 Label Style not working when a field is set to Heading Only --- .../adempiere/webui/adwindow/ADTabpanel.java | 21 +++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/adwindow/ADTabpanel.java b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/adwindow/ADTabpanel.java index 33019fa8f8..46ca50d9f1 100644 --- a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/adwindow/ADTabpanel.java +++ b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/adwindow/ADTabpanel.java @@ -57,6 +57,7 @@ import org.adempiere.webui.editor.WebEditorFactory; import org.adempiere.webui.event.ContextMenuListener; import org.adempiere.webui.panel.HelpController; import org.adempiere.webui.session.SessionManager; +import org.adempiere.webui.theme.ThemeManager; import org.adempiere.webui.util.GridTabDataBinder; import org.adempiere.webui.util.TreeUtils; import org.adempiere.webui.util.ZKUpdateUtil; @@ -71,6 +72,7 @@ import org.compiere.model.I_AD_Preference; import org.compiere.model.MColumn; import org.compiere.model.MPreference; import org.compiere.model.MRole; +import org.compiere.model.MStyle; import org.compiere.model.MSysConfig; import org.compiere.model.MTab; import org.compiere.model.MTable; @@ -736,6 +738,25 @@ DataStatusListener, IADTabpanel, IdSpace, IFieldEditorContainer Label label = new Label(field.getHeader()); Div div = new Div(); div.setSclass("form-label-heading"); + if (field.getAD_FieldStyle_ID() > 0) { + MStyle style = MStyle.get(Env.getCtx(), field.getAD_FieldStyle_ID()); + String cssStyle = style.buildStyle(ThemeManager.getTheme(), new Evaluatee() { + @Override + public String get_ValueAsString(String variableName) { + return field.get_ValueAsString(variableName); + } + }); + if (cssStyle != null && cssStyle.startsWith(MStyle.SCLASS_PREFIX)) { + String sclass = cssStyle.substring(MStyle.SCLASS_PREFIX.length()); + div.setSclass(sclass); + } else if (style != null && cssStyle.startsWith(MStyle.ZCLASS_PREFIX)) { + String zclass = cssStyle.substring(MStyle.ZCLASS_PREFIX.length()); + div.setZclass(zclass); + } else { + div.setStyle(cssStyle); + } + } + row.appendCellChild(createSpacer()); div.appendChild(label); row.appendCellChild(div);