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


Java Converter.ConversionException方法代码示例

本文整理汇总了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);
}
 
开发者ID:cuba-platform,项目名称:cuba,代码行数:27,代码来源:WebTwinColumn.java

示例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();
}
 
开发者ID:apache,项目名称:incubator-openaz,代码行数:18,代码来源:DatatypeConverter.java

示例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;
}
 
开发者ID:apache,项目名称:incubator-openaz,代码行数:19,代码来源:ConstraintTypeConverter.java

示例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;
}
 
开发者ID:vaadin,项目名称:archetype-application-example,代码行数:25,代码来源:ProductGrid.java

示例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);
    }
}
 
开发者ID:cuba-platform,项目名称:cuba,代码行数:10,代码来源:CubaDateField.java

示例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;
}
 
开发者ID:cuba-platform,项目名称:cuba,代码行数:10,代码来源:CubaDateField.java

示例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));
    }
}
 
开发者ID:cuba-platform,项目名称:cuba,代码行数:9,代码来源:PropertyWrapper.java

示例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);
}
 
开发者ID:cuba-platform,项目名称:cuba,代码行数:13,代码来源:WebAbstractOptionsBase.java

示例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);
}
 
开发者ID:cuba-platform,项目名称:cuba,代码行数:35,代码来源:WebOptionsList.java

示例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);
}
 
开发者ID:cuba-platform,项目名称:cuba,代码行数:40,代码来源:WebTwinColumn.java

示例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;
}
 
开发者ID:apache,项目名称:incubator-openaz,代码行数:16,代码来源:CategoryConverter.java

示例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();
}
 
开发者ID:apache,项目名称:incubator-openaz,代码行数:13,代码来源:CategoryConverter.java

示例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;
}
 
开发者ID:apache,项目名称:incubator-openaz,代码行数:16,代码来源:DatatypeConverter.java

示例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;
}
 
开发者ID:apache,项目名称:incubator-openaz,代码行数:15,代码来源:ConstraintTypeConverter.java

示例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;
}
 
开发者ID:apache,项目名称:incubator-openaz,代码行数:11,代码来源:IdentifierConverter.java


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