From: <ste...@us...> - 2010-08-16 19:48:39
|
Revision: 1392 http://rails.svn.sourceforge.net/rails/?rev=1392&view=rev Author: stefanfrey Date: 2010-08-16 19:48:31 +0000 (Mon, 16 Aug 2010) Log Message: ----------- Fixed toolTip update issue (tooltip did not update after undos) Modified Paths: -------------- trunk/18xx/rails/ui/swing/hexmap/GUIHex.java trunk/18xx/rails/ui/swing/hexmap/HexMap.java Modified: trunk/18xx/rails/ui/swing/hexmap/GUIHex.java =================================================================== --- trunk/18xx/rails/ui/swing/hexmap/GUIHex.java 2010-08-16 19:06:47 UTC (rev 1391) +++ trunk/18xx/rails/ui/swing/hexmap/GUIHex.java 2010-08-16 19:48:31 UTC (rev 1392) @@ -224,7 +224,7 @@ currentTileOrientation = model.getCurrentTileRotation(); currentGUITile = new GUITile(currentTileId, this); currentGUITile.setRotation(currentTileOrientation); - setToolTip(); + toolTip = null; model.addObserver(this); @@ -661,7 +661,10 @@ } public String getToolTip() { - return toolTip; + if (toolTip != null) + return toolTip; + else + return getDefaultToolTip(); } @@ -682,7 +685,7 @@ return tt.toString(); } - protected void setToolTip() { + private String getDefaultToolTip() { StringBuffer tt = new StringBuffer("<html>"); tt.append("<b>Hex</b>: ").append(hexName); String name = model.getCityName(); @@ -754,7 +757,7 @@ tt.append("</html>"); - toolTip = tt.toString(); + return tt.toString(); } public boolean dropTile(int tileId, boolean upgradeMustConnect) { @@ -786,7 +789,7 @@ public void removeTile() { provisionalGUITile = null; setSelected(false); - setToolTip(); + toolTip = null; } public boolean canFixTile() { @@ -804,18 +807,18 @@ public void fixTile() { setSelected(false); - setToolTip(); + toolTip = null; } public void removeToken() { provisionalGUIToken = null; setSelected(false); - setToolTip(); + toolTip = null; } public void fixToken() { setSelected(false); - setToolTip(); + toolTip = null; } /** Needed to satisfy the ViewObject interface. Currently not used. */ Modified: trunk/18xx/rails/ui/swing/hexmap/HexMap.java =================================================================== --- trunk/18xx/rails/ui/swing/hexmap/HexMap.java 2010-08-16 19:06:47 UTC (rev 1391) +++ trunk/18xx/rails/ui/swing/hexmap/HexMap.java 2010-08-16 19:48:31 UTC (rev 1392) @@ -561,10 +561,11 @@ public void mouseReleased(MouseEvent arg0) {} public void updateOffBoardToolTips() { - for (GUIHex hex : hexes) { - if (hex.getHexModel().hasOffBoardValues()) { - hex.setToolTip(); - } - } +// for (GUIHex hex : hexes) { +// if (hex.getHexModel().hasOffBoardValues()) { +// hex.setToolTip(); +// } +// } + // do nothing as tooltip update before display } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |