@Override public ComponentWrapperPanel createWicketComponent(final String id, final AttrGroup group, final AttrDescription desc, final EntityWithAttributes entity) { // TODO RK cachen der factory Object factoryObject = desc.getWicketComponentFactoryClass(); AttrWicketComponentFactory factory; if (factoryObject instanceof AttrWicketComponentFactory) { factory = (AttrWicketComponentFactory) factoryObject; } else { throw new UnsupportedOperationException( "Attr cannot load component factory: " + desc.getPropertyName() + "; " + desc.getWicketComponentFactoryClass()); } return factory.createComponents(id, group, desc, entity); }
@Override public <PK extends Serializable, T extends TimeableAttrRow<PK>, U extends EntityWithTimeableAttr<PK, T> & EntityWithConfigurableAttr> Optional<IModel<String>> getStringAttribute(final U entity, final Date date, final String groupName, final String descName) { final T attrRowForCurrentDate = timeableService.getAttrRowValidAtDate(entity, groupName, date); if (attrRowForCurrentDate == null) { return Optional.empty(); } final String attribute = attrRowForCurrentDate.getStringAttribute(descName); if (attribute == null) { return Optional.empty(); } final AttrDescription attrDescription = getAttrDescription(entity, groupName, descName); final IModel<String> valueModel = (attrDescription.getWicketComponentFactoryClass() instanceof DropDownAttrWicketComponentFactory) ? new ResourceModel(attribute) : // DropDownAttrWicketComponentFactory -> it's a list of i18nkeys, so we need a ResourceModel for the translation new Model<>(attribute); return Optional.of(valueModel); }