Titles in Tables
Object titles can often be quite long if the intention is to uniquely identify the object. While this is appropriate for the object view, it can be cumbersome within tables.
If an object’s title is specified with from @Title annotation then the Wicket viewer will (for parented collections) automatically "contextualize" a title by excluding the part of the title corresponding to a reference to the owning (parent) object.
For example, suppose we have:
so that Customer has a collection of Orders:
public class Customer {
public Set<Order> getOrders() { /* ... */ }
...
}
and Product also has a collection of Orders:
public class Product {
public Set<Order> getOrders() { /* ... */ }
...
}
and where the Order class references both Customer and Product.
The Order's might involve each of these:
public class Order {
@Title(sequence="1")
public Customer getCustomer() { /* ... */ }
@Title(sequence="2")
public Product getProduct() { /* ... */ }
@Title(sequence="3")
public String getOtherInfo() { /* ... */ }
...
}
In this case, if we view a Customer with its collection of Orders, then in that parented collection’s table the customer’s property will be automatically excluded from the title of the Order (but it would show the product).
Conversely, if a Product is viewed then its collection of Orders would suppress product (but would show the customer).
|
This feature is a close cousin of the
|
The above annotations mean that titles usually "just work", altering according to the context in which they are viewed.
|
It is also possible to configure the Wicket viewer to abbreviate titles or suppress them completely. |