From b9002d7fd5455ca2c13934748531b30a97799a9f Mon Sep 17 00:00:00 2001 From: Daniel Gultsch Date: Tue, 15 Sep 2015 22:52:35 +0200 Subject: added missing type='submit' to mam queries fixed some nasty inheritance problems along the way fixes #1411 --- src/main/java/eu/siacs/conversations/xmpp/forms/Field.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/main/java/eu/siacs/conversations/xmpp/forms/Field.java') diff --git a/src/main/java/eu/siacs/conversations/xmpp/forms/Field.java b/src/main/java/eu/siacs/conversations/xmpp/forms/Field.java index ee2c51a9..c8388000 100644 --- a/src/main/java/eu/siacs/conversations/xmpp/forms/Field.java +++ b/src/main/java/eu/siacs/conversations/xmpp/forms/Field.java @@ -16,7 +16,7 @@ public class Field extends Element { super("field"); } - public String getName() { + public String getFieldName() { return this.getAttribute("var"); } -- cgit v1.2.3 From 60211a315ee8cf83a6b87836c30abc28e4dec272 Mon Sep 17 00:00:00 2001 From: Daniel Gultsch Date: Thu, 26 Nov 2015 17:44:29 +0100 Subject: hide subject edit button if not editable by user --- src/main/java/eu/siacs/conversations/xmpp/forms/Field.java | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'src/main/java/eu/siacs/conversations/xmpp/forms/Field.java') diff --git a/src/main/java/eu/siacs/conversations/xmpp/forms/Field.java b/src/main/java/eu/siacs/conversations/xmpp/forms/Field.java index c8388000..3ec1f214 100644 --- a/src/main/java/eu/siacs/conversations/xmpp/forms/Field.java +++ b/src/main/java/eu/siacs/conversations/xmpp/forms/Field.java @@ -47,4 +47,8 @@ public class Field extends Element { field.setChildren(element.getChildren()); return field; } + + public String getValue() { + return findChildContent("value"); + } } -- cgit v1.2.3 From a6c5430cdd400389a311ea9c2ab8a6fabc2f72c5 Mon Sep 17 00:00:00 2001 From: Daniel Gultsch Date: Fri, 22 Jan 2016 20:22:47 +0100 Subject: added UI wrapper for (some) form fields --- src/main/java/eu/siacs/conversations/xmpp/forms/Field.java | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'src/main/java/eu/siacs/conversations/xmpp/forms/Field.java') diff --git a/src/main/java/eu/siacs/conversations/xmpp/forms/Field.java b/src/main/java/eu/siacs/conversations/xmpp/forms/Field.java index 3ec1f214..c1fc808d 100644 --- a/src/main/java/eu/siacs/conversations/xmpp/forms/Field.java +++ b/src/main/java/eu/siacs/conversations/xmpp/forms/Field.java @@ -51,4 +51,16 @@ public class Field extends Element { public String getValue() { return findChildContent("value"); } + + public String getLabel() { + return getAttribute("label"); + } + + public String getType() { + return getAttribute("type"); + } + + public boolean isRequired() { + return hasChild("required"); + } } -- cgit v1.2.3 From 8850a1fbe3d8affd734b94eb0eb650dc1dfa5bd6 Mon Sep 17 00:00:00 2001 From: Daniel Gultsch Date: Sat, 23 Jan 2016 20:32:00 +0100 Subject: added FormWrapper and form field validation --- .../java/eu/siacs/conversations/xmpp/forms/Field.java | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'src/main/java/eu/siacs/conversations/xmpp/forms/Field.java') diff --git a/src/main/java/eu/siacs/conversations/xmpp/forms/Field.java b/src/main/java/eu/siacs/conversations/xmpp/forms/Field.java index c1fc808d..020b34b9 100644 --- a/src/main/java/eu/siacs/conversations/xmpp/forms/Field.java +++ b/src/main/java/eu/siacs/conversations/xmpp/forms/Field.java @@ -1,7 +1,9 @@ package eu.siacs.conversations.xmpp.forms; +import java.util.ArrayList; import java.util.Collection; import java.util.Iterator; +import java.util.List; import eu.siacs.conversations.xml.Element; @@ -52,6 +54,19 @@ public class Field extends Element { return findChildContent("value"); } + public List getValues() { + List values = new ArrayList<>(); + for(Element child : getChildren()) { + if ("value".equals(child.getName())) { + String content = child.getContent(); + if (content != null) { + values.add(content); + } + } + } + return values; + } + public String getLabel() { return getAttribute("label"); } -- cgit v1.2.3