Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » GEF » A possibe Bug in draw2d Label
A possibe Bug in draw2d Label [message #211543] Mon, 13 March 2006 23:42 Go to next message
Eclipse UserFriend
Originally posted by: ytgyazilim.gmail.com

Label has its invalidation code as follows.

public void invalidate() {
prefSize = null;
minSize = null;
clearLocations();
textSize = null;
subStringTextSize = null;
subStringText = null;
Figure.super.invalidate();
}

I hate it but do not have the time to throughly investigate it. But
although minsize is not critical for internal text size calculations it
is nulled out together with other stuff.

I think the primal contract is if the programmer tells the figure its
preferred size and minimum size, this overrides even the layout manager
and other internals it has.

But in Label invalidate erases this information. So label cannot be
tamed. So programmer has no way of telling the label its preferred and /
or min size...

I strongly think this is a bug.
....unless draw2d guys think otherwise?

Hasan
Re: A possibe Bug in draw2d Label [message #211660 is a reply to message #211543] Tue, 14 March 2006 16:59 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: none.us.ibm.com

This behavior is specific to Label. The pref/min size of a label is a
function of its attributes, not a user setting.

"H.Ceylan" <ytgyazilim@gmail.com> wrote in message
news:dv503t$dfp$1@utils.eclipse.org...
> Label has its invalidation code as follows.
>
> public void invalidate() {
> prefSize = null;
> minSize = null;
> clearLocations();
> textSize = null;
> subStringTextSize = null;
> subStringText = null;
> Figure.super.invalidate();
> }
>
> I hate it but do not have the time to throughly investigate it. But
> although minsize is not critical for internal text size calculations it
> is nulled out together with other stuff.
>
> I think the primal contract is if the programmer tells the figure its
> preferred size and minimum size, this overrides even the layout manager
> and other internals it has.
>
> But in Label invalidate erases this information. So label cannot be
> tamed. So programmer has no way of telling the label its preferred and /
> or min size...
>
> I strongly think this is a bug.
> ...unless draw2d guys think otherwise?
>
> Hasan
Re: A possibe Bug in draw2d Label [message #211675 is a reply to message #211660] Tue, 14 March 2006 20:07 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: ytgyazilim.gmail.com

HEllo Randy,

Then I think this is a violation of the contract. At least for the
minsize.
Can't you introduce two other private fields to use in
internal calculation and leave the minsize (and prefsize) alone?

Hasan

Randy Hudson wrote:
> This behavior is specific to Label. The pref/min size of a label is a
> function of its attributes, not a user setting.
>
> "H.Ceylan" <ytgyazilim@gmail.com> wrote in message
> news:dv503t$dfp$1@utils.eclipse.org...
>> Label has its invalidation code as follows.
>>
>> public void invalidate() {
>> prefSize = null;
>> minSize = null;
>> clearLocations();
>> textSize = null;
>> subStringTextSize = null;
>> subStringText = null;
>> Figure.super.invalidate();
>> }
>>
>> I hate it but do not have the time to throughly investigate it. But
>> although minsize is not critical for internal text size calculations it
>> is nulled out together with other stuff.
>>
>> I think the primal contract is if the programmer tells the figure its
>> preferred size and minimum size, this overrides even the layout manager
>> and other internals it has.
>>
>> But in Label invalidate erases this information. So label cannot be
>> tamed. So programmer has no way of telling the label its preferred and /
>> or min size...
>>
>> I strongly think this is a bug.
>> ...unless draw2d guys think otherwise?
>>
>> Hasan
>
>
Re: A possibe Bug in draw2d Label [message #211743 is a reply to message #211675] Wed, 15 March 2006 15:45 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: none.us.ibm.com

We could, but we already have too many fields, and the use case is not
common enough to add more fields.

What API do you think we should have created to allow most figures to
support a configurable preferred/min size, but not special-purpose figures
like Label?

SWT's Shell has a method setLayoutData(). What does that mean?

"H.Ceylan" <ytgyazilim@gmail.com> wrote in message
news:dv77uv$98i$1@utils.eclipse.org...
> HEllo Randy,
>
> Then I think this is a violation of the contract. At least for the
> minsize.
> Can't you introduce two other private fields to use in
> internal calculation and leave the minsize (and prefsize) alone?
>
> Hasan
Re: A possibe Bug in draw2d Label [message #211759 is a reply to message #211743] Wed, 15 March 2006 17:35 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: ytgyazilim.gmail.com

Randy Hudson wrote:
> We could, but we already have too many fields, and the use case is not
> common enough to add more fields.
>
> What API do you think we should have created to allow most figures to
> support a configurable preferred/min size, but not special-purpose figures
> like Label?
>
> SWT's Shell has a method setLayoutData(). What does that mean?
>
> "H.Ceylan" <ytgyazilim@gmail.com> wrote in message
> news:dv77uv$98i$1@utils.eclipse.org...
>> HEllo Randy,
>>
>> Then I think this is a violation of the contract. At least for the
>> minsize.
>> Can't you introduce two other private fields to use in
>> internal calculation and leave the minsize (and prefsize) alone?
>>
>> Hasan
>
>
Well, I think for most of the figures API is there.
I have used most of them and only came across with Label giving me the
hard time.

Following is a use case.
I have the header which is the part of the root edit part's figure
which also has contents pane figure with vertical flow layout.
Then I can add Part1 types to root edit part.
Part1 figures has a left side header of which the border must be aligned
with the headers column1 figure which is the label. but Label shrinks
down to min size.

------------------------------------------------------------ ---
|LABEL | etc. etc. |
------------------------------------------------------------ ---

------------------------------------------------------------ ---
|PartFig1 | PartFig1 contents figure |
| | |
| | |
| | |
------------------------------------------------------------ ---

------------------------------------------------------------ ---
|PartFig1 | PartFig1 contents figure |
| | |
| | |
| | |
------------------------------------------------------------ ---


I know that there is workarounds like encapsulating the Label into a
generic figure which has stacklayout as the layout manager.
Or as I did override the Label's getPreferredSize method to return what
I want to set it to.

But this does not look the way to go.
Trusting the minsize like I did it took me some time to figure out why
label's not responding later, despite the to the setMinSize /
setPreferredsize calls.

At the least setPrefferedsize / setMin size throw notsupported
exceptions so that people do not fall into same sort of waste-of-time
situations like me.

Regards,
Hasan
Re: A possibe Bug in draw2d Label [message #211799 is a reply to message #211759] Wed, 15 March 2006 22:50 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: none.us.ibm.com

That looks like a nested table. We have ideas about writing a table layout,
in which a table cell could contain an additional table which is involved in
column width calculations. Unfortunately we have not had resource to
implement the layout.

> Well, I think for most of the figures API is there.
> I have used most of them and only came across with Label giving me the
> hard time.
>
> Following is a use case.
> I have the header which is the part of the root edit part's figure
> which also has contents pane figure with vertical flow layout.
> Then I can add Part1 types to root edit part.
> Part1 figures has a left side header of which the border must be aligned
> with the headers column1 figure which is the label. but Label shrinks
> down to min size.
>
> ------------------------------------------------------------ ---
> |LABEL | etc. etc. |
> ------------------------------------------------------------ ---
>
> ------------------------------------------------------------ ---
> |PartFig1 | PartFig1 contents figure |
> | | |
> | | |
> | | |
> ------------------------------------------------------------ ---
>
> ------------------------------------------------------------ ---
> |PartFig1 | PartFig1 contents figure |
> | | |
> | | |
> | | |
> ------------------------------------------------------------ ---
>
>
> I know that there is workarounds like encapsulating the Label into a
> generic figure which has stacklayout as the layout manager.
> Or as I did override the Label's getPreferredSize method to return what
> I want to set it to.
>
> But this does not look the way to go.
> Trusting the minsize like I did it took me some time to figure out why
> label's not responding later, despite the to the setMinSize /
> setPreferredsize calls.
>
> At the least setPrefferedsize / setMin size throw notsupported
> exceptions so that people do not fall into same sort of waste-of-time
> situations like me.
>
> Regards,
> Hasan
Re: A possibe Bug in draw2d Label [message #211880 is a reply to message #211799] Thu, 16 March 2006 05:43 Go to previous message
Eclipse UserFriend
Originally posted by: ytgyazilim.gmail.com

Yeah exactly,

I have also thought of writing a layout manager for that
but since a client of mine is pushing too much to pull the deadline to
an earlier day I have not had change to do it.

Actually rather then discovering America twice I had read in the
newsgroup in the past that someone was translating SWT's grid layout
into draw2d. I think that would be way to go.

If you cannot implement / get to this guy , when I am done with my
project I can take the lead on grid layout and do it nd donate it.



Randy Hudson wrote:
> That looks like a nested table. We have ideas about writing a table layout,
> in which a table cell could contain an additional table which is involved in
> column width calculations. Unfortunately we have not had resource to
> implement the layout.
>
>> Well, I think for most of the figures API is there.
>> I have used most of them and only came across with Label giving me the
>> hard time.
>>
>> Following is a use case.
>> I have the header which is the part of the root edit part's figure
>> which also has contents pane figure with vertical flow layout.
>> Then I can add Part1 types to root edit part.
>> Part1 figures has a left side header of which the border must be aligned
>> with the headers column1 figure which is the label. but Label shrinks
>> down to min size.
Previous Topic:Diamond Primitives
Next Topic:How to force Direct Edit?
Goto Forum:
  


Current Time: Fri Apr 26 22:10:57 GMT 2024

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

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

Back to the top