|
From: <be...@us...> - 2006-11-29 19:06:12
|
Revision: 106
http://svn.sourceforge.net/jtreemap/?rev=106&view=rev
Author: benoitx
Date: 2006-11-29 11:06:07 -0800 (Wed, 29 Nov 2006)
Log Message:
-----------
Fixed a couple of issues whereby NPE could be generated.
Modified Paths:
--------------
trunk/JTreeMap/src/main/java/net/sf/jtreemap/swing/DefaultToolTip.java
trunk/JTreeMap/src/main/java/net/sf/jtreemap/swing/JTreeMap.java
trunk/JTreeMap/src/main/java/net/sf/jtreemap/swing/provider/RedGreenColorProvider.java
trunk/KTreeMap/qalab.xml
Modified: trunk/JTreeMap/src/main/java/net/sf/jtreemap/swing/DefaultToolTip.java
===================================================================
--- trunk/JTreeMap/src/main/java/net/sf/jtreemap/swing/DefaultToolTip.java 2006-11-29 00:50:25 UTC (rev 105)
+++ trunk/JTreeMap/src/main/java/net/sf/jtreemap/swing/DefaultToolTip.java 2006-11-29 19:06:07 UTC (rev 106)
@@ -49,7 +49,7 @@
private static final int DEFAULT_VALUE_SIZE = 10;
- private static final int DEFAULT_LABEL_SIZE = 14;
+ private static final int DEFAULT_LABEL_SIZE = 12;
private static final long serialVersionUID = -2492627777999093973L;
Modified: trunk/JTreeMap/src/main/java/net/sf/jtreemap/swing/JTreeMap.java
===================================================================
--- trunk/JTreeMap/src/main/java/net/sf/jtreemap/swing/JTreeMap.java 2006-11-29 00:50:25 UTC (rev 105)
+++ trunk/JTreeMap/src/main/java/net/sf/jtreemap/swing/JTreeMap.java 2006-11-29 19:06:07 UTC (rev 106)
@@ -191,7 +191,7 @@
* item to draw
*/
protected void draw(final Graphics g, final TreeMapNode item) {
- if (item.isLeaf()) {
+ if (item.isLeaf() && item.getValue() != null) {
g.setColor(this.colorProvider.getColor(item.getValue()));
g.fillRect(item.getX(), item.getY(), item.getWidth(), item.getHeight());
} else {
@@ -582,12 +582,12 @@
* @author Ekin Gulen
*/
protected class HandleMouseClick extends MouseAdapter {
-
+
@Override
public void mouseClicked(MouseEvent e) {
if (e.getButton() == MouseEvent.BUTTON1 && e.getClickCount() == 1) {
final TreeMapNode t = getDisplayedRoot().getChild(e.getX(), e.getY());
- if ( t != null && !t.isLeaf()) {
+ if (t != null && !t.isLeaf()) {
if (treeView == null) {
zoom(t);
} else {
@@ -595,12 +595,12 @@
// dont know why below does not work so for now leave it commented out
// treeView.setSelectionPath(new TreePath(t.getPath()));
}
-
+
} else {
if (treeView == null) {
- zoom((TreeMapNode)getDisplayedRoot().getParent());
+ zoom((TreeMapNode) getDisplayedRoot().getParent());
} else {
- zoom((TreeMapNode)getDisplayedRoot().getParent());
+ zoom((TreeMapNode) getDisplayedRoot().getParent());
// dont know why below does not work so for now leave it commented out
//treeView.setSelectionPath(new TreePath(((TreeMapNode)getDisplayedRoot().getParent()).getPath()));
}
@@ -609,9 +609,7 @@
}
}
}
-
-
-
+
/**
* Class who zoom and unzoom the JTreeMap.
*
Modified: trunk/JTreeMap/src/main/java/net/sf/jtreemap/swing/provider/RedGreenColorProvider.java
===================================================================
--- trunk/JTreeMap/src/main/java/net/sf/jtreemap/swing/provider/RedGreenColorProvider.java 2006-11-29 00:50:25 UTC (rev 105)
+++ trunk/JTreeMap/src/main/java/net/sf/jtreemap/swing/provider/RedGreenColorProvider.java 2006-11-29 19:06:07 UTC (rev 106)
@@ -86,7 +86,7 @@
setMaxValue(this.jTreeMap.getRoot());
}
- final double dValeur = (value !=null ? value.getValue() : 0.00);
+ final double dValeur = (value != null ? value.getValue() : 0.00);
int colorIndex = (int) (COLOUR_MAX_VALUE * Math.abs(dValeur) / this.maxAbsValue.getValue());
@@ -128,7 +128,7 @@
private void setMaxValue(final TreeMapNode root) {
if (root.isLeaf()) {
final Value value = root.getValue();
- if (this.maxAbsValue == null || Math.abs(value.getValue()) > this.maxAbsValue.getValue()) {
+ if (value != null && (this.maxAbsValue == null || Math.abs(value.getValue()) > this.maxAbsValue.getValue())) {
try {
final Class c = value.getClass();
if (this.maxAbsValue == null || this.minVal == null) {
@@ -204,8 +204,8 @@
}
g.setColor(Color.black);
- g.drawString(RedGreenColorProvider.this.maxAbsValue.getLabel(),
- Legend.X + (xCursor - 1) * Legend.WIDTH, Legend.Y - Y_INSET);
+ g.drawString(RedGreenColorProvider.this.maxAbsValue.getLabel(), Legend.X + (xCursor - 1) * Legend.WIDTH, Legend.Y
+ - Y_INSET);
}
}
}
Modified: trunk/KTreeMap/qalab.xml
===================================================================
--- trunk/KTreeMap/qalab.xml 2006-11-29 00:50:25 UTC (rev 105)
+++ trunk/KTreeMap/qalab.xml 2006-11-29 19:06:07 UTC (rev 106)
@@ -379,6 +379,9 @@
<result date="2006-11-10" statvalue="47" type="checkstyle"/>
<result date="2006-11-10" statvalue="1" type="findbugs"/>
<result date="2006-11-10" statvalue="1" type="findbugs"/>
+ <result date="2006-11-29" statvalue="1" type="findbugs"/>
+ <result date="2006-11-29" statvalue="1" type="findbugs"/>
+ <result date="2006-11-29" statvalue="1" type="findbugs"/>
<result date="2006-11-29" statvalue="47" type="checkstyle"/>
<result date="2006-11-29" statvalue="1" type="findbugs"/>
<result date="2006-11-29" statvalue="1" type="findbugs"/>
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|