private DataForm createDefaultInitiationForm() { final DataForm form = new DataForm(Form.TYPE_FORM); final FormField field = new FormField(STREAM_DATA_FIELD_NAME); field.setType(FormField.TYPE_LIST_SINGLE); if (!IBB_ONLY) { field.addOption(new FormField.Option(Socks5BytestreamManager.NAMESPACE)); } field.addOption(new FormField.Option(InBandBytestreamManager.NAMESPACE)); form.addField(field); return form; }
@Override public Set<FormField> toFormFields(String name) { Set<FormField> set = new HashSet<FormField>(); if (mOptions == null) return set; FormField f1 = new FormField(name); f1.setLabel(mLabel); f1.setDescription(mDescription); f1.setRequired(mRequired); if (mIsHidden) { f1.setType(FormField.TYPE_HIDDEN); } else { f1.setType(FormField.TYPE_LIST_SINGLE); } for (int i = 0; i < mOptions.size(); i++) { String label = mOptions.get(i).getLabel(); ArrayList<String> options = mOptions.get(i).getValues(); if ((options != null) && (options.size() > 0)) { String option = options.get(0); f1.addOption(new Option(label, option)); } } if (mValues.size() > 0) { f1.addValue(getValueAsString(0)); } set.add(f1); FormField f2 = new FormField(name + Specialization.SPECIALIZECHARACTER + Specialization.KEY_TYPE); f2.setType(FormField.TYPE_HIDDEN); f2.addValue(Parameter.TYPENAME_OPTION); set.add(f2); FormField f3 = new FormField(name + Specialization.SPECIALIZECHARACTER + Specialization.KEY_SUBTYPE); f3.setType(FormField.TYPE_HIDDEN); f3.addValue(mSubType); set.add(f3); if (mSubmitActionHint) { FormField f4 = new FormField( name + Specialization.SPECIALIZECHARACTER + Specialization.KEY_SUBMITACTIONHINT); f4.setType(FormField.TYPE_HIDDEN); f4.addValue(String.valueOf(mSubmitActionHint)); set.add(f4); } return set; }