IDEMPIERE-4151 Label Style not working when a field is set to Heading Only

This commit is contained in:
Diego Ruiz 2020-01-20 18:33:22 +01:00 committed by Carlos Ruiz
parent 54c26b54b6
commit ce7121ae85
1 changed files with 21 additions and 0 deletions

View File

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