pivot-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Chris Bartlett <cbartlet...@gmail.com>
Subject Re: User resizable panes
Date Sun, 19 Jun 2011 11:01:36 GMT

The JavaDoc comment suggests that setting a SplitPane's 'resizeMode'
property to PRIMARY_REGION should do it.

But I just played around with in the Component Explorer demo, and can't see
a change in behaviour when the resize mode is changed, but that might just
be because of the Container that is is in (a ScrollPane in this particular
http://pivot.apache.org/demos/component-explorer.html   (Layout Containers
-> SplitPane)

If the PRIMARY_REGION resize mode doesn't actually work (perhaps I just
misunderstood the purpose of PRIMARY_REGION?), then it should still be
possible to achieve what you want without too much effort.  (I dont't have
the source code in front of me right now, but will check it later.)

My first idea was to use a SplitPaneListener to listen for the
'splitRatioChanged' events.  The listener would would resize the target
Component & SplitPane, and adjust the 'splitRatio' as required.  Although
that might work, I think the user experience would not be good due to all
the resizing.

It might be easier to subclass SplitPane and associate it with a custom
SplitPaneSkin (based on the existing
org.apache.pivot.wtk.skin.terra.TerraSplitPaneSkin class).
Your custom skin would keep the mouse handling & splitter painting code from
TerraSplitPaneSkin , but just change what happens when the splitter is
dragged.  So rather than changing the 'splitRatio', it would resize the
'target' Component (and SplitPane itself) as the splitter handle is dragged

Another option would be to use a TablePane as the Container for your 2
 (This method would be quick and easy if the 'splitter' size only ever
changes programmatically, but it is probably too much work to build in the
changes based on use/mouse input.)
For the vertical layout orientation, you would create 1 column and 2 rows.
 One row would have a relative height of '1*', meaning that it would use all
space available to it.  The other would have a relative height of '-1',
meaning that it would just use the size required for the Component in the
row.  You could use 2 columns, and 1 row for a horizontal layout
The TablePane would handle the actual sizing for you, but you would need to
handle the mouse events yourself as well as the painting of the 'spliiter


2011/6/19 Piotr Kołaczkowski <pkolaczk@ii.pw.edu.pl>

> Hi,
> In Pivot 2.0, is there a way  to create a component with one edge thick
> just like the splitter in the SplitPane, so that when user drags this edge,
> the component resizes appropriately, but only this component and not the
> other one that is above/below/left/right?
> Imagine two components, one placed over another, in a single Expander (but
> it can be a BoxPane, Border or whatever):
> ===================
> Expander title
> -----------------------------
> Vertically resizable component
> ------------++--------------
> Fixed size component
> ===================
> I want the edge denoted by ---++--- to act very much like a traditional
> SplitPane, except that
> it doesn't resize the bottom component. So of course, when the user drags
> it, the total height of the container holding the two components also
> changes.
> If it is not possible to do that with the draggable splitter in the middle,
> I would be also satisfied with a solution, that the bottom edge of the
> expander can be resized, like this:
> ===================
> Expander title
> -----------------------------
> Resizable component 1
> ----------------------------
> Fixed size component 2
> =======++==========
> I tried that with SplitPane, by simply setting minimum, maximum and
> preferredHeight of the bottom component to the same value, but it seems to
> ignore this, and it also doesn't resize the container. :(
> Thank you and best regards,
> Piotr
> --
> Piotr Kołaczkowski
> Instytut Informatyki, Politechnika Warszawska
> Nowowiejska 15/19, 00-665 Warszawa
> e-mail: pkolaczk@ii.pw.edu.pl
> www: http://home.elka.pw.edu.pl/~pkolaczk/

View raw message