Page Index Toggle Pages: 1 Send TopicPrint
Normal Topic getting error message - AnchorPattern string identifier must be unique (Read 5013 times)
alukes
Junior Member
**
Offline


I love YaBB 1G - SP1!

Posts: 61
Joined: Jul 1st, 2011
getting error message - AnchorPattern string identifier must be unique
Oct 11th, 2012 at 12:03am
Print Post  
I create a frame, and then create a diagram on a panel, do work, then close the panel and set the panel to null.

I open a new panel from the same frame and get the anchor pattern string identifier must be unique error message.

I tried setting the anchor pattern to null as well.

What am I missing?


Thanks
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: getting error message - AnchorPattern string identifier must be unique
Reply #1 - Oct 11th, 2012 at 6:41am
Print Post  
AnchorPattern (and Shape) definitions are stored in a static list in order to share them between Diagram instances. Try reusing already defined AnchorPattern objects instead of creating them again when opening a new panel:

Code
Select All
AnchorPattern myPattern = AnchorPattern.fromId("myPattern");
if (myPattern == null)
	myPattern = new AnchorPattern(..., "myPattern"); 



I hope that helps,
Stoyan
  
Back to top
 
IP Logged
 
alukes
Junior Member
**
Offline


I love YaBB 1G - SP1!

Posts: 61
Joined: Jul 1st, 2011
Re: getting error message - AnchorPattern string identifier must be unique
Reply #2 - Oct 12th, 2012 at 12:19am
Print Post  
I close the panel, reopen it and test anchor is null, so it recreates the anchor


private AnchorPattern testAnchor
if (testanchor == null) {
testanchor = new AnchorPattern(new AnchorPoint[]{
new AnchorPoint(50, 0, true, false, MarkStyle.Circle, Color.red),
new AnchorPoint(50, 100, true, false, MarkStyle.Circle, Color.red),
new AnchorPoint(0, 50, true, false, MarkStyle.Circle, Color.red),
new AnchorPoint(100, 10, false, true, MarkStyle.Circle, Color.red),
new AnchorPoint(100, 20, false, true, MarkStyle.Circle, Color.red),
new AnchorPoint(100, 30, false, true, MarkStyle.Circle, Color.red),
new AnchorPoint(100, 40, false, true, MarkStyle.Circle, Color.red),
new AnchorPoint(100, 50, false, true, MarkStyle.Circle, Color.red),
new AnchorPoint(100, 60, false, true, MarkStyle.Circle, Color.red)}, "test name");
}

Do I have to use the exact method you wrote about or should this work?

Thanks
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: getting error message - AnchorPattern string identifier must be unique
Reply #3 - Oct 12th, 2012 at 6:22am
Print Post  
Yes, you must call fromId to check if it isn't already stored in the diagram's static list of AnchorPatterns. Alternatively, just make your testAnchor object static too and initialize it only once for the application.
  
Back to top
 
IP Logged
 
alukes
Junior Member
**
Offline


I love YaBB 1G - SP1!

Posts: 61
Joined: Jul 1st, 2011
Re: getting error message - AnchorPattern string identifier must be unique
Reply #4 - Oct 12th, 2012 at 10:21pm
Print Post  
That worked. Thanks for your patience. My second task is programming so I am not totally up to speed on it.
  
Back to top
 
IP Logged
 
Page Index Toggle Pages: 1
Send TopicPrint