001    package net.databinder.components;
002    
003    import org.apache.wicket.markup.html.basic.Label;
004    import org.apache.wicket.model.IModel;
005    import org.apache.wicket.util.convert.IConverter;
006    
007    /**
008     * Label that alters its contents with a specific converter before display. 
009     * @author Nathan Hamblen
010     * @deprecated this class isn't really necessary; just override getConverter
011     */
012    public abstract class CustomLabel extends Label {
013            private IConverter converter;
014            
015            /**
016             * @param id Wicket id of component
017             * @param converter specific converter to use before display
018             */
019            protected CustomLabel(String id, IConverter converter) {
020                    super(id);
021                    this.converter = converter;
022            }
023            
024            /**
025             * @param id Wicket id of component
026             * @param model model to be passed through converter
027             * @param converter specific converter to use before display
028             */
029            protected CustomLabel(String id, IModel model, IConverter converter) {
030                    super(id, model);
031                    this.converter = converter;
032            }
033            
034            /**
035             * Always returns the chosen converter.
036             */
037            @Override
038            public IConverter getConverter(Class type) {
039                    return converter;
040            }
041    }