mirror of
https://gitee.com/jmix/cuba.git
synced 2024-12-05 04:38:10 +08:00
PL-6998 Add ability to set stylename for fieldGroup fields from XML descriptor
This commit is contained in:
parent
0fa63651bb
commit
4945aa9c45
@ -46,6 +46,7 @@ import java.awt.*;
|
||||
import java.util.*;
|
||||
import java.util.List;
|
||||
|
||||
|
||||
/**
|
||||
*/
|
||||
public class DesktopFieldGroup extends DesktopAbstractComponent<JPanel> implements FieldGroup, AutoExpanding {
|
||||
@ -782,6 +783,11 @@ public class DesktopFieldGroup extends DesktopAbstractComponent<JPanel> implemen
|
||||
impl.repaint();
|
||||
}
|
||||
|
||||
String stylename = fieldConfig.getStyleName();
|
||||
if (StringUtils.isNotEmpty(stylename)) {
|
||||
fieldComponent.setStyleName(stylename);
|
||||
}
|
||||
|
||||
if (App.getInstance().isTestMode()) {
|
||||
jComponent.setName(fieldConfig.getId());
|
||||
}
|
||||
|
@ -116,6 +116,7 @@ public interface FieldGroup extends Component, Component.BelongToFrame, Componen
|
||||
private Formatter formatter;
|
||||
private Element element;
|
||||
private String width;
|
||||
private String stylename;
|
||||
private Datasource datasource;
|
||||
private String requiredError;
|
||||
private MetaPropertyPath metaPropertyPath;
|
||||
@ -191,6 +192,14 @@ public interface FieldGroup extends Component, Component.BelongToFrame, Componen
|
||||
this.width = width;
|
||||
}
|
||||
|
||||
public String getStyleName() {
|
||||
return stylename;
|
||||
}
|
||||
|
||||
public void setStyleName(String stylename) {
|
||||
this.stylename = stylename;
|
||||
}
|
||||
|
||||
public Datasource getDatasource() {
|
||||
return datasource;
|
||||
}
|
||||
|
@ -1187,6 +1187,8 @@
|
||||
<xs:attribute name="cols" type="xs:int"/>
|
||||
<xs:attribute name="rows" type="xs:int"/>
|
||||
|
||||
<xs:attribute name="stylename" type="xs:string"/>
|
||||
|
||||
<xs:attribute name="optionsDatasource" type="xs:string"/>
|
||||
<xs:attribute name="captionProperty" type="xs:string"/>
|
||||
<xs:attribute name="descriptionProperty" type="xs:string"/>
|
||||
|
@ -177,6 +177,11 @@ public class FieldGroupLoader extends AbstractComponentLoader<FieldGroup> {
|
||||
field.setDatasource(datasource);
|
||||
}
|
||||
|
||||
String stylename = element.attributeValue("stylename");
|
||||
if (StringUtils.isNotEmpty(stylename)) {
|
||||
field.setStyleName(stylename);
|
||||
}
|
||||
|
||||
String propertyName = metaPropertyPath != null ? metaPropertyPath.getMetaProperty().getName() : null;
|
||||
if (metaPropertyPath != null && DynamicAttributesUtils.isDynamicAttribute(metaPropertyPath.getMetaProperty())) {
|
||||
CategoryAttribute categoryAttribute = DynamicAttributesUtils.getCategoryAttribute(metaPropertyPath.getMetaProperty());
|
||||
|
@ -305,6 +305,11 @@ public class WebFieldGroup extends WebAbstractComponent<CubaFieldGroup>
|
||||
}
|
||||
}
|
||||
|
||||
String stylename = fieldConfig.getStyleName();
|
||||
if (StringUtils.isNotEmpty(stylename)) {
|
||||
fieldComponent.setStyleName(stylename);
|
||||
}
|
||||
|
||||
applyPermissions(fieldComponent);
|
||||
|
||||
registerFieldComponent(fieldConfig, fieldComponent);
|
||||
@ -465,6 +470,11 @@ public class WebFieldGroup extends WebAbstractComponent<CubaFieldGroup>
|
||||
((HasFormatter) fieldComponent).setFormatter(fieldConf.getFormatter());
|
||||
}
|
||||
|
||||
String stylename = fieldConf.getStyleName();
|
||||
if (StringUtils.isNotEmpty(stylename)) {
|
||||
fieldComponent.setStyleName(stylename);
|
||||
}
|
||||
|
||||
// some components (e.g. LookupPickerField) have width from the creation, so I commented out this check
|
||||
if (/*f.getWidth() == -1f &&*/ fieldConf.getWidth() != null) {
|
||||
fieldComponent.setWidth(fieldConf.getWidth());
|
||||
|
Loading…
Reference in New Issue
Block a user