I have searched but I dont find a clear way of getting the model when one
is creating a custom component:


public MoneyLabel(String id) {
    super(id);
    add(new AttributeAppender("class", " number"));
}

public MoneyLabel(String id, Model<? extends BigDecimal> bigDecimalModel) {
    super(id, bigDecimalModel);
    add(new AttributeAppender("class", " number"));
    if (bigDecimalModel.getObject().doubleValue() < 0.0) {
        add(new AttributeAppender("class", " negative"));
    }
}

In the second constructor I can use the supplied model to determine to add
the negative class. However in the first constructor I cannot find a way to
access the model.

What am I missing?

Ron
‚Äč

Reply via email to