Return-Path: Delivered-To: apmail-pivot-user-archive@www.apache.org Received: (qmail 24262 invoked from network); 26 May 2010 19:56:22 -0000 Received: from unknown (HELO mail.apache.org) (140.211.11.3) by 140.211.11.9 with SMTP; 26 May 2010 19:56:22 -0000 Received: (qmail 31888 invoked by uid 500); 26 May 2010 19:56:22 -0000 Delivered-To: apmail-pivot-user-archive@pivot.apache.org Received: (qmail 31866 invoked by uid 500); 26 May 2010 19:56:22 -0000 Mailing-List: contact user-help@pivot.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: user@pivot.apache.org Delivered-To: mailing list user@pivot.apache.org Received: (qmail 31858 invoked by uid 99); 26 May 2010 19:56:22 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 26 May 2010 19:56:22 +0000 X-ASF-Spam-Status: No, hits=2.2 required=10.0 tests=FREEMAIL_FROM,HTML_MESSAGE,RCVD_IN_DNSWL_NONE,SPF_PASS,T_TO_NO_BRKTS_FREEMAIL X-Spam-Check-By: apache.org Received-SPF: pass (nike.apache.org: domain of cbartlett.x@googlemail.com designates 209.85.212.182 as permitted sender) Received: from [209.85.212.182] (HELO mail-px0-f182.google.com) (209.85.212.182) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 26 May 2010 19:56:15 +0000 Received: by pxi7 with SMTP id 7so3259802pxi.13 for ; Wed, 26 May 2010 12:55:54 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlemail.com; s=gamma; h=domainkey-signature:mime-version:received:received:in-reply-to :references:date:message-id:subject:from:to:content-type; bh=cNkD7jkJ++k5UzT4K5Q3do2h/ru1+h7Q6SVM99DAG98=; b=UYUTmYAsOvX/iCklgtoYYfh3GYnRJD7VxmJ90YiGX8POchfa6a76SyaIlUHd9SA7K6 2jIuj2UrP3KSup4Xh5ktBBR+3bx5umxoPkbqFgaAW4R6N6Hef+NZl1ySHNdWyB/dGR8b AkvEc991/7jOCTMwG4AzHPpO+QsKG5q7T+4TU= DomainKey-Signature: a=rsa-sha1; c=nofws; d=googlemail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type; b=E4h5sff3rBHOHgbYQGMOh6yHPXCnPvUbgq5b/acb+GA7U8nqsfx9WDWkNg/t+1Jn8W kERMa3uXHuMOuKgdOd7yYXWI41mZvkxt2EfkrIcKbokukANRpcNqW8iWzzR8H7t0T+9s LQqFYD8WjXV9PtepM6c20j625Qz7D9dxYi7lk= MIME-Version: 1.0 Received: by 10.115.132.33 with SMTP id j33mr6189465wan.177.1274903754284; Wed, 26 May 2010 12:55:54 -0700 (PDT) Received: by 10.114.78.9 with HTTP; Wed, 26 May 2010 12:55:54 -0700 (PDT) In-Reply-To: References: <7060E2AF-F53C-4650-93A4-CC479CFEF0EA@mac.com> Date: Thu, 27 May 2010 02:55:54 +0700 Message-ID: Subject: Re: Making a org.apache.pivot.wtk.Dialog resizable From: Chris Bartlett To: user@pivot.apache.org Content-Type: multipart/alternative; boundary=0016e648d97e65a016048784a9c9 X-Virus-Checked: Checked by ClamAV on apache.org --0016e648d97e65a016048784a9c9 Content-Type: text/plain; charset=ISO-8859-1 Thanks for the detailed response, Greg. As this is by design, it would be helpful if the WTKX serializer could spit out a warning that the supplied style will be fully or partially ignored due to the absence of preferred widths/heights. > This would invalidate the caller's presumed intention to have the dialog sized automatically. If the code is making assumptions about the caller's intention, which override explicitly provided styling information, then I really think that a warning of some sort should be given. Perhaps I should be thinking of styles more as hints? Chris On Thu, May 27, 2010 at 2:43 AM, Greg Brown wrote: > Just a little more detail - when no explicit size is set, the assumption is > that the caller wants the dialog to be sized automatically based on the > preferred size of its content. Allowing the dialog to be resized in this > case would require applying an explicit preferred size to the dialog such > that further calls to layout() would use the explicitly-set size rather than > the default reported by the window's skin. This would invalidate the > caller's presumed intention to have the dialog sized automatically. > > So, if you want your dialog to be resizable, you just need to set an > explicit preferred size yourself (since this makes it clear that you do not > want the dialog to be sized automatically). If you want your dialog to open > at its default size, you could potentially override open() to clear any > previously explicitly set preferred size and then set it to the value > returned by getPreferredSize(). > > Again, hope this helps. > > Greg > > > On May 26, 2010, at 3:20 PM, Greg Brown wrote: > > > Correct - this is by design. In Pivot, a window's size is defined by its > preferred width and height properties rather than the actual width and > height properties. This is because, like all other components, a window > relies on its parent container (an instance of Display) to set its size. > During layout, DisplaySkin sets the size of the window to its preferred > size, whether explicitly defined by the caller or determined by the window's > skin. When an explicit preferred size is not set, TerraFrameSkin (which > TerraDialogSkin extends) reports a preferred size based on the size of its > content. The "resizable" style is ignored in this case. However, if either > preferred width or height is set, the flag is respected. > > > > This is different from AWT/Swing, which uses the pack() method to size a > window to its content. In Pivot, packing happens automatically when one or > both preferred dimensions is not set. > > > > Hope this helps. > > > > Greg > > > > > > On May 26, 2010, at 12:11 PM, Chris Bartlett wrote: > > > >> I've been struggling for a few hours trying to figure out how to make a > org.apache.pivot.wtk.Dialog resizable. (Using a copy of the 1.5 trunk > refreshed earlier today) > >> > >> Using org.apache.pivot.tutorials.windows.Windows as a base, I > modified 'dialog.wtkx' to include styles="{resizable:true}" in the > Dialog element. > >> > >> This doesn't have any effect unless the preferredWidth and/or > preferredHeight properties are also set. > >> The code in org.apache.pivot.wtk.skin.terra.TerraFrameSkin.mouseMove() > suggests this is deliberate. > >> > >> Am I missing something here as to why the preferred width & height are > relevant, or should this be classified as a bug? > >> IMHO settiing the resizable style should allow the Frame/Dialog to > be resized (unless it is maximized). > >> > >> Regards, > >> > >> Chris > >> > >> > > > > --0016e648d97e65a016048784a9c9 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable
Thanks for the detailed response, Greg.

As th= is is by design, it would be helpful if the WTKX serializer could spit out = a warning that the supplied style will be fully or partially ignored due to= the absence of preferred widths/heights.

> This would invalidate the caller's presumed in= tention to have the dialog sized automatically.
If the code is ma= king assumptions about the caller's intention, which override explicitl= y provided styling information, then I really think that a warning of some = sort should be given.

Perhaps I should be thinking of styles more as hints?

Chris


On Th= u, May 27, 2010 at 2:43 AM, Greg Brown <gkbrown@mac.com> wrote:
Just a little more detail - when no explici= t size is set, the assumption is that the caller wants the dialog to be siz= ed automatically based on the preferred size of its content. Allowing the d= ialog to be resized in this case would require applying an explicit preferr= ed size to the dialog such that further calls to layout() would use the exp= licitly-set size rather than the default reported by the window's skin.= This would invalidate the caller's presumed intention to have the dial= og sized automatically.

So, if you want your dialog to be resizable, you just need to set an explic= it preferred size yourself (since this makes it clear that you do not want = the dialog to be sized automatically). If you want your dialog to open at i= ts default size, you could potentially override open() to clear any previou= sly explicitly set preferred size and then set it to the value returned by = getPreferredSize().

Again, hope this helps.

Greg


On May 26, 2010, at 3:20 PM, Greg Brown wrote:

> Correct - this is by design. In Pivot, a window's size is defined = by its preferred width and height properties rather than the actual width a= nd height properties. This is because, like all other components, a window = relies on its parent container (an instance of Display) to set its size. Du= ring layout, DisplaySkin sets the size of the window to its preferred size,= whether explicitly defined by the caller or determined by the window's= skin. When an explicit preferred size is not set, TerraFrameSkin (which Te= rraDialogSkin extends) reports a preferred size based on the size of its co= ntent. The "resizable" style is ignored in this case. However, if= either preferred width or height is set, the flag is respected.
>
> This is different from AWT/Swing, which uses the pack() method to size= a window to its content. In Pivot, packing happens automatically when one = or both preferred dimensions is not set.
>
> Hope this helps.
>
> Greg
>
>
> On May 26, 2010, at 12:11 PM, Chris Bartlett wrote:
>
>> I've been struggling for a few hours trying to figure out how = to make a =A0 org.apache.pivot.wtk.Dialog =A0 resizable. =A0 (Using a copy = of the 1.5 trunk refreshed earlier today)
>>
>> Using =A0 org.apache.pivot.tutorials.windows.Windows =A0 as a base= , I modified =A0 'dialog.wtkx' =A0 to include =A0 =A0styles=3D"= ;{resizable:true}" =A0 in the Dialog element.
>>
>> This doesn't have any effect unless the =A0 preferredWidth =A0= and/or =A0preferredHeight =A0properties are also set.
>> The code in =A0 org.apache.pivot.wtk.skin.terra.TerraFrameSkin.mou= seMove() =A0 suggests this is deliberate.
>>
>> Am I missing something here as to why the preferred width & he= ight are relevant, or should this be classified as a bug?
>> IMHO settiing the =A0 resizable =A0 style should allow the Frame/D= ialog to be resized (unless it is maximized).
>>
>> Regards,
>>
>> Chris
>>
>>
>


--0016e648d97e65a016048784a9c9--