/** * @return a value source that can be used to create the component */ @SuppressWarnings("unchecked") @Nullable public ValueSource getValueSource() { return valueSource == null && datasource != null ? new DatasourceValueSource(datasource, property) : valueSource; }
@SuppressWarnings("unchecked") @Override public Component createField(Datasource datasource, String property, Element xmlDescriptor) { return createField(new DatasourceValueSource(datasource, property), property, xmlDescriptor); }
@SuppressWarnings("unchecked") @Override public Field createField(Datasource datasource, String property) { return createField(new DatasourceValueSource(datasource, property), property); }
/** * Sets datasource and its property. * @deprecated Use {@link #setValueSource(ValueSource)} instead. */ @SuppressWarnings("unchecked") @Deprecated default void setDatasource(Datasource datasource, String property) { if (datasource != null) { this.setValueSource(new DatasourceValueSource(datasource, property)); } else { this.setValueSource(null); } }
/** * Set datasource and its property. * * @deprecated Use {@link #setValueSource(ValueSource)} instead */ @SuppressWarnings("unchecked") @Deprecated default void setDatasource(Datasource datasource, String property) { if (datasource == null && property != null) { throw new IllegalArgumentException("datasource is null"); } if (datasource != null) { this.setValueSource(new DatasourceValueSource(datasource, property)); } else { this.setValueSource(null); } } }
@Override public Component generateField(Datasource datasource, String propertyId) { DynamicAttributeComponentsGenerator generator = AppBeans.get(DynamicAttributeComponentsGenerator.NAME); //noinspection unchecked return generator.generateComponent(new DatasourceValueSource(datasource, propertyId), propertyId); } }