當前位置: 首頁>>代碼示例>>Java>>正文


Java Field類代碼示例

本文整理匯總了Java中tigase.form.Field的典型用法代碼示例。如果您正苦於以下問題:Java Field類的具體用法?Java Field怎麽用?Java Field使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


Field類屬於tigase.form包,在下文中一共展示了Field類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: prepareRegistrationForm

import tigase.form.Field; //導入依賴的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: getTaskInfo

import tigase.form.Field; //導入依賴的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

示例3: equals

import tigase.form.Field; //導入依賴的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

示例4: init

import tigase.form.Field; //導入依賴的package包/類
protected void init() {
	form.addField(Field.fieldTextSingle(MUC_ROOMCONFIG_ROOMNAME_KEY, "", "Natural-Language Room Name"));
	form.addField(Field.fieldTextSingle(MUC_ROOMCONFIG_ROOMDESC_KEY, "", "Short Description of Room"));
	form.addField(Field.fieldBoolean(MUC_ROOMCONFIG_PERSISTENTROOM_KEY, Boolean.FALSE, "Make Room Persistent?"));
	form.addField(Field.fieldBoolean(MUC_ROOMCONFIG_PUBLICROOM_KEY, Boolean.TRUE, "Make Room Publicly Searchable?"));
	form.addField(Field.fieldBoolean(MUC_ROOMCONFIG_MODERATEDROOM_KEY, Boolean.FALSE, "Make Room Moderated?"));
	form.addField(Field.fieldBoolean(MUC_ROOMCONFIG_MEMBERSONLY_KEY, Boolean.FALSE, "Make Room Members Only?"));
	form.addField(Field.fieldBoolean(MUC_ROOMCONFIG_PASSWORDPROTECTEDROOM_KEY, Boolean.FALSE, "Password Required to Enter?"));
	form.addField(Field.fieldTextSingle(MUC_ROOMCONFIG_ROOMSECRET_KEY, "", "Password"));

	form.addField(Field.fieldListSingle(MUC_ROOMCONFIG_ANONYMITY_KEY, Anonymity.semianonymous.name(),
			"Room anonymity level:", new String[] { "Non-Anonymous Room", "Semi-Anonymous Room", "Fully-Anonymous Room" },
			new String[] { Anonymity.nonanonymous.name(), Anonymity.semianonymous.name(), Anonymity.fullanonymous.name() }));
	form.addField(Field.fieldBoolean(MUC_ROOMCONFIG_CHANGESUBJECT_KEY, Boolean.FALSE, "Allow Occupants to Change Subject?"));

	if (publicLoggingAvailable) {
		form.addField(Field.fieldBoolean(MUC_ROOMCONFIG_ENABLELOGGING_KEY, Boolean.FALSE, "Enable Public Logging?"));
		form.addField(Field.fieldListSingle(LOGGING_FORMAT_KEY, LogFormat.html.name(), "Logging format:", new String[] {
				"HTML", "Plain text" }, new String[] { LogFormat.html.name(), LogFormat.plain.name() }));
	}

	form.addField(Field.fieldTextSingle(MUC_ROOMCONFIG_MAXHISTORY_KEY, "50",
			"Maximum Number of History Messages Returned by Room"));

}
 
開發者ID:Smartupz,項目名稱:tigase-muc,代碼行數:26,代碼來源:RoomConfig.java

示例5: setValue

import tigase.form.Field; //導入依賴的package包/類
private void setValue(String var, Object data) {
	Field f = form.get(var);

	if (f == null) {
		return;
	} else if (data == null) {
		f.setValues(new String[] {});
	} else if (data instanceof String) {
		String str = (String) data;
		if (f.getType() == FieldType.bool && !"0".equals(str) && !"1".equals(str) && !"true".equalsIgnoreCase(str)
				&& !"false".equalsIgnoreCase(str))
			throw new RuntimeException("Boolean fields allows only '1', 'true', '0', 'false' values");
		f.setValues(new String[] { str.toLowerCase() });
	} else if (data instanceof Boolean && f.getType() == FieldType.bool) {
		boolean b = ((Boolean) data).booleanValue();
		f.setValues(new String[] { b ? "1" : "0" });
	} else if (data instanceof String[] && (f.getType() == FieldType.list_multi || f.getType() == FieldType.text_multi)) {
		String[] d = (String[]) data;
		f.setValues(d);
	} else {
		throw new RuntimeException("Cannot match type " + data.getClass().getCanonicalName() + " to field type "
				+ f.getType().name());
	}

}
 
開發者ID:Smartupz,項目名稱:tigase-muc,代碼行數:26,代碼來源:RoomConfig.java

示例6: write

import tigase.form.Field; //導入依賴的package包/類
public void write(final UserRepository repo, final MucConfig config, final String subnode) throws UserNotFoundException,
		TigaseDBException {
	List<Field> fields = form.getAllFields();
	for (Field field : fields) {
		if (field.getVar() != null && !this.blacklist.contains(field.getVar())) {
			String[] values = field.getValues();
			String value = field.getValue();
			if (values == null || values.length == 0) {
				repo.removeData(config.getServiceName(), subnode, field.getVar());
			} else if (values.length == 1) {
				repo.setData(config.getServiceName(), subnode, field.getVar(), value);
			} else {
				repo.setDataList(config.getServiceName(), subnode, field.getVar(), values);
			}
		}
	}
}
 
開發者ID:Smartupz,項目名稱:tigase-muc,代碼行數:18,代碼來源:RoomConfig.java

示例7: getCurrentConfiguration

import tigase.form.Field; //導入依賴的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

示例8: getTaskInfo

import tigase.form.Field; //導入依賴的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

示例9: setNewConfiguration

import tigase.form.Field; //導入依賴的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

示例10: getCurrentConfiguration

import tigase.form.Field; //導入依賴的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

示例11: setNewConfiguration

import tigase.form.Field; //導入依賴的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

示例12: getCurrentConfiguration

import tigase.form.Field; //導入依賴的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

示例13: setNewConfiguration

import tigase.form.Field; //導入依賴的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

示例14: getCurrentConfiguration

import tigase.form.Field; //導入依賴的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

示例15: setNewConfiguration

import tigase.form.Field; //導入依賴的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


注:本文中的tigase.form.Field類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。