public void focusLost(final FocusEvent e) { if (myPanel.getProject().isDisposed()) { myPanel.setContextComponent(null); myPanel.hideHint(); return; } final DialogWrapper dialog = DialogWrapper.findInstance(e.getOppositeComponent()); shouldFocusEditor = dialog != null; if (dialog != null) { Disposer.register( dialog.getDisposable(), new Disposable() { @Override public void dispose() { if (dialog.getExitCode() == DialogWrapper.CANCEL_EXIT_CODE) { shouldFocusEditor = false; } } }); } // required invokeLater since in current call sequence KeyboardFocusManager is not initialized // yet // but future focused component //noinspection SSBasedInspection SwingUtilities.invokeLater( new Runnable() { public void run() { processFocusLost(e); } }); }
public void focusLost(FocusEvent e) { Object objFocus = e.getSource(); boolean bSaveCmd = false; if (objFocus instanceof DataField) { DataField compFocus = (DataField) objFocus; Component comp = e.getOppositeComponent(); if (comp instanceof JButton) { String strTxt = ((JButton) comp).getText(); if (strTxt != null && strTxt.equals(WGlobal.SAVEUSER)) bSaveCmd = true; } // if the focus is not in the panel then write the file. /*if ((comp == null || !m_pnlDisplay.equals(comp.getParent())) && !bSaveCmd) { String strPrevValue = compFocus.getValue(); String strTxt = compFocus.getText(); if (!strPrevValue.equals(strTxt)) { // save the data by writing it to the file AppIF appIf = Util.getAppIF(); if (appIf instanceof VAdminIF) ((VAdminIF)appIf).getUserToolBar().doSave(); compFocus.setValue(strTxt); } }*/ } }
public void focusGained(final FocusEvent e) { if (e.getOppositeComponent() == null && shouldFocusEditor) { shouldFocusEditor = false; ToolWindowManager.getInstance(myPanel.getProject()).activateEditorComponent(); return; } myPanel.updateItems(); final List<NavBarItem> items = myPanel.getItems(); if (!myPanel.isInFloatingMode() && items.size() > 0) { myPanel.setContextComponent(items.get(items.size() - 1)); } else { myPanel.setContextComponent(null); } }
private void processFocusLost(FocusEvent e) { final Component opposite = e.getOppositeComponent(); if (myPanel.isInFloatingMode() && opposite != null && DialogWrapper.findInstance(opposite) != null) { myPanel.hideHint(); return; } final boolean nodePopupInactive = !myPanel.isNodePopupActive(); boolean childPopupInactive = !JBPopupFactory.getInstance().isChildPopupFocused(myPanel); if (nodePopupInactive && childPopupInactive) { if (opposite != null && opposite != myPanel && !myPanel.isAncestorOf(opposite) && !e.isTemporary()) { myPanel.setContextComponent(null); myPanel.hideHint(); } } myPanel.updateItems(); }