From 962732900d7f6a998d2f137b4275c67443cdb410 Mon Sep 17 00:00:00 2001 From: Shubham Goyal Date: Mon, 25 Sep 2023 14:11:37 -0500 Subject: [PATCH] Detail Field Action --- .../java/org/commcare/suite/model/DetailField.java | 11 +++++++++++ src/main/java/org/commcare/xml/DetailFieldParser.java | 7 +++++-- .../backend/suite/model/test/AppStructureTests.java | 10 ++++++++++ src/test/resources/app_structure/suite.xml | 11 +++++++++++ 4 files changed, 37 insertions(+), 2 deletions(-) diff --git a/src/main/java/org/commcare/suite/model/DetailField.java b/src/main/java/org/commcare/suite/model/DetailField.java index 33c09c20ec..29758edcc7 100644 --- a/src/main/java/org/commcare/suite/model/DetailField.java +++ b/src/main/java/org/commcare/suite/model/DetailField.java @@ -67,6 +67,7 @@ public class DetailField implements Externalizable { private String verticalAlign; private String fontSize; private String cssID; + private Action action; public DetailField() { } @@ -201,6 +202,7 @@ public void readExternal(DataInputStream in, PrototypeFactory pf) throws IOExcep horizontalAlign = ExtUtil.nullIfEmpty(ExtUtil.readString(in)); verticalAlign = ExtUtil.nullIfEmpty(ExtUtil.readString(in)); cssID = ExtUtil.nullIfEmpty(ExtUtil.readString(in)); + action = (Action)ExtUtil.read(in, new ExtWrapNullable(new ExtWrapTagged()), pf); } @Override @@ -230,6 +232,7 @@ public void writeExternal(DataOutputStream out) throws IOException { ExtUtil.writeString(out, ExtUtil.emptyIfNull(horizontalAlign)); ExtUtil.writeString(out, ExtUtil.emptyIfNull(verticalAlign)); ExtUtil.writeString(out, ExtUtil.emptyIfNull(cssID)); + ExtUtil.write(out, new ExtWrapNullable(action == null ? null : new ExtWrapTagged(action))); } public int getGridX() { @@ -264,6 +267,10 @@ public String getCssId() { return cssID; } + public Action getAction() { + return action; + } + public static class Builder { final DetailField field; @@ -382,5 +389,9 @@ public void setFontSize(String fontSize) { public void setCssID(String id) { field.cssID = id; } + + public void setAction(Action action) { + field.action = action; + } } } diff --git a/src/main/java/org/commcare/xml/DetailFieldParser.java b/src/main/java/org/commcare/xml/DetailFieldParser.java index caf439a057..2159959896 100644 --- a/src/main/java/org/commcare/xml/DetailFieldParser.java +++ b/src/main/java/org/commcare/xml/DetailFieldParser.java @@ -73,9 +73,9 @@ public DetailField parse() throws InvalidStructureException, IOException, XmlPul } else { throw new InvalidStructureException("detail with no