Wrong foreground when already unfocused fixed

This commit is contained in:
Nadya Zabrodina
2014-11-27 17:01:12 +03:00
parent 195377ae63
commit c689a0c511
2 changed files with 15 additions and 6 deletions
@@ -159,6 +159,17 @@ public class PushLog extends JPanel implements TypeSafeDataProvider {
updateChangesView();
}
});
myTree.addFocusListener(new FocusAdapter() {
@Override
public void focusLost(FocusEvent e) {
DefaultMutableTreeNode node = (DefaultMutableTreeNode)myTree.getLastSelectedPathComponent();
if (node != null && node instanceof RepositoryNode && myTree.isEditing()) {
//need to force repaint foreground for non-focused editing node
myTree.getCellEditor().getTreeCellEditorComponent(myTree, node, true, false, false, myTree.getRowForPath(
TreeUtil.getPathFromRoot(node)));
}
}
});
myTree.getInputMap().put(KeyStroke.getKeyStroke(KeyEvent.VK_F2, 0), START_EDITING);
//override default tree behaviour.
myTree.getInputMap().put(KeyStroke.getKeyStroke(KeyEvent.VK_ENTER, 0), "");
@@ -161,7 +161,10 @@ public class RepositoryWithBranchPanel<T extends PushTarget> extends NonOpaquePa
if (bounds != null) {
setPreferredSize(new Dimension(tree.getVisibleRect().width - bounds.x, bounds.height));
}
myDestPushTargetPanelComponent.requestFocus();
if (myTextRenderer.getTree().hasFocus()) {
//delegate focus from tree to editable component if needed
myDestPushTargetPanelComponent.requestFocus(true);
}
revalidate();
return this;
}
@@ -218,11 +221,6 @@ public class RepositoryWithBranchPanel<T extends PushTarget> extends NonOpaquePa
return myCheckBoxLoadingIconGapV;
}
public int getVBorderOffset(@NotNull SimpleColoredComponent coloredRenderer) {
Border border = coloredRenderer.getMyBorder();
return border != null ? border.getBorderInsets(coloredRenderer).top : 0;
}
public int getCheckBoxHeight() {
return myCheckBoxHeight;
}