diff --git a/core/src/main/java/edu/umd/cs/piccolo/PNode.java b/core/src/main/java/edu/umd/cs/piccolo/PNode.java index df2c769..67ab489 100644 --- a/core/src/main/java/edu/umd/cs/piccolo/PNode.java +++ b/core/src/main/java/edu/umd/cs/piccolo/PNode.java @@ -3159,6 +3159,18 @@ parent = (PNode) in.readObject(); } + // **************************************************************** + // Debugging - methods for debugging + // **************************************************************** + + /** + * Returns a string representation of this object for debugging purposes. + */ + public String toString() { + String result = super.toString().replaceAll(".*\\.", ""); + return result + "[" + paramString() + "]"; + } + /** * Returns a string representing the state of this node. This method is * intended to be used only for debugging purposes, and the content and @@ -3166,10 +3178,34 @@ * returned string may be empty but may not be null. * * @return a string representation of this node's state - * @deprecated */ - protected final String paramString() { - return "this Method (paramString) is deprecated and will go away in the next release."; + protected String paramString() { + StringBuffer result = new StringBuffer(); + + result.append("bounds=" + (bounds == null ? "null" : bounds.toString())); + result.append(",fullBounds=" + (fullBoundsCache == null ? "null" : fullBoundsCache.toString())); + result.append(",transform=" + (transform == null ? "null" : transform.toString())); + result.append(",paint=" + (paint == null ? "null" : paint.toString())); + result.append(",transparency=" + transparency); + result.append(",childrenCount=" + getChildrenCount()); + + if (fullBoundsInvalid) { + result.append(",fullBoundsInvalid"); + } + + if (pickable) { + result.append(",pickable"); + } + + if (childrenPickable) { + result.append(",childrenPickable"); + } + + if (visible) { + result.append(",visible"); + } + + return result.toString(); } public PInputEventListener[] getInputEventListeners() { diff --git a/core/src/main/java/edu/umd/cs/piccolo/nodes/PImage.java b/core/src/main/java/edu/umd/cs/piccolo/nodes/PImage.java index b9d0851..8b74d70 100644 --- a/core/src/main/java/edu/umd/cs/piccolo/nodes/PImage.java +++ b/core/src/main/java/edu/umd/cs/piccolo/nodes/PImage.java @@ -240,4 +240,22 @@ g2.dispose(); return result; } + + /** + * Returns a string representing the state of this node. This method is + * intended to be used only for debugging purposes, and the content and + * format of the returned string may vary between implementations. The + * returned string may be empty but may not be null. + * + * @return a string representation of this node's state + */ + protected String paramString() { + StringBuffer result = new StringBuffer(); + + result.append("image=" + (image == null ? "null" : image.toString())); + result.append(','); + result.append(super.paramString()); + + return result.toString(); + } } diff --git a/core/src/main/java/edu/umd/cs/piccolo/nodes/PPath.java b/core/src/main/java/edu/umd/cs/piccolo/nodes/PPath.java index b4e41ef..e53a841 100644 --- a/core/src/main/java/edu/umd/cs/piccolo/nodes/PPath.java +++ b/core/src/main/java/edu/umd/cs/piccolo/nodes/PPath.java @@ -426,4 +426,28 @@ stroke = PUtil.readStroke(in); path = PUtil.readPath(in); } + + // **************************************************************** + // Debugging - methods for debugging + // **************************************************************** + + /** + * Returns a string representing the state of this node. This method is + * intended to be used only for debugging purposes, and the content and + * format of the returned string may vary between implementations. The + * returned string may be empty but may not be null. + * + * @return a string representation of this node's state + */ + protected String paramString() { + StringBuffer result = new StringBuffer(); + + result.append("path=" + (path == null ? "null" : path.toString())); + result.append(",stroke=" + (stroke == null ? "null" : stroke.toString())); + result.append(",strokePaint=" + (strokePaint == null ? "null" : strokePaint.toString())); + result.append(','); + result.append(super.paramString()); + + return result.toString(); + } } diff --git a/core/src/main/java/edu/umd/cs/piccolo/nodes/PText.java b/core/src/main/java/edu/umd/cs/piccolo/nodes/PText.java index 956337d..abcfcd9 100644 --- a/core/src/main/java/edu/umd/cs/piccolo/nodes/PText.java +++ b/core/src/main/java/edu/umd/cs/piccolo/nodes/PText.java @@ -344,4 +344,27 @@ double height) { recomputeLayout(); } + + // **************************************************************** + // Debugging - methods for debugging + // **************************************************************** + + /** + * Returns a string representing the state of this node. This method is + * intended to be used only for debugging purposes, and the content and + * format of the returned string may vary between implementations. The + * returned string may be empty but may not be null. + * + * @return a string representation of this node's state + */ + protected String paramString() { + StringBuffer result = new StringBuffer(); + + result.append("text=" + (text == null ? "null" : text)); + result.append(",font=" + (font == null ? "null" : font.toString())); + result.append(','); + result.append(super.paramString()); + + return result.toString(); + } } diff --git a/swt/src/main/java/edu/umd/cs/piccolox/swt/PSWTImage.java b/swt/src/main/java/edu/umd/cs/piccolox/swt/PSWTImage.java index 65067c6..6627e88 100644 --- a/swt/src/main/java/edu/umd/cs/piccolox/swt/PSWTImage.java +++ b/swt/src/main/java/edu/umd/cs/piccolox/swt/PSWTImage.java @@ -141,4 +141,27 @@ } } } + + // **************************************************************** + // Debugging - methods for debugging + // **************************************************************** + + /** + * Returns a string representing the state of this node. This method is + * intended to be used only for debugging purposes, and the content and + * format of the returned string may vary between implementations. The + * returned string may be empty but may not be null. + * + * @return a string representation of this node's state + */ + protected String paramString() { + StringBuffer result = new StringBuffer(); + + result.append("image=" + (image == null ? "null" : image.toString())); + + result.append(','); + result.append(super.paramString()); + + return result.toString(); + } } diff --git a/swt/src/main/java/edu/umd/cs/piccolox/swt/PSWTPath.java b/swt/src/main/java/edu/umd/cs/piccolox/swt/PSWTPath.java index 5f6db1e..9794fe2 100644 --- a/swt/src/main/java/edu/umd/cs/piccolox/swt/PSWTPath.java +++ b/swt/src/main/java/edu/umd/cs/piccolox/swt/PSWTPath.java @@ -424,4 +424,27 @@ } setShape(path); } + + // **************************************************************** + // Debugging - methods for debugging + // **************************************************************** + + /** + * Returns a string representing the state of this node. This method is + * intended to be used only for debugging purposes, and the content and + * format of the returned string may vary between implementations. The + * returned string may be empty but may not be null. + * + * @return a string representation of this node's state + */ + protected String paramString() { + StringBuffer result = new StringBuffer(); + + result.append("path=" + (shape == null ? "null" : shape.toString())); + result.append(",strokePaint=" + (strokePaint == null ? "null" : strokePaint.toString())); + result.append(','); + result.append(super.paramString()); + + return result.toString(); + } } \ No newline at end of file