Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » GEF » Problems with Border, setClip() and getInsets()
Problems with Border, setClip() and getInsets() [message #242872] Mon, 12 May 2008 11:44 Go to next message
chris is currently offline chrisFriend
Messages: 72
Registered: July 2009
Member
This is a multi-part message in MIME format.
--------------050503080708030903010102
Content-Type: text/plain; charset=ISO-8859-15; format=flowed
Content-Transfer-Encoding: 7bit

Hi,

I'm having trouble defining my own border. I'm trying to do something
like a UML "multi-object" (see attached pic). This works so far, but
only if I use the setClip method as shown in the attached class (I've
learned that from some example code). But this seems to be causing
trouble with repainting in some situations...

In fact, I've seen a message where somebody suggests not to use
setClip() - returning appropriate Insets shall be the solution.
Unfortunately, I can't find the message in this newsgroup any more.

So I tried to return Insets as can be seen in the code, but my border
wouldn't appear, so I switched back to the setClip() solution for now.

Can anybody help me figuring out what I'm doing wrong?

Thanks in advance,
Chris

--------------050503080708030903010102
Content-Type: image/gif;
name="MultiObject.gif"
Content-Transfer-Encoding: base64
Content-Disposition: inline;
filename="MultiObject.gif"

R0lGODlhigBdAPcAAAQCBPz+/ERCRAAAAAUcnCPqDwATYgAAACG+qCKUbAA2 hgB+AAANIgCO
eBY3NwB+fg/gYAAPDwAODgAAAAAgqAIAbAAAhgAAAACc4AMP6gBiEwAAACgB mOkA9RMANwAC
ftEAqOUAbIEAhnwAAACeoAACOAEAgQAAAFYBAAAAAAAAAAAAADDMQOj1ZBMT UAAAAEcgAQAg
AABGAAAAAFAgEukAJBMAAQAAGAA07OmH7pE2E3x+AECy4wAOuJILRXwAAP8E YP8QD/8ADv8A
AD0x6AAzuJI4RXwgAG14AOcgAIE5AHwzAAAgGgB4AxYgAAAyAFg0CQMgkABC NwBQfhhQ+RYA
lhcASAAAAJAcnGvqDxYTYgAAAAAohADC6wA3EwB+AH7gKAAP7wAOE8AAAAAg kAAAkwAASAAA
AP+c7P8P7v9iE/8AAP8BAP8AAP8AAP8CAAAB/wAA/wAA/wAA/wDZ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hmNRJto4o4+/1RYj czzuR2SPcWX1
I2dXvZXkiowNKZmLWAJ2WJZc6iXVl2CGKeaYZJZp5plopqnmmmy26eabcMYp 55x01mnnnXjm
qeeefPZpZkAAOw==
--------------050503080708030903010102
Content-Type: text/x-java;
name="MultiObjectBorder.java"
Content-Transfer-Encoding: base64
Content-Disposition: inline;
filename="MultiObjectBorder.java"

cGFja2FnZSBkZS51cGIuZG1tLmVkaXRvci5kaWFncmFtLmN1c3RvbS5lZGl0 LnBhcnRzOwoK
aW1wb3J0IG9yZy5lY2xpcHNlLmRyYXcyZC5BYnN0cmFjdEJvcmRlcjsKaW1w b3J0IG9yZy5l
Y2xpcHNlLmRyYXcyZC5HcmFwaGljczsKaW1wb3J0IG9yZy5lY2xpcHNlLmRy YXcyZC5JRmln
dXJlOwppbXBvcnQgb3JnLmVjbGlwc2UuZHJhdzJkLlJlY3RhbmdsZUZpZ3Vy ZTsKaW1wb3J0
IG9yZy5lY2xpcHNlLmRyYXcyZC5nZW9tZXRyeS5JbnNldHM7CmltcG9ydCBv cmcuZWNsaXBz
ZS5kcmF3MmQuZ2VvbWV0cnkuUG9pbnQ7CmltcG9ydCBvcmcuZWNsaXBzZS5k cmF3MmQuZ2Vv
bWV0cnkuUmVjdGFuZ2xlOwoKcHVibGljIGNsYXNzIE11bHRpT2JqZWN0Qm9y ZGVyIGV4dGVu
ZHMgQWJzdHJhY3RCb3JkZXIgewoKCS8qKgoJICogdGhlICJzaXplIiBvZiB0 aGUgQm9yZGVy
CgkgKi8KCXByaXZhdGUgaW50IG9mZnNldDsKCglwdWJsaWMgTXVsdGlPYmpl Y3RCb3JkZXIo
aW50IG9mZnNldCkgewoJCXRoaXMub2Zmc2V0ID0gb2Zmc2V0OwoJfQoKCXB1 YmxpYyB2b2lk
IHBhaW50KElGaWd1cmUgYUZpZ3VyZSwgR3JhcGhpY3MgZ3JhcGhpY3MsIElu c2V0cyBpbnNl
dHMpIHsKCQl0ZW1wUmVjdC5zZXRCb3VuZHM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YW5n bGVGaWd1cmUg
cmVjdGFuZ2xlRmlndXJlID0gKFJlY3RhbmdsZUZpZ3VyZSkgYUZpZ3VyZTsK CQkJaWYgKHJl
Y3RhbmdsZUZpZ3VyZS5nZXRGb3JlZ3JvdW5kQ29sb3IoKSAhPSBudWxsKSB7 CgkJCQlncmFw
aGljcy5zZXRGb3JlZ3JvdW5kQ29sb3IocmVjdGFuZ2xlRmlndXJlLmdldEZv cmVncm91bmRD
b2xvcigpKTsKCQkJfQoJCQlncmFwaGljcy5zZXRMaW5lV2lkdGgocmVjdGFu Z2xlRmlndXJl
LmdldExpbmVXaWR0aCgpKTsKCQl9CgkJZ3JhcGhpY3MuZHJhd0xpbmUobGVm dExvd2VyLCBs
ZWZ0VXBwZXIpOwoJCWdyYXBoaWNzLmRyYXdMaW5lKGxlZnRVcHBlciwgcmln aHRVcHBlcik7
CgkJZ3JhcGhpY3MuZHJhd0xpbmUocmlnaHRVcHBlciwgcmlnaHRMb3dlcik7 CgkJZ3JhcGhp
Y3MuZHJhd0xpbmUocmlnaHRMb3dlciwgZW5kKTsKCX0KCglAT3ZlcnJpZGUK CXB1YmxpYyBi
b29sZWFuIGlzT3BhcXVlKCkgewoJCXJldHVybiB0cnVlOwoJfQoKCXB1Ymxp YyBJbnNldHMg
Z2V0SW5zZXRzKEBTdXBwcmVzc1dhcm5pbmdzKCJ1bnVzZWQiKSBJRmlndXJl IGFGaWd1cmUp
IHsKCQlyZXR1cm4gbmV3IEluc2V0cygwKTsKLy8JCXJldHVybiBuZXcgSW5z ZXRzKG9mZnNl
dCwgMCwgMCwgb2Zmc2V0KTsKCX0KfQ==
--------------050503080708030903010102--
Re: Problems with Border, setClip() and getInsets() [message #242926 is a reply to message #242872] Wed, 14 May 2008 16:42 Go to previous messageGo to next message
Del Myers is currently offline Del MyersFriend
Messages: 82
Registered: July 2009
Member
I had a similar problem, and I ended up just writing my own Figure for it. That
is a lot easier than trying to create a border. I can probably send you the code
for it, if you like.

Del

chris wrote:
> Hi,
>
> I'm having trouble defining my own border. I'm trying to do something
> like a UML "multi-object" (see attached pic). This works so far, but
> only if I use the setClip method as shown in the attached class (I've
> learned that from some example code). But this seems to be causing
> trouble with repainting in some situations...
>
> In fact, I've seen a message where somebody suggests not to use
> setClip() - returning appropriate Insets shall be the solution.
> Unfortunately, I can't find the message in this newsgroup any more.
>
> So I tried to return Insets as can be seen in the code, but my border
> wouldn't appear, so I switched back to the setClip() solution for now.
>
> Can anybody help me figuring out what I'm doing wrong?
>
> Thanks in advance,
> Chris
>
> ------------------------------------------------------------ ------------
>
Re: Problems with Border, setClip() and getInsets() [message #242936 is a reply to message #242926] Thu, 15 May 2008 05:07 Go to previous message
chris is currently offline chrisFriend
Messages: 72
Registered: July 2009
Member
Hi Del,

that would be awesome. The only problem is that I need to add/remove
that border depending on a boolean attribute of the semantic element -
with your solution, I would have to learn how to exchange the figure of
an EditPart :-)

In fact, I thought it's pretty easy to write a custom border, but this
doesn't seem to be the case - does anybody have a solution to the
original problem?

Thanks,
Chris


Del Myers schrieb:
> I had a similar problem, and I ended up just writing my own Figure for
> it. That is a lot easier than trying to create a border. I can probably
> send you the code for it, if you like.
>
> Del
>
> chris wrote:
>> Hi,
>>
>> I'm having trouble defining my own border. I'm trying to do something
>> like a UML "multi-object" (see attached pic). This works so far, but
>> only if I use the setClip method as shown in the attached class (I've
>> learned that from some example code). But this seems to be causing
>> trouble with repainting in some situations...
>>
>> In fact, I've seen a message where somebody suggests not to use
>> setClip() - returning appropriate Insets shall be the solution.
>> Unfortunately, I can't find the message in this newsgroup any more.
>>
>> So I tried to return Insets as can be seen in the code, but my border
>> wouldn't appear, so I switched back to the setClip() solution for now.
>>
>> Can anybody help me figuring out what I'm doing wrong?
>>
>> Thanks in advance,
>> Chris
>>
>> ------------------------------------------------------------ ------------
>>


--
Olin Miller: "You probably wouldn't worry about what people think of you
if you could know how seldom they do."
Previous Topic:ComboBoxPropertyDescriptor proplem
Next Topic:order icons in pop-up-menu
Goto Forum:
  


Current Time: Thu Nov 14 08:55:55 GMT 2024

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

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

Back to the top