Creates a new instance of RegForm @param regform @param resultId @param stream @param childName
(ServiceDiscovery disco, FormSubmitListener listener, String to, JabberDataBlock regform, JabberStream stream, String resultId, String childName)
| 81 | * @param childName |
| 82 | */ |
| 83 | public DiscoForm(ServiceDiscovery disco, FormSubmitListener listener, String to, JabberDataBlock regform, JabberStream stream, String resultId, String childName) { |
| 84 | super(regform.getAttribute("from"), false); |
| 85 | service = (to == null) ? regform.getAttribute("from") : to; |
| 86 | this.disco = disco; |
| 87 | this.listener = listener; |
| 88 | JabberDataBlock query = (childName == null) ? regform : regform.getChildBlock(childName); |
| 89 | this.childName = query.getTagName(); |
| 90 | xmlns = query.getAttribute("xmlns"); |
| 91 | node = query.getAttribute("node"); |
| 92 | sessionId = query.getAttribute("sessionid"); |
| 93 | JabberDataBlock x = query.findNamespace("x", NS_XDATA); |
| 94 | this.id = resultId; |
| 95 | //this.listener=listener; |
| 96 | // todo: обработать ошибку query |
| 97 | fields = new Vector(); |
| 98 | |
| 99 | // for instructions |
| 100 | |
| 101 | Vector vFields=(xData=(x!=null))? x.getChildBlocks() : query.getChildBlocks(); |
| 102 | |
| 103 | Enumeration e; |
| 104 | |
| 105 | if (vFields!=null) { |
| 106 | for (e=vFields.elements(); e.hasMoreElements(); ){ |
| 107 | FormField field=new FormField((JabberDataBlock)e.nextElement()); |
| 108 | fields.addElement(field); |
| 109 | } |
| 110 | |
| 111 | for (e=fields.elements(); e.hasMoreElements(); ){ |
| 112 | FormField field=(FormField) e.nextElement(); |
| 113 | if (!field.hidden || field.registered) |
| 114 | itemsList.addElement(field.formItem); |
| 115 | } |
| 116 | } |
| 117 | |
| 118 | |
| 119 | if (this.childName.equals("command")) { |
| 120 | if (query.getAttribute("status").equals("completed")) { |
| 121 | itemsList.addElement(new SimpleString("Complete.", false)); |
| 122 | complete = true; |
| 123 | } |
| 124 | } |
| 125 | this.stream = stream; |
| 126 | //moveCursorTo(getNextSelectableRef(-1)); |
| 127 | show(); |
| 128 | } |
| 129 | |
| 130 | private void sendForm(String id){ |
| 131 | JabberDataBlock req=new Iq(service, Iq.TYPE_SET, id); |
nothing calls this directly
no test coverage detected