本文整理了Java中com.vaadin.data.Property.getType()
方法的一些代码示例,展示了Property.getType()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Property.getType()
方法的具体详情如下:
包路径:com.vaadin.data.Property
类名称:Property
方法名:getType
暂无
代码示例来源:origin: org.aperteworkflow/base-widgets
@Override
public Class<?> getType() {
return propertyDataSource.getType();
}
代码示例来源:origin: org.aperteworkflow/gui-commons
@Override
public Object parse(String formattedValue) throws Exception {
if ("".equals(formattedValue)){
return null;
}
return ConvertUtils.convert(formattedValue, map.get(newDataSource.getType()));
}
};
代码示例来源:origin: org.vaadin.addons/customfield
/**
* Construct a new formatter that is connected to given data source. Calls
* {@link #format(Object)} which can be a problem if the formatter has not
* yet been initialized.
*
* @param propertyDataSource
* to connect this property to.
*/
public PropertyConverter(Property propertyDataSource) {
setPropertyDataSource(propertyDataSource);
propertyClass = (Class<? extends PC>) propertyDataSource.getType();
}//new
代码示例来源:origin: org.aperteworkflow/gui-commons
if (newDataSource.getType().isPrimitive() && newDataSource instanceof ObjectProperty) {
try {
Field[] fields = newDataSource.getClass().getSuperclass().getDeclaredFields();
代码示例来源:origin: org.opennms.features.topology/api
private synchronized void loadPropertiesIfNull() {
if (m_properties == null) {
m_properties = new TreeMap<Object,Class<?>>();
BeanItem<T> item = null;
try {
item = new BeanItem<T>(m_datasource.createInstance(m_itemClass));
} catch (InstantiationException e) {
LoggerFactory.getLogger(getClass()).error("Class {} does not have a default constructor. Cannot create an instance.", getItemClass());
} catch (IllegalAccessException e) {
LoggerFactory.getLogger(getClass()).error("Class {} does not have a public default constructor. Cannot create an instance.", getItemClass());
}
for (Object key : item.getItemPropertyIds()) {
m_properties.put(key, item.getItemProperty(key).getType());
}
}
}
}
代码示例来源:origin: org.opennms.features.topology/org.opennms.features.topology.api
private synchronized void loadPropertiesIfNull() {
if (m_properties == null) {
m_properties = new TreeMap<Object,Class<?>>();
BeanItem<T> item = null;
try {
item = new BeanItem<T>(m_datasource.createInstance(m_itemClass));
} catch (InstantiationException e) {
LoggerFactory.getLogger(getClass()).error("Class {} does not have a default constructor. Cannot create an instance.", getItemClass());
} catch (IllegalAccessException e) {
LoggerFactory.getLogger(getClass()).error("Class {} does not have a public default constructor. Cannot create an instance.", getItemClass());
}
for (Object key : item.getItemPropertyIds()) {
m_properties.put(key, item.getItemProperty(key).getType());
}
}
}
}
代码示例来源:origin: tlaukkan/vaadin-lazyquerycontainer
/**
* Expands nested bean properties by replacing a top-level property with
* some or all of its sub-properties. The expansion is not recursive.
*
* @param propertyId
* property id for the property whose sub-properties are to be
* expanded,
* @param subPropertyIds
* sub-properties to expand, all sub-properties are expanded if
* not specified
*/
public void expandProperty(final String propertyId, final String... subPropertyIds) {
Set<String> subPropertySet = new HashSet<String>(
Arrays.asList(subPropertyIds));
if (0 == subPropertyIds.length) {
// Enumerate all sub-properties
Class<?> propertyType = getItemProperty(propertyId).getType();
Map<String, ?> pds = getPropertyDescriptors(propertyType);
subPropertySet.addAll(pds.keySet());
}
for (String subproperty : subPropertySet) {
String qualifiedPropertyId = propertyId + "." + subproperty;
addNestedProperty(qualifiedPropertyId);
}
}
代码示例来源:origin: org.opennms.features.topology.plugins/org.opennms.features.topology.plugins.browsers
@Override
public Object generateCell(Table source, Object itemId, Object columnId) {
Property property = source.getContainerProperty(itemId, columnId);
if (property == null || property.getValue() == null) {
return null;
}
String formattedValue;
if(property.getType().equals(Instant.class)){
formattedValue = timeformatService.format((Instant) property.getValue(), UserTimeZoneExtractor.extractUserTimeZoneIdOrNull());
} else if(property.getType().equals(Date.class)){
formattedValue = timeformatService.format((Date) property.getValue(), UserTimeZoneExtractor.extractUserTimeZoneIdOrNull());
} else {
formattedValue = property.toString();
}
return formattedValue;
}
}
代码示例来源:origin: nz.co.senanque/madura-vaadin
protected String formatPropertyValue(Object rowId, Object colId,
Property<?> property) {
// Format by property type
Formatter formatter = FormatterFactory.getFormatter(property.getType());
if (formatter != null) {
// setColumnAlignment(colId, Table.ALIGN_RIGHT);
return formatter.format(property.getValue());
}
return super.formatPropertyValue(rowId, colId, property);
}
代码示例来源:origin: org.aperteworkflow/gui-commons
@Override
public Field createField(Item item, Object propertyId, Component uiContext) {
Class<?> type = item.getItemProperty(propertyId).getType();
Field field = createFieldByPropertyType(type);
field.setCaption(createCaptionByPropertyId(propertyId));
return field;
}
代码示例来源:origin: nz.co.senanque/madura-vaadinsupport
protected String formatPropertyValue(Object rowId, Object colId,
Property property) {
// Format by property type
Formatter formatter = FormatterFactory.getFormatter(property.getType());
if (formatter != null) {
// setColumnAlignment(colId, Table.ALIGN_RIGHT);
return formatter.format(property.getValue());
}
return super.formatPropertyValue(rowId, colId, property);
}
代码示例来源:origin: com.holon-platform.vaadin7/holon-vaadin
@SuppressWarnings("unchecked")
@Override
public void setPropertyDataSource(@SuppressWarnings("rawtypes") Property newDataSource) {
// Stops listening the old data source changes
if (dataSource != null && Property.ValueChangeNotifier.class.isAssignableFrom(dataSource.getClass())) {
((Property.ValueChangeNotifier) dataSource).removeValueChangeListener(this);
}
// Check if the current converter is compatible.
if (newDataSource != null
&& !ConverterUtil.canConverterPossiblyHandle(getConverter(), getType(), newDataSource.getType())) {
// There is no converter set or there is no way the current converter can be compatible
Converter<T, Object> c = ConverterUtil.getConverter(getType(), newDataSource.getType(), getSession());
setConverter(c);
}
dataSource = newDataSource;
if (dataSource != null) {
// Update value from the data source
updateValueFromDataSource();
}
// Listens the new data source
if (dataSource != null && Property.ValueChangeNotifier.class.isAssignableFrom(dataSource.getClass())) {
((Property.ValueChangeNotifier) dataSource).addValueChangeListener(this);
}
markAsDirty();
}
代码示例来源:origin: org.aperteworkflow/base-widgets
component.setReadOnly(false);
if (Date.class.isAssignableFrom(component.getType())) {
DateWidgetElement dwe = Lang2.assumeType(element, DateWidgetElement.class);
Date v = new SimpleDateFormat(dwe.getFormat()).parse(String.valueOf(value));
component.setValue(v);
} else if (String.class.isAssignableFrom(component.getType())) {
component.setValue(nvl(value, ""));
} else if (component instanceof Container &&
component.getType().isAssignableFrom(value.getClass())) {
if (((Container) component).containsId(value)) {
component.setValue(value);
代码示例来源:origin: org.metawidget.modules/metawidget-all
Class<?> componentPropertyType = property.getType();
@SuppressWarnings( "unchecked" )
Converter<Object, Object> setValueConverter = (Converter<Object, Object>) getConverter( toInspectPropertyType, componentPropertyType );
代码示例来源:origin: org.metawidget.modules/metawidget-all
Converter<Object, Object> getValueConverter = (Converter<Object, Object>) getConverter( property.getType(), toInspectPropertyType );
代码示例来源:origin: org.aperteworkflow/base-widgets
@Override
public Field createField(Item item, Object propertyId, Component uiContext) {
Property property = item.getItemProperty(propertyId);
Class<?> cls = property.getType();
Class[] supported = new Class[]{String.class, Boolean.class, Integer.class};
if (!Arrays.asList(supported).contains(cls)) {
内容来源于网络,如有侵权,请联系作者删除!