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


Java Form类代码示例

本文整理汇总了Java中tigase.form.Form的典型用法代码示例。如果您正苦于以下问题:Java Form类的具体用法?Java Form怎么用?Java Form使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1: prepareRegistrationForm

import tigase.form.Form; //导入依赖的package包/类
private Element prepareRegistrationForm(final XMPPResourceConnection session) throws NoConnectionIdException {
	Element query = new Element("query", new String[] { "xmlns" }, XMLNSS);
	query.addChild(new Element("instructions", "Use the enclosed form to register."));
	Form form = new Form(SignatureCalculator.SUPPORTED_TYPE, "Contest Registration",
			"Please provide the following information to sign up for our special contests!");

	form.addField(Field.fieldTextSingle("username", "", "Username"));
	form.addField(Field.fieldTextPrivate("password", "", "Password"));
	form.addField(Field.fieldTextSingle("email", "", "Email"));

	SignatureCalculator sc = new SignatureCalculator(oauthConsumerKey, oauthConsumerSecret);
	sc.setOauthToken(UUID.nameUUIDFromBytes((session.getConnectionId() + "|" + session.getSessionId()).getBytes()).toString());
	sc.addEmptyFields(form);

	query.addChild(form.getElement());
	return query;
}
 
开发者ID:kontalk,项目名称:tigase-server,代码行数:18,代码来源:JabberIqRegister.java

示例2: initFromElement

import tigase.form.Form; //导入依赖的package包/类
@Override
public void initFromElement(Element elem) {
	if (elem.getName() != ELEM_NAME) {
		throw new IllegalArgumentException("Incorrect element name, expected: " + ELEM_NAME);
	}
	super.initFromElement(elem);

	this.taskName = elem.getAttributeStaticStr(TASK_NAME_ATT);
	try {
		this.type = Type.valueOf(elem.getAttributeStaticStr(TASK_TYPE_ATT));
	} catch (Exception e) {
		e.printStackTrace();
	}
	this.scriptExtension = elem.getAttributeStaticStr(SCRIPT_EXT_ATT);

	setTaskClass(elem.getAttributeStaticStr(TASK_CLASS_ATT));
	setTaskScriptEncoded(elem.getCDataStaticStr(TASK_SCRIPT_PATH));

	Element form = elem.getChild("x", "jabber:x:data");
	if (form != null) {
		this.configuration = new Form(form);
	}
}
 
开发者ID:kontalk,项目名称:tigase-server,代码行数:24,代码来源:TaskConfigItem.java

示例3: getTaskInfo

import tigase.form.Form; //导入依赖的package包/类
@Override
public Form getTaskInfo() {
	Form result = new Form("", "Memory Information", "");
	result.addField(Field.fieldTextSingle("heapMemMax", Long.toString(runtime.getHeapMemMax()), "Heap Memory Max"));
	result.addField(Field.fieldTextSingle("heapMemUsed", Long.toString(runtime.getHeapMemUsed()), "Heap Memory Used"));
	result.addField(Field.fieldTextSingle("heapMemUsedPercentage", Float.toString(runtime.getHeapMemUsage()),
																															"Heap Memory Used [%]"));
	result.addField(Field.fieldTextSingle("nonHeapMemMax", Long.toString(runtime.getNonHeapMemMax()), "Non-Heap Memory Max"));
	result.addField(Field.fieldTextSingle("nonHeapMemUsed", Long.toString(runtime.getNonHeapMemUsed()),
			"Non-Heap Memory Used"));
	result.addField(Field.fieldTextSingle("nonHeapMemUsedPercentage", Float.toString(runtime.getNonHeapMemUsage()),
			"Non-Heap Memory Used [%]"));
	result.addField(Field.fieldTextSingle("directMemUsed", Long.toString(runtime.getDirectMemUsed()), "Direct Memory Used"));

	return result;
}
 
开发者ID:kontalk,项目名称:tigase-server,代码行数:17,代码来源:MemoryCheckerTask.java

示例4: execute

import tigase.form.Form; //导入依赖的package包/类
@Override
public void execute(AdhHocRequest request, AdHocResponse response) throws AdHocCommandException {
	try {
		if (request.getAction() != null && "cancel".equals(request.getAction())) {
			response.cancelSession();
		} else {
			final InfoTask taskInstance = ctx.getKernel().getInstance(request.getIq().getStanzaTo().getResource());

			Form form = taskInstance.getTaskInfo();

			response.getElements().add(form.getElement());
		}
	} catch (Exception e) {
		e.printStackTrace();
		throw new AdHocCommandException(Authorization.INTERNAL_SERVER_ERROR, e.getMessage());
	}
}
 
开发者ID:kontalk,项目名称:tigase-server,代码行数:18,代码来源:InfoTaskCommand.java

示例5: equals

import tigase.form.Form; //导入依赖的package包/类
private Set<String> equals(Form form) {
	final HashSet<String> result = new HashSet<String>();
	/*
	 * for (Field field : this.form.getAllFields()) { Field of =
	 * form.get(field.getVar()); if (of == null) {
	 * result.add(field.getVar()); } else { boolean tmp =
	 * Arrays.equals(field.getValues(), of.getValues()); if (!tmp)
	 * result.add(field.getVar()); } }
	 */
	for (Field field : form.getAllFields()) {
		Field of = this.form.get(field.getVar());
		if (of == null) {
			result.add(field.getVar());
		} else {
			boolean tmp = Arrays.equals(field.getValues(), of.getValues());
			if (!tmp)
				result.add(field.getVar());
		}
	}

	return result;
}
 
开发者ID:Smartupz,项目名称:tigase-muc,代码行数:23,代码来源:RoomConfig.java

示例6: getCurrentConfiguration

import tigase.form.Form; //导入依赖的package包/类
@Override
public Form getCurrentConfiguration() {
	Form form = super.getCurrentConfiguration();

	form.addField(Field.fieldTextSingle("averageLoadThreshold", String.valueOf(averageLoadThreshold),
			"Alarm when AverageLoad is bigger than"));

	return form;
}
 
开发者ID:kontalk,项目名称:tigase-server,代码行数:10,代码来源:LoadCheckerTask.java

示例7: getTaskInfo

import tigase.form.Form; //导入依赖的package包/类
@Override
public Form getTaskInfo() {
	Form result = new Form("", "Load Information", "");
	result.addField(Field.fieldTextSingle("averageLoad", Double.toString(runtime.getLoadAverage()), "Load Average"));

	return result;
}
 
开发者ID:kontalk,项目名称:tigase-server,代码行数:8,代码来源:LoadCheckerTask.java

示例8: setNewConfiguration

import tigase.form.Form; //导入依赖的package包/类
@Override
public void setNewConfiguration(Form form) {
	Field tmp = form.get("averageLoadThreshold");
	if (tmp != null) {
		this.averageLoadThreshold = Long.parseLong(tmp.getValue());
	}

	super.setNewConfiguration(form);
}
 
开发者ID:kontalk,项目名称:tigase-server,代码行数:10,代码来源:LoadCheckerTask.java

示例9: getCurrentConfiguration

import tigase.form.Form; //导入依赖的package包/类
@Override
public Form getCurrentConfiguration() {
	Form f = super.getCurrentConfiguration();

	Field x = Field.fieldListSingle("levelTreshold", levelTreshold.getName(), "Log level threshold",
			new String[] { Level.SEVERE.getName(), Level.WARNING.getName(), Level.INFO.getName(), Level.CONFIG.getName(),
					Level.FINE.getName(), Level.FINER.getName(), Level.FINEST.getName(), Level.ALL.getName() },
			new String[] { Level.SEVERE.getName(), Level.WARNING.getName(), Level.INFO.getName(), Level.CONFIG.getName(),
					Level.FINE.getName(), Level.FINER.getName(), Level.FINEST.getName(), Level.ALL.getName() });

	f.addField(x);

	return f;
}
 
开发者ID:kontalk,项目名称:tigase-server,代码行数:15,代码来源:LoggerTask.java

示例10: setNewConfiguration

import tigase.form.Form; //导入依赖的package包/类
@Override
public void setNewConfiguration(Form form) {
	Field f = form.get("levelTreshold");
	if (f != null)
		setLevelTreshold(f.getValue());
	super.setNewConfiguration(form);
}
 
开发者ID:kontalk,项目名称:tigase-server,代码行数:8,代码来源:LoggerTask.java

示例11: getCurrentConfiguration

import tigase.form.Form; //导入依赖的package包/类
@Override
public Form getCurrentConfiguration() {
	Form f = super.getCurrentConfiguration();

	f.addField(Field.fieldTextSingle(PERIOD_VAR, "" + period, "Period [ms]"));

	return f;
}
 
开发者ID:kontalk,项目名称:tigase-server,代码行数:9,代码来源:AbstractConfigurableTimerTask.java

示例12: setNewConfiguration

import tigase.form.Form; //导入依赖的package包/类
@Override
public void setNewConfiguration(Form form) {
	Field f = form.get(PERIOD_VAR);
	if (f != null) {
		long value = Long.parseLong(f.getValue());
		setPeriod(value);
	}

	super.setNewConfiguration(form);
}
 
开发者ID:kontalk,项目名称:tigase-server,代码行数:11,代码来源:AbstractConfigurableTimerTask.java

示例13: getCurrentConfiguration

import tigase.form.Form; //导入依赖的package包/类
@Override
public Form getCurrentConfiguration() {
	Form x = super.getCurrentConfiguration();
	x.addField(Field.fieldTextSingle("cpuTempThreshold", "" + cpuTempThreshold, "CPU Temp threshold"));
	// x.addField(Field.fieldTextSingle("N270#cpuTemp", "" +
	// cpuTempThreshold, "CPU Temp threshold"));
	return x;
}
 
开发者ID:kontalk,项目名称:tigase-server,代码行数:9,代码来源:CpuTempTask.java

示例14: setNewConfiguration

import tigase.form.Form; //导入依赖的package包/类
@Override
public void setNewConfiguration(Form form) {
	Field cpuTempField = form.get("cpuTempThreshold");
	if (cpuTempField != null) {
		this.cpuTempThreshold = Integer.parseInt(cpuTempField.getValue());
	}

	super.setNewConfiguration(form);
}
 
开发者ID:kontalk,项目名称:tigase-server,代码行数:10,代码来源:CpuTempTask.java

示例15: setNewConfiguration

import tigase.form.Form; //导入依赖的package包/类
@Override
public void setNewConfiguration(Form form) {
	Field m = form.get("message");
	if (m == null) {
		this.message = "<not found>";
	} else {
		this.message = m.getValue();
	}

	super.setNewConfiguration(form);
}
 
开发者ID:kontalk,项目名称:tigase-server,代码行数:12,代码来源:SampleTask.java


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