/** * Get a {@link PropertyListingBuilder} to create and setup a {@link PropertyListing}. * @param properties The listing property set (not null) * @return A new {@link PropertyListingBuilder} */ static PropertyListingBuilder builder(Property<?>... properties) { return builder(PropertySet.of(properties)); }
/** * Get a builder to create a {@link PropertyInputForm} using given property set. * @param <C> Form content element type * @param content The form content, where the {@link Input}s will be composed using the configured * {@link Composer} (not null) * @param properties The property set (not null) * @return A new {@link PropertyInputFormBuilder} */ static <C extends Component> PropertyInputFormBuilder<C> form(C content, Property<?>... properties) { return PropertyInputForm.builder(content, PropertySet.of(properties)); }
/** * Create a PropertySetProjection using given <code>properties</code> * @param <P> Actual property type * @param properties Projection property set * @return PropertySetProjection on given properties */ @SuppressWarnings("rawtypes") static <P extends Property> PropertySetProjection of(Iterable<P> properties) { return new DefaultPropertySetProjection( (properties instanceof PropertySet) ? (PropertySet) properties : PropertySet.of(properties)); }
@SuppressWarnings("rawtypes") @Override public <P extends Property> R propertySet(Iterable<P> properties) { this.propertySet = PropertySet.of(properties); return getActualDefinition(); }
/** * Create a new {@link DocumentConverter} to convert documents into {@link PropertyBox} instances using given * property set. * @param <P> Property type * @param properties The property set to use (not null) * @return A new {@link PropertyBox} type {@link DocumentConverter} */ @SuppressWarnings("rawtypes") static <P extends Property> DocumentConverter<PropertyBox> propertyBox(Iterable<P> properties) { return new PropertyBoxDocumentConverter(PropertySet.of(properties)); }
/** * Create a new {@link DocumentConverter} to convert documents into {@link PropertyBox} instances using given * property set. * @param <P> Property type * @param properties The property set to use (not null) * @return A new {@link PropertyBox} type {@link DocumentConverter} */ @SuppressWarnings({ "rawtypes", "unchecked" }) static <P extends Property> DocumentConverter<PropertyBox> propertyBox(P... properties) { return new PropertyBoxDocumentConverter(PropertySet.of(properties)); }
/** * Create a new {@link DatastoreDataProvider} which uses {@link PropertyBox} items type and {@link QueryFilter} type * data provider filters. * @param datastore The {@link Datastore} to use (not null) * @param target The {@link DataTarget} to use as query target (not null) * @param properties The property set to use as query projection (not null) * @return A new {@link DatastoreDataProvider} */ static DatastoreDataProvider<PropertyBox, QueryFilter> create(Datastore datastore, DataTarget<?> target, Property<?>... properties) { return builder(datastore, target, PropertySet.of(properties)).build(); }
public <P extends Property<?>> AbstractBuilder(Iterable<P> properties) { super(); ObjectUtils.argumentNotNull(properties, "Properties must be not null"); this.instance = new DefaultPropertyInputGroup( (properties instanceof PropertySet<?>) ? (PropertySet<?>) properties : PropertySet.of(properties)); }
@Override public B dataSource(Datastore datastore, DataTarget<?> dataTarget, Property<?>... properties) { MultiPropertySelectInputBuilder.super.dataSource(datastore, dataTarget, properties); setupItemConverter(datastore, dataTarget, PropertySet.of(properties)); return builder(); }
public void propertySet2() { // tag::propertyset2[] final PathProperty<String> NAME = PathProperty.create("name", String.class); final PathProperty<String> SURNAME = PathProperty.create("surname", String.class); final PropertySet<Property<?>> SET = PropertySet.of(NAME, SURNAME); // <1> boolean contains = SET.contains(NAME); // <2> SET.forEach(p -> p.toString()); // <3> String captions = SET.stream().map(p -> p.getMessage()).collect(Collectors.joining()); // <4> List<Property<?>> list = SET.asList(); // <5> // end::propertyset2[] }
@SuppressWarnings("rawtypes") @Override public <P extends Property> O propertySet(Iterable<P> properties) { ObjectUtils.argumentNotNull(properties, "Properties must be not null"); getDefinition().setPropertySet( (properties instanceof PropertySet) ? (PropertySet) properties : PropertySet.of(properties)); return getActualOperation(); }
@Override public TablePropertyListingBuilder dataSource(Datastore datastore, DataTarget<?> dataTarget, Property... identifierProperties) { commitHandler(new DatastoreCommitHandler(datastore, dataTarget)); dataSource(new DatastoreItemDataProvider(datastore, dataTarget, PropertySet.of(properties)), identifierProperties); return builder(); }
public void group2() { // tag::group2[] final PathProperty<Long> ID = PathProperty.create("id", Long.class); final PathProperty<String> DESCRIPTION = PathProperty.create("description", String.class); final PropertySet<?> PROPERTIES = PropertySet.of(ID, DESCRIPTION); PropertyInputGroup group = Components.input.propertyGroup().properties(PROPERTIES).build(); // <1> // end::group2[] }
@Override public B dataSource(Datastore datastore, DataTarget<?> dataTarget) { // Use item listing property set PropertySet<?> propertySet = (properties instanceof PropertySet) ? (PropertySet<?>) properties : PropertySet.of(properties); // set data source dataSource(ItemDataProvider.create(datastore, dataTarget, propertySet)); // set commit handler commitHandler(CommitHandler.datastore(datastore, dataTarget)); return builder(); }
public void propertyListing2() { // tag::propertyListing2[] final NumericProperty<Long> ID = NumericProperty.longType("id"); final StringProperty DESCRIPTION = StringProperty.create("description"); final BooleanProperty ACTIVE = BooleanProperty.create("active"); final PropertySet<?> PROPERTIES = PropertySet.of(ID, DESCRIPTION, ACTIVE); PropertyListing listing = Components.listing.properties(PROPERTIES) // <1> .build(DESCRIPTION, ID); // <2> // end::propertyListing2[] }
public void dataprovider1() { // tag::dataprovider1[] final NumericProperty<Long> ID = NumericProperty.longType("id"); final StringProperty NAME = StringProperty.create("name"); final PropertySet<?> SUBJECT = PropertySet.of(ID, NAME); // <1> final DataTarget<?> TARGET = DataTarget.named("subjects"); // <2> final Datastore datastore = obtainDatastore(); // <3> DataProvider<PropertyBox, QueryFilter> dataProvider = DatastoreDataProvider.create(datastore, TARGET, SUBJECT); // <4> dataProvider = DatastoreDataProvider.create(datastore, TARGET, ID, NAME); // <5> // end::dataprovider1[] }
public void deserializepb() { // tag::deserializepb[] Json json = Json.require(); // <1> final PathProperty<Long> KEY = create("key", long.class); final PathProperty<String> NAME = create("name", String.class); final PropertySet<?> PROPERTIES = PropertySet.of(KEY, NAME); PropertyBox result = json.fromJson(JsonReader.from("[JSON string]"), PROPERTIES); // <2> result = json.fromJson("[JSON string]", PROPERTIES); // <3> result = json.fromJson(JsonReader.from("[JSON string]"), KEY, NAME); // <4> List<PropertyBox> results = json.fromJsonArray("[JSON string]", PROPERTIES); // <5> // end::deserializepb[] }
public void selectable10() { // tag::selectable10[] Datastore datastore = obtainDatastore(); final PathProperty<Long> ID = PathProperty.create("id", Long.class); final PathProperty<String> DESCRIPTION = PathProperty.create("description", String.class); SingleSelect<Long> singleSelect = Components.input.singleSelect(ID) .dataSource(datastore, DataTarget.named("testData"), PropertySet.of(ID, DESCRIPTION), // Datastore () -> ID.gt(0L)) // <1> .itemCaptionGenerator(propertyBox -> propertyBox.getValue(DESCRIPTION)).build(); // end::selectable10[] }
public void propertySet() { // tag::propertyset[] final StringProperty NAME = StringProperty.create("name"); final StringProperty SURNAME = StringProperty.create("surname"); final NumericProperty<Integer> SEQUENCE = NumericProperty.integerType("surname"); PropertySet<Property<?>> set = PropertySet.of(NAME, SURNAME); // <1> set = PropertySet.builder().add(NAME).add(SURNAME).build(); // <2> PropertySet<Property<?>> set2 = PropertySet.builder().add(set).add(SEQUENCE).build(); // <3> // end::propertyset[] }
public void propertyBox2() { // tag::propertybox2[] final PathProperty<Long> ID = PathProperty.create("id", Long.class).withValidator(Validator.notNull()); // <1> final StringProperty NAME = StringProperty.create("name").withValidator(Validator.notBlank()); // <2> final PropertySet<?> PROPERTIES = PropertySet.of(ID, NAME); PropertyBox propertyBox = PropertyBox.create(PROPERTIES); propertyBox.setValue(ID, null); // <3> propertyBox = PropertyBox.builder(PROPERTIES).invalidAllowed(true).build(); // <4> propertyBox.validate(); // <5> // end::propertybox2[] }