use of io.jmix.ui.component.Component.BelongToFrame in project jmix by jmix-framework.
the class TableFieldFactoryImpl method createField.
@SuppressWarnings("unchecked")
@Override
public com.vaadin.v7.ui.Field<?> createField(com.vaadin.v7.data.Container container, Object itemId, Object propertyId, Component uiContext) {
String fieldPropertyId = String.valueOf(propertyId);
Table.Column columnConf = webTable.getColumnsInternal().get(propertyId);
TableDataContainer tableDataContainer = (TableDataContainer) container;
Object entity = tableDataContainer.getInternalItem(itemId);
InstanceContainer instanceContainer = webTable.getInstanceContainer((E) entity);
io.jmix.ui.component.Component columnComponent = createField(new ContainerValueSource(instanceContainer, fieldPropertyId), fieldPropertyId, columnConf.getXmlDescriptor());
if (columnComponent instanceof Field) {
Field jmixField = (Field) columnComponent;
Map<Table.Column, String> requiredColumns = webTable.getRequiredColumnsInternal();
if (requiredColumns != null && requiredColumns.containsKey(columnConf)) {
jmixField.setRequired(true);
jmixField.setRequiredMessage(requiredColumns.get(columnConf));
}
}
if (!(columnComponent instanceof CheckBox)) {
// todo get rid of concrete CheckBox class !
columnComponent.setWidthFull();
}
if (columnComponent instanceof BelongToFrame) {
BelongToFrame belongToFrame = (BelongToFrame) columnComponent;
if (belongToFrame.getFrame() == null) {
belongToFrame.setFrame(webTable.getFrame());
}
}
applyPermissions(columnComponent);
columnComponent.setParent(webTable);
Component componentImpl = getComponentImplementation(columnComponent);
if (componentImpl instanceof com.vaadin.v7.ui.Field) {
return (com.vaadin.v7.ui.Field<?>) componentImpl;
}
return new EditableColumnFieldWrapper(componentImpl, columnComponent);
}
Aggregations