Skip to content

Commit

Permalink
feat: Save Applications and Sections Margins Style - MEED-7131 - Meed…
Browse files Browse the repository at this point in the history
  • Loading branch information
boubaker committed Jul 3, 2024
1 parent b220a18 commit 35ac7bf
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,14 @@ private MappedAttributes() {

public static final Key<String> BOX_SHADOW = Key.create("box-shadow", ValueType.STRING);

public static final Key<String> MARGIN_TOP = Key.create("margin-top", ValueType.STRING);

public static final Key<String> MARGIN_BOTTOM = Key.create("margin-bottom", ValueType.STRING);

public static final Key<String> MARGIN_LEFT = Key.create("margin-left", ValueType.STRING);

public static final Key<String> MARGIN_RIGHT = Key.create("margin-right", ValueType.STRING);

public static final Key<String> RADIUS_TOP_RIGHT_SHADOW = Key.create("radius-top-right", ValueType.STRING);

public static final Key<String> RADIUS_TOP_LEFT_SHADOW = Key.create("radius-top-left", ValueType.STRING);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -838,6 +838,18 @@ private ModelStyle mapPropertiesToStyle(JSONObject attrs) { // NOSONAR
if (attrs.containsKey(MappedAttributes.BOX_SHADOW.getName())) {
cssStyle.setBoxShadow((String) attrs.get(MappedAttributes.BOX_SHADOW.getName()));
}
if (attrs.containsKey(MappedAttributes.MARGIN_TOP.getName())) {
cssStyle.setMarginTop(Integer.parseInt((String) attrs.get(MappedAttributes.MARGIN_TOP.getName())));
}
if (attrs.containsKey(MappedAttributes.MARGIN_BOTTOM.getName())) {
cssStyle.setMarginBottom(Integer.parseInt((String) attrs.get(MappedAttributes.MARGIN_BOTTOM.getName())));
}
if (attrs.containsKey(MappedAttributes.MARGIN_RIGHT.getName())) {
cssStyle.setMarginRight(Integer.parseInt((String) attrs.get(MappedAttributes.MARGIN_RIGHT.getName())));
}
if (attrs.containsKey(MappedAttributes.MARGIN_LEFT.getName())) {
cssStyle.setMarginLeft(Integer.parseInt((String) attrs.get(MappedAttributes.MARGIN_LEFT.getName())));
}
if (attrs.containsKey(MappedAttributes.RADIUS_TOP_RIGHT_SHADOW.getName())) {
cssStyle.setRadiusTopRight(Integer.parseInt((String) attrs.get(MappedAttributes.RADIUS_TOP_RIGHT_SHADOW.getName())));
}
Expand Down Expand Up @@ -953,6 +965,18 @@ private void mapStyleToProperties(ModelStyle cssStyle, JSONObject properties) {
if (StringUtils.isNotBlank(cssStyle.getBoxShadow())) {
properties.put(MappedAttributes.BOX_SHADOW.getName(), cssStyle.getBoxShadow());
}
if (cssStyle.getMarginTop() != null) {
properties.put(MappedAttributes.MARGIN_TOP.getName(), cssStyle.getMarginTop().toString());
}
if (cssStyle.getMarginBottom() != null) {
properties.put(MappedAttributes.MARGIN_BOTTOM.getName(), cssStyle.getMarginBottom().toString());
}
if (cssStyle.getMarginRight() != null) {
properties.put(MappedAttributes.MARGIN_RIGHT.getName(), cssStyle.getMarginRight().toString());
}
if (cssStyle.getMarginLeft() != null) {
properties.put(MappedAttributes.MARGIN_LEFT.getName(), cssStyle.getMarginLeft().toString());
}
if (cssStyle.getRadiusTopRight() != null) {
properties.put(MappedAttributes.RADIUS_TOP_RIGHT_SHADOW.getName(), cssStyle.getRadiusTopRight().toString());
}
Expand Down

0 comments on commit 35ac7bf

Please sign in to comment.