I've partially fixed this.
1) NamedObj._exportMoMLContents() now exports the value of _displayName
if it is non-null. Formerly, NamedObj.exportMoML() was doing the export
of _displayName, but this was causing problems when Parameter.exportMoML()
was called because NamedObj.exportMoML() was not being called,
NamedObj.exportMoMLContents() was instead being called.
NamedObj now looks like:
protected void _exportMoMLContents(Writer output, int depth)
throws IOException {
// If the display name has been set, then include a display element.
// Note that copying parameters that have _displayName set need
// to export _displayName.
// See: http://bugzilla.ecoinformatics.org/show_bug.cgi?id=3361
if (_displayName != null) {
output.write("<display name=\"");
output.write(StringUtilities.escapeForXML(_displayName));
output.write("\"/>");
}
// Callers of this method should hold read access
// so as to avoid ConcurrentModificationException.
if (_attributes != null) {
Iterator attributes = _attributes.elementList().iterator();
while (attributes.hasNext()) {
Attribute attribute = (Attribute) attributes.next();
attribute.exportMoML(output, depth);
}
}
}
2) I changed actor.gui.RenameConfigurer so that we now say "Name"
instead of "New Name". This fits better with the other dialogs.
For example, Edit Parameters does not say "New foo", it says "foo".
3) I'm not so sure if the copy of a Parameter should update the Display Name
or not. The reason is that if we start messing with the internals of
a Parameter, we are sort of violating some sort of existing contract.
This could be done, perhaps by having MoMLParser.attribute() properly
handle the _displayName, but this seems hacky. Further discussion
is warranted.
I'm moving this to an enhancement request.