Hi apptaro,
> I'm new to Pivot and trying to create a prototype application. I was
> looking for Flex-like framework in Java, was disappointed by JavaFX,
> and I finally found Pivot and got so excited!
I am very happy to hear that. :-)
> In my prototype, I created a OrderHeader data transfer object as POJO:
>
> public class OrderHeader {
> private Long orderId;
> private Date orderDate;
> private String orderChannel;
> private Customer customer;
> ....
> // constructor, getters, setters
> ....
> }
>
> Then I created a form using WTKX and a application logic which does
> Form.load(orderHeader).
>
> One problem is that I cannot format orderDate which I display using
> Label. It seems there is no way to format out of a box. Should I
> extend a Label class and override load() and store()?
If you are using Pivot 1.5, you can do this using a Label.TextBindMapping. Pass
an implementation of this interface to Label#setTextBindMapping(). You may also
want to set the bind type (see Label#setTextBindType()).
> Another problem is that ListButton does not seem to support value and
> label separation as html <option> tag does. My orderChannel has
> internal values such as "INTERNET", but I want to display as
> "Internet" in the ListButton. How should I work around this? Should I
> extend a ListViewItemRenderer class overriding render() and set it to
> the ListButton?
That is one option. You could also extend org.apache.pivot.wtk.content.ListItem
and add a "value" property.
> JSF provides very flexible formatting feature, and I wonder Pivot
> does/will provide similar feature. (I also need to format numbers and
> boolean values in Label, TextInput and TableView.)
This sounds interesting. In Pivot 1.5, most components that support data
binding now provide a mapping interface like Label.TextBindMapping. This may be
sufficient for your needs, but I would still like to understand more about how
the JSF formatting feature works. Maybe it is something that could be added in
a later release.
Greg