当前位置: 首页>>代码示例>>Java>>正文


Java FormField.getVariable方法代码示例

本文整理汇总了Java中org.jivesoftware.smackx.FormField.getVariable方法的典型用法代码示例。如果您正苦于以下问题:Java FormField.getVariable方法的具体用法?Java FormField.getVariable怎么用?Java FormField.getVariable使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.jivesoftware.smackx.FormField的用法示例。


在下文中一共展示了FormField.getVariable方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getItemsToSearch

import org.jivesoftware.smackx.FormField; //导入方法依赖的package包/类
private String getItemsToSearch() {
    StringBuilder buf = new StringBuilder();

    if (form == null) {
        form = Form.getFormFrom(this);
    }

    if (form == null) {
        return "";
    }

    Iterator<FormField> fields = form.getFields();
    while (fields.hasNext()) {
        FormField field = fields.next();
        String name = field.getVariable();
        String value = getSingleValue(field);
        if (value.trim().length() > 0) {
            buf.append("<").append(name).append(">").append(value).append("</").append(name).append(">");
        }
    }

    return buf.toString();
}
 
开发者ID:ice-coffee,项目名称:EIM,代码行数:24,代码来源:SimpleUserSearch.java

示例2: testCreateReservedRoom

import org.jivesoftware.smackx.FormField; //导入方法依赖的package包/类
/**
 * Tests creating a new "Reserved Room".
 */
public void testCreateReservedRoom() {
    MultiUserChat muc = new MultiUserChat(getConnection(0), room);

    try {
        // Create the room
        muc.create("testbot1");

        // Get the the room's configuration form
        Form form = muc.getConfigurationForm();
        assertNotNull("No room configuration form", form);
        // Create a new form to submit based on the original form
        Form submitForm = form.createAnswerForm();
        // Add default answers to the form to submit
        for (Iterator<FormField> fields = form.getFields(); fields.hasNext();) {
            FormField field = fields.next();
            if (!FormField.TYPE_HIDDEN.equals(field.getType())
                && field.getVariable() != null) {
                // Sets the default value as the answer
                submitForm.setDefaultAnswer(field.getVariable());
            }
        }
        List<String> owners = new ArrayList<String>();
        owners.add(getBareJID(0));
        submitForm.setAnswer("muc#roomconfig_roomowners", owners);

        // Update the new room's configuration
        muc.sendConfigurationForm(submitForm);

        // Destroy the new room
        muc.destroy("The room has almost no activity...", null);

    }
    catch (XMPPException e) {
        e.printStackTrace();
        fail(e.getMessage());
    }
}
 
开发者ID:TTalkIM,项目名称:Smack,代码行数:41,代码来源:MultiUserChatCreationTest.java

示例3: createRoom

import org.jivesoftware.smackx.FormField; //导入方法依赖的package包/类
/**
 * ����������
 * 
 * @param roomName
 * @param roomPwd
 *            ����������
 */
public MultiUserChat createRoom(String roomName, String roomPwd, String subject) {
	MultiUserChat multiUserChat = new MultiUserChat(connection, roomName
			+ CONFERENCE + connection.getServiceName());
	try {
		multiUserChat.create(roomName);
		Form configForm = multiUserChat.getConfigurationForm();
		Form submitForm = configForm.createAnswerForm();
		for (Iterator<FormField> fields = configForm.getFields(); fields
				.hasNext();) {
			FormField formField = fields.next();
			if (!formField.getType().equals(FormField.TYPE_HIDDEN)
					&& formField.getVariable() != null) {
				submitForm.setDefaultAnswer(formField.getVariable());
			}
		}

		List<String> owners = new ArrayList<String>();
		owners.add(connection.getUser());
		//submitForm.setAnswer("muc#roomconfig_roomowners", owners);
		submitForm.setAnswer("muc#roomconfig_passwordprotectedroom", true);
		// �����������dz־������ң�����Ҫ����������
		submitForm.setAnswer("muc#roomconfig_persistentroom", true);
		// ������Գ�Ա����
		submitForm.setAnswer("muc#roomconfig_membersonly", false);
		// ����ռ��������������
		submitForm.setAnswer("muc#roomconfig_allowinvites", true);
		// �������ij�Ա��
		submitForm.setAnswer("muc#roomconfig_maxusers", Arrays.asList("30"));
		// �ܹ�����ռ������ʵ JID �Ľ�ɫ
		// submitForm.setAnswer("muc#roomconfig_whois", "anyone");
		// ��¼����Ի�
		submitForm.setAnswer("muc#roomconfig_enablelogging", true);
		// ������ע����dzƵ�¼
		submitForm.setAnswer("x-muc#roomconfig_reservednick", true);
		// ����ʹ�����޸��dz�
		submitForm.setAnswer("x-muc#roomconfig_canchangenick", false);
		// �����û�ע�᷿��
		submitForm.setAnswer("x-muc#roomconfig_registration", false);
		// ���ý�������
		submitForm.setAnswer("muc#roomconfig_roomsecret", roomPwd);
		submitForm.setAnswer("muc#roomconfig_roomdesc", subject);
		multiUserChat.sendConfigurationForm(submitForm);

	} catch (XMPPException e) {
		SLog.e(tag, "���������� ����");
		SLog.e(tag, Log.getStackTraceString(e));
		e.getStackTrace();
	}
	return multiUserChat;
}
 
开发者ID:ice-coffee,项目名称:EIM,代码行数:58,代码来源:XmppConnectionManager.java


注:本文中的org.jivesoftware.smackx.FormField.getVariable方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。