Overriding class tags |
From JAXXWiki
Class tags can be overridden just like methods can in ordinary Java. Suppose you have a JAXX class which descends from another JAXX class:
Super.jaxx:
<JFrame title='Super'>
<VBox>
<JLabel text='Label 1' id='label1'/>
<JLabel text='Label 2' id='label2'/>
</VBox>
</JFrame>
Sub.jaxx:
<Super title='Sub'> <JLabel text='Modified label 2' id='label2'/> </Super>
If both classes define a class tag with the same ID as shown in this example, the subclass' class tag will override the superclass' class tag. Sub appears as follows:
Benefits
Why would you want to do this? Being able to override components is a very powerful mechanism for customizing subclasses. In ordinary Java code, it is common to write methods named create<ComponentName>() which produce Components, specifically so that subclasses can override these methods and alter the components that are produced.
Overriding is the same basic technique (and in fact is implemented exactly that way). It can be particularly useful when applied to a "placeholder" component -- a dummy component in the superclass which can be replaced with the "real" implementation in any number of subclasses.


