summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTarun Gupta <tarun1995gupta@gmail.com>2015-06-20 01:02:12 (GMT)
committerTarun Gupta <tarun1995gupta@gmail.com>2015-06-27 07:12:55 (GMT)
commita673d269487fd86efe7f9c5f9b4cd1c00cab556d (patch)
tree10145697d3153a8a170361c5355ad9bccee21776 /src/com/isode/stroke/elements/FormPage.java
parent27212e007077418d18014286a46723fa26693864 (diff)
downloadstroke-a673d269487fd86efe7f9c5f9b4cd1c00cab556d.zip
stroke-a673d269487fd86efe7f9c5f9b4cd1c00cab556d.tar.bz2
Adds Form Elements and Version Element.
Adds FormPage, FormReportedRef, FormSection, FormText and Version Elements. Updates Form Elements, its Parser And Serializer. Updates SearchPayload Element, its Parser And Serializer. License: This patch is BSD-licensed, see Documentation/Licenses/BSD-simplified.txt for details. Test-Information: Adds Search Payload Parser and Serializer Test. Updates tests for Form Parser and Serializer. Updates InBandRegistrationPayloadSerializer Test and MAMQuerySerializerTest. All tests passes. Change-Id: I8c620a3db39fe433bc9a5478b98d5caeaf9ed40b
Diffstat (limited to 'src/com/isode/stroke/elements/FormPage.java')
-rw-r--r--src/com/isode/stroke/elements/FormPage.java134
1 files changed, 134 insertions, 0 deletions
diff --git a/src/com/isode/stroke/elements/FormPage.java b/src/com/isode/stroke/elements/FormPage.java
new file mode 100644
index 0000000..b23a6e2
--- /dev/null
+++ b/src/com/isode/stroke/elements/FormPage.java
@@ -0,0 +1,134 @@
+/*
+ * Copyright (c) 2015 Isode Limited.
+ * All rights reserved.
+ * See the COPYING file for more information.
+ */
+/*
+ * Copyright (c) 2015 Tarun Gupta.
+ * Licensed under the simplified BSD license.
+ * See Documentation/Licenses/BSD-simplified.txt for more information.
+ */
+
+package com.isode.stroke.elements;
+
+import com.isode.stroke.base.NotNull;
+import com.isode.stroke.elements.FormField;
+import com.isode.stroke.elements.FormReportedRef;
+import com.isode.stroke.elements.FormText;
+import com.isode.stroke.elements.FormSection;
+import java.util.Vector;
+
+public class FormPage {
+
+ private String label_ = "";
+ private String xmlns_ = "";
+ private Vector<FormText> textElements_ = new Vector<FormText>();
+ private Vector<FormReportedRef> reportedRefs_ = new Vector<FormReportedRef>();
+ private Vector<FormSection> childSections_ = new Vector<FormSection>();
+ private Vector<FormField> fields_ = new Vector<FormField>();
+ private Vector<String> fieldRefs_ = new Vector<String>();
+
+ /**
+ * Default Constructor.
+ */
+ public FormPage() {
+ this.xmlns_ = "http://jabber.org/protocol/xdata-layout";
+ }
+
+ /**
+ * @param label, Not Null.
+ */
+ public void setLabel(String label) {
+ NotNull.exceptIfNull(label, "label");
+ label_ = label;
+ }
+
+ /**
+ * @return label, Not Null.
+ */
+ public String getLabel() {
+ return label_;
+ }
+
+ /**
+ * @return xmlns, Not Null.
+ */
+ public String getXMLNS() {
+ return xmlns_;
+ }
+
+ /**
+ * @param textElement, Not Null.
+ */
+ public void addTextElement(FormText textElement) {
+ NotNull.exceptIfNull(textElement, "textElement");
+ textElements_.add(textElement);
+ }
+
+ /**
+ * @return textElement, Not Null.
+ */
+ public Vector<FormText> getTextElements() {
+ return textElements_;
+ }
+
+ /**
+ * @param reportedRef, Not Null.
+ */
+ public void addReportedRef(FormReportedRef reportedRef) {
+ NotNull.exceptIfNull(reportedRef, "reportedRef");
+ reportedRefs_.add(reportedRef);
+ }
+
+ /**
+ * @return reportedRef, Not Null.
+ */
+ public Vector<FormReportedRef> getReportedRefs() {
+ return reportedRefs_;
+ }
+
+ /**
+ * @param childSection, Not Null.
+ */
+ public void addChildSection(FormSection childSection) {
+ NotNull.exceptIfNull(childSection, "childSection");
+ childSections_.add(childSection);
+ }
+
+ /**
+ * @return childSection, Not Null.
+ */
+ public Vector<FormSection> getChildSections() {
+ return childSections_;
+ }
+
+ /**
+ * @param field, Not Null.
+ */
+ public void addField(FormField field) {
+ NotNull.exceptIfNull(field, "field");
+ fields_.add(field);
+ }
+
+ /**
+ * @return field, Not Null.
+ */
+ public Vector<FormField> getFields() {
+ return fields_;
+ }
+
+ /**
+ * @param ref, Not Null.
+ */
+ public void addFieldRef(String ref) {
+ NotNull.exceptIfNull(ref, "ref");
+ fieldRefs_.add(ref);
+ }
+
+ /**
+ * @return ref, Not Null.
+ */
+ public Vector<String> getFieldRefs() {
+ return fieldRefs_;
+ }
+} \ No newline at end of file