I've been thinking about a potential syntax for the population of
lists, menus and comboboxes and trees, as well as adding in the extra
listeners.
As far as listeners go i think that there should be an attribute to add
each type of listener an object supports.. ie if it supports a
ChangeListener the xml should support a changeListener attribute.
lists, we really need item listeners because, according to the docs at
least, actionListeners are only fired on double clicks, but users
generally single click on list items.
<list action="whatever" itemListener="anItemListener">
<listItem>item 1</listItem>
<listItem>item 2</listItem>
</list>
Menu's are going to be complex, there are so many things that can be
added to one.
menus need menuListeners, changeListeners, and itemListeners, delays,
seperators, and tearOff indicators.
menuitems need itemListeners and changeListeners and accellerators
I'm not sure about actions in the context of JMenu.add(Action) ... the
syntax would be confusing if the standard action wasn't changed to
actionListener.
I've included a potential solution but I'm not thrilled with it.
theActionObjectsName would be the same thing you currently set as the
value to a normal action attribute.
menuItem calls JMenu.add(JMenuItem)
action calls JMenu.add(Action)
string calls JMenu.add(String)
component calls JMenu.add(Component)
i'm thinking menuSeparator for a tag name instead of separator to
distinguish it from JSeperator
<menu menuListener="xxx" changeListener="xxx" delay="int"
tearOff="true">
<menuItem itemListener="xxx" changeListener="xxx"
accellerator="xxx">the menu item </menuItem>
<menuSeparator />
<action>theActionObjectsName</action>
<string>the string to add</string>
<component>theNameOfTheComponentObject</component>
</menu>
comboboxes are nearly as bad, an important bit would be the ability to
add objects not just strings. Obviously the objects ahve to have
toString() defined or things won't work.
stringItem and objectItem both call JComboBox.addItem(Object) except in
the case of objectItem it would be an object gathered from the creating
class.
<combobox itemListener="xxx" action="xxx" popupMenuListener="xxx">
<stringItem>this is item 1</stringItem>
<objectItem>theNameOfTheObject</objectItem>
</combobox>
<tree treeExpansionListener="xxx" treeSelectionListener="xxx"
treeWillExpandListener="xxx">
<!-- not sure what to do here about populating them at the moment but i
wanted to note the listeners above -->
</tree>
if all these listeners are to be implemented with this syntax i think
actionListener="xxx" should be an alternate syntax for action="xxx" or
maybe a replacement.
That's all for the moment.
-kate