Bug #4915
closedPortParameters instantiated from Outline tab cannot be deleted
0%
Description
If you drag a PortParameter to canvas from the Outline tab, it can't then be deleted from canvas. Also, it doesn't seem to instantiate properly, just the port (arrow) shows up, not the parameter (dot).
Files
Updated by Aaron Aaron over 14 years ago
Please let me know if revision 23524 (in trunk)
and revision 23523 (in 2.0 branch) fix this problem.
Updated by Derik Barseghian over 14 years ago
No, same problem in both trunk and 2.0.
Updated by Aaron Aaron over 14 years ago
OK, narrowed it down a bit. The EditorDropTarget class is not recognizing an "_alternateGetMomlAction" in certain cases for the PortParameter when it is dragged from the Outline tab. No idea why yet but the solution involves making sure the alternative GetMomlFromLSID action is used when dropping to the canvas...
Updated by Aaron Aaron over 14 years ago
Well, having trouble figuring this one out. I went through and tested all the other parameters included in the CoreActors KAR and found that SemanticTypeParameter also has this problem.
Updated by Aaron Aaron over 14 years ago
Added the "_notDraggable" parameter to the ParameterPort class constructor so PTree will not allow you to drag it to the canvas. This fixes the problem.
Updated by Christopher Brooks over 14 years ago
The executive summary is that I can't reproduce this bug before the change to ParameterPort. Is the change to ParameterPort necessary?
Details:
In Kepler-2.0 release candidate 1 (installed on April 21), I can't get a PortParameter:
1. Start Kepler-2.0 release candidate 1
2. In "Search Components", enter "PortParameter" and hit Search
3. Try to drag the PortParameter into the canvas. I get:
com.microstar.xml.XmlException: Cannot create entity without a class name. in [external stream] at line 2 and column 23
at ptolemy.moml.MoMLParser._checkForNull(MoMLParser.java:3792)
at ptolemy.moml.MoMLParser._createEntity(MoMLParser.java:3973)
at ptolemy.moml.MoMLParser.startElement(MoMLParser.java:2493)
at com.microstar.xml.XmlParser.parseElement(XmlParser.java:921)
at com.microstar.xml.XmlParser.parseContent(XmlParser.java:1104)
at com.microstar.xml.XmlParser.parseElement(XmlParser.java:924)
at com.microstar.xml.XmlParser.parseContent(XmlParser.java:1104)
at com.microstar.xml.XmlParser.parseElement(XmlParser.java:924)
at com.microstar.xml.XmlParser.parseDocument(XmlParser.java:481)
at com.microstar.xml.XmlParser.doParse(XmlParser.java:159)
at com.microstar.xml.XmlParser.parse(XmlParser.java:132)
at ptolemy.moml.MoMLParser.parse(MoMLParser.java:1402)
at ptolemy.moml.MoMLParser.parse(MoMLParser.java:1374)
at ptolemy.moml.MoMLParser.parse(MoMLParser.java:1530)
at ptolemy.moml.MoMLChangeRequest._execute(MoMLChangeRequest.java:270)
at ptolemy.kernel.util.ChangeRequest.execute(ChangeRequest.java:171)
at ptolemy.kernel.util.NamedObj.executeChangeRequests(NamedObj.java:732)
at ptolemy.kernel.util.NamedObj.requestChange(NamedObj.java:1762)
at ptolemy.actor.CompositeActor.requestChange(CompositeActor.java:1533)
at ptolemy.vergil.basic.EditorDropTarget$DTListener.drop(EditorDropTarget.java:450)
at java.awt.dnd.DropTarget.drop(DropTarget.java:430)
at sun.awt.dnd.SunDropTargetContextPeer.processDropMessage(SunDropTargetContextPeer.java:500)
at sun.awt.dnd.SunDropTargetContextPeer.access$800(SunDropTargetContextPeer.java:53)
at sun.awt.dnd.SunDropTargetContextPeer$EventDispatcher.dispatchDropEvent(SunDropTargetContextPeer.java:812)
at sun.awt.dnd.SunDropTargetContextPeer$EventDispatcher.dispatchEvent(SunDropTargetContextPeer.java:736)
at sun.awt.dnd.SunDropTargetEvent.dispatch(SunDropTargetEvent.java:29)
at java.awt.Component.dispatchEventImpl(Component.java:3926)
at java.awt.Container.dispatchEventImpl(Container.java:2068)
at java.awt.Component.dispatchEvent(Component.java:3903)
at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4256)
at java.awt.LightweightDispatcher.processDropTargetEvent(Container.java:4007)
at java.awt.LightweightDispatcher.dispatchEvent(Container.java:3861)
at java.awt.Container.dispatchEventImpl(Container.java:2054)
at java.awt.Window.dispatchEventImpl(Window.java:1801)
at java.awt.Component.dispatchEvent(Component.java:3903)
at java.awt.EventQueue.dispatchEvent(EventQueue.java:463)
at java.awt.EventDispatchThread.pumpOneEventForHierarchy(EventDispatchThread.java:269)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:190)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:184)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:176)
at java.awt.EventDispatchThread.run(EventDispatchThread.java:110)
In the current Kepler trunk with the ParameterPort change, I can delete the ParameterPort.
The change is:
svn diff -r 57040 ../ptolemy/src/ptolemy/actor/parameters/ParameterPort.java
Index: ../ptolemy/src/ptolemy/actor/parameters/ParameterPort.java ===================================================================
--- ../ptolemy/src/ptolemy/actor/parameters/ParameterPort.java (revision 57040)
++ ../ptolemy/src/ptolemy/actor/parameters/ParameterPort.java (working copy)@ -80,6 +80,8
@
"tokenConsumptionRate", new IntToken(1));
tokenConsumptionRate.setVisibility(Settable.NOT_EDITABLE);
tokenConsumptionRate.setPersistent(false);
+ new Parameter(this,"_notDraggable");
}///////////////////////////////////////////////////////////////////
The log message is:
r57732 | aschultz | 2010-04-29 21:11:15 -0700 (Thu, 29 Apr 2010) | 1 line
reference Kepler bug 4915. This change prevents ParameterPorts from being dragged to the canvas
_notDraggable is used in ptolemy/vergil/tree/PTree.java:
public void dragGestureRecognized(DragGestureEvent e) {
...
if (object instanceof NamedObj
&& !_isPropertySet((NamedObj) object, "_notDraggable")) {
PtolemyTransferable transferable = new PtolemyTransferable();
transferable.addObject((NamedObj) object);
//initial cursor, transferable, dsource listener
e
.startDrag(DragSource.DefaultCopyNoDrop,
transferable, dsl);
}
...
The _notDraggable line is from:
r57545 | cxh | 2010-04-02 15:37:08 -0700 (Fri, 02 Apr 2010) | 1 line
Change from Sean Riddle: added _isPropertySet() so that things can be made non-draggable, used in ecogrid.
Anyway, with the above change to ParameterPort, I can delete the ParameterPort.
1. Start up the devel version
2. In "Search Components", enter "PortParameter" and hit Search
3. Drag the PortParameter into the canvas
4. Highlight the entire PortParameter and hit delete.
5. The PortParameter is gone.
However, there are some problems.
1. I'm concerned because adding a field increases the size of models slightly and also
changes the output of a few tests. It might be possible to avoid saving this data?
In the Kepler head, I can drag the arrow around separately from the dot. Ptolemy II had this
problem, but it was solved awhile ago:
2007-03-09 21:51 cxh
- [r45502] /trunk/ptolemy/configs/utilityPortParameter.xml,
/trunk/ptolemy/vergil/actor/ExternalIOPortController.java:
PortParameter was rendered as two pieces, which caused problems
when dragging. See
https://chess.eecs.berkeley.edu/bugzilla/show_bug.cgi?id=34
If I revert to a previous version of ParameterPort:
svn update -r 57040 ../ptolemy/src/ptolemy/actor/parameters/ParameterPort.java
Then I cannot replicate this bug?
So, I'm wondering if the change to ptII is necessary?
Updated by Derik Barseghian over 14 years ago
Hey Christopher, this bug was specific to the (new-ish) Outline tab, not the Components tab. Before it was made non-draggable, to replicate you would:
- drag a PortParameter from the Components tab to canvas
- change to the Outline tab
- try to drag the PortParameter to canvas from the Outline tab.
Updated by Derik Barseghian over 14 years ago
Hey Christopher,
I just commented out these two lines in ParameterPort's constructor (which I believe is essentially the same as reverting this file to r57040):
//Parameter notDraggable = new Parameter(this,"_notDraggable");
//notDraggable.setPersistent(false);
and I'm then able to replicate the bug again on reporting trunk and kepler trunk on Windows and reporting trunk on os X (even though I don't think platform nor reporting vs kepler makes a difference for this) by doing the following:
1) from Component Library, drag out a PortParameter
2) switch to Outline
3) drag out the PortParameter. I just get a white arrow and no dot, and I can't delete the arrow.
I see you added that second line to keep this nonDraggable Parameter from being written out:
r57762 "Mark the notDraggable parameter as non-persistent so that it does not get written out." I presume that remedies your concern about the model sizes in the comment above...?
Updated by Christopher Brooks over 14 years ago
Both Arrow and Dot are highlighted and both are removed.
Updated by Christopher Brooks over 14 years ago
The arrow is highlighted. It is not removed both with and without the changes to
ParameterPort
Updated by Christopher Brooks over 14 years ago
If the Dot is highlighted, I can delete the entire Port Parameter.
Updated by Christopher Brooks over 14 years ago
Hi Derik,
I still can't reproduce this.
Can you try it from a clean tree?
Note that "ant run" and "ant compile" do not recompile ptolemy after
editing ParameterPort. After editing ParameterPort.java,
One must use
ant force-ptolemy run
I added three attachments that have screenshots before I delete it.
Updated by Derik Barseghian over 14 years ago
With these two lines commented in ParameterPort constructor:
//Parameter notDraggable = new Parameter(this,"_notDraggable");
//notDraggable.setPersistent(false);
this picture is the result of trying to instantiate (i.e. a second) PortParameter utilizing an existing PortParameter that was instantiated from the Component Library.
Updated by Derik Barseghian over 14 years ago
Hey Christopher,
I think our wires are still crossed. The bug is that when you have a PortParameter on canvas, and you switch to the Outline view, and then try to instantiate a second PortParameter from the existing one (by dragging PortParameter out to canvas from the Outline area)-- you simply get a white arrow, and you can't delete it. The last attachment shows this state. I know I've got PortParameter recompiled to temporarily take the nonDraggable change out because I can drag it out now.
Updated by Derik Barseghian over 14 years ago
I should say that that's what the bug was. It currently doesn't happen since aaron added the nonDraggable parameter.
Updated by Christopher Brooks over 14 years ago
I'm somewhat mystified here. I tried building with a clean tree
and I still can't completely replicate this.
There is a problem where if I select just the arrow, then I can't delete
it, but this bug is present both with and without the patch to ParameterPort.java
Note that the arrow can be dragged around separately, which is a bug that
I fixed in ptII a long time ago, see the ChangeLog entry above.
Updated by Christopher Brooks over 14 years ago
Aha!
I can replicate the bug.
Yay!
And the change to ParameterPort is required.
I'll close this now.