1
0
Fork 0
mirror of https://codeberg.org/Mercury-IM/Smack synced 2025-09-10 18:59:41 +02:00

1) Added SearchField and DataForm support for JEP 55.

git-svn-id: http://svn.igniterealtime.org/svn/repos/smack/trunk@2839 b35dd754-fafc-0310-a699-88a17e54d16e
This commit is contained in:
Derek DeMoro 2005-09-19 04:06:59 +00:00 committed by derek
parent ab474ea063
commit 61590449b7
5 changed files with 274 additions and 75 deletions

View file

@ -55,13 +55,13 @@ public class ReportedData {
// Otherwise return null
return null;
}
/**
* Creates a new ReportedData based on the returned dataForm from a search
*(namespace "jabber:iq:search").
*
* @param dataForm the dataForm returned from a search (namespace "jabber:iq:search").
*(namespace "jabber:iq:search").
*
* @param dataForm the dataForm returned from a search (namespace "jabber:iq:search").
*/
private ReportedData(DataForm dataForm) {
// Add the columns to the report based on the reported data fields
@ -90,7 +90,29 @@ public class ReportedData {
// Set the report's title
this.title = dataForm.getTitle();
}
public ReportedData(){
// Allow for model creation of ReportedData.
}
/**
* Adds a new <code>Row</code>.
* @param row the new row to add.
*/
public void addRow(Row row){
rows.add(row);
}
/**
* Adds a new <code>Column</code>
* @param column the column to add.
*/
public void addColumn(Column column){
columns.add(column);
}
/**
* Returns an Iterator for the rows returned from a search.
*
@ -102,7 +124,7 @@ public class ReportedData {
/**
* Returns an Iterator for the columns returned from a search.
*
*
* @return an Iterator for the columns returned from a search.
*/
public Iterator getColumns() {
@ -111,19 +133,19 @@ public class ReportedData {
/**
* Returns the report's title. It is similar to the title on a web page or an X
* Returns the report's title. It is similar to the title on a web page or an X
* window.
*
*
* @return title of the report.
*/
public String getTitle() {
return title;
}
/**
*
*
* Represents the columns definition of the reported data.
*
*
* @author Gaston Dombiak
*/
public static class Column {
@ -133,20 +155,20 @@ public class ReportedData {
/**
* Creates a new column with the specified definition.
*
*
* @param label the columns's label.
* @param variable the variable name of the column.
* @param type the format for the returned data.
*/
private Column(String label, String variable, String type) {
public Column(String label, String variable, String type) {
this.label = label;
this.variable = variable;
this.type = type;
}
/**
* Returns the column's label.
*
*
* @return label of the column.
*/
public String getLabel() {
@ -156,23 +178,23 @@ 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
* <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
* <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
* <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>
*
*
* @return format for the returned data.
*/
public String getType() {
@ -182,7 +204,7 @@ public class ReportedData {
/**
* Returns the variable name that the column is showing.
*
*
* @return the variable name of the column.
*/
public String getVariable() {
@ -191,17 +213,17 @@ public class ReportedData {
}
public static class Row {
private List fields = new ArrayList();
private Row(List fields) {
public Row(List fields) {
this.fields = fields;
}
/**
* Returns the values of the field whose variable matches the requested variable.
*
*
* @param variable the variable to match.
* @return the values of the field whose variable matches the requested variable.
*/
@ -214,22 +236,22 @@ public class ReportedData {
}
return null;
}
/**
* Returns the fields that define the data that goes with the item.
*
*
* @return the fields that define the data that goes with the item.
*/
private Iterator getFields() {
return Collections.unmodifiableList(new ArrayList(fields)).iterator();
}
}
private static class Field {
public static class Field {
private String variable;
private List values;
private Field(String variable, List values) {
public Field(String variable, List values) {
this.variable = variable;
this.values = values;
}