Skip to content

Commit

Permalink
Quickfix protegeproject#723 by caching the mouse position of MList
Browse files Browse the repository at this point in the history
  • Loading branch information
ykazakov committed Jan 18, 2019
1 parent 6beb3a6 commit 970b7b0
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,6 @@ public String getName() {

private MListCellRenderer ren;


private boolean mouseDown;

private List<MListButton> editAndDeleteButtonList = Arrays.asList(editButton, deleteButton);
Expand All @@ -77,6 +76,8 @@ public String getName() {

private List<MListButton> deleteButtonList = Arrays.asList(deleteButton);

private Point lastMousePosition;

public int lastMousePositionCellIndex = -1;


Expand Down Expand Up @@ -154,9 +155,9 @@ private void handleMouseMoved() {
if (dirty != null) {
repaint(dirty);
}
Point pt = MList.this.getMousePosition();
if (pt != null) {
lastMousePositionCellIndex = MList.this.locationToIndex(pt);
lastMousePosition = super.getMousePosition();
if (lastMousePosition != null) {
lastMousePositionCellIndex = MList.this.locationToIndex(lastMousePosition);
}
else {
lastMousePositionCellIndex = -1;
Expand All @@ -168,6 +169,12 @@ private void handleMouseMoved() {
}
}

@Override
public Point getMousePosition() {
// use the cache mouse position to avoid performance problems, see #723
return lastMousePosition;
}

protected String getRowName(Object rowObject) {
return null;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -490,7 +490,7 @@ private void setupLinkedObjectComponent(JComponent component, Rectangle cellRect
}
if (component instanceof LinkedObjectComponent && OWLRendererPreferences.getInstance().isRenderHyperlinks()) {
linkedObjectComponent = (LinkedObjectComponent) component;
Point mouseLoc = component.getMousePosition(true);
Point mouseLoc = component.getMousePosition();
if (mouseLoc == null) {
linkedObjectComponent.setLinkedObject(null);
return;
Expand Down

0 comments on commit 970b7b0

Please sign in to comment.