mirror of
https://codeberg.org/Mercury-IM/Smack
synced 2025-12-14 00:51:19 +01:00
Make FormField.Type an enum
This commit is contained in:
parent
0c68d59ade
commit
755765120d
13 changed files with 178 additions and 146 deletions
|
|
@ -143,9 +143,9 @@ public class ReportedData {
|
|||
* @author Gaston Dombiak
|
||||
*/
|
||||
public static class Column {
|
||||
private String label;
|
||||
private String variable;
|
||||
private String type;
|
||||
private final String label;
|
||||
private final String variable;
|
||||
private final FormField.Type type;
|
||||
|
||||
/**
|
||||
* Creates a new column with the specified definition.
|
||||
|
|
@ -154,7 +154,7 @@ public class ReportedData {
|
|||
* @param variable the variable name of the column.
|
||||
* @param type the format for the returned data.
|
||||
*/
|
||||
public Column(String label, String variable, String type) {
|
||||
public Column(String label, String variable, FormField.Type type) {
|
||||
this.label = label;
|
||||
this.variable = variable;
|
||||
this.type = type;
|
||||
|
|
@ -171,27 +171,11 @@ public class ReportedData {
|
|||
|
||||
|
||||
/**
|
||||
* Returns the column's data format. Valid formats are:
|
||||
*
|
||||
* <ul>
|
||||
* <li>text-single -> single line or word of text
|
||||
* <li>text-private -> instead of showing the user what they typed, you show ***** to
|
||||
* protect it
|
||||
* <li>text-multi -> multiple lines of text entry
|
||||
* <li>list-single -> given a list of choices, pick one
|
||||
* <li>list-multi -> given a list of choices, pick one or more
|
||||
* <li>boolean -> 0 or 1, true or false, yes or no. Default value is 0
|
||||
* <li>fixed -> fixed for putting in text to show sections, or just advertise your web
|
||||
* site in the middle of the form
|
||||
* <li>hidden -> is not given to the user at all, but returned with the questionnaire
|
||||
* <li>jid-single -> Jabber ID - choosing a JID from your roster, and entering one based
|
||||
* on the rules for a JID.
|
||||
* <li>jid-multi -> multiple entries for JIDs
|
||||
* </ul>
|
||||
* Returns the column's data format.
|
||||
*
|
||||
* @return format for the returned data.
|
||||
*/
|
||||
public String getType() {
|
||||
public FormField.Type getType() {
|
||||
return type;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -93,7 +93,7 @@ class SimpleUserSearch extends IQ {
|
|||
|
||||
protected void parseItems(XmlPullParser parser) throws XmlPullParserException, IOException {
|
||||
ReportedData data = new ReportedData();
|
||||
data.addColumn(new ReportedData.Column("JID", "jid", "text-single"));
|
||||
data.addColumn(new ReportedData.Column("JID", "jid", FormField.Type.text_single));
|
||||
|
||||
boolean done = false;
|
||||
|
||||
|
|
@ -135,7 +135,7 @@ class SimpleUserSearch extends IQ {
|
|||
|
||||
// Column name should be the same
|
||||
if (!exists) {
|
||||
ReportedData.Column column = new ReportedData.Column(name, name, "text-single");
|
||||
ReportedData.Column column = new ReportedData.Column(name, name, FormField.Type.text_single);
|
||||
data.addColumn(column);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -185,7 +185,7 @@ public class UserSearch extends SimpleIQ {
|
|||
field.setLabel("Nickname");
|
||||
}
|
||||
|
||||
field.setType(FormField.TYPE_TEXT_SINGLE);
|
||||
field.setType(FormField.Type.text_single);
|
||||
dataForm.addField(field);
|
||||
}
|
||||
else if (eventType == XmlPullParser.END_TAG) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue