Something like this? class MyLabel extends Label { private String text; public MyLabel(String id, String text, final FormComponent fc) { super(id, new AbstractReadOnlyModel() { Object getObject(Component component) { return text + (fc.isRequired() ? " *" : ""); } this.text = text; } }
Have fun, Erik. Jonathan Sharp schreef: > I have a custom label component that extends label. In the constructor > it takes a form component that I want it to check if isRequired() at > render time and append "*" to the text of the label. What would be the > easiest way to do this? The data for the label could be passed in > through various models, etc. > > Cheers, > -js > -- Erik van Oosten http://day-to-day-stuff.blogspot.com/ ------------------------------------------------------------------------- Using Tomcat but need to do more? Need to support web services, security? Get stuff done quickly with pre-integrated technology to make your job easier Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642 _______________________________________________ Wicket-user mailing list Wicket-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/wicket-user