fix listener adding/removal

This commit is contained in:
millmanorama 2018-03-26 14:06:48 +02:00
parent 78f1028875
commit d98eabb22d
2 changed files with 20 additions and 4 deletions

View File

@ -118,10 +118,6 @@ public final class MessageBrowser extends JPanel implements ExplorerManager.Prov
Bundle.MessageBrowser_DataResultViewerTable_title())); Bundle.MessageBrowser_DataResultViewerTable_title()));
messagesResultPanel.open(); messagesResultPanel.open();
//add listener that maintains correct selection in the Global Actions Context
KeyboardFocusManager.getCurrentKeyboardFocusManager()
.addPropertyChangeListener("focusOwner", focusPropertyListener);
this.tableEM.addPropertyChangeListener(new PropertyChangeListener() { this.tableEM.addPropertyChangeListener(new PropertyChangeListener() {
/** /**
* Listener that pushes selections in the tableEM (the Accounts * Listener that pushes selections in the tableEM (the Accounts
@ -176,6 +172,14 @@ public final class MessageBrowser extends JPanel implements ExplorerManager.Prov
return proxyLookup; return proxyLookup;
} }
@Override
public void addNotify() {
super.addNotify();
//add listener that maintains correct selection in the Global Actions Context
KeyboardFocusManager.getCurrentKeyboardFocusManager()
.addPropertyChangeListener("focusOwner", focusPropertyListener);
}
@Override @Override
public void removeNotify() { public void removeNotify() {
super.removeNotify(); super.removeNotify();

View File

@ -446,6 +446,17 @@ public final class TimeLineTopComponent extends TopComponent implements Explorer
public void componentOpened() { public void componentOpened() {
super.componentOpened(); super.componentOpened();
WindowManager.getDefault().setTopComponentFloating(this, true); WindowManager.getDefault().setTopComponentFloating(this, true);
//add listener that maintains correct selection in the Global Actions Context
KeyboardFocusManager.getCurrentKeyboardFocusManager()
.addPropertyChangeListener("focusOwner", focusPropertyListener);
}
@Override
protected void componentClosed() {
super.componentClosed();
KeyboardFocusManager.getCurrentKeyboardFocusManager()
.removePropertyChangeListener("focusOwner", focusPropertyListener);
} }
@Override @Override
@ -476,6 +487,7 @@ public final class TimeLineTopComponent extends TopComponent implements Explorer
.withZone(TimeLineController.getJodaTimeZone()) .withZone(TimeLineController.getJodaTimeZone())
.toString(zonedFormatter); .toString(zonedFormatter);
return Bundle.TimeLineResultView_startDateToEndDate_text(start, end); return Bundle.TimeLineResultView_startDateToEndDate_text(start, end);
} }
} }