本文整理汇总了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;
}
示例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));
}
}
}
}
示例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);
}
}
}
}
示例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;
}
示例5: initialValue
import com.holonplatform.vaadin.navigator.annotations.ViewParameter; //导入依赖的package包/类
@Override
protected DateFormat initialValue() {
return new SimpleDateFormat(ViewParameter.DEFAULT_DATE_PATTERN);
}