Skip to content

Commit

Permalink
Merge pull request #1359 from dimagi/copy_of_addsAlignmentToResp
Browse files Browse the repository at this point in the history
Duplicate of addsAlignmentToResp
  • Loading branch information
shubham1g5 authored Oct 16, 2023
2 parents 3eff97a + f5aed82 commit 4067180
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/main/java/org/commcare/suite/model/DetailField.java
Original file line number Diff line number Diff line change
Expand Up @@ -198,6 +198,9 @@ public void readExternal(DataInputStream in, PrototypeFactory pf) throws IOExcep
gridHeight = ExtUtil.readInt(in);
fontSize = ExtUtil.nullIfEmpty(ExtUtil.readString(in));
showBlanksLastInSort = ExtUtil.readBool(in);
horizontalAlign = ExtUtil.nullIfEmpty(ExtUtil.readString(in));
verticalAlign = ExtUtil.nullIfEmpty(ExtUtil.readString(in));
cssID = ExtUtil.nullIfEmpty(ExtUtil.readString(in));
}

@Override
Expand All @@ -224,6 +227,9 @@ public void writeExternal(DataOutputStream out) throws IOException {
ExtUtil.writeNumeric(out, gridHeight);
ExtUtil.writeString(out, ExtUtil.emptyIfNull(fontSize));
ExtUtil.writeBool(out, showBlanksLastInSort);
ExtUtil.writeString(out, ExtUtil.emptyIfNull(horizontalAlign));
ExtUtil.writeString(out, ExtUtil.emptyIfNull(verticalAlign));
ExtUtil.writeString(out, ExtUtil.emptyIfNull(cssID));
}

public int getGridX() {
Expand Down
13 changes: 13 additions & 0 deletions src/main/java/org/commcare/suite/model/Style.java
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ public class Style {
private DisplayFormat displayFormats;
private int fontSize;
private int widthHint;
private String horizontalAlign;
private String verticalAlign;

public Style(){}

Expand All @@ -30,6 +32,9 @@ public Style(DetailField detail){
setWidthHint(-1);
}
setDisplayFormatFromString(detail.getTemplateForm());

verticalAlign = detail.getVerticalAlign();
horizontalAlign = detail.getHorizontalAlign();
}

enum DisplayFormat {
Expand Down Expand Up @@ -105,4 +110,12 @@ private void setDisplayFormatFromString(String displayFormat){
public String toString(){
return "Style: [displayFormat=" + displayFormats + ", fontSize=" + fontSize + "]";
}

public String getHorizontalAlign() {
return horizontalAlign;
}

public String getVerticalAlign() {
return verticalAlign;
}
}

0 comments on commit 4067180

Please sign in to comment.