IDEMPIERE-3617 Styles not working in master mode after navigate to another record
This commit is contained in:
parent
44ef536af6
commit
ffcd468f13
|
@ -15,16 +15,18 @@ import org.compiere.util.Env;
|
|||
*
|
||||
*/
|
||||
public class MStyle extends X_AD_Style {
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
private static final long serialVersionUID = -5183438249097292583L;
|
||||
private static final long serialVersionUID = 4988653330824933725L;
|
||||
|
||||
/** Cache */
|
||||
private static CCache<Integer,MStyle> s_cache = new CCache<Integer,MStyle>(Table_Name, 30, 60);
|
||||
private X_AD_StyleLine[] m_lines = null;
|
||||
|
||||
public static final String SCLASS_PREFIX = "@sclass=";
|
||||
public static final String ZCLASS_PREFIX = "@zclass=";
|
||||
|
||||
public MStyle(Properties ctx, int AD_Style_ID, String trxName) {
|
||||
super(ctx, AD_Style_ID, trxName);
|
||||
}
|
||||
|
|
|
@ -299,7 +299,28 @@ public class GridTabRowRenderer implements RowRenderer<Object[]>, RowRendererExt
|
|||
styleBuilder.append("; ");
|
||||
styleBuilder.append(inlineStyle);
|
||||
}
|
||||
component.setStyle(styleBuilder.toString());
|
||||
setComponentStyle(component, styleBuilder.toString());
|
||||
}
|
||||
|
||||
protected void setComponentStyle(HtmlBasedComponent component, String style) {
|
||||
if (style != null && style.startsWith(MStyle.SCLASS_PREFIX)) {
|
||||
String sclass = style.substring(MStyle.SCLASS_PREFIX.length());
|
||||
if (component instanceof EditorBox)
|
||||
((EditorBox)component).getTextbox().setSclass(sclass);
|
||||
else
|
||||
component.setSclass(sclass);
|
||||
} else if (style != null && style.startsWith(MStyle.ZCLASS_PREFIX)) {
|
||||
String zclass = style.substring(MStyle.ZCLASS_PREFIX.length());
|
||||
if (component instanceof EditorBox)
|
||||
((EditorBox)component).getTextbox().setZclass(zclass);
|
||||
else
|
||||
component.setZclass(zclass);
|
||||
} else {
|
||||
if (component instanceof EditorBox)
|
||||
((EditorBox)component).getTextbox().setStyle(style);
|
||||
else
|
||||
component.setStyle(style);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -594,9 +594,18 @@ public abstract class WEditor implements EventListener<Event>, PropertyChangeLis
|
|||
}
|
||||
|
||||
protected void setLabelStyle(String style) {
|
||||
if (label != null)
|
||||
if (label != null) {
|
||||
if (style != null && style.toLowerCase().startsWith(MStyle.SCLASS_PREFIX)) {
|
||||
String sclass = style.substring(MStyle.SCLASS_PREFIX.length());
|
||||
label.setSclass(sclass);
|
||||
} else if (style != null && style.toLowerCase().startsWith(MStyle.ZCLASS_PREFIX)) {
|
||||
String zclass = style.substring(MStyle.ZCLASS_PREFIX.length());
|
||||
label.setZclass(zclass);
|
||||
} else {
|
||||
label.setStyle(style);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
protected void applyFieldStyles(boolean applyDictionaryStyle) {
|
||||
String style = null;
|
||||
|
@ -609,11 +618,25 @@ public abstract class WEditor implements EventListener<Event>, PropertyChangeLis
|
|||
|
||||
protected void setFieldStyle(String style) {
|
||||
HtmlBasedComponent component = (HtmlBasedComponent) getComponent();
|
||||
if (style != null && style.startsWith(MStyle.SCLASS_PREFIX)) {
|
||||
String sclass = style.substring(MStyle.SCLASS_PREFIX.length());
|
||||
if (component instanceof EditorBox)
|
||||
((EditorBox)component).getTextbox().setSclass(sclass);
|
||||
else
|
||||
component.setSclass(sclass);
|
||||
} else if (style != null && style.startsWith(MStyle.ZCLASS_PREFIX)) {
|
||||
String zclass = style.substring(MStyle.ZCLASS_PREFIX.length());
|
||||
if (component instanceof EditorBox)
|
||||
((EditorBox)component).getTextbox().setZclass(zclass);
|
||||
else
|
||||
component.setZclass(zclass);
|
||||
} else {
|
||||
if (component instanceof EditorBox)
|
||||
((EditorBox)component).getTextbox().setStyle(style);
|
||||
else
|
||||
component.setStyle(style);
|
||||
}
|
||||
}
|
||||
|
||||
protected String buildStyle(int AD_Style_ID) {
|
||||
MStyle style = MStyle.get(Env.getCtx(), AD_Style_ID);
|
||||
|
|
Loading…
Reference in New Issue