Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/gui/NavigatableComponent.java
r10395 r10405 315 315 316 316 protected void updateLocationState() { 317 if ( SwingUtilities.getWindowAncestor(this) != null && isShowing()) {317 if (isVisibleOnScreen()) { 318 318 state = state.usingLocation(this); 319 319 } 320 } 321 322 protected boolean isVisibleOnScreen() { 323 return SwingUtilities.getWindowAncestor(this) != null && isShowing(); 320 324 } 321 325 -
trunk/test/unit/org/openstreetmap/josm/gui/NavigatableComponentTest.java
r10402 r10405 9 9 import java.awt.geom.Point2D; 10 10 11 import javax.swing.J Frame;11 import javax.swing.JPanel; 12 12 13 13 import org.CustomMatchers; … … 32 32 public class NavigatableComponentTest { 33 33 34 private final class NavigatableComponentMock extends NavigatableComponent { 35 @Override 36 public Point getLocationOnScreen() { 37 return new Point(30, 40); 38 } 39 40 @Override 41 protected boolean isVisibleOnScreen() { 42 return true; 43 } 44 } 45 34 46 private static final int HEIGHT = 200; 35 47 private static final int WIDTH = 300; … … 48 60 @Before 49 61 public void setUp() { 50 component = new NavigatableComponent() { 51 @Override 52 public Point getLocationOnScreen() { 53 return new Point(30, 40); 54 } 55 }; 62 component = new NavigatableComponentMock(); 56 63 component.setBounds(new Rectangle(WIDTH, HEIGHT)); 57 64 // wait for the event to be propagated. … … 62 69 }); 63 70 component.setVisible(true); 64 J Frame window = new JFrame();65 window.add(component);71 JPanel parent = new JPanel(); 72 parent.add(component); 66 73 component.updateLocationState(); 67 74 }
Note:
See TracChangeset
for help on using the changeset viewer.