[SOLVED] DocumentPane: detect when a tab is selected

Discuss here any questions about the WebLaF library.
Bugs can be posted directly to GitHub issues tracker.

[SOLVED] DocumentPane: detect when a tab is selected

Postby petermacgonagan » Sun Sep 13, 2015 7:37 am

Hello,

How to detect when the user has selected an another Tab in a DocumentPane, please?
I've tried pane.addFocusListener(new FocusListener() { ... without success.

Is it normal that when I change the title of a DocumentData (linked to the tab of DocumentPane), the title is not refreshed? I've tried: invalidate, repaint, etc.

Thank you :D
petermacgonagan
 
Posts: 9
Joined: Wed Sep 03, 2014 10:57 pm

Re: DocumentPane: detect when a tab is selected

Postby mgarin » Sun Sep 13, 2015 3:58 pm

First of all - make sure to use pre-release v1.29 version instead of v1.28. You can find it here:
http://weblookandfeel.com/downloads/prerelease/
It has a lot of changes and overall improvements including improvements for WebDocumentPane.

To track tab selection (and some other events) there is a special listener:
Code: Select all
        final WebDocumentPane pane = new WebDocumentPane (  );
        pane.addDocumentListener ( new DocumentListener ()
        {
            @Override
            public void opened ( final DocumentData document, final PaneData pane, final int index )
            {
               
            }

            @Override
            public void selected ( final DocumentData document, final PaneData pane, final int index )
            {

            }

            @Override
            public boolean closing ( final DocumentData document, final PaneData pane, final int index )
            {
                return true;
            }

            @Override
            public void closed ( final DocumentData document, final PaneData pane, final int index )
            {

            }
        } );


There is also another listener that informs about other WebDocumentPane events:
Code: Select all
        pane.addDocumentPaneListener ( new DocumentPaneListener ()
        {
            public void splitted ( WebDocumentPane documentPane, PaneData splittedPane, SplitData newSplitData )
            {
               
            }

            public void merged ( WebDocumentPane documentPane, SplitData mergedSplit, StructureData newStructureData )
            {

            }

            public void orientationChanged ( WebDocumentPane documentPane, SplitData splitData )
            {

            }

            public void sidesSwapped ( WebDocumentPane documentPane, SplitData splitData )
            {

            }

            public void dividerLocationChanged ( WebDocumentPane documentPane, SplitData splitData )
            {

            }
        } );
User avatar
mgarin
Site Admin
 
Posts: 223
Joined: Mon Apr 16, 2012 1:01 pm
Location: Russia, Saint-Petersburg

Re: DocumentPane: detect when a tab is selected

Postby mgarin » Tue Nov 24, 2015 6:05 pm

I guess the case was solved, so i'll mark it solved for now.
User avatar
mgarin
Site Admin
 
Posts: 223
Joined: Mon Apr 16, 2012 1:01 pm
Location: Russia, Saint-Petersburg


Return to Questions

Who is online

Users browsing this forum: No registered users and 2 guests

cron