Search in sources :

Example 1 with TableColumnDescriptor

use of org.linkki.core.ui.section.annotations.TableColumnDescriptor in project linkki by linkki-framework.

the class UIAnnotationReader method createAndAddDescriptor.

private void createAndAddDescriptor(Annotation annotation, Method method) {
    List<LinkkiAspectDefinition> aspectDefs = AspectAnnotationReader.createAspectDefinitionsFrom(annotation);
    String pmoPropertyName = getPmoPropertyName(method);
    PropertyElementDescriptors elementDescriptors = descriptorsByProperty.computeIfAbsent(pmoPropertyName, PropertyElementDescriptors::new);
    if (BindingDefinition.isLinkkiBindingDefinition(annotation)) {
        BindingDefinition uiElement = BindingDefinition.from(annotation);
        addDescriptor(elementDescriptors, uiElement, pmoPropertyName, annotation, aspectDefs);
    } else {
        elementDescriptors.addAspect(aspectDefs);
        if (annotation instanceof UITableColumn) {
            columnDescriptors.put(elementDescriptors, new TableColumnDescriptor(annotatedClass, method, (UITableColumn) annotation));
        }
    }
}
Also used : UITableColumn(org.linkki.core.ui.section.annotations.UITableColumn) BindingDefinition(org.linkki.core.ui.section.annotations.BindingDefinition) LinkkiAspectDefinition(org.linkki.core.binding.aspect.definition.LinkkiAspectDefinition) TableColumnDescriptor(org.linkki.core.ui.section.annotations.TableColumnDescriptor)

Example 2 with TableColumnDescriptor

use of org.linkki.core.ui.section.annotations.TableColumnDescriptor in project linkki by linkki-framework.

the class PmoBasedTableFactory method setConfiguredColumndWidthOrExpandRatio.

private void setConfiguredColumndWidthOrExpandRatio(Table table, PropertyElementDescriptors field) {
    if (!annotationReader.hasTableColumnAnnotation(field)) {
        return;
    }
    TableColumnDescriptor column = annotationReader.getTableColumnDescriptor(field);
    column.checkValidConfiguration();
    if (column.isCustomWidthDefined()) {
        table.setColumnWidth(field.getPmoPropertyName(), column.getWidth());
    } else if (column.isCustomExpandRatioDefined()) {
        table.setColumnExpandRatio(field.getPmoPropertyName(), column.getExpandRatio());
    }
}
Also used : TableColumnDescriptor(org.linkki.core.ui.section.annotations.TableColumnDescriptor)

Aggregations

TableColumnDescriptor (org.linkki.core.ui.section.annotations.TableColumnDescriptor)2 LinkkiAspectDefinition (org.linkki.core.binding.aspect.definition.LinkkiAspectDefinition)1 BindingDefinition (org.linkki.core.ui.section.annotations.BindingDefinition)1 UITableColumn (org.linkki.core.ui.section.annotations.UITableColumn)1