I use xml for persisting data about UI elements. For example, I have a tag that stands for JButton, - for JMenuItem and I handle them with the help of Java SAX classes. But I want to build my UI element using Action like this:
Then I'll handle such tag and build what I want. But I have a problem with passing different amount of options to this Action object. In one case I want to pass name like:
putValue(NAME, "Element name");
In another case it will be:
putValue(NAME, "Some name");
putValue(SHORT_DESCRIPTION, "Tooltip");
putValue(MNEMONIC_KEY, new Integer('A'));
In a code it will look like:
class NewAction extends AbstractAtion {
public NewAction() {
putValue(NAME, "Some name");
putValue(SHORT_DESCRIPTION, "Tooltip");
putValue(MNEMONIC_KEY, new Integer('A'));
}
}
But how to do it with xml? Are there any ideas on how to store and handle different amount of Action key:value args. in xml?