Return-Path: Delivered-To: apmail-pivot-user-archive@www.apache.org Received: (qmail 4283 invoked from network); 18 Mar 2011 14:28:49 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.3) by minotaur.apache.org with SMTP; 18 Mar 2011 14:28:49 -0000 Received: (qmail 7944 invoked by uid 500); 18 Mar 2011 14:28:49 -0000 Delivered-To: apmail-pivot-user-archive@pivot.apache.org Received: (qmail 7925 invoked by uid 500); 18 Mar 2011 14:28:49 -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 7917 invoked by uid 99); 18 Mar 2011 14:28:49 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 18 Mar 2011 14:28:49 +0000 X-ASF-Spam-Status: No, hits=-0.7 required=5.0 tests=FREEMAIL_FROM,RCVD_IN_DNSWL_LOW,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: domain of noelgrandin@gmail.com designates 74.125.82.50 as permitted sender) Received: from [74.125.82.50] (HELO mail-ww0-f50.google.com) (74.125.82.50) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 18 Mar 2011 14:28:41 +0000 Received: by wwc33 with SMTP id 33so3701247wwc.7 for ; Fri, 18 Mar 2011 07:28:20 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:message-id:date:from:user-agent:mime-version:to :subject:references:in-reply-to:content-type :content-transfer-encoding; bh=Oyfo41cFl00ZwZ+c07kIRO6SJ1HXjEA8vJf+d5UmjUM=; b=vChURN97W8N5uJwnjUExlqcGSNfE2gjb0RjuTFNCwM6scnGGDD2Vw3VvRWZvI0YygF jxIZp31Of+vxDoeyONURifwDwU9LlbUO0ZR4NAd8tVDX83VWNIGjjFqkffW2gwXAxd3X HZu73DXnR9gK9oM4irZ3lrMfiCwKkm+1+Z69s= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=message-id:date:from:user-agent:mime-version:to:subject:references :in-reply-to:content-type:content-transfer-encoding; b=EPg47keV6ZDxINKJnDC762LIPrRa0ZCEWerw+kpghz+YWJSvK6oNe66JCPFgj2xr8s fQK5UiztSC5DtjUML0y8ipJLrOVRTM8+3e+XPHBd+Zg1ouC2k1aCDvcMyrnMu7S/iZ+z NDaG3h9SFeMR5GD+iYXtMkf4p6OUgbChaAZdc= Received: by 10.216.135.230 with SMTP id u80mr2348550wei.114.1300458500059; Fri, 18 Mar 2011 07:28:20 -0700 (PDT) Received: from [192.168.1.243] (196-215-30-133.dynamic.isadsl.co.za [196.215.30.133]) by mx.google.com with ESMTPS id bd8sm1393827wbb.52.2011.03.18.07.28.17 (version=TLSv1/SSLv3 cipher=OTHER); Fri, 18 Mar 2011 07:28:18 -0700 (PDT) Message-ID: <4D836C00.2080807@gmail.com> Date: Fri, 18 Mar 2011 16:28:16 +0200 From: Noel Grandin User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.8) Gecko/20051201 Thunderbird/1.5 Mnenhy/0.7.3.0 MIME-Version: 1.0 To: Greg Brown , Pivot User Subject: Re: The patchwork that is Pivot layout References: <4D831C36.6000308@gmail.com> <4D835EEF.8010907@gmail.com> <4A246DB7-FD48-41B3-BDD0-EE06BCC94282@verizon.net> In-Reply-To: <4A246DB7-FD48-41B3-BDD0-EE06BCC94282@verizon.net> Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Greg Brown wrote: >>>> At the moment, the "fill" style of BoxPane is doing double duty. >>>> It means two things for a vertical boxpane >>>> (1) make the component fill the available width if the component is smaller than the boxpane width >>>> (2) if the components preferred width is greater than the available width, cut off the component. >>> Actually, in #2 the component isn't simply clipped to the box pane's width - it is given its constrained preferred height. This gives the component a chance to wrap its content, which wouldn't be possible without the fill style (we need a width to constrain against). >>> >> Yeah, but we want to give components the chance to wrap even if fill is false, which is not currently the case. > In order to wrap, a component needs a width constraint. The "fill" flag allows us to use the width of the BoxPane as this constraint. Otherwise, how would we know what the wrap width should be? The only other way to do it would be to assign an explicit preferred width to the component. > In layout(), we have a width constraint we could use, which is the width that has been allocated to us. Similarly in getPreferredHeight(int). I already prototyped this, so I know it solves Bill's problem. (but I haven't implemented a complete solution yet). >>>> Border could do with having alignment and fill styles, which is a fairly straightforward change and would make this >>>> class more useful. >>> It could, but I'm not sure how much value that might really offer. How often do you want to put something in a border that doesn't completely fill the internal space of the border? Probably not that often, and when you do, you can use BoxPane, TablePane, ScrollPane, etc. >>> >> Alignment and fill would affect how the bordered component sits within the space allocated by the parent container. So >> if I wrap a component in a border and put it inside something else, I don't necessarily want it to fill the space within >> it's parent. > That sounds similar to what Bill described. But, as I mentioned earlier, Pivot doesn't define horizontal or vertical alignment properties on the Component class. Layout customization properties are defined by the container, not the child component. The only input a child component has into the layout process is preferred size. > ImageViewSkin and LabelSkin already have "child" properties like this. So we have precedent. I implemented something similar in BorderSkin as an exercise. Pretty straightforward. I'm just waiting on the outcome of this discussion to see if I should check it in. I agree that this is (minor) violation of the DRY principle, but I like my libraries to have some redundancy, especially when it eases the life of client programmers. Regards, Noel.