Bug #3361
openparameters lose their Display Name when copy and pasted
0%
Description
It may be this is the 'proper' behavior, but it doesn't seem so to me (cxh?).
steps to reproduce:
- Drag Parameter to canvas
- Right click, Customize Name
- type in a New Name: new_name, and a Display Name: display_name
- Commit
- copy and paste the Parameter
The second Parameter has New name: new_name2, and Display name: new_name2, but I think Display name should be: display_name2.
This affects:
GriddlesParameter
ColorParameter
FileParameter
Parameter
PortParameter
RequireVersion
SemanticTypeParameter
StringParameter
Updated by Derik Barseghian over 16 years ago
Also, why "New name" ? It seems like it should just be Name and Display Name.
Updated by Christopher Brooks over 16 years ago
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.