Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » GEF » Drawing terminals in a figure like the logic example
Drawing terminals in a figure like the logic example [message #175403] Mon, 04 April 2005 17:55 Go to next message
Eclipse UserFriend
Originally posted by: jdelgad.correo.ugr.es

Hi all,

I have created a figure with 2 output terminals (like the andGate in
the logic example, although in this case are input terminals). Now I would
like to know how to allow the user to set a connection to the terminal he
prefers, i.e. how to make that an output connection could be set in two
different points into the same figure.

Thank you very much.
Re: Drawing terminals in a figure like the logic example [message #175418 is a reply to message #175403] Mon, 04 April 2005 18:37 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: jgreen.upb.de

Hello Jose Antonio,
did you specify anchors for each single "terminal" of you EditPart
(->NodeEditPart)? There you could return a specific Anchor e.g. for a
position passed by a request. I think.
Or you make child-EditParts for your "terminals" that always return
"their" anchor.

Hope that helps.

Joel


Jose Antonio wrote:
> Hi all,
>
> I have created a figure with 2 output terminals (like the andGate in
> the logic example, although in this case are input terminals). Now I
> would like to know how to allow the user to set a connection to the
> terminal he prefers, i.e. how to make that an output connection could be
> set in two different points into the same figure.
>
> Thank you very much.
>
Re: Drawing terminals in a figure like the logic example (another problem) [message #175437 is a reply to message #175418] Mon, 04 April 2005 20:16 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: jdelgad.correo.ugr.es

Hi,

I have already solved this problem with this code, but I have another
problem:


public OutputFigure() {

FixedConnectionAnchor outputConnectionAnchorA, outputConnectionAnchorB;
outputConnectionAnchorA = new FixedConnectionAnchor(this);
outputConnectionAnchorA.offsetV = 4;
outputConnectionAnchorB = new FixedConnectionAnchor(this);
outputConnectionAnchorB.offsetV =10;
outputConnectionAnchors.addElement(outputConnectionAnchorA);
outputConnectionAnchors.addElement(outputConnectionAnchorB);
connectionAnchors.put(Box.TERMINAL_A, outputConnectionAnchorA);
connectionAnchors.put(Box.TERMINAL_B, outputConnectionAnchorB);
setLayoutManager(new StackLayout());
}

Now, when I draw a connection between two nodes, the connection
disappear and I get the following exception:

Unhandled event loop exception
Reason:
java.lang.NullPointerException

When the nodes only had one output terminal this exception didn't occur.
The code I had then was the following:

public OutputFigure() {
outputConnectionAnchor = new FixedConnectionAnchor(this);
outputConnectionAnchor.topDown = true;
outputConnectionAnchor.offsetH = -1;
outputConnectionAnchors.addElement(outputConnectionAnchor);
connectionAnchors.put(SimpleOutput.TERMINAL_OUT,
outputConnectionAnchor);
setLayoutManager(new StackLayout());
}

Where is the problem? Please help!!

--Jose Antonio.
Re: Drawing terminals in a figure like the logic example (another problem) [message #175585 is a reply to message #175437] Tue, 05 April 2005 09:57 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: jgreenyer.s-und-n.de

Hi Jose Antonio,
I suppose you're copying the implementation of the OutputFigure in the
Logic example (I didn't get that clearly from the previous mail).

You should find out where you have the NullPointerException. I guess
maybe somewhere in your "NodeFigure" (if you inherit from this like in
the Logic example). Have a closer look on your error log and start
tracking your problem from there.
Maybe, it is because you put your Anchors in the connectionAnchors
Hashtable with other key strings and cannot be esolved correctly.

Joel


Jose wrote:
> Hi,
>
> I have already solved this problem with this code, but I have another
> problem:
>
>
> public OutputFigure() {
>
> FixedConnectionAnchor outputConnectionAnchorA, outputConnectionAnchorB;
> outputConnectionAnchorA = new FixedConnectionAnchor(this);
> outputConnectionAnchorA.offsetV = 4;
> outputConnectionAnchorB = new FixedConnectionAnchor(this);
> outputConnectionAnchorB.offsetV =10;
> outputConnectionAnchors.addElement(outputConnectionAnchorA);
> outputConnectionAnchors.addElement(outputConnectionAnchorB);
> connectionAnchors.put(Box.TERMINAL_A, outputConnectionAnchorA);
> connectionAnchors.put(Box.TERMINAL_B, outputConnectionAnchorB);
> setLayoutManager(new StackLayout());
> }
>
> Now, when I draw a connection between two nodes, the connection
> disappear and I get the following exception:
>
> Unhandled event loop exception
> Reason:
> java.lang.NullPointerException
>
> When the nodes only had one output terminal this exception didn't
> occur. The code I had then was the following:
>
> public OutputFigure() {
> outputConnectionAnchor = new FixedConnectionAnchor(this);
> outputConnectionAnchor.topDown = true;
> outputConnectionAnchor.offsetH = -1;
> outputConnectionAnchors.addElement(outputConnectionAnchor);
> connectionAnchors.put(SimpleOutput.TERMINAL_OUT, outputConnectionAnchor);
> setLayoutManager(new StackLayout());
> }
>
> Where is the problem? Please help!!
>
> --Jose Antonio.
>
>
>
>
>
>
Re: Drawing terminals ... PROBLEM SOLVED [message #175677 is a reply to message #175585] Tue, 05 April 2005 18:16 Go to previous message
Eclipse UserFriend
Originally posted by: jdelgad.correo.ugr.es

Hi Joel,

the problem was what you say in your previous mail. I was putting the
two anchors in the hashTable with the same key string, and they weren't
able to be resolved.

Thank you for your help


--Jose.
Previous Topic:How to refresh a View
Next Topic:Translating from request.getLocation() to container coordinates
Goto Forum:
  


Current Time: Wed Feb 08 06:43:46 GMT 2023

Powered by FUDForum. Page generated in 0.02398 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top