<AWT Dev> [9] Review Request: 8027324 The spec for Toolkit.setDynamicLayout() and Toolkit.isDynamicLayoutActive() needs to be clarified

Phil Race philip.race at oracle.com
Tue Mar 22 20:05:51 UTC 2016


On 03/22/2016 12:45 PM, Sergey Bylokhov wrote:
> On 22.03.16 22:21, Phil Race wrote:
>> I don't get how JCK detected this problem unless there is a
>> manual test that was verified visually
>
> This is the automated test, which sets the flag to false and expects 
> that on OSX isDynamicLayoutActive() will also return false.
>
>> but here is what I
>> think you want the spec. to say :-
>>
>>     /**
>>       * Returns whether dynamic layout of Containers on resize is 
>> currently
>>       * enabled on the underlying operating system and/or window 
>> manager).
>>       * If the platform supports it, {@code 
>> setDynamicLayout(boolean)} may
>>       * be used to programmatically enable or disable platform dynamic
>> layout.
>>       * Regardless of whether that toggling is supported, or whether
>> {@code true}
>>       * or {@code false} is specified as an argument, or has never been
>> called at
>>       * all, this method will return the active current platform
>> behavior and which
>>       * will be followed by the JDK in determining layout policy during
>> resizing.
>
> This is a similar text to the specification of setDynamicLayout(),

Yes, I suppose it is.
> should we copy it to isDynamicLayoutActive() or can I add a link?

I suppose an @see [for a specification of the behaviour] would be fine.
Why don't you give that a go and we'll see if the result seems to need
any tweaks.


> Or I can remove this text in braces:
> "(both set in program
>      *( {@code isDynamicLayoutSet()} )
>      *, and supported
>      * by the underlying operating system and/or window manager)"
>
> It seems that "Returns whether dynamic layout of Containers on resize 
> is currently active or not" should be enough. All other information 
> already provided in other methods.
>

I think a subset of the words I used :-

       * Returns whether dynamic layout of Containers on resize is 
currently
       * enabled on the underlying operating system and/or window manager)
       * and which will be followed by the JDK in determining layout 
policy during resizing.

are clearer and the rest should be covered by @see so people can then know
they must read the docs on at least the setXX method to see how that  is 
involved.

-phil

>>       * <p>
>>       * If dynamic layout is currently inactive then Containers
>>       * re-layout their components when resizing is completed. As a 
>> result
>>       * the {@code Component.validate()} method will be invoked only
>>       * once per resize.
>>       * If dynamic layout is currently active then Containers
>>       * re-layout their components on every native resize event and
>>       * the {@code validate()} method will be invoked each time.
>>       * The OS/WM support can be queried using
>>       * the getDesktopProperty("awt.dynamicLayoutSupported") method.
>>       * This property will reflect the platform capability but is
>>       * not sufficient to tell if it is presently enabled.
>> ...
>>
>> If this sounds right then we would need to make sure the other docs
>> clearly support this interpretation.
>>
>> And it seems messy that if you want to find out if you can
>> change the behaviour programmatically, you need to
>> call setDynamicLayout(true) and setDynamicLayout(false) and
>> after each then call isDynamicLayoutActive() and
>> compare results to see if it made any difference ..
>
> true.
>
>>
>> -phil.
>>
>>
>> On 03/22/2016 11:50 AM, Sergey Bylokhov wrote:
>>> On 22.03.16 21:12, Phil Race wrote:
>>>> On 03/22/2016 11:01 AM, Sergey Bylokhov wrote:
>>>>>>
>>>>>> That flag is used to determine the behaviour of
>>>>>> isDynamicLayoutActive()
>>>>>> If it is set to "false" then isDynamicLayoutActive() will always
>>>>>> return
>>>>>> false,
>>>>>> (regardless of what the underlying platform is doing)
>>>>>> If it is set to "true" then isDynamicLayoutActive() will will 
>>>>>> consult
>>>>>> the desktop property which is *supposed* to reflect the platform
>>>>>> support
>>>>>> and so should agree with what the desktop property says.
>>>>>
>>>>> Nope, the isDynamicLayoutActive() always returns the current status.
>>>>> It cannot return true if this feature is unsupported by the OS, 
>>>>> but it
>>>>> can return true if the user sets the flag to false, but the OS cannot
>>>>> disable the feature.
>>>>
>>>> In that case I don't think the old wording or your current 
>>>> re-wording is
>>>> correct.
>>>
>>> That's actually a problem how to describe it.
>>>
>>>> The latter looks like this :-
>>>>
>>>> 11 * Returns whether dynamic layout of Containers on resize is 
>>>> currently
>>>> 212 * active (both set in program ({@code isDynamicLayoutSet()}), and
>>>> supported
>>>> ^^^^^^
>>>>   213 * by the underlying operating system and/or window manager). 
>>>> That
>>>> "and" means *both* conditions must be true for this to return true,
>>>
>>> Both conditions(flag + os_support) must be true if the OS can change
>>> the current status. But if the native system cannot change the status
>>> then the flag will be skipped.
>>>
>>>> whereas you are telling me that even if I call setDynamicLayout(false)
>>>> it might return true. -phil. -
>>>>
>>>>
>>>
>>>
>>
>
>



More information about the awt-dev mailing list