Draggable tabs

Sven Reimers sven.reimers at gmail.com
Tue Mar 20 05:33:26 PDT 2012


Hi,

great addition!

Could you attach your patch to the issue
(http://javafx-jira.kenai.com/browse/RT-20477)? That would make it
easier to test this already.

>From my point of view this could be an initial step for
http://javafx-jira.kenai.com/browse/RT-20477 (docking framework)

How about not just reordering the tabs in one tab pane, but to allow
for dragging one tab to another tab pane?

Sven

On Tue, Mar 20, 2012 at 1:30 AM, Jonathan Giles
<jonathan.giles at oracle.com> wrote:
> Martin,
>
> It sounds like you got everything you wanted by just editing the OpenJFX
> code. This pleases me immensely - this is, from what I can tell, the first
> time anyone has done this for OpenJFX!
>
> In terms of considering your changes for inclusion into OpenJFX, it begins
> by considering submitting an OCA: http://openjdk.java.net/contribute/
>
> Once you've done that, feel free to contact me off-list and we can work
> through the process of reviewing the patch for possible inclusion into
> OpenJFX.
>
> -- Jonathan
>
>
>
> On 20/03/2012 12:28 p.m., martin at percossi.com wrote:
>>
>> Hello Jonathan,
>>
>> I have filed two feature requests, RT-20476 and RT-20477. It's the first
>> time I've done this, so I may have gotten something wrong. The first
>> essentially proposes making a mouse *press* select a tab, rather than a
>> mouse *click*. RT-20477 references RT-20476 and requests the tab dragging
>> functionality.
>>
>> I've also implemented both of the requests; the results are satisfactory
>> for my purposes. I won't bore you with the details, but I think I'd need to
>> refactor the code for it to be "admissible". E.g. I use the controller
>> containing the tab pane to intercept and forward the relevant new events
>> (MOUSE_PRESSED, MOUSE_DRAG, MOUSE_RELEASED) rather than changing TabPane.
>> There's a couple of other things that I had to change (in TabPaneSkin), but
>> I did make an effort to keep a minimal footprint on the code.
>>
>> Just to mention in passing, I've also made a slight alteration to the
>> layoutChildren() method in TabPaneSkin which allows the tab pane headers to
>> overlap slightly (the amount currently is 13 pixels, and it's rather
>> shabbily hard-wired but that's easy to fix). That change makes use of the of
>> the StackPane created (and anonymously implemented) in the constructor of
>> TabPaneSkin to handle the front-to-back layout correctly, so you get the
>> effect of tabs overlapping each other slightly, which I think looks nice.
>> And you don't need to alter the components graphics components used by
>> TabPaneSkin -- all you need is essentially a map from tab header to it's
>> "index".
>>
>> I'm happy to furnish you with my code for review, but I'll probably have
>> to ask an expert on the TabPane code a couple of questions to make sure I
>> didn't screw anything up. If you do want my code in some shape or form just
>> let me know.
>>
>> Kind regards,
>> Martin
>>
>> -----Original Message-----
>> From: "Jonathan Giles"<jonathan.giles at oracle.com>
>> Sent: Thursday, March 15, 2012 4:50pm
>> To: martin at percossi.com
>> Cc: openjfx-dev at openjdk.java.net
>> Subject: Re: Draggable tabs
>>
>>
>> On 16/03/2012 5:25 a.m., martin at percossi.com wrote:
>>>
>>> My question: if I'm not mistaken, javafx.scene.control.Tab is not
>>> draggable. I'd like to be able to obtain the same behaviour as e.g. Chrome,
>>> where tabs can be rearranged by dragging the "handle". (At some point in the
>>> future, I want to extend this into a full-featured docking framework, where
>>> tabs can be pulled out of the main window and thereby create a new window.
>>> But we're getting ahead of ourselves.) I'd appreciate any pointers on how
>>> best to implement this functionality.
>>
>> I would imagine writing your own solution would be quite difficult, as
>> the nodes are not exposed via any API. You could possibly find the node
>> via a lookup() call, but even then I'm not sure you'll get the visuals
>> you want.
>>
>> If you are happy to wait, the best approach to get the TabPane/Tab API
>> to support this would be to file a feature request on the Jira tracker
>> at http://javafx-jira.kenai.com.
>>
>> If you are wanting this sooner, another option (after filing the Jira
>> RFE above) would be if you downloaded OpenJFX, reviewed the TabPaneSkin
>> source code, and added support in there directly. You could then provide
>> the patch to the OpenJFX project via the Jira issue and it could
>> possibly be integrated into a future release of JavaFX.
>>>
>>> Second question (speculative): Is it possible to get a "raw" window
>>> handle (i.e. in Microsoft Windows)? Basically, if you're writing a VST
>>> plugin host, you need to provide a parent window handle within which the VST
>>> plugin can stuff its GUI. In the worst case, this would create an entirely
>>> new window, but ideally, I would be able to get a raw window handle and
>>> "place" the GUI into some part of the JavaFX GUI. Am I asking for too much?
>>> ;)
>>
>> I'll leave this to the glass team to answer.
>>
>> -- Jonathan



-- 
Sven Reimers

* Senior System Engineer and Software Architect
* NetBeans Dream Team Member: http://dreamteam.netbeans.org
* NetBeans Governance Board Member: http://netbeans.org/about/os/governance.html
* Community Leader  NetBeans: http://community.java.net/netbeans
                              Desktop Java:
http://community.java.net/javadesktop
* Duke's Choice Award Winner 2009
* Blog: http://nbguru.blogspot.com

* XING: https://www.xing.com/profile/Sven_Reimers8
* LinkedIn: http://www.linkedin.com/in/svenreimers

Join the NetBeans Groups:
* XING: http://www.xing.com/group-20148.82db20
* NUGM: http://haug-server.dyndns.org/display/NUGM/Home
* LinkedIn: http://www.linkedin.com/groups?gid=1860468
                   http://www.linkedin.com/groups?gid=107402
                   http://www.linkedin.com/groups?gid=1684717
* Oracle: https://mix.oracle.com/groups/18497


More information about the openjfx-dev mailing list