In my GWT project, I have a widget "composition(? not 100% sure about the term)", called MenuItem. This has the following structure:
<div class="some invariable class">
<div class="first-child"><!-- something --></div>
<div class="middle-element"><label /></div>
</div>
I want to create widgets, which all have this structure, but in place of <!-- something -->, for instance an IconMenuItem would put a FontAwesome icon, or ImageMenuItem would put a small thumbnail there.
I'm kind of new to GWT and reading the documentation and some topics here at SO, I suspect that MenuItem should extend Composite and *MenuItem should extend this MenuItem.
However, I'm not sure how I would enforce the HTML structure above without duplicating it. I'm also unsure about what the best practice would be to allow different types of elements, like I said about the image and icon example.
What would be the good class structure, which class should inherit/compose which class?