@Override protected FormNode createReturnExtension(String currentElement, String currentNamespace, Map<String, String> attributeMap, List<? extends ExtensionElement> content) { return new FormNode(FormNodeType.valueOfFromElementName(currentElement, currentNamespace), attributeMap.get("node"), new Form((DataForm) content.iterator().next())); } }
/** * Create an instant room. The default configuration will be accepted and the room will become unlocked, i.e. * other users are able to join. * * @throws NoResponseException * @throws XMPPErrorException * @throws NotConnectedException * @throws InterruptedException * @see <a href="http://www.xmpp.org/extensions/xep-0045.html#createroom-instant">XEP-45 ยง 10.1.2 Creating an * Instant Room</a> */ public void makeInstant() throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException { sendConfigurationForm(new Form(DataForm.Type.submit)); }
/** * Returns the form of the current stage. Usually it is the form that must * be answered to execute the next action. If that is the case it should be * used by the requester to fill all the information that the executor needs * to continue to the next stage. It can also be the result of the * execution. * * @return the form of the current stage to fill out or the result of the * execution. */ public Form getForm() { if (data.getForm() == null) { return null; } else { return new Form(data.getForm()); } }
/** * Returns a new ReportedData if the stanza is used for gathering data and includes an * extension that matches the elementName and namespace "x","jabber:x:data". * * @param packet the stanza used for gathering data. * @return the data form parsed from the stanza or <tt>null</tt> if there was not * a form in the packet. */ public static Form getFormFrom(Stanza packet) { // Check if the packet includes the DataForm extension DataForm dataForm = DataForm.from(packet); if (dataForm != null) { if (dataForm.getReportedData() == null) return new Form(dataForm); } // Otherwise return null return null; }
Form form = new Form(DataForm.Type.submit); Iterator<String> iter = metadata.keySet().iterator(); while (iter.hasNext()) {
Form form = new Form(DataForm.Type.submit); for (FormField field : getFields()) {
@SmackIntegrationTest public void testFilloutForm() throws NotConnectedException, InterruptedException { Form formToSend = new Form(DataForm.Type.form); formToSend.setInstructions( "Fill out this form to report your case.\nThe case will be created automatically.");
/** * Creates a new public Conference Room. * * @param roomName the name of the room. * @param serviceName the service name to use (ex.conference.jivesoftware.com) * @return the new ChatRoom created. If an error occured, null will be returned. */ public ChatRoom createConferenceRoom(Localpart roomName, DomainBareJid serviceName) { EntityBareJid roomAddress = JidCreate.entityBareFrom(roomName, serviceName); final MultiUserChat chatRoom = MultiUserChatManager.getInstanceFor( SparkManager.getConnection()).getMultiUserChat( roomAddress); final GroupChatRoom room = UIComponentRegistry.createGroupChatRoom(chatRoom); try { LocalPreferences pref = SettingsManager.getLocalPreferences(); Resourcepart nickname = pref.getNickname(); chatRoom.create(nickname); // Send an empty room configuration form which indicates that we want // an instant room chatRoom.sendConfigurationForm(new Form( DataForm.Type.submit )); } catch (XMPPException | SmackException | InterruptedException e1) { Log.error("Unable to send conference room chat configuration form.", e1); return null; } getChatContainer().addChatRoom(room); return room; }