Project

General

Profile

Actions

Bug #4915

closed

PortParameters instantiated from Outline tab cannot be deleted

Added by Derik Barseghian almost 14 years ago. Updated almost 14 years ago.

Status:
Resolved
Priority:
Normal
Category:
general
Target version:
Start date:
03/30/2010
Due date:
% Done:

0%

Estimated time:
Bugzilla-Id:
4915

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

PortParameterBothHighlighed.tiff (80.5 KB) PortParameterBothHighlighed.tiff Christopher Brooks, 05/12/2010 04:02 PM
PortParameterArrowHighlighted.tiff (80.5 KB) PortParameterArrowHighlighted.tiff Christopher Brooks, 05/12/2010 04:06 PM
PortParameterDotHighlighted.tiff (80.5 KB) PortParameterDotHighlighted.tiff Christopher Brooks, 05/12/2010 04:15 PM
without_nondraggable.png (28 KB) without_nondraggable.png Derik Barseghian, 05/12/2010 04:24 PM
build.txt (10.6 KB) build.txt Christopher Brooks, 05/12/2010 04:41 PM
Actions #1

Updated by Aaron Aaron almost 14 years ago

Please let me know if revision 23524 (in trunk)
and revision 23523 (in 2.0 branch) fix this problem.

Actions #2

Updated by Derik Barseghian almost 14 years ago

No, same problem in both trunk and 2.0.

Actions #3

Updated by Aaron Aaron almost 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...

Actions #4

Updated by Aaron Aaron almost 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.

Actions #5

Updated by Aaron Aaron almost 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.

Actions #6

Updated by Christopher Brooks almost 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

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?

Actions #7

Updated by Derik Barseghian almost 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.

Actions #8

Updated by Derik Barseghian almost 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...?

Actions #9

Updated by Christopher Brooks almost 14 years ago

Both Arrow and Dot are highlighted and both are removed.

Actions #10

Updated by Christopher Brooks almost 14 years ago

The arrow is highlighted. It is not removed both with and without the changes to
ParameterPort

Actions #11

Updated by Christopher Brooks almost 14 years ago

If the Dot is highlighted, I can delete the entire Port Parameter.

Actions #12

Updated by Christopher Brooks almost 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.

Actions #13

Updated by Derik Barseghian almost 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.

Actions #14

Updated by Derik Barseghian almost 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.

Actions #15

Updated by Derik Barseghian almost 14 years ago

I should say that that's what the bug was. It currently doesn't happen since aaron added the nonDraggable parameter.

Actions #16

Updated by Christopher Brooks almost 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.

Actions #17

Updated by Christopher Brooks almost 14 years ago

Aha!
I can replicate the bug.
Yay!
And the change to ParameterPort is required.
I'll close this now.

Actions #18

Updated by Redmine Admin almost 11 years ago

Original Bugzilla ID was 4915

Actions

Also available in: Atom PDF