wicket-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Hendy Irawan <he...@soluvas.com>
Subject Re: Wicket and microdata
Date Thu, 20 Nov 2014 07:30:32 GMT
Here's what I came up with :
https://github.com/soluvas/soluvas-web/commit/8cfbe121bc8589502154bf72fff9bd94762dd7cb

While my usage is for e-commerce websites, with sufficient definitions it's
usable for any kind of site, primarily using schema.org vocabulary. IMHO
it's quite convenient (thanks to Wicket's Behavior programming model, yay!)
and also type-safe (no Strings, ma!).

Usage examples:

final WebMarkupContainer productDiv = new WebMarkupContainer("productDiv");
productDiv.add(new ItemScopeBehavior(SchemaOrgClass.PRODUCT));

...

protected void populateItem(final ListItem<ProductImage> imageItem) {
	imageItem.add(new ImageMicrodataBehavior());

...

final Label descLabel = new Label("descriptionHtml", new
PropertyModel<String>(model, "descriptionHtml"));
descLabel.add(new ItemPropBehavior(SchemaOrgProperty.DESCRIPTION));

...

inStockLabel = new Label("inStockStatus", "In Stock");
inStockLabel.add(new ItemPropEnumBehavior(SchemaOrgProperty.AVAILABILITY,
ItemAvailability.IN_STOCK));
add(inStockLabel);
outOfStockLabel = new Label("outOfStockStatus", "Out of Stock");
outOfStockLabel.add(new ItemPropEnumBehavior(SchemaOrgProperty.AVAILABILITY,
ItemAvailability.OUT_OF_STOCK));
add(outOfStockLabel);

...

currencyPriceAfterDiscountLbl.add(new
ItemPropContentBehavior(SchemaOrgProperty.PRICE_CURRENCY, 
		new PropertyModel<CurrencyUnit>(selectedProductModel, "currency")));
add(currencyPriceAfterDiscountLbl);
final Label priceAfterDiscountsLabel = new MoneyLabel("price",
priceAfterDiscountsModel);
priceAfterDiscountsLabel.add(new
ItemPropContentBehavior(SchemaOrgProperty.PRICE, 
		priceAfterDiscountsModel));

...

localSkuCtr.add(new Label("localSkuValue", new PropertyModel<>(productModel,
"localSku"))
	.add(new ItemPropBehavior(SchemaOrgProperty.SKU)) );

Hendy


--
View this message in context: http://apache-wicket.1842946.n4.nabble.com/Wicket-and-microdata-tp4661135p4668470.html
Sent from the Users forum mailing list archive at Nabble.com.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Mime
View raw message