Getting Active Dockable or Top Left Dockable

34 views
Skip to first unread message

darylh...@gmail.com

unread,
Dec 24, 2013, 3:32:00 PM12/24/13
to vldo...@googlegroups.com
Hi, 

Just started using vldocking and so far it has been great. I am creating an app that will allow a user to create ssh sesisons and move them around in a tabbed/docked manner. 

My current issue is adding a new ssh session to the DockingDesktop.

I currently do this 

    public void launchSshSession(SshConnectionConfig sshConfig) {
        TerminalPanel terminalPanel = new TerminalPanel(sshConfig);
        terminalsDesktop.addDockable(terminalPanel);
    }

this will add the new terminal directly below the top left terminal in my current layout. 

I would like it to do one of the following (preferably 1). 

1. Add the new terminal on top of the currently active terminal. 

If I could do something like this, I think it would work great 

        TerminalPanel terminalPanel = new TerminalPanel(sshConfig);
        Dockable active = terminalsDesktop.getActive(); 
        terminalsDesktop.createTab(active, terminalPanel, 0, true);

But the method getActive does not exist. Any way to get the currently active Dockable ? 

2. Alternately I would be ok with adding it on top of the top left dockable, but not sure how to get this either. 


Any ideas ? I am quite sure this is probably possible, but I've been through the tutorials and browsed the javadocs and haven't been able to figure it out yet. 

Thanks, great framework. 
Message has been deleted

Andreas Kuhtz

unread,
Dec 29, 2013, 7:48:29 AM12/29/13
to vldo...@googlegroups.com
Hi,

Doesn't DockingDesktop.getSelectedDockable() return the active Dockable?

Cheers
Andreas

darylh...@gmail.com

unread,
Jan 10, 2014, 9:17:29 PM1/10/14
to vldo...@googlegroups.com
No, it doesn't seem to work. For me it returns null everytime. I took a look at the code and it says 

/** Returns the currently selected dockable, or null if none is selected.
*<p>
* A selected dockable is a dockable whose component contains the keyboard focus.
*/
public Dockable getSelectedDockable() {
return focusHandler.currentDockable;
} I am wondering if my panel for some reason has not registered the "keyboard" focus. So I tried it with one of the Dockable from the tutorial (MyTextEditor), when I put the focus in the text editor, it also returned null). I might have to take a look at the source and see if I can find anything in there.
Reply all
Reply to author
Forward
0 new messages