this question good wicket design. have several ways how implement it, want ideas how design better. want build simple timerpanel, label , timer (some kind of stopwatch).
how should design model. sure need imodel<localdatetime> timeruntil
. how can define text of label in timerpanel?
the timerpanel used in parentpanel. parentpanel has model this:
public class parentdto { private localdatetime timeravaliduntil; private localdatetime timerbvaliduntil; }
since parentdto not have information label of timerpanel, following
new propertymodel(getdefaultmodel(), "timeravaliduntil")
is not enough.
here the question: should define fixed wicketid, lets timerlabel
label in timerpanel
, , parent panel has define in panel.properties.xml
?. (option a)
timerpanela:timerlabel
or ist better create new modelobject, (option b)
public class timerdto() { string timerlabel; imodel<localdatetime> timervaliduntil; }
we try connect our models, if change modelobject in 1 panel changed in dependant panels. please share knowledge... thx.
the usage of resource keys in parentpanel (option a) fine, allows i18n labels.
if timer entity not have label (e.g. edited user), don't see gain in adding one.
wicket can work objects inside models, there's no need build intermediate layer of dtos. developing faster binding components directly actual entities.
i'd might mistaken *dto suffix example gives me impression, you're going opposite direction.
Comments
Post a Comment