programmatically removing connected shapes

classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

programmatically removing connected shapes

Антон Борисов
I have 3 shapes connected: 2 connector shapes, 1 text shape, they are
connected next way:   " ----> text ----> "

I trying to do next: removing one of this shapes (i.e by key delete) will
causes deleting two another.

I handle XEventListener "ShapeRemoved", and deleting another by
XDrawPage.remove, but sdraw fails in some case, exactly when firstly i
remove text shape ( by key ).

I suppose that its happening because of ShapeModified event of already
removed shape.

Which workaround can fit my needs ?

--
Борисов Антон
Reply | Threaded
Open this post in threaded view
|

programmatically removing connected shapes

Антон Борисов
Hello, need some help with draw extension

I have 3 shapes connected: 2 connector shapes, 1 text shape, they are
connected next way:   " ----> text ----> "

I trying to do next: removing one of this shapes (i.e by key delete)
will causes deleting two another.

I handle XEventListener "ShapeRemoved", and deleting another by
XDrawPage.remove, but sdraw fails in some case, exactly when firstly i
remove text shape ( by key ).

I suppose that its happening because of ShapeModified event of already
removed shape.

Which workaround can fit my needs ?
Any help would be appreciated

Thanks,
--
Borisov Anton

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

Re: programmatically removing connected shapes

Ariel Constenla-Haile-2
Hi Антон,

On Mon, May 20, 2013 at 08:56:05PM +0400, Антон Борисов wrote:

> Hello, need some help with draw extension
>
> I have 3 shapes connected: 2 connector shapes, 1 text shape, they are
> connected next way:   " ----> text ----> "
>
> I trying to do next: removing one of this shapes (i.e by key delete)
> will causes deleting two another.
>
> I handle XEventListener "ShapeRemoved", and deleting another by
> XDrawPage.remove, but sdraw fails in some case, exactly when firstly i
> remove text shape ( by key ).
In which way is it failing?

AFAIK, there is no way to know, from the text shape, if it connected to
connectors. For a connector, you have StartShape and EndShape; but for
the text shape you have no way to know which connectors are connecting
it.

One way is to track this information in a collection of connected shapes
and for each connected shape store the information about its connectors.
Then, when you get notified that a shape is being removed, search the
shape in the collection and remove its connector.


Regards
--
Ariel Constenla-Haile
La Plata, Argentina

attachment0 (853 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: programmatically removing connected shapes

Антон Борисов
Suddenly closing,
if run from console:

## A fatal error has been detected by the Java Runtime Environment:##
SIGSEGV (0xb) at pc=0x00007f0b3c22fbe8, pid=5345,
tid=139686241486656## JRE version: 7.0_03-b147# Java VM: OpenJDK
64-Bit Server VM (22.0-b10 mixed mode linux-amd64 compressed oops)#
Derivative: IcedTea7 2.1.1pre# Distribution: Ubuntu 12.04 LTS, package
7~u3-2.1.1~pre1-1ubuntu3# Problematic frame:# C  [libc.so.6+0x3b6be8]
__libc_thread_freeres+0x2539b8## Failed to write core dump. Core dumps
have been disabled. To enable core dumping, try "ulimit -c unlimited"
before starting Java again## An error report file with more
information is saved as:# /tmp/hs_err_pid5345.log## If you would like
to submit a bug report, please include# instructions on how to
reproduce the bug and visit:#
https://bugs.launchpad.net/ubuntu/+source/openjdk-7/#[error occurred
during error reporting , id 0xb]

storing connected shapes isn't a problem, problem is that it's crashes
when deleting.

if i manually ( by delete key) remove connector shape it's ok, i
handle OnShapeRemove event and remove other.
In case of manually removing text shape, o handle OnShapeRemove event,
delete connected ConnectorShape but program crashes.


2013/5/20 Ariel Constenla-Haile <[hidden email]>:

> Hi Антон,
>
> On Mon, May 20, 2013 at 08:56:05PM +0400, Антон Борисов wrote:
>> Hello, need some help with draw extension
>>
>> I have 3 shapes connected: 2 connector shapes, 1 text shape, they are
>> connected next way:   " ----> text ----> "
>>
>> I trying to do next: removing one of this shapes (i.e by key delete)
>> will causes deleting two another.
>>
>> I handle XEventListener "ShapeRemoved", and deleting another by
>> XDrawPage.remove, but sdraw fails in some case, exactly when firstly i
>> remove text shape ( by key ).
>
> In which way is it failing?
>
> AFAIK, there is no way to know, from the text shape, if it connected to
> connectors. For a connector, you have StartShape and EndShape; but for
> the text shape you have no way to know which connectors are connecting
> it.
>
> One way is to track this information in a collection of connected shapes
> and for each connected shape store the information about its connectors.
> Then, when you get notified that a shape is being removed, search the
> shape in the collection and remove its connector.
>
>
> Regards
> --
> Ariel Constenla-Haile
> La Plata, Argentina



--
Борисов Антон

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

Re: programmatically removing connected shapes

Ariel Constenla-Haile-2
Hi Anton,

On Wed, May 22, 2013 at 09:07:59PM +0400, Антон Борисов wrote:

> Suddenly closing,
> if run from console:
>
> ## A fatal error has been detected by the Java Runtime Environment:##
> SIGSEGV (0xb) at pc=0x00007f0b3c22fbe8, pid=5345,
> tid=139686241486656## JRE version: 7.0_03-b147# Java VM: OpenJDK
> 64-Bit Server VM (22.0-b10 mixed mode linux-amd64 compressed oops)#
> Derivative: IcedTea7 2.1.1pre# Distribution: Ubuntu 12.04 LTS, package
> 7~u3-2.1.1~pre1-1ubuntu3# Problematic frame:# C  [libc.so.6+0x3b6be8]
> __libc_thread_freeres+0x2539b8## Failed to write core dump. Core dumps
> have been disabled. To enable core dumping, try "ulimit -c unlimited"
> before starting Java again## An error report file with more
> information is saved as:# /tmp/hs_err_pid5345.log## If you would like
> to submit a bug report, please include# instructions on how to
> reproduce the bug and visit:#
> https://bugs.launchpad.net/ubuntu/+source/openjdk-7/#[error occurred
> during error reporting , id 0xb]
>
> storing connected shapes isn't a problem, problem is that it's crashes
> when deleting.
>
> if i manually ( by delete key) remove connector shape it's ok, i
> handle OnShapeRemove event and remove other.
> In case of manually removing text shape, o handle OnShapeRemove event,
> delete connected ConnectorShape but program crashes.
This might be a bug in the application core code. If you can share your
extension code, or create a client application with the minimal code and
steps to reproduce it, please submit a bug report at
https://issues.apache.org/ooo/


Regards
--
Ariel Constenla-Haile
La Plata, Argentina

attachment0 (853 bytes) Download Attachment