I’ve found some small bug or inconsistency in DF. I’m using a CFocusListener on each dockable to determine if it got selected or deselected. This works most of the time, except in one case.
Say, I have 3 stacked dockables and the size of the window is not large enough to display all dockables in the dock title -> the overflow menu is visible and contains the two docks which could not be displayed.
If I click on the Overflow menu, the current dockable doesn’t get the focus and doesn’t get selected.
If I choose one of the dockables from the Overflow menu, the dockable is shown but again not selected.
If I click on any shown dockable the events are fired correct.
Could you please check, what wrong there?
Or is there an other way to determine or to get informed which dockable got selected and deselected?
I need this functionality to keep track of the selected and deselected dockables.
I’ve tried it with the latest DF version 1.1.2p2b and version 1.1.2p1h.
Here is how I use the CFocusListener (only as example):
DefaultSingleCDockable dock = (DefaultSingleCDockable)cControl.getSingleDockable(dockID);
dock.addFocusListener(new CFocusListener() {
@Override
public void focusLost (CDockable paramCDockable) {
fireDeselected(dockID);
}
@Override
public void focusGained (CDockable paramCDockable) {
fireSelected(dockID);
}
});
I need to track or redirect the selected events because one of our applications has a lot of views. If there is a data change the views will be updated. This can be very time consuming so only visible views should be updated. If an invisible view is made visible the view should do the update.
I have tried the location listener, seems to work fine with one little exception. If I select a dockable from the overflow menu which is not visible, the view is made visible but no event is fired.
If you could fix this, my problem would be solved.
Looks strange, clicking on a tab or in the menu should trigger the same code… I’ll have a closer look during the weekend, why the LocationListener is not triggered when you select something from the overflow menu.
The whole issue was caused by a listener that was not properly added to the StackDockComponent (I did write “removeStackDockComponentListener” instead of “addStackDockComponentListener”…). In the next version both the Location-Listener and the Focus-Listener will be triggered when using the menu.
I’ll upload the new version tomorrow (3.February), because I have another open issue to resolve (completely unrelated to this bug).