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


Java ViewParameter類代碼示例

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


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

示例1: generateParametersString

import com.holonplatform.vaadin.navigator.annotations.ViewParameter; //導入依賴的package包/類
/**
 * Generate parameters URI string from name-value map
 * @param paramsMap name-value map
 * @param encoding URI encoding (charset)
 * @return Parameters string
 * @throws ViewConfigurationException Error in URI building
 */
public static String generateParametersString(Map<String, Object> paramsMap, String encoding)
		throws ViewConfigurationException {
	if (paramsMap != null && !paramsMap.isEmpty()) {

		String charset = (encoding == null) ? ViewParameter.DEFAULT_PARAMETER_ENCODING : encoding;

		StringBuilder paramsString = new StringBuilder();

		for (Entry<String, Object> entry : paramsMap.entrySet()) {
			if (entry.getKey() != null && !entry.getKey().trim().equals("")) {
				try {
					String serializedValue = serializeParameterValue(entry.getValue(),
							DEFAULT_PARAM_DATE_FORMAT.get());
					if (serializedValue != null) {
						if (paramsString.length() > 0) {
							paramsString.append("/");
						}
						paramsString.append(URLEncoder.encode(entry.getKey().trim(), charset));
						paramsString.append("=");
						paramsString.append(URLEncoder.encode(serializedValue, charset));
					}
				} catch (Exception e) {
					throw new ViewConfigurationException("Failed to serialize view parameters", e);
				}
			}
		}

		return paramsString.toString();
	}
	return null;
}
 
開發者ID:holon-platform,項目名稱:holon-vaadin7,代碼行數:39,代碼來源:ViewNavigationUtils.java

示例2: parseParameter

import com.holonplatform.vaadin.navigator.annotations.ViewParameter; //導入依賴的package包/類
private static void parseParameter(String p, Map<String, String> parametersMap, String encoding)
		throws UnsupportedEncodingException {
	if (p != null && p.contains("=")) {
		String[] splitted = PARAMETER_SEPARATOR_PATTERN.split(p);
		if (splitted != null && splitted.length == 2) {
			String key = splitted[0];
			String value = splitted[1];
			if (key != null && !key.trim().equals("") && value != null && !value.trim().equals("")) {
				String charset = (encoding == null) ? ViewParameter.DEFAULT_PARAMETER_ENCODING : encoding;
				parametersMap.put(URLDecoder.decode(key, charset), URLDecoder.decode(value, charset));
			}
		}
	}
}
 
開發者ID:holon-platform,項目名稱:holon-vaadin7,代碼行數:15,代碼來源:ViewNavigationUtils.java

示例3: checkParameterName

import com.holonplatform.vaadin.navigator.annotations.ViewParameter; //導入依賴的package包/類
/**
 * Check parameter name does not contains illegal characters
 * @param parameterName Parameter name to check
 * @throws ViewConfigurationException If parameter contains illegal characters
 */
private static void checkParameterName(String parameterName) throws ViewConfigurationException {
	if (parameterName != null) {
		for (char illegalChar : ViewParameter.ILLEGAL_PARAMETER_NAME_CHARACTERS) {
			if (parameterName.indexOf(illegalChar) > -1) {
				throw new ViewConfigurationException(
						"Illegal character " + illegalChar + " in View parameter name: " + parameterName);
			}
		}
	}
}
 
開發者ID:holon-platform,項目名稱:holon-vaadin7,代碼行數:16,代碼來源:ViewNavigationUtils.java

示例4: getViewParameterFields

import com.holonplatform.vaadin.navigator.annotations.ViewParameter; //導入依賴的package包/類
/**
 * Get class (and superclasses) {@link ViewParameter} annotated fields
 * @param cls Class to inspect
 * @return {@link ViewParameter} annotated fields, or an empty list if none
 */
private static List<Field> getViewParameterFields(Class<?> cls) {
	List<Field> fields = new ArrayList<>();
	Class<?> currentClass = cls;
	while (currentClass != null) {
		final Field[] declaredFields = currentClass.getDeclaredFields();
		for (final Field field : declaredFields) {
			if (field.isAnnotationPresent(ViewParameter.class)) {
				fields.add(field);
			}
		}
		currentClass = currentClass.getSuperclass();
	}
	return fields;
}
 
開發者ID:holon-platform,項目名稱:holon-vaadin7,代碼行數:20,代碼來源:ViewNavigationUtils.java

示例5: initialValue

import com.holonplatform.vaadin.navigator.annotations.ViewParameter; //導入依賴的package包/類
@Override
protected DateFormat initialValue() {
	return new SimpleDateFormat(ViewParameter.DEFAULT_DATE_PATTERN);
}
 
開發者ID:holon-platform,項目名稱:holon-vaadin7,代碼行數:5,代碼來源:ViewNavigationUtils.java


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