本文整理汇总了Java中com.vaadin.data.util.converter.Converter.ConversionException方法的典型用法代码示例。如果您正苦于以下问题:Java Converter.ConversionException方法的具体用法?Java Converter.ConversionException怎么用?Java Converter.ConversionException使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.vaadin.data.util.converter.Converter
的用法示例。
在下文中一共展示了Converter.ConversionException方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: setValue
import com.vaadin.data.util.converter.Converter; //导入方法依赖的package包/类
@Override
public void setValue(Object newValue) throws ReadOnlyException, Converter.ConversionException {
Class propertyType = propertyPath.getMetaProperty().getJavaType();
if (Set.class.isAssignableFrom(propertyType)) {
if (newValue == null) {
newValue = new HashSet();
} else {
if (newValue instanceof Collection) {
newValue = new HashSet<>((Collection<?>) newValue);
} else {
newValue = Collections.singleton(newValue);
}
}
} else if (List.class.isAssignableFrom(propertyType)) {
if (newValue == null) {
newValue = new ArrayList();
} else {
if (newValue instanceof Collection) {
newValue = new ArrayList<>((Collection<?>) newValue);
} else {
newValue = Collections.singletonList(newValue);
}
}
}
super.setValue(newValue);
}
示例2: convertToPresentation
import com.vaadin.data.util.converter.Converter; //导入方法依赖的package包/类
@Override
public Object convertToPresentation(Datatype value,
Class<? extends Object> targetType, Locale locale)
throws Converter.ConversionException {
if (value == null) {
return null;
}
if (targetType.isInstance(String.class) ||
targetType.getName().equals(String.class.getName())) {
return value.getXacmlId();
}
if (targetType.isInstance(Identifier.class) ||
targetType.getName().equals(Identifier.class.getName())) {
return value.getIdentifer();
}
return value.getIdentifer();
}
示例3: convertToPresentation
import com.vaadin.data.util.converter.Converter; //导入方法依赖的package包/类
@Override
public Object convertToPresentation(ConstraintType value,
Class<? extends Object> targetType, Locale locale)
throws Converter.ConversionException {
if (logger.isTraceEnabled()) {
logger.trace("convertToPresentation:" + value + " target " + targetType);
}
if (value == null) {
return null;
}
if (targetType.isAssignableFrom(String.class)) {
return value.getConstraintType();
}
if (targetType.isInstance(Integer.class)) {
return value.getId();
}
return null;
}
示例4: convertToPresentation
import com.vaadin.data.util.converter.Converter; //导入方法依赖的package包/类
@Override
public String convertToPresentation(Enum availability,
java.lang.Class<? extends String> targetType, Locale locale)
throws Converter.ConversionException {
String text = super.convertToPresentation(availability, targetType,
locale);
String color = "";
if (availability == Availability.AVAILABLE) {
color = "#2dd085";
} else if (availability == Availability.COMING) {
color = "#ffc66e";
} else if (availability == Availability.DISCONTINUED) {
color = "#f54993";
}
String iconCode = "<span class=\"v-icon\" style=\"font-family: "
+ FontAwesome.CIRCLE.getFontFamily() + ";color:" + color
+ "\">&#x"
+ Integer.toHexString(FontAwesome.CIRCLE.getCodepoint())
+ ";</span>";
return iconCode + " " + text;
}
示例5: setValue
import com.vaadin.data.util.converter.Converter; //导入方法依赖的package包/类
@Override
protected void setValue(Date newValue, boolean repaintIsNotNeeded) throws Converter.ConversionException {
if (newValue == MARKER_DATE)
super.setValue(prevValue, true);
else {
prevValue = newValue;
super.setValue(newValue, repaintIsNotNeeded);
}
}
示例6: handleUnparsableDateString
import com.vaadin.data.util.converter.Converter; //导入方法依赖的package包/类
@Override
protected Date handleUnparsableDateString(String dateString) throws Converter.ConversionException {
if (Objects.equals(dateString, StringUtils.replaceChars(getState(false).dateMask, "#U", "__"))) {
return null;
}
markAsDirty();
return MARKER_DATE;
}
示例7: setValue
import com.vaadin.data.util.converter.Converter; //导入方法依赖的package包/类
@Override
public void setValue(Object newValue) throws Property.ReadOnlyException, Converter.ConversionException {
final Instance instance = getInstance();
if (instance != null) {
InstanceUtils.setValueEx(instance, propertyPath.getPath(), valueOf(newValue));
}
}
示例8: setValue
import com.vaadin.data.util.converter.Converter; //导入方法依赖的package包/类
@Override
public void setValue(Object newValue) throws ReadOnlyException, Converter.ConversionException {
if (newValue instanceof Collection) {
Class propertyType = propertyPath.getMetaProperty().getJavaType();
if (Set.class.isAssignableFrom(propertyType)) {
newValue = new LinkedHashSet<>((Collection<?>) newValue);
} else if (List.class.isAssignableFrom(propertyType)) {
newValue = new ArrayList<>((Collection<?>) newValue);
}
}
super.setValue(newValue);
}
示例9: WebOptionsList
import com.vaadin.data.util.converter.Converter; //导入方法依赖的package包/类
public WebOptionsList() {
component = new CubaListSelect() {
@Override
public void setPropertyDataSource(Property newDataSource) {
if (newDataSource == null) {
super.setPropertyDataSource(null);
return;
}
super.setPropertyDataSource(new PropertyAdapter(newDataSource) {
@Override
public Class getType() {
// we ourselves convert values in this property adapter
return Object.class;
}
@Override
public Object getValue() {
final Object o = itemProperty.getValue();
return getKeyFromValue(o);
}
@Override
public void setValue(Object newValue) throws ReadOnlyException, Converter.ConversionException {
final Object v = getValueFromKey(newValue);
itemProperty.setValue(v);
}
});
}
};
attachListener(component);
initDefaults(component);
}
示例10: WebTwinColumn
import com.vaadin.data.util.converter.Converter; //导入方法依赖的package包/类
public WebTwinColumn() {
component = new CubaTwinColSelect() {
@Override
public void setPropertyDataSource(Property newDataSource) {
super.setPropertyDataSource(new PropertyAdapter(newDataSource) {
@Override
public Object getValue() {
final Object o = itemProperty.getValue();
return getKeyFromValue(o);
}
@Override
public void setValue(Object newValue) throws ReadOnlyException, Converter.ConversionException {
final Object v = getValueFromKey(newValue);
itemProperty.setValue(v);
}
});
}
@Override
public Resource getItemIcon(Object itemId) {
if (styleProvider != null) {
@SuppressWarnings({"unchecked"})
final Entity item = optionsDatasource.getItem(itemId);
final String resURL = styleProvider.getItemIcon(item, isSelected(itemId));
return resURL == null ? null : WebComponentsHelper.getResource(resURL);
} else {
return null;
}
}
};
attachListener(component);
component.setImmediate(true);
component.setItemCaptionMode(AbstractSelect.ItemCaptionMode.ITEM);
component.setMultiSelect(true);
component.setInvalidAllowed(false);
component.setInvalidCommitted(true);
}
示例11: convertToModel
import com.vaadin.data.util.converter.Converter; //导入方法依赖的package包/类
@Override
public Category convertToModel(Object value,
Class<? extends Category> targetType, Locale locale)
throws Converter.ConversionException {
Category category = new Category();
if (value == null) {
return category;
}
if (value instanceof Identifier) {
category.setXacmlId(((Identifier)value).stringValue());
} else {
category.setXacmlId(value.toString());
}
return category;
}
示例12: convertToPresentation
import com.vaadin.data.util.converter.Converter; //导入方法依赖的package包/类
@Override
public Object convertToPresentation(Category value,
Class<? extends Object> targetType, Locale locale)
throws Converter.ConversionException {
if (targetType.getName().equals(String.class.getName())) {
return value.getXacmlId();
}
if (targetType.getName().equals(Identifier.class.getName())) {
return value.getIdentifer();
}
return value.getIdentifer();
}
示例13: convertToModel
import com.vaadin.data.util.converter.Converter; //导入方法依赖的package包/类
@Override
public Datatype convertToModel(Object value,
Class<? extends Datatype> targetType, Locale locale)
throws Converter.ConversionException {
Datatype datatype = new Datatype();
if (value == null) {
return datatype;
}
if (value instanceof Identifier) {
datatype.setXacmlId(((Identifier)value).stringValue());
} else {
datatype.setXacmlId(value.toString());
}
return datatype;
}
示例14: convertToModel
import com.vaadin.data.util.converter.Converter; //导入方法依赖的package包/类
@Override
public ConstraintType convertToModel(Object value,
Class<? extends ConstraintType> targetType, Locale locale)
throws Converter.ConversionException {
if (logger.isTraceEnabled()) {
logger.trace("convertToModel:" + value + " target " + targetType);
}
ConstraintType constraintValue = new ConstraintType();
if (value == null) {
return constraintValue;
}
// PLD TODO??
return constraintValue;
}
示例15: convertToPresentation
import com.vaadin.data.util.converter.Converter; //导入方法依赖的package包/类
@Override
public Object convertToPresentation(Identifier value,
Class<? extends Object> targetType, Locale locale)
throws Converter.ConversionException {
if (targetType.isInstance(String.class) ||
targetType.getName().equals(String.class.getName())) {
return value.stringValue();
}
return null;
}