'Widget builder
@param f: the calling function'

def __call__(self, f):

    def widget(r, **attr):
        components = f(r, **attr)
        components = [c for c in components if (c is not None)]
        title = self.title
        if title:
            label = self.label
            value = self.value
            T = current.T
            if (label and value):
                title_ = DIV(SPAN(('%s    ' % T(title)), _class='cap-value    upper'), SPAN(('%s    ::    ' % T(label)), _class='cap-label    upper'), SPAN(value, _class='cap-strong'))
            else:
                title_ = DIV(SPAN(T(title), _class='cap-value    upper'))
            header = TAG[''](title_, DIV(_class='underline'))
            output = DIV(header, *components)
        else:
            output = DIV(components)
        return output
    return widget
